projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added API functions to get score tape from score server
[rocksndiamonds.git]
/
src
/
tools.c
diff --git
a/src/tools.c
b/src/tools.c
index a3e5306835f7082e83a21f22c3dc053f13f5257d..bde987901f8b4181c824ae673faa4cde114aea90 100644
(file)
--- a/
src/tools.c
+++ b/
src/tools.c
@@
-512,6
+512,10
@@
static void DrawMaskedBorderExt_Rect(int x, int y, int width, int height,
Bitmap *src_bitmap = getGlobalBorderBitmapFromStatus(global.border_status);
Bitmap *dst_bitmap = gfx.masked_border_bitmap_ptr;
Bitmap *src_bitmap = getGlobalBorderBitmapFromStatus(global.border_status);
Bitmap *dst_bitmap = gfx.masked_border_bitmap_ptr;
+ // may happen for "border.draw_masked.*" with undefined "global.border.*"
+ if (src_bitmap == NULL)
+ return;
+
if (x == -1 && y == -1)
return;
if (x == -1 && y == -1)
return;
@@
-1490,8
+1494,9
@@
int getGraphicAnimationFrameXY(int graphic, int lx, int ly)
int ysize = MAX(1, g->anim_frames / xsize);
int xoffset = g->anim_start_frame % xsize;
int yoffset = g->anim_start_frame % ysize;
int ysize = MAX(1, g->anim_frames / xsize);
int xoffset = g->anim_start_frame % xsize;
int yoffset = g->anim_start_frame % ysize;
- int x = (lx + xoffset + xsize) % xsize;
- int y = (ly + yoffset + ysize) % ysize;
+ // may be needed if screen field is significantly larger than playfield
+ int x = (lx + xoffset + SCR_FIELDX * xsize) % xsize;
+ int y = (ly + yoffset + SCR_FIELDY * ysize) % ysize;
int sync_frame = y * xsize + x;
return sync_frame % g->anim_frames;
int sync_frame = y * xsize + x;
return sync_frame % g->anim_frames;
@@
-1499,14
+1504,19
@@
int getGraphicAnimationFrameXY(int graphic, int lx, int ly)
else if (graphic_info[graphic].anim_mode & ANIM_RANDOM_STATIC)
{
struct GraphicInfo *g = &graphic_info[graphic];
else if (graphic_info[graphic].anim_mode & ANIM_RANDOM_STATIC)
{
struct GraphicInfo *g = &graphic_info[graphic];
- int x = (lx + lev_fieldx) % lev_fieldx;
- int y = (ly + lev_fieldy) % lev_fieldy;
+ // may be needed if screen field is significantly larger than playfield
+ int x = (lx + SCR_FIELDX * lev_fieldx) % lev_fieldx;
+ int y = (ly + SCR_FIELDY * lev_fieldy) % lev_fieldy;
int sync_frame = GfxRandomStatic[x][y];
return sync_frame % g->anim_frames;
}
int sync_frame = GfxRandomStatic[x][y];
return sync_frame % g->anim_frames;
}
+ else
+ {
+ int sync_frame = (IN_LEV_FIELD(lx, ly) ? GfxFrame[lx][ly] : -1);
- return getGraphicAnimationFrame(graphic, GfxFrame[lx][ly]);
+ return getGraphicAnimationFrame(graphic, sync_frame);
+ }
}
void getGraphicSourceBitmap(int graphic, int tilesize, Bitmap **bitmap)
}
void getGraphicSourceBitmap(int graphic, int tilesize, Bitmap **bitmap)
@@
-1996,11
+2006,11
@@
void DrawScreenElementExt(int x, int y, int dx, int dy, int element,
int graphic;
int frame;
int graphic;
int frame;
- if (element == EL_EMPTY)
- element = GfxElementEmpty[lx][ly];
-
if (IN_LEV_FIELD(lx, ly))
{
if (IN_LEV_FIELD(lx, ly))
{
+ if (element == EL_EMPTY)
+ element = GfxElementEmpty[lx][ly];
+
SetRandomAnimationValue(lx, ly);
graphic = el_act_dir2img(element, GfxAction[lx][ly], GfxDir[lx][ly]);
SetRandomAnimationValue(lx, ly);
graphic = el_act_dir2img(element, GfxAction[lx][ly], GfxDir[lx][ly]);
@@
-2517,6
+2527,11
@@
void DrawScreenGraphic(int x, int y, int graphic, int frame)
}
}
}
}
+void DrawLevelGraphic(int x, int y, int graphic, int frame)
+{
+ DrawScreenGraphic(SCREENX(x), SCREENY(y), graphic, frame);
+}
+
void DrawScreenElement(int x, int y, int element)
{
int mask_mode = NO_MASKING;
void DrawScreenElement(int x, int y, int element)
{
int mask_mode = NO_MASKING;
@@
-3960,6
+3975,9
@@
void DrawLevelGraphicAnimationIfNeeded(int x, int y, int graphic)
if (!IN_LEV_FIELD(x, y) || !IN_SCR_FIELD(sx, sy))
return;
if (!IN_LEV_FIELD(x, y) || !IN_SCR_FIELD(sx, sy))
return;
+ if (Tile[x][y] == EL_EMPTY)
+ graphic = el2img(GfxElementEmpty[x][y]);
+
if (!IS_NEW_FRAME(GfxFrame[x][y], graphic))
return;
if (!IS_NEW_FRAME(GfxFrame[x][y], graphic))
return;
@@
-5378,7
+5396,6
@@
unsigned int MoveDoor(unsigned int door_state)
int num_move_steps = 0; // number of animation steps for all doors
int max_move_delay_doors_only = 0; // delay for doors only (no panel)
int num_move_steps_doors_only = 0; // steps for doors only (no panel)
int num_move_steps = 0; // number of animation steps for all doors
int max_move_delay_doors_only = 0; // delay for doors only (no panel)
int num_move_steps_doors_only = 0; // steps for doors only (no panel)
- int current_move_delay = 0;
int start = 0;
int k;
int start = 0;
int k;
@@
-5638,8
+5655,6
@@
unsigned int MoveDoor(unsigned int door_state)
SkipUntilDelayReached(&door_delay, door_delay_value, &k, last_frame);
SkipUntilDelayReached(&door_delay, door_delay_value, &k, last_frame);
- current_move_delay += max_step_delay;
-
// prevent OS (Windows) from complaining about program not responding
CheckQuitEvent();
}
// prevent OS (Windows) from complaining about program not responding
CheckQuitEvent();
}
@@
-9954,7
+9969,7
@@
static const unsigned __int64 epoch = ((unsigned __int64) 116444736000000000ULL)
* Note: this function is not for Win32 high precision timing purpose. See
* elapsed_time().
*/
* Note: this function is not for Win32 high precision timing purpose. See
* elapsed_time().
*/
-int gettimeofday_windows(struct timeval * tp, struct timezone * tzp)
+
static
int gettimeofday_windows(struct timeval * tp, struct timezone * tzp)
{
FILETIME file_time;
SYSTEMTIME system_time;
{
FILETIME file_time;
SYSTEMTIME system_time;