From: Holger Schemel Date: Wed, 18 Sep 2002 23:00:31 +0000 (+0200) Subject: rnd-20020919-1-src X-Git-Tag: 3.0.0^2~240 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=9aa43cb75a7df05a938b9e095c1dee6558313d21;p=rocksndiamonds.git rnd-20020919-1-src --- diff --git a/src/conftime.h b/src/conftime.h index 5b4bb77e..3f71d745 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2002-09-17 00:07]" +#define COMPILE_DATE_STRING "[2002-09-18 01:21]" diff --git a/src/game.c b/src/game.c index a9773267..f0658bc0 100644 --- a/src/game.c +++ b/src/game.c @@ -2847,7 +2847,10 @@ void StartMoving(int x, int y) { TurnRound(x, y); - if (MovDelay[x][y] && (element == EL_KAEFER)) + if (MovDelay[x][y] && (element == EL_KAEFER || + element == EL_FLIEGER || + element == EL_SP_SNIKSNAK || + element == EL_SP_ELECTRON)) DrawNewLevelField(x, y); else if (MovDelay[x][y] && (element == EL_KAEFER || element == EL_FLIEGER || @@ -3115,7 +3118,7 @@ void StartMoving(int x, int y) else /* element == EL_PACMAN */ { Feld[newx][newy] = EL_LEERRAUM; - DrawLevelField(newx, newy); + DrawNewLevelField(newx, newy); PlaySoundLevel(x, y, SND_PACMAN_EATING_AMOEBA); } } @@ -3132,7 +3135,8 @@ void StartMoving(int x, int y) TurnRound(x, y); - if (element == EL_KAEFER) + if (element == EL_KAEFER || element == EL_FLIEGER || + element == EL_SP_SNIKSNAK) #if 0 DrawLevelField(x, y); #else @@ -3161,7 +3165,7 @@ void StartMoving(int x, int y) #if 0 DrawGraphicAnimation(x, y, GFX2_SP_ELECTRON, 8, 2, ANIM_NORMAL); #else - DrawNewGraphicAnimation(x, y, IMG_SP_ELECTRON_MOVING); + DrawNewGraphicAnimation(x, y, IMG_SP_ELECTRON); #endif if (DONT_TOUCH(element)) @@ -3300,7 +3304,9 @@ void ContinueMoving(int x, int y) if (!CAN_MOVE(element)) MovDir[newx][newy] = 0; - if (element == EL_KAEFER) + if (element == EL_KAEFER || element == EL_FLIEGER || + element == EL_SP_SNIKSNAK || element == EL_PACMAN || + element == EL_SP_ELECTRON) { DrawNewLevelField(x, y); DrawNewLevelField(newx, newy); @@ -3329,7 +3335,9 @@ void ContinueMoving(int x, int y) } else /* still moving on */ { - if (element == EL_KAEFER) + if (element == EL_KAEFER || element == EL_FLIEGER || + element == EL_SP_SNIKSNAK || element == EL_PACMAN || + element == EL_SP_ELECTRON) DrawNewLevelField(x, y); else DrawLevelField(x, y); diff --git a/src/init.c b/src/init.c index e4d81d05..96d96ace 100644 --- a/src/init.c +++ b/src/init.c @@ -981,22 +981,36 @@ static void InitGraphicInfo() /* always start with reliable default values */ new_graphic_info[i].bitmap = getBitmapFromImageID(i); - new_graphic_info[i].src_x = parameter[GFXARG_XPOS] * TILEX; - new_graphic_info[i].src_y = parameter[GFXARG_YPOS] * TILEY; - new_graphic_info[i].anim_frames = parameter[GFXARG_FRAMES]; - new_graphic_info[i].anim_delay = parameter[GFXARG_DELAY]; - new_graphic_info[i].anim_vertical = parameter[GFXARG_VERTICAL]; - new_graphic_info[i].anim_mode = - (parameter[GFXARG_PINGPONG] ? ANIM_PINGPONG : - parameter[GFXARG_REVERSE] ? ANIM_REVERSE : ANIM_NORMAL); + new_graphic_info[i].src_x = parameter[GFX_ARG_XPOS] * TILEX; + new_graphic_info[i].src_y = parameter[GFX_ARG_YPOS] * TILEY; + new_graphic_info[i].anim_frames = parameter[GFX_ARG_FRAMES]; + + new_graphic_info[i].anim_delay = parameter[GFX_ARG_DELAY]; if (new_graphic_info[i].anim_delay == 0) /* delay must be at least 1 */ new_graphic_info[i].anim_delay = 1; + + /* basically, animation can be either normal or reverse direction */ + if (parameter[GFX_ARG_REVERSE]) + new_graphic_info[i].anim_mode = ANIM_REVERSE; + else + new_graphic_info[i].anim_mode = ANIM_NORMAL; + + /* additionally, animation can be either pingpong or pingpong2 layout */ + if (parameter[GFX_ARG_PINGPONG]) + new_graphic_info[i].anim_mode |= ANIM_PINGPONG; + else if (parameter[GFX_ARG_PINGPONG2]) + new_graphic_info[i].anim_mode |= ANIM_PINGPONG2; + + /* animation synchronized with global frame counter, not move position */ + new_graphic_info[i].anim_global_sync = parameter[GFX_ARG_GLOBAL_SYNC]; + + new_graphic_info[i].anim_vertical = parameter[GFX_ARG_VERTICAL]; } #if 0 - printf("D> %d\n", image_files[GFX_BD_DIAMOND].parameter[GFXARG_NUM_FRAMES]); - printf("W> %d\n", image_files[GFX_ROBOT_WHEEL].parameter[GFXARG_NUM_FRAMES]); + printf("D> %d\n", image_files[GFX_BD_DIAMOND].parameter[GFX_ARG_NUM_FRAMES]); + printf("W> %d\n", image_files[GFX_ROBOT_WHEEL].parameter[GFX_ARG_NUM_FRAMES]); graphic_info[GFX_ABLENK].bitmap = getBitmapFromImageID(GFX_ROBOT_WHEEL); graphic_info[GFX_ABLENK].src_x = 0; diff --git a/src/main.c b/src/main.c index 227c3576..c56de02b 100644 --- a/src/main.c +++ b/src/main.c @@ -136,6 +136,25 @@ char *sound_name[NUM_SOUNDS] = "gate.wav" }; +/* this is used to reduce memory usage of the different animation types */ +int anim_action_mapping[] = +{ + 0, /* GFX_ACTION_UNKNOWN (0) */ + 0, /* GFX_ACTION_DEFAULT (1) */ + 0, /* GFX_ACTION_WAITING (2) */ + + 1, /* GFX_ACTION_MOVING (3) */ + 2, /* GFX_ACTION_DIGGING (4) */ + 3, /* GFX_ACTION_COLLECTING (5) */ + 4, /* GFX_ACTION_PUSHING (6) */ + + 5, /* GFX_ACTION_PASSING (7) */ + 5, /* GFX_ACTION_IMPACT (8) */ + 5, /* GFX_ACTION_ACTIVATING (9) */ + 5, /* GFX_ACTION_BURNING (10) */ + 5 /* GFX_ACTION_OTHER (11) */ +}; + struct ConfigInfo image_config_suffix[] = { { ".xpos", "0" }, @@ -145,6 +164,7 @@ struct ConfigInfo image_config_suffix[] = { ".pingpong", "0" }, { ".pingpong2", "0" }, { ".reverse", "0" }, + { ".global_sync", "0" }, { ".vertical", "0" }, { NULL, NULL } @@ -343,18 +363,22 @@ struct ConfigInfo image_config[] = { "spaceship_right.xpos", "8" }, { "spaceship_right.ypos", "3" }, { "spaceship_right.frames", "2" }, + { "spaceship_right.delay", "4" }, { "spaceship_up", "RocksElements.pcx" }, { "spaceship_up.xpos", "10" }, { "spaceship_up.ypos", "3" }, { "spaceship_up.frames", "2" }, + { "spaceship_up.delay", "4" }, { "spaceship_left", "RocksElements.pcx" }, { "spaceship_left.xpos", "12" }, { "spaceship_left.ypos", "3" }, { "spaceship_left.frames", "2" }, + { "spaceship_left.delay", "4" }, { "spaceship_down", "RocksElements.pcx" }, { "spaceship_down.xpos", "14" }, { "spaceship_down.ypos", "3" }, { "spaceship_down.frames", "2" }, + { "spaceship_down.delay", "4" }, { "bug_right", "RocksElements.pcx" }, { "bug_right.xpos", "8" }, @@ -381,18 +405,26 @@ struct ConfigInfo image_config[] = { "pacman_right.xpos", "8" }, { "pacman_right.ypos", "5" }, { "pacman_right.frames", "2" }, + { "pacman_right.reverse", "1" }, + { "pacman_right.delay", "4" }, { "pacman_up", "RocksElements.pcx" }, { "pacman_up.xpos", "10" }, { "pacman_up.ypos", "5" }, { "pacman_up.frames", "2" }, + { "pacman_up.reverse", "1" }, + { "pacman_up.delay", "4" }, { "pacman_left", "RocksElements.pcx" }, { "pacman_left.xpos", "12" }, { "pacman_left.ypos", "5" }, { "pacman_left.frames", "2" }, + { "pacman_left.reverse", "1" }, + { "pacman_left.delay", "4" }, { "pacman_down", "RocksElements.pcx" }, { "pacman_down.xpos", "14" }, { "pacman_down.ypos", "5" }, { "pacman_down.frames", "2" }, + { "pacman_down.reverse", "1" }, + { "pacman_down.delay", "4" }, { "explosion", "RocksElements.pcx" }, { "explosion.xpos", "0" }, @@ -1488,67 +1520,39 @@ struct ConfigInfo image_config[] = { "sp_sniksnak_left", "RocksSP.pcx" }, { "sp_sniksnak_left.xpos", "8" }, { "sp_sniksnak_left.ypos", "8" }, - { "sp_sniksnak_left.frames", "1" }, - { "sp_sniksnak_left.moving", "RocksSP.pcx" }, - { "sp_sniksnak_left.moving.xpos", "8" }, - { "sp_sniksnak_left.moving.ypos", "8" }, - { "sp_sniksnak_left.moving.frames", "4" }, - { "sp_sniksnak_left.moving.pingpong", "1" }, + { "sp_sniksnak_left.frames", "4" }, + { "sp_sniksnak_left.pingpong2", "1" }, { "sp_sniksnak_right", "RocksSP.pcx" }, { "sp_sniksnak_right.xpos", "12" }, { "sp_sniksnak_right.ypos", "8" }, - { "sp_sniksnak_right.frames", "1" }, - { "sp_sniksnak_right.moving", "RocksSP.pcx" }, - { "sp_sniksnak_right.moving.xpos", "12" }, - { "sp_sniksnak_right.moving.ypos", "8" }, - { "sp_sniksnak_right.moving.frames", "4" }, - { "sp_sniksnak_right.moving.pingpong", "1" }, + { "sp_sniksnak_right.frames", "4" }, + { "sp_sniksnak_right.pingpong2", "1" }, { "sp_sniksnak_up", "RocksSP.pcx" }, { "sp_sniksnak_up.xpos", "8" }, { "sp_sniksnak_up.ypos", "9" }, - { "sp_sniksnak_up.frames", "1" }, - { "sp_sniksnak_up.moving", "RocksSP.pcx" }, - { "sp_sniksnak_up.moving.xpos", "8" }, - { "sp_sniksnak_up.moving.ypos", "9" }, - { "sp_sniksnak_up.moving.frames", "4" }, - { "sp_sniksnak_up.moving.pingpong", "1" }, + { "sp_sniksnak_up.frames", "4" }, + { "sp_sniksnak_up.pingpong2", "1" }, { "sp_sniksnak_down", "RocksSP.pcx" }, { "sp_sniksnak_down.xpos", "12" }, { "sp_sniksnak_down.ypos", "9" }, - { "sp_sniksnak_down.frames", "1" }, - { "sp_sniksnak_down.moving", "RocksSP.pcx" }, - { "sp_sniksnak_down.moving.xpos", "12" }, - { "sp_sniksnak_down.moving.ypos", "9" }, - { "sp_sniksnak_down.moving.frames", "4" }, - { "sp_sniksnak_down.moving.pingpong", "1" }, + { "sp_sniksnak_down.frames", "4" }, + { "sp_sniksnak_down.pingpong2", "1" }, { "sp_electron", "RocksSP.pcx" }, { "sp_electron.xpos", "8" }, { "sp_electron.ypos", "10" }, { "sp_electron.frames", "8" }, { "sp_electron.delay", "2" }, - { "sp_electron.moving", "RocksSP.pcx" }, - { "sp_electron.moving.xpos", "8" }, - { "sp_electron.moving.ypos", "10" }, - { "sp_electron.moving.frames", "8" }, - { "sp_electron.delay", "2" }, + { "sp_electron.global_sync", "1" }, { "sp_terminal", "RocksSP.pcx" }, - { "sp_terminal.xpos", "3" }, - { "sp_terminal.ypos", "2" }, - { "sp_terminal.frames", "1" }, - { "sp_terminal.running", "RocksSP.pcx" }, - { "sp_terminal.running.xpos", "8" }, - { "sp_terminal.running.ypos", "11" }, - { "sp_terminal.running.frames", "7" }, + { "sp_terminal.xpos", "8" }, + { "sp_terminal.ypos", "11" }, + { "sp_terminal.frames", "7" }, { "sp_terminal_active", "RocksSP.pcx" }, { "sp_terminal_active.xpos", "8" }, { "sp_terminal_active.ypos", "12" }, - { "sp_terminal_active.frames", "1" }, - { "sp_terminal_active.running", "RocksSP.pcx" }, - { "sp_terminal_active.running.xpos", "8" }, - { "sp_terminal_active.running.ypos", "12" }, - { "sp_terminal_active.running.frames", "7" }, + { "sp_terminal_active.frames", "7" }, { "sp_buggy_base", "RocksSP.pcx" }, { "sp_buggy_base.xpos", "1" }, @@ -2174,24 +2178,7 @@ struct ConfigInfo image_config[] = { "dx_bomb.ypos", "1" }, { "dx_bomb.frames", "1" }, -#if 0 - { "", "RocksMore.pcx" }, - { ".xpos", "" }, - { ".ypos", "" }, - { ".frames", "" }, -#endif - -#if 0 - /* images for Boulder Dash style elements and actions */ - { "bd_diamond", "bd_diamond.pcx" }, - { "bd_diamond.frame_xpos", "0" }, - { "bd_diamond.num_frames", "1" }, - { "robot_wheel", "bd_diamond.pcx" }, - { "robot_wheel.frame_xpos", "0" }, - { "robot_wheel.num_frames", "4" }, -#endif - - { NULL, NULL } + { NULL, NULL } }; struct ConfigInfo sound_config[] = diff --git a/src/main.h b/src/main.h index 823a230f..7f4252d7 100644 --- a/src/main.h +++ b/src/main.h @@ -346,9 +346,11 @@ struct ElementInfo char *sound_class_name; /* classification for custom sound effects */ char *editor_description; /* short description for level editor */ - int graphic; - int direction_graphic[4]; /* special graphics for left/right/up/down */ - boolean has_direction_graphic; + int graphic[NUM_GFX_ACTIONS_MAPPED]; + + /* special graphics for left/right/up/down */ + int direction_graphic[NUM_GFX_ACTIONS_MAPPED][4]; + boolean has_direction_graphic[NUM_GFX_ACTIONS_MAPPED]; }; struct GraphicInfo @@ -364,6 +366,7 @@ struct NewGraphicInfo int anim_frames; int anim_delay; int anim_mode; + boolean anim_global_sync; boolean anim_vertical; }; @@ -1475,15 +1478,34 @@ extern struct FileInfo *image_files, *sound_files; #define NUM_SOUNDS 55 +/* values for animation action types */ +#define GFX_ACTION_UNKNOWN 0 +#define GFX_ACTION_DEFAULT 1 +#define GFX_ACTION_WAITING 2 +#define GFX_ACTION_MOVING 3 +#define GFX_ACTION_DIGGING 4 +#define GFX_ACTION_COLLECTING 5 +#define GFX_ACTION_PUSHING 6 +#define GFX_ACTION_PASSING 7 +#define GFX_ACTION_IMPACT 8 +#define GFX_ACTION_ACTIVATING 9 +#define GFX_ACTION_BURNING 10 +#define GFX_ACTION_OTHER 11 + +#define NUM_GFX_ACTIONS 12 +#define NUM_GFX_ACTIONS_MAPPED 6 + + /* values for image configuration suffixes */ -#define GFXARG_XPOS 0 -#define GFXARG_YPOS 1 -#define GFXARG_FRAMES 2 -#define GFXARG_DELAY 3 -#define GFXARG_PINGPONG 4 -#define GFXARG_PINGPONG2 5 -#define GFXARG_REVERSE 6 -#define GFXARG_VERTICAL 7 +#define GFX_ARG_XPOS 0 +#define GFX_ARG_YPOS 1 +#define GFX_ARG_FRAMES 2 +#define GFX_ARG_DELAY 3 +#define GFX_ARG_PINGPONG 4 +#define GFX_ARG_PINGPONG2 5 +#define GFX_ARG_REVERSE 6 +#define GFX_ARG_GLOBAL_SYNC 7 +#define GFX_ARG_VERTICAL 8 /* values for image configuration */ #define IMG_EMPTY_SPACE 0 @@ -1792,163 +1814,157 @@ extern struct FileInfo *image_files, *sound_files; #define IMG_SP_PORT_XY 303 #define IMG_SP_SNIKSNAK 304 #define IMG_SP_SNIKSNAK_LEFT 305 -#define IMG_SP_SNIKSNAK_LEFT_MOVING 306 -#define IMG_SP_SNIKSNAK_RIGHT 307 -#define IMG_SP_SNIKSNAK_RIGHT_MOVING 308 -#define IMG_SP_SNIKSNAK_UP 309 -#define IMG_SP_SNIKSNAK_UP_MOVING 310 -#define IMG_SP_SNIKSNAK_DOWN 311 -#define IMG_SP_SNIKSNAK_DOWN_MOVING 312 -#define IMG_SP_ELECTRON 313 -#define IMG_SP_ELECTRON_MOVING 314 -#define IMG_SP_TERMINAL 315 -#define IMG_SP_TERMINAL_RUNNING 316 -#define IMG_SP_TERMINAL_ACTIVE 317 -#define IMG_SP_TERMINAL_ACTIVE_RUNNING 318 -#define IMG_SP_BUGGY_BASE 319 -#define IMG_SP_BUGGY_BASE_ACTIVATING 320 -#define IMG_SP_HARD_BASE1 321 -#define IMG_SP_HARD_BASE2 322 -#define IMG_SP_HARD_BASE3 323 -#define IMG_SP_HARD_BASE4 324 -#define IMG_SP_HARD_BASE5 325 -#define IMG_SP_HARD_BASE6 326 -#define IMG_INVISIBLE_STEELWALL 327 -#define IMG_INVISIBLE_STEELWALL_ON 328 -#define IMG_INVISIBLE_SAND 329 -#define IMG_INVISIBLE_SAND_ON 330 -#define IMG_INVISIBLE_WALL 331 -#define IMG_INVISIBLE_WALL_ON 332 -#define IMG_EM_KEY1 333 -#define IMG_EM_KEY2 334 -#define IMG_EM_KEY3 335 -#define IMG_EM_KEY4 336 -#define IMG_EM_GATE1 337 -#define IMG_EM_GATE2 338 -#define IMG_EM_GATE3 339 -#define IMG_EM_GATE4 340 -#define IMG_EM_GATE1_GRAY 341 -#define IMG_EM_GATE2_GRAY 342 -#define IMG_EM_GATE3_GRAY 343 -#define IMG_EM_GATE4_GRAY 344 -#define IMG_SP_EXPLOSION 345 -#define IMG_SP_EXPLOSION_INFOTRON 346 -#define IMG_CONVEYOR_BELT1_MIDDLE 347 -#define IMG_CONVEYOR_BELT1_MIDDLE_RUNNING 348 -#define IMG_CONVEYOR_BELT1_LEFT 349 -#define IMG_CONVEYOR_BELT1_LEFT_RUNNING 350 -#define IMG_CONVEYOR_BELT1_RIGHT 351 -#define IMG_CONVEYOR_BELT1_RIGHT_RUNNING 352 -#define IMG_CONVEYOR_BELT1_SWITCH_LEFT 353 -#define IMG_CONVEYOR_BELT1_SWITCH_MIDDLE 354 -#define IMG_CONVEYOR_BELT1_SWITCH_RIGHT 355 -#define IMG_CONVEYOR_BELT2_MIDDLE 356 -#define IMG_CONVEYOR_BELT2_MIDDLE_RUNNING 357 -#define IMG_CONVEYOR_BELT2_LEFT 358 -#define IMG_CONVEYOR_BELT2_LEFT_RUNNING 359 -#define IMG_CONVEYOR_BELT2_RIGHT 360 -#define IMG_CONVEYOR_BELT2_RIGHT_RUNNING 361 -#define IMG_CONVEYOR_BELT2_SWITCH_LEFT 362 -#define IMG_CONVEYOR_BELT2_SWITCH_MIDDLE 363 -#define IMG_CONVEYOR_BELT2_SWITCH_RIGHT 364 -#define IMG_CONVEYOR_BELT3_MIDDLE 365 -#define IMG_CONVEYOR_BELT3_MIDDLE_RUNNING 366 -#define IMG_CONVEYOR_BELT3_LEFT 367 -#define IMG_CONVEYOR_BELT3_LEFT_RUNNING 368 -#define IMG_CONVEYOR_BELT3_RIGHT 369 -#define IMG_CONVEYOR_BELT3_RIGHT_RUNNING 370 -#define IMG_CONVEYOR_BELT3_SWITCH_LEFT 371 -#define IMG_CONVEYOR_BELT3_SWITCH_MIDDLE 372 -#define IMG_CONVEYOR_BELT3_SWITCH_RIGHT 373 -#define IMG_CONVEYOR_BELT4_MIDDLE 374 -#define IMG_CONVEYOR_BELT4_MIDDLE_RUNNING 375 -#define IMG_CONVEYOR_BELT4_LEFT 376 -#define IMG_CONVEYOR_BELT4_LEFT_RUNNING 377 -#define IMG_CONVEYOR_BELT4_RIGHT 378 -#define IMG_CONVEYOR_BELT4_RIGHT_RUNNING 379 -#define IMG_CONVEYOR_BELT4_SWITCH_LEFT 380 -#define IMG_CONVEYOR_BELT4_SWITCH_MIDDLE 381 -#define IMG_CONVEYOR_BELT4_SWITCH_RIGHT 382 -#define IMG_SWITCHGATE_SWITCH_UP 383 -#define IMG_SWITCHGATE_SWITCH_DOWN 384 -#define IMG_LIGHT_SWITCH_OFF 385 -#define IMG_LIGHT_SWITCH_ON 386 -#define IMG_TIMEGATE_WHEEL 387 -#define IMG_TIMEGATE_WHEEL_RUNNING 388 -#define IMG_ENVELOPE 389 -#define IMG_SIGN_EXCLAMATION 390 -#define IMG_SIGN_STOP 391 -#define IMG_LANDMINE 392 -#define IMG_STEELWALL_SLANTED 393 -#define IMG_EXTRA_TIME 394 -#define IMG_SHIELD_ACTIVE 395 -#define IMG_SHIELD_PASSIVE 396 -#define IMG_SWITCHGATE_CLOSED 397 -#define IMG_SWITCHGATE_OPENING 398 -#define IMG_SWITCHGATE_OPEN 399 -#define IMG_SWITCHGATE_CLOSING 400 -#define IMG_TIMEGATE_CLOSED 401 -#define IMG_TIMEGATE_OPENING 402 -#define IMG_TIMEGATE_OPEN 403 -#define IMG_TIMEGATE_CLOSING 404 -#define IMG_BALLOON 405 -#define IMG_BALLOON_MOVING 406 -#define IMG_BALLOON_WINDROSE_LEFT 407 -#define IMG_BALLOON_WINDROSE_RIGHT 408 -#define IMG_BALLOON_WINDROSE_UP 409 -#define IMG_BALLOON_WINDROSE_DOWN 410 -#define IMG_BALLOON_WINDROSE_ALL 411 -#define IMG_EMC_STEELWALL1 412 -#define IMG_EMC_STEELWALL2 413 -#define IMG_EMC_STEELWALL3 414 -#define IMG_EMC_STEELWALL4 415 -#define IMG_EMC_WALL_PILLAR_UPPER 416 -#define IMG_EMC_WALL_PILLAR_MIDDLE 417 -#define IMG_EMC_WALL_PILLAR_LOWER 418 -#define IMG_EMC_WALL4 419 -#define IMG_EMC_WALL5 420 -#define IMG_EMC_WALL6 421 -#define IMG_EMC_WALL7 422 -#define IMG_EMC_WALL8 423 -#define IMG_ARROW_BLUE_LEFT 424 -#define IMG_ARROW_BLUE_RIGHT 425 -#define IMG_ARROW_BLUE_UP 426 -#define IMG_ARROW_BLUE_DOWN 427 -#define IMG_ARROW_RED_LEFT 428 -#define IMG_ARROW_RED_RIGHT 429 -#define IMG_ARROW_RED_UP 430 -#define IMG_ARROW_RED_DOWN 431 -#define IMG_SCROLLBAR_BLUE 432 -#define IMG_SCROLLBAR_RED 433 -#define IMG_SCROLLBAR_GREEN 434 -#define IMG_SCROLLBAR_YELLOW 435 -#define IMG_PEARL 436 -#define IMG_PEARL_BREAKING 437 -#define IMG_CRYSTAL 438 -#define IMG_WALL_PEARL 439 -#define IMG_WALL_CRYSTAL 440 -#define IMG_SPRING 441 -#define IMG_TUBE_RIGHT_DOWN 442 -#define IMG_TUBE_HORIZONTAL_DOWN 443 -#define IMG_TUBE_LEFT_DOWN 444 -#define IMG_TUBE_HORIZONTAL 445 -#define IMG_TUBE_VERTICAL_RIGHT 446 -#define IMG_TUBE_ALL 447 -#define IMG_TUBE_VERTICAL_LEFT 448 -#define IMG_TUBE_VERTICAL 449 -#define IMG_TUBE_RIGHT_UP 450 -#define IMG_TUBE_HORIZONTAL_UP 451 -#define IMG_TUBE_LEFT_UP 452 -#define IMG_TRAP_INACTIVE 453 -#define IMG_TRAP_ACTIVE 454 -#define IMG_TRAP_ACTIVATING 455 -#define IMG_BD_WALL 456 -#define IMG_BD_ROCK 457 -#define IMG_BD_ROCK_FALLING 458 -#define IMG_BD_ROCK_PUSHING 459 -#define IMG_DX_BOMB 460 - -#define NUM_IMAGE_FILES 461 +#define IMG_SP_SNIKSNAK_RIGHT 306 +#define IMG_SP_SNIKSNAK_UP 307 +#define IMG_SP_SNIKSNAK_DOWN 308 +#define IMG_SP_ELECTRON 309 +#define IMG_SP_TERMINAL 310 +#define IMG_SP_TERMINAL_ACTIVE 311 +#define IMG_SP_BUGGY_BASE 312 +#define IMG_SP_BUGGY_BASE_ACTIVATING 313 +#define IMG_SP_HARD_BASE1 314 +#define IMG_SP_HARD_BASE2 315 +#define IMG_SP_HARD_BASE3 316 +#define IMG_SP_HARD_BASE4 317 +#define IMG_SP_HARD_BASE5 318 +#define IMG_SP_HARD_BASE6 319 +#define IMG_INVISIBLE_STEELWALL 320 +#define IMG_INVISIBLE_STEELWALL_ON 321 +#define IMG_INVISIBLE_SAND 322 +#define IMG_INVISIBLE_SAND_ON 323 +#define IMG_INVISIBLE_WALL 324 +#define IMG_INVISIBLE_WALL_ON 325 +#define IMG_EM_KEY1 326 +#define IMG_EM_KEY2 327 +#define IMG_EM_KEY3 328 +#define IMG_EM_KEY4 329 +#define IMG_EM_GATE1 330 +#define IMG_EM_GATE2 331 +#define IMG_EM_GATE3 332 +#define IMG_EM_GATE4 333 +#define IMG_EM_GATE1_GRAY 334 +#define IMG_EM_GATE2_GRAY 335 +#define IMG_EM_GATE3_GRAY 336 +#define IMG_EM_GATE4_GRAY 337 +#define IMG_SP_EXPLOSION 338 +#define IMG_SP_EXPLOSION_INFOTRON 339 +#define IMG_CONVEYOR_BELT1_MIDDLE 340 +#define IMG_CONVEYOR_BELT1_MIDDLE_RUNNING 341 +#define IMG_CONVEYOR_BELT1_LEFT 342 +#define IMG_CONVEYOR_BELT1_LEFT_RUNNING 343 +#define IMG_CONVEYOR_BELT1_RIGHT 344 +#define IMG_CONVEYOR_BELT1_RIGHT_RUNNING 345 +#define IMG_CONVEYOR_BELT1_SWITCH_LEFT 346 +#define IMG_CONVEYOR_BELT1_SWITCH_MIDDLE 347 +#define IMG_CONVEYOR_BELT1_SWITCH_RIGHT 348 +#define IMG_CONVEYOR_BELT2_MIDDLE 349 +#define IMG_CONVEYOR_BELT2_MIDDLE_RUNNING 350 +#define IMG_CONVEYOR_BELT2_LEFT 351 +#define IMG_CONVEYOR_BELT2_LEFT_RUNNING 352 +#define IMG_CONVEYOR_BELT2_RIGHT 353 +#define IMG_CONVEYOR_BELT2_RIGHT_RUNNING 354 +#define IMG_CONVEYOR_BELT2_SWITCH_LEFT 355 +#define IMG_CONVEYOR_BELT2_SWITCH_MIDDLE 356 +#define IMG_CONVEYOR_BELT2_SWITCH_RIGHT 357 +#define IMG_CONVEYOR_BELT3_MIDDLE 358 +#define IMG_CONVEYOR_BELT3_MIDDLE_RUNNING 359 +#define IMG_CONVEYOR_BELT3_LEFT 360 +#define IMG_CONVEYOR_BELT3_LEFT_RUNNING 361 +#define IMG_CONVEYOR_BELT3_RIGHT 362 +#define IMG_CONVEYOR_BELT3_RIGHT_RUNNING 363 +#define IMG_CONVEYOR_BELT3_SWITCH_LEFT 364 +#define IMG_CONVEYOR_BELT3_SWITCH_MIDDLE 365 +#define IMG_CONVEYOR_BELT3_SWITCH_RIGHT 366 +#define IMG_CONVEYOR_BELT4_MIDDLE 367 +#define IMG_CONVEYOR_BELT4_MIDDLE_RUNNING 368 +#define IMG_CONVEYOR_BELT4_LEFT 369 +#define IMG_CONVEYOR_BELT4_LEFT_RUNNING 370 +#define IMG_CONVEYOR_BELT4_RIGHT 371 +#define IMG_CONVEYOR_BELT4_RIGHT_RUNNING 372 +#define IMG_CONVEYOR_BELT4_SWITCH_LEFT 373 +#define IMG_CONVEYOR_BELT4_SWITCH_MIDDLE 374 +#define IMG_CONVEYOR_BELT4_SWITCH_RIGHT 375 +#define IMG_SWITCHGATE_SWITCH_UP 376 +#define IMG_SWITCHGATE_SWITCH_DOWN 377 +#define IMG_LIGHT_SWITCH_OFF 378 +#define IMG_LIGHT_SWITCH_ON 379 +#define IMG_TIMEGATE_WHEEL 380 +#define IMG_TIMEGATE_WHEEL_RUNNING 381 +#define IMG_ENVELOPE 382 +#define IMG_SIGN_EXCLAMATION 383 +#define IMG_SIGN_STOP 384 +#define IMG_LANDMINE 385 +#define IMG_STEELWALL_SLANTED 386 +#define IMG_EXTRA_TIME 387 +#define IMG_SHIELD_ACTIVE 388 +#define IMG_SHIELD_PASSIVE 389 +#define IMG_SWITCHGATE_CLOSED 390 +#define IMG_SWITCHGATE_OPENING 391 +#define IMG_SWITCHGATE_OPEN 392 +#define IMG_SWITCHGATE_CLOSING 393 +#define IMG_TIMEGATE_CLOSED 394 +#define IMG_TIMEGATE_OPENING 395 +#define IMG_TIMEGATE_OPEN 396 +#define IMG_TIMEGATE_CLOSING 397 +#define IMG_BALLOON 398 +#define IMG_BALLOON_MOVING 399 +#define IMG_BALLOON_WINDROSE_LEFT 400 +#define IMG_BALLOON_WINDROSE_RIGHT 401 +#define IMG_BALLOON_WINDROSE_UP 402 +#define IMG_BALLOON_WINDROSE_DOWN 403 +#define IMG_BALLOON_WINDROSE_ALL 404 +#define IMG_EMC_STEELWALL1 405 +#define IMG_EMC_STEELWALL2 406 +#define IMG_EMC_STEELWALL3 407 +#define IMG_EMC_STEELWALL4 408 +#define IMG_EMC_WALL_PILLAR_UPPER 409 +#define IMG_EMC_WALL_PILLAR_MIDDLE 410 +#define IMG_EMC_WALL_PILLAR_LOWER 411 +#define IMG_EMC_WALL4 412 +#define IMG_EMC_WALL5 413 +#define IMG_EMC_WALL6 414 +#define IMG_EMC_WALL7 415 +#define IMG_EMC_WALL8 416 +#define IMG_ARROW_BLUE_LEFT 417 +#define IMG_ARROW_BLUE_RIGHT 418 +#define IMG_ARROW_BLUE_UP 419 +#define IMG_ARROW_BLUE_DOWN 420 +#define IMG_ARROW_RED_LEFT 421 +#define IMG_ARROW_RED_RIGHT 422 +#define IMG_ARROW_RED_UP 423 +#define IMG_ARROW_RED_DOWN 424 +#define IMG_SCROLLBAR_BLUE 425 +#define IMG_SCROLLBAR_RED 426 +#define IMG_SCROLLBAR_GREEN 427 +#define IMG_SCROLLBAR_YELLOW 428 +#define IMG_PEARL 429 +#define IMG_PEARL_BREAKING 430 +#define IMG_CRYSTAL 431 +#define IMG_WALL_PEARL 432 +#define IMG_WALL_CRYSTAL 433 +#define IMG_SPRING 434 +#define IMG_TUBE_RIGHT_DOWN 435 +#define IMG_TUBE_HORIZONTAL_DOWN 436 +#define IMG_TUBE_LEFT_DOWN 437 +#define IMG_TUBE_HORIZONTAL 438 +#define IMG_TUBE_VERTICAL_RIGHT 439 +#define IMG_TUBE_ALL 440 +#define IMG_TUBE_VERTICAL_LEFT 441 +#define IMG_TUBE_VERTICAL 442 +#define IMG_TUBE_RIGHT_UP 443 +#define IMG_TUBE_HORIZONTAL_UP 444 +#define IMG_TUBE_LEFT_UP 445 +#define IMG_TRAP_INACTIVE 446 +#define IMG_TRAP_ACTIVE 447 +#define IMG_TRAP_ACTIVATING 448 +#define IMG_BD_WALL 449 +#define IMG_BD_ROCK 450 +#define IMG_BD_ROCK_FALLING 451 +#define IMG_BD_ROCK_PUSHING 452 +#define IMG_DX_BOMB 453 + +#define NUM_IMAGE_FILES 454 + /* values for sound configuration suffixes */ /* (currently none) */ @@ -2187,8 +2203,9 @@ extern struct FileInfo *image_files, *sound_files; /* for DrawGraphicAnimation() [tools.c] and AnimateToon() [cartoons.c] */ #define ANIM_NORMAL 0 -#define ANIM_PINGPONG 1 -#define ANIM_REVERSE 2 +#define ANIM_REVERSE (1 << 0) +#define ANIM_PINGPONG (1 << 1) +#define ANIM_PINGPONG2 (1 << 2) /* values for game_emulation */ #define EMU_NONE 0 diff --git a/src/tools.c b/src/tools.c index 7b7bdefb..4ef1f68b 100644 --- a/src/tools.c +++ b/src/tools.c @@ -706,27 +706,38 @@ static int getGraphicAnimationPhase(int frames, int delay, int mode) return phase; } -static int getNewGraphicAnimationFrame(int graphic) +static int getNewGraphicAnimationFrame(int graphic, int sync_frame) { - int frames = new_graphic_info[graphic].anim_frames; + int num_frames = new_graphic_info[graphic].anim_frames; int delay = new_graphic_info[graphic].anim_delay; int mode = new_graphic_info[graphic].anim_mode; - int phase; + int frame; - if (mode == ANIM_PINGPONG) + /* animation synchronized with global frame counter, not move position */ + if (new_graphic_info[graphic].anim_global_sync || sync_frame < 0) + sync_frame = FrameCounter; + + if (mode & ANIM_PINGPONG) /* use border frames once */ { - int max_anim_frames = 2 * frames - 2; + int max_anim_frames = 2 * num_frames - 2; - phase = (FrameCounter % (delay * max_anim_frames)) / delay; - phase = (phase < frames ? phase : max_anim_frames - phase); + frame = (sync_frame % (delay * max_anim_frames)) / delay; + frame = (frame < num_frames ? frame : max_anim_frames - frame); } - else - phase = (FrameCounter % (delay * frames)) / delay; + else if (mode & ANIM_PINGPONG2) /* use border frames twice */ + { + int max_anim_frames = 2 * num_frames; - if (mode == ANIM_REVERSE) - phase = (frames - 1) - phase; + frame = (sync_frame % (delay * max_anim_frames)) / delay; + frame = (frame < num_frames ? frame : max_anim_frames - frame - 1); + } + else /* mode == ANIM_NORMAL || mode == ANIM_REVERSE */ + frame = (sync_frame % (delay * num_frames)) / delay; - return phase; + if (mode & ANIM_REVERSE) /* use reverse animation direction */ + frame = num_frames - frame - 1; + + return frame; } void DrawGraphicAnimationExt(int x, int y, int graphic, @@ -749,7 +760,7 @@ void DrawNewGraphicAnimationExt(int x, int y, int graphic, int mask_mode) if (!(FrameCounter % delay) && IN_SCR_FIELD(SCREENX(x), SCREENY(y))) { - int frame = getNewGraphicAnimationFrame(graphic); + int frame = getNewGraphicAnimationFrame(graphic, -1); if (mask_mode == USE_MASKING) DrawNewGraphicThruMask(SCREENX(x), SCREENY(y), graphic, frame); @@ -1448,18 +1459,23 @@ void DrawNewScreenElementExt(int x, int y, int dx, int dy, int element, int cut_mode, int mask_mode) { int ux = LEVELX(x), uy = LEVELY(y); - int dir = MovDir[ux][uy]; - int graphic = el_dir2img(element, dir); - int frame = getNewGraphicAnimationFrame(graphic); - int phase8 = ABS(MovPos[ux][uy]) / (TILEX / 8); + int move_dir = MovDir[ux][uy]; + int move_pos = ABS(MovPos[ux][uy]) / (TILEX / 8); + int graphic = el_dir2img(element, move_dir); + int frame = getNewGraphicAnimationFrame(graphic, move_pos); + int phase8 = move_pos; int phase4 = phase8 / 2; int phase2 = phase8 / 4; - if (element == EL_KAEFER) + int dir = move_dir; /* !!! THROW AWAY LATER !!! */ + + if (0) { ; } - else if (element == EL_PACMAN || element == EL_KAEFER || element == EL_FLIEGER) +#if 0 + else if (element == EL_PACMAN || element == EL_KAEFER || + element == EL_FLIEGER) { graphic += 1 * !phase2; @@ -1485,12 +1501,9 @@ void DrawNewScreenElementExt(int x, int y, int dx, int dy, int element, } else if (element == EL_SP_ELECTRON) { -#if 1 graphic = GFX2_SP_ELECTRON + getGraphicAnimationPhase(8, 2, ANIM_NORMAL); -#else - graphic = GFX2_SP_ELECTRON + getNewGraphicAnimationFrame(graphic); -#endif } +#endif else if (element == EL_MOLE || element == EL_PINGUIN || element == EL_SCHWEIN || element == EL_DRACHE) { @@ -1518,7 +1531,7 @@ void DrawNewScreenElementExt(int x, int y, int dx, int dy, int element, #if 1 graphic = GFX_SONDE_START + getGraphicAnimationPhase(8, 2, ANIM_NORMAL); #else - graphic = GFX_SONDE_START + getNewGraphicAnimationFrame(graphic); + graphic = GFX_SONDE_START + getNewGraphicAnimationFrame(graphic, move_pos); #endif } else if (element == EL_SALZSAEURE) @@ -1526,7 +1539,7 @@ void DrawNewScreenElementExt(int x, int y, int dx, int dy, int element, #if 1 graphic = GFX_GEBLUBBER + getGraphicAnimationPhase(4, 10, ANIM_NORMAL); #else - graphic = GFX_GEBLUBBER + getNewGraphicAnimationFrame(graphic); + graphic = GFX_GEBLUBBER + getNewGraphicAnimationFrame(graphic, move_pos); #endif } else if (element == EL_BUTTERFLY || element == EL_FIREFLY) @@ -1571,7 +1584,7 @@ void DrawNewScreenElementExt(int x, int y, int dx, int dy, int element, #if 1 graphic += 3 + getGraphicAnimationPhase(4, 4, ANIM_REVERSE); #else - graphic += 3 + getNewGraphicAnimationFrame(graphic); + graphic += 3 + getNewGraphicAnimationFrame(graphic, move_pos); #endif } else if (IS_AMOEBOID(element) || element == EL_AMOEBA_DRIPPING) @@ -3309,6 +3322,7 @@ int el2img(int element) { case EL_BUTTERFLY: return IMG_BD_BUTTERFLY; case EL_FIREFLY: return IMG_BD_FIREFLY; + case EL_SP_ELECTRON: return IMG_SP_ELECTRON; default: break;