Compare commits
12 Commits
RaceUI2
...
GiantKartI
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
abbee26708 | ||
|
|
9c6352c867 | ||
|
|
ae1181540d | ||
|
|
df25f9b1fb | ||
|
|
639a173339 | ||
|
|
862113d2a9 | ||
|
|
1285f8c58c | ||
|
|
a9b49305db | ||
|
|
d9581d9f70 | ||
|
|
6a9a1a0e7a | ||
|
|
d3c4dd0b7c | ||
|
|
b48f31d4a0 |
@@ -2,30 +2,23 @@
|
||||
<challenge version="3">
|
||||
<unlock_list list="false"/>
|
||||
<track id="cocoa_temple" laps="3" reverse="false"/>
|
||||
<mode major="single" minor="timetrial"/>
|
||||
<requirements trophies="0"/>
|
||||
<mode major="single" minor="quickrace"/>
|
||||
<requirements trophies="5"/>
|
||||
|
||||
<best>
|
||||
<karts number="1"
|
||||
replay_file="challenge_cocoa_temple_supertux.replay"/>
|
||||
<requirements position="1"/>
|
||||
<karts number="8"/>
|
||||
<requirements position="1" time="125"/>
|
||||
</best>
|
||||
<hard>
|
||||
<karts number="1"
|
||||
replay_file="challenge_cocoa_temple_expert.replay"/>
|
||||
<requirements position="1"/>
|
||||
<karts number="7"/>
|
||||
<requirements position="1" time="160"/>
|
||||
</hard>
|
||||
<medium>
|
||||
<karts number="1"
|
||||
replay_file="challenge_cocoa_temple_intermediate.replay"/>
|
||||
<karts number="6"/>
|
||||
<requirements position="1"/>
|
||||
</medium>
|
||||
<easy>
|
||||
<karts number="1"
|
||||
replay_file="challenge_cocoa_temple_novice.replay"/>
|
||||
<karts number="1"/>
|
||||
<karts number="5"/>
|
||||
<requirements position="1"/>
|
||||
</easy>
|
||||
|
||||
<unlock kart="suzanne"/>
|
||||
</challenge>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<label proportion="1" align="center" text_align="right" I18N="In the multitouch settings screen" text="Buttons scale"/>
|
||||
<div proportion="1" align="center" height="fit" layout="horizontal-row" >
|
||||
<spacer width="40" height="10" />
|
||||
<gauge id="scale" proportion="1" min_value="80" max_value="160"/>
|
||||
<gauge id="scale" proportion="1" min_value="50" max_value="150"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<stkgui>
|
||||
<div x="1%" y="2%" width="98%" height="96%" layout="vertical-row">
|
||||
<div y="2%" width="100%" height="96%" layout="vertical-row">
|
||||
|
||||
<div width="100%" height="40%" layout="vertical-row">
|
||||
<div width="100%" height="25%" layout="vertical-row" >
|
||||
<label id="name" width="100%" text_align="center"/>
|
||||
</div>
|
||||
<!-- This is filled in programmatically -->
|
||||
<box width="100%" height="75%" align="center" layout="vertical-row" padding="1">
|
||||
<box width="98%" height="75%" align="center" layout="vertical-row" padding="1">
|
||||
<list id="current_replay_info" x="0" y="0" width="100%" height="100%"/>
|
||||
</box>
|
||||
</div>
|
||||
@@ -18,8 +18,8 @@
|
||||
</div>
|
||||
|
||||
<div width="64%" height="100%" layout="vertical-row">
|
||||
<div width="95%" align="center" layout="vertical-row" height="50%">
|
||||
<div width="100%" height="fit" layout="horizontal-row" >
|
||||
<div width="95%" align="center" layout="vertical-row" height="fit">
|
||||
<div width="100%" height="40" layout="horizontal-row" >
|
||||
<checkbox width="fit" id="record-race" I18N="Ghost replay info action" text_align="left"/>
|
||||
<spacer width="10"/>
|
||||
<label proportion="1" id="record-race-text" height="100%" text_align="left" I18N="Ghost replay info action" text="Record the race for ghost replay"/>
|
||||
@@ -36,7 +36,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div width="95%" height="40%" align="center">
|
||||
<div width="95%" height="50%" align="center">
|
||||
<buttonbar id="actions" x="0" y="0" height="100%" width="100%" align="center">
|
||||
<icon-button id="start" width="128" height="128"
|
||||
icon="gui/icons/green_check.png"
|
||||
|
||||
@@ -44,8 +44,6 @@ options_language.png by Alayan, based on http://www.languageicon.org/, released
|
||||
|
||||
blue_flag.png, heart.png and red_flag.png by Benau, released under CC-BY-SA 4
|
||||
|
||||
lap_flag.png, modified by Alayan, original by Alina Oleynik from The Noun Project, under CC-BY 3.0
|
||||
|
||||
====
|
||||
|
||||
Glass Skin by Auria, under CC-BY-SA 3+
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 12 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 12 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 12 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 2.2 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 2.2 KiB |
@@ -13,55 +13,50 @@
|
||||
<list id="replay_list" x="0" y="0" width="100%" height="100%"/>
|
||||
</box>
|
||||
|
||||
<tabs id="race_mode" height="6%" max_height="110" x="1%" width="98%" align="center">
|
||||
<tabs id="race_mode" height="6%" max_height="110" x="2%" width="98%" align="center">
|
||||
<icon-button id="tab_time_trial" width="128" height="128" icon="gui/icons/mode_tt.png"
|
||||
I18N="In the ghost replay selection screen" text="Time trial"/>
|
||||
<icon-button id="tab_egg_hunt" width="128" height="128" icon="gui/icons/mode_easter.png"
|
||||
I18N="In the ghost replay selection screen" text="Egg hunt"/>
|
||||
</tabs>
|
||||
|
||||
<spacer width="100%" height="2%" />
|
||||
<spacer width="100%" height="1.5%" />
|
||||
|
||||
<div width="98%" align="center" layout="horizontal-row" height="fit">
|
||||
<div width="60%" height="fit" layout="horizontal-row" >
|
||||
<div width="99%" align="center" layout="horizontal-row" height="fit">
|
||||
<div proportion="1" height="fit" layout="horizontal-row" >
|
||||
<checkbox width="fit" id="best_times_toggle" text_align="left"/>
|
||||
<spacer width="2%" height="fit"/>
|
||||
<label height="100%" text_align="left" I18N="In the ghost replay selection screen" text="Only show the best times"/>
|
||||
</div>
|
||||
<div width="40%" height="fit" layout="horizontal-row" >
|
||||
<div proportion="1" height="fit" layout="horizontal-row" >
|
||||
<checkbox width="fit" id="compare_toggle" text_align="left"/>
|
||||
<spacer width="2%" height="fit"/>
|
||||
<label height="100%" id="compare-toggle-text" text_align="left" I18N="In the ghost replay selection screen" text="Compare replay"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div width="98%" align="center" layout="horizontal-row" height="fit">
|
||||
<div width="60%" height="fit" layout="horizontal-row" >
|
||||
<div width="99%" align="center" layout="horizontal-row" height="fit">
|
||||
<div proportion="2" height="fit" layout="horizontal-row" >
|
||||
<checkbox width="fit" id="replay_difficulty_toggle" text_align="left"/>
|
||||
<spacer width="2%" height="fit"/>
|
||||
<label height="100%" text_align="left" I18N="In the ghost replay selection screen" text="Only show replays matching the current difficulty"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div width="98%" align="center" layout="horizontal-row" height="fit">
|
||||
<div width="60%" height="fit" layout="horizontal-row" >
|
||||
<checkbox width="fit" id="replay_version_toggle" text_align="left"/>
|
||||
<spacer width="2%" height="fit" />
|
||||
<label height="100%" text_align="left" I18N="In the ghost replay selection screen" text="Only show replays matching the current version"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div width="98%" align="center" layout="horizontal-row" height="fit">
|
||||
<div width="60%" height="fit" layout="horizontal-row" >
|
||||
<div proportion="1" height="fit" layout="horizontal-row" >
|
||||
<checkbox width="fit" id="replay_multiplayer_toggle" text_align="left"/>
|
||||
<spacer width="2%" height="fit"/>
|
||||
<label height="100%" text_align="left" I18N="In the ghost replay selection screen" text="Hide multiplayer replays"/>
|
||||
</div>
|
||||
<div width="40%" height="fit" layout="horizontal-row" >
|
||||
<spacer proportion="1" height="5"/>
|
||||
<button width="fit" id="record-ghost" I18N="In the ghost replay selection screen" text="Record a ghost replay"/>
|
||||
</div>
|
||||
|
||||
<div width="99%" align="center" layout="horizontal-row" height="fit">
|
||||
<div proportion="1" height="fit" layout="horizontal-row" >
|
||||
<checkbox width="fit" id="replay_version_toggle" text_align="left"/>
|
||||
<spacer width="1%" height="fit" />
|
||||
<label height="100%" text_align="left" I18N="In the ghost replay selection screen" text="Only show replays matching the current version"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button x="1%" id="record-ghost" I18N="In the ghost replay selection screen" text="Record a ghost replay"/>
|
||||
|
||||
</div>
|
||||
</stkgui>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<checkbox width="fit" id="private_server" text_align="left"/>
|
||||
<spacer width="10"/>
|
||||
<label proportion="1" height="100%" text_align="left"
|
||||
I18N="In the server selection screen" text="Show private server(s)"/>
|
||||
I18N="In the server selection screen" text="Show only private server(s)"/>
|
||||
<checkbox width="fit" id="game_started" text_align="left"/>
|
||||
<spacer width="10"/>
|
||||
<label proportion="1" height="100%" text_align="left"
|
||||
|
||||
@@ -30,26 +30,14 @@
|
||||
|
||||
<!-- ************ SKIN CHOICE ************ -->
|
||||
<div layout="horizontal-row" width="100%" height="fit">
|
||||
<label proportion="1" I18N="In the ui settings" text="Skin" align="center"/>
|
||||
<label I18N="In the ui settings" text="Skin" align="center"/>
|
||||
<spacer width="2%" height="20"/>
|
||||
<div layout="horizontal-row" proportion="5" height="100%">
|
||||
<spinner id="skinchoice" width="60%"/>
|
||||
</div>
|
||||
<spinner id="skinchoice" width="30%"/>
|
||||
</div>
|
||||
|
||||
<spacer width="5" height="2%"/>
|
||||
|
||||
<div layout="horizontal-row" width="100%" height="fit">
|
||||
<label proportion="1" I18N="In the ui settings" text="Minimap" align="center"/>
|
||||
<spacer width="2%" height="20"/>
|
||||
<div layout="horizontal-row" proportion="5" height="100%">
|
||||
<spinner id="minimap" width="60%"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<spacer width="5" height="2%"/>
|
||||
|
||||
<div layout="horizontal-row" width="100%" height="fit">
|
||||
<div layout="horizontal-row" width="100%" height="6%">
|
||||
<checkbox id="showfps"/>
|
||||
<spacer width="1%" height="100%" />
|
||||
<label height="100%" I18N="In the ui settings" text="Display FPS" word_wrap="true"/>
|
||||
@@ -57,7 +45,7 @@
|
||||
|
||||
<spacer width="5" height="2%"/>
|
||||
|
||||
<div layout="horizontal-row" width="100%" height="fit">
|
||||
<div layout="horizontal-row" width="100%" height="6%">
|
||||
<checkbox id="split_screen_horizontally"/>
|
||||
<spacer width="1%" height="100%" />
|
||||
<label height="100%" I18N="In the ui settings" text="Multiplayer splits screen horizontally" word_wrap="true"/>
|
||||
@@ -65,7 +53,7 @@
|
||||
|
||||
<spacer width="5" height="2%"/>
|
||||
|
||||
<div layout="horizontal-row" width="100%" height="fit">
|
||||
<div layout="horizontal-row" width="100%" height="6%">
|
||||
<checkbox id="perPlayerDifficulty"/>
|
||||
<spacer width="1%" height="100%" />
|
||||
<label height="100%" I18N="In the ui settings" text="Enable per-player handicaps" word_wrap="true"/>
|
||||
@@ -73,7 +61,7 @@
|
||||
|
||||
<spacer width="5" height="2%"/>
|
||||
|
||||
<div layout="horizontal-row" width="100%" height="fit">
|
||||
<div layout="horizontal-row" width="100%" height="6%">
|
||||
<checkbox id="enable-internet"/>
|
||||
<spacer width="1%" height="100%" />
|
||||
<label height="100%" I18N="In the ui settings" text="Connect to the Internet" word_wrap="true"/>
|
||||
@@ -81,7 +69,7 @@
|
||||
|
||||
<spacer width="5" height="2%"/>
|
||||
|
||||
<div layout="horizontal-row" width="100%" height="fit">
|
||||
<div layout="horizontal-row" width="100%" height="6%">
|
||||
<checkbox id="enable-hw-report"/>
|
||||
<spacer width="1%" height="100%" />
|
||||
<label height="100%" id="label-hw-report" I18N="In the ui settings"
|
||||
@@ -90,7 +78,7 @@
|
||||
|
||||
<spacer width="5" height="2%"/>
|
||||
|
||||
<div layout="horizontal-row" width="100%" height="fit">
|
||||
<div layout="horizontal-row" width="100%" height="6%">
|
||||
<checkbox id="show-login"/>
|
||||
<spacer width="1%" height="100%" />
|
||||
<label height="100%" I18N="In the ui settings" text="Always show login screen" word_wrap="true"/>
|
||||
@@ -98,7 +86,7 @@
|
||||
|
||||
<spacer width="5" height="2%"/>
|
||||
|
||||
<div layout="horizontal-row" width="100%" height="fit">
|
||||
<div layout="horizontal-row" width="100%" height="6%">
|
||||
<checkbox id="enable-lobby-chat"/>
|
||||
<spacer width="1%" height="100%" />
|
||||
<label height="100%" id="label-lobby-chat" I18N="In the ui settings" text="Enable chatting in networking lobby" word_wrap="true"/>
|
||||
|
||||
@@ -7,117 +7,89 @@
|
||||
|
||||
<spacer width="1" height="2%"/>
|
||||
|
||||
<div width="100%" height="73%" layout="horizontal-row">
|
||||
<!-- Left pane -->
|
||||
<div width="34%" height="100%" layout="vertical-row">
|
||||
<icon-button width="100%" height="55%" id="screenshot" custom_ratio="1.33333"/>
|
||||
<box width="100%" height="40%" padding="10" layout="horizontal-row">
|
||||
<!-- Left pane -->
|
||||
<div proportion="1" height="100%" layout="vertical-row">
|
||||
<icon-button proportion="1" width="100%" height="100%" id="screenshot" custom_ratio="1.33333"/>
|
||||
</div>
|
||||
<!-- Right pane -->
|
||||
<div proportion="1" height="100%" layout="vertical-row">
|
||||
<label id="highscores" width="100%" text_align="center" text="= Highscores ="/>
|
||||
|
||||
<spacer width="1" height="2%"/>
|
||||
|
||||
<!-- Misc. info box -->
|
||||
<box width="100%" height="43%" padding="10" layout="vertical-row">
|
||||
<spacer width="1" height="20%"/>
|
||||
<label id="author" width="100%" text_align="center" word_wrap="true"/>
|
||||
<spacer width="1" height="20%"/>
|
||||
<label id="max-arena-players" width="100%" text_align="center" word_wrap="true"/>
|
||||
<spacer width="1" height="20%"/>
|
||||
</box>
|
||||
</div>
|
||||
|
||||
<spacer width="2%" height="1"/>
|
||||
|
||||
<div width="64%" height="100%" layout="vertical-row">
|
||||
<!-- Right pane -->
|
||||
<box width="100%" height="55%" padding="10" layout="vertical-row">
|
||||
<label id="highscores" width="100%" text_align="center" text="= Highscores ="/>
|
||||
|
||||
<spacer width="1" height="2%"/>
|
||||
|
||||
<div width="95%" height="fit" layout="horizontal-row">
|
||||
<icon id="iconscore1" icon="gui/icons/random_kart.png" width="font" height="font"/>
|
||||
<spacer width="2%" height="1"/>
|
||||
<label id="highscore1" proportion="1" text="(Empty)"/>
|
||||
</div>
|
||||
|
||||
<spacer width="1" height="2%"/>
|
||||
|
||||
<div width="95%" height="fit" layout="horizontal-row">
|
||||
<icon id="iconscore2" icon="gui/icons/random_kart.png" width="font" height="font"/>
|
||||
<spacer width="2%" height="1"/>
|
||||
<label id="highscore2" proportion="1" text="(Empty)"/>
|
||||
</div>
|
||||
|
||||
<spacer width="1" height="2%"/>
|
||||
|
||||
<div width="95%" height="fit" layout="horizontal-row">
|
||||
<icon id="iconscore3" icon="gui/icons/random_kart.png" width="font" height="font"/>
|
||||
<spacer width="2%" height="1"/>
|
||||
<label id="highscore3" proportion="1" text="(Empty)"/>
|
||||
</div>
|
||||
|
||||
<spacer width="1" height="2%"/>
|
||||
|
||||
<div width="95%" height="fit" layout="horizontal-row">
|
||||
<icon id="iconscore4" icon="gui/icons/random_kart.png" width="font" height="font"/>
|
||||
<spacer width="2%" height="1"/>
|
||||
<label id="highscore4" proportion="1" text="(Empty)"/>
|
||||
</div>
|
||||
|
||||
<spacer width="1" height="2%"/>
|
||||
|
||||
<div width="95%" height="fit" layout="horizontal-row">
|
||||
<icon id="iconscore5" icon="gui/icons/random_kart.png" width="font" height="font"/>
|
||||
<spacer width="2%" height="1"/>
|
||||
<label id="highscore5" proportion="1" text="(Empty)"/>
|
||||
</div>
|
||||
</box><!-- Highscores box -->
|
||||
<div width="95%" height="fit" layout="horizontal-row">
|
||||
<icon id="iconscore1" icon="gui/icons/random_kart.png" width="font" height="font"/>
|
||||
<spacer width="2%" height="1"/>
|
||||
<label id="highscore1" proportion="1" text="(Empty)"/>
|
||||
</div>
|
||||
|
||||
<spacer width="1" height="2%"/>
|
||||
<!-- Race options box -->
|
||||
<box width="100%" height="43%" layout="vertical-row">
|
||||
<div width="100%" height="fit" layout="horizontal-row" >
|
||||
<div proportion="1" height="fit" layout="horizontal-row">
|
||||
<spinner id="lap-spinner" width="100%" min_value="1" max_value="20" align="center"
|
||||
wrap_around="true" />
|
||||
</div>
|
||||
<spacer width="3%"/>
|
||||
<label id="lap-text" proportion="4" I18N="In the track info screen" text="Number of laps" text_align="left"/>
|
||||
</div>
|
||||
<spacer width="1" height="2%"/>
|
||||
<div width="100%" height="fit" layout="horizontal-row" >
|
||||
<div proportion="1" height="fit" layout="horizontal-row">
|
||||
<spinner id="ai-spinner" width="100%" min_value="1" max_value="20" align="center"
|
||||
wrap_around="true" />
|
||||
</div>
|
||||
<spacer width="3%"/>
|
||||
<label id="ai-text" proportion="4" I18N="In the track info screen" text="Number of AI karts" text_align="left"/>
|
||||
</div>
|
||||
<spacer width="1" height="2%"/>
|
||||
<div width="100%" height="fit" layout="horizontal-row" >
|
||||
<div proportion="1" height="fit" layout="horizontal-row">
|
||||
<div width="100%" height="fit" text-align="center" layout="vertical-row" >
|
||||
<checkbox id="option" align="center"/>
|
||||
</div>
|
||||
</div>
|
||||
<spacer width="3%"/>
|
||||
<label id="option-text" proportion="4" I18N="In the track info screen" text_align="left"/>
|
||||
</div>
|
||||
<spacer width="1" height="2%"/>
|
||||
<div width="100%" height="fit" layout="horizontal-row" >
|
||||
<div proportion="1" height="fit" layout="horizontal-row">
|
||||
<div width="100%" height="fit" text-align="center" layout="vertical-row" >
|
||||
<checkbox id="record" align="center"/>
|
||||
</div>
|
||||
</div>
|
||||
<spacer width="3%"/>
|
||||
<label id="record-race-text" proportion="4" I18N="In the track info screen" text="Record the race for ghost replay" text_align="left"/>
|
||||
</div>
|
||||
</box><!-- Race options box -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div width="95%" height="fit" layout="horizontal-row">
|
||||
<icon id="iconscore2" icon="gui/icons/random_kart.png" width="font" height="font"/>
|
||||
<spacer width="2%" height="1"/>
|
||||
<label id="highscore2" proportion="1" text="(Empty)"/>
|
||||
</div>
|
||||
|
||||
<spacer width="1" height="2%"/>
|
||||
|
||||
<div width="95%" height="fit" layout="horizontal-row">
|
||||
<icon id="iconscore3" icon="gui/icons/random_kart.png" width="font" height="font"/>
|
||||
<spacer width="2%" height="1"/>
|
||||
<label id="highscore3" proportion="1" text="(Empty)"/>
|
||||
</div>
|
||||
|
||||
<spacer width="1" height="2%"/>
|
||||
|
||||
<label id="author" width="100%" text_align="center" word_wrap="true"/>
|
||||
|
||||
<spacer width="1" height="10%"/>
|
||||
<label id="max-arena-players" width="100%" text_align="center" word_wrap="true"/>
|
||||
</div>
|
||||
|
||||
</box>
|
||||
<spacer width="1" height="1%"/>
|
||||
<box width="100%" height="33%" layout="vertical-row">
|
||||
<div width="100%" height="fit" layout="horizontal-row" >
|
||||
<label id="lap-text" proportion="1" I18N="In the track info screen" text="Number of laps" text_align="right"/>
|
||||
<spacer width="40"/>
|
||||
<div proportion="1" height="fit" layout="horizontal-row">
|
||||
<spinner id="lap-spinner" width="50%" min_value="1" max_value="20" align="center"
|
||||
wrap_around="true" />
|
||||
</div>
|
||||
</div>
|
||||
<spacer width="1" height="1%"/>
|
||||
<div width="100%" height="fit" layout="horizontal-row" >
|
||||
<label id="ai-text" proportion="1" I18N="In the track info screen" text="Number of AI karts" text_align="right"/>
|
||||
<spacer width="40"/>
|
||||
<div proportion="1" height="fit" layout="horizontal-row">
|
||||
<spinner id="ai-spinner" width="50%" min_value="1" max_value="20" align="center"
|
||||
wrap_around="true" />
|
||||
</div>
|
||||
</div>
|
||||
<spacer width="1" height="1%"/>
|
||||
<div width="100%" height="fit" layout="horizontal-row" >
|
||||
<label id="option-text" proportion="1" I18N="In the track info screen" text_align="right"/>
|
||||
<spacer width="40"/>
|
||||
<div proportion="1" height="fit" layout="horizontal-row">
|
||||
<div width="50%" height="fit" text-align="center" layout="vertical-row" >
|
||||
<checkbox id="option" align="center"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<spacer width="1" height="1%"/>
|
||||
<div width="100%" height="fit" layout="horizontal-row" >
|
||||
<label id="record-race-text" proportion="1" I18N="In the track info screen" text="Record the race for ghost replay" text_align="right"/>
|
||||
<spacer width="40"/>
|
||||
<div proportion="1" height="fit" layout="horizontal-row">
|
||||
<div width="50%" height="fit" text-align="center" layout="vertical-row" >
|
||||
<checkbox id="record" align="center"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</box>
|
||||
<spacer width="1" height="1%"/>
|
||||
|
||||
<buttonbar id="buttons" height="17%" width="100%" align="center">
|
||||
<icon-button id="start" width="64" height="64" icon="gui/icons/green_check.png"
|
||||
I18N="In the track info screen" text="Start Race"/>
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
The actual turn radius is piece-wise linearly interpolated. This
|
||||
allows for tighter turning at lower speeds, and also avoids that
|
||||
the kart becomes too hard to control at high speed (speeds of
|
||||
higher than 25 can only be reached with powerups).
|
||||
higher than 23 can only be reached with powerups).
|
||||
time-full-steer: This is the amount of change in steering depending
|
||||
on current steering. So if the steering is between 0 and 0.5,
|
||||
the time-for-steering-change is 0.15. If the current steering is
|
||||
@@ -243,6 +243,16 @@
|
||||
<zipper duration="3.5" force="250.0" speed-gain="4.5" max-speed-increase="15"
|
||||
fade-out-time="1.0" />
|
||||
|
||||
<!-- Super
|
||||
duration: Time super-size is active.
|
||||
force: Additional engine force.
|
||||
max-speed-increase: Additional speed allowed on top of the
|
||||
kart-specific maximum kart speed.
|
||||
fade-out-time: determines how long it takes for super-size's speed boost
|
||||
to fade out (after 'time'). -->
|
||||
<super duration="10" force="800.0" max-speed-increase="3"
|
||||
fade-out-time="0.5" />
|
||||
|
||||
<!-- Swatter
|
||||
duration: How long can the swatter be active.
|
||||
distance: How close a kart or an item must be before it can be hit.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
151
data/powerup.xml
151
data/powerup.xml
@@ -1,6 +1,7 @@
|
||||
<?xml version="1.0"?>
|
||||
<powerup>
|
||||
<item name="zipper" icon="zipper_collect.png" />
|
||||
<item name="super" icon="super_size.png" />
|
||||
<item name="bowling" icon="bowling-icon.png"
|
||||
model="bowling.spm" speed="4.0"
|
||||
min-height="0.2" max-height="1.0"
|
||||
@@ -131,112 +132,112 @@
|
||||
<!-- The entry for '1' kart lists more than a single weight
|
||||
because the others are used for interpolation when
|
||||
there are two karts or more. -->
|
||||
<!-- bubble cake bowl zipper plunger switch swattr rubber para anvil -->
|
||||
<weight single ="140 0 300 100 225 75 160 0 0 0"
|
||||
multi =" 0 0 0 0 0 0 0 0 0 0" />
|
||||
<weight single ="150 0 295 130 200 70 135 0 0 0"
|
||||
multi =" 0 0 20 0 0 0 0 0 0 0" />
|
||||
<weight single ="150 0 310 135 180 65 135 0 0 0"
|
||||
multi =" 0 0 25 0 0 0 0 0 0 0" />
|
||||
<weight single ="155 0 280 180 170 60 125 0 0 0"
|
||||
multi =" 0 0 30 0 0 0 0 0 0 0" />
|
||||
<weight single ="170 0 180 275 150 50 85 0 0 0"
|
||||
multi =" 0 0 90 0 0 0 0 0 0 0" />
|
||||
<!-- bubble cake bowl zipper plunger switch swattr rubber super para anvil -->
|
||||
<weight single ="140 0 300 100 225 75 160 0 0 0 0"
|
||||
multi =" 0 0 0 0 0 0 0 0 0 0 0" />
|
||||
<weight single ="150 0 295 130 200 70 135 0 0 0 0"
|
||||
multi =" 0 0 20 0 0 0 0 0 0 0 0" />
|
||||
<weight single ="150 0 310 135 180 65 135 0 0 0 0"
|
||||
multi =" 0 0 25 0 0 0 0 0 0 0 0" />
|
||||
<weight single ="155 0 280 180 170 60 125 0 0 0 0"
|
||||
multi =" 0 0 30 0 0 0 0 0 0 0 0" />
|
||||
<weight single ="170 0 180 275 150 50 85 0 0 0 0"
|
||||
multi =" 0 0 90 0 0 0 0 0 0 0 0" />
|
||||
</weights>
|
||||
<weights num-karts="5">
|
||||
<!-- bubble cake bowl zipper plunger switch swattr rubber para anvil -->
|
||||
<weight single ="130 80 260 75 230 60 165 0 0 0"
|
||||
multi =" 0 0 0 0 0 0 0 0 0 0" />
|
||||
<weight single ="150 135 240 125 140 50 135 0 0 0"
|
||||
multi =" 0 0 25 0 0 0 0 0 0 0" />
|
||||
<weight single ="150 135 225 135 135 45 135 15 0 0"
|
||||
multi =" 0 0 25 0 0 0 0 0 0 0" />
|
||||
<weight single ="160 120 140 190 110 35 100 80 30 0"
|
||||
multi =" 0 0 35 0 0 0 0 0 0 0" />
|
||||
<weight single ="140 105 45 225 0 30 0 50 90 0"
|
||||
multi =" 40 0 80 175 20 0 0 0 0 0" />
|
||||
<!-- bubble cake bowl zipper plunger switch swattr rubber super para anvil -->
|
||||
<weight single ="130 80 260 75 230 60 165 0 0 0 0"
|
||||
multi =" 0 0 0 0 0 0 0 0 0 0 0" />
|
||||
<weight single ="150 135 240 125 140 50 135 0 0 0 0"
|
||||
multi =" 0 0 25 0 0 0 0 0 0 0 0" />
|
||||
<weight single ="150 135 225 135 135 45 135 15 0 0 0"
|
||||
multi =" 0 0 25 0 0 0 0 0 0 0 0" />
|
||||
<weight single ="160 120 140 190 110 35 100 80 0 30 0"
|
||||
multi =" 0 0 35 0 0 0 0 0 0 0 0" />
|
||||
<weight single ="110 100 45 205 0 30 0 50 120 90 0"
|
||||
multi =" 40 0 80 110 20 0 0 0 0 0 0" />
|
||||
</weights>
|
||||
<weights num-karts="9">
|
||||
<!-- bubble cake bowl zipper plunger switch swattr rubber para anvil -->
|
||||
<weight single ="120 60 290 50 270 40 170 0 0 0"
|
||||
multi =" 0 0 0 0 0 0 0 0 0 0" />
|
||||
<weight single ="145 150 225 120 160 35 135 0 0 0"
|
||||
multi =" 0 0 30 0 0 0 0 0 0 0" />
|
||||
<weight single ="150 130 205 140 130 30 130 50 0 0"
|
||||
multi =" 0 0 35 0 0 0 0 0 0 0" />
|
||||
<weight single ="165 115 130 225 70 25 80 60 40 0"
|
||||
multi =" 0 0 60 0 30 0 0 0 0 0" />
|
||||
<weight single ="100 80 35 185 0 15 0 20 75 0"
|
||||
multi =" 90 0 90 290 20 0 0 0 0 0" />
|
||||
<!-- bubble cake bowl zipper plunger switch swattr rubber super para anvil -->
|
||||
<weight single ="120 60 290 50 270 40 170 0 0 0 0"
|
||||
multi =" 0 0 0 0 0 0 0 0 0 0 0" />
|
||||
<weight single ="145 150 225 120 160 35 135 0 0 0 0"
|
||||
multi =" 0 0 30 0 0 0 0 0 0 0 0" />
|
||||
<weight single ="150 130 205 140 130 30 130 50 0 0 0"
|
||||
multi =" 0 0 35 0 0 0 0 0 0 0 0" />
|
||||
<weight single ="165 115 130 225 70 25 80 60 0 40 0"
|
||||
multi =" 0 0 60 0 30 0 0 0 0 0 0" />
|
||||
<weight single =" 85 75 30 195 0 15 0 20 170 75 0"
|
||||
multi =" 75 0 75 165 20 0 0 0 0 0 0" />
|
||||
</weights>
|
||||
<weights num-karts="14">
|
||||
<!-- bubble cake bowl zipper plunger switch swattr rubber para anvil -->
|
||||
<weight single ="110 40 320 25 300 30 175 0 0 0"
|
||||
multi =" 0 0 0 0 0 0 0 0 0 0" />
|
||||
<weight single ="140 155 240 110 170 20 135 0 0 0"
|
||||
multi =" 0 0 30 0 0 0 0 0 0 0" />
|
||||
<weight single ="150 125 210 145 145 15 120 50 0 0"
|
||||
multi =" 0 0 40 0 0 0 0 0 0 0" />
|
||||
<weight single ="135 105 115 220 60 15 70 40 30 0"
|
||||
multi =" 40 0 80 40 50 0 0 0 0 0" />
|
||||
<weight single =" 90 70 15 175 0 0 0 0 50 0"
|
||||
multi ="120 0 125 325 30 0 0 0 0 0" />
|
||||
<!-- bubble cake bowl zipper plunger switch swattr rubber super para anvil -->
|
||||
<weight single ="110 40 320 25 300 30 175 0 0 0 0"
|
||||
multi =" 0 0 0 0 0 0 0 0 0 0 0" />
|
||||
<weight single ="140 155 240 110 170 20 135 0 0 0 0"
|
||||
multi =" 0 0 30 0 0 0 0 0 0 0 0" />
|
||||
<weight single ="150 125 210 145 145 15 120 50 0 0 0"
|
||||
multi =" 0 0 40 0 0 0 0 0 0 0 0" />
|
||||
<weight single ="135 105 115 220 60 15 70 40 0 30 0"
|
||||
multi =" 40 0 80 40 50 0 0 0 0 0 0" />
|
||||
<weight single =" 65 60 10 160 0 0 0 0 230 50 0"
|
||||
multi ="110 0 80 215 20 0 0 0 0 0 0" />
|
||||
</weights>
|
||||
<weights num-karts="20">
|
||||
<!-- bubble cake bowl zipper plunger switch swattr rubber para anvil -->
|
||||
<weight single ="100 0 370 0 330 20 180 0 0 0"
|
||||
multi =" 0 0 0 0 0 0 0 0 0 0" />
|
||||
<weight single ="135 160 240 100 185 15 135 0 0 0"
|
||||
multi =" 0 0 30 0 0 0 0 0 0 0" />
|
||||
<weight single ="150 120 200 150 140 10 105 50 0 0"
|
||||
multi =" 0 0 50 0 25 0 0 0 0 0" />
|
||||
<weight single ="125 90 100 250 50 10 50 30 15 0"
|
||||
multi =" 50 0 100 50 80 0 0 0 0 0" />
|
||||
<weight single =" 75 60 0 125 0 0 0 0 35 0"
|
||||
multi ="150 0 155 400 0 0 0 0 0 0" />
|
||||
<!-- bubble cake bowl zipper plunger switch swattr rubber super para anvil -->
|
||||
<weight single ="100 0 370 0 330 20 180 0 0 0 0"
|
||||
multi =" 0 0 0 0 0 0 0 0 0 0 0" />
|
||||
<weight single ="135 160 240 100 185 15 135 0 0 0 0"
|
||||
multi =" 0 0 30 0 0 0 0 0 0 0 0" />
|
||||
<weight single ="150 120 200 150 140 10 105 50 0 0 0"
|
||||
multi =" 0 0 50 0 25 0 0 0 0 0 0" />
|
||||
<weight single ="125 90 100 250 50 10 50 30 0 15 0"
|
||||
multi =" 50 0 100 50 80 0 0 0 0 0 0" />
|
||||
<weight single =" 40 45 0 110 0 0 0 0 300 35 0"
|
||||
multi ="140 0 80 250 0 0 0 0 0 0 0" />
|
||||
</weights>
|
||||
</race-weight-list>
|
||||
|
||||
<ftl-weight-list>
|
||||
<weights num-karts="1">
|
||||
<!-- bubble cake bowl zipper plunger switch swattr rubber para anvil -->
|
||||
<!-- bubble cake bowl zipper plunger switch swattr rubber super para anvil -->
|
||||
<!-- This is the entry for the leader: -->
|
||||
<weight single ="35 0 25 35 25 15 25 0 0 0"
|
||||
multi ="20 0 0 20 0 0 0 0 0 0" />
|
||||
<weight single ="35 0 25 35 25 15 25 0 0 0 0"
|
||||
multi ="20 0 0 20 0 0 0 0 0 0 0" />
|
||||
<!-- This is the entry for the first non-leader karts: -->
|
||||
<weight single ="25 0 60 25 58 2 30 0 0 0"
|
||||
multi =" 0 0 0 0 0 0 0 0 0 0" />
|
||||
<weight single ="35 0 55 35 25 3 25 0 0 0"
|
||||
multi =" 0 0 10 0 12 0 0 0 0 0" />
|
||||
<weight single ="25 0 40 45 15 5 15 10 5 0"
|
||||
multi ="10 0 15 15 0 0 0 0 0 0" />
|
||||
<weight single ="25 0 60 25 58 2 30 0 0 0 0"
|
||||
multi =" 0 0 0 0 0 0 0 0 0 0 0" />
|
||||
<weight single ="35 0 55 35 25 3 25 0 0 0 0"
|
||||
multi =" 0 0 10 0 12 0 0 0 0 0 0" />
|
||||
<weight single ="25 0 40 45 15 5 15 10 0 5 0"
|
||||
multi ="10 0 15 15 0 0 0 0 0 0 0" />
|
||||
<!-- This is the entry for the last kart: -->
|
||||
<weight single ="20 0 15 25 0 0 0 0 15 0"
|
||||
multi ="20 0 25 80 0 0 0 0 0 0" />
|
||||
<weight single ="20 0 15 25 0 0 0 0 0 15 0"
|
||||
multi ="20 0 25 80 0 0 0 0 0 0 0" />
|
||||
</weights>
|
||||
</ftl-weight-list>
|
||||
|
||||
<battle-weight-list>
|
||||
<weights num-karts="1">
|
||||
<!-- bubble cake bowl zipper plunger switch swattr rubber para anvil -->
|
||||
<weight single ="10 30 60 0 0 10 30 0 0 0"
|
||||
multi =" 0 0 5 0 0 0 0 0 0 0" />
|
||||
<!-- bubble cake bowl zipper plunger switch swattr rubber super para anvil -->
|
||||
<weight single ="10 30 60 0 0 10 30 0 0 0 0"
|
||||
multi =" 0 0 5 0 0 0 0 0 0 0 0" />
|
||||
</weights>
|
||||
</battle-weight-list>
|
||||
|
||||
<soccer-weight-list>
|
||||
<weights num-karts="1">
|
||||
<!-- bubble cake bowl zipper plunger switch swattr rubber para anvil -->
|
||||
<weight single =" 0 30 60 0 0 10 30 0 0 0"
|
||||
multi =" 0 0 5 0 0 0 0 0 0 0" />
|
||||
<!-- bubble cake bowl zipper plunger switch swattr rubber super para anvil -->
|
||||
<weight single =" 0 30 60 0 0 10 30 0 0 0 0"
|
||||
multi =" 0 0 5 0 0 0 0 0 0 0 0" />
|
||||
</weights>
|
||||
</soccer-weight-list>
|
||||
|
||||
<tutorial-weight-list>
|
||||
<weights num-karts="1">
|
||||
<!-- bubble cake bowl zipper plunger switch swattr rubber para anvil -->
|
||||
<weight single =" 0 0 0 0 0 0 0 0 0 0"
|
||||
multi =" 0 0 100 0 0 0 0 0 0 0" />
|
||||
<!-- bubble cake bowl zipper plunger switch swattr rubber super para anvil -->
|
||||
<weight single =" 0 0 0 0 0 0 0 0 0 0 0"
|
||||
multi =" 0 0 100 0 0 0 0 0 0 0 0" />
|
||||
</weights>
|
||||
</tutorial-weight-list>
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -11,7 +11,7 @@
|
||||
|
||||
<!-- Minimum and maxium server versions that be be read by this binary.
|
||||
Older versions will be ignored. -->
|
||||
<server-version min="2" max="2"/>
|
||||
<server-version min="1" max="1"/>
|
||||
|
||||
<!-- Maximum number of karts to be used at the same time. This limit
|
||||
can easily be increased, but some tracks might not have valid start
|
||||
@@ -114,7 +114,7 @@
|
||||
that the bit is to be set to 0, otherwise the bit will be set.
|
||||
|
||||
This field takes two
|
||||
values: the first value is 'and'ed with bullet's default values
|
||||
values: the first value is 'and'ed with bullet's default values
|
||||
(i.e. it can be used to unset bullet defaults), the second value
|
||||
is 'or'ed (i.e. is used to set a bit). A value of -1 for 'and'
|
||||
means to keep all bits. The valid names are listed in stk_config.cpp
|
||||
@@ -125,7 +125,7 @@
|
||||
smooth-angle-limit="0.65"
|
||||
fps="120"
|
||||
default-track-friction="0.5"
|
||||
default-moveable-friction="0.5"
|
||||
default-moveable-friction="0.5"
|
||||
solver-iterations="4"
|
||||
solver-split-impulse="true"
|
||||
solver-split-impulse-threshold="-0.00001"
|
||||
@@ -149,14 +149,14 @@
|
||||
<replay max-frames="12000" delta-t="0.200" delta-speed="0.6"
|
||||
delta-steering="0.35" />
|
||||
|
||||
<!-- Determines the minimap related values.
|
||||
<!-- Determines the minimap related values.
|
||||
size: The size of the minimap (scaled afterwards) 480 = full screen height)
|
||||
ai-icon: The size of the icons for the AI karts on the minimap.
|
||||
player-icon: The size of the icons for the player karts. -->
|
||||
|
||||
<minimap size="180.0" ai-icon="16.0" player-icon="20.0"/>
|
||||
|
||||
<urls donate="https://supertuxkart.net/Donate"
|
||||
<urls donate="https://supertuxkart.net/Donate"
|
||||
password-reset="http://addons.supertuxkart.net/password-reset.php" />
|
||||
|
||||
<!-- Skidmark data: maximum number of skid marks, and
|
||||
@@ -201,7 +201,7 @@
|
||||
away if there is an explosion. -->
|
||||
<explosion impulse-objects="500.0" />
|
||||
|
||||
<!-- Networking
|
||||
<!-- Networking
|
||||
state-frequency: how many states the server will send per second.
|
||||
steering-reduction: Reduce a remote kart's steering by this factor
|
||||
each frame. This helps reduces oversteering by high latency
|
||||
|
||||
@@ -133,20 +133,6 @@ namespace scene
|
||||
}
|
||||
}
|
||||
|
||||
virtual void recursiveUpdateAbsolutePosition()
|
||||
{
|
||||
if (IsVisible)
|
||||
{
|
||||
// update absolute position
|
||||
updateAbsolutePosition();
|
||||
|
||||
// perform the post render process on all children
|
||||
|
||||
ISceneNodeList::Iterator it = Children.begin();
|
||||
for (; it != Children.end(); ++it)
|
||||
(*it)->recursiveUpdateAbsolutePosition();
|
||||
}
|
||||
}
|
||||
|
||||
//! Renders the node.
|
||||
virtual void render() = 0;
|
||||
|
||||
@@ -249,10 +249,6 @@ void CAnimatedMeshSceneNode::OnAnimate(u32 timeMs)
|
||||
LastTimeMs = timeMs;
|
||||
|
||||
IAnimatedMeshSceneNode::OnAnimate(timeMs);
|
||||
|
||||
// For up-to-date current frame bone-child attachment
|
||||
for (u32 n=0;n<JointChildSceneNodes.size();++n)
|
||||
JointChildSceneNodes[n]->recursiveUpdateAbsolutePosition();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -186,9 +186,6 @@ void CIrrDeviceAndroid::createVideoModeList()
|
||||
|
||||
int width = ANativeWindow_getWidth(Android->window);
|
||||
int height = ANativeWindow_getHeight(Android->window);
|
||||
|
||||
os::Printer::log("Window width:", core::stringc(width).c_str(), ELL_DEBUG);
|
||||
os::Printer::log("Window height:", core::stringc(height).c_str(), ELL_DEBUG);
|
||||
|
||||
if (width > 0 && height > 0)
|
||||
{
|
||||
|
||||
@@ -121,9 +121,6 @@ void CMountPointReader::buildDirectory()
|
||||
io::path full = list->getFullFileName(i);
|
||||
full = full.subString(Path.size(), full.size() - Path.size());
|
||||
|
||||
if (full == "")
|
||||
continue;
|
||||
|
||||
if (!list->isDirectory(i))
|
||||
{
|
||||
addItem(full, list->getFileOffset(i), list->getFileSize(i), false, RealFileNames.size());
|
||||
|
||||
@@ -435,7 +435,7 @@ void ChallengeData::setRace(RaceManager::Difficulty d) const
|
||||
if (m_is_ghost_replay)
|
||||
{
|
||||
const bool result = ReplayPlay::get()->addReplayFile(file_manager
|
||||
->getAsset(FileManager::REPLAY, m_replay_files[d]),
|
||||
->getAsset(FileManager::CHALLENGE, m_replay_files[d]),
|
||||
true/*custom_replay*/);
|
||||
if (!result)
|
||||
Log::fatal("ChallengeData", "Can't open replay for challenge!");
|
||||
|
||||
@@ -41,7 +41,6 @@ static std::vector<UserConfigParam*> all_params;
|
||||
#include "utils/string_utils.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <stdlib.h>
|
||||
@@ -54,12 +53,9 @@ const int UserConfig::m_current_config_version = 8;
|
||||
// ----------------------------------------------------------------------------
|
||||
UserConfigParam::~UserConfigParam()
|
||||
{
|
||||
if (m_can_be_deleted)
|
||||
{
|
||||
auto it = std::find(all_params.begin(), all_params.end(), this);
|
||||
if (it != all_params.end())
|
||||
all_params.erase(it);
|
||||
}
|
||||
// Now we have server config param so we cannot do this anymore,
|
||||
// esp all params are kept until the closing of stk anyway
|
||||
//all_params.remove(this);
|
||||
} // ~UserConfigParam
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
@@ -66,7 +66,6 @@ class UserConfigParam
|
||||
{
|
||||
friend class GroupUserConfigParam;
|
||||
protected:
|
||||
bool m_can_be_deleted = true;
|
||||
std::string m_param_name;
|
||||
std::string m_comment;
|
||||
public:
|
||||
@@ -762,7 +761,7 @@ namespace UserConfigParams
|
||||
&m_network_group, "Use random port for server connection "
|
||||
"(check stk_config.xml for default value)"));
|
||||
PARAM_PREFIX BoolUserConfigParam m_lobby_chat
|
||||
PARAM_DEFAULT(BoolUserConfigParam(true, "lobby-chat",
|
||||
PARAM_DEFAULT(BoolUserConfigParam(false, "lobby-chat",
|
||||
&m_network_group, "Enable chatting in networking lobby, if off than "
|
||||
"no chat message will be displayed from any players."));
|
||||
PARAM_PREFIX IntUserConfigParam m_max_players
|
||||
@@ -903,10 +902,6 @@ namespace UserConfigParams
|
||||
PARAM_DEFAULT( StringUserConfigParam("Peach.stkskin", "skin_file",
|
||||
"Name of the skin to use") );
|
||||
|
||||
PARAM_PREFIX IntUserConfigParam m_minimap_display
|
||||
PARAM_DEFAULT(IntUserConfigParam(0, "minimap_display",
|
||||
"Minimap: 0 bottom-left, 1 middle-right, 2 hidden"));
|
||||
|
||||
// ---- Handicap
|
||||
PARAM_PREFIX GroupUserConfigParam m_handicap
|
||||
PARAM_DEFAULT( GroupUserConfigParam("Handicap",
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include <sstream>
|
||||
|
||||
#include "config/user_config.hpp"
|
||||
#include "graphics/central_settings.hpp"
|
||||
#include "graphics/material.hpp"
|
||||
#include "graphics/particle_kind_manager.hpp"
|
||||
#include "graphics/sp/sp_texture_manager.hpp"
|
||||
@@ -58,10 +57,9 @@ MaterialManager::MaterialManager()
|
||||
MaterialManager::~MaterialManager()
|
||||
{
|
||||
#ifndef SERVER_ONLY
|
||||
if (CVS->isGLSL())
|
||||
SP::SPTextureManager::get()->stopThreads();
|
||||
SP::SPTextureManager::get()->stopThreads();
|
||||
#endif
|
||||
|
||||
|
||||
for(unsigned int i=0; i<m_materials.size(); i++)
|
||||
{
|
||||
delete m_materials[i];
|
||||
|
||||
@@ -974,39 +974,21 @@ namespace GUIEngine
|
||||
if (ScreenKeyboard::isActive()) ScreenKeyboard::dismiss();
|
||||
if (ModalDialog::isADialogActive()) ModalDialog::dismiss();
|
||||
|
||||
if (g_font)
|
||||
{
|
||||
//delete g_font;
|
||||
g_font->drop();
|
||||
g_font = NULL;
|
||||
}
|
||||
if (g_title_font)
|
||||
{
|
||||
//delete g_title_font;
|
||||
g_title_font->drop();
|
||||
g_title_font = NULL;
|
||||
}
|
||||
if (g_small_font)
|
||||
{
|
||||
//delete g_small_font;
|
||||
g_small_font->drop();
|
||||
g_small_font = NULL;
|
||||
}
|
||||
if (g_large_font)
|
||||
{
|
||||
g_large_font->drop();
|
||||
g_large_font = NULL;
|
||||
}
|
||||
if (g_digit_font)
|
||||
{
|
||||
g_digit_font->drop();
|
||||
g_digit_font = NULL;
|
||||
}
|
||||
if (g_outline_font)
|
||||
{
|
||||
g_outline_font->drop();
|
||||
g_outline_font = NULL;
|
||||
}
|
||||
//delete g_font;
|
||||
g_font->drop();
|
||||
g_font = NULL;
|
||||
//delete g_title_font;
|
||||
g_title_font->drop();
|
||||
g_title_font = NULL;
|
||||
//delete g_small_font;
|
||||
g_small_font->drop();
|
||||
g_small_font = NULL;
|
||||
g_large_font->drop();
|
||||
g_large_font = NULL;
|
||||
g_digit_font->drop();
|
||||
g_digit_font = NULL;
|
||||
g_outline_font->drop();
|
||||
g_outline_font = NULL;
|
||||
|
||||
// nothing else to delete for now AFAIK, irrlicht will automatically
|
||||
// kill everything along the device
|
||||
|
||||
@@ -272,9 +272,7 @@ PlayerKartWidget::~PlayerKartWidget()
|
||||
|
||||
if (m_kart_name->getIrrlichtElement() != NULL)
|
||||
m_kart_name->getIrrlichtElement()->remove();
|
||||
|
||||
if (getCurrentScreen() != NULL)
|
||||
getCurrentScreen()->manualRemoveWidget(this);
|
||||
getCurrentScreen()->manualRemoveWidget(this);
|
||||
|
||||
#ifdef DEBUG
|
||||
m_magic_number = 0xDEADBEEF;
|
||||
|
||||
@@ -631,26 +631,3 @@ std::string AssetsAndroid::getDataPath()
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Get a path for internal lib directory
|
||||
* \return Path for internal lib directory or empty string when failed
|
||||
*/
|
||||
std::string AssetsAndroid::getLibPath()
|
||||
{
|
||||
#ifdef ANDROID
|
||||
AndroidApplicationInfo application_info =
|
||||
CIrrDeviceAndroid::getApplicationInfo(global_android_app->activity);
|
||||
|
||||
std::string lib_path = application_info.native_lib_dir;
|
||||
|
||||
if (access(lib_path.c_str(), R_OK) != 0)
|
||||
{
|
||||
lib_path = "";
|
||||
}
|
||||
|
||||
return lib_path;
|
||||
#endif
|
||||
|
||||
return "";
|
||||
}
|
||||
@@ -43,7 +43,6 @@ public:
|
||||
|
||||
void init();
|
||||
static std::string getDataPath();
|
||||
static std::string getLibPath();
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -110,8 +110,7 @@ Attachment::~Attachment()
|
||||
*/
|
||||
void Attachment::set(AttachmentType type, int ticks,
|
||||
AbstractKart *current_kart,
|
||||
bool disable_swatter_animation,
|
||||
bool set_by_rewind_parachute)
|
||||
bool disable_swatter_animation)
|
||||
{
|
||||
// Don't override currently player swatter removing bomb animation
|
||||
Swatter* s = dynamic_cast<Swatter*>(m_plugin);
|
||||
@@ -180,8 +179,7 @@ void Attachment::set(AttachmentType type, int ticks,
|
||||
// A parachute can be attached as result of the usage of an item. In this
|
||||
// case we have to save the current kart speed so that it can be detached
|
||||
// by slowing down.
|
||||
// if set by rewind the parachute ticks is already correct
|
||||
if (m_type == ATTACH_PARACHUTE && !set_by_rewind_parachute)
|
||||
if(m_type==ATTACH_PARACHUTE)
|
||||
{
|
||||
const KartProperties *kp = m_kart->getKartProperties();
|
||||
float speed_mult;
|
||||
@@ -308,16 +306,19 @@ void Attachment::rewindTo(BareNetworkString *buffer)
|
||||
|
||||
// Attaching an object can be expensive (loading new models, ...)
|
||||
// so avoid doing this if there is no change in attachment type
|
||||
if (m_type == new_type)
|
||||
// Don't use set to reset a model on local player if it's already cleared
|
||||
// (or m_initial_speed is redone / model is re-shown again when rewinding)
|
||||
if (m_type == new_type || m_type == ATTACH_NOTHING)
|
||||
{
|
||||
setTicksLeft(ticks_left);
|
||||
if (m_type != new_type && new_type != ATTACH_SWATTER)
|
||||
m_type = new_type;
|
||||
return;
|
||||
}
|
||||
|
||||
set(new_type, ticks_left, m_previous_owner,
|
||||
new_type == ATTACH_SWATTER && !is_removing_bomb
|
||||
/*disable_swatter_animation*/,
|
||||
new_type == ATTACH_PARACHUTE);
|
||||
/*disable_swatter_animation*/);
|
||||
} // rewindTo
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@@ -352,12 +353,6 @@ void Attachment::hitBanana(ItemState *item_state)
|
||||
return;
|
||||
}
|
||||
|
||||
// Make it consistent with attachment rewind when eating banana with bomb
|
||||
// see if (m_type == ATTACH_BOMB && m_kart->getKartAnimation() != NULL)
|
||||
// in 515
|
||||
if (m_kart->getKartAnimation())
|
||||
return;
|
||||
|
||||
AttachmentType new_attachment = ATTACH_NOTHING;
|
||||
const KartProperties *kp = m_kart->getKartProperties();
|
||||
// Use this as a basic random number to make sync with server easier.
|
||||
@@ -534,19 +529,13 @@ void Attachment::update(int ticks)
|
||||
m_node->setVisible((division & 0x1) == 0);
|
||||
}
|
||||
|
||||
if (m_plugin)
|
||||
if(m_plugin)
|
||||
{
|
||||
int discard_ticks = m_plugin->updateAndTestFinished(ticks);
|
||||
if (discard_ticks != -1)
|
||||
bool discard = m_plugin->updateAndTestFinished(ticks);
|
||||
if(discard)
|
||||
{
|
||||
// Save it for rewinding
|
||||
m_ticks_left =
|
||||
discard_ticks - World::getWorld()->getTicksSinceStart();
|
||||
if (m_ticks_left <= 0)
|
||||
{
|
||||
clear(); // also removes the plugin
|
||||
return;
|
||||
}
|
||||
clear(); // also removes the plugin
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -116,8 +116,7 @@ public:
|
||||
void handleCollisionWithKart(AbstractKart *other);
|
||||
void set (AttachmentType type, int ticks,
|
||||
AbstractKart *previous_kart=NULL,
|
||||
bool disable_swatter_animation = false,
|
||||
bool set_by_rewind_parachute = false);
|
||||
bool disable_swatter_animation = false);
|
||||
void rewindTo(BareNetworkString *buffer);
|
||||
void saveState(BareNetworkString *buffer) const;
|
||||
|
||||
|
||||
@@ -53,9 +53,8 @@ public:
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Updates a plugin. This is called once each time frame. If the
|
||||
* function returns a non-negative number, the attachment is discarded
|
||||
* when world ticks >= that number. */
|
||||
virtual int updateAndTestFinished(int ticks) = 0;
|
||||
* function returns true, the attachment is discarded. */
|
||||
virtual bool updateAndTestFinished(int ticks) = 0;
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Called when the animation of the Attachment's node is done. */
|
||||
|
||||
@@ -198,6 +198,12 @@ bool Bowling::hit(AbstractKart* kart, PhysicalObject* obj)
|
||||
kart->decreaseShieldTime();
|
||||
return true;
|
||||
}
|
||||
// Super-Sized karts are immune to bowling balls
|
||||
// (But if they have a gum shield, they lose it)
|
||||
else if (kart && kart->isSuperSized())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_has_hit_kart = kart != NULL;
|
||||
|
||||
@@ -224,13 +224,6 @@ public:
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the type of flyable. */
|
||||
PowerupManager::PowerupType getType() const {return m_type;}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the owner's kart */
|
||||
AbstractKart *getOwner() const { return m_owner;}
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the owner's kart */
|
||||
AbstractKart *getOwner() const { return m_owner;}
|
||||
// ------------------------------------------------------------------------
|
||||
/** Sets wether Flyable should update TerrainInfo as part of its update
|
||||
* call, or if the inheriting object will update TerrainInfo itself
|
||||
|
||||
@@ -37,25 +37,6 @@
|
||||
#include <ISceneManager.h>
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Constructor.
|
||||
* \param type Type of the item.
|
||||
* \param owner If not NULL it is the kart that dropped this item; NULL
|
||||
* indicates an item that's part of the track.
|
||||
* \param id Index of this item in the array of all items.
|
||||
*/
|
||||
ItemState::ItemState(ItemType type, const AbstractKart *owner, int id)
|
||||
{
|
||||
setType(type);
|
||||
m_item_id = id;
|
||||
m_previous_owner = owner;
|
||||
m_used_up_counter = -1;
|
||||
if (owner)
|
||||
setDeactivatedTicks(stk_config->time2Ticks(1.5f));
|
||||
else
|
||||
setDeactivatedTicks(0);
|
||||
} // ItemState(ItemType)
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Sets the disappear counter depending on type. */
|
||||
void ItemState::setDisappearCounter()
|
||||
@@ -71,23 +52,9 @@ void ItemState::setDisappearCounter()
|
||||
} // switch
|
||||
} // setDisappearCounter
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
/** Initialises an item.
|
||||
* \param type Type for this item.
|
||||
*/
|
||||
void ItemState::initItem(ItemType type, const Vec3& xyz)
|
||||
{
|
||||
m_xyz = xyz;
|
||||
m_original_type = ITEM_NONE;
|
||||
m_ticks_till_return = 0;
|
||||
setDisappearCounter();
|
||||
} // initItem
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Update the state of the item, called once per physics frame.
|
||||
* \param ticks Number of ticks to simulate. While this value is 1 when
|
||||
* called during the normal game loop, during a rewind this value
|
||||
* can be (much) larger than 1.
|
||||
* \param ticks Number of ticks to simulate (typically 1).
|
||||
*/
|
||||
void ItemState::update(int ticks)
|
||||
{
|
||||
@@ -140,17 +107,12 @@ void ItemState::collected(const AbstractKart *kart)
|
||||
* \param normal The normal upon which the item is placed (so that it can
|
||||
* be aligned properly with the ground).
|
||||
* \param mesh The mesh to be used for this item.
|
||||
* \param owner 'Owner' of this item, i.e. the kart that drops it. This is
|
||||
* used to deactivate this item for the owner, i.e. avoid that a kart
|
||||
* 'collects' its own bubble gum. NULL means no owner, and the item
|
||||
* can be collected immediatley by any kart.
|
||||
* \param is_predicted True if the creation of the item is predicted by
|
||||
* a client. Only used in networking.
|
||||
*/
|
||||
Item::Item(ItemType type, const Vec3& xyz, const Vec3& normal,
|
||||
scene::IMesh* mesh, scene::IMesh* lowres_mesh,
|
||||
const AbstractKart *owner, bool is_predicted)
|
||||
: ItemState(type, owner)
|
||||
scene::IMesh* mesh, scene::IMesh* lowres_mesh, bool is_predicted)
|
||||
: ItemState(type)
|
||||
{
|
||||
assert(type != ITEM_TRIGGER); // use other constructor for that
|
||||
|
||||
@@ -228,6 +190,7 @@ Item::Item(const Vec3& xyz, float distance, TriggerItemListener* trigger)
|
||||
void Item::initItem(ItemType type, const Vec3 &xyz)
|
||||
{
|
||||
ItemState::initItem(type, xyz);
|
||||
m_previous_owner = NULL;
|
||||
m_rotate = (getType()!=ITEM_BUBBLEGUM) &&
|
||||
(getType()!=ITEM_TRIGGER );
|
||||
// Now determine in which quad this item is, and its distance
|
||||
@@ -371,6 +334,17 @@ void Item::reset()
|
||||
}
|
||||
} // reset
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Sets which karts dropped an item. This is used to avoid that a kart is
|
||||
* affected by its own items.
|
||||
* \param parent Kart that dropped the item.
|
||||
*/
|
||||
void Item::setParent(const AbstractKart* parent)
|
||||
{
|
||||
m_previous_owner = parent;
|
||||
ItemState::setDeactivatedTicks(stk_config->time2Ticks(1.5f));
|
||||
} // setParent
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Updated the item - rotates it, takes care of items coming back into
|
||||
* the game after it has been collected.
|
||||
|
||||
@@ -122,11 +122,10 @@ private:
|
||||
* and then converting this value to a Vec3. */
|
||||
Vec3 m_xyz;
|
||||
|
||||
/** The 'owner' of the item, i.e. the kart that dropped this item.
|
||||
* Is NULL if the item is part of the track. */
|
||||
const AbstractKart *m_previous_owner;
|
||||
|
||||
protected:
|
||||
/** The 'owner' of the item, i.e. the kart that dropped this item.
|
||||
* Is NULL if the item is part of the track. */
|
||||
const AbstractKart *m_previous_owner;
|
||||
|
||||
friend class ItemManager;
|
||||
friend class NetworkItemManager;
|
||||
@@ -134,13 +133,24 @@ protected:
|
||||
virtual void setType(ItemType type) { m_type = type; }
|
||||
|
||||
public:
|
||||
ItemState(ItemType type, const AbstractKart *owner=NULL, int id = -1);
|
||||
void initItem(ItemType type, const Vec3& xyz);
|
||||
void update(int ticks);
|
||||
void setDisappearCounter();
|
||||
virtual void collected(const AbstractKart *kart);
|
||||
/** Constructor.
|
||||
* \param type Type of the item.
|
||||
* \param id Index of this item in the array of all items.
|
||||
* \param kart_id If !=-1 the kart that dropped this item; -1
|
||||
* indicates an item that's part of the track. */
|
||||
ItemState(ItemType type, int id=-1, AbstractKart *kart=NULL)
|
||||
{
|
||||
setType(type);
|
||||
m_item_id = id;
|
||||
m_previous_owner = kart;
|
||||
} // ItemState(ItemType)
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
virtual ~ItemState() {}
|
||||
void setDisappearCounter();
|
||||
void update(int ticks);
|
||||
virtual void collected(const AbstractKart *kart);
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
void reset()
|
||||
@@ -156,6 +166,19 @@ public:
|
||||
}
|
||||
} // reset
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
/** Initialises an item.
|
||||
* \param type Type for this item.
|
||||
*/
|
||||
void initItem(ItemType type, const Vec3& xyz)
|
||||
{
|
||||
m_xyz = xyz;
|
||||
m_original_type = ITEM_NONE;
|
||||
m_deactive_ticks = 0;
|
||||
m_ticks_till_return = 0;
|
||||
setDisappearCounter();
|
||||
} // initItem
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Switches an item to be of a different type. Used for the switch
|
||||
* powerup.
|
||||
@@ -306,19 +329,20 @@ private:
|
||||
public:
|
||||
Item(ItemType type, const Vec3& xyz, const Vec3& normal,
|
||||
scene::IMesh* mesh, scene::IMesh* lowres_mesh,
|
||||
const AbstractKart *owner,
|
||||
bool is_predicted=false);
|
||||
Item(const Vec3& xyz, float distance,
|
||||
TriggerItemListener* trigger);
|
||||
virtual ~Item ();
|
||||
void updateGraphics(float dt);
|
||||
virtual void collected(const AbstractKart *kart) OVERRIDE;
|
||||
void setParent(const AbstractKart* parent);
|
||||
void reset();
|
||||
void switchTo(ItemType type, scene::IMesh *mesh,
|
||||
scene::IMesh *lowmesh);
|
||||
void switchTo(ItemType type, scene::IMesh *mesh, scene::IMesh *lowmesh);
|
||||
void switchBack();
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns true if the Kart is close enough to hit this item, the item is
|
||||
* not deactivated anymore, and it wasn't placed by this kart (this is
|
||||
* e.g. used to avoid that a kart hits a bubble gum it just dropped).
|
||||
@@ -328,7 +352,7 @@ public:
|
||||
*/
|
||||
bool hitKart(const Vec3 &xyz, const AbstractKart *kart=NULL) const
|
||||
{
|
||||
if (getPreviousOwner() == kart && getDeactivatedTicks() > 0)
|
||||
if (m_previous_owner == kart && getDeactivatedTicks() > 0)
|
||||
return false;
|
||||
Vec3 lc = quatRotate(m_original_rotation, xyz - getXYZ());
|
||||
// Don't be too strict if the kart is a bit above the item
|
||||
@@ -349,8 +373,7 @@ protected:
|
||||
bool hitLine(const core::line3df &line,
|
||||
const AbstractKart *kart=NULL) const
|
||||
{
|
||||
if (getPreviousOwner() == kart && getDeactivatedTicks() > 0)
|
||||
return false;
|
||||
if (m_previous_owner == kart && getDeactivatedTicks() >0) return false;
|
||||
|
||||
Vec3 closest = line.getClosestPoint(getXYZ().toIrrVector());
|
||||
return hitKart(closest, kart);
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
*/
|
||||
ItemEventInfo::ItemEventInfo(BareNetworkString *buffer, int *count)
|
||||
{
|
||||
m_ticks_till_return = 0;
|
||||
m_type = (EventType)buffer->getUInt8();
|
||||
m_ticks = buffer->getTime();
|
||||
m_kart_id = buffer->getInt8();
|
||||
@@ -42,11 +41,7 @@ ItemEventInfo::ItemEventInfo(BareNetworkString *buffer, int *count)
|
||||
m_xyz = buffer->getVec3();
|
||||
*count -= 12;
|
||||
}
|
||||
else if (m_type == IEI_COLLECT)
|
||||
{
|
||||
m_ticks_till_return = buffer->getUInt16();
|
||||
*count -= 2;
|
||||
}
|
||||
|
||||
} // ItemEventInfo(BareNetworkString, int *count)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -60,6 +55,7 @@ void ItemEventInfo::saveState(BareNetworkString *buffer)
|
||||
.addUInt16(m_index);
|
||||
if(m_type == IEI_NEW)
|
||||
buffer->add(m_xyz);
|
||||
else if (m_type == IEI_COLLECT)
|
||||
buffer->addUInt16(m_ticks_till_return);
|
||||
} // saveState
|
||||
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
#include "items/item.hpp"
|
||||
#include "utils/vec3.hpp"
|
||||
#include "utils/types.hpp"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
@@ -52,20 +51,13 @@ private:
|
||||
/** In case of new items the position of the new item. */
|
||||
Vec3 m_xyz;
|
||||
|
||||
/** Ticks for the item to return, atm used by collecting banana
|
||||
* with bomb to delay the return for banana. */
|
||||
int16_t m_ticks_till_return;
|
||||
|
||||
public:
|
||||
/** Constructor for collecting an existing item.
|
||||
* \param ticks Time of the event.
|
||||
* \param item_id The index of the item that was collected.
|
||||
* \param kart_id the kart that collected the item.
|
||||
* \param ttr Ticks till return after being collected. */
|
||||
|
||||
ItemEventInfo(int ticks, int index, int kart_id, int16_t ttr)
|
||||
: m_ticks(ticks), m_index(index), m_kart_id(kart_id),
|
||||
m_ticks_till_return(ttr)
|
||||
* \param kart_id the kart that collected the item. */
|
||||
ItemEventInfo(int ticks, int index, int kart_id)
|
||||
: m_ticks(ticks), m_index(index), m_kart_id(kart_id)
|
||||
{
|
||||
m_type = IEI_COLLECT;
|
||||
} // ItemEventInfo(collected existing item)
|
||||
@@ -77,15 +69,14 @@ public:
|
||||
*/
|
||||
ItemEventInfo(int ticks, ItemState::ItemType type, int index,
|
||||
int kart_id, const Vec3 &xyz)
|
||||
: m_ticks(ticks), m_index(index), m_kart_id(kart_id), m_xyz(xyz),
|
||||
m_ticks_till_return(0)
|
||||
: m_ticks(ticks), m_index(index), m_kart_id(kart_id), m_xyz(xyz)
|
||||
{
|
||||
m_type = IEI_NEW;
|
||||
} // ItemEventInfo(new item)
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
/** Constructor for switching items. */
|
||||
ItemEventInfo(int ticks) : m_ticks(ticks), m_ticks_till_return(0)
|
||||
ItemEventInfo(int ticks) : m_ticks(ticks)
|
||||
{
|
||||
m_type = IEI_SWITCH;
|
||||
} // ItemEventInfo(switch)
|
||||
@@ -125,9 +116,6 @@ public:
|
||||
return m_xyz;
|
||||
} // getXYZ
|
||||
// --------------------------------------------------------------------
|
||||
/** Returns the ticks till return, used only by collection events. */
|
||||
int getTicksTillReturn() const { return m_ticks_till_return; }
|
||||
// --------------------------------------------------------------------
|
||||
/** Returns the type of this item. Note at this stage only bubble gums
|
||||
* can be created during a race. */
|
||||
ItemState::ItemType getNewItemType() const
|
||||
|
||||
@@ -226,15 +226,13 @@ unsigned int ItemManager::insertItem(Item *item)
|
||||
// previously deleted entry, otherwise at the end.
|
||||
int index = -1;
|
||||
for(index=(int)m_all_items.size()-1; index>=0 && m_all_items[index]; index--) {}
|
||||
if (index == -1)
|
||||
{
|
||||
index = (int)m_all_items.size();
|
||||
m_all_items.push_back(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if(index==-1) index = (int)m_all_items.size();
|
||||
|
||||
if(index<(int)m_all_items.size())
|
||||
m_all_items[index] = item;
|
||||
}
|
||||
else
|
||||
m_all_items.push_back(item);
|
||||
item->setItemId(index);
|
||||
|
||||
// Now insert into the appropriate quad list, if there is a quad list
|
||||
@@ -288,7 +286,9 @@ Item* ItemManager::dropNewItem(ItemState::ItemType type,
|
||||
}
|
||||
|
||||
Item* item = new Item(type, pos, normal, m_item_mesh[mesh_type],
|
||||
m_item_lowres_mesh[mesh_type], /*prev_owner*/kart);
|
||||
m_item_lowres_mesh[mesh_type]);
|
||||
|
||||
if(kart != NULL) item->setParent(kart);
|
||||
insertItem(item);
|
||||
if(m_switch_ticks>=0)
|
||||
{
|
||||
@@ -318,7 +318,7 @@ Item* ItemManager::placeItem(ItemState::ItemType type, const Vec3& xyz,
|
||||
ItemState::ItemType mesh_type = type;
|
||||
|
||||
Item* item = new Item(type, xyz, normal, m_item_mesh[mesh_type],
|
||||
m_item_lowres_mesh[mesh_type], /*prev_owner*/NULL);
|
||||
m_item_lowres_mesh[mesh_type]);
|
||||
|
||||
insertItem(item);
|
||||
if (m_switch_ticks >= 0)
|
||||
@@ -354,7 +354,7 @@ Item* ItemManager::placeTrigger(const Vec3& xyz, float distance,
|
||||
* \param item The item that was collected.
|
||||
* \param kart The kart that collected the item.
|
||||
*/
|
||||
void ItemManager::collectedItem(ItemState *item, AbstractKart *kart)
|
||||
void ItemManager::collectedItem(Item *item, AbstractKart *kart)
|
||||
{
|
||||
assert(item);
|
||||
// Spare tire karts don't collect items
|
||||
|
||||
@@ -133,9 +133,8 @@ public:
|
||||
void updateGraphics (float dt);
|
||||
void checkItemHit (AbstractKart* kart);
|
||||
void reset ();
|
||||
virtual void collectedItem (ItemState *item, AbstractKart *kart);
|
||||
virtual void collectedItem (Item *item, AbstractKart *kart);
|
||||
void switchItems ();
|
||||
bool areItemSwitched() { return (m_switch_ticks > 0); }
|
||||
bool randomItemsForArena(const AlignedArray<btTransform>& pos);
|
||||
// ------------------------------------------------------------------------
|
||||
/** Only used in the NetworkItemManager. */
|
||||
|
||||
@@ -95,18 +95,17 @@ void NetworkItemManager::initClientConfirmState()
|
||||
* \param item The item that was collected.
|
||||
* \param kart The kart that collected the item.
|
||||
*/
|
||||
void NetworkItemManager::collectedItem(ItemState *item, AbstractKart *kart)
|
||||
void NetworkItemManager::collectedItem(Item *item, AbstractKart *kart)
|
||||
{
|
||||
if(NetworkConfig::get()->isServer())
|
||||
{
|
||||
ItemManager::collectedItem(item, kart);
|
||||
// The server saves the collected item as item event info
|
||||
m_item_events.lock();
|
||||
m_item_events.getData().emplace_back(World::getWorld()->getTicksSinceStart(),
|
||||
item->getItemId(),
|
||||
kart->getWorldKartId(),
|
||||
item->getTicksTillReturn());
|
||||
item->getItemId(),
|
||||
kart->getWorldKartId());
|
||||
m_item_events.unlock();
|
||||
ItemManager::collectedItem(item, kart);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -143,7 +142,7 @@ Item* NetworkItemManager::dropNewItem(ItemState::ItemType type,
|
||||
kart->getXYZ() );
|
||||
m_item_events.unlock();
|
||||
return item;
|
||||
} // dropNewItem
|
||||
} // newItem
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Called by the GameProtocol when a confirmation for an item event is
|
||||
@@ -238,9 +237,9 @@ void NetworkItemManager::forwardTime(int ticks)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Restores the state of the items to the current world time. It takes the
|
||||
* last saved confirmed state, applies any updates from the server, and
|
||||
* then syncs up the confirmed state to the in-race items.
|
||||
* It uses exactly 'count' bytes of the message.
|
||||
* last saved
|
||||
|
||||
* using exactly 'count' bytes of the message.
|
||||
* \param buffer the state content.
|
||||
* \param count Number of bytes used for this state.
|
||||
*/
|
||||
@@ -268,7 +267,6 @@ void NetworkItemManager::restoreState(BareNetworkString *buffer, int count)
|
||||
// From here the replay can happen.
|
||||
|
||||
// 1) Remove predicted items:
|
||||
// --------------------------
|
||||
for (unsigned int i=0; i<m_all_items.size(); i++)
|
||||
{
|
||||
Item *item = m_all_items[i];
|
||||
@@ -276,22 +274,20 @@ void NetworkItemManager::restoreState(BareNetworkString *buffer, int count)
|
||||
{
|
||||
deleteItem(item);
|
||||
}
|
||||
} // for i in m_all_items
|
||||
}
|
||||
|
||||
// 2) Apply all events to current confirmed state:
|
||||
// -----------------------------------------------
|
||||
World *world = World::getWorld();
|
||||
int current_time = m_confirmed_state_time;
|
||||
bool has_state = count > 0;
|
||||
while(count > 0)
|
||||
{
|
||||
// 2.1) Decode the event in the message
|
||||
// ------------------------------------
|
||||
// 1) Decode the event in the message
|
||||
// ----------------------------------
|
||||
ItemEventInfo iei(buffer, &count);
|
||||
|
||||
// 2.2) If the event needs to be applied, forward
|
||||
// the time to the time of this event:
|
||||
// ----------------------------------------------
|
||||
// 2) If the event needs to be applied, forward
|
||||
// the time to the time of this event:
|
||||
// --------------------------------------------
|
||||
int dt = iei.getTicks() - current_time;
|
||||
// Skip an event that are 'in the past' (i.e. have been sent again by
|
||||
// the server because it has not yet received confirmation from all
|
||||
@@ -301,35 +297,13 @@ void NetworkItemManager::restoreState(BareNetworkString *buffer, int count)
|
||||
// Forward the saved state:
|
||||
if (dt>0) forwardTime(dt);
|
||||
|
||||
// TODO: apply the various events types, atm only collection
|
||||
// and new items are supported.
|
||||
// TODO: apply the various events types, atm only collection is supported:
|
||||
if(iei.isItemCollection())
|
||||
{
|
||||
int index = iei.getIndex();
|
||||
// An item on the track was collected:
|
||||
AbstractKart *kart = world->getKart(iei.getKartId());
|
||||
|
||||
// The world clock was set by the RewindManager to be the time
|
||||
// of the state we are rewinding to. But this confirmed collection
|
||||
// event happened in the past (we are replaying item events since
|
||||
// the last confirmed state in order to get a new confirmed state).
|
||||
// So we need to reset the clock to the time at which this event
|
||||
// happened so that (e.g.) kart can use the right time (for
|
||||
// example, bubble gum torque depends on time, and would be wrong
|
||||
// otherwise resulting in stuttering).
|
||||
int old_time = world->getTicksSinceStart(); // Save time we rewind to
|
||||
world->setTicksForRewind(iei.getTicks()); // Set time of event
|
||||
|
||||
if (m_confirmed_state[index] != NULL)
|
||||
{
|
||||
m_confirmed_state[index]->collected(kart);// Collect item
|
||||
// Reset till ticks return from state (required for eating banana with bomb)
|
||||
int ttr = iei.getTicksTillReturn();
|
||||
m_confirmed_state[index]->setTicksTillReturn(ttr);
|
||||
}
|
||||
|
||||
world->setTicksForRewind(old_time); // Set time to rewind-to
|
||||
|
||||
AbstractKart *kart = World::getWorld()->getKart(iei.getKartId());
|
||||
m_confirmed_state[index]->collected(kart);
|
||||
if (m_confirmed_state[index]->isUsedUp())
|
||||
{
|
||||
delete m_confirmed_state[index];
|
||||
@@ -338,9 +312,9 @@ void NetworkItemManager::restoreState(BareNetworkString *buffer, int count)
|
||||
}
|
||||
else if(iei.isNewItem())
|
||||
{
|
||||
AbstractKart *kart = world->getKart(iei.getKartId());
|
||||
ItemState *is = new ItemState(iei.getNewItemType(), kart,
|
||||
iei.getIndex() );
|
||||
AbstractKart *kart = World::getWorld()->getKart(iei.getKartId());
|
||||
ItemState *is = new ItemState(iei.getNewItemType(), iei.getIndex(),
|
||||
kart);
|
||||
is->initItem(iei.getNewItemType(), iei.getXYZ());
|
||||
if (m_confirmed_state.size() <= is->getItemId())
|
||||
{
|
||||
@@ -351,34 +325,29 @@ void NetworkItemManager::restoreState(BareNetworkString *buffer, int count)
|
||||
if (m_confirmed_state[is->getItemId()] == NULL)
|
||||
m_confirmed_state[is->getItemId()] = is;
|
||||
else
|
||||
{
|
||||
*m_confirmed_state[is->getItemId()] = *is;
|
||||
delete is;
|
||||
}
|
||||
}
|
||||
}
|
||||
current_time = iei.getTicks();
|
||||
} // while count >0
|
||||
|
||||
// Inform the server which events have been received (if there has
|
||||
// been any updates - no need to send messages if nothing has changed)
|
||||
|
||||
// Inform the server which events have been received.
|
||||
if (has_state)
|
||||
{
|
||||
if (auto gp = GameProtocol::lock())
|
||||
gp->sendItemEventConfirmation(world->getTicksSinceStart());
|
||||
gp->sendItemEventConfirmation(World::getWorld()->getTicksSinceStart());
|
||||
}
|
||||
|
||||
// Forward the confirmed item state to the world time:
|
||||
int dt = world->getTicksSinceStart() - current_time;
|
||||
int dt = World::getWorld()->getTicksSinceStart() - current_time;
|
||||
if(dt>0) forwardTime(dt);
|
||||
|
||||
// 3. Restore the state to the current world time:
|
||||
// ===============================================
|
||||
// Restore the state to the current world time:
|
||||
// ============================================
|
||||
|
||||
for(unsigned int i=0; i<m_confirmed_state.size(); i++)
|
||||
{
|
||||
Item *item = i < m_all_items.size() ? m_all_items[i] : NULL;
|
||||
Item *item = m_all_items[i];
|
||||
const ItemState *is = m_confirmed_state[i];
|
||||
if (is && item)
|
||||
*(ItemState*)item = *is;
|
||||
@@ -387,33 +356,18 @@ void NetworkItemManager::restoreState(BareNetworkString *buffer, int count)
|
||||
Vec3 xyz = is->getXYZ();
|
||||
Item *item_new = dropNewItem(is->getType(), is->getPreviousOwner(),
|
||||
&xyz);
|
||||
if (i != item_new->getItemId())
|
||||
{
|
||||
// The server has this item at a different index in the list
|
||||
// of all items, which means the client has an incorrect
|
||||
// item at the index given by the server - delete that item
|
||||
Log::info("nim", "about to delete item with not matching index i %d item %d",
|
||||
i, item_new->getItemId());
|
||||
if(m_all_items[i])
|
||||
deleteItem(m_all_items[i]);
|
||||
m_all_items[item_new->getItemId()] = NULL;
|
||||
m_all_items[i] = item_new;
|
||||
item_new->setItemId(i);
|
||||
}
|
||||
item_new->setPredicted(false);
|
||||
item_new->setDeactivatedTicks(is->getDeactivatedTicks());
|
||||
item_new->setItemId(i);
|
||||
m_all_items[i] = item_new;
|
||||
*((ItemState*)m_all_items[i]) = *is;
|
||||
}
|
||||
else if (!is && item)
|
||||
{
|
||||
Log::info("nim", "About to delete item index %d i %d",
|
||||
item->getItemId(), i);
|
||||
|
||||
deleteItem(m_all_items[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// Now we save the current local
|
||||
m_confirmed_state_time = world->getTicksSinceStart();
|
||||
m_confirmed_state_time = World::getWorld()->getTicksSinceStart();
|
||||
} // restoreState
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ public:
|
||||
virtual void reset() OVERRIDE;
|
||||
virtual void setItemConfirmationTime(std::weak_ptr<STKPeer> peer,
|
||||
int ticks) OVERRIDE;
|
||||
virtual void collectedItem(ItemState *item, AbstractKart *kart) OVERRIDE;
|
||||
virtual void collectedItem(Item *item, AbstractKart *kart) OVERRIDE;
|
||||
virtual Item* dropNewItem(ItemState::ItemType type, const AbstractKart *kart,
|
||||
const Vec3 *xyz=NULL) OVERRIDE;
|
||||
virtual BareNetworkString* saveState(std::vector<std::string>* ru)
|
||||
|
||||
@@ -256,7 +256,7 @@ BareNetworkString* Plunger::saveState(std::vector<std::string>* ru)
|
||||
BareNetworkString* buffer = Flyable::saveState(ru);
|
||||
buffer->addUInt16(m_keep_alive).addUInt8(m_moved_to_infinity ? 1 : 0);
|
||||
if (m_rubber_band)
|
||||
buffer->addUInt8(m_rubber_band->get8BitState());
|
||||
buffer->addUInt8(m_rubber_band->getRubberBandTo());
|
||||
else
|
||||
buffer->addUInt8(255);
|
||||
return buffer;
|
||||
@@ -268,20 +268,7 @@ void Plunger::restoreState(BareNetworkString *buffer, int count)
|
||||
Flyable::restoreState(buffer, count);
|
||||
m_keep_alive = buffer->getUInt16();
|
||||
m_moved_to_infinity = buffer->getUInt8() == 1;
|
||||
uint8_t bit_state = buffer->getUInt8();
|
||||
if (bit_state == 255 && m_rubber_band)
|
||||
{
|
||||
delete m_rubber_band;
|
||||
m_rubber_band = NULL;
|
||||
if (!m_reverse_mode)
|
||||
m_reverse_mode = true;
|
||||
}
|
||||
else if (bit_state != 255 && !m_rubber_band)
|
||||
{
|
||||
m_rubber_band = new RubberBand(this, m_owner);
|
||||
if (m_reverse_mode)
|
||||
m_reverse_mode = false;
|
||||
}
|
||||
if (bit_state != 255)
|
||||
m_rubber_band->set8BitState(bit_state);
|
||||
int8_t rbt = buffer->getUInt8();
|
||||
if (rbt != -1 && m_rubber_band)
|
||||
m_rubber_band->setRubberBandTo((RubberBand::RubberBandTo)rbt);
|
||||
} // restoreState
|
||||
|
||||
@@ -170,6 +170,9 @@ void Powerup::set(PowerupManager::PowerupType type, int n)
|
||||
case PowerupManager::POWERUP_ZIPPER:
|
||||
break ;
|
||||
|
||||
case PowerupManager::POWERUP_SUPER_SIZE:
|
||||
break ;
|
||||
|
||||
case PowerupManager::POWERUP_BOWLING:
|
||||
m_sound_use = SFXManager::get()->createSoundSource("bowling_shoot");
|
||||
break ;
|
||||
@@ -276,6 +279,9 @@ void Powerup::use()
|
||||
case PowerupManager::POWERUP_ZIPPER:
|
||||
m_kart->handleZipper(NULL, true);
|
||||
break ;
|
||||
case PowerupManager::POWERUP_SUPER_SIZE:
|
||||
m_kart->setSuper();
|
||||
break ;
|
||||
case PowerupManager::POWERUP_SWITCH:
|
||||
{
|
||||
ItemManager::get()->switchItems();
|
||||
@@ -563,7 +569,7 @@ void Powerup::hitBonusBox(const ItemState &item_state)
|
||||
random_number);
|
||||
// FIXME Disable switch and bubblegum for now in network
|
||||
if (NetworkConfig::get()->isNetworking() &&
|
||||
(new_powerup == PowerupManager::POWERUP_BUBBLEGUM ||
|
||||
(new_powerup == PowerupManager::POWERUP_BUBBLEGUM ||
|
||||
new_powerup == PowerupManager::POWERUP_SWITCH))
|
||||
new_powerup = PowerupManager::POWERUP_BOWLING;
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ PowerupManager::PowerupType
|
||||
static std::string powerup_names[] = {
|
||||
"", /* Nothing */
|
||||
"bubblegum", "cake", "bowling", "zipper", "plunger", "switch",
|
||||
"swatter", "rubber-ball", "parachute", "anchor"
|
||||
"swatter", "rubber-ball", "super", "parachute", "anchor"
|
||||
};
|
||||
|
||||
for(unsigned int i=POWERUP_FIRST; i<=POWERUP_LAST; i++)
|
||||
|
||||
@@ -132,6 +132,7 @@ public:
|
||||
POWERUP_CAKE,
|
||||
POWERUP_BOWLING, POWERUP_ZIPPER, POWERUP_PLUNGER,
|
||||
POWERUP_SWITCH, POWERUP_SWATTER, POWERUP_RUBBERBALL,
|
||||
POWERUP_SUPER_SIZE,
|
||||
POWERUP_PARACHUTE,
|
||||
POWERUP_ANVIL, //powerup.cpp assumes these two come last
|
||||
POWERUP_LAST=POWERUP_ANVIL,
|
||||
|
||||
@@ -201,8 +201,7 @@ bool ProjectileManager::projectileIsClose(const AbstractKart * const kart,
|
||||
* \param type The type of projectile checked
|
||||
*/
|
||||
int ProjectileManager::getNearbyProjectileCount(const AbstractKart * const kart,
|
||||
float radius, PowerupManager::PowerupType type,
|
||||
bool exclude_owned)
|
||||
float radius, PowerupManager::PowerupType type)
|
||||
{
|
||||
float r2 = radius * radius;
|
||||
int projectile_count = 0;
|
||||
@@ -213,9 +212,6 @@ int ProjectileManager::getNearbyProjectileCount(const AbstractKart * const kart,
|
||||
continue;
|
||||
if (i->second->getType() == type)
|
||||
{
|
||||
if (exclude_owned && (i->second->getOwner() == kart))
|
||||
continue;
|
||||
|
||||
float dist2 = i->second->getXYZ().distance2(kart->getXYZ());
|
||||
if (dist2 < r2)
|
||||
{
|
||||
@@ -314,4 +310,3 @@ std::shared_ptr<Rewinder>
|
||||
return nullptr;
|
||||
}
|
||||
} // addProjectileFromNetworkState
|
||||
|
||||
|
||||
@@ -72,8 +72,7 @@ public:
|
||||
float radius);
|
||||
|
||||
int getNearbyProjectileCount(const AbstractKart * const kart,
|
||||
float radius, PowerupManager::PowerupType type,
|
||||
bool exclude_owned=false);
|
||||
float radius, PowerupManager::PowerupType type);
|
||||
// ------------------------------------------------------------------------
|
||||
/** Adds a special hit effect to be shown.
|
||||
* \param hit_effect The hit effect to be added. */
|
||||
@@ -101,4 +100,3 @@ extern ProjectileManager *projectile_manager;
|
||||
#endif
|
||||
|
||||
/* EOF */
|
||||
|
||||
|
||||
@@ -45,7 +45,6 @@
|
||||
RubberBand::RubberBand(Plunger *plunger, AbstractKart *kart)
|
||||
: m_plunger(plunger), m_owner(kart)
|
||||
{
|
||||
m_hit_kart = NULL;
|
||||
m_attached_state = RB_TO_PLUNGER;
|
||||
updatePosition();
|
||||
|
||||
@@ -277,7 +276,6 @@ void RubberBand::hit(AbstractKart *kart_hit, const Vec3 *track_xyz)
|
||||
// =================
|
||||
m_hit_position = *track_xyz;
|
||||
m_attached_state = RB_TO_TRACK;
|
||||
m_hit_kart = NULL;
|
||||
} // hit
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -291,24 +289,3 @@ void RubberBand::remove()
|
||||
}
|
||||
#endif
|
||||
} // remove
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
uint8_t RubberBand::get8BitState() const
|
||||
{
|
||||
uint8_t state = (uint8_t)(m_attached_state & 3);
|
||||
state |= m_attached_state == RB_TO_KART && m_hit_kart ?
|
||||
(m_hit_kart->getWorldKartId() << 3) : 0;
|
||||
return state;
|
||||
} // get8BitState
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void RubberBand::set8BitState(uint8_t bit_state)
|
||||
{
|
||||
m_hit_kart = NULL;
|
||||
m_attached_state = (RubberBandTo)(bit_state & 3);
|
||||
if (m_attached_state == RB_TO_KART)
|
||||
{
|
||||
unsigned kart = bit_state >> 3;
|
||||
m_hit_kart = World::getWorld()->getKart(kart);
|
||||
}
|
||||
} // set8BitState
|
||||
|
||||
@@ -73,8 +73,8 @@ public:
|
||||
void updateGraphics(float dt);
|
||||
void update(int ticks);
|
||||
void hit(AbstractKart *kart_hit, const Vec3 *track_xyz=NULL);
|
||||
uint8_t get8BitState() const;
|
||||
void set8BitState(uint8_t bit_state);
|
||||
RubberBandTo getRubberBandTo() const { return m_attached_state; }
|
||||
void setRubberBandTo(RubberBandTo rbt) { m_attached_state = rbt; }
|
||||
void remove();
|
||||
}; // RubberBand
|
||||
#endif
|
||||
|
||||
@@ -161,20 +161,20 @@ void Swatter::updateGrahpics(float dt)
|
||||
/** Updates an armed swatter: it checks for any karts that are close enough
|
||||
* and not invulnerable, it swats the kart.
|
||||
* \param dt Time step size.
|
||||
* \return World ticks to discard the swatter.
|
||||
* \return True if the attachment should be discarded.
|
||||
*/
|
||||
int Swatter::updateAndTestFinished(int ticks)
|
||||
bool Swatter::updateAndTestFinished(int ticks)
|
||||
{
|
||||
const int ticks_start = World::getWorld()->getTicksSinceStart();
|
||||
if (m_removed_bomb_ticks != std::numeric_limits<int>::max())
|
||||
{
|
||||
if (ticks_start >= m_removed_bomb_ticks)
|
||||
return m_removed_bomb_ticks;
|
||||
return -1;
|
||||
return true;
|
||||
return false;
|
||||
} // if removing bomb
|
||||
|
||||
if (RewindManager::get()->isRewinding())
|
||||
return -1;
|
||||
return false;
|
||||
|
||||
if (!m_discard_now)
|
||||
{
|
||||
@@ -186,7 +186,7 @@ int Swatter::updateAndTestFinished(int ticks)
|
||||
// to make sure all clients know the existence of swatter each other
|
||||
if (ticks_start - m_swatter_start_ticks < 60 ||
|
||||
m_swatter_end_ticks - ticks_start < 60)
|
||||
return -1;
|
||||
return false;
|
||||
|
||||
chooseTarget();
|
||||
pointToTarget();
|
||||
@@ -258,15 +258,15 @@ int Swatter::updateAndTestFinished(int ticks)
|
||||
|
||||
if (m_discard_now)
|
||||
{
|
||||
return m_end_swat_ticks;
|
||||
return ticks_start > m_end_swat_ticks;
|
||||
}
|
||||
else if (ticks_start > m_end_swat_ticks)
|
||||
{
|
||||
m_animation_phase = SWATTER_AIMING;
|
||||
m_end_swat_ticks = std::numeric_limits<int>::max();
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
return -1;
|
||||
return false;
|
||||
} // updateAndTestFinished
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
@@ -87,7 +87,7 @@ public:
|
||||
scene::ISceneNode* bomb_scene_node, int ticks);
|
||||
virtual ~Swatter();
|
||||
void updateGrahpics(float dt) OVERRIDE;
|
||||
int updateAndTestFinished(int ticks) OVERRIDE;
|
||||
bool updateAndTestFinished(int ticks) OVERRIDE;
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns if the swatter is currently aiming, i.e. can be used to
|
||||
|
||||
@@ -161,6 +161,14 @@ AbstractCharacteristic::ValueType AbstractCharacteristic::getType(
|
||||
return TYPE_FLOAT;
|
||||
case ZIPPER_FADE_OUT_TIME:
|
||||
return TYPE_FLOAT;
|
||||
case SUPER_DURATION:
|
||||
return TYPE_FLOAT;
|
||||
case SUPER_FORCE:
|
||||
return TYPE_FLOAT;
|
||||
case SUPER_MAX_SPEED_INCREASE:
|
||||
return TYPE_FLOAT;
|
||||
case SUPER_FADE_OUT_TIME:
|
||||
return TYPE_FLOAT;
|
||||
case SWATTER_DURATION:
|
||||
return TYPE_FLOAT;
|
||||
case SWATTER_DISTANCE:
|
||||
@@ -397,6 +405,14 @@ std::string AbstractCharacteristic::getName(CharacteristicType type)
|
||||
return "ZIPPER_MAX_SPEED_INCREASE";
|
||||
case ZIPPER_FADE_OUT_TIME:
|
||||
return "ZIPPER_FADE_OUT_TIME";
|
||||
case SUPER_DURATION:
|
||||
return "SUPER_DURATION";
|
||||
case SUPER_FORCE:
|
||||
return "SUPER_FORCE";
|
||||
case SUPER_MAX_SPEED_INCREASE:
|
||||
return "SUPER_MAX_SPEED_INCREASE";
|
||||
case SUPER_FADE_OUT_TIME:
|
||||
return "SUPER_FADE_OUT_TIME";
|
||||
case SWATTER_DURATION:
|
||||
return "SWATTER_DURATION";
|
||||
case SWATTER_DISTANCE:
|
||||
@@ -1155,6 +1171,54 @@ float AbstractCharacteristic::getZipperFadeOutTime() const
|
||||
return result;
|
||||
} // getZipperFadeOutTime
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
float AbstractCharacteristic::getSuperDuration() const
|
||||
{
|
||||
float result;
|
||||
bool is_set = false;
|
||||
process(SUPER_DURATION, &result, &is_set);
|
||||
if (!is_set)
|
||||
Log::fatal("AbstractCharacteristic", "Can't get characteristic %s",
|
||||
getName(SUPER_DURATION).c_str());
|
||||
return result;
|
||||
} // getSuperDuration
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
float AbstractCharacteristic::getSuperForce() const
|
||||
{
|
||||
float result;
|
||||
bool is_set = false;
|
||||
process(SUPER_FORCE, &result, &is_set);
|
||||
if (!is_set)
|
||||
Log::fatal("AbstractCharacteristic", "Can't get characteristic %s",
|
||||
getName(SUPER_FORCE).c_str());
|
||||
return result;
|
||||
} // getSuperForce
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
float AbstractCharacteristic::getSuperMaxSpeedIncrease() const
|
||||
{
|
||||
float result;
|
||||
bool is_set = false;
|
||||
process(SUPER_MAX_SPEED_INCREASE, &result, &is_set);
|
||||
if (!is_set)
|
||||
Log::fatal("AbstractCharacteristic", "Can't get characteristic %s",
|
||||
getName(SUPER_MAX_SPEED_INCREASE).c_str());
|
||||
return result;
|
||||
} // getSuperMaxSpeedIncrease
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
float AbstractCharacteristic::getSuperFadeOutTime() const
|
||||
{
|
||||
float result;
|
||||
bool is_set = false;
|
||||
process(SUPER_FADE_OUT_TIME, &result, &is_set);
|
||||
if (!is_set)
|
||||
Log::fatal("AbstractCharacteristic", "Can't get characteristic %s",
|
||||
getName(SUPER_FADE_OUT_TIME).c_str());
|
||||
return result;
|
||||
} // getSuperFadeOutTime
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
float AbstractCharacteristic::getSwatterDuration() const
|
||||
{
|
||||
|
||||
@@ -154,6 +154,12 @@ public:
|
||||
ZIPPER_MAX_SPEED_INCREASE,
|
||||
ZIPPER_FADE_OUT_TIME,
|
||||
|
||||
// Super size
|
||||
SUPER_DURATION,
|
||||
SUPER_FORCE,
|
||||
SUPER_MAX_SPEED_INCREASE,
|
||||
SUPER_FADE_OUT_TIME,
|
||||
|
||||
// Swatter
|
||||
SWATTER_DURATION,
|
||||
SWATTER_DISTANCE,
|
||||
@@ -329,6 +335,11 @@ public:
|
||||
float getZipperMaxSpeedIncrease() const;
|
||||
float getZipperFadeOutTime() const;
|
||||
|
||||
float getSuperDuration() const;
|
||||
float getSuperForce() const;
|
||||
float getSuperMaxSpeedIncrease() const;
|
||||
float getSuperFadeOutTime() const;
|
||||
|
||||
float getSwatterDuration() const;
|
||||
float getSwatterDistance() const;
|
||||
float getSwatterSquashDuration() const;
|
||||
|
||||
@@ -261,8 +261,6 @@ public:
|
||||
/** Returns true if the kart has a plunger attached to its face. */
|
||||
virtual int getBlockedByPlungerTicks() const = 0;
|
||||
// ------------------------------------------------------------------------
|
||||
virtual float getGraphicalViewBlockedByPlunger() const = 0;
|
||||
// ------------------------------------------------------------------------
|
||||
/** Sets that the view is blocked by a plunger. The duration depends on
|
||||
* the difficulty, see KartPorperties getPlungerInFaceTime. */
|
||||
virtual void blockViewWithPlunger() = 0;
|
||||
@@ -270,6 +268,9 @@ public:
|
||||
/** Returns if the kart is currently being squashed. */
|
||||
virtual bool isSquashed() const = 0;
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns if the kart is currently being super-sized. */
|
||||
virtual bool isSuperSized() const = 0;
|
||||
// ------------------------------------------------------------------------
|
||||
/** Squashes this kart: it will scale the kart in up direction, and causes
|
||||
* a slowdown while this kart is squashed.
|
||||
* \param time How long the kart will be squashed.
|
||||
@@ -279,6 +280,17 @@ public:
|
||||
/** Makes the kart unsquashed again. */
|
||||
virtual void unsetSquash() = 0;
|
||||
// ------------------------------------------------------------------------
|
||||
/** This activates super mode for kart ; upscaling it and giving it
|
||||
* other perks. */
|
||||
virtual void setSuper() = 0;
|
||||
// ------------------------------------------------------------------------
|
||||
/** This disables super mode
|
||||
* \param instant Is this a normal end or a reset */
|
||||
virtual void unsetSuper(bool instant) = 0;
|
||||
// ------------------------------------------------------------------------
|
||||
/** Updates the kart's current scaling */
|
||||
virtual void updateScale(int ticks) = 0;
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the speed of the kart in meters/second. This is not declared
|
||||
* pure abstract, since this function is not needed for certain classes,
|
||||
* like Ghost. */
|
||||
|
||||
@@ -143,19 +143,9 @@ void AbstractKartAnimation::addNetworkAnimationChecker(bool reset_powerup)
|
||||
{
|
||||
// Prevent access to deleted kart animation object
|
||||
std::weak_ptr<int> cct = m_check_created_ticks;
|
||||
Vec3 original_position;
|
||||
AbstractKart* k = m_kart;
|
||||
if (k)
|
||||
original_position = k->getXYZ();
|
||||
RewindManager::get()->addRewindInfoEventFunction(new
|
||||
RewindInfoEventFunction(m_created_ticks,
|
||||
/*undo_function*/[cct, k, original_position]()
|
||||
{
|
||||
auto cct_sp = cct.lock();
|
||||
if (!cct_sp || !k)
|
||||
return;
|
||||
k->setXYZ(original_position);
|
||||
},
|
||||
[](){},
|
||||
/*replay_function*/[p]()
|
||||
{
|
||||
if (p)
|
||||
|
||||
@@ -30,14 +30,6 @@
|
||||
|
||||
class AbstractKart;
|
||||
|
||||
enum KartAnimationType : uint8_t
|
||||
{
|
||||
KAT_RESCUE = 0,
|
||||
KAT_EXPLOSION_DIRECT_HIT = 1,
|
||||
KAT_EXPLOSION = 2,
|
||||
KAT_CANNON = 3
|
||||
};
|
||||
|
||||
/** The base class for all kart animation, like rescue, explosion, or cannon.
|
||||
* Kart animations are done by removing the physics body from the physics
|
||||
* world, and instead modifying the rotation and position of the kart
|
||||
@@ -102,12 +94,10 @@ public:
|
||||
m_end_transform = t;
|
||||
m_end_ticks = ticks;
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
void checkNetworkAnimationCreationSucceed(const btTransform& fb_trans);
|
||||
// ------------------------------------------------------------------------
|
||||
// ----------------------------------------------------------------------------
|
||||
void checkNetworkAnimationCreationSucceed(const btTransform& fallback_trans);
|
||||
// ----------------------------------------------------------------------------
|
||||
int getEndTicks() const { return m_end_ticks; }
|
||||
// ------------------------------------------------------------------------
|
||||
virtual KartAnimationType getAnimationType() const = 0;
|
||||
}; // AbstractKartAnimation
|
||||
|
||||
#endif
|
||||
|
||||
@@ -81,8 +81,6 @@ public:
|
||||
virtual ~CannonAnimation();
|
||||
virtual void update(int ticks);
|
||||
// ------------------------------------------------------------------------
|
||||
virtual bool usePredefinedEndTransform() const { return false; }
|
||||
// ------------------------------------------------------------------------
|
||||
virtual KartAnimationType getAnimationType() const { return KAT_CANNON; }
|
||||
virtual bool usePredefinedEndTransform() const { return false; }
|
||||
}; // CannonAnimation
|
||||
#endif
|
||||
|
||||
@@ -101,8 +101,6 @@ void NetworkAIController::convertAIToPlayerActions()
|
||||
0 : 32768);
|
||||
all_actions.emplace_back(PA_RESCUE,
|
||||
m_ai_controls->getRescue() ? 32768 : 0);
|
||||
all_actions.emplace_back(PA_LOOK_BACK,
|
||||
m_ai_controls->getLookBack() ? 32768 : 0);
|
||||
|
||||
for (const auto& a : all_actions)
|
||||
{
|
||||
|
||||
@@ -316,9 +316,6 @@ void SkiddingAI::update(int ticks)
|
||||
|
||||
int num_ai = m_world->getNumKarts() - race_manager->getNumPlayers();
|
||||
int position_among_ai = m_kart->getPosition() - m_num_players_ahead;
|
||||
// Karts with boosted AI get a better speed cap value
|
||||
if (m_kart->getBoostAI())
|
||||
position_among_ai = 1;
|
||||
|
||||
float speed_cap = m_ai_properties->getSpeedCap(m_distance_to_player,
|
||||
position_among_ai,
|
||||
@@ -1066,6 +1063,7 @@ void SkiddingAI::evaluateItems(const Item *item, Vec3 kart_aim_direction,
|
||||
* Level 2 to 5 AI : strategy detailed before each item
|
||||
* Each successive level is overall stronger (5 the strongest, 2 the weakest of
|
||||
* non-random strategies), but two levels may share a strategy for a given item.
|
||||
* (level 5 is not yet used ; meant for SuperTux GP preferred karts or boss races)
|
||||
* \param dt Time step size.
|
||||
* STATE: shield on -> avoid usage of offensive items (with certain tolerance)
|
||||
* STATE: swatter on -> avoid usage of shield
|
||||
@@ -1243,6 +1241,12 @@ void SkiddingAI::handleItems(const float dt, const Vec3 *aim_point, int last_nod
|
||||
m_controls->setFire(true);
|
||||
break; // POWERUP_PARACHUTE
|
||||
|
||||
case PowerupManager::POWERUP_SUPER_SIZE:
|
||||
// FIXME : this is a temporary AI to avoid crashes
|
||||
if(m_time_since_last_shot > 1.0f)
|
||||
m_controls->setFire(true);
|
||||
break; // POWERUP_SUPER_SIZE
|
||||
|
||||
case PowerupManager::POWERUP_SWATTER:
|
||||
{
|
||||
// if the kart has a shield, do not break it by using a swatter.
|
||||
@@ -1362,7 +1366,7 @@ void SkiddingAI::handleBubblegum(int item_skill, const std::vector<const Item *>
|
||||
//if it is a bomb, wait : we may pass it to another kart before the timer runs out
|
||||
if (item_skill == 5 && type == Attachment::ATTACH_BOMB)
|
||||
{
|
||||
if (m_kart->getAttachment()->getTicksLeft() < stk_config->time2Ticks(2))
|
||||
if (m_kart->getAttachment()->getTicksLeft() > stk_config->time2Ticks(3))
|
||||
{
|
||||
m_controls->setFire(true);
|
||||
m_controls->setLookBack(false);
|
||||
@@ -1426,8 +1430,7 @@ void SkiddingAI::handleBubblegum(int item_skill, const std::vector<const Item *>
|
||||
if (abs_angle < 0.2f) straight_behind = true;
|
||||
}
|
||||
|
||||
if(m_distance_behind < 8.0f && straight_behind &&
|
||||
(!ItemManager::get()->areItemSwitched() || item_skill < 4))
|
||||
if(m_distance_behind < 8.0f && straight_behind )
|
||||
{
|
||||
m_controls->setFire(true);
|
||||
m_controls->setLookBack(true);
|
||||
|
||||
@@ -72,7 +72,7 @@ ExplosionAnimation *ExplosionAnimation::create(AbstractKart *kart)
|
||||
// ----------------------------------------------------------------------------
|
||||
ExplosionAnimation::ExplosionAnimation(AbstractKart *kart,
|
||||
const Vec3 &explosion_position,
|
||||
bool direct_hit, bool from_state)
|
||||
bool direct_hit)
|
||||
: AbstractKartAnimation(kart, "ExplosionAnimation")
|
||||
{
|
||||
m_direct_hit = direct_hit;
|
||||
@@ -148,8 +148,7 @@ ExplosionAnimation::ExplosionAnimation(AbstractKart *kart,
|
||||
|
||||
m_kart->getAttachment()->clear();
|
||||
// Clear powerups when direct hit in CTF
|
||||
if (!from_state)
|
||||
addNetworkAnimationChecker(m_reset_ticks != -1);
|
||||
addNetworkAnimationChecker(m_reset_ticks != -1);
|
||||
} // ExplosionAnimation
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -74,9 +74,9 @@ protected:
|
||||
Vec3 m_reset_xyz, m_reset_normal;
|
||||
|
||||
ExplosionAnimation(AbstractKart *kart);
|
||||
public:
|
||||
ExplosionAnimation(AbstractKart *kart, const Vec3 &pos,
|
||||
bool direct_hit, bool from_state = false);
|
||||
bool direct_hit);
|
||||
public:
|
||||
static ExplosionAnimation *create(AbstractKart *kart, const Vec3 &pos,
|
||||
bool direct_hit);
|
||||
static ExplosionAnimation *create(AbstractKart *kart);
|
||||
@@ -85,8 +85,5 @@ public:
|
||||
virtual void update(int ticks);
|
||||
bool hasResetAlready() const
|
||||
{ return m_reset_ticks != -1 && m_timer < m_reset_ticks; }
|
||||
// ------------------------------------------------------------------------
|
||||
virtual KartAnimationType getAnimationType() const
|
||||
{ return m_direct_hit ? KAT_EXPLOSION_DIRECT_HIT : KAT_EXPLOSION; }
|
||||
}; // ExplosionAnimation
|
||||
#endif
|
||||
|
||||
@@ -135,7 +135,6 @@ Kart::Kart (const std::string& ident, unsigned int world_kart_id,
|
||||
m_fire_clicked = 0;
|
||||
m_boosted_ai = false;
|
||||
m_type = RaceManager::KT_AI;
|
||||
m_flying = false;
|
||||
|
||||
m_xyz_history_size = stk_config->time2Ticks(XYZ_HISTORY_TIME);
|
||||
|
||||
@@ -185,7 +184,7 @@ Kart::Kart (const std::string& ident, unsigned int world_kart_id,
|
||||
m_terrain_sound = NULL;
|
||||
m_last_sound_material = NULL;
|
||||
m_previous_terrain_sound = NULL;
|
||||
m_graphical_view_blocked_by_plunger = 0.0f;
|
||||
|
||||
} // Kart
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@@ -299,7 +298,7 @@ Kart::~Kart()
|
||||
*/
|
||||
void Kart::reset()
|
||||
{
|
||||
if (m_flying && !isGhostKart())
|
||||
if (m_flying)
|
||||
{
|
||||
m_flying = false;
|
||||
stopFlying();
|
||||
@@ -349,6 +348,7 @@ void Kart::reset()
|
||||
m_collision_particles->setCreationRateAbsolute(0.0f);
|
||||
#endif
|
||||
|
||||
unsetSuper(true /*instant*/);
|
||||
unsetSquash();
|
||||
|
||||
m_last_used_powerup = PowerupManager::POWERUP_NOTHING;
|
||||
@@ -361,7 +361,9 @@ void Kart::reset()
|
||||
m_invulnerable_ticks = 0;
|
||||
m_min_nitro_ticks = 0;
|
||||
m_energy_to_min_ratio = 0;
|
||||
m_scale_change_ticks = 0;
|
||||
m_squash_time = std::numeric_limits<float>::max();
|
||||
m_super_time = std::numeric_limits<float>::max();
|
||||
m_collected_energy = 0;
|
||||
m_bounce_back_ticks = 0;
|
||||
m_brake_ticks = 0;
|
||||
@@ -370,7 +372,6 @@ void Kart::reset()
|
||||
m_current_lean = 0.0f;
|
||||
m_falling_time = 0.0f;
|
||||
m_view_blocked_by_plunger = 0;
|
||||
m_graphical_view_blocked_by_plunger = 0.0f;
|
||||
m_has_caught_nolok_bubblegum = false;
|
||||
m_is_jumping = false;
|
||||
m_flying = false;
|
||||
@@ -591,15 +592,8 @@ void Kart::blockViewWithPlunger()
|
||||
{
|
||||
// Avoid that a plunger extends the plunger time
|
||||
if(m_view_blocked_by_plunger<=0 && !isShielded())
|
||||
{
|
||||
m_view_blocked_by_plunger =
|
||||
stk_config->time2Ticks(m_kart_properties->getPlungerInFaceTime());
|
||||
if (m_graphical_view_blocked_by_plunger == 0.0f)
|
||||
{
|
||||
m_graphical_view_blocked_by_plunger =
|
||||
m_kart_properties->getPlungerInFaceTime();
|
||||
}
|
||||
}
|
||||
if(isShielded())
|
||||
{
|
||||
decreaseShieldTime();
|
||||
@@ -883,27 +877,22 @@ float Kart::getSpeedForTurnRadius(float radius) const
|
||||
InterpolationArray turn_angle_at_speed = m_kart_properties->getTurnRadius();
|
||||
// Convert the turn radius into turn angle
|
||||
for(int i = 0; i < (int)turn_angle_at_speed.size(); i++)
|
||||
turn_angle_at_speed.setY(i, sin( 1.0 / turn_angle_at_speed.getY(i)));
|
||||
turn_angle_at_speed.setY(i, sin(m_kart_properties->getWheelBase() /
|
||||
turn_angle_at_speed.getY(i)));
|
||||
|
||||
float angle = sin(1.0 / radius);
|
||||
float angle = sin(m_kart_properties->getWheelBase() / radius);
|
||||
return turn_angle_at_speed.getReverse(angle);
|
||||
} // getSpeedForTurnRadius
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the maximum steering angle (depending on speed).
|
||||
This is proportional to kart length because physics reverse this effect,
|
||||
the results of this function should not be used to determine the
|
||||
real raw steer angle. */
|
||||
/** Returns the maximum steering angle (depending on speed). */
|
||||
float Kart::getMaxSteerAngle(float speed) const
|
||||
{
|
||||
InterpolationArray turn_angle_at_speed = m_kart_properties->getTurnRadius();
|
||||
// Convert the turn radius into turn angle
|
||||
// We multiply by wheel base to keep turn radius identical
|
||||
// across karts of different lengths sharing the same
|
||||
// turn radius properties
|
||||
for(int i = 0; i < (int)turn_angle_at_speed.size(); i++)
|
||||
turn_angle_at_speed.setY(i, sin( 1.0 / turn_angle_at_speed.getY(i))
|
||||
* m_kart_properties->getWheelBase());
|
||||
turn_angle_at_speed.setY(i, sin(m_kart_properties->getWheelBase() /
|
||||
turn_angle_at_speed.getY(i)));
|
||||
|
||||
return turn_angle_at_speed.get(speed);
|
||||
} // getMaxSteerAngle
|
||||
@@ -959,16 +948,10 @@ void Kart::finishedRace(float time, bool from_server)
|
||||
World::getWorld()->getTicksSinceStart(),
|
||||
/*undo_function*/[old_controller, this]()
|
||||
{
|
||||
if (m_network_finish_check_ticks == -1)
|
||||
return;
|
||||
|
||||
m_controller = old_controller;
|
||||
},
|
||||
/*replay_function*/[ec, old_controller, this]()
|
||||
{
|
||||
if (m_network_finish_check_ticks == -1)
|
||||
return;
|
||||
|
||||
m_saved_controller = old_controller;
|
||||
ec->reset();
|
||||
m_controller = ec;
|
||||
@@ -1078,8 +1061,9 @@ void Kart::setRaceResult()
|
||||
}
|
||||
else if (race_manager->getMajorMode() == RaceManager::MAJOR_MODE_FREE_FOR_ALL)
|
||||
{
|
||||
// the top kart wins
|
||||
FreeForAll* ffa = dynamic_cast<FreeForAll*>(World::getWorld());
|
||||
m_race_result = ffa->getKartFFAResult(getWorldKartId());
|
||||
m_race_result = ffa->getKartAtPosition(1) == this;
|
||||
}
|
||||
else if (race_manager->getMajorMode() == RaceManager::MAJOR_MODE_CAPTURE_THE_FLAG)
|
||||
{
|
||||
@@ -1332,13 +1316,13 @@ void Kart::eliminate()
|
||||
*/
|
||||
void Kart::update(int ticks)
|
||||
{
|
||||
if (m_network_finish_check_ticks > 0 &&
|
||||
if (m_network_finish_check_ticks != 0 &&
|
||||
World::getWorld()->getTicksSinceStart() >
|
||||
m_network_finish_check_ticks &&
|
||||
!m_finished_race && m_saved_controller != NULL)
|
||||
{
|
||||
Log::warn("Kart", "Missing finish race from server.");
|
||||
m_network_finish_check_ticks = -1;
|
||||
m_network_finish_check_ticks = 0;
|
||||
delete m_controller;
|
||||
m_controller = m_saved_controller;
|
||||
m_saved_controller = NULL;
|
||||
@@ -1441,10 +1425,7 @@ void Kart::update(int ticks)
|
||||
if(m_view_blocked_by_plunger > 0) m_view_blocked_by_plunger -= ticks;
|
||||
//unblock the view if kart just became shielded
|
||||
if(isShielded())
|
||||
{
|
||||
m_view_blocked_by_plunger = 0;
|
||||
m_graphical_view_blocked_by_plunger = 0.0f;
|
||||
}
|
||||
// Decrease remaining invulnerability time
|
||||
if(m_invulnerable_ticks>0)
|
||||
{
|
||||
@@ -1553,7 +1534,7 @@ void Kart::update(int ticks)
|
||||
"v(16-18) %f %f %f steerf(20) %f maxangle(22) %f speed(24) %f "
|
||||
"steering(26-27) %f %f clock(29) %lf skidstate(31) %d factor(33) %f "
|
||||
"maxspeed(35) %f engf(37) %f braketick(39) %d brakes(41) %d heading(43) %f "
|
||||
"bubticks(45) %d bubtor(47) %f",
|
||||
"noderot(45) %f suslen %f",
|
||||
getIdent().c_str(),
|
||||
World::getWorld()->getTime(), World::getWorld()->getTicksSinceStart(),
|
||||
getXYZ().getX(), getXYZ().getY(), getXYZ().getZ(),
|
||||
@@ -1574,8 +1555,8 @@ void Kart::update(int ticks)
|
||||
m_brake_ticks, //39
|
||||
m_controls.getButtonsCompressed(), //41
|
||||
getHeading(), //43
|
||||
m_bubblegum_ticks, // 45
|
||||
m_bubblegum_torque // 47
|
||||
m_node->getAbsoluteTransformation().getRotationDegrees().Y, //45
|
||||
m_vehicle->getWheelInfo(0).m_raycastInfo.m_suspensionLength
|
||||
);
|
||||
#endif
|
||||
// After the physics step was done, the position of the wheels (as stored
|
||||
@@ -1684,7 +1665,6 @@ void Kart::update(int ticks)
|
||||
if (emergency)
|
||||
{
|
||||
m_view_blocked_by_plunger = 0;
|
||||
m_graphical_view_blocked_by_plunger = 0.0f;
|
||||
if (m_flying)
|
||||
{
|
||||
stopFlying();
|
||||
@@ -1815,6 +1795,14 @@ void Kart::setSquash(float time, float slowdown)
|
||||
return;
|
||||
}
|
||||
|
||||
if(isSuperSized())
|
||||
{
|
||||
unsetSuper(true /*instant*/);
|
||||
setInvulnerableTicks(stk_config->time2Ticks(2.5f));
|
||||
showStarEffect(2.5f);
|
||||
return;
|
||||
}
|
||||
|
||||
m_max_speed->setSlowdown(MaxSpeed::MS_DECREASE_SQUASH, slowdown,
|
||||
stk_config->time2Ticks(0.1f),
|
||||
stk_config->time2Ticks(time));
|
||||
@@ -1869,6 +1857,86 @@ void Kart::unsetSquash()
|
||||
#endif
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** This activates super mode for kart ; upscaling it and giving it
|
||||
* other perks. */
|
||||
void Kart::setSuper()
|
||||
{
|
||||
if (isSquashed())
|
||||
unsetSquash();
|
||||
|
||||
float max_speed_increase = m_kart_properties->getSuperMaxSpeedIncrease();
|
||||
float duration = m_kart_properties->getSuperDuration();
|
||||
float fade_out_time = m_kart_properties->getSuperFadeOutTime();
|
||||
float engine_force = m_kart_properties->getSuperForce();
|
||||
|
||||
m_max_speed->increaseMaxSpeed(MaxSpeed::MS_INCREASE_SUPER,
|
||||
max_speed_increase,
|
||||
engine_force,
|
||||
stk_config->time2Ticks(duration),
|
||||
stk_config->time2Ticks(fade_out_time));
|
||||
// Kart small or downscaling and not currently upscaling
|
||||
if (m_scale_change_ticks <= 0 && m_super_time == std::numeric_limits<float>::max())
|
||||
m_scale_change_ticks = stk_config->time2Ticks(SUPER_TRANSITION_TIME) +
|
||||
m_scale_change_ticks;
|
||||
|
||||
m_super_time = duration;
|
||||
} // setSuper
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Update the scale according to m_scale_change_ticks
|
||||
*/
|
||||
void Kart::updateScale(int ticks)
|
||||
{
|
||||
//TODO update physics model too
|
||||
if (m_scale_change_ticks == 0) return;
|
||||
|
||||
float scale_by_tick = 0.5/(float)stk_config->time2Ticks(SUPER_TRANSITION_TIME);
|
||||
float scale_factor;
|
||||
if (m_scale_change_ticks > 0)
|
||||
{
|
||||
m_scale_change_ticks -= ticks;
|
||||
if (m_scale_change_ticks < 0) m_scale_change_ticks = 0;
|
||||
scale_factor = 1.5 - (m_scale_change_ticks*scale_by_tick);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_scale_change_ticks += ticks;
|
||||
if (m_scale_change_ticks > 0) m_scale_change_ticks = 0;
|
||||
scale_factor = 1.0 - (m_scale_change_ticks*scale_by_tick);
|
||||
}
|
||||
|
||||
#ifndef SERVER_ONLY
|
||||
m_node->setScale(core::vector3df(scale_factor,scale_factor,scale_factor));
|
||||
#endif
|
||||
} // setSuper
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** This disables super mode
|
||||
* \param instant Is this a normal end or a reset */
|
||||
void Kart::unsetSuper(bool instant)
|
||||
{
|
||||
//TODO update physics model too
|
||||
m_super_time = std::numeric_limits<float>::max();
|
||||
if (instant)
|
||||
{
|
||||
#ifndef SERVER_ONLY
|
||||
m_node->setScale(core::vector3df(1.0f,1.0f,1.0f));
|
||||
#endif
|
||||
m_scale_change_ticks = 0;
|
||||
// This resets the speed boost
|
||||
m_max_speed->increaseMaxSpeed(MaxSpeed::MS_INCREASE_SUPER,
|
||||
0, 0, 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Will scale back to normal over time
|
||||
m_scale_change_ticks = -40;
|
||||
// The speed boost will end by itself
|
||||
}
|
||||
} // unsetSuper
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Returns if the kart is currently being squashed
|
||||
*/
|
||||
@@ -1878,6 +1946,16 @@ bool Kart::isSquashed() const
|
||||
m_max_speed->isSpeedDecreaseActive(MaxSpeed::MS_DECREASE_SQUASH) == 1;
|
||||
} // setSquash
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Returns if the kart is currently super-sized
|
||||
*/
|
||||
bool Kart::isSuperSized() const
|
||||
{
|
||||
return
|
||||
m_max_speed->getSpeedIncreaseTicksLeft(MaxSpeed::MS_INCREASE_SUPER) > 0;
|
||||
} // setSquash
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Plays any terrain specific sound effect.
|
||||
*/
|
||||
@@ -2529,6 +2607,18 @@ bool Kart::playCustomSFX(unsigned int type)
|
||||
*/
|
||||
void Kart::updatePhysics(int ticks)
|
||||
{
|
||||
if (m_super_time != std::numeric_limits<float>::max())
|
||||
{
|
||||
m_super_time -= stk_config->ticks2Time(ticks);
|
||||
// If super time ends, reset the model
|
||||
if (m_super_time <= 0.0f)
|
||||
{
|
||||
unsetSuper(false /*instant*/);
|
||||
}
|
||||
} // if super
|
||||
|
||||
updateScale(ticks);
|
||||
|
||||
if (m_controls.getAccel() > 0.0f &&
|
||||
World::getWorld()->getTicksSinceStart() == 1)
|
||||
{
|
||||
@@ -3061,10 +3151,6 @@ void Kart::updateGraphics(float dt)
|
||||
unsetSquash();
|
||||
}
|
||||
} // if squashed
|
||||
if (m_graphical_view_blocked_by_plunger > 0.0f)
|
||||
m_graphical_view_blocked_by_plunger -= dt;
|
||||
if (m_graphical_view_blocked_by_plunger < 0.0f)
|
||||
m_graphical_view_blocked_by_plunger = 0.0f;
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < EMITTER_COUNT; i++)
|
||||
|
||||
@@ -223,9 +223,6 @@ protected:
|
||||
/** When a kart has its view blocked by the plunger, this variable will be
|
||||
* > 0 the number it contains is the time left before removing plunger. */
|
||||
int16_t m_view_blocked_by_plunger;
|
||||
|
||||
float m_graphical_view_blocked_by_plunger;
|
||||
|
||||
/** The current speed (i.e. length of velocity vector) of this kart. */
|
||||
float m_speed;
|
||||
|
||||
@@ -256,6 +253,12 @@ protected:
|
||||
int m_ticks_last_crash;
|
||||
RaceManager::KartType m_type;
|
||||
|
||||
// Used to know where we are when upscaling/downscaling the kart
|
||||
// Set to positive to upscale, to negative to downscale
|
||||
int8_t m_scale_change_ticks;
|
||||
float m_super_time;
|
||||
const float SUPER_TRANSITION_TIME = 0.5;//TODO : move to config
|
||||
|
||||
/** To prevent using nitro in too short bursts */
|
||||
int8_t m_min_nitro_ticks;
|
||||
|
||||
@@ -318,6 +321,10 @@ public:
|
||||
virtual void setSquash (float time, float slowdown) OVERRIDE;
|
||||
virtual void unsetSquash () OVERRIDE;
|
||||
|
||||
virtual void setSuper () OVERRIDE;
|
||||
virtual void unsetSuper (bool instant) OVERRIDE;
|
||||
virtual void updateScale (int ticks) OVERRIDE;
|
||||
|
||||
virtual void crashed (AbstractKart *k, bool update_attachments) OVERRIDE;
|
||||
virtual void crashed (const Material *m, const Vec3 &normal) OVERRIDE;
|
||||
virtual float getHoT () const OVERRIDE;
|
||||
@@ -397,9 +404,6 @@ public:
|
||||
virtual int getBlockedByPlungerTicks() const OVERRIDE
|
||||
{ return m_view_blocked_by_plunger; }
|
||||
// ------------------------------------------------------------------------
|
||||
virtual float getGraphicalViewBlockedByPlunger() const OVERRIDE
|
||||
{ return m_graphical_view_blocked_by_plunger; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Sets that the view is blocked by a plunger. The duration depends on
|
||||
* the difficulty, see KartPorperties getPlungerInFaceTime. */
|
||||
virtual void blockViewWithPlunger() OVERRIDE;
|
||||
@@ -514,6 +518,9 @@ public:
|
||||
/** Returns if the kart is currently being squashed. */
|
||||
virtual bool isSquashed() const OVERRIDE;
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns if the kart is currently super sized. */
|
||||
virtual bool isSuperSized() const OVERRIDE;
|
||||
// ------------------------------------------------------------------------
|
||||
/** Shows the star effect for a certain time. */
|
||||
virtual void showStarEffect(float t) OVERRIDE;
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
@@ -303,12 +303,17 @@ void KartProperties::load(const std::string &filename, const std::string &node)
|
||||
m_gravity_center_shift.setZ(0);
|
||||
}
|
||||
|
||||
// The longer the kart,the bigger its turn radius if using an identical
|
||||
// wheel base, exactly proportionally to its length.
|
||||
// The wheel base is used to compensate this
|
||||
// We divide by 1.425 to have a default turn radius which conforms
|
||||
// closely (+-0,1%) with the specifications in kart_characteristics.xml
|
||||
m_wheel_base = fabsf(m_kart_model->getLength()/1.425f);
|
||||
// In older STK versions the physical wheels where moved 'wheel_radius'
|
||||
// into the physical body (i.e. 'hypothetical' wheel shape would not
|
||||
// poke out of the physical shape). In order to make the karts a bit more
|
||||
// stable, the physical wheel position (i.e. location of raycast) were
|
||||
// moved to be on the corner of the shape. In order to retain the same
|
||||
// steering behaviour, the wheel base (which in turn determines the
|
||||
// turn angle at certain speeds) is shortened by 2*wheel_radius
|
||||
// Wheel radius was always 0.25, and is now not used anymore, but in order
|
||||
// to keep existing steering behaviour, the same formula is still
|
||||
// used.
|
||||
m_wheel_base = fabsf(m_kart_model->getLength() - 2*0.25f);
|
||||
|
||||
m_shadow_material = material_manager->getMaterialSPM(m_shadow_file, "",
|
||||
"alphablend");
|
||||
@@ -896,6 +901,30 @@ float KartProperties::getZipperFadeOutTime() const
|
||||
return m_cached_characteristic->getZipperFadeOutTime();
|
||||
} // getZipperFadeOutTime
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
float KartProperties::getSuperDuration() const
|
||||
{
|
||||
return m_cached_characteristic->getSuperDuration();
|
||||
} // getSuperDuration
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
float KartProperties::getSuperForce() const
|
||||
{
|
||||
return m_cached_characteristic->getSuperForce();
|
||||
} // getSuperForce
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
float KartProperties::getSuperMaxSpeedIncrease() const
|
||||
{
|
||||
return m_cached_characteristic->getSuperMaxSpeedIncrease();
|
||||
} // getSuperMaxSpeedIncrease
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
float KartProperties::getSuperFadeOutTime() const
|
||||
{
|
||||
return m_cached_characteristic->getSuperFadeOutTime();
|
||||
} // getSuperFadeOutTime
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
float KartProperties::getSwatterDuration() const
|
||||
{
|
||||
|
||||
@@ -444,6 +444,11 @@ public:
|
||||
float getZipperMaxSpeedIncrease() const;
|
||||
float getZipperFadeOutTime() const;
|
||||
|
||||
float getSuperDuration() const;
|
||||
float getSuperForce() const;
|
||||
float getSuperMaxSpeedIncrease() const;
|
||||
float getSuperFadeOutTime() const;
|
||||
|
||||
float getSwatterDuration() const;
|
||||
float getSwatterDistance() const;
|
||||
float getSwatterSquashDuration() const;
|
||||
|
||||
@@ -21,8 +21,7 @@
|
||||
#include "items/attachment.hpp"
|
||||
#include "items/powerup.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "karts/explosion_animation.hpp"
|
||||
#include "karts/rescue_animation.hpp"
|
||||
#include "karts/abstract_kart_animation.hpp"
|
||||
#include "karts/controller/player_controller.hpp"
|
||||
#include "karts/kart_properties.hpp"
|
||||
#include "karts/max_speed.hpp"
|
||||
@@ -53,7 +52,6 @@ KartRewinder::KartRewinder(const std::string& ident,
|
||||
*/
|
||||
void KartRewinder::reset()
|
||||
{
|
||||
m_last_animation_end_ticks = -1;
|
||||
m_transfrom_from_network =
|
||||
btTransform(btQuaternion(0.0f, 0.0f, 0.0f, 1.0f));
|
||||
Kart::reset();
|
||||
@@ -140,9 +138,7 @@ BareNetworkString* KartRewinder::saveState(std::vector<std::string>* ru)
|
||||
buffer->add(trans.getOrigin());
|
||||
btQuaternion quat = trans.getRotation();
|
||||
buffer->add(quat);
|
||||
unsigned et = ka->getEndTicks() & 134217727;
|
||||
et |= ka->getAnimationType() << 27;
|
||||
buffer->addUInt32(et);
|
||||
buffer->addUInt32(ka->getEndTicks());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -211,38 +207,10 @@ void KartRewinder::restoreState(BareNetworkString *buffer, int count)
|
||||
|
||||
if (has_animation)
|
||||
{
|
||||
unsigned et = buffer->getUInt32();
|
||||
int end_ticks = et & 134217727;
|
||||
KartAnimationType kat = (KartAnimationType)(et >> 27);
|
||||
if (!getKartAnimation() && end_ticks != m_last_animation_end_ticks)
|
||||
{
|
||||
Log::info("KartRewinder", "Creating animation %d from state", kat);
|
||||
switch (kat)
|
||||
{
|
||||
case KAT_RESCUE:
|
||||
new RescueAnimation(this, false/*is_auto_rescue*/,
|
||||
true/*from_state*/);
|
||||
break;
|
||||
case KAT_EXPLOSION_DIRECT_HIT:
|
||||
new ExplosionAnimation(this, getSmoothedXYZ(),
|
||||
true/*direct_hit*/, true/*from_state*/);
|
||||
break;
|
||||
case KAT_EXPLOSION:
|
||||
new ExplosionAnimation(this, getSmoothedXYZ(),
|
||||
false/*direct_hit*/, true/*from_state*/);
|
||||
break;
|
||||
default:
|
||||
Log::warn("KartRewinder", "Unknown animation %d from state",
|
||||
kat);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (getKartAnimation())
|
||||
{
|
||||
getKartAnimation()->setEndTransformTicks(m_transfrom_from_network,
|
||||
end_ticks);
|
||||
}
|
||||
m_last_animation_end_ticks = end_ticks;
|
||||
int end_ticks = buffer->getUInt32();
|
||||
AbstractKartAnimation* ka = getKartAnimation();
|
||||
if (ka)
|
||||
ka->setEndTransformTicks(m_transfrom_from_network, end_ticks);
|
||||
}
|
||||
|
||||
Vec3 lv = buffer->getVec3();
|
||||
|
||||
@@ -33,7 +33,6 @@ private:
|
||||
btTransform m_transfrom_from_network;
|
||||
float m_prev_steering, m_steering_smoothing_dt, m_steering_smoothing_time;
|
||||
|
||||
int m_last_animation_end_ticks;
|
||||
public:
|
||||
KartRewinder(const std::string& ident, unsigned int world_kart_id,
|
||||
int position, const btTransform& init_transform,
|
||||
|
||||
@@ -30,7 +30,7 @@ friend class KartRewinder;
|
||||
public:
|
||||
/** The categories to use for increasing the speed of a kart:
|
||||
* Increase due to zipper, slipstream, nitro, rubber band,
|
||||
* skidding usage. */
|
||||
* skidding usage, or super bonus (big kart). */
|
||||
enum {MS_INCREASE_MIN,
|
||||
MS_INCREASE_ZIPPER = MS_INCREASE_MIN,
|
||||
MS_INCREASE_SLIPSTREAM,
|
||||
@@ -38,6 +38,7 @@ public:
|
||||
MS_INCREASE_RUBBER,
|
||||
MS_INCREASE_SKIDDING,
|
||||
MS_INCREASE_RED_SKIDDING,
|
||||
MS_INCREASE_SUPER,
|
||||
MS_INCREASE_MAX};
|
||||
|
||||
/** The categories to use for decreasing the speed of a kart:
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "karts/kart_properties.hpp"
|
||||
#include "modes/three_strikes_battle.hpp"
|
||||
#include "network/network_config.hpp"
|
||||
#include "physics/btKart.hpp"
|
||||
#include "physics/physics.hpp"
|
||||
#include "physics/triangle_mesh.hpp"
|
||||
#include "tracks/drive_graph.hpp"
|
||||
@@ -40,8 +41,7 @@
|
||||
* and initialised the timer.
|
||||
* \param kart Pointer to the kart which is animated.
|
||||
*/
|
||||
RescueAnimation::RescueAnimation(AbstractKart *kart, bool is_auto_rescue,
|
||||
bool from_state)
|
||||
RescueAnimation::RescueAnimation(AbstractKart *kart, bool is_auto_rescue)
|
||||
: AbstractKartAnimation(kart, "RescueAnimation")
|
||||
{
|
||||
btTransform prev_trans = kart->getTrans();
|
||||
@@ -61,6 +61,7 @@ RescueAnimation::RescueAnimation(AbstractKart *kart, bool is_auto_rescue,
|
||||
m_up_vector = m_kart->getTrans().getBasis().getColumn(1);
|
||||
m_xyz = m_kart->getXYZ();
|
||||
m_kart->getAttachment()->clear();
|
||||
m_kart->getVehicle()->resetGroundHeight();
|
||||
|
||||
if (NetworkConfig::get()->isNetworking() &&
|
||||
NetworkConfig::get()->isServer())
|
||||
@@ -90,11 +91,8 @@ RescueAnimation::RescueAnimation(AbstractKart *kart, bool is_auto_rescue,
|
||||
}
|
||||
|
||||
// Clear powerups when rescue in CTF
|
||||
if (!from_state)
|
||||
{
|
||||
addNetworkAnimationChecker(race_manager->getMajorMode() ==
|
||||
RaceManager::MAJOR_MODE_CAPTURE_THE_FLAG);
|
||||
}
|
||||
addNetworkAnimationChecker(race_manager->getMajorMode() ==
|
||||
RaceManager::MAJOR_MODE_CAPTURE_THE_FLAG);
|
||||
} // RescueAnimation
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -49,13 +49,9 @@ protected:
|
||||
Referee *m_referee;
|
||||
|
||||
public:
|
||||
RescueAnimation(AbstractKart *kart,
|
||||
bool is_auto_rescue = false,
|
||||
bool from_state = false);
|
||||
RescueAnimation(AbstractKart *kart, bool is_auto_rescue=false);
|
||||
float maximumHeight();
|
||||
virtual ~RescueAnimation();
|
||||
virtual void update(int ticks);
|
||||
// ------------------------------------------------------------------------
|
||||
virtual KartAnimationType getAnimationType() const { return KAT_RESCUE; }
|
||||
}; // RescueAnimation
|
||||
#endif
|
||||
|
||||
@@ -421,7 +421,6 @@ void Skidding::update(int ticks, bool is_on_ground,
|
||||
m_predicted_curve->setHeading(m_kart->getHeading());
|
||||
float angle = m_kart->getMaxSteerAngle(SPEED)
|
||||
* fabsf(getSteeringFraction());
|
||||
//FIXME : what is this for ?
|
||||
float r = kp->getWheelBase()
|
||||
/ asin(angle)*1.0f;
|
||||
|
||||
|
||||
@@ -483,6 +483,18 @@ void XmlCharacteristic::load(const XMLNode *node)
|
||||
&m_values[ZIPPER_FADE_OUT_TIME]);
|
||||
}
|
||||
|
||||
if (const XMLNode *sub_node = node->getNode("super"))
|
||||
{
|
||||
sub_node->get("duration",
|
||||
&m_values[SUPER_DURATION]);
|
||||
sub_node->get("force",
|
||||
&m_values[SUPER_FORCE]);
|
||||
sub_node->get("max-speed-increase",
|
||||
&m_values[SUPER_MAX_SPEED_INCREASE]);
|
||||
sub_node->get("fade-out-time",
|
||||
&m_values[SUPER_FADE_OUT_TIME]);
|
||||
}
|
||||
|
||||
if (const XMLNode *sub_node = node->getNode("swatter"))
|
||||
{
|
||||
sub_node->get("duration",
|
||||
|
||||
17
src/main.cpp
17
src/main.cpp
@@ -1841,7 +1841,7 @@ void main_abort()
|
||||
{
|
||||
if (main_loop)
|
||||
{
|
||||
main_loop->requestAbort();
|
||||
main_loop->abort();
|
||||
}
|
||||
}
|
||||
#ifdef ANDROID
|
||||
@@ -1936,11 +1936,8 @@ int main(int argc, char *argv[] )
|
||||
}
|
||||
else if (CommandLine::has("--lan-server", &s))
|
||||
{
|
||||
if (no_graphics)
|
||||
{
|
||||
ProfileWorld::disableGraphics();
|
||||
UserConfigParams::m_enable_sound = false;
|
||||
}
|
||||
ProfileWorld::disableGraphics();
|
||||
UserConfigParams::m_enable_sound = false;
|
||||
NetworkConfig::get()->setIsServer(true);
|
||||
ServerConfig::m_server_name = s;
|
||||
ServerConfig::m_wan_server = false;
|
||||
@@ -2282,10 +2279,8 @@ int main(int argc, char *argv[] )
|
||||
{
|
||||
Log::closeOutputFiles();
|
||||
#endif
|
||||
#ifndef ANDROID
|
||||
fclose(stderr);
|
||||
fclose(stdout);
|
||||
#endif
|
||||
#ifndef WIN32
|
||||
}
|
||||
#endif
|
||||
@@ -2341,9 +2336,6 @@ static void cleanSuperTuxKart()
|
||||
if(unlock_manager) delete unlock_manager;
|
||||
Online::ProfileManager::destroy();
|
||||
GUIEngine::DialogQueue::deallocate();
|
||||
GUIEngine::clear();
|
||||
GUIEngine::cleanUp();
|
||||
GUIEngine::clearScreenCache();
|
||||
if(font_manager) delete font_manager;
|
||||
|
||||
// Now finish shutting down objects which a separate thread. The
|
||||
@@ -2357,8 +2349,7 @@ static void cleanSuperTuxKart()
|
||||
#ifndef SERVER_ONLY
|
||||
if (!ProfileWorld::isNoGraphics())
|
||||
{
|
||||
if (UserConfigParams::m_internet_status == Online::RequestManager::
|
||||
IPERM_ALLOWED && !NewsManager::get()->waitForReadyToDeleted(2.0f))
|
||||
if(!NewsManager::get()->waitForReadyToDeleted(2.0f))
|
||||
{
|
||||
Log::info("Thread", "News manager not stopping, exiting anyway.");
|
||||
}
|
||||
|
||||
@@ -55,10 +55,10 @@ void override_default_params()
|
||||
{
|
||||
case ACONFIGURATION_SCREENSIZE_SMALL:
|
||||
case ACONFIGURATION_SCREENSIZE_NORMAL:
|
||||
UserConfigParams::m_multitouch_scale = 1.4f;
|
||||
UserConfigParams::m_multitouch_scale = 1.3f;
|
||||
break;
|
||||
case ACONFIGURATION_SCREENSIZE_LARGE:
|
||||
UserConfigParams::m_multitouch_scale = 1.3f;
|
||||
UserConfigParams::m_multitouch_scale = 1.2f;
|
||||
break;
|
||||
case ACONFIGURATION_SCREENSIZE_XLARGE:
|
||||
UserConfigParams::m_multitouch_scale = 1.1f;
|
||||
|
||||
@@ -65,8 +65,7 @@ LRESULT CALLBACK separateProcessProc(_In_ HWND hwnd, _In_ UINT uMsg,
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
MainLoop::MainLoop(unsigned parent_pid)
|
||||
: m_abort(false), m_request_abort(false), m_ticks_adjustment(0),
|
||||
m_parent_pid(parent_pid)
|
||||
: m_abort(false), m_ticks_adjustment(0), m_parent_pid(parent_pid)
|
||||
{
|
||||
m_curr_time = 0;
|
||||
m_prev_time = 0;
|
||||
@@ -308,22 +307,16 @@ void MainLoop::run()
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
if (msg.message == WM_QUIT)
|
||||
{
|
||||
m_request_abort = true;
|
||||
}
|
||||
m_abort = true;
|
||||
}
|
||||
// If parent is killed, abort the child main loop too
|
||||
if (WaitForSingleObject(parent, 0) != WAIT_TIMEOUT)
|
||||
{
|
||||
m_request_abort = true;
|
||||
}
|
||||
m_abort = true;
|
||||
}
|
||||
#else
|
||||
// POSIX equivalent
|
||||
if (m_parent_pid != 0 && getppid() != (int)m_parent_pid)
|
||||
{
|
||||
m_request_abort = true;
|
||||
}
|
||||
m_abort = true;
|
||||
#endif
|
||||
PROFILER_PUSH_CPU_MARKER("Main loop", 0xFF, 0x00, 0xF7);
|
||||
|
||||
@@ -334,28 +327,17 @@ void MainLoop::run()
|
||||
|
||||
// Shutdown next frame if shutdown request is sent while loading the
|
||||
// world
|
||||
if ((STKHost::existHost() && STKHost::get()->requestedShutdown()) ||
|
||||
m_request_abort)
|
||||
if (STKHost::existHost() && STKHost::get()->requestedShutdown())
|
||||
{
|
||||
bool exist_host = STKHost::existHost();
|
||||
SFXManager::get()->quickSound("anvil");
|
||||
core::stringw msg = _("Server connection timed out.");
|
||||
|
||||
if (!m_request_abort)
|
||||
if (!STKHost::get()->getErrorMessage().empty())
|
||||
{
|
||||
if (!ProfileWorld::isNoGraphics())
|
||||
{
|
||||
SFXManager::get()->quickSound("anvil");
|
||||
if (!STKHost::get()->getErrorMessage().empty())
|
||||
{
|
||||
msg = STKHost::get()->getErrorMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (exist_host == true)
|
||||
{
|
||||
STKHost::get()->shutdown();
|
||||
msg = STKHost::get()->getErrorMessage();
|
||||
}
|
||||
STKHost::get()->shutdown();
|
||||
// In case the user opened a race pause dialog
|
||||
GUIEngine::ModalDialog::dismiss();
|
||||
|
||||
#ifndef SERVER_ONLY
|
||||
if (CVS->isGLSL())
|
||||
@@ -368,32 +350,19 @@ void MainLoop::run()
|
||||
irr_driver->getActualScreenSize().Height);
|
||||
}
|
||||
#endif
|
||||
|
||||
// In case the user opened a race pause dialog
|
||||
GUIEngine::ModalDialog::dismiss();
|
||||
|
||||
|
||||
if (World::getWorld())
|
||||
{
|
||||
race_manager->clearNetworkGrandPrixResult();
|
||||
race_manager->exitRace();
|
||||
}
|
||||
|
||||
if (exist_host == true)
|
||||
if (!ProfileWorld::isNoGraphics())
|
||||
{
|
||||
if (!ProfileWorld::isNoGraphics())
|
||||
{
|
||||
StateManager::get()->resetAndSetStack(
|
||||
NetworkConfig::get()->getResetScreens().data());
|
||||
MessageQueue::add(MessageQueue::MT_ERROR, msg);
|
||||
}
|
||||
|
||||
NetworkConfig::get()->unsetNetworking();
|
||||
}
|
||||
|
||||
if (m_request_abort)
|
||||
{
|
||||
m_abort = true;
|
||||
StateManager::get()->resetAndSetStack(
|
||||
NetworkConfig::get()->getResetScreens().data());
|
||||
MessageQueue::add(MessageQueue::MT_ERROR, msg);
|
||||
}
|
||||
NetworkConfig::get()->unsetNetworking();
|
||||
}
|
||||
|
||||
if (!m_abort)
|
||||
@@ -423,96 +392,84 @@ void MainLoop::run()
|
||||
PROFILER_PUSH_CPU_MARKER("Database polling update", 0x00, 0x7F, 0x7F);
|
||||
Online::RequestManager::get()->update(frame_duration);
|
||||
PROFILER_POP_CPU_MARKER();
|
||||
}
|
||||
|
||||
m_ticks_adjustment.lock();
|
||||
if (m_ticks_adjustment.getData() != 0)
|
||||
m_ticks_adjustment.lock();
|
||||
if (m_ticks_adjustment.getData() != 0)
|
||||
{
|
||||
if (m_ticks_adjustment.getData() > 0)
|
||||
{
|
||||
if (m_ticks_adjustment.getData() > 0)
|
||||
num_steps += m_ticks_adjustment.getData();
|
||||
m_ticks_adjustment.getData() = 0;
|
||||
}
|
||||
else if (m_ticks_adjustment.getData() < 0)
|
||||
{
|
||||
int new_steps = num_steps + m_ticks_adjustment.getData();
|
||||
if (new_steps < 0)
|
||||
{
|
||||
num_steps += m_ticks_adjustment.getData();
|
||||
num_steps = 0;
|
||||
m_ticks_adjustment.getData() = new_steps;
|
||||
}
|
||||
else
|
||||
{
|
||||
num_steps = new_steps;
|
||||
m_ticks_adjustment.getData() = 0;
|
||||
}
|
||||
else if (m_ticks_adjustment.getData() < 0)
|
||||
{
|
||||
int new_steps = num_steps + m_ticks_adjustment.getData();
|
||||
if (new_steps < 0)
|
||||
{
|
||||
num_steps = 0;
|
||||
m_ticks_adjustment.getData() = new_steps;
|
||||
}
|
||||
else
|
||||
{
|
||||
num_steps = new_steps;
|
||||
m_ticks_adjustment.getData() = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
m_ticks_adjustment.unlock();
|
||||
|
||||
for (int i = 0; i < num_steps; i++)
|
||||
{
|
||||
if (World::getWorld() && history->replayHistory())
|
||||
{
|
||||
history->updateReplay(
|
||||
World::getWorld()->getTicksSinceStart());
|
||||
}
|
||||
|
||||
PROFILER_PUSH_CPU_MARKER("Protocol manager update",
|
||||
0x7F, 0x00, 0x7F);
|
||||
if (auto pm = ProtocolManager::lock())
|
||||
{
|
||||
pm->update(1);
|
||||
}
|
||||
PROFILER_POP_CPU_MARKER();
|
||||
|
||||
PROFILER_PUSH_CPU_MARKER("Update race", 0, 255, 255);
|
||||
if (World::getWorld())
|
||||
{
|
||||
updateRace(1);
|
||||
}
|
||||
PROFILER_POP_CPU_MARKER();
|
||||
|
||||
// We need to check again because update_race may have requested
|
||||
// the main loop to abort; and it's not a good idea to continue
|
||||
// since the GUI engine is no more to be called then.
|
||||
if (m_abort || m_request_abort)
|
||||
break;
|
||||
|
||||
if (m_frame_before_loading_world)
|
||||
{
|
||||
m_frame_before_loading_world = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (World::getWorld())
|
||||
{
|
||||
if (World::getWorld()->getPhase()==WorldStatus::SETUP_PHASE)
|
||||
{
|
||||
// Skip the large num steps contributed by loading time
|
||||
World::getWorld()->updateTime(1);
|
||||
break;
|
||||
}
|
||||
World::getWorld()->updateTime(1);
|
||||
}
|
||||
} // for i < num_steps
|
||||
}
|
||||
m_ticks_adjustment.unlock();
|
||||
|
||||
// Handle controller the last to avoid slow PC sending actions too
|
||||
// late
|
||||
for(int i=0; i<num_steps; i++)
|
||||
{
|
||||
if (World::getWorld() && history->replayHistory())
|
||||
history->updateReplay(World::getWorld()->getTicksSinceStart());
|
||||
|
||||
PROFILER_PUSH_CPU_MARKER("Protocol manager update",
|
||||
0x7F, 0x00, 0x7F);
|
||||
if (auto pm = ProtocolManager::lock())
|
||||
{
|
||||
pm->update(1);
|
||||
}
|
||||
PROFILER_POP_CPU_MARKER();
|
||||
|
||||
PROFILER_PUSH_CPU_MARKER("Update race", 0, 255, 255);
|
||||
if (World::getWorld()) updateRace(1);
|
||||
PROFILER_POP_CPU_MARKER();
|
||||
|
||||
// We need to check again because update_race may have requested
|
||||
// the main loop to abort; and it's not a good idea to continue
|
||||
// since the GUI engine is no more to be called then.
|
||||
if (m_abort) break;
|
||||
|
||||
if (m_frame_before_loading_world)
|
||||
{
|
||||
m_frame_before_loading_world = false;
|
||||
break;
|
||||
}
|
||||
if (World::getWorld())
|
||||
{
|
||||
if (World::getWorld()->getPhase() == WorldStatus::SETUP_PHASE)
|
||||
{
|
||||
// Skip the large num steps contributed by loading time
|
||||
World::getWorld()->updateTime(1);
|
||||
break;
|
||||
}
|
||||
World::getWorld()->updateTime(1);
|
||||
}
|
||||
} // for i < num_steps
|
||||
|
||||
// Handle controller the last to avoid slow PC sending actions too late
|
||||
if (!m_abort)
|
||||
{
|
||||
if (!ProfileWorld::isNoGraphics())
|
||||
{
|
||||
// User aborted (e.g. closed window)
|
||||
bool abort = !irr_driver->getDevice()->run();
|
||||
|
||||
if (abort)
|
||||
{
|
||||
m_request_abort = true;
|
||||
}
|
||||
m_abort = true;
|
||||
}
|
||||
|
||||
if (auto gp = GameProtocol::lock())
|
||||
{
|
||||
gp->sendActions();
|
||||
}
|
||||
}
|
||||
PROFILER_POP_CPU_MARKER(); // MainLoop pop
|
||||
PROFILER_SYNC_FRAME();
|
||||
@@ -525,4 +482,12 @@ void MainLoop::run()
|
||||
|
||||
} // run
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Set the abort flag, causing the mainloop to be left.
|
||||
*/
|
||||
void MainLoop::abort()
|
||||
{
|
||||
m_abort = true;
|
||||
} // abort
|
||||
|
||||
/* EOF */
|
||||
|
||||
@@ -31,8 +31,6 @@ class MainLoop
|
||||
private:
|
||||
/** True if the main loop should exit. */
|
||||
std::atomic_bool m_abort;
|
||||
|
||||
std::atomic_bool m_request_abort;
|
||||
|
||||
/** True if the frame rate should be throttled. */
|
||||
bool m_throttle_fps;
|
||||
@@ -50,9 +48,7 @@ public:
|
||||
MainLoop(unsigned parent_pid);
|
||||
~MainLoop();
|
||||
void run();
|
||||
/** Set the abort flag, causing the mainloop to be left. */
|
||||
void abort() { m_abort = true; }
|
||||
void requestAbort() { m_request_abort = true; }
|
||||
void abort();
|
||||
void setThrottleFPS(bool throttle) { m_throttle_fps = throttle; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns true if STK is to be stoppe. */
|
||||
|
||||
@@ -159,8 +159,7 @@ const std::string& EasterEggHunt::getIdent() const
|
||||
/** Called when a kart has collected an egg.
|
||||
* \param kart The kart that collected an egg.
|
||||
*/
|
||||
void EasterEggHunt::collectedItem(const AbstractKart *kart,
|
||||
const ItemState *item )
|
||||
void EasterEggHunt::collectedItem(const AbstractKart *kart, const Item *item)
|
||||
{
|
||||
if(item->getType() != ItemState::ITEM_EASTER_EGG) return;
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
virtual void getKartsDisplayInfo(
|
||||
std::vector<RaceGUIBase::KartIconDisplayInfo> *info) OVERRIDE;
|
||||
virtual void collectedItem(const AbstractKart *kart,
|
||||
const ItemState *item ) OVERRIDE;
|
||||
const Item *item ) OVERRIDE;
|
||||
void collectedEasterEggGhost(int world_id);
|
||||
|
||||
const int numberOfEggsFound() { return m_eggs_found; }
|
||||
|
||||
@@ -196,14 +196,3 @@ video::SColor FreeForAll::getColor(unsigned int kart_id) const
|
||||
{
|
||||
return GUIEngine::getSkin()->getColor("font::normal");
|
||||
} // getColor
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
bool FreeForAll::getKartFFAResult(int kart_id) const
|
||||
{
|
||||
// the kart(s) which has the top score wins
|
||||
AbstractKart* k = getKartAtPosition(1);
|
||||
if (!k)
|
||||
return false;
|
||||
int top_score = getKartScore(k->getWorldKartId());
|
||||
return getKartScore(kart_id) == top_score;
|
||||
} // getKartFFAResult
|
||||
|
||||
@@ -66,8 +66,6 @@ public:
|
||||
void setKartScoreFromServer(NetworkString& ns);
|
||||
// ------------------------------------------------------------------------
|
||||
int getKartScore(int kart_id) const { return m_scores.at(kart_id); }
|
||||
// ------------------------------------------------------------------------
|
||||
bool getKartFFAResult(int kart_id) const;
|
||||
}; // FreeForAll
|
||||
|
||||
|
||||
|
||||
@@ -598,8 +598,7 @@ void LinearWorld::getKartsDisplayInfo(
|
||||
|
||||
// Don't compare times when crossing the start line first
|
||||
if(laps_of_leader>0 &&
|
||||
(getTimeTicks() - getTicksAtLapForKart(kart->getWorldKartId()) <
|
||||
stk_config->time2Ticks(8) ||
|
||||
(getTimeTicks() - getTicksAtLapForKart(kart->getWorldKartId())<5||
|
||||
rank_info.lap != laps_of_leader) &&
|
||||
raceHasLaps())
|
||||
{ // Display for 5 seconds
|
||||
|
||||
@@ -213,11 +213,11 @@ const std::string& SoccerWorld::getIdent() const
|
||||
void SoccerWorld::update(int ticks)
|
||||
{
|
||||
updateBallPosition(ticks);
|
||||
if (Track::getCurrentTrack()->hasNavMesh())
|
||||
updateSectorForKarts();
|
||||
if (Track::getCurrentTrack()->hasNavMesh() &&
|
||||
!NetworkConfig::get()->isNetworking())
|
||||
{
|
||||
updateSectorForKarts();
|
||||
if (!NetworkConfig::get()->isNetworking())
|
||||
updateAIData();
|
||||
updateAIData();
|
||||
}
|
||||
|
||||
WorldWithRank::update(ticks);
|
||||
@@ -652,9 +652,6 @@ int SoccerWorld::getAttacker(KartTeam team) const
|
||||
//-----------------------------------------------------------------------------
|
||||
unsigned int SoccerWorld::getRescuePositionIndex(AbstractKart *kart)
|
||||
{
|
||||
if (!Track::getCurrentTrack()->hasNavMesh())
|
||||
return m_kart_position_map.at(kart->getWorldKartId());
|
||||
|
||||
int last_valid_node =
|
||||
getTrackSector(kart->getWorldKartId())->getLastValidGraphNode();
|
||||
if (last_valid_node >= 0)
|
||||
@@ -666,9 +663,6 @@ unsigned int SoccerWorld::getRescuePositionIndex(AbstractKart *kart)
|
||||
//-----------------------------------------------------------------------------
|
||||
btTransform SoccerWorld::getRescueTransform(unsigned int rescue_pos) const
|
||||
{
|
||||
if (!Track::getCurrentTrack()->hasNavMesh())
|
||||
return WorldWithRank::getRescueTransform(rescue_pos);
|
||||
|
||||
const Vec3 &xyz = Graph::get()->getQuad(rescue_pos)->getCenter();
|
||||
const Vec3 &normal = Graph::get()->getQuad(rescue_pos)->getNormal();
|
||||
btTransform pos;
|
||||
|
||||
@@ -229,8 +229,8 @@ void World::init()
|
||||
global_player_id, race_manager->getKartType(i),
|
||||
race_manager->getPlayerDifficulty(i));
|
||||
}
|
||||
new_kart->setBoostAI(race_manager->hasBoostedAI(i));
|
||||
m_karts.push_back(new_kart);
|
||||
|
||||
} // for i
|
||||
|
||||
// Load other custom models if needed
|
||||
@@ -587,9 +587,6 @@ void World::onGo()
|
||||
*/
|
||||
void World::terminateRace()
|
||||
{
|
||||
// In case the user opened paused dialog in network
|
||||
GUIEngine::ModalDialog::dismiss();
|
||||
|
||||
m_schedule_pause = false;
|
||||
m_schedule_unpause = false;
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
class AbstractKart;
|
||||
class btRigidBody;
|
||||
class Controller;
|
||||
class ItemState;
|
||||
class Item;
|
||||
class PhysicalObject;
|
||||
|
||||
namespace Scripting
|
||||
@@ -263,8 +263,7 @@ public:
|
||||
int *amount );
|
||||
// ------------------------------------------------------------------------
|
||||
/** Receives notification if an item is collected. Used for easter eggs. */
|
||||
virtual void collectedItem(const AbstractKart *kart,
|
||||
const ItemState *item ) {}
|
||||
virtual void collectedItem(const AbstractKart *kart, const Item *item) {}
|
||||
// ------------------------------------------------------------------------
|
||||
virtual void endRaceEarly() { return; }
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
@@ -385,8 +385,7 @@ void ServerLobby::asynchronousUpdate()
|
||||
handlePendingConnection();
|
||||
}
|
||||
|
||||
if (NetworkConfig::get()->isWAN() &&
|
||||
allowJoinedPlayersWaiting() && m_server_recovering.expired() &&
|
||||
if (allowJoinedPlayersWaiting() && m_server_recovering.expired() &&
|
||||
StkTime::getRealTimeMs() > m_last_success_poll_time.load() + 30000)
|
||||
{
|
||||
Log::warn("ServerLobby", "Trying auto server recovery.");
|
||||
|
||||
@@ -154,27 +154,8 @@ void RewindManager::saveState()
|
||||
|
||||
m_overall_state_size = 0;
|
||||
std::vector<std::string> rewinder_using;
|
||||
|
||||
// We must save the item state first (so that it is restored first),
|
||||
// otherwise state updates for a kart could be overwritten by
|
||||
// e.g. simulating the item collection later (which resets bubblegum
|
||||
// counter).
|
||||
BareNetworkString* buffer = NULL;
|
||||
if(auto r = m_all_rewinder["N"].lock())
|
||||
buffer = r->saveState(&rewinder_using);
|
||||
if (buffer)
|
||||
{
|
||||
m_overall_state_size += buffer->size();
|
||||
gp->addState(buffer);
|
||||
}
|
||||
delete buffer; // buffer can be freed
|
||||
|
||||
for (auto& p : m_all_rewinder)
|
||||
{
|
||||
// The Network ItemManager was saved first before this loop,
|
||||
// so skip it here.
|
||||
if(p.first=="N") continue;
|
||||
|
||||
// TODO: check if it's worth passing in a sufficiently large buffer from
|
||||
// GameProtocol - this would save the copy operation.
|
||||
BareNetworkString* buffer = NULL;
|
||||
|
||||
@@ -51,7 +51,6 @@ FloatServerConfigParam::FloatServerConfigParam(float default_value,
|
||||
const char* comment)
|
||||
: FloatUserConfigParam(param_name, comment)
|
||||
{
|
||||
m_can_be_deleted = false;
|
||||
m_value = default_value;
|
||||
m_default_value = default_value;
|
||||
g_server_params.push_back(this);
|
||||
@@ -63,7 +62,6 @@ IntServerConfigParam::IntServerConfigParam(int default_value,
|
||||
const char* comment)
|
||||
: IntUserConfigParam(param_name, comment)
|
||||
{
|
||||
m_can_be_deleted = false;
|
||||
m_value = default_value;
|
||||
m_default_value = default_value;
|
||||
g_server_params.push_back(this);
|
||||
@@ -75,7 +73,6 @@ BoolServerConfigParam::BoolServerConfigParam(bool default_value,
|
||||
const char* comment)
|
||||
: BoolUserConfigParam(param_name, comment)
|
||||
{
|
||||
m_can_be_deleted = false;
|
||||
m_value = default_value;
|
||||
m_default_value = default_value;
|
||||
g_server_params.push_back(this);
|
||||
@@ -87,7 +84,6 @@ StringServerConfigParam::StringServerConfigParam(std::string default_value,
|
||||
const char* comment)
|
||||
: StringUserConfigParam(param_name, comment)
|
||||
{
|
||||
m_can_be_deleted = false;
|
||||
m_value = default_value;
|
||||
m_default_value = default_value;
|
||||
g_server_params.push_back(this);
|
||||
@@ -136,7 +132,7 @@ void loadServerConfigXML(const XMLNode* root)
|
||||
return;
|
||||
}
|
||||
|
||||
/*int config_file_version = -1;
|
||||
int config_file_version = -1;
|
||||
if (root->get("version", &config_file_version) < 1 ||
|
||||
config_file_version < stk_config->m_min_server_version ||
|
||||
config_file_version > stk_config->m_max_server_version)
|
||||
@@ -146,7 +142,7 @@ void loadServerConfigXML(const XMLNode* root)
|
||||
delete root;
|
||||
writeServerConfigToDisk();
|
||||
return;
|
||||
}*/
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < g_server_params.size(); i++)
|
||||
g_server_params[i]->findYourDataInAChildOf(root);
|
||||
|
||||
@@ -269,7 +269,7 @@ namespace ServerConfig
|
||||
|
||||
// ========================================================================
|
||||
/** Server version, will be advanced if there are protocol changes. */
|
||||
static const uint32_t m_server_version = 2;
|
||||
static const uint32_t m_server_version = 1;
|
||||
// ========================================================================
|
||||
void loadServerConfig(const std::string& path = "");
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
@@ -634,7 +634,8 @@ void STKHost::setErrorMessage(const irr::core::stringw &message)
|
||||
{
|
||||
if (!message.empty())
|
||||
{
|
||||
Log::error("STKHost", "%s", StringUtils::wideToUtf8(message).c_str());
|
||||
irr::core::stringc s(message.c_str());
|
||||
Log::error("STKHost", "%s", s.c_str());
|
||||
}
|
||||
m_error_message = message;
|
||||
} // setErrorMessage
|
||||
|
||||
@@ -326,11 +326,7 @@ namespace Online
|
||||
setProgress(-1.0f);
|
||||
|
||||
Request::afterOperation();
|
||||
if (m_curl_session)
|
||||
{
|
||||
curl_easy_cleanup(m_curl_session);
|
||||
m_curl_session = NULL;
|
||||
}
|
||||
curl_easy_cleanup(m_curl_session);
|
||||
} // afterOperation
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace Online
|
||||
std::string m_filename;
|
||||
|
||||
/** Pointer to the curl data structure for this request. */
|
||||
CURL *m_curl_session = NULL;
|
||||
CURL *m_curl_session;
|
||||
|
||||
/** curl return code. */
|
||||
CURLcode m_curl_code;
|
||||
@@ -93,14 +93,7 @@ namespace Online
|
||||
int priority = 1);
|
||||
HTTPRequest(const char * const filename, bool manage_memory = false,
|
||||
int priority = 1);
|
||||
virtual ~HTTPRequest()
|
||||
{
|
||||
if (m_curl_session)
|
||||
{
|
||||
curl_easy_cleanup(m_curl_session);
|
||||
m_curl_session = NULL;
|
||||
}
|
||||
}
|
||||
virtual ~HTTPRequest() {}
|
||||
virtual bool isAllowedToAdd() const OVERRIDE;
|
||||
void setApiURL(const std::string& url, const std::string &action);
|
||||
void setAddonsURL(const std::string& path);
|
||||
|
||||
@@ -213,13 +213,7 @@ namespace Online
|
||||
me->m_current_request->execute();
|
||||
// This test is necessary in case that execute() was aborted
|
||||
// (otherwise the assert in addResult will be triggered).
|
||||
if (!me->getAbort())
|
||||
me->addResult(me->m_current_request);
|
||||
else if (me->m_current_request->manageMemory())
|
||||
{
|
||||
delete me->m_current_request;
|
||||
me->m_current_request = NULL;
|
||||
}
|
||||
if (!me->getAbort()) me->addResult(me->m_current_request);
|
||||
me->m_request_queue.lock();
|
||||
} // while handle all requests
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "LinearMath/btIDebugDraw.h"
|
||||
#include "BulletDynamics/ConstraintSolver/btContactConstraint.h"
|
||||
|
||||
#include "config/stk_config.hpp"
|
||||
#include "graphics/material.hpp"
|
||||
#include "karts/kart.hpp"
|
||||
#include "karts/kart_model.hpp"
|
||||
@@ -130,12 +131,22 @@ void btKart::reset()
|
||||
m_max_speed = -1.0f;
|
||||
m_min_speed = 0.0f;
|
||||
m_cushioning_disable_time = 0;
|
||||
resetGroundHeight();
|
||||
|
||||
// Set the brakes so that karts don't slide downhill
|
||||
setAllBrakes(5.0f);
|
||||
|
||||
} // reset
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Resets the ground height of a kart. This is also called on rescues.
|
||||
*/
|
||||
void btKart::resetGroundHeight()
|
||||
{
|
||||
m_ground_height = 0.15;
|
||||
m_ground_height_old = 0.15;
|
||||
} // resetGroundHeight
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
const btTransform& btKart::getWheelTransformWS( int wheelIndex ) const
|
||||
{
|
||||
@@ -277,10 +288,10 @@ btScalar btKart::rayCast(unsigned int index, float fraction)
|
||||
btScalar max_susp_len = wheel.getSuspensionRestLength()
|
||||
+ wheel.m_maxSuspensionTravel;
|
||||
|
||||
// Do a slightly longer raycast to see if the kart might soon hit the
|
||||
// Do a longer raycast to see if the kart might soon hit the
|
||||
// ground and some 'cushioning' is needed to avoid that the chassis
|
||||
// hits the ground.
|
||||
btScalar raylen = max_susp_len + 0.5f;
|
||||
btScalar raylen = max_susp_len*10 + 0.5f;
|
||||
|
||||
btVector3 rayvector = wheel.m_raycastInfo.m_wheelDirectionWS * (raylen);
|
||||
const btVector3& source = wheel.m_raycastInfo.m_hardPointWS;
|
||||
@@ -296,6 +307,9 @@ btScalar btKart::rayCast(unsigned int index, float fraction)
|
||||
wheel.m_raycastInfo.m_groundObject = 0;
|
||||
|
||||
btScalar depth = raylen * rayResults.m_distFraction;
|
||||
|
||||
if (depth < m_ground_height)
|
||||
m_ground_height = depth;
|
||||
if (object && depth < max_susp_len)
|
||||
{
|
||||
wheel.m_raycastInfo.m_contactNormalWS = rayResults.m_hitNormalInWorld;
|
||||
@@ -517,17 +531,18 @@ void btKart::updateVehicle( btScalar step )
|
||||
if(m_cushioning_disable_time>0) m_cushioning_disable_time --;
|
||||
|
||||
bool needed_cushioning = false;
|
||||
|
||||
btVector3 v =
|
||||
m_chassisBody->getVelocityInLocalPoint(m_wheelInfo[wheel_index]
|
||||
.m_chassisConnectionPointCS);
|
||||
btVector3 down = -m_chassisBody->getGravity();
|
||||
down.normalize();
|
||||
btVector3 v_down = (v * down) * down;
|
||||
btScalar offset=0.1f;
|
||||
btScalar offset=0.24;
|
||||
|
||||
#ifdef DEBUG_CUSHIONING
|
||||
Log::verbose("physics",
|
||||
"World %d wheel %d lsuspl %f vdown %f overall speed %f lenght %f",
|
||||
"World %d wheel %d lsuspl %f vdown %f overall speed %f length %f",
|
||||
World::getWorld()->getTimeTicks(),
|
||||
wheel_index,
|
||||
m_wheelInfo[wheel_index].m_raycastInfo.m_suspensionLength,
|
||||
@@ -543,19 +558,26 @@ void btKart::updateVehicle( btScalar step )
|
||||
// predict the upcoming collision correcty - so we add an offset
|
||||
// to the predicted kart movement, which was found experimentally:
|
||||
btScalar gravity = m_chassisBody->getGravity().length();
|
||||
if (v_down.getY()<0 && m_cushioning_disable_time==0 &&
|
||||
m_wheelInfo[wheel_index].m_raycastInfo.m_suspensionLength
|
||||
< step * (-v_down.getY()+gravity*step)+offset)
|
||||
|
||||
btScalar absolute_fall = step*(-v_down.getY() + gravity*step);
|
||||
btScalar predicted_fall = gravity*step*step +
|
||||
(m_ground_height_old-m_ground_height);
|
||||
|
||||
// if the ground_height is below offset-0.01f ;
|
||||
// the terrain has unexpectedly changed - avoid sending the kart flying
|
||||
if (absolute_fall > 0.06 && m_cushioning_disable_time==0 &&
|
||||
m_ground_height < predicted_fall + offset &&
|
||||
m_ground_height > (offset-0.01f) && m_ground_height_old > 0.3)
|
||||
{
|
||||
// Disable more cushioning for 1 second. This avoids the problem
|
||||
// of hovering: a kart gets cushioned on a down-sloping area, still
|
||||
// moves forwards, gets cushioned again etc. --> kart is hovering
|
||||
// and not controllable.
|
||||
m_cushioning_disable_time = 120;
|
||||
m_cushioning_disable_time = stk_config->time2Ticks(1);
|
||||
|
||||
needed_cushioning = true;
|
||||
btVector3 impulse = down * (-v_down.getY() + gravity*step)
|
||||
/ m_chassisBody->getInvMass();
|
||||
btVector3 impulse = down * (predicted_fall/step)
|
||||
/ m_chassisBody->getInvMass();
|
||||
#ifdef DEBUG_CUSHIONING
|
||||
float v_old = m_chassisBody->getLinearVelocity().getY();
|
||||
#endif
|
||||
@@ -563,12 +585,13 @@ void btKart::updateVehicle( btScalar step )
|
||||
#ifdef DEBUG_CUSHIONING
|
||||
Log::verbose("physics",
|
||||
"World %d Cushioning imp %f vdown %f from %f m/s to %f m/s "
|
||||
"contact %f kart %f susp %f relspeed %f",
|
||||
"height %f contact %f kart %f susp %f relspeed %f",
|
||||
World::getWorld()->getTimeTicks(),
|
||||
impulse.getY(),
|
||||
-v_down.getY(),
|
||||
v_old,
|
||||
m_chassisBody->getLinearVelocity().getY(),
|
||||
m_ground_height,
|
||||
m_wheelInfo[wheel_index].m_raycastInfo.m_isInContact ?
|
||||
m_wheelInfo[wheel_index].m_raycastInfo.m_contactPointWS.getY()
|
||||
: -100,
|
||||
@@ -579,6 +602,9 @@ void btKart::updateVehicle( btScalar step )
|
||||
);
|
||||
#endif
|
||||
}
|
||||
// Update the ground height history
|
||||
m_ground_height_old = m_ground_height;
|
||||
m_ground_height = 999.9f;
|
||||
|
||||
|
||||
// Update friction (i.e. forward force)
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
#ifndef BT_KART_HPP
|
||||
#define BT_KART_HPP
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "BulletDynamics/Dynamics/btRigidBody.h"
|
||||
#include "BulletDynamics/ConstraintSolver/btTypedConstraint.h"
|
||||
#include "physics/btKartRaycast.hpp"
|
||||
@@ -117,6 +119,10 @@ private:
|
||||
* physics steps, so need to be set again by the application. */
|
||||
btScalar m_max_speed;
|
||||
|
||||
/** Smallest wheel height to the ground */
|
||||
btScalar m_ground_height;
|
||||
btScalar m_ground_height_old;
|
||||
|
||||
/** True if the visual wheels touch the ground. */
|
||||
bool m_visual_wheels_touch_ground;
|
||||
|
||||
@@ -142,6 +148,7 @@ public:
|
||||
Kart *kart);
|
||||
virtual ~btKart();
|
||||
void reset();
|
||||
void resetGroundHeight();
|
||||
void debugDraw(btIDebugDraw* debugDrawer);
|
||||
const btTransform& getChassisWorldTransform() const;
|
||||
btScalar rayCast(unsigned int index, float fraction=1.0f);
|
||||
@@ -292,4 +299,3 @@ public:
|
||||
}; // class btKart
|
||||
|
||||
#endif //BT_KART_HPP
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include "utils/translation.hpp"
|
||||
|
||||
HighscoreManager* highscore_manager=0;
|
||||
const unsigned int HighscoreManager::CURRENT_HSCORE_FILE_VERSION = 4;
|
||||
const unsigned int HighscoreManager::CURRENT_HSCORE_FILE_VERSION = 3;
|
||||
|
||||
HighscoreManager::HighscoreManager()
|
||||
{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user