From: Holger Schemel Date: Sun, 22 Aug 1999 21:07:31 +0000 (+0200) Subject: rnd-19990822-1-src X-Git-Tag: 1.4.0^2~22 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=5d50a7e10873581345ee63a5afafd43dbd45809b;p=rocksndiamonds.git rnd-19990822-1-src --- diff --git a/src/editor.c b/src/editor.c index c5af9691..fdef6f27 100644 --- a/src/editor.c +++ b/src/editor.c @@ -1071,6 +1071,11 @@ int editor_element[] = EL_LIGHT_SWITCH_OFF, EL_LIGHT_SWITCH_ON, + EL_FORCE_FIELD, + EL_EXTRA_TIME, + EL_LEERRAUM, + EL_LEERRAUM, + /* EL_CHAR('D'), EL_CHAR('Y'), diff --git a/src/files.c b/src/files.c index 80c766cd..ce0a95be 100644 --- a/src/files.c +++ b/src/files.c @@ -524,6 +524,16 @@ void LoadLevel(int level_nr) fgetc(file); fgetc(file); + if (level.num_yam_contents < 1 || + level.num_yam_contents > MAX_ELEMENT_CONTENTS) + { +#if DEBUG + printf("WARNING: num_yam_contents == %d (corrected)\n", + level.num_yam_contents); +#endif + level.num_yam_contents = STD_ELEMENT_CONTENTS; + } + for(i=0; i 0) + { + Feld[xx][yy] = EL_LIGHT_SWITCH_ON; + DrawLevelField(xx, yy); + } + else if (element == EL_LIGHT_SWITCH_ON && + game.light_time_left == 0) + { + Feld[xx][yy] = EL_LIGHT_SWITCH_OFF; + DrawLevelField(xx, yy); + } + + if (element == EL_INVISIBLE_STEEL || + element == EL_UNSICHTBAR || + element == EL_SAND_INVISIBLE) + DrawLevelField(xx, yy); + } + } +} + void Impact(int x, int y) { boolean lastline = (y == lev_fieldy-1); @@ -1636,6 +1764,20 @@ void Impact(int x, int y) PlaySoundLevel(x, y, SND_QUIRK); return; } + else if (IS_BELT_SWITCH(smashed)) + { + ToggleBeltSwitch(x, y+1); + } + else if (smashed == EL_SWITCHGATE_SWITCH_1 || + smashed == EL_SWITCHGATE_SWITCH_2) + { + ToggleSwitchgateSwitch(x, y+1); + } + else if (smashed == EL_LIGHT_SWITCH_OFF || + smashed == EL_LIGHT_SWITCH_ON) + { + ToggleLightSwitch(x, y+1); + } } } } @@ -1693,7 +1835,7 @@ void Impact(int x, int y) break; } - if (sound>=0) + if (sound >= 0) PlaySoundLevel(x, y, sound); } } @@ -3833,6 +3975,10 @@ void GameActions() OpenSwitchgate(x, y); else if (element == EL_SWITCHGATE_CLOSING) CloseSwitchgate(x, y); + else if (element == EL_EXTRA_TIME) + DrawGraphicAnimation(x, y, GFX_EXTRA_TIME, 6, 4, ANIM_NORMAL); + else if (element == EL_FORCE_FIELD) + DrawGraphicAnimation(x, y, GFX_FORCE_FIELD, 6, 4, ANIM_NORMAL); if (game.magic_wall_active) { @@ -4631,6 +4777,21 @@ int DigField(struct PlayerInfo *player, PlaySoundLevel(x, y, SND_PONG); break; + case EL_EXTRA_TIME: + RemoveField(x, y); + if (level.time > 0) + { + TimeLeft += 10; + DrawText(DX_TIME, DY_TIME, int2str(TimeLeft, 3), FS_SMALL, FC_YELLOW); + } + PlaySoundStereo(SND_GONG, PSND_MAX_RIGHT); + break; + + case EL_FORCE_FIELD: + RemoveField(x, y); + PlaySoundLevel(x, y, SND_PONG); + break; + case EL_DYNAMITE_INACTIVE: case EL_SP_DISK_RED: RemoveField(x, y); @@ -4746,152 +4907,32 @@ int DigField(struct PlayerInfo *player, case EL_BELT4_SWITCH_L: case EL_BELT4_SWITCH_M: case EL_BELT4_SWITCH_R: + if (!player->Switching) { - static int belt_base_element[4] = - { - EL_BELT1_SWITCH_L, - EL_BELT2_SWITCH_L, - EL_BELT3_SWITCH_L, - EL_BELT4_SWITCH_L - }; - static int belt_move_dir[4] = - { - MV_LEFT, - MV_NO_MOVING, - MV_RIGHT, - MV_NO_MOVING, - }; - - int belt_nr = getBeltNrFromSwitchElement(element); - int belt_dir_nr = (game.belt_dir_nr[belt_nr] + 1) % 4; - int belt_dir = belt_move_dir[belt_dir_nr]; - int xx, yy; - - if (player->Switching) - return MF_ACTION; - player->Switching = TRUE; - - game.belt_dir_nr[belt_nr] = belt_dir_nr; - game.belt_dir[belt_nr] = belt_dir; - - if (belt_dir_nr == 3) - belt_dir_nr = 1; - - for (yy=0; yySwitching) { - int xx, yy; - - if (player->Switching) - return MF_ACTION; - player->Switching = TRUE; - - game.switchgate_pos = !game.switchgate_pos; - - for (yy=0; yySwitching) { - int xx, yy; - - if (player->Switching) - return MF_ACTION; - player->Switching = TRUE; - - game.light_time_left = - (element == EL_LIGHT_SWITCH_OFF ? 10 * FRAMES_PER_SECOND : 0); - - for (yy=0; yy 0) - { - Feld[xx][yy] = EL_LIGHT_SWITCH_ON; - DrawLevelField(xx, yy); - } - else if (element == EL_LIGHT_SWITCH_ON && - game.light_time_left == 0) - { - Feld[xx][yy] = EL_LIGHT_SWITCH_OFF; - DrawLevelField(xx, yy); - } - - if (element == EL_INVISIBLE_STEEL || - element == EL_UNSICHTBAR || - element == EL_SAND_INVISIBLE) - DrawLevelField(xx, yy); - } - } - - return MF_ACTION; + ToggleLightSwitch(x, y); } + return MF_ACTION; break; case EL_SP_EXIT: diff --git a/src/main.h b/src/main.h index ab26aad5..5cfda96e 100644 --- a/src/main.h +++ b/src/main.h @@ -589,12 +589,12 @@ extern char *element_info[]; #define MICRO_SP_PER_LINE 64 #define MINI_DC_STARTX 256 -#define MINI_DC_STARTY 0 -#define MICRO_DC_STARTX 256 +#define MINI_DC_STARTY 256 +#define MICRO_DC_STARTX 384 #define MICRO_DC_STARTY 384 -#define DC_PER_LINE 8 -#define MINI_DC_PER_LINE 8 -#define MICRO_DC_PER_LINE 8 +#define DC_PER_LINE 16 +#define MINI_DC_PER_LINE 16 +#define MICRO_DC_PER_LINE 16 #define FONT_CHARS_PER_LINE 16 #define FONT_LINES_PER_FONT 4 @@ -1320,6 +1320,9 @@ extern char *element_info[]; #define GFX_LANDMINE (GFX_START_ROCKSDC + 14 * DC_PER_LINE + 7) #define GFX_STEEL_SLANTED (GFX_START_ROCKSDC + 15 * DC_PER_LINE + 5) +#define GFX_EXTRA_TIME (GFX_START_ROCKSDC + 0 * DC_PER_LINE + 8) +#define GFX_FORCE_FIELD (GFX_START_ROCKSDC + 1 * DC_PER_LINE + 8) + /* graphics from "RocksFont" */ #define GFX_CHAR_START (GFX_START_ROCKSFONT) #define GFX_CHAR_ASCII0 (GFX_CHAR_START - 32) @@ -1360,8 +1363,6 @@ extern char *element_info[]; #define GFX_DOOR_WHITE GFX_CHAR_FRAGE #define GFX_DOOR_WHITE_GRAY GFX_CHAR_FRAGE #define GFX_KEY_WHITE GFX_CHAR_FRAGE -#define GFX_FORCE_FIELD GFX_CHAR_FRAGE -#define GFX_EXTRA_TIME GFX_CHAR_FRAGE #define GFX_TIME_GATE GFX_CHAR_FRAGE #define GFX_TIME_GATE_WHEEL GFX_CHAR_FRAGE #define GFX_SIGN_RADIOACTIVITY GFX_CHAR_FRAGE