projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added limiting default number of game elements on info screen
[rocksndiamonds.git]
/
src
/
tools.c
diff --git
a/src/tools.c
b/src/tools.c
index d00b01d46d74a5abd9ac177b1ae5ee62e91512c5..98e60731333f9add8584999855c3ee65459e3e1f 100644
(file)
--- a/
src/tools.c
+++ b/
src/tools.c
@@
-165,6
+165,14
@@
static struct DoorPartControlInfo door_part_controls[] =
}
};
}
};
+static struct XY xy_topdown[] =
+{
+ { 0, -1 },
+ { -1, 0 },
+ { +1, 0 },
+ { 0, +1 }
+};
+
// forward declaration for internal use
static void UnmapToolButtons(void);
// forward declaration for internal use
static void UnmapToolButtons(void);
@@
-767,7
+775,7
@@
void BackToFront(void)
DrawFramesPerSecond();
// remove playfield redraw before potentially merging with doors redraw
DrawFramesPerSecond();
// remove playfield redraw before potentially merging with doors redraw
- if (DrawingDeactivated(REAL_SX, REAL_SY
, FULL_SXSIZE, FULL_SYSIZE
))
+ if (DrawingDeactivated(REAL_SX, REAL_SY))
redraw_mask &= ~REDRAW_FIELD;
// redraw complete window if both playfield and (some) doors need redraw
redraw_mask &= ~REDRAW_FIELD;
// redraw complete window if both playfield and (some) doors need redraw
@@
-1102,7
+1110,7
@@
static int getGlobalGameStatus(int status)
status);
}
status);
}
-
static
Bitmap *getBitmapFromGraphicOrDefault(int graphic, int default_graphic)
+Bitmap *getBitmapFromGraphicOrDefault(int graphic, int default_graphic)
{
if (graphic == IMG_UNDEFINED)
return NULL;
{
if (graphic == IMG_UNDEFINED)
return NULL;
@@
-1433,7
+1441,7
@@
void FloodFillLevelExt(int start_x, int start_y, int fill_element,
int max_fieldx, int max_fieldy)
{
static struct XY stack_buffer[MAX_LEV_FIELDX * MAX_LEV_FIELDY];
int max_fieldx, int max_fieldy)
{
static struct XY stack_buffer[MAX_LEV_FIELDX * MAX_LEV_FIELDY];
- st
atic struct XY check[4] = { { -1, 0 }, { 0, -1 }, { 1, 0 }, { 0, 1 } }
;
+ st
ruct XY *check = xy_topdown
;
int old_element = field[start_x][start_y];
int stack_pos = 0;
int old_element = field[start_x][start_y];
int stack_pos = 0;
@@
-1484,6
+1492,8
@@
int getGraphicAnimationFrame(int graphic, int sync_frame)
// animation synchronized with global frame counter, not move position
if (graphic_info[graphic].anim_global_sync || sync_frame < 0)
sync_frame = FrameCounter;
// animation synchronized with global frame counter, not move position
if (graphic_info[graphic].anim_global_sync || sync_frame < 0)
sync_frame = FrameCounter;
+ else if (graphic_info[graphic].anim_global_anim_sync)
+ sync_frame = getGlobalAnimSyncFrame();
return getAnimationFrame(graphic_info[graphic].anim_frames,
graphic_info[graphic].anim_delay,
return getAnimationFrame(graphic_info[graphic].anim_frames,
graphic_info[graphic].anim_delay,
@@
-2293,13
+2303,7
@@
static void DrawLevelFieldCrumbledExt(int x, int y, int graphic, int frame)
int sx = SCREENX(x), sy = SCREENY(y);
int element;
int i;
int sx = SCREENX(x), sy = SCREENY(y);
int element;
int i;
- static int xy[4][2] =
- {
- { 0, -1 },
- { -1, 0 },
- { +1, 0 },
- { 0, +1 }
- };
+ struct XY *xy = xy_topdown;
if (!IN_LEV_FIELD(x, y))
return;
if (!IN_LEV_FIELD(x, y))
return;
@@
-2314,8
+2318,8
@@
static void DrawLevelFieldCrumbledExt(int x, int y, int graphic, int frame)
// crumble field borders towards direct neighbour fields
for (i = 0; i < 4; i++)
{
// crumble field borders towards direct neighbour fields
for (i = 0; i < 4; i++)
{
- int xx = x + xy[i]
[0]
;
- int yy = y + xy[i]
[1]
;
+ int xx = x + xy[i]
.x
;
+ int yy = y + xy[i]
.y
;
element = (IN_LEV_FIELD(xx, yy) ? TILE_GFX_ELEMENT(xx, yy) :
BorderElement);
element = (IN_LEV_FIELD(xx, yy) ? TILE_GFX_ELEMENT(xx, yy) :
BorderElement);
@@
-2349,10
+2353,10
@@
static void DrawLevelFieldCrumbledExt(int x, int y, int graphic, int frame)
// crumble field borders of direct neighbour fields
for (i = 0; i < 4; i++)
{
// crumble field borders of direct neighbour fields
for (i = 0; i < 4; i++)
{
- int xx = x + xy[i]
[0]
;
- int yy = y + xy[i]
[1]
;
- int sxx = sx + xy[i]
[0]
;
- int syy = sy + xy[i]
[1]
;
+ int xx = x + xy[i]
.x
;
+ int yy = y + xy[i]
.y
;
+ int sxx = sx + xy[i]
.x
;
+ int syy = sy + xy[i]
.y
;
if (!IN_LEV_FIELD(xx, yy) ||
!IN_SCR_FIELD(sxx, syy))
if (!IN_LEV_FIELD(xx, yy) ||
!IN_SCR_FIELD(sxx, syy))
@@
-2445,22
+2449,16
@@
void DrawLevelFieldCrumbledDigging(int x, int y, int direction,
void DrawLevelFieldCrumbledNeighbours(int x, int y)
{
int sx = SCREENX(x), sy = SCREENY(y);
void DrawLevelFieldCrumbledNeighbours(int x, int y)
{
int sx = SCREENX(x), sy = SCREENY(y);
- static int xy[4][2] =
- {
- { 0, -1 },
- { -1, 0 },
- { +1, 0 },
- { 0, +1 }
- };
+ struct XY *xy = xy_topdown;
int i;
// crumble direct neighbour fields (required for field borders)
for (i = 0; i < 4; i++)
{
int i;
// crumble direct neighbour fields (required for field borders)
for (i = 0; i < 4; i++)
{
- int xx = x + xy[i]
[0]
;
- int yy = y + xy[i]
[1]
;
- int sxx = sx + xy[i]
[0]
;
- int syy = sy + xy[i]
[1]
;
+ int xx = x + xy[i]
.x
;
+ int yy = y + xy[i]
.y
;
+ int sxx = sx + xy[i]
.x
;
+ int syy = sy + xy[i]
.y
;
if (!IN_LEV_FIELD(xx, yy) ||
!IN_SCR_FIELD(sxx, syy) ||
if (!IN_LEV_FIELD(xx, yy) ||
!IN_SCR_FIELD(sxx, syy) ||
@@
-4607,7
+4605,7
@@
static int RequestHandleEvents(unsigned int req_state, int draw_buffer_game)
case EVENT_KEYPRESS:
{
case EVENT_KEYPRESS:
{
- Key key = GetEventKey((KeyEvent *)&event
, TRUE
);
+ Key key = GetEventKey((KeyEvent *)&event);
switch (key)
{
switch (key)
{
@@
-8790,6
+8788,8
@@
void SetGfxAnimation_EM(struct GraphicInfo_EM *g_em,
if (graphic_info[graphic].anim_global_sync)
sync_frame = FrameCounter;
if (graphic_info[graphic].anim_global_sync)
sync_frame = FrameCounter;
+ else if (graphic_info[graphic].anim_global_anim_sync)
+ sync_frame = getGlobalAnimSyncFrame();
else if (IN_FIELD(x, y, MAX_LEV_FIELDX, MAX_LEV_FIELDY))
sync_frame = GfxFrame[x][y];
else
else if (IN_FIELD(x, y, MAX_LEV_FIELDX, MAX_LEV_FIELDY))
sync_frame = GfxFrame[x][y];
else
@@
-8849,6
+8849,8
@@
void getGraphicSourceObjectExt_EM(struct GraphicInfo_EM *g_em,
if (graphic_info[graphic].anim_global_sync)
sync_frame = FrameCounter;
if (graphic_info[graphic].anim_global_sync)
sync_frame = FrameCounter;
+ else if (graphic_info[graphic].anim_global_anim_sync)
+ sync_frame = getGlobalAnimSyncFrame();
else if (IN_FIELD(x, y, MAX_LEV_FIELDX, MAX_LEV_FIELDY))
sync_frame = GfxFrame[x][y];
else
else if (IN_FIELD(x, y, MAX_LEV_FIELDX, MAX_LEV_FIELDY))
sync_frame = GfxFrame[x][y];
else
@@
-9312,7
+9314,7
@@
void InitGraphicInfo_EM(void)
}
}
}
}
-static void CheckSaveEngineSnapshot_EM(
byte action[MAX_PLAYERS],
int frame,
+static void CheckSaveEngineSnapshot_EM(int frame,
boolean any_player_moving,
boolean any_player_snapping,
boolean any_player_dropping)
boolean any_player_moving,
boolean any_player_snapping,
boolean any_player_dropping)
@@
-9369,7
+9371,7
@@
static void CheckSaveEngineSnapshot_MM(boolean element_clicked,
}
}
}
}
-boolean CheckSingleStepMode_EM(
byte action[MAX_PLAYERS],
int frame,
+boolean CheckSingleStepMode_EM(int frame,
boolean any_player_moving,
boolean any_player_snapping,
boolean any_player_dropping)
boolean any_player_moving,
boolean any_player_snapping,
boolean any_player_dropping)
@@
-9378,7
+9380,7
@@
boolean CheckSingleStepMode_EM(byte action[MAX_PLAYERS], int frame,
if (frame == 7 && !any_player_dropping && FrameCounter > 6)
TapeTogglePause(TAPE_TOGGLE_AUTOMATIC);
if (frame == 7 && !any_player_dropping && FrameCounter > 6)
TapeTogglePause(TAPE_TOGGLE_AUTOMATIC);
- CheckSaveEngineSnapshot_EM(
action,
frame, any_player_moving,
+ CheckSaveEngineSnapshot_EM(frame, any_player_moving,
any_player_snapping, any_player_dropping);
return tape.pausing;
any_player_snapping, any_player_dropping);
return tape.pausing;
@@
-9412,7
+9414,7
@@
void CheckSingleStepMode_MM(boolean element_clicked,
}
void getGraphicSource_SP(struct GraphicInfo_SP *g_sp,
}
void getGraphicSource_SP(struct GraphicInfo_SP *g_sp,
- int graphic, int sync_frame
, int x, int y
)
+ int graphic, int sync_frame)
{
int frame = getGraphicAnimationFrame(graphic, sync_frame);
{
int frame = getGraphicAnimationFrame(graphic, sync_frame);
@@
-9968,7
+9970,13
@@
void ChangeViewportPropertiesIfNeeded(void)
void OpenURL(char *url)
{
void OpenURL(char *url)
{
+#if SDL_VERSION_ATLEAST(2,0,14)
SDL_OpenURL(url);
SDL_OpenURL(url);
+#else
+ Warn("SDL_OpenURL(\"%s\") not supported by SDL %d.%d.%d!",
+ url, SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL);
+ Warn("Please upgrade to at least SDL 2.0.14 for URL support!");
+#endif
}
void OpenURLFromHash(SetupFileHash *hash, int hash_key)
}
void OpenURLFromHash(SetupFileHash *hash, int hash_key)