projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rnd-20030816-2-src
[rocksndiamonds.git]
/
src
/
tools.c
diff --git
a/src/tools.c
b/src/tools.c
index e7b996358e77ad7e6e1ab3b91fa42571753c36a1..9b5873b5cc3a920c636bb21ec8bab50e7b76fec6 100644
(file)
--- a/
src/tools.c
+++ b/
src/tools.c
@@
-34,6
+34,7
@@
/* forward declaration for internal use */
static void UnmapToolButtons();
static void HandleToolButtons(struct GadgetInfo *);
/* forward declaration for internal use */
static void UnmapToolButtons();
static void HandleToolButtons(struct GadgetInfo *);
+static int el_act_dir2crm(int, 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;
@@
-503,6
+504,9
@@
inline void DrawLevelGraphicAnimationIfNeeded(int x, int y, int graphic)
return;
DrawGraphicAnimation(sx, sy, graphic);
return;
DrawGraphicAnimation(sx, sy, graphic);
+
+ if (CAN_BE_CRUMBLED(Feld[x][y]))
+ DrawLevelFieldCrumbledSand(x, y);
}
void DrawLevelElementAnimationIfNeeded(int x, int y, int element)
}
void DrawLevelElementAnimationIfNeeded(int x, int y, int element)
@@
-519,6
+523,9
@@
void DrawLevelElementAnimationIfNeeded(int x, int y, int element)
return;
DrawGraphicAnimation(sx, sy, graphic);
return;
DrawGraphicAnimation(sx, sy, graphic);
+
+ if (CAN_BE_CRUMBLED(element))
+ DrawLevelFieldCrumbledSand(x, y);
}
void DrawAllPlayers()
}
void DrawAllPlayers()
@@
-658,8
+665,13
@@
void DrawPlayer(struct PlayerInfo *player)
{
if (player_is_moving && GfxElement[jx][jy] != EL_UNDEFINED)
{
{
if (player_is_moving && GfxElement[jx][jy] != EL_UNDEFINED)
{
+#if 1
+ if (CAN_BE_CRUMBLED(GfxElement[jx][jy]))
+ DrawLevelFieldCrumbledSandDigging(jx, jy, move_dir, player->StepFrame);
+#else
if (GfxElement[jx][jy] == EL_SAND)
DrawLevelFieldCrumbledSandDigging(jx, jy, move_dir, player->StepFrame);
if (GfxElement[jx][jy] == EL_SAND)
DrawLevelFieldCrumbledSandDigging(jx, jy, move_dir, player->StepFrame);
+#endif
else
{
int old_element = GfxElement[jx][jy];
else
{
int old_element = GfxElement[jx][jy];
@@
-1200,7
+1212,8
@@
static void DrawLevelFieldCrumbledSandExt(int x, int y, int graphic, int frame)
if (!IN_LEV_FIELD(x, y))
return;
if (!IN_LEV_FIELD(x, y))
return;
- element = (GfxElement[x][y] != EL_UNDEFINED ? GfxElement[x][y] : Feld[x][y]);
+ element = (GfxElement[x][y] != EL_UNDEFINED && Feld[x][y] != EL_EXPLOSION ?
+ GfxElement[x][y] : Feld[x][y]);
/* crumble field itself */
if (CAN_BE_CRUMBLED(element) && !IS_MOVING(x, y))
/* crumble field itself */
if (CAN_BE_CRUMBLED(element) && !IS_MOVING(x, y))
@@
-1221,6
+1234,13
@@
static void DrawLevelFieldCrumbledSandExt(int x, int y, int graphic, int frame)
if (CAN_BE_CRUMBLED(element) && !IS_MOVING(xx, yy))
continue;
if (CAN_BE_CRUMBLED(element) && !IS_MOVING(xx, yy))
continue;
+#if 0
+ if (Feld[x][y] == EL_CUSTOM_START + 123)
+ printf("::: crumble [%d] THE CHAOS ENGINE (%d, %d): %d, %d\n",
+ i, Feld[x][y], element,
+ CAN_BE_CRUMBLED(element), IS_MOVING(x, y));
+#endif
+
if (i == 1 || i == 2)
{
width = snip;
if (i == 1 || i == 2)
{
width = snip;
@@
-1290,8
+1310,13
@@
void DrawLevelFieldCrumbledSand(int x, int y)
void DrawLevelFieldCrumbledSandDigging(int x, int y, int direction,
int step_frame)
{
void DrawLevelFieldCrumbledSandDigging(int x, int y, int direction,
int step_frame)
{
+#if 1
+ int graphic1 = el_act_dir2img(GfxElement[x][y], ACTION_DIGGING, direction);
+ int graphic2 = el_act_dir2crm(GfxElement[x][y], ACTION_DIGGING, direction);
+#else
int graphic1 = el_act_dir2img(EL_SAND, ACTION_DIGGING, direction);
int graphic2 = el_act_dir2img(EL_SAND_CRUMBLED, ACTION_DIGGING, direction);
int graphic1 = el_act_dir2img(EL_SAND, ACTION_DIGGING, direction);
int graphic2 = el_act_dir2img(EL_SAND_CRUMBLED, ACTION_DIGGING, direction);
+#endif
int frame1 = getGraphicAnimationFrame(graphic1, step_frame);
int frame2 = getGraphicAnimationFrame(graphic2, step_frame);
int sx = SCREENX(x), sy = SCREENY(y);
int frame1 = getGraphicAnimationFrame(graphic1, step_frame);
int frame2 = getGraphicAnimationFrame(graphic2, step_frame);
int sx = SCREENX(x), sy = SCREENY(y);
@@
-1609,8
+1634,7
@@
static void DrawMicroLevelLabelExt(int mode)
if (strlen(label_text) > 0)
{
if (strlen(label_text) > 0)
{
- int text_width = strlen(label_text) * getFontWidth(font_nr);
- int lxpos = SX + (SXSIZE - text_width) / 2;
+ int lxpos = SX + (SXSIZE - getTextWidth(label_text, font_nr)) / 2;
int lypos = MICROLABEL_YPOS;
DrawText(lxpos, lypos, label_text, font_nr);
int lypos = MICROLABEL_YPOS;
DrawText(lxpos, lypos, label_text, font_nr);
@@
-1646,8
+1670,8
@@
void DrawMicroLevel(int xpos, int ypos, boolean restart)
if (leveldir_current->name)
{
if (leveldir_current->name)
{
- int
len = strlen(leveldir_current->name
);
- int lxpos = SX + (SXSIZE -
len * getFontWidth(FONT_TEXT_1)
) / 2;
+ int
text_width = getTextWidth(leveldir_current->name, FONT_TEXT_1
);
+ int lxpos = SX + (SXSIZE -
text_width
) / 2;
int lypos = SY + 352;
DrawText(lxpos, lypos, leveldir_current->name, FONT_TEXT_1);
int lypos = SY + 352;
DrawText(lxpos, lypos, leveldir_current->name, FONT_TEXT_1);
@@
-2438,6
+2462,14
@@
int el_act_dir2img(int element, int action, int direction)
return element_info[element].direction_graphic[action][direction];
}
return element_info[element].direction_graphic[action][direction];
}
+static int el_act_dir2crm(int element, int action, int direction)
+{
+ element = GFX_ELEMENT(element);
+ direction = MV_DIR_BIT(direction);
+
+ return element_info[element].direction_crumbled[action][direction];
+}
+
int el_act2img(int element, int action)
{
element = GFX_ELEMENT(element);
int el_act2img(int element, int action)
{
element = GFX_ELEMENT(element);