projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added support for post delay for global animations
[rocksndiamonds.git]
/
src
/
tools.c
diff --git
a/src/tools.c
b/src/tools.c
index 3cf3b9609618d50b46346dba54d7bed7c7f32937..dbeba50c151b71240f4558ffc780909718ec1f46 100644
(file)
--- a/
src/tools.c
+++ b/
src/tools.c
@@
-173,6
+173,9
@@
static int el_act2crm(int, int);
static struct GadgetInfo *tool_gadget[NUM_TOOL_BUTTONS];
static int request_gadget_id = -1;
static struct GadgetInfo *tool_gadget[NUM_TOOL_BUTTONS];
static int request_gadget_id = -1;
+static unsigned int sync_frame_delay = 0;
+static unsigned int sync_frame_delay_value = GAME_FRAME_DELAY;
+
static char *print_if_not_empty(int element)
{
static char *s = NULL;
static char *print_if_not_empty(int element)
{
static char *s = NULL;
@@
-649,7
+652,7
@@
void FadeSetEnterScreen()
void FadeSetNextScreen()
{
void FadeSetNextScreen()
{
- fading = menu.next_screen;
+ fading = menu.next_screen
[game_status]
;
// (do not overwrite fade mode set by FadeSetEnterScreen)
// FadeSetLeaveNext(fading, TRUE); /* (keep same fade mode) */
// (do not overwrite fade mode set by FadeSetEnterScreen)
// FadeSetLeaveNext(fading, TRUE); /* (keep same fade mode) */
@@
-875,7
+878,8
@@
static void RedrawGlobalBorderIfNeeded()
return;
// copy current draw buffer to later copy back areas that have not changed
return;
// copy current draw buffer to later copy back areas that have not changed
- BlitBitmap(backbuffer, bitmap_db_store, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0);
+ if (game_status_last != GAME_MODE_TITLE)
+ BlitBitmap(backbuffer, bitmap_db_store, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0);
if (CheckIfGlobalBorderRedrawIsNeeded())
{
if (CheckIfGlobalBorderRedrawIsNeeded())
{
@@
-1064,8
+1068,8
@@
void getSizedGraphicSourceExt(int graphic, int frame, int tilesize,
}
*bitmap = src_bitmap;
}
*bitmap = src_bitmap;
- *x = src_x * tilesize /
TILESIZE
;
- *y = src_y * tilesize /
TILESIZE
;
+ *x = src_x * tilesize /
g->tile_size
;
+ *y = src_y * tilesize /
g->tile_size
;
}
void getFixedGraphicSourceExt(int graphic, int frame, Bitmap **bitmap,
}
void getFixedGraphicSourceExt(int graphic, int frame, Bitmap **bitmap,
@@
-1126,6
+1130,9
@@
inline static void getGraphicSourceExt(int graphic, int frame, Bitmap **bitmap,
*x = src_x + frame * g->offset_x;
*y = src_y + frame * g->offset_y;
}
*x = src_x + frame * g->offset_x;
*y = src_y + frame * g->offset_y;
}
+
+ *x = *x * TILESIZE_VAR / g->tile_size;
+ *y = *y * TILESIZE_VAR / g->tile_size;
}
void getGraphicSource(int graphic, int frame, Bitmap **bitmap, int *x, int *y)
}
void getGraphicSource(int graphic, int frame, Bitmap **bitmap, int *x, int *y)
@@
-1235,13
+1242,12
@@
void DrawGraphicThruMaskExt(DrawBuffer *d, int dst_x, int dst_y, int graphic,
void DrawFixedGraphicThruMaskExt(DrawBuffer *d, int dst_x, int dst_y,
int graphic, int frame)
{
void DrawFixedGraphicThruMaskExt(DrawBuffer *d, int dst_x, int dst_y,
int graphic, int frame)
{
- struct GraphicInfo *g = &graphic_info[graphic];
Bitmap *src_bitmap;
int src_x, src_y;
getFixedGraphicSource(graphic, frame, &src_bitmap, &src_x, &src_y);
Bitmap *src_bitmap;
int src_x, src_y;
getFixedGraphicSource(graphic, frame, &src_bitmap, &src_x, &src_y);
- BlitBitmapMasked(src_bitmap, d, src_x, src_y,
g->width, g->height
,
+ BlitBitmapMasked(src_bitmap, d, src_x, src_y,
TILEX, TILEY
,
dst_x, dst_y);
}
dst_x, dst_y);
}
@@
-1302,20
+1308,20
@@
inline static void DrawGraphicShiftedNormal(int x, int y, int dx, int dy,
width = -dx;
dx = TILEX + dx;
}
width = -dx;
dx = TILEX + dx;
}
- else if (x
==
BX1 && dx < 0) /* object leaves playfield to the left */
+ else if (x
==
BX1 && dx < 0) /* object leaves playfield to the left */
{
width += dx;
cx = -dx;
dx = 0;
}
{
width += dx;
cx = -dx;
dx = 0;
}
- else if (x
==
BX2 && dx > 0) /* object leaves playfield to the right */
+ else if (x
==
BX2 && dx > 0) /* object leaves playfield to the right */
width -= dx;
else if (dx) /* general horizontal movement */
MarkTileDirty(x + SIGN(dx), y);
if (y < BY1) /* object enters playfield from the top */
{
width -= dx;
else if (dx) /* general horizontal movement */
MarkTileDirty(x + SIGN(dx), y);
if (y < BY1) /* object enters playfield from the top */
{
- if (cut_mode
==
CUT_BELOW) /* object completely above top border */
+ if (cut_mode
==
CUT_BELOW) /* object completely above top border */
return;
y = BY1;
return;
y = BY1;
@@
-1329,7
+1335,7
@@
inline static void DrawGraphicShiftedNormal(int x, int y, int dx, int dy,
height = -dy;
dy = TILEY + dy;
}
height = -dy;
dy = TILEY + dy;
}
- else if (y
==
BY1 && dy < 0) /* object leaves playfield to the top */
+ else if (y
==
BY1 && dy < 0) /* object leaves playfield to the top */
{
height += dy;
cy = -dy;
{
height += dy;
cy = -dy;
@@
-2388,13
+2394,6
@@
void AnimateEnvelopeRequest(int anim_mode, int action)
ystart = yend;
end = 0;
}
ystart = yend;
end = 0;
}
- else
- {
- if (action == ACTION_OPENING)
- PlayMenuSoundStereo(SND_DOOR_OPENING, SOUND_MIDDLE);
- else if (action == ACTION_CLOSING)
- PlayMenuSoundStereo(SND_DOOR_CLOSING, SOUND_MIDDLE);
- }
for (i = start; i <= end; i++)
{
for (i = start; i <= end; i++)
{
@@
-3400,8
+3399,7
@@
void WaitForEventToContinue()
DoAnimation();
DoAnimation();
- /* don't eat all CPU time */
- Delay(10);
+ WaitUntilDelayReached(&sync_frame_delay, sync_frame_delay_value);
}
}
}
}
@@
-3572,12
+3570,11
@@
static int RequestHandleEvents(unsigned int req_state)
else
{
DoAnimation();
else
{
DoAnimation();
-
- if (!PendingEvent()) /* delay only if no pending events */
- Delay(10);
}
BackToFront();
}
BackToFront();
+
+ WaitUntilDelayReached(&sync_frame_delay, sync_frame_delay_value);
}
return result;
}
return result;
@@
-8333,6
+8330,7
@@
void ChangeViewportPropertiesIfNeeded()
// printf("::: init_video_buffer\n");
InitVideoBuffer(WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH, setup.fullscreen);
// printf("::: init_video_buffer\n");
InitVideoBuffer(WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH, setup.fullscreen);
+ InitImageTextures();
}
if (init_gadgets_and_toons)
}
if (init_gadgets_and_toons)