From eecbe2a298826a3c32ca78b81b77491702ced84c Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Tue, 27 Dec 2005 23:38:24 +0100 Subject: [PATCH] rnd-20051227-1-src * changed "score for each 10 seconds/steps left" to "1 second/step" * added own score for collecting "extra time" instead of sharing it --- ChangeLog | 4 ++ src/conftime.h | 2 +- src/editor.c | 8 ++- src/files.c | 25 ++++++-- src/game.c | 171 ++++++++++++++++++++++++++++--------------------- src/main.h | 7 ++ 6 files changed, 133 insertions(+), 84 deletions(-) diff --git a/ChangeLog b/ChangeLog index bef90ca3..d3ed1b8e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2005-12-27 + * changed "score for each 10 seconds/steps left" to "1 second/step" + * added own score for collecting "extra time" instead of sharing it + 2005-12-22 * added "set player shield: off / normal / deadly" to CE action options * added new player option "use level start element" in level editor diff --git a/src/conftime.h b/src/conftime.h index 1fcfa537..57c3fa18 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2005-12-23 02:25]" +#define COMPILE_DATE_STRING "[2005-12-27 23:30]" diff --git a/src/editor.c b/src/editor.c index 91a51ea4..2a470054 100644 --- a/src/editor.c +++ b/src/editor.c @@ -1023,7 +1023,7 @@ static struct GADGET_ID_LEVEL_TIMESCORE_DOWN, GADGET_ID_LEVEL_TIMESCORE_UP, GADGET_ID_LEVEL_TIMESCORE_TEXT, GADGET_ID_NONE, &level.score[SC_TIME_BONUS], - "score for each 10 sec/steps left:", NULL, NULL + "score for each second/step left:", NULL, NULL }, { ED_LEVEL_SETTINGS_XPOS(0), ED_COUNTER2_YPOS(8), @@ -1700,6 +1700,10 @@ static struct ValueTextInfo options_action_arg_number[] = { CA_ARG_NUMBER_CE_SCORE, "CE score" }, { CA_ARG_NUMBER_CE_VALUE, "CE value" }, { CA_ARG_UNDEFINED, " " }, + { CA_ARG_NUMBER_LEVEL_TIME, "time" }, + { CA_ARG_NUMBER_LEVEL_GEMS, "gems" }, + { CA_ARG_NUMBER_LEVEL_SCORE, "score" }, + { CA_ARG_UNDEFINED, " " }, { CA_ARG_ELEMENT_HEADLINE, "[CE value" }, { CA_ARG_ELEMENT_HEADLINE, " of" }, { CA_ARG_ELEMENT_HEADLINE, " element]" }, @@ -7218,7 +7222,7 @@ static struct { EL_DYNABOMB_INCREASE_POWER, &level.score[SC_DYNAMITE],TEXT_COLLECTING }, { EL_SHIELD_NORMAL, &level.score[SC_SHIELD], TEXT_COLLECTING }, { EL_SHIELD_DEADLY, &level.score[SC_SHIELD], TEXT_COLLECTING }, - { EL_EXTRA_TIME, &level.score[SC_TIME_BONUS], TEXT_COLLECTING }, + { EL_EXTRA_TIME, &level.extra_time_score, TEXT_COLLECTING }, { EL_KEY_1, &level.score[SC_KEY], TEXT_COLLECTING }, { EL_KEY_2, &level.score[SC_KEY], TEXT_COLLECTING }, { EL_KEY_3, &level.score[SC_KEY], TEXT_COLLECTING }, diff --git a/src/files.c b/src/files.c index e49a2965..b867a6b3 100644 --- a/src/files.c +++ b/src/files.c @@ -195,6 +195,10 @@ static struct EL_EXTRA_TIME, CONF_VALUE_INTEGER_1, &li.extra_time, 10 }, + { + EL_EXTRA_TIME, CONF_VALUE_INTEGER_2, + &li.extra_time_score, 10 + }, { EL_TIME_ORB_FULL, CONF_VALUE_INTEGER_1, &li.time_orb_time, 10 @@ -212,15 +216,15 @@ static struct &li.use_start_element[0], FALSE }, { - EL_PLAYER_2, CONF_VALUE_ELEMENT_2, + EL_PLAYER_2, CONF_VALUE_BOOLEAN_2, &li.use_start_element[1], FALSE }, { - EL_PLAYER_3, CONF_VALUE_ELEMENT_2, + EL_PLAYER_3, CONF_VALUE_BOOLEAN_2, &li.use_start_element[2], FALSE }, { - EL_PLAYER_4, CONF_VALUE_ELEMENT_2, + EL_PLAYER_4, CONF_VALUE_BOOLEAN_2, &li.use_start_element[3], FALSE }, @@ -481,7 +485,7 @@ static void setLevelInfoToDefaults(struct LevelInfo *level) } for (i = 0; i < LEVEL_SCORE_ELEMENTS; i++) - level->score[i] = 10; + level->score[i] = (i == SC_TIME_BONUS ? 1 : 10); level->num_yamyam_contents = STD_ELEMENT_CONTENTS; for (i = 0; i < MAX_ELEMENT_CONTENTS; i++) @@ -2874,14 +2878,21 @@ static void LoadLevel_InitVersion(struct LevelInfo *level, char *filename) if (level->game_version < VERSION_IDENT(2,2,0,0)) level->use_spring_bug = TRUE; - /* time orb caused limited time in endless time levels before 3.2.0-5 */ if (level->game_version < VERSION_IDENT(3,2,0,5)) + { + /* time orb caused limited time in endless time levels before 3.2.0-5 */ level->use_time_orb_bug = TRUE; - /* default behaviour for snapping was "no snap delay" before 3.2.0-5 */ - if (level->game_version < VERSION_IDENT(3,2,0,5)) + /* default behaviour for snapping was "no snap delay" before 3.2.0-5 */ level->block_snap_field = FALSE; + /* extra time score was same value as time left score before 3.2.0-5 */ + level->extra_time_score = level->score[SC_TIME_BONUS]; + + /* time bonus score was given for 10 s instead of 1 s before 3.2.0-5 */ + level->score[SC_TIME_BONUS] /= 10; + } + /* only few elements were able to actively move into acid before 3.1.0 */ /* trigger settings did not exist before 3.1.0; set to default "any" */ if (level->game_version < VERSION_IDENT(3,1,0,0)) diff --git a/src/game.c b/src/game.c index 346e1269..aec9cfc3 100644 --- a/src/game.c +++ b/src/game.c @@ -2320,12 +2320,17 @@ void GameWon() { if (!tape.playing && !setup.sound_loops) PlaySoundStereo(SND_GAME_LEVELTIME_BONUS, SOUND_MIDDLE); - if (TimeLeft > 0 && !(TimeLeft % 10)) - RaiseScore(level.score[SC_TIME_BONUS]); - if (TimeLeft > 100 && !(TimeLeft % 10)) + + if (TimeLeft > 100 && TimeLeft % 10 == 0) + { TimeLeft -= 10; + RaiseScore(level.score[SC_TIME_BONUS] * 10); + } else + { TimeLeft--; + RaiseScore(level.score[SC_TIME_BONUS]); + } DrawGameValue_Time(TimeLeft); @@ -2348,12 +2353,17 @@ void GameWon() { if (!tape.playing && !setup.sound_loops) PlaySoundStereo(SND_GAME_LEVELTIME_BONUS, SOUND_MIDDLE); - if (TimePlayed < 999 && !(TimePlayed % 10)) - RaiseScore(level.score[SC_TIME_BONUS]); - if (TimePlayed < 900 && !(TimePlayed % 10)) + + if (TimePlayed < 900 && TimePlayed % 10 == 0) + { TimePlayed += 10; + RaiseScore(level.score[SC_TIME_BONUS] * 10); + } else + { TimePlayed++; + RaiseScore(level.score[SC_TIME_BONUS]); + } DrawGameValue_Time(TimePlayed); @@ -6589,7 +6599,11 @@ static void ExecuteCustomElementAction(int x, int y, int element, int page) if (!change->has_action) return; - /* ---------- determine action paramater values ---------- */ + /* ---------- determine action paramater values -------------------------- */ + + int level_time_value = + (level.time > 0 ? TimeLeft : + TimePlayed); int action_arg_element = (action_arg == CA_ARG_PLAYER_TRIGGER ? change->actual_trigger_player : @@ -6647,6 +6661,9 @@ static void ExecuteCustomElementAction(int x, int y, int element, int page) action_arg == CA_ARG_NUMBER_CE_VALUE ? ei->custom_value_initial : #endif action_arg == CA_ARG_NUMBER_CE_DELAY ? GET_CHANGE_DELAY(change) : + action_arg == CA_ARG_NUMBER_LEVEL_TIME ? level_time_value : + action_arg == CA_ARG_NUMBER_LEVEL_GEMS ? local_player->gems_still_needed : + action_arg == CA_ARG_NUMBER_LEVEL_SCORE ? local_player->score : action_arg == CA_ARG_ELEMENT_TARGET ? GET_NEW_CUSTOM_VALUE(change->target_element) : action_arg == CA_ARG_ELEMENT_TRIGGER ? change->actual_trigger_ce_value : -1); @@ -6676,7 +6693,7 @@ static void ExecuteCustomElementAction(int x, int y, int element, int page) action_arg == CA_ARG_PLAYER_TRIGGER ? trigger_player_bits : PLAYER_BITS_ANY); - /* ---------- execute action ---------- */ + /* ---------- execute action -------------------------------------------- */ switch(action_type) { @@ -6685,24 +6702,78 @@ static void ExecuteCustomElementAction(int x, int y, int element, int page) return; } - case CA_EXIT_PLAYER: + /* ---------- level actions ------------------------------------------- */ + + case CA_RESTART_LEVEL: { - for (i = 0; i < MAX_PLAYERS; i++) - if (action_arg_player_bits & (1 << i)) - stored_player[i].LevelSolved = stored_player[i].GameOver = TRUE; + game.restart_level = TRUE; break; } - case CA_KILL_PLAYER: + case CA_SHOW_ENVELOPE: { - for (i = 0; i < MAX_PLAYERS; i++) - if (action_arg_player_bits & (1 << i)) - KillPlayer(&stored_player[i]); + int element = getSpecialActionElement(action_arg_element, + action_arg_number, EL_ENVELOPE_1); + + if (IS_ENVELOPE(element)) + local_player->show_envelope = element; + + break; + } + + case CA_SET_LEVEL_TIME: + { + if (level.time > 0) /* only modify limited time value */ + { + TimeLeft = action_arg_number_new; + + DrawGameValue_Time(TimeLeft); + + if (!TimeLeft && setup.time_limit) + for (i = 0; i < MAX_PLAYERS; i++) + KillPlayer(&stored_player[i]); + } + + break; + } + + case CA_SET_LEVEL_SCORE: + { + local_player->score = action_arg_number_new; + + DrawGameValue_Score(local_player->score); + + break; + } + + case CA_SET_LEVEL_GEMS: + { + local_player->gems_still_needed = action_arg_number_new; + + DrawGameValue_Emeralds(local_player->gems_still_needed); + + break; + } + + case CA_SET_LEVEL_GRAVITY: + { + game.gravity = (action_arg == CA_ARG_GRAVITY_OFF ? FALSE : + action_arg == CA_ARG_GRAVITY_ON ? TRUE : + action_arg == CA_ARG_GRAVITY_TOGGLE ? !game.gravity : + game.gravity); + break; + } + + case CA_SET_LEVEL_WIND: + { + game.wind_direction = action_arg_direction; break; } + /* ---------- player actions ------------------------------------------ */ + case CA_MOVE_PLAYER: { /* automatically move to the next field in specified direction */ @@ -6713,20 +6784,20 @@ static void ExecuteCustomElementAction(int x, int y, int element, int page) break; } - case CA_RESTART_LEVEL: + case CA_EXIT_PLAYER: { - game.restart_level = TRUE; + for (i = 0; i < MAX_PLAYERS; i++) + if (action_arg_player_bits & (1 << i)) + stored_player[i].LevelSolved = stored_player[i].GameOver = TRUE; break; } - case CA_SHOW_ENVELOPE: + case CA_KILL_PLAYER: { - int element = getSpecialActionElement(action_arg_element, - action_arg_number, EL_ENVELOPE_1); - - if (IS_ENVELOPE(element)) - local_player->show_envelope = element; + for (i = 0; i < MAX_PLAYERS; i++) + if (action_arg_player_bits & (1 << i)) + KillPlayer(&stored_player[i]); break; } @@ -6828,55 +6899,7 @@ static void ExecuteCustomElementAction(int x, int y, int element, int page) break; } - case CA_SET_LEVEL_GRAVITY: - { - game.gravity = (action_arg == CA_ARG_GRAVITY_OFF ? FALSE : - action_arg == CA_ARG_GRAVITY_ON ? TRUE : - action_arg == CA_ARG_GRAVITY_TOGGLE ? !game.gravity : - game.gravity); - break; - } - - case CA_SET_LEVEL_WIND: - { - game.wind_direction = action_arg_direction; - - break; - } - - case CA_SET_LEVEL_GEMS: - { - local_player->gems_still_needed = action_arg_number_new; - - DrawGameValue_Emeralds(local_player->gems_still_needed); - - break; - } - - case CA_SET_LEVEL_TIME: - { - if (level.time > 0) /* only modify limited time value */ - { - TimeLeft = action_arg_number_new; - - DrawGameValue_Time(TimeLeft); - - if (!TimeLeft && setup.time_limit) - for (i = 0; i < MAX_PLAYERS; i++) - KillPlayer(&stored_player[i]); - } - - break; - } - - case CA_SET_LEVEL_SCORE: - { - local_player->score = action_arg_number_new; - - DrawGameValue_Score(local_player->score); - - break; - } + /* ---------- CE actions ---------------------------------------------- */ case CA_SET_CE_SCORE: { @@ -10636,7 +10659,7 @@ void RaiseScoreElement(int element) RaiseScore(level.score[SC_SHIELD]); break; case EL_EXTRA_TIME: - RaiseScore(level.score[SC_TIME_BONUS]); + RaiseScore(level.extra_time_score); break; case EL_KEY_1: case EL_KEY_2: diff --git a/src/main.h b/src/main.h index 71bca9d7..e2bfa12b 100644 --- a/src/main.h +++ b/src/main.h @@ -340,6 +340,9 @@ #define CA_ARG_NUMBER_CE_SCORE (CA_ARG_NUMBER + 3) #define CA_ARG_NUMBER_CE_VALUE (CA_ARG_NUMBER + 4) #define CA_ARG_NUMBER_CE_DELAY (CA_ARG_NUMBER + 5) +#define CA_ARG_NUMBER_LEVEL_TIME (CA_ARG_NUMBER + 6) +#define CA_ARG_NUMBER_LEVEL_GEMS (CA_ARG_NUMBER + 7) +#define CA_ARG_NUMBER_LEVEL_SCORE (CA_ARG_NUMBER + 8) #define CA_ARG_NUMBER_HEADLINE (CA_ARG_NUMBER + 999) #define CA_ARG_ELEMENT 12000 #define CA_ARG_ELEMENT_TARGET (CA_ARG_ELEMENT + 0) @@ -1800,9 +1803,12 @@ struct LevelInfo int extra_time; int time_orb_time; + int extra_time_score; + int start_element[MAX_PLAYERS]; boolean use_start_element[MAX_PLAYERS]; +#if 1 /* values for the new EMC elements */ int android_move_time; int android_clone_time; @@ -1817,6 +1823,7 @@ struct LevelInfo int wind_direction_initial; struct Content ball_content[MAX_ELEMENT_CONTENTS]; boolean android_array[16]; +#endif int can_move_into_acid_bits; /* bitfield to store property for elements */ int dont_collide_with_bits; /* bitfield to store property for elements */ -- 2.34.1