case XK_Q:
#endif
case XK_q:
- Dynamite = 1000;
+ local_player->dynamite = 1000;
break;
case XK_x:
if (!file)
{
- player = default_player;
+ *local_player = default_player;
level_nr = default_player.level_nr;
return;
}
if (mode==PLAYER_SETUP)
{
- player = new_player;
- if (player.leveldir_nr < num_leveldirs)
- leveldir_nr = player.leveldir_nr;
+ *local_player = new_player;
+ if (local_player->leveldir_nr < num_leveldirs)
+ leveldir_nr = local_player->leveldir_nr;
else
leveldir_nr = 0;
}
else
{
- player.handicap = new_player.handicap;
- player.level_nr = new_player.level_nr;
+ local_player->handicap = new_player.handicap;
+ local_player->level_nr = new_player.level_nr;
}
- level_nr = player.level_nr;
+ level_nr = local_player->level_nr;
fclose(file);
}
if (feof(file)) /* Spieler noch nicht in Liste enthalten */
break;
else /* prüfen, ob Spieler in Liste enthalten */
- if (!strncmp(default_player.login_name,player.login_name,MAX_NAMELEN-1))
+ if (!strncmp(default_player.login_name,
+ local_player->login_name, MAX_NAMELEN-1))
{
fseek(file,-(2*MAX_NAMELEN+1+2+1+(version_10_file ? 0 : 11)),SEEK_CUR);
break;
}
}
- player.level_nr = level_nr;
+ local_player->level_nr = level_nr;
for(i=0;i<MAX_NAMELEN;i++)
- fputc(player.login_name[i],file);
+ fputc(local_player->login_name[i],file);
for(i=0;i<MAX_NAMELEN;i++)
- fputc(player.alias_name[i],file);
- fputc(player.handicap,file);
- fputc(player.setup / 256,file);
- fputc(player.setup % 256,file);
- fputc(player.leveldir_nr,file);
+ fputc(local_player->alias_name[i],file);
+ fputc(local_player->handicap,file);
+ fputc(local_player->setup / 256,file);
+ fputc(local_player->setup % 256,file);
+ fputc(local_player->leveldir_nr,file);
if (!version_10_file)
{
- fputc(player.level_nr,file);
+ fputc(local_player->level_nr,file);
for(i=0;i<10;i++) /* currently unused bytes */
fputc(0,file);
}
--- /dev/null
+/* gadget.c */
+
+#include "gadget.h"
+
+struct Gadget *gadget_list;
+
+void NextGadgetEvent()
--- /dev/null
+/* gadget.h */
+
+/* gadget types */
+#define GD_TYPE_NORMAL_BUTTON (1<<0)
+#define GD_TYPE_TWO_STATE_BUTTON (1<<1)
+#define GD_TYPE_DRAWING_AREA (1<<2)
+#define GD_TYPE_TEXTINPUT (1<<3)
+#define GD_TYPE_TEXTOUTPUT (1<<4)
+#define GD_TYPE_NUMBERINPUT (1<<5)
+#define GD_TYPE_NUMBEROUTPUT (1<<6)
+
+/* gadget events */
+#define GD_EVENT_PRESSED (1<<0)
+#define GD_EVENT_RELEASED (1<<1)
+#define GD_EVENT_MOVING (1<<2)
+
+/* gadget structure constants */
+#define MAX_GADGET_TEXTSIZE 1024
+
+struct GadgetDesign
+{
+ Pixmap pixmap; /* Pixmap with gadget surface */
+ int x,y; /* position of rectangle in Pixmap */
+};
+
+struct Gadget
+{
+ int x,y; /* screen position */
+ int width,height; /* screen size */
+ unsigned long type; /* type (button, text input, ...) */
+ unsigned long state; /* state (pressed, released, ...) */
+ long number_value;
+ char text_value[MAX_GADGET_TEXTSIZE];
+ struct GadgetDesign *design[2]; /* 0: normal; 1: pressed */
+ struct GadgetDesign *alt_design[2]; /* alternative design */
+ unsigned long event; /* actual gadget event */
+ struct Gadget *next; /* next list entry */
+};
+
+struct NewGadget
+{
+ int x,y; /* screen position */
+ int width,height; /* screen size */
+ unsigned long type; /* type (button, text input, ...) */
+ struct GadgetDesign *design[2]; /* 0: normal; 1: pressed */
+ struct GadgetDesign *alt_design[2]; /* alternative design */
+ unsigned long value_mask; /* actual gadget event */
+};
+
+struct GadgetEvent
+{
+ unsigned long state; /* state (pressed, released, ...) */
+ int x,y; /* position inside drawing area */
+};
int old_joystick_nr = joystick_nr;
if (sound_status==SOUND_OFF)
- player.setup &= ~SETUP_SOUND;
+ local_player->setup &= ~SETUP_SOUND;
if (!sound_loops_allowed)
{
- player.setup &= ~SETUP_SOUND_LOOPS;
- player.setup &= ~SETUP_SOUND_MUSIC;
+ local_player->setup &= ~SETUP_SOUND_LOOPS;
+ local_player->setup &= ~SETUP_SOUND_MUSIC;
}
- sound_on = sound_simple_on = SETUP_SOUND_ON(player.setup);
- sound_loops_on = SETUP_SOUND_LOOPS_ON(player.setup);
- sound_music_on = SETUP_SOUND_MUSIC_ON(player.setup);
- toons_on = SETUP_TOONS_ON(player.setup);
- direct_draw_on = SETUP_DIRECT_DRAW_ON(player.setup);
- fading_on = SETUP_FADING_ON(player.setup);
- autorecord_on = SETUP_AUTO_RECORD_ON(player.setup);
- joystick_nr = SETUP_2ND_JOYSTICK_ON(player.setup);
- quick_doors = SETUP_QUICK_DOORS_ON(player.setup);
- scroll_delay_on = SETUP_SCROLL_DELAY_ON(player.setup);
- soft_scrolling_on = SETUP_SOFT_SCROLL_ON(player.setup);
+ sound_on = sound_simple_on = SETUP_SOUND_ON(local_player->setup);
+ sound_loops_on = SETUP_SOUND_LOOPS_ON(local_player->setup);
+ sound_music_on = SETUP_SOUND_MUSIC_ON(local_player->setup);
+ toons_on = SETUP_TOONS_ON(local_player->setup);
+ direct_draw_on = SETUP_DIRECT_DRAW_ON(local_player->setup);
+ fading_on = SETUP_FADING_ON(local_player->setup);
+ autorecord_on = SETUP_AUTO_RECORD_ON(local_player->setup);
+ joystick_nr = SETUP_2ND_JOYSTICK_ON(local_player->setup);
+ quick_doors = SETUP_QUICK_DOORS_ON(local_player->setup);
+ scroll_delay_on = SETUP_SCROLL_DELAY_ON(local_player->setup);
+ soft_scrolling_on = SETUP_SOFT_SCROLL_ON(local_player->setup);
#ifndef MSDOS
if (joystick_nr != old_joystick_nr)
BOOL emulate_bd = TRUE; /* unless non-BOULDERDASH elements found */
BOOL emulate_sb = TRUE; /* unless non-SOKOBAN elements found */
- Dynamite = Score = 0;
- Gems = level.edelsteine;
- SokobanFields = Lights = Friends = 0;
- DynaBombCount = DynaBombSize = DynaBombsLeft = 0;
- DynaBombXL = FALSE;
- Key[0] = Key[1] = Key[2] = Key[3] = FALSE;
+ local_player->active = TRUE;
+ local_player->local = TRUE;
+
+ actual_player = local_player;
+
+ actual_player->score = 0;
+
+ actual_player->gems_still_needed = level.edelsteine;
+ actual_player->sokobanfields_still_needed = 0;
+ actual_player->lights_still_needed = 0;
+ actual_player->friends_still_needed = 0;
+
+ for(i=0; i<4; i++)
+ actual_player->key[i] = FALSE;
+
+ actual_player->dynamite = 0;
+ actual_player->dynabomb_count = 0;
+ actual_player->dynabomb_size = 0;
+ actual_player->dynabombs_left = 0;
+ actual_player->dynabomb_xl = FALSE;
+
MampferNr = 0;
FrameCounter = 0;
TimeFrames = 0;
JY = lastJY = y;
break;
case EL_SPIELER2:
+ case EL_SPIELER3:
+ case EL_SPIELER4:
Feld[x][y] = EL_LEERRAUM;
break;
case EL_BADEWANNE:
MovDelay[x][y] = 96;
break;
case EL_BIRNE_AUS:
- Lights++;
+ local_player->lights_still_needed++;
break;
case EL_SOKOBAN_FELD_LEER:
- SokobanFields++;
+ local_player->sokobanfields_still_needed++;
break;
case EL_MAULWURF:
case EL_PINGUIN:
- Friends++;
+ local_player->friends_still_needed++;
break;
case EL_SCHWEIN:
case EL_DRACHE:
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(Gems,3),FS_SMALL,FC_YELLOW);
+ 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(Dynamite,3),FS_SMALL,FC_YELLOW);
+ 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(Score,5),FS_SMALL,FC_YELLOW);
+ 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);
if (TimeLeft)
{
if (sound_loops_on)
- PlaySoundExt(SND_SIRR,PSND_MAX_VOLUME,PSND_MAX_RIGHT,PSND_LOOP);
+ PlaySoundExt(SND_SIRR, PSND_MAX_VOLUME, PSND_MAX_RIGHT, PSND_LOOP);
- while(TimeLeft>0)
+ while(TimeLeft > 0)
{
if (!sound_loops_on)
- PlaySoundStereo(SND_SIRR,PSND_MAX_RIGHT);
+ PlaySoundStereo(SND_SIRR, PSND_MAX_RIGHT);
if (TimeLeft && !(TimeLeft % 10))
RaiseScore(level.score[SC_ZEITBONUS]);
if (TimeLeft > 100 && !(TimeLeft % 10))
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);
}
FadeSounds();
/* Hero disappears */
- DrawLevelElement(ExitX,ExitY,Feld[ExitX][ExitY]);
+ DrawLevelField(ExitX, ExitY);
BackToFront();
if (tape.playing)
SaveLevelTape(tape.level_nr); /* Ask to save tape */
}
- if (level_nr==player.handicap &&
- level_nr<leveldir[leveldir_nr].levels-1)
+ if (level_nr == local_player->handicap &&
+ level_nr < leveldir[leveldir_nr].levels-1)
{
- player.handicap++;
+ local_player->handicap++;
bumplevel = TRUE;
SavePlayerInfo(PLAYER_LEVEL);
}
- if ((hi_pos=NewHiScore())>=0)
+ if ((hi_pos=NewHiScore()) >= 0)
{
game_status = HALLOFFAME;
DrawHallOfFame(hi_pos);
LoadScore(level_nr);
- if (!strcmp(player.alias_name,EMPTY_ALIAS) ||
- Score<highscore[MAX_SCORE_ENTRIES-1].Score)
+ if (!strcmp(local_player->alias_name,EMPTY_ALIAS) ||
+ local_player->score < highscore[MAX_SCORE_ENTRIES-1].Score)
return(-1);
for(k=0;k<MAX_SCORE_ENTRIES;k++)
{
- if (Score>highscore[k].Score) /* Spieler kommt in Highscore-Liste */
+ if (local_player->score > highscore[k].Score)
{
+ /* Spieler kommt in Highscore-Liste */
+
if (k<MAX_SCORE_ENTRIES-1)
{
int m = MAX_SCORE_ENTRIES-1;
#ifdef ONE_PER_NAME
for(l=k;l<MAX_SCORE_ENTRIES;l++)
- if (!strcmp(player.alias_name,highscore[l].Name))
+ if (!strcmp(local_player->alias_name,highscore[l].Name))
m = l;
if (m==k) /* Spieler überschreibt seine alte Position */
goto put_into_list;
#ifdef ONE_PER_NAME
put_into_list:
#endif
- sprintf(highscore[k].Name,player.alias_name);
- highscore[k].Score = Score;
+ sprintf(highscore[k].Name,local_player->alias_name);
+ highscore[k].Score = local_player->score;
position = k;
break;
}
#ifdef ONE_PER_NAME
- else if (!strcmp(player.alias_name,highscore[k].Name))
+ else if (!strcmp(local_player->alias_name,highscore[k].Name))
break; /* Spieler schon mit besserer Punktzahl in der Liste */
#endif
if (element != EL_LEERRAUM &&
element != EL_ERDREICH &&
element != EL_EXPLODING &&
- !DynaBombXL)
+ !actual_player->dynabomb_xl)
break;
}
}
- DynaBombsLeft++;
+ actual_player->dynabombs_left++;
}
void Bang(int x, int y)
case EL_DYNABOMB_NR:
case EL_DYNABOMB_SZ:
case EL_DYNABOMB_XL:
- DynaExplode(x,y,DynaBombSize);
+ DynaExplode(x,y,actual_player->dynabomb_size);
break;
case EL_BIRNE_AUS:
case EL_BIRNE_EIN:
if (IN_SCR_FIELD(SCROLLX(newx),SCROLLY(newy)))
DrawGraphicThruMask(SCROLLX(newx),SCROLLY(newy),el2gfx(element));
- Friends--;
- if (!Friends && PlayerGone && !GameOver)
+ local_player->friends_still_needed--;
+ if (!local_player->friends_still_needed && PlayerGone && !GameOver)
LevelSolved = GameOver = TRUE;
return;
void AusgangstuerPruefen(int x, int y)
{
- if (!Gems && !SokobanFields && !Lights)
+ if (!local_player->gems_still_needed &&
+ !local_player->sokobanfields_still_needed &&
+ !local_player->lights_still_needed)
{
Feld[x][y] = EL_AUSGANG_ACT;
case EL_EDELSTEIN_LILA:
Feld[x][y] = EL_LEERRAUM;
MovDelay[x][y] = 0; /* wegen EDELSTEIN_BD-Funkeln! */
- if (Gems>0)
- Gems--;
+ if (local_player->gems_still_needed > 0)
+ local_player->gems_still_needed--;
RaiseScoreElement(EL_EDELSTEIN);
- DrawText(DX_EMERALDS,DY_EMERALDS,int2str(Gems,3),FS_SMALL,FC_YELLOW);
- PlaySoundLevel(x,y,SND_PONG);
+ DrawText(DX_EMERALDS, DY_EMERALDS,
+ int2str(local_player->gems_still_needed, 3),
+ FS_SMALL, FC_YELLOW);
+ PlaySoundLevel(x, y, SND_PONG);
break;
case EL_DIAMANT:
Feld[x][y] = EL_LEERRAUM;
- Gems -= 3;
- if (Gems<0)
- Gems=0;
+ local_player->gems_still_needed -= 3;
+ if (local_player->gems_still_needed < 0)
+ local_player->gems_still_needed = 0;
RaiseScoreElement(EL_DIAMANT);
- DrawText(DX_EMERALDS,DY_EMERALDS,int2str(Gems,3),FS_SMALL,FC_YELLOW);
- PlaySoundLevel(x,y,SND_PONG);
+ DrawText(DX_EMERALDS, DY_EMERALDS,
+ int2str(local_player->gems_still_needed, 3),
+ FS_SMALL, FC_YELLOW);
+ PlaySoundLevel(x, y, SND_PONG);
break;
case EL_DYNAMIT_AUS:
Feld[x][y] = EL_LEERRAUM;
- Dynamite++;
+ actual_player->dynamite++;
RaiseScoreElement(EL_DYNAMIT);
- DrawText(DX_DYNAMITE,DY_DYNAMITE,int2str(Dynamite,3),FS_SMALL,FC_YELLOW);
+ DrawText(DX_DYNAMITE, DY_DYNAMITE,
+ int2str(local_player->dynamite, 3),
+ FS_SMALL, FC_YELLOW);
PlaySoundLevel(x,y,SND_PONG);
break;
case EL_DYNABOMB_NR:
Feld[x][y] = EL_LEERRAUM;
- DynaBombCount++;
- DynaBombsLeft++;
+ actual_player->dynabomb_count++;
+ actual_player->dynabombs_left++;
RaiseScoreElement(EL_DYNAMIT);
PlaySoundLevel(x,y,SND_PONG);
break;
case EL_DYNABOMB_SZ:
Feld[x][y] = EL_LEERRAUM;
- DynaBombSize++;
+ actual_player->dynabomb_size++;
RaiseScoreElement(EL_DYNAMIT);
PlaySoundLevel(x,y,SND_PONG);
break;
case EL_DYNABOMB_XL:
Feld[x][y] = EL_LEERRAUM;
- DynaBombXL = TRUE;
+ actual_player->dynabomb_xl = TRUE;
RaiseScoreElement(EL_DYNAMIT);
PlaySoundLevel(x,y,SND_PONG);
break;
int key_nr = element-EL_SCHLUESSEL1;
Feld[x][y] = EL_LEERRAUM;
- Key[key_nr] = TRUE;
+ actual_player->key[key_nr] = TRUE;
RaiseScoreElement(EL_SCHLUESSEL);
DrawMiniGraphicExt(drawto,gc,
DX_KEYS+key_nr*MINI_TILEX,DY_KEYS,
case EL_PFORTE2:
case EL_PFORTE3:
case EL_PFORTE4:
- if (!Key[element-EL_PFORTE1])
+ if (!actual_player->key[element-EL_PFORTE1])
return(MF_NO_ACTION);
break;
case EL_PFORTE2X:
case EL_PFORTE3X:
case EL_PFORTE4X:
- if (!Key[element-EL_PFORTE1X])
+ if (!actual_player->key[element-EL_PFORTE1X])
return(MF_NO_ACTION);
break;
PlayerGone = TRUE;
PlaySoundLevel(x,y,SND_BUING);
- if (!Friends)
+ if (!local_player->friends_still_needed)
LevelSolved = GameOver = TRUE;
break;
case EL_BIRNE_AUS:
Feld[x][y] = EL_BIRNE_EIN;
- Lights--;
+ local_player->lights_still_needed--;
DrawLevelField(x,y);
PlaySoundLevel(x,y,SND_DENG);
return(MF_ACTION);
if (element == EL_SOKOBAN_FELD_VOLL)
{
Feld[x][y] = EL_SOKOBAN_FELD_LEER;
- SokobanFields++;
+ local_player->sokobanfields_still_needed++;
}
else
Feld[x][y] = EL_LEERRAUM;
if (Feld[x+dx][y+dy] == EL_SOKOBAN_FELD_LEER)
{
Feld[x+dx][y+dy] = EL_SOKOBAN_FELD_VOLL;
- SokobanFields--;
+ local_player->sokobanfields_still_needed--;
if (element == EL_SOKOBAN_OBJEKT)
PlaySoundLevel(x,y,SND_DENG);
}
PlaySoundLevel(x+dx,y+dy,SND_PUSCH);
if (IS_SB_ELEMENT(element) &&
- SokobanFields == 0 && game_emulation == EMU_SOKOBAN)
+ local_player->sokobanfields_still_needed == 0 &&
+ game_emulation == EMU_SOKOBAN)
{
LevelSolved = GameOver = TRUE;
PlaySoundLevel(x,y,SND_BUING);
element = Feld[JX][JY];
- if ((Dynamite==0 && DynaBombsLeft==0) ||
+ if ((actual_player->dynamite==0 && actual_player->dynabombs_left==0) ||
element==EL_DYNAMIT || element==EL_DYNABOMB || element==EL_EXPLODING)
return(FALSE);
if (element != EL_LEERRAUM)
Store[JX][JY] = element;
- if (Dynamite)
+ if (actual_player->dynamite)
{
Feld[JX][JY] = EL_DYNAMIT;
MovDelay[JX][JY] = 96;
- Dynamite--;
- DrawText(DX_DYNAMITE,DY_DYNAMITE,int2str(Dynamite,3),FS_SMALL,FC_YELLOW);
+ actual_player->dynamite--;
+ DrawText(DX_DYNAMITE, DY_DYNAMITE,
+ int2str(local_player->dynamite, 3),
+ FS_SMALL, FC_YELLOW);
DrawGraphicThruMask(SCROLLX(JX),SCROLLY(JY),GFX_DYNAMIT);
}
else
{
Feld[JX][JY] = EL_DYNABOMB;
MovDelay[JX][JY] = 96;
- DynaBombsLeft--;
+ actual_player->dynabombs_left--;
DrawGraphicThruMask(SCROLLX(JX),SCROLLY(JY),GFX_DYNABOMB);
}
void RaiseScore(int value)
{
- Score += value;
- DrawText(DX_SCORE,DY_SCORE,int2str(Score,5),FS_SMALL,FC_YELLOW);
+ local_player->score += value;
+ DrawText(DX_SCORE, DY_SCORE,
+ int2str(local_player->score, 5),
+ FS_SMALL, FC_YELLOW);
}
void RaiseScoreElement(int element)
void InitLevelAndPlayerInfo()
{
+ local_player = &stored_player[0];
+
if (!LoadLevelInfo()) /* global level info */
CloseAll();
int PlayerMovDir, PlayerMovPos, PlayerPushing;
int PlayerFrame, PlayerGfxPos;
int PlayerGone, LevelSolved, GameOver;
-int FrameCounter, TimeFrames, TimeLeft, Score;
-int Gems, SokobanFields, Lights, Friends;
-int Dynamite, Key[4], MampferNr;
-int DynaBombCount, DynaBombSize, DynaBombsLeft, DynaBombXL;
-int SiebAktiv;
+int FrameCounter, TimeFrames, TimeLeft;
+int MampferNr, SiebAktiv;
struct LevelDirInfo leveldir[MAX_LEVDIR_ENTRIES];
struct LevelInfo level;
-struct PlayerInfo player;
+struct PlayerInfo stored_player[MAX_PLAYERS+1];
+struct PlayerInfo *local_player, *actual_player;
struct HiScore highscore[MAX_SCORE_ENTRIES];
struct SoundInfo Sound[NUM_SOUNDS];
struct RecordingInfo tape;
#define MAX_LEV_FIELDX 128
#define MAX_LEV_FIELDY 128
+#define MAX_PLAYERS 4
+
#ifndef MIN
#define MIN(a,b) ((a)<(b) ? (a) : (b))
#endif
struct PlayerInfo
{
+ BOOL active, local;
+
char login_name[MAX_NAMELEN];
char alias_name[MAX_NAMELEN];
int handicap;
unsigned int setup;
int leveldir_nr;
int level_nr;
+
+ int JX,JY, lastJX,lastJY, ZX,ZY, ExitX,ExitY;
+ int PlayerMovDir, PlayerMovPos, PlayerPushing;
+ int PlayerFrame, PlayerGfxPos;
+ int PlayerGone, LevelSolved, GameOver;
+
+ int score;
+ int gems_still_needed;
+ int sokobanfields_still_needed;
+ int lights_still_needed;
+ int friends_still_needed;
+ int key[4];
+ int dynamite;
+ int dynabomb_count, dynabomb_size, dynabombs_left, dynabomb_xl;
};
struct LevelInfo
extern int PlayerMovDir, PlayerMovPos, PlayerPushing;
extern int PlayerFrame, PlayerGfxPos;
extern int PlayerGone,LevelSolved,GameOver;
-extern int FrameCounter,TimeFrames,TimeLeft,Score;
-extern int Gems,SokobanFields,Lights,Friends;
-extern int Dynamite,Key[4],MampferNr;
-extern int DynaBombCount, DynaBombSize, DynaBombsLeft, DynaBombXL;
-extern int SiebAktiv;
+extern int FrameCounter,TimeFrames,TimeLeft;
+extern int MampferNr, SiebAktiv;
extern struct LevelDirInfo leveldir[];
extern struct LevelInfo level;
-extern struct PlayerInfo player;
+extern struct PlayerInfo stored_player[];
+extern struct PlayerInfo *local_player, *actual_player;
extern struct HiScore highscore[];
extern struct RecordingInfo tape;
extern struct SoundInfo Sound[];
* It was reworked for the GNU C Library by Roland McGrath.
*/
-#ifndef MSDOS
-#include <ansidecl.h>
-#endif
#include <errno.h>
#include <limits.h>
#include <stdlib.h>
ClearWindow();
DrawHeadline();
DrawText(SX+32, SY+64, "Name:",FS_BIG,FC_GREEN);
- DrawText(SX+192,SY+64, player.alias_name,FS_BIG,FC_RED);
+ DrawText(SX+192,SY+64, local_player->alias_name,FS_BIG,FC_RED);
DrawText(SX+32, SY+96, "Level:",FS_BIG,FC_GREEN);
DrawText(SX+352,SY+96, int2str(level_nr,3),FS_BIG,
(level_nr<leveldir[leveldir_nr].levels ? FC_RED : FC_YELLOW));
level_nr = new_level_nr;
- if (level_nr>player.handicap)
- level_nr = player.handicap;
+ if (level_nr > local_player->handicap)
+ level_nr = local_player->handicap;
DrawTextExt(drawto,gc,SX+352,SY+96, int2str(level_nr,3), FS_BIG,FC_RED);
DrawTextExt(window,gc,SX+352,SY+96, int2str(level_nr,3), FS_BIG,FC_RED);
if (y==3)
{
game_status = TYPENAME;
- HandleTypeName(strlen(player.alias_name),0);
+ HandleTypeName(strlen(local_player->alias_name),0);
}
else if (y==4)
{
void CheckCheat()
{
- int old_handicap = player.handicap;
+ int old_handicap = local_player->handicap;
- if (!strcmp(player.alias_name,"Artsoft"))
- player.handicap = leveldir[leveldir_nr].levels-1;
+ if (!strcmp(local_player->alias_name,"Artsoft"))
+ local_player->handicap = leveldir[leveldir_nr].levels-1;
- if (player.handicap != old_handicap)
+ if (local_player->handicap != old_handicap)
{
SavePlayerInfo(PLAYER_LEVEL);
- level_nr = player.handicap;
+ level_nr = local_player->handicap;
}
}
if (newxpos)
{
xpos = newxpos;
- DrawText(SX+6*32,SY+ypos*32,player.alias_name,FS_BIG,FC_YELLOW);
+ DrawText(SX+6*32, SY+ypos*32, local_player->alias_name, FS_BIG, FC_YELLOW);
DrawGraphic(xpos+6,ypos,GFX_KUGEL_ROT);
return;
}
if((ascii = get_ascii(key)) && xpos<MAX_NAMELEN-1)
{
#endif
- player.alias_name[xpos] = ascii;
- player.alias_name[xpos+1] = 0;
+ local_player->alias_name[xpos] = ascii;
+ local_player->alias_name[xpos+1] = 0;
xpos++;
DrawTextExt(drawto,gc,SX+6*32,SY+ypos*32,
- player.alias_name,FS_BIG,FC_YELLOW);
+ local_player->alias_name,FS_BIG,FC_YELLOW);
DrawTextExt(window,gc,SX+6*32,SY+ypos*32,
- player.alias_name,FS_BIG,FC_YELLOW);
+ local_player->alias_name,FS_BIG,FC_YELLOW);
DrawGraphic(xpos+6,ypos,GFX_KUGEL_ROT);
}
else if ((key==XK_Delete || key==XK_BackSpace) && xpos>0)
{
xpos--;
- player.alias_name[xpos] = 0;
+ local_player->alias_name[xpos] = 0;
DrawGraphic(xpos+6,ypos,GFX_KUGEL_ROT);
DrawGraphic(xpos+7,ypos,GFX_LEERRAUM);
}
else if (key==XK_Return && xpos>0)
{
- DrawText(SX+6*32,SY+ypos*32,player.alias_name,FS_BIG,FC_RED);
+ DrawText(SX+6*32,SY+ypos*32,local_player->alias_name,FS_BIG,FC_RED);
DrawGraphic(xpos+6,ypos,GFX_LEERRAUM);
SavePlayerInfo(PLAYER_SETUP);
CheckCheat();
}
else
{
- player.leveldir_nr = leveldir_nr = y-3;
+ local_player->leveldir_nr = leveldir_nr = y-3;
LoadPlayerInfo(PLAYER_LEVEL);
SavePlayerInfo(PLAYER_SETUP);
CheckCheat();
if (i < SETUP_SCREEN_POS_EMPTY)
{
int setting_bit = setup[base].bit;
- int setting_pos = ((player.setup & setting_bit) != 0 ? 0 : 1);
+ int setting_pos = ((local_player->setup & setting_bit) != 0 ? 0 : 1);
DrawText(SX+14*32, SY+i*32,setup[base].mode[setting_pos],
FS_BIG,setup[base].color[setting_pos]);
}
if (y==3 && sound_status==SOUND_AVAILABLE)
{
- if (SETUP_SOUND_ON(player.setup))
+ if (SETUP_SOUND_ON(local_player->setup))
{
DrawText(SX+14*32, SY+yy*32,"off",FS_BIG,FC_BLUE);
DrawText(SX+14*32, SY+(yy+1)*32,"off",FS_BIG,FC_BLUE);
DrawText(SX+14*32, SY+(yy+2)*32,"off",FS_BIG,FC_BLUE);
- player.setup &= ~SETUP_SOUND_LOOPS;
- player.setup &= ~SETUP_SOUND_MUSIC;
+ local_player->setup &= ~SETUP_SOUND_LOOPS;
+ local_player->setup &= ~SETUP_SOUND_MUSIC;
}
else
DrawText(SX+14*32, SY+yy*32,"on ",FS_BIG,FC_YELLOW);
- player.setup ^= SETUP_SOUND;
+ local_player->setup ^= SETUP_SOUND;
}
else if (y==4 && sound_loops_allowed)
{
- if (SETUP_SOUND_LOOPS_ON(player.setup))
+ if (SETUP_SOUND_LOOPS_ON(local_player->setup))
DrawText(SX+14*32, SY+yy*32,"off",FS_BIG,FC_BLUE);
else
{
DrawText(SX+14*32, SY+yy*32,"on ",FS_BIG,FC_YELLOW);
DrawText(SX+14*32, SY+(yy-1)*32,"on ",FS_BIG,FC_YELLOW);
- player.setup |= SETUP_SOUND;
+ local_player->setup |= SETUP_SOUND;
}
- player.setup ^= SETUP_SOUND_LOOPS;
+ local_player->setup ^= SETUP_SOUND_LOOPS;
}
else if (y==5 && sound_loops_allowed)
{
- if (SETUP_SOUND_MUSIC_ON(player.setup))
+ if (SETUP_SOUND_MUSIC_ON(local_player->setup))
DrawText(SX+14*32, SY+yy*32,"off",FS_BIG,FC_BLUE);
else
{
DrawText(SX+14*32, SY+yy*32,"on ",FS_BIG,FC_YELLOW);
DrawText(SX+14*32, SY+(yy-2)*32,"on ",FS_BIG,FC_YELLOW);
- player.setup |= SETUP_SOUND;
+ local_player->setup |= SETUP_SOUND;
}
- player.setup ^= SETUP_SOUND_MUSIC;
+ local_player->setup ^= SETUP_SOUND_MUSIC;
}
else if (y==6)
{
- if (SETUP_TOONS_ON(player.setup))
+ if (SETUP_TOONS_ON(local_player->setup))
DrawText(SX+14*32, SY+yy*32,"off",FS_BIG,FC_BLUE);
else
DrawText(SX+14*32, SY+yy*32,"on ",FS_BIG,FC_YELLOW);
- player.setup ^= SETUP_TOONS;
+ local_player->setup ^= SETUP_TOONS;
}
else if (y==7)
{
- if (!SETUP_DIRECT_DRAW_ON(player.setup))
+ if (!SETUP_DIRECT_DRAW_ON(local_player->setup))
DrawText(SX+14*32, SY+yy*32,"off",FS_BIG,FC_BLUE);
else
DrawText(SX+14*32, SY+yy*32,"on ",FS_BIG,FC_YELLOW);
- player.setup ^= SETUP_DIRECT_DRAW;
+ local_player->setup ^= SETUP_DIRECT_DRAW;
}
else if (y==8)
{
- if (SETUP_SCROLL_DELAY_ON(player.setup))
+ if (SETUP_SCROLL_DELAY_ON(local_player->setup))
DrawText(SX+14*32, SY+yy*32,"off",FS_BIG,FC_BLUE);
else
DrawText(SX+14*32, SY+yy*32,"on ",FS_BIG,FC_YELLOW);
- player.setup ^= SETUP_SCROLL_DELAY;
+ local_player->setup ^= SETUP_SCROLL_DELAY;
}
else if (y==9)
{
- if (SETUP_SOFT_SCROLL_ON(player.setup))
+ if (SETUP_SOFT_SCROLL_ON(local_player->setup))
DrawText(SX+14*32, SY+yy*32,"off",FS_BIG,FC_BLUE);
else
DrawText(SX+14*32, SY+yy*32,"on ",FS_BIG,FC_YELLOW);
- player.setup ^= SETUP_SOFT_SCROLL;
+ local_player->setup ^= SETUP_SOFT_SCROLL;
}
else if (y==10)
{
- if (SETUP_FADING_ON(player.setup))
+ if (SETUP_FADING_ON(local_player->setup))
DrawText(SX+14*32, SY+yy*32,"off",FS_BIG,FC_BLUE);
else
DrawText(SX+14*32, SY+yy*32,"on ",FS_BIG,FC_YELLOW);
- player.setup ^= SETUP_FADING;
+ local_player->setup ^= SETUP_FADING;
}
else if (y==11)
{
- if (SETUP_QUICK_DOORS_ON(player.setup))
+ if (SETUP_QUICK_DOORS_ON(local_player->setup))
DrawText(SX+14*32, SY+yy*32,"off",FS_BIG,FC_BLUE);
else
DrawText(SX+14*32, SY+yy*32,"on ",FS_BIG,FC_YELLOW);
- player.setup ^= SETUP_QUICK_DOORS;
+ local_player->setup ^= SETUP_QUICK_DOORS;
}
else if (y==12)
{
- if (SETUP_AUTO_RECORD_ON(player.setup))
+ if (SETUP_AUTO_RECORD_ON(local_player->setup))
DrawText(SX+14*32, SY+yy*32,"off",FS_BIG,FC_BLUE);
else
DrawText(SX+14*32, SY+yy*32,"on ",FS_BIG,FC_YELLOW);
- player.setup ^= SETUP_AUTO_RECORD;
+ local_player->setup ^= SETUP_AUTO_RECORD;
}
else if (y==13)
{
- if (SETUP_2ND_JOYSTICK_ON(player.setup))
+ if (SETUP_2ND_JOYSTICK_ON(local_player->setup))
DrawText(SX+14*32, SY+yy*32,"1st",FS_BIG,FC_YELLOW);
else
DrawText(SX+14*32, SY+yy*32,"2nd",FS_BIG,FC_YELLOW);
- player.setup ^= SETUP_2ND_JOYSTICK;
+ local_player->setup ^= SETUP_2ND_JOYSTICK;
}
else if (y==14)
{
#ifdef MSDOS
joy_nr[0] = '#';
- joy_nr[1] = SETUP_2ND_JOYSTICK_ON(player.setup)+49;
+ joy_nr[1] = SETUP_2ND_JOYSTICK_ON(local_player->setup)+49;
joy_nr[2] = '\0';
remove_joystick();
BackToFront();
for(clear_keybuf();!keypressed(););
- calibrate_joystick(SETUP_2ND_JOYSTICK_ON(player.setup));
+ calibrate_joystick(SETUP_2ND_JOYSTICK_ON(local_player->setup));
ClearWindow();
DrawText(SX+16, SY+7*32, "MOVE JOYSTICK TO",FS_BIG,FC_YELLOW);
BackToFront();
for(clear_keybuf();!keypressed(););
- calibrate_joystick(SETUP_2ND_JOYSTICK_ON(player.setup));
+ calibrate_joystick(SETUP_2ND_JOYSTICK_ON(local_player->setup));
DrawSetupScreen();
return;
if (sound_music_on)
{
sound_music_on = FALSE;
- player.setup &= ~SETUP_SOUND_MUSIC;
+ local_player->setup &= ~SETUP_SOUND_MUSIC;
FadeSound(background_loop[level_nr % num_bg_loops]);
DrawSoundDisplay(BUTTON_SOUND_MUSIC_OFF);
}
else if (sound_loops_allowed)
{
sound_on = sound_music_on = TRUE;
- player.setup |= (SETUP_SOUND | SETUP_SOUND_MUSIC);
+ local_player->setup |= (SETUP_SOUND | SETUP_SOUND_MUSIC);
PlaySoundLoop(background_loop[level_nr % num_bg_loops]);
DrawSoundDisplay(BUTTON_SOUND_MUSIC_ON);
}
if (sound_loops_on)
{
sound_loops_on = FALSE;
- player.setup &= ~SETUP_SOUND_LOOPS;
+ local_player->setup &= ~SETUP_SOUND_LOOPS;
DrawSoundDisplay(BUTTON_SOUND_LOOPS_OFF);
}
else if (sound_loops_allowed)
{
sound_on = sound_loops_on = TRUE;
- player.setup |= (SETUP_SOUND | SETUP_SOUND_LOOPS);
+ local_player->setup |= (SETUP_SOUND | SETUP_SOUND_LOOPS);
DrawSoundDisplay(BUTTON_SOUND_LOOPS_ON);
}
else
if (sound_simple_on)
{
sound_simple_on = FALSE;
- player.setup &= ~SETUP_SOUND;
+ local_player->setup &= ~SETUP_SOUND;
DrawSoundDisplay(BUTTON_SOUND_SIMPLE_OFF);
}
else if (sound_status==SOUND_AVAILABLE)
{
sound_on = sound_simple_on = TRUE;
- player.setup |= SETUP_SOUND;
+ local_player->setup |= SETUP_SOUND;
DrawSoundDisplay(BUTTON_SOUND_SIMPLE_ON);
}
else