aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjörn Andersson2003-09-21 16:11:26 +0000
committerTorbjörn Andersson2003-09-21 16:11:26 +0000
commit3c7c60196f149c36c105db1d6a739f234c9b1f9b (patch)
treecf92e73e7f4ad8050e9a8c9a3c7c76f0edbb7de3
parent14813704ae5352e0902e7b3d73a9c75d19587800 (diff)
downloadscummvm-rg350-3c7c60196f149c36c105db1d6a739f234c9b1f9b.tar.gz
scummvm-rg350-3c7c60196f149c36c105db1d6a739f234c9b1f9b.tar.bz2
scummvm-rg350-3c7c60196f149c36c105db1d6a739f234c9b1f9b.zip
ScummVM code formatting conventions
svn-id: r10350
-rw-r--r--sword2/build_display.cpp123
-rw-r--r--sword2/controls.cpp144
-rw-r--r--sword2/function.cpp61
-rw-r--r--sword2/interpreter.cpp712
-rw-r--r--sword2/maketext.cpp124
-rw-r--r--sword2/mem_view.cpp53
-rw-r--r--sword2/mouse.cpp243
-rw-r--r--sword2/resman.cpp386
-rw-r--r--sword2/save_rest.cpp34
-rw-r--r--sword2/sound.cpp68
-rw-r--r--sword2/speech.cpp485
11 files changed, 1145 insertions, 1288 deletions
diff --git a/sword2/build_display.cpp b/sword2/build_display.cpp
index 770c7d5c5d..38a1c3ebd6 100644
--- a/sword2/build_display.cpp
+++ b/sword2/build_display.cpp
@@ -603,18 +603,18 @@ void Process_image(buildit *build_unit) { // (5nov96 JEL)
} else {
// what compression was used?
switch (anim_head->runTimeComp) {
- case NONE:
- spriteType += RDSPR_NOCOMPRESSION;
- break;
- case RLE256:
- spriteType += RDSPR_RLE256;
- break;
- case RLE16:
- spriteType += RDSPR_RLE16;
- // points to just after last cdt_entry, ie.
- // start of colour table
- colTablePtr = (uint8*) (anim_head + 1) + anim_head->noAnimFrames * sizeof(_cdtEntry);
- break;
+ case NONE:
+ spriteType += RDSPR_NOCOMPRESSION;
+ break;
+ case RLE256:
+ spriteType += RDSPR_RLE256;
+ break;
+ case RLE16:
+ spriteType += RDSPR_RLE16;
+ // points to just after last cdt_entry, ie.
+ // start of colour table
+ colTablePtr = (uint8*) (anim_head + 1) + anim_head->noAnimFrames * sizeof(_cdtEntry);
+ break;
}
}
@@ -894,80 +894,73 @@ int32 FN_register_frame(int32 *params) { // (27nov96 JEL)
// check low word for sprite type
switch (ob_graph->type & 0x0000ffff) {
- case BGP0_SPRITE:
+ case BGP0_SPRITE:
#ifdef _SWORD2_DEBUG
- if (cur_bgp0 == MAX_bgp0_sprites)
- Con_fatal_error("ERROR: bgp0_list full in FN_register_frame [line=%d file=%s]",__LINE__,__FILE__);
+ if (cur_bgp0 == MAX_bgp0_sprites)
+ Con_fatal_error("ERROR: bgp0_list full in FN_register_frame [line=%d file=%s]", __LINE__, __FILE__);
#endif
- Register_frame(params, &bgp0_list[cur_bgp0]);
- cur_bgp0++;
- break;
-
- case BGP1_SPRITE:
+ Register_frame(params, &bgp0_list[cur_bgp0]);
+ cur_bgp0++;
+ break;
+ case BGP1_SPRITE:
#ifdef _SWORD2_DEBUG
- if (cur_bgp1 == MAX_bgp1_sprites)
- Con_fatal_error("ERROR: bgp1_list full in FN_register_frame [line=%d file=%s]",__LINE__,__FILE__);
+ if (cur_bgp1 == MAX_bgp1_sprites)
+ Con_fatal_error("ERROR: bgp1_list full in FN_register_frame [line=%d file=%s]", __LINE__, __FILE__);
#endif
- Register_frame(params, &bgp1_list[cur_bgp1]);
- cur_bgp1++;
- break;
-
- case BACK_SPRITE:
+ Register_frame(params, &bgp1_list[cur_bgp1]);
+ cur_bgp1++;
+ break;
+ case BACK_SPRITE:
#ifdef _SWORD2_DEBUG
- if (cur_back == MAX_back_sprites)
- Con_fatal_error("ERROR: back_list full in FN_register_frame [line=%d file=%s]",__LINE__,__FILE__);
+ if (cur_back == MAX_back_sprites)
+ Con_fatal_error("ERROR: back_list full in FN_register_frame [line=%d file=%s]", __LINE__, __FILE__);
#endif
- Register_frame(params, &back_list[cur_back]);
- cur_back++;
- break;
-
- case SORT_SPRITE:
+ Register_frame(params, &back_list[cur_back]);
+ cur_back++;
+ break;
+ case SORT_SPRITE:
#ifdef _SWORD2_DEBUG
- if (cur_sort == MAX_sort_sprites)
- Con_fatal_error("ERROR: sort_list full in FN_register_frame [line=%d file=%s]",__LINE__,__FILE__);
+ if (cur_sort == MAX_sort_sprites)
+ Con_fatal_error("ERROR: sort_list full in FN_register_frame [line=%d file=%s]", __LINE__, __FILE__);
#endif
- sort_order[cur_sort] = cur_sort;
- Register_frame(params, &sort_list[cur_sort]);
- cur_sort++;
- break;
-
- case FORE_SPRITE:
+ sort_order[cur_sort] = cur_sort;
+ Register_frame(params, &sort_list[cur_sort]);
+ cur_sort++;
+ break;
+ case FORE_SPRITE:
#ifdef _SWORD2_DEBUG
- if (cur_fore == MAX_fore_sprites)
- Con_fatal_error("ERROR: fore_list full in FN_register_frame [line=%d file=%s]",__LINE__,__FILE__);
+ if (cur_fore == MAX_fore_sprites)
+ Con_fatal_error("ERROR: fore_list full in FN_register_frame [line=%d file=%s]", __LINE__, __FILE__);
#endif
- Register_frame(params, &fore_list[cur_fore]);
- cur_fore++;
- break;
-
- case FGP0_SPRITE:
+ Register_frame(params, &fore_list[cur_fore]);
+ cur_fore++;
+ break;
+ case FGP0_SPRITE:
#ifdef _SWORD2_DEBUG
- if (cur_fgp0 == MAX_fgp0_sprites)
- Con_fatal_error("ERROR: fgp0_list full in FN_register_frame [line=%d file=%s]",__LINE__,__FILE__);
+ if (cur_fgp0 == MAX_fgp0_sprites)
+ Con_fatal_error("ERROR: fgp0_list full in FN_register_frame [line=%d file=%s]", __LINE__, __FILE__);
#endif
- Register_frame(params, &fgp0_list[cur_fgp0]);
- cur_fgp0++;
- break;
-
- case FGP1_SPRITE:
+ Register_frame(params, &fgp0_list[cur_fgp0]);
+ cur_fgp0++;
+ break;
+ case FGP1_SPRITE:
#ifdef _SWORD2_DEBUG
- if (cur_fgp1 == MAX_fgp1_sprites)
- Con_fatal_error("ERROR: fgp1_list full in FN_register_frame [line=%d file=%s]",__LINE__,__FILE__);
+ if (cur_fgp1 == MAX_fgp1_sprites)
+ Con_fatal_error("ERROR: fgp1_list full in FN_register_frame [line=%d file=%s]", __LINE__, __FILE__);
#endif
- Register_frame(params, &fgp1_list[cur_fgp1]);
- cur_fgp1++;
- break;
-
- default:
- // NO_SPRITE no registering!
- break;
+ Register_frame(params, &fgp1_list[cur_fgp1]);
+ cur_fgp1++;
+ break;
+ default:
+ // NO_SPRITE no registering!
+ break;
}
return IR_CONT;
diff --git a/sword2/controls.cpp b/sword2/controls.cpp
index 5730736fda..227eca7ee2 100644
--- a/sword2/controls.cpp
+++ b/sword2/controls.cpp
@@ -134,12 +134,12 @@ void Sword2FontRenderer::drawText(char *text, int x, int y, int alignment) {
int textWidth = getTextWidth(text);
switch (alignment) {
- case kAlignRight:
- x -= textWidth;
- break;
- case kAlignCenter:
- x -= (textWidth / 2);
- break;
+ case kAlignRight:
+ x -= textWidth;
+ break;
+ case kAlignCenter:
+ x -= (textWidth / 2);
+ break;
}
}
@@ -272,19 +272,19 @@ void Sword2Widget::createSurfaceImage(int state, uint32 res, int x, int y, uint3
// Which compression was used?
switch (anim_head->runTimeComp) {
- case NONE:
- spriteType |= RDSPR_NOCOMPRESSION;
- break;
- case RLE256:
- spriteType |= RDSPR_RLE256;
- break;
- case RLE16:
- spriteType |= RDSPR_RLE256;
- // Points to just after last cdt_entry, i.e. start of
- // colour table
- colTablePtr = (uint8 *) (anim_head + 1) +
- anim_head->noAnimFrames * sizeof(_cdtEntry);
- break;
+ case NONE:
+ spriteType |= RDSPR_NOCOMPRESSION;
+ break;
+ case RLE256:
+ spriteType |= RDSPR_RLE256;
+ break;
+ case RLE16:
+ spriteType |= RDSPR_RLE256;
+ // Points to just after last cdt_entry, i.e. start of colour
+ // table
+ colTablePtr = (uint8 *) (anim_head + 1) +
+ anim_head->noAnimFrames * sizeof(_cdtEntry);
+ break;
}
_sprites[state].x = x;
@@ -400,21 +400,19 @@ int Sword2Dialog::run() {
if (me) {
switch (me->buttons) {
- case RD_LEFTBUTTONDOWN:
- if (newHit)
- _widgets[i]->onMouseDown(newMouseX, newMouseY);
- break;
-
- case RD_LEFTBUTTONUP:
- if (newHit)
- _widgets[i]->onMouseUp(newMouseX, newMouseY);
- // So that slider widgets will
- // know when the user releases
- // the mouse button, even if
- // the cursor is outside of the
- // slider's hit area.
- _widgets[i]->releaseMouse(newMouseX, newMouseY);
- break;
+ case RD_LEFTBUTTONDOWN:
+ if (newHit)
+ _widgets[i]->onMouseDown(newMouseX, newMouseY);
+ break;
+ case RD_LEFTBUTTONUP:
+ if (newHit)
+ _widgets[i]->onMouseUp(newMouseX, newMouseY);
+ // So that slider widgets will know
+ // when the user releases the mouse
+ // button, even if the cursor is
+ // outside of the slider's hit area.
+ _widgets[i]->releaseMouse(newMouseX, newMouseY);
+ break;
}
}
@@ -1261,13 +1259,12 @@ public:
uint32 textId;
switch (rv) {
- case SR_ERR_FILEOPEN:
- textId = 213516674;
- break;
-
- default: // SR_ERR_WRITEFAIL
- textId = 213516676;
- break;
+ case SR_ERR_FILEOPEN:
+ textId = 213516674;
+ break;
+ default: // SR_ERR_WRITEFAIL
+ textId = 213516676;
+ break;
}
Control_error((char*) (FetchTextLine(res_man.Res_open(textId / SIZE), textId & 0xffff) + 2));
@@ -1280,17 +1277,15 @@ public:
uint32 textId;
switch (rv) {
- case SR_ERR_FILEOPEN:
- textId = 213516670;
- break;
-
- case SR_ERR_INCOMPATIBLE:
- textId = 213516671;
- break;
-
- default: // SR_ERR_READFAIL
- textId = 213516673;
- break;
+ case SR_ERR_FILEOPEN:
+ textId = 213516670;
+ break;
+ case SR_ERR_INCOMPATIBLE:
+ textId = 213516671;
+ break;
+ default: // SR_ERR_READFAIL
+ textId = 213516673;
+ break;
}
Control_error((char *) (FetchTextLine(res_man.Res_open(textId / SIZE), textId & 0xffff) + 2));
@@ -1529,26 +1524,31 @@ void Option_control(void) { //Pete6Jun97
void UpdateGraphicsLevel(uint8 newLevel) { // (James13jun97)
switch (newLevel) {
- case 0: // Lowest setting: no graphics fx
- ClearTransFx();
- ClearShadowFx();
- ClearBltFx();
- break;
- case 1: // Medium-low setting: transparency-blending
- SetTransFx();
- ClearShadowFx();
- ClearBltFx();
- break;
- case 2: // Medium-high setting: transparency-blending + shading
- SetTransFx();
- SetShadowFx();
- ClearBltFx();
- break;
- case 3: // Highest setting: transparency-blending + shading + edge-blending + improved stretching
- SetTransFx();
- SetShadowFx();
- SetBltFx();
- break;
+ case 0:
+ // Lowest setting: no graphics fx
+ ClearTransFx();
+ ClearShadowFx();
+ ClearBltFx();
+ break;
+ case 1:
+ // Medium-low setting: transparency-blending
+ SetTransFx();
+ ClearShadowFx();
+ ClearBltFx();
+ break;
+ case 2:
+ // Medium-high setting: transparency-blending + shading
+ SetTransFx();
+ SetShadowFx();
+ ClearBltFx();
+ break;
+ case 3:
+ // Highest setting: transparency-blending + shading +
+ // edge-blending + improved stretching
+ SetTransFx();
+ SetShadowFx();
+ SetBltFx();
+ break;
}
// update our global variable - which needs to be checked when dimming
diff --git a/sword2/function.cpp b/sword2/function.cpp
index 306e7a825e..889140039d 100644
--- a/sword2/function.cpp
+++ b/sword2/function.cpp
@@ -263,21 +263,18 @@ int32 FN_flash(int32 *params) { // (James14feb97)
#ifdef _SWORD2_DEBUG
// what colour?
switch (params[0]) {
- case WHITE:
- BS2_SetPalette(0, 1, white, RDPAL_INSTANT);
- break;
-
- case RED:
- BS2_SetPalette(0, 1, red, RDPAL_INSTANT);
- break;
-
- case GREEN:
- BS2_SetPalette(0, 1, green, RDPAL_INSTANT);
- break;
-
- case BLUE:
- BS2_SetPalette(0, 1, blue, RDPAL_INSTANT);
- break;
+ case WHITE:
+ BS2_SetPalette(0, 1, white, RDPAL_INSTANT);
+ break;
+ case RED:
+ BS2_SetPalette(0, 1, red, RDPAL_INSTANT);
+ break;
+ case GREEN:
+ BS2_SetPalette(0, 1, green, RDPAL_INSTANT);
+ break;
+ case BLUE:
+ BS2_SetPalette(0, 1, blue, RDPAL_INSTANT);
+ break;
}
// There used to be a busy-wait loop here, so I don't know how long
@@ -302,25 +299,21 @@ int32 FN_colour(int32 *params) { // (James14feb97)
#ifdef _SWORD2_DEBUG
// what colour?
switch (params[0]) {
- case BLACK:
- BS2_SetPalette(0, 1, black, RDPAL_INSTANT);
- break;
-
- case WHITE:
- BS2_SetPalette(0, 1, white, RDPAL_INSTANT);
- break;
-
- case RED:
- BS2_SetPalette(0, 1, red, RDPAL_INSTANT);
- break;
-
- case GREEN:
- BS2_SetPalette(0, 1, green, RDPAL_INSTANT);
- break;
-
- case BLUE:
- BS2_SetPalette(0, 1, blue, RDPAL_INSTANT);
- break;
+ case BLACK:
+ BS2_SetPalette(0, 1, black, RDPAL_INSTANT);
+ break;
+ case WHITE:
+ BS2_SetPalette(0, 1, white, RDPAL_INSTANT);
+ break;
+ case RED:
+ BS2_SetPalette(0, 1, red, RDPAL_INSTANT);
+ break;
+ case GREEN:
+ BS2_SetPalette(0, 1, green, RDPAL_INSTANT);
+ break;
+ case BLUE:
+ BS2_SetPalette(0, 1, blue, RDPAL_INSTANT);
+ break;
}
#endif
diff --git a/sword2/interpreter.cpp b/sword2/interpreter.cpp
index 4066f38eff..5100296be9 100644
--- a/sword2/interpreter.cpp
+++ b/sword2/interpreter.cpp
@@ -365,390 +365,346 @@ int RunScript(char *scriptData, char *objectData, uint32 *offset) {
while (runningScript) {
curCommand = code[ip++];
- switch(curCommand) {
- case CP_END_SCRIPT:
- // End the script
- DEBUG("End script",0);
- runningScript = 0;
- break;
-
- case CP_PUSH_LOCAL_VAR32:
- // Push the contents of a local variable
- Read16ip(parameter);
- DEBUG("Push local var %d (%d)", parameter, *(int32 *) (variables + parameter));
- PUSHONSTACK(*(int32 *) (variables + parameter));
- break;
-
- case CP_PUSH_GLOBAL_VAR32:
- // Push a global variable
- Read16ip(parameter);
- DEBUG("Push global var %d (%d)", parameter, globalInterpreterVariables2[parameter]);
- ASSERT(globalInterpreterVariables2);
- PUSHONSTACK(globalInterpreterVariables2[parameter]);
- break;
-
- case CP_POP_LOCAL_VAR32:
- // Pop a value into a local word variable
- Read16ip(parameter);
- POPOFFSTACK(value);
- DEBUG("Pop %d into var %d", value, parameter);
- *((int32 *) (variables + parameter)) = value;
- break;
-
- case CP_CALL_MCODE:
- // Call an mcode routine
- Read16ip(parameter);
- ASSERT(parameter <= MAX_FN_NUMBER);
- // amount to adjust stack by (no of parameters)
- Read8ip(value);
- DEBUG("Call mcode %d with stack = %x", parameter, stack2 + stackPointer2 - value);
- retVal = McodeTable[parameter](stack2 + stackPointer2 - value);
- stackPointer2 -= value;
- CHECKSTACKPOINTER2
-
- switch (retVal & 7) {
- case IR_STOP:
- // Quit out for a cycle
- *offset = ip;
- return 0;
-
- case IR_CONT:
- // Continue as normal
- break;
-
- case IR_TERMINATE:
- // Return without updating the
- // offset
- return 2;
-
- case IR_REPEAT:
- // Return setting offset to
- // start of this function call
- *offset = savedStartOfMcode;
- return 0;
-
- case IR_GOSUB:
- // that's really neat
- *offset = ip;
- return 2;
-
- default:
- ASSERT(FALSE);
- }
- parameterReturnedFromMcodeFunction = retVal >> 3;
- break;
-
- case CP_PUSH_LOCAL_ADDR:
- // push the address of a local variable
- Read16ip(parameter);
- DEBUG("Push address of local variable %d (%x)", parameter, (int32) (variables + parameter));
- PUSHONSTACK((int32) (variables + parameter));
- break;
-
- case CP_PUSH_INT32:
- // Push a long word value on to the stack
- Read32ip(parameter);
- DEBUG("Push int32 %d (%x)", parameter, parameter);
- PUSHONSTACK(parameter);
- break;
-
- case CP_SKIPONFALSE:
- // Skip if the value on the stack is false
- Read32ipLeaveip(parameter);
- POPOFFSTACK(value);
- DEBUG("Skip %d if %d is false", parameter, value);
- if (value)
- ip += sizeof(int32);
- else
- ip += parameter;
- break;
-
- case CP_SKIPALWAYS:
- // skip a block
- Read32ipLeaveip(parameter);
- DEBUG("Skip %d", parameter);
- ip += parameter;
- break;
-
- case CP_SWITCH:
- // 9 switch
- POPOFFSTACK(value);
- Read32ip(caseCount);
-
- // Search the cases
- foundCase = 0;
- for (count = 0; count < caseCount && !foundCase; count++) {
- if (value == (int32) READ_LE_UINT32(code + ip)) {
- // We have found the case, so
- // lets jump to it
- foundCase = 1;
- ip += READ_LE_UINT32(code + ip + sizeof(int32));
- } else
- ip += sizeof(int32) * 2;
- }
-
- // If we found no matching case then use the
- // default
-
- if (!foundCase)
- ip += READ_LE_UINT32(code + ip);
-
- break;
-
- case CP_ADDNPOP_LOCAL_VAR32:
- Read16ip(parameter);
- POPOFFSTACK(value);
- *((int32 *) (variables + parameter)) += value;
- DEBUG("+= %d into var %d->%d", value, parameter, *(int32 *) (variables + parameter));
- break;
-
- case CP_SUBNPOP_LOCAL_VAR32:
- Read16ip(parameter);
- POPOFFSTACK(value);
- *((int32 *) (variables + parameter)) -= value;
- DEBUG("-= %d into var %d->%d", value, parameter, *(int32 *) (variables + parameter));
- break;
-
- case CP_SKIPONTRUE:
- // Skip if the value on the stack is TRUE
- Read32ipLeaveip(parameter);
- POPOFFSTACK(value);
- DEBUG("Skip %d if %d is false", parameter, value);
- if (!value)
- ip += sizeof(int32);
- else
- ip += parameter;
- break;
-
- case CP_POP_GLOBAL_VAR32:
- // Pop a global variable
- Read16ip(parameter);
- POPOFFSTACK(value);
- DEBUG("Pop %d into global var %d", value, parameter);
-
-#ifdef TRACEGLOBALVARIABLESET
- TRACEGLOBALVARIABLESET(parameter, value);
-#endif
-
- globalInterpreterVariables2[parameter] = value;
- break;
-
- case CP_ADDNPOP_GLOBAL_VAR32:
- // Add and pop a global variable
- Read16ip(parameter);
- // parameter = *((int16_TYPE *) (code + ip));
- // ip += 2;
- POPOFFSTACK(value);
- globalInterpreterVariables2[parameter] += value;
- DEBUG("+= %d into global var %d->%d", value, parameter, *(int32 *) (variables + parameter));
- break;
-
- case CP_SUBNPOP_GLOBAL_VAR32:
- // Sub and pop a global variable
- Read16ip(parameter);
- POPOFFSTACK(value);
- globalInterpreterVariables2[parameter] -= value;
- DEBUG("-= %d into global var %d->%d", value, parameter, *(int32 *) (variables + parameter));
- break;
-
- case CP_DEBUGON:
- // Turn debugging on
- g_debugFlag = 1;
- break;
-
- case CP_DEBUGOFF:
- // Turn debugging on
- g_debugFlag = 0;
- break;
-
- case CP_QUIT:
+ switch (curCommand) {
+ case CP_END_SCRIPT:
+ // End the script
+ DEBUG("End script",0);
+ runningScript = 0;
+ break;
+ case CP_PUSH_LOCAL_VAR32:
+ // Push the contents of a local variable
+ Read16ip(parameter);
+ DEBUG("Push local var %d (%d)", parameter, *(int32 *) (variables + parameter));
+ PUSHONSTACK(*(int32 *) (variables + parameter));
+ break;
+ case CP_PUSH_GLOBAL_VAR32:
+ // Push a global variable
+ Read16ip(parameter);
+ DEBUG("Push global var %d (%d)", parameter, globalInterpreterVariables2[parameter]);
+ ASSERT(globalInterpreterVariables2);
+ PUSHONSTACK(globalInterpreterVariables2[parameter]);
+ break;
+ case CP_POP_LOCAL_VAR32:
+ // Pop a value into a local word variable
+ Read16ip(parameter);
+ POPOFFSTACK(value);
+ DEBUG("Pop %d into var %d", value, parameter);
+ *((int32 *) (variables + parameter)) = value;
+ break;
+ case CP_CALL_MCODE:
+ // Call an mcode routine
+ Read16ip(parameter);
+ ASSERT(parameter <= MAX_FN_NUMBER);
+ // amount to adjust stack by (no of parameters)
+ Read8ip(value);
+ DEBUG("Call mcode %d with stack = %x", parameter, stack2 + stackPointer2 - value);
+ retVal = McodeTable[parameter](stack2 + stackPointer2 - value);
+ stackPointer2 -= value;
+ CHECKSTACKPOINTER2
+
+ switch (retVal & 7) {
+ case IR_STOP:
// Quit out for a cycle
*offset = ip;
return 0;
+ case IR_CONT:
+ // Continue as normal
+ break;
+ case IR_TERMINATE:
+ // Return without updating the
+ // offset
+ return 2;
+ case IR_REPEAT:
+ // Return setting offset to
+ // start of this function call
+ *offset = savedStartOfMcode;
+ return 0;
+ case IR_GOSUB:
+ // that's really neat
+ *offset = ip;
+ return 2;
+ default:
+ ASSERT(FALSE);
+ }
+ parameterReturnedFromMcodeFunction = retVal >> 3;
+ break;
+ case CP_PUSH_LOCAL_ADDR:
+ // push the address of a local variable
+ Read16ip(parameter);
+ DEBUG("Push address of local variable %d (%x)", parameter, (int32) (variables + parameter));
+ PUSHONSTACK((int32) (variables + parameter));
+ break;
+ case CP_PUSH_INT32:
+ // Push a long word value on to the stack
+ Read32ip(parameter);
+ DEBUG("Push int32 %d (%x)", parameter, parameter);
+ PUSHONSTACK(parameter);
+ break;
+ case CP_SKIPONFALSE:
+ // Skip if the value on the stack is false
+ Read32ipLeaveip(parameter);
+ POPOFFSTACK(value);
+ DEBUG("Skip %d if %d is false", parameter, value);
+ if (value)
+ ip += sizeof(int32);
+ else
+ ip += parameter;
+ break;
+ case CP_SKIPALWAYS:
+ // skip a block
+ Read32ipLeaveip(parameter);
+ DEBUG("Skip %d", parameter);
+ ip += parameter;
+ break;
+ case CP_SWITCH:
+ // 9 switch
+ POPOFFSTACK(value);
+ Read32ip(caseCount);
+
+ // Search the cases
+ foundCase = 0;
+ for (count = 0; count < caseCount && !foundCase; count++) {
+ if (value == (int32) READ_LE_UINT32(code + ip)) {
+ // We have found the case, so lets
+ // jump to it
+ foundCase = 1;
+ ip += READ_LE_UINT32(code + ip + sizeof(int32));
+ } else
+ ip += sizeof(int32) * 2;
+ }
+
+ // If we found no matching case then use the
+ // default
+
+ if (!foundCase)
+ ip += READ_LE_UINT32(code + ip);
+
+ break;
+ case CP_ADDNPOP_LOCAL_VAR32:
+ Read16ip(parameter);
+ POPOFFSTACK(value);
+ *((int32 *) (variables + parameter)) += value;
+ DEBUG("+= %d into var %d->%d", value, parameter, *(int32 *) (variables + parameter));
+ break;
+ case CP_SUBNPOP_LOCAL_VAR32:
+ Read16ip(parameter);
+ POPOFFSTACK(value);
+ *((int32 *) (variables + parameter)) -= value;
+ DEBUG("-= %d into var %d->%d", value, parameter, *(int32 *) (variables + parameter));
+ break;
+ case CP_SKIPONTRUE:
+ // Skip if the value on the stack is TRUE
+ Read32ipLeaveip(parameter);
+ POPOFFSTACK(value);
+ DEBUG("Skip %d if %d is false", parameter, value);
+ if (!value)
+ ip += sizeof(int32);
+ else
+ ip += parameter;
+ break;
+ case CP_POP_GLOBAL_VAR32:
+ // Pop a global variable
+ Read16ip(parameter);
+ POPOFFSTACK(value);
+ DEBUG("Pop %d into global var %d", value, parameter);
- case CP_TERMINATE:
- // Quit out immediately without affecting the
- // offset pointer
- return 3;
-
- // Operators
-
- case OP_ISEQUAL:
- // '=='
- DEBUG("%d == %d -> %d",
- stack2[stackPointer2 - 2],
- stack2[stackPointer2 - 1],
- stack2[stackPointer2 - 2] == stack2[stackPointer2 - 1]);
- DOOPERATION (stack2[stackPointer2 - 2] == stack2[stackPointer2 - 1]);
- break;
-
- case OP_PLUS:
- // '+'
- DEBUG("%d + %d -> %d",
- stack2[stackPointer2 - 2],
- stack2[stackPointer2 - 1],
- stack2[stackPointer2 - 2] + stack2[stackPointer2 - 1]);
- DOOPERATION(stack2[stackPointer2 - 2] + stack2[stackPointer2 - 1]);
- break;
-
- case OP_MINUS:
- // '-'
- DEBUG("%d - %d -> %d",
- stack2[stackPointer2 - 2],
- stack2[stackPointer2 - 1],
- stack2[stackPointer2 - 2] - stack2[stackPointer2 - 1]);
- DOOPERATION(stack2[stackPointer2 - 2] - stack2[stackPointer2 - 1]);
- break;
-
- case OP_TIMES:
- // '*'
- DEBUG("%d * %d -> %d",
- stack2[stackPointer2 - 2],
- stack2[stackPointer2 - 1],
- stack2[stackPointer2 - 2] * stack2[stackPointer2 - 1]);
- DOOPERATION(stack2[stackPointer2 - 2] * stack2[stackPointer2 - 1]);
- break;
-
- case OP_DIVIDE:
- // '/'
- DEBUG("%d / %d -> %d",
- stack2[stackPointer2 - 2],
- stack2[stackPointer2 - 1],
- stack2[stackPointer2 - 2] / stack2[stackPointer2 - 1]);
- DOOPERATION(stack2[stackPointer2 - 2] / stack2[stackPointer2 - 1]);
- break;
-
- case OP_NOTEQUAL:
- // '!='
- DEBUG("%d != %d -> %d",
- stack2[stackPointer2 - 2],
- stack2[stackPointer2 - 1],
- stack2[stackPointer2 - 2] != stack2[stackPointer2 - 1]);
- DOOPERATION(stack2[stackPointer2 - 2] != stack2[stackPointer2 - 1]);
- break;
-
- case OP_ANDAND:
- // '&&'
- DEBUG("%d != %d -> %d",
- stack2[stackPointer2 - 2],
- stack2[stackPointer2 - 1],
- stack2[stackPointer2 - 2] && stack2[stackPointer2 - 1]);
- DOOPERATION(stack2[stackPointer2 - 2] && stack2[stackPointer2 - 1]);
- break;
-
- case OP_GTTHAN:
- // '>'
- DEBUG("%d > %d -> %d",
- stack2[stackPointer2 - 2],
- stack2[stackPointer2 - 1],
- stack2[stackPointer2 - 2] > stack2[stackPointer2 - 1]);
- DOOPERATION(stack2[stackPointer2 - 2] > stack2[stackPointer2 - 1]);
- break;
-
- case OP_LSTHAN:
- // '<'
- DEBUG("%d < %d -> %d",
- stack2[stackPointer2 - 2],
- stack2[stackPointer2 - 1],
- stack2[stackPointer2 - 2] < stack2[stackPointer2 - 1]);
- DOOPERATION(stack2[stackPointer2 - 2] < stack2[stackPointer2 - 1]);
- break;
-
- case CP_JUMP_ON_RETURNED:
- // Jump to a part of the script depending on
- // the return value from an mcode routine
-
- // Get the maximum value
- Read8ip(parameter);
-
- ip += READ_LE_UINT32(code + ip + parameterReturnedFromMcodeFunction * 4);
- break;
-
- case CP_TEMP_TEXT_PROCESS:
- // Process a text line
- // This was apparently used in Linc
- Read32ip(parameter);
- DEBUG("Process text id %d", parameter);
- break;
-
- case CP_SAVE_MCODE_START:
- // Save the start position on an mcode
- // instruction in case we need to restart it
- // again
- savedStartOfMcode = ip - 1;
- break;
-
- case CP_RESTART_SCRIPT:
- // Start the script again
- // Do a ip search to find the script we are
- // running
-
- tempScrPtr = scriptData + READ_LE_UINT32(scriptData) + sizeof(int);
- scriptNumber = 0;
- foundScript = 0;
-
- for (count = 1; count < (int) noScripts && !foundScript; count++) {
- if (ip < ((const int *) tempScrPtr)[count + 1]) {
- scriptNumber = count - 1;
- foundScript = 1;
- }
- }
+#ifdef TRACEGLOBALVARIABLESET
+ TRACEGLOBALVARIABLESET(parameter, value);
+#endif
- if (!foundScript)
+ globalInterpreterVariables2[parameter] = value;
+ break;
+ case CP_ADDNPOP_GLOBAL_VAR32:
+ // Add and pop a global variable
+ Read16ip(parameter);
+ // parameter = *((int16_TYPE *) (code + ip));
+ // ip += 2;
+ POPOFFSTACK(value);
+ globalInterpreterVariables2[parameter] += value;
+ DEBUG("+= %d into global var %d->%d", value, parameter, *(int32 *) (variables + parameter));
+ break;
+ case CP_SUBNPOP_GLOBAL_VAR32:
+ // Sub and pop a global variable
+ Read16ip(parameter);
+ POPOFFSTACK(value);
+ globalInterpreterVariables2[parameter] -= value;
+ DEBUG("-= %d into global var %d->%d", value, parameter, *(int32 *) (variables + parameter));
+ break;
+ case CP_DEBUGON:
+ // Turn debugging on
+ g_debugFlag = 1;
+ break;
+ case CP_DEBUGOFF:
+ // Turn debugging on
+ g_debugFlag = 0;
+ break;
+ case CP_QUIT:
+ // Quit out for a cycle
+ *offset = ip;
+ return 0;
+ case CP_TERMINATE:
+ // Quit out immediately without affecting the offset
+ // pointer
+ return 3;
+
+ // Operators
+
+ case OP_ISEQUAL:
+ // '=='
+ DEBUG("%d == %d -> %d",
+ stack2[stackPointer2 - 2],
+ stack2[stackPointer2 - 1],
+ stack2[stackPointer2 - 2] == stack2[stackPointer2 - 1]);
+ DOOPERATION (stack2[stackPointer2 - 2] == stack2[stackPointer2 - 1]);
+ break;
+ case OP_PLUS:
+ // '+'
+ DEBUG("%d + %d -> %d",
+ stack2[stackPointer2 - 2],
+ stack2[stackPointer2 - 1],
+ stack2[stackPointer2 - 2] + stack2[stackPointer2 - 1]);
+ DOOPERATION(stack2[stackPointer2 - 2] + stack2[stackPointer2 - 1]);
+ break;
+ case OP_MINUS:
+ // '-'
+ DEBUG("%d - %d -> %d",
+ stack2[stackPointer2 - 2],
+ stack2[stackPointer2 - 1],
+ stack2[stackPointer2 - 2] - stack2[stackPointer2 - 1]);
+ DOOPERATION(stack2[stackPointer2 - 2] - stack2[stackPointer2 - 1]);
+ break;
+ case OP_TIMES:
+ // '*'
+ DEBUG("%d * %d -> %d",
+ stack2[stackPointer2 - 2],
+ stack2[stackPointer2 - 1],
+ stack2[stackPointer2 - 2] * stack2[stackPointer2 - 1]);
+ DOOPERATION(stack2[stackPointer2 - 2] * stack2[stackPointer2 - 1]);
+ break;
+ case OP_DIVIDE:
+ // '/'
+ DEBUG("%d / %d -> %d",
+ stack2[stackPointer2 - 2],
+ stack2[stackPointer2 - 1],
+ stack2[stackPointer2 - 2] / stack2[stackPointer2 - 1]);
+ DOOPERATION(stack2[stackPointer2 - 2] / stack2[stackPointer2 - 1]);
+ break;
+ case OP_NOTEQUAL:
+ // '!='
+ DEBUG("%d != %d -> %d",
+ stack2[stackPointer2 - 2],
+ stack2[stackPointer2 - 1],
+ stack2[stackPointer2 - 2] != stack2[stackPointer2 - 1]);
+ DOOPERATION(stack2[stackPointer2 - 2] != stack2[stackPointer2 - 1]);
+ break;
+ case OP_ANDAND:
+ // '&&'
+ DEBUG("%d != %d -> %d",
+ stack2[stackPointer2 - 2],
+ stack2[stackPointer2 - 1],
+ stack2[stackPointer2 - 2] && stack2[stackPointer2 - 1]);
+ DOOPERATION(stack2[stackPointer2 - 2] && stack2[stackPointer2 - 1]);
+ break;
+ case OP_GTTHAN:
+ // '>'
+ DEBUG("%d > %d -> %d",
+ stack2[stackPointer2 - 2],
+ stack2[stackPointer2 - 1],
+ stack2[stackPointer2 - 2] > stack2[stackPointer2 - 1]);
+ DOOPERATION(stack2[stackPointer2 - 2] > stack2[stackPointer2 - 1]);
+ break;
+ case OP_LSTHAN:
+ // '<'
+ DEBUG("%d < %d -> %d",
+ stack2[stackPointer2 - 2],
+ stack2[stackPointer2 - 1],
+ stack2[stackPointer2 - 2] < stack2[stackPointer2 - 1]);
+ DOOPERATION(stack2[stackPointer2 - 2] < stack2[stackPointer2 - 1]);
+ break;
+ case CP_JUMP_ON_RETURNED:
+ // Jump to a part of the script depending on
+ // the return value from an mcode routine
+
+ // Get the maximum value
+ Read8ip(parameter);
+ ip += READ_LE_UINT32(code + ip + parameterReturnedFromMcodeFunction * 4);
+ break;
+ case CP_TEMP_TEXT_PROCESS:
+ // Process a text line
+ // This was apparently used in Linc
+ Read32ip(parameter);
+ DEBUG("Process text id %d", parameter);
+ break;
+ case CP_SAVE_MCODE_START:
+ // Save the start position on an mcode instruction in
+ // case we need to restart it again
+ savedStartOfMcode = ip - 1;
+ break;
+ case CP_RESTART_SCRIPT:
+ // Start the script again
+ // Do a ip search to find the script we are running
+
+ tempScrPtr = scriptData + READ_LE_UINT32(scriptData) + sizeof(int);
+ scriptNumber = 0;
+ foundScript = 0;
+
+ for (count = 1; count < (int) noScripts && !foundScript; count++) {
+ if (ip < ((const int *) tempScrPtr)[count + 1]) {
scriptNumber = count - 1;
-
- // So we know what script we are running,
- // lets restart it
-
- ip = ((const int *) tempScrPtr)[scriptNumber + 1];
- break;
-
- case CP_PUSH_STRING:
- // Push the address of a string on to the stack
- // Get the string size
- Read8ip(parameter);
- // ip points to the string
- PUSHONSTACK((int) (code + ip));
- ip += (parameter + 1);
- break;
-
- case CP_PUSH_DEREFERENCED_STRUCTURE:
- // Push the address of a dereferenced structure
- Read32ip(parameter);
- DEBUG("Push address of far variable (%x)", (int32) (variables + parameter));
- PUSHONSTACK((int) (objectData + sizeof(int) + sizeof(_standardHeader) + sizeof(_object_hub) + parameter));
- break;
-
- case OP_GTTHANE:
- // '>='
- DEBUG("%d > %d -> %d",
- stack2[stackPointer2 - 2],
- stack2[stackPointer2 - 1],
- stack2[stackPointer2 - 2] >= stack2[stackPointer2 - 1]);
- DOOPERATION(stack2[stackPointer2 - 2] >= stack2[stackPointer2 - 1]);
- break;
-
- case OP_LSTHANE:
- // '<='
- DEBUG("%d < %d -> %d",
- stack2[stackPointer2 - 2],
- stack2[stackPointer2 - 1],
- stack2[stackPointer2 - 2] <= stack2[stackPointer2 - 1]);
- DOOPERATION(stack2[stackPointer2 - 2] <= stack2[stackPointer2 - 1]);
- break;
-
- case OP_OROR:
- // '||'
- DEBUG("%d || %d -> %d",
- stack2[stackPointer2 - 2],
- stack2[stackPointer2 - 1],
- stack2[stackPointer2 - 2] || stack2[stackPointer2 - 1]);
- DOOPERATION (stack2[stackPointer2 - 2] || stack2[stackPointer2 - 1]);
- break;
-
- default:
- Con_fatal_error("Interpreter error: Invalid token %d", curCommand);
- return 3;
+ foundScript = 1;
+ }
+ }
+
+ if (!foundScript)
+ scriptNumber = count - 1;
+
+ // So we know what script we are running, lets restart
+ // it
+
+ ip = ((const int *) tempScrPtr)[scriptNumber + 1];
+ break;
+ case CP_PUSH_STRING:
+ // Push the address of a string on to the stack
+ // Get the string size
+ Read8ip(parameter);
+
+ // ip points to the string
+ PUSHONSTACK((int) (code + ip));
+ ip += (parameter + 1);
+ break;
+ case CP_PUSH_DEREFERENCED_STRUCTURE:
+ // Push the address of a dereferenced structure
+ Read32ip(parameter);
+ DEBUG("Push address of far variable (%x)", (int32) (variables + parameter));
+ PUSHONSTACK((int) (objectData + sizeof(int) + sizeof(_standardHeader) + sizeof(_object_hub) + parameter));
+ break;
+ case OP_GTTHANE:
+ // '>='
+ DEBUG("%d > %d -> %d",
+ stack2[stackPointer2 - 2],
+ stack2[stackPointer2 - 1],
+ stack2[stackPointer2 - 2] >= stack2[stackPointer2 - 1]);
+ DOOPERATION(stack2[stackPointer2 - 2] >= stack2[stackPointer2 - 1]);
+ break;
+ case OP_LSTHANE:
+ // '<='
+ DEBUG("%d < %d -> %d",
+ stack2[stackPointer2 - 2],
+ stack2[stackPointer2 - 1],
+ stack2[stackPointer2 - 2] <= stack2[stackPointer2 - 1]);
+ DOOPERATION(stack2[stackPointer2 - 2] <= stack2[stackPointer2 - 1]);
+ break;
+ case OP_OROR:
+ // '||'
+ DEBUG("%d || %d -> %d",
+ stack2[stackPointer2 - 2],
+ stack2[stackPointer2 - 1],
+ stack2[stackPointer2 - 2] || stack2[stackPointer2 - 1]);
+ DOOPERATION (stack2[stackPointer2 - 2] || stack2[stackPointer2 - 1]);
+ break;
+ default:
+ Con_fatal_error("Interpreter error: Invalid token %d", curCommand);
+ return 3;
}
}
diff --git a/sword2/maketext.cpp b/sword2/maketext.cpp
index b884726024..c697a15e35 100644
--- a/sword2/maketext.cpp
+++ b/sword2/maketext.cpp
@@ -400,22 +400,20 @@ void CopyChar(_frameHeader *charPtr, uint8 *spritePtr, uint16 spriteWidth, uint8
// if required output pen is non-zero
if (pen) {
- for(cols = 0; cols < charPtr->width; cols++) {
+ for (cols = 0; cols < charPtr->width; cols++) {
// inc source ptr along sprite data
switch (*source++) {
- case LETTER_COL:
- *dest = pen;
- break;
-
- case BORDER_COL:
- // don't do a border pixel if
- // there's already a bit of
- // another character underneath
- // (for overlapping!)
-
- if (!*dest)
- *dest = border_pen;
- break;
+ case LETTER_COL:
+ *dest = pen;
+ break;
+ case BORDER_COL:
+ // don't do a border pixel if there's
+ // already a bit of another character
+ // underneath (for overlapping!)
+
+ if (!*dest)
+ *dest = border_pen;
+ break;
// do nothing if source pixel is zero,
// ie. transparent
@@ -502,43 +500,35 @@ uint32 Build_new_block(uint8 *ascii, int16 x, int16 y, uint16 width, uint8 pen,
frame_head = (_frameHeader *) text_sprite_list[j].text_mem->ad;
switch (justification) {
- // this one is always used for SPEECH TEXT; possibly
- // also for pointer text
- case POSITION_AT_CENTRE_OF_BASE:
- x -= (frame_head->width) / 2;
- y -= frame_head->height;
- break;
-
- case POSITION_AT_CENTRE_OF_TOP:
- x -= (frame_head->width) / 2;
- break;
-
- case POSITION_AT_LEFT_OF_TOP:
- // the given coords are already correct for
- // this!
- break;
-
- case POSITION_AT_RIGHT_OF_TOP:
- x -= frame_head->width;
- break;
-
- case POSITION_AT_LEFT_OF_BASE:
- y -= frame_head->height;
- break;
-
- case POSITION_AT_RIGHT_OF_BASE:
- x -= frame_head->width;
- y -= frame_head->height;
- break;
-
- case POSITION_AT_LEFT_OF_CENTRE:
- y -= (frame_head->height) / 2;
- break;
-
- case POSITION_AT_RIGHT_OF_CENTRE:
- x -= frame_head->width;
- y -= (frame_head->height) / 2;
- break;
+ // this one is always used for SPEECH TEXT; possibly
+ // also for pointer text
+ case POSITION_AT_CENTRE_OF_BASE:
+ x -= (frame_head->width) / 2;
+ y -= frame_head->height;
+ break;
+ case POSITION_AT_CENTRE_OF_TOP:
+ x -= (frame_head->width) / 2;
+ break;
+ case POSITION_AT_LEFT_OF_TOP:
+ // the given coords are already correct for this!
+ break;
+ case POSITION_AT_RIGHT_OF_TOP:
+ x -= frame_head->width;
+ break;
+ case POSITION_AT_LEFT_OF_BASE:
+ y -= frame_head->height;
+ break;
+ case POSITION_AT_RIGHT_OF_BASE:
+ x -= frame_head->width;
+ y -= frame_head->height;
+ break;
+ case POSITION_AT_LEFT_OF_CENTRE:
+ y -= (frame_head->height) / 2;
+ break;
+ case POSITION_AT_RIGHT_OF_CENTRE:
+ x -= frame_head->width;
+ y -= (frame_head->height) / 2;
+ break;
}
// ensure text sprite is a few pixels inside the visible screen
@@ -680,22 +670,20 @@ void InitialiseFontResourceFlags(void) { // (James31july97)
void InitialiseFontResourceFlags(uint8 language) { // (James31july97)
switch (language) {
- case FINNISH_TEXT: // special Finnish fonts
- speech_font_id = FINNISH_SPEECH_FONT_ID;
- controls_font_id = FINNISH_CONTROLS_FONT_ID;
- red_font_id = FINNISH_RED_FONT_ID;
- break;
-
- case POLISH_TEXT: // special Polish fonts
- speech_font_id = POLISH_SPEECH_FONT_ID;
- controls_font_id = POLISH_CONTROLS_FONT_ID;
- red_font_id = POLISH_RED_FONT_ID;
- break;
-
- default: // DEFAULT_TEXT - regular fonts
- speech_font_id = ENGLISH_SPEECH_FONT_ID;
- controls_font_id = ENGLISH_CONTROLS_FONT_ID;
- red_font_id = ENGLISH_RED_FONT_ID;
- break;
+ case FINNISH_TEXT: // special Finnish fonts
+ speech_font_id = FINNISH_SPEECH_FONT_ID;
+ controls_font_id = FINNISH_CONTROLS_FONT_ID;
+ red_font_id = FINNISH_RED_FONT_ID;
+ break;
+ case POLISH_TEXT: // special Polish fonts
+ speech_font_id = POLISH_SPEECH_FONT_ID;
+ controls_font_id = POLISH_CONTROLS_FONT_ID;
+ red_font_id = POLISH_RED_FONT_ID;
+ break;
+ default: // DEFAULT_TEXT - regular fonts
+ speech_font_id = ENGLISH_SPEECH_FONT_ID;
+ controls_font_id = ENGLISH_CONTROLS_FONT_ID;
+ red_font_id = ENGLISH_RED_FONT_ID;
+ break;
}
}
diff --git a/sword2/mem_view.cpp b/sword2/mem_view.cpp
index ceeee39aef..de6df195a4 100644
--- a/sword2/mem_view.cpp
+++ b/sword2/mem_view.cpp
@@ -125,37 +125,28 @@ void Console_mem_display(void) { // Tony13Aug96
}
const char *Fetch_mem_owner(uint32 uid) { //Tony3June96
- switch(uid) {
- case UID_memman:
- return "MEMMAN";
-
- case UID_font:
- return "font";
-
- case UID_temp:
- return "temp ram allocation";
-
- case UID_decompression_buffer:
- return "decompression buffer";
-
- case UID_shrink_buffer:
- return "shrink buffer";
-
- case UID_con_sprite:
- return "console sprite buffer";
-
- case UID_text_sprite:
- return "text sprite";
-
- case UID_walk_anim:
- return "walk anim";
-
- case UID_savegame_buffer:
- return "savegame buffer";
-
- default:
- sprintf(buf, "<sob> %d?", uid);
- return buf;
+ switch (uid) {
+ case UID_memman:
+ return "MEMMAN";
+ case UID_font:
+ return "font";
+ case UID_temp:
+ return "temp ram allocation";
+ case UID_decompression_buffer:
+ return "decompression buffer";
+ case UID_shrink_buffer:
+ return "shrink buffer";
+ case UID_con_sprite:
+ return "console sprite buffer";
+ case UID_text_sprite:
+ return "text sprite";
+ case UID_walk_anim:
+ return "walk anim";
+ case UID_savegame_buffer:
+ return "savegame buffer";
+ default:
+ sprintf(buf, "<sob> %d?", uid);
+ return buf;
}
}
diff --git a/sword2/mouse.cpp b/sword2/mouse.cpp
index 5ca8690c53..40acb13022 100644
--- a/sword2/mouse.cpp
+++ b/sword2/mouse.cpp
@@ -144,31 +144,26 @@ void Mouse_engine(void) { // Tony30Sept96
}
switch (mouse_mode) {
- case MOUSE_normal:
- Normal_mouse();
- break;
-
- case MOUSE_top:
- Top_menu_mouse();
- break;
-
- case MOUSE_drag:
- Drag_mouse();
- break;
-
- case MOUSE_system_menu:
- System_menu();
- break;
-
- case MOUSE_holding:
- if (mousey < 400) {
- mouse_mode = MOUSE_normal;
- Zdebug(" releasing");
- }
- break;
-
- default:
- break;
+ case MOUSE_normal:
+ Normal_mouse();
+ break;
+ case MOUSE_top:
+ Top_menu_mouse();
+ break;
+ case MOUSE_drag:
+ Drag_mouse();
+ break;
+ case MOUSE_system_menu:
+ System_menu();
+ break;
+ case MOUSE_holding:
+ if (mousey < 400) {
+ mouse_mode = MOUSE_normal;
+ Zdebug(" releasing");
+ }
+ break;
+ default:
+ break;
}
}
@@ -249,25 +244,21 @@ void System_menu(void) { // Tony19Mar97
// call the relevent screen
switch (hit) {
- case 0:
- Option_control();
- break;
-
- case 1:
- Quit_control();
- break;
-
- case 2:
- Save_control();
- break;
-
- case 3:
- Restore_control();
- break;
-
- case 4:
- Restart_control();
- break;
+ case 0:
+ Option_control();
+ break;
+ case 1:
+ Quit_control();
+ break;
+ case 2:
+ Save_control();
+ break;
+ case 3:
+ Restore_control();
+ break;
+ case 4:
+ Restart_control();
+ break;
}
// Menu stays open on death screen
@@ -917,96 +908,80 @@ void CreatePointerText(uint32 textId, uint32 pointerRes) { // James16jun97
// correctly for text position
switch (pointerRes) {
- case CROSHAIR:
- yOffset = -7;
- xOffset = +10;
- break;
-
- case EXIT0:
- yOffset = +15;
- xOffset = +20;
- break;
-
- case EXIT1:
- yOffset = +16;
- xOffset = -10;
- break;
-
- case EXIT2:
- yOffset = +10;
- xOffset = -22;
- break;
-
- case EXIT3:
- yOffset = -16;
- xOffset = -10;
- break;
-
- case EXIT4:
- yOffset = -15;
- xOffset = +15;
- break;
-
- case EXIT5:
- yOffset = -12;
- xOffset = +10;
- break;
-
- case EXIT6:
- yOffset = +10;
- xOffset = +25;
- break;
-
- case EXIT7:
- yOffset = +16;
- xOffset = +20;
- break;
-
- case EXITDOWN:
- yOffset = -20;
- xOffset = -10;
- break;
-
- case EXITUP:
- yOffset = +20;
- xOffset = +20;
- break;
-
- case MOUTH:
- yOffset = -10;
- xOffset = +15;
- break;
-
- case NORMAL:
- yOffset = -10;
- xOffset = +15;
- break;
-
- case PICKUP:
- yOffset = -40;
- xOffset = +10;
- break;
-
- case SCROLL_L:
- yOffset = -20;
- xOffset = +20;
- break;
-
- case SCROLL_R:
- yOffset = -20;
- xOffset = -20;
- break;
-
- case USE:
- yOffset = -8;
- xOffset = +20;
- break;
-
- default:
- // shouldn't happen if we cover all
- // the different mouse pointers above
- yOffset = -10;
- xOffset = +10;
+ case CROSHAIR:
+ yOffset = -7;
+ xOffset = +10;
+ break;
+ case EXIT0:
+ yOffset = +15;
+ xOffset = +20;
+ break;
+ case EXIT1:
+ yOffset = +16;
+ xOffset = -10;
+ break;
+ case EXIT2:
+ yOffset = +10;
+ xOffset = -22;
+ break;
+ case EXIT3:
+ yOffset = -16;
+ xOffset = -10;
+ break;
+ case EXIT4:
+ yOffset = -15;
+ xOffset = +15;
+ break;
+ case EXIT5:
+ yOffset = -12;
+ xOffset = +10;
+ break;
+ case EXIT6:
+ yOffset = +10;
+ xOffset = +25;
+ break;
+ case EXIT7:
+ yOffset = +16;
+ xOffset = +20;
+ break;
+ case EXITDOWN:
+ yOffset = -20;
+ xOffset = -10;
+ break;
+ case EXITUP:
+ yOffset = +20;
+ xOffset = +20;
+ break;
+ case MOUTH:
+ yOffset = -10;
+ xOffset = +15;
+ break;
+ case NORMAL:
+ yOffset = -10;
+ xOffset = +15;
+ break;
+ case PICKUP:
+ yOffset = -40;
+ xOffset = +10;
+ break;
+ case SCROLL_L:
+ yOffset = -20;
+ xOffset = +20;
+ break;
+ case SCROLL_R:
+ yOffset = -20;
+ xOffset = -20;
+ break;
+ case USE:
+ yOffset = -8;
+ xOffset = +20;
+ break;
+ default:
+ // shouldn't happen if we cover all
+ // the different mouse pointers above
+ yOffset = -10;
+ xOffset = +10;
+ break;
}
// set up justification for text sprite, based on its
diff --git a/sword2/resman.cpp b/sword2/resman.cpp
index d832c7bbdf..625afcfb9f 100644
--- a/sword2/resman.cpp
+++ b/sword2/resman.cpp
@@ -277,175 +277,177 @@ static void convertEndian(uint8 *file, uint32 len) {
SWAP32(hdr->compSize);
SWAP32(hdr->decompSize);
- switch(hdr->fileType) {
- case ANIMATION_FILE: {
- _animHeader *animHead = (_animHeader *)file;
-
- SWAP16(animHead->noAnimFrames);
- SWAP16(animHead->feetStartX);
- SWAP16(animHead->feetStartY);
- SWAP16(animHead->feetEndX);
- SWAP16(animHead->feetEndY);
- SWAP16(animHead->blend);
-
- _cdtEntry *cdtEntry = (_cdtEntry *) (file + sizeof(_animHeader));
- for (i = 0; i < animHead->noAnimFrames; i++, cdtEntry++) {
- SWAP16(cdtEntry->x);
- SWAP16(cdtEntry->y);
- SWAP32(cdtEntry->frameOffset);
-
- _frameHeader *frameHeader = (_frameHeader *) (file + cdtEntry->frameOffset);
- // Quick trick to prevent us from incorrectly applying the endian
- // fixes multiple times. This assumes that frames are less than 1 MB
- // and have height/width less than 4096.
- if ((frameHeader->compSize & 0xFFF00000) ||
- (frameHeader->width & 0xF000) ||
- (frameHeader->height & 0xF000)) {
- SWAP32(frameHeader->compSize);
- SWAP16(frameHeader->width);
- SWAP16(frameHeader->height);
- }
+ _animHeader *animHead;
+ _cdtEntry *cdtEntry;
+ _multiScreenHeader *mscreenHeader;
+ _object_hub *objectHub;
+ _walkGridHeader *walkGridHeader;
+ uint32 *list;
+ _textHeader *textHeader;
+
+ switch (hdr->fileType) {
+ case ANIMATION_FILE:
+ animHead = (_animHeader *)file;
+
+ SWAP16(animHead->noAnimFrames);
+ SWAP16(animHead->feetStartX);
+ SWAP16(animHead->feetStartY);
+ SWAP16(animHead->feetEndX);
+ SWAP16(animHead->feetEndY);
+ SWAP16(animHead->blend);
+
+ cdtEntry = (_cdtEntry *) (file + sizeof(_animHeader));
+ for (i = 0; i < animHead->noAnimFrames; i++, cdtEntry++) {
+ SWAP16(cdtEntry->x);
+ SWAP16(cdtEntry->y);
+ SWAP32(cdtEntry->frameOffset);
+
+ _frameHeader *frameHeader = (_frameHeader *) (file + cdtEntry->frameOffset);
+ // Quick trick to prevent us from incorrectly applying the endian
+ // fixes multiple times. This assumes that frames are less than 1 MB
+ // and have height/width less than 4096.
+ if ((frameHeader->compSize & 0xFFF00000) ||
+ (frameHeader->width & 0xF000) ||
+ (frameHeader->height & 0xF000)) {
+ SWAP32(frameHeader->compSize);
+ SWAP16(frameHeader->width);
+ SWAP16(frameHeader->height);
}
- break;
}
- case SCREEN_FILE: {
- _multiScreenHeader *mscreenHeader = (_multiScreenHeader *)file;
-
- SWAP32(mscreenHeader->palette);
- SWAP32(mscreenHeader->bg_parallax[0]);
- SWAP32(mscreenHeader->bg_parallax[1]);
- SWAP32(mscreenHeader->screen);
- SWAP32(mscreenHeader->fg_parallax[0]);
- SWAP32(mscreenHeader->fg_parallax[1]);
- SWAP32(mscreenHeader->layers);
- SWAP32(mscreenHeader->paletteTable);
- SWAP32(mscreenHeader->maskOffset);
-
- // screenHeader
- _screenHeader *screenHeader = (_screenHeader*) (file + mscreenHeader->screen);
-
- SWAP16(screenHeader->width);
- SWAP16(screenHeader->height);
- SWAP16(screenHeader->noLayers);
-
- // layerHeader
- _layerHeader *layerHeader = (_layerHeader *) (file + mscreenHeader->layers);
- for (i = 0; i < screenHeader->noLayers; i++, layerHeader++) {
- SWAP16(layerHeader->x);
- SWAP16(layerHeader->y);
- SWAP16(layerHeader->width);
- SWAP16(layerHeader->height);
- SWAP32(layerHeader->maskSize);
- SWAP32(layerHeader->offset);
- }
-
- // backgroundParallaxLayer
- _parallax *parallax;
- int offset;
- offset = mscreenHeader->bg_parallax[0];
- if (offset > 0) {
- parallax = (_parallax *) (file + offset);
- SWAP16(parallax->w);
- SWAP16(parallax->h);
- }
-
- offset = mscreenHeader->bg_parallax[1];
- if (offset > 0) {
- parallax = (_parallax *) (file + offset);
- SWAP16(parallax->w);
- SWAP16(parallax->h);
- }
+ break;
+ case SCREEN_FILE: {
+ mscreenHeader = (_multiScreenHeader *) file;
+
+ SWAP32(mscreenHeader->palette);
+ SWAP32(mscreenHeader->bg_parallax[0]);
+ SWAP32(mscreenHeader->bg_parallax[1]);
+ SWAP32(mscreenHeader->screen);
+ SWAP32(mscreenHeader->fg_parallax[0]);
+ SWAP32(mscreenHeader->fg_parallax[1]);
+ SWAP32(mscreenHeader->layers);
+ SWAP32(mscreenHeader->paletteTable);
+ SWAP32(mscreenHeader->maskOffset);
+
+ // screenHeader
+ _screenHeader *screenHeader = (_screenHeader*) (file + mscreenHeader->screen);
+
+ SWAP16(screenHeader->width);
+ SWAP16(screenHeader->height);
+ SWAP16(screenHeader->noLayers);
+
+ // layerHeader
+ _layerHeader *layerHeader = (_layerHeader *) (file + mscreenHeader->layers);
+ for (i = 0; i < screenHeader->noLayers; i++, layerHeader++) {
+ SWAP16(layerHeader->x);
+ SWAP16(layerHeader->y);
+ SWAP16(layerHeader->width);
+ SWAP16(layerHeader->height);
+ SWAP32(layerHeader->maskSize);
+ SWAP32(layerHeader->offset);
+ }
- // backgroundLayer
- offset = mscreenHeader->screen + sizeof(_screenHeader);
- if (offset > 0) {
- parallax = (_parallax *) (file + offset);
- SWAP16(parallax->w);
- SWAP16(parallax->h);
- }
+ // backgroundParallaxLayer
+ _parallax *parallax;
+ int offset;
+ offset = mscreenHeader->bg_parallax[0];
+ if (offset > 0) {
+ parallax = (_parallax *) (file + offset);
+ SWAP16(parallax->w);
+ SWAP16(parallax->h);
+ }
- // foregroundParallaxLayer
- offset = mscreenHeader->fg_parallax[0];
- if (offset > 0) {
- parallax = (_parallax *) (file + offset);
- SWAP16(parallax->w);
- SWAP16(parallax->h);
- }
+ offset = mscreenHeader->bg_parallax[1];
+ if (offset > 0) {
+ parallax = (_parallax *) (file + offset);
+ SWAP16(parallax->w);
+ SWAP16(parallax->h);
+ }
- offset = mscreenHeader->fg_parallax[1];
- if (offset > 0) {
- parallax = (_parallax *) (file + offset);
- SWAP16(parallax->w);
- SWAP16(parallax->h);
- }
- break;
+ // backgroundLayer
+ offset = mscreenHeader->screen + sizeof(_screenHeader);
+ if (offset > 0) {
+ parallax = (_parallax *) (file + offset);
+ SWAP16(parallax->w);
+ SWAP16(parallax->h);
}
- case GAME_OBJECT: {
- _object_hub *objectHub = (_object_hub *)file;
- objectHub->type = (int)SWAP_BYTES_32(objectHub->type);
- SWAP32(objectHub->logic_level);
+ // foregroundParallaxLayer
+ offset = mscreenHeader->fg_parallax[0];
+ if (offset > 0) {
+ parallax = (_parallax *) (file + offset);
+ SWAP16(parallax->w);
+ SWAP16(parallax->h);
+ }
- for (i = 0; i < TREE_SIZE; i++) {
- SWAP32(objectHub->logic[i]);
- SWAP32(objectHub->script_id[i]);
- SWAP32(objectHub->script_pc[i]);
- }
- break;
+ offset = mscreenHeader->fg_parallax[1];
+ if (offset > 0) {
+ parallax = (_parallax *) (file + offset);
+ SWAP16(parallax->w);
+ SWAP16(parallax->h);
}
- case WALK_GRID_FILE: {
- _walkGridHeader *walkGridHeader = (_walkGridHeader *)file;
-
- SWAP32(walkGridHeader->numBars);
- SWAP32(walkGridHeader->numNodes);
-
- _barData *barData = (_barData *) (file + sizeof(_walkGridHeader));
- for (i = 0; i < walkGridHeader->numBars; i++) {
- SWAP16(barData->x1);
- SWAP16(barData->y1);
- SWAP16(barData->x2);
- SWAP16(barData->y2);
- SWAP16(barData->xmin);
- SWAP16(barData->ymin);
- SWAP16(barData->xmax);
- SWAP16(barData->ymax);
- SWAP16(barData->dx);
- SWAP16(barData->dy);
- SWAP32(barData->co);
- barData++;
- }
+ break;
+ case GAME_OBJECT:
+ objectHub = (_object_hub *)file;
- uint16 *node = (uint16 *) (file + sizeof(_walkGridHeader) + walkGridHeader->numBars * sizeof(_barData));
- for (i = 0; i < walkGridHeader->numNodes*2; i++) {
- SWAP16(*node);
- node++;
- }
+ objectHub->type = (int)SWAP_BYTES_32(objectHub->type);
+ SWAP32(objectHub->logic_level);
- break;
+ for (i = 0; i < TREE_SIZE; i++) {
+ SWAP32(objectHub->logic[i]);
+ SWAP32(objectHub->script_id[i]);
+ SWAP32(objectHub->script_pc[i]);
}
- case GLOBAL_VAR_FILE:
- break;
- case PARALLAX_FILE_null:
- break;
- case RUN_LIST: {
- uint32 *list = (uint32 *)file;
- while (*list) {
- SWAP32(*list);
- list++;
- }
- break;
+ break;
+ case WALK_GRID_FILE:
+ _walkGridHeader *walkGridHeader = (_walkGridHeader *)file;
+
+ SWAP32(walkGridHeader->numBars);
+ SWAP32(walkGridHeader->numNodes);
+
+ _barData *barData = (_barData *) (file + sizeof(_walkGridHeader));
+ for (i = 0; i < walkGridHeader->numBars; i++) {
+ SWAP16(barData->x1);
+ SWAP16(barData->y1);
+ SWAP16(barData->x2);
+ SWAP16(barData->y2);
+ SWAP16(barData->xmin);
+ SWAP16(barData->ymin);
+ SWAP16(barData->xmax);
+ SWAP16(barData->ymax);
+ SWAP16(barData->dx);
+ SWAP16(barData->dy);
+ SWAP32(barData->co);
+ barData++;
}
- case TEXT_FILE: {
- _textHeader *textHeader = (_textHeader *)file;
- SWAP32(textHeader->noOfLines);
- break;
+
+ uint16 *node = (uint16 *) (file + sizeof(_walkGridHeader) + walkGridHeader->numBars * sizeof(_barData));
+ for (i = 0; i < walkGridHeader->numNodes*2; i++) {
+ SWAP16(*node);
+ node++;
}
- case SCREEN_MANAGER:
- break;
- case MOUSE_FILE:
- break;
- case ICON_FILE:
- break;
+
+ break;
+ case GLOBAL_VAR_FILE:
+ break;
+ case PARALLAX_FILE_null:
+ break;
+ case RUN_LIST:
+ uint32 *list = (uint32 *)file;
+ while (*list) {
+ SWAP32(*list);
+ list++;
+ }
+ break;
+ case TEXT_FILE:
+ _textHeader *textHeader = (_textHeader *)file;
+ SWAP32(textHeader->noOfLines);
+ break;
+ case SCREEN_MANAGER:
+ break;
+ case MOUSE_FILE:
+ break;
+ case ICON_FILE:
+ break;
}
}
#endif
@@ -836,43 +838,43 @@ void resMan::Examine_res(uint8 *input) { //Tony23Oct96
// NOT USED HERE
//----------------------------------------------------
- switch(file_header->fileType) {
- case ANIMATION_FILE:
- Print_to_console(" <anim> %s", file_header->name);
- break;
- case SCREEN_FILE:
- Print_to_console(" <layer> %s", file_header->name);
- break;
- case GAME_OBJECT:
- Print_to_console(" <game object> %s", file_header->name);
- break;
- case WALK_GRID_FILE:
- Print_to_console(" <walk grid> %s", file_header->name);
- break;
- case GLOBAL_VAR_FILE:
- Print_to_console(" <global variables> %s", file_header->name);
- break;
- case PARALLAX_FILE_null:
- Print_to_console(" <parallax file NOT USED!> %s", file_header->name);
- break;
- case RUN_LIST:
- Print_to_console(" <run list> %s", file_header->name);
- break;
- case TEXT_FILE:
- Print_to_console(" <text file> %s", file_header->name);
- break;
- case SCREEN_MANAGER:
- Print_to_console(" <screen manager> %s", file_header->name);
- break;
- case MOUSE_FILE:
- Print_to_console(" <mouse pointer> %s", file_header->name);
- break;
- case ICON_FILE:
- Print_to_console(" <menu icon> %s", file_header->name);
- break;
- default:
- Print_to_console(" unrecognised fileType %d", file_header->fileType);
- break;
+ switch (file_header->fileType) {
+ case ANIMATION_FILE:
+ Print_to_console(" <anim> %s", file_header->name);
+ break;
+ case SCREEN_FILE:
+ Print_to_console(" <layer> %s", file_header->name);
+ break;
+ case GAME_OBJECT:
+ Print_to_console(" <game object> %s", file_header->name);
+ break;
+ case WALK_GRID_FILE:
+ Print_to_console(" <walk grid> %s", file_header->name);
+ break;
+ case GLOBAL_VAR_FILE:
+ Print_to_console(" <global variables> %s", file_header->name);
+ break;
+ case PARALLAX_FILE_null:
+ Print_to_console(" <parallax file NOT USED!> %s", file_header->name);
+ break;
+ case RUN_LIST:
+ Print_to_console(" <run list> %s", file_header->name);
+ break;
+ case TEXT_FILE:
+ Print_to_console(" <text file> %s", file_header->name);
+ break;
+ case SCREEN_MANAGER:
+ Print_to_console(" <screen manager> %s", file_header->name);
+ break;
+ case MOUSE_FILE:
+ Print_to_console(" <mouse pointer> %s", file_header->name);
+ break;
+ case ICON_FILE:
+ Print_to_console(" <menu icon> %s", file_header->name);
+ break;
+ default:
+ Print_to_console(" unrecognised fileType %d", file_header->fileType);
+ break;
}
res_man.Res_close(res);
}
diff --git a/sword2/save_rest.cpp b/sword2/save_rest.cpp
index 03defc47df..97c513e597 100644
--- a/sword2/save_rest.cpp
+++ b/sword2/save_rest.cpp
@@ -564,25 +564,21 @@ void PutPlayerStructures(void) { // James27feb97 (updated by James on 29july97)
// which megaset was the player at the time of saving?
switch (g_header.mega.megaset_res) {
- case 36: // GeoMega:
- null_pc = 9; // script no.9 - 'player_is_george'
- break;
-
- case 2003: // GeoMegaB:
- null_pc = 13; // script no.13 - 'player_is_georgeB'
- break;
-
- case 1366: // NicMegaA:
- null_pc = 11; // script no.11 - 'player_is_nicoA'
- break;
-
- case 1437: // NicMegaB:
- null_pc = 12; // script no.12 - 'player_is_nicoB'
- break;
-
- case 1575: // NicMegaC:
- null_pc = 10; // script no.10 - 'player_is_nicoC'
- break;
+ case 36: // GeoMega:
+ null_pc = 9; // script no.9 - 'player_is_george'
+ break;
+ case 2003: // GeoMegaB:
+ null_pc = 13; // script no.13 - 'player_is_georgeB'
+ break;
+ case 1366: // NicMegaA:
+ null_pc = 11; // script no.11 - 'player_is_nicoA'
+ break;
+ case 1437: // NicMegaB:
+ null_pc = 12; // script no.12 - 'player_is_nicoB'
+ break;
+ case 1575: // NicMegaC:
+ null_pc = 10; // script no.10 - 'player_is_nicoC'
+ break;
}
RunScript(raw_script_ad, raw_script_ad, &null_pc);
diff --git a/sword2/sound.cpp b/sword2/sound.cpp
index 3582b3ed70..accbacf2d6 100644
--- a/sword2/sound.cpp
+++ b/sword2/sound.cpp
@@ -76,28 +76,24 @@ void Process_fx_queue(void) {
continue;
switch (fxq[j].type) {
- case FX_RANDOM:
- // 1 in 'delay' chance of this fx occurring
- if (rand() % fxq[j].delay == 0)
- Trigger_fx(j);
- break;
-
- case FX_SPOT:
- if (fxq[j].delay)
- fxq[j].delay--;
- else {
- Trigger_fx(j);
- fxq[j].type = FX_SPOT2;
- }
- break;
-
- case FX_SPOT2:
- // Once the Fx has finished remove it from
- // the queue.
-
- if (g_sound->IsFxOpen(j + 1))
- fxq[j].resource = 0;
- break;
+ case FX_RANDOM:
+ // 1 in 'delay' chance of this fx occurring
+ if (rand() % fxq[j].delay == 0)
+ Trigger_fx(j);
+ break;
+ case FX_SPOT:
+ if (fxq[j].delay)
+ fxq[j].delay--;
+ else {
+ Trigger_fx(j);
+ fxq[j].type = FX_SPOT2;
+ }
+ break;
+ case FX_SPOT2:
+ // Once the Fx has finished remove it from the queue.
+ if (g_sound->IsFxOpen(j + 1))
+ fxq[j].resource = 0;
+ break;
}
}
}
@@ -163,22 +159,18 @@ int32 FN_play_fx(int32 *params) { // called from script only
char type[10];
if (wantSfxDebug) {
- switch (params[1]) // 'type'
- {
- case FX_SPOT:
- strcpy(type, "SPOT");
- break;
-
- case FX_LOOP:
- strcpy(type, "LOOPED");
- break;
-
- case FX_RANDOM:
- strcpy(type, "RANDOM");
- break;
-
- default:
- strcpy(type, "INVALID");
+ switch (params[1]) { // 'type'
+ case FX_SPOT:
+ strcpy(type, "SPOT");
+ break;
+ case FX_LOOP:
+ strcpy(type, "LOOPED");
+ break;
+ case FX_RANDOM:
+ strcpy(type, "RANDOM");
+ break;
+ default:
+ strcpy(type, "INVALID");
}
Zdebug("SFX (sample=\"%s\", vol=%d, pan=%d, delay=%d, type=%s)", FetchObjectName(params[0]), params[3], params[4], params[2], type);
diff --git a/sword2/speech.cpp b/sword2/speech.cpp
index bdf30604c6..621ac11354 100644
--- a/sword2/speech.cpp
+++ b/sword2/speech.cpp
@@ -661,233 +661,215 @@ int32 FN_speech_process(int32 *params) { // Tony5Dec96
while(1) {
//we are currently running a command
switch (ob_speech->command) {
- case 0:
- // Do nothing
- break;
-
- case INS_talk:
- pars[0] = params[0]; // ob_graphic
- pars[1] = params[1]; // ob_speech
- pars[2] = params[2]; // ob_logic
- pars[3] = params[3]; // ob_mega
-
- pars[4] = ob_speech->ins1; // encoded text number
- pars[5] = ob_speech->ins2; // wav res id
- pars[6] = ob_speech->ins3; // anim res id
- pars[7] = ob_speech->ins4; // anim table res id
- pars[8] = ob_speech->ins5; // animation mode - 0 lip synced, 1 just straight animation
-
- // Zdebug("speech-process talk");
-
- // run the function - (it thinks it's been
- // called from script - bloody fool)
-
- if (FN_i_speak(pars) != IR_REPEAT) {
- // Zdebug("speech-process talk finished");
- // command finished
- ob_speech->command = 0;
-
- // waiting for command
- ob_speech->wait_state = 1;
- }
-
- // come back again next cycle
- return IR_REPEAT;
-
- case INS_turn:
- pars[0] = params[2]; // ob_logic
- pars[1] = params[0]; // ob_graphic
- pars[2] = params[3]; // ob_mega
- pars[3] = params[4]; // ob_walkdata
- pars[4] = ob_speech->ins1; // direction to turn to
-
- if (FN_turn(pars) != IR_REPEAT) {
- // command finished
- ob_speech->command = 0;
-
- // waiting for command
- ob_speech->wait_state = 1;
- }
-
- // come back again next cycle
- return IR_REPEAT;
-
- case INS_face:
- pars[0] = params[2]; // ob_logic
- pars[1] = params[0]; // ob_graphic
- pars[2] = params[3]; // ob_mega
- pars[3] = params[4]; // ob_walkdata
- pars[4] = ob_speech->ins1; // target
-
- if (FN_face_mega(pars) != IR_REPEAT) {
- // command finished
- ob_speech->command = 0;
-
- // waiting for command
- ob_speech->wait_state = 1;
- }
-
- // come back again next cycle
- return IR_REPEAT;
-
- case INS_anim:
- pars[0] = params[2]; // ob_logic
- pars[1] = params[0]; // ob_graphic
- pars[2] = ob_speech->ins1; // anim res
-
- if (FN_anim(pars) != IR_REPEAT) {
- // command finished
- ob_speech->command = 0;
-
- // waiting for command
- ob_speech->wait_state = 1;
- }
-
- // come back again next cycle
- return IR_REPEAT;
-
- case INS_reverse_anim:
- pars[0] = params[2]; // ob_logic
- pars[1] = params[0]; // ob_graphic
- pars[2] = ob_speech->ins1; // anim res
+ case 0:
+ // Do nothing
+ break;
+ case INS_talk:
+ pars[0] = params[0]; // ob_graphic
+ pars[1] = params[1]; // ob_speech
+ pars[2] = params[2]; // ob_logic
+ pars[3] = params[3]; // ob_mega
+ pars[4] = ob_speech->ins1; // encoded text number
+ pars[5] = ob_speech->ins2; // wav res id
+ pars[6] = ob_speech->ins3; // anim res id
+ pars[7] = ob_speech->ins4; // anim table res id
+ pars[8] = ob_speech->ins5; // animation mode - 0 lip synced, 1 just straight animation
+
+ // Zdebug("speech-process talk");
+
+ // run the function - (it thinks it's been called from
+ // script - bloody fool)
+
+ if (FN_i_speak(pars) != IR_REPEAT) {
+ // Zdebug("speech-process talk finished");
+ // command finished
+ ob_speech->command = 0;
+
+ // waiting for command
+ ob_speech->wait_state = 1;
+ }
- if (FN_reverse_anim(pars) != IR_REPEAT) {
- // command finished
- ob_speech->command = 0;
+ // come back again next cycle
+ return IR_REPEAT;
+ case INS_turn:
+ pars[0] = params[2]; // ob_logic
+ pars[1] = params[0]; // ob_graphic
+ pars[2] = params[3]; // ob_mega
+ pars[3] = params[4]; // ob_walkdata
+ pars[4] = ob_speech->ins1; // direction to turn to
+
+ if (FN_turn(pars) != IR_REPEAT) {
+ // command finished
+ ob_speech->command = 0;
+
+ // waiting for command
+ ob_speech->wait_state = 1;
+ }
- // waiting for command
- ob_speech->wait_state = 1;
- }
+ // come back again next cycle
+ return IR_REPEAT;
+ case INS_face:
+ pars[0] = params[2]; // ob_logic
+ pars[1] = params[0]; // ob_graphic
+ pars[2] = params[3]; // ob_mega
+ pars[3] = params[4]; // ob_walkdata
+ pars[4] = ob_speech->ins1; // target
+
+ if (FN_face_mega(pars) != IR_REPEAT) {
+ // command finished
+ ob_speech->command = 0;
+
+ // waiting for command
+ ob_speech->wait_state = 1;
+ }
- // come back again next cycle
- return IR_REPEAT;
+ // come back again next cycle
+ return IR_REPEAT;
+ case INS_anim:
+ pars[0] = params[2]; // ob_logic
+ pars[1] = params[0]; // ob_graphic
+ pars[2] = ob_speech->ins1; // anim res
- case INS_table_anim:
- pars[0] = params[2]; // ob_logic
- pars[1] = params[0]; // ob_graphic
- pars[2] = params[3]; // ob_mega
- pars[3] = ob_speech->ins1; // pointer to anim table
+ if (FN_anim(pars) != IR_REPEAT) {
+ // command finished
+ ob_speech->command = 0;
- if (FN_mega_table_anim(pars) != IR_REPEAT) {
- // command finished
- ob_speech->command = 0;
+ // waiting for command
+ ob_speech->wait_state = 1;
+ }
- // waiting for command
- ob_speech->wait_state = 1;
- }
+ // come back again next cycle
+ return IR_REPEAT;
+ case INS_reverse_anim:
+ pars[0] = params[2]; // ob_logic
+ pars[1] = params[0]; // ob_graphic
+ pars[2] = ob_speech->ins1; // anim res
- // come back again next cycle
- return IR_REPEAT;
+ if (FN_reverse_anim(pars) != IR_REPEAT) {
+ // command finished
+ ob_speech->command = 0;
- case INS_reverse_table_anim:
- pars[0] = params[2]; // ob_logic
- pars[1] = params[0]; // ob_graphic
- pars[2] = params[3]; // ob_mega
- pars[3] = ob_speech->ins1; // pointer to anim table
+ // waiting for command
+ ob_speech->wait_state = 1;
+ }
- if (FN_reverse_mega_table_anim(pars) != IR_REPEAT) {
- // command finished
- ob_speech->command = 0;
+ // come back again next cycle
+ return IR_REPEAT;
+ case INS_table_anim:
+ pars[0] = params[2]; // ob_logic
+ pars[1] = params[0]; // ob_graphic
+ pars[2] = params[3]; // ob_mega
+ pars[3] = ob_speech->ins1; // pointer to anim table
+
+ if (FN_mega_table_anim(pars) != IR_REPEAT) {
+ // command finished
+ ob_speech->command = 0;
+
+ // waiting for command
+ ob_speech->wait_state = 1;
+ }
- // waiting for command
- ob_speech->wait_state = 1;
- }
+ // come back again next cycle
+ return IR_REPEAT;
+ case INS_reverse_table_anim:
+ pars[0] = params[2]; // ob_logic
+ pars[1] = params[0]; // ob_graphic
+ pars[2] = params[3]; // ob_mega
+ pars[3] = ob_speech->ins1; // pointer to anim table
+
+ if (FN_reverse_mega_table_anim(pars) != IR_REPEAT) {
+ // command finished
+ ob_speech->command = 0;
+
+ // waiting for command
+ ob_speech->wait_state = 1;
+ }
- // come back again next cycle
- return IR_REPEAT;
-
- case INS_no_sprite:
- FN_no_sprite(params); // ob_graphic
- ob_speech->command = 0; // command finished
- ob_speech->wait_state = 1; // waiting for command
- return IR_REPEAT ;
-
- case INS_sort:
- FN_sort_sprite(params); // ob_graphic
- ob_speech->command = 0; // command finished
- ob_speech->wait_state = 1; // waiting for command
- return IR_REPEAT;
-
- case INS_foreground:
- FN_fore_sprite(params); // ob_graphic
- ob_speech->command = 0; // command finished
- ob_speech->wait_state = 1; // waiting for command
- return IR_REPEAT;
-
- case INS_background:
- FN_back_sprite(params); // ob_graphic
- ob_speech->command = 0; // command finished
- ob_speech->wait_state = 1; // waiting for command
- return IR_REPEAT;
-
- case INS_walk:
- pars[0] = params[2]; // ob_logic
- pars[1] = params[0]; // ob_graphic
- pars[2] = params[3]; // ob_mega
- pars[3] = params[4]; // ob_walkdata
- pars[4] = ob_speech->ins1; // target x
- pars[5] = ob_speech->ins2; // target y
- pars[6] = ob_speech->ins3; // target direction
-
- if (FN_walk(pars) != IR_REPEAT) {
- // Zdebug("speech-process walk finished");
- // command finished
- ob_speech->command = 0;
-
- //waiting for command
- ob_speech->wait_state = 1;
- }
+ // come back again next cycle
+ return IR_REPEAT;
+ case INS_no_sprite:
+ FN_no_sprite(params); // ob_graphic
+ ob_speech->command = 0; // command finished
+ ob_speech->wait_state = 1; // waiting for command
+ return IR_REPEAT ;
+ case INS_sort:
+ FN_sort_sprite(params); // ob_graphic
+ ob_speech->command = 0; // command finished
+ ob_speech->wait_state = 1; // waiting for command
+ return IR_REPEAT;
+ case INS_foreground:
+ FN_fore_sprite(params); // ob_graphic
+ ob_speech->command = 0; // command finished
+ ob_speech->wait_state = 1; // waiting for command
+ return IR_REPEAT;
+ case INS_background:
+ FN_back_sprite(params); // ob_graphic
+ ob_speech->command = 0; // command finished
+ ob_speech->wait_state = 1; // waiting for command
+ return IR_REPEAT;
+ case INS_walk:
+ pars[0] = params[2]; // ob_logic
+ pars[1] = params[0]; // ob_graphic
+ pars[2] = params[3]; // ob_mega
+ pars[3] = params[4]; // ob_walkdata
+ pars[4] = ob_speech->ins1; // target x
+ pars[5] = ob_speech->ins2; // target y
+ pars[6] = ob_speech->ins3; // target direction
+
+ if (FN_walk(pars) != IR_REPEAT) {
+ // Zdebug("speech-process walk finished");
+ // command finished
+ ob_speech->command = 0;
+
+ //waiting for command
+ ob_speech->wait_state = 1;
+ }
- // come back again next cycle
- return IR_REPEAT;
-
- case INS_walk_to_anim:
- pars[0] = params[2]; // ob_logic
- pars[1] = params[0]; // ob_graphic
- pars[2] = params[3]; // ob_mega
- pars[3] = params[4]; // ob_walkdata
- pars[4] = ob_speech->ins1; // anim resource
-
- if (FN_walk_to_anim(pars) != IR_REPEAT) {
- // Zdebug("speech-process walk finished");
- // command finished
- ob_speech->command = 0;
- // waiting for command
- ob_speech->wait_state = 1;
- }
+ // come back again next cycle
+ return IR_REPEAT;
+ case INS_walk_to_anim:
+ pars[0] = params[2]; // ob_logic
+ pars[1] = params[0]; // ob_graphic
+ pars[2] = params[3]; // ob_mega
+ pars[3] = params[4]; // ob_walkdata
+ pars[4] = ob_speech->ins1; // anim resource
+
+ if (FN_walk_to_anim(pars) != IR_REPEAT) {
+ // Zdebug("speech-process walk finished");
+ // command finished
+ ob_speech->command = 0;
+
+ // waiting for command
+ ob_speech->wait_state = 1;
+ }
- // come back again next cycle
- return IR_REPEAT;
-
- case INS_stand_after_anim:
- pars[0] = params[0]; // ob_graphic
- pars[1] = params[3]; // ob_mega
- pars[2] = ob_speech->ins1; // anim resource
- FN_stand_after_anim(pars);
- ob_speech->command = 0; // command finished
- ob_speech->wait_state = 1; // waiting for command
- return IR_REPEAT; // come back again next cycle
-
- case INS_set_frame:
-
- pars[0] = params[0]; // ob_graphic
- pars[1] = ob_speech->ins1; // anim_resource
- pars[2] = ob_speech->ins2; // FIRST_FRAME or LAST_FRAME
- ret= FN_set_frame(pars);
- ob_speech->command = 0; // command finished
- ob_speech->wait_state = 1; // waiting for command
- return IR_REPEAT; // come back again next cycle
-
- case INS_quit:
- // Zdebug("speech-process - quit");
- ob_speech->command = 0; // finish with all this
- // ob_speech->wait_state = 0; // start with waiting for command next conversation
- return IR_CONT; // thats it, we're finished with this
-
- default:
- ob_speech->command = 0; // not yet implemented - just cancel
- ob_speech->wait_state = 1; // waiting for command
- break;
+ // come back again next cycle
+ return IR_REPEAT;
+ case INS_stand_after_anim:
+ pars[0] = params[0]; // ob_graphic
+ pars[1] = params[3]; // ob_mega
+ pars[2] = ob_speech->ins1; // anim resource
+ FN_stand_after_anim(pars);
+ ob_speech->command = 0; // command finished
+ ob_speech->wait_state = 1; // waiting for command
+ return IR_REPEAT; // come back again next cycle
+ case INS_set_frame:
+ pars[0] = params[0]; // ob_graphic
+ pars[1] = ob_speech->ins1; // anim_resource
+ pars[2] = ob_speech->ins2; // FIRST_FRAME or LAST_FRAME
+ ret = FN_set_frame(pars);
+ ob_speech->command = 0; // command finished
+ ob_speech->wait_state = 1; // waiting for command
+ return IR_REPEAT; // come back again next cycle
+ case INS_quit:
+ // Zdebug("speech-process - quit");
+ ob_speech->command = 0; // finish with all this
+ // ob_speech->wait_state = 0; // start with waiting for command next conversation
+ return IR_CONT; // thats it, we're finished with this
+ default:
+ ob_speech->command = 0; // not yet implemented - just cancel
+ ob_speech->wait_state = 1; // waiting for command
+ break;
}
if (SPEECH_ID == ID) {
@@ -1629,48 +1611,37 @@ void GetCorrectCdForSpeech(int32 wavId) {
uint8 WantSpeechForLine(uint32 wavId) { // James (29july97)
switch (wavId) {
- case 1328: // AttendantSpeech
- // SFX(Phone71);
- // FX <Telephone rings>
-
- case 2059: // PabloSpeech
- // SFX (2059);
- // FX <Sound of sporadic gunfire from below>
-
- case 4082: // DuaneSpeech
- // SFX (4082);
- // FX <Pffffffffffft! Frp. (Unimpressive, flatulent noise.)>
-
- case 4214: // cat_52
- // SFX (4214);
- // 4214FXMeow!
-
- case 4568: // trapdoor_13
- // SFX (4568);
- // 4568fx<door slamming>
-
- case 4913: // LobineauSpeech
- // SFX (tone2);
- // FX <Lobineau hangs up>
-
- case 5120: // bush_66
- // SFX (5120);
- // 5120FX<loud buzzing>
-
- case 528: // PresidentaSpeech
- // SFX (528);
- // FX <Nearby Crash of Collapsing Masonry>
-
- case 920: // location 62
-
- case 923: // location 62
-
- case 926: // location 62
- // don't want speech for these lines!
- return 0;
-
- default:
- // ok for all other lines
- return 1;
+ case 1328: // AttendantSpeech
+ // SFX(Phone71);
+ // FX <Telephone rings>
+ case 2059: // PabloSpeech
+ // SFX (2059);
+ // FX <Sound of sporadic gunfire from below>
+ case 4082: // DuaneSpeech
+ // SFX (4082);
+ // FX <Pffffffffffft! Frp. (Unimpressive, flatulent noise.)>
+ case 4214: // cat_52
+ // SFX (4214);
+ // 4214FXMeow!
+ case 4568: // trapdoor_13
+ // SFX (4568);
+ // 4568fx<door slamming>
+ case 4913: // LobineauSpeech
+ // SFX (tone2);
+ // FX <Lobineau hangs up>
+ case 5120: // bush_66
+ // SFX (5120);
+ // 5120FX<loud buzzing>
+ case 528: // PresidentaSpeech
+ // SFX (528);
+ // FX <Nearby Crash of Collapsing Masonry>
+ case 920: // location 62
+ case 923: // location 62
+ case 926: // location 62
+ // don't want speech for these lines!
+ return 0;
+ default:
+ // ok for all other lines
+ return 1;
}
}