2006-02-22 22:40:53 +00:00
|
|
|
|
/* ScummVM - Scumm Interpreter
|
|
|
|
|
* Copyright (C) 2006 The ScummVM project
|
|
|
|
|
*
|
|
|
|
|
* cinE Engine is (C) 2004-2005 by CinE Team
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
*
|
|
|
|
|
* $URL$
|
|
|
|
|
* $Id$
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2006-03-29 15:59:37 +00:00
|
|
|
|
#include "common/stdafx.h"
|
|
|
|
|
#include "common/endian.h"
|
2006-04-10 05:37:31 +00:00
|
|
|
|
#include "common/savefile.h"
|
2006-03-29 15:59:37 +00:00
|
|
|
|
|
2006-02-22 22:40:53 +00:00
|
|
|
|
#include "cine/cine.h"
|
2006-02-25 00:46:56 +00:00
|
|
|
|
#include "cine/font.h"
|
2006-02-25 01:18:01 +00:00
|
|
|
|
#include "cine/main_loop.h"
|
|
|
|
|
#include "cine/object.h"
|
2006-02-25 01:01:27 +00:00
|
|
|
|
#include "cine/sfx_player.h"
|
2006-02-25 01:18:01 +00:00
|
|
|
|
#include "cine/various.h"
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-25 00:26:14 +00:00
|
|
|
|
namespace Cine {
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 allowSystemMenu = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 commandVar3[4];
|
|
|
|
|
int16 commandVar1;
|
|
|
|
|
int16 commandVar2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
unk1Struct messageTable[NUM_MAX_MESSAGE];
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint32 var6;
|
|
|
|
|
uint32 var8;
|
2006-03-23 03:45:52 +00:00
|
|
|
|
byte *var9;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 var2;
|
|
|
|
|
uint16 var3;
|
|
|
|
|
uint16 var4;
|
|
|
|
|
uint16 var5;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-05-08 19:49:52 +00:00
|
|
|
|
int16 buildObjectListCommand(void);
|
|
|
|
|
|
2006-03-23 03:45:52 +00:00
|
|
|
|
void drawString(const char *string, byte param) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-03-23 03:45:52 +00:00
|
|
|
|
void blitRawScreen(byte *frontBuffer) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
gfxFlipRawPage(frontBuffer);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Common::File partFileHandle;
|
|
|
|
|
|
|
|
|
|
void waitPlayerInput(void) {
|
|
|
|
|
}
|
|
|
|
|
|
2006-03-09 23:02:29 +00:00
|
|
|
|
void freeAnimDataTable(void) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void mainLoopSub1(void) {
|
|
|
|
|
}
|
|
|
|
|
|
2006-03-09 23:02:29 +00:00
|
|
|
|
void setTextWindow(uint16 param1, uint16 param2, uint16 param3, uint16 param4) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 errorVar;
|
2006-03-23 03:45:52 +00:00
|
|
|
|
byte menuVar;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-03-23 03:45:52 +00:00
|
|
|
|
void gfxFuncGen1(byte *param1, byte *param2, byte *param3, byte *param4, int16 param5) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-03-23 03:45:52 +00:00
|
|
|
|
byte *page0c;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
void ptrGfxFunc13(void) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void gfxFuncGen2(void) {
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 allowPlayerInput;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 checkForPendingDataLoadSwitch;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 fadeRequired;
|
|
|
|
|
uint16 isDrawCommandEnabled;
|
|
|
|
|
uint16 waitForPlayerClick;
|
2006-03-02 20:08:41 +00:00
|
|
|
|
uint16 menuCommandLen;
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 var17;
|
|
|
|
|
uint16 var18;
|
|
|
|
|
uint16 var19;
|
|
|
|
|
uint16 var20;
|
2006-03-23 03:45:52 +00:00
|
|
|
|
byte var21;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 playerCommand;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
char commandBuffer[80];
|
|
|
|
|
|
|
|
|
|
char currentPrcName[20];
|
|
|
|
|
char currentRelName[20];
|
|
|
|
|
char currentObjectName[20];
|
|
|
|
|
char currentMsgName[20];
|
|
|
|
|
char newPrcName[20];
|
|
|
|
|
char newRelName[20];
|
|
|
|
|
char newObjectName[20];
|
|
|
|
|
char newMsgName[20];
|
|
|
|
|
|
|
|
|
|
char currentBgName[8][15];
|
|
|
|
|
char currentCtName[15];
|
|
|
|
|
char currentPartName[15];
|
|
|
|
|
char currentDatName[30];
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 saveVar2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-03-23 03:45:52 +00:00
|
|
|
|
byte isInPause = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 defaultMenuBoxColor;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-03-23 03:45:52 +00:00
|
|
|
|
byte inputVar1 = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 inputVar2;
|
|
|
|
|
uint16 inputVar3;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-04-12 22:06:30 +00:00
|
|
|
|
const char **failureMessages;
|
2006-04-08 07:50:47 +00:00
|
|
|
|
const commandeType *defaultActionCommand;
|
|
|
|
|
const commandeType *systemMenu;
|
|
|
|
|
const commandeType *confirmMenu;
|
|
|
|
|
const char *commandPrepositionOn;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
selectedObjStruct currentSelectedObject;
|
|
|
|
|
|
2006-04-08 07:50:47 +00:00
|
|
|
|
void initLanguage(Common::Language lang) {
|
2006-04-12 22:06:30 +00:00
|
|
|
|
static const char *failureMessages_EN[] = {
|
|
|
|
|
// EXAMINE
|
|
|
|
|
"I don't see anything unusual.",
|
|
|
|
|
"There's nothing of interest here.",
|
|
|
|
|
"This isn't particularly interesting.",
|
|
|
|
|
"You won't find anything.",
|
|
|
|
|
// TAKE
|
|
|
|
|
"I can't take that.",
|
|
|
|
|
"I find it difficult.",
|
|
|
|
|
"I don't see what I am supposed to take.",
|
|
|
|
|
"I have difficulty in following you.",
|
|
|
|
|
// INVENTORY (???)
|
|
|
|
|
"There's no point.",
|
|
|
|
|
"You have better things to do.",
|
|
|
|
|
"Come on, don't let's waste any time.",
|
|
|
|
|
"That doesn't seem to me to be a good idea.",
|
|
|
|
|
// USE
|
|
|
|
|
"I don't see why I should do that.",
|
|
|
|
|
"It's had no effect whatsoever.",
|
|
|
|
|
"It won't produce any results.",
|
|
|
|
|
"Try and find something else.",
|
|
|
|
|
// OPERATE
|
|
|
|
|
"It doesn't work.",
|
|
|
|
|
"Let suppose you are trying and don't let's mention it again.",
|
|
|
|
|
"Nothing happens.",
|
|
|
|
|
"You have better things to do.",
|
|
|
|
|
// SPEAK
|
|
|
|
|
"No answer.",
|
|
|
|
|
"More action , less talking !",
|
|
|
|
|
"I'd be very surprised if you got an answer",
|
|
|
|
|
"A wall of silence ..."
|
|
|
|
|
};
|
|
|
|
|
|
2006-04-08 07:50:47 +00:00
|
|
|
|
static const commandeType defaultActionCommand_EN[] = {
|
|
|
|
|
"EXAMINE",
|
|
|
|
|
"TAKE",
|
|
|
|
|
"INVENTORY",
|
|
|
|
|
"USE",
|
|
|
|
|
"OPERATE",
|
|
|
|
|
"SPEAK",
|
|
|
|
|
"NOACTION"
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static const commandeType systemMenu_EN[] = {
|
|
|
|
|
"Pause",
|
|
|
|
|
"Restart Game",
|
|
|
|
|
"Quit",
|
|
|
|
|
"Backup Drive is A:",
|
|
|
|
|
"Restore game",
|
|
|
|
|
"Save game"
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static const commandeType confirmMenu_EN[] = {
|
|
|
|
|
"Ok, go ahead ...",
|
|
|
|
|
"Absolutely Not!"
|
|
|
|
|
};
|
|
|
|
|
|
2006-05-01 14:14:24 +00:00
|
|
|
|
// \x82 == <20>, \x85 == <20>, \x87 == <20>, \x88 == <20>
|
2006-04-12 22:06:30 +00:00
|
|
|
|
static const char *failureMessages_FR[] = {
|
|
|
|
|
// EXAMINER
|
|
|
|
|
"Je ne vois rien de special.",
|
2006-05-01 14:14:24 +00:00
|
|
|
|
"Il n'y a rien d'int\x82ressant.",
|
|
|
|
|
"Cela pr\x82sente peu d'int\x82r\x88ts.",
|
2006-04-12 22:06:30 +00:00
|
|
|
|
"Vous ne trouvez rien.",
|
|
|
|
|
// PRENDRE
|
|
|
|
|
"Je ne peux pas prendre cela.",
|
|
|
|
|
"Cela me semble difficile",
|
2006-05-01 14:14:24 +00:00
|
|
|
|
"Je ne vois pas ce qu'il y a \x85 prendre",
|
|
|
|
|
"j'ai du mal \x85 vous suivre.",
|
2006-04-12 22:06:30 +00:00
|
|
|
|
// INVENTAIRE (???)
|
|
|
|
|
"C'est inutile",
|
2006-05-01 14:14:24 +00:00
|
|
|
|
"Vous avez mieux \x85 faire",
|
|
|
|
|
"Allons, ne perdons pas de temps",
|
2006-05-01 20:10:29 +00:00
|
|
|
|
"\x87""a ne me semble pas \x88tre une bonne id\x82""e",
|
2006-04-12 22:06:30 +00:00
|
|
|
|
// UTILISER
|
|
|
|
|
"Je ne vois pas pourquoi je ferais cela.",
|
|
|
|
|
"C'est absolument sans effets",
|
2006-05-01 14:14:24 +00:00
|
|
|
|
"Cela n'amenerait \x85 rien",
|
2006-04-12 22:06:30 +00:00
|
|
|
|
"Essayez de trouver autre chose.",
|
|
|
|
|
// ACTIONNER
|
|
|
|
|
"Ca ne marche pas",
|
|
|
|
|
"Supposons que vous essayez et n'en parlons plus.",
|
|
|
|
|
"Rien n'y fait.",
|
2006-05-01 14:14:24 +00:00
|
|
|
|
"Vous avez mieux \x85 faire.",
|
2006-04-12 22:06:30 +00:00
|
|
|
|
// PARLER
|
2006-05-01 14:14:24 +00:00
|
|
|
|
"Vous lui parlez . Sans r\x82ponse.",
|
2006-04-12 22:06:30 +00:00
|
|
|
|
"Plus d'actes et moins de Paroles !",
|
2006-05-01 14:14:24 +00:00
|
|
|
|
"Je serais bien surpris si vous obteniez une r\x82ponse.",
|
2006-04-12 22:06:30 +00:00
|
|
|
|
"Un mur de silence ..."
|
|
|
|
|
};
|
|
|
|
|
|
2006-04-08 07:50:47 +00:00
|
|
|
|
static const commandeType defaultActionCommand_FR[] = {
|
|
|
|
|
"EXAMINER",
|
|
|
|
|
"PRENDRE",
|
|
|
|
|
"INVENTAIRE",
|
|
|
|
|
"UTILISER",
|
|
|
|
|
"ACTIONNER",
|
|
|
|
|
"PARLER",
|
|
|
|
|
"NOACTION"
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static const commandeType systemMenu_FR[] = {
|
|
|
|
|
"Pause",
|
|
|
|
|
"Nouvelle partie",
|
|
|
|
|
"Quitter",
|
|
|
|
|
"Lecteur de Svg. A:",
|
|
|
|
|
"Charger une partie",
|
|
|
|
|
"Sauver la partie"
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static const commandeType confirmMenu_FR[] = {
|
|
|
|
|
"Ok , Vas-y ...",
|
|
|
|
|
"Surtout Pas !"
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
switch (lang) {
|
|
|
|
|
case Common::FR_FRA:
|
2006-04-12 22:06:30 +00:00
|
|
|
|
failureMessages = failureMessages_FR;
|
2006-04-08 07:50:47 +00:00
|
|
|
|
defaultActionCommand = defaultActionCommand_FR;
|
|
|
|
|
systemMenu = systemMenu_FR;
|
|
|
|
|
confirmMenu = confirmMenu_FR;
|
|
|
|
|
commandPrepositionOn = "sur";
|
|
|
|
|
break;
|
|
|
|
|
default:
|
2006-04-12 22:06:30 +00:00
|
|
|
|
failureMessages = failureMessages_EN;
|
2006-04-08 07:50:47 +00:00
|
|
|
|
defaultActionCommand = defaultActionCommand_EN;
|
|
|
|
|
systemMenu = systemMenu_EN;
|
|
|
|
|
confirmMenu = confirmMenu_EN;
|
|
|
|
|
commandPrepositionOn = "on";
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-22 22:40:53 +00:00
|
|
|
|
void mainLoopSub3(void) {
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 stopObjectScript(int16 entryIdx) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
prcLinkedListStruct *currentHead = &objScriptList;
|
|
|
|
|
prcLinkedListStruct *tempHead = currentHead;
|
|
|
|
|
|
|
|
|
|
currentHead = tempHead->next;
|
|
|
|
|
|
|
|
|
|
while (currentHead) {
|
|
|
|
|
if (currentHead->scriptIdx == entryIdx) {
|
|
|
|
|
currentHead->scriptIdx = -1;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
currentHead = currentHead->next;
|
|
|
|
|
}
|
|
|
|
|
|
2006-04-08 08:04:23 +00:00
|
|
|
|
return -1;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
void runObjectScript(int16 entryIdx) {
|
|
|
|
|
uint16 i;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
prcLinkedListStruct *pNewElement;
|
|
|
|
|
prcLinkedListStruct *currentHead = &objScriptList;
|
|
|
|
|
prcLinkedListStruct *tempHead = currentHead;
|
|
|
|
|
|
|
|
|
|
currentHead = tempHead->next;
|
|
|
|
|
|
|
|
|
|
while (currentHead) {
|
|
|
|
|
tempHead = currentHead;
|
|
|
|
|
|
2006-03-23 03:17:47 +00:00
|
|
|
|
assert(tempHead);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
currentHead = tempHead->next;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
pNewElement = (prcLinkedListStruct *)malloc(sizeof(prcLinkedListStruct));
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-03-23 03:17:47 +00:00
|
|
|
|
assert(pNewElement);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
pNewElement->next = tempHead->next;
|
|
|
|
|
tempHead->next = pNewElement;
|
|
|
|
|
|
|
|
|
|
// copy the stack into the script instance
|
|
|
|
|
for (i = 0; i < SCRIPT_STACK_SIZE; i++) {
|
|
|
|
|
pNewElement->stack[i] = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 50; i++) {
|
|
|
|
|
pNewElement->localVars[i] = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pNewElement->compareResult = 0;
|
|
|
|
|
pNewElement->scriptPosition = 0;
|
|
|
|
|
|
2006-02-24 22:34:22 +00:00
|
|
|
|
pNewElement->scriptPtr = (byte *)relTable[entryIdx].data;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
pNewElement->scriptIdx = entryIdx;
|
|
|
|
|
|
2006-02-24 22:34:22 +00:00
|
|
|
|
computeScriptStack(pNewElement->scriptPtr, pNewElement->stack, relTable[entryIdx].size);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-04-12 16:34:23 +00:00
|
|
|
|
void addPlayerCommandMessage(int16 cmd) {
|
2006-04-12 22:06:30 +00:00
|
|
|
|
overlayHeadElement *currentHeadPtr = overlayHead.next;
|
|
|
|
|
overlayHeadElement *tempHead = &overlayHead;
|
|
|
|
|
overlayHeadElement *pNewElement;
|
|
|
|
|
|
|
|
|
|
while (currentHeadPtr) {
|
|
|
|
|
tempHead = currentHeadPtr;
|
|
|
|
|
currentHeadPtr = tempHead->next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pNewElement = (overlayHeadElement *)malloc(sizeof(overlayHeadElement));
|
|
|
|
|
|
|
|
|
|
assert(pNewElement);
|
|
|
|
|
|
|
|
|
|
pNewElement->next = tempHead->next;
|
|
|
|
|
tempHead->next = pNewElement;
|
|
|
|
|
|
|
|
|
|
pNewElement->objIdx = cmd;
|
|
|
|
|
pNewElement->type = 3;
|
|
|
|
|
|
|
|
|
|
if (!currentHeadPtr) {
|
|
|
|
|
currentHeadPtr = &overlayHead;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pNewElement->previous = currentHeadPtr->previous;
|
|
|
|
|
currentHeadPtr->previous = pNewElement;
|
2006-04-12 16:34:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-04-09 12:04:33 +00:00
|
|
|
|
int16 getRelEntryForObject(uint16 param1, uint16 param2, selectedObjStruct *pSelectedObject) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 i;
|
|
|
|
|
int16 di = -1;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
for (i = 0; i < NUM_MAX_REL; i++) {
|
2006-02-24 22:34:22 +00:00
|
|
|
|
if (relTable[i].data && relTable[i].obj1Param1 == param1 && relTable[i].obj1Param2 == pSelectedObject->idx) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
if (param2 == 1) {
|
|
|
|
|
di = i;
|
|
|
|
|
} else if (param2 == 2) {
|
2006-02-24 22:34:22 +00:00
|
|
|
|
if (relTable[i].obj2Param == pSelectedObject->param) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
di = i;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (di != -1)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return di;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 getObjectUnderCursor(uint16 x, uint16 y) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
overlayHeadElement *currentHead = overlayHead.previous;
|
|
|
|
|
|
|
|
|
|
while (currentHead) {
|
|
|
|
|
if (currentHead->type < 2) {
|
|
|
|
|
if (objectTable[currentHead->objIdx].name[0]) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 objX;
|
|
|
|
|
int16 objY;
|
|
|
|
|
int16 frame;
|
|
|
|
|
int16 part;
|
|
|
|
|
int16 treshold;
|
|
|
|
|
int16 height;
|
|
|
|
|
int16 xdif;
|
|
|
|
|
int16 ydif;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
objX = objectTable[currentHead->objIdx].x;
|
|
|
|
|
objY = objectTable[currentHead->objIdx].y;
|
|
|
|
|
|
2006-04-08 08:04:23 +00:00
|
|
|
|
frame = ABS((int16)(objectTable[currentHead->objIdx].frame));
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
part = objectTable[currentHead->objIdx].part;
|
|
|
|
|
|
|
|
|
|
if (currentHead->type == 0) {
|
|
|
|
|
treshold = animDataTable[frame].var1;
|
|
|
|
|
} else {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
treshold = animDataTable[frame].width / 2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-02-24 22:34:22 +00:00
|
|
|
|
height = animDataTable[frame].height;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
xdif = x - objX;
|
|
|
|
|
ydif = y - objY;
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
if ((xdif >= 0) && ((treshold << 4) > xdif) && (ydif > 0) && (ydif < height)) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
if (animDataTable[frame].ptr1) {
|
2006-10-15 01:06:44 +00:00
|
|
|
|
if (g_cine->getGameType() == Cine::GType_OS)
|
2006-02-23 20:02:46 +00:00
|
|
|
|
return currentHead->objIdx;
|
|
|
|
|
|
|
|
|
|
if (currentHead->type == 0) { // use generated mask
|
|
|
|
|
if (gfxGetBit(x - objX, y - objY, animDataTable[frame].ptr2, animDataTable[frame].width)) {
|
|
|
|
|
return currentHead->objIdx;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
2006-02-23 20:02:46 +00:00
|
|
|
|
} else if (currentHead->type == 1) { // is mask
|
|
|
|
|
if (gfxGetBit(x - objX, y - objY, animDataTable[frame].ptr1, animDataTable[frame].width * 4)) {
|
|
|
|
|
return currentHead->objIdx;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
currentHead = currentHead->previous;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
2006-04-09 19:44:40 +00:00
|
|
|
|
static commandeType currentSaveName[10];
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 loadSaveDirectory(void) {
|
2006-04-10 05:37:31 +00:00
|
|
|
|
Common::InSaveFile *fHandle;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-10-15 01:06:44 +00:00
|
|
|
|
if (g_cine->getGameType() == Cine::GType_FW)
|
2006-04-10 05:37:31 +00:00
|
|
|
|
fHandle = g_saveFileMan->openForLoading("FW.DIR");
|
2006-02-22 22:40:53 +00:00
|
|
|
|
else
|
2006-04-10 05:37:31 +00:00
|
|
|
|
fHandle = g_saveFileMan->openForLoading("OS.DIR");
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-04-10 05:37:31 +00:00
|
|
|
|
if (!fHandle) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2006-04-10 05:37:31 +00:00
|
|
|
|
fHandle->read(currentSaveName, 10 * 20);
|
|
|
|
|
delete fHandle;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 currentDisk;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-04-10 05:37:31 +00:00
|
|
|
|
void loadObjectScriptFromSave(Common::InSaveFile *fHandle) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 i;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
prcLinkedListStruct *newElement;
|
|
|
|
|
prcLinkedListStruct *currentHead = &globalScriptsHead;
|
|
|
|
|
prcLinkedListStruct *tempHead = currentHead;
|
|
|
|
|
|
|
|
|
|
currentHead = tempHead->next;
|
|
|
|
|
|
|
|
|
|
while (currentHead) {
|
|
|
|
|
tempHead = currentHead;
|
|
|
|
|
currentHead = tempHead->next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
newElement =
|
2006-02-23 20:02:46 +00:00
|
|
|
|
(prcLinkedListStruct *)malloc(sizeof(prcLinkedListStruct));
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
newElement->next = tempHead->next;
|
|
|
|
|
tempHead->next = newElement;
|
|
|
|
|
|
2006-03-03 19:38:17 +00:00
|
|
|
|
for (i = 0; i < SCRIPT_STACK_SIZE; i++)
|
|
|
|
|
newElement->stack[i] = fHandle->readUint16BE();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-03-03 19:38:17 +00:00
|
|
|
|
for (i = 0; i < 50; i++)
|
|
|
|
|
newElement->localVars[i] = fHandle->readUint16BE();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-03-03 19:38:17 +00:00
|
|
|
|
newElement->compareResult = fHandle->readUint16BE();
|
|
|
|
|
newElement->scriptPosition = fHandle->readUint16BE();
|
|
|
|
|
newElement->scriptIdx = fHandle->readUint16BE();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-24 22:34:22 +00:00
|
|
|
|
newElement->scriptPtr = (byte *)relTable[newElement->scriptIdx].data;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-04-10 05:37:31 +00:00
|
|
|
|
void loadGlobalScriptFromSave(Common::InSaveFile *fHandle) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 i;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
prcLinkedListStruct *newElement;
|
|
|
|
|
prcLinkedListStruct *currentHead = &globalScriptsHead;
|
|
|
|
|
prcLinkedListStruct *tempHead = currentHead;
|
|
|
|
|
|
|
|
|
|
currentHead = tempHead->next;
|
|
|
|
|
|
|
|
|
|
while (currentHead) {
|
|
|
|
|
tempHead = currentHead;
|
|
|
|
|
currentHead = tempHead->next;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
newElement = (prcLinkedListStruct *)malloc(sizeof(prcLinkedListStruct));
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
newElement->next = tempHead->next;
|
|
|
|
|
tempHead->next = newElement;
|
|
|
|
|
|
2006-03-03 19:38:17 +00:00
|
|
|
|
for (i = 0; i < SCRIPT_STACK_SIZE; i++)
|
|
|
|
|
newElement->stack[i] = fHandle->readUint16BE();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-03-03 19:38:17 +00:00
|
|
|
|
for (i = 0; i < 50; i++)
|
|
|
|
|
newElement->localVars[i] = fHandle->readUint16BE();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-03-03 19:38:17 +00:00
|
|
|
|
newElement->compareResult = fHandle->readUint16BE();
|
|
|
|
|
newElement->scriptPosition = fHandle->readUint16BE();
|
|
|
|
|
newElement->scriptIdx = fHandle->readUint16BE();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
newElement->scriptPtr = scriptTable[newElement->scriptIdx].ptr;
|
|
|
|
|
}
|
|
|
|
|
|
2006-04-10 05:37:31 +00:00
|
|
|
|
void loadOverlayFromSave(Common::InSaveFile *fHandle) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
overlayHeadElement *newElement;
|
|
|
|
|
overlayHeadElement *currentHead = &overlayHead;
|
|
|
|
|
overlayHeadElement *tempHead = currentHead;
|
|
|
|
|
|
|
|
|
|
currentHead = tempHead->next;
|
|
|
|
|
|
|
|
|
|
while (currentHead) {
|
|
|
|
|
tempHead = currentHead;
|
|
|
|
|
currentHead = tempHead->next;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
newElement = (overlayHeadElement *)malloc(sizeof(overlayHeadElement));
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-03-03 19:38:17 +00:00
|
|
|
|
fHandle->readUint32BE();
|
|
|
|
|
fHandle->readUint32BE();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-03-03 19:38:17 +00:00
|
|
|
|
newElement->objIdx = fHandle->readUint16BE();
|
|
|
|
|
newElement->type = fHandle->readUint16BE();
|
|
|
|
|
newElement->x = fHandle->readSint16BE();
|
|
|
|
|
newElement->y = fHandle->readSint16BE();
|
2006-03-09 23:02:29 +00:00
|
|
|
|
newElement->width = fHandle->readSint16BE();
|
|
|
|
|
newElement->color = fHandle->readSint16BE();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
newElement->next = tempHead->next;
|
|
|
|
|
tempHead->next = newElement;
|
|
|
|
|
|
|
|
|
|
if (!currentHead)
|
|
|
|
|
currentHead = &overlayHead;
|
|
|
|
|
|
|
|
|
|
newElement->previous = currentHead->previous;
|
|
|
|
|
currentHead->previous = newElement;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void setupGlobalScriptList(void) {
|
|
|
|
|
prcLinkedListStruct *currentHead = globalScriptsHead.next;
|
|
|
|
|
|
|
|
|
|
while (currentHead) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
currentHead->scriptPtr = scriptTable[currentHead->scriptIdx].ptr;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
currentHead = currentHead->next;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void setupObjectScriptList(void) {
|
|
|
|
|
prcLinkedListStruct *currentHead = objScriptList.next;
|
|
|
|
|
|
|
|
|
|
while (currentHead) {
|
2006-02-24 22:34:22 +00:00
|
|
|
|
currentHead->scriptPtr = (byte *)relTable[currentHead->scriptIdx].data;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
currentHead = currentHead->next;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 makeLoad(char *saveName) {
|
|
|
|
|
int16 i;
|
|
|
|
|
int16 size;
|
2006-04-10 05:37:31 +00:00
|
|
|
|
Common::InSaveFile *fHandle;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-04-10 05:37:31 +00:00
|
|
|
|
fHandle = g_saveFileMan->openForLoading(saveName);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-04-10 05:37:31 +00:00
|
|
|
|
if (!fHandle) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
drawString("Cette sauvegarde n'existe pas ...", 0);
|
|
|
|
|
waitPlayerInput();
|
2006-02-23 20:02:46 +00:00
|
|
|
|
// restoreScreen();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
checkDataDisk(-1);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
2006-03-09 22:37:19 +00:00
|
|
|
|
g_sfxPlayer->stop();
|
2006-03-09 23:02:29 +00:00
|
|
|
|
freeAnimDataTable();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
unloadAllMasks();
|
2006-10-15 01:06:44 +00:00
|
|
|
|
// if (g_cine->getGameType() == Cine::GType_OS) {
|
2006-04-08 19:26:15 +00:00
|
|
|
|
// freeUnkList();
|
|
|
|
|
// }
|
2006-02-22 22:40:53 +00:00
|
|
|
|
freePrcLinkedList();
|
|
|
|
|
releaseObjectScripts();
|
|
|
|
|
closeEngine7();
|
|
|
|
|
closePart();
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < NUM_MAX_REL; i++) {
|
2006-02-24 22:34:22 +00:00
|
|
|
|
if (relTable[i].data) {
|
|
|
|
|
free(relTable[i].data);
|
|
|
|
|
relTable[i].data = NULL;
|
|
|
|
|
relTable[i].size = 0;
|
|
|
|
|
relTable[i].obj1Param1 = 0;
|
|
|
|
|
relTable[i].obj1Param2 = 0;
|
|
|
|
|
relTable[i].obj2Param = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < NUM_MAX_SCRIPT; i++) {
|
|
|
|
|
if (scriptTable[i].ptr) {
|
|
|
|
|
free(scriptTable[i].ptr);
|
|
|
|
|
scriptTable[i].ptr = NULL;
|
2006-02-25 18:16:40 +00:00
|
|
|
|
scriptTable[i].size = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < NUM_MAX_MESSAGE; i++) {
|
|
|
|
|
messageTable[i].len = 0;
|
|
|
|
|
|
|
|
|
|
if (messageTable[i].ptr) {
|
|
|
|
|
free(messageTable[i].ptr);
|
|
|
|
|
messageTable[i].ptr = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < NUM_MAX_OBJECT; i++) {
|
|
|
|
|
objectTable[i].part = 0;
|
|
|
|
|
objectTable[i].name[0] = 0;
|
|
|
|
|
objectTable[i].frame = 0;
|
|
|
|
|
objectTable[i].mask = 0;
|
|
|
|
|
objectTable[i].costume = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 255; i++) {
|
|
|
|
|
globalVars[i] = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var2 = 0;
|
|
|
|
|
var3 = 0;
|
|
|
|
|
var4 = 0;
|
|
|
|
|
var5 = 0;
|
|
|
|
|
|
|
|
|
|
strcpy(newPrcName, "");
|
|
|
|
|
strcpy(newRelName, "");
|
|
|
|
|
strcpy(newObjectName, "");
|
|
|
|
|
strcpy(newMsgName, "");
|
|
|
|
|
strcpy(currentBgName[0], "");
|
|
|
|
|
strcpy(currentCtName, "");
|
|
|
|
|
|
|
|
|
|
allowPlayerInput = 0;
|
|
|
|
|
waitForPlayerClick = 0;
|
|
|
|
|
playerCommand = -1;
|
|
|
|
|
isDrawCommandEnabled = 0;
|
|
|
|
|
|
|
|
|
|
strcpy(commandBuffer, "");
|
|
|
|
|
|
2006-02-24 22:34:22 +00:00
|
|
|
|
globalVars[VAR_MOUSE_X_POS] = 0;
|
|
|
|
|
globalVars[VAR_MOUSE_Y_POS] = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
fadeRequired = 0;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 16; i++) {
|
2006-04-09 09:08:45 +00:00
|
|
|
|
c_palette[i] = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
checkForPendingDataLoadSwitch = 0;
|
|
|
|
|
|
2006-04-10 05:37:31 +00:00
|
|
|
|
currentDisk = fHandle->readUint16BE();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-04-10 05:37:31 +00:00
|
|
|
|
fHandle->read(currentPartName, 13);
|
|
|
|
|
fHandle->read(currentDatName, 13);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-04-10 05:37:31 +00:00
|
|
|
|
saveVar2 = fHandle->readSint16BE();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-04-10 05:37:31 +00:00
|
|
|
|
fHandle->read(currentPrcName, 13);
|
|
|
|
|
fHandle->read(currentRelName, 13);
|
|
|
|
|
fHandle->read(currentMsgName, 13);
|
|
|
|
|
fHandle->read(currentBgName[0], 13);
|
|
|
|
|
fHandle->read(currentCtName, 13);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-04-10 05:37:31 +00:00
|
|
|
|
fHandle->readUint16BE();
|
|
|
|
|
fHandle->readUint16BE();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-04-09 09:08:45 +00:00
|
|
|
|
for (i = 0; i < 255; i++) {
|
2006-04-10 05:37:31 +00:00
|
|
|
|
objectTable[i].x = fHandle->readSint16BE();
|
|
|
|
|
objectTable[i].y = fHandle->readSint16BE();
|
|
|
|
|
objectTable[i].mask = fHandle->readUint16BE();
|
|
|
|
|
objectTable[i].frame = fHandle->readSint16BE();
|
|
|
|
|
objectTable[i].costume = fHandle->readSint16BE();
|
|
|
|
|
fHandle->read(objectTable[i].name, 20);
|
|
|
|
|
objectTable[i].part = fHandle->readUint16BE();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 16; i++) {
|
2006-04-10 05:37:31 +00:00
|
|
|
|
c_palette[i] = fHandle->readUint16BE();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 16; i++) {
|
2006-04-10 05:37:31 +00:00
|
|
|
|
tempPalette[i] = fHandle->readUint16BE();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 255; i++) {
|
2006-04-10 05:37:31 +00:00
|
|
|
|
globalVars[i] = fHandle->readUint16BE();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 16; i++) {
|
2006-04-10 05:37:31 +00:00
|
|
|
|
zoneData[i] = fHandle->readUint16BE();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 4; i++) {
|
2006-04-10 05:37:31 +00:00
|
|
|
|
commandVar3[i] = fHandle->readUint16BE();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-04-10 05:37:31 +00:00
|
|
|
|
fHandle->read(commandBuffer, 0x50);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-04-10 05:37:31 +00:00
|
|
|
|
defaultMenuBoxColor = fHandle->readUint16BE();
|
|
|
|
|
bgVar0 = fHandle->readUint16BE();
|
|
|
|
|
allowPlayerInput = fHandle->readUint16BE();
|
|
|
|
|
playerCommand = fHandle->readSint16BE();
|
|
|
|
|
commandVar1 = fHandle->readSint16BE();
|
|
|
|
|
isDrawCommandEnabled = fHandle->readUint16BE();
|
|
|
|
|
var5 = fHandle->readUint16BE();
|
|
|
|
|
var4 = fHandle->readUint16BE();
|
|
|
|
|
var3 = fHandle->readUint16BE();
|
|
|
|
|
var2 = fHandle->readUint16BE();
|
|
|
|
|
commandVar2 = fHandle->readSint16BE();
|
|
|
|
|
defaultMenuBoxColor2 = fHandle->readUint16BE();
|
2006-03-03 19:38:17 +00:00
|
|
|
|
|
2006-04-10 05:37:31 +00:00
|
|
|
|
fHandle->readUint16BE();
|
|
|
|
|
fHandle->readUint16BE();
|
2006-04-09 09:08:45 +00:00
|
|
|
|
|
2006-02-22 22:40:53 +00:00
|
|
|
|
for (i = 0; i < NUM_MAX_ANIMDATA; i++) {
|
2006-04-10 05:37:31 +00:00
|
|
|
|
animDataTable[i].width = fHandle->readUint16BE();
|
|
|
|
|
animDataTable[i].var1 = fHandle->readUint16BE();
|
|
|
|
|
animDataTable[i].bpp = fHandle->readUint16BE();
|
|
|
|
|
animDataTable[i].height = fHandle->readUint16BE();
|
2006-04-10 23:48:22 +00:00
|
|
|
|
animDataTable[i].ptr1 = NULL;
|
|
|
|
|
animDataTable[i].ptr2 = NULL;
|
2006-04-10 05:37:31 +00:00
|
|
|
|
animDataTable[i].fileIdx = fHandle->readSint16BE();
|
|
|
|
|
animDataTable[i].frameIdx = fHandle->readSint16BE();
|
|
|
|
|
fHandle->read(animDataTable[i].name, 10);
|
2006-05-26 09:36:41 +00:00
|
|
|
|
animDataTable[i].refresh = (fHandle->readByte() != 0);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-05-01 14:14:24 +00:00
|
|
|
|
// TODO: handle screen params (really required ?)
|
2006-04-10 05:37:31 +00:00
|
|
|
|
fHandle->readUint16BE();
|
|
|
|
|
fHandle->readUint16BE();
|
|
|
|
|
fHandle->readUint16BE();
|
|
|
|
|
fHandle->readUint16BE();
|
|
|
|
|
fHandle->readUint16BE();
|
|
|
|
|
fHandle->readUint16BE();
|
|
|
|
|
|
|
|
|
|
size = fHandle->readSint16BE();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
for (i = 0; i < size; i++) {
|
2006-04-10 05:37:31 +00:00
|
|
|
|
loadGlobalScriptFromSave(fHandle);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-04-10 05:37:31 +00:00
|
|
|
|
size = fHandle->readSint16BE();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
for (i = 0; i < size; i++) {
|
2006-04-10 05:37:31 +00:00
|
|
|
|
loadObjectScriptFromSave(fHandle);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-04-10 05:37:31 +00:00
|
|
|
|
size = fHandle->readSint16BE();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
for (i = 0; i < size; i++) {
|
2006-04-10 05:37:31 +00:00
|
|
|
|
loadOverlayFromSave(fHandle);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-04-10 05:37:31 +00:00
|
|
|
|
size = fHandle->readSint16BE();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
for (i = 0; i < size; i++) {
|
2006-04-10 05:37:31 +00:00
|
|
|
|
// loadBgIncrustFromSave(fHandle);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-04-10 05:37:31 +00:00
|
|
|
|
delete fHandle;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
checkDataDisk(currentDisk);
|
|
|
|
|
|
|
|
|
|
if (strlen(currentPartName)) {
|
|
|
|
|
loadPart(currentPartName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (strlen(currentPrcName)) {
|
|
|
|
|
loadPrc(currentPrcName);
|
|
|
|
|
setupGlobalScriptList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (strlen(currentRelName)) {
|
|
|
|
|
loadRel(currentRelName);
|
|
|
|
|
setupObjectScriptList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (strlen(currentMsgName)) {
|
|
|
|
|
loadMsg(currentMsgName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (strlen(currentBgName[0])) {
|
|
|
|
|
loadBg(currentBgName[0]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (strlen(currentCtName)) {
|
|
|
|
|
loadCt(currentCtName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
loadResourcesFromSave();
|
|
|
|
|
//reincrustAllBg();
|
|
|
|
|
|
2006-03-16 20:29:07 +00:00
|
|
|
|
setMouseCursor(MOUSE_CURSOR_NORMAL);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (strlen(currentDatName)) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
/* i = saveVar2;
|
|
|
|
|
saveVar2 = 0;
|
|
|
|
|
loadMusic();
|
|
|
|
|
if (i) {
|
|
|
|
|
playMusic();
|
|
|
|
|
}*/
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-04-08 08:04:23 +00:00
|
|
|
|
return 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void makeSave(char *saveFileName) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 i;
|
2006-04-10 05:37:31 +00:00
|
|
|
|
Common::OutSaveFile *fHandle;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-04-10 05:37:31 +00:00
|
|
|
|
fHandle = g_saveFileMan->openForSaving(saveFileName);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-04-10 05:37:31 +00:00
|
|
|
|
if (!fHandle) {
|
|
|
|
|
drawString("Could not create save file ...", 0);
|
|
|
|
|
waitPlayerInput();
|
|
|
|
|
// restoreScreen();
|
|
|
|
|
checkDataDisk(-1);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fHandle->writeUint16BE(currentDisk);
|
|
|
|
|
fHandle->write(currentPartName, 13);
|
|
|
|
|
fHandle->write(currentDatName, 13);
|
|
|
|
|
fHandle->writeUint16BE(saveVar2);
|
|
|
|
|
fHandle->write(currentPrcName, 13);
|
|
|
|
|
fHandle->write(currentRelName, 13);
|
|
|
|
|
fHandle->write(currentMsgName, 13);
|
|
|
|
|
fHandle->write(currentBgName[0], 13);
|
|
|
|
|
fHandle->write(currentCtName, 13);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-04-10 05:37:31 +00:00
|
|
|
|
fHandle->writeUint16BE(0xFF);
|
|
|
|
|
fHandle->writeUint16BE(0x20);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
for (i = 0; i < 255; i++) {
|
2006-04-10 05:37:31 +00:00
|
|
|
|
fHandle->writeUint16BE(objectTable[i].x);
|
|
|
|
|
fHandle->writeUint16BE(objectTable[i].y);
|
|
|
|
|
fHandle->writeUint16BE(objectTable[i].mask);
|
|
|
|
|
fHandle->writeUint16BE(objectTable[i].frame);
|
|
|
|
|
fHandle->writeUint16BE(objectTable[i].costume);
|
|
|
|
|
fHandle->write(objectTable[i].name, 20);
|
|
|
|
|
fHandle->writeUint16BE(objectTable[i].part);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 16; i++) {
|
2006-04-10 05:37:31 +00:00
|
|
|
|
fHandle->writeUint16BE(c_palette[i]);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 16; i++) {
|
2006-04-10 05:37:31 +00:00
|
|
|
|
fHandle->writeUint16BE(tempPalette[i]);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 255; i++) {
|
2006-04-10 05:37:31 +00:00
|
|
|
|
fHandle->writeUint16BE(globalVars[i]);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 16; i++) {
|
2006-04-10 05:37:31 +00:00
|
|
|
|
fHandle->writeUint16BE(zoneData[i]);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 4; i++) {
|
2006-04-10 05:37:31 +00:00
|
|
|
|
fHandle->writeUint16BE(commandVar3[i]);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-04-10 05:37:31 +00:00
|
|
|
|
fHandle->write(commandBuffer, 0x50);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-04-10 05:37:31 +00:00
|
|
|
|
fHandle->writeUint16BE(defaultMenuBoxColor);
|
|
|
|
|
fHandle->writeUint16BE(bgVar0);
|
|
|
|
|
fHandle->writeUint16BE(allowPlayerInput);
|
|
|
|
|
fHandle->writeUint16BE(playerCommand);
|
|
|
|
|
fHandle->writeUint16BE(commandVar1);
|
|
|
|
|
fHandle->writeUint16BE(isDrawCommandEnabled);
|
|
|
|
|
fHandle->writeUint16BE(var5);
|
|
|
|
|
fHandle->writeUint16BE(var4);
|
|
|
|
|
fHandle->writeUint16BE(var3);
|
|
|
|
|
fHandle->writeUint16BE(var2);
|
|
|
|
|
fHandle->writeUint16BE(commandVar2);
|
|
|
|
|
fHandle->writeUint16BE(defaultMenuBoxColor2);
|
2006-04-09 10:54:41 +00:00
|
|
|
|
|
2006-04-10 05:37:31 +00:00
|
|
|
|
fHandle->writeUint16BE(0xFF);
|
|
|
|
|
fHandle->writeUint16BE(0x1E);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
for (i = 0; i < NUM_MAX_ANIMDATA; i++) {
|
2006-04-10 05:37:31 +00:00
|
|
|
|
fHandle->writeUint16BE(animDataTable[i].width);
|
|
|
|
|
fHandle->writeUint16BE(animDataTable[i].var1);
|
|
|
|
|
fHandle->writeUint16BE(animDataTable[i].bpp);
|
|
|
|
|
fHandle->writeUint16BE(animDataTable[i].height);
|
|
|
|
|
fHandle->writeSint16BE(animDataTable[i].fileIdx);
|
|
|
|
|
fHandle->writeSint16BE(animDataTable[i].frameIdx);
|
|
|
|
|
fHandle->write(animDataTable[i].name, 10);
|
2006-04-10 23:22:26 +00:00
|
|
|
|
|
|
|
|
|
// Horrifyingly, cinE used to dump the entire struct to the
|
|
|
|
|
// save file, including the data pointers. While these pointers
|
|
|
|
|
// would be invalid after loading, the loadResourcesFromSave()
|
|
|
|
|
// function would still test if ptr1 was non-NULL, presumably
|
|
|
|
|
// to see if the object was present in the room.
|
|
|
|
|
|
|
|
|
|
fHandle->writeByte(animDataTable[i].ptr1 ? 1 : 0);
|
2006-03-03 19:38:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-04-10 05:37:31 +00:00
|
|
|
|
fHandle->writeUint16BE(0); // Screen params, unhandled
|
|
|
|
|
fHandle->writeUint16BE(0);
|
|
|
|
|
fHandle->writeUint16BE(0);
|
|
|
|
|
fHandle->writeUint16BE(0);
|
|
|
|
|
fHandle->writeUint16BE(0);
|
|
|
|
|
fHandle->writeUint16BE(0);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 numScript = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
prcLinkedListStruct *currentHead = globalScriptsHead.next;
|
|
|
|
|
|
|
|
|
|
while (currentHead) {
|
|
|
|
|
numScript++;
|
|
|
|
|
currentHead = currentHead->next;
|
|
|
|
|
}
|
|
|
|
|
|
2006-04-10 05:37:31 +00:00
|
|
|
|
fHandle->writeUint16BE(numScript);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
// actual save
|
|
|
|
|
currentHead = globalScriptsHead.next;
|
|
|
|
|
|
|
|
|
|
while (currentHead) {
|
|
|
|
|
for (i = 0; i < SCRIPT_STACK_SIZE; i++) {
|
2006-04-10 05:37:31 +00:00
|
|
|
|
fHandle->writeUint16BE(currentHead->stack[i]);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 50; i++) {
|
2006-04-10 05:37:31 +00:00
|
|
|
|
fHandle->writeUint16BE(currentHead->localVars[i]);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-04-10 05:37:31 +00:00
|
|
|
|
fHandle->writeUint16BE(currentHead->compareResult);
|
|
|
|
|
fHandle->writeUint16BE(currentHead->scriptPosition);
|
|
|
|
|
fHandle->writeUint16BE(currentHead->scriptIdx);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
currentHead = currentHead->next;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 numScript = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
prcLinkedListStruct *currentHead = objScriptList.next;
|
|
|
|
|
|
|
|
|
|
while (currentHead) {
|
|
|
|
|
numScript++;
|
|
|
|
|
currentHead = currentHead->next;
|
|
|
|
|
}
|
|
|
|
|
|
2006-04-10 05:37:31 +00:00
|
|
|
|
fHandle->writeUint16BE(numScript);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
// actual save
|
|
|
|
|
currentHead = objScriptList.next;
|
|
|
|
|
|
|
|
|
|
while (currentHead) {
|
|
|
|
|
for (i = 0; i < SCRIPT_STACK_SIZE; i++) {
|
2006-04-10 05:37:31 +00:00
|
|
|
|
fHandle->writeUint16BE(currentHead->stack[i]);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 50; i++) {
|
2006-04-10 05:37:31 +00:00
|
|
|
|
fHandle->writeUint16BE(currentHead->localVars[i]);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-04-10 05:37:31 +00:00
|
|
|
|
fHandle->writeUint16BE(currentHead->compareResult);
|
|
|
|
|
fHandle->writeUint16BE(currentHead->scriptPosition);
|
|
|
|
|
fHandle->writeUint16BE(currentHead->scriptIdx);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
currentHead = currentHead->next;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 numScript = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
overlayHeadElement *currentHead = overlayHead.next;
|
|
|
|
|
|
|
|
|
|
while (currentHead) {
|
|
|
|
|
numScript++;
|
|
|
|
|
currentHead = currentHead->next;
|
|
|
|
|
}
|
|
|
|
|
|
2006-04-10 05:37:31 +00:00
|
|
|
|
fHandle->writeUint16BE(numScript);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
// actual save
|
|
|
|
|
currentHead = overlayHead.next;
|
|
|
|
|
|
|
|
|
|
while (currentHead) {
|
2006-04-10 05:37:31 +00:00
|
|
|
|
fHandle->writeUint32BE(0);
|
|
|
|
|
fHandle->writeUint32BE(0);
|
|
|
|
|
fHandle->writeUint16BE(currentHead->objIdx);
|
|
|
|
|
fHandle->writeUint16BE(currentHead->type);
|
|
|
|
|
fHandle->writeSint16BE(currentHead->x);
|
|
|
|
|
fHandle->writeSint16BE(currentHead->y);
|
|
|
|
|
fHandle->writeSint16BE(currentHead->width);
|
|
|
|
|
fHandle->writeSint16BE(currentHead->color);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
currentHead = currentHead->next;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-04-10 05:37:31 +00:00
|
|
|
|
// This corresponds to the loadBgIncrustFromSave() handling, I think.
|
|
|
|
|
fHandle->writeUint16BE(0);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-04-10 05:37:31 +00:00
|
|
|
|
delete fHandle;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-03-16 20:29:07 +00:00
|
|
|
|
setMouseCursor(MOUSE_CURSOR_NORMAL);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void makeSystemMenu(void) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 numEntry;
|
|
|
|
|
int16 mouseButton;
|
|
|
|
|
int16 mouseX;
|
|
|
|
|
int16 mouseY;
|
|
|
|
|
int16 systemCommand;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (!allowSystemMenu) {
|
|
|
|
|
manageEvents();
|
2006-02-23 20:02:46 +00:00
|
|
|
|
getMouseData(mouseUpdateStatus, (uint16 *)&mouseButton,(uint16 *)&mouseX, (uint16 *)&mouseY);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
while (mouseButton) {
|
|
|
|
|
manageEvents();
|
2006-02-23 20:02:46 +00:00
|
|
|
|
getMouseData(mouseUpdateStatus, (uint16 *)&mouseButton, (uint16 *)&mouseX, (uint16 *)&mouseY);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
numEntry = 6;
|
|
|
|
|
|
|
|
|
|
if (!allowPlayerInput) {
|
|
|
|
|
numEntry--;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
systemCommand = makeMenuChoice(systemMenu, numEntry, mouseX, mouseY, 140);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
switch (systemCommand) {
|
|
|
|
|
case 0:
|
|
|
|
|
{
|
|
|
|
|
drawString("PAUSE", 0);
|
|
|
|
|
waitPlayerInput();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 1:
|
|
|
|
|
{
|
2006-02-23 20:02:46 +00:00
|
|
|
|
getMouseData(mouseUpdateStatus, (uint16 *)&mouseButton, (uint16 *)&mouseX, (uint16 *)&mouseY);
|
|
|
|
|
if (!makeMenuChoice(confirmMenu, 2, mouseX, mouseY + 8, 100)) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
//reinitEngine();
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 2:
|
|
|
|
|
{
|
2006-02-23 20:02:46 +00:00
|
|
|
|
getMouseData(mouseUpdateStatus, (uint16 *)&mouseButton, (uint16 *)&mouseX, (uint16 *)&mouseY);
|
|
|
|
|
if (!makeMenuChoice(confirmMenu, 2, mouseX, mouseY + 8, 100)) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
exitEngine = 1;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 3: // Select save drive... change ?
|
|
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 4: // load game
|
|
|
|
|
{
|
|
|
|
|
if (loadSaveDirectory()) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 selectedSave;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
getMouseData(mouseUpdateStatus, (uint16 *)&mouseButton, (uint16 *)&mouseX, (uint16 *)&mouseY);
|
|
|
|
|
selectedSave = makeMenuChoice(currentSaveName, 10, mouseX, mouseY + 8, 180);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (selectedSave >= 0) {
|
|
|
|
|
char saveNameBuffer[256];
|
2006-10-15 01:06:44 +00:00
|
|
|
|
if (g_cine->getGameType() == Cine::GType_FW)
|
2006-02-23 20:02:46 +00:00
|
|
|
|
sprintf(saveNameBuffer, "FW.%1d", selectedSave);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
else
|
2006-02-23 20:02:46 +00:00
|
|
|
|
sprintf(saveNameBuffer, "OS.%1d", selectedSave);
|
|
|
|
|
|
|
|
|
|
getMouseData(mouseUpdateStatus, (uint16 *)&mouseButton, (uint16 *)&mouseX, (uint16 *)&mouseY);
|
|
|
|
|
if (!makeMenuChoice(confirmMenu, 2, mouseX, mouseY + 8, 100)) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
char loadString[256];
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
sprintf(loadString, "Chargement de | %s", currentSaveName[selectedSave]);
|
|
|
|
|
drawString(loadString, 0);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
makeLoad(saveNameBuffer);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
} else {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
drawString("Chargement Annul<75> ...", 0);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
waitPlayerInput();
|
|
|
|
|
checkDataDisk(-1);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
drawString("Chargement Annul<75> ...", 0);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
waitPlayerInput();
|
|
|
|
|
checkDataDisk(-1);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
drawString("Aucune sauvegarde dans le lecteur ...", 0);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
waitPlayerInput();
|
|
|
|
|
checkDataDisk(-1);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 5:
|
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 selectedSave;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
loadSaveDirectory();
|
2006-02-23 20:02:46 +00:00
|
|
|
|
selectedSave = makeMenuChoice(currentSaveName, 10, mouseX, mouseY + 8, 180);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (selectedSave >= 0) {
|
|
|
|
|
char saveFileName[256];
|
2006-02-23 20:02:46 +00:00
|
|
|
|
//makeTextEntryMenu("Veuillez entrer le Nom de la Sauvegarde .", ¤tSaveName[selectedSave], 120);
|
|
|
|
|
sprintf(currentSaveName[selectedSave], "temporary save name");
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-10-15 01:06:44 +00:00
|
|
|
|
if (g_cine->getGameType() == Cine::GType_FW)
|
2006-02-23 20:02:46 +00:00
|
|
|
|
sprintf(saveFileName, "FW.%1d", selectedSave);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
else
|
2006-02-23 20:02:46 +00:00
|
|
|
|
sprintf(saveFileName, "OS.%1d", selectedSave);
|
|
|
|
|
|
|
|
|
|
getMouseData(mouseUpdateStatus, (uint16 *)&mouseButton, (uint16 *)&mouseX, (uint16 *)&mouseY);
|
|
|
|
|
if (!makeMenuChoice(confirmMenu, 2, mouseX, mouseY + 8, 100)) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
char saveString[256];
|
|
|
|
|
|
2006-04-10 05:37:31 +00:00
|
|
|
|
Common::OutSaveFile *fHandle;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-10-15 01:06:44 +00:00
|
|
|
|
if (g_cine->getGameType() == Cine::GType_FW)
|
2006-04-10 05:37:31 +00:00
|
|
|
|
fHandle = g_saveFileMan->openForSaving("FW.DIR");
|
2006-02-22 22:40:53 +00:00
|
|
|
|
else
|
2006-04-10 05:37:31 +00:00
|
|
|
|
fHandle = g_saveFileMan->openForSaving("OS.DIR");
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-04-10 05:37:31 +00:00
|
|
|
|
fHandle->write(currentSaveName, 200);
|
|
|
|
|
delete fHandle;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
sprintf(saveString, "Sauvegarde de |%s", currentSaveName[selectedSave]);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
drawString(saveString, 0);
|
|
|
|
|
|
|
|
|
|
makeSave(saveFileName);
|
|
|
|
|
|
|
|
|
|
checkDataDisk(-1);
|
|
|
|
|
} else {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
drawString("Sauvegarde Annul<75>e ...", 0);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
waitPlayerInput();
|
|
|
|
|
checkDataDisk(-1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
const int16 choiceResultTable[] = {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
1,
|
|
|
|
|
1,
|
|
|
|
|
1,
|
|
|
|
|
2,
|
|
|
|
|
1,
|
|
|
|
|
1,
|
|
|
|
|
1
|
|
|
|
|
};
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
const int16 subObjectUseTable[] = {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
3,
|
|
|
|
|
3,
|
|
|
|
|
3,
|
|
|
|
|
3,
|
|
|
|
|
3,
|
|
|
|
|
0,
|
|
|
|
|
0
|
|
|
|
|
};
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
const int16 canUseOnItemTable[] = {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
1,
|
|
|
|
|
0,
|
|
|
|
|
0,
|
|
|
|
|
1,
|
|
|
|
|
1,
|
|
|
|
|
0,
|
|
|
|
|
0
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
commandeType objectListCommand[20];
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 objListTab[20];
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-05-08 19:49:52 +00:00
|
|
|
|
void makeTextEntry(const commandeType commandList[], uint16 height, uint16 X, uint16 Y, uint16 width) {
|
|
|
|
|
byte color = 2;
|
|
|
|
|
byte color2;
|
|
|
|
|
int16 paramY = (height * 9) + 10;
|
|
|
|
|
int16 currentX;
|
|
|
|
|
int16 currentY;
|
|
|
|
|
int16 i;
|
|
|
|
|
uint16 j;
|
|
|
|
|
|
|
|
|
|
if (X + width > 319) {
|
|
|
|
|
X = 319 - width;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Y + paramY > 199) {
|
|
|
|
|
Y = 199 - paramY;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
color2 = defaultMenuBoxColor2;
|
|
|
|
|
|
|
|
|
|
hideMouse();
|
|
|
|
|
blitRawScreen(page1Raw);
|
|
|
|
|
|
|
|
|
|
gfxDrawPlainBoxRaw(X, Y, X + width, Y + 4, color2, page1Raw);
|
|
|
|
|
|
|
|
|
|
currentX = X + 4;
|
|
|
|
|
currentY = Y + 4;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < height; i++) {
|
|
|
|
|
gfxDrawPlainBoxRaw(X, currentY, X + width, currentY + 9, color2, page1Raw);
|
|
|
|
|
currentX = X + 4;
|
|
|
|
|
|
|
|
|
|
for (j = 0; j < strlen(commandList[i]); j++) {
|
|
|
|
|
byte currentChar = commandList[i][j];
|
|
|
|
|
|
|
|
|
|
if (currentChar == ' ') {
|
|
|
|
|
currentX += 5;
|
|
|
|
|
} else {
|
|
|
|
|
byte characterWidth = fontParamTable[currentChar].characterWidth;
|
|
|
|
|
|
|
|
|
|
if (characterWidth) {
|
|
|
|
|
byte characterIdx = fontParamTable[currentChar].characterIdx;
|
|
|
|
|
drawSpriteRaw(textTable[characterIdx][0], textTable[characterIdx][1], 2, 8, page1Raw, currentX, currentY);
|
|
|
|
|
currentX += characterWidth + 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
currentY += 9;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gfxDrawPlainBoxRaw(X, currentY, X + width, currentY + 4, color2, page1Raw); // bottom part
|
|
|
|
|
gfxDrawLine(X + 1, Y + 1, X + width - 1, Y + 1, 0, page1Raw); // top
|
|
|
|
|
gfxDrawLine(X + 1, currentY + 3, X + width - 1, currentY + 3, 0, page1Raw); // bottom
|
|
|
|
|
gfxDrawLine(X + 1, Y + 1, X + 1, currentY + 3, 0, page1Raw); // left
|
|
|
|
|
gfxDrawLine(X + width - 1, Y + 1, X + width - 1, currentY + 3, 0, page1Raw); // left
|
|
|
|
|
|
|
|
|
|
gfxDrawLine(X, Y, X + width, Y, color, page1Raw);
|
|
|
|
|
gfxDrawLine(X, currentY + 4, X + width, currentY + 4, color, page1Raw);
|
|
|
|
|
gfxDrawLine(X, Y, X, currentY + 4, color, page1Raw);
|
|
|
|
|
gfxDrawLine(X + width, Y, X + width, currentY + 4, color, page1Raw);
|
|
|
|
|
|
|
|
|
|
blitRawScreen(page1Raw);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void processInventory(int16 x, int16 y) {
|
|
|
|
|
int16 listSize = buildObjectListCommand();
|
|
|
|
|
uint16 button;
|
|
|
|
|
|
|
|
|
|
if (!listSize)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
makeTextEntry(objectListCommand, listSize, x, y, 140);
|
|
|
|
|
|
|
|
|
|
do {
|
|
|
|
|
manageEvents();
|
|
|
|
|
getMouseData(mouseUpdateStatus, &button, &dummyU16, &dummyU16);
|
|
|
|
|
} while (!button);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 buildObjectListCommand(void) {
|
|
|
|
|
int16 i;
|
|
|
|
|
int16 j;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-10-15 01:06:44 +00:00
|
|
|
|
assert(g_cine->getGameType() == Cine::GType_FW);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
for (i = 0; i < 20; i++) {
|
|
|
|
|
objectListCommand[i][0] = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
j = 0;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 255; i++) {
|
|
|
|
|
if (objectTable[i].name[0] && objectTable[i].costume == -2) {
|
|
|
|
|
strcpy(objectListCommand[j], objectTable[i].name);
|
|
|
|
|
objListTab[j] = i;
|
|
|
|
|
j++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-04-08 08:04:23 +00:00
|
|
|
|
return j;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 buildObjectListCommand2(int16 param) {
|
|
|
|
|
int16 i;
|
|
|
|
|
int16 j;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-10-15 01:06:44 +00:00
|
|
|
|
assert(g_cine->getGameType() == Cine::GType_OS);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
for (i = 0; i < 20; i++) {
|
|
|
|
|
objectListCommand[i][0] = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
j = 0;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 255; i++) {
|
|
|
|
|
if (objectTable[i].name[0] && objectTable[i].costume == param) {
|
|
|
|
|
strcpy(objectListCommand[j], objectTable[i].name);
|
|
|
|
|
objListTab[j] = i;
|
|
|
|
|
j++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-04-08 08:04:23 +00:00
|
|
|
|
return j;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 selectSubObject(int16 x, int16 y) {
|
|
|
|
|
int16 listSize = buildObjectListCommand();
|
|
|
|
|
int16 selectedObject;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (!listSize) {
|
|
|
|
|
return -2;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
selectedObject = makeMenuChoice(objectListCommand, listSize, x, y, 140);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (selectedObject == -1)
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
return objListTab[selectedObject];
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 selectSubObject2(int16 x, int16 y, int16 param) {
|
|
|
|
|
int16 listSize = buildObjectListCommand2(param);
|
|
|
|
|
int16 selectedObject;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (!listSize) {
|
|
|
|
|
return -2;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
selectedObject = makeMenuChoice2(objectListCommand, listSize, x, y, 140);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (selectedObject == -1)
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
if (selectedObject >= 8000) {
|
|
|
|
|
return objListTab[selectedObject - 8000] + 8000;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return objListTab[selectedObject];
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 canUseOnObject = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
void makeCommandLine(void) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 x;
|
|
|
|
|
uint16 y;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
commandVar1 = 0;
|
|
|
|
|
commandVar2 = -10;
|
|
|
|
|
|
|
|
|
|
if (playerCommand != -1) {
|
|
|
|
|
strcpy(commandBuffer, defaultActionCommand[playerCommand]);
|
|
|
|
|
} else {
|
|
|
|
|
strcpy(commandBuffer, "");
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
if ((playerCommand != -1) && (choiceResultTable[playerCommand] == 2)) { // need object selection ?
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 si;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
getMouseData(mouseUpdateStatus, &dummyU16, &x, &y);
|
|
|
|
|
|
2006-10-15 01:06:44 +00:00
|
|
|
|
if (g_cine->getGameType() == Cine::GType_FW) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
si = selectSubObject(x, y + 8);
|
|
|
|
|
} else {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
si = selectSubObject2(x, y + 8, -subObjectUseTable[playerCommand]);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (si < 0) {
|
|
|
|
|
playerCommand = -1;
|
|
|
|
|
strcpy(commandBuffer, "");
|
|
|
|
|
} else {
|
2006-10-15 01:06:44 +00:00
|
|
|
|
if (g_cine->getGameType() == Cine::GType_OS) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
if (si >= 8000) {
|
|
|
|
|
si -= 8000;
|
2006-02-23 20:02:46 +00:00
|
|
|
|
canUseOnObject = canUseOnItemTable[playerCommand];
|
2006-02-22 22:40:53 +00:00
|
|
|
|
} else {
|
|
|
|
|
canUseOnObject = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
commandVar3[0] = si;
|
|
|
|
|
commandVar1 = 1;
|
|
|
|
|
|
|
|
|
|
strcat(commandBuffer, " ");
|
2006-02-23 20:02:46 +00:00
|
|
|
|
strcat(commandBuffer, objectTable[commandVar3[0]].name);
|
2006-04-08 07:50:47 +00:00
|
|
|
|
strcat(commandBuffer, " ");
|
|
|
|
|
strcat(commandBuffer, commandPrepositionOn);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (playerCommand == 2) {
|
|
|
|
|
getMouseData(mouseUpdateStatus, &dummyU16, &x, &y);
|
2006-05-08 19:49:52 +00:00
|
|
|
|
processInventory(x, y + 8);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
playerCommand = -1;
|
|
|
|
|
commandVar1 = 0;
|
|
|
|
|
strcpy(commandBuffer, "");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-10-15 01:06:44 +00:00
|
|
|
|
if (g_cine->getGameType() == Cine::GType_OS) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
if (playerCommand != -1 && canUseOnObject != 0) { // call use on sub object
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 si;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
getMouseData(mouseUpdateStatus, &dummyU16, &x, &y);
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
si = selectSubObject2(x, y + 8, -subObjectUseTable[playerCommand]);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (si) {
|
|
|
|
|
if (si >= 8000) {
|
|
|
|
|
si -= 8000;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
commandVar3[commandVar1] = si;
|
|
|
|
|
|
|
|
|
|
commandVar1++;
|
|
|
|
|
|
|
|
|
|
// TODO: add command message draw
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
isDrawCommandEnabled = 1;
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
if (playerCommand != -1 && choiceResultTable[playerCommand] == commandVar1) {
|
2006-04-09 12:04:33 +00:00
|
|
|
|
selectedObjStruct obj;
|
|
|
|
|
obj.idx = commandVar3[0];
|
|
|
|
|
obj.param = commandVar3[1];
|
|
|
|
|
int16 di = getRelEntryForObject(playerCommand, commandVar1, &obj);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (di != -1) {
|
|
|
|
|
runObjectScript(di);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (allowSystemMenu == 0) {
|
|
|
|
|
isDrawCommandEnabled = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 needMouseSave = 0;
|
|
|
|
|
|
|
|
|
|
uint16 menuVar4 = 0;
|
|
|
|
|
uint16 menuVar5 = 0;
|
|
|
|
|
|
|
|
|
|
int16 makeMenuChoice(const commandeType commandList[], uint16 height, uint16 X, uint16 Y,
|
|
|
|
|
uint16 width) {
|
2006-03-23 03:45:52 +00:00
|
|
|
|
byte color = 2;
|
|
|
|
|
byte color2;
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 paramY;
|
|
|
|
|
int16 currentX;
|
|
|
|
|
int16 currentY;
|
|
|
|
|
int16 i;
|
|
|
|
|
uint16 button;
|
|
|
|
|
int16 var_A;
|
|
|
|
|
int16 di;
|
|
|
|
|
uint16 j;
|
|
|
|
|
int16 mouseX;
|
|
|
|
|
int16 mouseY;
|
|
|
|
|
int16 var_16;
|
|
|
|
|
int16 var_14;
|
|
|
|
|
int16 currentSelection;
|
|
|
|
|
int16 oldSelection;
|
|
|
|
|
int16 var_4;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (allowSystemMenu)
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
paramY = (height * 9) + 10;
|
|
|
|
|
|
|
|
|
|
if (X + width > 319) {
|
|
|
|
|
X = 319 - width;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Y + paramY > 199) {
|
|
|
|
|
Y = 199 - paramY;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
color2 = defaultMenuBoxColor2;
|
|
|
|
|
|
|
|
|
|
hideMouse();
|
|
|
|
|
blitRawScreen(page1Raw);
|
|
|
|
|
|
|
|
|
|
gfxDrawPlainBoxRaw(X, Y, X + width, Y + 4, color2, page1Raw);
|
|
|
|
|
|
|
|
|
|
currentX = X + 4;
|
|
|
|
|
currentY = Y + 4;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < height; i++) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
gfxDrawPlainBoxRaw(X, currentY, X + width, currentY + 9, color2, page1Raw);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
currentX = X + 4;
|
|
|
|
|
|
|
|
|
|
for (j = 0; j < strlen(commandList[i]); j++) {
|
2006-03-23 03:45:52 +00:00
|
|
|
|
byte currentChar = commandList[i][j];
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (currentChar == ' ') {
|
|
|
|
|
currentX += 5;
|
|
|
|
|
} else {
|
2006-03-23 03:45:52 +00:00
|
|
|
|
byte characterWidth = fontParamTable[currentChar].characterWidth;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (characterWidth) {
|
2006-03-23 03:45:52 +00:00
|
|
|
|
byte characterIdx = fontParamTable[currentChar].characterIdx;
|
2006-02-23 20:02:46 +00:00
|
|
|
|
drawSpriteRaw(textTable[characterIdx][0], textTable[characterIdx][1], 2, 8, page1Raw, currentX, currentY);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
currentX += characterWidth + 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
currentY += 9;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gfxDrawPlainBoxRaw(X, currentY, X + width, currentY + 4, color2, page1Raw); // bottom part
|
|
|
|
|
|
|
|
|
|
gfxDrawLine(X + 1, Y + 1, X + width - 1, Y + 1, 0, page1Raw); // top
|
|
|
|
|
gfxDrawLine(X + 1, currentY + 3, X + width - 1, currentY + 3, 0, page1Raw); // bottom
|
|
|
|
|
gfxDrawLine(X + 1, Y + 1, X + 1, currentY + 3, 0, page1Raw); // left
|
|
|
|
|
gfxDrawLine(X + width - 1, Y + 1, X + width - 1, currentY + 3, 0, page1Raw); // left
|
|
|
|
|
|
|
|
|
|
gfxDrawLine(X, Y, X + width, Y, color, page1Raw);
|
|
|
|
|
gfxDrawLine(X, currentY + 4, X + width, currentY + 4, color, page1Raw);
|
|
|
|
|
gfxDrawLine(X, Y, X, currentY + 4, color, page1Raw);
|
|
|
|
|
gfxDrawLine(X + width, Y, X + width, currentY + 4, color, page1Raw);
|
|
|
|
|
|
|
|
|
|
blitRawScreen(page1Raw);
|
|
|
|
|
|
|
|
|
|
do {
|
|
|
|
|
manageEvents();
|
|
|
|
|
getMouseData(mouseUpdateStatus, &button, &dummyU16, &dummyU16);
|
|
|
|
|
} while (button);
|
|
|
|
|
|
|
|
|
|
var_A = 0;
|
|
|
|
|
|
|
|
|
|
currentSelection = 0;
|
|
|
|
|
|
|
|
|
|
di = currentSelection * 9 + Y + 4;
|
|
|
|
|
gfxDrawPlainBoxRaw(X + 2, di - 1, X + width - 2, di + 7, 0, page1Raw); // draw black box behind selection
|
|
|
|
|
currentX = X + 4;
|
|
|
|
|
|
|
|
|
|
for (j = 0; j < strlen(commandList[currentSelection]); j++) {
|
2006-03-23 03:45:52 +00:00
|
|
|
|
byte currentChar = commandList[currentSelection][j];
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (currentChar == ' ') {
|
|
|
|
|
currentX += 5;
|
|
|
|
|
} else {
|
2006-03-23 03:45:52 +00:00
|
|
|
|
byte characterWidth = fontParamTable[currentChar].characterWidth;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (characterWidth) {
|
2006-03-23 03:45:52 +00:00
|
|
|
|
byte characterIdx = fontParamTable[currentChar].characterIdx;
|
2006-02-23 20:02:46 +00:00
|
|
|
|
drawSpriteRaw(textTable[characterIdx][0], textTable[characterIdx][1], 2, 8, page1Raw, currentX, di);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
currentX += characterWidth + 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
blitRawScreen(page1Raw);
|
|
|
|
|
|
|
|
|
|
manageEvents();
|
2006-02-23 20:02:46 +00:00
|
|
|
|
getMouseData(mouseUpdateStatus, &button, (uint16 *)&mouseX, (uint16 *)&mouseY);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
var_16 = mouseX;
|
|
|
|
|
var_14 = mouseY;
|
|
|
|
|
|
|
|
|
|
menuVar = 0;
|
|
|
|
|
|
|
|
|
|
do {
|
|
|
|
|
manageEvents();
|
2006-02-23 20:02:46 +00:00
|
|
|
|
getMouseData(mouseUpdateStatus, &button, (uint16 *)&mouseX, (uint16 *)&mouseY);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (button) {
|
|
|
|
|
var_A = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
oldSelection = currentSelection;
|
|
|
|
|
|
|
|
|
|
if (needMouseSave) {
|
|
|
|
|
for (j = 0; j < 3; j++) {
|
|
|
|
|
mainLoopSub6();
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
if (menuVar4 && currentSelection > 0) { // go up
|
2006-02-22 22:40:53 +00:00
|
|
|
|
currentSelection--;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
if (menuVar5) { // go down
|
2006-02-22 22:40:53 +00:00
|
|
|
|
if (height - 1 > currentSelection) {
|
|
|
|
|
currentSelection++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
if (mouseX > X && mouseX < X + width && mouseY > Y && mouseY < Y + height * 9) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
currentSelection = (mouseY - (Y + 4)) / 9;
|
|
|
|
|
|
|
|
|
|
if (currentSelection < 0)
|
|
|
|
|
currentSelection = 0;
|
|
|
|
|
|
|
|
|
|
if (currentSelection >= height)
|
|
|
|
|
currentSelection = height - 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
if (currentSelection != oldSelection) { // old != new
|
2006-02-22 22:40:53 +00:00
|
|
|
|
if (needMouseSave) {
|
|
|
|
|
hideMouse();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
di = oldSelection * 9 + Y + 4;
|
|
|
|
|
|
|
|
|
|
gfxDrawPlainBoxRaw(X + 2, di - 1, X + width - 2, di + 7, color2, page1Raw); // restore color
|
|
|
|
|
|
|
|
|
|
currentX = X + 4;
|
|
|
|
|
|
|
|
|
|
for (j = 0; j < strlen(commandList[oldSelection]); j++) {
|
2006-03-23 03:45:52 +00:00
|
|
|
|
byte currentChar = commandList[oldSelection][j];
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (currentChar == ' ') {
|
|
|
|
|
currentX += 5;
|
|
|
|
|
} else {
|
2006-03-23 03:45:52 +00:00
|
|
|
|
byte characterWidth = fontParamTable[currentChar].characterWidth;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (characterWidth) {
|
2006-03-23 03:45:52 +00:00
|
|
|
|
byte characterIdx = fontParamTable[currentChar].characterIdx;
|
2006-02-23 20:02:46 +00:00
|
|
|
|
drawSpriteRaw(textTable[characterIdx][0], textTable[characterIdx][1], 2, 8, page1Raw, currentX, di);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
currentX += characterWidth + 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
di = currentSelection * 9 + Y + 4;
|
|
|
|
|
|
|
|
|
|
gfxDrawPlainBoxRaw(X + 2, di - 1, X + width - 2, di + 7, 0, page1Raw); // black new
|
|
|
|
|
|
|
|
|
|
currentX = X + 4;
|
|
|
|
|
|
|
|
|
|
for (j = 0; j < strlen(commandList[currentSelection]);
|
|
|
|
|
j++) {
|
2006-03-23 03:45:52 +00:00
|
|
|
|
byte currentChar = commandList[currentSelection][j];
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (currentChar == ' ') {
|
|
|
|
|
currentX += 5;
|
|
|
|
|
} else {
|
2006-03-23 03:45:52 +00:00
|
|
|
|
byte characterWidth = fontParamTable[currentChar].characterWidth;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (characterWidth) {
|
2006-03-23 03:45:52 +00:00
|
|
|
|
byte characterIdx = fontParamTable[currentChar].characterIdx;
|
2006-02-23 20:02:46 +00:00
|
|
|
|
drawSpriteRaw(textTable[characterIdx][0], textTable[characterIdx][1], 2, 8, page1Raw, currentX, di);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
currentX += characterWidth + 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
blitRawScreen(page1Raw);
|
|
|
|
|
|
|
|
|
|
if (needMouseSave) {
|
|
|
|
|
gfxFuncGen2();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} while (!var_A);
|
|
|
|
|
|
2006-04-05 13:06:03 +00:00
|
|
|
|
assert(!needMouseSave);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
var_4 = button;
|
|
|
|
|
|
|
|
|
|
menuVar = 0;
|
|
|
|
|
|
|
|
|
|
do {
|
|
|
|
|
manageEvents();
|
|
|
|
|
getMouseData(mouseUpdateStatus, &button, &dummyU16, &dummyU16);
|
|
|
|
|
} while (button);
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
if (var_4 == 2) { // recheck
|
2006-02-22 22:40:53 +00:00
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return currentSelection;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 makeMenuChoice2(const commandeType commandList[], uint16 height, uint16 X, uint16 Y,
|
|
|
|
|
uint16 width) {
|
2006-03-23 03:45:52 +00:00
|
|
|
|
byte color = 2;
|
|
|
|
|
byte color2;
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 paramY;
|
|
|
|
|
int16 currentX;
|
|
|
|
|
int16 currentY;
|
|
|
|
|
int16 i;
|
|
|
|
|
uint16 button;
|
|
|
|
|
int16 var_A;
|
|
|
|
|
int16 di;
|
|
|
|
|
uint16 j;
|
|
|
|
|
int16 mouseX;
|
|
|
|
|
int16 mouseY;
|
|
|
|
|
int16 var_16;
|
|
|
|
|
int16 var_14;
|
|
|
|
|
int16 currentSelection;
|
|
|
|
|
int16 oldSelection;
|
|
|
|
|
int16 var_4;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (allowSystemMenu)
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
paramY = (height * 9) + 10;
|
|
|
|
|
|
|
|
|
|
if (X + width > 319) {
|
|
|
|
|
X = 319 - width;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Y + paramY > 199) {
|
|
|
|
|
Y = 199 - paramY;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
color2 = defaultMenuBoxColor2;
|
|
|
|
|
|
|
|
|
|
hideMouse();
|
|
|
|
|
blitRawScreen(page1Raw);
|
|
|
|
|
|
|
|
|
|
gfxDrawPlainBoxRaw(X, Y, X + width, Y + 4, color2, page1Raw);
|
|
|
|
|
|
|
|
|
|
currentX = X + 4;
|
|
|
|
|
currentY = Y + 4;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < height; i++) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
gfxDrawPlainBoxRaw(X, currentY, X + width, currentY + 9, color2, page1Raw);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
currentX = X + 4;
|
|
|
|
|
|
|
|
|
|
for (j = 0; j < strlen(commandList[i]); j++) {
|
2006-03-23 03:45:52 +00:00
|
|
|
|
byte currentChar = commandList[i][j];
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (currentChar == ' ') {
|
|
|
|
|
currentX += 5;
|
|
|
|
|
} else {
|
2006-03-23 03:45:52 +00:00
|
|
|
|
byte characterWidth = fontParamTable[currentChar].characterWidth;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (characterWidth) {
|
2006-03-23 03:45:52 +00:00
|
|
|
|
byte characterIdx = fontParamTable[currentChar].characterIdx;
|
2006-02-23 20:02:46 +00:00
|
|
|
|
drawSpriteRaw(textTable[characterIdx][0], textTable[characterIdx][1], 2, 8, page1Raw, currentX, currentY);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
currentX += characterWidth + 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
currentY += 9;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gfxDrawPlainBoxRaw(X, currentY, X + width, currentY + 4, color2, page1Raw); // bottom part
|
|
|
|
|
|
|
|
|
|
gfxDrawLine(X + 1, Y + 1, X + width - 1, Y + 1, 0, page1Raw); // top
|
|
|
|
|
gfxDrawLine(X + 1, currentY + 3, X + width - 1, currentY + 3, 0, page1Raw); // bottom
|
|
|
|
|
gfxDrawLine(X + 1, Y + 1, X + 1, currentY + 3, 0, page1Raw); // left
|
|
|
|
|
gfxDrawLine(X + width - 1, Y + 1, X + width - 1, currentY + 3, 0, page1Raw); // left
|
|
|
|
|
|
|
|
|
|
gfxDrawLine(X, Y, X + width, Y, color, page1Raw);
|
|
|
|
|
gfxDrawLine(X, currentY + 4, X + width, currentY + 4, color, page1Raw);
|
|
|
|
|
gfxDrawLine(X, Y, X, currentY + 4, color, page1Raw);
|
|
|
|
|
gfxDrawLine(X + width, Y, X + width, currentY + 4, color, page1Raw);
|
|
|
|
|
|
|
|
|
|
blitRawScreen(page1Raw);
|
|
|
|
|
|
|
|
|
|
do {
|
|
|
|
|
manageEvents();
|
|
|
|
|
getMouseData(mouseUpdateStatus, &button, &dummyU16, &dummyU16);
|
|
|
|
|
} while (button);
|
|
|
|
|
|
|
|
|
|
var_A = 0;
|
|
|
|
|
|
|
|
|
|
currentSelection = 0;
|
|
|
|
|
|
|
|
|
|
di = currentSelection * 9 + Y + 4;
|
|
|
|
|
gfxDrawPlainBoxRaw(X + 2, di - 1, X + width - 2, di + 7, 0, page1Raw); // draw black box behind selection
|
|
|
|
|
currentX = X + 4;
|
|
|
|
|
|
|
|
|
|
for (j = 0; j < strlen(commandList[currentSelection]); j++) {
|
2006-03-23 03:45:52 +00:00
|
|
|
|
byte currentChar = commandList[currentSelection][j];
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (currentChar == ' ') {
|
|
|
|
|
currentX += 5;
|
|
|
|
|
} else {
|
2006-03-23 03:45:52 +00:00
|
|
|
|
byte characterWidth = fontParamTable[currentChar].characterWidth;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (characterWidth) {
|
2006-03-23 03:45:52 +00:00
|
|
|
|
byte characterIdx = fontParamTable[currentChar].characterIdx;
|
2006-02-23 20:02:46 +00:00
|
|
|
|
drawSpriteRaw(textTable[characterIdx][0], textTable[characterIdx][1], 2, 8, page1Raw, currentX, di);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
currentX += characterWidth + 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
blitRawScreen(page1Raw);
|
|
|
|
|
|
|
|
|
|
manageEvents();
|
2006-02-23 20:02:46 +00:00
|
|
|
|
getMouseData(mouseUpdateStatus, &button, (uint16 *)&mouseX, (uint16 *)&mouseY);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
var_16 = mouseX;
|
|
|
|
|
var_14 = mouseY;
|
|
|
|
|
|
|
|
|
|
menuVar = 0;
|
|
|
|
|
|
|
|
|
|
do {
|
|
|
|
|
manageEvents();
|
2006-02-23 20:02:46 +00:00
|
|
|
|
getMouseData(mouseUpdateStatus, &button, (uint16 *)&mouseX, (uint16 *)&mouseY);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (button) {
|
|
|
|
|
var_A = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
oldSelection = currentSelection;
|
|
|
|
|
|
|
|
|
|
if (needMouseSave) {
|
|
|
|
|
for (j = 0; j < 3; j++) {
|
|
|
|
|
mainLoopSub6();
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
if (menuVar4 && currentSelection > 0) { // go up
|
2006-02-22 22:40:53 +00:00
|
|
|
|
currentSelection--;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
if (menuVar5) { // go down
|
2006-02-22 22:40:53 +00:00
|
|
|
|
if (height - 1 > currentSelection) {
|
|
|
|
|
currentSelection++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
if (mouseX > X && mouseX < X + width && mouseY > Y && mouseY < Y + height * 9) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
currentSelection = (mouseY - (Y + 4)) / 9;
|
|
|
|
|
|
|
|
|
|
if (currentSelection < 0)
|
|
|
|
|
currentSelection = 0;
|
|
|
|
|
|
|
|
|
|
if (currentSelection >= height)
|
|
|
|
|
currentSelection = height - 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
if (currentSelection != oldSelection) { // old != new
|
2006-02-22 22:40:53 +00:00
|
|
|
|
if (needMouseSave) {
|
|
|
|
|
hideMouse();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
di = oldSelection * 9 + Y + 4;
|
|
|
|
|
|
|
|
|
|
gfxDrawPlainBoxRaw(X + 2, di - 1, X + width - 2, di + 7, color2, page1Raw); // restore color
|
|
|
|
|
|
|
|
|
|
currentX = X + 4;
|
|
|
|
|
|
|
|
|
|
for (j = 0; j < strlen(commandList[oldSelection]); j++) {
|
2006-03-23 03:45:52 +00:00
|
|
|
|
byte currentChar = commandList[oldSelection][j];
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (currentChar == ' ') {
|
|
|
|
|
currentX += 5;
|
|
|
|
|
} else {
|
2006-03-23 03:45:52 +00:00
|
|
|
|
byte characterWidth = fontParamTable[currentChar].characterWidth;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (characterWidth) {
|
2006-03-23 03:45:52 +00:00
|
|
|
|
byte characterIdx = fontParamTable[currentChar].characterIdx;
|
2006-02-23 20:02:46 +00:00
|
|
|
|
drawSpriteRaw(textTable[characterIdx][0], textTable[characterIdx][1], 2, 8, page1Raw, currentX, di);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
currentX += characterWidth + 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
di = currentSelection * 9 + Y + 4;
|
|
|
|
|
|
|
|
|
|
gfxDrawPlainBoxRaw(X + 2, di - 1, X + width - 2, di + 7, 0, page1Raw); // black new
|
|
|
|
|
|
|
|
|
|
currentX = X + 4;
|
|
|
|
|
|
|
|
|
|
for (j = 0; j < strlen(commandList[currentSelection]);
|
|
|
|
|
j++) {
|
2006-03-23 03:45:52 +00:00
|
|
|
|
byte currentChar = commandList[currentSelection][j];
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (currentChar == ' ') {
|
|
|
|
|
currentX += 5;
|
|
|
|
|
} else {
|
2006-03-23 03:45:52 +00:00
|
|
|
|
byte characterWidth = fontParamTable[currentChar].characterWidth;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (characterWidth) {
|
2006-03-23 03:45:52 +00:00
|
|
|
|
byte characterIdx = fontParamTable[currentChar].characterIdx;
|
2006-02-23 20:02:46 +00:00
|
|
|
|
drawSpriteRaw(textTable[characterIdx][0], textTable[characterIdx][1], 2, 8, page1Raw, currentX, di);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
currentX += characterWidth + 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
blitRawScreen(page1Raw);
|
|
|
|
|
|
|
|
|
|
if (needMouseSave) {
|
|
|
|
|
gfxFuncGen2();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} while (!var_A);
|
|
|
|
|
|
2006-04-05 13:06:03 +00:00
|
|
|
|
assert(!needMouseSave);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
var_4 = button;
|
|
|
|
|
|
|
|
|
|
menuVar = 0;
|
|
|
|
|
|
|
|
|
|
do {
|
|
|
|
|
manageEvents();
|
|
|
|
|
getMouseData(mouseUpdateStatus, &button, &dummyU16, &dummyU16);
|
|
|
|
|
} while (button);
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
if (var_4 == 2) { // recheck
|
2006-02-22 22:40:53 +00:00
|
|
|
|
return currentSelection + 8000;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return currentSelection;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
void drawMenuBox(char *command, int16 x, int16 y) {
|
2006-03-23 03:45:52 +00:00
|
|
|
|
byte j;
|
|
|
|
|
byte lColor = 2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
hideMouse();
|
|
|
|
|
|
|
|
|
|
gfxDrawPlainBoxRaw(x, y, x + 300, y + 10, 0, page2Raw);
|
|
|
|
|
|
|
|
|
|
gfxDrawLine(x - 1, y - 1, x + 301, y - 1, lColor, page2Raw); // top
|
|
|
|
|
gfxDrawLine(x - 1, y + 11, x + 301, y + 11, lColor, page2Raw); // bottom
|
|
|
|
|
gfxDrawLine(x - 1, y - 1, x - 1, y + 11, lColor, page2Raw); // left
|
|
|
|
|
gfxDrawLine(x + 301, y - 1, x + 301, y + 11, lColor, page2Raw); // right
|
|
|
|
|
|
|
|
|
|
x += 2;
|
|
|
|
|
y += 2;
|
|
|
|
|
|
|
|
|
|
for (j = 0; j < strlen(command); j++) {
|
2006-03-23 03:45:52 +00:00
|
|
|
|
byte currentChar = command[j];
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (currentChar == ' ') {
|
|
|
|
|
x += 5;
|
|
|
|
|
} else {
|
2006-03-23 03:45:52 +00:00
|
|
|
|
byte characterWidth = fontParamTable[currentChar].characterWidth;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (characterWidth) {
|
2006-03-23 03:45:52 +00:00
|
|
|
|
byte characterIdx = fontParamTable[currentChar].characterIdx;
|
2006-02-23 20:02:46 +00:00
|
|
|
|
drawSpriteRaw(textTable[characterIdx][0], textTable[characterIdx][1], 2, 8, page2Raw, x, y);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
x += characterWidth + 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gfxFuncGen2();
|
|
|
|
|
}
|
|
|
|
|
|
2006-04-11 23:31:03 +00:00
|
|
|
|
void makeActionMenu(void) {
|
|
|
|
|
uint16 mouseButton;
|
|
|
|
|
uint16 mouseX;
|
|
|
|
|
uint16 mouseY;
|
|
|
|
|
|
|
|
|
|
getMouseData(mouseUpdateStatus, &mouseButton, &mouseX, &mouseY);
|
|
|
|
|
|
2006-10-15 01:06:44 +00:00
|
|
|
|
if (g_cine->getGameType() == Cine::GType_OS) {
|
2006-04-11 23:31:03 +00:00
|
|
|
|
playerCommand = makeMenuChoice2(defaultActionCommand, 6, mouseX, mouseY, 70);
|
|
|
|
|
|
|
|
|
|
if (playerCommand >= 8000) {
|
|
|
|
|
playerCommand -= 8000;
|
|
|
|
|
canUseOnObject = 1;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
playerCommand = makeMenuChoice(defaultActionCommand, 6, mouseX, mouseY, 70);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 executePlayerInput(void) {
|
|
|
|
|
uint16 var_5E;
|
|
|
|
|
uint16 var_2;
|
|
|
|
|
uint16 mouseButton;
|
|
|
|
|
uint16 mouseX;
|
|
|
|
|
uint16 mouseY;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
canUseOnObject = 0;
|
|
|
|
|
|
|
|
|
|
if (isInPause) {
|
|
|
|
|
drawString("PAUSE", 0);
|
|
|
|
|
waitPlayerInput();
|
|
|
|
|
isInPause = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (allowPlayerInput) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 currentEntry = 0;
|
|
|
|
|
uint16 di = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (isDrawCommandEnabled) {
|
|
|
|
|
drawMenuBox(commandBuffer, 10, defaultMenuBoxColor);
|
|
|
|
|
isDrawCommandEnabled = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
getMouseData(mouseUpdateStatus, &mouseButton, &mouseX, &mouseY);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
while (mouseButton && currentEntry < 200) {
|
|
|
|
|
if (mouseButton & 1) {
|
|
|
|
|
di |= 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (mouseButton & 2) {
|
|
|
|
|
di |= 2;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
getMouseData(mouseUpdateStatus, &mouseButton, &mouseX, &mouseY);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
currentEntry++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (di) {
|
|
|
|
|
mouseButton = di;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (playerCommand != -1) {
|
|
|
|
|
if (mouseButton & 1) {
|
|
|
|
|
if (mouseButton & 2) {
|
|
|
|
|
makeSystemMenu();
|
|
|
|
|
} else {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 si;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
do {
|
|
|
|
|
manageEvents();
|
2006-02-23 20:02:46 +00:00
|
|
|
|
getMouseData(mouseUpdateStatus, &mouseButton, &dummyU16, &dummyU16);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
} while (mouseButton);
|
|
|
|
|
|
|
|
|
|
si = getObjectUnderCursor(mouseX,
|
|
|
|
|
mouseY);
|
|
|
|
|
|
|
|
|
|
if (si != -1) {
|
|
|
|
|
commandVar3[commandVar1] = si;
|
|
|
|
|
commandVar1++;
|
|
|
|
|
|
|
|
|
|
strcat(commandBuffer, " ");
|
2006-02-23 20:02:46 +00:00
|
|
|
|
strcat(commandBuffer, objectTable[si].name);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
isDrawCommandEnabled = 1;
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
if (choiceResultTable[playerCommand] == commandVar1) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 relEntry;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
drawMenuBox(commandBuffer, 10, defaultMenuBoxColor);
|
2006-04-09 12:04:33 +00:00
|
|
|
|
selectedObjStruct obj;
|
|
|
|
|
obj.idx = commandVar3[0];
|
|
|
|
|
obj.param = commandVar3[1];
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-04-09 12:04:33 +00:00
|
|
|
|
relEntry = getRelEntryForObject(playerCommand, commandVar1, &obj);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (relEntry != -1) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
runObjectScript(relEntry);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
} else {
|
2006-04-12 16:34:23 +00:00
|
|
|
|
addPlayerCommandMessage(playerCommand);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
playerCommand = -1;
|
|
|
|
|
|
|
|
|
|
commandVar1 = 0;
|
2006-02-23 20:02:46 +00:00
|
|
|
|
strcpy(commandBuffer, "");
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2006-02-24 22:34:22 +00:00
|
|
|
|
globalVars[VAR_MOUSE_X_POS] = mouseX;
|
|
|
|
|
globalVars[VAR_MOUSE_Y_POS] = mouseY;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (mouseButton & 2) {
|
|
|
|
|
if (mouseButton & 1) {
|
|
|
|
|
makeSystemMenu();
|
|
|
|
|
}
|
|
|
|
|
|
2006-04-11 23:31:03 +00:00
|
|
|
|
makeActionMenu();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
makeCommandLine();
|
|
|
|
|
} else {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 objIdx;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
objIdx = getObjectUnderCursor(mouseX, mouseY);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (commandVar2 != objIdx) {
|
|
|
|
|
if (objIdx != -1) {
|
|
|
|
|
char command[256];
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
strcpy(command, commandBuffer);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
strcat(command, " ");
|
2006-02-23 20:02:46 +00:00
|
|
|
|
strcat(command, objectTable[objIdx].name);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
drawMenuBox(command, 10, defaultMenuBoxColor);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
} else {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
isDrawCommandEnabled = 1;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
commandVar2 = objIdx;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (mouseButton & 2) {
|
|
|
|
|
if (!(mouseButton & 1)) {
|
2006-10-15 01:06:44 +00:00
|
|
|
|
if (g_cine->getGameType() == Cine::GType_OS) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
playerCommand = makeMenuChoice2(defaultActionCommand, 6, mouseX, mouseY, 70);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (playerCommand >= 8000) {
|
|
|
|
|
playerCommand -= 8000;
|
|
|
|
|
canUseOnObject = 1;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
playerCommand = makeMenuChoice(defaultActionCommand, 6, mouseX, mouseY, 70);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
makeCommandLine();
|
|
|
|
|
} else {
|
|
|
|
|
makeSystemMenu();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (mouseButton & 1) {
|
|
|
|
|
if (!(mouseButton & 2)) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 objIdx;
|
|
|
|
|
int16 relEntry;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-24 22:34:22 +00:00
|
|
|
|
globalVars[VAR_MOUSE_X_POS] = mouseX;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
if (!mouseX) {
|
2006-02-24 22:34:22 +00:00
|
|
|
|
globalVars[VAR_MOUSE_X_POS]++;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-02-24 22:34:22 +00:00
|
|
|
|
globalVars[VAR_MOUSE_Y_POS] = mouseY;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
objIdx = getObjectUnderCursor(mouseX, mouseY);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (objIdx != -1) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
currentSelectedObject.idx = objIdx;
|
|
|
|
|
currentSelectedObject.param = -1;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
relEntry = getRelEntryForObject(6, 1, ¤tSelectedObject);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (relEntry != -1) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
runObjectScript(relEntry);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
makeSystemMenu();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 di = 0;
|
2006-02-23 20:02:46 +00:00
|
|
|
|
getMouseData(mouseUpdateStatus, &mouseButton, &mouseX, &mouseY);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
while (mouseButton) {
|
|
|
|
|
if (mouseButton & 1) {
|
|
|
|
|
di |= 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (mouseButton & 2) {
|
|
|
|
|
di |= 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
manageEvents();
|
2006-02-23 20:02:46 +00:00
|
|
|
|
getMouseData(mouseUpdateStatus, &mouseButton, &mouseX, &mouseY);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (di) {
|
|
|
|
|
mouseButton = di;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((mouseButton & 1) && (mouseButton & 2)) {
|
|
|
|
|
makeSystemMenu();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var_2 = menuVar & 0x7F;
|
|
|
|
|
var_5E = var_2;
|
|
|
|
|
|
|
|
|
|
if (menuVar & 0x80) {
|
|
|
|
|
var_5E = 0;
|
|
|
|
|
var_2 = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
if (inputVar1 && allowPlayerInput) { // use keyboard
|
2006-02-22 22:40:53 +00:00
|
|
|
|
inputVar1 = 0;
|
|
|
|
|
|
2006-02-24 22:34:22 +00:00
|
|
|
|
switch (globalVars[VAR_MOUSE_X_MODE]) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
case 1:
|
2006-04-08 08:04:23 +00:00
|
|
|
|
mouseX = objectTable[1].x + 12;
|
|
|
|
|
break;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
case 2:
|
2006-04-08 08:04:23 +00:00
|
|
|
|
mouseX = objectTable[1].x + 7;
|
|
|
|
|
break;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
default:
|
2006-04-08 08:04:23 +00:00
|
|
|
|
mouseX = globalVars[VAR_MOUSE_X_POS];
|
|
|
|
|
break;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-02-24 22:34:22 +00:00
|
|
|
|
switch (globalVars[VAR_MOUSE_Y_MODE]) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
case 1:
|
2006-04-08 08:04:23 +00:00
|
|
|
|
mouseY = objectTable[1].y + 34;
|
|
|
|
|
break;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
case 2:
|
2006-04-08 08:04:23 +00:00
|
|
|
|
mouseY = objectTable[1].y + 28;
|
|
|
|
|
break;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
default:
|
2006-04-08 08:04:23 +00:00
|
|
|
|
mouseY = globalVars[VAR_MOUSE_Y_POS];
|
|
|
|
|
break;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (var_5E == bgVar0) {
|
|
|
|
|
var_5E = 0;
|
|
|
|
|
|
2006-02-24 22:34:22 +00:00
|
|
|
|
globalVars[VAR_MOUSE_X_POS] = mouseX;
|
|
|
|
|
globalVars[VAR_MOUSE_Y_POS] = mouseY;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
} else {
|
|
|
|
|
if (inputVar2) {
|
|
|
|
|
if (inputVar2 == 2) {
|
2006-02-24 22:34:22 +00:00
|
|
|
|
globalVars[VAR_MOUSE_X_POS] = 1;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
} else {
|
2006-02-24 22:34:22 +00:00
|
|
|
|
globalVars[VAR_MOUSE_X_POS] = 320;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2006-02-24 22:34:22 +00:00
|
|
|
|
globalVars[VAR_MOUSE_X_POS] = mouseX;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (inputVar3) {
|
|
|
|
|
if (inputVar3 == 2) {
|
2006-02-24 22:34:22 +00:00
|
|
|
|
globalVars[VAR_MOUSE_Y_POS] = 1;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
} else {
|
2006-02-24 22:34:22 +00:00
|
|
|
|
globalVars[VAR_MOUSE_Y_POS] = 200;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2006-02-24 22:34:22 +00:00
|
|
|
|
globalVars[VAR_MOUSE_Y_POS] = mouseY;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bgVar0 = var_5E;
|
2006-02-23 20:02:46 +00:00
|
|
|
|
} else { // don't use keyboard for move -> shortcuts to commands
|
|
|
|
|
getMouseData(mouseUpdateStatus, &mouseButton, &mouseX, &mouseY);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
switch (var_2 - 59) {
|
|
|
|
|
case 0:
|
2006-04-08 08:04:23 +00:00
|
|
|
|
if (allowPlayerInput) {
|
|
|
|
|
playerCommand = 0;
|
|
|
|
|
makeCommandLine();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
2006-04-08 08:04:23 +00:00
|
|
|
|
break;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
case 1:
|
2006-04-08 08:04:23 +00:00
|
|
|
|
if (allowPlayerInput) {
|
|
|
|
|
playerCommand = 1;
|
|
|
|
|
makeCommandLine();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
2006-04-08 08:04:23 +00:00
|
|
|
|
break;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
case 2:
|
2006-04-08 08:04:23 +00:00
|
|
|
|
if (allowPlayerInput) {
|
|
|
|
|
playerCommand = 2;
|
|
|
|
|
makeCommandLine();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
2006-04-08 08:04:23 +00:00
|
|
|
|
break;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
case 3:
|
2006-04-08 08:04:23 +00:00
|
|
|
|
if (allowPlayerInput) {
|
|
|
|
|
playerCommand = 3;
|
|
|
|
|
makeCommandLine();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
2006-04-08 08:04:23 +00:00
|
|
|
|
break;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
case 4:
|
2006-04-08 08:04:23 +00:00
|
|
|
|
if (allowPlayerInput) {
|
|
|
|
|
playerCommand = 4;
|
|
|
|
|
makeCommandLine();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
2006-04-08 08:04:23 +00:00
|
|
|
|
break;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
case 5:
|
2006-04-08 08:04:23 +00:00
|
|
|
|
if (allowPlayerInput) {
|
|
|
|
|
playerCommand = 5;
|
|
|
|
|
makeCommandLine();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
2006-04-08 08:04:23 +00:00
|
|
|
|
break;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
case 6:
|
|
|
|
|
case 7:
|
|
|
|
|
case 8:
|
|
|
|
|
case 23:
|
2006-04-08 08:04:23 +00:00
|
|
|
|
break;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
case 9:
|
|
|
|
|
case 24:
|
2006-04-08 08:04:23 +00:00
|
|
|
|
makeSystemMenu();
|
|
|
|
|
break;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
default:
|
2006-04-08 08:04:23 +00:00
|
|
|
|
// printf("Unhandled case %d in last part of executePLayerInput\n",var2-59);
|
|
|
|
|
break;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return var_5E;
|
|
|
|
|
}
|
|
|
|
|
|
2006-03-23 03:45:52 +00:00
|
|
|
|
void drawSprite(overlayHeadElement *currentOverlay, byte *spritePtr,
|
|
|
|
|
byte *maskPtr, uint16 width, uint16 height, byte *page, int16 x, int16 y) {
|
2006-02-23 10:35:33 +00:00
|
|
|
|
#if 0
|
2006-03-23 03:45:52 +00:00
|
|
|
|
byte *ptr = NULL;
|
|
|
|
|
byte i = 0;
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 si = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
overlayHeadElement *pCurrentOverlay = currentOverlay;
|
|
|
|
|
|
2006-04-08 08:04:23 +00:00
|
|
|
|
while (pCurrentOverlay) { // unfinished, probably for mask handling..
|
2006-02-22 22:40:53 +00:00
|
|
|
|
if (pCurrentOverlay->type == 5) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 maskX;
|
|
|
|
|
int16 maskY;
|
|
|
|
|
int16 maskWidth;
|
|
|
|
|
int16 maskHeight;
|
|
|
|
|
uint16 maskSpriteIdx;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (!si) {
|
2006-03-23 03:45:52 +00:00
|
|
|
|
ptr = (byte *)malloc(width * height);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
si = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
maskX = objectTable[pCurrentOverlay->objIdx].x;
|
|
|
|
|
maskY = objectTable[pCurrentOverlay->objIdx].y;
|
|
|
|
|
|
|
|
|
|
maskSpriteIdx = objectTable[pCurrentOverlay->objIdx].frame;
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
maskWidth = animDataTable[maskSpriteIdx].width / 2;
|
2006-02-24 22:34:22 +00:00
|
|
|
|
maskHeight = animDataTable[maskSpriteIdx].height;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
gfxSpriteFunc2(spritePtr, width, height, animDataTable[maskSpriteIdx].ptr1, maskWidth, maskHeight, ptr, maskX - x,maskY - y, i++);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pCurrentOverlay = pCurrentOverlay->next;
|
|
|
|
|
}
|
|
|
|
|
|
2006-04-08 08:04:23 +00:00
|
|
|
|
if (si) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
gfxSpriteFunc1(ptr, width, height, page, x, y);
|
|
|
|
|
free(ptr);
|
|
|
|
|
} else
|
|
|
|
|
#endif
|
|
|
|
|
|
2006-10-15 01:06:44 +00:00
|
|
|
|
if (g_cine->getGameType() == Cine::GType_OS) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
drawSpriteRaw2(spritePtr, objectTable[currentOverlay->objIdx].part, width, height, page, x, y);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
} else {
|
|
|
|
|
drawSpriteRaw(spritePtr, maskPtr, width, height, page, x, y);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 additionalBgVScroll = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
void backupOverlayPage(void) {
|
2006-03-23 03:45:52 +00:00
|
|
|
|
byte *bgPage;
|
|
|
|
|
byte *scrollBg;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
bgPage = additionalBgTable[currentAdditionalBgIdx];
|
|
|
|
|
|
|
|
|
|
if (bgPage) {
|
|
|
|
|
if (!additionalBgVScroll) {
|
|
|
|
|
memcpy(page1Raw, bgPage, 320 * 200);
|
|
|
|
|
} else {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 i;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
scrollBg = additionalBgTable[currentAdditionalBgIdx2];
|
|
|
|
|
|
|
|
|
|
for (i = additionalBgVScroll;
|
|
|
|
|
i < 200 + additionalBgVScroll; i++) {
|
|
|
|
|
if (i > 200) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
memcpy(page1Raw + (i - additionalBgVScroll) * 320, scrollBg + (i - 200) * 320, 320);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
} else {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
memcpy(page1Raw + (i - additionalBgVScroll) * 320, bgPage + (i) * 320, 320);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-05-31 10:55:09 +00:00
|
|
|
|
uint16 computeMessageLength(const byte *ptr, uint16 width, uint16 *numWords, uint16 *messageWidth, uint16 *lineResult) {
|
|
|
|
|
const byte *localPtr = ptr;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 var_2 = 0;
|
|
|
|
|
uint16 localLineResult = 0;
|
|
|
|
|
uint16 var_6 = 0;
|
|
|
|
|
uint16 var_8 = 0;
|
|
|
|
|
uint16 localMessageWidth = 0;
|
|
|
|
|
uint16 var_16 = 0;
|
|
|
|
|
uint16 finished = 0;
|
|
|
|
|
uint16 si = 0;
|
|
|
|
|
uint16 di = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
while (!finished) {
|
2006-03-23 03:45:52 +00:00
|
|
|
|
byte character = *(localPtr++);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (character == ' ') {
|
|
|
|
|
var_8 = var_16;
|
|
|
|
|
var_6 = localMessageWidth;
|
|
|
|
|
localLineResult = si;
|
|
|
|
|
var_2 = di;
|
|
|
|
|
|
|
|
|
|
if (si + 5 < width) {
|
|
|
|
|
var_16++;
|
|
|
|
|
si += 5;
|
|
|
|
|
} else {
|
|
|
|
|
finished = 1;
|
|
|
|
|
}
|
|
|
|
|
} else if (character == 0x7C || character == 0) {
|
|
|
|
|
finished = 1;
|
|
|
|
|
si = 0;
|
|
|
|
|
} else {
|
|
|
|
|
if (fontParamTable[character].characterWidth) {
|
2006-04-05 11:44:46 +00:00
|
|
|
|
uint16 var_C = fontParamTable[character].characterWidth + 1;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (si + var_C < width) {
|
|
|
|
|
si += var_C;
|
|
|
|
|
localMessageWidth += var_C;
|
|
|
|
|
} else {
|
|
|
|
|
finished = 1;
|
|
|
|
|
|
|
|
|
|
if (localLineResult) {
|
|
|
|
|
var_16 = var_8;
|
|
|
|
|
localMessageWidth = var_6;
|
|
|
|
|
si = localLineResult;
|
|
|
|
|
di = var_2;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
di++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
*numWords = var_16;
|
|
|
|
|
*messageWidth = localMessageWidth;
|
|
|
|
|
*lineResult = si;
|
|
|
|
|
|
2006-04-08 08:04:23 +00:00
|
|
|
|
return di;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-03-23 03:45:52 +00:00
|
|
|
|
void drawDialogueMessage(byte msgIdx, int16 x, int16 y, int16 width, int16 color) {
|
|
|
|
|
byte color2 = 2;
|
|
|
|
|
byte endOfMessageReached = 0;
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 localX;
|
|
|
|
|
int16 localY;
|
|
|
|
|
int16 localWidth;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
char *messagePtr = (char *)messageTable[msgIdx].ptr;
|
|
|
|
|
|
|
|
|
|
if (!messagePtr) {
|
|
|
|
|
freeOverlay(msgIdx, 2);
|
2006-04-12 22:07:41 +00:00
|
|
|
|
return;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var20 += strlen(messagePtr);
|
|
|
|
|
|
|
|
|
|
gfxDrawPlainBoxRaw(x, y, x + width, y + 4, color, page1Raw);
|
|
|
|
|
|
|
|
|
|
localX = x + 4;
|
|
|
|
|
localY = y + 4;
|
|
|
|
|
localWidth = width - 8;
|
|
|
|
|
|
|
|
|
|
do {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 messageLength = 0;
|
|
|
|
|
uint16 numWords;
|
|
|
|
|
uint16 messageWidth;
|
|
|
|
|
uint16 lineResult;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
char *endOfMessagePtr;
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 fullLineWidth;
|
|
|
|
|
uint16 interWordSize;
|
|
|
|
|
uint16 interWordSizeRemain;
|
2006-03-23 03:45:52 +00:00
|
|
|
|
byte currentChar;
|
|
|
|
|
byte characterWidth;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
while (messagePtr[messageLength] == ' ') {
|
|
|
|
|
messageLength++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
messagePtr += messageLength;
|
|
|
|
|
|
2006-03-23 03:45:52 +00:00
|
|
|
|
messageLength = computeMessageLength((byte *) messagePtr, localWidth, &numWords, &messageWidth, &lineResult);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
endOfMessagePtr = messagePtr + messageLength;
|
|
|
|
|
|
|
|
|
|
if (lineResult) {
|
|
|
|
|
fullLineWidth = localWidth - messageWidth;
|
|
|
|
|
|
|
|
|
|
if (numWords) {
|
|
|
|
|
interWordSize = fullLineWidth / numWords;
|
|
|
|
|
interWordSizeRemain = fullLineWidth % numWords;
|
|
|
|
|
} else {
|
|
|
|
|
interWordSize = 5;
|
|
|
|
|
interWordSizeRemain = 0;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
interWordSize = 5;
|
|
|
|
|
interWordSizeRemain = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
gfxDrawPlainBoxRaw(x, localY, x + width, localY + 9, color, page1Raw);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
do {
|
|
|
|
|
currentChar = *(messagePtr++);
|
|
|
|
|
|
|
|
|
|
if (currentChar == 0) {
|
|
|
|
|
endOfMessageReached = 1;
|
|
|
|
|
} else if (currentChar == ' ') {
|
|
|
|
|
localX += interWordSizeRemain + interWordSize;
|
|
|
|
|
|
|
|
|
|
if (interWordSizeRemain)
|
|
|
|
|
interWordSizeRemain = 0;
|
|
|
|
|
} else {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
characterWidth = fontParamTable[currentChar].characterWidth;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (characterWidth) {
|
2006-03-23 03:45:52 +00:00
|
|
|
|
byte characterIdx = fontParamTable[currentChar].characterIdx;
|
2006-02-23 20:02:46 +00:00
|
|
|
|
drawSpriteRaw(textTable[characterIdx][0], textTable[characterIdx][1], 2, 8, page1Raw, localX, localY);
|
2006-04-05 11:44:46 +00:00
|
|
|
|
localX += characterWidth + 1;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2006-02-23 20:02:46 +00:00
|
|
|
|
} while ((messagePtr < endOfMessagePtr) && !endOfMessageReached);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
localX = x + 4;
|
|
|
|
|
localY += 9;
|
|
|
|
|
} while (!endOfMessageReached);
|
|
|
|
|
|
|
|
|
|
gfxDrawPlainBoxRaw(x, localY, x + width, localY + 4, color, page1Raw);
|
|
|
|
|
|
|
|
|
|
gfxDrawLine(x + 1, y + 1, x + width - 1, y + 1, 0, page1Raw); // top
|
|
|
|
|
gfxDrawLine(x + 1, localY + 3, x + width - 1, localY + 3, 0, page1Raw); // bottom
|
|
|
|
|
gfxDrawLine(x + 1, y + 1, x + 1, localY + 3, 0, page1Raw); // left
|
|
|
|
|
gfxDrawLine(x + width - 1, y + 1, x + width - 1, localY + 3, 0, page1Raw); // right
|
|
|
|
|
|
|
|
|
|
gfxDrawLine(x, y, x + width, y, color2, page1Raw);
|
|
|
|
|
gfxDrawLine(x, localY + 4, x + width, localY + 4, color2, page1Raw);
|
|
|
|
|
gfxDrawLine(x, y, x, localY + 4, color2, page1Raw);
|
|
|
|
|
gfxDrawLine(x + width, y, x + width, localY + 4, color2, page1Raw);
|
|
|
|
|
|
|
|
|
|
freeOverlay(msgIdx, 2);
|
|
|
|
|
}
|
|
|
|
|
|
2006-04-12 22:06:30 +00:00
|
|
|
|
void drawFailureMessage(byte cmd) {
|
|
|
|
|
byte color2 = 2;
|
|
|
|
|
byte endOfMessageReached = 0;
|
|
|
|
|
int16 localX;
|
|
|
|
|
int16 localY;
|
|
|
|
|
int16 localWidth;
|
|
|
|
|
|
|
|
|
|
byte msgIdx = cmd * 4 + rand() % 4;
|
|
|
|
|
|
|
|
|
|
const char *messagePtr = failureMessages[msgIdx];
|
|
|
|
|
int len = strlen(messagePtr);
|
|
|
|
|
|
|
|
|
|
var20 += len;
|
|
|
|
|
|
|
|
|
|
int16 width = 6 * len + 20;
|
|
|
|
|
|
|
|
|
|
if (width > 300)
|
|
|
|
|
width = 300;
|
|
|
|
|
|
|
|
|
|
int16 x = (320 - width) / 2;
|
|
|
|
|
int16 y = 80;
|
|
|
|
|
int16 color = 4;
|
|
|
|
|
|
|
|
|
|
gfxDrawPlainBoxRaw(x, y, x + width, y + 4, color, page1Raw);
|
|
|
|
|
|
|
|
|
|
localX = x + 4;
|
|
|
|
|
localY = y + 4;
|
|
|
|
|
localWidth = width - 8;
|
|
|
|
|
|
|
|
|
|
do {
|
|
|
|
|
uint16 messageLength = 0;
|
|
|
|
|
uint16 numWords;
|
|
|
|
|
uint16 messageWidth;
|
|
|
|
|
uint16 lineResult;
|
|
|
|
|
const char *endOfMessagePtr;
|
|
|
|
|
uint16 fullLineWidth;
|
|
|
|
|
uint16 interWordSize;
|
|
|
|
|
uint16 interWordSizeRemain;
|
|
|
|
|
byte currentChar;
|
|
|
|
|
byte characterWidth;
|
|
|
|
|
|
|
|
|
|
while (messagePtr[messageLength] == ' ') {
|
|
|
|
|
messageLength++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
messagePtr += messageLength;
|
|
|
|
|
|
2006-05-31 10:55:09 +00:00
|
|
|
|
messageLength = computeMessageLength((const byte *) messagePtr, localWidth, &numWords, &messageWidth, &lineResult);
|
2006-04-12 22:06:30 +00:00
|
|
|
|
|
|
|
|
|
endOfMessagePtr = messagePtr + messageLength;
|
|
|
|
|
|
|
|
|
|
if (lineResult) {
|
|
|
|
|
fullLineWidth = localWidth - messageWidth;
|
|
|
|
|
|
|
|
|
|
if (numWords) {
|
|
|
|
|
interWordSize = fullLineWidth / numWords;
|
|
|
|
|
interWordSizeRemain = fullLineWidth % numWords;
|
|
|
|
|
} else {
|
|
|
|
|
interWordSize = 5;
|
|
|
|
|
interWordSizeRemain = 0;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
interWordSize = 5;
|
|
|
|
|
interWordSizeRemain = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gfxDrawPlainBoxRaw(x, localY, x + width, localY + 9, color, page1Raw);
|
|
|
|
|
|
|
|
|
|
do {
|
|
|
|
|
currentChar = *(messagePtr++);
|
|
|
|
|
|
|
|
|
|
if (currentChar == 0) {
|
|
|
|
|
endOfMessageReached = 1;
|
|
|
|
|
} else if (currentChar == ' ') {
|
|
|
|
|
localX += interWordSizeRemain + interWordSize;
|
|
|
|
|
|
|
|
|
|
if (interWordSizeRemain)
|
|
|
|
|
interWordSizeRemain = 0;
|
|
|
|
|
} else {
|
|
|
|
|
characterWidth = fontParamTable[currentChar].characterWidth;
|
|
|
|
|
|
|
|
|
|
if (characterWidth) {
|
|
|
|
|
byte characterIdx = fontParamTable[currentChar].characterIdx;
|
|
|
|
|
drawSpriteRaw(textTable[characterIdx][0], textTable[characterIdx][1], 2, 8, page1Raw, localX, localY);
|
|
|
|
|
localX += characterWidth + 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} while ((messagePtr < endOfMessagePtr) && !endOfMessageReached);
|
|
|
|
|
|
|
|
|
|
localX = x + 4;
|
|
|
|
|
localY += 9;
|
|
|
|
|
} while (!endOfMessageReached);
|
|
|
|
|
|
|
|
|
|
gfxDrawPlainBoxRaw(x, localY, x + width, localY + 4, color, page1Raw);
|
|
|
|
|
|
|
|
|
|
gfxDrawLine(x + 1, y + 1, x + width - 1, y + 1, 0, page1Raw); // top
|
|
|
|
|
gfxDrawLine(x + 1, localY + 3, x + width - 1, localY + 3, 0, page1Raw); // bottom
|
|
|
|
|
gfxDrawLine(x + 1, y + 1, x + 1, localY + 3, 0, page1Raw); // left
|
|
|
|
|
gfxDrawLine(x + width - 1, y + 1, x + width - 1, localY + 3, 0, page1Raw); // right
|
|
|
|
|
|
|
|
|
|
gfxDrawLine(x, y, x + width, y, color2, page1Raw);
|
|
|
|
|
gfxDrawLine(x, localY + 4, x + width, localY + 4, color2, page1Raw);
|
|
|
|
|
gfxDrawLine(x, y, x, localY + 4, color2, page1Raw);
|
|
|
|
|
gfxDrawLine(x + width, y, x + width, localY + 4, color2, page1Raw);
|
|
|
|
|
|
|
|
|
|
freeOverlay(cmd, 3);
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-22 22:40:53 +00:00
|
|
|
|
void drawOverlays(void) {
|
|
|
|
|
overlayHeadElement *currentOverlay;
|
|
|
|
|
|
|
|
|
|
backupOverlayPage();
|
|
|
|
|
|
|
|
|
|
var20 = 0;
|
|
|
|
|
|
|
|
|
|
currentOverlay = &overlayHead;
|
|
|
|
|
|
|
|
|
|
currentOverlay = currentOverlay->next;
|
|
|
|
|
|
|
|
|
|
while (currentOverlay) {
|
|
|
|
|
switch (currentOverlay->type) {
|
|
|
|
|
case 0: // sprite
|
|
|
|
|
{
|
|
|
|
|
objectStruct *objPtr;
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 x;
|
|
|
|
|
int16 y;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-03-23 03:17:47 +00:00
|
|
|
|
assert(currentOverlay->objIdx <= NUM_MAX_OBJECT);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
objPtr = &objectTable[currentOverlay->objIdx];
|
|
|
|
|
|
|
|
|
|
x = objPtr->x;
|
|
|
|
|
y = objPtr->y;
|
|
|
|
|
|
|
|
|
|
if (objPtr->frame >= 0) {
|
2006-10-15 01:06:44 +00:00
|
|
|
|
if (g_cine->getGameType() == Cine::GType_OS) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 partVar1;
|
|
|
|
|
uint16 partVar2;
|
2006-02-27 21:25:59 +00:00
|
|
|
|
AnimData *pPart;
|
2006-02-23 20:02:46 +00:00
|
|
|
|
pPart = &animDataTable[objPtr->frame];
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
partVar1 = pPart->var1;
|
2006-02-24 22:34:22 +00:00
|
|
|
|
partVar2 = pPart->height;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (pPart->ptr1) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
drawSprite(currentOverlay, pPart->ptr1, pPart->ptr1, partVar1, partVar2, page1Raw, x, y);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 partVar1;
|
|
|
|
|
uint16 partVar2;
|
2006-02-27 21:25:59 +00:00
|
|
|
|
AnimData *pPart;
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 part = objPtr->part;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-03-23 03:17:47 +00:00
|
|
|
|
assert(part >= 0 && part <= NUM_MAX_ANIMDATA);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
pPart = &animDataTable[objPtr->frame];
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
partVar1 = pPart->var1;
|
2006-02-24 22:34:22 +00:00
|
|
|
|
partVar2 = pPart->height;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (pPart->ptr1) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
drawSprite(currentOverlay, pPart->ptr1, pPart->ptr2, partVar1, partVar2, page1Raw, x, y);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 2: // text
|
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
|
byte messageIdx;
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 x;
|
|
|
|
|
int16 y;
|
|
|
|
|
uint16 partVar1;
|
|
|
|
|
uint16 partVar2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
// gfxWaitVSync();
|
|
|
|
|
// hideMouse();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
messageIdx = currentOverlay->objIdx;
|
|
|
|
|
x = currentOverlay->x;
|
|
|
|
|
y = currentOverlay->y;
|
2006-03-09 23:02:29 +00:00
|
|
|
|
partVar1 = currentOverlay->width;
|
|
|
|
|
partVar2 = currentOverlay->color;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
blitRawScreen(page1Raw);
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
drawDialogueMessage(messageIdx, x, y, partVar1, partVar2);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
//blitScreen(page0, NULL);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
gfxFuncGen2();
|
|
|
|
|
|
|
|
|
|
waitForPlayerClick = 1;
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 3:
|
|
|
|
|
{
|
2006-04-12 22:06:30 +00:00
|
|
|
|
// gfxWaitSync()
|
|
|
|
|
// hideMouse();
|
|
|
|
|
|
|
|
|
|
blitRawScreen(page1Raw);
|
|
|
|
|
|
|
|
|
|
drawFailureMessage(currentOverlay->objIdx);
|
|
|
|
|
|
|
|
|
|
//blitScreen(page0, NULL);
|
|
|
|
|
|
|
|
|
|
gfxFuncGen2();
|
|
|
|
|
|
|
|
|
|
waitForPlayerClick = 1;
|
|
|
|
|
|
2006-02-22 22:40:53 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 4:
|
|
|
|
|
{
|
|
|
|
|
objectStruct *objPtr;
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 x;
|
|
|
|
|
int16 y;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-03-23 03:17:47 +00:00
|
|
|
|
assert(currentOverlay->objIdx <= NUM_MAX_OBJECT);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
objPtr = &objectTable[currentOverlay->objIdx];
|
|
|
|
|
|
|
|
|
|
x = objPtr->x;
|
|
|
|
|
y = objPtr->y;
|
|
|
|
|
|
|
|
|
|
if (objPtr->frame >= 0) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 partVar1;
|
|
|
|
|
uint16 partVar2;
|
2006-02-27 21:25:59 +00:00
|
|
|
|
AnimData *pPart;
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 part = objPtr->part;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-03-23 03:17:47 +00:00
|
|
|
|
assert(part >= 0 && part <= NUM_MAX_ANIMDATA);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
pPart = &animDataTable[objPtr->frame];
|
|
|
|
|
|
|
|
|
|
partVar1 = pPart->width / 2;
|
2006-02-24 22:34:22 +00:00
|
|
|
|
partVar2 = pPart->height;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (pPart->ptr1) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
gfxFillSprite(pPart->ptr1, partVar1, partVar2, page1Raw, x, y);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 20:
|
|
|
|
|
{
|
|
|
|
|
objectStruct *objPtr;
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 x;
|
|
|
|
|
int16 y;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
var5 = currentOverlay->x;
|
|
|
|
|
|
2006-03-23 03:17:47 +00:00
|
|
|
|
assert(currentOverlay->objIdx <= NUM_MAX_OBJECT);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
objPtr = &objectTable[currentOverlay->objIdx];
|
|
|
|
|
|
|
|
|
|
x = objPtr->x;
|
|
|
|
|
y = objPtr->y;
|
|
|
|
|
|
|
|
|
|
if (objPtr->frame >= 0) {
|
2006-02-23 11:05:58 +00:00
|
|
|
|
if (var5 <= 8) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
if (additionalBgTable[var5]) {
|
2006-02-24 22:34:22 +00:00
|
|
|
|
if (animDataTable[objPtr->frame].bpp == 1) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 x2;
|
|
|
|
|
int16 y2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
x2 = animDataTable[objPtr->frame].width / 2;
|
2006-02-24 22:34:22 +00:00
|
|
|
|
y2 = animDataTable[objPtr->frame].height;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (animDataTable[objPtr->frame].ptr1) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
// drawSpriteRaw(animDataTable[objPtr->frame].ptr1, animDataTable[objPtr->frame].ptr1, x2, y2,
|
|
|
|
|
// additionalBgTable[currentAdditionalBgIdx], x, y);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
currentOverlay = currentOverlay->next;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void flip(void) {
|
|
|
|
|
blitRawScreen(page1Raw);
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 processKeyboard(uint16 param) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void mainLoopSub6(void) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void checkForPendingDataLoad(void) {
|
|
|
|
|
if (newPrcName[0] != 0) {
|
|
|
|
|
freePrcLinkedList();
|
|
|
|
|
resetglobalScriptsHead();
|
|
|
|
|
|
|
|
|
|
loadPrc(newPrcName);
|
|
|
|
|
|
|
|
|
|
strcpy(currentPrcName, newPrcName);
|
|
|
|
|
strcpy(newPrcName, "");
|
|
|
|
|
|
|
|
|
|
addScriptToList0(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (newRelName[0] != 0) {
|
|
|
|
|
releaseObjectScripts();
|
|
|
|
|
resetObjectScriptHead();
|
|
|
|
|
|
|
|
|
|
loadRel(newRelName);
|
|
|
|
|
|
|
|
|
|
strcpy(currentRelName, newRelName);
|
|
|
|
|
strcpy(newRelName, "");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (newObjectName[0] != 0) {
|
|
|
|
|
unloadAllMasks();
|
|
|
|
|
resetMessageHead();
|
|
|
|
|
|
|
|
|
|
loadObject(newObjectName);
|
|
|
|
|
|
|
|
|
|
strcpy(currentObjectName, newObjectName);
|
|
|
|
|
strcpy(newObjectName, "");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (newMsgName[0] != 0) {
|
|
|
|
|
loadMsg(newMsgName);
|
|
|
|
|
|
|
|
|
|
strcpy(currentMsgName, newMsgName);
|
|
|
|
|
strcpy(newMsgName, "");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 exitEngine;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
void hideMouse(void) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void closeEngine7(void) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void removeExtention(char *dest, const char *source) {
|
2006-03-23 03:45:52 +00:00
|
|
|
|
byte *ptr;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
strcpy(dest, source);
|
|
|
|
|
|
2006-03-23 03:45:52 +00:00
|
|
|
|
ptr = (byte *) strchr(dest, '.');
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (ptr) {
|
|
|
|
|
*ptr = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 var22;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 defaultMenuBoxColor2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 zoneData[NUM_MAX_ZONE];
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-03-23 03:45:52 +00:00
|
|
|
|
void addMessage(byte param1, int16 param2, int16 param3, int16 param4, int16 param5) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
overlayHeadElement *currentHead = &overlayHead;
|
|
|
|
|
overlayHeadElement *tempHead = currentHead;
|
|
|
|
|
overlayHeadElement *newElement;
|
|
|
|
|
|
|
|
|
|
currentHead = tempHead->next;
|
|
|
|
|
|
|
|
|
|
while (currentHead) {
|
|
|
|
|
tempHead = currentHead;
|
|
|
|
|
currentHead = tempHead->next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
newElement = (overlayHeadElement *) malloc(sizeof(overlayHeadElement));
|
|
|
|
|
|
|
|
|
|
newElement->next = tempHead->next;
|
|
|
|
|
tempHead->next = newElement;
|
|
|
|
|
|
|
|
|
|
newElement->objIdx = param1;
|
|
|
|
|
newElement->type = 2;
|
|
|
|
|
|
|
|
|
|
newElement->x = param2;
|
|
|
|
|
newElement->y = param3;
|
2006-03-09 23:02:29 +00:00
|
|
|
|
newElement->width = param4;
|
|
|
|
|
newElement->color = param5;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (!currentHead)
|
|
|
|
|
currentHead = &overlayHead;
|
|
|
|
|
|
|
|
|
|
newElement->previous = currentHead->previous;
|
|
|
|
|
|
|
|
|
|
currentHead->previous = newElement;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-27 21:25:59 +00:00
|
|
|
|
SeqListElement seqList;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-27 21:25:59 +00:00
|
|
|
|
void addSeqListElement(int16 param0, int16 param1, int16 param2, int16 param3, int16 param4, int16 param5, int16 param6, int16 param7, int16 param8) {
|
|
|
|
|
SeqListElement *currentHead = &seqList;
|
|
|
|
|
SeqListElement *tempHead = currentHead;
|
|
|
|
|
SeqListElement *newElement;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
currentHead = tempHead->next;
|
|
|
|
|
|
|
|
|
|
while (currentHead && currentHead->varE < param7) {
|
|
|
|
|
tempHead = currentHead;
|
|
|
|
|
currentHead = tempHead->next;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-27 21:25:59 +00:00
|
|
|
|
newElement = (SeqListElement *)malloc(sizeof(SeqListElement));
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
newElement->next = tempHead->next;
|
|
|
|
|
tempHead->next = newElement;
|
|
|
|
|
|
|
|
|
|
newElement->var6 = param0;
|
|
|
|
|
newElement->var4 = param1;
|
|
|
|
|
newElement->var8 = param2;
|
|
|
|
|
newElement->varA = param3;
|
|
|
|
|
newElement->varC = param4;
|
|
|
|
|
newElement->var14 = 0;
|
|
|
|
|
newElement->var16 = 0;
|
|
|
|
|
newElement->var18 = param5;
|
|
|
|
|
newElement->var1A = param6;
|
|
|
|
|
newElement->varE = param7;
|
|
|
|
|
newElement->var10 = param8;
|
|
|
|
|
newElement->var12 = param8;
|
|
|
|
|
newElement->var1C = 0;
|
|
|
|
|
newElement->var1E = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-27 21:25:59 +00:00
|
|
|
|
void resetSeqList() {
|
|
|
|
|
seqList.next = NULL;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-02-27 21:25:59 +00:00
|
|
|
|
void computeMove1(SeqListElement *element, int16 x, int16 y, int16 param1,
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 param2, int16 x2, int16 y2) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
element->var16 = 0;
|
|
|
|
|
element->var14 = 0;
|
|
|
|
|
|
|
|
|
|
if (y2) {
|
|
|
|
|
if (y - param2 > y2) {
|
|
|
|
|
element->var16 = 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (y + param2 < y2) {
|
|
|
|
|
element->var16 = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (x2) {
|
|
|
|
|
if (x - param1 > x2) {
|
|
|
|
|
element->var14 = 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (x + param1 < x2) {
|
|
|
|
|
element->var14 = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-27 21:25:59 +00:00
|
|
|
|
uint16 computeMove2(SeqListElement *element) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 returnVar = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (element->var16 == 1) {
|
|
|
|
|
returnVar = 4;
|
|
|
|
|
} else if (element->var16 == 2) {
|
|
|
|
|
returnVar = 3;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (element->var14 == 1) {
|
|
|
|
|
returnVar = 1;
|
|
|
|
|
} else if (element->var14 == 2) {
|
|
|
|
|
returnVar = 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return returnVar;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// sort all the gfx stuff...
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
void resetGfxEntityEntry(uint16 objIdx) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
#if 0
|
|
|
|
|
overlayHeadElement* tempHead = &overlayHead;
|
2006-03-23 03:45:52 +00:00
|
|
|
|
byte* var_16 = NULL;
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 var_10 = 0;
|
|
|
|
|
uint16 var_12 = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
overlayHeadElement* currentHead = tempHead->next;
|
2006-03-23 03:45:52 +00:00
|
|
|
|
byte* var_1A = NULL;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
overlayHeadElement* var1E = &overlayHead;
|
|
|
|
|
|
2006-04-08 08:04:23 +00:00
|
|
|
|
while (currentHead) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
tempHead2 = currentHead->next;
|
|
|
|
|
|
2006-04-08 08:04:23 +00:00
|
|
|
|
if (currentHead->objIdx == objIdx && currentHead->type!=2 && currentHead->type!=3 && currentHead->type!=0x14) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
tempHead->next = tempHead2;
|
|
|
|
|
|
2006-04-08 08:04:23 +00:00
|
|
|
|
if (tempHead2) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
tempHead2->previous = currentHead->previous;
|
|
|
|
|
} else {
|
|
|
|
|
seqVar0 = currentHead->previous;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var_22 = var_16;
|
|
|
|
|
|
2006-04-08 08:04:23 +00:00
|
|
|
|
if (!var_22) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
// todo: goto?
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var_22->previous = currentHead;
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
|
2006-04-08 08:04:23 +00:00
|
|
|
|
if (currentHead->type == 0x14) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
|
2006-04-08 08:04:23 +00:00
|
|
|
|
if (currentHead->type == 0x2 || currentHead->type == 0x3) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
si = 10000;
|
|
|
|
|
} else {
|
|
|
|
|
si = objectTable[currentHead->objIdx];
|
|
|
|
|
}
|
|
|
|
|
|
2006-04-08 08:04:23 +00:00
|
|
|
|
if (objectTable[objIdx]>si) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
var1E = currentHead;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tempHead = tempHead->next;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
if (var_1A) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
currentHead = var_16;
|
|
|
|
|
var_22 = var_1E->next;
|
|
|
|
|
var_1E->next = currentHead;
|
|
|
|
|
var_1A->next = var_22;
|
|
|
|
|
|
2006-04-08 08:04:23 +00:00
|
|
|
|
if (var_1E != &gfxEntityHead) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
currentHead->previous = var_1E;
|
|
|
|
|
}
|
|
|
|
|
|
2006-04-08 08:04:23 +00:00
|
|
|
|
if (!var_22) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
seqVar0 = var_1A;
|
|
|
|
|
} else {
|
|
|
|
|
var_22->previous = var_1A;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
2006-03-23 03:45:52 +00:00
|
|
|
|
uint16 addAni(uint16 param1, uint16 param2, byte *ptr, SeqListElement *element, uint16 param3, int16 *param4) {
|
|
|
|
|
byte *currentPtr = ptr;
|
|
|
|
|
byte *ptrData;
|
|
|
|
|
byte *ptr2;
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 di;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-03-23 03:17:47 +00:00
|
|
|
|
assert(ptr);
|
|
|
|
|
assert(element);
|
|
|
|
|
assert(param4);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-03-03 19:38:17 +00:00
|
|
|
|
dummyU16 = READ_BE_UINT16((currentPtr + param1 * 2) + 8);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
ptrData = ptr + dummyU16;
|
|
|
|
|
|
2006-03-23 03:17:47 +00:00
|
|
|
|
assert(*ptrData);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
di = (objectTable[param2].costume + 1) % (*ptrData);
|
|
|
|
|
ptr2 = (ptrData + (di * 8)) + 1;
|
|
|
|
|
|
|
|
|
|
if ((checkCollision(param2, ptr2[0], ptr2[1], ptr2[2], ptr[0]) & 1)) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
objectTable[param2].x += (int8)ptr2[4];
|
|
|
|
|
objectTable[param2].y += (int8)ptr2[5];
|
|
|
|
|
objectTable[param2].mask += (int8)ptr2[6];
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (objectTable[param2].frame) {
|
|
|
|
|
resetGfxEntityEntry(param2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
objectTable[param2].frame = ptr2[7] + element->var8;
|
|
|
|
|
|
|
|
|
|
if (param3 || !element->var14) {
|
|
|
|
|
objectTable[param2].costume = di;
|
|
|
|
|
} else {
|
|
|
|
|
*param4 = di;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-27 21:25:59 +00:00
|
|
|
|
void processSeqListElement(SeqListElement *element) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 x;
|
|
|
|
|
int16 y;
|
2006-03-23 03:45:52 +00:00
|
|
|
|
byte *ptr1;
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 var_10;
|
|
|
|
|
int16 var_4;
|
|
|
|
|
int16 var_2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (element->var12 < element->var10) {
|
|
|
|
|
element->var12++;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
element->var12 = 0;
|
|
|
|
|
|
|
|
|
|
x = objectTable[element->var6].x;
|
|
|
|
|
y = objectTable[element->var6].y;
|
|
|
|
|
ptr1 = animDataTable[element->varA].ptr1;
|
|
|
|
|
|
|
|
|
|
if (ptr1) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 param1;
|
|
|
|
|
uint16 param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
param1 = ptr1[1];
|
|
|
|
|
param2 = ptr1[2];
|
|
|
|
|
|
2006-10-15 01:06:44 +00:00
|
|
|
|
if (element->varC != 255)
|
|
|
|
|
warning("processSeqListElement: varC = %d", element->varC);
|
2006-04-05 13:06:03 +00:00
|
|
|
|
|
|
|
|
|
if (globalVars[VAR_MOUSE_X_POS] || globalVars[VAR_MOUSE_Y_POS]) {
|
|
|
|
|
computeMove1(element, ptr1[4] + x, ptr1[5] + y, param1, param2, globalVars[VAR_MOUSE_X_POS], globalVars[VAR_MOUSE_Y_POS]);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
} else {
|
2006-04-05 13:06:03 +00:00
|
|
|
|
element->var16 = 0;
|
|
|
|
|
element->var14 = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var_10 = computeMove2(element);
|
|
|
|
|
|
|
|
|
|
if (var_10) {
|
|
|
|
|
element->var1C = var_10;
|
|
|
|
|
element->var1E = var_10;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var_4 = -1;
|
|
|
|
|
|
|
|
|
|
if ((element->var16 == 1
|
2006-02-23 20:02:46 +00:00
|
|
|
|
&& !addAni(3, element->var6, ptr1, element, 0, &var_4)) || (element->var16 == 2 && !addAni(2, element->var6, ptr1, element, 0,
|
2006-02-22 22:40:53 +00:00
|
|
|
|
&var_4))) {
|
|
|
|
|
if (element->varC == 255) {
|
2006-02-24 22:34:22 +00:00
|
|
|
|
globalVars[VAR_MOUSE_Y_POS] = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((element->var14 == 1
|
2006-02-23 20:02:46 +00:00
|
|
|
|
&& !addAni(0, element->var6, ptr1, element, 1, &var_2))) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
if (element->varC == 255) {
|
2006-02-24 22:34:22 +00:00
|
|
|
|
globalVars[VAR_MOUSE_X_POS] = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (var_4 != -1) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
objectTable[element->var6].costume = var_4;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
if ((element->var14 == 2 && !addAni(1, element->var6, ptr1, element, 1, &var_2))) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
if (element->varC == 255) {
|
2006-02-24 22:34:22 +00:00
|
|
|
|
globalVars[VAR_MOUSE_X_POS] = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (var_4 != -1) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
objectTable[element->var6].costume = var_4;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (element->var16 + element->var14) {
|
|
|
|
|
if (element->var1C) {
|
|
|
|
|
if (element->var1E) {
|
|
|
|
|
objectTable[element->var6].costume = 0;
|
|
|
|
|
element->var1E = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
addAni(element->var1C + 3, element->var6, ptr1, element, 1, (int16 *) & var2);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-27 21:25:59 +00:00
|
|
|
|
void processSeqList(void) {
|
|
|
|
|
SeqListElement *currentHead = &seqList;
|
|
|
|
|
SeqListElement *tempHead = currentHead;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
currentHead = tempHead->next;
|
|
|
|
|
|
|
|
|
|
while (currentHead) {
|
|
|
|
|
if (currentHead->var4 != -1) {
|
2006-02-27 21:25:59 +00:00
|
|
|
|
processSeqListElement(currentHead);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tempHead = currentHead;
|
|
|
|
|
currentHead = tempHead->next;
|
|
|
|
|
}
|
|
|
|
|
}
|
2006-02-25 00:26:14 +00:00
|
|
|
|
|
|
|
|
|
} // End of namespace Cine
|