home *** CD-ROM | disk | FTP | other *** search
Text File | 2006-12-06 | 28.3 KB | 1,016 lines |
- /* ScummC
- * Copyright (C) 2006 Alban Bedel
- *
- * 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.
- *
- */
-
- // include all the vars used by the engine itself
- #include <scummVars6.s>
- #include "common.sch"
-
- // The room we start in
- room Road;
-
- bit verbsOn,cursorOn,cursorLoaded;
-
- int sntcVerb,sntcObjA,sntcObjB;
- int selVerb,altVerb;
- int tryPick;
- int* invObj;
-
- room ResRoom {
-
- // define the charset we are going to use
- // the gui use the first charset, so te be sure force its address
- chset chset1 @ 1 = "vera-gui.char";
- // our standard charset
- chset chtest = "vera.char";
- // dialog charset
- chset dialogCharset = "vera-small.char";
- // and the costume for our actor
- cost egoCost = "devil.cost";
-
- // an object for the cursor image
- object cursor {
- x = 0;
- y = 0;
- w = 16;
- h = 16;
- name = "cursor";
- states = {
- { 3, 3, "cursor.bmp" }
- };
- }
-
- // the inventory icons
- object axe {
- w = 40;
- h = 16;
- x = 0;
- name = "the axe";
- states = {
- { 0, 0, "inv_axe.bmp" }
- };
- state = 1;
- }
-
- local script localTest() {
- dbgPrint("Ltst");
- }
-
- // some startup scripts
-
- // set the actor costume, etc
- script setupActors() {
- // create the actor
- setCurrentActor(hero);
- initActor();
- setActorCostume(egoCost);
- setActorTalkPos(-60,-60);
- setActorName("Beasty");
- setActorWalkSpeed(2,1);
- setActorTalkColor(BEASTY_COLOR);
- setActorWidth(40);
- setActorAnimSpeed(2);
- // set VAR_EGO so we can use the *Ego* functions
- VAR_EGO = hero;
- }
-
- // setup all the verbs
- script setupVerbs() {
- int color,hiColor,dimColor,l,c,vrb;
-
- color = VERB_COLOR;
- hiColor = VERB_HI_COLOR;
- dimColor = VERB_DIM_COLOR;
-
- sntcVerb = WalkTo;
- //sntcObjA = 0;
- //sntcObjB = 0;
-
- setCurrentVerb(SntcLine);
- initVerb();
- setVerbName("%v{sntcVerb} %n{sntcObjA} %s{sntcPrepo} %n{sntcObjB}");
- setVerbXY(160,145);
- setVerbColor(color);
- setVerbHiColor(hiColor);
- verbCenter();
-
- setCurrentVerb(WalkTo);
- initVerb();
- setVerbName("Walk to");
- setVerbKey('w');
-
- setCurrentVerb(Give);
- initVerb();
- setVerbName("Give");
- setVerbXY(10,156);
- setVerbColor(color);
- setVerbHiColor(hiColor);
- setVerbDimColor(dimColor);
- setVerbKey('g');
-
- setCurrentVerb(PickUp);
- initVerb();
- setVerbName("Pick up");
- setVerbXY(50,156);
- setVerbColor(color);
- setVerbHiColor(hiColor);
- setVerbDimColor(dimColor);
- setVerbKey('p');
-
- setCurrentVerb(Use);
- initVerb();
- setVerbName("Use");
- setVerbXY(100,156);
- setVerbColor(color);
- setVerbHiColor(hiColor);
- setVerbDimColor(dimColor);
- setVerbKey('u');
-
- setCurrentVerb(Open);
- initVerb();
- setVerbName("Open");
- setVerbXY(10,170);
- setVerbColor(color);
- setVerbHiColor(hiColor);
- setVerbDimColor(dimColor);
- setVerbKey('o');
-
- setCurrentVerb(LookAt);
- initVerb();
- setVerbName("Look at");
- setVerbXY(50,170);
- setVerbColor(color);
- setVerbHiColor(hiColor);
- setVerbDimColor(dimColor);
- setVerbKey('l');
-
- setCurrentVerb(Push);
- initVerb();
- setVerbName("Push");
- setVerbXY(100,170);
- setVerbColor(color);
- setVerbHiColor(hiColor);
- setVerbDimColor(dimColor);
- //setVerbKey('');
-
- setCurrentVerb(Close);
- initVerb();
- setVerbName("Close");
- setVerbXY(10,184);
- setVerbColor(color);
- setVerbHiColor(hiColor);
- setVerbDimColor(dimColor);
- setVerbKey('c');
-
- setCurrentVerb(TalkTo);
- initVerb();
- setVerbName("Talk to");
- setVerbXY(50,184);
- setVerbColor(color);
- setVerbHiColor(hiColor);
- setVerbDimColor(dimColor);
- setVerbKey('t');
-
- setCurrentVerb(Pull);
- initVerb();
- setVerbName("Pull");
- setVerbXY(100,184);
- setVerbColor(color);
- setVerbHiColor(hiColor);
- setVerbDimColor(dimColor);
- //setVerbKey('');
-
- setCurrentVerb(invUp);
- initVerb();
- setVerbName("\x03");
- setVerbXY(135,160);
- setVerbColor(color);
- setVerbHiColor(hiColor);
- setVerbDimColor(dimColor);
- //verbCenter();
-
- setCurrentVerb(invDown);
- initVerb();
- setVerbName("\x02");
- setVerbXY(135,182);
- setVerbColor(color);
- setVerbHiColor(hiColor);
- setVerbDimColor(dimColor);
- //verbCenter();
-
-
- for(l = 0,vrb = invSlot0 ; l < 2 ; l++)
- for(c = 0 ; c < 4 ; c++, vrb++) {
- setCurrentVerb(vrb);
- initVerb();
- //verbCenter();
- setVerbXY(160 + c*40,160 + l*20);
- }
- dimInt(invObj,8);
-
- }
-
- // turn on all the verb for the interface
- // and fire the mouse watching thread
- script showVerbs(int show) {
- int* vrb;
- int i;
-
- if(!!show == verbsOn) return;
-
- vrb[0] = [ Give, PickUp, Use, Open,
- LookAt, Push, Close, TalkTo,
- Pull, SntcLine, invUp, invDown ];
-
- for(i = 0 ; i < 12 ; i++) {
- setCurrentVerb(vrb[i]);
- if(show)
- setVerbOn();
- else
- setVerbOff();
- redrawVerb();
- }
- undim(vrb);
-
- for(i = 0 ; i < 8 ; i++) {
- setCurrentVerb(invSlot0+i);
- if(show)
- setVerbOn();
- else
- setVerbOff();
- redrawVerb();
- }
-
- verbsOn = !!show;
-
- }
-
-
- // this script run in the background cheking where the mouse is
- // and update the sentence and set the alt verb
- script mouseWatch() {
- int vrb,obj,target,alt;
-
- // we run forever (well until someone kill us)
- while(1) {
- unless(cursorOn) {
- if(altVerb) {
- setCurrentVerb(altVerb);
- setVerbOn();
- redrawVerb();
- altVerb = 0;
- }
- do breakScript() until(cursorOn);
-
- }
- if(isScriptRunning(VAR_SENTENCE_SCRIPT)) {
- breakScript();
- continue;
- }
-
- // read the current state
-
- // find what verb should be displayed and the
- // object under the pointer
- vrb = 0;
- obj = getActorAt(VAR_VIRT_MOUSE_X,VAR_VIRT_MOUSE_Y);
- if(obj == VAR_EGO)
- obj = 0;
- unless(obj)
- obj = getObjectAt(VAR_VIRT_MOUSE_X,VAR_VIRT_MOUSE_Y);
- unless(obj) {
- obj = getVerbAt(VAR_MOUSE_X,VAR_MOUSE_Y);
- if(obj >= invSlot0 && obj <= invSlot7) {
- obj = findInventory(VAR_EGO,obj-invSlot0+1);
- if(!selVerb || selVerb == PickUp)
- vrb = Use;
- else
- vrb = selVerb;
- } else
- obj = 0;
- }
- unless(vrb)
- vrb = selVerb ? selVerb : WalkTo;
-
- if(sntcPrepo) {
- target = sntcObjB;
- if(obj == sntcObjA) obj = 0;
- } else target = sntcObjA;
-
- //dbgPrint("%i{vrb} <> %i{sntcVerb} | %i{obj} <> %i{target}");
- unless(vrb == sntcVerb && obj == target) {
- sntcVerb = vrb;
- if(sntcPrepo) sntcObjB = obj;
- else sntcObjA = obj;
- setCurrentVerb(SntcLine);
- redrawVerb();
- }
-
-
- if(obj) {
- if(obj <= 0xF)
- alt = TalkTo;
- else if(obj is Openable)
- alt = getObjectState(obj) ? Close : Open;
- else
- alt = LookAt;
- } else
- alt = 0;
-
- if(alt != altVerb) {
- if(altVerb) {
- setCurrentVerb(altVerb);
- setVerbOn();
- redrawVerb();
- }
- if(alt) {
- setCurrentVerb(alt);
- verbDim();
- redrawVerb();
- }
- altVerb = alt;
- }
-
- breakScript();
- }
- }
-
-
- // setup the cursor
- script showCursor() {
-
- if(cursorOn) return;
- /*
- unless(cursorLoaded) {
- cursorLoaded = 1;
- loadFlObject(cursor,ResRoom);
- setCursorImage(cursor,ResRoom);
- setCursorTransparency(31);
- }
- */
- cursorOn();
- userPutOn();
- cursorOn = 1;
- }
-
- script hideCursor() {
- unless(cursorOn) return;
-
- cursorOff();
- userPutOff();
- cursorOn = 0;
- }
-
- script cutsceneStart(int type) {
- dbgPrint("cutscene start");
- hideCursor();
- if(type > 0) {
- // We need to break here to make sure the mouse watch script
- // stop. Otherwise it might turn on the alt verb again,
- breakScript();
- showVerbs(0);
- }
- }
-
- script cutsceneEnd(int type) {
- dbgPrint("cutscene end");
- showCursor();
- if(type > 1)
- showVerbs(1);
- }
-
- script resetSntc(int vrb) {
- sntcObjA = 0;
- if(sntcPrepo) {
- undim(sntcPrepo);
- sntcObjB = 0;
- }
- selVerb = vrb;
- setCurrentVerb(SntcLine);
- redrawVerb();
- }
-
- script defaultAction(int vrb, int objA, int objB) {
- switch(vrb) {
- case WalkTo:
- return;
-
- case PickUp:
- if(objA <= 0xF)
- egoSay("I can't carry him around.");
- else
- egoSay("I can't pick that up.");
- break;
-
- case Use:
- if(objA <= 0xF) {
- if(objB)
- egoSay("I can't use that on someone!");
- else
- egoSay("I can't just *use* someone!");
- } else
- egoSay("I can't use that !");
- break;
-
- case LookAt:
- if(objA <= 0xF)
- egoSay("There is nothing special about him.");
- else
- egoSay("There is nothing special about it.");
- break;
-
- case Push:
- case Pull:
- if(objA <= 0xF)
- egoSay("That wouldn't be very nice.");
- else
- egoSay("I don't feel in shape today.");
- break;
-
- case Open:
- if(objA <= 0xF) {
- egoSay("You know these human bodies aren't very resistant, if i open it he might die.");
- break;
- }
- if(objA is !Openable) {
- egoSay("It's not the kind of thing that can be opened.");
- break;
- }
- if(getObjectState(objA)) {
- egoSay("It's already open.");
- break;
- }
- // some sound would be nice
- setObjectState(objA,1);
- if(getObjectVerbEntrypoint(objA,SetBoxes))
- startObject2(objA,SetBoxes, [ vrb, objA ]);
- break;
-
- case Close:
- if(objA <= 0xF) {
- egoSay("Closing someone ?\wThat hardly make any sense.");
- break;
- }
- if(objA is !Openable) {
- egoSay("I don't think that this can be closed.");
- break;
- }
- unless(getObjectState(objA)) {
- egoSay("It's already closed.");
- break;
- }
- setObjectState(objA,0);
- if(getObjectVerbEntrypoint(objA,SetBoxes))
- startObject2(objA,SetBoxes, [ vrb, objA ]);
- break;
-
- default:
- egoSay("Hmm. No.");
- break;
- }
- waitForMessage();
- }
-
- // the sentence script, doSentence call it
- script sentenceHandler(int vrb, int objA, int objB) {
- int owner,tmp,act;
-
- // click on the sentence line, make it as if the user
- // clicked the currently selected objects
- if(vrb == SntcLine) {
- vrb = sntcVerb;
- objA = sntcObjA;
- objB = sntcObjB;
- }
-
- // look who own the object
- owner = getObjectOwner(objA);
-
- // with use and give we must own it first
- while(isAnyOf(vrb, [ Use, Give ])) {
- unless(objB) {
- if(getObjectVerbEntrypoint(objA,Preposition)) {
- startObject2(objA,Preposition,[ vrb, objA ]);
- if(sntcPrepo) {
- setCurrentVerb(SntcLine);
- redrawVerb();
- return;
- }
- }
- break;
- }
-
- // we must pick it up first
- if(owner != VAR_EGO) {
- if(tryPick == objA) { // pickup failed
- tryPick = 0;
- return;
- }
- // try to pickup then do our action again
- tryPick = objA;
- doSentence(vrb,objA,0,objB);
- doSentence(PickUp,objA,0,0);
- return;
- } else
- tryPick = 0;
- break;
- }
-
- // if the object is in the room walk there
- if(objA <= 0xF || owner == 0xF) {
- walkActorToObj(VAR_EGO,objA,0);
- waitForActor(VAR_EGO);
- // This is needed when walking to an actor
- if(objA <= 0xF)
- actorFace(VAR_EGO,objA);
- } else if(objB) if(objB <= 0xF || getObjectOwner(objB) == 0xF) {
- walkActorToObj(VAR_EGO,objB,0);
- waitForActor(VAR_EGO);
- if(objB <= 0xF)
- actorFace(VAR_EGO,objB);
- }
-
- // switch the objects
- if(objB) {
- dbgPrint("Switch objects");
- tmp = objA;
- objA = objB;
- objB = tmp;
- }
-
- // Take the actorObject if it exist
- if(objA <= 0xF) if(actorObject[objA]) {
- act = objA;
- objA = actorObject[objA];
- }
-
- // if the object implement the verb call that
- if(getObjectVerbEntrypoint(objA,vrb)) {
- startObject(2,objA,vrb,[ vrb, objA, objB ]);
- // if the verb locked the cursor wait until its unlocked
- do breakScript() until(cursorOn);
- } else {
- //otherwise use our default:
- defaultAction(vrb, act ? act : objA, objB);
-
- }
- // if the verb need objB we are done for now
- if(sntcPrepo && !objB) return;
-
- // all done, reset the sentence
- resetSntc(0);
- }
-
- script keyboardHandler(int key) {
- switch(key) {
- case 'o':
- egoSay("Hooo");
- break;
- case 'r':
- egoSay("Let's restart.");
- waitForMessage();
- restartGame();
- break;
- case 'q':
- shutdown();
- break;
- }
- }
-
- // This script receive the keyboard and mouse events
- script inputHandler(int area,int cmd, int btn) {
- int vrb,obj,objB,x;
-
- dbgPrintBegin();
- dbgPrint("Area=%i{area} cmd=%i{cmd} button=%i{btn}");
- dbgPrintEnd();
-
- egoPrintBegin();
- egoPrintOverhead();
- actorPrintEnd();
-
- if(area == 4) { // area 4 is the keyboard
- keyboardHandler(cmd);
- return;
- }
-
- // A verb was clicked
- if(isAnyOf(cmd, [ Give, PickUp, Use,
- Open, LookAt, Push,
- Close, TalkTo, Pull ])) {
- resetSntc(cmd);
- return;
- }
-
- // now are left: room click and inventory
- // stop any currently running sentence
- stopSentence();
- // (re)start the mouse script, giving it a chance to update
- // the sentence.
- // Note that it's a non recursive call hence it will kill the script
- // then start it again.
- mouseWatch();
-
- // button 2 was cliked but not on an object: cancel
- if(btn == 2) unless(sntcPrepo ? sntcObjB : sntcObjA) {
- // stop walking
- setCurrentActor(VAR_EGO);
- setActorStanding();
- resetSntc(0);
- return;
- }
-
- // an object was cliked
- if(sntcPrepo ? sntcObjB : sntcObjA) {
- // an inventory object was cliked
- // select the verb that is displayed
- // We need this to keep Use when PickUp
- // was originaly selected
- if(cmd) selVerb = sntcVerb;
- // button 2: select the alternat verb
- if(btn == 2 && altVerb) {
- selVerb = altVerb;
- mouseWatch();
- }
- // queue the sentence
- doSentence(sntcVerb,sntcObjA,0,sntcObjB);
- return;
- }
- // click on nothing, ignore non room clicks
- if(area != 2) return;
-
- // reset the sentence so we get WalkTo again
- if(selVerb) resetSntc(0);
-
- // then go there
- walkActorTo(VAR_EGO,VAR_VIRT_MOUSE_X,VAR_VIRT_MOUSE_Y);
- }
-
- script setInventoryIcon(int icon, int slot) {
- setCurrentVerb(slot);
- setVerbObject(icon,ResRoom);
- redrawVerb();
- }
-
- script inventoryHandler(int obj) {
- int i, count;
- //unless(obj) return;
-
- count = getInventoryCount(hero);
-
- dbgPrint("%i{count} obj in inv");
-
-
- for(i = 0 ; i < 8 ; i++) {
- if(i < count) {
- obj = findInventory(hero,i+1);
- startObject2(obj,Icon, [ setInventoryIcon, invSlot0+i ]);
- } else {
- setCurrentVerb(invSlot0+i);
- setVerbNameString(0);
- redrawVerb();
- }
- }
-
- }
-
- //
- // Dialogs stuff
- //
-
- // Reset the dialog list
- script dialogClear(int kill) {
- int i;
- if(dialogList) {
- if(kill) {
- for(i = 0 ; i < numDialog ; i++)
- undim(dialogList[i]);
- }
- undim(dialogList);
- dialogList = 0;
- }
- numDialog = numActiveDialog = 0;
- }
-
- // Add an entry to the dialog list
- script dialogAdd(char* str) {
- if(numDialog >= MAX_DIALOG_SENTENCE) {
- dbgPrint("Too many sentences, can't add another one.");
- return;
- }
- unless(dialogList)
- dimInt(dialogList,MAX_DIALOG_SENTENCE);
- dialogList[numDialog] = str;
- numDialog++;
- if(str) numActiveDialog++;
- }
-
- // Remove an entry, if kill is not zero undim the string too
- script dialogRemove(int idx, int kill) {
- int i;
- if(idx < 0 || idx >= numDialog) {
- dbgPrint("Dialog index out of range: %i{idx}, can't remove.");
- return;
- }
- if(dialogList[idx]) {
- numActiveDialog--;
- // Remove the string from the array
- if(kill)
- undim(dialogList[idx]);
- dialogList[idx] = 0;
- }
- // shift the res
- for(i = idx+1 ; i < numDialog ; i++)
- dialogList[i-1] = dialogList[i];
- numDialog--;
- }
-
- script showDialog() {
- int i,v,d,first,last,firstSentence,lastSentence;
-
- first = last = -1;
- firstSentence = lastSentence = -1;
- // switch the charset
- initCharset(dialogCharset);
- // Dialog lines
- v = 0;
- for(i = 0 ; i < numDialog ; i++) {
- unless(dialogList[i]) continue;
- if(firstSentence < 0) firstSentence = i;
- lastSentence = i;
- if(v < dialogOffset || v >= dialogOffset+MAX_DIALOG_LINES) {
- v++;
- continue;
- }
- if(first < 0) first = i;
- last = i;
- setCurrentVerb(dialogVerb0 + d);
- initVerb();
- setVerbNameString(dialogList[i]);
- setVerbXY(12,145+11*d);
- setVerbColor(dialogColor);
- setVerbHiColor(dialogHiColor);
- setVerbOn();
- redrawVerb();
- v++, d++;
- }
- for( ; d < MAX_DIALOG_LINES ; d++) {
- setCurrentVerb(dialogVerb0 + d);
- setVerbOff();
- redrawVerb();
- }
- dbgPrint("Sentence: %i{firstSentence} %i{lastSentence}");
- dbgPrint("Shown: %i{first} %i{last}");
-
- // Up arrow
- setCurrentVerb(dialogUp);
- if(first > firstSentence) {
- initVerb();
- setVerbName("\x03");
- setVerbXY(2,145);
- setVerbColor(dialogColor);
- setVerbHiColor(dialogHiColor);
- setVerbOn();
- redrawVerb();
- } else {
- setVerbOff();
- redrawVerb();
- }
- // Down arrow
- setCurrentVerb(dialogDown);
- if(last < lastSentence) {
- initVerb();
- setVerbName("\x02");
- setVerbXY(2,145+4*11);
- setVerbColor(dialogColor);
- setVerbHiColor(dialogHiColor);
- setVerbOn();
- redrawVerb();
- } else {
- setVerbOff();
- redrawVerb();
- }
-
- initCharset(chtest);
-
- }
-
- script dialogInputHandler(int area,int cmd, int btn) {
- int i,v,d;
-
- dbgPrintBegin();
- dbgPrint("Area=%i{area} cmd=%i{cmd} button=%i{btn}");
- dbgPrintEnd();
-
- egoPrintBegin();
- egoPrintOverhead();
- actorPrintEnd();
-
- if(area == 4) { // area 4 is the keyboard
- keyboardHandler(cmd);
- return;
- }
-
- if(cmd == dialogUp || cmd == dialogDown) {
- dialogOffset += (cmd == dialogUp ? -1 : 1)*MAX_DIALOG_LINES/2;
- if(dialogOffset > numActiveDialog-MAX_DIALOG_LINES)
- dialogOffset = numActiveDialog-MAX_DIALOG_LINES;
- if(dialogOffset < 0) dialogOffset = 0;
- dbgPrint("Dialog offset: %i{dialogOffset}");
- showDialog();
- return;
- }
-
- if(cmd < dialogVerb0 || cmd > dialogVerb4)
- return;
-
- // Find the selected sentence
- for(i = 0 ; i < numDialog ; i++) {
- unless(dialogList[i]) continue;
- if(v < dialogOffset || v >= dialogOffset+MAX_DIALOG_LINES) {
- v++;
- continue;
- }
- if(d == cmd-dialogVerb0) break;
- v++, d++;
- }
-
- selectedSentence = i;
- }
-
- // Start a dialog
- script dialogStart(int color, int hiColor) {
- int i;
- selectedSentence = -1;
- dialogOffset = 0;
- if(numDialog < 1) {
- dbgPrint("No dialog was setup, nothing to show.");
- selectedSentence = -2;
- return;
- }
- // Hide the normal verbs/inventory
- showVerbs(0);
- // Show our stuff
- // setup the verbs
- dialogColor = color ? color : VERB_COLOR;
- dialogHiColor = hiColor ? hiColor : VERB_HI_COLOR;
- showDialog();
- // Kill the mouseWatch
- if(isScriptRunning(mouseWatch))
- stopScript(mouseWatch);
- // Set the dialog input handler
- VAR_VERB_SCRIPT = dialogInputHandler;
- }
-
- script dialogHide() {
- int i;
- for(i = 0 ; i < MAX_DIALOG_LINES ; i++) {
- setCurrentVerb(dialogVerb0 + i);
- setVerbOff();
- redrawVerb();
- }
- setCurrentVerb(dialogUp);
- setVerbOff();
- redrawVerb();
- setCurrentVerb(dialogDown);
- setVerbOff();
- redrawVerb();
- }
-
- script dialogEnd() {
- dialogHide();
- showVerbs(1);
- VAR_VERB_SCRIPT = inputHandler;
- // Restart the mouse watching thread
- mouseWatch();
- }
-
- // The main script is the first thing started by the engine.
- // At that point no room is loaded yet.
- script main (int bootParam) {
- int i,j;
-
- //trace(1,"main");
- // First setup the engine a bit
- // set the F5 key for the main menu
- VAR_MAINMENU_KEY = 319;
- // set the . key to skip text
- VAR_TALKSTOP_KEY = 46;
- // set F8 as the restart key
- VAR_RESTART_KEY = 322;
- // pause key can also be defined in that way instead of
- // doing it in the key handler as we did.
- VAR_PAUSE_KEY = ' ';
- // skip a cutscene
- VAR_CUTSCENEEXIT_KEY = 27;
-
- VAR_GAME_VERSION = 0;
- VAR_GUI_COLORS[0] = [ 0x00, 0x00, 0x43, 0x00, 0xD7, 0x34, 0x52, 0x90, 0x00, 0x6A,
- 0x06, 0x1A, 0xD5, 0xE5, 0xE3, 0xE5, 0xE3, 0xE5, 0xE3, 0xE5,
- 0xE3, 0x00, 0x00, 0x00, 0x00, 0x14, 0xD7, 0xE5, 0xE3, 0xE5,
- 0xE3, 0x37, 0x1C, 0xE5, 0xE3, 0xE5, 0xE3, 0x14, 0xD7, 0xE5,
- 0xE3, 0xE5, 0xE3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ];
- // 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6 ];
-
-
-
- VAR_DEBUG_PASSWORD[0] = "";
- //VAR_DEBUG_PASSWORD[0] = "pass";
- //for(i = 0 ; VAR_DEBUG_PASSWORD[i] != 0 ; i++)
- // VAR_DEBUG_PASSWORD[i] = VAR_DEBUG_PASSWORD[i] - 'c';
-
-
- // setup the GUI
- VAR_PAUSE_MSG[0] = "ScummC Paused !";
- VAR_QUIT_MSG[0] = "Are you sure you want to quit ? (Y/N)Y";
- VAR_RESTART_MSG[0] = "Are you sure you want to restart ? (Y/N)Y";
-
- VAR_SAVE_BTN[0] = "Save it";
- VAR_LOAD_BTN[0] = "Load it";
- VAR_PLAY_BTN[0] = "Continue";
- VAR_CANCEL_BTN[0] = "Cancel";
- VAR_QUIT_BTN[0] = "Quit";
- VAR_OK_BTN[0] = "Ok";
-
- VAR_SAVE_MSG[0] = "Saveing '%%s'";
- VAR_LOAD_MSG[0] = "Loading '%%s'";
-
- VAR_MAIN_MENU_TITLE[0] = "ScummC test Menu";
- VAR_SAVE_MENU_TITLE[0] = "Save game";
- VAR_LOAD_MENU_TITLE[0] = "Load game";
-
- VAR_NOT_SAVED_MSG[0] = "Game NOT saved";
- VAR_NOT_LOADED_MSG[0] = "Game NOT loaded";
-
- VAR_GAME_DISK_MSG[0] = "Insert disk %%c";
- VAR_ENTER_NAME_MSG[0] = "You must enter a name";
- VAR_SAVE_DISK_MSG[0] = "Insert your save disk";
-
- VAR_OPEN_FAILED_MSG[0] = "Failed to open %%s (%%c%%d)";
- VAR_READ_ERROR_MSG[0] = "Read error on disk %%c (%%c%%d)";
-
- // set the main loop speed
- VAR_TIMER_NEXT = 2;
-
- // set the input handler
- VAR_VERB_SCRIPT = inputHandler;
- VAR_SENTENCE_SCRIPT = sentenceHandler;
- VAR_INVENTORY_SCRIPT = inventoryHandler;
- VAR_CUTSCENE_START_SCRIPT = cutsceneStart;
- VAR_CUTSCENE_END_SCRIPT = cutsceneEnd;
-
- // keep this room in memory even if we leave it,
- // as it contain the charset, costume, etc
- // it's probably not very useful atm bcs we only have one
- // room, but well :)
- loadRoom(ResRoom);
- lockRoom(ResRoom);
-
- loadCostume(egoCost);
- lockCostume(egoCost);
-
- loadRoom(Road);
- lockRoom(Road);
-
- // Initialize the graphic mode.
- // It need to match the room image height otherwise
- // the graphics are going wacky
- setScreen(0,144);
- //setScreen(44,188);
-
- // Create the actor -> obj link
- dimInt(actorObject,0x10);
-
- // init the charset
- //initCharset(chset1);
- initCharset(chtest);
-
-
- setupActors();
- setupVerbs();
-
- mouseWatch();
-
- // do the box effect
- screenEffect(0x0005);
- // start the room
- startRoom(Road);
- }
-
- }
-