#include "joystick.h"
#include "network.h"
+#ifdef DEBUG
+static unsigned int getStateCheckSum(int counter)
+{
+ int x, y;
+ unsigned int mult = 1;
+ unsigned int checksum = 0;
+ static short lastFeld[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+ static boolean first_game = TRUE;
+
+ for (y=0; y<lev_fieldy; y++) for(x=0; x<lev_fieldx; x++)
+ {
+ /*
+ if (counter == 3)
+ {
+ if (first_game)
+ lastFeld[x][y] = Feld[x][y];
+ else if (lastFeld[x][y] != Feld[x][y])
+ printf("DIFF: [%d][%d]: lastFeld == %d != %d == Feld\n",
+ x, y, lastFeld[x][y], Feld[x][y]);
+ }
+ */
+
+ checksum += mult++ * Ur[x][y];
+ checksum += mult++ * Feld[x][y];
+
+ /*
+ checksum += mult++ * MovPos[x][y];
+ checksum += mult++ * MovDir[x][y];
+ checksum += mult++ * MovDelay[x][y];
+ checksum += mult++ * Store[x][y];
+ checksum += mult++ * Store2[x][y];
+ checksum += mult++ * StorePlayer[x][y];
+ checksum += mult++ * Frame[x][y];
+ checksum += mult++ * AmoebaNr[x][y];
+ checksum += mult++ * JustHit[x][y];
+ checksum += mult++ * Stop[x][y];
+ */
+ }
+
+ if (counter == 3 && first_game)
+ first_game = FALSE;
+
+ return checksum;
+}
+#endif
+
void GetPlayerConfig()
{
if (sound_status == SOUND_OFF)
void InitGame()
{
- int i,j, x,y;
+ int i, j, x, y;
boolean emulate_bd = TRUE; /* unless non-BOULDERDASH elements found */
boolean emulate_sb = TRUE; /* unless non-SOKOBAN elements found */
/* don't play tapes over network */
network_playing = (options.network && !tape.playing);
- for(i=0; i<MAX_PLAYERS; i++)
+ for (i=0; i<MAX_PLAYERS; i++)
{
struct PlayerInfo *player = &stored_player[i];
player->lights_still_needed = 0;
player->friends_still_needed = 0;
- for(j=0; j<4; j++)
+ for (j=0; j<4; j++)
player->key[j] = FALSE;
player->dynamite = 0;
player->last_jx = player->last_jy = 0;
player->jx = player->jy = 0;
- DigField(player, 0,0,0,0,DF_NO_PUSH);
- SnapField(player, 0,0);
+ DigField(player, 0, 0, 0, 0, DF_NO_PUSH);
+ SnapField(player, 0, 0);
player->LevelSolved = FALSE;
player->GameOver = FALSE;
AllPlayersGone = SiebAktiv = FALSE;
- for(i=0;i<MAX_NUM_AMOEBA;i++)
+ for (i=0; i<MAX_NUM_AMOEBA; i++)
AmoebaCnt[i] = AmoebaCnt2[i] = 0;
- for(y=0;y<lev_fieldy;y++) for(x=0;x<lev_fieldx;x++)
+ for (x=0; x<lev_fieldx; x++)
{
- Feld[x][y] = Ur[x][y];
- MovPos[x][y] = MovDir[x][y] = MovDelay[x][y] = 0;
- Store[x][y] = Store2[x][y] = StorePlayer[x][y] = 0;
- Frame[x][y] = 0;
- AmoebaNr[x][y] = 0;
- JustHit[x][y] = 0;
+ for (y=0; y<lev_fieldy; y++)
+ {
+ Feld[x][y] = Ur[x][y];
+ MovPos[x][y] = MovDir[x][y] = MovDelay[x][y] = 0;
+ Store[x][y] = Store2[x][y] = StorePlayer[x][y] = 0;
+ Frame[x][y] = 0;
+ AmoebaNr[x][y] = 0;
+ JustHit[x][y] = 0;
+ Stop[x][y] = FALSE;
+ }
+ }
+ for(y=0; y<lev_fieldy; y++) for(x=0; x<lev_fieldx; x++)
+ {
if (emulate_bd && !IS_BD_ELEMENT(Feld[x][y]))
emulate_bd = FALSE;
if (emulate_sb && !IS_SB_ELEMENT(Feld[x][y]))
emulate_sb = FALSE;
- switch(Feld[x][y])
+ switch (Feld[x][y])
{
case EL_SPIELFIGUR:
Feld[x][y] = EL_SPIELER1;
break;
}
case EL_BADEWANNE:
- if (x<lev_fieldx-1 && Feld[x+1][y]==EL_SALZSAEURE)
+ if (x < lev_fieldx-1 && Feld[x+1][y] == EL_SALZSAEURE)
Feld[x][y] = EL_BADEWANNE1;
- else if (x>0 && Feld[x-1][y]==EL_SALZSAEURE)
+ else if (x > 0 && Feld[x-1][y] == EL_SALZSAEURE)
Feld[x][y] = EL_BADEWANNE2;
- else if (y>0 && Feld[x][y-1]==EL_BADEWANNE1)
+ else if (y > 0 && Feld[x][y-1] == EL_BADEWANNE1)
Feld[x][y] = EL_BADEWANNE3;
- else if (y>0 && Feld[x][y-1]==EL_SALZSAEURE)
+ else if (y > 0 && Feld[x][y-1] == EL_SALZSAEURE)
Feld[x][y] = EL_BADEWANNE4;
- else if (y>0 && Feld[x][y-1]==EL_BADEWANNE2)
+ else if (y > 0 && Feld[x][y-1] == EL_BADEWANNE2)
Feld[x][y] = EL_BADEWANNE5;
break;
case EL_KAEFER_R:
case EL_MAMPFER2:
case EL_ROBOT:
case EL_PACMAN:
- InitMovDir(x,y);
+ InitMovDir(x, y);
break;
case EL_AMOEBE_VOLL:
case EL_AMOEBE_BD:
- InitAmoebaNr(x,y);
+ InitAmoebaNr(x, y);
break;
case EL_TROPFEN:
- if (y==lev_fieldy-1)
+ if (y == lev_fieldy - 1)
{
Feld[x][y] = EL_AMOEBING;
Store[x][y] = EL_AMOEBE_NASS;
break;
case EL_SCHWEIN:
case EL_DRACHE:
- MovDir[x][y] = 1<<RND(4);
+ MovDir[x][y] = 1 << RND(4);
break;
default:
break;
}
/* check if any connected player was not found in playfield */
- for(i=0; i<MAX_PLAYERS; i++)
+ for (i=0; i<MAX_PLAYERS; i++)
{
struct PlayerInfo *player = &stored_player[i];
if (player->connected && !player->present)
{
- for(j=0; j<MAX_PLAYERS; j++)
+ for (j=0; j<MAX_PLAYERS; j++)
{
struct PlayerInfo *some_player = &stored_player[j];
int jx = some_player->jx, jy = some_player->jy;
/* when in single player mode, eliminate all but the first active player */
if (!options.network && !setup.team_mode)
{
- for(i=0; i<MAX_PLAYERS; i++)
+ for (i=0; i<MAX_PLAYERS; i++)
{
if (stored_player[i].active)
{
- for(j=i+1; j<MAX_PLAYERS; j++)
+ for (j=i+1; j<MAX_PLAYERS; j++)
{
struct PlayerInfo *player = &stored_player[j];
int jx = player->jx, jy = player->jy;
}
}
- for(i=0; i<MAX_PLAYERS; i++)
+ for (i=0; i<MAX_PLAYERS; i++)
{
struct PlayerInfo *player = &stored_player[i];
DrawAllPlayers();
FadeToFront();
- XCopyArea(display,pix[PIX_DOOR],pix[PIX_DB_DOOR],gc,
- DOOR_GFX_PAGEX5,DOOR_GFX_PAGEY1, DXSIZE,DYSIZE,
- DOOR_GFX_PAGEX1,DOOR_GFX_PAGEY1);
- DrawTextExt(pix[PIX_DB_DOOR],gc,
- DOOR_GFX_PAGEX1+XX_LEVEL,DOOR_GFX_PAGEY1+YY_LEVEL,
- int2str(level_nr,2),FS_SMALL,FC_YELLOW);
- DrawTextExt(pix[PIX_DB_DOOR],gc,
- DOOR_GFX_PAGEX1+XX_EMERALDS,DOOR_GFX_PAGEY1+YY_EMERALDS,
- int2str(local_player->gems_still_needed,3),FS_SMALL,FC_YELLOW);
- DrawTextExt(pix[PIX_DB_DOOR],gc,
- DOOR_GFX_PAGEX1+XX_DYNAMITE,DOOR_GFX_PAGEY1+YY_DYNAMITE,
- int2str(local_player->dynamite,3),FS_SMALL,FC_YELLOW);
- DrawTextExt(pix[PIX_DB_DOOR],gc,
- DOOR_GFX_PAGEX1+XX_SCORE,DOOR_GFX_PAGEY1+YY_SCORE,
- int2str(local_player->score,5),FS_SMALL,FC_YELLOW);
- DrawTextExt(pix[PIX_DB_DOOR],gc,
- DOOR_GFX_PAGEX1+XX_TIME,DOOR_GFX_PAGEY1+YY_TIME,
- int2str(TimeLeft,3),FS_SMALL,FC_YELLOW);
+ XCopyArea(display, pix[PIX_DOOR], pix[PIX_DB_DOOR], gc,
+ DOOR_GFX_PAGEX5, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE,
+ DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1);
+ DrawTextExt(pix[PIX_DB_DOOR], gc,
+ DOOR_GFX_PAGEX1 + XX_LEVEL, DOOR_GFX_PAGEY1 + YY_LEVEL,
+ int2str(level_nr, 2), FS_SMALL, FC_YELLOW);
+ DrawTextExt(pix[PIX_DB_DOOR], gc,
+ DOOR_GFX_PAGEX1 + XX_EMERALDS, DOOR_GFX_PAGEY1 + YY_EMERALDS,
+ int2str(local_player->gems_still_needed,3), FS_SMALL, FC_YELLOW);
+ DrawTextExt(pix[PIX_DB_DOOR], gc,
+ DOOR_GFX_PAGEX1 + XX_DYNAMITE, DOOR_GFX_PAGEY1 + YY_DYNAMITE,
+ int2str(local_player->dynamite, 3), FS_SMALL, FC_YELLOW);
+ DrawTextExt(pix[PIX_DB_DOOR], gc,
+ DOOR_GFX_PAGEX1 + XX_SCORE, DOOR_GFX_PAGEY1 + YY_SCORE,
+ int2str(local_player->score, 5), FS_SMALL, FC_YELLOW);
+ DrawTextExt(pix[PIX_DB_DOOR], gc,
+ DOOR_GFX_PAGEX1 + XX_TIME, DOOR_GFX_PAGEY1 + YY_TIME,
+ int2str(TimeLeft, 3), FS_SMALL, FC_YELLOW);
DrawGameButton(BUTTON_GAME_STOP);
DrawGameButton(BUTTON_GAME_PAUSE);
DrawGameButton(BUTTON_GAME_PLAY);
- DrawSoundDisplay(BUTTON_SOUND_MUSIC | (BUTTON_ON * setup.sound_music));
- DrawSoundDisplay(BUTTON_SOUND_LOOPS | (BUTTON_ON * setup.sound_loops));
- DrawSoundDisplay(BUTTON_SOUND_SIMPLE | (BUTTON_ON * setup.sound_simple));
- XCopyArea(display,drawto,pix[PIX_DB_DOOR],gc,
- DX+GAME_CONTROL_XPOS,DY+GAME_CONTROL_YPOS,
- GAME_CONTROL_XSIZE,2*GAME_CONTROL_YSIZE,
- DOOR_GFX_PAGEX1+GAME_CONTROL_XPOS,
- DOOR_GFX_PAGEY1+GAME_CONTROL_YPOS);
+ DrawSoundDisplay(BUTTON_SOUND_MUSIC | (setup.sound_music ? BUTTON_ON : 0));
+ DrawSoundDisplay(BUTTON_SOUND_LOOPS | (setup.sound_loops ? BUTTON_ON : 0));
+ DrawSoundDisplay(BUTTON_SOUND_SIMPLE | (setup.sound_simple ? BUTTON_ON : 0));
+ XCopyArea(display, drawto, pix[PIX_DB_DOOR], gc,
+ DX + GAME_CONTROL_XPOS, DY + GAME_CONTROL_YPOS,
+ GAME_CONTROL_XSIZE, 2 * GAME_CONTROL_YSIZE,
+ DOOR_GFX_PAGEX1 + GAME_CONTROL_XPOS,
+ DOOR_GFX_PAGEY1 + GAME_CONTROL_YPOS);
OpenDoor(DOOR_OPEN_1);
XAutoRepeatOff(display);
- for (i=0;i<4;i++)
+ for (i=0; i<4; i++)
printf("Spieler %d %saktiv.\n",
i+1, (stored_player[i].active ? "" : "nicht "));
int i, element = Feld[x][y];
static int xy[4][2] =
{
- { 0,+1 },
- { +1,0 },
- { 0,-1 },
- { -1,0 }
+ { 0, +1 },
+ { +1, 0 },
+ { 0, -1 },
+ { -1, 0 }
};
static int direction[2][4] =
{
case EL_KAEFER_L:
case EL_KAEFER_U:
Feld[x][y] = EL_KAEFER;
- MovDir[x][y] = direction[0][element-EL_KAEFER_R];
+ MovDir[x][y] = direction[0][element - EL_KAEFER_R];
break;
case EL_FLIEGER_R:
case EL_FLIEGER_O:
case EL_FLIEGER_L:
case EL_FLIEGER_U:
Feld[x][y] = EL_FLIEGER;
- MovDir[x][y] = direction[0][element-EL_FLIEGER_R];
+ MovDir[x][y] = direction[0][element - EL_FLIEGER_R];
break;
case EL_BUTTERFLY_R:
case EL_BUTTERFLY_O:
case EL_BUTTERFLY_L:
case EL_BUTTERFLY_U:
Feld[x][y] = EL_BUTTERFLY;
- MovDir[x][y] = direction[0][element-EL_BUTTERFLY_R];
+ MovDir[x][y] = direction[0][element - EL_BUTTERFLY_R];
break;
case EL_FIREFLY_R:
case EL_FIREFLY_O:
case EL_FIREFLY_L:
case EL_FIREFLY_U:
Feld[x][y] = EL_FIREFLY;
- MovDir[x][y] = direction[0][element-EL_FIREFLY_R];
+ MovDir[x][y] = direction[0][element - EL_FIREFLY_R];
break;
case EL_PACMAN_R:
case EL_PACMAN_O:
case EL_PACMAN_L:
case EL_PACMAN_U:
Feld[x][y] = EL_PACMAN;
- MovDir[x][y] = direction[0][element-EL_PACMAN_R];
+ MovDir[x][y] = direction[0][element - EL_PACMAN_R];
break;
default:
- MovDir[x][y] = 1<<RND(4);
+ MovDir[x][y] = 1 << RND(4);
if (element != EL_KAEFER &&
element != EL_FLIEGER &&
element != EL_BUTTERFLY &&
element != EL_FIREFLY)
break;
- for(i=0;i<4;i++)
+ for (i=0; i<4; i++)
{
- int x1,y1;
-
- x1 = x+xy[i][0];
- y1 = y+xy[i][1];
+ int x1 = x + xy[i][0];
+ int y1 = y + xy[i][1];
- if (!IN_LEV_FIELD(x1,y1) || !IS_FREE(x1,y1))
+ if (!IN_LEV_FIELD(x1, y1) || !IS_FREE(x1, y1))
{
- if (element==EL_KAEFER || element==EL_BUTTERFLY)
+ if (element == EL_KAEFER || element == EL_BUTTERFLY)
{
MovDir[x][y] = direction[0][i];
break;
}
- else if (element==EL_FLIEGER || element==EL_FIREFLY)
+ else if (element == EL_FLIEGER || element == EL_FIREFLY)
{
MovDir[x][y] = direction[1][i];
break;
void InitAmoebaNr(int x, int y)
{
int i;
- int group_nr = AmoebeNachbarNr(x,y);
+ int group_nr = AmoebeNachbarNr(x, y);
- if (group_nr==0)
+ if (group_nr == 0)
{
- for(i=1;i<MAX_NUM_AMOEBA;i++)
+ for (i=1; i<MAX_NUM_AMOEBA; i++)
{
- if (AmoebaCnt[i]==0)
+ if (AmoebaCnt[i] == 0)
{
group_nr = i;
break;
TimeLeft -= 10;
else
TimeLeft--;
- DrawText(DX_TIME, DY_TIME, int2str(TimeLeft,3), FS_SMALL, FC_YELLOW);
+ DrawText(DX_TIME, DY_TIME, int2str(TimeLeft, 3), FS_SMALL, FC_YELLOW);
BackToFront();
Delay(10);
}
SaveTape(tape.level_nr); /* Ask to save tape */
}
- if ((hi_pos=NewHiScore()) >= 0)
+ if ((hi_pos = NewHiScore()) >= 0)
{
game_status = HALLOFFAME;
DrawHallOfFame(hi_pos);
boolean NewHiScore()
{
- int k,l;
+ int k, l;
int position = -1;
LoadScore(level_nr);
if (!strcmp(setup.player_name, EMPTY_ALIAS) ||
local_player->score < highscore[MAX_SCORE_ENTRIES-1].Score)
- return(-1);
+ return -1;
- for(k=0;k<MAX_SCORE_ENTRIES;k++)
+ for (k=0; k<MAX_SCORE_ENTRIES; k++)
{
if (local_player->score > highscore[k].Score)
{
/* Spieler kommt in Highscore-Liste */
- if (k<MAX_SCORE_ENTRIES-1)
+ if (k < MAX_SCORE_ENTRIES - 1)
{
- int m = MAX_SCORE_ENTRIES-1;
+ int m = MAX_SCORE_ENTRIES - 1;
#ifdef ONE_PER_NAME
- for(l=k;l<MAX_SCORE_ENTRIES;l++)
+ for (l=k; l<MAX_SCORE_ENTRIES; l++)
if (!strcmp(setup.player_name, highscore[l].Name))
m = l;
- if (m==k) /* Spieler überschreibt seine alte Position */
+ if (m == k) /* Spieler überschreibt seine alte Position */
goto put_into_list;
#endif
- for(l=m;l>k;l--)
+ for (l=m; l>k; l--)
{
- strcpy(highscore[l].Name,highscore[l-1].Name);
- highscore[l].Score = highscore[l-1].Score;
+ strcpy(highscore[l].Name, highscore[l - 1].Name);
+ highscore[l].Score = highscore[l - 1].Score;
}
}
}
- if (position>=0)
+ if (position >= 0)
SaveScore(level_nr);
- return(position);
+ return position;
}
void InitMovingField(int x, int y, int direction)
{
- int newx = x + (direction==MV_LEFT ? -1 : direction==MV_RIGHT ? +1 : 0);
- int newy = y + (direction==MV_UP ? -1 : direction==MV_DOWN ? +1 : 0);
+ int newx = x + (direction == MV_LEFT ? -1 : direction == MV_RIGHT ? +1 : 0);
+ int newy = y + (direction == MV_UP ? -1 : direction == MV_DOWN ? +1 : 0);
MovDir[x][y] = direction;
MovDir[newx][newy] = direction;
void Moving2Blocked(int x, int y, int *goes_to_x, int *goes_to_y)
{
int direction = MovDir[x][y];
- int newx = x + (direction==MV_LEFT ? -1 : direction==MV_RIGHT ? +1 : 0);
- int newy = y + (direction==MV_UP ? -1 : direction==MV_DOWN ? +1 : 0);
+ int newx = x + (direction == MV_LEFT ? -1 : direction == MV_RIGHT ? +1 : 0);
+ int newy = y + (direction == MV_UP ? -1 : direction == MV_DOWN ? +1 : 0);
*goes_to_x = newx;
*goes_to_y = newy;
int oldx = x, oldy = y;
int direction = MovDir[x][y];
- if (direction==MV_LEFT)
+ if (direction == MV_LEFT)
oldx++;
- else if (direction==MV_RIGHT)
+ else if (direction == MV_RIGHT)
oldx--;
- else if (direction==MV_UP)
+ else if (direction == MV_UP)
oldy++;
- else if (direction==MV_DOWN)
+ else if (direction == MV_DOWN)
oldy--;
*comes_from_x = oldx;
{
int element = Feld[x][y];
- if (element==EL_BLOCKED)
+ if (element == EL_BLOCKED)
{
- int oldx,oldy;
+ int oldx, oldy;
- Blocked2Moving(x,y,&oldx,&oldy);
- return(Feld[oldx][oldy]);
+ Blocked2Moving(x, y, &oldx, &oldy);
+ return Feld[oldx][oldy];
}
else
- return(element);
+ return element;
}
static void RemoveField(int x, int y)
void RemoveMovingField(int x, int y)
{
- int oldx = x,oldy = y, newx = x,newy = y;
+ int oldx = x, oldy = y, newx = x, newy = y;
- if (Feld[x][y] != EL_BLOCKED && !IS_MOVING(x,y))
+ if (Feld[x][y] != EL_BLOCKED && !IS_MOVING(x, y))
return;
- if (IS_MOVING(x,y))
+ if (IS_MOVING(x, y))
{
- Moving2Blocked(x,y,&newx,&newy);
+ Moving2Blocked(x, y, &newx, &newy);
if (Feld[newx][newy] != EL_BLOCKED)
return;
}
- else if (Feld[x][y]==EL_BLOCKED)
+ else if (Feld[x][y] == EL_BLOCKED)
{
- Blocked2Moving(x,y,&oldx,&oldy);
- if (!IS_MOVING(oldx,oldy))
+ Blocked2Moving(x, y, &oldx, &oldy);
+ if (!IS_MOVING(oldx, oldy))
return;
}
- if (Feld[x][y]==EL_BLOCKED &&
- (Store[oldx][oldy]==EL_MORAST_LEER ||
- Store[oldx][oldy]==EL_SIEB_LEER ||
- Store[oldx][oldy]==EL_SIEB2_LEER ||
- Store[oldx][oldy]==EL_AMOEBE_NASS))
+ if (Feld[x][y] == EL_BLOCKED &&
+ (Store[oldx][oldy] == EL_MORAST_LEER ||
+ Store[oldx][oldy] == EL_SIEB_LEER ||
+ Store[oldx][oldy] == EL_SIEB2_LEER ||
+ Store[oldx][oldy] == EL_AMOEBE_NASS))
{
Feld[oldx][oldy] = Store[oldx][oldy];
Store[oldx][oldy] = Store2[oldx][oldy] = 0;
MovPos[oldx][oldy] = MovDir[oldx][oldy] = MovDelay[oldx][oldy] = 0;
MovPos[newx][newy] = MovDir[newx][newy] = MovDelay[newx][newy] = 0;
- DrawLevelField(oldx,oldy);
- DrawLevelField(newx,newy);
+ DrawLevelField(oldx, oldy);
+ DrawLevelField(newx, newy);
}
void DrawDynamite(int x, int y)
int graphic = el2gfx(Feld[x][y]);
int phase;
- if (!IN_SCR_FIELD(sx,sy) || IS_PLAYER(x,y))
+ if (!IN_SCR_FIELD(sx, sy) || IS_PLAYER(x, y))
return;
if (Store[x][y])
- DrawGraphic(sx,sy, el2gfx(Store[x][y]));
+ DrawGraphic(sx, sy, el2gfx(Store[x][y]));
- if (Feld[x][y]==EL_DYNAMIT)
+ if (Feld[x][y] == EL_DYNAMIT)
{
- if ((phase = (96-MovDelay[x][y])/12) > 6)
+ if ((phase = (96 - MovDelay[x][y]) / 12) > 6)
phase = 6;
}
else
{
- if ((phase = ((96-MovDelay[x][y])/6) % 8) > 3)
- phase = 7-phase;
+ if ((phase = ((96 - MovDelay[x][y]) / 6) % 8) > 3)
+ phase = 7 - phase;
}
if (Store[x][y])
- DrawGraphicThruMask(sx,sy, graphic + phase);
+ DrawGraphicThruMask(sx, sy, graphic + phase);
else
- DrawGraphic(sx,sy, graphic + phase);
+ DrawGraphic(sx, sy, graphic + phase);
}
void CheckDynamite(int x, int y)
if (MovDelay[x][y])
{
if (!(MovDelay[x][y] % 12))
- PlaySoundLevel(x,y,SND_ZISCH);
+ PlaySoundLevel(x, y, SND_ZISCH);
- if (Feld[x][y]==EL_DYNAMIT && !(MovDelay[x][y] % 12))
- DrawDynamite(x,y);
- else if (Feld[x][y]==EL_DYNABOMB && !(MovDelay[x][y] % 6))
- DrawDynamite(x,y);
+ if (Feld[x][y] == EL_DYNAMIT && !(MovDelay[x][y] % 12))
+ DrawDynamite(x, y);
+ else if (Feld[x][y] == EL_DYNABOMB && !(MovDelay[x][y] % 6))
+ DrawDynamite(x, y);
return;
}
}
StopSound(SND_ZISCH);
- Bang(x,y);
+ Bang(x, y);
}
void Explode(int ex, int ey, int phase, int mode)
{
- int x,y;
+ int x, y;
int num_phase = 9, delay = 2;
- int last_phase = num_phase*delay;
- int half_phase = (num_phase/2)*delay;
+ int last_phase = num_phase * delay;
+ int half_phase = (num_phase / 2) * delay;
- if (phase==0) /* Feld 'Store' initialisieren */
+ if (phase == 0) /* Feld 'Store' initialisieren */
{
int center_element = Feld[ex][ey];
- if (IS_MOVING(ex,ey) || IS_BLOCKED(ex,ey))
+ if (IS_MOVING(ex, ey) || IS_BLOCKED(ex, ey))
{
- center_element = MovingOrBlocked2Element(ex,ey);
- RemoveMovingField(ex,ey);
+ center_element = MovingOrBlocked2Element(ex, ey);
+ RemoveMovingField(ex, ey);
}
- for(y=ey-1;y<ey+2;y++) for(x=ex-1;x<ex+2;x++)
+ for (y=ey-1; y<ey+2; y++) for(x=ex-1; x<ex+2; x++)
{
int element = Feld[x][y];
- if (IS_MOVING(x,y) || IS_BLOCKED(x,y))
+ if (IS_MOVING(x, y) || IS_BLOCKED(x, y))
{
- element = MovingOrBlocked2Element(x,y);
- RemoveMovingField(x,y);
+ element = MovingOrBlocked2Element(x, y);
+ RemoveMovingField(x, y);
}
- if (!IN_LEV_FIELD(x,y) || IS_MASSIV(element) || element==EL_BURNING)
+ if (!IN_LEV_FIELD(x, y) || IS_MASSIV(element) || element == EL_BURNING)
continue;
- if ((mode!=EX_NORMAL || center_element==EL_AMOEBA2DIAM) &&
+ if ((mode!=EX_NORMAL || center_element == EL_AMOEBA2DIAM) &&
(x!=ex || y!=ey))
continue;
- if (element==EL_EXPLODING)
+ if (element == EL_EXPLODING)
element = Store2[x][y];
- if (IS_PLAYER(ex,ey))
+ if (IS_PLAYER(ex, ey))
{
switch(StorePlayer[ex][ey])
{
break;
}
}
- else if (center_element==EL_MAULWURF)
+ else if (center_element == EL_MAULWURF)
Store[x][y] = EL_EDELSTEIN_ROT;
- else if (center_element==EL_PINGUIN)
+ else if (center_element == EL_PINGUIN)
Store[x][y] = EL_EDELSTEIN_LILA;
- else if (center_element==EL_KAEFER)
- Store[x][y] = ((x==ex && y==ey) ? EL_DIAMANT : EL_EDELSTEIN);
- else if (center_element==EL_BUTTERFLY)
+ else if (center_element == EL_KAEFER)
+ Store[x][y] = ((x == ex && y == ey) ? EL_DIAMANT : EL_EDELSTEIN);
+ else if (center_element == EL_BUTTERFLY)
Store[x][y] = EL_EDELSTEIN_BD;
- else if (center_element==EL_MAMPFER)
+ else if (center_element == EL_MAMPFER)
Store[x][y] = level.mampfer_inhalt[MampferNr][x-ex+1][y-ey+1];
- else if (center_element==EL_AMOEBA2DIAM)
+ else if (center_element == EL_AMOEBA2DIAM)
Store[x][y] = level.amoebe_inhalt;
- else if (element==EL_ERZ_EDEL)
+ else if (element == EL_ERZ_EDEL)
Store[x][y] = EL_EDELSTEIN;
- else if (element==EL_ERZ_DIAM)
+ else if (element == EL_ERZ_DIAM)
Store[x][y] = EL_DIAMANT;
- else if (element==EL_ERZ_EDEL_BD)
+ else if (element == EL_ERZ_EDEL_BD)
Store[x][y] = EL_EDELSTEIN_BD;
- else if (element==EL_ERZ_EDEL_GELB)
+ else if (element == EL_ERZ_EDEL_GELB)
Store[x][y] = EL_EDELSTEIN_GELB;
- else if (element==EL_ERZ_EDEL_ROT)
+ else if (element == EL_ERZ_EDEL_ROT)
Store[x][y] = EL_EDELSTEIN_ROT;
- else if (element==EL_ERZ_EDEL_LILA)
+ else if (element == EL_ERZ_EDEL_LILA)
Store[x][y] = EL_EDELSTEIN_LILA;
else if (!IS_PFORTE(Store[x][y]))
Store[x][y] = EL_LEERRAUM;
- if (x!=ex || y!=ey || center_element==EL_AMOEBA2DIAM || mode==EX_BORDER)
+ if (x != ex || y != ey ||
+ center_element == EL_AMOEBA2DIAM || mode == EX_BORDER)
Store2[x][y] = element;
if (AmoebaNr[x][y] &&
- (element==EL_AMOEBE_VOLL ||
- element==EL_AMOEBE_BD ||
- element==EL_AMOEBING))
+ (element == EL_AMOEBE_VOLL ||
+ element == EL_AMOEBE_BD ||
+ element == EL_AMOEBING))
{
AmoebaCnt[AmoebaNr[x][y]]--;
AmoebaCnt2[AmoebaNr[x][y]]--;
Stop[x][y] = TRUE;
}
- if (center_element==EL_MAMPFER)
+ if (center_element == EL_MAMPFER)
MampferNr = (MampferNr+1) % 4;
return;
Frame[x][y] = (phase<last_phase ? phase+1 : 0);
- if (phase==half_phase)
+ if (phase == half_phase)
{
int element = Store2[x][y];
- if (IS_PLAYER(x,y))
- KillHero(PLAYERINFO(x,y));
+ if (IS_PLAYER(x, y))
+ KillHero(PLAYERINFO(x, y));
else if (IS_EXPLOSIVE(element))
{
Feld[x][y] = Store2[x][y];
Store2[x][y] = 0;
- Bang(x,y);
+ Bang(x, y);
}
- else if (element==EL_AMOEBA2DIAM)
- AmoebeUmwandeln(x,y);
+ else if (element == EL_AMOEBA2DIAM)
+ AmoebeUmwandeln(x, y);
}
- if (phase==last_phase)
+ if (phase == last_phase)
{
int element;
Store[x][y] = Store2[x][y] = 0;
MovDir[x][y] = MovPos[x][y] = MovDelay[x][y] = 0;
if (CAN_MOVE(element) || COULD_MOVE(element))
- InitMovDir(x,y);
- DrawLevelField(x,y);
+ InitMovDir(x, y);
+ DrawLevelField(x, y);
}
- else if (!(phase%delay) && IN_SCR_FIELD(SCREENX(x),SCREENY(y)))
+ else if (!(phase%delay) && IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
{
- if (phase==delay)
- ErdreichAnbroeckeln(SCREENX(x),SCREENY(y));
+ if (phase == delay)
+ ErdreichAnbroeckeln(SCREENX(x), SCREENY(y));
- DrawGraphic(SCREENX(x),SCREENY(y),GFX_EXPLOSION+(phase/delay-1));
+ DrawGraphic(SCREENX(x), SCREENY(y), GFX_EXPLOSION+(phase/delay-1));
}
}
void DynaExplode(int ex, int ey)
{
- int i,j;
+ int i, j;
struct PlayerInfo *player = &stored_player[Store2[ex][ey] - EL_SPIELER1];
static int xy[4][2] =
{
- { 0,-1 },
- { -1,0 },
- { +1,0 },
- { 0,+1 }
+ { 0, -1 },
+ { -1, 0 },
+ { +1, 0 },
+ { 0, +1 }
};
Store2[ex][ey] = 0; /* delete player information */
- Explode(ex,ey,0,EX_CENTER);
+ Explode(ex, ey, 0, EX_CENTER);
- for(i=0;i<4;i++)
+ for (i=0; i<4; i++)
{
- for(j=1; j<=player->dynabomb_size; j++)
+ for (j=1; j<=player->dynabomb_size; j++)
{
int x = ex+j*xy[i%4][0];
int y = ey+j*xy[i%4][1];
int element;
- if (!IN_LEV_FIELD(x,y) || IS_MASSIV(Feld[x][y]))
+ if (!IN_LEV_FIELD(x, y) || IS_MASSIV(Feld[x][y]))
break;
element = Feld[x][y];
- Explode(x,y,0,EX_BORDER);
+ Explode(x, y, 0, EX_BORDER);
if (element != EL_LEERRAUM &&
element != EL_ERDREICH &&
{
int element = Feld[x][y];
- PlaySoundLevel(x,y,SND_ROAAAR);
+ PlaySoundLevel(x, y, SND_ROAAAR);
switch(element)
{
case EL_ROBOT:
case EL_PACMAN:
RaiseScoreElement(element);
- Explode(x,y,0,EX_NORMAL);
+ Explode(x, y, 0, EX_NORMAL);
break;
case EL_DYNABOMB:
case EL_DYNABOMB_NR:
case EL_DYNABOMB_SZ:
case EL_DYNABOMB_XL:
- DynaExplode(x,y);
+ DynaExplode(x, y);
break;
case EL_BIRNE_AUS:
case EL_BIRNE_EIN:
- Explode(x,y,0,EX_CENTER);
+ Explode(x, y, 0, EX_CENTER);
break;
default:
- Explode(x,y,0,EX_NORMAL);
+ Explode(x, y, 0, EX_NORMAL);
break;
}
}
if (element!=EL_BLURB_LEFT && element!=EL_BLURB_RIGHT) /* Anfang */
{
- PlaySoundLevel(x,y,SND_BLURB);
- if (IN_LEV_FIELD(x-1,y) && IS_FREE(x-1,y) &&
- (!IN_LEV_FIELD(x-1,y-1) ||
- !CAN_FALL(MovingOrBlocked2Element(x-1,y-1))))
+ PlaySoundLevel(x, y, SND_BLURB);
+ if (IN_LEV_FIELD(x-1, y) && IS_FREE(x-1, y) &&
+ (!IN_LEV_FIELD(x-1, y-1) ||
+ !CAN_FALL(MovingOrBlocked2Element(x-1, y-1))))
{
Feld[x-1][y] = EL_BLURB_LEFT;
}
- if (IN_LEV_FIELD(x+1,y) && IS_FREE(x+1,y) &&
- (!IN_LEV_FIELD(x+1,y-1) ||
- !CAN_FALL(MovingOrBlocked2Element(x+1,y-1))))
+ if (IN_LEV_FIELD(x+1, y) && IS_FREE(x+1, y) &&
+ (!IN_LEV_FIELD(x+1, y-1) ||
+ !CAN_FALL(MovingOrBlocked2Element(x+1, y-1))))
{
Feld[x+1][y] = EL_BLURB_RIGHT;
}
if (MovDelay[x][y]) /* neue Phase / in Wartezustand */
{
MovDelay[x][y]--;
- if (MovDelay[x][y]/2 && IN_SCR_FIELD(SCREENX(x),SCREENY(y)))
- DrawGraphic(SCREENX(x),SCREENY(y),graphic+4-MovDelay[x][y]/2);
+ if (MovDelay[x][y]/2 && IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
+ DrawGraphic(SCREENX(x), SCREENY(y), graphic+4-MovDelay[x][y]/2);
if (!MovDelay[x][y])
{
Feld[x][y] = EL_LEERRAUM;
- DrawLevelField(x,y);
+ DrawLevelField(x, y);
}
}
}
void Impact(int x, int y)
{
- boolean lastline = (y==lev_fieldy-1);
+ boolean lastline = (y == lev_fieldy-1);
boolean object_hit = FALSE;
int element = Feld[x][y];
int smashed = 0;
if (Feld[x][y+1] == EL_PLAYER_IS_LEAVING)
return;
- object_hit = (!IS_FREE(x,y+1) && (!IS_MOVING(x,y+1) ||
+ object_hit = (!IS_FREE(x, y+1) && (!IS_MOVING(x, y+1) ||
MovDir[x][y+1]!=MV_DOWN ||
MovPos[x][y+1]<=TILEY/2));
if (object_hit)
- smashed = MovingOrBlocked2Element(x,y+1);
+ smashed = MovingOrBlocked2Element(x, y+1);
}
/* Auftreffendes Element fällt in Salzsäure */
- if (!lastline && smashed==EL_SALZSAEURE)
+ if (!lastline && smashed == EL_SALZSAEURE)
{
- Blurb(x,y);
+ Blurb(x, y);
return;
}
/* Auftreffendes Element ist Bombe */
- if (element==EL_BOMBE && (lastline || object_hit))
+ if (element == EL_BOMBE && (lastline || object_hit))
{
- Bang(x,y);
+ Bang(x, y);
return;
}
/* Auftreffendes Element ist Säuretropfen */
- if (element==EL_TROPFEN && (lastline || object_hit))
+ if (element == EL_TROPFEN && (lastline || object_hit))
{
- if (object_hit && IS_PLAYER(x,y+1))
- KillHero(PLAYERINFO(x,y+1));
- else if (object_hit && (smashed==EL_MAULWURF || smashed==EL_PINGUIN))
- Bang(x,y+1);
+ if (object_hit && IS_PLAYER(x, y+1))
+ KillHero(PLAYERINFO(x, y+1));
+ else if (object_hit && (smashed == EL_MAULWURF || smashed == EL_PINGUIN))
+ Bang(x, y+1);
else
{
Feld[x][y] = EL_AMOEBING;
if (!lastline && object_hit)
{
if (CAN_CHANGE(element) &&
- (smashed==EL_SIEB_LEER || smashed==EL_SIEB2_LEER) && !SiebAktiv)
+ (smashed == EL_SIEB_LEER || smashed == EL_SIEB2_LEER) && !SiebAktiv)
SiebAktiv = level.dauer_sieb * FRAMES_PER_SECOND;
- if (IS_PLAYER(x,y+1))
+ if (IS_PLAYER(x, y+1))
{
- KillHero(PLAYERINFO(x,y+1));
+ KillHero(PLAYERINFO(x, y+1));
return;
}
- else if (smashed==EL_MAULWURF || smashed==EL_PINGUIN)
+ else if (smashed == EL_MAULWURF || smashed == EL_PINGUIN)
{
- Bang(x,y+1);
+ Bang(x, y+1);
return;
}
- else if (element==EL_EDELSTEIN_BD)
+ else if (element == EL_EDELSTEIN_BD)
{
if (IS_ENEMY(smashed) && IS_BD_ELEMENT(smashed))
{
- Bang(x,y+1);
+ Bang(x, y+1);
return;
}
}
- else if (element==EL_FELSBROCKEN)
+ else if (element == EL_FELSBROCKEN)
{
- if (IS_ENEMY(smashed) || smashed==EL_BOMBE || smashed==EL_SONDE ||
- smashed==EL_SCHWEIN || smashed==EL_DRACHE)
+ if (IS_ENEMY(smashed) || smashed == EL_BOMBE || smashed == EL_SONDE ||
+ smashed == EL_SCHWEIN || smashed == EL_DRACHE)
{
- Bang(x,y+1);
+ Bang(x, y+1);
return;
}
- else if (!IS_MOVING(x,y+1))
+ else if (!IS_MOVING(x, y+1))
{
- if (smashed==EL_BIRNE_AUS || smashed==EL_BIRNE_EIN)
+ if (smashed == EL_BIRNE_AUS || smashed == EL_BIRNE_EIN)
{
- Bang(x,y+1);
+ Bang(x, y+1);
return;
}
- else if (smashed==EL_KOKOSNUSS)
+ else if (smashed == EL_KOKOSNUSS)
{
Feld[x][y+1] = EL_CRACKINGNUT;
- PlaySoundLevel(x,y,SND_KNACK);
+ PlaySoundLevel(x, y, SND_KNACK);
RaiseScoreElement(EL_KOKOSNUSS);
return;
}
- else if (smashed==EL_DIAMANT)
+ else if (smashed == EL_DIAMANT)
{
Feld[x][y+1] = EL_LEERRAUM;
- PlaySoundLevel(x,y,SND_QUIRK);
+ PlaySoundLevel(x, y, SND_QUIRK);
return;
}
}
}
/* Geräusch beim Durchqueren des Siebes */
- if (!lastline && (Feld[x][y+1]==EL_SIEB_LEER || Feld[x][y+1]==EL_SIEB2_LEER))
+ if (!lastline &&
+ (Feld[x][y+1] == EL_SIEB_LEER || Feld[x][y+1] == EL_SIEB2_LEER))
{
- PlaySoundLevel(x,y,SND_QUIRK);
+ PlaySoundLevel(x, y, SND_QUIRK);
return;
}
}
if (sound>=0)
- PlaySoundLevel(x,y,sound);
+ PlaySoundLevel(x, y, sound);
}
}
{
static struct
{
- int x,y;
+ int x, y;
} move_xy[] =
{
- { 0,0 },
- {-1,0 },
- {+1,0 },
- { 0,0 },
- { 0,-1 },
- { 0,0 }, { 0,0 }, { 0,0 },
- { 0,+1 }
+ { 0, 0 },
+ {-1, 0 },
+ {+1, 0 },
+ { 0, 0 },
+ { 0, -1 },
+ { 0, 0 }, { 0, 0 }, { 0, 0 },
+ { 0, +1 }
};
static struct
{
- int left,right,back;
+ int left, right, back;
} turn[] =
{
{ 0, 0, 0 },
int right_x = x+right_dx, right_y = y+right_dy;
int move_x = x+move_dx, move_y = y+move_dy;
- if (element==EL_KAEFER || element==EL_BUTTERFLY)
+ if (element == EL_KAEFER || element == EL_BUTTERFLY)
{
- TestIfBadThingHitsOtherBadThing(x,y);
+ TestIfBadThingHitsOtherBadThing(x, y);
- if (IN_LEV_FIELD(right_x,right_y) &&
- IS_FREE_OR_PLAYER(right_x,right_y))
+ if (IN_LEV_FIELD(right_x, right_y) &&
+ IS_FREE_OR_PLAYER(right_x, right_y))
MovDir[x][y] = right_dir;
- else if (!IN_LEV_FIELD(move_x,move_y) ||
- !IS_FREE_OR_PLAYER(move_x,move_y))
+ else if (!IN_LEV_FIELD(move_x, move_y) ||
+ !IS_FREE_OR_PLAYER(move_x, move_y))
MovDir[x][y] = left_dir;
- if (element==EL_KAEFER && MovDir[x][y] != old_move_dir)
+ if (element == EL_KAEFER && MovDir[x][y] != old_move_dir)
MovDelay[x][y] = 9;
- else if (element==EL_BUTTERFLY) /* && MovDir[x][y]==left_dir) */
+ else if (element == EL_BUTTERFLY) /* && MovDir[x][y] == left_dir) */
MovDelay[x][y] = 1;
}
- else if (element==EL_FLIEGER || element==EL_FIREFLY)
+ else if (element == EL_FLIEGER || element == EL_FIREFLY)
{
- TestIfBadThingHitsOtherBadThing(x,y);
+ TestIfBadThingHitsOtherBadThing(x, y);
- if (IN_LEV_FIELD(left_x,left_y) &&
- IS_FREE_OR_PLAYER(left_x,left_y))
+ if (IN_LEV_FIELD(left_x, left_y) &&
+ IS_FREE_OR_PLAYER(left_x, left_y))
MovDir[x][y] = left_dir;
- else if (!IN_LEV_FIELD(move_x,move_y) ||
- !IS_FREE_OR_PLAYER(move_x,move_y))
+ else if (!IN_LEV_FIELD(move_x, move_y) ||
+ !IS_FREE_OR_PLAYER(move_x, move_y))
MovDir[x][y] = right_dir;
- if (element==EL_FLIEGER && MovDir[x][y] != old_move_dir)
+ if (element == EL_FLIEGER && MovDir[x][y] != old_move_dir)
MovDelay[x][y] = 9;
- else if (element==EL_FIREFLY) /* && MovDir[x][y]==right_dir) */
+ else if (element == EL_FIREFLY) /* && MovDir[x][y] == right_dir) */
MovDelay[x][y] = 1;
}
- else if (element==EL_MAMPFER)
+ else if (element == EL_MAMPFER)
{
boolean can_turn_left = FALSE, can_turn_right = FALSE;
- if (IN_LEV_FIELD(left_x,left_y) &&
- (IS_FREE_OR_PLAYER(left_x,left_y) ||
+ if (IN_LEV_FIELD(left_x, left_y) &&
+ (IS_FREE_OR_PLAYER(left_x, left_y) ||
Feld[left_x][left_y] == EL_DIAMANT))
can_turn_left = TRUE;
- if (IN_LEV_FIELD(right_x,right_y) &&
- (IS_FREE_OR_PLAYER(right_x,right_y) ||
+ if (IN_LEV_FIELD(right_x, right_y) &&
+ (IS_FREE_OR_PLAYER(right_x, right_y) ||
Feld[right_x][right_y] == EL_DIAMANT))
can_turn_right = TRUE;
MovDelay[x][y] = 16+16*RND(3);
}
- else if (element==EL_MAMPFER2)
+ else if (element == EL_MAMPFER2)
{
boolean can_turn_left = FALSE, can_turn_right = FALSE;
- if (IN_LEV_FIELD(left_x,left_y) &&
- (IS_FREE_OR_PLAYER(left_x,left_y) ||
+ if (IN_LEV_FIELD(left_x, left_y) &&
+ (IS_FREE_OR_PLAYER(left_x, left_y) ||
IS_MAMPF2(Feld[left_x][left_y])))
can_turn_left = TRUE;
- if (IN_LEV_FIELD(right_x,right_y) &&
- (IS_FREE_OR_PLAYER(right_x,right_y) ||
+ if (IN_LEV_FIELD(right_x, right_y) &&
+ (IS_FREE_OR_PLAYER(right_x, right_y) ||
IS_MAMPF2(Feld[right_x][right_y])))
can_turn_right = TRUE;
MovDelay[x][y] = 16+16*RND(3);
}
- else if (element==EL_PACMAN)
+ else if (element == EL_PACMAN)
{
boolean can_turn_left = FALSE, can_turn_right = FALSE;
- if (IN_LEV_FIELD(left_x,left_y) &&
- (IS_FREE_OR_PLAYER(left_x,left_y) ||
+ if (IN_LEV_FIELD(left_x, left_y) &&
+ (IS_FREE_OR_PLAYER(left_x, left_y) ||
IS_AMOEBOID(Feld[left_x][left_y])))
can_turn_left = TRUE;
- if (IN_LEV_FIELD(right_x,right_y) &&
- (IS_FREE_OR_PLAYER(right_x,right_y) ||
+ if (IN_LEV_FIELD(right_x, right_y) &&
+ (IS_FREE_OR_PLAYER(right_x, right_y) ||
IS_AMOEBOID(Feld[right_x][right_y])))
can_turn_right = TRUE;
MovDelay[x][y] = 6+RND(40);
}
- else if (element==EL_SCHWEIN)
+ else if (element == EL_SCHWEIN)
{
boolean can_turn_left = FALSE, can_turn_right = FALSE, can_move_on = FALSE;
boolean should_turn_left = FALSE, should_turn_right = FALSE;
int rnd_value = 24;
int rnd = RND(rnd_value);
- if (IN_LEV_FIELD(left_x,left_y) &&
- (IS_FREE(left_x,left_y) || IS_GEM(Feld[left_x][left_y])))
+ if (IN_LEV_FIELD(left_x, left_y) &&
+ (IS_FREE(left_x, left_y) || IS_GEM(Feld[left_x][left_y])))
can_turn_left = TRUE;
- if (IN_LEV_FIELD(right_x,right_y) &&
- (IS_FREE(right_x,right_y) || IS_GEM(Feld[right_x][right_y])))
+ if (IN_LEV_FIELD(right_x, right_y) &&
+ (IS_FREE(right_x, right_y) || IS_GEM(Feld[right_x][right_y])))
can_turn_right = TRUE;
- if (IN_LEV_FIELD(move_x,move_y) &&
- (IS_FREE(move_x,move_y) || IS_GEM(Feld[move_x][move_y])))
+ if (IN_LEV_FIELD(move_x, move_y) &&
+ (IS_FREE(move_x, move_y) || IS_GEM(Feld[move_x][move_y])))
can_move_on = TRUE;
if (can_turn_left &&
(!can_move_on ||
- (IN_LEV_FIELD(x+back_dx+left_dx,y+back_dy+left_dy) &&
- !IS_FREE(x+back_dx+left_dx,y+back_dy+left_dy))))
+ (IN_LEV_FIELD(x+back_dx+left_dx, y+back_dy+left_dy) &&
+ !IS_FREE(x+back_dx+left_dx, y+back_dy+left_dy))))
should_turn_left = TRUE;
if (can_turn_right &&
(!can_move_on ||
- (IN_LEV_FIELD(x+back_dx+right_dx,y+back_dy+right_dy) &&
- !IS_FREE(x+back_dx+right_dx,y+back_dy+right_dy))))
+ (IN_LEV_FIELD(x+back_dx+right_dx, y+back_dy+right_dy) &&
+ !IS_FREE(x+back_dx+right_dx, y+back_dy+right_dy))))
should_turn_right = TRUE;
if (can_move_on &&
(!can_turn_left || !can_turn_right ||
- (IN_LEV_FIELD(x+move_dx+left_dx,y+move_dy+left_dy) &&
- !IS_FREE(x+move_dx+left_dx,y+move_dy+left_dy)) ||
- (IN_LEV_FIELD(x+move_dx+right_dx,y+move_dy+right_dy) &&
- !IS_FREE(x+move_dx+right_dx,y+move_dy+right_dy))))
+ (IN_LEV_FIELD(x+move_dx+left_dx, y+move_dy+left_dy) &&
+ !IS_FREE(x+move_dx+left_dx, y+move_dy+left_dy)) ||
+ (IN_LEV_FIELD(x+move_dx+right_dx, y+move_dy+right_dy) &&
+ !IS_FREE(x+move_dx+right_dx, y+move_dy+right_dy))))
should_move_on = TRUE;
if (should_turn_left || should_turn_right || should_move_on)
else
MovDir[x][y] = back_dir;
- if (!IS_FREE(x+move_xy[MovDir[x][y]].x,y+move_xy[MovDir[x][y]].y) &&
+ if (!IS_FREE(x+move_xy[MovDir[x][y]].x, y+move_xy[MovDir[x][y]].y) &&
!IS_GEM(Feld[x+move_xy[MovDir[x][y]].x][y+move_xy[MovDir[x][y]].y]))
MovDir[x][y] = old_move_dir;
MovDelay[x][y] = 0;
}
- else if (element==EL_DRACHE)
+ else if (element == EL_DRACHE)
{
boolean can_turn_left = FALSE, can_turn_right = FALSE, can_move_on = FALSE;
int rnd_value = 24;
int rnd = RND(rnd_value);
- if (IN_LEV_FIELD(left_x,left_y) && IS_FREE(left_x,left_y))
+ if (IN_LEV_FIELD(left_x, left_y) && IS_FREE(left_x, left_y))
can_turn_left = TRUE;
- if (IN_LEV_FIELD(right_x,right_y) && IS_FREE(right_x,right_y))
+ if (IN_LEV_FIELD(right_x, right_y) && IS_FREE(right_x, right_y))
can_turn_right = TRUE;
- if (IN_LEV_FIELD(move_x,move_y) && IS_FREE(move_x,move_y))
+ if (IN_LEV_FIELD(move_x, move_y) && IS_FREE(move_x, move_y))
can_move_on = TRUE;
if (can_move_on && rnd > rnd_value/8)
else
MovDir[x][y] = back_dir;
- if (!IS_FREE(x+move_xy[MovDir[x][y]].x,y+move_xy[MovDir[x][y]].y))
+ if (!IS_FREE(x+move_xy[MovDir[x][y]].x, y+move_xy[MovDir[x][y]].y))
MovDir[x][y] = old_move_dir;
MovDelay[x][y] = 0;
}
- else if (element==EL_ROBOT || element==EL_SONDE ||
- element==EL_MAULWURF || element==EL_PINGUIN)
+ else if (element == EL_ROBOT || element == EL_SONDE ||
+ element == EL_MAULWURF || element == EL_PINGUIN)
{
int attr_x = -1, attr_y = -1;
{
int i;
- for(i=0; i<MAX_PLAYERS; i++)
+ for (i=0; i<MAX_PLAYERS; i++)
{
struct PlayerInfo *player = &stored_player[i];
int jx = player->jx, jy = player->jy;
}
}
- if (element==EL_ROBOT && ZX>=0 && ZY>=0)
+ if (element == EL_ROBOT && ZX>=0 && ZY>=0)
{
attr_x = ZX;
attr_y = ZY;
}
- if (element==EL_MAULWURF || element==EL_PINGUIN)
+ if (element == EL_MAULWURF || element == EL_PINGUIN)
{
int i;
static int xy[4][2] =
{
- { 0,-1 },
- { -1,0 },
- { +1,0 },
- { 0,+1 }
+ { 0, -1 },
+ { -1, 0 },
+ { +1, 0 },
+ { 0, +1 }
};
- for(i=0;i<4;i++)
+ for (i=0; i<4; i++)
{
int ex = x + xy[i%4][0];
int ey = y + xy[i%4][1];
- if (IN_LEV_FIELD(ex,ey) && Feld[ex][ey] == EL_AUSGANG_AUF)
+ if (IN_LEV_FIELD(ex, ey) && Feld[ex][ey] == EL_AUSGANG_AUF)
{
attr_x = ex;
attr_y = ey;
else if (attr_y>y)
MovDir[x][y] |= (AllPlayersGone ? MV_UP : MV_DOWN);
- if (element==EL_ROBOT)
+ if (element == EL_ROBOT)
{
int newx, newy;
if ((MovDir[x][y]&(MV_LEFT|MV_RIGHT)) && (MovDir[x][y]&(MV_UP|MV_DOWN)))
MovDir[x][y] &= (RND(2) ? (MV_LEFT|MV_RIGHT) : (MV_UP|MV_DOWN));
- Moving2Blocked(x,y,&newx,&newy);
+ Moving2Blocked(x, y, &newx, &newy);
- if (IN_LEV_FIELD(newx,newy) && IS_FREE_OR_PLAYER(newx,newy))
+ if (IN_LEV_FIELD(newx, newy) && IS_FREE_OR_PLAYER(newx, newy))
MovDelay[x][y] = 8+8*!RND(3);
else
MovDelay[x][y] = 16;
MovDir[x][y] =
new_move_dir & (first_horiz ? (MV_LEFT|MV_RIGHT) : (MV_UP|MV_DOWN));
- Moving2Blocked(x,y,&newx,&newy);
+ Moving2Blocked(x, y, &newx, &newy);
- if (IN_LEV_FIELD(newx,newy) &&
- (IS_FREE(newx,newy) ||
+ if (IN_LEV_FIELD(newx, newy) &&
+ (IS_FREE(newx, newy) ||
Feld[newx][newy] == EL_SALZSAEURE ||
- ((element == EL_MAULWURF || element==EL_PINGUIN) &&
+ ((element == EL_MAULWURF || element == EL_PINGUIN) &&
(Feld[newx][newy] == EL_AUSGANG_AUF ||
IS_MAMPF3(Feld[newx][newy])))))
return;
MovDir[x][y] =
new_move_dir & (!first_horiz ? (MV_LEFT|MV_RIGHT) : (MV_UP|MV_DOWN));
- Moving2Blocked(x,y,&newx,&newy);
+ Moving2Blocked(x, y, &newx, &newy);
- if (IN_LEV_FIELD(newx,newy) &&
- (IS_FREE(newx,newy) ||
+ if (IN_LEV_FIELD(newx, newy) &&
+ (IS_FREE(newx, newy) ||
Feld[newx][newy] == EL_SALZSAEURE ||
- ((element == EL_MAULWURF || element==EL_PINGUIN) &&
+ ((element == EL_MAULWURF || element == EL_PINGUIN) &&
(Feld[newx][newy] == EL_AUSGANG_AUF ||
IS_MAMPF3(Feld[newx][newy])))))
return;
{
int i;
- for(i=0; i<MAX_PLAYERS; i++)
+ for (i=0; i<MAX_PLAYERS; i++)
{
struct PlayerInfo *player = &stored_player[i];
int next_jy = player->jy + (player->jy - player->last_jy);
if (x == next_jx && y == next_jy)
- return(TRUE);
+ return TRUE;
}
}
- return(FALSE);
+ return FALSE;
}
void StartMoving(int x, int y)
if (CAN_FALL(element) && y<lev_fieldy-1)
{
- if ((x>0 && IS_PLAYER(x-1,y)) || (x<lev_fieldx-1 && IS_PLAYER(x+1,y)))
- if (JustBeingPushed(x,y))
+ if ((x>0 && IS_PLAYER(x-1, y)) || (x<lev_fieldx-1 && IS_PLAYER(x+1, y)))
+ if (JustBeingPushed(x, y))
return;
- if (element==EL_MORAST_VOLL)
+ if (element == EL_MORAST_VOLL)
{
- if (IS_FREE(x,y+1))
+ if (IS_FREE(x, y+1))
{
- InitMovingField(x,y,MV_DOWN);
+ InitMovingField(x, y, MV_DOWN);
Feld[x][y] = EL_FELSBROCKEN;
Store[x][y] = EL_MORAST_LEER;
}
- else if (Feld[x][y+1]==EL_MORAST_LEER)
+ else if (Feld[x][y+1] == EL_MORAST_LEER)
{
if (!MovDelay[x][y])
MovDelay[x][y] = TILEY + 1;
Feld[x][y+1] = EL_MORAST_VOLL;
}
}
- else if (element==EL_FELSBROCKEN && Feld[x][y+1]==EL_MORAST_LEER)
+ else if (element == EL_FELSBROCKEN && Feld[x][y+1] == EL_MORAST_LEER)
{
- InitMovingField(x,y,MV_DOWN);
+ InitMovingField(x, y, MV_DOWN);
Store[x][y] = EL_MORAST_VOLL;
}
- else if (element==EL_SIEB_VOLL)
+ else if (element == EL_SIEB_VOLL)
{
- if (IS_FREE(x,y+1))
+ if (IS_FREE(x, y+1))
{
- InitMovingField(x,y,MV_DOWN);
+ InitMovingField(x, y, MV_DOWN);
Feld[x][y] = EL_CHANGED(Store2[x][y]);
Store[x][y] = EL_SIEB_LEER;
}
- else if (Feld[x][y+1]==EL_SIEB_LEER)
+ else if (Feld[x][y+1] == EL_SIEB_LEER)
{
if (!MovDelay[x][y])
MovDelay[x][y] = TILEY/4 + 1;
Store2[x][y] = 0;
}
}
- else if (element==EL_SIEB2_VOLL)
+ else if (element == EL_SIEB2_VOLL)
{
- if (IS_FREE(x,y+1))
+ if (IS_FREE(x, y+1))
{
- InitMovingField(x,y,MV_DOWN);
+ InitMovingField(x, y, MV_DOWN);
Feld[x][y] = EL_CHANGED2(Store2[x][y]);
Store[x][y] = EL_SIEB2_LEER;
}
- else if (Feld[x][y+1]==EL_SIEB2_LEER)
+ else if (Feld[x][y+1] == EL_SIEB2_LEER)
{
if (!MovDelay[x][y])
MovDelay[x][y] = TILEY/4 + 1;
}
}
else if (SiebAktiv && CAN_CHANGE(element) &&
- (Feld[x][y+1]==EL_SIEB_LEER || Feld[x][y+1]==EL_SIEB2_LEER))
+ (Feld[x][y+1] == EL_SIEB_LEER || Feld[x][y+1] == EL_SIEB2_LEER))
{
- InitMovingField(x,y,MV_DOWN);
+ InitMovingField(x, y, MV_DOWN);
Store[x][y] =
- (Feld[x][y+1]==EL_SIEB_LEER ? EL_SIEB_VOLL : EL_SIEB2_VOLL);
+ (Feld[x][y+1] == EL_SIEB_LEER ? EL_SIEB_VOLL : EL_SIEB2_VOLL);
Store2[x][y+1] = element;
}
- else if (CAN_SMASH(element) && Feld[x][y+1]==EL_SALZSAEURE)
+ else if (CAN_SMASH(element) && Feld[x][y+1] == EL_SALZSAEURE)
{
- Blurb(x,y);
- InitMovingField(x,y,MV_DOWN);
+ Blurb(x, y);
+ InitMovingField(x, y, MV_DOWN);
Store[x][y] = EL_SALZSAEURE;
}
- else if (CAN_SMASH(element) && Feld[x][y+1]==EL_BLOCKED && JustHit[x][y])
+ else if (CAN_SMASH(element) && Feld[x][y+1] == EL_BLOCKED && JustHit[x][y])
{
- Impact(x,y);
+ Impact(x, y);
}
- else if (IS_FREE(x,y+1))
+ else if (IS_FREE(x, y+1))
{
- InitMovingField(x,y,MV_DOWN);
+ InitMovingField(x, y, MV_DOWN);
}
- else if (element==EL_TROPFEN)
+ else if (element == EL_TROPFEN)
{
Feld[x][y] = EL_AMOEBING;
Store[x][y] = EL_AMOEBE_NASS;
}
else if (IS_SLIPPERY(Feld[x][y+1]) && !Store[x][y+1])
{
- boolean left = (x>0 && IS_FREE(x-1,y) &&
- (IS_FREE(x-1,y+1) || Feld[x-1][y+1]==EL_SALZSAEURE));
- boolean right = (x<lev_fieldx-1 && IS_FREE(x+1,y) &&
- (IS_FREE(x+1,y+1) || Feld[x+1][y+1]==EL_SALZSAEURE));
+ boolean left = (x>0 && IS_FREE(x-1, y) &&
+ (IS_FREE(x-1, y+1) || Feld[x-1][y+1] == EL_SALZSAEURE));
+ boolean right = (x<lev_fieldx-1 && IS_FREE(x+1, y) &&
+ (IS_FREE(x+1, y+1) || Feld[x+1][y+1] == EL_SALZSAEURE));
if (left || right)
{
if (left && right && game_emulation != EMU_BOULDERDASH)
left = !(right = RND(2));
- InitMovingField(x,y,left ? MV_LEFT : MV_RIGHT);
+ InitMovingField(x, y, left ? MV_LEFT : MV_RIGHT);
}
}
}
else if (CAN_MOVE(element))
{
- int newx,newy;
+ int newx, newy;
- if (element == EL_SONDE && JustBeingPushed(x,y))
+ if (element == EL_SONDE && JustBeingPushed(x, y))
return;
if (!MovDelay[x][y]) /* neuer Schritt / noch nicht gewartet */
if (element!=EL_MAMPFER && element!=EL_MAMPFER2 && element!=EL_PACMAN)
{
- TurnRound(x,y);
+ TurnRound(x, y);
if (MovDelay[x][y] && (element == EL_KAEFER || element == EL_FLIEGER))
- DrawLevelField(x,y);
+ DrawLevelField(x, y);
}
}
{
MovDelay[x][y]--;
- if (element==EL_ROBOT || element==EL_MAMPFER || element==EL_MAMPFER2)
+ if (element == EL_ROBOT || element == EL_MAMPFER ||
+ element == EL_MAMPFER2)
{
int phase = MovDelay[x][y] % 8;
if (phase>3)
phase = 7-phase;
- if (IN_SCR_FIELD(SCREENX(x),SCREENY(y)))
- DrawGraphic(SCREENX(x),SCREENY(y), el2gfx(element)+phase);
+ if (IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
+ DrawGraphic(SCREENX(x), SCREENY(y), el2gfx(element)+phase);
- if ((element==EL_MAMPFER || element==EL_MAMPFER2)
- && MovDelay[x][y]%4==3)
- PlaySoundLevel(x,y,SND_NJAM);
+ if ((element == EL_MAMPFER || element == EL_MAMPFER2)
+ && MovDelay[x][y]%4 == 3)
+ PlaySoundLevel(x, y, SND_NJAM);
}
- else if (element==EL_DRACHE)
+ else if (element == EL_DRACHE)
{
int i;
int dir = MovDir[x][y];
dir == MV_DOWN ? GFX_FLAMMEN_DOWN : GFX_LEERRAUM);
int phase = FrameCounter % 2;
- for(i=1;i<=3;i++)
+ for (i=1; i<=3; i++)
{
int xx = x + i*dx, yy = y + i*dy;
int sx = SCREENX(xx), sy = SCREENY(yy);
- if (!IN_LEV_FIELD(xx,yy) ||
- IS_SOLID(Feld[xx][yy]) || Feld[xx][yy]==EL_EXPLODING)
+ if (!IN_LEV_FIELD(xx, yy) ||
+ IS_SOLID(Feld[xx][yy]) || Feld[xx][yy] == EL_EXPLODING)
break;
if (MovDelay[x][y])
{
- int flamed = MovingOrBlocked2Element(xx,yy);
+ int flamed = MovingOrBlocked2Element(xx, yy);
if (IS_ENEMY(flamed) || IS_EXPLOSIVE(flamed))
- Bang(xx,yy);
+ Bang(xx, yy);
else
- RemoveMovingField(xx,yy);
+ RemoveMovingField(xx, yy);
Feld[xx][yy] = EL_BURNING;
- if (IN_SCR_FIELD(sx,sy))
- DrawGraphic(sx,sy, graphic + phase*3 + i-1);
+ if (IN_SCR_FIELD(sx, sy))
+ DrawGraphic(sx, sy, graphic + phase*3 + i-1);
}
else
{
if (Feld[xx][yy] == EL_BURNING)
Feld[xx][yy] = EL_LEERRAUM;
- DrawLevelField(xx,yy);
+ DrawLevelField(xx, yy);
}
}
}
return;
}
- if (element==EL_KAEFER || element==EL_BUTTERFLY)
+ if (element == EL_KAEFER || element == EL_BUTTERFLY)
{
- PlaySoundLevel(x,y,SND_KLAPPER);
+ PlaySoundLevel(x, y, SND_KLAPPER);
}
- else if (element==EL_FLIEGER || element==EL_FIREFLY)
+ else if (element == EL_FLIEGER || element == EL_FIREFLY)
{
- PlaySoundLevel(x,y,SND_ROEHR);
+ PlaySoundLevel(x, y, SND_ROEHR);
}
/* neuer Schritt / Wartezustand beendet */
- Moving2Blocked(x,y,&newx,&newy); /* wohin soll's gehen? */
+ Moving2Blocked(x, y, &newx, &newy); /* wohin soll's gehen? */
- if (IS_ENEMY(element) && IS_PLAYER(newx,newy))
+ if (IS_ENEMY(element) && IS_PLAYER(newx, newy))
{
/* Spieler erwischt */
MovDir[x][y] = 0;
- KillHero(PLAYERINFO(newx,newy));
+ KillHero(PLAYERINFO(newx, newy));
return;
}
else if ((element == EL_MAULWURF || element == EL_PINGUIN ||
- element==EL_ROBOT || element==EL_SONDE) &&
- IN_LEV_FIELD(newx,newy) &&
- MovDir[x][y]==MV_DOWN && Feld[newx][newy]==EL_SALZSAEURE)
+ element == EL_ROBOT || element == EL_SONDE) &&
+ IN_LEV_FIELD(newx, newy) &&
+ MovDir[x][y] == MV_DOWN && Feld[newx][newy] == EL_SALZSAEURE)
{
- Blurb(x,y);
+ Blurb(x, y);
Store[x][y] = EL_SALZSAEURE;
}
else if ((element == EL_MAULWURF || element == EL_PINGUIN) &&
- IN_LEV_FIELD(newx,newy))
+ IN_LEV_FIELD(newx, newy))
{
if (Feld[newx][newy] == EL_AUSGANG_AUF)
{
Feld[x][y] = EL_LEERRAUM;
- DrawLevelField(x,y);
+ DrawLevelField(x, y);
- PlaySoundLevel(newx,newy,SND_BUING);
- if (IN_SCR_FIELD(SCREENX(newx),SCREENY(newy)))
- DrawGraphicThruMask(SCREENX(newx),SCREENY(newy),el2gfx(element));
+ PlaySoundLevel(newx, newy, SND_BUING);
+ if (IN_SCR_FIELD(SCREENX(newx), SCREENY(newy)))
+ DrawGraphicThruMask(SCREENX(newx), SCREENY(newy), el2gfx(element));
local_player->friends_still_needed--;
if (!local_player->friends_still_needed &&
}
else if (IS_MAMPF3(Feld[newx][newy]))
{
- if (DigField(local_player, newx,newy, 0,0, DF_DIG) == MF_MOVING)
- DrawLevelField(newx,newy);
+ if (DigField(local_player, newx, newy, 0, 0, DF_DIG) == MF_MOVING)
+ DrawLevelField(newx, newy);
else
MovDir[x][y] = MV_NO_MOVING;
}
- else if (!IS_FREE(newx,newy))
+ else if (!IS_FREE(newx, newy))
{
- if (IS_PLAYER(x,y))
- DrawPlayerField(x,y);
+ if (IS_PLAYER(x, y))
+ DrawPlayerField(x, y);
else
- DrawLevelField(x,y);
+ DrawLevelField(x, y);
return;
}
}
- else if (element == EL_SCHWEIN && IN_LEV_FIELD(newx,newy))
+ else if (element == EL_SCHWEIN && IN_LEV_FIELD(newx, newy))
{
if (IS_GEM(Feld[newx][newy]))
{
- if (IS_MOVING(newx,newy))
- RemoveMovingField(newx,newy);
+ if (IS_MOVING(newx, newy))
+ RemoveMovingField(newx, newy);
else
{
Feld[newx][newy] = EL_LEERRAUM;
- DrawLevelField(newx,newy);
+ DrawLevelField(newx, newy);
}
}
- else if (!IS_FREE(newx,newy))
+ else if (!IS_FREE(newx, newy))
{
- if (IS_PLAYER(x,y))
- DrawPlayerField(x,y);
+ if (IS_PLAYER(x, y))
+ DrawPlayerField(x, y);
else
- DrawLevelField(x,y);
+ DrawLevelField(x, y);
return;
}
}
- else if (element==EL_DRACHE && IN_LEV_FIELD(newx,newy))
+ else if (element == EL_DRACHE && IN_LEV_FIELD(newx, newy))
{
- if (!IS_FREE(newx,newy))
+ if (!IS_FREE(newx, newy))
{
- if (IS_PLAYER(x,y))
- DrawPlayerField(x,y);
+ if (IS_PLAYER(x, y))
+ DrawPlayerField(x, y);
else
- DrawLevelField(x,y);
+ DrawLevelField(x, y);
return;
}
else
int dx = newx - x, dy = newy - y;
int newx1 = newx+1*dx, newy1 = newy+1*dy;
int newx2 = newx+2*dx, newy2 = newy+2*dy;
- int element1 = (IN_LEV_FIELD(newx1,newy1) ?
- MovingOrBlocked2Element(newx1,newy1) : EL_BETON);
- int element2 = (IN_LEV_FIELD(newx2,newy2) ?
- MovingOrBlocked2Element(newx2,newy2) : EL_BETON);
+ int element1 = (IN_LEV_FIELD(newx1, newy1) ?
+ MovingOrBlocked2Element(newx1, newy1) : EL_BETON);
+ int element2 = (IN_LEV_FIELD(newx2, newy2) ?
+ MovingOrBlocked2Element(newx2, newy2) : EL_BETON);
if ((wanna_flame || IS_ENEMY(element1) || IS_ENEMY(element2)) &&
element1 != EL_DRACHE && element2 != EL_DRACHE &&
element1 != EL_BURNING && element2 != EL_BURNING)
{
- if (IS_PLAYER(x,y))
- DrawPlayerField(x,y);
+ if (IS_PLAYER(x, y))
+ DrawPlayerField(x, y);
else
- DrawLevelField(x,y);
+ DrawLevelField(x, y);
MovDelay[x][y] = 50;
Feld[newx][newy] = EL_BURNING;
- if (IN_LEV_FIELD(newx1,newy1) && Feld[newx1][newy1] == EL_LEERRAUM)
+ if (IN_LEV_FIELD(newx1, newy1) && Feld[newx1][newy1] == EL_LEERRAUM)
Feld[newx1][newy1] = EL_BURNING;
- if (IN_LEV_FIELD(newx2,newy2) && Feld[newx2][newy2] == EL_LEERRAUM)
+ if (IN_LEV_FIELD(newx2, newy2) && Feld[newx2][newy2] == EL_LEERRAUM)
Feld[newx2][newy2] = EL_BURNING;
return;
}
}
}
- else if (element==EL_MAMPFER && IN_LEV_FIELD(newx,newy) &&
- Feld[newx][newy]==EL_DIAMANT)
+ else if (element == EL_MAMPFER && IN_LEV_FIELD(newx, newy) &&
+ Feld[newx][newy] == EL_DIAMANT)
{
- if (IS_MOVING(newx,newy))
- RemoveMovingField(newx,newy);
+ if (IS_MOVING(newx, newy))
+ RemoveMovingField(newx, newy);
else
{
Feld[newx][newy] = EL_LEERRAUM;
- DrawLevelField(newx,newy);
+ DrawLevelField(newx, newy);
}
}
- else if (element==EL_MAMPFER2 && IN_LEV_FIELD(newx,newy) &&
+ else if (element == EL_MAMPFER2 && IN_LEV_FIELD(newx, newy) &&
IS_MAMPF2(Feld[newx][newy]))
{
if (AmoebaNr[newx][newy])
{
AmoebaCnt2[AmoebaNr[newx][newy]]--;
- if (Feld[newx][newy]==EL_AMOEBE_VOLL || Feld[newx][newy]==EL_AMOEBE_BD)
+ if (Feld[newx][newy] == EL_AMOEBE_VOLL ||
+ Feld[newx][newy] == EL_AMOEBE_BD)
AmoebaCnt[AmoebaNr[newx][newy]]--;
}
- if (IS_MOVING(newx,newy))
- RemoveMovingField(newx,newy);
+ if (IS_MOVING(newx, newy))
+ RemoveMovingField(newx, newy);
else
{
Feld[newx][newy] = EL_LEERRAUM;
- DrawLevelField(newx,newy);
+ DrawLevelField(newx, newy);
}
}
- else if (element==EL_PACMAN && IN_LEV_FIELD(newx,newy) &&
+ else if (element == EL_PACMAN && IN_LEV_FIELD(newx, newy) &&
IS_AMOEBOID(Feld[newx][newy]))
{
if (AmoebaNr[newx][newy])
{
AmoebaCnt2[AmoebaNr[newx][newy]]--;
- if (Feld[newx][newy]==EL_AMOEBE_VOLL || Feld[newx][newy]==EL_AMOEBE_BD)
+ if (Feld[newx][newy] == EL_AMOEBE_VOLL ||
+ Feld[newx][newy] == EL_AMOEBE_BD)
AmoebaCnt[AmoebaNr[newx][newy]]--;
}
Feld[newx][newy] = EL_LEERRAUM;
- DrawLevelField(newx,newy);
+ DrawLevelField(newx, newy);
}
- else if (!IN_LEV_FIELD(newx,newy) || !IS_FREE(newx,newy))
+ else if (!IN_LEV_FIELD(newx, newy) || !IS_FREE(newx, newy))
{ /* gegen Wand gelaufen */
- TurnRound(x,y);
+ TurnRound(x, y);
if (element == EL_KAEFER || element == EL_FLIEGER)
- DrawLevelField(x,y);
+ DrawLevelField(x, y);
else if (element == EL_BUTTERFLY || element == EL_FIREFLY)
- DrawGraphicAnimation(x,y, el2gfx(element), 2, 4, ANIM_NORMAL);
- else if (element==EL_SONDE)
- DrawGraphicAnimation(x,y, GFX_SONDE_START, 8, 2, ANIM_NORMAL);
+ DrawGraphicAnimation(x, y, el2gfx(element), 2, 4, ANIM_NORMAL);
+ else if (element == EL_SONDE)
+ DrawGraphicAnimation(x, y, GFX_SONDE_START, 8, 2, ANIM_NORMAL);
return;
}
- if (element==EL_ROBOT && IN_SCR_FIELD(x,y))
- PlaySoundLevel(x,y,SND_SCHLURF);
+ if (element == EL_ROBOT && IN_SCR_FIELD(x, y))
+ PlaySoundLevel(x, y, SND_SCHLURF);
- InitMovingField(x,y,MovDir[x][y]);
+ InitMovingField(x, y, MovDir[x][y]);
}
if (MovDir[x][y])
- ContinueMoving(x,y);
+ ContinueMoving(x, y);
}
void ContinueMoving(int x, int y)
{
int element = Feld[x][y];
int direction = MovDir[x][y];
- int dx = (direction==MV_LEFT ? -1 : direction==MV_RIGHT ? +1 : 0);
- int dy = (direction==MV_UP ? -1 : direction==MV_DOWN ? +1 : 0);
+ int dx = (direction == MV_LEFT ? -1 : direction == MV_RIGHT ? +1 : 0);
+ int dy = (direction == MV_UP ? -1 : direction == MV_DOWN ? +1 : 0);
int horiz_move = (dx!=0);
int newx = x + dx, newy = y + dy;
int step = (horiz_move ? dx : dy) * TILEX/8;
if (CAN_FALL(element) && horiz_move)
step*=2;
- else if (element==EL_TROPFEN)
+ else if (element == EL_TROPFEN)
step/=2;
- else if (Store[x][y]==EL_MORAST_VOLL || Store[x][y]==EL_MORAST_LEER)
+ else if (Store[x][y] == EL_MORAST_VOLL || Store[x][y] == EL_MORAST_LEER)
step/=4;
MovPos[x][y] += step;
Feld[x][y] = EL_LEERRAUM;
Feld[newx][newy] = element;
- if (Store[x][y]==EL_MORAST_VOLL)
+ if (Store[x][y] == EL_MORAST_VOLL)
{
Store[x][y] = 0;
Feld[newx][newy] = EL_MORAST_VOLL;
element = EL_MORAST_VOLL;
}
- else if (Store[x][y]==EL_MORAST_LEER)
+ else if (Store[x][y] == EL_MORAST_LEER)
{
Store[x][y] = 0;
Feld[x][y] = EL_MORAST_LEER;
}
- else if (Store[x][y]==EL_SIEB_VOLL)
+ else if (Store[x][y] == EL_SIEB_VOLL)
{
Store[x][y] = 0;
element = Feld[newx][newy] = (SiebAktiv ? EL_SIEB_VOLL : EL_SIEB_TOT);
}
- else if (Store[x][y]==EL_SIEB_LEER)
+ else if (Store[x][y] == EL_SIEB_LEER)
{
Store[x][y] = Store2[x][y] = 0;
Feld[x][y] = (SiebAktiv ? EL_SIEB_LEER : EL_SIEB_TOT);
}
- else if (Store[x][y]==EL_SIEB2_VOLL)
+ else if (Store[x][y] == EL_SIEB2_VOLL)
{
Store[x][y] = 0;
element = Feld[newx][newy] = (SiebAktiv ? EL_SIEB2_VOLL : EL_SIEB2_TOT);
}
- else if (Store[x][y]==EL_SIEB2_LEER)
+ else if (Store[x][y] == EL_SIEB2_LEER)
{
Store[x][y] = Store2[x][y] = 0;
Feld[x][y] = (SiebAktiv ? EL_SIEB2_LEER : EL_SIEB2_TOT);
}
- else if (Store[x][y]==EL_SALZSAEURE)
+ else if (Store[x][y] == EL_SALZSAEURE)
{
Store[x][y] = 0;
Feld[newx][newy] = EL_SALZSAEURE;
element = EL_SALZSAEURE;
}
- else if (Store[x][y]==EL_AMOEBE_NASS)
+ else if (Store[x][y] == EL_AMOEBE_NASS)
{
Store[x][y] = 0;
Feld[x][y] = EL_AMOEBE_NASS;
if (!CAN_MOVE(element))
MovDir[newx][newy] = 0;
- DrawLevelField(x,y);
- DrawLevelField(newx,newy);
+ DrawLevelField(x, y);
+ DrawLevelField(newx, newy);
Stop[newx][newy] = TRUE;
JustHit[x][newy] = 3;
if (DONT_TOUCH(element)) /* Käfer oder Flieger */
{
- TestIfBadThingHitsHero(newx,newy);
- TestIfBadThingHitsFriend(newx,newy);
- TestIfBadThingHitsOtherBadThing(newx,newy);
+ TestIfBadThingHitsHero(newx, newy);
+ TestIfBadThingHitsFriend(newx, newy);
+ TestIfBadThingHitsOtherBadThing(newx, newy);
}
else if (element == EL_PINGUIN)
- TestIfFriendHitsBadThing(newx,newy);
+ TestIfFriendHitsBadThing(newx, newy);
- if (CAN_SMASH(element) && direction==MV_DOWN &&
- (newy==lev_fieldy-1 || !IS_FREE(x,newy+1)))
- Impact(x,newy);
+ if (CAN_SMASH(element) && direction == MV_DOWN &&
+ (newy == lev_fieldy-1 || !IS_FREE(x, newy+1)))
+ Impact(x, newy);
}
else /* noch in Bewegung */
- DrawLevelField(x,y);
+ DrawLevelField(x, y);
}
int AmoebeNachbarNr(int ax, int ay)
int group_nr = 0;
static int xy[4][2] =
{
- { 0,-1 },
- { -1,0 },
- { +1,0 },
- { 0,+1 }
+ { 0, -1 },
+ { -1, 0 },
+ { +1, 0 },
+ { 0, +1 }
};
- for(i=0;i<4;i++)
+ for (i=0; i<4; i++)
{
int x = ax+xy[i%4][0];
int y = ay+xy[i%4][1];
- if (!IN_LEV_FIELD(x,y))
+ if (!IN_LEV_FIELD(x, y))
continue;
- if (Feld[x][y]==element && AmoebaNr[x][y]>0)
+ if (Feld[x][y] == element && AmoebaNr[x][y]>0)
group_nr = AmoebaNr[x][y];
}
- return(group_nr);
+ return group_nr;
}
void AmoebenVereinigen(int ax, int ay)
{
- int i,x,y,xx,yy;
+ int i, x, y, xx, yy;
int new_group_nr = AmoebaNr[ax][ay];
static int xy[4][2] =
{
- { 0,-1 },
- { -1,0 },
- { +1,0 },
- { 0,+1 }
+ { 0, -1 },
+ { -1, 0 },
+ { +1, 0 },
+ { 0, +1 }
};
if (!new_group_nr)
return;
- for(i=0;i<4;i++)
+ for (i=0; i<4; i++)
{
x = ax+xy[i%4][0];
y = ay+xy[i%4][1];
- if (!IN_LEV_FIELD(x,y))
+ if (!IN_LEV_FIELD(x, y))
continue;
- if ((Feld[x][y]==EL_AMOEBE_VOLL ||
- Feld[x][y]==EL_AMOEBE_BD ||
- Feld[x][y]==EL_AMOEBE_TOT) &&
+ if ((Feld[x][y] == EL_AMOEBE_VOLL ||
+ Feld[x][y] == EL_AMOEBE_BD ||
+ Feld[x][y] == EL_AMOEBE_TOT) &&
AmoebaNr[x][y] != new_group_nr)
{
int old_group_nr = AmoebaNr[x][y];
AmoebaCnt2[new_group_nr] += AmoebaCnt2[old_group_nr];
AmoebaCnt2[old_group_nr] = 0;
- for(yy=0;yy<lev_fieldy;yy++) for(xx=0;xx<lev_fieldx;xx++)
- if (AmoebaNr[xx][yy]==old_group_nr)
+ for (yy=0; yy<lev_fieldy; yy++) for (xx=0; xx<lev_fieldx; xx++)
+ if (AmoebaNr[xx][yy] == old_group_nr)
AmoebaNr[xx][yy] = new_group_nr;
}
}
void AmoebeUmwandeln(int ax, int ay)
{
- int i,x,y;
+ int i, x, y;
int group_nr = AmoebaNr[ax][ay];
static int xy[4][2] =
{
- { 0,-1 },
- { -1,0 },
- { +1,0 },
- { 0,+1 }
+ { 0, -1 },
+ { -1, 0 },
+ { +1, 0 },
+ { 0, +1 }
};
- if (Feld[ax][ay]==EL_AMOEBE_TOT)
+ if (Feld[ax][ay] == EL_AMOEBE_TOT)
{
- for(y=0;y<lev_fieldy;y++) for(x=0;x<lev_fieldx;x++)
+ for (y=0; y<lev_fieldy; y++) for (x=0; x<lev_fieldx; x++)
{
- if (Feld[x][y]==EL_AMOEBE_TOT && AmoebaNr[x][y]==group_nr)
+ if (Feld[x][y] == EL_AMOEBE_TOT && AmoebaNr[x][y] == group_nr)
{
AmoebaNr[x][y] = 0;
Feld[x][y] = EL_AMOEBA2DIAM;
}
}
- Bang(ax,ay);
+ Bang(ax, ay);
}
else
{
- for(i=0;i<4;i++)
+ for (i=0; i<4; i++)
{
x = ax+xy[i%4][0];
y = ay+xy[i%4][1];
- if (!IN_LEV_FIELD(x,y))
+ if (!IN_LEV_FIELD(x, y))
continue;
- if (Feld[x][y]==EL_AMOEBA2DIAM)
- Bang(x,y);
+ if (Feld[x][y] == EL_AMOEBA2DIAM)
+ Bang(x, y);
}
}
}
void AmoebeUmwandeln2(int ax, int ay, int new_element)
{
- int x,y;
+ int x, y;
int group_nr = AmoebaNr[ax][ay];
boolean done = FALSE;
- for(y=0;y<lev_fieldy;y++) for(x=0;x<lev_fieldx;x++)
+ for (y=0; y<lev_fieldy; y++) for (x=0; x<lev_fieldx; x++)
{
- if (AmoebaNr[x][y]==group_nr &&
- (Feld[x][y]==EL_AMOEBE_TOT ||
- Feld[x][y]==EL_AMOEBE_BD ||
- Feld[x][y]==EL_AMOEBING))
+ if (AmoebaNr[x][y] == group_nr &&
+ (Feld[x][y] == EL_AMOEBE_TOT ||
+ Feld[x][y] == EL_AMOEBE_BD ||
+ Feld[x][y] == EL_AMOEBING))
{
AmoebaNr[x][y] = 0;
Feld[x][y] = new_element;
- DrawLevelField(x,y);
+ DrawLevelField(x, y);
done = TRUE;
}
}
if (done)
- PlaySoundLevel(ax,ay,new_element==EL_FELSBROCKEN ? SND_KLOPF : SND_PLING);
+ PlaySoundLevel(ax, ay,
+ (new_element == EL_FELSBROCKEN ? SND_KLOPF : SND_PLING));
}
void AmoebeWaechst(int x, int y)
if (DelayReached(&sound_delay, sound_delay_value))
{
- PlaySoundLevel(x,y,SND_AMOEBE);
+ PlaySoundLevel(x, y, SND_AMOEBE);
sound_delay_value = 30;
}
}
if (MovDelay[x][y]) /* neue Phase / in Wartezustand */
{
MovDelay[x][y]--;
- if (MovDelay[x][y]/2 && IN_SCR_FIELD(SCREENX(x),SCREENY(y)))
- DrawGraphic(SCREENX(x),SCREENY(y),GFX_AMOEBING+3-MovDelay[x][y]/2);
+ if (MovDelay[x][y]/2 && IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
+ DrawGraphic(SCREENX(x), SCREENY(y), GFX_AMOEBING+3-MovDelay[x][y]/2);
if (!MovDelay[x][y])
{
Feld[x][y] = Store[x][y];
Store[x][y] = 0;
- DrawLevelField(x,y);
+ DrawLevelField(x, y);
}
}
}
int newax = ax, neway = ay;
static int xy[4][2] =
{
- { 0,-1 },
- { -1,0 },
- { +1,0 },
- { 0,+1 }
+ { 0, -1 },
+ { -1, 0 },
+ { +1, 0 },
+ { 0, +1 }
};
if (!level.tempo_amoebe)
{
Feld[ax][ay] = EL_AMOEBE_TOT;
- DrawLevelField(ax,ay);
+ DrawLevelField(ax, ay);
return;
}
return;
}
- if (element==EL_AMOEBE_NASS) /* tropfende Amöbe */
+ if (element == EL_AMOEBE_NASS) /* tropfende Amöbe */
{
int start = RND(4);
int x = ax+xy[start][0];
int y = ay+xy[start][1];
- if (!IN_LEV_FIELD(x,y))
+ if (!IN_LEV_FIELD(x, y))
return;
- if (IS_FREE(x,y) ||
- Feld[x][y]==EL_ERDREICH || Feld[x][y]==EL_MORAST_LEER)
+ if (IS_FREE(x, y) ||
+ Feld[x][y] == EL_ERDREICH || Feld[x][y] == EL_MORAST_LEER)
{
newax = x;
neway = y;
}
- if (newax==ax && neway==ay)
+ if (newax == ax && neway == ay)
return;
}
else /* normale oder "gefüllte" Amöbe */
int start = RND(4);
boolean waiting_for_player = FALSE;
- for(i=0;i<4;i++)
+ for (i=0; i<4; i++)
{
int j = (start+i)%4;
int x = ax+xy[j][0];
int y = ay+xy[j][1];
- if (!IN_LEV_FIELD(x,y))
+ if (!IN_LEV_FIELD(x, y))
continue;
- if (IS_FREE(x,y) ||
- Feld[x][y]==EL_ERDREICH || Feld[x][y]==EL_MORAST_LEER)
+ if (IS_FREE(x, y) ||
+ Feld[x][y] == EL_ERDREICH || Feld[x][y] == EL_MORAST_LEER)
{
newax = x;
neway = y;
break;
}
- else if (IS_PLAYER(x,y))
+ else if (IS_PLAYER(x, y))
waiting_for_player = TRUE;
}
- if (newax==ax && neway==ay)
+ if (newax == ax && neway == ay)
{
- if (i==4 && !waiting_for_player)
+ if (i == 4 && !waiting_for_player)
{
Feld[ax][ay] = EL_AMOEBE_TOT;
- DrawLevelField(ax,ay);
+ DrawLevelField(ax, ay);
AmoebaCnt[AmoebaNr[ax][ay]]--;
if (AmoebaCnt[AmoebaNr[ax][ay]]<=0) /* Amöbe vollständig tot */
{
- if (element==EL_AMOEBE_VOLL)
- AmoebeUmwandeln(ax,ay);
- else if (element==EL_AMOEBE_BD)
- AmoebeUmwandeln2(ax,ay,level.amoebe_inhalt);
+ if (element == EL_AMOEBE_VOLL)
+ AmoebeUmwandeln(ax, ay);
+ else if (element == EL_AMOEBE_BD)
+ AmoebeUmwandeln2(ax, ay, level.amoebe_inhalt);
}
}
return;
}
- else if (element==EL_AMOEBE_VOLL || element==EL_AMOEBE_BD)
+ else if (element == EL_AMOEBE_VOLL || element == EL_AMOEBE_BD)
{
int new_group_nr = AmoebaNr[ax][ay];
AmoebaNr[newax][neway] = new_group_nr;
AmoebaCnt[new_group_nr]++;
AmoebaCnt2[new_group_nr]++;
- AmoebenVereinigen(newax,neway);
+ AmoebenVereinigen(newax, neway);
- if (AmoebaCnt2[new_group_nr] >= 200 && element==EL_AMOEBE_BD)
+ if (AmoebaCnt2[new_group_nr] >= 200 && element == EL_AMOEBE_BD)
{
- AmoebeUmwandeln2(newax,neway,EL_FELSBROCKEN);
+ AmoebeUmwandeln2(newax, neway, EL_FELSBROCKEN);
return;
}
}
}
- if (element!=EL_AMOEBE_NASS || neway<ay || !IS_FREE(newax,neway) ||
- (neway==lev_fieldy-1 && newax!=ax))
+ if (element!=EL_AMOEBE_NASS || neway<ay || !IS_FREE(newax, neway) ||
+ (neway == lev_fieldy-1 && newax!=ax))
{
Feld[newax][neway] = EL_AMOEBING;
Store[newax][neway] = element;
}
- else if (neway==ay)
+ else if (neway == ay)
Feld[newax][neway] = EL_TROPFEN;
else
{
- InitMovingField(ax,ay,MV_DOWN);
+ InitMovingField(ax, ay, MV_DOWN);
Feld[ax][ay] = EL_TROPFEN;
Store[ax][ay] = EL_AMOEBE_NASS;
- ContinueMoving(ax,ay);
+ ContinueMoving(ax, ay);
return;
}
- DrawLevelField(newax,neway);
+ DrawLevelField(newax, neway);
}
void Life(int ax, int ay)
{
- int x1,y1,x2,y2;
- static int life[4] = { 2,3,3,3 }; /* "Life"-Parameter */
+ int x1, y1, x2, y2;
+ static int life[4] = { 2, 3, 3, 3 }; /* "Life"-Parameter */
int life_time = 40;
int element = Feld[ax][ay];
return;
}
- for(y1=-1;y1<2;y1++) for(x1=-1;x1<2;x1++)
+ for (y1=-1; y1<2; y1++) for(x1=-1; x1<2; x1++)
{
int xx = ax+x1, yy = ay+y1;
int nachbarn = 0;
- if (!IN_LEV_FIELD(xx,yy))
+ if (!IN_LEV_FIELD(xx, yy))
continue;
- for(y2=-1;y2<2;y2++) for(x2=-1;x2<2;x2++)
+ for (y2=-1; y2<2; y2++) for (x2=-1; x2<2; x2++)
{
int x = xx+x2, y = yy+y2;
- if (!IN_LEV_FIELD(x,y) || (x==xx && y==yy))
+ if (!IN_LEV_FIELD(x, y) || (x == xx && y == yy))
continue;
- if (((Feld[x][y]==element || (element==EL_LIFE && IS_PLAYER(x,y))) &&
+ if (((Feld[x][y] == element ||
+ (element == EL_LIFE && IS_PLAYER(x, y))) &&
!Stop[x][y]) ||
- (IS_FREE(x,y) && Stop[x][y]))
+ (IS_FREE(x, y) && Stop[x][y]))
nachbarn++;
}
- if (xx==ax && yy==ay) /* mittleres Feld mit Amoebe */
+ if (xx == ax && yy == ay) /* mittleres Feld mit Amoebe */
{
if (nachbarn<life[0] || nachbarn>life[1])
{
Feld[xx][yy] = EL_LEERRAUM;
if (!Stop[xx][yy])
- DrawLevelField(xx,yy);
+ DrawLevelField(xx, yy);
Stop[xx][yy] = TRUE;
}
}
- else if (IS_FREE(xx,yy) || Feld[xx][yy]==EL_ERDREICH)
+ else if (IS_FREE(xx, yy) || Feld[xx][yy] == EL_ERDREICH)
{ /* Randfeld ohne Amoebe */
if (nachbarn>=life[2] && nachbarn<=life[3])
{
Feld[xx][yy] = element;
- MovDelay[xx][yy] = (element==EL_LIFE ? 0 : life_time-1);
+ MovDelay[xx][yy] = (element == EL_LIFE ? 0 : life_time-1);
if (!Stop[xx][yy])
- DrawLevelField(xx,yy);
+ DrawLevelField(xx, yy);
Stop[xx][yy] = TRUE;
}
}
MovDelay[x][y]--;
if (MovDelay[x][y])
{
- if (IN_SCR_FIELD(SCREENX(x),SCREENY(y)))
- DrawGraphic(SCREENX(x),SCREENY(y),GFX_ABLENK+MovDelay[x][y]%4);
+ if (IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
+ DrawGraphic(SCREENX(x), SCREENY(y), GFX_ABLENK+MovDelay[x][y]%4);
if (!(MovDelay[x][y]%4))
- PlaySoundLevel(x,y,SND_MIEP);
+ PlaySoundLevel(x, y, SND_MIEP);
return;
}
}
Feld[x][y] = EL_ABLENK_AUS;
- DrawLevelField(x,y);
- if (ZX==x && ZY==y)
+ DrawLevelField(x, y);
+ if (ZX == x && ZY == y)
ZX = ZY = -1;
}
Feld[x][y]=EL_ABLENK_EIN;
else
Feld[x][y]=EL_ABLENK_AUS;
- DrawLevelField(x,y);
+ DrawLevelField(x, y);
Feld[x][y]=EL_ABLENK_EIN;
}
return;
}
Feld[x][y]=EL_ABLENK_AUS;
- DrawLevelField(x,y);
- if (ZX==x && ZY==y)
+ DrawLevelField(x, y);
+ if (ZX == x && ZY == y)
ZX=ZY=-1;
}
void Blubber(int x, int y)
{
- if (y > 0 && IS_MOVING(x,y-1) && MovDir[x][y-1] == MV_DOWN)
- DrawLevelField(x,y-1);
+ if (y > 0 && IS_MOVING(x, y-1) && MovDir[x][y-1] == MV_DOWN)
+ DrawLevelField(x, y-1);
else
- DrawGraphicAnimation(x,y, GFX_GEBLUBBER, 4, 10, ANIM_NORMAL);
+ DrawGraphicAnimation(x, y, GFX_GEBLUBBER, 4, 10, ANIM_NORMAL);
}
void NussKnacken(int x, int y)
if (MovDelay[x][y]) /* neue Phase / in Wartezustand */
{
MovDelay[x][y]--;
- if (MovDelay[x][y]/2 && IN_SCR_FIELD(SCREENX(x),SCREENY(y)))
- DrawGraphic(SCREENX(x),SCREENY(y),GFX_CRACKINGNUT+3-MovDelay[x][y]/2);
+ if (MovDelay[x][y]/2 && IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
+ DrawGraphic(SCREENX(x), SCREENY(y), GFX_CRACKINGNUT+3-MovDelay[x][y]/2);
if (!MovDelay[x][y])
{
Feld[x][y] = EL_EDELSTEIN;
- DrawLevelField(x,y);
+ DrawLevelField(x, y);
}
}
}
void SiebAktivieren(int x, int y, int typ)
{
- if (!(SiebAktiv % 4) && IN_SCR_FIELD(SCREENX(x),SCREENY(y)))
- DrawGraphic(SCREENX(x),SCREENY(y),
- (typ==1 ? GFX_SIEB_VOLL : GFX_SIEB2_VOLL)+3-(SiebAktiv%16)/4);
+ if (!(SiebAktiv % 4) && IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
+ DrawGraphic(SCREENX(x), SCREENY(y),
+ (typ == 1 ? GFX_SIEB_VOLL :
+ GFX_SIEB2_VOLL) + 3 - (SiebAktiv % 16) / 4);
}
void AusgangstuerPruefen(int x, int y)
MovDelay[x][y]--;
tuer = MovDelay[x][y]/delay;
- if (!(MovDelay[x][y]%delay) && IN_SCR_FIELD(SCREENX(x),SCREENY(y)))
- DrawGraphic(SCREENX(x),SCREENY(y),GFX_AUSGANG_AUF-tuer);
+ if (!(MovDelay[x][y]%delay) && IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
+ DrawGraphic(SCREENX(x), SCREENY(y), GFX_AUSGANG_AUF-tuer);
if (!MovDelay[x][y])
{
Feld[x][y] = EL_AUSGANG_AUF;
- DrawLevelField(x,y);
+ DrawLevelField(x, y);
}
}
}
void AusgangstuerBlinken(int x, int y)
{
- DrawGraphicAnimation(x,y, GFX_AUSGANG_AUF, 4, 4, ANIM_OSCILLATE);
+ DrawGraphicAnimation(x, y, GFX_AUSGANG_AUF, 4, 4, ANIM_OSCILLATE);
}
void EdelsteinFunkeln(int x, int y)
{
- if (!IN_SCR_FIELD(SCREENX(x),SCREENY(y)) || IS_MOVING(x,y))
+ if (!IN_SCR_FIELD(SCREENX(x), SCREENY(y)) || IS_MOVING(x, y))
return;
if (Feld[x][y] == EL_EDELSTEIN_BD)
- DrawGraphicAnimation(x,y, GFX_EDELSTEIN_BD, 4, 4, ANIM_REVERSE);
+ DrawGraphicAnimation(x, y, GFX_EDELSTEIN_BD, 4, 4, ANIM_REVERSE);
else
{
if (!MovDelay[x][y]) /* neue Phase / noch nicht gewartet */
if (setup.direct_draw && MovDelay[x][y])
SetDrawtoField(DRAW_BUFFERED);
- DrawGraphic(SCREENX(x),SCREENY(y), el2gfx(Feld[x][y]));
+ DrawGraphic(SCREENX(x), SCREENY(y), el2gfx(Feld[x][y]));
if (MovDelay[x][y])
{
if (phase > 2)
phase = 4-phase;
- DrawGraphicThruMask(SCREENX(x),SCREENY(y), GFX_FUNKELN_WEISS + phase);
+ DrawGraphicThruMask(SCREENX(x), SCREENY(y), GFX_FUNKELN_WEISS + phase);
if (setup.direct_draw)
{
- int dest_x,dest_y;
+ int dest_x, dest_y;
dest_x = FX + SCREENX(x)*TILEX;
dest_y = FY + SCREENY(y)*TILEY;
- XCopyArea(display,drawto_field,window,gc,
- dest_x,dest_y, TILEX,TILEY, dest_x,dest_y);
+ XCopyArea(display, drawto_field, window, gc,
+ dest_x, dest_y, TILEX, TILEY, dest_x, dest_y);
SetDrawtoField(DRAW_DIRECT);
}
}
MovDelay[x][y]--;
phase = 2-MovDelay[x][y]/delay;
- if (!(MovDelay[x][y]%delay) && IN_SCR_FIELD(SCREENX(x),SCREENY(y)))
- DrawGraphic(SCREENX(x),SCREENY(y),
+ if (!(MovDelay[x][y]%delay) && IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
+ DrawGraphic(SCREENX(x), SCREENY(y),
(MovDir[x][y] == MV_LEFT ? GFX_MAUER_LEFT :
MovDir[x][y] == MV_RIGHT ? GFX_MAUER_RIGHT :
MovDir[x][y] == MV_UP ? GFX_MAUER_UP :
{
if (MovDir[x][y] == MV_LEFT)
{
- if (IN_LEV_FIELD(x-1,y) && IS_MAUER(Feld[x-1][y]))
- DrawLevelField(x-1,y);
+ if (IN_LEV_FIELD(x-1, y) && IS_MAUER(Feld[x-1][y]))
+ DrawLevelField(x-1, y);
}
else if (MovDir[x][y] == MV_RIGHT)
{
- if (IN_LEV_FIELD(x+1,y) && IS_MAUER(Feld[x+1][y]))
- DrawLevelField(x+1,y);
+ if (IN_LEV_FIELD(x+1, y) && IS_MAUER(Feld[x+1][y]))
+ DrawLevelField(x+1, y);
}
else if (MovDir[x][y] == MV_UP)
{
- if (IN_LEV_FIELD(x,y-1) && IS_MAUER(Feld[x][y-1]))
- DrawLevelField(x,y-1);
+ if (IN_LEV_FIELD(x, y-1) && IS_MAUER(Feld[x][y-1]))
+ DrawLevelField(x, y-1);
}
else
{
- if (IN_LEV_FIELD(x,y+1) && IS_MAUER(Feld[x][y+1]))
- DrawLevelField(x,y+1);
+ if (IN_LEV_FIELD(x, y+1) && IS_MAUER(Feld[x][y+1]))
+ DrawLevelField(x, y+1);
}
Feld[x][y] = Store[x][y];
Store[x][y] = 0;
MovDir[x][y] = MV_NO_MOVING;
- DrawLevelField(x,y);
+ DrawLevelField(x, y);
}
}
}
return;
}
- if (IN_LEV_FIELD(ax,ay-1) && IS_FREE(ax,ay-1))
+ if (IN_LEV_FIELD(ax, ay-1) && IS_FREE(ax, ay-1))
oben_frei = TRUE;
- if (IN_LEV_FIELD(ax,ay+1) && IS_FREE(ax,ay+1))
+ if (IN_LEV_FIELD(ax, ay+1) && IS_FREE(ax, ay+1))
unten_frei = TRUE;
- if (IN_LEV_FIELD(ax-1,ay) && IS_FREE(ax-1,ay))
+ if (IN_LEV_FIELD(ax-1, ay) && IS_FREE(ax-1, ay))
links_frei = TRUE;
- if (IN_LEV_FIELD(ax+1,ay) && IS_FREE(ax+1,ay))
+ if (IN_LEV_FIELD(ax+1, ay) && IS_FREE(ax+1, ay))
rechts_frei = TRUE;
if (element == EL_MAUER_Y || element == EL_MAUER_XY)
Feld[ax][ay-1] = EL_MAUERND;
Store[ax][ay-1] = element;
MovDir[ax][ay-1] = MV_UP;
- if (IN_SCR_FIELD(SCREENX(ax),SCREENY(ay-1)))
- DrawGraphic(SCREENX(ax),SCREENY(ay-1),GFX_MAUER_UP);
+ if (IN_SCR_FIELD(SCREENX(ax), SCREENY(ay-1)))
+ DrawGraphic(SCREENX(ax), SCREENY(ay-1), GFX_MAUER_UP);
}
if (unten_frei)
{
Feld[ax][ay+1] = EL_MAUERND;
Store[ax][ay+1] = element;
MovDir[ax][ay+1] = MV_DOWN;
- if (IN_SCR_FIELD(SCREENX(ax),SCREENY(ay+1)))
- DrawGraphic(SCREENX(ax),SCREENY(ay+1),GFX_MAUER_DOWN);
+ if (IN_SCR_FIELD(SCREENX(ax), SCREENY(ay+1)))
+ DrawGraphic(SCREENX(ax), SCREENY(ay+1), GFX_MAUER_DOWN);
}
}
Feld[ax-1][ay] = EL_MAUERND;
Store[ax-1][ay] = element;
MovDir[ax-1][ay] = MV_LEFT;
- if (IN_SCR_FIELD(SCREENX(ax-1),SCREENY(ay)))
- DrawGraphic(SCREENX(ax-1),SCREENY(ay),GFX_MAUER_LEFT);
+ if (IN_SCR_FIELD(SCREENX(ax-1), SCREENY(ay)))
+ DrawGraphic(SCREENX(ax-1), SCREENY(ay), GFX_MAUER_LEFT);
}
if (rechts_frei)
{
Feld[ax+1][ay] = EL_MAUERND;
Store[ax+1][ay] = element;
MovDir[ax+1][ay] = MV_RIGHT;
- if (IN_SCR_FIELD(SCREENX(ax+1),SCREENY(ay)))
- DrawGraphic(SCREENX(ax+1),SCREENY(ay),GFX_MAUER_RIGHT);
+ if (IN_SCR_FIELD(SCREENX(ax+1), SCREENY(ay)))
+ DrawGraphic(SCREENX(ax+1), SCREENY(ay), GFX_MAUER_RIGHT);
}
}
if (element == EL_MAUER_LEBT && (links_frei || rechts_frei))
- DrawLevelField(ax,ay);
+ DrawLevelField(ax, ay);
- if (!IN_LEV_FIELD(ax,ay-1) || IS_MAUER(Feld[ax][ay-1]))
+ if (!IN_LEV_FIELD(ax, ay-1) || IS_MAUER(Feld[ax][ay-1]))
oben_massiv = TRUE;
- if (!IN_LEV_FIELD(ax,ay+1) || IS_MAUER(Feld[ax][ay+1]))
+ if (!IN_LEV_FIELD(ax, ay+1) || IS_MAUER(Feld[ax][ay+1]))
unten_massiv = TRUE;
- if (!IN_LEV_FIELD(ax-1,ay) || IS_MAUER(Feld[ax-1][ay]))
+ if (!IN_LEV_FIELD(ax-1, ay) || IS_MAUER(Feld[ax-1][ay]))
links_massiv = TRUE;
- if (!IN_LEV_FIELD(ax+1,ay) || IS_MAUER(Feld[ax+1][ay]))
+ if (!IN_LEV_FIELD(ax+1, ay) || IS_MAUER(Feld[ax+1][ay]))
rechts_massiv = TRUE;
if (((oben_massiv && unten_massiv) ||
void CheckForDragon(int x, int y)
{
- int i,j;
+ int i, j;
boolean dragon_found = FALSE;
static int xy[4][2] =
{
- { 0,-1 },
- { -1,0 },
- { +1,0 },
- { 0,+1 }
+ { 0, -1 },
+ { -1, 0 },
+ { +1, 0 },
+ { 0, +1 }
};
- for(i=0;i<4;i++)
+ for (i=0; i<4; i++)
{
- for(j=0;j<4;j++)
+ for (j=0; j<4; j++)
{
int xx = x + j*xy[i][0], yy = y + j*xy[i][1];
- if (IN_LEV_FIELD(xx,yy) &&
+ if (IN_LEV_FIELD(xx, yy) &&
(Feld[xx][yy] == EL_BURNING || Feld[xx][yy] == EL_DRACHE))
{
if (Feld[xx][yy] == EL_DRACHE)
if (!dragon_found)
{
- for(i=0;i<4;i++)
+ for (i=0; i<4; i++)
{
- for(j=0;j<3;j++)
+ for (j=0; j<3; j++)
{
int xx = x + j*xy[i][0], yy = y + j*xy[i][1];
- if (IN_LEV_FIELD(xx,yy) && Feld[xx][yy] == EL_BURNING)
+ if (IN_LEV_FIELD(xx, yy) && Feld[xx][yy] == EL_BURNING)
{
Feld[xx][yy] = EL_LEERRAUM;
- DrawLevelField(xx,yy);
+ DrawLevelField(xx, yy);
}
else
break;
player->frame_reset_delay = 0;
if (button1)
- snapped = SnapField(player, dx,dy);
+ snapped = SnapField(player, dx, dy);
else
{
if (button2)
bombed = PlaceBomb(player);
- moved = MoveFigure(player, dx,dy);
+ moved = MoveFigure(player, dx, dy);
}
if (tape.recording && (moved || snapped || bombed))
}
else if (tape.playing && snapped)
- SnapField(player, 0,0); /* stop snapping */
+ SnapField(player, 0, 0); /* stop snapping */
}
else
{
- DigField(player, 0,0, 0,0, DF_NO_PUSH);
- SnapField(player, 0,0);
+ DigField(player, 0, 0, 0, 0, DF_NO_PUSH);
+ SnapField(player, 0, 0);
if (++player->frame_reset_delay > MoveSpeed)
player->Frame = 0;
}
{
int dx = (next_joy == JOY_LEFT ? -1 : +1);
- if (IN_LEV_FIELD(jx+dx,jy) && IS_PUSHABLE(Feld[jx+dx][jy]))
+ if (IN_LEV_FIELD(jx+dx, jy) && IS_PUSHABLE(Feld[jx+dx][jy]))
{
int el = Feld[jx+dx][jy];
- int push_delay = (IS_SB_ELEMENT(el) || el==EL_SONDE ? 2 : 10);
+ int push_delay = (IS_SB_ELEMENT(el) || el == EL_SONDE ? 2 : 10);
if (tape.delay_played + push_delay >= tape.pos[tape.counter].delay)
{
static long action_delay = 0;
long action_delay_value;
int sieb_x = 0, sieb_y = 0;
- int i, x,y, element;
+ int i, x, y, element;
byte *recorded_player_action;
byte summarized_player_action = 0;
recorded_player_action = (tape.playing ? TapePlayAction() : NULL);
- for(i=0; i<MAX_PLAYERS; i++)
+ for (i=0; i<MAX_PLAYERS; i++)
{
summarized_player_action |= stored_player[i].action;
if (!options.network && !setup.team_mode)
local_player->effective_action = summarized_player_action;
- for(i=0; i<MAX_PLAYERS; i++)
+ for (i=0; i<MAX_PLAYERS; i++)
{
int actual_player_action = stored_player[i].effective_action;
*/
+
+
+
+#ifdef DEBUG
+ if (TimeFrames == 0 && !local_player->gone)
+ {
+ extern unsigned int last_RND();
+
+ printf("DEBUG: %03d last RND was %d \t [state checksum is %d]\n",
+ level.time - TimeLeft,
+ last_RND(),
+ getStateCheckSum(level.time - TimeLeft));
+ }
+#endif
+
+
+
+#ifdef DEBUG
+ if (GameFrameDelay >= 500)
+ printf("FrameCounter == %d\n", FrameCounter);
+#endif
+
+
+
+
+
FrameCounter++;
TimeFrames++;
- for(y=0;y<lev_fieldy;y++) for(x=0;x<lev_fieldx;x++)
+ for (y=0; y<lev_fieldy; y++) for (x=0; x<lev_fieldx; x++)
{
Stop[x][y] = FALSE;
if (JustHit[x][y]>0)
JustHit[x][y]--;
#if DEBUG
- if (IS_BLOCKED(x,y))
+ if (IS_BLOCKED(x, y))
{
- int oldx,oldy;
+ int oldx, oldy;
- Blocked2Moving(x,y,&oldx,&oldy);
- if (!IS_MOVING(oldx,oldy))
+ Blocked2Moving(x, y, &oldx, &oldy);
+ if (!IS_MOVING(oldx, oldy))
{
printf("GameActions(): (BLOCKED=>MOVING) context corrupted!\n");
- printf("GameActions(): BLOCKED: x = %d, y = %d\n",x,y);
- printf("GameActions(): !MOVING: oldx = %d, oldy = %d\n",oldx,oldy);
+ printf("GameActions(): BLOCKED: x = %d, y = %d\n", x, y);
+ printf("GameActions(): !MOVING: oldx = %d, oldy = %d\n", oldx, oldy);
printf("GameActions(): This should never happen!\n");
}
}
#endif
}
- for(y=0;y<lev_fieldy;y++) for(x=0;x<lev_fieldx;x++)
+ for (y=0; y<lev_fieldy; y++) for (x=0; x<lev_fieldx; x++)
{
element = Feld[x][y];
if (IS_INACTIVE(element))
continue;
- if (!IS_MOVING(x,y) && (CAN_FALL(element) || CAN_MOVE(element)))
+ if (!IS_MOVING(x, y) && (CAN_FALL(element) || CAN_MOVE(element)))
{
- StartMoving(x,y);
+ StartMoving(x, y);
if (IS_GEM(element))
- EdelsteinFunkeln(x,y);
+ EdelsteinFunkeln(x, y);
}
- else if (IS_MOVING(x,y))
- ContinueMoving(x,y);
- else if (element==EL_DYNAMIT || element==EL_DYNABOMB)
- CheckDynamite(x,y);
- else if (element==EL_EXPLODING)
- Explode(x,y,Frame[x][y],EX_NORMAL);
- else if (element==EL_AMOEBING)
- AmoebeWaechst(x,y);
+ else if (IS_MOVING(x, y))
+ ContinueMoving(x, y);
+ else if (element == EL_DYNAMIT || element == EL_DYNABOMB)
+ CheckDynamite(x, y);
+ else if (element == EL_EXPLODING)
+ Explode(x, y, Frame[x][y], EX_NORMAL);
+ else if (element == EL_AMOEBING)
+ AmoebeWaechst(x, y);
else if (IS_AMOEBALIVE(element))
- AmoebeAbleger(x,y);
- else if (element==EL_LIFE || element==EL_LIFE_ASYNC)
- Life(x,y);
- else if (element==EL_ABLENK_EIN)
- Ablenk(x,y);
- else if (element==EL_SALZSAEURE)
- Blubber(x,y);
- else if (element==EL_BLURB_LEFT || element==EL_BLURB_RIGHT)
- Blurb(x,y);
- else if (element==EL_CRACKINGNUT)
- NussKnacken(x,y);
- else if (element==EL_AUSGANG_ZU)
- AusgangstuerPruefen(x,y);
- else if (element==EL_AUSGANG_ACT)
- AusgangstuerOeffnen(x,y);
- else if (element==EL_AUSGANG_AUF)
- AusgangstuerBlinken(x,y);
- else if (element==EL_MAUERND)
- MauerWaechst(x,y);
- else if (element==EL_MAUER_LEBT ||
- element==EL_MAUER_X ||
- element==EL_MAUER_Y ||
- element==EL_MAUER_XY)
- MauerAbleger(x,y);
- else if (element==EL_BURNING)
- CheckForDragon(x,y);
+ AmoebeAbleger(x, y);
+ else if (element == EL_LIFE || element == EL_LIFE_ASYNC)
+ Life(x, y);
+ else if (element == EL_ABLENK_EIN)
+ Ablenk(x, y);
+ else if (element == EL_SALZSAEURE)
+ Blubber(x, y);
+ else if (element == EL_BLURB_LEFT || element == EL_BLURB_RIGHT)
+ Blurb(x, y);
+ else if (element == EL_CRACKINGNUT)
+ NussKnacken(x, y);
+ else if (element == EL_AUSGANG_ZU)
+ AusgangstuerPruefen(x, y);
+ else if (element == EL_AUSGANG_ACT)
+ AusgangstuerOeffnen(x, y);
+ else if (element == EL_AUSGANG_AUF)
+ AusgangstuerBlinken(x, y);
+ else if (element == EL_MAUERND)
+ MauerWaechst(x, y);
+ else if (element == EL_MAUER_LEBT ||
+ element == EL_MAUER_X ||
+ element == EL_MAUER_Y ||
+ element == EL_MAUER_XY)
+ MauerAbleger(x, y);
+ else if (element == EL_BURNING)
+ CheckForDragon(x, y);
if (SiebAktiv)
{
boolean sieb = FALSE;
int jx = local_player->jx, jy = local_player->jy;
- if (element==EL_SIEB_LEER || element==EL_SIEB_VOLL ||
- Store[x][y]==EL_SIEB_LEER)
+ if (element == EL_SIEB_LEER || element == EL_SIEB_VOLL ||
+ Store[x][y] == EL_SIEB_LEER)
{
SiebAktivieren(x, y, 1);
sieb = TRUE;
}
- else if (element==EL_SIEB2_LEER || element==EL_SIEB2_VOLL ||
- Store[x][y]==EL_SIEB2_LEER)
+ else if (element == EL_SIEB2_LEER || element == EL_SIEB2_VOLL ||
+ Store[x][y] == EL_SIEB2_LEER)
{
SiebAktivieren(x, y, 2);
sieb = TRUE;
if (SiebAktiv)
{
if (!(SiebAktiv%4))
- PlaySoundLevel(sieb_x,sieb_y,SND_MIEP);
+ PlaySoundLevel(sieb_x, sieb_y, SND_MIEP);
SiebAktiv--;
if (!SiebAktiv)
{
- for(y=0;y<lev_fieldy;y++) for(x=0;x<lev_fieldx;x++)
+ for (y=0; y<lev_fieldy; y++) for (x=0; x<lev_fieldx; x++)
{
element = Feld[x][y];
- if (element==EL_SIEB_LEER || element==EL_SIEB_VOLL)
+ if (element == EL_SIEB_LEER || element == EL_SIEB_VOLL)
{
Feld[x][y] = EL_SIEB_TOT;
- DrawLevelField(x,y);
+ DrawLevelField(x, y);
}
- else if (element==EL_SIEB2_LEER || element==EL_SIEB2_VOLL)
+ else if (element == EL_SIEB2_LEER || element == EL_SIEB2_VOLL)
{
Feld[x][y] = EL_SIEB2_TOT;
- DrawLevelField(x,y);
+ DrawLevelField(x, y);
}
}
}
TimeLeft--;
if (tape.recording || tape.playing)
- DrawVideoDisplay(VIDEO_STATE_TIME_ON,level.time-TimeLeft);
+ DrawVideoDisplay(VIDEO_STATE_TIME_ON, level.time-TimeLeft);
if (TimeLeft<=10)
- PlaySoundStereo(SND_GONG,PSND_MAX_RIGHT);
+ PlaySoundStereo(SND_GONG, PSND_MAX_RIGHT);
- DrawText(DX_TIME,DY_TIME,int2str(TimeLeft,3),FS_SMALL,FC_YELLOW);
+ DrawText(DX_TIME, DY_TIME, int2str(TimeLeft, 3), FS_SMALL, FC_YELLOW);
if (!TimeLeft)
- for(i=0; i<MAX_PLAYERS; i++)
+ for (i=0; i<MAX_PLAYERS; i++)
KillHero(&stored_player[i]);
}
int min_x = x, min_y = y, max_x = x, max_y = y;
int i;
- for(i=0; i<MAX_PLAYERS; i++)
+ for (i=0; i<MAX_PLAYERS; i++)
{
int jx = stored_player[i].jx, jy = stored_player[i].jy;
max_y = MAX(max_y, jy);
}
- return(max_x - min_x < SCR_FIELDX && max_y - min_y < SCR_FIELDY);
+ return (max_x - min_x < SCR_FIELDX && max_y - min_y < SCR_FIELDY);
}
static boolean AllPlayersInVisibleScreen()
{
int i;
- for(i=0; i<MAX_PLAYERS; i++)
+ for (i=0; i<MAX_PLAYERS; i++)
{
int jx = stored_player[i].jx, jy = stored_player[i].jy;
continue;
if (!IN_VIS_FIELD(SCREENX(jx), SCREENY(jy)))
- return(FALSE);
+ return FALSE;
}
- return(TRUE);
+ return TRUE;
}
void ScrollLevel(int dx, int dy)
{
int softscroll_offset = (setup.soft_scrolling ? TILEX : 0);
- int x,y;
+ int x, y;
- XCopyArea(display,drawto_field,drawto_field,gc,
- FX + TILEX*(dx==-1) - softscroll_offset,
- FY + TILEY*(dy==-1) - softscroll_offset,
+ XCopyArea(display, drawto_field, drawto_field, gc,
+ FX + TILEX*(dx == -1) - softscroll_offset,
+ FY + TILEY*(dy == -1) - softscroll_offset,
SXSIZE - TILEX*(dx!=0) + 2*softscroll_offset,
SYSIZE - TILEY*(dy!=0) + 2*softscroll_offset,
- FX + TILEX*(dx==1) - softscroll_offset,
- FY + TILEY*(dy==1) - softscroll_offset);
+ FX + TILEX*(dx == 1) - softscroll_offset,
+ FY + TILEY*(dy == 1) - softscroll_offset);
if (dx)
{
- x = (dx==1 ? BX1 : BX2);
- for(y=BY1; y<=BY2; y++)
- DrawScreenField(x,y);
+ x = (dx == 1 ? BX1 : BX2);
+ for (y=BY1; y<=BY2; y++)
+ DrawScreenField(x, y);
}
if (dy)
{
- y = (dy==1 ? BY1 : BY2);
- for(x=BX1; x<=BX2; x++)
- DrawScreenField(x,y);
+ y = (dy == 1 ? BY1 : BY2);
+ for (x=BX1; x<=BX2; x++)
+ DrawScreenField(x, y);
}
redraw_mask |= REDRAW_FIELD;
int can_move;
if (player->gone || (!dx && !dy))
- return(MF_NO_ACTION);
+ return MF_NO_ACTION;
player->MovDir = (dx < 0 ? MV_LEFT :
dx > 0 ? MV_RIGHT :
dy < 0 ? MV_UP :
dy > 0 ? MV_DOWN : MV_NO_MOVING);
- if (!IN_LEV_FIELD(new_jx,new_jy))
- return(MF_NO_ACTION);
+ if (!IN_LEV_FIELD(new_jx, new_jy))
+ return MF_NO_ACTION;
- if (!options.network && !AllPlayersInSight(player, new_jx,new_jy))
- return(MF_NO_ACTION);
+ if (!options.network && !AllPlayersInSight(player, new_jx, new_jy))
+ return MF_NO_ACTION;
- element = MovingOrBlocked2Element(new_jx,new_jy);
+ element = MovingOrBlocked2Element(new_jx, new_jy);
if (DONT_GO_TO(element))
{
- if (element==EL_SALZSAEURE && dx==0 && dy==1)
+ if (element == EL_SALZSAEURE && dx == 0 && dy == 1)
{
- Blurb(jx,jy);
+ Blurb(jx, jy);
Feld[jx][jy] = EL_SPIELFIGUR;
- InitMovingField(jx,jy,MV_DOWN);
+ InitMovingField(jx, jy, MV_DOWN);
Store[jx][jy] = EL_SALZSAEURE;
- ContinueMoving(jx,jy);
+ ContinueMoving(jx, jy);
BuryHero(player);
}
else
KillHero(player);
- return(MF_MOVING);
+ return MF_MOVING;
}
- can_move = DigField(player, new_jx,new_jy, real_dx,real_dy, DF_DIG);
+ can_move = DigField(player, new_jx, new_jy, real_dx, real_dy, DF_DIG);
if (can_move != MF_MOVING)
- return(can_move);
+ return can_move;
StorePlayer[jx][jy] = 0;
player->last_jx = jx;
ScrollFigure(player, SCROLL_INIT);
- return(MF_MOVING);
+ return MF_MOVING;
}
boolean MoveFigure(struct PlayerInfo *player, int dx, int dy)
int moved = MF_NO_ACTION;
if (player->gone || (!dx && !dy))
- return(FALSE);
+ return FALSE;
- if (!FrameReached(&player->move_delay,MoveSpeed) && !tape.playing)
- return(FALSE);
+ if (!FrameReached(&player->move_delay, MoveSpeed) && !tape.playing)
+ return FALSE;
if (player->MovPos)
{
if (player->last_move_dir & (MV_LEFT | MV_RIGHT))
{
- if (!(moved |= MoveFigureOneStep(player, 0,dy, dx,dy)))
- moved |= MoveFigureOneStep(player, dx,0, dx,dy);
+ if (!(moved |= MoveFigureOneStep(player, 0, dy, dx, dy)))
+ moved |= MoveFigureOneStep(player, dx, 0, dx, dy);
}
else
{
- if (!(moved |= MoveFigureOneStep(player, dx,0, dx,dy)))
- moved |= MoveFigureOneStep(player, 0,dy, dx,dy);
+ if (!(moved |= MoveFigureOneStep(player, dx, 0, dx, dy)))
+ moved |= MoveFigureOneStep(player, 0, dy, dx, dy);
}
jx = player->jx;
int old_scroll_x = scroll_x, old_scroll_y = scroll_y;
int offset = (setup.scroll_delay ? 3 : 0);
- if (!IN_VIS_FIELD(SCREENX(jx),SCREENY(jy)))
+ if (!IN_VIS_FIELD(SCREENX(jx), SCREENY(jy)))
{
/* actual player has left the screen -- scroll in that direction */
if (jx != old_jx) /* player has moved horizontally */
else if (old_jx == jx && old_jy != jy)
player->MovDir = (old_jy < jy ? MV_DOWN : MV_UP);
- DrawLevelField(jx,jy); /* für "ErdreichAnbroeckeln()" */
+ DrawLevelField(jx, jy); /* für "ErdreichAnbroeckeln()" */
player->last_move_dir = player->MovDir;
}
else
player->last_move_dir = MV_NO_MOVING;
- TestIfHeroHitsBadThing(jx,jy);
+ TestIfHeroHitsBadThing(jx, jy);
if (player->gone)
RemoveHero(player);
- return(moved);
+ return moved;
}
void ScrollFigure(struct PlayerInfo *player, int mode)
DrawPlayer(player);
return;
}
- else if (!FrameReached(&player->actual_frame_counter,1))
+ else if (!FrameReached(&player->actual_frame_counter, 1))
return;
player->MovPos += (player->MovPos > 0 ? -1 : 1) * TILEX/8;
ScreenGfxPos = ScrollStepSize * (ScreenMovPos / ScrollStepSize);
return;
}
- else if (!FrameReached(&screen_frame_counter,1))
+ else if (!FrameReached(&screen_frame_counter, 1))
return;
if (ScreenMovPos)
int i, killx = goodx, killy = goody;
static int xy[4][2] =
{
- { 0,-1 },
- { -1,0 },
- { +1,0 },
- { 0,+1 }
+ { 0, -1 },
+ { -1, 0 },
+ { +1, 0 },
+ { 0, +1 }
};
static int harmless[4] =
{
MV_DOWN
};
- for(i=0; i<4; i++)
+ for (i=0; i<4; i++)
{
- int x,y, element;
+ int x, y, element;
x = goodx + xy[i][0];
y = goody + xy[i][1];
- if (!IN_LEV_FIELD(x,y))
+ if (!IN_LEV_FIELD(x, y))
continue;
element = Feld[x][y];
if (killx != goodx || killy != goody)
{
- if (IS_PLAYER(goodx,goody))
- KillHero(PLAYERINFO(goodx,goody));
+ if (IS_PLAYER(goodx, goody))
+ KillHero(PLAYERINFO(goodx, goody));
else
- Bang(goodx,goody);
+ Bang(goodx, goody);
}
}
int i, killx = badx, killy = bady;
static int xy[4][2] =
{
- { 0,-1 },
- { -1,0 },
- { +1,0 },
- { 0,+1 }
+ { 0, -1 },
+ { -1, 0 },
+ { +1, 0 },
+ { 0, +1 }
};
static int harmless[4] =
{
MV_DOWN
};
- for(i=0; i<4; i++)
+ for (i=0; i<4; i++)
{
- int x,y, element;
+ int x, y, element;
x = badx + xy[i][0];
y = bady + xy[i][1];
- if (!IN_LEV_FIELD(x,y))
+ if (!IN_LEV_FIELD(x, y))
continue;
element = Feld[x][y];
- if (IS_PLAYER(x,y))
+ if (IS_PLAYER(x, y))
{
killx = x;
killy = y;
}
else if (element == EL_PINGUIN)
{
- if (MovDir[x][y] == harmless[i] && IS_MOVING(x,y))
+ if (MovDir[x][y] == harmless[i] && IS_MOVING(x, y))
continue;
killx = x;
if (killx != badx || killy != bady)
{
- if (IS_PLAYER(killx,killy))
- KillHero(PLAYERINFO(killx,killy));
+ if (IS_PLAYER(killx, killy))
+ KillHero(PLAYERINFO(killx, killy));
else
- Bang(killx,killy);
+ Bang(killx, killy);
}
}
void TestIfHeroHitsBadThing(int x, int y)
{
- TestIfGoodThingHitsBadThing(x,y);
+ TestIfGoodThingHitsBadThing(x, y);
}
void TestIfBadThingHitsHero(int x, int y)
{
- TestIfBadThingHitsGoodThing(x,y);
+ TestIfBadThingHitsGoodThing(x, y);
}
void TestIfFriendHitsBadThing(int x, int y)
{
- TestIfGoodThingHitsBadThing(x,y);
+ TestIfGoodThingHitsBadThing(x, y);
}
void TestIfBadThingHitsFriend(int x, int y)
{
- TestIfBadThingHitsGoodThing(x,y);
+ TestIfBadThingHitsGoodThing(x, y);
}
void TestIfBadThingHitsOtherBadThing(int badx, int bady)
int i, killx = badx, killy = bady;
static int xy[4][2] =
{
- { 0,-1 },
- { -1,0 },
- { +1,0 },
- { 0,+1 }
+ { 0, -1 },
+ { -1, 0 },
+ { +1, 0 },
+ { 0, +1 }
};
- for(i=0; i<4; i++)
+ for (i=0; i<4; i++)
{
- int x,y, element;
+ int x, y, element;
x=badx + xy[i][0];
y=bady + xy[i][1];
- if (!IN_LEV_FIELD(x,y))
+ if (!IN_LEV_FIELD(x, y))
continue;
element = Feld[x][y];
}
if (killx != badx || killy != bady)
- Bang(badx,bady);
+ Bang(badx, bady);
}
void KillHero(struct PlayerInfo *player)
if (IS_PFORTE(Feld[jx][jy]))
Feld[jx][jy] = EL_LEERRAUM;
- Bang(jx,jy);
+ Bang(jx, jy);
BuryHero(player);
}
if (player->gone)
return;
- PlaySoundLevel(jx,jy, SND_AUTSCH);
- PlaySoundLevel(jx,jy, SND_LACHEN);
+ PlaySoundLevel(jx, jy, SND_AUTSCH);
+ PlaySoundLevel(jx, jy, SND_LACHEN);
player->GameOver = TRUE;
RemoveHero(player);
player->gone = TRUE;
StorePlayer[jx][jy] = 0;
- for(i=0; i<MAX_PLAYERS; i++)
+ for (i=0; i<MAX_PLAYERS; i++)
if (stored_player[i].active && !stored_player[i].gone)
found = TRUE;
if (mode == DF_NO_PUSH)
{
player->push_delay = 0;
- return(MF_NO_ACTION);
+ return MF_NO_ACTION;
}
- if (IS_MOVING(x,y) || IS_PLAYER(x,y))
- return(MF_NO_ACTION);
+ if (IS_MOVING(x, y) || IS_PLAYER(x, y))
+ return MF_NO_ACTION;
element = Feld[x][y];
case EL_EDELSTEIN_ROT:
case EL_EDELSTEIN_LILA:
case EL_DIAMANT:
- RemoveField(x,y);
+ RemoveField(x, y);
local_player->gems_still_needed -= (element == EL_DIAMANT ? 3 : 1);
if (local_player->gems_still_needed < 0)
local_player->gems_still_needed = 0;
break;
case EL_DYNAMIT_AUS:
- RemoveField(x,y);
+ RemoveField(x, y);
player->dynamite++;
RaiseScoreElement(EL_DYNAMIT);
DrawText(DX_DYNAMITE, DY_DYNAMITE,
int2str(local_player->dynamite, 3),
FS_SMALL, FC_YELLOW);
- PlaySoundLevel(x,y,SND_PONG);
+ PlaySoundLevel(x, y, SND_PONG);
break;
case EL_DYNABOMB_NR:
- RemoveField(x,y);
+ RemoveField(x, y);
player->dynabomb_count++;
player->dynabombs_left++;
RaiseScoreElement(EL_DYNAMIT);
- PlaySoundLevel(x,y,SND_PONG);
+ PlaySoundLevel(x, y, SND_PONG);
break;
case EL_DYNABOMB_SZ:
- RemoveField(x,y);
+ RemoveField(x, y);
player->dynabomb_size++;
RaiseScoreElement(EL_DYNAMIT);
- PlaySoundLevel(x,y,SND_PONG);
+ PlaySoundLevel(x, y, SND_PONG);
break;
case EL_DYNABOMB_XL:
- RemoveField(x,y);
+ RemoveField(x, y);
player->dynabomb_xl = TRUE;
RaiseScoreElement(EL_DYNAMIT);
- PlaySoundLevel(x,y,SND_PONG);
+ PlaySoundLevel(x, y, SND_PONG);
break;
case EL_SCHLUESSEL1:
{
int key_nr = element-EL_SCHLUESSEL1;
- RemoveField(x,y);
+ RemoveField(x, y);
player->key[key_nr] = TRUE;
RaiseScoreElement(EL_SCHLUESSEL);
- DrawMiniGraphicExt(drawto,gc,
- DX_KEYS+key_nr*MINI_TILEX,DY_KEYS,
+ DrawMiniGraphicExt(drawto, gc,
+ DX_KEYS+key_nr*MINI_TILEX, DY_KEYS,
GFX_SCHLUESSEL1+key_nr);
- DrawMiniGraphicExt(window,gc,
- DX_KEYS+key_nr*MINI_TILEX,DY_KEYS,
+ DrawMiniGraphicExt(window, gc,
+ DX_KEYS+key_nr*MINI_TILEX, DY_KEYS,
GFX_SCHLUESSEL1+key_nr);
- PlaySoundLevel(x,y,SND_PONG);
+ PlaySoundLevel(x, y, SND_PONG);
break;
}
Feld[x][y] = EL_ABLENK_EIN;
ZX = x;
ZY = y;
- DrawLevelField(x,y);
- return(MF_ACTION);
+ DrawLevelField(x, y);
+ return MF_ACTION;
break;
case EL_FELSBROCKEN:
case EL_BOMBE:
case EL_KOKOSNUSS:
case EL_ZEIT_LEER:
- if (dy || mode==DF_SNAP)
- return(MF_NO_ACTION);
+ if (dy || mode == DF_SNAP)
+ return MF_NO_ACTION;
player->Pushing = TRUE;
- if (!IN_LEV_FIELD(x+dx,y+dy) || !IS_FREE(x+dx,y+dy))
- return(MF_NO_ACTION);
+ if (!IN_LEV_FIELD(x+dx, y+dy) || !IS_FREE(x+dx, y+dy))
+ return MF_NO_ACTION;
if (real_dy)
{
- if (IN_LEV_FIELD(jx,jy+real_dy) && !IS_SOLID(Feld[jx][jy+real_dy]))
- return(MF_NO_ACTION);
+ if (IN_LEV_FIELD(jx, jy+real_dy) && !IS_SOLID(Feld[jx][jy+real_dy]))
+ return MF_NO_ACTION;
}
if (player->push_delay == 0)
player->push_delay = FrameCounter;
if (!FrameReached(&player->push_delay, player->push_delay_value) &&
!tape.playing)
- return(MF_NO_ACTION);
+ return MF_NO_ACTION;
- RemoveField(x,y);
+ RemoveField(x, y);
Feld[x+dx][y+dy] = element;
player->push_delay_value = 2+RND(8);
- DrawLevelField(x+dx,y+dy);
- if (element==EL_FELSBROCKEN)
- PlaySoundLevel(x+dx,y+dy,SND_PUSCH);
- else if (element==EL_KOKOSNUSS)
- PlaySoundLevel(x+dx,y+dy,SND_KNURK);
+ DrawLevelField(x+dx, y+dy);
+ if (element == EL_FELSBROCKEN)
+ PlaySoundLevel(x+dx, y+dy, SND_PUSCH);
+ else if (element == EL_KOKOSNUSS)
+ PlaySoundLevel(x+dx, y+dy, SND_KNURK);
else
- PlaySoundLevel(x+dx,y+dy,SND_KLOPF);
+ PlaySoundLevel(x+dx, y+dy, SND_KLOPF);
break;
case EL_PFORTE1:
case EL_PFORTE3:
case EL_PFORTE4:
if (!player->key[element-EL_PFORTE1])
- return(MF_NO_ACTION);
+ return MF_NO_ACTION;
break;
case EL_PFORTE1X:
case EL_PFORTE3X:
case EL_PFORTE4X:
if (!player->key[element-EL_PFORTE1X])
- return(MF_NO_ACTION);
+ return MF_NO_ACTION;
break;
case EL_AUSGANG_ZU:
case EL_AUSGANG_ACT:
/* Tür ist (noch) nicht offen! */
- return(MF_NO_ACTION);
+ return MF_NO_ACTION;
break;
case EL_AUSGANG_AUF:
- if (mode==DF_SNAP)
- return(MF_NO_ACTION);
+ if (mode == DF_SNAP)
+ return MF_NO_ACTION;
- PlaySoundLevel(x,y,SND_BUING);
+ PlaySoundLevel(x, y, SND_BUING);
/*
player->gone = TRUE;
- PlaySoundLevel(x,y,SND_BUING);
+ PlaySoundLevel(x, y, SND_BUING);
if (!local_player->friends_still_needed)
player->LevelSolved = player->GameOver = TRUE;
case EL_BIRNE_AUS:
Feld[x][y] = EL_BIRNE_EIN;
local_player->lights_still_needed--;
- DrawLevelField(x,y);
- PlaySoundLevel(x,y,SND_DENG);
- return(MF_ACTION);
+ DrawLevelField(x, y);
+ PlaySoundLevel(x, y, SND_DENG);
+ return MF_ACTION;
break;
case EL_ZEIT_VOLL:
Feld[x][y] = EL_ZEIT_LEER;
TimeLeft += 10;
- DrawText(DX_TIME,DY_TIME,int2str(TimeLeft,3),FS_SMALL,FC_YELLOW);
- DrawLevelField(x,y);
- PlaySoundStereo(SND_GONG,PSND_MAX_RIGHT);
- return(MF_ACTION);
+ DrawText(DX_TIME, DY_TIME, int2str(TimeLeft, 3), FS_SMALL, FC_YELLOW);
+ DrawLevelField(x, y);
+ PlaySoundStereo(SND_GONG, PSND_MAX_RIGHT);
+ return MF_ACTION;
break;
case EL_SOKOBAN_FELD_LEER:
case EL_SOKOBAN_FELD_VOLL:
case EL_SOKOBAN_OBJEKT:
case EL_SONDE:
- if (mode==DF_SNAP)
- return(MF_NO_ACTION);
+ if (mode == DF_SNAP)
+ return MF_NO_ACTION;
player->Pushing = TRUE;
- if (!IN_LEV_FIELD(x+dx,y+dy)
- || (!IS_FREE(x+dx,y+dy)
+ if (!IN_LEV_FIELD(x+dx, y+dy)
+ || (!IS_FREE(x+dx, y+dy)
&& (Feld[x+dx][y+dy] != EL_SOKOBAN_FELD_LEER
|| !IS_SB_ELEMENT(element))))
- return(MF_NO_ACTION);
+ return MF_NO_ACTION;
if (dx && real_dy)
{
- if (IN_LEV_FIELD(jx,jy+real_dy) && !IS_SOLID(Feld[jx][jy+real_dy]))
- return(MF_NO_ACTION);
+ if (IN_LEV_FIELD(jx, jy+real_dy) && !IS_SOLID(Feld[jx][jy+real_dy]))
+ return MF_NO_ACTION;
}
else if (dy && real_dx)
{
- if (IN_LEV_FIELD(jx+real_dx,jy) && !IS_SOLID(Feld[jx+real_dx][jy]))
- return(MF_NO_ACTION);
+ if (IN_LEV_FIELD(jx+real_dx, jy) && !IS_SOLID(Feld[jx+real_dx][jy]))
+ return MF_NO_ACTION;
}
if (player->push_delay == 0)
player->push_delay = FrameCounter;
if (!FrameReached(&player->push_delay, player->push_delay_value) &&
!tape.playing)
- return(MF_NO_ACTION);
+ return MF_NO_ACTION;
if (IS_SB_ELEMENT(element))
{
local_player->sokobanfields_still_needed++;
}
else
- RemoveField(x,y);
+ RemoveField(x, y);
if (Feld[x+dx][y+dy] == EL_SOKOBAN_FELD_LEER)
{
Feld[x+dx][y+dy] = EL_SOKOBAN_FELD_VOLL;
local_player->sokobanfields_still_needed--;
if (element == EL_SOKOBAN_OBJEKT)
- PlaySoundLevel(x,y,SND_DENG);
+ PlaySoundLevel(x, y, SND_DENG);
}
else
Feld[x+dx][y+dy] = EL_SOKOBAN_OBJEKT;
}
else
{
- RemoveField(x,y);
+ RemoveField(x, y);
Feld[x+dx][y+dy] = element;
}
player->push_delay_value = 2;
- DrawLevelField(x,y);
- DrawLevelField(x+dx,y+dy);
- PlaySoundLevel(x+dx,y+dy,SND_PUSCH);
+ DrawLevelField(x, y);
+ DrawLevelField(x+dx, y+dy);
+ PlaySoundLevel(x+dx, y+dy, SND_PUSCH);
if (IS_SB_ELEMENT(element) &&
local_player->sokobanfields_still_needed == 0 &&
game_emulation == EMU_SOKOBAN)
{
player->LevelSolved = player->GameOver = TRUE;
- PlaySoundLevel(x,y,SND_BUING);
+ PlaySoundLevel(x, y, SND_BUING);
}
break;
break;
default:
- return(MF_NO_ACTION);
+ return MF_NO_ACTION;
break;
}
player->push_delay = 0;
- return(MF_MOVING);
+ return MF_MOVING;
}
boolean SnapField(struct PlayerInfo *player, int dx, int dy)
int jx = player->jx, jy = player->jy;
int x = jx + dx, y = jy + dy;
- if (player->gone || !IN_LEV_FIELD(x,y))
- return(FALSE);
+ if (player->gone || !IN_LEV_FIELD(x, y))
+ return FALSE;
if (dx && dy)
- return(FALSE);
+ return FALSE;
if (!dx && !dy)
{
player->snapped = FALSE;
- return(FALSE);
+ return FALSE;
}
if (player->snapped)
- return(FALSE);
+ return FALSE;
player->MovDir = (dx < 0 ? MV_LEFT :
dx > 0 ? MV_RIGHT :
dy < 0 ? MV_UP :
dy > 0 ? MV_DOWN : MV_NO_MOVING);
- if (!DigField(player, x,y, 0,0, DF_SNAP))
- return(FALSE);
+ if (!DigField(player, x, y, 0, 0, DF_SNAP))
+ return FALSE;
player->snapped = TRUE;
- DrawLevelField(x,y);
+ DrawLevelField(x, y);
BackToFront();
- return(TRUE);
+ return TRUE;
}
boolean PlaceBomb(struct PlayerInfo *player)
int element;
if (player->gone || player->MovPos)
- return(FALSE);
+ return FALSE;
element = Feld[jx][jy];
- if ((player->dynamite==0 && player->dynabombs_left==0) ||
- element==EL_DYNAMIT || element==EL_DYNABOMB || element==EL_EXPLODING)
- return(FALSE);
+ if ((player->dynamite == 0 && player->dynabombs_left == 0) ||
+ element == EL_DYNAMIT || element == EL_DYNABOMB ||
+ element == EL_EXPLODING)
+ return FALSE;
if (element != EL_LEERRAUM)
Store[jx][jy] = element;
player->dynamite--;
DrawText(DX_DYNAMITE, DY_DYNAMITE, int2str(local_player->dynamite, 3),
FS_SMALL, FC_YELLOW);
- if (IN_SCR_FIELD(SCREENX(jx),SCREENY(jy)))
- DrawGraphicThruMask(SCREENX(jx),SCREENY(jy),GFX_DYNAMIT);
+ if (IN_SCR_FIELD(SCREENX(jx), SCREENY(jy)))
+ DrawGraphicThruMask(SCREENX(jx), SCREENY(jy), GFX_DYNAMIT);
}
else
{
Store2[jx][jy] = player->element_nr; /* for DynaExplode() */
MovDelay[jx][jy] = 96;
player->dynabombs_left--;
- if (IN_SCR_FIELD(SCREENX(jx),SCREENY(jy)))
- DrawGraphicThruMask(SCREENX(jx),SCREENY(jy),GFX_DYNABOMB);
+ if (IN_SCR_FIELD(SCREENX(jx), SCREENY(jy)))
+ DrawGraphicThruMask(SCREENX(jx), SCREENY(jy), GFX_DYNABOMB);
}
- return(TRUE);
+ return TRUE;
}
void PlaySoundLevel(int x, int y, int sound_nr)
(!setup.sound_loops && IS_LOOP_SOUND(sound_nr)))
return;
- if (!IN_LEV_FIELD(x,y) ||
+ if (!IN_LEV_FIELD(x, y) ||
sx < -silence_distance || sx >= SCR_FIELDX+silence_distance ||
sy < -silence_distance || sy >= SCR_FIELDY+silence_distance)
return;
if(stereo < PSND_MAX_LEFT) stereo = PSND_MAX_LEFT;
#endif
- if (!IN_SCR_FIELD(sx,sy))
+ if (!IN_SCR_FIELD(sx, sy))
{
int dx = ABS(sx-SCR_FIELDX/2)-SCR_FIELDX/2;
int dy = ABS(sy-SCR_FIELDY/2)-SCR_FIELDY/2;
void ClearWindow()
{
- XFillRectangle(display,backbuffer,gc,
- REAL_SX,REAL_SY, FULL_SXSIZE,FULL_SYSIZE);
+ XFillRectangle(display, backbuffer, gc,
+ REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE);
- if (setup.soft_scrolling && game_status==PLAYING)
+ if (setup.soft_scrolling && game_status == PLAYING)
{
- XFillRectangle(display,fieldbuffer,gc,
- 0,0, FXSIZE,FYSIZE);
+ XFillRectangle(display, fieldbuffer, gc, 0, 0, FXSIZE, FYSIZE);
SetDrawtoField(DRAW_BUFFERED);
}
else
SetDrawtoField(DRAW_BACKBUFFER);
- if (setup.direct_draw && game_status==PLAYING)
+ if (setup.direct_draw && game_status == PLAYING)
{
- XFillRectangle(display,window,gc,
- REAL_SX,REAL_SY, FULL_SXSIZE,FULL_SYSIZE);
+ XFillRectangle(display, window, gc,
+ REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE);
SetDrawtoField(DRAW_DIRECT);
}
int font_width, font_height, font_start;
int font_pixmap;
- if (font!=FS_SMALL && font!=FS_BIG)
+ if (font != FS_SMALL && font != FS_BIG)
font = FS_SMALL;
- if (font_color<FC_RED || font_color>FC_SPECIAL2)
+ if (font_color < FC_RED || font_color > FC_SPECIAL2)
font_color = FC_RED;
- font_width =
- (font==FS_BIG ? FONT1_XSIZE :
- font_color<FC_SPECIAL1 ? FONT2_XSIZE :
- font_color<FC_SPECIAL2 ? FONT3_XSIZE : FONT4_XSIZE);
- font_height =
- (font==FS_BIG ? FONT1_XSIZE :
- font_color<FC_SPECIAL2 ? FONT2_XSIZE: FONT4_XSIZE);
- font_pixmap = (font==FS_BIG ? PIX_BIGFONT : PIX_SMALLFONT);
- font_start =
- font_color*(font==FS_BIG ? FONT1_YSIZE : FONT2_YSIZE)*FONT_LINES_PER_FONT;
+ font_width = (font == FS_BIG ? FONT1_XSIZE :
+ font_color < FC_SPECIAL1 ? FONT2_XSIZE :
+ font_color < FC_SPECIAL2 ? FONT3_XSIZE : FONT4_XSIZE);
+ font_height = (font == FS_BIG ? FONT1_XSIZE :
+ font_color < FC_SPECIAL2 ? FONT2_XSIZE : FONT4_XSIZE);
+ font_pixmap = (font == FS_BIG ? PIX_BIGFONT : PIX_SMALLFONT);
+ font_start = (font_color * (font == FS_BIG ? FONT1_YSIZE : FONT2_YSIZE) *
+ FONT_LINES_PER_FONT);
while(*text)
{
char c = *text++;
- if (c>='a' && c<='z')
+ if (c >= 'a' && c <= 'z')
c = 'A' + (c - 'a');
- else if (c=='ä' || c=='Ä')
+ else if (c == 'ä' || c == 'Ä')
c = 91;
- else if (c=='ö' || c=='Ö')
+ else if (c == 'ö' || c == 'Ö')
c = 92;
- else if (c=='ü' || c=='Ü')
+ else if (c == 'ü' || c == 'Ü')
c = 93;
- if (c>=32 && c<=95)
- XCopyArea(display,pix[font_pixmap],d,gc,
- ((c-32) % FONT_CHARS_PER_LINE)*font_width,
- ((c-32) / FONT_CHARS_PER_LINE)*font_height + font_start,
- font_width,font_height, x,y);
+ if (c >= 32 && c <= 95)
+ XCopyArea(display, pix[font_pixmap], d, gc,
+ ((c - 32) % FONT_CHARS_PER_LINE) * font_width,
+ ((c - 32) / FONT_CHARS_PER_LINE) * font_height + font_start,
+ font_width, font_height, x, y);
x += font_width;
}
int graphic, phase;
if (!player->active || player->gone ||
- !IN_SCR_FIELD(SCREENX(last_jx),SCREENY(last_jy)))
+ !IN_SCR_FIELD(SCREENX(last_jx), SCREENY(last_jy)))
return;
#if DEBUG
{
if (Store[last_jx][last_jy])
{
- DrawLevelElement(last_jx,last_jy, Store[last_jx][last_jy]);
- DrawLevelFieldThruMask(last_jx,last_jy);
+ DrawLevelElement(last_jx, last_jy, Store[last_jx][last_jy]);
+ DrawLevelFieldThruMask(last_jx, last_jy);
}
else if (Feld[last_jx][last_jy] == EL_DYNAMIT)
- DrawDynamite(last_jx,last_jy);
+ DrawDynamite(last_jx, last_jy);
else
- DrawLevelField(last_jx,last_jy);
+ DrawLevelField(last_jx, last_jy);
- if (player->Pushing && IN_SCR_FIELD(SCREENX(next_jx),SCREENY(next_jy)))
+ if (player->Pushing && IN_SCR_FIELD(SCREENX(next_jx), SCREENY(next_jy)))
{
if (player->GfxPos)
{
if (Feld[next_jx][next_jy] == EL_SOKOBAN_FELD_VOLL)
- DrawLevelElement(next_jx,next_jy, EL_SOKOBAN_FELD_LEER);
+ DrawLevelElement(next_jx, next_jy, EL_SOKOBAN_FELD_LEER);
else
- DrawLevelElement(next_jx,next_jy, EL_LEERRAUM);
+ DrawLevelElement(next_jx, next_jy, EL_LEERRAUM);
}
else
- DrawLevelField(next_jx,next_jy);
+ DrawLevelField(next_jx, next_jy);
}
}
- if (!IN_SCR_FIELD(sx,sy))
+ if (!IN_SCR_FIELD(sx, sy))
return;
if (setup.direct_draw)
/* draw things behind the player, if needed */
if (Store[jx][jy])
- DrawLevelElement(jx,jy, Store[jx][jy]);
+ DrawLevelElement(jx, jy, Store[jx][jy]);
else if (element != EL_DYNAMIT && element != EL_DYNABOMB)
- DrawLevelField(jx,jy);
+ DrawLevelField(jx, jy);
/* draw player himself */
- if (player->MovDir==MV_LEFT)
+ if (player->MovDir == MV_LEFT)
graphic = (player->Pushing ? GFX_SPIELER1_PUSH_LEFT : GFX_SPIELER1_LEFT);
- else if (player->MovDir==MV_RIGHT)
+ else if (player->MovDir == MV_RIGHT)
graphic = (player->Pushing ? GFX_SPIELER1_PUSH_RIGHT : GFX_SPIELER1_RIGHT);
- else if (player->MovDir==MV_UP)
+ else if (player->MovDir == MV_UP)
graphic = GFX_SPIELER1_UP;
else /* MV_DOWN || MV_NO_MOVING */
graphic = GFX_SPIELER1_DOWN;
if (!setup.soft_scrolling && ScreenMovPos)
sxx = syy = 0;
- DrawGraphicShiftedThruMask(sx,sy, sxx,syy, graphic, NO_CUTTING);
+ DrawGraphicShiftedThruMask(sx, sy, sxx, syy, graphic, NO_CUTTING);
if (player->Pushing && player->GfxPos)
{
if (Feld[jx][jy] == EL_SOKOBAN_FELD_LEER ||
Feld[next_jx][next_jy] == EL_SOKOBAN_FELD_VOLL)
- DrawGraphicShiftedThruMask(px,py,sxx,syy, GFX_SOKOBAN_OBJEKT,NO_CUTTING);
+ DrawGraphicShiftedThruMask(px, py, sxx, syy, GFX_SOKOBAN_OBJEKT,
+ NO_CUTTING);
else
{
int element = Feld[next_jx][next_jy];
graphic += (phase+4)%4;
}
- DrawGraphicShifted(px,py, sxx,syy, graphic, NO_CUTTING, NO_MASKING);
+ DrawGraphicShifted(px, py, sxx, syy, graphic, NO_CUTTING, NO_MASKING);
}
}
if (element == EL_DYNAMIT)
{
- if ((phase = (96-MovDelay[jx][jy])/12) > 6)
+ if ((phase = (96 - MovDelay[jx][jy]) / 12) > 6)
phase = 6;
}
else
{
- if ((phase = ((96-MovDelay[jx][jy])/6) % 8) > 3)
- phase = 7-phase;
+ if ((phase = ((96 - MovDelay[jx][jy]) / 6) % 8) > 3)
+ phase = 7 - phase;
}
- DrawGraphicThruMask(sx,sy, graphic + phase);
+ DrawGraphicThruMask(sx, sy, graphic + phase);
}
- if ((last_jx != jx || last_jy != jy) && Feld[last_jx][last_jy]==EL_EXPLODING)
+ if ((last_jx != jx || last_jy != jy) &&
+ Feld[last_jx][last_jy] == EL_EXPLODING)
{
int phase = Frame[last_jx][last_jy];
int delay = 2;
if (phase > 2)
- DrawGraphicThruMask(SCREENX(last_jx),SCREENY(last_jy),
- GFX_EXPLOSION + ((phase-1)/delay-1));
+ DrawGraphicThruMask(SCREENX(last_jx), SCREENY(last_jy),
+ GFX_EXPLOSION + ((phase - 1) / delay - 1));
}
if (setup.direct_draw)
{
- int dest_x = SX + SCREENX(MIN(jx,last_jx))*TILEX;
- int dest_y = SY + SCREENY(MIN(jy,last_jy))*TILEY;
+ int dest_x = SX + SCREENX(MIN(jx, last_jx)) * TILEX;
+ int dest_y = SY + SCREENY(MIN(jy, last_jy)) * TILEY;
int x_size = TILEX * (1 + ABS(jx - last_jx));
int y_size = TILEY * (1 + ABS(jy - last_jy));
- XCopyArea(display,drawto_field,window,gc,
- dest_x,dest_y, x_size,y_size, dest_x,dest_y);
+ XCopyArea(display, drawto_field, window, gc,
+ dest_x, dest_y, x_size, y_size, dest_x, dest_y);
SetDrawtoField(DRAW_DIRECT);
}
if (mode == ANIM_OSCILLATE)
{
- int max_anim_frames = frames*2 - 2;
+ int max_anim_frames = 2 * frames - 2;
phase = (FrameCounter % (delay * max_anim_frames)) / delay;
phase = (phase < frames ? phase : max_anim_frames - phase);
}
{
int phase = getGraphicAnimationPhase(frames, delay, mode);
- if (!(FrameCounter % delay) && IN_SCR_FIELD(SCREENX(x),SCREENY(y)))
+ if (!(FrameCounter % delay) && IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
{
if (mask_mode == USE_MASKING)
- DrawGraphicThruMask(SCREENX(x),SCREENY(y), graphic + phase);
+ DrawGraphicThruMask(SCREENX(x), SCREENY(y), graphic + phase);
else
- DrawGraphic(SCREENX(x),SCREENY(y), graphic + phase);
+ DrawGraphic(SCREENX(x), SCREENY(y), graphic + phase);
}
}
void DrawGraphicAnimation(int x, int y, int graphic,
int frames, int delay, int mode)
{
- DrawGraphicAnimationExt(x,y, graphic, frames,delay,mode, NO_MASKING);
+ DrawGraphicAnimationExt(x, y, graphic, frames, delay, mode, NO_MASKING);
}
void DrawGraphicAnimationThruMask(int x, int y, int graphic,
int frames, int delay, int mode)
{
- DrawGraphicAnimationExt(x,y, graphic, frames,delay,mode, USE_MASKING);
+ DrawGraphicAnimationExt(x, y, graphic, frames, delay, mode, USE_MASKING);
}
void DrawGraphic(int x, int y, int graphic)
}
#endif
- DrawGraphicExt(drawto_field, gc, FX+x*TILEX, FY+y*TILEY, graphic);
+ DrawGraphicExt(drawto_field, gc, FX + x*TILEX, FY + y*TILEY, graphic);
MarkTileDirty(x,y);
}
if (graphic >= GFX_START_ROCKSSCREEN && graphic <= GFX_END_ROCKSSCREEN)
{
graphic -= GFX_START_ROCKSSCREEN;
- XCopyArea(display,pix[PIX_BACK],d,gc,
+ XCopyArea(display, pix[PIX_BACK], d, gc,
SX + (graphic % GFX_PER_LINE) * TILEX,
SY + (graphic / GFX_PER_LINE) * TILEY,
- TILEX,TILEY, x,y);
+ TILEX, TILEY, x, y);
}
else if (graphic >= GFX_START_ROCKSHEROES && graphic <= GFX_END_ROCKSHEROES)
{
graphic -= GFX_START_ROCKSHEROES;
- XCopyArea(display,pix[PIX_HEROES],d,gc,
+ XCopyArea(display, pix[PIX_HEROES], d, gc,
(graphic % HEROES_PER_LINE) * TILEX,
(graphic / HEROES_PER_LINE) * TILEY,
- TILEX,TILEY, x,y);
+ TILEX, TILEY, x, y);
}
else if (graphic >= GFX_START_ROCKSFONT && graphic <= GFX_END_ROCKSFONT)
{
graphic -= GFX_START_ROCKSFONT;
- XCopyArea(display,pix[PIX_BIGFONT],d,gc,
+ XCopyArea(display, pix[PIX_BIGFONT], d, gc,
(graphic % FONT_CHARS_PER_LINE) * TILEX,
(graphic / FONT_CHARS_PER_LINE) * TILEY +
FC_SPECIAL1 * FONT_LINES_PER_FONT * TILEY,
- TILEX,TILEY, x,y);
+ TILEX, TILEY, x, y);
}
else
- XFillRectangle(display,d,gc, x,y, TILEX,TILEY);
+ XFillRectangle(display, d, gc, x, y, TILEX, TILEY);
}
void DrawGraphicThruMask(int x, int y, int graphic)
}
#endif
- DrawGraphicThruMaskExt(drawto_field, FX+x*TILEX, FY+y*TILEY, graphic);
+ DrawGraphicThruMaskExt(drawto_field, FX + x*TILEX, FY + y*TILEY, graphic);
MarkTileDirty(x,y);
}
src_pixmap = pix[PIX_BACK];
drawing_gc = clip_gc[PIX_BACK];
graphic -= GFX_START_ROCKSSCREEN;
- src_x = SX+(graphic % GFX_PER_LINE)*TILEX;
- src_y = SY+(graphic / GFX_PER_LINE)*TILEY;
+ src_x = SX + (graphic % GFX_PER_LINE) * TILEX;
+ src_y = SY + (graphic / GFX_PER_LINE) * TILEY;
}
else if (graphic >= GFX_START_ROCKSHEROES && graphic <= GFX_END_ROCKSHEROES)
{
src_pixmap = pix[PIX_HEROES];
drawing_gc = clip_gc[PIX_HEROES];
graphic -= GFX_START_ROCKSHEROES;
- src_x = (graphic % HEROES_PER_LINE)*TILEX;
- src_y = (graphic / HEROES_PER_LINE)*TILEY;
+ src_x = (graphic % HEROES_PER_LINE) * TILEX;
+ src_y = (graphic / HEROES_PER_LINE) * TILEY;
}
else
{
if (tile_clipmask[tile] != None)
{
XSetClipMask(display, tile_clip_gc, tile_clipmask[tile]);
- XSetClipOrigin(display, tile_clip_gc, dest_x,dest_y);
+ XSetClipOrigin(display, tile_clip_gc, dest_x, dest_y);
XCopyArea(display, src_pixmap, drawto_field, tile_clip_gc,
- src_x,src_y, TILEX,TILEY, dest_x,dest_y);
+ src_x, src_y, TILEX, TILEY, dest_x, dest_y);
}
else
{
XSetClipOrigin(display, drawing_gc, dest_x-src_x, dest_y-src_y);
XCopyArea(display, src_pixmap, drawto_field, drawing_gc,
- src_x,src_y, TILEX,TILEY, dest_x,dest_y);
+ src_x, src_y, TILEX, TILEY, dest_x, dest_y);
}
}
void DrawMiniGraphic(int x, int y, int graphic)
{
- DrawMiniGraphicExt(drawto,gc, SX+x*MINI_TILEX,SY+y*MINI_TILEY, graphic);
+ DrawMiniGraphicExt(drawto,gc, SX + x*MINI_TILEX, SY + y*MINI_TILEY, graphic);
MarkTileDirty(x/2, y/2);
}
if (graphic >= GFX_START_ROCKSSCREEN && graphic <= GFX_END_ROCKSSCREEN)
{
graphic -= GFX_START_ROCKSSCREEN;
- XCopyArea(display,pix[PIX_BACK],d,gc,
- MINI_GFX_STARTX+(graphic % MINI_GFX_PER_LINE)*MINI_TILEX,
- MINI_GFX_STARTY+(graphic / MINI_GFX_PER_LINE)*MINI_TILEY,
- MINI_TILEX,MINI_TILEY, x,y);
+ XCopyArea(display, pix[PIX_BACK], d, gc,
+ MINI_GFX_STARTX + (graphic % MINI_GFX_PER_LINE) * MINI_TILEX,
+ MINI_GFX_STARTY + (graphic / MINI_GFX_PER_LINE) * MINI_TILEY,
+ MINI_TILEX, MINI_TILEY, x, y);
}
else if (graphic >= GFX_START_ROCKSFONT && graphic <= GFX_END_ROCKSFONT)
{
graphic -= GFX_START_ROCKSFONT;
- XCopyArea(display,pix[PIX_SMALLFONT],d,gc,
- (graphic % FONT_CHARS_PER_LINE)*FONT4_XSIZE,
- (graphic / FONT_CHARS_PER_LINE)*FONT4_YSIZE +
- FC_SPECIAL2*FONT2_YSIZE*FONT_LINES_PER_FONT,
- MINI_TILEX,MINI_TILEY, x,y);
+ XCopyArea(display, pix[PIX_SMALLFONT], d, gc,
+ (graphic % FONT_CHARS_PER_LINE) * FONT4_XSIZE,
+ (graphic / FONT_CHARS_PER_LINE) * FONT4_YSIZE +
+ FC_SPECIAL2 * FONT2_YSIZE * FONT_LINES_PER_FONT,
+ MINI_TILEX, MINI_TILEY, x, y);
}
else
- XFillRectangle(display,d,gc, x,y, MINI_TILEX,MINI_TILEY);
+ XFillRectangle(display, d, gc, x, y, MINI_TILEX, MINI_TILEY);
}
void DrawGraphicShifted(int x,int y, int dx,int dy, int graphic,
{
int width = TILEX, height = TILEY;
int cx = 0, cy = 0;
- int src_x,src_y, dest_x,dest_y;
+ int src_x, src_y, dest_x, dest_y;
int tile = graphic;
Pixmap src_pixmap;
GC drawing_gc;
if (graphic < 0)
{
- DrawGraphic(x,y,graphic);
+ DrawGraphic(x, y, graphic);
return;
}
width = -dx;
dx = TILEX + dx;
}
- else if (x==BX1 && dx<0) /* Element verläßt links das Bild */
+ else if (x==BX1 && dx < 0) /* Element verläßt links das Bild */
{
width += dx;
cx = -dx;
dx = 0;
}
- else if (x==BX2 && dx>0) /* Element verläßt rechts das Bild */
+ else if (x==BX2 && dx > 0) /* Element verläßt rechts das Bild */
width -= dx;
else if (dx) /* allg. Bewegung in x-Richtung */
MarkTileDirty(x + SIGN(dx), y);
height = -dy;
dy = TILEY + dy;
}
- else if (y==BY1 && dy<0) /* Element verläßt oben das Bild */
+ else if (y==BY1 && dy < 0) /* Element verläßt oben das Bild */
{
height += dy;
cy = -dy;
dy = 0;
}
- else if (dy > 0 && cut_mode==CUT_ABOVE)
+ else if (dy > 0 && cut_mode == CUT_ABOVE)
{
if (y == BY2) /* Element unterhalb des Bildes */
return;
height = dy;
- cy = TILEY-dy;
+ cy = TILEY - dy;
dy = TILEY;
MarkTileDirty(x, y + 1);
} /* Element verläßt unten das Bild */
- else if (dy > 0 && (y == BY2 || cut_mode==CUT_BELOW))
+ else if (dy > 0 && (y == BY2 || cut_mode == CUT_BELOW))
height -= dy;
else if (dy) /* allg. Bewegung in y-Richtung */
MarkTileDirty(x, y + SIGN(dy));
src_pixmap = pix[PIX_BACK];
drawing_gc = clip_gc[PIX_BACK];
graphic -= GFX_START_ROCKSSCREEN;
- src_x = SX+(graphic % GFX_PER_LINE)*TILEX+cx;
- src_y = SY+(graphic / GFX_PER_LINE)*TILEY+cy;
+ src_x = SX + (graphic % GFX_PER_LINE) * TILEX + cx;
+ src_y = SY + (graphic / GFX_PER_LINE) * TILEY + cy;
}
else if (graphic >= GFX_START_ROCKSHEROES && graphic <= GFX_END_ROCKSHEROES)
{
src_pixmap = pix[PIX_HEROES];
drawing_gc = clip_gc[PIX_HEROES];
graphic -= GFX_START_ROCKSHEROES;
- src_x = (graphic % HEROES_PER_LINE)*TILEX+cx;
- src_y = (graphic / HEROES_PER_LINE)*TILEY+cy;
+ src_x = (graphic % HEROES_PER_LINE) * TILEX + cx;
+ src_y = (graphic / HEROES_PER_LINE) * TILEY + cy;
}
- dest_x = FX + x*TILEX + dx;
- dest_y = FY + y*TILEY + dy;
+ dest_x = FX + x * TILEX + dx;
+ dest_y = FY + y * TILEY + dy;
#if DEBUG
if (!IN_SCR_FIELD(x,y))
if (tile_clipmask[tile] != None)
{
XSetClipMask(display, tile_clip_gc, tile_clipmask[tile]);
- XSetClipOrigin(display, tile_clip_gc, dest_x,dest_y);
+ XSetClipOrigin(display, tile_clip_gc, dest_x, dest_y);
XCopyArea(display, src_pixmap, drawto_field, tile_clip_gc,
- src_x,src_y, TILEX,TILEY, dest_x,dest_y);
+ src_x, src_y, TILEX, TILEY, dest_x, dest_y);
}
else
{
printf("DrawGraphicShifted(): tile '%d' needs clipping!\n", tile);
#endif
- XSetClipOrigin(display, drawing_gc, dest_x-src_x, dest_y-src_y);
+ XSetClipOrigin(display, drawing_gc, dest_x - src_x, dest_y - src_y);
XCopyArea(display, src_pixmap, drawto_field, drawing_gc,
- src_x,src_y, width,height, dest_x,dest_y);
+ src_x, src_y, width, height, dest_x, dest_y);
}
}
else
XCopyArea(display, src_pixmap, drawto_field, gc,
- src_x,src_y, width,height, dest_x,dest_y);
+ src_x, src_y, width, height, dest_x, dest_y);
MarkTileDirty(x,y);
}
{
int ux = LEVELX(x), uy = LEVELY(y);
int graphic = el2gfx(element);
- int phase4 = ABS(MovPos[ux][uy])/(TILEX/4);
+ int phase4 = ABS(MovPos[ux][uy]) / (TILEX / 4);
int phase = phase4 / 2;
int dir = MovDir[ux][uy];
- if (element==EL_PACMAN || element==EL_KAEFER || element==EL_FLIEGER)
+ if (element == EL_PACMAN || element == EL_KAEFER || element == EL_FLIEGER)
{
graphic += 4*!phase;
else if (dir == MV_DOWN)
graphic += 3;
}
- else if (element==EL_MAULWURF || element==EL_PINGUIN ||
- element==EL_SCHWEIN || element==EL_DRACHE)
- {
- if (dir==MV_LEFT)
- graphic = (element==EL_MAULWURF ? GFX_MAULWURF_LEFT :
- element==EL_PINGUIN ? GFX_PINGUIN_LEFT :
- element==EL_SCHWEIN ? GFX_SCHWEIN_LEFT : GFX_DRACHE_LEFT);
- else if (dir==MV_RIGHT)
- graphic = (element==EL_MAULWURF ? GFX_MAULWURF_RIGHT :
- element==EL_PINGUIN ? GFX_PINGUIN_RIGHT :
- element==EL_SCHWEIN ? GFX_SCHWEIN_RIGHT : GFX_DRACHE_RIGHT);
- else if (dir==MV_UP)
- graphic = (element==EL_MAULWURF ? GFX_MAULWURF_UP :
- element==EL_PINGUIN ? GFX_PINGUIN_UP :
- element==EL_SCHWEIN ? GFX_SCHWEIN_UP : GFX_DRACHE_UP);
+ else if (element == EL_MAULWURF || element == EL_PINGUIN ||
+ element == EL_SCHWEIN || element == EL_DRACHE)
+ {
+ if (dir == MV_LEFT)
+ graphic = (element == EL_MAULWURF ? GFX_MAULWURF_LEFT :
+ element == EL_PINGUIN ? GFX_PINGUIN_LEFT :
+ element == EL_SCHWEIN ? GFX_SCHWEIN_LEFT : GFX_DRACHE_LEFT);
+ else if (dir == MV_RIGHT)
+ graphic = (element == EL_MAULWURF ? GFX_MAULWURF_RIGHT :
+ element == EL_PINGUIN ? GFX_PINGUIN_RIGHT :
+ element == EL_SCHWEIN ? GFX_SCHWEIN_RIGHT : GFX_DRACHE_RIGHT);
+ else if (dir == MV_UP)
+ graphic = (element == EL_MAULWURF ? GFX_MAULWURF_UP :
+ element == EL_PINGUIN ? GFX_PINGUIN_UP :
+ element == EL_SCHWEIN ? GFX_SCHWEIN_UP : GFX_DRACHE_UP);
else
- graphic = (element==EL_MAULWURF ? GFX_MAULWURF_DOWN :
- element==EL_PINGUIN ? GFX_PINGUIN_DOWN :
- element==EL_SCHWEIN ? GFX_SCHWEIN_DOWN : GFX_DRACHE_DOWN);
+ graphic = (element == EL_MAULWURF ? GFX_MAULWURF_DOWN :
+ element == EL_PINGUIN ? GFX_PINGUIN_DOWN :
+ element == EL_SCHWEIN ? GFX_SCHWEIN_DOWN : GFX_DRACHE_DOWN);
graphic += phase4;
}
- else if (element==EL_SONDE)
+ else if (element == EL_SONDE)
{
graphic = GFX_SONDE_START + getGraphicAnimationPhase(8, 2, ANIM_NORMAL);
}
- else if (element==EL_SALZSAEURE)
+ else if (element == EL_SALZSAEURE)
{
graphic = GFX_GEBLUBBER + getGraphicAnimationPhase(4, 10, ANIM_NORMAL);
}
- else if (element==EL_BUTTERFLY || element==EL_FIREFLY)
+ else if (element == EL_BUTTERFLY || element == EL_FIREFLY)
{
graphic += !phase;
}
- else if ((element==EL_FELSBROCKEN || IS_GEM(element)) && !cut_mode)
+ else if ((element == EL_FELSBROCKEN || IS_GEM(element)) && !cut_mode)
{
- graphic += phase * (element==EL_FELSBROCKEN ? 2 : 1);
+ graphic += phase * (element == EL_FELSBROCKEN ? 2 : 1);
}
- else if ((element==EL_SIEB_LEER || element==EL_SIEB2_LEER ||
- element==EL_SIEB_VOLL || element==EL_SIEB2_VOLL) && SiebAktiv)
+ else if ((element == EL_SIEB_LEER || element == EL_SIEB2_LEER ||
+ element == EL_SIEB_VOLL || element == EL_SIEB2_VOLL) && SiebAktiv)
{
- graphic += 3-(SiebAktiv%8)/2;
+ graphic += 3 - (SiebAktiv % 8) / 2;
}
else if (IS_AMOEBOID(element))
{
- graphic = (element==EL_AMOEBE_TOT ? GFX_AMOEBE_TOT : GFX_AMOEBE_LEBT);
- graphic += (x+2*y) % 4;
+ graphic = (element == EL_AMOEBE_TOT ? GFX_AMOEBE_TOT : GFX_AMOEBE_LEBT);
+ graphic += (x + 2 * y + 4) % 4;
}
- else if (element==EL_MAUER_LEBT)
+ else if (element == EL_MAUER_LEBT)
{
boolean links_massiv = FALSE, rechts_massiv = FALSE;
- if (!IN_LEV_FIELD(ux-1,uy) || IS_MAUER(Feld[ux-1][uy]))
+ if (!IN_LEV_FIELD(ux-1, uy) || IS_MAUER(Feld[ux-1][uy]))
links_massiv = TRUE;
- if (!IN_LEV_FIELD(ux+1,uy) || IS_MAUER(Feld[ux+1][uy]))
+ if (!IN_LEV_FIELD(ux+1, uy) || IS_MAUER(Feld[ux+1][uy]))
rechts_massiv = TRUE;
if (links_massiv && rechts_massiv)
}
if (dx || dy)
- DrawGraphicShifted(x,y, dx,dy, graphic, cut_mode, mask_mode);
+ DrawGraphicShifted(x, y, dx, dy, graphic, cut_mode, mask_mode);
else if (mask_mode == USE_MASKING)
- DrawGraphicThruMask(x,y, graphic);
+ DrawGraphicThruMask(x, y, graphic);
else
- DrawGraphic(x,y, graphic);
+ DrawGraphic(x, y, graphic);
}
void DrawLevelElementExt(int x, int y, int dx, int dy, int element,
int cut_mode, int mask_mode)
{
- if (IN_LEV_FIELD(x,y) && IN_SCR_FIELD(SCREENX(x),SCREENY(y)))
- DrawScreenElementExt(SCREENX(x),SCREENY(y), dx,dy, element,
+ if (IN_LEV_FIELD(x, y) && IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
+ DrawScreenElementExt(SCREENX(x), SCREENY(y), dx, dy, element,
cut_mode, mask_mode);
}
void DrawScreenElementShifted(int x, int y, int dx, int dy, int element,
int cut_mode)
{
- DrawScreenElementExt(x,y, dx,dy, element, cut_mode, NO_MASKING);
+ DrawScreenElementExt(x, y, dx, dy, element, cut_mode, NO_MASKING);
}
void DrawLevelElementShifted(int x, int y, int dx, int dy, int element,
int cut_mode)
{
- DrawLevelElementExt(x,y, dx,dy, element, cut_mode, NO_MASKING);
+ DrawLevelElementExt(x, y, dx, dy, element, cut_mode, NO_MASKING);
}
void DrawScreenElementThruMask(int x, int y, int element)
{
- DrawScreenElementExt(x,y, 0,0, element, NO_CUTTING, USE_MASKING);
+ DrawScreenElementExt(x, y, 0, 0, element, NO_CUTTING, USE_MASKING);
}
void DrawLevelElementThruMask(int x, int y, int element)
{
- DrawLevelElementExt(x,y, 0,0, element, NO_CUTTING, USE_MASKING);
+ DrawLevelElementExt(x, y, 0, 0, element, NO_CUTTING, USE_MASKING);
}
void DrawLevelFieldThruMask(int x, int y)
{
- DrawLevelElementExt(x,y, 0,0, Feld[x][y], NO_CUTTING, USE_MASKING);
+ DrawLevelElementExt(x, y, 0, 0, Feld[x][y], NO_CUTTING, USE_MASKING);
}
void ErdreichAnbroeckeln(int x, int y)
int snip = 4;
static int xy[4][2] =
{
- { 0,-1 },
- { -1,0 },
- { +1,0 },
- { 0,+1 }
+ { 0, -1 },
+ { -1, 0 },
+ { +1, 0 },
+ { 0, +1 }
};
- if (!IN_LEV_FIELD(ux,uy))
+ if (!IN_LEV_FIELD(ux, uy))
return;
element = Feld[ux][uy];
- if (element==EL_ERDREICH)
+ if (element == EL_ERDREICH)
{
- if (!IN_SCR_FIELD(x,y))
+ if (!IN_SCR_FIELD(x, y))
return;
graphic = GFX_ERDENRAND;
- for(i=0;i<4;i++)
+ for(i=0; i<4; i++)
{
- int uxx,uyy;
+ int uxx, uyy;
- uxx = ux+xy[i][0];
- uyy = uy+xy[i][1];
- if (!IN_LEV_FIELD(uxx,uyy))
+ uxx = ux + xy[i][0];
+ uyy = uy + xy[i][1];
+ if (!IN_LEV_FIELD(uxx, uyy))
element = EL_BETON;
else
element = Feld[uxx][uyy];
- if (element==EL_ERDREICH)
+ if (element == EL_ERDREICH)
continue;
- if (i==1 || i==2)
+ if (i == 1 || i == 2)
{
width = snip;
height = TILEY;
- cx = (i==2 ? TILEX-snip : 0);
+ cx = (i == 2 ? TILEX - snip : 0);
cy = 0;
}
else
width = TILEX;
height = snip;
cx = 0;
- cy = (i==3 ? TILEY-snip : 0);
+ cy = (i == 3 ? TILEY - snip : 0);
}
- XCopyArea(display,pix[PIX_BACK],drawto_field,gc,
- SX+(graphic % GFX_PER_LINE)*TILEX+cx,
- SY+(graphic / GFX_PER_LINE)*TILEY+cy,
- width,height, FX+x*TILEX+cx,FY+y*TILEY+cy);
+ XCopyArea(display, pix[PIX_BACK], drawto_field, gc,
+ SX + (graphic % GFX_PER_LINE) * TILEX + cx,
+ SY + (graphic / GFX_PER_LINE) * TILEY + cy,
+ width, height, FX + x * TILEX + cx, FY + y * TILEY + cy);
}
- MarkTileDirty(x,y);
+ MarkTileDirty(x, y);
}
else
{
graphic = GFX_ERDENRAND;
- for(i=0;i<4;i++)
+ for(i=0; i<4; i++)
{
- int xx,yy,uxx,uyy;
+ int xx, yy, uxx, uyy;
- xx = x+xy[i][0];
- yy = y+xy[i][1];
- uxx = ux+xy[i][0];
- uyy = uy+xy[i][1];
+ xx = x + xy[i][0];
+ yy = y + xy[i][1];
+ uxx = ux + xy[i][0];
+ uyy = uy + xy[i][1];
- if (!IN_LEV_FIELD(uxx,uyy) || Feld[uxx][uyy]!=EL_ERDREICH ||
- !IN_SCR_FIELD(xx,yy))
+ if (!IN_LEV_FIELD(uxx, uyy) || Feld[uxx][uyy] != EL_ERDREICH ||
+ !IN_SCR_FIELD(xx, yy))
continue;
- if (i==1 || i==2)
+ if (i == 1 || i == 2)
{
width = snip;
height = TILEY;
- cx = (i==1 ? TILEX-snip : 0);
+ cx = (i == 1 ? TILEX - snip : 0);
cy = 0;
}
else
cy = (i==0 ? TILEY-snip : 0);
}
- XCopyArea(display,pix[PIX_BACK],drawto_field,gc,
- SX+(graphic % GFX_PER_LINE)*TILEX+cx,
- SY+(graphic / GFX_PER_LINE)*TILEY+cy,
- width,height, FX+xx*TILEX+cx,FY+yy*TILEY+cy);
+ XCopyArea(display, pix[PIX_BACK], drawto_field, gc,
+ SX + (graphic % GFX_PER_LINE) * TILEX + cx,
+ SY + (graphic / GFX_PER_LINE) * TILEY + cy,
+ width, height, FX + xx * TILEX + cx, FY + yy * TILEY + cy);
- MarkTileDirty(xx,yy);
+ MarkTileDirty(xx, yy);
}
}
}
void DrawScreenElement(int x, int y, int element)
{
- DrawScreenElementExt(x,y, 0,0, element, NO_CUTTING, NO_MASKING);
- ErdreichAnbroeckeln(x,y);
+ DrawScreenElementExt(x, y, 0, 0, element, NO_CUTTING, NO_MASKING);
+ ErdreichAnbroeckeln(x, y);
}
void DrawLevelElement(int x, int y, int element)
{
- if (IN_LEV_FIELD(x,y) && IN_SCR_FIELD(SCREENX(x),SCREENY(y)))
- DrawScreenElement(SCREENX(x),SCREENY(y),element);
+ if (IN_LEV_FIELD(x, y) && IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
+ DrawScreenElement(SCREENX(x), SCREENY(y), element);
}
void DrawScreenField(int x, int y)
int ux = LEVELX(x), uy = LEVELY(y);
int element;
- if (!IN_LEV_FIELD(ux,uy))
+ if (!IN_LEV_FIELD(ux, uy))
{
- DrawScreenElement(x,y,EL_BETON);
+ DrawScreenElement(x, y, EL_BETON);
return;
}
element = Feld[ux][uy];
- if (IS_MOVING(ux,uy))
+ if (IS_MOVING(ux, uy))
{
- int horiz_move = (MovDir[ux][uy]==MV_LEFT || MovDir[ux][uy]==MV_RIGHT);
+ int horiz_move = (MovDir[ux][uy] == MV_LEFT || MovDir[ux][uy] == MV_RIGHT);
boolean cut_mode = NO_CUTTING;
- if (Store[ux][uy]==EL_MORAST_LEER ||
- Store[ux][uy]==EL_SIEB_LEER ||
- Store[ux][uy]==EL_SIEB2_LEER ||
- Store[ux][uy]==EL_AMOEBE_NASS)
+ if (Store[ux][uy] == EL_MORAST_LEER ||
+ Store[ux][uy] == EL_SIEB_LEER ||
+ Store[ux][uy] == EL_SIEB2_LEER ||
+ Store[ux][uy] == EL_AMOEBE_NASS)
cut_mode = CUT_ABOVE;
- else if (Store[ux][uy]==EL_MORAST_VOLL ||
- Store[ux][uy]==EL_SIEB_VOLL ||
- Store[ux][uy]==EL_SIEB2_VOLL)
+ else if (Store[ux][uy] == EL_MORAST_VOLL ||
+ Store[ux][uy] == EL_SIEB_VOLL ||
+ Store[ux][uy] == EL_SIEB2_VOLL)
cut_mode = CUT_BELOW;
- if (cut_mode==CUT_ABOVE)
- DrawScreenElementShifted(x,y, 0,0, Store[ux][uy], NO_CUTTING);
+ if (cut_mode == CUT_ABOVE)
+ DrawScreenElementShifted(x, y, 0, 0, Store[ux][uy], NO_CUTTING);
else
- DrawScreenElement(x,y,EL_LEERRAUM);
+ DrawScreenElement(x, y, EL_LEERRAUM);
if (horiz_move)
- DrawScreenElementShifted(x,y, MovPos[ux][uy],0, element, NO_CUTTING);
+ DrawScreenElementShifted(x, y, MovPos[ux][uy], 0, element, NO_CUTTING);
else
- DrawScreenElementShifted(x,y, 0,MovPos[ux][uy], element, cut_mode);
+ DrawScreenElementShifted(x, y, 0, MovPos[ux][uy], element, cut_mode);
if (Store[ux][uy] == EL_SALZSAEURE)
- DrawLevelElementThruMask(ux,uy+1, EL_SALZSAEURE);
+ DrawLevelElementThruMask(ux, uy + 1, EL_SALZSAEURE);
}
- else if (IS_BLOCKED(ux,uy))
+ else if (IS_BLOCKED(ux, uy))
{
- int oldx,oldy;
+ int oldx, oldy;
int sx, sy;
int horiz_move;
boolean cut_mode = NO_CUTTING;
- Blocked2Moving(ux,uy,&oldx,&oldy);
+ Blocked2Moving(ux, uy, &oldx, &oldy);
sx = SCREENX(oldx);
sy = SCREENY(oldy);
- horiz_move = (MovDir[oldx][oldy]==MV_LEFT || MovDir[oldx][oldy]==MV_RIGHT);
+ horiz_move = (MovDir[oldx][oldy] == MV_LEFT ||
+ MovDir[oldx][oldy] == MV_RIGHT);
- if (Store[oldx][oldy]==EL_MORAST_LEER ||
- Store[oldx][oldy]==EL_SIEB_LEER ||
- Store[oldx][oldy]==EL_SIEB2_LEER ||
- Store[oldx][oldy]==EL_AMOEBE_NASS)
+ if (Store[oldx][oldy] == EL_MORAST_LEER ||
+ Store[oldx][oldy] == EL_SIEB_LEER ||
+ Store[oldx][oldy] == EL_SIEB2_LEER ||
+ Store[oldx][oldy] == EL_AMOEBE_NASS)
cut_mode = CUT_ABOVE;
- DrawScreenElement(x,y,EL_LEERRAUM);
+ DrawScreenElement(x, y, EL_LEERRAUM);
element = Feld[oldx][oldy];
if (horiz_move)
DrawScreenElementShifted(sx,sy, 0,MovPos[oldx][oldy],element,cut_mode);
}
else if (IS_DRAWABLE(element))
- DrawScreenElement(x,y,element);
+ DrawScreenElement(x, y, element);
else
- DrawScreenElement(x,y,EL_LEERRAUM);
+ DrawScreenElement(x, y, EL_LEERRAUM);
}
void DrawLevelField(int x, int y)
{
- if (IN_SCR_FIELD(SCREENX(x),SCREENY(y)))
- DrawScreenField(SCREENX(x),SCREENY(y));
- else if (IS_MOVING(x,y))
+ if (IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
+ DrawScreenField(SCREENX(x), SCREENY(y));
+ else if (IS_MOVING(x, y))
{
int newx,newy;
- Moving2Blocked(x,y,&newx,&newy);
- if (IN_SCR_FIELD(SCREENX(newx),SCREENY(newy)))
- DrawScreenField(SCREENX(newx),SCREENY(newy));
+ Moving2Blocked(x, y, &newx, &newy);
+ if (IN_SCR_FIELD(SCREENX(newx), SCREENY(newy)))
+ DrawScreenField(SCREENX(newx), SCREENY(newy));
}
- else if (IS_BLOCKED(x,y))
+ else if (IS_BLOCKED(x, y))
{
- int oldx,oldy;
+ int oldx, oldy;
- Blocked2Moving(x,y,&oldx,&oldy);
- if (IN_SCR_FIELD(SCREENX(oldx),SCREENY(oldy)))
- DrawScreenField(SCREENX(oldx),SCREENY(oldy));
+ Blocked2Moving(x, y, &oldx, &oldy);
+ if (IN_SCR_FIELD(SCREENX(oldx), SCREENY(oldy)))
+ DrawScreenField(SCREENX(oldx), SCREENY(oldy));
}
}
if (!element)
{
- DrawMiniGraphic(x,y,-1);
+ DrawMiniGraphic(x, y, -1);
return;
}
graphic = el2gfx(element);
- DrawMiniGraphic(x,y,graphic);
+ DrawMiniGraphic(x, y, graphic);
}
void DrawMiniElementOrWall(int sx, int sy, int scroll_x, int scroll_y)
{
int x = sx + scroll_x, y = sy + scroll_y;
- if (x<-1 || x>lev_fieldx || y<-1 || y>lev_fieldy)
- DrawMiniElement(sx,sy,EL_LEERRAUM);
- else if (x==-1 || x==lev_fieldx || y==-1 || y==lev_fieldy)
- DrawMiniElement(sx,sy,EL_BETON);
+ if (x < -1 || x > lev_fieldx || y < -1 || y > lev_fieldy)
+ DrawMiniElement(sx, sy, EL_LEERRAUM);
+ else if (x == -1 || x == lev_fieldx || y == -1 || y == lev_fieldy)
+ DrawMiniElement(sx, sy, EL_BETON);
else
- DrawMiniElement(sx,sy,Feld[x][y]);
+ DrawMiniElement(sx, sy, Feld[x][y]);
}
void DrawMicroElement(int xpos, int ypos, int element)
{
int graphic;
- if (element==EL_LEERRAUM)
+ if (element == EL_LEERRAUM)
return;
graphic = el2gfx(element);
- XCopyArea(display,pix[PIX_BACK],drawto,gc,
- MICRO_GFX_STARTX+(graphic % MICRO_GFX_PER_LINE)*MICRO_TILEX,
- MICRO_GFX_STARTY+(graphic / MICRO_GFX_PER_LINE)*MICRO_TILEY,
- MICRO_TILEX,MICRO_TILEY, xpos,ypos);
+ XCopyArea(display, pix[PIX_BACK], drawto, gc,
+ MICRO_GFX_STARTX + (graphic % MICRO_GFX_PER_LINE) * MICRO_TILEX,
+ MICRO_GFX_STARTY + (graphic / MICRO_GFX_PER_LINE) * MICRO_TILEY,
+ MICRO_TILEX, MICRO_TILEY, xpos, ypos);
}
void DrawLevel()
for(x=BX1; x<=BX2; x++)
for(y=BY1; y<=BY2; y++)
- DrawScreenField(x,y);
+ DrawScreenField(x, y);
if (setup.soft_scrolling)
- XCopyArea(display,fieldbuffer,backbuffer,gc,
- FX,FY, SXSIZE,SYSIZE,
- SX,SY);
+ XCopyArea(display, fieldbuffer, backbuffer, gc,
+ FX, FY, SXSIZE, SYSIZE, SX, SY);
redraw_mask |= (REDRAW_FIELD | REDRAW_FROM_BACKBUFFER);
}
ClearWindow();
- for(x=0;x<2*SCR_FIELDX;x++)
- for(y=0;y<2*SCR_FIELDY;y++)
- DrawMiniElementOrWall(x,y,scroll_x,scroll_y);
+ for(x=0; x<2*SCR_FIELDX; x++)
+ for(y=0; y<2*SCR_FIELDY; y++)
+ DrawMiniElementOrWall(x, y, scroll_x, scroll_y);
redraw_mask |= REDRAW_FIELD;
}
{
int x,y;
- XFillRectangle(display,drawto,gc,
- xpos-MICRO_TILEX,ypos-MICRO_TILEY,
- MICRO_TILEX*(STD_LEV_FIELDX+2),
- MICRO_TILEY*(STD_LEV_FIELDY+2));
+ XFillRectangle(display, drawto, gc,
+ xpos - MICRO_TILEX, ypos - MICRO_TILEY,
+ MICRO_TILEX * (STD_LEV_FIELDX + 2),
+ MICRO_TILEY * (STD_LEV_FIELDY + 2));
if (lev_fieldx < STD_LEV_FIELDX)
xpos += (STD_LEV_FIELDX - lev_fieldx)/2 * MICRO_TILEX;
if (lev_fieldy < STD_LEV_FIELDY)
ypos += (STD_LEV_FIELDY - lev_fieldy)/2 * MICRO_TILEY;
- for(x=-1;x<=STD_LEV_FIELDX;x++)
- for(y=-1;y<=STD_LEV_FIELDY;y++)
- if (x>=0 && x<lev_fieldx && y>=0 && y<lev_fieldy)
- DrawMicroElement(xpos+MICRO_TILEX*x,ypos+MICRO_TILEY*y,
- Feld[x][y]=Ur[x][y]);
- else if (x>=-1 && x<lev_fieldx+1 && y>=-1 && y<lev_fieldy+1)
- DrawMicroElement(xpos+MICRO_TILEX*x,ypos+MICRO_TILEY*y,
+ for(x=-1; x<=STD_LEV_FIELDX; x++)
+ for(y=-1; y<=STD_LEV_FIELDY; y++)
+ if (x >= 0 && x < lev_fieldx && y >= 0 && y < lev_fieldy)
+ DrawMicroElement(xpos + x * MICRO_TILEX, ypos + y * MICRO_TILEY,
+ Ur[x][y]);
+ else if (x >= -1 && x < lev_fieldx+1 && y >= -1 && y < lev_fieldy+1)
+ DrawMicroElement(xpos + x * MICRO_TILEX, ypos + y * MICRO_TILEY,
EL_BETON);
- XFillRectangle(display,drawto,gc, SX,MICROLABEL_YPOS, SXSIZE,FONT4_YSIZE);
+ XFillRectangle(display, drawto,gc, SX, MICROLABEL_YPOS, SXSIZE, FONT4_YSIZE);
if (level.name)
{
int len = strlen(level.name);
- int lxpos = SX+(SXSIZE-len*FONT4_XSIZE)/2;
+ int lxpos = SX + (SXSIZE - len * FONT4_XSIZE) / 2;
int lypos = MICROLABEL_YPOS;
- DrawText(lxpos,lypos,level.name,FS_SMALL,FC_SPECIAL2);
+ DrawText(lxpos, lypos, level.name, FS_SMALL, FC_SPECIAL2);
}
redraw_mask |= REDRAW_MICROLEV;
int REQ_in_range(int x, int y)
{
- if (y>DY+249 && y<DY+278)
+ if (y > DY+249 && y < DY+278)
{
- if (x>DX+1 && x<DX+48)
- return(1);
- else if (x>DX+51 && x<DX+98)
- return(2);
+ if (x > DX+1 && x < DX+48)
+ return 1;
+ else if (x > DX+51 && x < DX+98)
+ return 2;
}
- return(0);
+ return 0;
}
boolean Request(char *text, unsigned int req_state)
{
- int mx,my, ty, result = -1;
+ int mx, my, ty, result = -1;
unsigned int old_door_state;
/* pause network game while waiting for request to answer */
CloseDoor(DOOR_CLOSE_1);
/* Alten Türinhalt sichern */
- XCopyArea(display,pix[PIX_DB_DOOR],pix[PIX_DB_DOOR],gc,
- DOOR_GFX_PAGEX1,DOOR_GFX_PAGEY1, DXSIZE,DYSIZE,
- DOOR_GFX_PAGEX2,DOOR_GFX_PAGEY1);
+ XCopyArea(display, pix[PIX_DB_DOOR], pix[PIX_DB_DOOR], gc,
+ DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE,
+ DOOR_GFX_PAGEX2, DOOR_GFX_PAGEY1);
/* Fragetext schreiben */
- XFillRectangle(display,pix[PIX_DB_DOOR],gc,
- DOOR_GFX_PAGEX1,DOOR_GFX_PAGEY1,DXSIZE,DYSIZE);
+ XFillRectangle(display, pix[PIX_DB_DOOR], gc,
+ DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE);
- for(ty=0;ty<13;ty++)
+ for(ty=0; ty<13; ty++)
{
- int tx,tl,tc;
+ int tx, tl, tc;
char txt[256];
- if (!(*text))
+ if (!*text)
break;
- for(tl=0,tx=0;tx<7;tl++,tx++)
+
+ for(tl=0,tx=0; tx<7; tl++,tx++)
{
- tc=*(text+tx);
- if (!tc || tc==32)
+ tc = *(text + tx);
+ if (!tc || tc == 32)
break;
}
if (!tl)
ty--;
continue;
}
- sprintf(txt,text);
- txt[tl]=0;
- DrawTextExt(pix[PIX_DB_DOOR],gc,
- DOOR_GFX_PAGEX1+51-(tl*14)/2,SY+ty*16,txt,FS_SMALL,FC_YELLOW);
- text+=(tl+(tc==32));
+ sprintf(txt, text);
+ txt[tl] = 0;
+ DrawTextExt(pix[PIX_DB_DOOR], gc,
+ DOOR_GFX_PAGEX1 + 51 - (tl * 14)/2, SY + ty * 16,
+ txt, FS_SMALL, FC_YELLOW);
+ text += tl + (tc == 32 ? 1 : 0);
}
if (req_state & REQ_ASK)
if (door_state & DOOR_COPY_BACK)
{
- XCopyArea(display,pix[PIX_DB_DOOR],pix[PIX_DB_DOOR],gc,
- DOOR_GFX_PAGEX2,DOOR_GFX_PAGEY1, DXSIZE,DYSIZE+VYSIZE,
- DOOR_GFX_PAGEX1,DOOR_GFX_PAGEY1);
+ XCopyArea(display, pix[PIX_DB_DOOR], pix[PIX_DB_DOOR], gc,
+ DOOR_GFX_PAGEX2, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE + VYSIZE,
+ DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1);
door_state &= ~DOOR_COPY_BACK;
}
{
unsigned int new_door_state;
- XCopyArea(display,backbuffer,pix[PIX_DB_DOOR],gc,
- DX,DY, DXSIZE,DYSIZE, DOOR_GFX_PAGEX1,DOOR_GFX_PAGEY1);
- XCopyArea(display,backbuffer,pix[PIX_DB_DOOR],gc,
- VX,VY, VXSIZE,VYSIZE, DOOR_GFX_PAGEX1,DOOR_GFX_PAGEY2);
+ XCopyArea(display, backbuffer, pix[PIX_DB_DOOR], gc,
+ DX, DY, DXSIZE, DYSIZE, DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1);
+ XCopyArea(display, backbuffer, pix[PIX_DB_DOOR], gc,
+ VX, VY, VXSIZE, VYSIZE, DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY2);
new_door_state = MoveDoor(door_state);
if (door_state == DOOR_GET_STATE)
return(door1 | door2);
- if (door1==DOOR_OPEN_1 && door_state & DOOR_OPEN_1)
+ if (door1 == DOOR_OPEN_1 && door_state & DOOR_OPEN_1)
door_state &= ~DOOR_OPEN_1;
- else if (door1==DOOR_CLOSE_1 && door_state & DOOR_CLOSE_1)
+ else if (door1 == DOOR_CLOSE_1 && door_state & DOOR_CLOSE_1)
door_state &= ~DOOR_CLOSE_1;
- if (door2==DOOR_OPEN_2 && door_state & DOOR_OPEN_2)
+ if (door2 == DOOR_OPEN_2 && door_state & DOOR_OPEN_2)
door_state &= ~DOOR_OPEN_2;
- else if (door2==DOOR_CLOSE_2 && door_state & DOOR_CLOSE_2)
+ else if (door2 == DOOR_CLOSE_2 && door_state & DOOR_CLOSE_2)
door_state &= ~DOOR_CLOSE_2;
if (setup.quick_doors)
if (door_state & DOOR_ACTION)
{
if (!(door_state & DOOR_NO_DELAY))
- PlaySoundStereo(SND_OEFFNEN,PSND_MAX_RIGHT);
+ PlaySoundStereo(SND_OEFFNEN, PSND_MAX_RIGHT);
start = ((door_state & DOOR_NO_DELAY) ? DXSIZE : 0);
if (door_state & DOOR_ACTION_1)
{
int i = (door_state & DOOR_OPEN_1 ? DXSIZE-x : x);
- int j = (DXSIZE - i)/3;
-
- XCopyArea(display,pix[PIX_DB_DOOR],drawto,gc,
- DOOR_GFX_PAGEX1,DOOR_GFX_PAGEY1+i/2,
- DXSIZE,DYSIZE-i/2, DX,DY);
-
- XFillRectangle(display,drawto,gc,DX,DY+DYSIZE-i/2,DXSIZE,i/2);
-
- XSetClipOrigin(display,clip_gc[PIX_DOOR],
- DX-i,(DY+j)-DOOR_GFX_PAGEY1);
- XCopyArea(display,pix[PIX_DOOR],drawto,clip_gc[PIX_DOOR],
- DXSIZE,DOOR_GFX_PAGEY1, i,77, DX+DXSIZE-i,DY+j);
- XCopyArea(display,pix[PIX_DOOR],drawto,clip_gc[PIX_DOOR],
- DXSIZE,DOOR_GFX_PAGEY1+140, i,63, DX+DXSIZE-i,DY+140+j);
- XSetClipOrigin(display,clip_gc[PIX_DOOR],
- DX-DXSIZE+i,DY-(DOOR_GFX_PAGEY1+j));
- XCopyArea(display,pix[PIX_DOOR],drawto,clip_gc[PIX_DOOR],
- DXSIZE-i,DOOR_GFX_PAGEY1+j, i,77-j, DX,DY);
- XCopyArea(display,pix[PIX_DOOR],drawto,clip_gc[PIX_DOOR],
- DXSIZE-i,DOOR_GFX_PAGEY1+140, i,63, DX,DY+140-j);
-
- XCopyArea(display,pix[PIX_DOOR],drawto,clip_gc[PIX_DOOR],
- DXSIZE-i,DOOR_GFX_PAGEY1+77, i,63,
- DX,DY+77-j);
- XCopyArea(display,pix[PIX_DOOR],drawto,clip_gc[PIX_DOOR],
- DXSIZE-i,DOOR_GFX_PAGEY1+203, i,77,
- DX,DY+203-j);
- XSetClipOrigin(display,clip_gc[PIX_DOOR],
- DX-i,(DY+j)-DOOR_GFX_PAGEY1);
- XCopyArea(display,pix[PIX_DOOR],drawto,clip_gc[PIX_DOOR],
- DXSIZE,DOOR_GFX_PAGEY1+77, i,63,
- DX+DXSIZE-i,DY+77+j);
- XCopyArea(display,pix[PIX_DOOR],drawto,clip_gc[PIX_DOOR],
- DXSIZE,DOOR_GFX_PAGEY1+203, i,77-j,
- DX+DXSIZE-i,DY+203+j);
+ int j = (DXSIZE - i) / 3;
+
+ XCopyArea(display, pix[PIX_DB_DOOR], drawto, gc,
+ DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1 + i/2,
+ DXSIZE,DYSIZE - i/2, DX, DY);
+
+ XFillRectangle(display, drawto, gc, DX, DY + DYSIZE - i/2, DXSIZE,i/2);
+
+ XSetClipOrigin(display, clip_gc[PIX_DOOR],
+ DX - i, (DY + j) - DOOR_GFX_PAGEY1);
+ XCopyArea(display, pix[PIX_DOOR], drawto,clip_gc[PIX_DOOR],
+ DXSIZE, DOOR_GFX_PAGEY1, i, 77, DX + DXSIZE - i, DY + j);
+ XCopyArea(display, pix[PIX_DOOR], drawto, clip_gc[PIX_DOOR],
+ DXSIZE, DOOR_GFX_PAGEY1 + 140, i, 63, DX + DXSIZE - i,
+ DY + 140 + j);
+ XSetClipOrigin(display, clip_gc[PIX_DOOR],
+ DX - DXSIZE + i, DY - (DOOR_GFX_PAGEY1 + j));
+ XCopyArea(display, pix[PIX_DOOR], drawto, clip_gc[PIX_DOOR],
+ DXSIZE - i, DOOR_GFX_PAGEY1 + j, i, 77 - j, DX, DY);
+ XCopyArea(display, pix[PIX_DOOR], drawto, clip_gc[PIX_DOOR],
+ DXSIZE-i, DOOR_GFX_PAGEY1 + 140, i, 63, DX, DY + 140 - j);
+
+ XCopyArea(display, pix[PIX_DOOR], drawto, clip_gc[PIX_DOOR],
+ DXSIZE - i, DOOR_GFX_PAGEY1 + 77, i, 63,
+ DX, DY + 77 - j);
+ XCopyArea(display, pix[PIX_DOOR], drawto, clip_gc[PIX_DOOR],
+ DXSIZE - i, DOOR_GFX_PAGEY1 + 203, i, 77,
+ DX, DY + 203 - j);
+ XSetClipOrigin(display, clip_gc[PIX_DOOR],
+ DX - i, (DY + j) - DOOR_GFX_PAGEY1);
+ XCopyArea(display, pix[PIX_DOOR], drawto, clip_gc[PIX_DOOR],
+ DXSIZE, DOOR_GFX_PAGEY1 + 77, i, 63,
+ DX + DXSIZE - i, DY + 77 + j);
+ XCopyArea(display, pix[PIX_DOOR], drawto, clip_gc[PIX_DOOR],
+ DXSIZE, DOOR_GFX_PAGEY1 + 203, i, 77 - j,
+ DX + DXSIZE - i, DY + 203 + j);
redraw_mask |= REDRAW_DOOR_1;
}
if (door_state & DOOR_ACTION_2)
{
- int i = (door_state & DOOR_OPEN_2 ? VXSIZE-x : x);
- int j = (VXSIZE - i)/3;
-
- XCopyArea(display,pix[PIX_DB_DOOR],drawto,gc,
- DOOR_GFX_PAGEX1,DOOR_GFX_PAGEY2+i/2,
- VXSIZE,VYSIZE-i/2, VX,VY);
-
- XFillRectangle(display,drawto,gc,VX,VY+VYSIZE-i/2,VXSIZE,i/2);
-
- XSetClipOrigin(display,clip_gc[PIX_DOOR],
- VX-i,(VY+j)-DOOR_GFX_PAGEY2);
- XCopyArea(display,pix[PIX_DOOR],drawto,clip_gc[PIX_DOOR],
- VXSIZE,DOOR_GFX_PAGEY2, i,VYSIZE/2, VX+VXSIZE-i,VY+j);
- XSetClipOrigin(display,clip_gc[PIX_DOOR],
- VX-VXSIZE+i,VY-(DOOR_GFX_PAGEY2+j));
- XCopyArea(display,pix[PIX_DOOR],drawto,clip_gc[PIX_DOOR],
- VXSIZE-i,DOOR_GFX_PAGEY2+j, i,VYSIZE/2-j, VX,VY);
-
- XCopyArea(display,pix[PIX_DOOR],drawto,clip_gc[PIX_DOOR],
- VXSIZE-i,DOOR_GFX_PAGEY2+VYSIZE/2, i,VYSIZE/2,
- VX,VY+VYSIZE/2-j);
- XSetClipOrigin(display,clip_gc[PIX_DOOR],
- VX-i,(VY+j)-DOOR_GFX_PAGEY2);
- XCopyArea(display,pix[PIX_DOOR],drawto,clip_gc[PIX_DOOR],
- VXSIZE,DOOR_GFX_PAGEY2+VYSIZE/2, i,VYSIZE/2-j,
- VX+VXSIZE-i,VY+VYSIZE/2+j);
+ int i = (door_state & DOOR_OPEN_2 ? VXSIZE - x : x);
+ int j = (VXSIZE - i) / 3;
+
+ XCopyArea(display, pix[PIX_DB_DOOR], drawto, gc,
+ DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY2 + i/2,
+ VXSIZE, VYSIZE - i/2, VX, VY);
+
+ XFillRectangle(display, drawto, gc, VX, VY + VYSIZE-i/2, VXSIZE, i/2);
+
+ XSetClipOrigin(display, clip_gc[PIX_DOOR],
+ VX - i, (VY + j) - DOOR_GFX_PAGEY2);
+ XCopyArea(display, pix[PIX_DOOR], drawto, clip_gc[PIX_DOOR],
+ VXSIZE, DOOR_GFX_PAGEY2, i, VYSIZE / 2, VX + VXSIZE-i, VY+j);
+ XSetClipOrigin(display, clip_gc[PIX_DOOR],
+ VX - VXSIZE + i, VY - (DOOR_GFX_PAGEY2 + j));
+ XCopyArea(display, pix[PIX_DOOR], drawto,clip_gc[PIX_DOOR],
+ VXSIZE - i, DOOR_GFX_PAGEY2 + j, i, VYSIZE / 2 - j, VX, VY);
+
+ XCopyArea(display, pix[PIX_DOOR], drawto, clip_gc[PIX_DOOR],
+ VXSIZE - i, DOOR_GFX_PAGEY2 + VYSIZE / 2, i, VYSIZE / 2,
+ VX, VY + VYSIZE / 2 - j);
+ XSetClipOrigin(display, clip_gc[PIX_DOOR],
+ VX - i, (VY + j) - DOOR_GFX_PAGEY2);
+ XCopyArea(display, pix[PIX_DOOR], drawto, clip_gc[PIX_DOOR],
+ VXSIZE, DOOR_GFX_PAGEY2 + VYSIZE / 2, i, VYSIZE / 2 - j,
+ VX + VXSIZE - i, VY + VYSIZE / 2 + j);
redraw_mask |= REDRAW_DOOR_2;
}
{
static XImage *pixelimage;
- pixelimage = XGetImage(display, d, x,y, 1,1, AllPlanes, ZPixmap);
- return(XGetPixel(pixelimage,0,0));
+ pixelimage = XGetImage(display, d, x, y, 1, 1, AllPlanes, ZPixmap);
+ return(XGetPixel(pixelimage, 0, 0));
}
int el2gfx(int element)
{
switch(element)
{
- case EL_LEERRAUM: return(-1);
- case EL_ERDREICH: return(GFX_ERDREICH);
- case EL_MAUERWERK: return(GFX_MAUERWERK);
- case EL_FELSBODEN: return(GFX_FELSBODEN);
- case EL_FELSBROCKEN: return(GFX_FELSBROCKEN);
- case EL_SCHLUESSEL: return(GFX_SCHLUESSEL);
- case EL_EDELSTEIN: return(GFX_EDELSTEIN);
- case EL_AUSGANG_ZU: return(GFX_AUSGANG_ZU);
- case EL_AUSGANG_ACT: return(GFX_AUSGANG_ACT);
- case EL_AUSGANG_AUF: return(GFX_AUSGANG_AUF);
- case EL_SPIELFIGUR: return(GFX_SPIELFIGUR);
- case EL_SPIELER1: return(GFX_SPIELER1);
- case EL_SPIELER2: return(GFX_SPIELER2);
- case EL_SPIELER3: return(GFX_SPIELER3);
- case EL_SPIELER4: return(GFX_SPIELER4);
- case EL_KAEFER: return(GFX_KAEFER);
- case EL_KAEFER_R: return(GFX_KAEFER_R);
- case EL_KAEFER_O: return(GFX_KAEFER_O);
- case EL_KAEFER_L: return(GFX_KAEFER_L);
- case EL_KAEFER_U: return(GFX_KAEFER_U);
- case EL_FLIEGER: return(GFX_FLIEGER);
- case EL_FLIEGER_R: return(GFX_FLIEGER_R);
- case EL_FLIEGER_O: return(GFX_FLIEGER_O);
- case EL_FLIEGER_L: return(GFX_FLIEGER_L);
- case EL_FLIEGER_U: return(GFX_FLIEGER_U);
- case EL_BUTTERFLY: return(GFX_BUTTERFLY);
- case EL_BUTTERFLY_R: return(GFX_BUTTERFLY_R);
- case EL_BUTTERFLY_O: return(GFX_BUTTERFLY_O);
- case EL_BUTTERFLY_L: return(GFX_BUTTERFLY_L);
- case EL_BUTTERFLY_U: return(GFX_BUTTERFLY_U);
- case EL_FIREFLY: return(GFX_FIREFLY);
- case EL_FIREFLY_R: return(GFX_FIREFLY_R);
- case EL_FIREFLY_O: return(GFX_FIREFLY_O);
- case EL_FIREFLY_L: return(GFX_FIREFLY_L);
- case EL_FIREFLY_U: return(GFX_FIREFLY_U);
- case EL_MAMPFER: return(GFX_MAMPFER);
- case EL_ROBOT: return(GFX_ROBOT);
- case EL_BETON: return(GFX_BETON);
- case EL_DIAMANT: return(GFX_DIAMANT);
- case EL_MORAST_LEER: return(GFX_MORAST_LEER);
- case EL_MORAST_VOLL: return(GFX_MORAST_VOLL);
- case EL_TROPFEN: return(GFX_TROPFEN);
- case EL_BOMBE: return(GFX_BOMBE);
- case EL_SIEB_LEER: return(GFX_SIEB_LEER);
- case EL_SIEB_VOLL: return(GFX_SIEB_VOLL);
- case EL_SIEB_TOT: return(GFX_SIEB_TOT);
- case EL_SALZSAEURE: return(GFX_SALZSAEURE);
- case EL_AMOEBE_TOT: return(GFX_AMOEBE_TOT);
- case EL_AMOEBE_NASS: return(GFX_AMOEBE_NASS);
- case EL_AMOEBE_NORM: return(GFX_AMOEBE_NORM);
- case EL_AMOEBE_VOLL: return(GFX_AMOEBE_VOLL);
- case EL_AMOEBE_BD: return(GFX_AMOEBE_BD);
- case EL_AMOEBA2DIAM: return(GFX_AMOEBA2DIAM);
- case EL_KOKOSNUSS: return(GFX_KOKOSNUSS);
- case EL_LIFE: return(GFX_LIFE);
- case EL_LIFE_ASYNC: return(GFX_LIFE_ASYNC);
- case EL_DYNAMIT: return(GFX_DYNAMIT);
- case EL_BADEWANNE: return(GFX_BADEWANNE);
- case EL_BADEWANNE1: return(GFX_BADEWANNE1);
- case EL_BADEWANNE2: return(GFX_BADEWANNE2);
- case EL_BADEWANNE3: return(GFX_BADEWANNE3);
- case EL_BADEWANNE4: return(GFX_BADEWANNE4);
- case EL_BADEWANNE5: return(GFX_BADEWANNE5);
- case EL_ABLENK_AUS: return(GFX_ABLENK_AUS);
- case EL_ABLENK_EIN: return(GFX_ABLENK_EIN);
- case EL_SCHLUESSEL1: return(GFX_SCHLUESSEL1);
- case EL_SCHLUESSEL2: return(GFX_SCHLUESSEL2);
- case EL_SCHLUESSEL3: return(GFX_SCHLUESSEL3);
- case EL_SCHLUESSEL4: return(GFX_SCHLUESSEL4);
- case EL_PFORTE1: return(GFX_PFORTE1);
- case EL_PFORTE2: return(GFX_PFORTE2);
- case EL_PFORTE3: return(GFX_PFORTE3);
- case EL_PFORTE4: return(GFX_PFORTE4);
- case EL_PFORTE1X: return(GFX_PFORTE1X);
- case EL_PFORTE2X: return(GFX_PFORTE2X);
- case EL_PFORTE3X: return(GFX_PFORTE3X);
- case EL_PFORTE4X: return(GFX_PFORTE4X);
- case EL_DYNAMIT_AUS: return(GFX_DYNAMIT_AUS);
- case EL_PACMAN: return(GFX_PACMAN);
- case EL_PACMAN_R: return(GFX_PACMAN_R);
- case EL_PACMAN_O: return(GFX_PACMAN_O);
- case EL_PACMAN_L: return(GFX_PACMAN_L);
- case EL_PACMAN_U: return(GFX_PACMAN_U);
- case EL_UNSICHTBAR: return(GFX_UNSICHTBAR);
- case EL_ERZ_EDEL: return(GFX_ERZ_EDEL);
- case EL_ERZ_DIAM: return(GFX_ERZ_DIAM);
- case EL_BIRNE_AUS: return(GFX_BIRNE_AUS);
- case EL_BIRNE_EIN: return(GFX_BIRNE_EIN);
- case EL_ZEIT_VOLL: return(GFX_ZEIT_VOLL);
- case EL_ZEIT_LEER: return(GFX_ZEIT_LEER);
- case EL_MAUER_LEBT: return(GFX_MAUER_LEBT);
- case EL_MAUER_X: return(GFX_MAUER_X);
- case EL_MAUER_Y: return(GFX_MAUER_Y);
- case EL_MAUER_XY: return(GFX_MAUER_XY);
- case EL_EDELSTEIN_BD: return(GFX_EDELSTEIN_BD);
- case EL_EDELSTEIN_GELB: return(GFX_EDELSTEIN_GELB);
- case EL_EDELSTEIN_ROT: return(GFX_EDELSTEIN_ROT);
- case EL_EDELSTEIN_LILA: return(GFX_EDELSTEIN_LILA);
- case EL_ERZ_EDEL_BD: return(GFX_ERZ_EDEL_BD);
- case EL_ERZ_EDEL_GELB: return(GFX_ERZ_EDEL_GELB);
- case EL_ERZ_EDEL_ROT: return(GFX_ERZ_EDEL_ROT);
- case EL_ERZ_EDEL_LILA: return(GFX_ERZ_EDEL_LILA);
- case EL_MAMPFER2: return(GFX_MAMPFER2);
- case EL_SIEB2_LEER: return(GFX_SIEB2_LEER);
- case EL_SIEB2_VOLL: return(GFX_SIEB2_VOLL);
- case EL_SIEB2_TOT: return(GFX_SIEB2_TOT);
- case EL_DYNABOMB: return(GFX_DYNABOMB);
- case EL_DYNABOMB_NR: return(GFX_DYNABOMB_NR);
- case EL_DYNABOMB_SZ: return(GFX_DYNABOMB_SZ);
- case EL_DYNABOMB_XL: return(GFX_DYNABOMB_XL);
- case EL_SOKOBAN_OBJEKT: return(GFX_SOKOBAN_OBJEKT);
- case EL_SOKOBAN_FELD_LEER: return(GFX_SOKOBAN_FELD_LEER);
- case EL_SOKOBAN_FELD_VOLL: return(GFX_SOKOBAN_FELD_VOLL);
- case EL_MAULWURF: return(GFX_MAULWURF);
- case EL_PINGUIN: return(GFX_PINGUIN);
- case EL_SCHWEIN: return(GFX_SCHWEIN);
- case EL_DRACHE: return(GFX_DRACHE);
- case EL_SONDE: return(GFX_SONDE);
- case EL_PFEIL_L: return(GFX_PFEIL_L);
- case EL_PFEIL_R: return(GFX_PFEIL_R);
- case EL_PFEIL_O: return(GFX_PFEIL_O);
- case EL_PFEIL_U: return(GFX_PFEIL_U);
+ case EL_LEERRAUM: return -1;
+ case EL_ERDREICH: return GFX_ERDREICH;
+ case EL_MAUERWERK: return GFX_MAUERWERK;
+ case EL_FELSBODEN: return GFX_FELSBODEN;
+ case EL_FELSBROCKEN: return GFX_FELSBROCKEN;
+ case EL_SCHLUESSEL: return GFX_SCHLUESSEL;
+ case EL_EDELSTEIN: return GFX_EDELSTEIN;
+ case EL_AUSGANG_ZU: return GFX_AUSGANG_ZU;
+ case EL_AUSGANG_ACT: return GFX_AUSGANG_ACT;
+ case EL_AUSGANG_AUF: return GFX_AUSGANG_AUF;
+ case EL_SPIELFIGUR: return GFX_SPIELFIGUR;
+ case EL_SPIELER1: return GFX_SPIELER1;
+ case EL_SPIELER2: return GFX_SPIELER2;
+ case EL_SPIELER3: return GFX_SPIELER3;
+ case EL_SPIELER4: return GFX_SPIELER4;
+ case EL_KAEFER: return GFX_KAEFER;
+ case EL_KAEFER_R: return GFX_KAEFER_R;
+ case EL_KAEFER_O: return GFX_KAEFER_O;
+ case EL_KAEFER_L: return GFX_KAEFER_L;
+ case EL_KAEFER_U: return GFX_KAEFER_U;
+ case EL_FLIEGER: return GFX_FLIEGER;
+ case EL_FLIEGER_R: return GFX_FLIEGER_R;
+ case EL_FLIEGER_O: return GFX_FLIEGER_O;
+ case EL_FLIEGER_L: return GFX_FLIEGER_L;
+ case EL_FLIEGER_U: return GFX_FLIEGER_U;
+ case EL_BUTTERFLY: return GFX_BUTTERFLY;
+ case EL_BUTTERFLY_R: return GFX_BUTTERFLY_R;
+ case EL_BUTTERFLY_O: return GFX_BUTTERFLY_O;
+ case EL_BUTTERFLY_L: return GFX_BUTTERFLY_L;
+ case EL_BUTTERFLY_U: return GFX_BUTTERFLY_U;
+ case EL_FIREFLY: return GFX_FIREFLY;
+ case EL_FIREFLY_R: return GFX_FIREFLY_R;
+ case EL_FIREFLY_O: return GFX_FIREFLY_O;
+ case EL_FIREFLY_L: return GFX_FIREFLY_L;
+ case EL_FIREFLY_U: return GFX_FIREFLY_U;
+ case EL_MAMPFER: return GFX_MAMPFER;
+ case EL_ROBOT: return GFX_ROBOT;
+ case EL_BETON: return GFX_BETON;
+ case EL_DIAMANT: return GFX_DIAMANT;
+ case EL_MORAST_LEER: return GFX_MORAST_LEER;
+ case EL_MORAST_VOLL: return GFX_MORAST_VOLL;
+ case EL_TROPFEN: return GFX_TROPFEN;
+ case EL_BOMBE: return GFX_BOMBE;
+ case EL_SIEB_LEER: return GFX_SIEB_LEER;
+ case EL_SIEB_VOLL: return GFX_SIEB_VOLL;
+ case EL_SIEB_TOT: return GFX_SIEB_TOT;
+ case EL_SALZSAEURE: return GFX_SALZSAEURE;
+ case EL_AMOEBE_TOT: return GFX_AMOEBE_TOT;
+ case EL_AMOEBE_NASS: return GFX_AMOEBE_NASS;
+ case EL_AMOEBE_NORM: return GFX_AMOEBE_NORM;
+ case EL_AMOEBE_VOLL: return GFX_AMOEBE_VOLL;
+ case EL_AMOEBE_BD: return GFX_AMOEBE_BD;
+ case EL_AMOEBA2DIAM: return GFX_AMOEBA2DIAM;
+ case EL_KOKOSNUSS: return GFX_KOKOSNUSS;
+ case EL_LIFE: return GFX_LIFE;
+ case EL_LIFE_ASYNC: return GFX_LIFE_ASYNC;
+ case EL_DYNAMIT: return GFX_DYNAMIT;
+ case EL_BADEWANNE: return GFX_BADEWANNE;
+ case EL_BADEWANNE1: return GFX_BADEWANNE1;
+ case EL_BADEWANNE2: return GFX_BADEWANNE2;
+ case EL_BADEWANNE3: return GFX_BADEWANNE3;
+ case EL_BADEWANNE4: return GFX_BADEWANNE4;
+ case EL_BADEWANNE5: return GFX_BADEWANNE5;
+ case EL_ABLENK_AUS: return GFX_ABLENK_AUS;
+ case EL_ABLENK_EIN: return GFX_ABLENK_EIN;
+ case EL_SCHLUESSEL1: return GFX_SCHLUESSEL1;
+ case EL_SCHLUESSEL2: return GFX_SCHLUESSEL2;
+ case EL_SCHLUESSEL3: return GFX_SCHLUESSEL3;
+ case EL_SCHLUESSEL4: return GFX_SCHLUESSEL4;
+ case EL_PFORTE1: return GFX_PFORTE1;
+ case EL_PFORTE2: return GFX_PFORTE2;
+ case EL_PFORTE3: return GFX_PFORTE3;
+ case EL_PFORTE4: return GFX_PFORTE4;
+ case EL_PFORTE1X: return GFX_PFORTE1X;
+ case EL_PFORTE2X: return GFX_PFORTE2X;
+ case EL_PFORTE3X: return GFX_PFORTE3X;
+ case EL_PFORTE4X: return GFX_PFORTE4X;
+ case EL_DYNAMIT_AUS: return GFX_DYNAMIT_AUS;
+ case EL_PACMAN: return GFX_PACMAN;
+ case EL_PACMAN_R: return GFX_PACMAN_R;
+ case EL_PACMAN_O: return GFX_PACMAN_O;
+ case EL_PACMAN_L: return GFX_PACMAN_L;
+ case EL_PACMAN_U: return GFX_PACMAN_U;
+ case EL_UNSICHTBAR: return GFX_UNSICHTBAR;
+ case EL_ERZ_EDEL: return GFX_ERZ_EDEL;
+ case EL_ERZ_DIAM: return GFX_ERZ_DIAM;
+ case EL_BIRNE_AUS: return GFX_BIRNE_AUS;
+ case EL_BIRNE_EIN: return GFX_BIRNE_EIN;
+ case EL_ZEIT_VOLL: return GFX_ZEIT_VOLL;
+ case EL_ZEIT_LEER: return GFX_ZEIT_LEER;
+ case EL_MAUER_LEBT: return GFX_MAUER_LEBT;
+ case EL_MAUER_X: return GFX_MAUER_X;
+ case EL_MAUER_Y: return GFX_MAUER_Y;
+ case EL_MAUER_XY: return GFX_MAUER_XY;
+ case EL_EDELSTEIN_BD: return GFX_EDELSTEIN_BD;
+ case EL_EDELSTEIN_GELB: return GFX_EDELSTEIN_GELB;
+ case EL_EDELSTEIN_ROT: return GFX_EDELSTEIN_ROT;
+ case EL_EDELSTEIN_LILA: return GFX_EDELSTEIN_LILA;
+ case EL_ERZ_EDEL_BD: return GFX_ERZ_EDEL_BD;
+ case EL_ERZ_EDEL_GELB: return GFX_ERZ_EDEL_GELB;
+ case EL_ERZ_EDEL_ROT: return GFX_ERZ_EDEL_ROT;
+ case EL_ERZ_EDEL_LILA: return GFX_ERZ_EDEL_LILA;
+ case EL_MAMPFER2: return GFX_MAMPFER2;
+ case EL_SIEB2_LEER: return GFX_SIEB2_LEER;
+ case EL_SIEB2_VOLL: return GFX_SIEB2_VOLL;
+ case EL_SIEB2_TOT: return GFX_SIEB2_TOT;
+ case EL_DYNABOMB: return GFX_DYNABOMB;
+ case EL_DYNABOMB_NR: return GFX_DYNABOMB_NR;
+ case EL_DYNABOMB_SZ: return GFX_DYNABOMB_SZ;
+ case EL_DYNABOMB_XL: return GFX_DYNABOMB_XL;
+ case EL_SOKOBAN_OBJEKT: return GFX_SOKOBAN_OBJEKT;
+ case EL_SOKOBAN_FELD_LEER: return GFX_SOKOBAN_FELD_LEER;
+ case EL_SOKOBAN_FELD_VOLL: return GFX_SOKOBAN_FELD_VOLL;
+ case EL_MAULWURF: return GFX_MAULWURF;
+ case EL_PINGUIN: return GFX_PINGUIN;
+ case EL_SCHWEIN: return GFX_SCHWEIN;
+ case EL_DRACHE: return GFX_DRACHE;
+ case EL_SONDE: return GFX_SONDE;
+ case EL_PFEIL_L: return GFX_PFEIL_L;
+ case EL_PFEIL_R: return GFX_PFEIL_R;
+ case EL_PFEIL_O: return GFX_PFEIL_O;
+ case EL_PFEIL_U: return GFX_PFEIL_U;
default:
{
if (IS_CHAR(element))
- return(GFX_CHAR_START + (element-EL_CHAR_START));
+ return GFX_CHAR_START + (element - EL_CHAR_START);
else
- return(-1);
+ return -1;
}
}
}