projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rnd-20030404-4-src
[rocksndiamonds.git]
/
src
/
game.c
diff --git
a/src/game.c
b/src/game.c
index 9dca25854cf41ca1b13b79267f3d8323b54acaf4..493bd5f671a1bd9b29b634069797bc779a2a1aa2 100644
(file)
--- a/
src/game.c
+++ b/
src/game.c
@@
-658,6
+658,8
@@
void InitGame()
player->is_moving = FALSE;
player->is_waiting = FALSE;
player->is_moving = FALSE;
player->is_waiting = FALSE;
+ player->is_digging = FALSE;
+ player->is_collecting = FALSE;
player->move_delay = game.initial_move_delay;
player->move_delay_value = game.initial_move_delay_value;
player->move_delay = game.initial_move_delay;
player->move_delay_value = game.initial_move_delay_value;
@@
-917,7
+919,7
@@
void InitGame()
else
{
DrawTextExt(drawto, DX + XX_EMERALDS, DY + YY_EMERALDS,
else
{
DrawTextExt(drawto, DX + XX_EMERALDS, DY + YY_EMERALDS,
- int2str(level_nr, 3), FONT_LEVEL_NUMBER,
FON
T_OPAQUE);
+ int2str(level_nr, 3), FONT_LEVEL_NUMBER,
BLI
T_OPAQUE);
BlitBitmap(drawto, drawto,
DX + XX_EMERALDS, DY + YY_EMERALDS + 1,
getFontWidth(FONT_LEVEL_NUMBER) * 3,
BlitBitmap(drawto, drawto,
DX + XX_EMERALDS, DY + YY_EMERALDS + 1,
getFontWidth(FONT_LEVEL_NUMBER) * 3,
@@
-941,11
+943,12
@@
void InitGame()
OpenDoor(DOOR_OPEN_ALL);
OpenDoor(DOOR_OPEN_ALL);
- PlaySoundStereo(SND_GAME_STARTING, SOUND_M
AX_RIGHT
);
+ PlaySoundStereo(SND_GAME_STARTING, SOUND_M
IDDLE
);
if (setup.sound_music)
PlayMusic(level_nr);
KeyboardAutoRepeatOff();
if (setup.sound_music)
PlayMusic(level_nr);
KeyboardAutoRepeatOff();
+ SetMouseCursor(CURSOR_PLAYFIELD);
if (options.debug)
{
if (options.debug)
{
@@
-1097,18
+1100,18
@@
void GameWon()
local_player->LevelSolved = FALSE;
local_player->LevelSolved = FALSE;
- PlaySoundStereo(SND_GAME_WINNING, SOUND_M
AX_RIGHT
);
+ PlaySoundStereo(SND_GAME_WINNING, SOUND_M
IDDLE
);
if (TimeLeft)
{
if (!tape.playing && setup.sound_loops)
if (TimeLeft)
{
if (!tape.playing && setup.sound_loops)
- PlaySoundExt(SND_GAME_LEVELTIME_BONUS, SOUND_MAX_VOLUME, SOUND_M
AX_RIGHT
,
+ PlaySoundExt(SND_GAME_LEVELTIME_BONUS, SOUND_MAX_VOLUME, SOUND_M
IDDLE
,
SND_CTRL_PLAY_LOOP);
while (TimeLeft > 0)
{
if (!tape.playing && !setup.sound_loops)
SND_CTRL_PLAY_LOOP);
while (TimeLeft > 0)
{
if (!tape.playing && !setup.sound_loops)
- PlaySoundStereo(SND_GAME_LEVELTIME_BONUS, SOUND_M
AX_RIGHT
);
+ PlaySoundStereo(SND_GAME_LEVELTIME_BONUS, SOUND_M
IDDLE
);
if (TimeLeft > 0 && !(TimeLeft % 10))
RaiseScore(level.score[SC_ZEITBONUS]);
if (TimeLeft > 100 && !(TimeLeft % 10))
if (TimeLeft > 0 && !(TimeLeft % 10))
RaiseScore(level.score[SC_ZEITBONUS]);
if (TimeLeft > 100 && !(TimeLeft % 10))
@@
-1128,13
+1131,13
@@
void GameWon()
else if (level.time == 0) /* level without time limit */
{
if (!tape.playing && setup.sound_loops)
else if (level.time == 0) /* level without time limit */
{
if (!tape.playing && setup.sound_loops)
- PlaySoundExt(SND_GAME_LEVELTIME_BONUS, SOUND_MAX_VOLUME, SOUND_M
AX_RIGHT
,
+ PlaySoundExt(SND_GAME_LEVELTIME_BONUS, SOUND_MAX_VOLUME, SOUND_M
IDDLE
,
SND_CTRL_PLAY_LOOP);
while (TimePlayed < 999)
{
if (!tape.playing && !setup.sound_loops)
SND_CTRL_PLAY_LOOP);
while (TimePlayed < 999)
{
if (!tape.playing && !setup.sound_loops)
- PlaySoundStereo(SND_GAME_LEVELTIME_BONUS, SOUND_M
AX_RIGHT
);
+ PlaySoundStereo(SND_GAME_LEVELTIME_BONUS, SOUND_M
IDDLE
);
if (TimePlayed < 999 && !(TimePlayed % 10))
RaiseScore(level.score[SC_ZEITBONUS]);
if (TimePlayed < 900 && !(TimePlayed % 10))
if (TimePlayed < 999 && !(TimePlayed % 10))
RaiseScore(level.score[SC_ZEITBONUS]);
if (TimePlayed < 900 && !(TimePlayed % 10))
@@
-1382,6
+1385,7
@@
static int MovingOrBlocked2ElementIfNotLeaving(int x, int y)
static void RemoveField(int x, int y)
{
Feld[x][y] = EL_EMPTY;
static void RemoveField(int x, int y)
{
Feld[x][y] = EL_EMPTY;
+ GfxElement[x][y] = EL_EMPTY;
MovPos[x][y] = 0;
MovDir[x][y] = 0;
MovDelay[x][y] = 0;
MovPos[x][y] = 0;
MovDir[x][y] = 0;
MovDelay[x][y] = 0;
@@
-1615,6
+1619,7
@@
void Explode(int ex, int ey, int phase, int mode)
}
Feld[x][y] = EL_EXPLOSION;
}
Feld[x][y] = EL_EXPLOSION;
+ GfxElement[x][y] = EL_EMPTY;
MovDir[x][y] = MovPos[x][y] = 0;
AmoebaNr[x][y] = 0;
ExplodePhase[x][y] = 1;
MovDir[x][y] = MovPos[x][y] = 0;
AmoebaNr[x][y] = 0;
ExplodePhase[x][y] = 1;
@@
-1686,7
+1691,7
@@
void Explode(int ex, int ey, int phase, int mode)
int frame = getGraphicAnimationFrame(graphic, phase - delay);
if (phase == delay)
int frame = getGraphicAnimationFrame(graphic, phase - delay);
if (phase == delay)
- Draw
CrumbledSand(SCREENX(x), SCREENY(y)
);
+ Draw
LevelFieldCrumbledSand(x, y
);
if (IS_PFORTE(Store[x][y]))
{
if (IS_PFORTE(Store[x][y]))
{
@@
-3141,7
+3146,7
@@
void StartMoving(int x, int y)
Feld[x][y] = EL_EMPTY;
DrawLevelField(x, y);
Feld[x][y] = EL_EMPTY;
DrawLevelField(x, y);
- PlaySoundLevel(newx, newy, SND_
CLASS_EXIT
_PASSING);
+ PlaySoundLevel(newx, newy, SND_
PENGUIN
_PASSING);
if (IN_SCR_FIELD(SCREENX(newx), SCREENY(newy)))
DrawGraphicThruMask(SCREENX(newx),SCREENY(newy), el2img(element), 0);
if (IN_SCR_FIELD(SCREENX(newx), SCREENY(newy)))
DrawGraphicThruMask(SCREENX(newx),SCREENY(newy), el2img(element), 0);
@@
-3395,7
+3400,7
@@
void ContinueMoving(int x, int y)
yy = y + xy[i][1];
if (IN_LEV_FIELD(xx, yy) && Feld[xx][yy] == EL_SAND)
yy = y + xy[i][1];
if (IN_LEV_FIELD(xx, yy) && Feld[xx][yy] == EL_SAND)
- DrawLevelField(xx, yy); /* for "
DrawCrumbledSand()
" */
+ DrawLevelField(xx, yy); /* for "
crumbled sand
" */
}
}
}
}
@@
-4380,7
+4385,7
@@
static void ChangeActiveTrap(int x, int y)
/* if new animation frame was drawn, correct crumbled sand border */
if (IS_NEW_FRAME(GfxFrame[x][y], graphic))
/* if new animation frame was drawn, correct crumbled sand border */
if (IS_NEW_FRAME(GfxFrame[x][y], graphic))
- Draw
CrumbledSand(SCREENX(x), SCREENY(y)
);
+ Draw
LevelFieldCrumbledSand(x, y
);
}
static void ChangeElement(int x, int y)
}
static void ChangeElement(int x, int y)
@@
-4879,7
+4884,7
@@
void GameActions()
TimeLeft--;
if (TimeLeft <= 10 && setup.time_limit)
TimeLeft--;
if (TimeLeft <= 10 && setup.time_limit)
- PlaySoundStereo(SND_GAME_RUNNING_OUT_OF_TIME, SOUND_M
AX_RIGHT
);
+ PlaySoundStereo(SND_GAME_RUNNING_OUT_OF_TIME, SOUND_M
IDDLE
);
DrawText(DX_TIME, DY_TIME, int2str(TimeLeft, 3), FONT_TEXT_2);
DrawText(DX_TIME, DY_TIME, int2str(TimeLeft, 3), FONT_TEXT_2);
@@
-5251,7
+5256,7
@@
boolean MoveFigure(struct PlayerInfo *player, int dx, int dy)
else if (old_jx == jx && old_jy != jy)
player->MovDir = (old_jy < jy ? MV_DOWN : MV_UP);
else if (old_jx == jx && old_jy != jy)
player->MovDir = (old_jy < jy ? MV_DOWN : MV_UP);
- DrawLevelField(jx, jy); /* for "
DrawCrumbledSand()
" */
+ DrawLevelField(jx, jy); /* for "
crumbled sand
" */
player->last_move_dir = player->MovDir;
player->is_moving = TRUE;
player->last_move_dir = player->MovDir;
player->is_moving = TRUE;
@@
-5664,7
+5669,10
@@
int DigField(struct PlayerInfo *player,
int element;
if (player->MovPos == 0)
int element;
if (player->MovPos == 0)
+ {
player->is_digging = FALSE;
player->is_digging = FALSE;
+ player->is_collecting = FALSE;
+ }
if (player->MovPos == 0)
player->Pushing = FALSE;
if (player->MovPos == 0)
player->Pushing = FALSE;
@@
-5721,11
+5729,14
@@
int DigField(struct PlayerInfo *player,
case EL_SP_BASE:
case EL_SP_BUGGY_BASE:
case EL_SP_BUGGY_BASE_ACTIVATING:
case EL_SP_BASE:
case EL_SP_BUGGY_BASE:
case EL_SP_BUGGY_BASE_ACTIVATING:
+ RemoveField(x, y);
#if 1
#if 1
- if (mode != DF_SNAP && element == EL_SAND)
- GfxElement[x][y] = Feld[x][y];
+ if (mode != DF_SNAP && element != EL_EMPTY)
+ {
+ GfxElement[x][y] = (CAN_BE_CRUMBLED(element) ? EL_SAND : element);
+ player->is_digging = TRUE;
+ }
#endif
#endif
- RemoveField(x, y);
PlaySoundLevelElementAction(x, y, element, ACTION_DIGGING);
break;
PlaySoundLevelElementAction(x, y, element, ACTION_DIGGING);
break;
@@
-5739,6
+5750,13
@@
int DigField(struct PlayerInfo *player,
case EL_PEARL:
case EL_CRYSTAL:
RemoveField(x, y);
case EL_PEARL:
case EL_CRYSTAL:
RemoveField(x, y);
+#if 1
+ if (mode != DF_SNAP)
+ {
+ GfxElement[x][y] = element;
+ player->is_collecting = TRUE;
+ }
+#endif
local_player->gems_still_needed -= (element == EL_DIAMOND ? 3 :
element == EL_PEARL ? 5 :
element == EL_CRYSTAL ? 8 : 1);
local_player->gems_still_needed -= (element == EL_DIAMOND ? 3 :
element == EL_PEARL ? 5 :
element == EL_CRYSTAL ? 8 : 1);
@@
-5768,7
+5786,7
@@
int DigField(struct PlayerInfo *player,
TimeLeft += 10;
DrawText(DX_TIME, DY_TIME, int2str(TimeLeft, 3), FONT_TEXT_2);
}
TimeLeft += 10;
DrawText(DX_TIME, DY_TIME, int2str(TimeLeft, 3), FONT_TEXT_2);
}
- PlaySoundStereo(SND_EXTRA_TIME_COLLECTING, SOUND_M
AX_RIGHT
);
+ PlaySoundStereo(SND_EXTRA_TIME_COLLECTING, SOUND_M
IDDLE
);
break;
case EL_SHIELD_NORMAL:
break;
case EL_SHIELD_NORMAL:
@@
-6202,7
+6220,7
@@
int DigField(struct PlayerInfo *player,
TimeLeft += 10;
DrawText(DX_TIME, DY_TIME, int2str(TimeLeft, 3), FONT_TEXT_2);
DrawLevelField(x, y);
TimeLeft += 10;
DrawText(DX_TIME, DY_TIME, int2str(TimeLeft, 3), FONT_TEXT_2);
DrawLevelField(x, y);
- PlaySoundStereo(SND_TIME_ORB_FULL_COLLECTING, SOUND_M
AX_RIGHT
);
+ PlaySoundStereo(SND_TIME_ORB_FULL_COLLECTING, SOUND_M
IDDLE
);
return MF_ACTION;
break;
return MF_ACTION;
break;
@@
-6368,8
+6386,8
@@
int DigField(struct PlayerInfo *player,
player->push_delay = 0;
player->push_delay = 0;
- if (Feld[x][y] != element) /* really digged something */
- player->is_
digging = TRUE
;
+ if (Feld[x][y] != element) /* really digged
/collected
something */
+ player->is_
collecting = !player->is_digging
;
return MF_MOVING;
}
return MF_MOVING;
}
@@
-6393,7
+6411,10
@@
boolean SnapField(struct PlayerInfo *player, int dx, int dy)
player->snapped = FALSE;
if (player->MovPos == 0)
player->snapped = FALSE;
if (player->MovPos == 0)
+ {
player->is_digging = FALSE;
player->is_digging = FALSE;
+ player->is_collecting = FALSE;
+ }
return FALSE;
}
return FALSE;
}
@@
-6411,6
+6432,8
@@
boolean SnapField(struct PlayerInfo *player, int dx, int dy)
player->snapped = TRUE;
player->is_digging = FALSE;
player->snapped = TRUE;
player->is_digging = FALSE;
+ player->is_collecting = FALSE;
+
DrawLevelField(x, y);
BackToFront();
DrawLevelField(x, y);
BackToFront();