LAB: Cleanup

This commit is contained in:
Eugene Sandulenko 2014-12-26 00:32:42 +01:00
parent fefb78457e
commit 58182bd77a
17 changed files with 137 additions and 126 deletions

View file

@ -45,7 +45,7 @@ const char *CurFileName = " ";
bool LongWinInFront = false; bool LongWinInFront = false;
struct TextFont *MsgFont; TextFont *MsgFont;
extern bool DoBlack, waiteffect, EffectPlaying, stopsound, DoNotDrawMessage, IsHiRes, nopalchange, DoMusic; extern bool DoBlack, waiteffect, EffectPlaying, stopsound, DoNotDrawMessage, IsHiRes, nopalchange, DoMusic;
@ -131,13 +131,13 @@ static uint32 BUFFERSIZE = BIGBUFFERSIZE;
static byte *MovePanelBuffer, *InvPanelBuffer; static byte *MovePanelBuffer, *InvPanelBuffer;
static uint32 MovePanelBufferSize, InvPanelBufferSize; static uint32 MovePanelBufferSize, InvPanelBufferSize;
static struct Image *MoveImages[20], static Image *MoveImages[20],
#if defined(DOSCODE) #if defined(DOSCODE)
*InvImages[6]; *InvImages[6];
#else #else
*InvImages[10]; *InvImages[10];
#endif #endif
static struct Gadget *MoveGadgetList, *InvGadgetList; static Gadget *MoveGadgetList, *InvGadgetList;
static char initcolors[] = { '\x00', '\x00', '\x00', '\x30', static char initcolors[] = { '\x00', '\x00', '\x00', '\x30',
@ -251,7 +251,7 @@ static uint16 OldMode;
bool setUpScreens(void) { bool setUpScreens(void) {
uint16 counter; uint16 counter;
byte *bufferstorage, **buffer = &bufferstorage; byte *bufferstorage, **buffer = &bufferstorage;
struct Gadget *curgad; Gadget *curgad;
uint16 y; uint16 y;
if (!createScreen(IsHiRes)) if (!createScreen(IsHiRes))
@ -395,8 +395,8 @@ uint16 curmousex = 0, curmousey = 0;
/* Permanently flips the imagry of a gadget. */ /* Permanently flips the imagry of a gadget. */
/******************************************************************************/ /******************************************************************************/
static void perFlipGadget(uint16 GadID) { static void perFlipGadget(uint16 GadID) {
struct Image *Temp; Image *Temp;
struct Gadget *TopGad; Gadget *TopGad;
TopGad = MoveGadgetList; TopGad = MoveGadgetList;
@ -424,7 +424,7 @@ static void perFlipGadget(uint16 GadID) {
/* Eats all the available messages. */ /* Eats all the available messages. */
/******************************************************************************/ /******************************************************************************/
void eatMessages(void) { void eatMessages(void) {
struct IntuiMessage *Msg; IntuiMessage *Msg;
do { do {
Msg = getMsg(); Msg = getMsg();
@ -722,7 +722,7 @@ static bool novesa = false, noaudio = false;
/* Processes user input events. */ /* Processes user input events. */
/******************************************************************************/ /******************************************************************************/
static void process(void) { static void process(void) {
struct IntuiMessage *Msg; IntuiMessage *Msg;
uint32 Class; uint32 Class;
uint16 Code, Qualifier, MouseX, MouseY, ActionMode = 4, CurInv = MAPNUM, /* Lab: Labyrinth specific initialization */ uint16 Code, Qualifier, MouseX, MouseY, ActionMode = 4, CurInv = MAPNUM, /* Lab: Labyrinth specific initialization */
@ -1801,8 +1801,8 @@ int followCrumbs() {
byte dropCrumbs[] = { 0x00 }; byte dropCrumbs[] = { 0x00 };
byte dropCrumbsOff[] = { 0x00 }; byte dropCrumbsOff[] = { 0x00 };
struct Image DropCrumbsImage = { 24, 24, dropCrumbs }; Image DropCrumbsImage = { 24, 24, dropCrumbs };
struct Image DropCrumbsOffImage = { 24, 24, dropCrumbsOff }; Image DropCrumbsOffImage = { 24, 24, dropCrumbsOff };
void mayShowCrumbIndicator() { void mayShowCrumbIndicator() {
if (DroppingCrumbs && MainDisplay) { if (DroppingCrumbs && MainDisplay) {

View file

@ -39,10 +39,10 @@
namespace Lab { namespace Lab {
struct BitMap bit1, bit2, *DispBitMap = &bit1, *DrawBitMap = &bit1; BitMap bit1, bit2, *DispBitMap = &bit1, *DrawBitMap = &bit1;
extern struct BitMap RawDiffBM; extern BitMap RawDiffBM;
extern char diffcmap[256 * 3], lastcmap[256 * 3]; extern char diffcmap[256 * 3], lastcmap[256 * 3];
extern bool IsBM, NoFlip, nopalchange, ContMusic; extern bool IsBM, NoFlip, nopalchange, ContMusic;
@ -50,7 +50,7 @@ extern int32 ReadSoFar;
extern bool ReadIsDone, ReadIsError; extern bool ReadIsDone, ReadIsError;
extern bool DoBlack, EffectPlaying, stopsound; extern bool DoBlack, EffectPlaying, stopsound;
extern bool IsHiRes; extern bool IsHiRes;
extern struct TextFont *MsgFont; extern TextFont *MsgFont;
extern const char *CurFileName; extern const char *CurFileName;
@ -229,7 +229,7 @@ static void getWord(char *WordBuffer, const char *MainBuffer, uint16 *WordWidth)
/* Gets a line of text for flowText; makes sure that its length is less than */ /* Gets a line of text for flowText; makes sure that its length is less than */
/* or equal to the maximum width. */ /* or equal to the maximum width. */
/******************************************************************************/ /******************************************************************************/
static void getLine(struct TextFont *tf, char *LineBuffer, const char **MainBuffer, uint16 LineWidth) { static void getLine(TextFont *tf, char *LineBuffer, const char **MainBuffer, uint16 LineWidth) {
uint16 CurWidth = 0, WordWidth; uint16 CurWidth = 0, WordWidth;
char WordBuffer[100]; char WordBuffer[100];
bool doit = true; bool doit = true;
@ -256,8 +256,6 @@ static void getLine(struct TextFont *tf, char *LineBuffer, const char **MainBuff
} else } else
doit = false; doit = false;
} }
/* NYI: Would add code here to break up words in case they were longer than a line */
} }
@ -281,7 +279,7 @@ uint32 flowText(void *font, /* the TextAttr pointer */
bool output, /* Whether to output any text */ bool output, /* Whether to output any text */
uint16 x1, /* Cords */ uint16 x1, /* Cords */
uint16 y1, uint16 x2, uint16 y2, const char *str) { /* The text itself */ uint16 y1, uint16 x2, uint16 y2, const char *str) { /* The text itself */
struct TextFont *msgfont = (TextFont *)font; TextFont *msgfont = (TextFont *)font;
char linebuffer[256]; char linebuffer[256];
const char *temp; const char *temp;
uint16 numlines, actlines, fontheight, width; uint16 numlines, actlines, fontheight, width;
@ -343,7 +341,7 @@ extern byte *VGABASEADDRESS;
/******************************************************************************/ /******************************************************************************/
/* Calls flowText, but flows it to memory. Same restrictions as flowText. */ /* Calls flowText, but flows it to memory. Same restrictions as flowText. */
/******************************************************************************/ /******************************************************************************/
uint32 flowTextToMem(struct Image *DestIm, void *font, /* the TextAttr pointer */ uint32 flowTextToMem(Image *DestIm, void *font, /* the TextAttr pointer */
uint16 spacing, /* How much vertical spacing between the lines */ uint16 spacing, /* How much vertical spacing between the lines */
uint16 pencolor, /* pen number to use for text */ uint16 pencolor, /* pen number to use for text */
uint16 backpen, /* the background color */ uint16 backpen, /* the background color */
@ -527,7 +525,7 @@ void copyLong64(uint32 *Dest, uint32 *Source, uint32 Many64) {
/*****************************************************************************/ /*****************************************************************************/
static void doScrollBlack(void) { static void doScrollBlack(void) {
byte *mem, *tempmem; byte *mem, *tempmem;
struct Image Im; Image Im;
uint16 width, height, by, nheight, CurPage; uint16 width, height, by, nheight, CurPage;
uint32 size, copysize; uint32 size, copysize;
uint32 *BaseAddr; uint32 *BaseAddr;
@ -619,7 +617,7 @@ static void doScrollBlack(void) {
extern struct BitMap RawDiffBM; extern BitMap RawDiffBM;
extern DIFFHeader headerdata; extern DIFFHeader headerdata;
@ -768,7 +766,7 @@ static void doScrollBounce(void) {
/*****************************************************************************/ /*****************************************************************************/
static void doTransWipe(CloseDataPtr *CPtr, char *filename) { static void doTransWipe(CloseDataPtr *CPtr, char *filename) {
uint16 LastY, CurY, counter, linesdone = 0, lineslast; uint16 LastY, CurY, counter, linesdone = 0, lineslast;
struct Image ImSource, ImDest; Image ImSource, ImDest;
if (IsHiRes) { if (IsHiRes) {
lineslast = 3; lineslast = 3;

View file

@ -41,16 +41,14 @@ extern bool IsHiRes;
Common::KeyState _keyPressed; Common::KeyState _keyPressed;
struct Gadget *createButton(uint16 x, uint16 y, uint16 id, uint16 key, Image *im, Image *imalt) { Gadget *createButton(uint16 x, uint16 y, uint16 id, uint16 key, Image *im, Image *imalt) {
Gadget *gptr; Gadget *gptr;
if ((gptr = (Gadget *)calloc(sizeof(struct Gadget), 1))) { if ((gptr = new Gadget())) {
gptr->x = x; gptr->x = x;
gptr->y = y; gptr->y = y;
gptr->GadgetID = id; gptr->GadgetID = id;
#if !defined(DOSCODE)
gptr->KeyEquiv = key; gptr->KeyEquiv = key;
#endif
gptr->Im = im; gptr->Im = im;
gptr->ImAlt = imalt; gptr->ImAlt = imalt;
gptr->NextGadget = NULL; gptr->NextGadget = NULL;
@ -64,7 +62,7 @@ struct Gadget *createButton(uint16 x, uint16 y, uint16 id, uint16 key, Image *im
void freeButtonList(Gadget *gptrlist) { void freeButtonList(Gadget *gptrlist) {
struct Gadget *gptr, *next = gptrlist; Gadget *gptr, *next = gptrlist;
while (next) { while (next) {
gptr = next; gptr = next;
@ -80,7 +78,7 @@ void freeButtonList(Gadget *gptrlist) {
/*****************************************************************************/ /*****************************************************************************/
/* Draws a gadget list to the screen. */ /* Draws a gadget list to the screen. */
/*****************************************************************************/ /*****************************************************************************/
void drawGadgetList(struct Gadget *gadlist) { void drawGadgetList(Gadget *gadlist) {
while (gadlist) { while (gadlist) {
drawImage(gadlist->Im, gadlist->x, gadlist->y); drawImage(gadlist->Im, gadlist->x, gadlist->y);
@ -95,7 +93,7 @@ void drawGadgetList(struct Gadget *gadlist) {
/*****************************************************************************/ /*****************************************************************************/
/* Ghoasts a gadget, and makes it unavailable for using. */ /* Ghoasts a gadget, and makes it unavailable for using. */
/*****************************************************************************/ /*****************************************************************************/
void ghoastGadget(struct Gadget *curgad, uint16 pencolor) { void ghoastGadget(Gadget *curgad, uint16 pencolor) {
ghoastRect(pencolor, curgad->x, curgad->y, curgad->x + curgad->Im->Width - 1, curgad->y + curgad->Im->Height - 1); ghoastRect(pencolor, curgad->x, curgad->y, curgad->x + curgad->Im->Width - 1, curgad->y + curgad->Im->Height - 1);
curgad->GadgetFlags |= GADGETOFF; curgad->GadgetFlags |= GADGETOFF;
} }
@ -105,7 +103,7 @@ void ghoastGadget(struct Gadget *curgad, uint16 pencolor) {
/*****************************************************************************/ /*****************************************************************************/
/* Unghoasts a gadget, and makes it available again. */ /* Unghoasts a gadget, and makes it available again. */
/*****************************************************************************/ /*****************************************************************************/
void unGhoastGadget(struct Gadget *curgad) { void unGhoastGadget(Gadget *curgad) {
drawImage(curgad->Im, curgad->x, curgad->y); drawImage(curgad->Im, curgad->x, curgad->y);
curgad->GadgetFlags &= !(GADGETOFF); curgad->GadgetFlags &= !(GADGETOFF);
} }
@ -114,20 +112,18 @@ void unGhoastGadget(struct Gadget *curgad) {
/*****************************************************************************/ /*****************************************************************************/
/* Make a key press have the right case for a gadget KeyEquiv value. */ /* Make a key press have the right case for a gadget KeyEquiv value. */
/*****************************************************************************/ /*****************************************************************************/
#if !defined(DOSCODE)
uint16 makeGadgetKeyEquiv(uint16 key) { uint16 makeGadgetKeyEquiv(uint16 key) {
if (Common::isAlnum(key)) if (Common::isAlnum(key))
key = tolower(key); key = tolower(key);
return key; return key;
} }
#endif
/*****************************************************************************/ /*****************************************************************************/
/* Checks whether or not the cords fall within one of the gadgets in a list */ /* Checks whether or not the cords fall within one of the gadgets in a list */
/* of gadgets. */ /* of gadgets. */
/*****************************************************************************/ /*****************************************************************************/
static struct Gadget *checkNumGadgetHit(struct Gadget *gadlist, uint16 key) { static Gadget *checkNumGadgetHit(Gadget *gadlist, uint16 key) {
#if !defined(DOSCODE) #if !defined(DOSCODE)
uint16 gkey = key - '0'; uint16 gkey = key - '0';
#else #else
@ -177,17 +173,16 @@ static bool keyPress(uint16 *KeyCode) {
} }
struct IntuiMessage IMessage; IntuiMessage IMessage;
extern struct Gadget *ScreenGadgetList; extern Gadget *ScreenGadgetList;
struct IntuiMessage *getMsg(void) { IntuiMessage *getMsg(void) {
struct Gadget *curgad; Gadget *curgad;
int Qualifiers; int Qualifiers;
updateMouse(); updateMouse();
#if !defined(DOSCODE)
Qualifiers = _keyPressed.flags; Qualifiers = _keyPressed.flags;
#endif
if ((curgad = mouseGadget()) != NULL) { if ((curgad = mouseGadget()) != NULL) {
updateMouse(); updateMouse();
@ -196,21 +191,15 @@ struct IntuiMessage *getMsg(void) {
IMessage.GadgetID = curgad->GadgetID; IMessage.GadgetID = curgad->GadgetID;
IMessage.Qualifier = Qualifiers; IMessage.Qualifier = Qualifiers;
return &IMessage; return &IMessage;
} } else if (mouseButton(&IMessage.MouseX, &IMessage.MouseY, true)) { /* Left Button */
else if (mouseButton(&IMessage.MouseX, &IMessage.MouseY, true)) { /* Left Button */
IMessage.Qualifier = IEQUALIFIER_LEFTBUTTON | Qualifiers; IMessage.Qualifier = IEQUALIFIER_LEFTBUTTON | Qualifiers;
IMessage.Class = MOUSEBUTTONS; IMessage.Class = MOUSEBUTTONS;
return &IMessage; return &IMessage;
} } else if (mouseButton(&IMessage.MouseX, &IMessage.MouseY, false)) { /* Right Button */
else if (mouseButton(&IMessage.MouseX, &IMessage.MouseY, false)) { /* Right Button */
IMessage.Qualifier = IEQUALIFIER_RBUTTON | Qualifiers; IMessage.Qualifier = IEQUALIFIER_RBUTTON | Qualifiers;
IMessage.Class = MOUSEBUTTONS; IMessage.Class = MOUSEBUTTONS;
return &IMessage; return &IMessage;
} } else if (keyPress(&IMessage.Code)) { /* Keyboard key */
else if (keyPress(&IMessage.Code)) { /* Keyboard key */
curgad = checkNumGadgetHit(ScreenGadgetList, IMessage.Code); curgad = checkNumGadgetHit(ScreenGadgetList, IMessage.Code);
if (curgad) { if (curgad) {

View file

@ -49,8 +49,8 @@ struct Gadget {
uint16 KeyEquiv; // if not zero, a key that activates gadget uint16 KeyEquiv; // if not zero, a key that activates gadget
#endif #endif
uint32 GadgetFlags; uint32 GadgetFlags;
struct Image *Im, *ImAlt; Image *Im, *ImAlt;
struct Gadget *NextGadget; Gadget *NextGadget;
}; };
extern Common::KeyState _keyPressed; extern Common::KeyState _keyPressed;
@ -119,21 +119,17 @@ extern Common::KeyState _keyPressed;
struct Gadget *createButton(uint16 x, uint16 y, uint16 id, Gadget *createButton(uint16 x, uint16 y, uint16 id, uint16 key, Image *im, Image *imalt);
#if !defined(DOSCODE)
uint16 key,
#endif
struct Image *im, struct Image *imalt);
void freeButtonList(void *gptrlist); void freeButtonList(void *gptrlist);
void drawGadgetList(struct Gadget *gadlist); void drawGadgetList(Gadget *gadlist);
void ghoastGadget(struct Gadget *curgad, uint16 pencolor); void ghoastGadget(Gadget *curgad, uint16 pencolor);
void unGhoastGadget(struct Gadget *curgad); void unGhoastGadget(Gadget *curgad);
struct IntuiMessage *getMsg(void); IntuiMessage *getMsg(void);
void replyMsg(void *Msg); void replyMsg(void *Msg);

View file

@ -37,7 +37,7 @@
namespace Lab { namespace Lab {
static struct TextFont filler, *msgfont = &filler; static TextFont filler, *msgfont = &filler;
extern bool nopalchange, noscreenchange, hidemouse, DoBlack, NoFlip, IsHiRes; extern bool nopalchange, noscreenchange, hidemouse, DoBlack, NoFlip, IsHiRes;
@ -63,7 +63,7 @@ extern int32 longcharsdrawn;
/* the message port. */ /* the message port. */
/******************************************************************************/ /******************************************************************************/
void introEatMessages(void) { void introEatMessages(void) {
struct IntuiMessage *Msg; IntuiMessage *Msg;
while (1) { while (1) {
Msg = getMsg(); Msg = getMsg();
@ -88,7 +88,7 @@ void introEatMessages(void) {
/*****************************************************************************/ /*****************************************************************************/
static void doPictText(const char *Filename, bool isscreen) { static void doPictText(const char *Filename, bool isscreen) {
uint32 lastsecs = 0L, lastmicros = 0L, secs = 0L, micros = 0L; uint32 lastsecs = 0L, lastmicros = 0L, secs = 0L, micros = 0L;
struct IntuiMessage *Msg; IntuiMessage *Msg;
char filename[50] = "Lab:rooms/Intro/"; char filename[50] = "Lab:rooms/Intro/";
byte *curplace, **tfile; byte *curplace, **tfile;
bool DrawNextText = true, End = false, Begin = true; bool DrawNextText = true, End = false, Begin = true;

View file

@ -86,10 +86,10 @@ uint32 sizeOfFile(const char *name) {
typedef struct { struct FileMarker {
char name[32]; char name[32];
void *Start, *End; void *Start, *End;
} FileMarker; };

View file

@ -52,6 +52,7 @@ typedef struct {
struct Image; struct Image;
struct TextFont; struct TextFont;
struct Gadget;
/*----------------------------*/ /*----------------------------*/
/*------ From Audioi.c -------*/ /*------ From Audioi.c -------*/
@ -101,7 +102,7 @@ uint32 flowText(void *font, /* the TextAttr pointer */
uint16 x1, /* Cords */ uint16 x1, /* Cords */
uint16 y1, uint16 x2, uint16 y2, const char *text); /* The text itself */ uint16 y1, uint16 x2, uint16 y2, const char *text); /* The text itself */
uint32 flowTextToMem(struct Image *DestIm, void *font, /* the TextAttr pointer */ uint32 flowTextToMem(Image *DestIm, void *font, /* the TextAttr pointer */
uint16 spacing, /* How much vertical spacing between the lines */ uint16 spacing, /* How much vertical spacing between the lines */
uint16 pencolor, /* pen number to use for text */ uint16 pencolor, /* pen number to use for text */
uint16 backpen, /* the background color */ uint16 backpen, /* the background color */
@ -136,7 +137,7 @@ void flipViews(void *scrPtr);
/*----- From Interface.c -----*/ /*----- From Interface.c -----*/
/*----------------------------*/ /*----------------------------*/
struct Gadget *addGadButton(uint16 x, uint16 y, void *UpImage, void *DownImage, uint16 id); Gadget *addGadButton(uint16 x, uint16 y, void *UpImage, void *DownImage, uint16 id);
void gadgetsOnOff(void *gptr, void *win, int32 num, bool on); void gadgetsOnOff(void *gptr, void *win, int32 num, bool on);

View file

@ -42,8 +42,8 @@
namespace Lab { namespace Lab {
static struct TextFont *BigMsgFont; static TextFont *BigMsgFont;
static struct TextFont bmf; static TextFont bmf;
extern uint16 Direction; extern uint16 Direction;
@ -87,8 +87,7 @@ void setAmigaPal(uint16 *pal, uint16 numcolors) {
bool getFont(const char *filename, TextFont *textfont) { bool getFont(const char *filename, TextFont *textfont) {
byte *fontbuffer; byte *fontbuffer;
fontbuffer = (byte *)stealBufMem(sizeOfFile(filename) - fontbuffer = (byte *)stealBufMem(sizeOfFile(filename) - (sizeof(TextFont) + 4));
(sizeof(struct TextFont) + 4));
g_music->checkMusic(); g_music->checkMusic();
if (fontbuffer == NULL) if (fontbuffer == NULL)
@ -227,7 +226,7 @@ static uint16 mapScaleY(uint16 y) {
static bool loadMapData(void) { static bool loadMapData(void) {
byte **buffer, Temp[5]; byte **buffer, Temp[5];
int32 Size; int32 Size;
struct Gadget *gptr; Gadget *gptr;
uint16 counter; uint16 counter;
BigMsgFont = &bmf; BigMsgFont = &bmf;
@ -736,7 +735,7 @@ void processMap(uint16 CurRoom) {
char *sptr; char *sptr;
byte newcolor[3]; byte newcolor[3];
bool drawmap; bool drawmap;
struct IntuiMessage *Msg; IntuiMessage *Msg;
CurMsg = CurRoom; CurMsg = CurRoom;
CurFloor = Maps[CurRoom].PageNumber; CurFloor = Maps[CurRoom].PageNumber;

View file

@ -41,7 +41,7 @@ char g_PathSeperator[4];
#define SAVEVERSION "LBS3" #define SAVEVERSION "LBS3"
int getSaveGameList(struct SaveGameInfo *info, int maxNum) { int getSaveGameList(SaveGameInfo *info, int maxNum) {
warning("STUB: getSaveGameList"); warning("STUB: getSaveGameList");
return 0; return 0;
@ -112,7 +112,7 @@ int getSaveGameList(struct SaveGameInfo *info, int maxNum) {
#endif #endif
} }
void freeSaveGameList(struct SaveGameInfo *info, int count) { void freeSaveGameList(SaveGameInfo *info, int count) {
int i; int i;
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {

View file

@ -46,8 +46,8 @@ struct SaveGameInfo {
char SaveGameDate[128]; char SaveGameDate[128];
}; };
int getSaveGameList(struct SaveGameInfo *info, int maxNum); int getSaveGameList(SaveGameInfo *info, int maxNum);
void freeSaveGameList(struct SaveGameInfo *info, int count); void freeSaveGameList(SaveGameInfo *info, int count);
} // End of namespace Lab } // End of namespace Lab

View file

@ -50,8 +50,8 @@ static bool MouseHidden = true, QuitMouseHandler = false;
static int32 NumHidden = 1; static int32 NumHidden = 1;
static uint16 CurMouseX, CurMouseY; static uint16 CurMouseX, CurMouseY;
static uint16 MouseImageWidth = 10, MouseImageHeight = 15; static uint16 MouseImageWidth = 10, MouseImageHeight = 15;
static struct Gadget *LastGadgetHit = NULL; static Gadget *LastGadgetHit = NULL;
struct Gadget *ScreenGadgetList = NULL; Gadget *ScreenGadgetList = NULL;
static byte MouseData[] = {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, static byte MouseData[] = {1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
1, 7, 1, 0, 0, 0, 0, 0, 0, 0, 1, 7, 1, 0, 0, 0, 0, 0, 0, 0,
1, 7, 7, 1, 0, 0, 0, 0, 0, 0, 1, 7, 7, 1, 0, 0, 0, 0, 0, 0,
@ -69,12 +69,12 @@ static byte MouseData[] = {1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 1, 1, 0, 0}; 0, 0, 0, 0, 0, 0, 1, 1, 0, 0};
static struct Image MouseImage, BackImage; static Image MouseImage, BackImage;
static byte BackImageBuffer[256]; static byte BackImageBuffer[256];
static uint16 backx, backy; static uint16 backx, backy;
static bool drawmouse = false, gadhit = false; static bool drawmouse = false, gadhit = false;
static struct Gadget *hitgad = NULL; static Gadget *hitgad = NULL;
void mouseShowXY(uint16 CurMouseX, uint16 CurMouseY); void mouseShowXY(uint16 CurMouseX, uint16 CurMouseY);
@ -82,7 +82,7 @@ void mouseShowXY(uint16 CurMouseX, uint16 CurMouseY);
/* Checks whether or not the cords fall within one of the gadgets in a list */ /* Checks whether or not the cords fall within one of the gadgets in a list */
/* of gadgets. */ /* of gadgets. */
/*****************************************************************************/ /*****************************************************************************/
static Gadget *checkGadgetHit(struct Gadget *gadlist, uint16 x, uint16 y) { static Gadget *checkGadgetHit(Gadget *gadlist, uint16 x, uint16 y) {
uint16 counter; uint16 counter;
while (gadlist != NULL) { while (gadlist != NULL) {
@ -121,7 +121,7 @@ static Gadget *checkGadgetHit(struct Gadget *gadlist, uint16 x, uint16 y) {
void attachGadgetList(struct Gadget *GadList) { void attachGadgetList(Gadget *GadList) {
if (ScreenGadgetList != GadList) if (ScreenGadgetList != GadList)
LastGadgetHit = NULL; LastGadgetHit = NULL;
@ -165,7 +165,7 @@ static void restoreBackMouse(void) {
} }
static struct Gadget *TempGad; static Gadget *TempGad;
void mouse_handler(int32 max, int32 mcx, int32 mdx) { void mouse_handler(int32 max, int32 mcx, int32 mdx) {

View file

@ -55,7 +55,7 @@ bool mouseButton(uint16 *x, uint16 *y, bool leftbutton);
Gadget *mouseGadget(void); Gadget *mouseGadget(void);
void attachGadgetList(struct Gadget *GadList); void attachGadgetList(Gadget *GadList);
void mouse_handler(int32 max, int32 mcx, int32 mdx); void mouse_handler(int32 max, int32 mcx, int32 mdx);

View file

@ -37,7 +37,7 @@
namespace Lab { namespace Lab {
extern struct BitMap *DispBitMap, *DrawBitMap; extern BitMap *DispBitMap, *DrawBitMap;
extern uint32 VGABytesPerPage; extern uint32 VGABytesPerPage;
/* /*
@ -88,7 +88,7 @@ static bool continuous,
char diffcmap[256 * 3], lastcmap[256 * 3]; char diffcmap[256 * 3], lastcmap[256 * 3];
struct BitMap RawDiffBM; BitMap RawDiffBM;

View file

@ -54,7 +54,7 @@ int g_IsRegistered;
extern bool nopalchange, DoBlack, IsHiRes; extern bool nopalchange, DoBlack, IsHiRes;
extern struct BitMap *DispBitMap, *DrawBitMap; extern BitMap *DispBitMap, *DrawBitMap;
extern char diffcmap[3 * 256]; extern char diffcmap[3 * 256];
extern uint32 VGAScreenWidth, VGAScreenHeight; extern uint32 VGAScreenWidth, VGAScreenHeight;
@ -106,7 +106,7 @@ static byte *loadBackPict(const char *fileName, bool tomem) {
static struct Image *Images[10]; static Image *Images[10];
uint16 combination[6] = {0, 0, 0, 0, 0, 0}, solution[] = {0, 4, 0, 8, 7, 2}; uint16 combination[6] = {0, 0, 0, 0, 0, 0}, solution[] = {0, 4, 0, 8, 7, 2};
@ -161,7 +161,7 @@ void showCombination(const char *filename) {
/* Changes the combination number of one of the slots */ /* Changes the combination number of one of the slots */
/*****************************************************************************/ /*****************************************************************************/
static void changeCombination(uint16 number) { static void changeCombination(uint16 number) {
struct Image display; Image display;
uint16 counter, combnum; uint16 counter, combnum;
bool unlocked = true; bool unlocked = true;
@ -251,7 +251,7 @@ void mouseCombination(uint16 x, uint16 y) {
struct Image *Tiles[16]; Image *Tiles[16];
int16 CurTile[4] [4] = { int16 CurTile[4] [4] = {
{ 1, 5, 9, 13 }, { 1, 5, 9, 13 },
{ 2, 6, 10, 14 }, { 2, 6, 10, 14 },
@ -513,9 +513,9 @@ void mouseTile(uint16 x, uint16 y) {
/*------------------------ Does the detective notes. ------------------------*/ /*------------------------ Does the detective notes. ------------------------*/
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
extern struct TextFont *MsgFont; extern TextFont *MsgFont;
static struct TextFont *BigMsgFont; static TextFont *BigMsgFont;
static struct TextFont bmfont; static TextFont bmfont;
/*****************************************************************************/ /*****************************************************************************/
@ -631,10 +631,10 @@ static uint16 JPage = 0;
static bool lastpage = false; static bool lastpage = false;
static struct Image *JCancel, *JCancelAlt, *JLeft, *JLeftAlt, *JRight, *JRightAlt, JBackImage, ScreenImage; static Image *JCancel, *JCancelAlt, *JLeft, *JLeftAlt, *JRight, *JRightAlt, JBackImage, ScreenImage;
static uint16 JGadX[3] = {80, 144, 194}, JGadY[3] = {162, 164, 162}; static uint16 JGadX[3] = {80, 144, 194}, JGadY[3] = {162, 164, 162};
static struct Gadget ForwardG, CancelG, BackG; static Gadget ForwardG, CancelG, BackG;
@ -645,7 +645,7 @@ static struct Gadget ForwardG, CancelG, BackG;
static bool loadJournalData() { static bool loadJournalData() {
byte **buffer; byte **buffer;
char filename[20]; char filename[20];
struct Gadget *TopGadget = &BackG; Gadget *TopGadget = &BackG;
uint16 counter; uint16 counter;
bool bridge, dirty, news, clean; bool bridge, dirty, news, clean;
@ -863,13 +863,13 @@ static void drawJournal(uint16 wipenum, bool needFade) {
/* Processes user input. */ /* Processes user input. */
/*****************************************************************************/ /*****************************************************************************/
static void processJournal() { static void processJournal() {
struct IntuiMessage *Msg; IntuiMessage *Msg;
uint32 Class; uint32 Class;
uint16 Qualifier, GadID; uint16 Qualifier, GadID;
while (1) { while (1) {
g_music->checkMusic(); /* Make sure we check the music at least after every message */ g_music->checkMusic(); /* Make sure we check the music at least after every message */
Msg = (struct IntuiMessage *) getMsg(); Msg = (IntuiMessage *) getMsg();
if (Msg == NULL) { if (Msg == NULL) {
g_music->newCheckMusic(); g_music->newCheckMusic();
@ -970,7 +970,7 @@ void doJournal() {
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
struct Image *Arrow1, *NoArrow1, *DriveButton; Image *Arrow1, *NoArrow1, *DriveButton;
extern InventoryData *Inventory; extern InventoryData *Inventory;
@ -1084,7 +1084,7 @@ void getRoomMessage(int MyRoomNum, int MyDirection, char *msg);
extern char g_SaveGamePath[512]; extern char g_SaveGamePath[512];
extern char g_PathSeperator[4]; extern char g_PathSeperator[4];
struct SaveGameInfo g_SaveGameInfo[MAX_SAVED_GAMES]; SaveGameInfo g_SaveGameInfo[MAX_SAVED_GAMES];
int g_TotalSavedGames; int g_TotalSavedGames;
char g_CommonPalette[3 * 256]; char g_CommonPalette[3 * 256];
int g_LastSaveGameNumber = 0; int g_LastSaveGameNumber = 0;
@ -1093,7 +1093,19 @@ int g_CurSaveSet = 0;
int g_PendingNewSave = 0; int g_PendingNewSave = 0;
enum UI_Ident { enum UI_Ident {
ID_SAVE, ID_LOAD, ID_NEWSLOT, ID_1_TO_5, ID_6_TO_10, ID_11_TO_15, ID_SLOT_A, ID_SLOT_B, ID_SLOT_C, ID_SLOT_D, ID_SLOT_E, ID_CANCEL, ID_LAST ID_SAVE,
ID_LOAD,
ID_NEWSLOT,
ID_1_TO_5,
ID_6_TO_10,
ID_11_TO_15,
ID_SLOT_A,
ID_SLOT_B,
ID_SLOT_C,
ID_SLOT_D,
ID_SLOT_E,
ID_CANCEL,
ID_LAST
}; };
struct ModernUI { struct ModernUI {
@ -1101,12 +1113,27 @@ struct ModernUI {
int x, y, w, h; int x, y, w, h;
}; };
struct ModernUI theUI[ID_LAST] = { ModernUI theUI[ID_LAST] = {
{ ID_LOAD, 491, 182, 128, 54 }, { ID_SAVE, 491, 255, 128, 54 }, { ID_NEWSLOT, 491, 328, 128, 54 }, { ID_1_TO_5, 27, 40, 146, 25 }, { ID_6_TO_10, 175, 40, 146, 25 }, { ID_11_TO_15, 323, 40, 146, 25 }, { ID_SLOT_A, 27, 67, 442, 72 }, { ID_SLOT_B, 27, 142, 442, 72 }, { ID_SLOT_C, 27, 217, 442, 72 }, { ID_SLOT_D, 27, 292, 442, 72 }, { ID_SLOT_E, 27, 367, 442, 72 }, { ID_CANCEL, 531, 405, 52, 52 } { ID_LOAD, 491, 182, 128, 54 },
{ ID_SAVE, 491, 255, 128, 54 },
{ ID_NEWSLOT, 491, 328, 128, 54 },
{ ID_1_TO_5, 27, 40, 146, 25 },
{ ID_6_TO_10, 175, 40, 146, 25 },
{ ID_11_TO_15, 323, 40, 146, 25 },
{ ID_SLOT_A, 27, 67, 442, 72 },
{ ID_SLOT_B, 27, 142, 442, 72 },
{ ID_SLOT_C, 27, 217, 442, 72 },
{ ID_SLOT_D, 27, 292, 442, 72 },
{ ID_SLOT_E, 27, 367, 442, 72 },
{ ID_CANCEL, 531, 405, 52, 52 }
}; };
enum { enum {
SG_BLACK = 1, SG_TAN = 14, SG_DKTAN = 38, SG_WHITE = 105, SG_YELLOW = 118 SG_BLACK = 1,
SG_TAN = 14,
SG_DKTAN = 38,
SG_WHITE = 105,
SG_YELLOW = 118
}; };
/*****************************************************************************/ /*****************************************************************************/
@ -1178,7 +1205,7 @@ static void drawSaveLoad() {
for (i = 0, j = 5 * g_CurSaveSet; i < 5; i++, j++) { for (i = 0, j = 5 * g_CurSaveSet; i < 5; i++, j++) {
uint16 hue, y; uint16 hue, y;
char num_text[4]; char num_text[4];
struct Image thumbnail, screen; Image thumbnail, screen;
if (j < g_TotalSavedGames + g_PendingNewSave) { if (j < g_TotalSavedGames + g_PendingNewSave) {
char msg[256]; char msg[256];
@ -1224,7 +1251,7 @@ static void drawSaveLoad() {
WSDL_UpdateScreen(); WSDL_UpdateScreen();
} }
static void makeThumbnail(struct SaveGameInfo *info) { static void makeThumbnail(SaveGameInfo *info) {
char *pictName; char *pictName;
CloseDataPtr CPtr = NULL; CloseDataPtr CPtr = NULL;
byte *BitMapMem; byte *BitMapMem;
@ -1260,7 +1287,7 @@ static void makeThumbnail(struct SaveGameInfo *info) {
} }
static void addSaveSlot() { static void addSaveSlot() {
struct SaveGameInfo *info; SaveGameInfo *info;
if (g_PendingNewSave || g_TotalSavedGames == MAX_SAVED_GAMES) if (g_PendingNewSave || g_TotalSavedGames == MAX_SAVED_GAMES)
return; return;
@ -1370,7 +1397,7 @@ static bool doLoadGame() {
/* Processes user input. */ /* Processes user input. */
/*****************************************************************************/ /*****************************************************************************/
static bool processSaveLoad() { static bool processSaveLoad() {
struct IntuiMessage *Msg; IntuiMessage *Msg;
uint32 Class; uint32 Class;
uint16 Qualifier, MouseX, MouseY, Code; uint16 Qualifier, MouseX, MouseY, Code;
@ -1700,7 +1727,7 @@ static void checkFiles(void) {
/* Processes user input. */ /* Processes user input. */
/*****************************************************************************/ /*****************************************************************************/
static uint16 processSaveRestore(uint16 type) { static uint16 processSaveRestore(uint16 type) {
struct IntuiMessage *Msg; IntuiMessage *Msg;
uint32 Class; uint32 Class;
uint16 Qualifier, MouseX, MouseY, Code, Temp; uint16 Qualifier, MouseX, MouseY, Code, Temp;
@ -1913,7 +1940,8 @@ static uint16 monpage;
static const char *TextFileName; static const char *TextFileName;
struct Image *MonButton, *AltMonButton, *MonQuit, *AltMonQuit, *MonBack, *AltMonBack, *MonDown, *AltMonDown, *MonUp, *AltMonUp; Image *MonButton, *AltMonButton, *MonQuit, *AltMonQuit, *MonBack, *AltMonBack,
*MonDown, *AltMonDown, *MonUp, *AltMonUp;
@ -2004,7 +2032,7 @@ static void drawMonText(char *text, uint16 x1, uint16 y1, uint16 x2, uint16 y2,
/* Processes user input. */ /* Processes user input. */
/*****************************************************************************/ /*****************************************************************************/
static void processMonitor(char *ntext, bool isinteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { static void processMonitor(char *ntext, bool isinteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2) {
struct IntuiMessage *Msg; IntuiMessage *Msg;
uint32 Class; uint32 Class;
uint16 Qualifier, Code, MouseX, MouseY; uint16 Qualifier, Code, MouseX, MouseY;
const char *Test = " ", *StartFileName = TextFileName; const char *Test = " ", *StartFileName = TextFileName;
@ -2158,7 +2186,7 @@ void doMonitor(char *background, char *textfile, bool isinteractive, uint16 x1,
#if defined(LABDEMO) #if defined(LABDEMO)
void doTrialBlock() { void doTrialBlock() {
struct IntuiMessage *Msg; IntuiMessage *Msg;
uint32 Class; uint32 Class;
uint16 Qualifier, MouseX, MouseY, Code, Temp; uint16 Qualifier, MouseX, MouseY, Code, Temp;

View file

@ -52,17 +52,17 @@ struct TextFont {
#pragma pack(pop) #pragma pack(pop)
#endif #endif
bool openFontMem(const char *TextFontPath, struct TextFont *tf, byte *fontbuffer); bool openFontMem(const char *TextFontPath, TextFont *tf, byte *fontbuffer);
bool openFont(const char *TextFontPath, struct TextFont **tf); bool openFont(const char *TextFontPath, TextFont **tf);
void closeFont(struct TextFont *tf); void closeFont(TextFont *tf);
uint16 textLength(struct TextFont *tf, const char *text, uint16 numchars); uint16 textLength(TextFont *tf, const char *text, uint16 numchars);
uint16 textHeight(struct TextFont *tf); uint16 textHeight(TextFont *tf);
void text(struct TextFont *tf, uint16 x, uint16 y, uint16 color, const char *text, uint16 numchars); void text(TextFont *tf, uint16 x, uint16 y, uint16 color, const char *text, uint16 numchars);
} // End of namespace Lab } // End of namespace Lab

View file

@ -342,7 +342,7 @@ void getMode(uint16 *Mode) {
/*****************************************************************************/ /*****************************************************************************/
/* Draws an image to the screen. */ /* Draws an image to the screen. */
/*****************************************************************************/ /*****************************************************************************/
void drawImage(struct Image *Im, uint16 x, uint16 y) { void drawImage(Image *Im, uint16 x, uint16 y) {
#if !defined(DOSCODE) #if !defined(DOSCODE)
int sx, sy, dx, dy, w, h; int sx, sy, dx, dy, w, h;
@ -458,7 +458,7 @@ void drawImage(struct Image *Im, uint16 x, uint16 y) {
/*****************************************************************************/ /*****************************************************************************/
/* Draws an image to the screen. */ /* Draws an image to the screen. */
/*****************************************************************************/ /*****************************************************************************/
void drawMaskImage(struct Image *Im, uint16 x, uint16 y) { void drawMaskImage(Image *Im, uint16 x, uint16 y) {
#if !defined(DOSCODE) #if !defined(DOSCODE)
int sx, sy, dx, dy, w, h; int sx, sy, dx, dy, w, h;
@ -588,7 +588,7 @@ void drawMaskImage(struct Image *Im, uint16 x, uint16 y) {
/*****************************************************************************/ /*****************************************************************************/
/* Reads an image from the screen. */ /* Reads an image from the screen. */
/*****************************************************************************/ /*****************************************************************************/
void readScreenImage(struct Image *Im, uint16 x, uint16 y) { void readScreenImage(Image *Im, uint16 x, uint16 y) {
#if !defined(DOSCODE) #if !defined(DOSCODE)
int sx, sy, dx, dy, w, h; int sx, sy, dx, dy, w, h;
@ -839,7 +839,7 @@ byte *TempScrollData;
/* function will fail. */ /* function will fail. */
/*****************************************************************************/ /*****************************************************************************/
void scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { void scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2) {
struct Image Im; Image Im;
uint16 temp; uint16 temp;
Im.ImageData = TempScrollData; Im.ImageData = TempScrollData;
@ -885,7 +885,7 @@ void scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2) {
/* Scrolls the display in the y direction by blitting. */ /* Scrolls the display in the y direction by blitting. */
/*****************************************************************************/ /*****************************************************************************/
void scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { void scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2) {
struct Image Im; Image Im;
uint16 temp; uint16 temp;
Im.ImageData = TempScrollData; Im.ImageData = TempScrollData;

View file

@ -73,13 +73,13 @@ void VGASetPal(void *cmap, uint16 numcolors);
/*---------- Drawing Routines ----------*/ /*---------- Drawing Routines ----------*/
void drawImage(struct Image *Im, uint16 x, uint16 y); void drawImage(Image *Im, uint16 x, uint16 y);
void drawMaskImage(struct Image *Im, uint16 x, uint16 y); void drawMaskImage(Image *Im, uint16 x, uint16 y);
void readScreenImage(struct Image *Im, uint16 x, uint16 y); void readScreenImage(Image *Im, uint16 x, uint16 y);
void bltBitMap(struct Image *ImSource, uint16 xs, uint16 ys, struct Image *ImDest, uint16 xd, uint16 yd, uint16 width, uint16 height); void bltBitMap(Image *ImSource, uint16 xs, uint16 ys, Image *ImDest, uint16 xd, uint16 yd, uint16 width, uint16 height);
void scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2); void scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2);