applied indent to a couple of source files; added .indent.pro file with default indent settings as per readme.txt

svn-id: r4469
This commit is contained in:
Max Horn 2002-07-07 13:14:34 +00:00
parent 465164a3ba
commit 2d73a779cb
7 changed files with 195 additions and 223 deletions

6
.indent.pro vendored Normal file
View File

@ -0,0 +1,6 @@
-br -bap -nbc -lp -ce -cdw -brs -nbad -nbc -npsl -nip -ts2 -ncs -nbs
-npcs -nbap -Tbyte -Tvoid -Tuint32 -Tuint8 -Tuint16 -Tint -Tint8
-Tint16 -Tint32 -TArrayHeader -TMemBlkHeader -TVerbSlot -TObjectData
-TImageHeader -TRoomHeader -TCodeHeader -TResHdr -TBompHeader
-TMidiChannelAdl -TGui -TScumm -TSoundEngine -TPart -TPlayer
--line-length100

View File

@ -26,10 +26,10 @@
void Dialog::draw()
{
Widget *w = _firstWidget;
_gui->clearArea(_x, _y, _w, _h);
_gui->box(_x, _y, _w, _h);
while (w) {
w->draw();
w = w->_next;
@ -60,7 +60,7 @@ void Dialog::handleMouseMoved(int x, int y, int button)
* Determine the widget at location (x,y) if any. Assumes the coordinates are
* in the local coordinate system, i.e. relative to the top left of the dialog.
*/
Widget* Dialog::findWidget(int x, int y)
Widget *Dialog::findWidget(int x, int y)
{
Widget *w = _firstWidget;
while (w) {
@ -108,30 +108,30 @@ void Dialog::addButton(int x, int y, int w, int h, char hotkey, int resID, uint3
#pragma mark -
enum {
kSaveCmd = 'SAVE',
kLoadCmd = 'LOAD',
kPlayCmd = 'PLAY',
kOptionsCmd = 'OPTN',
kQuitCmd = 'QUIT'
kSaveCmd = 'SAVE',
kLoadCmd = 'LOAD',
kPlayCmd = 'PLAY',
kOptionsCmd = 'OPTN',
kQuitCmd = 'QUIT'
};
SaveLoadDialog::SaveLoadDialog(NewGui *gui)
: Dialog(gui, 30, 20, 260, 124)
SaveLoadDialog::SaveLoadDialog(NewGui * gui)
:Dialog(gui, 30, 20, 260, 124)
{
addResText(10, 7, 240, 16, 1);
// addResText(10, 7, 240, 16, 2);
// addResText(10, 7, 240, 16, 3);
addButton(200, 20, 54, 16, 'S', 4, kSaveCmd); // Save
addButton(200, 40, 54, 16, 'L', 5, kLoadCmd); // Load
addButton(200, 60, 54, 16, 'P', 6, kPlayCmd); // Play
addButton(200, 80, 54, 16, 'O', 17, kOptionsCmd); // Options
addButton(200, 100, 54, 16, 'Q', 8, kQuitCmd); // Quit
// addResText(10, 7, 240, 16, 2);
// addResText(10, 7, 240, 16, 3);
addButton(200, 20, 54, 16, 'S', 4, kSaveCmd); // Save
addButton(200, 40, 54, 16, 'L', 5, kLoadCmd); // Load
addButton(200, 60, 54, 16, 'P', 6, kPlayCmd); // Play
addButton(200, 80, 54, 16, 'O', 17, kOptionsCmd); // Options
addButton(200, 100, 54, 16, 'Q', 8, kQuitCmd); // Quit
}
void SaveLoadDialog::handleCommand(uint32 cmd)
{
switch(cmd) {
switch (cmd) {
case kSaveCmd:
break;
case kLoadCmd:
@ -151,8 +151,8 @@ void SaveLoadDialog::handleCommand(uint32 cmd)
#pragma mark -
PauseDialog::PauseDialog(NewGui *gui)
: Dialog(gui, 50, 80, 220, 16)
PauseDialog::PauseDialog(NewGui * gui)
:Dialog(gui, 50, 80, 220, 16)
{
addResText(2, 2, 220, 16, 10);
}

View File

@ -24,8 +24,8 @@
#include "newgui.h"
Widget::Widget(Dialog *boss, int x, int y, int w, int h)
: _boss(boss), _x(x), _y(y), _w(w), _h(h), _id(0), _flags(0)
Widget::Widget(Dialog * boss, int x, int y, int w, int h)
:_boss(boss), _x(x), _y(y), _w(w), _h(h), _id(0), _flags(0)
{
// Insert into the widget list of the boss
_next = _boss->_firstWidget;
@ -40,26 +40,24 @@ void Widget::draw()
// Account for our relative position in the dialog
_x += _boss->_x;
_y += _boss->_y;
// Clear background
if (_flags & WIDGET_CLEARBG)
_boss->_gui->clearArea(_x, _y, _w, _h);
// Draw border
if (_flags & WIDGET_BORDER) {
_boss->_gui->box(_x, _y, _w, _h);
_x += 4;
_y += 4;
}
// Now perform the actual widget draw
drawWidget(_flags & WIDGET_HILITED);
if (_flags & WIDGET_BORDER) {
_x -= 4;
_y -= 4;
}
// Restore x/y
_x -= _boss->_x;
_y -= _boss->_y;
@ -69,8 +67,8 @@ void Widget::draw()
#pragma mark -
StaticTextWidget::StaticTextWidget(Dialog *boss, int x, int y, int w, int h, const char *text)
: Widget(boss, x, y, w, h)
StaticTextWidget::StaticTextWidget(Dialog * boss, int x, int y, int w, int h, const char *text)
:Widget(boss, x, y, w, h)
{
// FIXME - maybe we should make a real copy of the string?
_text = text;
@ -78,7 +76,7 @@ StaticTextWidget::StaticTextWidget(Dialog *boss, int x, int y, int w, int h, con
void StaticTextWidget::drawWidget(bool hilite)
{
NewGui *gui = _boss->_gui;
NewGui *gui = _boss->_gui;
gui->drawString(_text, _x, _y, _w, hilite ? gui->_textcolorhi : gui->_textcolor);
}
@ -86,10 +84,10 @@ void StaticTextWidget::drawWidget(bool hilite)
#pragma mark -
ButtonWidget::ButtonWidget(Dialog *boss, int x, int y, int w, int h, const char *label, uint32 cmd)
: StaticTextWidget(boss, x, y, w, h, label), _cmd(cmd), _hotkey(0)
ButtonWidget::ButtonWidget(Dialog * boss, int x, int y, int w, int h, const char *label, uint32 cmd)
:StaticTextWidget(boss, x, y, w, h, label), _cmd(cmd), _hotkey(0)
{
_flags = WIDGET_ENABLED | WIDGET_BORDER /* | WIDGET_CLEARBG */;
_flags = WIDGET_ENABLED | WIDGET_BORDER /* | WIDGET_CLEARBG */ ;
}
void ButtonWidget::handleClick(int button)

View File

@ -28,7 +28,7 @@
#define vline(x, y, y2, color) line(x, y, x, y2, color);
NewGui::NewGui(Scumm *s) : _s(s), _active(false), _need_redraw(false), _activeDialog(0)
NewGui::NewGui(Scumm *s):_s(s), _active(false), _need_redraw(false), _activeDialog(0)
{
_pauseDialog = new PauseDialog(this);
_saveLoadDialog = new SaveLoadDialog(this);
@ -128,13 +128,13 @@ const char *NewGui::queryString(int stringno)
result = (char *)_s->getStringAddress(string);
if (!result) { // Gracelessly degrade to english :)
if (!result) { // Gracelessly degrade to english :)
if (_s->_features & GF_AFTER_V6)
return string_map_table_v6[stringno - 1].string;
else
return string_map_table_v5[stringno - 1].string;
}
return result;
}
@ -148,7 +148,7 @@ byte *NewGui::getBasePtr(int x, int y)
return NULL;
return vs->screenPtr + x + (y - vs->topline) * 320 +
_s->_screenStartStrip * 8 + (_s->camera._cur.y - 100)*320;
_s->_screenStartStrip * 8 + (_s->camera._cur.y - 100) * 320;
}
void NewGui::box(int x, int y, int width, int height)
@ -167,12 +167,12 @@ void NewGui::box(int x, int y, int width, int height)
void NewGui::line(int x, int y, int x2, int y2, byte color)
{
byte *ptr;
if (x2 < x)
x2 ^= x ^= x2 ^= x; // Swap x2 and x
x2 ^= x ^= x2 ^= x; // Swap x2 and x
if (y2 < y)
y2 ^= y ^= y2 ^= y; // Swap y2 and y
y2 ^= y ^= y2 ^= y; // Swap y2 and y
ptr = getBasePtr(x, y);
@ -221,8 +221,8 @@ void NewGui::drawChar(const char str, int xx, int yy)
byte *ptr = getBasePtr(xx, yy);
if (ptr == NULL)
return;
return;
for (y = 0; y < 8; y++) {
for (x = 0; x < 8; x++) {
unsigned char color;

View File

@ -25,7 +25,7 @@
#include "actor.h"
/* Start executing script 'script' with parameters 'a' and 'b' */
void Scumm::runScript(int script, int a, int b, int16 * lvarptr)
void Scumm::runScript(int script, int a, int b, int16 *lvarptr)
{
byte *scriptPtr;
uint32 scriptOffs;
@ -142,8 +142,8 @@ void Scumm::stopObjectScript(int script)
do {
if (nest->number == script &&
(nest->where == WIO_ROOM || nest->where == WIO_FLOBJECT ||
nest->where == WIO_INVENTORY)) {
(nest->where == WIO_ROOM || nest->where == WIO_FLOBJECT
|| nest->where == WIO_INVENTORY)) {
nest->number = 0xFF;
nest->slot = 0xFF;
nest->where = 0xFF;
@ -276,7 +276,8 @@ void Scumm::executeScript()
_opcode = fetchScriptByte();
_scriptPointerStart = _scriptPointer;
vm.slot[_currentScript].didexec = 1;
debug(8, "Script %d: [%X] %s()", vm.slot[_currentScript].number, _opcode, _opcodes_lookup[_opcode]);
debug(8, "Script %d: [%X] %s()", vm.slot[_currentScript].number, _opcode,
_opcodes_lookup[_opcode]);
op = getOpcode(_opcode);
(this->*op) ();
}
@ -340,8 +341,7 @@ int Scumm::readVar(uint var)
if (var & 0x8000) {
var &= 0x7FFF;
checkRange(_numBitVariables - 1, 0, var,
"Bit variable %d out of range(r)");
checkRange(_numBitVariables - 1, 0, var, "Bit variable %d out of range(r)");
return (_bitVars[var >> 3] & (1 << (var & 7))) ? 1 : 0;
}
@ -364,25 +364,27 @@ void Scumm::writeVar(uint var, int value)
if (var == VAR_CHARINC)
_vars[VAR_CHARINC] = _defaultTalkDelay / 20;
else
_vars[var] = value;
_vars[var] = value;
if ((_varwatch == (int)var) || (_varwatch == 0)) {
if (vm.slot[_currentScript].number < 100)
debug(0, "vars[%d] = %d (via script-%d)", var, value, vm.slot[_currentScript].number);
debug(0, "vars[%d] = %d (via script-%d)", var, value,
vm.slot[_currentScript].number);
else
debug(0, "vars[%d] = %d (via room-%d-%d)", var, value, _currentRoom, vm.slot[_currentScript].number);
debug(0, "vars[%d] = %d (via room-%d-%d)", var, value, _currentRoom,
vm.slot[_currentScript].number);
}
return;
}
if (var & 0x8000) {
var &= 0x7FFF;
checkRange(_numBitVariables - 1, 0, var,
"Bit variable %d out of range(w)");
checkRange(_numBitVariables - 1, 0, var, "Bit variable %d out of range(w)");
/* FIXME: Enable Indy4 mousefighting by default.
is there a better place to put this? */
if (_gameId == GID_INDY4 && var == 107 && vm.slot[_currentScript].number == 1)
is there a better place to put this? */
if (_gameId == GID_INDY4 && var == 107
&& vm.slot[_currentScript].number == 1)
value = 1;
if (value)
@ -562,7 +564,7 @@ void Scumm::unfreezeScripts()
}
for (i = 0; i < 6; i++) {
if (((int8)-- sentence[i].unk) < 0)
if (((int8)--sentence[i].unk) < 0)
sentence[i].unk = 0;
}
}
@ -576,8 +578,8 @@ void Scumm::runAllScripts()
_currentScript = 0xFF;
for (_curExecScript = 0; _curExecScript < NUM_SCRIPT_SLOT; _curExecScript++) {
if (vm.slot[_curExecScript].status == ssRunning &&
vm.slot[_curExecScript].didexec == 0) {
if (vm.slot[_curExecScript].status == ssRunning
&& vm.slot[_curExecScript].didexec == 0) {
_currentScript = (char)_curExecScript;
getScriptBaseAddress();
getScriptEntryPoint();
@ -684,8 +686,8 @@ void Scumm::checkAndRunVar33()
_sentenceNum--;
if (!(_features & GF_AFTER_V7))
if (sentence[_sentenceNum].unk2 &&
sentence[_sentenceNum].unk3 == sentence[_sentenceNum].unk4)
if (sentence[_sentenceNum].unk2
&& sentence[_sentenceNum].unk3 == sentence[_sentenceNum].unk4)
return;
_localParamList[0] = sentence[_sentenceNum].unk5;
@ -722,7 +724,7 @@ void Scumm::decreaseScriptDelay(int amount)
}
}
void Scumm::runVerbCode(int object, int entry, int a, int b, int16 * vars)
void Scumm::runVerbCode(int object, int entry, int a, int b, int16 *vars)
{
uint32 obcd;
int slot, where, offs;
@ -760,7 +762,7 @@ void Scumm::runVerbCode(int object, int entry, int a, int b, int16 * vars)
runScriptNested(slot);
}
void Scumm::initializeLocals(int slot, int16 * vars)
void Scumm::initializeLocals(int slot, int16 *vars)
{
int i;
if (!vars) {
@ -852,7 +854,7 @@ void Scumm::endCutscene()
runScript(_vars[VAR_CUTSCENE_END_SCRIPT], 0, 0, args);
}
void Scumm::cutscene(int16 * args)
void Scumm::cutscene(int16 *args)
{
int scr = _currentScript;
vm.slot[scr].cutsceneOverride++;
@ -901,8 +903,8 @@ bool Scumm::isScriptRunning(int script)
int i;
ScriptSlot *ss = vm.slot;
for (i = 0; i < NUM_SCRIPT_SLOT; i++, ss++)
if (ss->number == script && (ss->where == WIO_GLOBAL ||
ss->where == WIO_LOCAL) && ss->status)
if (ss->number == script
&& (ss->where == WIO_GLOBAL || ss->where == WIO_LOCAL) && ss->status)
return true;
return false;
}
@ -978,8 +980,7 @@ int Scumm::defineArray(int array, int type, int dim2, int dim1)
size *= dim1 + 1;
size >>= 3;
ah =
(ArrayHeader *)createResource(rtString, id, size + sizeof(ArrayHeader));
ah = (ArrayHeader *)createResource(rtString, id, size + sizeof(ArrayHeader));
ah->type = type;
ah->dim1_size = dim1 + 1;

View File

@ -826,22 +826,21 @@ void Scumm::o5_actorSetClass()
{
int act = getVarOrDirectWord(0x80);
int newClass;
while ((_opcode = fetchScriptByte()) != 0xFF) {
newClass = getVarOrDirectWord(0x80);
if (newClass == 0) {
_classData[act] = 0;
if((_features & GF_SMALL_HEADER) && act <= NUM_ACTORS)
{
if ((_features & GF_SMALL_HEADER) && act <= NUM_ACTORS) {
Actor *a;
a = derefActorSafe(act, "actorSetClass");
a->forceClip=0;
}
a->forceClip = 0;
}
continue;
}
if(_gameId == GID_INDY3_256)
if (_gameId == GID_INDY3_256)
newClass--;
@ -963,8 +962,7 @@ void Scumm::o5_cursorCommand()
case 14: /* unk */
getWordVararg(table);
for (i = 0; i < 16; i++)
charset._colorMap[i] = _charsetData[string[1].t_charset][i] =
(unsigned char)table[i];
charset._colorMap[i] = _charsetData[string[1].t_charset][i] = (unsigned char)table[i];
break;
}
@ -1002,7 +1000,7 @@ void Scumm::o5_delay()
delay |= fetchScriptByte() << 16;
vm.slot[_currentScript].delay = delay;
vm.slot[_currentScript].status = 1;
o5_breakHere();
}
@ -1079,7 +1077,7 @@ void Scumm::o5_drawObject()
if (_features & GF_SMALL_HEADER) {
int temp = getVarOrDirectWord(0x40);
int temp2= getVarOrDirectWord(0x20); // Room
int temp2 = getVarOrDirectWord(0x20); // Room
idx = getObjectIndex(obj);
if (idx == -1)
@ -1088,9 +1086,9 @@ void Scumm::o5_drawObject()
xpos = ypos = 255;
if (temp != 0xFF) {
od->x_pos = temp<<3;
od->x_pos = temp << 3;
od->y_pos = temp2<<3;
od->y_pos = temp2 << 3;
}
@ -1104,8 +1102,7 @@ void Scumm::o5_drawObject()
i = _numObjectsInRoom;
do {
if (_objs[i].x_pos == x && _objs[i].y_pos == y && _objs[i].width == w
&& _objs[i].height == h)
if (_objs[i].x_pos == x && _objs[i].y_pos == y && _objs[i].width == w && _objs[i].height == h)
putState(_objs[i].obj_nr, 0);
} while (--i);
@ -1146,8 +1143,7 @@ void Scumm::o5_drawObject()
i = _numObjectsInRoom;
do {
if (_objs[i].x_pos == x && _objs[i].y_pos == y
&& _objs[i].width == w && _objs[i].height == h)
if (_objs[i].x_pos == x && _objs[i].y_pos == y && _objs[i].width == w && _objs[i].height == h)
putState(_objs[i].obj_nr, 0);
} while (--i);
@ -1240,30 +1236,25 @@ void Scumm::o5_freezeScripts()
void Scumm::o5_getActorCostume()
{
getResultPos();
setResult(derefActorSafe(getVarOrDirectByte(0x80), "o5_getActorCostume")->
costume);
setResult(derefActorSafe(getVarOrDirectByte(0x80), "o5_getActorCostume")->costume);
}
void Scumm::o5_getActorElevation()
{
getResultPos();
setResult(derefActorSafe(getVarOrDirectByte(0x80), "o5_getActorElevation")->
elevation);
setResult(derefActorSafe(getVarOrDirectByte(0x80), "o5_getActorElevation")->elevation);
}
void Scumm::o5_getActorFacing()
{
getResultPos();
setResult(newDirToOldDir
(derefActorSafe(getVarOrDirectByte(0x80), "o5_getActorFacing")->
facing));
setResult(newDirToOldDir(derefActorSafe(getVarOrDirectByte(0x80), "o5_getActorFacing")->facing));
}
void Scumm::o5_getActorMoving()
{
getResultPos();
setResult(derefActorSafe(getVarOrDirectByte(0x80), "o5_getActorMoving")->
moving);
setResult(derefActorSafe(getVarOrDirectByte(0x80), "o5_getActorMoving")->moving);
}
void Scumm::o5_getActorRoom()
@ -1272,9 +1263,9 @@ void Scumm::o5_getActorRoom()
Actor *act;
getResultPos();
temp = getVarOrDirectByte(0x80);
act = derefActorSafe(temp, "o5_getActorRoom");
if (!act)
if (!act)
return;
setResult(act->room);
@ -1287,8 +1278,7 @@ void Scumm::o5_getActorScale()
return;
}
getResultPos();
setResult(derefActorSafe(getVarOrDirectByte(0x80), "o5_getActorScale")->
scalex);
setResult(derefActorSafe(getVarOrDirectByte(0x80), "o5_getActorScale")->scalex);
}
void Scumm::o5_getActorWalkBox()
@ -1296,7 +1286,7 @@ void Scumm::o5_getActorWalkBox()
Actor *a;
getResultPos();
a = derefActorSafe(getVarOrDirectByte(0x80), "o5_getActorWalkbox");
if (a) // FIXME - bug 572977 workaround
if (a) // FIXME - bug 572977 workaround
setResult(a->walkbox);
else
setResult(0);
@ -1305,8 +1295,7 @@ void Scumm::o5_getActorWalkBox()
void Scumm::o5_getActorWidth()
{
getResultPos();
setResult(derefActorSafe(getVarOrDirectByte(0x80), "o5_getActorWidth")->
width);
setResult(derefActorSafe(getVarOrDirectByte(0x80), "o5_getActorWidth")->width);
}
void Scumm::o5_getActorX()
@ -1314,7 +1303,7 @@ void Scumm::o5_getActorX()
int a;
getResultPos();
if(_gameId == GID_INDY3_256)
if (_gameId == GID_INDY3_256)
a = getVarOrDirectByte(0x80);
else
a = getVarOrDirectWord(0x80);
@ -1327,7 +1316,7 @@ void Scumm::o5_getActorY()
int a;
getResultPos();
if(_gameId == GID_INDY3_256)
if (_gameId == GID_INDY3_256)
a = getVarOrDirectByte(0x80);
else
a = getVarOrDirectWord(0x80);
@ -1340,9 +1329,9 @@ void Scumm::o5_getAnimCounter()
Actor *a;
getResultPos();
a=derefActorSafe(getVarOrDirectByte(0x80),"o5_getActorAnimCounter");
a = derefActorSafe(getVarOrDirectByte(0x80), "o5_getActorAnimCounter");
if(a) // FIXME
if (a) // FIXME
setResult(a->cost.animCounter1);
else
setResult(0);
@ -1381,13 +1370,12 @@ void Scumm::o5_getDist()
r = getObjActToObjActDist(o1, o2);
/* FIXME: Fix for monkey 2, dunno what's wrong in scummvm */
if (_gameId == GID_MONKEY2 && vm.slot[_currentScript].number == 40
&& r < 60)
if (_gameId == GID_MONKEY2 && vm.slot[_currentScript].number == 40 && r < 60)
r = 60;
/* FIXME: Patch to allow TV cord to be picked up in Zak256 */
if ((_gameId == GID_ZAK256) && (r > 0))
r--;
r--;
setResult(r);
}
@ -1577,7 +1565,7 @@ void Scumm::o5_isSoundRunning()
void Scumm::o5_jumpRelative()
{
_scriptPointer += (int16) fetchScriptWord();
_scriptPointer += (int16)fetchScriptWord();
}
void Scumm::o5_lights()
@ -1618,8 +1606,8 @@ void Scumm::o5_loadRoomWithEgo()
/* Warning: used previously _xPos, _yPos from a previous update of those */
putActor(a, a->x, a->y, room);
x = (int16) fetchScriptWord();
y = (int16) fetchScriptWord();
x = (int16)fetchScriptWord();
y = (int16)fetchScriptWord();
_egoPositioned = false;
@ -1645,9 +1633,9 @@ void Scumm::o5_matrixOps()
a = getVarOrDirectByte(0x80);
b = fetchScriptByte();
if (b & 0x40) { // We don't use the locked
b &= ~0x40; // flag, so convert it to
b |= 0x80; // invisible
if (b & 0x40) { // We don't use the locked
b &= ~0x40; // flag, so convert it to
b |= 0x80; // invisible
}
setBoxFlags(a, b);
@ -1794,8 +1782,7 @@ void Scumm::o5_putActorInRoom()
a = derefActorSafe(getVarOrDirectByte(0x80), "o5_putActorInRoom");
room = getVarOrDirectByte(0x40);
if (a->visible && _currentRoom != room
&& _vars[VAR_TALK_ACTOR] == a->number) {
if (a->visible && _currentRoom != room && _vars[VAR_TALK_ACTOR] == a->number) {
clearMsgQueue();
}
a->room = room;
@ -2037,30 +2024,28 @@ void Scumm::o5_roomOps()
case 13:{ /* save-string */
char buf[256], *s;
FILE *out;
a = getVarOrDirectByte(0x80);
s = buf;
while ((*s++ = fetchScriptByte()))
;
while ((*s++ = fetchScriptByte()));
// Use buf as filename
out = fopen(buf, "wb");
if (out) {
byte *ptr;
ptr = getResourceAddress(rtString, a);
fwrite(ptr, getStringLen(ptr)+1, 1, out);
fwrite(ptr, getStringLen(ptr) + 1, 1, out);
fclose(out);
}
break;
}
case 14:{ /* load-string */
case 14:{ /* load-string */
char buf[256], *s;
FILE *in;
a = getVarOrDirectByte(0x80);
s = buf;
while ((*s++ = fetchScriptByte()))
;
while ((*s++ = fetchScriptByte()));
// Use buf as filename
in = fopen(buf, "rb");
@ -2069,9 +2054,9 @@ void Scumm::o5_roomOps()
int len;
fseek(in, 0, SEEK_END);
len = ftell(in); // Determine file size
ptr = (byte *)calloc(len+1, 1); // Create a zero terminated buffer
ptr = (byte *)calloc(len + 1, 1); // Create a zero terminated buffer
fseek(in, 0, SEEK_SET);
fread(ptr, len, 1, in); // Read in the data
fread(ptr, len, 1, in); // Read in the data
fclose(in);
loadPtrToResource(rtString, a, ptr);
free(ptr);
@ -2088,7 +2073,7 @@ void Scumm::o5_roomOps()
palManipulate(b, c, a, d, 1);
break;
case 16:
case 16:
a = getVarOrDirectByte(0x80);
b = getVarOrDirectByte(0x40);
if (a < 1)
@ -2200,8 +2185,7 @@ void Scumm::o5_setObjectName()
if (i >= size) {
work[i] = 0;
warning("New name of object %d too long (old *%s* new *%s*)",
obj, name, work);
warning("New name of object %d too long (old *%s* new *%s*)", obj, name, work);
i = size - 1;
}
@ -2305,7 +2289,7 @@ void Scumm::o5_startScript()
void Scumm::o5_startSound()
{
_vars[VAR_MUSIC_FLAG]=0;
_vars[VAR_MUSIC_FLAG] = 0;
addSoundToQueue(getVarOrDirectByte(0x80));
}
@ -2331,7 +2315,7 @@ void Scumm::o5_stopScript()
script = getVarOrDirectByte(0x80);
if (!script)
stopObjectCode();
stopObjectCode();
else
stopScriptNr(script);
}
@ -2448,26 +2432,26 @@ void Scumm::o5_verbOps()
vs->y = getVarOrDirectWord(0x40);
// FIXME: hack loom notes into right spot
if (_gameId == GID_LOOM256) {
if ((verb >= 90) && (verb <= 97)) { // Notes
if ((verb >= 90) && (verb <= 97)) { // Notes
switch (verb) {
case 90:
case 91:
vs->y -= 7;
case 90:
case 91:
vs->y -= 7;
break;
case 92:
vs->y -= 6;
case 92:
vs->y -= 6;
break;
case 93:
vs->y -= 4;
case 93:
vs->y -= 4;
break;
case 94:
vs->y -= 3;
case 94:
vs->y -= 3;
break;
case 95:
vs->y -= 1;
case 95:
vs->y -= 1;
break;
case 97:
vs->y -= 5;
case 97:
vs->y -= 5;
}
}
}
@ -2574,8 +2558,7 @@ void Scumm::o5_wait()
return;
case 4: /* wait for sentence */
if (_sentenceNum) {
if (sentence[_sentenceNum - 1].unk &&
!isScriptInUse(_vars[VAR_SENTENCE_SCRIPT]))
if (sentence[_sentenceNum - 1].unk && !isScriptInUse(_vars[VAR_SENTENCE_SCRIPT]))
return;
break;
}
@ -2662,7 +2645,7 @@ void Scumm::o5_walkActorToObject()
}
}
int Scumm::getWordVararg(int16 * ptr)
int Scumm::getWordVararg(int16 *ptr)
{
int i;
@ -2680,7 +2663,7 @@ int Scumm::getVarOrDirectWord(byte mask)
{
if (_opcode & mask)
return readVar(fetchScriptWord());
return (int16) fetchScriptWord();
return (int16)fetchScriptWord();
}
int Scumm::getVarOrDirectByte(byte mask)
@ -2750,12 +2733,12 @@ void Scumm::decodeParseString()
else
offset = 0;
delay = (int)((getVarOrDirectWord(0x40) & 0xffff) * 7.5);
if (_gameId == GID_LOOM256) {
if (_gameId == GID_LOOM256) {
_vars[VAR_MI1_TIMER] = 0;
#ifdef COMPRESSED_SOUND_FILE
if (playMP3CDTrack(1, 0, offset, delay) == -1)
#endif
_system->play_cdrom(1, 0, offset, delay);
_system->play_cdrom(1, 0, offset, delay);
} else {
warning("parseString: 8");
}
@ -2800,15 +2783,15 @@ void Scumm::o5_oldRoomEffect()
_opcode = fetchScriptByte();
if ((_opcode & 0x1F) == 3) {
a = getVarOrDirectWord(0x80);
switch(a) {
case 4:
_fullRedraw =true;
break;
default:
warning("Unsupported oldRoomEffect %d", a);
break;
switch (a) {
case 4:
_fullRedraw = true;
break;
default:
warning("Unsupported oldRoomEffect %d", a);
break;
}
}
}
}
void Scumm::o5_pickupObjectOld()
@ -2825,10 +2808,10 @@ void Scumm::o5_pickupObjectOld()
return;
if (whereIsObject(obj) == WIO_INVENTORY) /* Don't take an */
return; /* object twice */
return; /* object twice */
// warning("adding %d from %d to inventoryOld", obj, _currentRoom);
addObjectToInventory(obj, _roomResource);
addObjectToInventory(obj, _roomResource);
removeObjectFromRoom(obj);
putOwner(obj, _vars[VAR_EGO]);
putClass(obj, 32, 1);

View File

@ -710,8 +710,7 @@ int Scumm::popRoomAndObj(int *room)
int Scumm::readArray(int array, int idx, int base)
{
ArrayHeader *ah =
(ArrayHeader *)getResourceAddress(rtString, readVar(array));
ArrayHeader *ah = (ArrayHeader *)getResourceAddress(rtString, readVar(array));
if (ah == NULL) {
error("readArray: invalid array %d (%d)", array, readVar(array));
@ -724,14 +723,13 @@ int Scumm::readArray(int array, int idx, int base)
if (ah->type == 4) {
return ah->data[base];
} else {
return (int16) READ_LE_UINT16(ah->data + base * 2);
return (int16)READ_LE_UINT16(ah->data + base * 2);
}
}
void Scumm::writeArray(int array, int idx, int base, int value)
{
ArrayHeader *ah =
(ArrayHeader *)getResourceAddress(rtString, readVar(array));
ArrayHeader *ah = (ArrayHeader *)getResourceAddress(rtString, readVar(array));
assert(ah);
base += idx * ah->dim1_size;
@ -744,7 +742,7 @@ void Scumm::writeArray(int array, int idx, int base, int value)
}
}
int Scumm::getStackList(int16 * args, uint maxnum)
int Scumm::getStackList(int16 *args, uint maxnum)
{
uint num, i;
@ -771,7 +769,7 @@ void Scumm::o6_pushByte()
void Scumm::o6_pushWord()
{
push((int16) fetchScriptWord());
push((int16)fetchScriptWord());
}
void Scumm::o6_pushByteVar()
@ -786,8 +784,7 @@ void Scumm::o6_pushWordVar()
void Scumm::o6_invalid()
{
error("Invalid opcode '%x' at %x", _opcode,
_scriptPointer - _scriptOrgPointer);
error("Invalid opcode '%x' at %x", _opcode, _scriptPointer - _scriptOrgPointer);
}
void Scumm::o6_byteArrayRead()
@ -1012,7 +1009,7 @@ void Scumm::o6_jumpFalse()
void Scumm::o6_jump()
{
_scriptPointer += (int16) fetchScriptWord();
_scriptPointer += (int16)fetchScriptWord();
}
void Scumm::o6_startScriptEx()
@ -1161,8 +1158,7 @@ void Scumm::o6_cursorCommand()
case 0x9D: /* set charset colors */
getStackList(args, sizeof(args) / sizeof(args[0]));
for (i = 0; i < 16; i++)
charset._colorMap[i] = _charsetData[string[1].t_charset][i] =
(unsigned char)args[i];
charset._colorMap[i] = _charsetData[string[1].t_charset][i] = (unsigned char)args[i];
break;
case 0xD6:
makeCursorColorTransparent(pop());
@ -1389,8 +1385,7 @@ void Scumm::o6_putActorInRoom()
if (room == 0xFF) {
room = a->room;
} else {
if (a->visible && _currentRoom != room
&& _vars[VAR_TALK_ACTOR] == a->number) {
if (a->visible && _currentRoom != room && _vars[VAR_TALK_ACTOR] == a->number) {
clearMsgQueue();
}
if (room != 0)
@ -1649,16 +1644,16 @@ void Scumm::o6_isSoundRunning()
int snd = pop();
// FIXME: This fixes wak-a-rat until we correctly implement
// sam and max iMUSE
// sam and max iMUSE
if (_gameId == GID_SAMNMAX && _currentRoom == 18 && snd == 23) {
stopSound(snd);
push(0);
return;
return;
}
if (snd)
snd = isSoundRunning(snd);
push(snd);
}
@ -1996,7 +1991,7 @@ void Scumm::o6_actorSet()
break;
case 95:
a->ignoreBoxes = 1;
if(_features & GF_AFTER_V7) // yazoo: I don't know if it's supposed to be 100 in other games too...
if (_features & GF_AFTER_V7) // yazoo: I don't know if it's supposed to be 100 in other games too...
a->forceClip = 100;
else
a->forceClip = 0;
@ -2006,7 +2001,7 @@ void Scumm::o6_actorSet()
break;
case 96:
a->ignoreBoxes = 0;
if(_features & GF_AFTER_V7) // yazoo: I don't know if it's supposed to be 100 in other games too...
if (_features & GF_AFTER_V7) // yazoo: I don't know if it's supposed to be 100 in other games too...
a->forceClip = 100;
else
a->forceClip = 0;
@ -2332,7 +2327,7 @@ void Scumm::o6_wait()
{
switch (fetchScriptByte()) {
case 168:{
int offs = (int16) fetchScriptWord();
int offs = (int16)fetchScriptWord();
if (derefActorSafe(pop(), "o6_wait")->moving) {
_scriptPointer += offs;
o6_breakHere();
@ -2341,7 +2336,7 @@ void Scumm::o6_wait()
}
case 169:
//printf("waiting for message: %d\n", _vars[VAR_HAVE_MSG]);
if (_vars[VAR_HAVE_MSG])
break;
return;
@ -2358,8 +2353,7 @@ void Scumm::o6_wait()
case 171:
printf("wait for sentence");
if (_sentenceNum) {
if (sentence[_sentenceNum - 1].unk &&
!isScriptInUse(_vars[VAR_SENTENCE_SCRIPT]))
if (sentence[_sentenceNum - 1].unk && !isScriptInUse(_vars[VAR_SENTENCE_SCRIPT]))
return;
break;
}
@ -2368,7 +2362,7 @@ void Scumm::o6_wait()
break;
case 226:{ /* wait until actor drawn */
Actor *a = derefActorSafe(pop(), "o6_wait:226");
int offs = (int16) fetchScriptWord();
int offs = (int16)fetchScriptWord();
if (a && a->isInCurrentRoom() && a->needRedraw) {
_scriptPointer += offs;
o6_breakHere();
@ -2377,7 +2371,7 @@ void Scumm::o6_wait()
}
case 232:{ /* wait until actor stops turning */
Actor *a = derefActorSafe(pop(), "o6_wait:226");
int offs = (int16) fetchScriptWord();
int offs = (int16)fetchScriptWord();
if (a && a->isInCurrentRoom() && a->moving & MF_TURN) {
_scriptPointer += offs;
o6_breakHere();
@ -2415,10 +2409,10 @@ void Scumm::o6_soundKludge()
/* (yazoo): I don't know enought about the sound code to
* fix the looping sound bug. FIXME !*/
if(list[1] == 163 && _gameId == GID_DIG)
if (list[1] == 163 && _gameId == GID_DIG)
return;
soundKludge(list);
}
@ -2696,7 +2690,7 @@ void Scumm::o6_miscOps()
int i;
Actor *a;
IMuse *se = _imuse; //yazoo: not very nice
IMuse *se = _imuse; //yazoo: not very nice
getStackList(args, sizeof(args) / sizeof(args[0]));
@ -2714,8 +2708,7 @@ void Scumm::o6_miscOps()
warning("o6_miscOps: stub7()");
break;
case 10:
warning("o6_miscOps: stub10(%d,%d,%d,%d)", args[1], args[2], args[3],
args[4]);
warning("o6_miscOps: stub10(%d,%d,%d,%d)", args[1], args[2], args[3], args[4]);
break;
case 11:
warning("o6_miscOps: stub11(%d)", args[1]);
@ -2724,12 +2717,10 @@ void Scumm::o6_miscOps()
setCursorImg(args[1], (uint) - 1, args[2]);
break;
case 13:
derefActorSafe(args[1], "o6_miscOps:14")->remapActor(args[2], args[3],
args[4], -1);
derefActorSafe(args[1], "o6_miscOps:14")->remapActor(args[2], args[3], args[4], -1);
break;
case 14:
derefActorSafe(args[1], "o6_miscOps:14")->remapActor(args[2], args[3],
args[4], args[5]);
derefActorSafe(args[1], "o6_miscOps:14")->remapActor(args[2], args[3], args[4], args[5]);
break;
case 15:
_insaneFlag = args[1];
@ -2739,7 +2730,7 @@ void Scumm::o6_miscOps()
_msgPtrToAdd = charset._buffer;
_messagePtr = addMessageToStack(getStringAddressVar(VAR_STRING2DRAW));
i = 0;
while (charset._buffer[i] != 0) {
while (charset._buffer[i] != 0) {
if (charset._buffer[i] == '/') {
charset._bufPos = i + 1;
}
@ -2749,8 +2740,7 @@ void Scumm::o6_miscOps()
}
break;
case 17:
warning("o6_miscOps: stub17(%d,%d,%d,%d)", args[1], args[2], args[3],
args[4]);
warning("o6_miscOps: stub17(%d,%d,%d,%d)", args[1], args[2], args[3], args[4]);
break;
case 18:
warning("o6_miscOps: stub18(%d,%d)", args[1], args[2]);
@ -2762,8 +2752,7 @@ void Scumm::o6_miscOps()
a->needRedraw = true;
break;
case 108:
setupShadowPalette(args[1], args[2], args[3], args[4], args[5],
args[6]);
setupShadowPalette(args[1], args[2], args[3], args[4], args[5], args[6]);
break;
case 109:
setupShadowPalette(0, args[1], args[2], args[3], args[4], args[5]);
@ -2775,12 +2764,10 @@ void Scumm::o6_miscOps()
freezeScripts(2);
break;
case 118:
enqueueObject(args[1], args[2], args[3], args[4], args[5], args[6],
args[7], args[8], 3);
enqueueObject(args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], 3);
break;
case 119:
enqueueObject(args[1], args[2], args[3], args[4], args[5], args[6],
args[7], args[8], 0);
enqueueObject(args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], 0);
break;
case 120:
warning("o6_miscOps: stub120(%d,%d)", args[1], args[2]);
@ -2833,7 +2820,7 @@ void Scumm::o6_miscOps()
case 108: /* create proc_special_palette */
case 109:
createSpecialPalette(args[1], args[2],args[3], args[4], args[5], 0, 256);
createSpecialPalette(args[1], args[2], args[3], args[4], args[5], 0, 256);
break;
case 110:
@ -2863,8 +2850,7 @@ void Scumm::o6_miscOps()
break;
case 119:
enqueueObject(args[1], args[2], args[3], args[4], args[5],
args[6], args[7], args[8], 0);
enqueueObject(args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], 0);
break;
case 120:
@ -2877,9 +2863,9 @@ void Scumm::o6_miscOps()
case 122:
_vars[VAR_SOUNDRESULT] = (short)se->do_command( args[1], args[2], args[3], args[4],
args[5], args[6], args[7], args[8]
);
_vars[VAR_SOUNDRESULT] =
(short)se->do_command(args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8]
);
break;
case 123:
@ -2939,15 +2925,15 @@ void Scumm::o6_kernelFunction()
case 211:
warning("o6_kernelFunction: getInput(%d)", args[1]);
/*
13 = thrust
336 = thrust
328 = thrust
27 = abord
97 = left
331 = left
115 = right
333 = tight
*/
13 = thrust
336 = thrust
328 = thrust
27 = abord
97 = left
331 = left
115 = right
333 = tight
*/
push(0);
break;
case 212:
@ -3101,8 +3087,7 @@ void Scumm::decodeParseString2(int m, int n)
}
}
void Scumm::setupShadowPalette(int slot, int rfact, int gfact, int bfact,
int from, int to)
void Scumm::setupShadowPalette(int slot, int rfact, int gfact, int bfact, int from, int to)
{
byte *table;
int i, num;
@ -3123,8 +3108,7 @@ void Scumm::setupShadowPalette(int slot, int rfact, int gfact, int bfact,
num = to - from + 1;
do {
*table++ = remapPaletteColor((curpal[0] * rfact) >> 8,
curpal[1] * gfact >> 8,
curpal[2] * bfact >> 8, (uint) - 1);
curpal[1] * gfact >> 8, curpal[2] * bfact >> 8, (uint) - 1);
curpal += 3;
} while (--num);
}