X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Fcartoons.c;h=a0115cf98dce2b312824186ef95b8ac2afe3c2be;hp=fa8152d9852c46da5671bf086bf55b00f09fda02;hb=3ff2e8a0b5c27b99a9920bdf5ed82bc41bf40181;hpb=5df470717980e8b1e8648a536ca620e4ca52a170 diff --git a/src/cartoons.c b/src/cartoons.c index fa8152d9..a0115cf9 100644 --- a/src/cartoons.c +++ b/src/cartoons.c @@ -1,15 +1,13 @@ -/*********************************************************** -* Rocks'n'Diamonds -- McDuffin Strikes Back! * -*----------------------------------------------------------* -* (c) 1995-2002 Artsoft Entertainment * -* Holger Schemel * -* Detmolder Strasse 189 * -* 33604 Bielefeld * -* Germany * -* e-mail: info@artsoft.org * -*----------------------------------------------------------* -* cartoons.c * -***********************************************************/ +// ============================================================================ +// Rocks'n'Diamonds - McDuffin Strikes Back! +// ---------------------------------------------------------------------------- +// (c) 1995-2014 by Artsoft Entertainment +// Holger Schemel +// info@artsoft.org +// http://www.artsoft.org/ +// ---------------------------------------------------------------------------- +// cartoons.c +// ============================================================================ #include "cartoons.h" #include "main.h" @@ -17,319 +15,59 @@ /* values for toon definition */ -#define NUM_TOONS 18 +#define MAX_NUM_TOONS 20 -#define DWARF_XSIZE 40 -#define DWARF_YSIZE 48 -#define DWARF_X 2 -#define DWARF_Y 72 -#define DWARF2_Y 186 -#define DWARF_FRAMES 8 -#define DWARF_DELAY 5 -#define DWARF_STEPSIZE 4 -#define JUMPER_XSIZE 48 -#define JUMPER_YSIZE 56 -#define JUMPER_X 2 -#define JUMPER_Y 125 -#define JUMPER_FRAMES 8 -#define JUMPER_DELAY 5 -#define JUMPER_STEPSIZE 4 -#define CLOWN_XSIZE 80 -#define CLOWN_YSIZE 110 -#define CLOWN_X 327 -#define CLOWN_Y 10 -#define CLOWN_FRAMES 1 -#define CLOWN_DELAY 5 -#define CLOWN_STEPSIZE 4 -#define BIRD_XSIZE 32 -#define BIRD_YSIZE 30 -#define BIRD1_X 2 -#define BIRD1_Y 2 -#define BIRD2_X 2 -#define BIRD2_Y 37 -#define BIRD_FRAMES 8 -#define BIRD_DELAY 2 -#define BIRD_STEPSIZE 4 - -struct ToonInfo toons[NUM_TOONS] = -{ - { - IMG_GLOBAL_TOONS, - DWARF_XSIZE, DWARF_YSIZE, - DWARF_X, DWARF_Y, - DWARF_FRAMES, - DWARF_DELAY, - DWARF_STEPSIZE, - ANIM_LOOP, - ANIMDIR_RIGHT, - ANIMPOS_DOWN - }, - { - IMG_GLOBAL_TOONS, - DWARF_XSIZE, DWARF_YSIZE, - DWARF_X, DWARF2_Y, - DWARF_FRAMES, - DWARF_DELAY, - DWARF_STEPSIZE, - ANIM_LOOP, - ANIMDIR_LEFT, - ANIMPOS_DOWN - }, - { - IMG_GLOBAL_TOONS, - JUMPER_XSIZE, JUMPER_YSIZE, - JUMPER_X, JUMPER_Y, - JUMPER_FRAMES, - JUMPER_DELAY, - JUMPER_STEPSIZE, - ANIM_LOOP, - ANIMDIR_RIGHT, - ANIMPOS_DOWN - }, - { - IMG_GLOBAL_TOONS, - CLOWN_XSIZE, CLOWN_YSIZE, - CLOWN_X, CLOWN_Y, - CLOWN_FRAMES, - CLOWN_DELAY, - CLOWN_STEPSIZE, - ANIM_LOOP, - ANIMDIR_UP, - ANIMPOS_ANY - }, - { - IMG_GLOBAL_TOONS, - BIRD_XSIZE, BIRD_YSIZE, - BIRD1_X, BIRD1_Y, - BIRD_FRAMES, - BIRD_DELAY, - BIRD_STEPSIZE, - ANIM_PINGPONG, - ANIMDIR_RIGHT, - ANIMPOS_UPPER - }, - { - IMG_GLOBAL_TOONS, - BIRD_XSIZE, BIRD_YSIZE, - BIRD2_X, BIRD2_Y, - BIRD_FRAMES, - BIRD_DELAY, - BIRD_STEPSIZE, - ANIM_PINGPONG, - ANIMDIR_LEFT, - ANIMPOS_UPPER - }, - { - IMG_PLAYER1_LEFT_MOVING, - -1, -1, - -1, -1, - -1, - -1, - -1, - -1, - ANIMDIR_LEFT, - ANIMPOS_DOWN - }, - { - IMG_PLAYER1_RIGHT_MOVING, - -1, -1, - -1, -1, - -1, - -1, - -1, - -1, - ANIMDIR_RIGHT, - ANIMPOS_DOWN - }, - { - IMG_PENGUIN_LEFT_MOVING, - -1, -1, - -1, -1, - -1, - -1, - -1, - -1, - ANIMDIR_LEFT, - ANIMPOS_DOWN - }, - { - IMG_PENGUIN_RIGHT_MOVING, - -1, -1, - -1, -1, - -1, - -1, - -1, - -1, - ANIMDIR_RIGHT, - ANIMPOS_DOWN - }, - { - IMG_MOLE_LEFT_MOVING, - -1, -1, - -1, -1, - -1, - -1, - -1, - -1, - ANIMDIR_LEFT, - ANIMPOS_DOWN - }, - { - IMG_MOLE_RIGHT_MOVING, - -1, -1, - -1, -1, - -1, - -1, - -1, - -1, - ANIMDIR_RIGHT, - ANIMPOS_DOWN - }, - { - IMG_PIG_LEFT_MOVING, - -1, -1, - -1, -1, - -1, - -1, - -1, - -1, - ANIMDIR_LEFT, - ANIMPOS_DOWN - }, - { - IMG_PIG_RIGHT_MOVING, - -1, -1, - -1, -1, - -1, - -1, - -1, - -1, - ANIMDIR_RIGHT, - ANIMPOS_DOWN - }, - { - IMG_DRAGON_LEFT_MOVING, - -1, -1, - -1, -1, - -1, - -1, - -1, - -1, - ANIMDIR_LEFT, - ANIMPOS_DOWN - }, - { - IMG_DRAGON_RIGHT_MOVING, - -1, -1, - -1, -1, - -1, - -1, - -1, - -1, - ANIMDIR_RIGHT, - ANIMPOS_DOWN - }, - { - IMG_SATELLITE_MOVING, - -1, -1, - -1, -1, - -1, - -1, - -1, - -1, - ANIMDIR_LEFT, - ANIMPOS_ANY - }, - { - IMG_SATELLITE_MOVING, - -1, -1, - -1, -1, - -1, - -1, - -1, - -1, - ANIMDIR_RIGHT, - ANIMPOS_ANY - }, -}; +static struct ToonInfo toons[MAX_NUM_TOONS]; static void PrepareBackbuffer() { - /* Fill empty backbuffer for animation functions */ - if (setup.direct_draw && game_status == PLAYING) - { - int xx,yy; - - SetDrawtoField(DRAW_BACKBUFFER); - - for(xx=0; xx= 0 && global.num_toons < MAX_NUM_TOONS) + num_toons = global.num_toons; + + for (i = 0; i < num_toons; i++) { - int graphic = toons[i].graphic; + int graphic = IMG_TOON_1 + i; + struct FileInfo *image = getImageListEntryFromImageID(graphic); toons[i].bitmap = graphic_info[graphic].bitmap; - if (toons[i].src_x == -1 && toons[i].src_y == -1) - { - int anim_frames = graphic_info[graphic].anim_frames; - int anim_delay = graphic_info[graphic].anim_delay; - int anim_mode = graphic_info[graphic].anim_mode; - int start_frame = graphic_info[graphic].anim_start_frame; + toons[i].src_x = graphic_info[graphic].src_x; + toons[i].src_y = graphic_info[graphic].src_y; - toons[i].src_x = graphic_info[graphic].src_x; - toons[i].src_y = graphic_info[graphic].src_y; + toons[i].width = graphic_info[graphic].width; + toons[i].height = graphic_info[graphic].height; - toons[i].width = TILEX; - toons[i].height = TILEY; + toons[i].anim_frames = graphic_info[graphic].anim_frames; + toons[i].anim_delay = graphic_info[graphic].anim_delay; + toons[i].anim_mode = graphic_info[graphic].anim_mode; + toons[i].anim_start_frame = graphic_info[graphic].anim_start_frame; - toons[i].anim_frames = anim_frames; - toons[i].anim_delay = anim_delay; - toons[i].anim_mode = anim_mode; - toons[i].start_frame = start_frame; + toons[i].step_offset = graphic_info[graphic].step_offset; + toons[i].step_delay = graphic_info[graphic].step_delay; - toons[i].move_delay = 1; - toons[i].stepsize = TILEX / 8; - } - else - { - toons[i].anim_delay = 1; /* no delay between frames */ - toons[i].start_frame = 0; /* always start with first */ - } + toons[i].direction = image->parameter[GFX_ARG_DIRECTION]; + toons[i].position = image->parameter[GFX_ARG_POSITION]; } - InitToonScreen(bitmap_db_door, + InitToonScreen(bitmap_db_toons, BackToFront, PrepareBackbuffer, ToonNeedsRedraw, - toons, NUM_TOONS, + toons, num_toons, REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE, GAME_FRAME_DELAY); }