aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaweł Kołodziejski2003-03-06 17:58:13 +0000
committerPaweł Kołodziejski2003-03-06 17:58:13 +0000
commit093428ae9a6a1fd33003a8a0827d7410501a74cb (patch)
tree00a37a896d37505db01dd69a162627df49e4990c
parent90680fe9bb614c1c5b7030821445e294c937f152 (diff)
downloadscummvm-rg350-093428ae9a6a1fd33003a8a0827d7410501a74cb.tar.gz
scummvm-rg350-093428ae9a6a1fd33003a8a0827d7410501a74cb.tar.bz2
scummvm-rg350-093428ae9a6a1fd33003a8a0827d7410501a74cb.zip
and more cleanup
svn-id: r6718
-rw-r--r--scumm/actor.cpp137
-rw-r--r--scumm/actor.h2
-rw-r--r--scumm/akos.cpp85
-rw-r--r--scumm/boxes.cpp102
-rw-r--r--scumm/bundle.cpp43
-rw-r--r--scumm/charset.cpp50
-rw-r--r--scumm/charset.h2
-rw-r--r--scumm/costume.cpp82
-rw-r--r--scumm/costume.h1
-rw-r--r--scumm/debugger.cpp61
-rw-r--r--scumm/debugrl.cpp34
-rw-r--r--scumm/dialogs.cpp94
-rw-r--r--scumm/dialogs.h26
-rw-r--r--scumm/gfx.cpp325
-rw-r--r--scumm/gfx.h2
-rw-r--r--scumm/imuse.cpp485
-rw-r--r--scumm/instrument.cpp64
-rw-r--r--scumm/instrument.h3
-rw-r--r--scumm/intern.h25
-rw-r--r--scumm/object.cpp189
-rw-r--r--scumm/resource.cpp142
-rw-r--r--scumm/resource_v2.cpp3
-rw-r--r--scumm/resource_v3.cpp6
-rw-r--r--scumm/resource_v4.cpp3
-rw-r--r--scumm/saveload.cpp75
-rw-r--r--scumm/script.cpp148
-rw-r--r--scumm/script_v5.cpp366
-rw-r--r--scumm/script_v6.cpp596
-rw-r--r--scumm/script_v8.cpp131
-rw-r--r--scumm/scumm.h18
-rw-r--r--scumm/scummvm.cpp156
-rw-r--r--scumm/sound.cpp133
-rw-r--r--scumm/sound.h20
-rw-r--r--scumm/string.cpp43
-rw-r--r--scumm/usage_bits.cpp18
-rw-r--r--scumm/vars.cpp12
-rw-r--r--scumm/verbs.cpp30
37 files changed, 1322 insertions, 2390 deletions
diff --git a/scumm/actor.cpp b/scumm/actor.cpp
index 3556019d5b..d5701b7ab0 100644
--- a/scumm/actor.cpp
+++ b/scumm/actor.cpp
@@ -32,8 +32,7 @@
#include <math.h>
-void Actor::initActor(int mode)
-{
+void Actor::initActor(int mode) {
if (mode == 1) {
costume = 0;
room = 0;
@@ -91,14 +90,12 @@ void Actor::initActor(int mode)
}
}
-void Actor::stopActorMoving()
-{
+void Actor::stopActorMoving() {
_vm->stopScriptNr(walk_script);
moving = 0;
}
-void Actor::setActorWalkSpeed(uint newSpeedX, uint newSpeedY)
-{
+void Actor::setActorWalkSpeed(uint newSpeedX, uint newSpeedY) {
if (newSpeedX == speedx && newSpeedY == speedy)
return;
@@ -110,8 +107,7 @@ void Actor::setActorWalkSpeed(uint newSpeedX, uint newSpeedY)
}
}
-int Scumm::getAngleFromPos(int x, int y)
-{
+int Scumm::getAngleFromPos(int x, int y) {
if (_gameId == GID_DIG || _gameId == GID_CMI) {
double temp = atan2((double)x, (double)-y);
return normalizeAngle((int)(temp * 180 / 3.1415926535));
@@ -128,8 +124,7 @@ int Scumm::getAngleFromPos(int x, int y)
}
}
-int Actor::calcMovementFactor(int newX, int newY)
-{
+int Actor::calcMovementFactor(int newX, int newY) {
int actorX, actorY;
int diffX, diffY;
int32 XYFactor, YXFactor;
@@ -181,8 +176,7 @@ int Actor::calcMovementFactor(int newX, int newY)
return actorWalkStep();
}
-int Actor::remapDirection(int dir, bool is_walking)
-{
+int Actor::remapDirection(int dir, bool is_walking) {
int specdir;
byte flags;
bool flipX;
@@ -250,8 +244,7 @@ int Actor::remapDirection(int dir, bool is_walking)
return normalizeAngle(dir) | 1024;
}
-int Actor::updateActorDirection(bool is_walking)
-{
+int Actor::updateActorDirection(bool is_walking) {
int from, to;
int diff;
int dirType;
@@ -290,16 +283,12 @@ int Actor::updateActorDirection(bool is_walking)
return dir;
}
-void Actor::setBox(int box)
-{
+void Actor::setBox(int box) {
walkbox = box;
-
setupActorScale();
}
-
-int Actor::actorWalkStep()
-{
+int Actor::actorWalkStep() {
int tmpX, tmpY;
int actorX, actorY;
int distX, distY;
@@ -353,8 +342,7 @@ int Actor::actorWalkStep()
}
-void Actor::setupActorScale()
-{
+void Actor::setupActorScale() {
uint16 scale;
if (_vm->_features & GF_NO_SCALLING) {
@@ -408,8 +396,7 @@ void Actor::setupActorScale()
scaley = (byte)scale;
}
-void Actor::startAnimActor(int f)
-{
+void Actor::startAnimActor(int f) {
if (_vm->_features & GF_NEW_COSTUMES) {
switch (f) {
case 1001:
@@ -482,8 +469,7 @@ void Actor::startAnimActor(int f)
}
}
-void Actor::animateActor(int anim)
-{
+void Actor::animateActor(int anim) {
int cmd, dir;
if (_vm->_features & GF_NEW_COSTUMES) {
@@ -521,8 +507,7 @@ void Actor::animateActor(int anim)
}
}
-void Actor::setDirection(int direction)
-{
+void Actor::setDirection(int direction) {
uint aMask;
int i;
uint16 vald;
@@ -550,8 +535,7 @@ void Actor::setDirection(int direction)
needBgReset = true;
}
-void Actor::putActor(int dstX, int dstY, byte newRoom)
-{
+void Actor::putActor(int dstX, int dstY, byte newRoom) {
if (visible && _vm->_currentRoom != newRoom && _vm->_vars[_vm->VAR_TALK_ACTOR] == number) {
_vm->clearMsgQueue();
}
@@ -582,8 +566,7 @@ void Actor::putActor(int dstX, int dstY, byte newRoom)
}
}
-int Actor::getActorXYPos(int &xPos, int &yPos)
-{
+int Actor::getActorXYPos(int &xPos, int &yPos) {
if (!isInCurrentRoom())
return -1;
@@ -592,8 +575,7 @@ int Actor::getActorXYPos(int &xPos, int &yPos)
return 0;
}
-AdjustBoxResult Actor::adjustXYToBeInBox(int dstX, int dstY, int pathfrom)
-{
+AdjustBoxResult Actor::adjustXYToBeInBox(int dstX, int dstY, int pathfrom) {
AdjustBoxResult abr, tmp;
uint threshold;
uint best;
@@ -691,8 +673,7 @@ AdjustBoxResult Actor::adjustXYToBeInBox(int dstX, int dstY, int pathfrom)
return abr;
}
-void Actor::adjustActorPos()
-{
+void Actor::adjustActorPos() {
AdjustBoxResult abr;
byte flags;
@@ -719,8 +700,7 @@ void Actor::adjustActorPos()
}
}
-void Actor::factToObject(int obj)
-{
+void Actor::factToObject(int obj) {
int x2, y2, dir;
if (!isInCurrentRoom())
@@ -733,8 +713,7 @@ void Actor::factToObject(int obj)
turnToDirection(dir);
}
-void Actor::turnToDirection(int newdir)
-{
+void Actor::turnToDirection(int newdir) {
if (newdir == -1)
return;
@@ -746,8 +725,7 @@ void Actor::turnToDirection(int newdir)
}
}
-void Actor::hideActor()
-{
+void Actor::hideActor() {
if (!visible)
return;
@@ -761,8 +739,7 @@ void Actor::hideActor()
needBgReset = true;
}
-void Actor::showActor()
-{
+void Actor::showActor() {
if (_vm->_currentRoom == 0 || visible)
return;
@@ -779,8 +756,7 @@ void Actor::showActor()
needRedraw = true;
}
-void Scumm::showActors()
-{
+void Scumm::showActors() {
int i;
Actor *a;
@@ -791,8 +767,7 @@ void Scumm::showActors()
}
}
-void Scumm::stopTalk()
-{
+void Scumm::stopTalk() {
int act;
_sound->stopTalkSound();
@@ -813,14 +788,12 @@ void Scumm::stopTalk()
restoreCharsetBg();
}
-void Scumm::clearMsgQueue()
-{
+void Scumm::clearMsgQueue() {
_messagePtr = (byte *)" ";
stopTalk();
}
-void Scumm::walkActors()
-{
+void Scumm::walkActors() {
int i;
Actor *a;
@@ -835,8 +808,7 @@ void Scumm::walkActors()
}
/* Used in Scumm v5 only. Play sounds associated with actors */
-void Scumm::playActorSounds()
-{
+void Scumm::playActorSounds() {
int i;
Actor *a;
@@ -857,13 +829,12 @@ void Scumm::playActorSounds()
#define DRAW_ORDER(x) ((x)->y - ((x)->layer << 11))
-void Scumm::processActors()
-{
+void Scumm::processActors() {
int i;
Actor **actors, *a, **ac, **ac2, *tmp, **end;
int numactors = 0;
- actors = new Actor*[NUM_ACTORS];
+ actors = new Actor * [NUM_ACTORS];
// Make a list of all actors in this room
for (i = 1; i < NUM_ACTORS; i++) {
@@ -907,8 +878,7 @@ void Scumm::processActors()
// Used in Scumm v8, to allow the verb coin to be drawn over the inventory
// chest. I'm assuming that draw order won't matter here.
-void Scumm::processUpperActors()
-{
+void Scumm::processUpperActors() {
Actor *a;
int i;
@@ -922,8 +892,7 @@ void Scumm::processUpperActors()
}
}
-void Actor::drawActorCostume()
-{
+void Actor::drawActorCostume() {
if (!needRedraw)
return;
@@ -1054,8 +1023,7 @@ void Actor::drawActorCostume()
}
}
-void Actor::animateCostume()
-{
+void Actor::animateCostume() {
if (costume == 0)
return;
@@ -1081,8 +1049,7 @@ void Actor::animateCostume()
}
}
-void Actor::animateLimb(int limb, int f)
-{
+void Actor::animateLimb(int limb, int f) {
// This methods is very similiar to animateCostume().
// However, instead of animating *all* the limbs, it only animates
// the specified limb to be at the frame specified by "f".
@@ -1117,9 +1084,7 @@ void Actor::animateLimb(int limb, int f)
}
}
-
-void Scumm::setActorRedrawFlags(bool fg, bool bg)
-{
+void Scumm::setActorRedrawFlags(bool fg, bool bg) {
int i, j;
if (_fullRedraw) {
@@ -1149,8 +1114,7 @@ void Scumm::setActorRedrawFlags(bool fg, bool bg)
}
}
-int Scumm::getActorFromPos(int x, int y)
-{
+int Scumm::getActorFromPos(int x, int y) {
int i;
if (!testGfxAnyUsageBits(x >> 3))
@@ -1165,8 +1129,7 @@ int Scumm::getActorFromPos(int x, int y)
return 0;
}
-void Scumm::actorTalk()
-{
+void Scumm::actorTalk() {
int oldact;
Actor *a;
@@ -1210,8 +1173,7 @@ void Scumm::actorTalk()
CHARSET_1();
}
-void Actor::setActorCostume(int c)
-{
+void Actor::setActorCostume(int c) {
int i;
costumeNeedsInit = true;
@@ -1236,8 +1198,7 @@ void Actor::setActorCostume(int c)
}
-void Actor::startWalkActor(int destX, int destY, int dir)
-{
+void Actor::startWalkActor(int destX, int destY, int dir) {
AdjustBoxResult abr;
abr = adjustXYToBeInBox(destX, destY, walkbox);
@@ -1284,8 +1245,7 @@ void Actor::startWalkActor(int destX, int destY, int dir)
walkdata.curbox = walkbox;
}
-void Actor::startWalkAnim(int cmd, int angle)
-{
+void Actor::startWalkAnim(int cmd, int angle) {
if (angle == -1)
angle = facing;
@@ -1321,8 +1281,7 @@ void Actor::startWalkAnim(int cmd, int angle)
}
}
-void Actor::walkActor()
-{
+void Actor::walkActor() {
int j;
int16 foundPathX, foundPathY;
@@ -1382,8 +1341,7 @@ void Actor::walkActor()
calcMovementFactor(walkdata.destx, walkdata.desty);
}
-void Actor::walkActorOld()
-{
+void Actor::walkActorOld() {
ScummPoint gateLoc[5]; // Gate locations
int new_dir, next_box;
@@ -1475,16 +1433,14 @@ void Actor::walkActorOld()
goto restart;
}
-byte *Actor::getActorName()
-{
+byte *Actor::getActorName() {
byte *ptr = _vm->getResourceAddress(rtActorName, number);
if (ptr == NULL)
return (byte *)" ";
return ptr;
}
-void Actor::remapActorPalette(int r_fact, int g_fact, int b_fact, int threshold)
-{
+void Actor::remapActorPalette(int r_fact, int g_fact, int b_fact, int threshold) {
byte *akos, *rgbs, *akpl;
int akpl_size, i;
int r, g, b;
@@ -1558,8 +1514,7 @@ void Actor::remapActorPalette(int r_fact, int g_fact, int b_fact, int threshold)
}
}
-void Scumm::resetActorBgs()
-{
+void Scumm::resetActorBgs() {
Actor *a;
int i, j;
@@ -1581,8 +1536,7 @@ void Scumm::resetActorBgs()
}
}
-void Actor::classChanged(int cls, bool value)
-{
+void Actor::classChanged(int cls, bool value) {
switch(cls) {
case 20: // Never clip
break;
@@ -1601,7 +1555,6 @@ void Actor::classChanged(int cls, bool value)
}
}
-bool Actor::isInClass(int cls)
-{
+bool Actor::isInClass(int cls) {
return _vm->getClass(number, cls);
}
diff --git a/scumm/actor.h b/scumm/actor.h
index 9efef85b05..ec08a977e0 100644
--- a/scumm/actor.h
+++ b/scumm/actor.h
@@ -108,7 +108,7 @@ protected:
public:
// Constructor, sets all data to 0
- Actor() {
+ Actor() {
memset(this, 0, sizeof(Actor));
} void initActorClass(Scumm *scumm) {
_vm = scumm;
diff --git a/scumm/akos.cpp b/scumm/akos.cpp
index 32a000c431..826d565629 100644
--- a/scumm/akos.cpp
+++ b/scumm/akos.cpp
@@ -99,8 +99,7 @@ enum AkosOpcodes {
AKC_EndSeq = 0xC0FF
};
-bool Scumm::akos_hasManyDirections(Actor *a)
-{
+bool Scumm::akos_hasManyDirections(Actor *a) {
byte *akos;
AkosHeader *akhd;
@@ -111,16 +110,14 @@ bool Scumm::akos_hasManyDirections(Actor *a)
return (akhd->flags & 2) != 0;
}
-int Scumm::akos_frameToAnim(Actor *a, int frame)
-{
+int Scumm::akos_frameToAnim(Actor *a, int frame) {
if (akos_hasManyDirections(a))
return toSimpleDir(1, a->facing) + frame * 8;
else
return newDirToOldDir(a->facing) + frame * 4;
}
-void Scumm::akos_decodeData(Actor *a, int frame, uint usemask)
-{
+void Scumm::akos_decodeData(Actor *a, int frame, uint usemask) {
uint anim;
byte *akos, *r;
AkosHeader *akhd;
@@ -195,8 +192,7 @@ void Scumm::akos_decodeData(Actor *a, int frame, uint usemask)
} while ((uint16)mask);
}
-void AkosRenderer::setPalette(byte *new_palette)
-{
+void AkosRenderer::setPalette(byte *new_palette) {
byte *the_akpl;
uint size, i;
@@ -220,8 +216,7 @@ void AkosRenderer::setPalette(byte *new_palette)
}
}
-void AkosRenderer::setCostume(int costume)
-{
+void AkosRenderer::setCostume(int costume) {
akos = _vm->getResourceAddress(rtCostume, costume);
assert(akos);
@@ -234,15 +229,13 @@ void AkosRenderer::setCostume(int costume)
codec = READ_LE_UINT16(&akhd->codec);
}
-void AkosRenderer::setFacing(Actor *a)
-{
+void AkosRenderer::setFacing(Actor *a) {
_mirror = (newDirToOldDir(a->facing) != 0 || akhd->flags & 1);
if (a->flip)
_mirror = !_mirror;
}
-byte AkosRenderer::drawLimb(const CostumeData &cost, int limb)
-{
+byte AkosRenderer::drawLimb(const CostumeData &cost, int limb) {
uint code;
byte *p;
AkosOffset *off;
@@ -330,14 +323,12 @@ byte AkosRenderer::drawLimb(const CostumeData &cost, int limb)
return true;
}
-void AkosRenderer::codec1_genericDecode()
-{
+void AkosRenderer::codec1_genericDecode() {
byte *src, *dst;
byte len, maskbit;
uint y, color, height;
const byte *scaleytab, *mask;
-
y = v1.y;
len = v1.replen;
@@ -394,15 +385,13 @@ void AkosRenderer::codec1_genericDecode()
} while (1);
}
-void AkosRenderer::codec1_spec1()
-{
+void AkosRenderer::codec1_spec1() {
byte *src, *dst;
byte len, maskbit;
uint y, color, height;
byte pcolor;
const byte *scaleytab, *mask;
-
y = v1.y;
len = v1.replen;
@@ -462,20 +451,17 @@ void AkosRenderer::codec1_spec1()
} while (1);
}
-void AkosRenderer::codec1_spec2()
-{
+void AkosRenderer::codec1_spec2() {
warning("codec1_spec2"); // TODO
}
-void AkosRenderer::codec1_spec3()
-{
+void AkosRenderer::codec1_spec3() {
byte *src, *dst;
byte len, maskbit;
uint y, color, height;
uint pcolor;
const byte *scaleytab, *mask;
-
y = v1.y;
len = v1.replen;
@@ -639,9 +625,7 @@ const byte default_scale_table[768] = {
0x1F, 0x9F, 0x5F, 0xDF, 0x3F, 0xBF, 0x7F, 0xFF,
};
-
-void AkosRenderer::codec1()
-{
+void AkosRenderer::codec1() {
int num_colors;
bool use_scaling;
int i, j;
@@ -651,10 +635,8 @@ void AkosRenderer::codec1()
bool masking;
int step;
-
/* implement custom scale table */
-
v1.scaletable = default_scale_table;
// FIXME - which value for VAR_CUSTOMSCALETABLE in V8 ?
@@ -785,7 +767,7 @@ void AkosRenderer::codec1()
if (_mirror)
v1.scaleXstep = -v1.scaleXstep;
- if ((int) y_top >= (int) outheight || y_bottom <= 0)
+ if ((int) y_top >= (int)outheight || y_bottom <= 0)
return;
if ((int)x_left >= (int)outwidth || x_right <= 0)
@@ -852,8 +834,8 @@ void AkosRenderer::codec1()
masking = false;
if (_zbuf) {
masking = _vm->isMaskActiveAt(x_left, y_top, x_right, y_bottom,
- _vm->getResourceAddress(rtBuffer, 9) +
- _vm->gdi._imgBufOffs[_zbuf] + _vm->_screenStartStrip) != 0;
+ _vm->getResourceAddress(rtBuffer, 9) +
+ _vm->gdi._imgBufOffs[_zbuf] + _vm->_screenStartStrip) != 0;
}
v1.mask_ptr = NULL;
@@ -884,8 +866,7 @@ void AkosRenderer::codec1()
}
-void AkosRenderer::codec1_ignorePakCols(int num)
-{
+void AkosRenderer::codec1_ignorePakCols(int num) {
int n;
byte repcolor;
byte replen;
@@ -1003,7 +984,7 @@ void AkosRenderer::akos16SetupBitReader(byte *src) {
akos16.dataptr = src + 4;
}
-void AkosRenderer::akos16PutOnScreen(byte * dest, byte * src, byte transparency, int32 count) {
+void AkosRenderer::akos16PutOnScreen(byte *dest, byte *src, byte transparency, int32 count) {
byte tmp_data;
if (count == 0)
@@ -1083,7 +1064,7 @@ void AkosRenderer::akos16SkipData(int32 numskip) {
} else {
AKOS16_FILL_BITS()
akos16.color = ((byte)akos16.bits) & akos16.mask;
- AKOS16_EAT_BITS(akos16.shift)
+ AKOS16_EAT_BITS(akos16.shift)
AKOS16_FILL_BITS()
}
} else {
@@ -1140,14 +1121,14 @@ void AkosRenderer::akos16DecodeLine(byte *buf, int32 numbytes, int32 dir) {
}
}
-void AkosRenderer::akos16ApplyMask(byte * dest, byte * maskptr, byte bits, int32 count, byte fillwith) {
+void AkosRenderer::akos16ApplyMask(byte *dest, byte *maskptr, byte bits, int32 count, byte fillwith) {
byte tmp;
byte tmp_data = *(maskptr++);
byte bitpos = 1 << (7 - bits);
if (count == 0)
return;
-
+
for(;;) {
tmp = tmp_data;
do {
@@ -1165,8 +1146,8 @@ void AkosRenderer::akos16ApplyMask(byte * dest, byte * maskptr, byte bits, int32
}
}
-void AkosRenderer::akos16Decompress(byte * dest, int32 pitch, byte * src, int32 t_width, int32 t_height, int32 dir, int32 numskip_before, int32 numskip_after, byte transparency) {
- byte * tmp_buf = akos16.buffer;
+void AkosRenderer::akos16Decompress(byte *dest, int32 pitch, byte *src, int32 t_width, int32 t_height, int32 dir, int32 numskip_before, int32 numskip_after, byte transparency) {
+ byte *tmp_buf = akos16.buffer;
if (dir < 0) {
dest -= (t_width - 1);
@@ -1192,8 +1173,8 @@ void AkosRenderer::akos16Decompress(byte * dest, int32 pitch, byte * src, int32
}
}
-void AkosRenderer::akos16DecompressMask(byte * dest, int32 pitch, byte * src, int32 t_width, int32 t_height, int32 dir, int32 numskip_before, int32 numskip_after, byte transparency, byte * maskptr, int32 bitpos_start) {
- byte * tmp_buf = akos16.buffer;
+void AkosRenderer::akos16DecompressMask(byte *dest, int32 pitch, byte *src, int32 t_width, int32 t_height, int32 dir, int32 numskip_before, int32 numskip_after, byte transparency, byte * maskptr, int32 bitpos_start) {
+ byte *tmp_buf = akos16.buffer;
int maskpitch;
if (dir < 0) {
@@ -1334,20 +1315,19 @@ void AkosRenderer::codec16() {
int32 numskip_before = skip_x + (skip_y * _width);
int32 numskip_after = _width - cur_x;
- byte * dest = outptr + width_unk + height_unk * _vm->_realWidth;
+ byte *dest = outptr + width_unk + height_unk * _vm->_realWidth;
if (_zbuf == 0) {
akos16Decompress(dest, pitch, srcptr, cur_x, out_height, dir, numskip_before, numskip_after, 255);
return;
}
- byte * ptr = _vm->_screenStartStrip + _vm->getResourceAddress(rtBuffer, 9) + _vm->gdi._imgBufOffs[_zbuf];
+ byte *ptr = _vm->_screenStartStrip + _vm->getResourceAddress(rtBuffer, 9) + _vm->gdi._imgBufOffs[_zbuf];
ptr += _numStrips * clip_top + (clip_left / 8);
akos16DecompressMask(dest, pitch, srcptr, cur_x, out_height, dir, numskip_before, numskip_after, 255, ptr, clip_left / 8);
}
-bool Scumm::akos_increaseAnims(byte *akos, Actor *a)
-{
+bool Scumm::akos_increaseAnims(byte *akos, Actor *a) {
byte *aksq, *akfo;
int i;
uint size;
@@ -1366,13 +1346,11 @@ bool Scumm::akos_increaseAnims(byte *akos, Actor *a)
return result;
}
-
#define GW(o) ((int16)READ_LE_UINT16(aksq+curpos+(o)))
#define GUW(o) READ_LE_UINT16(aksq+curpos+(o))
#define GB(o) aksq[curpos+(o)]
-bool Scumm::akos_increaseAnim(Actor *a, int chan, byte *aksq, uint16 *akfo, int numakfo)
-{
+bool Scumm::akos_increaseAnim(Actor *a, int chan, byte *aksq, uint16 *akfo, int numakfo) {
byte active;
uint old_curpos, curpos, end;
uint code;
@@ -1604,8 +1582,7 @@ bool Scumm::akos_increaseAnim(Actor *a, int chan, byte *aksq, uint16 *akfo, int
return curpos != old_curpos;
}
-void Scumm::akos_queCommand(byte cmd, Actor *a, int param_1, int param_2)
-{
+void Scumm::akos_queCommand(byte cmd, Actor *a, int param_1, int param_2) {
switch (cmd) {
case 1:
a->putActor(0, 0, 0);
@@ -1657,9 +1634,7 @@ void Scumm::akos_queCommand(byte cmd, Actor *a, int param_1, int param_2)
}
}
-
-bool Scumm::akos_compare(int a, int b, byte cmd)
-{
+bool Scumm::akos_compare(int a, int b, byte cmd) {
switch (cmd) {
case 0:
return a == b;
diff --git a/scumm/boxes.cpp b/scumm/boxes.cpp
index 7f3bec66fd..9beb0ab31a 100644
--- a/scumm/boxes.cpp
+++ b/scumm/boxes.cpp
@@ -78,8 +78,7 @@ struct PathVertex { /* Linked list of walkpath nodes */
PathVertex *unkMatrixProc1(PathVertex *vtx, PathNode *node);
-byte Scumm::getMaskFromBox(int box)
-{
+byte Scumm::getMaskFromBox(int box) {
Box *ptr = getBoxBaseAddr(box);
if (!ptr)
return 0;
@@ -90,8 +89,7 @@ byte Scumm::getMaskFromBox(int box)
return ptr->old.mask;
}
-void Scumm::setBoxFlags(int box, int val)
-{
+void Scumm::setBoxFlags(int box, int val) {
debug(2, "setBoxFlags(%d, 0x%02x)", box, val);
/* FULL_THROTTLE stuff */
@@ -108,8 +106,7 @@ void Scumm::setBoxFlags(int box, int val)
}
}
-byte Scumm::getBoxFlags(int box)
-{
+byte Scumm::getBoxFlags(int box) {
Box *ptr = getBoxBaseAddr(box);
if (!ptr)
return 0;
@@ -119,8 +116,7 @@ byte Scumm::getBoxFlags(int box)
return ptr->old.flags;
}
-void Scumm::setBoxScale(int box, int scale)
-{
+void Scumm::setBoxScale(int box, int scale) {
Box *b = getBoxBaseAddr(box);
if (_features & GF_AFTER_V8)
b->v8.scale = TO_LE_32(scale);
@@ -128,14 +124,12 @@ void Scumm::setBoxScale(int box, int scale)
b->old.scale = TO_LE_16(scale);
}
-void Scumm::setBoxScaleSlot(int box, int slot)
-{
+void Scumm::setBoxScaleSlot(int box, int slot) {
Box *b = getBoxBaseAddr(box);
b->v8.scaleSlot = TO_LE_32(slot);
}
-int Scumm::getScale(int box, int x, int y)
-{
+int Scumm::getScale(int box, int x, int y) {
Box *ptr = getBoxBaseAddr(box);
assert(ptr);
@@ -148,19 +142,19 @@ int Scumm::getScale(int box, int x, int y)
if (s.y1 == s.y2 && s.x1 == s.x2)
error("Invalid scale slot %d", slot);
-
+
if (s.y1 != s.y2) {
if (y < 0)
y = 0;
-
+
scaleY = (s.scale2 - s.scale1) * (y - s.y1) / (s.y2 - s.y1) + s.scale1;
if (s.x1 == s.x2) {
return scaleY;
}
}
-
+
scaleX = (s.scale2 - s.scale1) * (x - s.x1) / (s.x2 - s.x1) + s.scale1;
-
+
if (s.y1 == s.y2) {
return scaleX;
} else {
@@ -187,8 +181,7 @@ int Scumm::getScale(int box, int x, int y)
}
}
-int Scumm::getBoxScale(int box)
-{
+int Scumm::getBoxScale(int box) {
if (_features & GF_NO_SCALLING)
return 255;
Box *ptr = getBoxBaseAddr(box);
@@ -200,8 +193,7 @@ int Scumm::getBoxScale(int box)
return FROM_LE_16(ptr->old.scale);
}
-byte Scumm::getNumBoxes()
-{
+byte Scumm::getNumBoxes() {
byte *ptr = getResourceAddress(rtMatrix, 2);
if (!ptr)
return 0;
@@ -211,8 +203,7 @@ byte Scumm::getNumBoxes()
return ptr[0];
}
-Box *Scumm::getBoxBaseAddr(int box)
-{
+Box *Scumm::getBoxBaseAddr(int box) {
byte *ptr = getResourceAddress(rtMatrix, 2);
if (!ptr)
return NULL;
@@ -228,8 +219,7 @@ Box *Scumm::getBoxBaseAddr(int box)
return (Box *)(ptr + box * SIZEOF_BOX + 2);
}
-int Scumm::getSpecialBox(int x, int y)
-{
+int Scumm::getSpecialBox(int x, int y) {
int i;
int numOfBoxes;
byte flag;
@@ -249,8 +239,7 @@ int Scumm::getSpecialBox(int x, int y)
return (-1);
}
-bool Scumm::checkXYInBoxBounds(int b, int x, int y)
-{
+bool Scumm::checkXYInBoxBounds(int b, int x, int y) {
BoxCoords box;
if (b == 0 && (!(_features & GF_SMALL_HEADER)))
@@ -294,8 +283,7 @@ bool Scumm::checkXYInBoxBounds(int b, int x, int y)
return true;
}
-void Scumm::getBoxCoordinates(int boxnum, BoxCoords *box)
-{
+void Scumm::getBoxCoordinates(int boxnum, BoxCoords *box) {
Box *bp = getBoxBaseAddr(boxnum);
if (_features & GF_AFTER_V8) {
@@ -343,8 +331,7 @@ void Scumm::getBoxCoordinates(int boxnum, BoxCoords *box)
}
}
-uint Scumm::distanceFromPt(int x, int y, int ptx, int pty)
-{
+uint Scumm::distanceFromPt(int x, int y, int ptx, int pty) {
int diffx, diffy;
diffx = abs(ptx - x);
@@ -361,8 +348,7 @@ uint Scumm::distanceFromPt(int x, int y, int ptx, int pty)
return diffx + diffy;
}
-ScummPoint Scumm::closestPtOnLine(int ulx, int uly, int llx, int lly, int x, int y)
-{
+ScummPoint Scumm::closestPtOnLine(int ulx, int uly, int llx, int lly, int x, int y) {
int lydiff, lxdiff;
int32 dist, a, b, c;
int x2, y2;
@@ -441,8 +427,7 @@ ScummPoint Scumm::closestPtOnLine(int ulx, int uly, int llx, int lly, int x, int
return pt;
}
-bool Scumm::inBoxQuickReject(int b, int x, int y, int threshold)
-{
+bool Scumm::inBoxQuickReject(int b, int x, int y, int threshold) {
int t;
BoxCoords box;
@@ -470,12 +455,11 @@ bool Scumm::inBoxQuickReject(int b, int x, int y, int threshold)
return true;
}
-AdjustBoxResult Scumm::getClosestPtOnBox(int b, int x, int y)
-{
+AdjustBoxResult Scumm::getClosestPtOnBox(int b, int x, int y) {
ScummPoint pt;
AdjustBoxResult best;
uint dist;
- uint bestdist = (uint) 0xFFFF;
+ uint bestdist = (uint)0xFFFF;
BoxCoords box;
getBoxCoordinates(b, &box);
@@ -516,8 +500,7 @@ AdjustBoxResult Scumm::getClosestPtOnBox(int b, int x, int y)
return best;
}
-byte *Scumm::getBoxMatrixBaseAddr()
-{
+byte *Scumm::getBoxMatrixBaseAddr() {
byte *ptr = getResourceAddress(rtMatrix, 1);
if (*ptr == 0xFF)
ptr++;
@@ -530,8 +513,7 @@ byte *Scumm::getBoxMatrixBaseAddr()
* way to 'to' (this can be 'to' itself or a third box).
* If there is no connection -1 is return.
*/
-int Scumm::getPathToDestBox(byte from, byte to)
-{
+int Scumm::getPathToDestBox(byte from, byte to) {
byte *boxm;
byte i;
int dest = -1;
@@ -561,8 +543,7 @@ int Scumm::getPathToDestBox(byte from, byte to)
* Computes the next point actor a has to walk towards in a straight
* line in order to get from box1 to box3 via box2.
*/
-bool Scumm::findPathTowards(Actor *a, byte box1nr, byte box2nr, byte box3nr, int16 &foundPathX, int16 &foundPathY)
-{
+bool Scumm::findPathTowards(Actor *a, byte box1nr, byte box2nr, byte box3nr, int16 &foundPathX, int16 &foundPathY) {
BoxCoords box1;
BoxCoords box2;
ScummPoint tmp;
@@ -695,25 +676,23 @@ bool Scumm::findPathTowards(Actor *a, byte box1nr, byte box2nr, byte box3nr, int
return false;
}
-void Scumm::createBoxMatrix()
-{
+void Scumm::createBoxMatrix() {
int num, i, j;
byte flags;
int table_1[66], table_2[66];
int counter, val;
int code;
-
// A heap (an optiimsation to avoid calling malloc/free extremly often)
_maxBoxVertexHeap = 1000;
createResource(rtMatrix, 4, _maxBoxVertexHeap);
_boxPathVertexHeap = getResourceAddress(rtMatrix, 4);
_boxPathVertexHeapIndex = _boxMatrixItem = 0;
-
+
// Temporary 64*65 distance matrix
createResource(rtMatrix, 3, 65 * 64);
_boxMatrixPtr3 = getResourceAddress(rtMatrix, 3);
-
+
// The result "matrix" in the special format used by Scumm.
createResource(rtMatrix, 1, BOX_MATRIX_SIZE);
_boxMatrixPtr1 = getResourceAddress(rtMatrix, 1);
@@ -825,8 +804,7 @@ void Scumm::createBoxMatrix()
nukeResource(rtMatrix, 3);
}
-PathVertex *unkMatrixProc1(PathVertex *vtx, PathNode *node)
-{
+PathVertex *unkMatrixProc1(PathVertex *vtx, PathNode *node) {
if (node == NULL || vtx == NULL)
return NULL;
@@ -848,8 +826,7 @@ PathVertex *unkMatrixProc1(PathVertex *vtx, PathNode *node)
return NULL;
}
-PathNode *Scumm::unkMatrixProc2(PathVertex *vtx, int i)
-{
+PathNode *Scumm::unkMatrixProc2(PathVertex *vtx, int i) {
PathNode *node;
if (vtx == NULL)
@@ -874,8 +851,7 @@ PathNode *Scumm::unkMatrixProc2(PathVertex *vtx, int i)
/* Check if two boxes are neighbours */
-bool Scumm::areBoxesNeighbours(int box1nr, int box2nr)
-{
+bool Scumm::areBoxesNeighbours(int box1nr, int box2nr) {
int j, k, m, n;
int tmp_x, tmp_y;
bool result;
@@ -984,15 +960,13 @@ bool Scumm::areBoxesNeighbours(int box1nr, int box2nr)
return result;
}
-void Scumm::addToBoxMatrix(byte b)
-{
+void Scumm::addToBoxMatrix(byte b) {
if (++_boxMatrixItem > BOX_MATRIX_SIZE)
error("Box matrix overflow");
*_boxMatrixPtr1++ = b;
}
-void *Scumm::addToBoxVertexHeap(int size)
-{
+void *Scumm::addToBoxVertexHeap(int size) {
byte *ptr = _boxPathVertexHeap;
_boxPathVertexHeap += size;
@@ -1004,16 +978,14 @@ void *Scumm::addToBoxVertexHeap(int size)
return ptr;
}
-PathVertex *Scumm::addPathVertex()
-{
+PathVertex *Scumm::addPathVertex() {
_boxPathVertexHeap = getResourceAddress(rtMatrix, 4);
_boxPathVertexHeapIndex = 0;
return (PathVertex *)addToBoxVertexHeap(sizeof(PathVertex));
}
-void Scumm::findPathTowardsOld(Actor *actor, byte trap1, byte trap2, byte final_trap, ScummPoint gateLoc[5])
-{
+void Scumm::findPathTowardsOld(Actor *actor, byte trap1, byte trap2, byte final_trap, ScummPoint gateLoc[5]) {
ScummPoint pt;
ScummPoint gateA[2];
ScummPoint gateB[2];
@@ -1054,8 +1026,7 @@ void Scumm::findPathTowardsOld(Actor *actor, byte trap1, byte trap2, byte final_
return;
}
-void Scumm::getGates(int trap1, int trap2, ScummPoint gateA[2], ScummPoint gateB[2])
-{
+void Scumm::getGates(int trap1, int trap2, ScummPoint gateA[2], ScummPoint gateB[2]) {
int i, j;
int dist[8];
int minDist[3];
@@ -1161,7 +1132,6 @@ void Scumm::getGates(int trap1, int trap2, ScummPoint gateA[2], ScummPoint gateB
}
}
-bool Scumm::compareSlope(int X1, int Y1, int X2, int Y2, int X3, int Y3)
-{
+bool Scumm::compareSlope(int X1, int Y1, int X2, int Y2, int X3, int Y3) {
return (Y2 - Y1) * (X3 - X1) <= (Y3 - Y1) * (X2 - X1);
}
diff --git a/scumm/bundle.cpp b/scumm/bundle.cpp
index c7c6040297..140381a190 100644
--- a/scumm/bundle.cpp
+++ b/scumm/bundle.cpp
@@ -90,8 +90,7 @@ byte imxShortTable[] = {
0, 0, 1, 3, 7, 15, 31, 63
};
-Bundle::Bundle()
-{
+Bundle::Bundle() {
_lastSong = -1;
_initializedImcTables = false;
@@ -99,16 +98,14 @@ Bundle::Bundle()
_bundleMusicTable = NULL;
}
-Bundle::~Bundle()
-{
+Bundle::~Bundle() {
if (_bundleVoiceTable)
free(_bundleVoiceTable);
if (_bundleMusicTable)
free(_bundleMusicTable);
}
-void Bundle::initializeImcTables()
-{
+void Bundle::initializeImcTables() {
if (_initializedImcTables == true)
return;
@@ -157,8 +154,7 @@ void Bundle::initializeImcTables()
_initializedImcTables = true;
}
-bool Bundle::openVoiceFile(const char *filename, const char *directory)
-{
+bool Bundle::openVoiceFile(const char *filename, const char *directory) {
int32 tag, offset;
initializeImcTables();
@@ -200,8 +196,7 @@ bool Bundle::openVoiceFile(const char *filename, const char *directory)
return true;
}
-bool Bundle::openMusicFile(const char *filename, const char *directory)
-{
+bool Bundle::openMusicFile(const char *filename, const char *directory) {
int32 tag, offset;
initializeImcTables();
@@ -243,8 +238,7 @@ bool Bundle::openMusicFile(const char *filename, const char *directory)
return true;
}
-int32 Bundle::decompressVoiceSampleByIndex(int32 index, byte *comp_final)
-{
+int32 Bundle::decompressVoiceSampleByIndex(int32 index, byte *comp_final) {
int32 i, tag, num, final_size, output_size;
byte *comp_input, *comp_output;
@@ -297,8 +291,7 @@ int32 Bundle::decompressVoiceSampleByIndex(int32 index, byte *comp_final)
return final_size;
}
-int32 Bundle::decompressMusicSampleByIndex(int32 index, int32 number, byte *comp_final)
-{
+int32 Bundle::decompressMusicSampleByIndex(int32 index, int32 number, byte *comp_final) {
int32 i = 0;
int tag, num, final_size;
byte *comp_input;
@@ -346,8 +339,7 @@ int32 Bundle::decompressMusicSampleByIndex(int32 index, int32 number, byte *comp
return final_size;
}
-int32 Bundle::decompressVoiceSampleByName(char *name, byte *comp_final)
-{
+int32 Bundle::decompressVoiceSampleByName(char *name, byte *comp_final) {
int32 final_size = 0, i;
if (_voiceFile.isOpen() == false) {
@@ -388,8 +380,7 @@ int32 Bundle::decompressMusicSampleByName(char *name, int32 number, byte *comp_f
return final_size;
}
-int32 Bundle::getNumberOfMusicSamplesByIndex(int32 index)
-{
+int32 Bundle::getNumberOfMusicSamplesByIndex(int32 index) {
if (_musicFile.isOpen() == false) {
warning("Bundle: music file is not open!");
return 0;
@@ -400,8 +391,7 @@ int32 Bundle::getNumberOfMusicSamplesByIndex(int32 index)
return _musicFile.readUint32BE();
}
-int32 Bundle::getNumberOfMusicSamplesByName(char *name)
-{
+int32 Bundle::getNumberOfMusicSamplesByName(char *name) {
int32 number = 0, i;
if (_musicFile.isOpen() == false) {
@@ -419,10 +409,14 @@ int32 Bundle::getNumberOfMusicSamplesByName(char *name)
return number;
}
-#define NextBit bit = mask & 1; mask >>= 1; if (!--bitsleft) {mask = READ_LE_UINT16(srcptr); srcptr += 2; bitsleft=16;}
+#define NextBit bit = mask & 1; mask >>= 1; \
+ if (!--bitsleft) { \
+ mask = READ_LE_UINT16(srcptr); \
+ srcptr += 2; \
+ bitsleft = 16; \
+ }
-int32 Bundle::compDecode(byte *src, byte *dst)
-{
+int32 Bundle::compDecode(byte *src, byte *dst) {
byte *result, *srcptr = src, *dstptr = dst;
int data, size, bit, bitsleft = 16, mask = READ_LE_UINT16(srcptr);
srcptr += 2;
@@ -454,8 +448,7 @@ int32 Bundle::compDecode(byte *src, byte *dst)
}
#undef NextBit
-int32 Bundle::decompressCodec(int32 codec, byte *comp_input, byte *comp_output, int32 input_size)
-{
+int32 Bundle::decompressCodec(int32 codec, byte *comp_input, byte *comp_output, int32 input_size) {
int32 output_size, channels;
int32 offset1, offset2, offset3, length, k, c, s, j, r, t, z;
byte *src, *t_table, *p, *ptr;
diff --git a/scumm/charset.cpp b/scumm/charset.cpp
index 89e09f6f74..c3f1ccf2c4 100644
--- a/scumm/charset.cpp
+++ b/scumm/charset.cpp
@@ -23,8 +23,7 @@
#include "scumm.h"
#include "nut_renderer.h"
-void CharsetRendererCommon::setCurID(byte id)
-{
+void CharsetRendererCommon::setCurID(byte id) {
_vm->checkRange(_vm->_maxCharsets - 1, 0, _curId, "Printing with bad charset %d");
_curId = id;
@@ -38,8 +37,7 @@ void CharsetRendererCommon::setCurID(byte id)
}
// do spacing for variable width old-style font
-int CharsetRendererClassic::getCharWidth(byte chr)
-{
+int CharsetRendererClassic::getCharWidth(byte chr) {
int spacing = 0;
int offs = READ_LE_UINT32(_fontPtr + chr * 4 + 4);
@@ -55,10 +53,9 @@ int CharsetRendererClassic::getCharWidth(byte chr)
return spacing;
}
-int CharsetRendererOld256::getCharWidth(byte chr)
-{
+int CharsetRendererOld256::getCharWidth(byte chr) {
int spacing = 0;
-
+
spacing = *(_fontPtr - 11 + chr);
// FIXME - this fixes the inventory icons in Zak256/Indy3
@@ -67,12 +64,11 @@ int CharsetRendererOld256::getCharWidth(byte chr)
if ((_vm->_gameId == GID_ZAK256 || _vm->_gameId == GID_INDY3_256)
&& (chr >= 1 && chr <= 4))
spacing = 6;
-
+
return spacing;
}
-int CharsetRenderer::getStringWidth(int arg, byte *text)
-{
+int CharsetRenderer::getStringWidth(int arg, byte *text) {
int pos = 0;
int width = 1;
byte chr;
@@ -115,8 +111,7 @@ int CharsetRenderer::getStringWidth(int arg, byte *text)
return width;
}
-void CharsetRenderer::addLinebreaks(int a, byte *str, int pos, int maxwidth)
-{
+void CharsetRenderer::addLinebreaks(int a, byte *str, int pos, int maxwidth) {
int lastspace = -1;
int curw = 1;
byte chr;
@@ -176,8 +171,8 @@ void CharsetRenderer::addLinebreaks(int a, byte *str, int pos, int maxwidth)
}
-void CharsetRendererOld256::printChar(int chr)
-{ // Indy3 / Zak256
+void CharsetRendererOld256::printChar(int chr) {
+ // Indy3 / Zak256
VirtScreen *vs;
byte *char_ptr, *dest_ptr;
unsigned int buffer = 0, mask = 0, x = 0, y = 0;
@@ -222,12 +217,9 @@ void CharsetRendererOld256::printChar(int chr)
if (_top + 8 > _strBottom)
_strBottom = _top + 8;
-
}
-
-void CharsetRendererClassic::printChar(int chr)
-{
+void CharsetRendererClassic::printChar(int chr) {
int width, height;
int offsX, offsY;
int d;
@@ -342,8 +334,7 @@ void CharsetRendererClassic::printChar(int chr)
_top -= offsY;
}
-void CharsetRendererClassic::drawBits(VirtScreen *vs, byte *dst, byte *mask, int drawTop, int width, int height)
-{
+void CharsetRendererClassic::drawBits(VirtScreen *vs, byte *dst, byte *mask, int drawTop, int width, int height) {
byte maskmask;
int y, x;
int maskpos;
@@ -391,8 +382,7 @@ void CharsetRendererClassic::drawBits(VirtScreen *vs, byte *dst, byte *mask, int
}
CharsetRendererNut::CharsetRendererNut(Scumm *vm)
- : CharsetRenderer(vm)
-{
+ : CharsetRenderer(vm) {
_current = 0;
for (int i = 0; i < 5; i++) {
@@ -406,37 +396,31 @@ CharsetRendererNut::CharsetRendererNut(Scumm *vm)
}
}
-CharsetRendererNut::~CharsetRendererNut()
-{
+CharsetRendererNut::~CharsetRendererNut() {
for (int i = 0; i < 5; i++)
delete _fr[i];
}
-void CharsetRendererNut::setCurID(byte id)
-{
+void CharsetRendererNut::setCurID(byte id) {
assert(id < 5);
_curId = id;
_current = _fr[id];
assert(_current);
}
-int CharsetRendererNut::getCharWidth(byte chr)
-{
+int CharsetRendererNut::getCharWidth(byte chr) {
assert(_current);
return _current->getCharWidth(chr);
}
-int CharsetRendererNut::getFontHeight()
-{
+int CharsetRendererNut::getFontHeight() {
// FIXME / TODO: how to implement this properly???
assert(_current);
return _current->getCharHeight('|');
}
-void CharsetRendererNut::printChar(int chr)
-{
+void CharsetRendererNut::printChar(int chr) {
assert(_current);
-
if (chr == '@')
return;
diff --git a/scumm/charset.h b/scumm/charset.h
index 3116f02572..3618e113a8 100644
--- a/scumm/charset.h
+++ b/scumm/charset.h
@@ -66,7 +66,6 @@ public:
virtual int getFontHeight() = 0;
};
-
class CharsetRendererCommon : public CharsetRenderer {
protected:
byte *_fontPtr;
@@ -93,7 +92,6 @@ public:
void printChar(int chr);
};
-
class CharsetRendererOld256 : public CharsetRendererCommon {
protected:
int getCharWidth(byte chr);
diff --git a/scumm/costume.cpp b/scumm/costume.cpp
index 5ebcba3562..6ba7635c06 100644
--- a/scumm/costume.cpp
+++ b/scumm/costume.cpp
@@ -28,8 +28,7 @@
const byte revBitMask[8] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 };
-void CostumeRenderer::ignorePakCols(int a)
-{
+void CostumeRenderer::ignorePakCols(int a) {
int n;
n = _height;
@@ -78,8 +77,7 @@ const byte cost_scaleTable[256] = {
238, 30, 158, 94, 222, 62, 190, 126, 254
};
-byte CostumeRenderer::mainRoutine(int slot, int frame)
-{
+byte CostumeRenderer::mainRoutine(int slot, int frame) {
int xmove, ymove, i, b, s;
uint scal;
byte scaling;
@@ -297,9 +295,9 @@ byte CostumeRenderer::mainRoutine(int slot, int frame)
else
masking =
_vm->isMaskActiveAt(_left, _top, _right, _bottom,
- _vm->getResourceAddress(rtBuffer, 9) +
- _vm->gdi._imgBufOffs[_zbuf] +
- _vm->_screenStartStrip);
+ _vm->getResourceAddress(rtBuffer, 9) +
+ _vm->gdi._imgBufOffs[_zbuf] +
+ _vm->_screenStartStrip);
if (masking || charsetmask) {
_mask_ptr = _vm->getResourceAddress(rtBuffer, 9) + _ypos * _numStrips + _vm->_screenStartStrip;
@@ -362,8 +360,7 @@ byte CostumeRenderer::mainRoutine(int slot, int frame)
return b;
}
-void CostumeRenderer::proc6()
-{
+void CostumeRenderer::proc6() {
byte *src, *dst;
byte len, height, pcolor, width;
uint y;
@@ -412,8 +409,7 @@ void CostumeRenderer::proc6()
} while (1);
}
-void CostumeRenderer::proc5()
-{
+void CostumeRenderer::proc5() {
byte *mask, *src, *dst;
byte maskbit, len, height, pcolor;
uint y, scrheight;
@@ -475,8 +471,7 @@ void CostumeRenderer::proc5()
} while (1);
}
-void CostumeRenderer::proc4()
-{
+void CostumeRenderer::proc4() {
byte *mask, *src, *dst;
byte maskbit, len, height, pcolor;
uint y, scrheight;
@@ -538,8 +533,7 @@ void CostumeRenderer::proc4()
} while (1);
}
-void CostumeRenderer::proc3()
-{
+void CostumeRenderer::proc3() {
byte *mask, *src, *dst;
byte maskbit, len, height, pcolor, width;
int color, t;
@@ -600,8 +594,7 @@ void CostumeRenderer::proc3()
} while (1);
}
-void CostumeRenderer::proc2()
-{
+void CostumeRenderer::proc2() {
byte *mask, *src, *dst;
byte maskbit, len, height, pcolor, width;
int color, t;
@@ -662,8 +655,7 @@ void CostumeRenderer::proc2()
} while (1);
}
-void CostumeRenderer::proc1()
-{
+void CostumeRenderer::proc1() {
byte *mask, *src, *dst, *dstorg;
byte maskbit, len, height, pcolor, width;
int color, t;
@@ -721,8 +713,7 @@ void CostumeRenderer::proc1()
} while (1);
}
-void CostumeRenderer::proc6_ami()
-{
+void CostumeRenderer::proc6_ami() {
byte len;
byte *src, *dst;
byte width, height, pcolor;
@@ -772,8 +763,7 @@ void CostumeRenderer::proc6_ami()
} while (1);
}
-void CostumeRenderer::proc5_ami()
-{
+void CostumeRenderer::proc5_ami() {
byte *mask, *src, *dst;
byte maskbit, len, width, height, pcolor;
uint y, scrheight;
@@ -838,8 +828,7 @@ void CostumeRenderer::proc5_ami()
} while (1);
}
-void CostumeRenderer::proc4_ami()
-{
+void CostumeRenderer::proc4_ami() {
byte *mask, *src, *dst;
byte maskbit, len, width, height, pcolor;
uint y, scrheight;
@@ -902,8 +891,7 @@ void CostumeRenderer::proc4_ami()
} while (1);
}
-void CostumeRenderer::proc3_ami()
-{
+void CostumeRenderer::proc3_ami() {
byte *mask, *src, *dst;
byte maskbit, len, height, pcolor, width;
int color, t;
@@ -966,8 +954,7 @@ void CostumeRenderer::proc3_ami()
} while (1);
}
-void CostumeRenderer::proc2_ami()
-{
+void CostumeRenderer::proc2_ami() {
byte *mask, *src, *dst;
byte maskbit, len, height, pcolor, width;
int color, t;
@@ -1031,8 +1018,7 @@ void CostumeRenderer::proc2_ami()
} while (1);
}
-void CostumeRenderer::proc1_ami()
-{
+void CostumeRenderer::proc1_ami() {
byte *mask, *src, *dst;
byte maskbit, len, height, pcolor, width;
uint y;
@@ -1096,8 +1082,7 @@ void CostumeRenderer::proc1_ami()
} while (1);
}
-void CostumeRenderer::proc_special(byte mask2)
-{
+void CostumeRenderer::proc_special(byte mask2) {
byte *mask, *src, *dst, *dstorg;
byte maskbit, len, height, pcolor, width;
uint y;
@@ -1194,11 +1179,9 @@ void CostumeRenderer::proc_special(byte mask2)
StartPos:;
} while (--len);
} while (1);
-
}
-void LoadedCostume::loadCostume(int id)
-{
+void LoadedCostume::loadCostume(int id) {
_ptr = _vm->getResourceAddress(rtCostume, id);
if (_vm->_features & GF_AFTER_V6) {
@@ -1227,8 +1210,7 @@ void LoadedCostume::loadCostume(int id)
_dataptr = _ptr + READ_LE_UINT16(_ptr + _numColors + 8);
}
-byte CostumeRenderer::drawLimb(const CostumeData &cost, int limb)
-{
+byte CostumeRenderer::drawLimb(const CostumeData &cost, int limb) {
int i;
int code;
@@ -1252,13 +1234,11 @@ byte CostumeRenderer::drawLimb(const CostumeData &cost, int limb)
}
-int Scumm::cost_frameToAnim(Actor *a, int frame)
-{
+int Scumm::cost_frameToAnim(Actor *a, int frame) {
return newDirToOldDir(a->facing) + frame * 4;
}
-void Scumm::cost_decodeData(Actor *a, int frame, uint usemask)
-{
+void Scumm::cost_decodeData(Actor *a, int frame, uint usemask) {
byte *p, *r;
uint mask, j;
int i;
@@ -1332,8 +1312,7 @@ void Scumm::cost_decodeData(Actor *a, int frame, uint usemask)
} while ((uint16)mask);
}
-void CostumeRenderer::setPalette(byte *palette)
-{
+void CostumeRenderer::setPalette(byte *palette) {
int i;
byte color;
@@ -1349,18 +1328,15 @@ void CostumeRenderer::setPalette(byte *palette)
}
}
-void CostumeRenderer::setFacing(Actor *a)
-{
+void CostumeRenderer::setFacing(Actor *a) {
_mirror = newDirToOldDir(a->facing) != 0 || (_loaded._ptr[7] & 0x80);
}
-void CostumeRenderer::setCostume(int costume)
-{
+void CostumeRenderer::setCostume(int costume) {
_loaded.loadCostume(costume);
}
-byte LoadedCostume::increaseAnims(Actor *a)
-{
+byte LoadedCostume::increaseAnims(Actor *a) {
int i;
byte r = 0;
@@ -1371,8 +1347,7 @@ byte LoadedCostume::increaseAnims(Actor *a)
return r;
}
-byte LoadedCostume::increaseAnim(Actor *a, int slot)
-{
+byte LoadedCostume::increaseAnim(Actor *a, int slot) {
int highflag;
int i, end;
byte code, nc;
@@ -1420,8 +1395,7 @@ byte LoadedCostume::increaseAnim(Actor *a, int slot)
} while (1);
}
-bool Scumm::isCostumeInUse(int cost)
-{
+bool Scumm::isCostumeInUse(int cost) {
int i;
Actor *a;
diff --git a/scumm/costume.h b/scumm/costume.h
index dd048d7f95..a15d870740 100644
--- a/scumm/costume.h
+++ b/scumm/costume.h
@@ -41,7 +41,6 @@ protected:
byte increaseAnim(Actor *a, int slot);
};
-
class CostumeRenderer : public BaseCostumeRenderer {
public:
uint _outheight;
diff --git a/scumm/debugger.cpp b/scumm/debugger.cpp
index 66735e6ff8..6164b27644 100644
--- a/scumm/debugger.cpp
+++ b/scumm/debugger.cpp
@@ -19,8 +19,7 @@
extern uint16 _debugLevel;
-ScummDebugger::ScummDebugger()
-{
+ScummDebugger::ScummDebugger() {
_s = 0;
_frame_countdown = 0;
_dvar_count = 0;
@@ -29,8 +28,7 @@ ScummDebugger::ScummDebugger()
}
// Initialisation Functions
-void ScummDebugger::attach(Scumm *s)
-{
+void ScummDebugger::attach(Scumm *s) {
if (_s)
detach();
@@ -72,8 +70,7 @@ void ScummDebugger::attach(Scumm *s)
}
}
-void ScummDebugger::detach()
-{
+void ScummDebugger::detach() {
#ifdef USE_CONSOLE
if (_s->_debuggerDialog)
_s->_debuggerDialog->setInputeCallback(0, 0);
@@ -84,7 +81,6 @@ void ScummDebugger::detach()
_detach_now = false;
}
-
// Temporary execution handler
void ScummDebugger::on_frame() {
if (_frame_countdown == 0)
@@ -108,8 +104,7 @@ void ScummDebugger::on_frame() {
// Console handler
#ifdef USE_CONSOLE
-bool ScummDebugger::debuggerInputCallback(ConsoleDialog *console, const char *input, void *refCon)
-{
+bool ScummDebugger::debuggerInputCallback(ConsoleDialog *console, const char *input, void *refCon) {
ScummDebugger *debugger = (ScummDebugger *)refCon;
return debugger->RunCommand((char*)input);
@@ -139,8 +134,7 @@ void ScummDebugger::DCmd_Register(const char *cmdname, DebugProc pointer) {
}
// Main Debugger Loop
-void ScummDebugger::enter()
-{
+void ScummDebugger::enter() {
#ifdef USE_CONSOLE
if (!_s->_debuggerDialog) {
_s->_debuggerDialog = new ConsoleDialog(_s->_newgui, _s->_realWidth);
@@ -396,23 +390,24 @@ bool ScummDebugger::Cmd_Object(int argc, const char **argv) {
if (!strcmp(argv[2], "pickup")) {
for (i = 1; i < _s->_maxInventoryItems; i++) {
- if (_s->_inventory[i] == (uint16)obj) {
- _s->putOwner(obj, _s->_vars[_s->VAR_EGO]);
- _s->runHook(obj);
- return true;
- }
- }
-
+ if (_s->_inventory[i] == (uint16)obj) {
+ _s->putOwner(obj, _s->_vars[_s->VAR_EGO]);
+ _s->runHook(obj);
+ return true;
+ }
+ }
+
if (argc == 3)
- _s->addObjectToInventory(obj, _s->_currentRoom);
+ _s->addObjectToInventory(obj, _s->_currentRoom);
else
- _s->addObjectToInventory(obj, atoi(argv[3]));
- _s->putOwner(obj, _s->_vars[_s->VAR_EGO]);
- _s->putClass(obj, 32, 1);
- _s->putState(obj, 1);
- _s->removeObjectFromRoom(obj);
- _s->clearDrawObjectQueue();
- _s->runHook(obj);
+ _s->addObjectToInventory(obj, atoi(argv[3]));
+
+ _s->putOwner(obj, _s->_vars[_s->VAR_EGO]);
+ _s->putClass(obj, 32, 1);
+ _s->putState(obj, 1);
+ _s->removeObjectFromRoom(obj);
+ _s->clearDrawObjectQueue();
+ _s->runHook(obj);
} else {
Debug_Printf("Unknown object command '%s'\n", argv[2]);
}
@@ -459,7 +454,6 @@ bool ScummDebugger::Cmd_Help(int argc, const char **argv) {
}
bool ScummDebugger::Cmd_DebugLevel(int argc, const char **argv) {
-
if (argc == 1) {
if (_s->_debugMode == false)
Debug_Printf("Debugging is not enabled at this time\n");
@@ -503,19 +497,18 @@ bool ScummDebugger::Cmd_PrintBox(int argc, const char **argv) {
return true;
}
-void ScummDebugger::printBox(int box)
-{
+void ScummDebugger::printBox(int box) {
BoxCoords coords;
int flags = _s->getBoxFlags(box);
int mask = _s->getMaskFromBox(box);
int scale = _s->getBoxScale(box);
_s->getBoxCoordinates(box, &coords);
-
+
// Print out coords, flags, zbuffer mask
Debug_Printf("%d: [%d x %d] [%d x %d] [%d x %d] [%d x %d], flags=0x%02x, mask=%d, scale=%d\n",
- box,
- coords.ul.x, coords.ul.y, coords.ll.x, coords.ll.y,
- coords.ur.x, coords.ur.y, coords.lr.x, coords.lr.y,
- flags, mask, scale);
+ box,
+ coords.ul.x, coords.ul.y, coords.ll.x, coords.ll.y,
+ coords.ur.x, coords.ur.y, coords.lr.x, coords.lr.y,
+ flags, mask, scale);
}
diff --git a/scumm/debugrl.cpp b/scumm/debugrl.cpp
index 8c9366a2f4..02cbb59d07 100644
--- a/scumm/debugrl.cpp
+++ b/scumm/debugrl.cpp
@@ -1,3 +1,23 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2002/2003 The ScummVM project
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Header$
+ */
+
#ifdef HAVE_READLINE
#include "debugrl.h"
@@ -14,13 +34,11 @@ char *_debugger_commands[] = {
(char *)NULL
};
-
// forwards decls
char **scumm_debugger_completion(const char *text, int start, int end);
char *scumm_debugger_command_generator(const char *text, int state);
-void initialize_readline()
-{
+void initialize_readline() {
/* Allow conditional parsing of the ~/.inputrc file. */
rl_readline_name = "scummvm";
@@ -28,11 +46,8 @@ void initialize_readline()
rl_attempted_completion_function = scumm_debugger_completion;
}
-char **scumm_debugger_completion(const char *text, int start, int end)
-{
-
+char **scumm_debugger_completion(const char *text, int start, int end) {
char **matches;
-
matches = (char **)NULL;
// If this word is at the start of the line, then it is a command
@@ -53,13 +68,10 @@ char **scumm_debugger_completion(const char *text, int start, int end)
return (matches);
}
-
/* Generator function for command completion. STATE lets us know whether
to start from scratch; without any state (i.e. STATE == 0), then we
start at the top of the list. */
-char *scumm_debugger_command_generator(const char *text, int state)
-{
-
+char *scumm_debugger_command_generator(const char *text, int state) {
static int list_index, len;
char *name;
diff --git a/scumm/dialogs.cpp b/scumm/dialogs.cpp
index b5dd57f234..8a09106438 100644
--- a/scumm/dialogs.cpp
+++ b/scumm/dialogs.cpp
@@ -85,14 +85,14 @@ static ResString string_map_table_v7[] = {
{96, "game name and version"}, //that's how it's supposed to be
{77, "Select a game to LOAD"},
{76, "Name your SAVE game"},
- {70, "save"}, //boot8
+ {70, "save"}, //boot8
{71, "load"}, //boot9
{72, "play"}, //boot10
{73, "cancel"}, //boot11
{74, "quit"}, //boot12
{75, "ok"}, //boot13
{85, "game paused"}, // boot3
-
+
/* this is the almost complete string map for v7
{63, "how may I serve you?"},
{64, "the dig v1.0"}, //(game name/version)
@@ -158,15 +158,13 @@ static ResString string_map_table_v5[] = {
#pragma mark -
-void ScummDialog::addResText(int x, int y, int w, int h, int resID)
-{
+void ScummDialog::addResText(int x, int y, int w, int h, int resID) {
// Get the string
new StaticTextWidget(this, x, y, w, h, queryResString(resID), kTextAlignCenter);
}
-const ScummVM::String ScummDialog::queryResString(int stringno)
-{
+const ScummVM::String ScummDialog::queryResString(int stringno) {
char *result;
int string;
@@ -184,7 +182,7 @@ const ScummVM::String ScummDialog::queryResString(int stringno)
if (result && *result == '/') {
byte tmp[256];
_scumm->translateText((byte *)result, tmp);
- strcpy(result, (char*)tmp);
+ strcpy(result, (char *)tmp);
}
if (!result || *result == '\0') { // Gracelessly degrade to english :)
@@ -234,7 +232,7 @@ const ScummVM::String ScummDialog::queryResString(int stringno)
for (i = 1; i < _scumm->_maxVerbs; i++) {
if (value == _scumm->_verbs[i].verbid && !_scumm->_verbs[i].type && !_scumm->_verbs[i].saveid) {
- char* verb = (char*)_scumm->getResourceAddress(rtVerb, i);
+ char *verb = (char *)_scumm->getResourceAddress(rtVerb, i);
if (verb) {
tmp += verb;
}
@@ -250,7 +248,7 @@ const ScummVM::String ScummDialog::queryResString(int stringno)
if (!value)
break;
- char* name = (char*)_scumm->getObjOrActorName(value);
+ char *name = (char *)_scumm->getObjOrActorName(value);
if (name) {
tmp += name;
}
@@ -263,7 +261,7 @@ const ScummVM::String ScummDialog::queryResString(int stringno)
value = _scumm->readVar(value);
if (value) {
- char *str = (char*)_scumm->getStringAddress(value);
+ char *str = (char *)_scumm->getStringAddress(value);
if (str) {
tmp += str;
}
@@ -290,12 +288,10 @@ const ScummVM::String ScummDialog::queryResString(int stringno)
return tmp;
}
-const char *ScummDialog::queryCustomString(int stringno)
-{
+const char *ScummDialog::queryCustomString(int stringno) {
return string_map_table_custom[stringno];
}
-
#pragma mark -
enum {
@@ -307,26 +303,24 @@ enum {
};
SaveLoadDialog::SaveLoadDialog(NewGui *gui, Scumm *scumm)
- : ScummDialog(gui, scumm, 30, 18, 260, 162)
-{
+ : ScummDialog(gui, scumm, 30, 18, 260, 162) {
const int x = 196;
// The headline
addResText(0, 7, 260, 16, 1);
-
+
// The five buttons on the side
_saveButton = addPushButton(x, 20, queryResString(4), kSaveCmd, 'S');
_loadButton = addPushButton(x, 40, queryResString(5), kLoadCmd, 'L');
addButton(x, 60, queryResString(6), kPlayCmd, 'P'); // Play
addButton(x, 80, queryCustomString(17), kOptionsCmd, 'O'); // Options
addButton(x, 100, queryResString(8), kQuitCmd, 'Q'); // Quit
-
+
// The save game list
_savegameList = new ListWidget(this, 8, 20, 182, 134);
}
-void SaveLoadDialog::open()
-{
+void SaveLoadDialog::open() {
switchToLoadMode();
#ifdef _WIN32_WCE
@@ -336,8 +330,7 @@ void SaveLoadDialog::open()
ScummDialog::open();
}
-void SaveLoadDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data)
-{
+void SaveLoadDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
switch (cmd) {
case kSaveCmd:
if (!_saveMode) {
@@ -392,16 +385,14 @@ void SaveLoadDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
}
void SaveLoadDialog::close() {
-
- ScummDialog::close();
+ ScummDialog::close();
#ifdef _WIN32_WCE
force_keyboard(false);
#endif
}
-void SaveLoadDialog::fillList()
-{
+void SaveLoadDialog::fillList() {
// Get savegame names
ScummVM::StringList l;
char name[32];
@@ -424,22 +415,19 @@ void SaveLoadDialog::fillList()
_savegameList->setNumberingMode(_saveMode ? kListNumberingOne : kListNumberingZero);
}
-void SaveLoadDialog::save()
-{
+void SaveLoadDialog::save() {
// Save the selected item
_scumm->requestSave(_savegameList->getSelected() + 1, _savegameList->getSelectedString().c_str());
close();
}
-void SaveLoadDialog::load()
-{
+void SaveLoadDialog::load() {
// Load the selected item
_scumm->requestLoad(_savegameList->getSelected());
close();
}
-void SaveLoadDialog::switchToSaveMode()
-{
+void SaveLoadDialog::switchToSaveMode() {
_saveMode = true;
_saveButton->setState(true);
_loadButton->setState(false);
@@ -450,8 +438,7 @@ void SaveLoadDialog::switchToSaveMode()
draw();
}
-void SaveLoadDialog::switchToLoadMode()
-{
+void SaveLoadDialog::switchToLoadMode() {
_saveMode = false;
_saveButton->setState(false);
_loadButton->setState(true);
@@ -462,10 +449,8 @@ void SaveLoadDialog::switchToLoadMode()
draw();
}
-
#pragma mark -
-
enum {
kMasterVolumeChanged = 'mavc',
kMusicVolumeChanged = 'muvc',
@@ -480,8 +465,7 @@ enum {
};
OptionsDialog::OptionsDialog(NewGui *gui, Scumm *scumm)
- : ScummDialog(gui, scumm, 40, 30, 240, 124)
-{
+ : ScummDialog(gui, scumm, 40, 30, 240, 124) {
//
// Add the buttons
//
@@ -493,7 +477,6 @@ OptionsDialog::OptionsDialog(NewGui *gui, Scumm *scumm)
addButton(kButtonWidth+12, _h-24, "Keys", kKeysCmd, 'K');
#endif
-
//
// Sound controllers
//
@@ -523,7 +506,6 @@ OptionsDialog::OptionsDialog(NewGui *gui, Scumm *scumm)
subtitlesCheckbox = new CheckboxWidget(this, 15, 62, 200, 16, "Show subtitles", 0, 'S');
amigaPalCheckbox = new CheckboxWidget(this, 15, 80, 200, 16, "Amiga palette conversion", 0, 'P');
-
//
// Finally create the sub dialogs
//
@@ -533,16 +515,14 @@ OptionsDialog::OptionsDialog(NewGui *gui, Scumm *scumm)
#endif
}
-OptionsDialog::~OptionsDialog()
-{
+OptionsDialog::~OptionsDialog() {
delete _aboutDialog;
#ifdef _WIN32_WCE
delete _keysDialog;
#endif
}
-void OptionsDialog::open()
-{
+void OptionsDialog::open() {
ScummDialog::open();
// display current sound settings
@@ -563,8 +543,7 @@ void OptionsDialog::open()
amigaPalCheckbox->setState((_scumm->_features & GF_AMIGA) != 0);
}
-void OptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data)
-{
+void OptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
switch (cmd) {
case kKeysCmd:
#ifdef _WIN32_WCE
@@ -632,8 +611,7 @@ void OptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data
#pragma mark -
AboutDialog::AboutDialog(NewGui *gui, Scumm *scumm)
- : ScummDialog(gui, scumm, 30, 20, 260, 124)
-{
+ : ScummDialog(gui, scumm, 30, 20, 260, 124) {
addButton(110, 100, queryCustomString(23), kCloseCmd, 'C'); // Close dialog - FIXME
new StaticTextWidget(this, 10, 10, 240, 16, "ScummVM " SCUMMVM_VERSION " (" SCUMMVM_CVS ")", kTextAlignCenter);
new StaticTextWidget(this, 10, 30, 240, 16, "http://www.scummvm.org", kTextAlignCenter);
@@ -645,21 +623,18 @@ AboutDialog::AboutDialog(NewGui *gui, Scumm *scumm)
#pragma mark -
InfoDialog::InfoDialog(NewGui *gui, Scumm *scumm, int res)
- : ScummDialog(gui, scumm, 0, 80, 0, 16) // dummy x and w
-{
+: ScummDialog(gui, scumm, 0, 80, 0, 16) { // dummy x and w
setInfoText(queryResString (res));
}
InfoDialog::InfoDialog(NewGui *gui, Scumm *scumm, const String& message)
- : ScummDialog(gui, scumm, 0, 80, 0, 16) // dummy x and w
-{
+: ScummDialog(gui, scumm, 0, 80, 0, 16) { // dummy x and w
setInfoText(message);
}
-void InfoDialog::setInfoText(const String& message)
-{
+void InfoDialog::setInfoText(const String& message) {
int width = _gui->getStringWidth(message.c_str()) + 16;
-
+
_x = (_scumm->_realWidth - width) >> 1;
_w = width;
@@ -669,8 +644,7 @@ void InfoDialog::setInfoText(const String& message)
#pragma mark -
PauseDialog::PauseDialog(NewGui *gui, Scumm *scumm)
- : InfoDialog(gui, scumm, 10)
-{
+ : InfoDialog(gui, scumm, 10) {
}
#ifdef _WIN32_WCE
@@ -683,18 +657,17 @@ enum {
KeysDialog::KeysDialog(NewGui *gui, Scumm *scumm)
- : ScummDialog(gui, scumm, 30, 20, 260, 160)
-{
+ : ScummDialog(gui, scumm, 30, 20, 260, 160) {
addButton(200, 20, queryCustomString(24), kMapCmd, 'M'); // Map
addButton(200, 40, "OK", kOKCmd, 'O'); // OK
addButton(200, 60, "Cancel", kCancelCmd, 'C'); // Cancel
-
+
_actionsList = new ListWidget(this, 10, 20, 180, 90);
_actionsList->setNumberingMode(kListNumberingZero);
_actionTitle = new StaticTextWidget(this, 10, 120, 240, 16, queryCustomString(25), kTextAlignCenter);
_keyMapping = new StaticTextWidget(this, 10, 140, 240, 16, "", kTextAlignCenter);
-
+
_actionTitle->setFlags(WIDGET_CLEARBG);
_keyMapping->setFlags(WIDGET_CLEARBG);
@@ -711,7 +684,6 @@ KeysDialog::KeysDialog(NewGui *gui, Scumm *scumm)
}
void KeysDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
-
switch(cmd) {
case kListSelectionChangedCmd:
diff --git a/scumm/dialogs.h b/scumm/dialogs.h
index 4232d514c7..cb2711aed1 100644
--- a/scumm/dialogs.h
+++ b/scumm/dialogs.h
@@ -56,11 +56,11 @@ public:
protected:
ListWidget *_savegameList;
-
+
PushButtonWidget *_saveButton;
PushButtonWidget *_loadButton;
- bool _saveMode;
+ bool _saveMode;
void fillList();
void save();
@@ -69,13 +69,11 @@ protected:
void switchToLoadMode();
};
-
class AboutDialog : public ScummDialog {
public:
AboutDialog(NewGui *gui, Scumm *scumm);
};
-
class OptionsDialog : public ScummDialog {
protected:
Dialog *_aboutDialog;
@@ -88,11 +86,10 @@ public:
~OptionsDialog();
virtual void open();
-
virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
protected:
-
+
int _soundVolumeMaster;
int _soundVolumeMusic;
int _soundVolumeSfx;
@@ -100,7 +97,7 @@ protected:
SliderWidget *masterVolumeSlider;
SliderWidget *musicVolumeSlider;
SliderWidget *sfxVolumeSlider;
-
+
StaticTextWidget *masterVolumeLabel;
StaticTextWidget *musicVolumeLabel;
StaticTextWidget *sfxVolumeLabel;
@@ -116,13 +113,14 @@ public:
// from resources
InfoDialog(NewGui *gui, Scumm *scumm, int res);
- virtual void handleMouseDown(int x, int y, int button, int clickCount)
- { close(); }
- virtual void handleKeyDown(uint16 ascii, int keycode, int modifiers)
- {
- setResult(ascii);
- close();
- }
+ virtual void handleMouseDown(int x, int y, int button, int clickCount) {
+ close();
+ }
+ virtual void handleKeyDown(uint16 ascii, int keycode, int modifiers) {
+ setResult(ascii);
+ close();
+ }
+
protected:
void setInfoText (const String& message);
};
diff --git a/scumm/gfx.cpp b/scumm/gfx.cpp
index b51a714298..18df1fd5c8 100644
--- a/scumm/gfx.cpp
+++ b/scumm/gfx.cpp
@@ -182,13 +182,11 @@ static const byte default_cursor_hotspots[8] = {
};
-static inline uint colorWeight(int red, int green, int blue)
-{
+static inline uint colorWeight(int red, int green, int blue) {
return 3 * red * red + 6 * green * green + 2 * blue * blue;
}
-void Scumm::getGraphicsPerformance()
-{
+void Scumm::getGraphicsPerformance() {
int i;
for (i = 10; i != 0; i--) {
@@ -212,8 +210,7 @@ void Scumm::getGraphicsPerformance()
initScreens(0, 16, _realWidth, 144);
}
-void Scumm::initScreens(int a, int b, int w, int h)
-{
+void Scumm::initScreens(int a, int b, int w, int h) {
int i;
for (i = 0; i < 3; i++) {
@@ -238,8 +235,7 @@ void Scumm::initScreens(int a, int b, int w, int h)
}
void Scumm::initVirtScreen(int slot, int number, int top, int width, int height, bool twobufs,
- bool scrollable)
-{
+ bool scrollable) {
VirtScreen *vs = &virtscr[slot];
int size;
@@ -269,7 +265,7 @@ void Scumm::initVirtScreen(int slot, int number, int top, int width, int height,
size += _realWidth * 4;
}
}
-
+
createResource(rtBuffer, slot + 1, size);
vs->screenPtr = getResourceAddress(rtBuffer, slot + 1);
memset(vs->screenPtr, 0, size); // reset background
@@ -283,8 +279,7 @@ void Scumm::initVirtScreen(int slot, int number, int top, int width, int height,
}
}
-VirtScreen *Scumm::findVirtScreen(int y)
-{
+VirtScreen *Scumm::findVirtScreen(int y) {
VirtScreen *vs = virtscr;
int i;
@@ -296,8 +291,7 @@ VirtScreen *Scumm::findVirtScreen(int y)
return NULL;
}
-void Scumm::updateDirtyRect(int virt, int left, int right, int top, int bottom, int dirtybit)
-{
+void Scumm::updateDirtyRect(int virt, int left, int right, int top, int bottom, int dirtybit) {
VirtScreen *vs = &virtscr[virt];
int lp, rp;
@@ -337,8 +331,7 @@ void Scumm::updateDirtyRect(int virt, int left, int right, int top, int bottom,
setVirtscreenDirty(vs, left, top, right, bottom);
}
-void Scumm::setVirtscreenDirty(VirtScreen *vs, int left, int top, int right, int bottom)
-{
+void Scumm::setVirtscreenDirty(VirtScreen *vs, int left, int top, int right, int bottom) {
int lp = left >> 3;
int rp = right >> 3;
@@ -358,8 +351,7 @@ void Scumm::setVirtscreenDirty(VirtScreen *vs, int left, int top, int right, int
}
}
-void Scumm::setDirtyRange(int slot, int top, int bottom)
-{
+void Scumm::setDirtyRange(int slot, int top, int bottom) {
int i;
VirtScreen *vs = &virtscr[slot];
for (i = 0; i < gdi._numStrips; i++) {
@@ -368,8 +360,7 @@ void Scumm::setDirtyRange(int slot, int top, int bottom)
}
}
-void Scumm::drawDirtyScreenParts()
-{
+void Scumm::drawDirtyScreenParts() {
int i;
VirtScreen *vs;
byte *src;
@@ -402,15 +393,13 @@ void Scumm::drawDirtyScreenParts()
}
}
-void Scumm::updateDirtyScreen(int slot)
-{
+void Scumm::updateDirtyScreen(int slot) {
gdi.updateDirtyScreen(&virtscr[slot]);
}
// Blit the data from the given VirtScreen to the display. If the camera moved,
// a full blit is done, otherwise only the visible dirty areas are updated.
-void Gdi::updateDirtyScreen(VirtScreen *vs)
-{
+void Gdi::updateDirtyScreen(VirtScreen *vs) {
if (vs->height == 0)
return;
@@ -419,13 +408,13 @@ void Gdi::updateDirtyScreen(VirtScreen *vs)
} else {
int i;
int start, w, top, bottom;
-
+
w = 8;
start = 0;
for (i = 0; i < _numStrips; i++) {
bottom = vs->bdirty[i];
-
+
if (bottom) {
top = vs->tdirty[i];
vs->tdirty[i] = vs->height;
@@ -449,8 +438,7 @@ void Gdi::updateDirtyScreen(VirtScreen *vs)
}
// Blit the specified rectangle from the given virtual screen to the display.
-void Gdi::drawStripToScreen(VirtScreen *vs, int x, int w, int t, int b)
-{
+void Gdi::drawStripToScreen(VirtScreen *vs, int x, int w, int t, int b) {
byte *ptr;
int height;
@@ -476,14 +464,12 @@ void Gdi::drawStripToScreen(VirtScreen *vs, int x, int w, int t, int b)
_vm->_system->copy_rect(ptr, _vm->_realWidth, x, vs->topline + t, w, height);
}
-void Gdi::clearUpperMask()
-{
+void Gdi::clearUpperMask() {
memset(_vm->getResourceAddress(rtBuffer, 9), 0, _imgBufOffs[1] - _imgBufOffs[0]);
}
// Reset the background behind an actor or blast object
-void Gdi::resetBackground(int top, int bottom, int strip)
-{
+void Gdi::resetBackground(int top, int bottom, int strip) {
VirtScreen *vs = &_vm->virtscr[0];
byte *backbuff_ptr, *bgbak_ptr;
int offs, numLinesToProcess;
@@ -512,8 +498,7 @@ void Gdi::resetBackground(int top, int bottom, int strip)
}
}
-void Scumm::blit(byte *dst, byte *src, int w, int h)
-{
+void Scumm::blit(byte *dst, byte *src, int w, int h) {
assert(h > 0);
assert(src != NULL);
assert(dst != NULL);
@@ -527,8 +512,7 @@ void Scumm::blit(byte *dst, byte *src, int w, int h)
#pragma mark -
-void Scumm::initBGBuffers(int height)
-{
+void Scumm::initBGBuffers(int height) {
byte *ptr;
int size, itemsize, i;
byte *room;
@@ -579,14 +563,13 @@ void Scumm::initBGBuffers(int height)
}
}
-void Scumm::drawFlashlight()
-{
+void Scumm::drawFlashlight() {
int i, j, offset, x, y;
// Remove the flash light first if it was previously drawn
if (_flashlightIsDrawn) {
updateDirtyRect(0, _flashlight.x, _flashlight.x + _flashlight.w,
- _flashlight.y, _flashlight.y + _flashlight.h, USAGE_BIT_DIRTY);
+ _flashlight.y, _flashlight.y + _flashlight.h, USAGE_BIT_DIRTY);
if (_flashlight.buffer) {
i = _flashlight.h;
@@ -600,7 +583,7 @@ void Scumm::drawFlashlight()
if (_flashlightXStrips == 0 || _flashlightYStrips == 0)
return;
-
+
// Calculate the area of the flashlight
if (_gameId == GID_ZAK256) {
x = _virtual_mouse_x;
@@ -612,9 +595,9 @@ void Scumm::drawFlashlight()
}
_flashlight.w = _flashlightXStrips * 8;
_flashlight.h = _flashlightYStrips * 8;
- _flashlight.x = x - _flashlight.w/2 - _screenStartStrip * 8;
- _flashlight.y = y - _flashlight.h/2;
-
+ _flashlight.x = x - _flashlight.w / 2 - _screenStartStrip * 8;
+ _flashlight.y = y - _flashlight.h / 2;
+
// Clip the flashlight at the borders
if (_flashlight.x < 0)
_flashlight.x = 0;
@@ -626,7 +609,7 @@ void Scumm::drawFlashlight()
_flashlight.y = virtscr[0].height - _flashlight.h;
// Redraw any actors "under" the flashlight
- for (i = _flashlight.x/8; i < (_flashlight.x+_flashlight.w)/8; i++) {
+ for (i = _flashlight.x / 8; i < (_flashlight.x + _flashlight.w) / 8; i++) {
setGfxUsageBit(_screenStartStrip + i, USAGE_BIT_DIRTY);
virtscr[0].tdirty[i] = 0;
virtscr[0].bdirty[i] = virtscr[0].height;
@@ -662,8 +645,7 @@ void Scumm::drawFlashlight()
// Redraw background as needed, i.e. the left/right sides if scrolling took place etc.
// Note that this only updated the virtual screen, not the actual display.
-void Scumm::redrawBGAreas()
-{
+void Scumm::redrawBGAreas() {
int i;
int val;
int diff;
@@ -713,8 +695,7 @@ void Scumm::redrawBGAreas()
_BgNeedsRedraw = false;
}
-void Scumm::redrawBGStrip(int start, int num)
-{
+void Scumm::redrawBGStrip(int start, int num) {
int s = _screenStartStrip + start;
assert(s >= 0 && (size_t) s < sizeof(gfxUsageBits) / (3 * sizeof(gfxUsageBits[0])));
@@ -723,11 +704,10 @@ void Scumm::redrawBGStrip(int start, int num)
setGfxUsageBit(s + i, USAGE_BIT_DIRTY);
gdi.drawBitmap(getResourceAddress(rtRoom, _roomResource) + _IM00_offs,
- &virtscr[0], s, 0, virtscr[0].height, s, num, 0);
+ &virtscr[0], s, 0, virtscr[0].height, s, num, 0);
}
-void Scumm::restoreCharsetBg()
-{
+void Scumm::restoreCharsetBg() {
if (gdi._mask_left != -1) {
restoreBG(gdi._mask_left, gdi._mask_top, gdi._mask_right, gdi._mask_bottom);
_charset->_hasMask = false;
@@ -740,8 +720,7 @@ void Scumm::restoreCharsetBg()
_charset->_nextTop = _string[0].ypos;
}
-void Scumm::restoreBG(int left, int top, int right, int bottom, byte backColor)
-{
+void Scumm::restoreBG(int left, int top, int right, int bottom, byte backColor) {
VirtScreen *vs;
int topline, height, width;
byte *backbuff, *bgbak;
@@ -803,16 +782,14 @@ void Scumm::restoreBG(int left, int top, int right, int bottom, byte backColor)
}
}
-int Scumm::hasCharsetMask(int x, int y, int x2, int y2)
-{
+int Scumm::hasCharsetMask(int x, int y, int x2, int y2) {
if (!_charset->_hasMask || y > gdi._mask_bottom || x > gdi._mask_right ||
y2 < gdi._mask_top || x2 < gdi._mask_left)
return 0;
return 1;
}
-byte Scumm::isMaskActiveAt(int l, int t, int r, int b, byte *mem)
-{
+byte Scumm::isMaskActiveAt(int l, int t, int r, int b, byte *mem) {
int w, h, i;
l >>= 3;
@@ -842,8 +819,7 @@ byte Scumm::isMaskActiveAt(int l, int t, int r, int b, byte *mem)
}
void Gdi::drawBitmap(byte *ptr, VirtScreen *vs, int x, int y, const int h,
- int stripnr, int numstrip, byte flag)
-{
+ int stripnr, int numstrip, byte flag) {
assert(ptr);
assert(h > 0);
byte *backbuff_ptr, *bgbak_ptr, *smap_ptr;
@@ -1045,8 +1021,7 @@ next_iter:
}
-bool Gdi::decompressBitmap(byte *bgbak_ptr, byte *smap_ptr, int numLinesToProcess)
-{
+bool Gdi::decompressBitmap(byte *bgbak_ptr, byte *smap_ptr, int numLinesToProcess) {
byte code = *smap_ptr++;
assert(numLinesToProcess);
@@ -1148,8 +1123,7 @@ bool Gdi::decompressBitmap(byte *bgbak_ptr, byte *smap_ptr, int numLinesToProces
return useOrDecompress;
}
-void Gdi::draw8ColWithMasking(byte *dst, byte *src, int height, byte *mask)
-{
+void Gdi::draw8ColWithMasking(byte *dst, byte *src, int height, byte *mask) {
byte maskbits;
do {
@@ -1185,8 +1159,7 @@ void Gdi::draw8ColWithMasking(byte *dst, byte *src, int height, byte *mask)
} while (--height);
}
-void Gdi::clear8ColWithMasking(byte *dst, int height, byte *mask)
-{
+void Gdi::clear8ColWithMasking(byte *dst, int height, byte *mask) {
byte maskbits;
do {
@@ -1221,9 +1194,7 @@ void Gdi::clear8ColWithMasking(byte *dst, int height, byte *mask)
} while (--height);
}
-
-void Gdi::draw8Col(byte *dst, byte *src, int height)
-{
+void Gdi::draw8Col(byte *dst, byte *src, int height) {
do {
#if defined(SCUMM_NEED_ALIGNMENT)
memcpy(dst, src, 8);
@@ -1248,8 +1219,7 @@ void Gdi::clear8Col(byte *dst, int height)
} while (--height);
}
-void Gdi::decompressMaskImg(byte *dst, byte *src, int height)
-{
+void Gdi::decompressMaskImg(byte *dst, byte *src, int height) {
byte b, c;
while (height) {
@@ -1274,8 +1244,7 @@ void Gdi::decompressMaskImg(byte *dst, byte *src, int height)
}
}
-void Gdi::decompressMaskImgOr(byte *dst, byte *src, int height)
-{
+void Gdi::decompressMaskImgOr(byte *dst, byte *src, int height) {
byte b, c;
while (height) {
@@ -1301,10 +1270,14 @@ void Gdi::decompressMaskImgOr(byte *dst, byte *src, int height)
}
#define READ_BIT (cl--, bit = bits&1, bits>>=1,bit)
-#define FILL_BITS do { if (cl <= 8) { bits |= (*src++ << cl); cl += 8; } } while (0)
-
-void Gdi::unkDecodeA(byte *dst, byte *src, int height)
-{
+#define FILL_BITS do { \
+ if (cl <= 8) { \
+ bits |= (*src++ << cl); \
+ cl += 8; \
+ } \
+ } while (0)
+
+void Gdi::unkDecodeA(byte *dst, byte *src, int height) {
byte color = *src++;
uint bits = *src++;
byte cl = 8;
@@ -1352,8 +1325,7 @@ void Gdi::unkDecodeA(byte *dst, byte *src, int height)
} while (--height);
}
-void Gdi::unkDecodeA_trans(byte *dst, byte *src, int height)
-{
+void Gdi::unkDecodeA_trans(byte *dst, byte *src, int height) {
byte color = *src++;
uint bits = *src++;
byte cl = 8;
@@ -1405,8 +1377,7 @@ void Gdi::unkDecodeA_trans(byte *dst, byte *src, int height)
} while (--height);
}
-void Gdi::unkDecodeB(byte *dst, byte *src, int height)
-{
+void Gdi::unkDecodeB(byte *dst, byte *src, int height) {
byte color = *src++;
uint bits = *src++;
byte cl = 8;
@@ -1436,8 +1407,7 @@ void Gdi::unkDecodeB(byte *dst, byte *src, int height)
} while (--height);
}
-void Gdi::unkDecodeB_trans(byte *dst, byte *src, int height)
-{
+void Gdi::unkDecodeB_trans(byte *dst, byte *src, int height) {
byte color = *src++;
uint bits = *src++;
byte cl = 8;
@@ -1469,8 +1439,7 @@ void Gdi::unkDecodeB_trans(byte *dst, byte *src, int height)
} while (--height);
}
-void Gdi::unkDecodeC(byte *dst, byte *src, int height)
-{
+void Gdi::unkDecodeC(byte *dst, byte *src, int height) {
byte color = *src++;
uint bits = *src++;
byte cl = 8;
@@ -1502,8 +1471,7 @@ void Gdi::unkDecodeC(byte *dst, byte *src, int height)
} while (--x);
}
-void Gdi::unkDecodeC_trans(byte *dst, byte *src, int height)
-{
+void Gdi::unkDecodeC_trans(byte *dst, byte *src, int height) {
byte color = *src++;
uint bits = *src++;
byte cl = 8;
@@ -1539,23 +1507,24 @@ void Gdi::unkDecodeC_trans(byte *dst, byte *src, int height)
#undef READ_BIT
#undef FILL_BITS
-
/* Ender - Zak256/Indy256 decoders */
-#define READ_256BIT \
- if ((mask <<= 1) == 256) {buffer = *src++; mask = 1;} \
- bits = ((buffer & mask) != 0);
-
-#define NEXT_ROW \
- dst += _vm->_realWidth; \
- if (--h == 0) { \
- if (!--x) \
- return; \
- dst -= _vertStripNextInc; \
- h = height; \
+#define READ_256BIT \
+ if ((mask <<= 1) == 256) { \
+ buffer = *src++; \
+ mask = 1; \
+ } \
+ bits = ((buffer & mask) != 0);
+
+#define NEXT_ROW \
+ dst += _vm->_realWidth; \
+ if (--h == 0) { \
+ if (!--x) \
+ return; \
+ dst -= _vertStripNextInc; \
+ h = height; \
}
-void Gdi::unkDecode7(byte *dst, byte *src, int height)
-{
+void Gdi::unkDecode7(byte *dst, byte *src, int height) {
uint h = height;
if (_vm->_features & GF_OLD256) {
@@ -1579,8 +1548,7 @@ void Gdi::unkDecode7(byte *dst, byte *src, int height)
} while (--height);
}
-void Gdi::unkDecode8(byte *dst, byte *src, int height)
-{
+void Gdi::unkDecode8(byte *dst, byte *src, int height) {
uint h = height;
int x = 8;
@@ -1595,8 +1563,7 @@ void Gdi::unkDecode8(byte *dst, byte *src, int height)
}
}
-void Gdi::unkDecode9(byte *dst, byte *src, int height)
-{
+void Gdi::unkDecode9(byte *dst, byte *src, int height) {
unsigned char c, bits, color, run;
int i, j;
uint buffer = 0, mask = 128;
@@ -1647,8 +1614,7 @@ void Gdi::unkDecode9(byte *dst, byte *src, int height)
}
}
-void Gdi::unkDecode10(byte *dst, byte *src, int height)
-{
+void Gdi::unkDecode10(byte *dst, byte *src, int height) {
int i;
unsigned char local_palette[256], numcolors = *src++;
uint h = height;
@@ -1675,8 +1641,7 @@ void Gdi::unkDecode10(byte *dst, byte *src, int height)
}
-void Gdi::unkDecode11(byte *dst, byte *src, int height)
-{
+void Gdi::unkDecode11(byte *dst, byte *src, int height) {
int bits, i;
uint buffer = 0, mask = 128;
unsigned char inc = 1, color = *src++;
@@ -1719,13 +1684,11 @@ void Gdi::unkDecode11(byte *dst, byte *src, int height)
#undef NEXT_ROW
#undef READ_256BIT
-
#pragma mark -
#pragma mark --- Camera ---
#pragma mark -
-void Scumm::setCameraAtEx(int at)
-{
+void Scumm::setCameraAtEx(int at) {
if (!(_features & GF_AFTER_V7)) {
camera._mode = CM_NORMAL;
camera._cur.x = at;
@@ -1734,8 +1697,7 @@ void Scumm::setCameraAtEx(int at)
}
}
-void Scumm::setCameraAt(int pos_x, int pos_y)
-{
+void Scumm::setCameraAt(int pos_x, int pos_y) {
if (_features & GF_AFTER_V7) {
ScummPoint old;
@@ -1782,8 +1744,7 @@ void Scumm::setCameraAt(int pos_x, int pos_y)
}
}
-void Scumm::setCameraFollows(Actor *a)
-{
+void Scumm::setCameraFollows(Actor *a) {
if (_features & GF_AFTER_V7) {
byte oldfollow = camera._follows;
int ax, ay;
@@ -1830,8 +1791,7 @@ void Scumm::setCameraFollows(Actor *a)
}
}
-void Scumm::clampCameraPos(ScummPoint *pt)
-{
+void Scumm::clampCameraPos(ScummPoint *pt) {
if (pt->x < _vars[VAR_CAMERA_MIN_X])
pt->x = _vars[VAR_CAMERA_MIN_X];
@@ -1845,8 +1805,7 @@ void Scumm::clampCameraPos(ScummPoint *pt)
pt->y = _vars[VAR_CAMERA_MAX_Y];
}
-void Scumm::moveCamera()
-{
+void Scumm::moveCamera() {
if (_features & GF_AFTER_V7) {
ScummPoint old = camera._cur;
Actor *a = NULL;
@@ -2011,8 +1970,7 @@ void Scumm::moveCamera()
}
}
-void Scumm::cameraMoved()
-{
+void Scumm::cameraMoved() {
if (_features & GF_AFTER_V7) {
assert(camera._cur.x >= (_realWidth / 2) && camera._cur.y >= (_realHeight / 2));
@@ -2045,8 +2003,7 @@ void Scumm::cameraMoved()
#endif
}
-void Scumm::panCameraTo(int x, int y)
-{
+void Scumm::panCameraTo(int x, int y) {
if (_features & GF_AFTER_V7) {
camera._follows = 0;
@@ -2060,8 +2017,7 @@ void Scumm::panCameraTo(int x, int y)
}
}
-void Scumm::actorFollowCamera(int act)
-{
+void Scumm::actorFollowCamera(int act) {
if (!(_features & GF_AFTER_V7)) {
int old;
@@ -2086,8 +2042,7 @@ void Scumm::actorFollowCamera(int act)
#pragma mark --- Transition effects ---
#pragma mark -
-void Scumm::fadeIn(int effect)
-{
+void Scumm::fadeIn(int effect) {
switch (effect) {
case 1:
case 2:
@@ -2118,8 +2073,7 @@ void Scumm::fadeIn(int effect)
_screenEffectFlag = true;
}
-void Scumm::fadeOut(int effect)
-{
+void Scumm::fadeOut(int effect) {
VirtScreen *vs;
setDirtyRange(0, 0, 0);
@@ -2173,8 +2127,7 @@ void Scumm::fadeOut(int effect)
* All effects operate on 8x8 blocks of the screen. These blocks are updated
* in a certain order; the exact order determines how the effect appears to the user.
*/
-void Scumm::transitionEffect(int a)
-{
+void Scumm::transitionEffect(int a) {
int delta[16]; // Offset applied during each iteration
int tab_2[16];
int i, j;
@@ -2340,7 +2293,6 @@ void Scumm::dissolveEffect(int width, int height) {
}
void Scumm::scrollEffect(int dir) {
-
VirtScreen *vs = &virtscr[0];
int x, y;
@@ -2435,8 +2387,7 @@ void Scumm::unkScreenEffect5(int a) {
warning("stub unkScreenEffect(%d)", a);
}
-void Scumm::setShake(int mode)
-{
+void Scumm::setShake(int mode) {
if (_shakeEnabled != (mode != 0))
_fullRedraw = true;
@@ -2449,8 +2400,7 @@ void Scumm::setShake(int mode)
#pragma mark --- Palette ---
#pragma mark -
-void Scumm::setPaletteFromPtr(byte *ptr)
-{
+void Scumm::setPaletteFromPtr(byte *ptr) {
int i;
byte *dest, r, g, b;
int numcolor;
@@ -2491,24 +2441,20 @@ void Scumm::setPaletteFromPtr(byte *ptr)
setDirtyColors(0, numcolor - 1);
}
-void Scumm::setPaletteFromRes()
-{
+void Scumm::setPaletteFromRes() {
byte *ptr;
ptr = getResourceAddress(rtRoom, _roomResource) + _CLUT_offs;
setPaletteFromPtr(ptr);
}
-
-void Scumm::setDirtyColors(int min, int max)
-{
+void Scumm::setDirtyColors(int min, int max) {
if (_palDirtyMin > min)
_palDirtyMin = min;
if (_palDirtyMax < max)
_palDirtyMax = max;
}
-void Scumm::initCycl(byte *ptr)
-{
+void Scumm::initCycl(byte *ptr) {
int j;
ColorCycle *cycl;
@@ -2531,8 +2477,7 @@ void Scumm::initCycl(byte *ptr)
}
}
-void Scumm::stopCycle(int i)
-{
+void Scumm::stopCycle(int i) {
ColorCycle *cycl;
checkRange(16, 0, i, "Stop Cycle %d Out Of Range");
@@ -2545,8 +2490,7 @@ void Scumm::stopCycle(int i)
cycl->delay = 0;
}
-void Scumm::cyclePalette()
-{
+void Scumm::cyclePalette() {
ColorCycle *cycl;
int valueToAdd;
int i, num;
@@ -2588,8 +2532,7 @@ void Scumm::cyclePalette()
// Perform color cycling on the palManipulate data, too, otherwise
// color cycling will be disturbed by the palette fade.
-void Scumm::moveMemInPalRes(int start, int end, byte direction)
-{
+void Scumm::moveMemInPalRes(int start, int end, byte direction) {
byte *startptr, *endptr;
byte *startptr2, *endptr2;
int num;
@@ -2626,8 +2569,7 @@ void Scumm::moveMemInPalRes(int start, int end, byte direction)
}
}
-void Scumm::palManipulateInit(int start, int end, int string_id, int time)
-{
+void Scumm::palManipulateInit(int start, int end, int string_id, int time) {
byte *pal, *target, *between;
byte *string1, *string2, *string3;
int i;
@@ -2662,19 +2604,18 @@ void Scumm::palManipulateInit(int start, int end, int string_id, int time)
*target++ = *string1++;
*target++ = *string2++;
*target++ = *string3++;
- *(uint16*)between = ((uint16) *pal++) << 8;
+ *(uint16 *)between = ((uint16) *pal++) << 8;
between += 2;
- *(uint16*)between = ((uint16) *pal++) << 8;
+ *(uint16 *)between = ((uint16) *pal++) << 8;
between += 2;
- *(uint16*)between = ((uint16) *pal++) << 8;
+ *(uint16 *)between = ((uint16) *pal++) << 8;
between += 2;
}
_palManipCounter = time;
}
-void Scumm::palManipulate()
-{
+void Scumm::palManipulate() {
byte *target, *pal, *between;
int i, j;
@@ -2700,8 +2641,7 @@ void Scumm::palManipulate()
_palManipCounter--;
}
-void Scumm::setupShadowPalette(int slot, int redScale, int greenScale, int blueScale, int startColor, int endColor)
-{
+void Scumm::setupShadowPalette(int slot, int redScale, int greenScale, int blueScale, int startColor, int endColor) {
byte *table;
int i;
byte *curpal;
@@ -2727,8 +2667,7 @@ void Scumm::setupShadowPalette(int slot, int redScale, int greenScale, int blueS
}
}
-void Scumm::setupShadowPalette(int redScale, int greenScale, int blueScale, int startColor, int endColor)
-{
+void Scumm::setupShadowPalette(int redScale, int greenScale, int blueScale, int startColor, int endColor) {
byte *basepal = getPalettePtr();
byte *pal = basepal;
byte *compareptr;
@@ -2803,8 +2742,7 @@ void Scumm::setupShadowPalette(int redScale, int greenScale, int blueScale, int
/* Yazoo: This function create the specialPalette used for semi-transparency in SamnMax */
void Scumm::createSpecialPalette(int16 from, int16 to, int16 redScale, int16 greenScale, int16 blueScale,
- int16 startColor, int16 endColor)
-{
+ int16 startColor, int16 endColor) {
byte *palPtr;
byte *curPtr;
byte *searchPtr;
@@ -2848,8 +2786,7 @@ void Scumm::createSpecialPalette(int16 from, int16 to, int16 redScale, int16 gre
}
}
-void Scumm::darkenPalette(int redScale, int greenScale, int blueScale, int startColor, int endColor)
-{
+void Scumm::darkenPalette(int redScale, int greenScale, int blueScale, int startColor, int endColor) {
if (_roomResource == 0) // FIXME - HACK to get COMI demo working
return;
@@ -2884,8 +2821,7 @@ void Scumm::darkenPalette(int redScale, int greenScale, int blueScale, int start
}
}
-int Scumm::remapPaletteColor(int r, int g, int b, uint threshold)
-{
+int Scumm::remapPaletteColor(int r, int g, int b, uint threshold) {
int i;
int ar, ag, ab;
uint sum, bestsum, bestitem = 0;
@@ -2934,8 +2870,7 @@ int Scumm::remapPaletteColor(int r, int g, int b, uint threshold)
return bestitem;
}
-void Scumm::swapPalColors(int a, int b)
-{
+void Scumm::swapPalColors(int a, int b) {
byte *ap, *bp;
byte t;
@@ -2959,8 +2894,7 @@ void Scumm::swapPalColors(int a, int b)
setDirtyColors(b, b);
}
-void Scumm::copyPalColor(int dst, int src)
-{
+void Scumm::copyPalColor(int dst, int src) {
byte *dp, *sp;
if ((uint) dst >= 256 || (uint) src >= 256)
@@ -2976,16 +2910,14 @@ void Scumm::copyPalColor(int dst, int src)
setDirtyColors(dst, dst);
}
-void Scumm::setPalColor(int idx, int r, int g, int b)
-{
+void Scumm::setPalColor(int idx, int r, int g, int b) {
_currentPalette[idx * 3 + 0] = r;
_currentPalette[idx * 3 + 1] = g;
_currentPalette[idx * 3 + 2] = b;
setDirtyColors(idx, idx);
}
-void Scumm::setPalette(int palindex)
-{
+void Scumm::setPalette(int palindex) {
byte *pals;
_curPalIndex = palindex;
@@ -2993,8 +2925,7 @@ void Scumm::setPalette(int palindex)
setPaletteFromPtr(pals);
}
-byte *Scumm::findPalInPals(byte *pal, int idx)
-{
+byte *Scumm::findPalInPals(byte *pal, int idx) {
byte *offs;
uint32 size;
@@ -3014,8 +2945,7 @@ byte *Scumm::findPalInPals(byte *pal, int idx)
return offs + READ_LE_UINT32(offs + idx * sizeof(uint32));
}
-byte *Scumm::getPalettePtr()
-{
+byte *Scumm::getPalettePtr() {
byte *cptr;
cptr = getResourceAddress(rtRoom, _roomResource);
@@ -3033,8 +2963,7 @@ byte *Scumm::getPalettePtr()
#pragma mark --- Cursor ---
#pragma mark -
-void Scumm::grabCursor(int x, int y, int w, int h)
-{
+void Scumm::grabCursor(int x, int y, int w, int h) {
VirtScreen *vs = findVirtScreen(y);
if (vs == NULL) {
@@ -3046,8 +2975,7 @@ void Scumm::grabCursor(int x, int y, int w, int h)
}
-void Scumm::grabCursor(byte *ptr, int width, int height)
-{
+void Scumm::grabCursor(byte *ptr, int width, int height) {
uint size;
byte *dst;
@@ -3069,8 +2997,7 @@ void Scumm::grabCursor(byte *ptr, int width, int height)
updateCursor();
}
-void Scumm::useIm01Cursor(byte *im, int w, int h)
-{
+void Scumm::useIm01Cursor(byte *im, int w, int h) {
VirtScreen *vs = &virtscr[0];
w <<= 3;
@@ -3089,16 +3016,14 @@ void Scumm::useIm01Cursor(byte *im, int w, int h)
blit(vs->screenPtr + vs->xstart, getResourceAddress(rtBuffer, 5) + vs->xstart, w, h);
}
-void Scumm::setCursor(int cursor)
-{
+void Scumm::setCursor(int cursor) {
if (cursor >= 0 && cursor <= 3)
_currentCursor = cursor;
else
warning("setCursor(%d)", cursor);
}
-void Scumm::setCursorHotspot2(int x, int y)
-{
+void Scumm::setCursorHotspot2(int x, int y) {
_cursor.hotspotX = x;
_cursor.hotspotY = y;
// FIXME this hacks around offset cursor in the humongous games
@@ -3108,14 +3033,12 @@ void Scumm::setCursorHotspot2(int x, int y)
}
}
-void Scumm::updateCursor()
-{
+void Scumm::updateCursor() {
_system->set_mouse_cursor(_grabbedCursor, _cursor.width, _cursor.height,
- _cursor.hotspotX, _cursor.hotspotY);
+ _cursor.hotspotX, _cursor.hotspotY);
}
-void Scumm::animateCursor()
-{
+void Scumm::animateCursor() {
if (_cursor.animate) {
if (!(_cursor.animateIndex & 0x3)) {
decompressDefaultCursor((_cursor.animateIndex >> 2) & 3);
@@ -3124,8 +3047,7 @@ void Scumm::animateCursor()
}
}
-void Scumm::useBompCursor(byte *im, int width, int height)
-{
+void Scumm::useBompCursor(byte *im, int width, int height) {
uint size;
width <<= 3;
@@ -3144,8 +3066,7 @@ void Scumm::useBompCursor(byte *im, int width, int height)
updateCursor();
}
-void Scumm::decompressDefaultCursor(int idx)
-{
+void Scumm::decompressDefaultCursor(int idx) {
int i, j;
byte color;
@@ -3185,8 +3106,7 @@ void Scumm::decompressDefaultCursor(int idx)
updateCursor();
}
-void Scumm::makeCursorColorTransparent(int a)
-{
+void Scumm::makeCursorColorTransparent(int a) {
int i, size;
size = _cursor.width * _cursor.height;
@@ -3356,8 +3276,7 @@ void Scumm::bompScaleFuncX(byte *line_buffer, byte *scalling_x_ptr, byte skip, i
}
}
-void Scumm::decompressBomp(byte *dst, byte *src, int w, int h)
-{
+void Scumm::decompressBomp(byte *dst, byte *src, int w, int h) {
int len, num;
byte code, color;
@@ -3389,7 +3308,7 @@ void Scumm::decompressBomp(byte *dst, byte *src, int w, int h)
} while (--h);
}
-void Scumm::drawBomp(BompDrawData * bd, int decode_mode, int mask) {
+void Scumm::drawBomp(BompDrawData *bd, int decode_mode, int mask) {
byte skip_y = 128;
byte skip_y_new = 0;
byte bits;
@@ -3422,8 +3341,8 @@ void Scumm::drawBomp(BompDrawData * bd, int decode_mode, int mask) {
clip_bottom -= tmp_y - bd->outheight;
}
- byte * src = bd->dataptr;
- byte * dst = bd->out + bd->y * bd->outwidth + bd->x + clip_left;
+ byte *src = bd->dataptr;
+ byte *dst = bd->out + bd->y * bd->outwidth + bd->x + clip_left;
mask_pitch = _realWidth / 8;
mask_offset = _screenStartStrip + (bd->y * mask_pitch) + ((bd->x + clip_left) >> 3);
diff --git a/scumm/gfx.h b/scumm/gfx.h
index 3d74d7ebad..8b4fe0fbf3 100644
--- a/scumm/gfx.h
+++ b/scumm/gfx.h
@@ -39,7 +39,6 @@ struct CameraData { /* Camera state data */
bool _movingToActor;
};
-
struct VirtScreen { /* Virtual screen areas */
int number;
uint16 topline;
@@ -74,7 +73,6 @@ struct BlastObject { /* BlastObjects to draw */
uint16 width, height;
uint16 scaleX, scaleY;
uint16 image;
-
uint16 mode;
};
diff --git a/scumm/imuse.cpp b/scumm/imuse.cpp
index bad1859448..56b53c0e8c 100644
--- a/scumm/imuse.cpp
+++ b/scumm/imuse.cpp
@@ -44,8 +44,6 @@
#define MDPG_TAG "MDpg"
#define MDHD_TAG "MDhd"
-
-
// Put IMUSE specific classes here, instead of in a .h file
// they will only be used from this file, so it will reduce
// compile time.
@@ -53,7 +51,6 @@
class IMuseDriver;
struct Part;
-
struct HookDatas {
byte _jump, _transpose;
byte _part_onoff[16];
@@ -190,14 +187,12 @@ struct CommandQueue {
uint16 array[8];
};
-
struct IsNoteCmdData {
byte chan;
byte note;
byte vel;
};
-
struct Part {
int _slot;
IMuseDriver *_drv;
@@ -237,7 +232,7 @@ struct Part {
void off();
void silence();
void set_instrument(uint b);
- void set_instrument(byte * data);
+ void set_instrument(byte *data);
void load_global_instrument (byte b);
void set_transpose(int8 transpose);
@@ -259,7 +254,6 @@ struct Part {
void fix_after_load();
void update_pris();
-
void changed(uint16 what);
};
@@ -270,8 +264,6 @@ struct ImTrigger {
byte command [4];
};
-
-
// IMuseDriver class
class IMuseDriver {
@@ -306,7 +298,6 @@ private:
byte _midi_chorus_last[16];
int8 _midi_pan_last[16];
-
void midiPitchBend(byte chan, int16 pitchbend);
void midiPitchBendFactor (byte chan, byte factor);
void midiVolume(byte chan, byte volume);
@@ -346,8 +337,6 @@ public:
byte get_hardware_type() { return 5; }
};
-
-
// WARNING: This is the internal variant of the IMUSE class.
// imuse.h contains a public version of the same class.
// the public version, only contains a set of methods.
@@ -480,16 +469,13 @@ public:
static IMuseInternal *create(OSystem *syst, MidiDriver *midi, SoundMixer *mixer);
};
-
-
////////////////////////////////////////
//
// IMUSE helper functions
//
////////////////////////////////////////
-static int clamp(int val, int min, int max)
-{
+static int clamp(int val, int min, int max) {
if (val < min)
return min;
if (val > max)
@@ -497,8 +483,7 @@ static int clamp(int val, int min, int max)
return val;
}
-static int transpose_clamp(int a, int b, int c)
-{
+static int transpose_clamp(int a, int b, int c) {
if (b > a)
a += (b - a + 11) / 12 * 12;
if (c < a)
@@ -506,8 +491,7 @@ static int transpose_clamp(int a, int b, int c)
return a;
}
-static uint32 get_delta_time(byte **s)
-{
+static uint32 get_delta_time(byte **s) {
byte *d = *s, b;
uint32 time = 0;
do {
@@ -518,13 +502,11 @@ static uint32 get_delta_time(byte **s)
return time;
}
-static uint read_word(byte *a)
-{
+static uint read_word(byte *a) {
return (a[0] << 8) + a[1];
}
-static void skip_midi_cmd(byte **song_ptr)
-{
+static void skip_midi_cmd(byte **song_ptr) {
byte *s, code;
const byte num_skip[] = {
@@ -549,8 +531,7 @@ static void skip_midi_cmd(byte **song_ptr)
*song_ptr = s;
}
-static int is_note_cmd(byte **a, IsNoteCmdData * isnote)
-{
+static int is_note_cmd(byte **a, IsNoteCmdData * isnote) {
byte *s = *a;
byte code;
@@ -602,18 +583,15 @@ IMuseInternal::~IMuseInternal() {
terminate();
}
-void IMuseInternal::lock()
-{
+void IMuseInternal::lock() {
_locked++;
}
-void IMuseInternal::unlock()
-{
+void IMuseInternal::unlock() {
_locked--;
}
-byte *IMuseInternal::findTag(int sound, char *tag, int index)
-{
+byte *IMuseInternal::findTag(int sound, char *tag, int index) {
byte *ptr = NULL;
int32 size, pos;
@@ -642,8 +620,7 @@ byte *IMuseInternal::findTag(int sound, char *tag, int index)
return NULL;
}
-bool IMuseInternal::isMT32(int sound)
-{
+bool IMuseInternal::isMT32(int sound) {
byte *ptr = NULL;
uint32 tag;
@@ -670,8 +647,7 @@ bool IMuseInternal::isMT32(int sound)
return false;
}
-bool IMuseInternal::isGM(int sound)
-{
+bool IMuseInternal::isGM(int sound) {
byte *ptr = NULL;
uint32 tag;
@@ -700,8 +676,7 @@ bool IMuseInternal::isGM(int sound)
return false;
}
-bool IMuseInternal::start_sound(int sound)
-{
+bool IMuseInternal::start_sound(int sound) {
Player *player;
void *mdhd;
@@ -749,8 +724,7 @@ bool IMuseInternal::start_sound(int sound)
}
-Player *IMuseInternal::allocate_player(byte priority)
-{
+Player *IMuseInternal::allocate_player(byte priority) {
Player *player = _players, *best = NULL;
int i;
byte bestpri = 255;
@@ -771,8 +745,7 @@ Player *IMuseInternal::allocate_player(byte priority)
return NULL;
}
-void IMuseInternal::init_players()
-{
+void IMuseInternal::init_players() {
Player *player = _players;
int i;
@@ -782,8 +755,7 @@ void IMuseInternal::init_players()
}
}
-void IMuseInternal::init_sustaining_notes()
-{
+void IMuseInternal::init_sustaining_notes() {
SustainingNotes *next = NULL, *sn = _sustaining_notes;
int i;
@@ -797,8 +769,7 @@ void IMuseInternal::init_sustaining_notes()
_sustain_notes_free = next;
}
-void IMuseInternal::init_volume_fader()
-{
+void IMuseInternal::init_volume_fader() {
VolumeFader *vf = _volume_fader;
int i;
@@ -808,8 +779,7 @@ void IMuseInternal::init_volume_fader()
_active_volume_faders = false;
}
-void IMuseInternal::init_parts()
-{
+void IMuseInternal::init_parts() {
Part *part;
int i;
@@ -819,8 +789,7 @@ void IMuseInternal::init_parts()
}
}
-int IMuseInternal::stop_sound(int sound)
-{
+int IMuseInternal::stop_sound(int sound) {
Player *player = _players;
int i;
int r = -1;
@@ -834,8 +803,7 @@ int IMuseInternal::stop_sound(int sound)
return r;
}
-int IMuseInternal::stop_all_sounds()
-{
+int IMuseInternal::stop_all_sounds() {
Player *player = _players;
int i;
@@ -846,8 +814,7 @@ int IMuseInternal::stop_all_sounds()
return 0;
}
-void IMuseInternal::on_timer()
-{
+void IMuseInternal::on_timer() {
if (_locked || _paused)
return;
@@ -861,8 +828,7 @@ void IMuseInternal::on_timer()
unlock();
}
-void IMuseInternal::sequencer_timers()
-{
+void IMuseInternal::sequencer_timers() {
Player *player = _players;
int i;
@@ -872,8 +838,7 @@ void IMuseInternal::sequencer_timers()
}
}
-void IMuseInternal::handle_marker(uint id, byte data)
-{
+void IMuseInternal::handle_marker(uint id, byte data) {
uint16 *p;
uint pos;
@@ -910,15 +875,13 @@ void IMuseInternal::handle_marker(uint id, byte data)
_queue_end = pos;
}
-int IMuseInternal::get_channel_volume(uint a)
-{
+int IMuseInternal::get_channel_volume(uint a) {
if (a < 8)
return _channel_volume_eff[a];
return (_master_volume * _music_volume / 255) >> 1;
}
-Part *IMuseInternal::allocate_part(byte pri)
-{
+Part *IMuseInternal::allocate_part(byte pri) {
Part *part, *best = NULL;
int i;
@@ -940,8 +903,7 @@ Part *IMuseInternal::allocate_part(byte pri)
return best;
}
-void IMuseInternal::expire_sustain_notes()
-{
+void IMuseInternal::expire_sustain_notes() {
SustainingNotes *sn, *next;
Player *player;
uint32 counter;
@@ -972,8 +934,7 @@ void IMuseInternal::expire_sustain_notes()
}
}
-void IMuseInternal::expire_volume_faders()
-{
+void IMuseInternal::expire_volume_faders() {
VolumeFader *vf;
int i;
@@ -993,8 +954,7 @@ void IMuseInternal::expire_volume_faders()
}
}
-void VolumeFader::on_timer(bool probe)
-{
+void VolumeFader::on_timer(bool probe) {
byte newvol;
newvol = curvol + speed_hi;
@@ -1022,8 +982,7 @@ void VolumeFader::on_timer(bool probe)
}
}
-byte VolumeFader::fading_to()
-{
+byte VolumeFader::fading_to() {
byte newvol;
byte orig_curvol;
uint16 orig_speed_lo_counter, orig_num_steps;
@@ -1052,8 +1011,7 @@ byte VolumeFader::fading_to()
return newvol;
}
-int IMuseInternal::get_sound_status(int sound)
-{
+int IMuseInternal::get_sound_status(int sound) {
int i;
Player *player;
for (i = ARRAYSIZE(_players), player = _players; i != 0; i--, player++) {
@@ -1074,8 +1032,7 @@ int IMuseInternal::get_sound_status(int sound)
// it treats sounds that are fading out just the same as
// other sounds. This is the method to use when determining
// what resources to expire from memory.
-bool IMuseInternal::get_sound_active(int sound)
-{
+bool IMuseInternal::get_sound_active(int sound) {
int i;
Player *player;
for (i = ARRAYSIZE(_players), player = _players; i != 0; i--, player++) {
@@ -1085,8 +1042,7 @@ bool IMuseInternal::get_sound_active(int sound)
return (get_queue_sound_status(sound) != 0);
}
-int IMuseInternal::get_queue_sound_status(int sound)
-{
+int IMuseInternal::get_queue_sound_status(int sound) {
uint16 *a;
int i, j;
@@ -1102,8 +1058,7 @@ int IMuseInternal::get_queue_sound_status(int sound)
return 0;
}
-int IMuseInternal::set_volchan(int sound, int volchan)
-{
+int IMuseInternal::set_volchan(int sound, int volchan) {
int r;
int i;
int num;
@@ -1147,8 +1102,7 @@ int IMuseInternal::set_volchan(int sound, int volchan)
}
}
-int IMuseInternal::clear_queue()
-{
+int IMuseInternal::clear_queue() {
_queue_adding = false;
_queue_cleared = true;
_queue_pos = 0;
@@ -1157,8 +1111,7 @@ int IMuseInternal::clear_queue()
return 0;
}
-int IMuseInternal::enqueue_command(int a, int b, int c, int d, int e, int f, int g)
-{
+int IMuseInternal::enqueue_command(int a, int b, int c, int d, int e, int f, int g) {
uint16 *p;
uint i;
@@ -1194,8 +1147,7 @@ int IMuseInternal::enqueue_command(int a, int b, int c, int d, int e, int f, int
}
}
-int IMuseInternal::query_queue(int param)
-{
+int IMuseInternal::query_queue(int param) {
switch (param) {
case 0: // Get trigger count
return _trigger_count;
@@ -1212,13 +1164,11 @@ int IMuseInternal::query_queue(int param)
}
}
-int IMuseInternal::get_music_volume()
-{
+int IMuseInternal::get_music_volume() {
return _music_volume;
}
-int IMuseInternal::set_music_volume(uint vol)
-{
+int IMuseInternal::set_music_volume(uint vol) {
if (vol > 255)
vol = 255;
else if (vol < 0)
@@ -1236,8 +1186,7 @@ int IMuseInternal::set_music_volume(uint vol)
return 0;
}
-int IMuseInternal::set_master_volume (uint vol)
-{
+int IMuseInternal::set_master_volume (uint vol) {
if (vol > 255)
vol = 255;
else if (vol < 0)
@@ -1255,13 +1204,11 @@ int IMuseInternal::set_master_volume (uint vol)
return 0;
}
-int IMuseInternal::get_master_volume()
-{
+int IMuseInternal::get_master_volume() {
return _master_volume;
}
-int IMuseInternal::terminate()
-{
+int IMuseInternal::terminate() {
if (_driver) {
_driver->uninit();
delete _driver;
@@ -1271,9 +1218,7 @@ int IMuseInternal::terminate()
// Not implemented
}
-
-int IMuseInternal::enqueue_trigger(int sound, int marker)
-{
+int IMuseInternal::enqueue_trigger(int sound, int marker) {
uint16 *p;
uint pos;
@@ -1297,8 +1242,7 @@ int IMuseInternal::enqueue_trigger(int sound, int marker)
return 0;
}
-int32 IMuseInternal::do_command(int a, int b, int c, int d, int e, int f, int g, int h)
-{
+int32 IMuseInternal::do_command(int a, int b, int c, int d, int e, int f, int g, int h) {
int i;
byte cmd = a & 0xFF;
byte param = a >> 8;
@@ -1576,8 +1520,7 @@ int IMuseInternal::set_channel_volume(uint chan, uint vol)
return 0;
}
-void IMuseInternal::update_volumes()
-{
+void IMuseInternal::update_volumes() {
Player *player;
int i;
@@ -1587,16 +1530,14 @@ void IMuseInternal::update_volumes()
}
}
-int IMuseInternal::set_volchan_entry(uint a, uint b)
-{
+int IMuseInternal::set_volchan_entry(uint a, uint b) {
if (a >= 8)
return -1;
_volchan_table[a] = b;
return 0;
}
-int HookDatas::query_param(int param, byte chan)
-{
+int HookDatas::query_param(int param, byte chan) {
switch (param) {
case 18:
return _jump;
@@ -1615,8 +1556,7 @@ int HookDatas::query_param(int param, byte chan)
}
}
-int HookDatas::set(byte cls, byte value, byte chan)
-{
+int HookDatas::set(byte cls, byte value, byte chan) {
switch (cls) {
case 0:
_jump = value;
@@ -1654,9 +1594,7 @@ int HookDatas::set(byte cls, byte value, byte chan)
return 0;
}
-
-VolumeFader *IMuseInternal::allocate_volume_fader()
-{
+VolumeFader *IMuseInternal::allocate_volume_fader() {
VolumeFader *vf;
int i;
@@ -1672,8 +1610,7 @@ VolumeFader *IMuseInternal::allocate_volume_fader()
return vf;
}
-Player *IMuseInternal::get_player_byid(int id)
-{
+Player *IMuseInternal::get_player_byid(int id) {
int i;
Player *player, *found = NULL;
@@ -1687,15 +1624,13 @@ Player *IMuseInternal::get_player_byid(int id)
return found;
}
-int IMuseInternal::get_volchan_entry(uint a)
-{
+int IMuseInternal::get_volchan_entry(uint a) {
if (a < 8)
return _volchan_table[a];
return -1;
}
-uint32 IMuseInternal::property(int prop, uint32 value)
-{
+uint32 IMuseInternal::property(int prop, uint32 value) {
switch (prop) {
case IMuse::PROP_TEMPO_BASE:
_game_tempo = value;
@@ -1704,24 +1639,18 @@ uint32 IMuseInternal::property(int prop, uint32 value)
return 0;
}
-void IMuseInternal::setBase(byte **base)
-{
+void IMuseInternal::setBase(byte **base) {
_base_sounds = base;
}
-
-IMuseInternal *IMuseInternal::create(OSystem *syst, MidiDriver *midi, SoundMixer *mixer)
-{
+IMuseInternal *IMuseInternal::create(OSystem *syst, MidiDriver *midi, SoundMixer *mixer) {
IMuseInternal *i = new IMuseInternal;
i->initialize(syst, midi, mixer);
return i;
}
-
-int IMuseInternal::initialize(OSystem *syst, MidiDriver *midi, SoundMixer *mixer)
-{
+int IMuseInternal::initialize(OSystem *syst, MidiDriver *midi, SoundMixer *mixer) {
int i;
-
IMuseDriver *driv;
if (midi == NULL)
@@ -1753,16 +1682,14 @@ int IMuseInternal::initialize(OSystem *syst, MidiDriver *midi, SoundMixer *mixer
return 0;
}
-void IMuseInternal::init_queue()
-{
+void IMuseInternal::init_queue() {
_queue_adding = false;
_queue_pos = 0;
_queue_end = 0;
_trigger_count = 0;
}
-void IMuseInternal::pause(bool paused)
-{
+void IMuseInternal::pause(bool paused) {
int vol = _music_volume;
if (paused)
_music_volume = 0;
@@ -1772,15 +1699,13 @@ void IMuseInternal::pause(bool paused)
_paused = paused;
}
-
////////////////////////////////////////
//
// Player implementation
//
////////////////////////////////////////
-int Player::fade_vol(byte vol, int time)
-{
+int Player::fade_vol(byte vol, int time) {
VolumeFader *vf;
int i;
@@ -1810,8 +1735,7 @@ int Player::fade_vol(byte vol, int time)
return 0;
}
-bool Player::is_fading_out()
-{
+bool Player::is_fading_out() {
VolumeFader *vf = _se->_volume_fader;
int i;
@@ -1822,8 +1746,7 @@ bool Player::is_fading_out()
return false;
}
-void Player::clear()
-{
+void Player::clear() {
uninit_seq();
cancel_volume_fade();
uninit_parts();
@@ -1831,8 +1754,7 @@ void Player::clear()
_ticks_per_beat = TICKS_PER_BEAT;
}
-bool Player::start_sound(int sound)
-{
+bool Player::start_sound(int sound) {
void *mdhd;
mdhd = _se->findTag(sound, MDHD_TAG, 0);
@@ -1868,13 +1790,11 @@ bool Player::start_sound(int sound)
return true;
}
-void Player::hook_clear()
-{
+void Player::hook_clear() {
memset(&_hook, 0, sizeof(_hook));
}
-int Player::start_seq_sound(int sound)
-{
+int Player::start_seq_sound(int sound) {
byte *ptr, *track_ptr;
_song_index = sound;
@@ -1907,8 +1827,7 @@ int Player::start_seq_sound(int sound)
return 0;
}
-void Player::set_tempo(uint32 b)
-{
+void Player::set_tempo(uint32 b) {
uint32 i, j;
i = _se->_game_tempo;
@@ -1925,8 +1844,7 @@ void Player::set_tempo(uint32 b)
set_speed(_speed);
}
-void Player::cancel_volume_fade()
-{
+void Player::cancel_volume_fade() {
VolumeFader *vf = _se->_volume_fader;
int i;
@@ -1936,8 +1854,7 @@ void Player::cancel_volume_fade()
}
}
-void Player::uninit_parts()
-{
+void Player::uninit_parts() {
if (_parts && _parts->_player != this)
error("asd");
while (_parts)
@@ -1945,19 +1862,16 @@ void Player::uninit_parts()
_se->_driver->update_pris(); // In case another player couldn't allocate all its parts
}
-void Player::uninit_seq()
-{
+void Player::uninit_seq() {
_abort = true;
}
-void Player::set_speed(byte speed)
-{
+void Player::set_speed(byte speed) {
_speed = speed;
_timer_speed = (_tempo_eff * speed >> 7);
}
-byte *Player::parse_midi(byte *s)
-{
+byte *Player::parse_midi(byte *s) {
byte cmd, chan, note, velocity, control;
uint value;
Part *part;
@@ -2091,8 +2005,7 @@ byte *Player::parse_midi(byte *s)
return s;
}
-void Player::parse_sysex(byte *p, uint len)
-{
+void Player::parse_sysex(byte *p, uint len) {
byte code;
byte a;
uint b;
@@ -2275,8 +2188,7 @@ void Player::parse_sysex(byte *p, uint len)
}
}
-void Player::decode_sysex_bytes(byte *src, byte *dst, int len)
-{
+void Player::decode_sysex_bytes(byte *src, byte *dst, int len) {
while (len >= 0) {
*dst++ = (src[0] << 4) | (src[1] & 0xF);
src += 2;
@@ -2284,8 +2196,7 @@ void Player::decode_sysex_bytes(byte *src, byte *dst, int len)
}
}
-void Player::maybe_jump (byte cmd, uint track, uint beat, uint tick)
-{
+void Player::maybe_jump (byte cmd, uint track, uint beat, uint tick) {
// Is this the hook I'm waiting for?
if (cmd && _hook._jump != cmd)
return;
@@ -2297,8 +2208,7 @@ void Player::maybe_jump (byte cmd, uint track, uint beat, uint tick)
jump (track, beat, tick);
}
-void Player::maybe_set_transpose(byte *data)
-{
+void Player::maybe_set_transpose(byte *data) {
byte cmd;
cmd = data[0];
@@ -2314,8 +2224,7 @@ void Player::maybe_set_transpose(byte *data)
set_transpose(data[1], (int8)data[2]);
}
-void Player::maybe_part_onoff(byte *data)
-{
+void Player::maybe_part_onoff(byte *data) {
byte cmd, *p;
uint chan;
Part *part;
@@ -2337,8 +2246,7 @@ void Player::maybe_part_onoff(byte *data)
part->set_onoff(data[2] != 0);
}
-void Player::maybe_set_volume(byte *data)
-{
+void Player::maybe_set_volume(byte *data) {
byte cmd;
byte *p;
uint chan;
@@ -2362,8 +2270,7 @@ void Player::maybe_set_volume(byte *data)
part->set_vol(data[2]);
}
-void Player::maybe_set_program(byte *data)
-{
+void Player::maybe_set_program(byte *data) {
byte cmd;
byte *p;
uint chan;
@@ -2386,8 +2293,7 @@ void Player::maybe_set_program(byte *data)
part->set_program(data[2]);
}
-void Player::maybe_set_transpose_part(byte *data)
-{
+void Player::maybe_set_transpose_part(byte *data) {
byte cmd;
byte *p;
uint chan;
@@ -2408,8 +2314,7 @@ void Player::maybe_set_transpose_part(byte *data)
part_set_transpose(chan, data[2], (int8)data[3]);
}
-int Player::set_transpose(byte relative, int b)
-{
+int Player::set_transpose(byte relative, int b) {
Part *part;
if (b > 24 || b < -24 || relative > 1)
@@ -2426,23 +2331,19 @@ int Player::set_transpose(byte relative, int b)
return 0;
}
-void Player::clear_active_notes()
-{
+void Player::clear_active_notes() {
memset(_se->_active_notes, 0, sizeof(_se->_active_notes));
}
-void Player::clear_active_note(int chan, byte note)
-{
+void Player::clear_active_note(int chan, byte note) {
_se->_active_notes[note] &= ~(1 << chan);
}
-void Player::set_active_note(int chan, byte note)
-{
+void Player::set_active_note(int chan, byte note) {
_se->_active_notes[note] |= (1 << chan);
}
-void Player::part_set_transpose(uint8 chan, byte relative, int8 b)
-{
+void Player::part_set_transpose(uint8 chan, byte relative, int8 b) {
Part *part;
if (b > 24 || b < -24)
@@ -2456,8 +2357,7 @@ void Player::part_set_transpose(uint8 chan, byte relative, int8 b)
part->set_transpose(b);
}
-void Player::key_on(uint8 chan, uint8 note, uint8 velocity)
-{
+void Player::key_on(uint8 chan, uint8 note, uint8 velocity) {
Part *part;
part = get_part(chan);
@@ -2467,8 +2367,7 @@ void Player::key_on(uint8 chan, uint8 note, uint8 velocity)
part->key_on(note, velocity);
}
-void Player::key_off(uint8 chan, uint8 note)
-{
+void Player::key_off(uint8 chan, uint8 note) {
Part *part;
for (part = _parts; part; part = part->_next) {
@@ -2477,8 +2376,7 @@ void Player::key_off(uint8 chan, uint8 note)
}
}
-bool Player::jump(uint track, uint beat, uint tick)
-{
+bool Player::jump(uint track, uint beat, uint tick) {
byte *mtrk, *cur_mtrk, *scanpos;
uint32 topos, curpos, track_offs;
@@ -2538,8 +2436,7 @@ bool Player::jump(uint track, uint beat, uint tick)
return true;
}
-bool Player::set_loop(uint count, uint tobeat, uint totick, uint frombeat, uint fromtick)
-{
+bool Player::set_loop(uint count, uint tobeat, uint totick, uint frombeat, uint fromtick) {
if (tobeat + 1 >= frombeat)
return false;
@@ -2556,13 +2453,11 @@ bool Player::set_loop(uint count, uint tobeat, uint totick, uint frombeat, uint
return true;
}
-void Player::clear_loop()
-{
+void Player::clear_loop() {
_loop_counter = 0;
}
-void Player::turn_off_pedals()
-{
+void Player::turn_off_pedals() {
Part *part;
for (part = _parts; part; part = part->_next) {
@@ -2571,8 +2466,7 @@ void Player::turn_off_pedals()
}
}
-void Player::find_sustaining_notes(byte *a, byte *b, uint32 l)
-{
+void Player::find_sustaining_notes(byte *a, byte *b, uint32 l) {
uint32 pos;
uint16 mask;
uint16 *bitlist_ptr;
@@ -2683,8 +2577,7 @@ void Player::find_sustaining_notes(byte *a, byte *b, uint32 l)
sn->next->prev = sn;
}
-Part *Player::get_part(uint8 chan)
-{
+Part *Player::get_part(uint8 chan) {
Part *part;
part = _parts;
@@ -2706,8 +2599,7 @@ Part *Player::get_part(uint8 chan)
return part;
}
-uint Player::update_actives()
-{
+uint Player::update_actives() {
Part *part;
uint16 *active;
int count = 0;
@@ -2721,8 +2613,7 @@ uint Player::update_actives()
return count;
}
-void Player::set_priority(int pri)
-{
+void Player::set_priority(int pri) {
Part *part;
_priority = pri;
@@ -2732,8 +2623,7 @@ void Player::set_priority(int pri)
_se->_driver->update_pris();
}
-void Player::set_pan(int pan)
-{
+void Player::set_pan(int pan) {
Part *part;
_pan = pan;
@@ -2742,8 +2632,7 @@ void Player::set_pan(int pan)
}
}
-void Player::set_detune(int detune)
-{
+void Player::set_detune(int detune) {
Part *part;
_detune = detune;
@@ -2752,8 +2641,7 @@ void Player::set_detune(int detune)
}
}
-int Player::scan(uint totrack, uint tobeat, uint totick)
-{
+int Player::scan(uint totrack, uint tobeat, uint totick) {
byte *mtrk, *scanptr;
uint32 curpos, topos;
uint32 pos;
@@ -2807,8 +2695,7 @@ int Player::scan(uint totrack, uint tobeat, uint totick)
return 0;
}
-void Player::turn_off_parts()
-{
+void Player::turn_off_parts() {
Part *part;
for (part = _parts; part; part = part->_next)
@@ -2816,8 +2703,7 @@ void Player::turn_off_parts()
_se->_driver->update_pris();
}
-void Player::play_active_notes()
-{
+void Player::play_active_notes() {
int i, j;
uint mask;
@@ -2831,8 +2717,7 @@ void Player::play_active_notes()
}
}
-int Player::set_vol(byte vol)
-{
+int Player::set_vol(byte vol) {
Part *part;
if (vol > 127)
@@ -2848,8 +2733,7 @@ int Player::set_vol(byte vol)
return 0;
}
-int Player::get_param(int param, byte chan)
-{
+int Player::get_param(int param, byte chan) {
switch (param) {
case 0:
return (byte)_priority;
@@ -2896,8 +2780,7 @@ int Player::get_param(int param, byte chan)
}
}
-int Player::query_part_param(int param, byte chan)
-{
+int Player::query_part_param(int param, byte chan) {
Part *part;
part = _parts;
@@ -2921,8 +2804,7 @@ int Player::query_part_param(int param, byte chan)
return 129;
}
-void Player::sequencer_timer()
-{
+void Player::sequencer_timer() {
byte *mtrk;
uint32 counter;
byte *song_ptr;
@@ -2967,8 +2849,7 @@ enum {
TYPE_PLAYER = 2
};
-int IMuseInternal::saveReference(void *me_ref, byte type, void *ref)
-{
+int IMuseInternal::saveReference(void *me_ref, byte type, void *ref) {
IMuseInternal *me = (IMuseInternal *)me_ref;
switch (type) {
case TYPE_PART:
@@ -2980,8 +2861,7 @@ int IMuseInternal::saveReference(void *me_ref, byte type, void *ref)
}
}
-void *IMuseInternal::loadReference(void *me_ref, byte type, int ref)
-{
+void *IMuseInternal::loadReference(void *me_ref, byte type, int ref) {
IMuseInternal *me = (IMuseInternal *)me_ref;
switch (type) {
case TYPE_PART:
@@ -2993,8 +2873,7 @@ void *IMuseInternal::loadReference(void *me_ref, byte type, int ref)
}
}
-int IMuseInternal::save_or_load(Serializer *ser, Scumm *scumm)
-{
+int IMuseInternal::save_or_load(Serializer *ser, Scumm *scumm) {
const SaveLoadEntry mainEntries[] = {
MKLINE(IMuseInternal, _queue_end, sleUint8, VER_V8),
MKLINE(IMuseInternal, _queue_pos, sleUint8, VER_V8),
@@ -3127,8 +3006,7 @@ int IMuseInternal::save_or_load(Serializer *ser, Scumm *scumm)
#undef MKLINE
#undef MKEND
-void IMuseInternal::fix_parts_after_load()
-{
+void IMuseInternal::fix_parts_after_load() {
Part *part;
int i;
@@ -3140,8 +3018,7 @@ void IMuseInternal::fix_parts_after_load()
// Only call this routine from the main thread,
// since it uses getResourceAddress
-void IMuseInternal::fix_players_after_load(Scumm *scumm)
-{
+void IMuseInternal::fix_players_after_load(Scumm *scumm) {
Player *player = _players;
int i;
@@ -3155,56 +3032,47 @@ void IMuseInternal::fix_players_after_load(Scumm *scumm)
}
}
-void Part::set_detune(int8 detune)
-{
+void Part::set_detune(int8 detune) {
_detune_eff = clamp((_detune = detune) + _player->_detune, -128, 127);
changed(IMuseDriver::pcMod);
}
-void Part::set_pitchbend(int value)
-{
+void Part::set_pitchbend(int value) {
_pitchbend = value;
changed(IMuseDriver::pcMod);
}
-void Part::set_vol(uint8 vol)
-{
+void Part::set_vol(uint8 vol) {
_vol_eff = ((_vol = vol) + 1) * _player->_vol_eff >> 7;
changed(IMuseDriver::pcVolume);
}
-void Part::set_pri(int8 pri)
-{
+void Part::set_pri(int8 pri) {
_pri_eff = clamp((_pri = pri) + _player->_priority, 0, 255);
changed(IMuseDriver::pcPriority);
}
-void Part::set_pan(int8 pan)
-{
+void Part::set_pan(int8 pan) {
_pan_eff = clamp((_pan = pan) + _player->_pan, -64, 63);
changed(IMuseDriver::pcPan);
}
-void Part::set_transpose(int8 transpose)
-{
+void Part::set_transpose(int8 transpose) {
_transpose_eff = transpose_clamp((_transpose = transpose) + _player->_transpose, -12, 12);
changed(IMuseDriver::pcMod);
}
-void Part::set_pedal(bool value)
-{
+void Part::set_pedal(bool value) {
_pedal = value;
changed(IMuseDriver::pcPedal);
}
-void Part::set_modwheel(uint value)
-{
+void Part::set_modwheel(uint value) {
_modwheel = value;
changed(IMuseDriver::pcModwheel);
}
-void Part::set_chorus(uint chorus)
-{
+void Part::set_chorus(uint chorus) {
_chorus = chorus;
changed(IMuseDriver::pcChorus);
}
@@ -3215,8 +3083,7 @@ void Part::set_effect_level(uint level)
changed(IMuseDriver::pcEffectLevel);
}
-void Part::fix_after_load()
-{
+void Part::fix_after_load() {
set_transpose(_transpose);
set_vol(_vol);
set_detune(_detune);
@@ -3226,8 +3093,7 @@ void Part::fix_after_load()
changed (IMuseDriver::pcAll);
}
-void Part::set_pitchbend_factor(uint8 value)
-{
+void Part::set_pitchbend_factor(uint8 value) {
if (value > 12)
return;
set_pitchbend(0);
@@ -3235,8 +3101,7 @@ void Part::set_pitchbend_factor(uint8 value)
changed (IMuseDriver::pcPitchBendFactor);
}
-void Part::set_onoff(bool on)
-{
+void Part::set_onoff(bool on) {
if (_on != on) {
_on = on;
if (!on)
@@ -3246,29 +3111,24 @@ void Part::set_onoff(bool on)
}
}
-void Part::set_instrument(byte * data)
-{
+void Part::set_instrument(byte * data) {
_instrument.adlib (data);
changed(IMuseDriver::pcProgram);
}
-void Part::load_global_instrument (byte slot)
-{
+void Part::load_global_instrument (byte slot) {
_drv->part_load_global_instrument (this, slot);
}
-void Part::key_on(byte note, byte velocity)
-{
+void Part::key_on(byte note, byte velocity) {
_drv->part_key_on(this, note, velocity);
}
-void Part::key_off(byte note)
-{
+void Part::key_off(byte note) {
_drv->part_key_off(this, note);
}
-void Part::init(IMuseDriver * driver)
-{
+void Part::init(IMuseDriver * driver) {
_drv = driver;
_player = NULL;
_next = NULL;
@@ -3277,8 +3137,7 @@ void Part::init(IMuseDriver * driver)
memset(_actives, 0, sizeof (_actives));
}
-void Part::setup(Player *player)
-{
+void Part::setup(Player *player) {
_player = player;
// Insert first into player's list
@@ -3316,8 +3175,7 @@ void Part::setup(Player *player)
changed (IMuseDriver::pcAll);
}
-void Part::uninit()
-{
+void Part::uninit() {
if (!_player)
return;
off();
@@ -3334,33 +3192,27 @@ void Part::uninit()
_prev = NULL;
}
-void Part::off()
-{
+void Part::off() {
_drv->part_off(this);
}
-void Part::changed(uint16 what)
-{
+void Part::changed(uint16 what) {
_drv->part_changed(this, what);
}
-void Part::set_param(byte param, int value)
-{
+void Part::set_param(byte param, int value) {
_drv->part_set_param(this, param, value);
}
-void Part::update_pris()
-{
+void Part::update_pris() {
_drv->update_pris();
}
-int Part::update_actives(uint16 *active)
-{
+int Part::update_actives(uint16 *active) {
return _drv->part_update_active(this, active);
}
-void Part::set_program(byte program)
-{
+void Part::set_program(byte program) {
if (_program != program || _bank != 0) {
_program = program;
_bank = 0;
@@ -3369,23 +3221,20 @@ void Part::set_program(byte program)
}
}
-void Part::set_instrument(uint b)
-{
+void Part::set_instrument(uint b) {
_bank = (byte)(b >> 8);
_program = (byte)b;
_instrument.program (_program, _player->_mt32emulate);
changed(IMuseDriver::pcProgram);
}
-
////////////////////////////////////////
//
// General MIDI implementation of iMuse
//
////////////////////////////////////////
-IMuseDriver::IMuseDriver (MidiDriver *midi)
-{
+IMuseDriver::IMuseDriver (MidiDriver *midi) {
int i;
// Initialize our "last" trackers with impossible
@@ -3406,8 +3255,7 @@ IMuseDriver::IMuseDriver (MidiDriver *midi)
_md = midi;
}
-void IMuseDriver::midiPitchBend(byte chan, int16 pitchbend)
-{
+void IMuseDriver::midiPitchBend(byte chan, int16 pitchbend) {
uint16 tmp;
if (_midi_pitchbend_last[chan] != pitchbend) {
@@ -3424,78 +3272,66 @@ void IMuseDriver::midiPitchBendFactor (byte chan, byte factor) {
}
}
-void IMuseDriver::midiVolume(byte chan, byte volume)
-{
+void IMuseDriver::midiVolume(byte chan, byte volume) {
if (_midi_volume_last[chan] != volume) {
_midi_volume_last[chan] = volume;
_md->send(volume << 16 | 7 << 8 | 0xB0 | chan);
}
}
-void IMuseDriver::midiPedal(byte chan, bool pedal)
-{
+void IMuseDriver::midiPedal(byte chan, bool pedal) {
if (_midi_pedal_last[chan] != pedal) {
_midi_pedal_last[chan] = pedal;
_md->send(pedal << 16 | 64 << 8 | 0xB0 | chan);
}
}
-void IMuseDriver::midiModWheel(byte chan, byte modwheel)
-{
+void IMuseDriver::midiModWheel(byte chan, byte modwheel) {
if (_midi_modwheel_last[chan] != modwheel) {
_midi_modwheel_last[chan] = modwheel;
_md->send(modwheel << 16 | 1 << 8 | 0xB0 | chan);
}
}
-void IMuseDriver::midiEffectLevel(byte chan, byte level)
-{
+void IMuseDriver::midiEffectLevel(byte chan, byte level) {
if (_midi_effectlevel_last[chan] != level) {
_midi_effectlevel_last[chan] = level;
_md->send(level << 16 | 91 << 8 | 0xB0 | chan);
}
}
-void IMuseDriver::midiChorus(byte chan, byte chorus)
-{
+void IMuseDriver::midiChorus(byte chan, byte chorus) {
if (_midi_chorus_last[chan] != chorus) {
_midi_chorus_last[chan] = chorus;
_md->send(chorus << 16 | 93 << 8 | 0xB0 | chan);
}
}
-void IMuseDriver::midiControl0(byte chan, byte value)
-{
+void IMuseDriver::midiControl0(byte chan, byte value) {
_md->send(value << 16 | 0 << 8 | 0xB0 | chan);
}
-
-void IMuseDriver::midiPan(byte chan, int8 pan)
-{
+void IMuseDriver::midiPan(byte chan, int8 pan) {
if (_midi_pan_last[chan] != pan) {
_midi_pan_last[chan] = pan;
_md->send(((pan - 64) & 0x7F) << 16 | 10 << 8 | 0xB0 | chan);
}
}
-void IMuseDriver::midiNoteOn(byte chan, byte note, byte velocity)
-{
+void IMuseDriver::midiNoteOn(byte chan, byte note, byte velocity) {
_md->send(velocity << 16 | note << 8 | 0x90 | chan);
}
-void IMuseDriver::midiNoteOff(byte chan, byte note)
-{
+void IMuseDriver::midiNoteOff(byte chan, byte note) {
_md->send(note << 8 | 0x80 | chan);
}
-void IMuseDriver::midiSilence(byte chan)
-{
+void IMuseDriver::midiSilence(byte chan) {
_md->send((64 << 8) | 0xB0 | chan);
_md->send((123 << 8) | 0xB0 | chan);
}
-void IMuseDriver::part_key_on(Part *part, byte note, byte velocity)
-{
+void IMuseDriver::part_key_on(Part *part, byte note, byte velocity) {
MidiChannel *mc = part->_mc;
part->_actives[note >> 4] |= (1 << (note & 0xF));
@@ -3511,8 +3347,7 @@ void IMuseDriver::part_key_on(Part *part, byte note, byte velocity)
}
}
-void IMuseDriver::part_key_off(Part *part, byte note)
-{
+void IMuseDriver::part_key_off(Part *part, byte note) {
MidiChannel *mc = part->_mc;
part->_actives[note >> 4] &= ~(1 << (note & 0xF));
@@ -3525,8 +3360,7 @@ void IMuseDriver::part_key_off(Part *part, byte note)
}
}
-void IMuseDriver::init(IMuseInternal *eng, OSystem *syst)
-{
+void IMuseDriver::init(IMuseInternal *eng, OSystem *syst) {
int i;
_system = syst;
@@ -3550,13 +3384,11 @@ void IMuseDriver::timer_callback (void *) {
g_scumm->_imuse->on_timer();
}
-void IMuseDriver::uninit()
-{
+void IMuseDriver::uninit() {
_md->close();
}
-void IMuseDriver::update_pris()
-{
+void IMuseDriver::update_pris() {
Part *part, *hipart;
int i;
byte hipri, lopri;
@@ -3596,14 +3428,12 @@ void IMuseDriver::update_pris()
}
}
-int IMuseDriver::part_update_active(Part *part, uint16 *active)
-{
+int IMuseDriver::part_update_active(Part *part, uint16 *active) {
int i, j;
uint16 *act, mask, bits;
int count = 0;
bits = 1 << part->_chan;
-
act = part->_actives;
for (i = 8; i; i--) {
@@ -3622,24 +3452,21 @@ int IMuseDriver::part_update_active(Part *part, uint16 *active)
return count;
}
-void IMuseDriver::set_instrument(uint slot, byte *data)
-{
+void IMuseDriver::set_instrument(uint slot, byte *data) {
if (slot < 32) {
// memcpy(&_glob_instr[slot], data, sizeof(Instrument));
_glob_instr[slot].adlib (data);
}
}
-void IMuseDriver::part_load_global_instrument (Part *part, byte slot)
-{
+void IMuseDriver::part_load_global_instrument (Part *part, byte slot) {
if (slot >= 32)
return;
_glob_instr [slot].copy_to (&part->_instrument);
part->changed (pcProgram);
}
-void IMuseDriver::part_changed(Part *part, uint16 what)
-{
+void IMuseDriver::part_changed(Part *part, uint16 what) {
MidiChannel *mc;
// Mark for re-schedule if program changed when in pre-state
@@ -3690,8 +3517,7 @@ void IMuseDriver::part_changed(Part *part, uint16 what)
}
-void IMuseDriver::part_off(Part *part)
-{
+void IMuseDriver::part_off(Part *part) {
MidiChannel *mc = part->_mc;
if (mc) {
mc->allNotesOff();
@@ -3701,8 +3527,6 @@ void IMuseDriver::part_off(Part *part)
}
}
-
-
////////////////////////////////////////////////////////////
//
// IMuse implementation
@@ -3740,8 +3564,7 @@ uint32 IMuse::property(int prop, uint32 value) { in(); uint32 ret = _target->pro
// The IMuse::create method provides a front-end factory
// for creating IMuseInternal without exposing that class
// to the client.
-IMuse *IMuse::create (OSystem *syst, MidiDriver *midi, SoundMixer *mixer)
-{
+IMuse *IMuse::create (OSystem *syst, MidiDriver *midi, SoundMixer *mixer) {
IMuseInternal *engine = IMuseInternal::create (syst, midi, mixer);
if (midi)
midi->property (MidiDriver::PROP_SMALLHEADER, (g_scumm->_features & GF_SMALL_HEADER) ? 1 : 0);
diff --git a/scumm/instrument.cpp b/scumm/instrument.cpp
index 5eb324d334..407d214c92 100644
--- a/scumm/instrument.cpp
+++ b/scumm/instrument.cpp
@@ -32,7 +32,7 @@ static const byte mt32_to_gm[128] = {
0, 1, 0, 2, 4, 4, 5, 3, 16, 17, 18, 16, 16, 19, 20, 21, // 0x
6, 6, 6, 7, 7, 7, 8, 112, 62, 62, 63, 63, 38, 38, 39, 39, // 1x
88, 95, 52, 98, 97, 99, 14, 54, 102, 96, 53, 102, 81, 100, 14, 80, // 2x
- 48, 48, 49, 45, 41, 40, 42, 42, 43, 46, 45, 24, 25, 28, 27, 104, // 3x
+ 48, 48, 49, 45, 41, 40, 42, 42, 43, 46, 45, 24, 25, 28, 27, 104, // 3x
32, 32, 34, 33, 36, 37, 35, 35, 79, 73, 72, 72, 74, 75, 64, 65, // 4x
66, 67, 71, 71, 68, 69, 70, 22, 56, 59, 57, 57, 60, 60, 58, 61, // 5x
61, 11, 11, 98, 14, 9, 14, 13, 12, 107, 107, 77, 78, 78, 76, 76, // 6x
@@ -43,6 +43,7 @@ static struct {
char *name;
byte program;
}
+
roland_to_gm_map [] = {
// Monkey Island 2 instruments
// TODO: Complete
@@ -123,8 +124,6 @@ roland_to_gm_map [] = {
// { "trickle4 ", ??? }
};
-
-
class Instrument_Program : public InstrumentInternal {
private:
byte _program;
@@ -237,24 +236,20 @@ public:
void copy_to (Instrument *dest) { dest->roland ((byte *) &_instrument); }
};
-
-
////////////////////////////////////////
//
// Instrument class members
//
////////////////////////////////////////
-void Instrument::clear()
-{
+void Instrument::clear() {
if (_instrument)
delete _instrument;
_instrument = NULL;
_type = itNone;
}
-void Instrument::program (byte prog, bool mt32)
-{
+void Instrument::program (byte prog, bool mt32) {
clear();
if (prog > 127)
return;
@@ -262,8 +257,7 @@ void Instrument::program (byte prog, bool mt32)
_instrument = new Instrument_Program (prog, mt32);
}
-void Instrument::adlib (byte *instrument)
-{
+void Instrument::adlib (byte *instrument) {
clear();
if (!instrument)
return;
@@ -271,8 +265,7 @@ void Instrument::adlib (byte *instrument)
_instrument = new Instrument_Adlib (instrument);
}
-void Instrument::roland (byte *instrument)
-{
+void Instrument::roland (byte *instrument) {
clear();
if (!instrument)
return;
@@ -280,8 +273,7 @@ void Instrument::roland (byte *instrument)
_instrument = new Instrument_Roland (instrument);
}
-void Instrument::saveOrLoad (Serializer *s)
-{
+void Instrument::saveOrLoad (Serializer *s) {
if (s->isSaving()) {
s->saveByte (_type);
if (_instrument)
@@ -308,8 +300,6 @@ void Instrument::saveOrLoad (Serializer *s)
}
}
-
-
////////////////////////////////////////
//
// Instrument_Program class members
@@ -318,21 +308,18 @@ void Instrument::saveOrLoad (Serializer *s)
Instrument_Program::Instrument_Program (byte program, bool mt32) :
_program (program),
-_mt32 (mt32)
-{
+_mt32 (mt32) {
if (program > 127)
_program = 255;
}
-Instrument_Program::Instrument_Program (Serializer *s)
-{
+Instrument_Program::Instrument_Program (Serializer *s) {
_program = 255;
if (!s->isSaving())
saveOrLoad (s);
}
-void Instrument_Program::saveOrLoad (Serializer *s)
-{
+void Instrument_Program::saveOrLoad (Serializer *s) {
if (s->isSaving()) {
s->saveByte (_program);
s->saveByte (_mt32 ? 1 : 0);
@@ -342,8 +329,7 @@ void Instrument_Program::saveOrLoad (Serializer *s)
}
}
-void Instrument_Program::send (MidiChannel *mc)
-{
+void Instrument_Program::send (MidiChannel *mc) {
if (_program > 127)
return;
@@ -353,57 +339,47 @@ void Instrument_Program::send (MidiChannel *mc)
mc->programChange (_mt32 ? mt32_to_gm [_program] : _program);
}
-
-
////////////////////////////////////////
//
// Instrument_Adlib class members
//
////////////////////////////////////////
-Instrument_Adlib::Instrument_Adlib (byte *data)
-{
+Instrument_Adlib::Instrument_Adlib (byte *data) {
memcpy (&_instrument, data, sizeof (_instrument));
}
-Instrument_Adlib::Instrument_Adlib (Serializer *s)
-{
+Instrument_Adlib::Instrument_Adlib (Serializer *s) {
if (!s->isSaving())
saveOrLoad (s);
else
memset (&_instrument, 0, sizeof (_instrument));
}
-void Instrument_Adlib::saveOrLoad (Serializer *s)
-{
+void Instrument_Adlib::saveOrLoad (Serializer *s) {
if (s->isSaving())
s->saveBytes (&_instrument, sizeof (_instrument));
else
s->loadBytes (&_instrument, sizeof (_instrument));
}
-void Instrument_Adlib::send (MidiChannel *mc)
-{
+void Instrument_Adlib::send (MidiChannel *mc) {
mc->sysEx_customInstrument ('ADL ', (byte *) &_instrument);
}
-
-
////////////////////////////////////////
//
// Instrument_Roland class members
//
////////////////////////////////////////
-Instrument_Roland::Instrument_Roland (byte *data)
-{
+Instrument_Roland::Instrument_Roland (byte *data) {
memcpy (&_instrument, data, sizeof (_instrument));
memcpy (&_instrument_name, &_instrument.common.name, sizeof (_instrument.common.name));
_instrument_name[10] = '\0';
}
-Instrument_Roland::Instrument_Roland (Serializer *s)
-{
+Instrument_Roland::Instrument_Roland (Serializer *s) {
_instrument_name[0] = '\0';
if (!s->isSaving())
saveOrLoad (s);
@@ -411,8 +387,7 @@ Instrument_Roland::Instrument_Roland (Serializer *s)
memset (&_instrument, 0, sizeof (_instrument));
}
-void Instrument_Roland::saveOrLoad (Serializer *s)
-{
+void Instrument_Roland::saveOrLoad (Serializer *s) {
if (s->isSaving())
s->saveBytes (&_instrument, sizeof (_instrument));
else
@@ -421,8 +396,7 @@ void Instrument_Roland::saveOrLoad (Serializer *s)
_instrument_name[10] = '\0';
}
-void Instrument_Roland::send (MidiChannel *mc)
-{
+void Instrument_Roland::send (MidiChannel *mc) {
if (NATIVE_MT32) { // if (mc->device()->mt32device()) {
_instrument.device_id = mc->getNumber();
mc->device()->sysEx ((byte *) &_instrument, sizeof (_instrument));
diff --git a/scumm/instrument.h b/scumm/instrument.h
index 9a64243068..1b2f8df27e 100644
--- a/scumm/instrument.h
+++ b/scumm/instrument.h
@@ -27,11 +27,8 @@
class Serializer;
class MidiChannel;
-
class Instrument;
-
-
class InstrumentInternal {
public:
virtual void saveOrLoad (Serializer *s) = 0;
diff --git a/scumm/intern.h b/scumm/intern.h
index b4ab5c0fbb..1d0a8fa6ed 100644
--- a/scumm/intern.h
+++ b/scumm/intern.h
@@ -26,8 +26,7 @@
#include "scumm.h"
class NutRenderer; // V8 Font Renderer
-class Scumm_v5 : public Scumm
-{
+class Scumm_v5 : public Scumm {
protected:
typedef void (Scumm_v5::*OpcodeProcV5)();
struct OpcodeEntryV5 {
@@ -36,7 +35,7 @@ protected:
};
const OpcodeEntryV5 *_opcodesV5;
-
+
public:
Scumm_v5(GameDetector *detector, OSystem *syst) : Scumm(detector, syst) {}
@@ -154,13 +153,12 @@ protected:
void o5_walkActorTo();
void o5_walkActorToActor();
void o5_walkActorToObject();
- void o5_oldRoomEffect();
+ void o5_oldRoomEffect();
void o5_pickupObjectOld();
};
// FIXME - subclassing V2 from Scumm_v5 is a hack: V2 should have its own opcode table
-class Scumm_v2 : public Scumm_v5
-{
+class Scumm_v2 : public Scumm_v5 {
public:
Scumm_v2(GameDetector *detector, OSystem *syst) : Scumm_v5(detector, syst) {}
@@ -170,8 +168,7 @@ public:
// FIXME - maybe we should move the opcodes from v5 to v3, and change the inheritance
// accordingly - that would be more logical I guess. However, if you do so, take care
// of preserving the right readIndexFile / loadCharset !!!
-class Scumm_v3 : public Scumm_v5
-{
+class Scumm_v3 : public Scumm_v5 {
public:
Scumm_v3(GameDetector *detector, OSystem *syst) : Scumm_v5(detector, syst) {}
@@ -179,16 +176,14 @@ public:
virtual void loadCharset(int no);
};
-class Scumm_v4 : public Scumm_v3
-{
+class Scumm_v4 : public Scumm_v3 {
public:
Scumm_v4(GameDetector *detector, OSystem *syst) : Scumm_v3(detector, syst) {}
void loadCharset(int no);
};
-class Scumm_v6 : public Scumm
-{
+class Scumm_v6 : public Scumm {
protected:
typedef void (Scumm_v6::*OpcodeProcV6)();
struct OpcodeEntryV6 {
@@ -389,8 +384,7 @@ protected:
byte VAR_TIMEDATE_SECOND;
};
-class Scumm_v7 : public Scumm_v6
-{
+class Scumm_v7 : public Scumm_v6 {
public:
Scumm_v7(GameDetector *detector, OSystem *syst) : Scumm_v6(detector, syst) {}
@@ -398,8 +392,7 @@ protected:
virtual void setupScummVars();
};
-class Scumm_v8 : public Scumm_v6
-{
+class Scumm_v8 : public Scumm_v6 {
protected:
typedef void (Scumm_v8::*OpcodeProcV8)();
struct OpcodeEntryV8 {
diff --git a/scumm/object.cpp b/scumm/object.cpp
index 791a45e2c1..411bb37377 100644
--- a/scumm/object.cpp
+++ b/scumm/object.cpp
@@ -49,7 +49,6 @@ void Scumm::putClass(int obj, int cls, bool set)
cls &= 0x7F;
checkRange(32, 1, cls, "Class %d out of range in putClass");
-
if (_features & GF_SMALL_HEADER) {
if (cls == 31) // CLASS_PLAYERONLY
cls = 23;
@@ -75,40 +74,34 @@ void Scumm::putClass(int obj, int cls, bool set)
}
}
-int Scumm::getOwner(int obj)
-{
+int Scumm::getOwner(int obj) {
checkRange(_numGlobalObjects - 1, 0, obj, "Object %d out of range in getOwner");
return _objectOwnerTable[obj];
}
-void Scumm::putOwner(int obj, int owner)
-{
+void Scumm::putOwner(int obj, int owner) {
checkRange(_numGlobalObjects - 1, 0, obj, "Object %d out of range in putOwner");
checkRange(0xFF, 0, owner, "Owner %d out of range in putOwner");
_objectOwnerTable[obj] = owner;
}
-int Scumm::getState(int obj)
-{
+int Scumm::getState(int obj) {
checkRange(_numGlobalObjects - 1, 0, obj, "Object %d out of range in getState");
return _objectStateTable[obj];
}
-void Scumm::putState(int obj, int state)
-{
+void Scumm::putState(int obj, int state) {
checkRange(_numGlobalObjects - 1, 0, obj, "Object %d out of range in putState");
checkRange(0xFF, 0, state, "State %d out of range in putState");
_objectStateTable[obj] = state;
}
-int Scumm::getObjectRoom(int obj)
-{
+int Scumm::getObjectRoom(int obj) {
checkRange(_numGlobalObjects - 1, 0, obj, "Object %d out of range in getObjectRoom");
return _objectRoomTable[obj];
}
-int Scumm::getObjectIndex(int object)
-{
+int Scumm::getObjectIndex(int object) {
int i;
if (object < 1)
@@ -129,8 +122,7 @@ int Scumm::getObjectIndex(int object)
}
}
-int Scumm::whereIsObject(int object)
-{
+int Scumm::whereIsObject(int object) {
int i;
if (object >= _numGlobalObjects)
@@ -156,8 +148,7 @@ int Scumm::whereIsObject(int object)
return WIO_NOT_FOUND;
}
-int Scumm::getObjectOrActorXY(int object, int &x, int &y)
-{
+int Scumm::getObjectOrActorXY(int object, int &x, int &y) {
if (object < NUM_ACTORS) {
Actor *act = derefActorSafe(object, "getObjectOrActorXY");
if (!act)
@@ -182,8 +173,7 @@ int Scumm::getObjectOrActorXY(int object, int &x, int &y)
/* Return the position of an object.
Returns X, Y and direction in angles
*/
-void Scumm::getObjectXYPos(int object, int &x, int &y, int &dir)
-{
+void Scumm::getObjectXYPos(int object, int &x, int &y, int &dir) {
ObjectData *od = &_objs[getObjectIndex(object)];
int state;
byte *ptr;
@@ -223,8 +213,7 @@ void Scumm::getObjectXYPos(int object, int &x, int &y, int &dir)
dir = oldDirToNewDir(od->actordir & 3);
}
-int Scumm::getObjActToObjActDist(int a, int b)
-{
+int Scumm::getObjActToObjActDist(int a, int b) {
int x, y, x2, y2;
Actor *acta = NULL;
Actor *actb = NULL;
@@ -258,8 +247,7 @@ int Scumm::getObjActToObjActDist(int a, int b)
return x;
}
-int Scumm::findObject(int x, int y)
-{
+int Scumm::findObject(int x, int y) {
int i, b;
byte a;
@@ -281,8 +269,7 @@ int Scumm::findObject(int x, int y)
return 0;
}
-void Scumm::drawRoomObject(int i, int arg)
-{
+void Scumm::drawRoomObject(int i, int arg) {
ObjectData *od;
byte a;
@@ -300,8 +287,7 @@ void Scumm::drawRoomObject(int i, int arg)
} while (od->state == a);
}
-void Scumm::drawRoomObjects(int arg)
-{
+void Scumm::drawRoomObjects(int arg) {
int i;
if (_features & GF_DRAWOBJ_OTHER_ORDER) {
@@ -334,8 +320,7 @@ const uint32 IMxx_tags[] = {
MKID('IM0F')
};
-void Scumm::drawObject(int obj, int arg)
-{
+void Scumm::drawObject(int obj, int arg) {
ObjectData *od;
int xpos, ypos, height, width;
byte *ptr;
@@ -413,8 +398,7 @@ void Scumm::drawObject(int obj, int arg)
}
}
-void Scumm::clearRoomObjects()
-{
+void Scumm::clearRoomObjects() {
int i;
if (_features & GF_SMALL_HEADER) {
@@ -442,8 +426,7 @@ void Scumm::clearRoomObjects()
}
}
-void Scumm::loadRoomObjects()
-{
+void Scumm::loadRoomObjects() {
int i, j;
ObjectData *od;
byte *ptr;
@@ -537,8 +520,7 @@ void Scumm::loadRoomObjects()
CHECK_HEAP
}
-void Scumm::loadRoomObjectsSmall()
-{
+void Scumm::loadRoomObjectsSmall() {
int i, j;
ObjectData *od;
byte *ptr;
@@ -600,8 +582,7 @@ void Scumm::loadRoomObjectsSmall()
CHECK_HEAP
}
-void Scumm::setupRoomObject(ObjectData *od, byte *room, byte *searchptr)
-{
+void Scumm::setupRoomObject(ObjectData *od, byte *room, byte *searchptr) {
CodeHeader *cdhd = NULL;
ImageHeader *imhd = NULL;
@@ -708,8 +689,7 @@ void Scumm::setupRoomObject(ObjectData *od, byte *room, byte *searchptr)
od->fl_object_index = 0;
}
-void Scumm::fixObjectFlags()
-{
+void Scumm::fixObjectFlags() {
int i;
ObjectData *od = &_objs[1];
for (i = 1; i < _numLocalObjects; i++, od++) {
@@ -718,8 +698,7 @@ void Scumm::fixObjectFlags()
}
}
-void Scumm::processDrawQue()
-{
+void Scumm::processDrawQue() {
int i, j;
for (i = 0; i < _drawObjectQueNr; i++) {
j = _drawObjectQue[i];
@@ -729,8 +708,7 @@ void Scumm::processDrawQue()
_drawObjectQueNr = 0;
}
-void Scumm::clearOwnerOf(int obj)
-{
+void Scumm::clearOwnerOf(int obj) {
int i, j;
uint16 *a;
@@ -771,8 +749,7 @@ void Scumm::clearOwnerOf(int obj)
}
}
-void Scumm::removeObjectFromRoom(int obj)
-{
+void Scumm::removeObjectFromRoom(int obj) {
int i, j, strip;
for (i = 1; i < _numLocalObjects; i++) {
@@ -796,20 +773,17 @@ void Scumm::removeObjectFromRoom(int obj)
}
}
-void Scumm::addObjectToDrawQue(int object)
-{
+void Scumm::addObjectToDrawQue(int object) {
_drawObjectQue[_drawObjectQueNr++] = object;
if ((unsigned int)_drawObjectQueNr > sizeof(_drawObjectQue) / sizeof(_drawObjectQue[0]))
error("Draw Object Que overflow");
}
-void Scumm::clearDrawObjectQueue()
-{
+void Scumm::clearDrawObjectQueue() {
_drawObjectQueNr = 0;
}
-byte *Scumm::getObjOrActorName(int obj)
-{
+byte *Scumm::getObjOrActorName(int obj) {
byte *objptr;
int i;
@@ -842,8 +816,7 @@ byte *Scumm::getObjOrActorName(int obj)
return findResourceData(MKID('OBNA'), objptr);
}
-uint32 Scumm::getOBCDOffs(int object)
-{
+uint32 Scumm::getOBCDOffs(int object) {
int i;
if (_objectOwnerTable[object] != OF_OWNER_ROOM)
@@ -858,8 +831,7 @@ uint32 Scumm::getOBCDOffs(int object)
return 0;
}
-byte *Scumm::getOBCDFromObject(int obj)
-{
+byte *Scumm::getOBCDFromObject(int obj) {
int i;
if (_objectOwnerTable[obj] != OF_OWNER_ROOM) {
@@ -882,8 +854,7 @@ byte *Scumm::getOBCDFromObject(int obj)
return 0;
}
-void Scumm::addObjectToInventory(uint obj, uint room)
-{
+void Scumm::addObjectToInventory(uint obj, uint room) {
int i, slot;
uint32 size;
byte *ptr, *dst;
@@ -916,8 +887,7 @@ void Scumm::addObjectToInventory(uint obj, uint room)
CHECK_HEAP
}
-void Scumm::findObjectInRoom(FindObjectInRoom *fo, byte findWhat, uint id, uint room)
-{
+void Scumm::findObjectInRoom(FindObjectInRoom *fo, byte findWhat, uint id, uint room) {
CodeHeader *cdhd;
int i, numobj;
byte *roomptr, *obcdptr, *obimptr, *searchptr;
@@ -1023,8 +993,7 @@ void Scumm::findObjectInRoom(FindObjectInRoom *fo, byte findWhat, uint id, uint
}
}
-int Scumm::getInventorySlot()
-{
+int Scumm::getInventorySlot() {
int i;
for (i = 1; i <= _maxInventoryItems; i++) {
if (_inventory[i] == 0)
@@ -1034,8 +1003,8 @@ int Scumm::getInventorySlot()
return -1;
}
-void Scumm::SamInventoryHack(int obj)
-{ // FIXME: Sam and Max hack
+void Scumm::SamInventoryHack(int obj) {
+ // FIXME: Sam and Max hack
int base = 6;
while (base < 80) {
@@ -1051,8 +1020,7 @@ void Scumm::SamInventoryHack(int obj)
}
}
-void Scumm::setOwnerOf(int obj, int owner)
-{
+void Scumm::setOwnerOf(int obj, int owner) {
ScriptSlot *ss;
if (owner == 0) {
clearOwnerOf(obj);
@@ -1071,8 +1039,7 @@ void Scumm::setOwnerOf(int obj, int owner)
runHook(0);
}
-int Scumm::getObjX(int obj)
-{
+int Scumm::getObjX(int obj) {
if (obj < NUM_ACTORS) {
if (obj < 1)
return 0; /* fix for indy4's map */
@@ -1086,8 +1053,7 @@ int Scumm::getObjX(int obj)
}
}
-int Scumm::getObjY(int obj)
-{
+int Scumm::getObjY(int obj) {
if (obj < NUM_ACTORS) {
if (obj < 1)
return 0; /* fix for indy4's map */
@@ -1101,8 +1067,7 @@ int Scumm::getObjY(int obj)
}
}
-int Scumm::getObjOldDir(int obj)
-{
+int Scumm::getObjOldDir(int obj) {
if (obj < NUM_ACTORS) {
return newDirToOldDir(derefActorSafe(obj, "getObjOldDir")->facing);
} else {
@@ -1112,8 +1077,7 @@ int Scumm::getObjOldDir(int obj)
}
}
-int Scumm::getObjNewDir(int obj)
-{
+int Scumm::getObjNewDir(int obj) {
if (obj < NUM_ACTORS) {
return derefActorSafe(obj, "getObjNewDir")->facing;
} else {
@@ -1123,8 +1087,7 @@ int Scumm::getObjNewDir(int obj)
}
}
-int Scumm::findInventory(int owner, int idx)
-{
+int Scumm::findInventory(int owner, int idx) {
int count = 1, i, obj;
for (i = 0; i != _maxInventoryItems; i++) {
obj = _inventory[i];
@@ -1134,8 +1097,7 @@ int Scumm::findInventory(int owner, int idx)
return 0;
}
-int Scumm::getInventoryCount(int owner)
-{
+int Scumm::getInventoryCount(int owner) {
int i, obj;
int count = 0;
for (i = 0; i != _maxInventoryItems; i++) {
@@ -1146,8 +1108,7 @@ int Scumm::getInventoryCount(int owner)
return count;
}
-void Scumm::setObjectState(int obj, int state, int x, int y)
-{
+void Scumm::setObjectState(int obj, int state, int x, int y) {
int i;
i = getObjectIndex(obj);
@@ -1165,8 +1126,7 @@ void Scumm::setObjectState(int obj, int state, int x, int y)
putState(obj, state);
}
-static int getDist(int x, int y, int x2, int y2)
-{
+static int getDist(int x, int y, int x2, int y2) {
int a = abs(y - y2);
int b = abs(x - x2);
if (a > b)
@@ -1174,8 +1134,7 @@ static int getDist(int x, int y, int x2, int y2)
return b;
}
-int Scumm::getDistanceBetween(bool is_obj_1, int b, int c, bool is_obj_2, int e, int f)
-{
+int Scumm::getDistanceBetween(bool is_obj_1, int b, int c, bool is_obj_2, int e, int f) {
int i, j;
int x, y;
int x2, y2;
@@ -1205,8 +1164,7 @@ int Scumm::getDistanceBetween(bool is_obj_1, int b, int c, bool is_obj_2, int e,
return getDist(x, y, x2, y2) * 0xFF / ((i + j) >> 1);
}
-void Scumm::setCursorImg(uint img, uint room, uint imgindex)
-{
+void Scumm::setCursorImg(uint img, uint room, uint imgindex) {
int w, h;
byte *dataptr, *bomp;
uint32 size;
@@ -1269,8 +1227,7 @@ void Scumm::setCursorImg(uint img, uint room, uint imgindex)
}
-void Scumm::nukeFlObjects(int min, int max)
-{
+void Scumm::nukeFlObjects(int min, int max) {
ObjectData *od;
int i;
@@ -1285,8 +1242,7 @@ void Scumm::nukeFlObjects(int min, int max)
}
void Scumm::enqueueObject(int objectNumber, int objectX, int objectY, int objectWidth,
- int objectHeight, int scaleX, int scaleY, int image, int mode)
-{
+ int objectHeight, int scaleX, int scaleY, int image, int mode) {
BlastObject *eo;
ObjectData *od;
@@ -1319,8 +1275,7 @@ void Scumm::enqueueObject(int objectNumber, int objectX, int objectY, int object
eo->mode = mode;
}
-void Scumm::drawBlastObjects()
-{
+void Scumm::drawBlastObjects() {
BlastObject *eo;
int i;
@@ -1330,8 +1285,7 @@ void Scumm::drawBlastObjects()
}
}
-void Scumm::drawBlastObject(BlastObject *eo)
-{
+void Scumm::drawBlastObject(BlastObject *eo) {
VirtScreen *vs;
byte *bomp, *ptr;
int idx, objnum;
@@ -1428,7 +1382,7 @@ void Scumm::drawBlastObject(BlastObject *eo)
updateDirtyRect(vs->number, bdd.x, bdd.x + bdd.srcwidth, bdd.y, bdd.y + bdd.srcheight, 0);
}
-byte _bompScaleTable[] = {
+byte _bompScaleTable[] = {
0, 128, 64, 192, 32, 160, 96, 224,
16, 144, 80, 208, 48, 176, 112, 240,
8, 136, 72, 200, 40, 168, 104, 232,
@@ -1497,22 +1451,22 @@ byte _bompScaleTable[] = {
};
byte _bompBitsTable[] = {
- 8, 7, 7, 6, 7, 6, 6, 5, 7, 6, 6, 5, 6, 5, 5, 4,
- 7, 6, 6, 5, 6, 5, 5, 4, 6, 5, 5, 4, 5, 4, 4, 3,
- 7, 6, 6, 5, 6, 5, 5, 4, 6, 5, 5, 4, 5, 4, 4, 3,
- 6, 5, 5, 4, 5, 4, 4, 3, 5, 4, 4, 3, 4, 3, 3, 2,
- 7, 6, 6, 5, 6, 5, 5, 4, 6, 5, 5, 4, 5, 4, 4, 3,
- 6, 5, 5, 4, 5, 4, 4, 3, 5, 4, 4, 3, 4, 3, 3, 2,
- 6, 5, 5, 4, 5, 4, 4, 3, 5, 4, 4, 3, 4, 3, 3, 2,
- 5, 4, 4, 3, 4, 3, 3, 2, 4, 3, 3, 2, 3, 2, 2, 1,
- 7, 6, 6, 5, 6, 5, 5, 4, 6, 5, 5, 4, 5, 4, 4, 3,
- 6, 5, 5, 4, 5, 4, 4, 3, 5, 4, 4, 3, 4, 3, 3, 2,
- 6, 5, 5, 4, 5, 4, 4, 3, 5, 4, 4, 3, 4, 3, 3, 2,
- 5, 4, 4, 3, 4, 3, 3, 2, 4, 3, 3, 2, 3, 2, 2, 1,
- 6, 5, 5, 4, 5, 4, 4, 3, 5, 4, 4, 3, 4, 3, 3, 2,
- 5, 4, 4, 3, 4, 3, 3, 2, 4, 3, 3, 2, 3, 2, 2, 1,
- 5, 4, 4, 3, 4, 3, 3, 2, 4, 3, 3, 2, 3, 2, 2, 1,
- 4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0,
+ 8, 7, 7, 6, 7, 6, 6, 5, 7, 6, 6, 5, 6, 5, 5, 4,
+ 7, 6, 6, 5, 6, 5, 5, 4, 6, 5, 5, 4, 5, 4, 4, 3,
+ 7, 6, 6, 5, 6, 5, 5, 4, 6, 5, 5, 4, 5, 4, 4, 3,
+ 6, 5, 5, 4, 5, 4, 4, 3, 5, 4, 4, 3, 4, 3, 3, 2,
+ 7, 6, 6, 5, 6, 5, 5, 4, 6, 5, 5, 4, 5, 4, 4, 3,
+ 6, 5, 5, 4, 5, 4, 4, 3, 5, 4, 4, 3, 4, 3, 3, 2,
+ 6, 5, 5, 4, 5, 4, 4, 3, 5, 4, 4, 3, 4, 3, 3, 2,
+ 5, 4, 4, 3, 4, 3, 3, 2, 4, 3, 3, 2, 3, 2, 2, 1,
+ 7, 6, 6, 5, 6, 5, 5, 4, 6, 5, 5, 4, 5, 4, 4, 3,
+ 6, 5, 5, 4, 5, 4, 4, 3, 5, 4, 4, 3, 4, 3, 3, 2,
+ 6, 5, 5, 4, 5, 4, 4, 3, 5, 4, 4, 3, 4, 3, 3, 2,
+ 5, 4, 4, 3, 4, 3, 3, 2, 4, 3, 3, 2, 3, 2, 2, 1,
+ 6, 5, 5, 4, 5, 4, 4, 3, 5, 4, 4, 3, 4, 3, 3, 2,
+ 5, 4, 4, 3, 4, 3, 3, 2, 4, 3, 3, 2, 3, 2, 2, 1,
+ 5, 4, 4, 3, 4, 3, 3, 2, 4, 3, 3, 2, 3, 2, 2, 1,
+ 4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0,
};
int32 Scumm::setupBompScale(byte * scalling, int32 size, byte scale) {
@@ -1582,8 +1536,7 @@ int32 Scumm::setupBompScale(byte * scalling, int32 size, byte scale) {
return ret_value;
}
-void Scumm::removeBlastObjects()
-{
+void Scumm::removeBlastObjects() {
BlastObject *eo;
int i;
@@ -1595,8 +1548,7 @@ void Scumm::removeBlastObjects()
clearEnqueue();
}
-void Scumm::removeBlastObject(BlastObject *eo)
-{
+void Scumm::removeBlastObject(BlastObject *eo) {
VirtScreen *vs = &virtscr[0];
int top, bottom, left, right;
@@ -1638,8 +1590,7 @@ void Scumm::removeBlastObject(BlastObject *eo)
updateDirtyRect(0, left, right, top, bottom, USAGE_BIT_RESTORED);
}
-int Scumm::findLocalObjectSlot()
-{
+int Scumm::findLocalObjectSlot() {
int i;
for (i = 1; i < _numLocalObjects; i++) {
@@ -1650,8 +1601,7 @@ int Scumm::findLocalObjectSlot()
return -1;
}
-int Scumm::findFlObjectSlot()
-{
+int Scumm::findFlObjectSlot() {
int i;
for (i = 1; i < _maxFLObject; i++) {
if (_baseFLObject[i] == NULL)
@@ -1661,8 +1611,7 @@ int Scumm::findFlObjectSlot()
return -1;
}
-void Scumm::loadFlObject(uint object, uint room)
-{
+void Scumm::loadFlObject(uint object, uint room) {
FindObjectInRoom foir;
int slot, objslot;
ObjectData *od;
diff --git a/scumm/resource.cpp b/scumm/resource.cpp
index 7614ad8d9b..425186e7d3 100644
--- a/scumm/resource.cpp
+++ b/scumm/resource.cpp
@@ -33,8 +33,7 @@
uint16 newTag2Old(uint32 oldTag);
/* Open a room */
-void Scumm::openRoom(int room)
-{
+void Scumm::openRoom(int room) {
int room_offs, roomlimit;
char buf[256];
@@ -131,8 +130,7 @@ void Scumm::openRoom(int room)
_fileOffset = 0; // start of file
}
-void Scumm::closeRoom()
-{
+void Scumm::closeRoom() {
if (_lastLoadedRoom != -1) {
_lastLoadedRoom = -1;
_encbyte = 0;
@@ -142,8 +140,7 @@ void Scumm::closeRoom()
}
/* Delete the currently loaded room offsets */
-void Scumm::deleteRoomOffsets()
-{
+void Scumm::deleteRoomOffsets() {
if (!(_features & GF_SMALL_HEADER) && !_dynamicRoomOffsets)
return;
@@ -154,8 +151,7 @@ void Scumm::deleteRoomOffsets()
}
/* Read room offsets */
-void Scumm::readRoomsOffsets()
-{
+void Scumm::readRoomsOffsets() {
int num, room;
debug(9, "readRoomOffsets()");
@@ -184,8 +180,7 @@ void Scumm::readRoomsOffsets()
}
}
-bool Scumm::openResourceFile(const char *filename)
-{
+bool Scumm::openResourceFile(const char *filename) {
char buf[256];
debug(9, "openResourceFile(%s)", filename);
@@ -200,8 +195,7 @@ bool Scumm::openResourceFile(const char *filename)
return _fileHandle.isOpen();
}
-void Scumm::askForDisk(const char *filename, int disknum)
-{
+void Scumm::askForDisk(const char *filename, int disknum) {
char buf[128];
if (_features & GF_AFTER_V8) {
@@ -221,8 +215,7 @@ void Scumm::askForDisk(const char *filename, int disknum)
}
}
-void Scumm::readIndexFile()
-{
+void Scumm::readIndexFile() {
uint32 blocktype, itemsize;
int numblock = 0;
int num, i;
@@ -383,8 +376,7 @@ void Scumm::readIndexFile()
closeRoom();
}
-void Scumm::readArrayFromIndexFile()
-{
+void Scumm::readArrayFromIndexFile() {
int num;
int a, b, c;
@@ -417,8 +409,7 @@ void Scumm::readArrayFromIndexFile()
}
}
-void Scumm::readResTypeList(int id, uint32 tag, const char *name)
-{
+void Scumm::readResTypeList(int id, uint32 tag, const char *name) {
int num;
int i;
@@ -468,9 +459,7 @@ void Scumm::readResTypeList(int id, uint32 tag, const char *name)
}
}
-
-void Scumm::allocResTypeData(int id, uint32 tag, int num, const char *name, int mode)
-{
+void Scumm::allocResTypeData(int id, uint32 tag, int num, const char *name, int mode) {
debug(9, "allocResTypeData(%s/%s,%x,%d,%d)", resTypeFromId(id), name, FROM_LE_32(tag), num, mode);
assert(id >= 0 && id < (int)(sizeof(res.mode) / sizeof(res.mode[0])));
@@ -491,8 +480,7 @@ void Scumm::allocResTypeData(int id, uint32 tag, int num, const char *name, int
}
}
-void Scumm::loadCharset(int no)
-{
+void Scumm::loadCharset(int no) {
int i;
byte *ptr;
@@ -515,14 +503,12 @@ void Scumm::loadCharset(int no)
}
}
-void Scumm::nukeCharset(int i)
-{
+void Scumm::nukeCharset(int i) {
checkRange(_maxCharsets - 1, 1, i, "Nuking illegal charset %d");
nukeResource(rtCharset, i);
}
-void Scumm::ensureResourceLoaded(int type, int i)
-{
+void Scumm::ensureResourceLoaded(int type, int i) {
void *addr;
debug(9, "ensureResourceLoaded(%s,%d)", resTypeFromId(type), i);
@@ -545,8 +531,7 @@ void Scumm::ensureResourceLoaded(int type, int i)
_vars[VAR_ROOM_FLAG] = 1;
}
-int Scumm::loadResource(int type, int idx)
-{
+int Scumm::loadResource(int type, int idx) {
int roomNr;
uint32 fileOffs;
uint32 size, tag;
@@ -626,8 +611,7 @@ int Scumm::loadResource(int type, int idx)
error("Cannot read resource");
}
-int Scumm::readSoundResource(int type, int idx)
-{
+int Scumm::readSoundResource(int type, int idx) {
uint32 pos, total_size, size, tag, basetag;
int pri, best_pri;
uint32 best_size = 0, best_offs = 0;
@@ -915,8 +899,7 @@ static char OLD256_MIDI_HACK[] =
"\x04\x00\x00\xf7"
"\x00\xb7\x07\x64"; // Controller 7 = 100
-int Scumm::readSoundResourceSmallHeader(int type, int idx)
-{
+int Scumm::readSoundResourceSmallHeader(int type, int idx) {
uint32 pos, total_size, size, dw, tag;
uint32 best_size = 0, best_offs = 0;
byte *ptr, *track, *instr;
@@ -1104,15 +1087,13 @@ int Scumm::readSoundResourceSmallHeader(int type, int idx)
}
-int Scumm::getResourceRoomNr(int type, int idx)
-{
+int Scumm::getResourceRoomNr(int type, int idx) {
if (type == rtRoom)
return idx;
return res.roomno[type][idx];
}
-byte *Scumm::getResourceAddress(int type, int idx)
-{
+byte *Scumm::getResourceAddress(int type, int idx) {
byte *ptr;
CHECK_HEAP
@@ -1139,8 +1120,7 @@ byte *Scumm::getResourceAddress(int type, int idx)
return ptr + sizeof(MemBlkHeader);
}
-byte *Scumm::getStringAddress(int i)
-{
+byte *Scumm::getStringAddress(int i) {
byte *b = getResourceAddress(rtString, i);
if (!b)
return NULL;
@@ -1150,10 +1130,7 @@ byte *Scumm::getStringAddress(int i)
return b;
}
-
-
-byte *Scumm::getStringAddressVar(int i)
-{
+byte *Scumm::getStringAddressVar(int i) {
byte *addr;
addr = getResourceAddress(rtString, _vars[i]);
@@ -1166,8 +1143,7 @@ byte *Scumm::getStringAddressVar(int i)
return (addr);
}
-void Scumm::setResourceCounter(int type, int idx, byte flag)
-{
+void Scumm::setResourceCounter(int type, int idx, byte flag) {
res.flags[type][idx] &= ~RF_USAGE;
res.flags[type][idx] |= flag;
}
@@ -1175,8 +1151,7 @@ void Scumm::setResourceCounter(int type, int idx, byte flag)
/* 2 bytes safety area to make "precaching" of bytes in the gdi drawer easier */
#define SAFETY_AREA 2
-byte *Scumm::createResource(int type, int idx, uint32 size)
-{
+byte *Scumm::createResource(int type, int idx, uint32 size) {
byte *ptr;
CHECK_HEAP
@@ -1202,8 +1177,7 @@ byte *Scumm::createResource(int type, int idx, uint32 size)
return ptr + sizeof(MemBlkHeader); /* skip header */
}
-bool Scumm::validateResource(const char *str, int type, int idx)
-{
+bool Scumm::validateResource(const char *str, int type, int idx) {
if (type < rtFirst || type > rtLast || (uint) idx >= (uint) res.num[type]) {
warning("%s Illegal Glob type %s (%d) num %d", str, resTypeFromId(type), type, idx);
return false;
@@ -1211,8 +1185,7 @@ bool Scumm::validateResource(const char *str, int type, int idx)
return true;
}
-void Scumm::nukeResource(int type, int idx)
-{
+void Scumm::nukeResource(int type, int idx) {
byte *ptr;
CHECK_HEAP
@@ -1230,8 +1203,7 @@ void Scumm::nukeResource(int type, int idx)
}
}
-byte *Scumm::findResourceData(uint32 tag, byte *ptr)
-{
+byte *Scumm::findResourceData(uint32 tag, byte *ptr) {
if (_features & GF_SMALL_HEADER)
ptr = findResourceSmall(tag, ptr, 0);
else
@@ -1242,8 +1214,7 @@ byte *Scumm::findResourceData(uint32 tag, byte *ptr)
return ptr + _resourceHeaderSize;
}
-int Scumm::getResourceDataSize(byte *ptr)
-{
+int Scumm::getResourceDataSize(byte *ptr) {
if (ptr == NULL)
return 0;
@@ -1259,8 +1230,7 @@ struct FindResourceState {
};
/* just O(N) complexity when iterating with this function */
-byte *findResource(uint32 tag, byte *searchin)
-{
+byte *findResource(uint32 tag, byte *searchin) {
uint32 size;
static FindResourceState frs;
FindResourceState *f = &frs; /* easier to make it thread safe like this */
@@ -1288,8 +1258,7 @@ byte *findResource(uint32 tag, byte *searchin)
return f->ptr;
}
-byte *findResourceSmall(uint32 tag, byte *searchin)
-{
+byte *findResourceSmall(uint32 tag, byte *searchin) {
uint32 size;
static FindResourceState frs;
FindResourceState *f = &frs; /* easier to make it thread safe like this */
@@ -1320,8 +1289,7 @@ byte *findResourceSmall(uint32 tag, byte *searchin)
return f->ptr;
}
-byte *findResource(uint32 tag, byte *searchin, int idx)
-{
+byte *findResource(uint32 tag, byte *searchin, int idx) {
uint32 curpos, totalsize, size;
assert(searchin);
@@ -1349,8 +1317,7 @@ byte *findResource(uint32 tag, byte *searchin, int idx)
return NULL;
}
-byte *findResourceSmall(uint32 tag, byte *searchin, int idx)
-{
+byte *findResourceSmall(uint32 tag, byte *searchin, int idx) {
uint32 curpos, totalsize, size;
uint16 smallTag;
@@ -1381,8 +1348,7 @@ byte *findResourceSmall(uint32 tag, byte *searchin, int idx)
return NULL;
}
-void Scumm::lock(int type, int i)
-{
+void Scumm::lock(int type, int i) {
if (!validateResource("Locking", type, i))
return;
res.flags[type][i] |= RF_LOCK;
@@ -1390,8 +1356,7 @@ void Scumm::lock(int type, int i)
// debug(1, "locking %d,%d", type, i);
}
-void Scumm::unlock(int type, int i)
-{
+void Scumm::unlock(int type, int i) {
if (!validateResource("Unlocking", type, i))
return;
res.flags[type][i] &= ~RF_LOCK;
@@ -1419,8 +1384,7 @@ bool Scumm::isResourceInUse(int type, int i)
}
}
-void Scumm::increaseResourceCounter()
-{
+void Scumm::increaseResourceCounter() {
int i, j;
byte counter;
@@ -1434,8 +1398,7 @@ void Scumm::increaseResourceCounter()
}
}
-void Scumm::expireResources(uint32 size)
-{
+void Scumm::expireResources(uint32 size) {
int i, j;
byte flag;
byte best_counter;
@@ -1480,8 +1443,7 @@ void Scumm::expireResources(uint32 size)
debug(5, "Expired resources, mem %d -> %d", oldAllocatedSize, _allocatedSize);
}
-void Scumm::freeResources()
-{
+void Scumm::freeResources() {
int i, j;
for (i = rtFirst; i <= rtLast; i++) {
for (j = res.num[i]; --j >= 0;) {
@@ -1495,8 +1457,7 @@ void Scumm::freeResources()
}
}
-void Scumm::loadPtrToResource(int type, int resindex, byte *source)
-{
+void Scumm::loadPtrToResource(int type, int resindex, byte *source) {
byte *alloced;
int i, len;
@@ -1519,15 +1480,13 @@ void Scumm::loadPtrToResource(int type, int resindex, byte *source)
}
}
-bool Scumm::isResourceLoaded(int type, int idx)
-{
+bool Scumm::isResourceLoaded(int type, int idx) {
if (!validateResource("isLoaded", type, idx))
return false;
return res.address[type][idx] != NULL;
}
-void Scumm::resourceStats()
-{
+void Scumm::resourceStats() {
int i, j;
uint32 lockedSize = 0, lockedNum = 0;
byte flag;
@@ -1544,17 +1503,14 @@ void Scumm::resourceStats()
debug(1, "Total allocated size=%d, locked=%d(%d)\n", _allocatedSize, lockedSize, lockedNum);
}
-void Scumm::heapClear(int mode)
-{
+void Scumm::heapClear(int mode) {
}
-void Scumm::unkHeapProc2(int a, int b)
-{
+void Scumm::unkHeapProc2(int a, int b) {
}
-void Scumm::readMAXS()
-{
- if (_features & GF_AFTER_V8) { // CMI
+void Scumm::readMAXS() {
+ if (_features & GF_AFTER_V8) { // CMI
_fileHandle.seek(50 + 50, SEEK_CUR); // 176 - 8
_numVariables = _fileHandle.readUint32LE(); // 1500
_numBitVariables = _fileHandle.readUint32LE(); // 2048
@@ -1651,8 +1607,7 @@ void Scumm::readMAXS()
_dynamicRoomOffsets = 1;
}
-void Scumm::allocateArrays()
-{
+void Scumm::allocateArrays() {
// Note: Buffers are now allocated in scummMain to allow for
// early GUI init.
@@ -1688,17 +1643,14 @@ void Scumm::allocateArrays()
}
-bool Scumm::isGlobInMemory(int type, int idx)
-{
+bool Scumm::isGlobInMemory(int type, int idx) {
if (!validateResource("isGlobInMemory", type, idx))
return false;
return res.address[type][idx] != NULL;
}
-
-uint16 newTag2Old(uint32 oldTag)
-{
+uint16 newTag2Old(uint32 oldTag) {
switch (oldTag) {
case (MKID('RMHD')):
return (0x4448); // HD
@@ -1738,9 +1690,7 @@ uint16 newTag2Old(uint32 oldTag)
}
}
-
-char *Scumm::resTypeFromId(int id)
-{
+char *Scumm::resTypeFromId(int id) {
static char buf[100];
switch (id) {
diff --git a/scumm/resource_v2.cpp b/scumm/resource_v2.cpp
index b992b3d7ea..0bab223390 100644
--- a/scumm/resource_v2.cpp
+++ b/scumm/resource_v2.cpp
@@ -25,8 +25,7 @@
#include "resource.h"
-void Scumm_v2::readIndexFile()
-{
+void Scumm_v2::readIndexFile() {
int magic = 0;
debug(9, "readIndexFile()");
diff --git a/scumm/resource_v3.cpp b/scumm/resource_v3.cpp
index e9b0a25d31..cb7e3e7953 100644
--- a/scumm/resource_v3.cpp
+++ b/scumm/resource_v3.cpp
@@ -26,8 +26,7 @@
#include "resource.h"
-void Scumm_v3::readIndexFile()
-{
+void Scumm_v3::readIndexFile() {
uint16 blocktype;
uint32 itemsize;
int numblock = 0;
@@ -151,8 +150,7 @@ void Scumm_v3::readIndexFile()
closeRoom();
}
-void Scumm_v3::loadCharset(int no)
-{
+void Scumm_v3::loadCharset(int no) {
uint32 size;
memset(_charsetData, 0, sizeof(_charsetData));
diff --git a/scumm/resource_v4.cpp b/scumm/resource_v4.cpp
index e8731bae18..69d3a5cd44 100644
--- a/scumm/resource_v4.cpp
+++ b/scumm/resource_v4.cpp
@@ -24,8 +24,7 @@
#include "scumm.h"
#include "intern.h"
-void Scumm_v4::loadCharset(int no)
-{
+void Scumm_v4::loadCharset(int no) {
uint32 size;
memset(_charsetData, 0, sizeof(_charsetData));
diff --git a/scumm/saveload.cpp b/scumm/saveload.cpp
index f94562c435..469637824a 100644
--- a/scumm/saveload.cpp
+++ b/scumm/saveload.cpp
@@ -40,23 +40,20 @@ struct SaveGameHeader {
};
-void Scumm::requestSave(int slot, const char *name)
-{
+void Scumm::requestSave(int slot, const char *name) {
_saveLoadSlot = slot;
_saveLoadCompatible = false;
_saveLoadFlag = 1; // 1 for save
strcpy(_saveLoadName, name);
}
-void Scumm::requestLoad(int slot)
-{
+void Scumm::requestLoad(int slot) {
_saveLoadSlot = slot;
_saveLoadCompatible = false;
_saveLoadFlag = 2; // 2 for load
}
-bool Scumm::saveState(int slot, bool compat, SaveFileManager *mgr)
-{
+bool Scumm::saveState(int slot, bool compat, SaveFileManager *mgr) {
char filename[256];
SaveFile *out;
SaveGameHeader hdr;
@@ -82,8 +79,7 @@ bool Scumm::saveState(int slot, bool compat, SaveFileManager *mgr)
return true;
}
-bool Scumm::loadState(int slot, bool compat, SaveFileManager *mgr)
-{
+bool Scumm::loadState(int slot, bool compat, SaveFileManager *mgr) {
char filename[256];
SaveFile *out;
int i, j;
@@ -184,23 +180,20 @@ bool Scumm::loadState(int slot, bool compat, SaveFileManager *mgr)
return true;
}
-void Scumm::makeSavegameName(char *out, int slot, bool compatible)
-{
+void Scumm::makeSavegameName(char *out, int slot, bool compatible) {
const char *dir = getSavePath();
sprintf(out, "%s%s.%c%.2d", dir, _game_name, compatible ? 'c' : 's', slot);
}
-void Scumm::listSavegames(bool *marks, int num, SaveFileManager *mgr)
-{
+void Scumm::listSavegames(bool *marks, int num, SaveFileManager *mgr) {
char prefix[256];
makeSavegameName(prefix, 99, false);
prefix[strlen(prefix)-2] = 0;
mgr->list_savefiles(prefix, marks, num);
}
-bool Scumm::getSavegameName(int slot, char *desc, SaveFileManager *mgr)
-{
+bool Scumm::getSavegameName(int slot, char *desc, SaveFileManager *mgr) {
char filename[256];
SaveFile *out;
SaveGameHeader hdr;
@@ -231,8 +224,7 @@ bool Scumm::getSavegameName(int slot, char *desc, SaveFileManager *mgr)
return true;
}
-void Scumm::saveOrLoad(Serializer *s, uint32 savegameVersion)
-{
+void Scumm::saveOrLoad(Serializer *s, uint32 savegameVersion) {
const SaveLoadEntry objectEntries[] = {
MKLINE(ObjectData, OBIMoffset, sleUint32, VER_V8),
MKLINE(ObjectData, OBCDoffset, sleUint32, VER_V8),
@@ -678,8 +670,7 @@ void Scumm::saveOrLoad(Serializer *s, uint32 savegameVersion)
}
}
-void Scumm::saveLoadResource(Serializer *ser, int type, int idx)
-{
+void Scumm::saveLoadResource(Serializer *ser, int type, int idx) {
byte *ptr;
uint32 size;
@@ -714,13 +705,11 @@ void Scumm::saveLoadResource(Serializer *ser, int type, int idx)
}
}
-void Serializer::saveBytes(void *b, int len)
-{
+void Serializer::saveBytes(void *b, int len) {
_saveLoadStream->fwrite(b, 1, len);
}
-void Serializer::loadBytes(void *b, int len)
-{
+void Serializer::loadBytes(void *b, int len) {
_saveLoadStream->fread(b, 1, len);
}
@@ -728,8 +717,7 @@ void Serializer::loadBytes(void *b, int len)
// Perhaps not necessary anymore with latest checks
-bool Serializer::checkEOFLoadStream()
-{
+bool Serializer::checkEOFLoadStream() {
if (!_saveLoadStream->fseek(1, SEEK_CUR))
return true;
if (_saveLoadStream->feof())
@@ -741,46 +729,39 @@ bool Serializer::checkEOFLoadStream()
#endif
-void Serializer::saveUint32(uint32 d)
-{
+void Serializer::saveUint32(uint32 d) {
uint32 e = FROM_LE_32(d);
saveBytes(&e, 4);
}
-void Serializer::saveWord(uint16 d)
-{
+void Serializer::saveWord(uint16 d) {
uint16 e = FROM_LE_16(d);
saveBytes(&e, 2);
}
-void Serializer::saveByte(byte b)
-{
+void Serializer::saveByte(byte b) {
saveBytes(&b, 1);
}
-uint32 Serializer::loadUint32()
-{
+uint32 Serializer::loadUint32() {
uint32 e;
loadBytes(&e, 4);
return FROM_LE_32(e);
}
-uint16 Serializer::loadWord()
-{
+uint16 Serializer::loadWord() {
uint16 e;
loadBytes(&e, 2);
return FROM_LE_16(e);
}
-byte Serializer::loadByte()
-{
+byte Serializer::loadByte() {
byte e;
loadBytes(&e, 1);
return e;
}
-void Serializer::saveArrayOf(void *b, int len, int datasize, byte filetype)
-{
+void Serializer::saveArrayOf(void *b, int len, int datasize, byte filetype) {
byte *at = (byte *)b;
uint32 data;
@@ -824,8 +805,7 @@ void Serializer::saveArrayOf(void *b, int len, int datasize, byte filetype)
}
}
-void Serializer::loadArrayOf(void *b, int len, int datasize, byte filetype)
-{
+void Serializer::loadArrayOf(void *b, int len, int datasize, byte filetype) {
byte *at = (byte *)b;
uint32 data;
@@ -872,8 +852,7 @@ void Serializer::loadArrayOf(void *b, int len, int datasize, byte filetype)
}
}
-void Serializer::saveLoadArrayOf(void *b, int num, int datasize, const SaveLoadEntry *sle)
-{
+void Serializer::saveLoadArrayOf(void *b, int num, int datasize, const SaveLoadEntry *sle) {
byte *data = (byte *)b;
if (isSaving()) {
@@ -889,24 +868,21 @@ void Serializer::saveLoadArrayOf(void *b, int num, int datasize, const SaveLoadE
}
}
-void Serializer::saveLoadArrayOf(void *b, int len, int datasize, byte filetype)
-{
+void Serializer::saveLoadArrayOf(void *b, int len, int datasize, byte filetype) {
if (isSaving())
saveArrayOf(b, len, datasize, filetype);
else
loadArrayOf(b, len, datasize, filetype);
}
-void Serializer::saveLoadEntries(void *d, const SaveLoadEntry *sle)
-{
+void Serializer::saveLoadEntries(void *d, const SaveLoadEntry *sle) {
if (isSaving())
saveEntries(d, sle);
else
loadEntries(d, sle);
}
-void Serializer::saveEntries(void *d, const SaveLoadEntry *sle)
-{
+void Serializer::saveEntries(void *d, const SaveLoadEntry *sle) {
byte type;
byte *at;
int size;
@@ -938,8 +914,7 @@ void Serializer::saveEntries(void *d, const SaveLoadEntry *sle)
}
}
-void Serializer::loadEntries(void *d, const SaveLoadEntry *sle)
-{
+void Serializer::loadEntries(void *d, const SaveLoadEntry *sle) {
byte type;
byte *at;
int size;
diff --git a/scumm/script.cpp b/scumm/script.cpp
index e5d8fc7429..11ca746c69 100644
--- a/scumm/script.cpp
+++ b/scumm/script.cpp
@@ -35,8 +35,7 @@ enum {
/* Start executing script 'script' with parameters 'a' and 'b' */
-void Scumm::runScript(int script, int a, int b, int *lvarptr)
-{
+void Scumm::runScript(int script, int a, int b, int *lvarptr) {
byte *scriptPtr;
uint32 scriptOffs;
byte scriptType;
@@ -80,8 +79,7 @@ void Scumm::runScript(int script, int a, int b, int *lvarptr)
}
/* Stop script 'script' */
-void Scumm::stopScriptNr(int script)
-{
+void Scumm::stopScriptNr(int script) {
ScriptSlot *ss;
NestedScript *nest;
int i, num;
@@ -119,8 +117,7 @@ void Scumm::stopScriptNr(int script)
}
/* Stop an object script 'script'*/
-void Scumm::stopObjectScript(int script)
-{
+void Scumm::stopObjectScript(int script) {
ScriptSlot *ss;
NestedScript *nest;
int i, num;
@@ -159,8 +156,7 @@ void Scumm::stopObjectScript(int script)
}
/* Return a free script slot */
-int Scumm::getScriptSlot()
-{
+int Scumm::getScriptSlot() {
ScriptSlot *ss;
int i;
ss = &vm.slot[1];
@@ -174,8 +170,7 @@ int Scumm::getScriptSlot()
}
/* Run script 'script' nested - eg, within the parent script.*/
-void Scumm::runScriptNested(int script)
-{
+void Scumm::runScriptNested(int script) {
NestedScript *nest;
ScriptSlot *slot;
@@ -219,8 +214,7 @@ void Scumm::runScriptNested(int script)
_currentScript = 0xFF;
}
-void Scumm::updateScriptPtr()
-{
+void Scumm::updateScriptPtr() {
if (_currentScript == 0xFF)
return;
@@ -228,8 +222,7 @@ void Scumm::updateScriptPtr()
}
/* Get the code pointer to a script */
-void Scumm::getScriptBaseAddress()
-{
+void Scumm::getScriptBaseAddress() {
ScriptSlot *ss;
int idx;
@@ -271,16 +264,14 @@ void Scumm::getScriptBaseAddress()
}
-void Scumm::getScriptEntryPoint()
-{
+void Scumm::getScriptEntryPoint() {
if (_currentScript == 0xFF)
return;
_scriptPointer = _scriptOrgPointer + vm.slot[_currentScript].offs;
}
/* Execute a script - Read opcode, and execute it from the table */
-void Scumm::executeScript()
-{
+void Scumm::executeScript() {
while (_currentScript != 0xFF) {
_opcode = fetchScriptByte();
vm.slot[_currentScript].didexec = 1;
@@ -294,8 +285,7 @@ void Scumm::executeScript()
CHECK_HEAP;
}
-byte Scumm::fetchScriptByte()
-{
+byte Scumm::fetchScriptByte() {
if (*_lastCodePtr + sizeof(MemBlkHeader) != _scriptOrgPointer) {
uint32 oldoffs = _scriptPointer - _scriptOrgPointer;
getScriptBaseAddress();
@@ -304,8 +294,7 @@ byte Scumm::fetchScriptByte()
return *_scriptPointer++;
}
-uint Scumm::fetchScriptWord()
-{
+uint Scumm::fetchScriptWord() {
int a;
if (*_lastCodePtr + sizeof(MemBlkHeader) != _scriptOrgPointer) {
uint32 oldoffs = _scriptPointer - _scriptOrgPointer;
@@ -317,8 +306,7 @@ uint Scumm::fetchScriptWord()
return a;
}
-int Scumm::fetchScriptWordSigned()
-{
+int Scumm::fetchScriptWordSigned() {
return (int16)fetchScriptWord();
}
@@ -326,8 +314,7 @@ int Scumm::fetchScriptWordSigned()
#define BYPASS_COPY_PROT
#endif
-int Scumm::readVar(uint var)
-{
+int Scumm::readVar(uint var) {
int a;
#ifdef BYPASS_COPY_PROT
static byte copyprotbypassed;
@@ -392,8 +379,7 @@ int Scumm::readVar(uint var)
return -1;
}
-void Scumm::writeVar(uint var, int value)
-{
+void Scumm::writeVar(uint var, int value) {
if (!(var & 0xF000)) {
checkRange(_numVariables - 1, 0, var, "Variable %d out of range(w)");
@@ -422,7 +408,7 @@ void Scumm::writeVar(uint var, int value)
var >>= 4;
checkRange(_numVariables - 1, 0, var, "Variable %d out of range(wzb)");
if(value)
- _vars[ var ] |= ( 1 << b );
+ _vars[ var ] |= ( 1 << b );
else
_vars[ var ] &= ~( 1 << b );
return;
@@ -457,8 +443,7 @@ void Scumm::writeVar(uint var, int value)
error("Illegal varbits (w)");
}
-void Scumm::getResultPos()
-{
+void Scumm::getResultPos() {
int a;
_resultVarNumber = fetchScriptWord();
@@ -473,27 +458,24 @@ void Scumm::getResultPos()
}
}
-void Scumm::setResult(int value)
-{
+void Scumm::setResult(int value) {
writeVar(_resultVarNumber, value);
}
-void Scumm::push(int a)
-{
+void Scumm::push(int a) {
assert(_scummStackPos >= 0 && (unsigned int)_scummStackPos <= ARRAYSIZE(_scummStack));
_scummStack[_scummStackPos++] = a;
}
-int Scumm::pop()
-{
+int Scumm::pop() {
if ((_scummStackPos < 1) || ((unsigned int)_scummStackPos > ARRAYSIZE(_scummStack))) {
error("No items on stack to pop() for %s (0x%X) at [%d-%d]", getOpcodeDesc(_opcode), _opcode, _roomResource, vm.slot[_currentScript].number);
}
return _scummStack[--_scummStackPos];
}
-void Scumm::drawBox(int x, int y, int x2, int y2, int color)
-{
+
+void Scumm::drawBox(int x, int y, int x2, int y2, int color) {
int top, bottom, count;
VirtScreen *vs;
byte *backbuff, *bgbuff;
@@ -546,8 +528,7 @@ void Scumm::drawBox(int x, int y, int x2, int y2, int color)
}
-void Scumm::stopObjectCode()
-{
+void Scumm::stopObjectCode() {
ScriptSlot *ss;
ss = &vm.slot[_currentScript];
@@ -572,8 +553,7 @@ void Scumm::stopObjectCode()
_currentScript = 0xFF;
}
-bool Scumm::isScriptInUse(int script)
-{
+bool Scumm::isScriptInUse(int script) {
ScriptSlot *ss;
int i;
@@ -586,8 +566,7 @@ bool Scumm::isScriptInUse(int script)
}
-void Scumm::runHook(int i)
-{
+void Scumm::runHook(int i) {
int tmp[16];
tmp[0] = i;
if (_vars[VAR_HOOK_SCRIPT]) {
@@ -595,8 +574,7 @@ void Scumm::runHook(int i)
}
}
-void Scumm::freezeScripts(int flag)
-{
+void Scumm::freezeScripts(int flag) {
int i;
for (i = 1; i < NUM_SCRIPT_SLOT; i++) {
@@ -615,8 +593,7 @@ void Scumm::freezeScripts(int flag)
}
}
-void Scumm::unfreezeScripts()
-{
+void Scumm::unfreezeScripts() {
int i;
for (i = 1; i < NUM_SCRIPT_SLOT; i++) {
if (vm.slot[i].status & 0x80) {
@@ -632,8 +609,7 @@ void Scumm::unfreezeScripts()
}
}
-void Scumm::runAllScripts()
-{
+void Scumm::runAllScripts() {
int i;
for (i = 0; i < NUM_SCRIPT_SLOT; i++)
@@ -654,8 +630,7 @@ void Scumm::runAllScripts()
}
}
-void Scumm::runExitScript()
-{
+void Scumm::runExitScript() {
if (_vars[VAR_EXIT_SCRIPT])
runScript(_vars[VAR_EXIT_SCRIPT], 0, 0, 0);
if (_EXCD_offs) {
@@ -691,8 +666,7 @@ void Scumm::runExitScript()
runScript(_vars[VAR_EXIT_SCRIPT2], 0, 0, 0);
}
-void Scumm::runEntryScript()
-{
+void Scumm::runEntryScript() {
if (_vars[VAR_ENTRY_SCRIPT])
runScript(_vars[VAR_ENTRY_SCRIPT], 0, 0, 0);
if (_ENCD_offs) {
@@ -711,8 +685,7 @@ void Scumm::runEntryScript()
runScript(_vars[VAR_ENTRY_SCRIPT2], 0, 0, 0);
}
-void Scumm::killScriptsAndResources()
-{
+void Scumm::killScriptsAndResources() {
ScriptSlot *ss;
int i;
@@ -742,16 +715,14 @@ void Scumm::killScriptsAndResources()
}
}
-void Scumm::killAllScriptsExceptCurrent()
-{
+void Scumm::killAllScriptsExceptCurrent() {
for (int i = 1; i < NUM_SCRIPT_SLOT; i++) {
if (i != _currentScript)
vm.slot[i].status = ssDead;
}
}
-void Scumm::doSentence(int c, int b, int a)
-{
+void Scumm::doSentence(int c, int b, int a) {
SentenceTab *st;
if (_features & GF_AFTER_V7) {
@@ -787,8 +758,7 @@ void Scumm::doSentence(int c, int b, int a)
st->freezeCount = 0;
}
-void Scumm::checkAndRunSentenceScript()
-{
+void Scumm::checkAndRunSentenceScript() {
int i;
ScriptSlot *ss;
@@ -817,8 +787,7 @@ void Scumm::checkAndRunSentenceScript()
runScript(_vars[VAR_SENTENCE_SCRIPT], 0, 0, _localParamList);
}
-void Scumm::runInputScript(int a, int cmd, int mode)
-{
+void Scumm::runInputScript(int a, int cmd, int mode) {
int args[16];
memset(args, 0, sizeof(args));
args[0] = a;
@@ -828,8 +797,7 @@ void Scumm::runInputScript(int a, int cmd, int mode)
runScript(_vars[VAR_VERB_SCRIPT], 0, 0, args);
}
-void Scumm::decreaseScriptDelay(int amount)
-{
+void Scumm::decreaseScriptDelay(int amount) {
ScriptSlot *ss = &vm.slot[0];
int i;
for (i = 0; i < NUM_SCRIPT_SLOT; i++, ss++) {
@@ -843,8 +811,7 @@ void Scumm::decreaseScriptDelay(int amount)
}
}
-void Scumm::runVerbCode(int object, int entry, int a, int b, int *vars)
-{
+void Scumm::runVerbCode(int object, int entry, int a, int b, int *vars) {
uint32 obcd;
int slot, where, offs;
@@ -881,8 +848,7 @@ void Scumm::runVerbCode(int object, int entry, int a, int b, int *vars)
runScriptNested(slot);
}
-void Scumm::initializeLocals(int slot, int *vars)
-{
+void Scumm::initializeLocals(int slot, int *vars) {
int i;
if (!vars) {
for (i = 0; i < 16; i++)
@@ -893,8 +859,7 @@ void Scumm::initializeLocals(int slot, int *vars)
}
}
-int Scumm::getVerbEntrypoint(int obj, int entry)
-{
+int Scumm::getVerbEntrypoint(int obj, int entry) {
byte *objptr, *verbptr;
int verboffs;
@@ -944,8 +909,7 @@ int Scumm::getVerbEntrypoint(int obj, int entry)
}
}
-bool Scumm::isScriptRunning(int script)
-{
+bool Scumm::isScriptRunning(int script) {
int i;
ScriptSlot *ss = vm.slot;
for (i = 0; i < NUM_SCRIPT_SLOT; i++, ss++)
@@ -954,19 +918,16 @@ bool Scumm::isScriptRunning(int script)
return false;
}
-bool Scumm::isRoomScriptRunning(int script)
-{
+bool Scumm::isRoomScriptRunning(int script) {
int i;
ScriptSlot *ss = vm.slot;
for (i = 0; i < NUM_SCRIPT_SLOT; i++, ss++)
if (ss->number == script && ss->where == WIO_ROOM && ss->status != ssDead)
return true;
return false;
-
}
-int Scumm::defineArray(int array, int type, int dim2, int dim1)
-{
+int Scumm::defineArray(int array, int type, int dim2, int dim1) {
int id;
int size;
ArrayHeader *ah;
@@ -1015,8 +976,7 @@ int Scumm::defineArray(int array, int type, int dim2, int dim1)
return id;
}
-void Scumm::nukeArray(int a)
-{
+void Scumm::nukeArray(int a) {
int data;
data = readVar(a);
@@ -1028,8 +988,7 @@ void Scumm::nukeArray(int a)
writeVar(a, 0);
}
-int Scumm::getArrayId()
-{
+int Scumm::getArrayId() {
byte **addr = _baseArrays;
int i;
@@ -1041,8 +1000,7 @@ int Scumm::getArrayId()
return -1;
}
-void Scumm::copyScriptString(byte *dst)
-{
+void Scumm::copyScriptString(byte *dst) {
int len = resStrLen(_scriptPointer) + 1;
while (len--)
*dst++ = fetchScriptByte();
@@ -1054,8 +1012,7 @@ void Scumm::copyScriptString(byte *dst)
// special characters embedded into the string. The reason for this function is that
// sometimes this embedded data contains zero bytes, thus we can't just use strlen.
//
-int Scumm::resStrLen(const byte *src) const
-{
+int Scumm::resStrLen(const byte *src) const {
int num = 0;
byte chr;
if (src == NULL)
@@ -1080,8 +1037,7 @@ int Scumm::resStrLen(const byte *src) const
return num;
}
-void Scumm::cutscene(int *args)
-{
+void Scumm::cutscene(int *args) {
int scr = _currentScript;
vm.slot[scr].cutsceneOverride++;
@@ -1098,8 +1054,7 @@ void Scumm::cutscene(int *args)
vm.cutSceneScriptIndex = 0xFF;
}
-void Scumm::endCutscene()
-{
+void Scumm::endCutscene() {
ScriptSlot *ss = &vm.slot[_currentScript];
int args[16];
@@ -1122,8 +1077,7 @@ void Scumm::endCutscene()
runScript(_vars[VAR_CUTSCENE_END_SCRIPT], 0, 0, args);
}
-void Scumm::exitCutscene()
-{
+void Scumm::exitCutscene() {
uint32 offs = vm.cutScenePtr[vm.cutSceneStackPointer];
if (offs) {
ScriptSlot *ss = &vm.slot[vm.cutSceneScript[vm.cutSceneStackPointer]];
@@ -1139,8 +1093,7 @@ void Scumm::exitCutscene()
}
}
-void Scumm::beginOverride()
-{
+void Scumm::beginOverride() {
int idx;
idx = vm.cutSceneStackPointer;
@@ -1157,8 +1110,7 @@ void Scumm::beginOverride()
_vars[VAR_OVERRIDE] = 0;
}
-void Scumm::endOverride()
-{
+void Scumm::endOverride() {
int idx;
idx = vm.cutSceneStackPointer;
diff --git a/scumm/script_v5.cpp b/scumm/script_v5.cpp
index d1a4de8710..e7f56c7b14 100644
--- a/scumm/script_v5.cpp
+++ b/scumm/script_v5.cpp
@@ -30,8 +30,7 @@
#define OPCODE(x) { &Scumm_v5::x, #x }
-void Scumm_v5::setupOpcodes()
-{
+void Scumm_v5::setupOpcodes() {
static const OpcodeEntryV5 opcodes[256] = {
/* 00 */
OPCODE(o5_stopObjectCode),
@@ -358,24 +357,20 @@ void Scumm_v5::setupOpcodes()
_opcodesV5 = opcodes;
}
-void Scumm_v5::executeOpcode(int i)
-{
+void Scumm_v5::executeOpcode(int i) {
OpcodeProcV5 op = _opcodesV5[i].proc;
(this->*op) ();
}
-const char *Scumm_v5::getOpcodeDesc(int i)
-{
+const char *Scumm_v5::getOpcodeDesc(int i) {
return _opcodesV5[i].desc;
}
-void Scumm_v5::o5_actorFollowCamera()
-{
+void Scumm_v5::o5_actorFollowCamera() {
actorFollowCamera(getVarOrDirectByte(0x80));
}
-void Scumm_v5::o5_actorFromPos()
-{
+void Scumm_v5::o5_actorFromPos() {
int x, y;
getResultPos();
x = getVarOrDirectWord(0x80);
@@ -383,8 +378,7 @@ void Scumm_v5::o5_actorFromPos()
setResult(getActorFromPos(x, y));
}
-void Scumm_v5::o5_actorSet()
-{
+void Scumm_v5::o5_actorSet() {
static const byte convertTable[20] =
{ 1, 0, 0, 2, 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 20 };
int act = getVarOrDirectByte(0x80);
@@ -521,8 +515,7 @@ void Scumm_v5::o5_actorSet()
}
}
-void Scumm_v5::o5_setClass()
-{
+void Scumm_v5::o5_setClass() {
int obj = getVarOrDirectWord(0x80);
int newClass;
@@ -543,24 +536,21 @@ void Scumm_v5::o5_setClass()
}
}
-void Scumm_v5::o5_add()
-{
+void Scumm_v5::o5_add() {
int a;
getResultPos();
a = getVarOrDirectWord(0x80);
setResult(readVar(_resultVarNumber) + a);
}
-void Scumm_v5::o5_and()
-{
+void Scumm_v5::o5_and() {
int a;
getResultPos();
a = getVarOrDirectWord(0x80);
setResult(readVar(_resultVarNumber) & a);
}
-void Scumm_v5::o5_animateActor()
-{
+void Scumm_v5::o5_animateActor() {
int act = getVarOrDirectByte(0x80);
int anim = getVarOrDirectByte(0x40);
@@ -571,19 +561,16 @@ void Scumm_v5::o5_animateActor()
a->animateActor(anim);
}
-void Scumm_v5::o5_badOpcode()
-{
+void Scumm_v5::o5_badOpcode() {
error("Scumm opcode %d illegal", _opcode);
}
-void Scumm_v5::o5_breakHere()
-{
+void Scumm_v5::o5_breakHere() {
updateScriptPtr();
_currentScript = 0xFF;
}
-void Scumm_v5::o5_chainScript()
-{
+void Scumm_v5::o5_chainScript() {
int vars[16];
int data;
int cur;
@@ -601,8 +588,7 @@ void Scumm_v5::o5_chainScript()
runScript(data, vm.slot[cur].unk1, vm.slot[cur].unk2, vars);
}
-void Scumm_v5::o5_cursorCommand()
-{
+void Scumm_v5::o5_cursorCommand() {
int i, j, k;
int table[16];
switch ((_opcode = fetchScriptByte()) & 0x1F) {
@@ -646,7 +632,6 @@ void Scumm_v5::o5_cursorCommand()
k = getVarOrDirectByte(0x20);
setCursorHotspot2(j, k);
break;
-
case 12: /* init cursor */
setCursor(getVarOrDirectByte(0x80));
break;
@@ -664,31 +649,26 @@ void Scumm_v5::o5_cursorCommand()
_vars[VAR_USERPUT] = _userPut;
}
-void Scumm_v5::o5_cutscene()
-{
+void Scumm_v5::o5_cutscene() {
int args[16];
getWordVararg(args);
cutscene(args);
}
-void Scumm_v5::o5_endCutscene()
-{
+void Scumm_v5::o5_endCutscene() {
endCutscene();
}
-void Scumm_v5::o5_debug()
-{
+void Scumm_v5::o5_debug() {
getVarOrDirectWord(0x80);
}
-void Scumm_v5::o5_decrement()
-{
+void Scumm_v5::o5_decrement() {
getResultPos();
setResult(readVar(_resultVarNumber) - 1);
}
-void Scumm_v5::o5_delay()
-{
+void Scumm_v5::o5_delay() {
int delay = fetchScriptByte();
delay |= fetchScriptByte() << 8;
delay |= fetchScriptByte() << 16;
@@ -697,15 +677,13 @@ void Scumm_v5::o5_delay()
o5_breakHere();
}
-void Scumm_v5::o5_delayVariable()
-{
+void Scumm_v5::o5_delayVariable() {
vm.slot[_currentScript].delay = readVar(fetchScriptWord());
vm.slot[_currentScript].status = 1;
o5_breakHere();
}
-void Scumm_v5::o5_divide()
-{
+void Scumm_v5::o5_divide() {
int a;
getResultPos();
a = getVarOrDirectWord(0x80);
@@ -716,8 +694,7 @@ void Scumm_v5::o5_divide()
setResult(readVar(_resultVarNumber) / a);
}
-void Scumm_v5::o5_doSentence()
-{
+void Scumm_v5::o5_doSentence() {
int a, b;
SentenceTab *st;
@@ -742,8 +719,7 @@ void Scumm_v5::o5_doSentence()
st->freezeCount = 0;
}
-void Scumm_v5::o5_drawBox()
-{
+void Scumm_v5::o5_drawBox() {
int x, y, x2, y2, color;
x = getVarOrDirectWord(0x80);
@@ -757,8 +733,7 @@ void Scumm_v5::o5_drawBox()
drawBox(x, y, x2, y2, color);
}
-void Scumm_v5::o5_drawObject()
-{
+void Scumm_v5::o5_drawObject() {
int state, obj, idx, i;
ObjectData *od;
uint16 x, y, w, h;
@@ -814,14 +789,11 @@ void Scumm_v5::o5_drawObject()
putState(obj, state);
}
-void Scumm_v5::o5_dummy()
-{
+void Scumm_v5::o5_dummy() {
/* nothing */
}
-
-void Scumm_v5::o5_expression()
-{
+void Scumm_v5::o5_expression() {
int dst, i;
_scummStackPos = 0;
@@ -863,8 +835,7 @@ void Scumm_v5::o5_expression()
setResult(pop());
}
-void Scumm_v5::o5_faceActor()
-{
+void Scumm_v5::o5_faceActor() {
int act, obj;
Actor *a;
act = getVarOrDirectByte(0x80);
@@ -876,24 +847,21 @@ void Scumm_v5::o5_faceActor()
a->factToObject(obj);
}
-void Scumm_v5::o5_findInventory()
-{
+void Scumm_v5::o5_findInventory() {
int t;
getResultPos();
t = getVarOrDirectByte(0x80);
setResult(findInventory(t, getVarOrDirectByte(0x40)));
}
-void Scumm_v5::o5_findObject()
-{
+void Scumm_v5::o5_findObject() {
int t;
getResultPos();
t = getVarOrDirectWord(0x80);
setResult(findObject(t, getVarOrDirectWord(0x40)));
}
-void Scumm_v5::o5_freezeScripts()
-{
+void Scumm_v5::o5_freezeScripts() {
int scr = getVarOrDirectByte(0x80);
if (scr != 0)
@@ -902,8 +870,7 @@ void Scumm_v5::o5_freezeScripts()
unfreezeScripts();
}
-void Scumm_v5::o5_getActorCostume()
-{
+void Scumm_v5::o5_getActorCostume() {
int act;
Actor *a;
getResultPos();
@@ -918,8 +885,7 @@ void Scumm_v5::o5_getActorCostume()
setResult(a->costume);
}
-void Scumm_v5::o5_getActorElevation()
-{
+void Scumm_v5::o5_getActorElevation() {
int act;
Actor *a;
getResultPos();
@@ -934,8 +900,7 @@ void Scumm_v5::o5_getActorElevation()
setResult(a->elevation);
}
-void Scumm_v5::o5_getActorFacing()
-{
+void Scumm_v5::o5_getActorFacing() {
int act;
Actor *a;
getResultPos();
@@ -950,8 +915,7 @@ void Scumm_v5::o5_getActorFacing()
setResult(newDirToOldDir (a->facing));
}
-void Scumm_v5::o5_getActorMoving()
-{
+void Scumm_v5::o5_getActorMoving() {
int act;
Actor *a;
getResultPos();
@@ -966,8 +930,7 @@ void Scumm_v5::o5_getActorMoving()
setResult(a->moving);
}
-void Scumm_v5::o5_getActorRoom()
-{
+void Scumm_v5::o5_getActorRoom() {
int act;
Actor *a;
getResultPos();
@@ -982,25 +945,22 @@ void Scumm_v5::o5_getActorRoom()
setResult(a->room);
}
-void Scumm_v5::o5_getActorScale()
-{
+void Scumm_v5::o5_getActorScale() {
// INDY3 uses this opcode as a wait_for_actor();
if (_gameId == GID_INDY3_256) {
- byte *oldaddr = _scriptPointer - 1;
-
- if (derefActorSafe(getVarOrDirectByte(0x80), "o5_wait")->moving) {
- _scriptPointer = oldaddr;
- o5_breakHere();
+ byte *oldaddr = _scriptPointer - 1;
+ if (derefActorSafe(getVarOrDirectByte(0x80), "o5_wait")->moving) {
+ _scriptPointer = oldaddr;
+ o5_breakHere();
}
- return;
+ return;
}
getResultPos();
setResult(derefActorSafe(getVarOrDirectByte(0x80), "o5_getActorScale")->scalex);
}
-void Scumm_v5::o5_getActorWalkBox()
-{
+void Scumm_v5::o5_getActorWalkBox() {
Actor *a;
getResultPos();
a = derefActorSafe(getVarOrDirectByte(0x80), "o5_getActorWalkbox");
@@ -1010,14 +970,12 @@ void Scumm_v5::o5_getActorWalkBox()
setResult(0);
}
-void Scumm_v5::o5_getActorWidth()
-{
+void Scumm_v5::o5_getActorWidth() {
getResultPos();
setResult(derefActorSafe(getVarOrDirectByte(0x80), "o5_getActorWidth")->width);
}
-void Scumm_v5::o5_getActorX()
-{
+void Scumm_v5::o5_getActorX() {
int a;
getResultPos();
@@ -1029,8 +987,7 @@ void Scumm_v5::o5_getActorX()
setResult(getObjX(a));
}
-void Scumm_v5::o5_getActorY()
-{
+void Scumm_v5::o5_getActorY() {
int a;
getResultPos();
@@ -1053,8 +1010,7 @@ void Scumm_v5::o5_getActorY()
setResult(getObjY(a));
}
-void Scumm_v5::o5_getAnimCounter()
-{
+void Scumm_v5::o5_getAnimCounter() {
Actor *a;
getResultPos();
@@ -1066,8 +1022,7 @@ void Scumm_v5::o5_getAnimCounter()
setResult(0);
}
-void Scumm_v5::o5_getClosestObjActor()
-{
+void Scumm_v5::o5_getClosestObjActor() {
int obj;
int act;
int closest_obj = 0xFF, closest_dist = 0xFF;
@@ -1089,8 +1044,7 @@ void Scumm_v5::o5_getClosestObjActor()
setResult(closest_dist);
}
-void Scumm_v5::o5_getDist()
-{
+void Scumm_v5::o5_getDist() {
int o1, o2;
int r;
getResultPos();
@@ -1105,20 +1059,17 @@ void Scumm_v5::o5_getDist()
setResult(r);
}
-void Scumm_v5::o5_getInventoryCount()
-{
+void Scumm_v5::o5_getInventoryCount() {
getResultPos();
setResult(getInventoryCount(getVarOrDirectByte(0x80)));
}
-void Scumm_v5::o5_getObjectOwner()
-{
+void Scumm_v5::o5_getObjectOwner() {
getResultPos();
setResult(getOwner(getVarOrDirectWord(0x80)));
}
-void Scumm_v5::o5_getObjectState()
-{
+void Scumm_v5::o5_getObjectState() {
if (_features & GF_SMALL_HEADER) {
o5_ifState();
} else {
@@ -1127,8 +1078,7 @@ void Scumm_v5::o5_getObjectState()
}
}
-void Scumm_v5::o5_ifState()
-{
+void Scumm_v5::o5_ifState() {
int a = getVarOrDirectWord(0x80);
int b = getVarOrDirectByte(0x40);
@@ -1138,8 +1088,7 @@ void Scumm_v5::o5_ifState()
ignoreScriptWord();
}
-void Scumm_v5::o5_ifNotState()
-{
+void Scumm_v5::o5_ifNotState() {
int a = getVarOrDirectWord(0x80);
int b = getVarOrDirectByte(0x40);
@@ -1149,20 +1098,17 @@ void Scumm_v5::o5_ifNotState()
ignoreScriptWord();
}
-void Scumm_v5::o5_getRandomNr()
-{
+void Scumm_v5::o5_getRandomNr() {
getResultPos();
setResult(_rnd.getRandomNumber(getVarOrDirectByte(0x80)));
}
-void Scumm_v5::o5_isScriptRunning()
-{
+void Scumm_v5::o5_isScriptRunning() {
getResultPos();
setResult(isScriptRunning(getVarOrDirectByte(0x80)));
}
-void Scumm_v5::o5_getVerbEntrypoint()
-{
+void Scumm_v5::o5_getVerbEntrypoint() {
int a, b;
getResultPos();
a = getVarOrDirectWord(0x80);
@@ -1171,8 +1117,7 @@ void Scumm_v5::o5_getVerbEntrypoint()
setResult(getVerbEntrypoint(a, b));
}
-void Scumm_v5::o5_ifClassOfIs()
-{
+void Scumm_v5::o5_ifClassOfIs() {
int act, cls, b = 0;
bool cond = true;
@@ -1195,14 +1140,12 @@ void Scumm_v5::o5_ifClassOfIs()
o5_jumpRelative();
}
-void Scumm_v5::o5_increment()
-{
+void Scumm_v5::o5_increment() {
getResultPos();
setResult(readVar(_resultVarNumber) + 1);
}
-void Scumm_v5::o5_isActorInBox()
-{
+void Scumm_v5::o5_isActorInBox() {
int box;
Actor *a;
@@ -1215,8 +1158,7 @@ void Scumm_v5::o5_isActorInBox()
ignoreScriptWord();
}
-void Scumm_v5::o5_isEqual()
-{
+void Scumm_v5::o5_isEqual() {
int16 a, b;
int var;
@@ -1239,8 +1181,7 @@ void Scumm_v5::o5_isEqual()
}
-void Scumm_v5::o5_isGreater()
-{
+void Scumm_v5::o5_isGreater() {
int16 a = readVar(fetchScriptWord());
int16 b = getVarOrDirectWord(0x80);
if (b > a)
@@ -1249,8 +1190,7 @@ void Scumm_v5::o5_isGreater()
o5_jumpRelative();
}
-void Scumm_v5::o5_isGreaterEqual()
-{
+void Scumm_v5::o5_isGreaterEqual() {
int16 a = readVar(fetchScriptWord());
int16 b = getVarOrDirectWord(0x80);
if (b >= a)
@@ -1259,8 +1199,7 @@ void Scumm_v5::o5_isGreaterEqual()
o5_jumpRelative();
}
-void Scumm_v5::o5_isLess()
-{
+void Scumm_v5::o5_isLess() {
int16 a = readVar(fetchScriptWord());
int16 b = getVarOrDirectWord(0x80);
@@ -1270,8 +1209,7 @@ void Scumm_v5::o5_isLess()
o5_jumpRelative();
}
-void Scumm_v5::o5_lessOrEqual()
-{
+void Scumm_v5::o5_lessOrEqual() {
int16 a = readVar(fetchScriptWord());
int16 b = getVarOrDirectWord(0x80);
if (b <= a)
@@ -1280,8 +1218,7 @@ void Scumm_v5::o5_lessOrEqual()
o5_jumpRelative();
}
-void Scumm_v5::o5_isNotEqual()
-{
+void Scumm_v5::o5_isNotEqual() {
int16 a = readVar(fetchScriptWord());
int16 b = getVarOrDirectWord(0x80);
if (b != a)
@@ -1290,8 +1227,7 @@ void Scumm_v5::o5_isNotEqual()
o5_jumpRelative();
}
-void Scumm_v5::o5_notEqualZero()
-{
+void Scumm_v5::o5_notEqualZero() {
int a = readVar(fetchScriptWord());
if (a != 0)
ignoreScriptWord();
@@ -1299,8 +1235,7 @@ void Scumm_v5::o5_notEqualZero()
o5_jumpRelative();
}
-void Scumm_v5::o5_equalZero()
-{
+void Scumm_v5::o5_equalZero() {
int a = readVar(fetchScriptWord());
if (a == 0)
ignoreScriptWord();
@@ -1308,8 +1243,7 @@ void Scumm_v5::o5_equalZero()
o5_jumpRelative();
}
-void Scumm_v5::o5_isSoundRunning()
-{
+void Scumm_v5::o5_isSoundRunning() {
int snd;
getResultPos();
snd = getVarOrDirectByte(0x80);
@@ -1318,13 +1252,11 @@ void Scumm_v5::o5_isSoundRunning()
setResult(snd);
}
-void Scumm_v5::o5_jumpRelative()
-{
+void Scumm_v5::o5_jumpRelative() {
_scriptPointer += (int16)fetchScriptWord();
}
-void Scumm_v5::o5_lights()
-{
+void Scumm_v5::o5_lights() {
int a, b, c;
a = getVarOrDirectByte(0x80);
@@ -1340,8 +1272,7 @@ void Scumm_v5::o5_lights()
_fullRedraw = 1;
}
-void Scumm_v5::o5_loadRoom()
-{
+void Scumm_v5::o5_loadRoom() {
int room;
room = getVarOrDirectByte(0x80);
@@ -1354,8 +1285,7 @@ void Scumm_v5::o5_loadRoom()
_fullRedraw = 1;
}
-void Scumm_v5::o5_loadRoomWithEgo()
-{
+void Scumm_v5::o5_loadRoomWithEgo() {
Actor *a;
int obj, room, x, y;
@@ -1385,8 +1315,7 @@ void Scumm_v5::o5_loadRoomWithEgo()
}
}
-void Scumm_v5::o5_matrixOps()
-{
+void Scumm_v5::o5_matrixOps() {
int a, b;
if (_features & GF_OLD256) {
@@ -1419,44 +1348,37 @@ void Scumm_v5::o5_matrixOps()
}
}
-void Scumm_v5::o5_move()
-{
+void Scumm_v5::o5_move() {
getResultPos();
setResult(getVarOrDirectWord(0x80));
}
-void Scumm_v5::o5_multiply()
-{
+void Scumm_v5::o5_multiply() {
int a;
getResultPos();
a = getVarOrDirectWord(0x80);
setResult(readVar(_resultVarNumber) * a);
}
-
-void Scumm_v5::o5_or()
-{
+void Scumm_v5::o5_or() {
int a;
getResultPos();
a = getVarOrDirectWord(0x80);
setResult(readVar(_resultVarNumber) | a);
}
-void Scumm_v5::o5_overRide()
-{
+void Scumm_v5::o5_overRide() {
if (fetchScriptByte() != 0)
beginOverride();
else
endOverride();
}
-void Scumm_v5::o5_panCameraTo()
-{
+void Scumm_v5::o5_panCameraTo() {
panCameraTo(getVarOrDirectWord(0x80), 0);
}
-void Scumm_v5::o5_pickupObject()
-{
+void Scumm_v5::o5_pickupObject() {
int obj, room;
if (_features & GF_OLD256) {
o5_drawObject();
@@ -1476,20 +1398,17 @@ void Scumm_v5::o5_pickupObject()
runHook(1);
}
-void Scumm_v5::o5_print()
-{
+void Scumm_v5::o5_print() {
_actorToPrintStrFor = getVarOrDirectByte(0x80);
decodeParseString();
}
-void Scumm_v5::o5_printEgo()
-{
+void Scumm_v5::o5_printEgo() {
_actorToPrintStrFor = (unsigned char)_vars[VAR_EGO];
decodeParseString();
}
-void Scumm_v5::o5_pseudoRoom()
-{
+void Scumm_v5::o5_pseudoRoom() {
int i = fetchScriptByte(), j;
while ((j = fetchScriptByte()) != 0) {
if (j >= 0x80) {
@@ -1498,8 +1417,7 @@ void Scumm_v5::o5_pseudoRoom()
}
}
-void Scumm_v5::o5_putActor()
-{
+void Scumm_v5::o5_putActor() {
int x, y;
Actor *a;
@@ -1512,9 +1430,7 @@ void Scumm_v5::o5_putActor()
a->putActor(x, y, a->room);
}
-
-void Scumm_v5::o5_putActorAtObject()
-{
+void Scumm_v5::o5_putActorAtObject() {
int obj, x, y;
Actor *a;
@@ -1529,8 +1445,7 @@ void Scumm_v5::o5_putActorAtObject()
a->putActor(x, y, a->room);
}
-void Scumm_v5::o5_putActorInRoom()
-{
+void Scumm_v5::o5_putActorInRoom() {
int room;
Actor *a;
@@ -1546,8 +1461,7 @@ void Scumm_v5::o5_putActorInRoom()
a->putActor(0, 0, 0);
}
-void Scumm_v5::o5_quitPauseRestart()
-{
+void Scumm_v5::o5_quitPauseRestart() {
switch (fetchScriptByte()) {
case 1:
pauseGame(false);
@@ -1558,8 +1472,7 @@ void Scumm_v5::o5_quitPauseRestart()
}
}
-void Scumm_v5::o5_resourceRoutines()
-{
+void Scumm_v5::o5_resourceRoutines() {
const ResTypes resType[4] = { rtScript, rtSound, rtCostume, rtRoom };
int resid = 0;
int foo, bar;
@@ -1680,8 +1593,7 @@ void Scumm_v5::o5_resourceRoutines()
}
}
-void Scumm_v5::o5_roomOps()
-{
+void Scumm_v5::o5_roomOps() {
int a = 0, b = 0, c, d, e;
if (_features & GF_OLD256) {
@@ -1886,8 +1798,7 @@ void Scumm_v5::o5_roomOps()
}
}
-void Scumm_v5::o5_saveRestoreVerbs()
-{
+void Scumm_v5::o5_saveRestoreVerbs() {
int a, b, c, slot, slot2;
_opcode = fetchScriptByte();
@@ -1936,13 +1847,11 @@ void Scumm_v5::o5_saveRestoreVerbs()
}
}
-void Scumm_v5::o5_setCameraAt()
-{
+void Scumm_v5::o5_setCameraAt() {
setCameraAtEx(getVarOrDirectWord(0x80));
}
-void Scumm_v5::o5_setObjectName()
-{
+void Scumm_v5::o5_setObjectName() {
int obj = getVarOrDirectWord(0x80);
int size;
int a;
@@ -1952,8 +1861,8 @@ void Scumm_v5::o5_setObjectName()
// Read in new name
while ((a = fetchScriptByte()) != 0) {
- work[i++] = a;
- if (a == 0xFF) {
+ work[i++] = a;
+ if (a == 0xFF) {
work[i++] = fetchScriptByte();
work[i++] = fetchScriptByte();
work[i++] = fetchScriptByte();
@@ -1996,8 +1905,7 @@ void Scumm_v5::o5_setObjectName()
runHook(0);
}
-void Scumm_v5::o5_setOwnerOf()
-{
+void Scumm_v5::o5_setOwnerOf() {
int obj, owner;
obj = getVarOrDirectWord(0x80);
@@ -2006,8 +1914,7 @@ void Scumm_v5::o5_setOwnerOf()
setOwnerOf(obj, owner);
}
-void Scumm_v5::o5_setState()
-{
+void Scumm_v5::o5_setState() {
int obj, state;
obj = getVarOrDirectWord(0x80);
state = getVarOrDirectByte(0x40);
@@ -2017,8 +1924,7 @@ void Scumm_v5::o5_setState()
clearDrawObjectQueue();
}
-void Scumm_v5::o5_setVarRange()
-{
+void Scumm_v5::o5_setVarRange() {
int a, b;
getResultPos();
@@ -2034,17 +1940,16 @@ void Scumm_v5::o5_setVarRange()
} while (--a);
}
-void Scumm_v5::o5_soundKludge()
-{
+void Scumm_v5::o5_soundKludge() {
int items[15];
int i;
if (_features & GF_SMALL_HEADER) { // Is WaitForSentence in SCUMM V3
- if (_sentenceNum) {
- if (_sentence[_sentenceNum - 1].freezeCount && !isScriptInUse(_vars[VAR_SENTENCE_SCRIPT]))
- return;
+ if (_sentenceNum) {
+ if (_sentence[_sentenceNum - 1].freezeCount && !isScriptInUse(_vars[VAR_SENTENCE_SCRIPT]))
+ return;
} else if (!isScriptInUse(_vars[VAR_SENTENCE_SCRIPT]))
- return;
+ return;
_scriptPointer--;
o5_breakHere();
@@ -2059,13 +1964,11 @@ void Scumm_v5::o5_soundKludge()
_sound->soundKludge(items, num);
}
-void Scumm_v5::o5_startMusic()
-{
+void Scumm_v5::o5_startMusic() {
_sound->addSoundToQueue(getVarOrDirectByte(0x80));
}
-void Scumm_v5::o5_startObject()
-{
+void Scumm_v5::o5_startObject() {
int obj, script;
int data[16];
@@ -2076,8 +1979,7 @@ void Scumm_v5::o5_startObject()
runVerbCode(obj, script, 0, 0, data);
}
-void Scumm_v5::o5_startScript()
-{
+void Scumm_v5::o5_startScript() {
int op, script;
int data[16];
int a, b;
@@ -2096,31 +1998,24 @@ void Scumm_v5::o5_startScript()
runScript(script, a, b, data);
}
-void Scumm_v5::o5_startSound()
-{
-
+void Scumm_v5::o5_startSound() {
_vars[VAR_MUSIC_FLAG] = 0;
-
_sound->addSoundToQueue(getVarOrDirectByte(0x80));
}
-void Scumm_v5::o5_stopMusic()
-{
+void Scumm_v5::o5_stopMusic() {
_sound->stopAllSounds();
}
-void Scumm_v5::o5_stopObjectCode()
-{
+void Scumm_v5::o5_stopObjectCode() {
stopObjectCode();
}
-void Scumm_v5::o5_stopObjectScript()
-{
+void Scumm_v5::o5_stopObjectScript() {
stopObjectScript(getVarOrDirectWord(0x80));
}
-void Scumm_v5::o5_stopScript()
-{
+void Scumm_v5::o5_stopScript() {
int script;
script = getVarOrDirectByte(0x80);
@@ -2130,13 +2025,11 @@ void Scumm_v5::o5_stopScript()
stopScriptNr(script);
}
-void Scumm_v5::o5_stopSound()
-{
+void Scumm_v5::o5_stopSound() {
_sound->stopSound(getVarOrDirectByte(0x80));
}
-void Scumm_v5::o5_stringOps()
-{
+void Scumm_v5::o5_stringOps() {
int a, b, c, i;
byte *ptr;
@@ -2191,16 +2084,14 @@ void Scumm_v5::o5_stringOps()
}
}
-void Scumm_v5::o5_subtract()
-{
+void Scumm_v5::o5_subtract() {
int a;
getResultPos();
a = getVarOrDirectWord(0x80);
setResult(readVar(_resultVarNumber) - a);
}
-void Scumm_v5::o5_verbOps()
-{
+void Scumm_v5::o5_verbOps() {
int verb, slot;
VerbSlot *vs;
int a, b;
@@ -2340,11 +2231,9 @@ void Scumm_v5::o5_verbOps()
verbMouseOver(0);
}
-void Scumm_v5::o5_wait()
-{
+void Scumm_v5::o5_wait() {
byte *oldaddr;
-
oldaddr = _scriptPointer - 1;
if (_gameId == GID_INDY3_256) {
@@ -2385,8 +2274,7 @@ void Scumm_v5::o5_wait()
o5_breakHere();
}
-void Scumm_v5::o5_walkActorTo()
-{
+void Scumm_v5::o5_walkActorTo() {
int x, y;
Actor *a;
a = derefActorSafe(getVarOrDirectByte(0x80), "o5_walkActorTo");
@@ -2395,8 +2283,7 @@ void Scumm_v5::o5_walkActorTo()
a->startWalkActor(x, y, -1);
}
-void Scumm_v5::o5_walkActorToActor()
-{
+void Scumm_v5::o5_walkActorToActor() {
int b, x, y;
Actor *a, *a2;
int nr;
@@ -2441,8 +2328,7 @@ void Scumm_v5::o5_walkActorToActor()
a->startWalkActor(x, y, -1);
}
-void Scumm_v5::o5_walkActorToObject()
-{
+void Scumm_v5::o5_walkActorToObject() {
int obj;
Actor *a;
@@ -2457,8 +2343,7 @@ void Scumm_v5::o5_walkActorToObject()
}
}
-int Scumm_v5::getWordVararg(int *ptr)
-{
+int Scumm_v5::getWordVararg(int *ptr) {
int i;
for (i = 0; i < 15; i++)
@@ -2471,22 +2356,19 @@ int Scumm_v5::getWordVararg(int *ptr)
return i;
}
-int Scumm_v5::getVarOrDirectWord(byte mask)
-{
+int Scumm_v5::getVarOrDirectWord(byte mask) {
if (_opcode & mask)
return readVar(fetchScriptWord());
return (int16)fetchScriptWord();
}
-int Scumm_v5::getVarOrDirectByte(byte mask)
-{
+int Scumm_v5::getVarOrDirectByte(byte mask) {
if (_opcode & mask)
return readVar(fetchScriptWord());
return fetchScriptByte();
}
-void Scumm_v5::decodeParseString()
-{
+void Scumm_v5::decodeParseString() {
int textSlot;
switch (_actorToPrintStrFor) {
@@ -2592,8 +2474,7 @@ void Scumm_v5::decodeParseString()
_string[textSlot].t_charset = _string[textSlot].charset;
}
-void Scumm_v5::o5_oldRoomEffect()
-{
+void Scumm_v5::o5_oldRoomEffect() {
int a;
_opcode = fetchScriptByte();
@@ -2608,8 +2489,7 @@ void Scumm_v5::o5_oldRoomEffect()
}
}
-void Scumm_v5::o5_pickupObjectOld()
-{
+void Scumm_v5::o5_pickupObjectOld() {
int obj = getVarOrDirectWord(0x80);
if (obj < 1) {
diff --git a/scumm/script_v6.cpp b/scumm/script_v6.cpp
index 2c133d7320..536dc63a82 100644
--- a/scumm/script_v6.cpp
+++ b/scumm/script_v6.cpp
@@ -40,8 +40,7 @@
#define OPCODE(x) { &Scumm_v6::x, #x }
-void Scumm_v6::setupOpcodes()
-{
+void Scumm_v6::setupOpcodes() {
static const OpcodeEntryV6 opcodes[256] = {
/* 00 */
OPCODE(o6_pushByte),
@@ -368,19 +367,16 @@ void Scumm_v6::setupOpcodes()
_opcodesV6 = opcodes;
}
-void Scumm_v6::executeOpcode(int i)
-{
+void Scumm_v6::executeOpcode(int i) {
OpcodeProcV6 op = _opcodesV6[i].proc;
(this->*op) ();
}
-const char *Scumm_v6::getOpcodeDesc(int i)
-{
+const char *Scumm_v6::getOpcodeDesc(int i) {
return _opcodesV6[i].desc;
}
-int Scumm_v6::popRoomAndObj(int *room)
-{
+int Scumm_v6::popRoomAndObj(int *room) {
int obj;
if (_features & GF_HAS_ROOMTABLE) {
@@ -395,8 +391,7 @@ int Scumm_v6::popRoomAndObj(int *room)
}
-int Scumm::readArray(int array, int idx, int base)
-{
+int Scumm::readArray(int array, int idx, int base) {
ArrayHeader *ah = (ArrayHeader *)getResourceAddress(rtString, readVar(array));
if (ah == NULL) {
@@ -418,8 +413,7 @@ int Scumm::readArray(int array, int idx, int base)
}
}
-void Scumm::writeArray(int array, int idx, int base, int value)
-{
+void Scumm::writeArray(int array, int idx, int base, int value) {
ArrayHeader *ah = (ArrayHeader *)getResourceAddress(rtString, readVar(array));
if (!ah)
return;
@@ -436,8 +430,7 @@ void Scumm::writeArray(int array, int idx, int base, int value)
}
}
-int Scumm_v6::getStackList(int *args, uint maxnum)
-{
+int Scumm_v6::getStackList(int *args, uint maxnum) {
uint num, i;
for (i = 0; i < maxnum; i++)
@@ -456,270 +449,225 @@ int Scumm_v6::getStackList(int *args, uint maxnum)
return num;
}
-void Scumm_v6::o6_pushByte()
-{
+void Scumm_v6::o6_pushByte() {
push(fetchScriptByte());
}
-void Scumm_v6::o6_pushWord()
-{
+void Scumm_v6::o6_pushWord() {
push(fetchScriptWordSigned());
}
-void Scumm_v6::o6_pushByteVar()
-{
+void Scumm_v6::o6_pushByteVar() {
push(readVar(fetchScriptByte()));
}
-void Scumm_v6::o6_pushWordVar()
-{
+void Scumm_v6::o6_pushWordVar() {
push(readVar(fetchScriptWord()));
}
-void Scumm_v6::o6_invalid()
-{
+void Scumm_v6::o6_invalid() {
error("Invalid opcode '%x' at %x", _opcode, _scriptPointer - _scriptOrgPointer);
}
-void Scumm_v6::o6_byteArrayRead()
-{
+void Scumm_v6::o6_byteArrayRead() {
int base = pop();
push(readArray(fetchScriptByte(), 0, base));
}
-void Scumm_v6::o6_wordArrayRead()
-{
+void Scumm_v6::o6_wordArrayRead() {
int base = pop();
push(readArray(fetchScriptWord(), 0, base));
}
-void Scumm_v6::o6_byteArrayIndexedRead()
-{
+void Scumm_v6::o6_byteArrayIndexedRead() {
int base = pop();
int idx = pop();
push(readArray(fetchScriptByte(), idx, base));
}
-void Scumm_v6::o6_wordArrayIndexedRead()
-{
+void Scumm_v6::o6_wordArrayIndexedRead() {
int base = pop();
int idx = pop();
push(readArray(fetchScriptWord(), idx, base));
}
-void Scumm_v6::o6_dup()
-{
+void Scumm_v6::o6_dup() {
int a = pop();
push(a);
push(a);
}
-void Scumm_v6::o6_not()
-{
+void Scumm_v6::o6_not() {
push(pop() == 0);
}
-void Scumm_v6::o6_eq()
-{
+void Scumm_v6::o6_eq() {
push(pop() == pop());
}
-void Scumm_v6::o6_neq()
-{
+void Scumm_v6::o6_neq() {
push(pop() != pop());
}
-void Scumm_v6::o6_gt()
-{
+void Scumm_v6::o6_gt() {
int a = pop();
push(pop() > a);
}
-void Scumm_v6::o6_lt()
-{
+void Scumm_v6::o6_lt() {
int a = pop();
push(pop() < a);
}
-void Scumm_v6::o6_le()
-{
+void Scumm_v6::o6_le() {
int a = pop();
push(pop() <= a);
}
-void Scumm_v6::o6_ge()
-{
+void Scumm_v6::o6_ge() {
int a = pop();
push(pop() >= a);
}
-void Scumm_v6::o6_add()
-{
+void Scumm_v6::o6_add() {
int a = pop();
push(pop() + a);
}
-void Scumm_v6::o6_sub()
-{
+void Scumm_v6::o6_sub() {
int a = pop();
push(pop() - a);
}
-void Scumm_v6::o6_mul()
-{
+void Scumm_v6::o6_mul() {
int a = pop();
push(pop() * a);
}
-void Scumm_v6::o6_div()
-{
+void Scumm_v6::o6_div() {
int a = pop();
if (a == 0)
error("division by zero");
push(pop() / a);
}
-void Scumm_v6::o6_land() // Logical And
-{
+void Scumm_v6::o6_land() {
int a = pop();
push(pop() && a);
}
-void Scumm_v6::o6_lor() // Logical Or
-{
+void Scumm_v6::o6_lor() {
int a = pop();
push(pop() || a);
}
-void Scumm_v6::o6_bor() // Bitwise Or
-{
+void Scumm_v6::o6_bor() {
int a = pop();
push(pop() | a);
}
-void Scumm_v6::o6_band() // Bitwise And
-{
+void Scumm_v6::o6_band() {
int a = pop();
push(pop() | a);
}
-void Scumm_v6::o6_pop()
-{
+void Scumm_v6::o6_pop() {
pop();
}
-void Scumm_v6::o6_writeByteVar()
-{
+void Scumm_v6::o6_writeByteVar() {
writeVar(fetchScriptByte(), pop());
}
-void Scumm_v6::o6_writeWordVar()
-{
+void Scumm_v6::o6_writeWordVar() {
writeVar(fetchScriptWord(), pop());
}
-void Scumm_v6::o6_byteArrayWrite()
-{
+void Scumm_v6::o6_byteArrayWrite() {
int a = pop();
writeArray(fetchScriptByte(), 0, pop(), a);
}
-void Scumm_v6::o6_wordArrayWrite()
-{
+void Scumm_v6::o6_wordArrayWrite() {
int a = pop();
writeArray(fetchScriptWord(), 0, pop(), a);
}
-void Scumm_v6::o6_byteArrayIndexedWrite()
-{
+void Scumm_v6::o6_byteArrayIndexedWrite() {
int val = pop();
int base = pop();
writeArray(fetchScriptByte(), pop(), base, val);
}
-void Scumm_v6::o6_wordArrayIndexedWrite()
-{
+void Scumm_v6::o6_wordArrayIndexedWrite() {
int val = pop();
int base = pop();
writeArray(fetchScriptWord(), pop(), base, val);
}
-void Scumm_v6::o6_byteVarInc()
-{
+void Scumm_v6::o6_byteVarInc() {
int var = fetchScriptByte();
writeVar(var, readVar(var) + 1);
}
-void Scumm_v6::o6_wordVarInc()
-{
+void Scumm_v6::o6_wordVarInc() {
int var = fetchScriptWord();
writeVar(var, readVar(var) + 1);
}
-void Scumm_v6::o6_byteArrayInc()
-{
+void Scumm_v6::o6_byteArrayInc() {
int var = fetchScriptByte();
int base = pop();
writeArray(var, 0, base, readArray(var, 0, base) + 1);
}
-void Scumm_v6::o6_wordArrayInc()
-{
+void Scumm_v6::o6_wordArrayInc() {
int var = fetchScriptWord();
int base = pop();
writeArray(var, 0, base, readArray(var, 0, base) + 1);
}
-
-void Scumm_v6::o6_byteVarDec()
-{
+void Scumm_v6::o6_byteVarDec() {
int var = fetchScriptByte();
writeVar(var, readVar(var) - 1);
}
-void Scumm_v6::o6_wordVarDec()
-{
+void Scumm_v6::o6_wordVarDec() {
int var = fetchScriptWord();
writeVar(var, readVar(var) - 1);
}
-void Scumm_v6::o6_byteArrayDec()
-{
+void Scumm_v6::o6_byteArrayDec() {
int var = fetchScriptByte();
int base = pop();
writeArray(var, 0, base, readArray(var, 0, base) - 1);
}
-void Scumm_v6::o6_wordArrayDec()
-{
+void Scumm_v6::o6_wordArrayDec() {
int var = fetchScriptWord();
int base = pop();
writeArray(var, 0, base, readArray(var, 0, base) - 1);
}
-void Scumm_v6::o6_jumpTrue()
-{
+void Scumm_v6::o6_jumpTrue() {
if (pop())
o6_jump();
else
fetchScriptWord();
}
-void Scumm_v6::o6_jumpFalse()
-{
+void Scumm_v6::o6_jumpFalse() {
if (!pop())
o6_jump();
else
fetchScriptWord();
}
-void Scumm_v6::o6_jump()
-{
+void Scumm_v6::o6_jump() {
_scriptPointer += fetchScriptWordSigned();
}
-void Scumm_v6::o6_startScriptEx()
-{
+void Scumm_v6::o6_startScriptEx() {
int args[16];
int script, flags;
@@ -729,8 +677,7 @@ void Scumm_v6::o6_startScriptEx()
runScript(script, flags & 1, flags & 2, args);
}
-void Scumm_v6::o6_jumpToScript()
-{
+void Scumm_v6::o6_jumpToScript() {
int args[16];
int script, flags;
@@ -741,8 +688,7 @@ void Scumm_v6::o6_jumpToScript()
runScript(script, flags & 1, flags & 2, args);
}
-void Scumm_v6::o6_startScript()
-{
+void Scumm_v6::o6_startScript() {
int args[16];
int script;
getStackList(args, sizeof(args) / sizeof(args[0]));
@@ -750,8 +696,7 @@ void Scumm_v6::o6_startScript()
runScript(script, 0, 0, args);
}
-void Scumm_v6::o6_startScriptQuick()
-{
+void Scumm_v6::o6_startScriptQuick() {
int args[16];
int script;
getStackList(args, sizeof(args) / sizeof(args[0]));
@@ -759,8 +704,7 @@ void Scumm_v6::o6_startScriptQuick()
runScript(script, 0, 1, args);
}
-void Scumm_v6::o6_startObjectEx()
-{
+void Scumm_v6::o6_startObjectEx() {
int args[16];
int script, entryp;
int flags;
@@ -771,8 +715,7 @@ void Scumm_v6::o6_startObjectEx()
runVerbCode(script, entryp, flags & 1, flags & 2, args);
}
-void Scumm_v6::o6_startObjectQuick()
-{
+void Scumm_v6::o6_startObjectQuick() {
int args[16];
int script, entryp;
getStackList(args, sizeof(args) / sizeof(args[0]));
@@ -781,19 +724,17 @@ void Scumm_v6::o6_startObjectQuick()
runVerbCode(script, entryp, 0, 1, args);
}
-void Scumm_v6::o6_setObjectState()
-{
+void Scumm_v6::o6_setObjectState() {
int a = pop();
int b = pop();
if (a == 0)
a = 1;
-// debug(1, "setObjectState(%d,%d)", a, b);
+// debug(1, "setObjectState(%d,%d)", a, b);
setObjectState(b, a, -1, -1);
}
-void Scumm_v6::o6_setObjectXY()
-{
+void Scumm_v6::o6_setObjectXY() {
int y = pop();
int x = pop();
int obj = pop();
@@ -801,30 +742,25 @@ void Scumm_v6::o6_setObjectXY()
setObjectState(obj, 1, x, y);
}
-void Scumm_v6::o6_stopObjectCode()
-{
+void Scumm_v6::o6_stopObjectCode() {
stopObjectCode();
}
-void Scumm_v6::o6_endCutscene()
-{
+void Scumm_v6::o6_endCutscene() {
endCutscene();
}
-void Scumm_v6::o6_cutscene()
-{
+void Scumm_v6::o6_cutscene() {
int args[16];
getStackList(args, sizeof(args) / sizeof(args[0]));
cutscene(args);
}
-void Scumm_v6::o6_stopMusic()
-{
+void Scumm_v6::o6_stopMusic() {
_sound->stopAllSounds();
}
-void Scumm_v6::o6_freezeUnfreeze()
-{
+void Scumm_v6::o6_freezeUnfreeze() {
int a = pop();
if (a)
freezeScripts(a);
@@ -832,8 +768,7 @@ void Scumm_v6::o6_freezeUnfreeze()
unfreezeScripts();
}
-void Scumm_v6::o6_cursorCommand()
-{
+void Scumm_v6::o6_cursorCommand() {
int a, i;
int args[16];
@@ -896,14 +831,12 @@ void Scumm_v6::o6_cursorCommand()
_vars[VAR_USERPUT] = _userPut;
}
-void Scumm_v6::o6_breakHere()
-{
+void Scumm_v6::o6_breakHere() {
updateScriptPtr();
_currentScript = 0xFF;
}
-void Scumm_v6::o6_ifClassOfIs()
-{
+void Scumm_v6::o6_ifClassOfIs() {
int args[16];
int num, obj, cls;
bool b;
@@ -921,8 +854,7 @@ void Scumm_v6::o6_ifClassOfIs()
push(cond);
}
-void Scumm_v6::o6_setClass()
-{
+void Scumm_v6::o6_setClass() {
int args[16];
int num, obj, cls;
@@ -940,13 +872,11 @@ void Scumm_v6::o6_setClass()
}
}
-void Scumm_v6::o6_getState()
-{
+void Scumm_v6::o6_getState() {
push(getState(pop()));
}
-void Scumm_v6::o6_setState()
-{
+void Scumm_v6::o6_setState() {
int state = pop();
int obj = pop();
@@ -958,43 +888,36 @@ void Scumm_v6::o6_setState()
clearDrawObjectQueue();
}
-void Scumm_v6::o6_setOwner()
-{
+void Scumm_v6::o6_setOwner() {
int owner = pop();
int obj = pop();
setOwnerOf(obj, owner);
}
-void Scumm_v6::o6_getOwner()
-{
+void Scumm_v6::o6_getOwner() {
push(getOwner(pop()));
}
-void Scumm_v6::o6_startSound()
-{
+void Scumm_v6::o6_startSound() {
if ((_features & GF_HUMONGOUS) && (_gameId != GID_PUTTDEMO))
pop();
_sound->addSoundToQueue(pop());
}
-void Scumm_v6::o6_stopSound()
-{
+void Scumm_v6::o6_stopSound() {
_sound->stopSound(pop());
}
-void Scumm_v6::o6_startMusic()
-{
+void Scumm_v6::o6_startMusic() {
_sound->addSoundToQueue(pop());
}
-void Scumm_v6::o6_stopObjectScript()
-{
+void Scumm_v6::o6_stopObjectScript() {
stopObjectScript(pop());
}
-void Scumm_v6::o6_panCameraTo()
-{
+void Scumm_v6::o6_panCameraTo() {
if (_features & GF_AFTER_V7) {
int y = pop();
int x = pop();
@@ -1004,16 +927,14 @@ void Scumm_v6::o6_panCameraTo()
}
}
-void Scumm_v6::o6_actorFollowCamera()
-{
+void Scumm_v6::o6_actorFollowCamera() {
if (_features & GF_AFTER_V7)
setCameraFollows(derefActorSafe(pop(), "actorFollowCamera"));
else
actorFollowCamera(pop());
}
-void Scumm_v6::o6_setCameraAt()
-{
+void Scumm_v6::o6_setCameraAt() {
if (_features & GF_AFTER_V7) {
int x, y;
@@ -1028,15 +949,13 @@ void Scumm_v6::o6_setCameraAt()
}
}
-void Scumm_v6::o6_loadRoom()
-{
+void Scumm_v6::o6_loadRoom() {
int room = pop();
startScene(room, 0, 0);
_fullRedraw = 1;
}
-void Scumm_v6::o6_stopScript()
-{
+void Scumm_v6::o6_stopScript() {
int script = pop();
if (script == 0)
stopObjectCode();
@@ -1044,8 +963,7 @@ void Scumm_v6::o6_stopScript()
stopScriptNr(script);
}
-void Scumm_v6::o6_walkActorToObj()
-{
+void Scumm_v6::o6_walkActorToObj() {
int obj, dist;
Actor *a, *a2;
int x;
@@ -1081,8 +999,7 @@ void Scumm_v6::o6_walkActorToObj()
}
}
-void Scumm_v6::o6_walkActorTo()
-{
+void Scumm_v6::o6_walkActorTo() {
int x, y;
y = pop();
x = pop();
@@ -1091,8 +1008,7 @@ void Scumm_v6::o6_walkActorTo()
a->startWalkActor(x, y, -1);
}
-void Scumm_v6::o6_putActorInRoom()
-{
+void Scumm_v6::o6_putActorInRoom() {
int room, x, y;
Actor *a;
@@ -1116,8 +1032,7 @@ void Scumm_v6::o6_putActorInRoom()
}
-void Scumm_v6::o6_putActorAtObject()
-{
+void Scumm_v6::o6_putActorAtObject() {
int room, obj, x, y;
Actor *a;
@@ -1135,8 +1050,7 @@ void Scumm_v6::o6_putActorAtObject()
a->putActor(x, y, room);
}
-void Scumm_v6::o6_faceActor()
-{
+void Scumm_v6::o6_faceActor() {
int obj = pop();
Actor *a = derefActorSafe(pop(), "o6_faceActor");
assert(a);
@@ -1144,8 +1058,7 @@ void Scumm_v6::o6_faceActor()
a->factToObject(obj);
}
-void Scumm_v6::o6_animateActor()
-{
+void Scumm_v6::o6_animateActor() {
int anim = pop();
Actor *a = derefActorSafe(pop(), "o6_animateActor");
if (!a)
@@ -1154,8 +1067,7 @@ void Scumm_v6::o6_animateActor()
a->animateActor(anim);
}
-void Scumm_v6::o6_doSentence()
-{
+void Scumm_v6::o6_doSentence() {
int a, b, c;
a = pop();
@@ -1167,8 +1079,7 @@ void Scumm_v6::o6_doSentence()
doSentence(c, b, a);
}
-void Scumm_v6::o6_pickupObject()
-{
+void Scumm_v6::o6_pickupObject() {
int obj, room;
int i;
@@ -1193,8 +1104,7 @@ void Scumm_v6::o6_pickupObject()
runHook(obj); /* Difference */
}
-void Scumm_v6::o6_loadRoomWithEgo()
-{
+void Scumm_v6::o6_loadRoomWithEgo() {
Actor *a;
int obj, room, x, y;
@@ -1227,16 +1137,14 @@ void Scumm_v6::o6_loadRoomWithEgo()
}
}
-void Scumm_v6::o6_getRandomNumber()
-{
+void Scumm_v6::o6_getRandomNumber() {
int rnd;
rnd = _rnd.getRandomNumber(pop());
_vars[VAR_V6_RANDOM_NR] = rnd;
push(rnd);
}
-void Scumm_v6::o6_getRandomNumberRange()
-{
+void Scumm_v6::o6_getRandomNumberRange() {
int max = pop();
int min = pop();
int rnd = _rnd.getRandomNumberRng(min, max);
@@ -1244,18 +1152,15 @@ void Scumm_v6::o6_getRandomNumberRange()
push(rnd);
}
-void Scumm_v6::o6_isScriptRunning()
-{
+void Scumm_v6::o6_isScriptRunning() {
push(isScriptRunning(pop()));
}
-void Scumm_v6::o6_isRoomScriptRunning()
-{
+void Scumm_v6::o6_isRoomScriptRunning() {
push(isRoomScriptRunning(pop()));
}
-void Scumm_v6::o6_getActorMoving()
-{
+void Scumm_v6::o6_getActorMoving() {
Actor *a = derefActorSafe(pop(), "o6_getActorMoving");
if (a)
push(a->moving);
@@ -1263,8 +1168,7 @@ void Scumm_v6::o6_getActorMoving()
push(0);
}
-void Scumm_v6::o6_getActorRoom()
-{
+void Scumm_v6::o6_getActorRoom() {
Actor *a = derefActorSafe(pop(), "o6_getActorRoom");
if (a)
push(a->room);
@@ -1272,105 +1176,89 @@ void Scumm_v6::o6_getActorRoom()
push(0);
}
-void Scumm_v6::o6_getActorWalkBox()
-{
+void Scumm_v6::o6_getActorWalkBox() {
Actor *a = derefActorSafe(pop(), "o6_getActorWalkBox");
assert(a);
push(a->ignoreBoxes ? 0 : a->walkbox);
}
-void Scumm_v6::o6_getActorCostume()
-{
+void Scumm_v6::o6_getActorCostume() {
Actor *a = derefActorSafe(pop(), "o6_getActorCostume");
assert(a);
push(a->costume);
}
-void Scumm_v6::o6_getActorElevation()
-{
+void Scumm_v6::o6_getActorElevation() {
Actor *a = derefActorSafe(pop(), "o6_getActorElevation");
assert(a);
push(a->elevation);
}
-void Scumm_v6::o6_getActorWidth()
-{
+void Scumm_v6::o6_getActorWidth() {
Actor *a = derefActorSafe(pop(), "o6_getActorWidth");
assert(a);
push(a->width);
}
-void Scumm_v6::o6_getActorScaleX()
-{
+void Scumm_v6::o6_getActorScaleX() {
Actor *a = derefActorSafe(pop(), "o6_getActorScale");
assert(a);
push(a->scalex);
}
-void Scumm_v6::o6_getActorAnimCounter1()
-{
+void Scumm_v6::o6_getActorAnimCounter1() {
Actor *a = derefActorSafe(pop(), "o6_getActorAnimCounter");
assert(a);
push(a->cost.animCounter1);
}
-void Scumm_v6::o6_getAnimateVariable()
-{
+void Scumm_v6::o6_getAnimateVariable() {
int var = pop();
Actor *a = derefActorSafe(pop(), "o6_getAnimateVariable");
assert(a);
push(a->getAnimVar(var));
}
-void Scumm_v6::o6_isActorInBox()
-{
+void Scumm_v6::o6_isActorInBox() {
int box = pop();
Actor *a = derefActorSafe(pop(), "o6_isActorInBox");
assert(a);
push(checkXYInBoxBounds(box, a->x, a->y));
}
-void Scumm_v6::o6_getActorLayer()
-{
+void Scumm_v6::o6_getActorLayer() {
Actor *a = derefActorSafe(pop(), "getActorLayer");
assert(a);
push(a->layer);
}
-void Scumm_v6::o6_getObjectX()
-{
+void Scumm_v6::o6_getObjectX() {
push(getObjX(pop()));
}
-void Scumm_v6::o6_getObjectY()
-{
+void Scumm_v6::o6_getObjectY() {
push(getObjY(pop()));
}
-void Scumm_v6::o6_getObjectOldDir()
-{
+void Scumm_v6::o6_getObjectOldDir() {
push(getObjOldDir(pop()));
}
-void Scumm_v6::o6_getObjectNewDir()
-{
+void Scumm_v6::o6_getObjectNewDir() {
push(getObjNewDir(pop()));
}
-void Scumm_v6::o6_findInventory()
-{
+void Scumm_v6::o6_findInventory() {
int idx = pop();
int owner = pop();
push(findInventory(owner, idx));
}
-void Scumm_v6::o6_getInventoryCount()
-{
+void Scumm_v6::o6_getInventoryCount() {
push(getInventoryCount(pop()));
}
-void Scumm_v6::o6_getVerbFromXY()
-{
+void Scumm_v6::o6_getVerbFromXY() {
int y = pop();
int x = pop();
int over = checkMouseOver(x, y);
@@ -1379,18 +1267,15 @@ void Scumm_v6::o6_getVerbFromXY()
push(over);
}
-void Scumm_v6::o6_beginOverride()
-{
+void Scumm_v6::o6_beginOverride() {
beginOverride();
}
-void Scumm_v6::o6_endOverride()
-{
+void Scumm_v6::o6_endOverride() {
endOverride();
}
-void Scumm_v6::o6_setObjectName()
-{
+void Scumm_v6::o6_setObjectName() {
int obj = pop();
int i;
@@ -1420,8 +1305,7 @@ void Scumm_v6::o6_setObjectName()
error("New name of %d overflows name table (max = %d)", obj, 50);
}
-void Scumm_v6::o6_isSoundRunning()
-{
+void Scumm_v6::o6_isSoundRunning() {
int snd = pop();
if (snd)
@@ -1430,8 +1314,7 @@ void Scumm_v6::o6_isSoundRunning()
push(snd);
}
-void Scumm_v6::o6_setBoxFlags()
-{
+void Scumm_v6::o6_setBoxFlags() {
int table[65];
int num, value;
@@ -1443,13 +1326,11 @@ void Scumm_v6::o6_setBoxFlags()
}
}
-void Scumm_v6::o6_createBoxMatrix()
-{
+void Scumm_v6::o6_createBoxMatrix() {
createBoxMatrix();
}
-void Scumm_v6::o6_resourceRoutines()
-{
+void Scumm_v6::o6_resourceRoutines() {
int resid;
switch (fetchScriptByte()) {
@@ -1554,8 +1435,7 @@ void Scumm_v6::o6_resourceRoutines()
}
}
-void Scumm_v6::o6_roomOps()
-{
+void Scumm_v6::o6_roomOps() {
int a, b, c, d, e;
switch (fetchScriptByte()) {
@@ -1681,8 +1561,7 @@ void Scumm_v6::o6_roomOps()
}
}
-void Scumm_v6::o6_actorOps()
-{
+void Scumm_v6::o6_actorOps() {
Actor *a;
int i, j, k;
int args[8];
@@ -1846,8 +1725,7 @@ void Scumm_v6::o6_actorOps()
}
}
-void Scumm_v6::o6_verbOps()
-{
+void Scumm_v6::o6_verbOps() {
int slot, a, b;
VerbSlot *vs;
byte *ptr, op;
@@ -1967,23 +1845,20 @@ void Scumm_v6::o6_verbOps()
}
}
-void Scumm_v6::o6_getActorFromXY()
-{
+void Scumm_v6::o6_getActorFromXY() {
int y = pop();
int x = pop();
push(getActorFromPos(x, y));
}
-void Scumm_v6::o6_findObject()
-{
+void Scumm_v6::o6_findObject() {
int y = pop();
int x = pop();
int r = findObject(x, y);
push(r);
}
-void Scumm_v6::o6_pseudoRoom()
-{
+void Scumm_v6::o6_pseudoRoom() {
int list[100];
int num, a, value;
@@ -1997,15 +1872,13 @@ void Scumm_v6::o6_pseudoRoom()
}
}
-void Scumm_v6::o6_getVerbEntrypoint()
-{
+void Scumm_v6::o6_getVerbEntrypoint() {
int e = pop();
int v = pop();
push(getVerbEntrypoint(v, e));
}
-void Scumm_v6::o6_arrayOps()
-{
+void Scumm_v6::o6_arrayOps() {
byte subOp = fetchScriptByte();
int array = fetchScriptWord();
int b, c, d, len;
@@ -2047,8 +1920,7 @@ void Scumm_v6::o6_arrayOps()
}
}
-void Scumm_v6::o6_saveRestoreVerbs()
-{
+void Scumm_v6::o6_saveRestoreVerbs() {
int a, b, c;
int slot, slot2;
@@ -2101,8 +1973,7 @@ void Scumm_v6::o6_saveRestoreVerbs()
}
}
-void Scumm_v6::o6_drawBox()
-{
+void Scumm_v6::o6_drawBox() {
int x, y, x2, y2, color;
color = pop();
y2 = pop();
@@ -2112,8 +1983,7 @@ void Scumm_v6::o6_drawBox()
drawBox(x, y, x2, y2, color);
}
-void Scumm_v6::o6_wait()
-{
+void Scumm_v6::o6_wait() {
switch (fetchScriptByte()) {
case 168:{
Actor *a = derefActorSafe(pop(), "o6_wait");
@@ -2186,16 +2056,14 @@ void Scumm_v6::o6_wait()
o6_breakHere();
}
-void Scumm_v6::o6_soundKludge()
-{
+void Scumm_v6::o6_soundKludge() {
int list[16];
int num = getStackList(list, sizeof(list) / sizeof(list[0]));
_sound->soundKludge(list, num);
}
-void Scumm_v6::o6_isAnyOf()
-{
+void Scumm_v6::o6_isAnyOf() {
int list[100];
int num;
int16 val;
@@ -2213,8 +2081,7 @@ void Scumm_v6::o6_isAnyOf()
return;
}
-void Scumm_v6::o6_quitPauseRestart()
-{
+void Scumm_v6::o6_quitPauseRestart() {
switch (fetchScriptByte()) {
case 158:
pauseGame(false);
@@ -2227,8 +2094,7 @@ void Scumm_v6::o6_quitPauseRestart()
}
}
-void Scumm_v6::o6_delay()
-{
+void Scumm_v6::o6_delay() {
// FIXME - what exactly are we measuring here? In order for the other two
// delay functions to be right, it should be 1/60th of a second. But for
// CMI it would seem this should delay for 1/10th of a second...
@@ -2238,8 +2104,7 @@ void Scumm_v6::o6_delay()
o6_breakHere();
}
-void Scumm_v6::o6_delaySeconds()
-{
+void Scumm_v6::o6_delaySeconds() {
uint32 delay = (uint32)pop();
if (_gameId != GID_CMI)
// FIXME - are we really measuring minutes here?
@@ -2254,8 +2119,7 @@ void Scumm_v6::o6_delaySeconds()
o6_breakHere();
}
-void Scumm_v6::o6_delayMinutes()
-{
+void Scumm_v6::o6_delayMinutes() {
// FIXME - are we really measuring minutes here?
uint32 delay = (uint16)pop() * 3600;
vm.slot[_currentScript].delay = delay;
@@ -2263,47 +2127,39 @@ void Scumm_v6::o6_delayMinutes()
o6_breakHere();
}
-void Scumm_v6::o6_stopSentence()
-{
+void Scumm_v6::o6_stopSentence() {
_sentenceNum = 0;
stopScriptNr(_vars[VAR_SENTENCE_SCRIPT]);
clearClickedStatus();
}
-void Scumm_v6::o6_printLine()
-{
+void Scumm_v6::o6_printLine() {
_actorToPrintStrFor = 0xFF;
decodeParseString(0, 0);
}
-void Scumm_v6::o6_printCursor()
-{
+void Scumm_v6::o6_printCursor() {
decodeParseString(1, 0);
}
-void Scumm_v6::o6_printDebug()
-{
+void Scumm_v6::o6_printDebug() {
decodeParseString(2, 0);
}
-void Scumm_v6::o6_printSystem()
-{
+void Scumm_v6::o6_printSystem() {
decodeParseString(3, 0);
}
-void Scumm_v6::o6_printActor()
-{
+void Scumm_v6::o6_printActor() {
decodeParseString(0, 1);
}
-void Scumm_v6::o6_printEgo()
-{
+void Scumm_v6::o6_printEgo() {
push(_vars[VAR_EGO]);
decodeParseString(0, 1);
}
-void Scumm_v6::o6_talkActor()
-{
+void Scumm_v6::o6_talkActor() {
_actorToPrintStrFor = pop();
_messagePtr = _scriptPointer;
@@ -2335,14 +2191,12 @@ void Scumm_v6::o6_talkActor()
}
}
-void Scumm_v6::o6_talkEgo()
-{
+void Scumm_v6::o6_talkEgo() {
push(_vars[VAR_EGO]);
o6_talkActor();
}
-void Scumm_v6::o6_dim()
-{
+void Scumm_v6::o6_dim() {
int data;
switch (fetchScriptByte()) {
@@ -2371,13 +2225,11 @@ void Scumm_v6::o6_dim()
defineArray(fetchScriptWord(), data, 0, pop());
}
-void Scumm_v6::o6_dummy()
-{
+void Scumm_v6::o6_dummy() {
/* nothing */
}
-void Scumm_v6::o6_dim2()
-{
+void Scumm_v6::o6_dim2() {
int a, b, data;
switch (fetchScriptByte()) {
case 199:
@@ -2404,22 +2256,18 @@ void Scumm_v6::o6_dim2()
defineArray(fetchScriptWord(), data, a, b);
}
-void Scumm_v6::o6_abs()
-{
+void Scumm_v6::o6_abs() {
push(abs(pop()));
}
-
-void Scumm_v6::o6_distObjectObject()
-{
+void Scumm_v6::o6_distObjectObject() {
int a, b;
b = pop();
a = pop();
push(getDistanceBetween(true, a, 0, true, b, 0));
}
-void Scumm_v6::o6_distObjectPt()
-{
+void Scumm_v6::o6_distObjectPt() {
int a, b, c;
c = pop();
b = pop();
@@ -2427,8 +2275,7 @@ void Scumm_v6::o6_distObjectPt()
push(getDistanceBetween(true, a, 0, false, b, c));
}
-void Scumm_v6::o6_distPtPt()
-{
+void Scumm_v6::o6_distPtPt() {
int a, b, c, d;
d = pop();
c = pop();
@@ -2437,8 +2284,7 @@ void Scumm_v6::o6_distPtPt()
push(getDistanceBetween(false, a, b, false, c, d));
}
-void Scumm_v6::o6_drawBlastObject()
-{
+void Scumm_v6::o6_drawBlastObject() {
int args[16];
int a, b, c, d, e;
@@ -2452,8 +2298,7 @@ void Scumm_v6::o6_drawBlastObject()
}
// Set BOMP processing window
-void Scumm_v6::o6_setBlastObjectWindow()
-{
+void Scumm_v6::o6_setBlastObjectWindow() {
// TODO - implement this
int a, b, c, d;
@@ -2466,8 +2311,7 @@ void Scumm_v6::o6_setBlastObjectWindow()
// sub_274EF(a, b, c, d);
}
-void Scumm_v6::o6_kernelSetFunctions()
-{
+void Scumm_v6::o6_kernelSetFunctions() {
int args[30];
Actor *a;
@@ -2483,84 +2327,84 @@ void Scumm_v6::o6_kernelSetFunctions()
// _imuseDigital->stopAll();
// }
uint32 speed;
- if (strcmp((char*)getStringAddressVar(VAR_VIDEONAME), "sq3.san") == 0)
- speed = 71000;
+ if (strcmp((char *)getStringAddressVar(VAR_VIDEONAME), "sq3.san") == 0)
+ speed = 71000;
else {
if (_smushFrameRate == 0)
_smushFrameRate = 14;
speed = 1000000 / _smushFrameRate;
}
-
+
debug(1, "INSANE Arg: %d", args[1]);
- ScummRenderer * sr = new ScummRenderer(this, speed);
- SmushPlayer * sp = new SmushPlayer(sr);
+ ScummRenderer *sr = new ScummRenderer(this, speed);
+ SmushPlayer *sp = new SmushPlayer(sr);
if (_noSubtitles)
sp->hide("subtitles");
// INSANE mode 0: SMUSH movie playback
if (args[1] == 0) {
- sp->play((char*)getStringAddressVar(VAR_VIDEONAME), getGameDataPath());
+ sp->play((char *)getStringAddressVar(VAR_VIDEONAME), getGameDataPath());
} else if (_gameId == GID_FT) {
int insaneMode = readArray(233,0,0);
debug(1, "FT_INSANE Mode: %d", insaneMode);
- switch (insaneMode) {
- case 0:
- sp->play("minedriv.san", getGameDataPath());
- break;
- case 1:
- sp->play("tovista2.san", getGameDataPath());
- break;
- case 2:
- sp->play("tovista1.san", getGameDataPath());
- break;
- case 3: {
- if (readArray(233,0,50) == 0) {
- InfoDialog* dialog = new InfoDialog(_newgui, this,
- "Set MineRoad - You can now jump the gorge.");
- runDialog (dialog);
- delete dialog;
-
- writeArray(233, 0, 50, 1); // INSANE callback: Chain
- writeArray(233, 0, 51, 1); // INSANE callback: Chainsaw
- writeArray(233, 0, 52, 1); // INSANE callback: Mace
- writeArray(233, 0, 53, 1); // INSANE callback: 2x4
- writeArray(233, 0, 54, 1); // INSANE callback: Wrench
- writeArray(233, 0, 55, 1); // INSANE callback: Dust
-
- writeArray(233, 0, 8, 1); // INSANE callback: Give Googles
- writeArray(233, 0, 7, 1); // INSANE callback: Give nitro fuel
-
- putState(235, 1); // Cheat and activate Ramp
- writeVar(142 | 0x8000, 1); // Cheat and activate auto-booster (fan)
+ switch (insaneMode) {
+ case 0:
+ sp->play("minedriv.san", getGameDataPath());
+ break;
+ case 1:
+ sp->play("tovista2.san", getGameDataPath());
+ break;
+ case 2:
+ sp->play("tovista1.san", getGameDataPath());
+ break;
+ case 3: {
+ if (readArray(233,0,50) == 0) {
+ InfoDialog *dialog = new InfoDialog(_newgui, this,
+ "Set MineRoad - You can now jump the gorge.");
+ runDialog (dialog);
+ delete dialog;
+
+ writeArray(233, 0, 50, 1); // INSANE callback: Chain
+ writeArray(233, 0, 51, 1); // INSANE callback: Chainsaw
+ writeArray(233, 0, 52, 1); // INSANE callback: Mace
+ writeArray(233, 0, 53, 1); // INSANE callback: 2x4
+ writeArray(233, 0, 54, 1); // INSANE callback: Wrench
+ writeArray(233, 0, 55, 1); // INSANE callback: Dust
+
+ writeArray(233, 0, 8, 1); // INSANE callback: Give Googles
+ writeArray(233, 0, 7, 1); // INSANE callback: Give nitro fuel
+
+ putState(235, 1); // Cheat and activate Ramp
+ writeVar(142 | 0x8000, 1); // Cheat and activate auto-booster (fan)
+ }
+// sp->play("minefite.san", getGameDataPath());
+ break;
}
-// sp->play("minefite.san", getGameDataPath());
- }
- break;
- case 4:
- sp->play("rottopen.san", getGameDataPath());
- break;
- case 5:
- case 6:
- case 7:
- case 8:
- warning("FT_INSANE mode %d: Stub", args[1]);
- break;
- case 9:
- sp->play("credits.san", getGameDataPath());
- default:
+ case 4:
+ sp->play("rottopen.san", getGameDataPath());
+ break;
+ case 5:
+ case 6:
+ case 7:
+ case 8:
+ warning("FT_INSANE mode %d: Stub", args[1]);
+ break;
+ case 9:
+ sp->play("credits.san", getGameDataPath());
+ default:
// Other INSANE modes
- warning("Unknown FT_INSANE mode for %d", args[1]);
- sp->play((char*)getStringAddressVar(VAR_VIDEONAME), getGameDataPath());
- }
+ warning("Unknown FT_INSANE mode for %d", args[1]);
+ sp->play((char *)getStringAddressVar(VAR_VIDEONAME), getGameDataPath());
+ }
} else {
// Other INSANE modes
warning("Unknown insane mode for %d", args[1]);
- sp->play((char*)getStringAddressVar(VAR_VIDEONAME), getGameDataPath());
+ sp->play((char *)getStringAddressVar(VAR_VIDEONAME), getGameDataPath());
}
delete sp;
delete sr;
- }
+ }
break;
case 7:
warning("o6_kernelSetFunctions: stub7()");
@@ -2765,8 +2609,7 @@ void Scumm_v6::o6_kernelSetFunctions()
}
}
-void Scumm_v6::o6_kernelGetFunctions()
-{
+void Scumm_v6::o6_kernelGetFunctions() {
int args[30];
int i;
Actor *a;
@@ -2850,8 +2693,7 @@ void Scumm_v6::o6_kernelGetFunctions()
}
}
-void Scumm_v6::o6_delayFrames()
-{
+void Scumm_v6::o6_delayFrames() {
ScriptSlot *ss = &vm.slot[_currentScript];
if (ss->delayFrameCount == 0) {
ss->delayFrameCount = pop();
@@ -2864,8 +2706,7 @@ void Scumm_v6::o6_delayFrames()
}
}
-void Scumm_v6::o6_pickOneOf()
-{
+void Scumm_v6::o6_pickOneOf() {
int args[100];
int i, num;
@@ -2876,8 +2717,7 @@ void Scumm_v6::o6_pickOneOf()
push(args[i]);
}
-void Scumm_v6::o6_pickOneOfDefault()
-{
+void Scumm_v6::o6_pickOneOfDefault() {
int args[100];
int i, num, def;
@@ -2938,7 +2778,7 @@ void Scumm_v6::o6_closeFile() {
// pop'd variable should be that pushed in o6_openFile()
warning("stub o6_closeFile(%d)", pop());
}
-
+
void Scumm_v6::o6_deleteFile() {
int len;
len = resStrLen(_scriptPointer);
@@ -3040,8 +2880,7 @@ void Scumm_v6::o6_pickVarRandom() {
push(readArray(value, 0, num));
}
-void Scumm_v6::o6_getDateTime()
-{
+void Scumm_v6::o6_getDateTime() {
struct tm *t;
time_t now = time(NULL);
@@ -3075,8 +2914,7 @@ void Scumm_v6::o6_localizeArray() {
warning("stub localizeArray(%d)", pop());
}
-void Scumm_v6::decodeParseString(int m, int n)
-{
+void Scumm_v6::decodeParseString(int m, int n) {
byte b;
b = fetchScriptByte();
diff --git a/scumm/script_v8.cpp b/scumm/script_v8.cpp
index 912bac47ea..d78177b8e7 100644
--- a/scumm/script_v8.cpp
+++ b/scumm/script_v8.cpp
@@ -35,8 +35,7 @@
#define OPCODE(x) { &Scumm_v8::x, #x }
-void Scumm_v8::setupOpcodes()
-{
+void Scumm_v8::setupOpcodes() {
static const OpcodeEntryV8 opcodes[256] = {
/* 00 */
OPCODE(o6_invalid),
@@ -363,20 +362,17 @@ void Scumm_v8::setupOpcodes()
_opcodesV8 = opcodes;
}
-void Scumm_v8::executeOpcode(int i)
-{
+void Scumm_v8::executeOpcode(int i) {
OpcodeProcV8 op = _opcodesV8[i].proc;
(this->*op) ();
}
-const char *Scumm_v8::getOpcodeDesc(int i)
-{
+const char *Scumm_v8::getOpcodeDesc(int i) {
return _opcodesV8[i].desc;
}
// In V8, the word size is 4 byte, not 2 bytes as in V6/V7 games
-uint Scumm_v8::fetchScriptWord()
-{
+uint Scumm_v8::fetchScriptWord() {
int a;
if (*_lastCodePtr + sizeof(MemBlkHeader) != _scriptOrgPointer) {
uint32 oldoffs = _scriptPointer - _scriptOrgPointer;
@@ -388,13 +384,11 @@ uint Scumm_v8::fetchScriptWord()
return a;
}
-int Scumm_v8::fetchScriptWordSigned()
-{
+int Scumm_v8::fetchScriptWordSigned() {
return (int32)fetchScriptWord();
}
-int Scumm_v8::readVar(uint var)
-{
+int Scumm_v8::readVar(uint var) {
debug(9, "readvar(%d)", var);
if (!(var & 0xF0000000)) {
@@ -418,8 +412,7 @@ int Scumm_v8::readVar(uint var)
return -1;
}
-void Scumm_v8::writeVar(uint var, int value)
-{
+void Scumm_v8::writeVar(uint var, int value) {
debug(9, "writeVar(%d, %d)", var, value);
if (!(var & 0xF0000000)) {
@@ -457,8 +450,7 @@ void Scumm_v8::writeVar(uint var, int value)
error("Illegal varbits (w)");
}
-void Scumm_v8::decodeParseString(int m, int n)
-{
+void Scumm_v8::decodeParseString(int m, int n) {
byte b;
bool containsSpeech;
@@ -565,8 +557,7 @@ void Scumm_v8::decodeParseString(int m, int n)
}
}
-void Scumm::enqueueText(byte *text, int x, int y, byte color, byte charset, bool center)
-{
+void Scumm::enqueueText(byte *text, int x, int y, byte color, byte charset, bool center) {
BlastText &bt = _blastTextQueue[_blastTextQueuePos++];
assert(_blastTextQueuePos <= 32);
@@ -578,8 +569,7 @@ void Scumm::enqueueText(byte *text, int x, int y, byte color, byte charset, bool
bt.center = center;
}
-void Scumm::drawBlastTexts()
-{
+void Scumm::drawBlastTexts() {
// FIXME
byte *buf;
@@ -622,14 +612,12 @@ void Scumm::drawBlastTexts()
_charset->_ignoreCharsetMask = false;
}
-void Scumm_v8::o8_mod()
-{
+void Scumm_v8::o8_mod() {
int a = pop();
push(pop() % a);
}
-void Scumm_v8::o8_wait()
-{
+void Scumm_v8::o8_wait() {
// TODO
int actnum, offs;
Actor *a;
@@ -691,8 +679,7 @@ void Scumm_v8::o8_wait()
o6_breakHere();
}
-void Scumm_v8::o8_dim()
-{
+void Scumm_v8::o8_dim() {
byte subOp = fetchScriptByte();
int array = fetchScriptWord();
@@ -711,8 +698,7 @@ void Scumm_v8::o8_dim()
}
}
-void Scumm_v8::o8_dim2()
-{
+void Scumm_v8::o8_dim2() {
byte subOp = fetchScriptByte();
int array = fetchScriptWord(), a, b;
@@ -735,8 +721,7 @@ void Scumm_v8::o8_dim2()
}
}
-void Scumm_v8::o8_arrayOps()
-{
+void Scumm_v8::o8_arrayOps() {
byte subOp = fetchScriptByte();
int array = fetchScriptWord();
int b, c, d, len;
@@ -778,19 +763,17 @@ void Scumm_v8::o8_arrayOps()
}
}
-void Scumm_v8::o8_blastText()
-{
+void Scumm_v8::o8_blastText() {
// FIXME
decodeParseString(5, 0);
}
-void Scumm_v8::o8_cursorCommand()
-{
+void Scumm_v8::o8_cursorCommand() {
// TODO
byte subOp = fetchScriptByte();
int a, i;
int args[16];
-
+
switch (subOp) {
case 0xDC: // SO_CURSOR_ON Turn cursor on
_cursor.state = 1;
@@ -865,8 +848,7 @@ void Scumm_v8::o8_cursorCommand()
_vars[VAR_USERPUT] = _userPut;
}
-void Scumm_v8::o8_createBoxMatrix()
-{
+void Scumm_v8::o8_createBoxMatrix() {
int i;
Actor *a;
@@ -879,8 +861,7 @@ void Scumm_v8::o8_createBoxMatrix()
}
}
-void Scumm_v8::o8_resourceRoutines()
-{
+void Scumm_v8::o8_resourceRoutines() {
// TODO
byte subOp = fetchScriptByte();
int resid = pop();
@@ -949,19 +930,18 @@ void Scumm_v8::o8_resourceRoutines()
}
}
-void Scumm_v8::o8_roomOps()
-{
+void Scumm_v8::o8_roomOps() {
// TODO
byte subOp = fetchScriptByte();
int a, b, c, d, e;
switch (subOp) {
case 0x52: // SO_ROOM_PALETTE Set room palette
- d = pop();
- c = pop();
- b = pop();
- a = pop();
- setPalColor(d, a, b, c);
+ d = pop();
+ c = pop();
+ b = pop();
+ a = pop();
+ setPalColor(d, a, b, c);
break;
case 0x55: // SO_ROOM_INTENSITY Set room intensity
// Not used in CMI???
@@ -1030,8 +1010,7 @@ void Scumm_v8::o8_roomOps()
}
}
-void Scumm_v8::o8_actorOps()
-{
+void Scumm_v8::o8_actorOps() {
byte subOp = fetchScriptByte();
Actor *a;
int i, j;
@@ -1199,8 +1178,7 @@ void Scumm_v8::o8_actorOps()
}
}
-void Scumm_v8::o8_cameraOps()
-{
+void Scumm_v8::o8_cameraOps() {
// TODO
byte subOp = fetchScriptByte();
switch (subOp) {
@@ -1215,8 +1193,7 @@ void Scumm_v8::o8_cameraOps()
}
}
-void Scumm_v8::o8_verbOps()
-{
+void Scumm_v8::o8_verbOps() {
byte subOp = fetchScriptByte();
VerbSlot *vs = NULL;
int slot, a, b;
@@ -1230,7 +1207,7 @@ void Scumm_v8::o8_verbOps()
//printf("Setting current actor to %d\n", _curActor);
return;
}
-
+
assert(0 <= _curVerbSlot && _curVerbSlot < _maxVerbs);
vs = &_verbs[_curVerbSlot];
assert(vs);
@@ -1334,16 +1311,14 @@ void Scumm_v8::o8_verbOps()
}
}
-void Scumm_v8::o8_soundKludge()
-{
+void Scumm_v8::o8_soundKludge() {
int args[16];
int num = getStackList(args, sizeof(args) / sizeof(args[0]));
_sound->soundKludge(args, num);
}
-void Scumm_v8::o8_system()
-{
+void Scumm_v8::o8_system() {
// TODO
byte subOp = fetchScriptByte();
switch (subOp) {
@@ -1359,8 +1334,7 @@ void Scumm_v8::o8_system()
}
-void Scumm_v8::o8_startVideo()
-{
+void Scumm_v8::o8_startVideo() {
int len = resStrLen(_scriptPointer);
warning("o8_startVideo(%s/%s)", getGameDataPath(), (char*)_scriptPointer);
@@ -1379,8 +1353,7 @@ void Scumm_v8::o8_startVideo()
_scriptPointer += len + 1;
}
-void Scumm_v8::o8_kernelSetFunctions()
-{
+void Scumm_v8::o8_kernelSetFunctions() {
// TODO
Actor *a;
int args[30];
@@ -1524,8 +1497,7 @@ void Scumm_v8::o8_kernelSetFunctions()
}
}
-void Scumm_v8::o8_kernelGetFunctions()
-{
+void Scumm_v8::o8_kernelGetFunctions() {
// TODO
int args[30];
int len = getStackList(args, sizeof(args) / sizeof(args[0]));
@@ -1662,8 +1634,7 @@ void Scumm_v8::o8_kernelGetFunctions()
}
-void Scumm_v8::o8_getActorChore()
-{
+void Scumm_v8::o8_getActorChore() {
int actnum = pop();
Actor *a = derefActorSafe(actnum, "o8_getActorChore");
assert(a);
@@ -1678,32 +1649,27 @@ void Scumm_v8::o8_getActorChore()
push(a->frame);
}
-void Scumm_v8::o8_getObjectImageX()
-{
+void Scumm_v8::o8_getObjectImageX() {
int i = getObjectIndex(pop());
push(_objs[i].x_pos);
}
-void Scumm_v8::o8_getObjectImageY()
-{
+void Scumm_v8::o8_getObjectImageY() {
int i = getObjectIndex(pop());
push(_objs[i].y_pos);
}
-void Scumm_v8::o8_getObjectImageWidth()
-{
+void Scumm_v8::o8_getObjectImageWidth() {
int i = getObjectIndex(pop());
push(_objs[i].width);
}
-void Scumm_v8::o8_getObjectImageHeight()
-{
+void Scumm_v8::o8_getObjectImageHeight() {
int i = getObjectIndex(pop());
push(_objs[i].height);
}
-void Scumm_v8::o8_getStringWidth()
-{
+void Scumm_v8::o8_getStringWidth() {
int charset = pop();
int len = resStrLen(_scriptPointer);
int oldID = _charset->getCurID();
@@ -1718,20 +1684,19 @@ void Scumm_v8::o8_getStringWidth()
_scriptPointer += len + 1;
}
-void Scumm_v8::o8_drawObject()
-{
+void Scumm_v8::o8_drawObject() {
int state = pop(), y = pop(), x = pop(), obj = pop(), objnum = getObjectIndex(obj);
ObjectData *od;
if (!objnum)
return;
- od = &_objs[objnum];
- if (x != 0x7FFFFFFF) {
- od->x_pos = x;
- od->y_pos = y;
- printf("setting position: 0x%X b 0x%X\n", x, y);
- }
+ od = &_objs[objnum];
+ if (x != 0x7FFFFFFF) {
+ od->x_pos = x;
+ od->y_pos = y;
+ debug(1, "setting position: 0x%X b 0x%X\n", x, y);
+ }
addObjectToDrawQue(objnum);
diff --git a/scumm/scumm.h b/scumm/scumm.h
index 63d8d89d2f..c42307c3d1 100644
--- a/scumm/scumm.h
+++ b/scumm/scumm.h
@@ -61,11 +61,11 @@ enum {
struct ScummPoint {
int x, y;
- bool operator ==(const ScummPoint &p) const
+ bool operator == (const ScummPoint &p) const
{
return p.x == x && p.y == y;
}
- bool operator !=(const ScummPoint &p) const
+ bool operator != (const ScummPoint &p) const
{
return p.x != x || p.y != y;
}
@@ -319,7 +319,7 @@ public:
// Scumm main loop
void mainRun();
int scummLoop(int delta);
-
+
// Event handling
void waitForTimer(int msec_delay);
void processKbd();
@@ -442,15 +442,13 @@ protected:
bool saveState(int slot, bool compat, SaveFileManager *mgr);
bool loadState(int slot, bool compat, SaveFileManager *mgr);
- bool saveState(int slot, bool compat)
- {
+ bool saveState(int slot, bool compat) {
SaveFileManager *mgr = _system->get_savefile_manager();
bool result = saveState(slot, compat, mgr);
delete mgr;
return result;
}
- bool loadState(int slot, bool compat)
- {
+ bool loadState(int slot, bool compat) {
SaveFileManager *mgr = _system->get_savefile_manager();
bool result = loadState(slot, compat, mgr);
delete mgr;
@@ -600,7 +598,7 @@ public:
int _lastLoadedRoom, _roomResource;
byte *findResourceData(uint32 tag, byte *ptr);
int getResourceDataSize(byte *ptr);
-
+
int getArrayId();
void nukeArray(int a);
int defineArray(int a, int b, int c, int d);
@@ -934,7 +932,7 @@ public:
Box *getBoxBaseAddr(int box);
byte getBoxFlags(int box);
int getBoxScale(int box);
-
+
int getScale(int box, int x, int y);
void setScaleItem(int slot, int a, int b, int c, int d);
@@ -1074,7 +1072,7 @@ public:
byte VAR_SOUNDRESULT;
byte VAR_TALKSTOP_KEY;
byte VAR_59;
-
+
byte VAR_SOUNDPARAM;
byte VAR_SOUNDPARAM2;
byte VAR_SOUNDPARAM3;
diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp
index 349e17573d..4f602df25b 100644
--- a/scumm/scummvm.cpp
+++ b/scumm/scummvm.cpp
@@ -59,7 +59,7 @@ static const VersionSettings scumm_settings[] = {
// {"zak64", "Zak McKracken and the Alien Mindbenders (C64)", GID_ZAK64, 1, 0, 0,},
/* Scumm Version 2 */
- {"maniac", "Maniac Mansion", GID_MANIAC, 2, 0, 0,
+ {"maniac", "Maniac Mansion", GID_MANIAC, 2, 0, 0,
GF_SMALL_HEADER | GF_USE_KEY | GF_SMALL_NAMES | GF_16COLOR | GF_OLD_BUNDLE | GF_NO_SCALLING, "MANIACEX.EXE"},
// {"zak", "Zak McKracken and the Alien Mindbenders", GID_ZAK, 2, 0, 0,
// GF_SMALL_HEADER | GF_USE_KEY | GF_SMALL_NAMES | GF_16COLOR | GF_OLD_BUNDLE | GF_NO_SCALLING, "ZAKEXE.EXE"},
@@ -142,13 +142,11 @@ static const VersionSettings scumm_settings[] = {
{NULL, NULL, 0, 0, 0, 0, 0, NULL}
};
-const VersionSettings *Engine_SCUMM_targetList()
-{
+const VersionSettings *Engine_SCUMM_targetList() {
return scumm_settings;
}
-Engine *Engine_SCUMM_create(GameDetector *detector, OSystem *syst)
-{
+Engine *Engine_SCUMM_create(GameDetector *detector, OSystem *syst) {
Engine *engine;
if (detector->_amiga)
@@ -173,8 +171,7 @@ Engine *Engine_SCUMM_create(GameDetector *detector, OSystem *syst)
}
Scumm::Scumm (GameDetector *detector, OSystem *syst)
- : Engine(detector, syst), _pauseDialog(0), _optionsDialog(0), _saveLoadDialog(0)
-{
+ : Engine(detector, syst), _pauseDialog(0), _optionsDialog(0), _saveLoadDialog(0) {
OSystem::Property prop;
// Use g_scumm from error() ONLY
@@ -236,10 +233,9 @@ Scumm::Scumm (GameDetector *detector, OSystem *syst)
// Override global fullscreen setting with any game-specific define
if (g_config->getBool("fullscreen", false)) {
- if (!syst->property(OSystem::PROP_GET_FULLSCREEN, 0))
- syst->property(OSystem::PROP_TOGGLE_FULLSCREEN, 0);
- }
-
+ if (!syst->property(OSystem::PROP_GET_FULLSCREEN, 0))
+ syst->property(OSystem::PROP_TOGGLE_FULLSCREEN, 0);
+ }
#ifndef __GP32__ //ph0x FIXME, "quick dirty hack"
/* Bind the mixer to the system => mixer will be invoked
@@ -301,8 +297,7 @@ Scumm::~Scumm ()
delete _audioNames;
}
-void Scumm::scummInit()
-{
+void Scumm::scummInit() {
int i;
Actor *a;
@@ -323,7 +318,7 @@ void Scumm::scummInit()
_charset = new CharsetRendererClassic(this);
memset(_charsetData, 0, sizeof(_charsetData));
-
+
if (!(_features & GF_SMALL_NAMES) && !(_features & GF_AFTER_V8))
loadCharset(1);
@@ -338,7 +333,7 @@ void Scumm::scummInit()
a->initActorClass(this);
a->initActor(1);
}
-
+
_vars[VAR_CHARINC] = 4;
_numNestedScripts = 0;
@@ -445,8 +440,7 @@ void Scumm::scummInit()
}
-void Scumm::initScummVars()
-{
+void Scumm::initScummVars() {
if (!(_features & GF_AFTER_V7)) {
_vars[VAR_CURRENTDRIVE] = 0;
_vars[VAR_FIXEDDISK] = true;
@@ -467,10 +461,9 @@ void Scumm::initScummVars()
_vars[VAR_CURRENTDISK] = 1;
_vars[VAR_LANGUAGE] = _language;
}
-}
+}
-void Scumm::checkRange(int max, int min, int no, const char *str)
-{
+void Scumm::checkRange(int max, int min, int no, const char *str) {
if (no < min || no > max) {
char buf[1024];
sprintf(buf, str, no);
@@ -479,8 +472,7 @@ void Scumm::checkRange(int max, int min, int no, const char *str)
}
}
-int Scumm::scummLoop(int delta)
-{
+int Scumm::scummLoop(int delta) {
static int counter = 0;
#ifndef _WIN32_WCE
@@ -572,8 +564,8 @@ load_game:
// Ender: Disabled for small_header games, as can overwrite game
// variables (eg, Zak256 cashcard values). Temp disabled for V8
// because of odd timing issue with scripts and the variable reset
- if (success && _saveLoadCompatible && !(_features & GF_SMALL_HEADER) && !(_features & GF_AFTER_V8))
- _vars[VAR_GAME_LOADED] = 201;
+ if (success && _saveLoadCompatible && !(_features & GF_SMALL_HEADER) && !(_features & GF_AFTER_V8))
+ _vars[VAR_GAME_LOADED] = 201;
} else {
success = loadState(_saveLoadSlot, _saveLoadCompatible);
if (!success)
@@ -581,7 +573,7 @@ load_game:
// Ender: Disabled for small_header games, as can overwrite game
// variables (eg, Zak256 cashcard values).
- if (success && _saveLoadCompatible && !(_features & GF_SMALL_HEADER))
+ if (success && _saveLoadCompatible && !(_features & GF_SMALL_HEADER))
_vars[VAR_GAME_LOADED] = 203;
}
@@ -696,8 +688,7 @@ load_game:
}
-void Scumm::startScene(int room, Actor * a, int objectNr)
-{
+void Scumm::startScene(int room, Actor * a, int objectNr) {
int i, where;
Actor *at;
@@ -799,7 +790,6 @@ void Scumm::startScene(int room, Actor * a, int objectNr)
if (_roomResource == 0)
return;
-
memset(gfxUsageBits, 0, sizeof(gfxUsageBits));
if (a) {
@@ -838,8 +828,7 @@ void Scumm::startScene(int room, Actor * a, int objectNr)
CHECK_HEAP;
}
-void Scumm::initRoomSubBlocks()
-{
+void Scumm::initRoomSubBlocks() {
int i, offs;
byte *ptr;
byte *roomptr, *searchptr, *roomResPtr;
@@ -876,7 +865,6 @@ void Scumm::initRoomSubBlocks()
_scrHeight = READ_LE_UINT16(&(rmhd->old.height));
}
-
if (_features & GF_SMALL_HEADER)
_IM00_offs = findResourceData(MKID('IM00'), roomptr) - roomptr;
else if (_features & GF_AFTER_V8) {
@@ -891,8 +879,7 @@ void Scumm::initRoomSubBlocks()
_IM00_offs = ptr - roomptr;
} else
_IM00_offs =
- findResource(MKID('IM00'),
- findResource(MKID('RMIM'), roomptr)) - roomptr;
+ findResource(MKID('IM00'), findResource(MKID('RMIM'), roomptr)) - roomptr;
// Look for an exit script
ptr = findResourceData(MKID('EXCD'), roomResPtr);
@@ -977,7 +964,6 @@ void Scumm::initRoomSubBlocks()
}
}
-
//
// Setup local script
//
@@ -1076,8 +1062,7 @@ void Scumm::initRoomSubBlocks()
memset(_extraBoxFlags, 0, sizeof(_extraBoxFlags));
}
-void Scumm::setScaleItem(int slot, int a, int b, int c, int d)
-{
+void Scumm::setScaleItem(int slot, int a, int b, int c, int d) {
byte *ptr;
int cur, amounttoadd, i, tmp;
@@ -1100,8 +1085,7 @@ void Scumm::setScaleItem(int slot, int a, int b, int c, int d)
}
}
-void Scumm::setScaleSlot(int slot, int x1, int y1, int scale1, int x2, int y2, int scale2)
-{
+void Scumm::setScaleSlot(int slot, int x1, int y1, int scale1, int x2, int y2, int scale2) {
assert(1 <= slot && slot <= 20);
_scaleSlots[slot-1].x2 = x2;
_scaleSlots[slot-1].y2 = y2;
@@ -1111,8 +1095,7 @@ void Scumm::setScaleSlot(int slot, int x1, int y1, int scale1, int x2, int y2, i
_scaleSlots[slot-1].scale1 = scale1;
}
-void Scumm::dumpResource(char *tag, int idx, byte *ptr)
-{
+void Scumm::dumpResource(char *tag, int idx, byte *ptr) {
char buf[256];
File out;
@@ -1138,33 +1121,28 @@ void Scumm::dumpResource(char *tag, int idx, byte *ptr)
out.close();
}
-void Scumm::clearClickedStatus()
-{
+void Scumm::clearClickedStatus() {
checkKeyHit();
_mouseButStat = 0;
_leftBtnPressed &= ~msClicked;
_rightBtnPressed &= ~msClicked;
}
-int Scumm::checkKeyHit()
-{
+int Scumm::checkKeyHit() {
int a = _keyPressed;
_keyPressed = 0;
return a;
}
-void Scumm::pauseGame(bool user)
-{
+void Scumm::pauseGame(bool user) {
pauseDialog();
}
-void Scumm::setOptions()
-{
+void Scumm::setOptions() {
//_newgui->optionsDialog();
}
-int Scumm::runDialog(Dialog *dialog)
-{
+int Scumm::runDialog(Dialog *dialog) {
// Pause sound put
bool old_soundsPaused = _sound->_soundsPaused;
_sound->pauseSounds(true);
@@ -1182,29 +1160,25 @@ int Scumm::runDialog(Dialog *dialog)
return result;
}
-void Scumm::pauseDialog()
-{
+void Scumm::pauseDialog() {
if (!_pauseDialog)
_pauseDialog = new PauseDialog(_newgui, this);
runDialog(_pauseDialog);
}
-void Scumm::saveloadDialog()
-{
+void Scumm::saveloadDialog() {
if (!_saveLoadDialog)
_saveLoadDialog = new SaveLoadDialog(_newgui, this);
runDialog(_saveLoadDialog);
}
-void Scumm::optionsDialog()
-{
+void Scumm::optionsDialog() {
if (!_optionsDialog)
_optionsDialog = new OptionsDialog(_newgui, this);
runDialog(_optionsDialog);
}
-char Scumm::displayError(bool showCancel, const char *message, ...)
-{
+char Scumm::displayError(bool showCancel, const char *message, ...) {
char buf[1024], result;
va_list va;
@@ -1219,14 +1193,12 @@ char Scumm::displayError(bool showCancel, const char *message, ...)
return result;
}
-void Scumm::shutDown(int i)
-{
+void Scumm::shutDown(int i) {
/* TODO: implement this */
warning("shutDown: not implemented");
}
-void Scumm::processKbd()
-{
+void Scumm::processKbd() {
int saveloadkey;
getKeyInput();
@@ -1237,8 +1209,6 @@ void Scumm::processKbd()
_virtual_mouse_x = mouse.x + virtscr[0].xstart;
-
-
if(_features & GF_AFTER_V7)
_virtual_mouse_y = mouse.y + camera._cur.y - (_realHeight / 2);
else
@@ -1275,7 +1245,7 @@ void Scumm::processKbd()
if (_lastKeyHit == _vars[VAR_RESTART_KEY]) {
warning("Restart not implemented");
-// pauseGame(true);
+// pauseGame(true);
return;
}
@@ -1338,8 +1308,7 @@ void Scumm::processKbd()
_mouseButStat = _lastKeyHit;
}
-int Scumm::getKeyInput()
-{
+int Scumm::getKeyInput() {
_mouseButStat = 0;
_lastKeyHit = checkKeyHit();
@@ -1394,8 +1363,7 @@ int Scumm::getKeyInput()
return _lastKeyHit;
}
-void Scumm::convertKeysToClicks()
-{
+void Scumm::convertKeysToClicks() {
if (_lastKeyHit && _cursor.state > 0) {
if (_lastKeyHit == 9) {
_mouseButStat = MBS_RIGHT_CLICK;
@@ -1407,13 +1375,11 @@ void Scumm::convertKeysToClicks()
}
}
-Actor *Scumm::derefActor(int id)
-{
+Actor *Scumm::derefActor(int id) {
return &_actors[id];
}
-Actor *Scumm::derefActorSafe(int id, const char *errmsg)
-{
+Actor *Scumm::derefActorSafe(int id, const char *errmsg) {
if (id < 1 || id >= NUM_ACTORS) {
if (_debugLevel > 1)
warning
@@ -1424,8 +1390,7 @@ Actor *Scumm::derefActorSafe(int id, const char *errmsg)
return derefActor(id);
}
-void Scumm::setStringVars(int slot)
-{
+void Scumm::setStringVars(int slot) {
StringTab *st = &_string[slot];
st->xpos = st->t_xpos;
st->ypos = st->t_ypos;
@@ -1437,13 +1402,11 @@ void Scumm::setStringVars(int slot)
st->charset = st->t_charset;
}
-void Scumm::startManiac()
-{
+void Scumm::startManiac() {
warning("stub startManiac()");
}
-void Scumm::destroy()
-{
+void Scumm::destroy() {
freeResources();
free(_objectStateTable);
@@ -1462,8 +1425,7 @@ void Scumm::destroy()
//
// Convert an old style direction to a new style one (angle),
//
-int newDirToOldDir(int dir)
-{
+int newDirToOldDir(int dir) {
if (dir >= 71 && dir <= 109)
return 1;
if (dir >= 109 && dir <= 251)
@@ -1476,8 +1438,7 @@ int newDirToOldDir(int dir)
//
// Convert an new style (angle) direction to an old style one.
//
-int oldDirToNewDir(int dir)
-{
+int oldDirToNewDir(int dir) {
const int new_dir_table[4] = { 270, 90, 180, 0 };
return new_dir_table[dir];
}
@@ -1485,8 +1446,7 @@ int oldDirToNewDir(int dir)
//
// Convert an angle to a simple direction.
//
-int toSimpleDir(int dirType, int dir)
-{
+int toSimpleDir(int dirType, int dir) {
const int16 many_direction_tab[16] = {
71, 109, 251, 289, -1, -1, -1, -1,
22, 72, 107, 157, 202, 252, 287, 337
@@ -1498,27 +1458,23 @@ int toSimpleDir(int dirType, int dir)
return i;
}
return 0;
-
}
//
// Convert a simple direction to an angle
//
-int fromSimpleDir(int dirType, int dir)
-{
+int fromSimpleDir(int dirType, int dir) {
if (dirType)
return dir * 45;
else
return dir * 90;
}
-
//
// Normalize the given angle - that means, ensure it is positive, and
// change it to the closest multiple of 45 degree by abusing toSimpleDir.
//
-int normalizeAngle(int angle)
-{
+int normalizeAngle(int angle) {
int temp;
temp = (angle + 360) % 360;
@@ -1526,8 +1482,7 @@ int normalizeAngle(int angle)
return toSimpleDir(1, temp) * 45;
}
-void NORETURN CDECL error(const char *s, ...)
-{
+void NORETURN CDECL error(const char *s, ...) {
char buf[1024];
#if defined( USE_WINDBG ) || defined ( _WIN32_WCE )
char buf2[1024];
@@ -1573,7 +1528,7 @@ void NORETURN CDECL error(const char *s, ...)
#endif
#endif
}
-
+
// Finally exit. quit() will terminate the program if g_system iss present
if (g_system)
g_system->quit();
@@ -1603,9 +1558,9 @@ void Scumm::waitForTimer(int msec_delay) {
_saveLoadSlot = event.kbd.keycode - '0';
// don't overwrite autosave (slot 0)
- if (_saveLoadSlot == 0)
+ if (_saveLoadSlot == 0)
_saveLoadSlot = 10;
-
+
sprintf(_saveLoadName, "Quicksave %d", _saveLoadSlot);
_saveLoadFlag = (event.kbd.flags == OSystem::KBD_ALT) ? 1 : 2;
_saveLoadCompatible = false;
@@ -1663,7 +1618,6 @@ void Scumm::waitForTimer(int msec_delay) {
}
}
-
void Scumm::updatePalette() {
if (_palDirtyMax == -1)
return;
@@ -1715,8 +1669,7 @@ void Scumm::updatePalette() {
_palDirtyMin = 256;
}
-void Scumm::mainRun()
-{
+void Scumm::mainRun() {
int delta = 0;
int last_time = _system->get_msecs();
int new_time;
@@ -1734,15 +1687,14 @@ void Scumm::mainRun()
}
}
-void Scumm::launch()
-{
+void Scumm::launch() {
gdi._vm = this;
_maxHeapThreshold = 450000;
_minHeapThreshold = 400000;
_verbRedraw = false;
-
+
allocResTypeData(rtBuffer, MKID('NONE'), 10, "buffer", 0);
initVirtScreen(0, 0, 0, _realWidth, _realHeight, false, false);
diff --git a/scumm/sound.cpp b/scumm/sound.cpp
index 1fa859a425..f004d4e6c4 100644
--- a/scumm/sound.cpp
+++ b/scumm/sound.cpp
@@ -123,15 +123,15 @@ void Sound::processSoundQues() {
_soundQuePos = 0;
}
-byte * Sound::readCreativeVocFile(byte * ptr, uint32 & size, uint32 & rate, uint32 & loops) {
- assert(strncmp((char*)ptr, "Creative Voice File\x1A", 20) == 0);
+byte *Sound::readCreativeVocFile(byte *ptr, uint32 &size, uint32 &rate, uint32 &loops) {
+ assert(strncmp((char *)ptr, "Creative Voice File\x1A", 20) == 0);
int32 offset = READ_LE_UINT16(ptr + 20);
int16 version = READ_LE_UINT16(ptr + 22);
int16 code = READ_LE_UINT16(ptr + 24);
assert(version == 0x010A || version == 0x0114);
assert(code == ~version + 0x1234);
bool quit = 0;
- byte * ret_sound = 0; size = 0, loops = 0;
+ byte *ret_sound = 0; size = 0, loops = 0;
while(!quit) {
int len = READ_LE_UINT32(ptr + offset);
offset += 4;
@@ -147,9 +147,9 @@ byte * Sound::readCreativeVocFile(byte * ptr, uint32 & size, uint32 & rate, uint
debug(9, "VOC Data Bloc : %d, %d, %d", rate, packing, len);
if(packing == 0) {
if(size) {
- ret_sound = (byte*)realloc(ret_sound, size + len);
+ ret_sound = (byte *)realloc(ret_sound, size + len);
} else {
- ret_sound = (byte*)malloc(len);
+ ret_sound = (byte *)malloc(len);
}
memcpy(ret_sound + size, ptr + offset, len);
size += len;
@@ -194,7 +194,7 @@ void Sound::playSound(int soundID) {
_scumm->_vars[_scumm->VAR_MI1_TIMER] = 0;
playCDTrack(ptr[16], ptr[17] == 0xff ? -1 : ptr[17],
(ptr[18] * 60 + ptr[19]) * 75 + ptr[20], 0);
-
+
_scumm->current_cd_sound = soundID;
return;
}
@@ -202,16 +202,16 @@ void Sound::playSound(int soundID) {
// This is rather hackish right now, but works OK. SFX are not sounding
// 100% correct, though, not sure right now what is causing this.
else if (READ_UINT32_UNALIGNED(ptr) == MKID('Mac1')) {
-
+
// Read info from the header
size = READ_BE_UINT32_UNALIGNED(ptr+0x60);
rate = READ_BE_UINT32_UNALIGNED(ptr+0x64) >> 16;
-
+
// Skip over the header (fixed size)
ptr += 0x72;
-
+
// Allocate a sound buffer, copy the data into it, and play
- sound = (char*)malloc(size);
+ sound = (char *)malloc(size);
memcpy(sound, ptr, size);
_scumm->_mixer->playRaw(NULL, sound, size, rate, SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE);
return;
@@ -223,13 +223,13 @@ void Sound::playSound(int soundID) {
ptr += 8 + READ_BE_UINT32_UNALIGNED(ptr+12);
if (READ_UINT32_UNALIGNED(ptr) != MKID('SDAT'))
return; // abort
-
+
size = READ_BE_UINT32_UNALIGNED(ptr+4) - 8;
// FIXME - what value here ?!? 11025 is just a guess based on strings in w32 bin, prev guess 8000
rate = 11025;
-
+
// Allocate a sound buffer, copy the data into it, and play
- sound = (char*)malloc(size);
+ sound = (char *)malloc(size);
memcpy(sound, ptr + 8, size);
_scumm->_mixer->playRaw(NULL, sound, size, rate, SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE);
return;
@@ -245,7 +245,7 @@ void Sound::playSound(int soundID) {
// Support for sampled sound effects in Monkey1 and Monkey2
else if (READ_UINT32_UNALIGNED(ptr) == MKID('SBL ')) {
debug(2, "Using SBL sound effect");
-
+
// TODO - Figuring out how the SBL chunk works. Here's
// an example:
//
@@ -287,15 +287,15 @@ void Sound::playSound(int soundID) {
rate = 8000;
size = READ_BE_UINT32_UNALIGNED(ptr + 4) - 27;
-
+
// Allocate a sound buffer, copy the data into it, and play
- sound = (char*)malloc(size);
+ sound = (char *)malloc(size);
memcpy(sound, ptr + 33, size);
_scumm->_mixer->playRaw(NULL, sound, size, rate, SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE);
return;
} else if (_scumm->_features & GF_OLD256) {
size = READ_LE_UINT32(ptr);
-
+
#if 0
// FIXME - this is just some debug output for Zak256
if (size != 30) {
@@ -361,9 +361,10 @@ void Sound::playSound(int soundID) {
ptr += 0x16;
if (size == 30) {
int track = *ptr;
-
+
if (track == _scumm->current_cd_sound)
- if (pollCD() == 1) return;
+ if (pollCD() == 1)
+ return;
playCDTrack(track, 1, 0, 0);
_scumm->current_cd_sound = track;
@@ -371,7 +372,7 @@ void Sound::playSound(int soundID) {
}
size -= 0x36;
- sound = (char*)malloc(size);
+ sound = (char *)malloc(size);
for (int x = 0; x < size; x++) {
int bit = *ptr++;
if (_scumm->_gameId == GID_INDY3_256) {
@@ -381,7 +382,7 @@ void Sound::playSound(int soundID) {
sound[x] = bit ^ 0x80;
} else {
if (bit < 0x80)
- sound[x] = 0x7F-bit;
+ sound[x] = 0x7F - bit;
else
sound[x] = bit;
}
@@ -456,17 +457,15 @@ void Sound::processSfxQueues() {
}
}
-static int compar(const void *a, const void *b)
-{
- return ((MP3OffsetTable *) a)->org_offset -
- ((MP3OffsetTable *) b)->org_offset;
+static int compar(const void *a, const void *b) {
+ return ((MP3OffsetTable *)a)->org_offset - ((MP3OffsetTable *)b)->org_offset;
}
int Sound::startTalkSound(uint32 offset, uint32 b, int mode) {
int num = 0, i;
byte file_byte, file_byte_2;
int size;
- byte* sound;
+ byte *sound;
if (_sfxFile->isOpen() == false) {
warning("startTalkSound: SFX file is not open");
@@ -479,13 +478,12 @@ int Sound::startTalkSound(uint32 offset, uint32 b, int mode) {
if (_scumm->_features & GF_HUMONGOUS) {
// SKIP TLKB (8) TALK (8) HSHD (24) and SDAT (8)
_sfxFile->seek(offset + 48, SEEK_SET);
- sound = (byte*)malloc(b - 64);
+ sound = (byte *)malloc(b - 64);
_sfxFile->read(sound, b - 64);
_scumm->_mixer->playRaw(NULL, sound, b - 64, 11025, SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE);
return -1;
}
-
// Some games frequently assume that starting one sound effect will
// automatically stop any other that may be playing at that time. So
// that is what we do here, but we make an exception for speech.
@@ -511,8 +509,8 @@ int Sound::startTalkSound(uint32 offset, uint32 b, int mode) {
MP3OffsetTable *result = NULL, key;
key.org_offset = offset;
- result = (MP3OffsetTable *) bsearch(&key, offset_table, num_sound_effects,
- sizeof(MP3OffsetTable), compar);
+ result = (MP3OffsetTable *)bsearch(&key, offset_table, num_sound_effects,
+ sizeof(MP3OffsetTable), compar);
if (result == NULL) {
warning("startTalkSound: did not find sound at offset %d !", offset);
@@ -678,8 +676,7 @@ void Sound::stopSound(int a) {
_soundQue2[i] = 0;
}
-void Sound::stopAllSounds()
-{
+void Sound::stopAllSounds() {
IMuse *se = _scumm->_imuse;
if (_scumm->current_cd_sound != 0) {
@@ -766,7 +763,7 @@ void Sound::pauseSounds(bool pause) {
return;
_soundsPaused = pause;
- _scumm->_mixer->pause(pause);
+ _scumm->_mixer->pause(pause);
_scumm->_sound->pauseBundleMusic(pause);
@@ -780,7 +777,6 @@ void Sound::pauseSounds(bool pause) {
else
startCDTimer();
}
-
}
int Sound::startSfxSound(File *file, int file_size) {
@@ -858,9 +854,9 @@ int Sound::startSfxSound(File *file, int file_size) {
return playSfxSound(data, size, 1000000 / (256 - rate), true);
}
-File * Sound::openSfxFile() {
+File *Sound::openSfxFile() {
char buf[256];
- File * file = new File();
+ File *file = new File();
/* Try opening the file <_exe_name>.sou first, eg tentacle.sou.
* That way, you can keep .sou files for multiple games in the
@@ -940,18 +936,17 @@ void Sound::stopSfxSound() {
}
}
-
bool Sound::isSfxFinished() {
return !_scumm->_mixer->hasActiveChannel();
}
-uint32 Sound::decode12BitsSample(byte * src, byte ** dst, uint32 size, bool stereo = false) {
+uint32 Sound::decode12BitsSample(byte *src, byte **dst, uint32 size, bool stereo = false) {
uint32 s_size = (size / 3) * 4;
uint32 loop_size = s_size / 4;
if (stereo == true) {
s_size *= 2;
}
- byte *ptr = *dst = (byte*)malloc(s_size);
+ byte *ptr = *dst = (byte *)malloc(s_size);
uint32 tmp;
while(loop_size--) {
@@ -976,24 +971,22 @@ uint32 Sound::decode12BitsSample(byte * src, byte ** dst, uint32 size, bool ster
return s_size;
}
-static void music_handler (void * engine) {
+static void music_handler (void *engine) {
g_scumm->_sound->bundleMusicHandler(g_scumm);
}
-void Sound::playBundleMusic(char * song) {
-
+void Sound::playBundleMusic(char *song) {
if (_scumm->_silentDigitalImuse == true) {
return;
}
if (_nameBundleMusic == NULL) {
- // FIXME: we have MUSDISK1.BUN and MUSDISK2.BUN in COMI.
_outputMixerSize = 66150; // ((22050 * 2 * 2) / 4) * 3
if (_scumm->_gameId == GID_CMI) {
char bunfile[20];
sprintf(bunfile, "musdisk%d.bun", _scumm->_vars[_scumm->VAR_CURRENTDISK]);
if (_musicDisk != _scumm->_vars[_scumm->VAR_CURRENTDISK])
- _scumm->_bundle->_musicFile.close();
+ _scumm->_bundle->_musicFile.close();
if (_scumm->_bundle->openMusicFile(bunfile, _scumm->getGameDataPath()) == false) {
if (_scumm->_bundle->openMusicFile("music.bun", _scumm->getGameDataPath()) == false) {
@@ -1008,8 +1001,8 @@ void Sound::playBundleMusic(char * song) {
if (_scumm->_bundle->openMusicFile("digmusic.bun", _scumm->getGameDataPath()) == false)
return;
}
- _musicBundleBufFinal = (byte*)malloc(_outputMixerSize);
- _musicBundleBufOutput = (byte*)malloc(((_outputMixerSize / 0x2000) + 1) * _outputMixerSize);
+ _musicBundleBufFinal = (byte *)malloc(_outputMixerSize);
+ _musicBundleBufOutput = (byte *)malloc(((_outputMixerSize / 0x2000) + 1) * _outputMixerSize);
_currentSampleBundleMusic = 0;
_offsetSampleBundleMusic = 0;
_offsetBufBundleMusic = 0;
@@ -1038,12 +1031,12 @@ void Sound::stopBundleMusic() {
_musicBundleToBeRemoved = true;
}
-void Sound::bundleMusicHandler(Scumm * scumm) {
- byte * ptr;
+void Sound::bundleMusicHandler(Scumm *scumm) {
+ byte *ptr;
int32 l, num = _numberSamplesBundleMusic, length, k;
int32 rate = 22050;
int32 tag, size = -1, header_size = 0;
-
+
if (_pauseBundleMusic)
return;
@@ -1121,7 +1114,7 @@ void Sound::bundleMusicHandler(Scumm * scumm) {
}
header_size = (ptr - _musicBundleBufOutput);
}
-
+
l++;
_currentSampleBundleMusic = l;
@@ -1143,12 +1136,12 @@ void Sound::bundleMusicHandler(Scumm * scumm) {
ptr = _musicBundleBufFinal;
- byte * buffer = NULL;
+ byte *buffer = NULL;
uint32 final_size;
if (_bundleMusicSampleBits == 12) {
final_size = decode12BitsSample(ptr, &buffer, _outputMixerSize);
} else if (_bundleMusicSampleBits == 16) {
- buffer = (byte*)malloc(_outputMixerSize);
+ buffer = (byte *)malloc(_outputMixerSize);
final_size = _outputMixerSize;
memcpy(buffer, ptr, _outputMixerSize);
} else {
@@ -1167,7 +1160,7 @@ void Sound::bundleMusicHandler(Scumm * scumm) {
}
int Sound::playBundleSound(char *sound) {
- byte * ptr;
+ byte *ptr;
bool result;
if (_scumm->_noDigitalSamples)
@@ -1217,7 +1210,7 @@ int Sound::playBundleSound(char *sound) {
}
assert(output_size <= 1000000);
- tag = READ_BE_UINT32(ptr); ptr+=4;
+ tag = READ_BE_UINT32(ptr); ptr += 4;
if (tag != MKID_BE('iMUS')) {
warning("Decompression of bundle sound failed");
free(ptr);
@@ -1247,7 +1240,7 @@ int Sound::playBundleSound(char *sound) {
break;
default:
- error("Unknown sound header %c%c%c%c", tag>>24, tag>>16, tag>>8, tag);
+ error("Unknown sound header %c%c%c%c", tag >> 24, tag >> 16, tag >> 8, tag);
}
}
@@ -1256,8 +1249,8 @@ int Sound::playBundleSound(char *sound) {
free(ptr);
return -1;
}
-
- byte * final = (byte *)malloc(size);
+
+ byte *final = (byte *)malloc(size);
memcpy(final, ptr, size);
if (_scumm->_actorToPrintStrFor != 0xFF && _scumm->_actorToPrintStrFor != 0) {
@@ -1382,8 +1375,7 @@ int Sound::playSfxSound_Vorbis(void *sound, uint32 size) {
// We use a real timer in an attempt to get better sync with CD tracks. This is
// necessary for games like Loom CD.
-static void cd_timer_handler(void *ptr)
-{
+static void cd_timer_handler(void *ptr) {
Scumm *scumm = (Scumm *) ptr;
// Maybe I could simply update _vars[VAR_MI1_TIMER] directly here, but
@@ -1398,13 +1390,11 @@ static void cd_timer_handler(void *ptr)
scumm->_sound->_cd_timer_value += 6;
}
-int Sound::readCDTimer()
-{
+int Sound::readCDTimer() {
return _cd_timer_value;
}
-void Sound::startCDTimer()
-{
+void Sound::startCDTimer() {
int timer_interval;
// The timer interval has been tuned for Loom CD and the Monkey 1
@@ -1422,13 +1412,11 @@ void Sound::startCDTimer()
_scumm->_timer->installProcedure(&cd_timer_handler, 1000 * timer_interval);
}
-void Sound::stopCDTimer()
-{
+void Sound::stopCDTimer() {
_scumm->_timer->releaseProcedure(&cd_timer_handler);
}
-void Sound::playCDTrack(int track, int num_loops, int start, int delay)
-{
+void Sound::playCDTrack(int track, int num_loops, int start, int delay) {
if (playMP3CDTrack(track, num_loops, start, delay) == -1)
_scumm->_system->play_cdrom(track, num_loops, start, delay);
@@ -1439,23 +1427,20 @@ void Sound::playCDTrack(int track, int num_loops, int start, int delay)
startCDTimer();
}
-void Sound::stopCD()
-{
+void Sound::stopCD() {
stopCDTimer();
if (stopMP3CD() == -1)
_scumm->_system->stop_cdrom();
}
-int Sound::pollCD()
-{
+int Sound::pollCD() {
if (pollMP3CD())
return 1;
return _scumm->_system->poll_cdrom();
}
-void Sound::updateCD()
-{
+void Sound::updateCD() {
if (updateMP3CD() == -1)
_scumm->_system->update_cdrom();
}
@@ -1650,7 +1635,7 @@ Sound::MP3TrackInfo::MP3TrackInfo(File *file) {
_error_flag = false;
return;
- error:
+error:
mad_frame_finish(&frame);
mad_stream_finish(&stream);
_error_flag = true;
diff --git a/scumm/sound.h b/scumm/sound.h
index db759c316c..6252c52540 100644
--- a/scumm/sound.h
+++ b/scumm/sound.h
@@ -42,16 +42,16 @@ enum {
bool _soundsPaused2;
bool _soundVolumePreset;
- char * _nameBundleMusic;
- char * _newNameBundleMusic;
+ char *_nameBundleMusic;
+ char *_newNameBundleMusic;
byte _musicDisk;
byte _voiceDisk;
int32 _currentSampleBundleMusic;
int32 _numberSamplesBundleMusic;
int32 _offsetSampleBundleMusic;
int32 _offsetBufBundleMusic;
- byte * _musicBundleBufFinal;
- byte * _musicBundleBufOutput;
+ byte *_musicBundleBufFinal;
+ byte *_musicBundleBufOutput;
bool _pauseBundleMusic;
int32 _bundleMusicTrack;
bool _musicBundleToBeChanged;
@@ -125,7 +125,7 @@ enum {
};
#endif
- Scumm * _scumm;
+ Scumm *_scumm;
public:
@@ -159,16 +159,16 @@ public:
void setupSound();
void pauseSounds(bool pause);
int startSfxSound(File *file, int file_size);
- File * openSfxFile();
+ File *openSfxFile();
void stopSfxSound();
bool isSfxFinished();
- uint32 decode12BitsSample(byte * src, byte ** dst, uint32 size, bool stereo);
- void playBundleMusic(char * song);
+ uint32 decode12BitsSample(byte *src, byte **dst, uint32 size, bool stereo);
+ void playBundleMusic(char *song);
void pauseBundleMusic(bool state);
- void bundleMusicHandler(Scumm * scumm);
+ void bundleMusicHandler(Scumm *scumm);
void stopBundleMusic();
int playBundleSound(char *sound);
- byte * readCreativeVocFile(byte * ptr, uint32 & size, uint32 & rate, uint32 & loops);
+ byte *readCreativeVocFile(byte *ptr, uint32 &size, uint32 &rate, uint32 &loops);
int playSfxSound(void *sound, uint32 size, uint rate, bool isUnsigned);
int playSfxSound_MP3(void *sound, uint32 size);
int playSfxSound_Vorbis(void *sound, uint32 size);
diff --git a/scumm/string.cpp b/scumm/string.cpp
index ebc546a47a..7d5626b8fc 100644
--- a/scumm/string.cpp
+++ b/scumm/string.cpp
@@ -28,8 +28,7 @@
#include "verbs.h"
#include "scumm/sound.h"
-void Scumm::unkMessage1()
-{
+void Scumm::unkMessage1() {
byte buffer[100];
_msgPtrToAdd = buffer;
_messagePtr = addMessageToStack(_messagePtr);
@@ -54,8 +53,7 @@ void Scumm::unkMessage1()
}
}
-void Scumm::unkMessage2()
-{
+void Scumm::unkMessage2() {
byte buf[100], *tmp;
_msgPtrToAdd = buf;
@@ -73,9 +71,7 @@ void Scumm::unkMessage2()
_messagePtr = tmp;
}
-
-void Scumm::CHARSET_1()
-{
+void Scumm::CHARSET_1() {
uint32 talk_sound_a = 0;
uint32 talk_sound_b = 0;
int s, i, t, c;
@@ -144,7 +140,6 @@ void Scumm::CHARSET_1()
else
_charset->setCurID(_string[0].charset);
-
_charset->_center = _string[0].center;
_charset->_right = _string[0].right;
_charset->_color = _charsetColor;
@@ -345,8 +340,7 @@ void Scumm::CHARSET_1()
gdi._mask_bottom = _charset->_strBottom;
}
-void Scumm::description()
-{
+void Scumm::description() {
int c;
byte *buf;
@@ -390,8 +384,7 @@ void Scumm::description()
gdi._mask_bottom = _charset->_strBottom;
}
-void Scumm::drawDescString(byte *msg)
-{
+void Scumm::drawDescString(byte *msg) {
byte c, *buf, buffer[256];
buf = _msgPtrToAdd = buffer;
@@ -435,8 +428,7 @@ void Scumm::drawDescString(byte *msg)
gdi._mask_bottom = _charset->_strBottom;
}
-void Scumm::drawString(int a)
-{
+void Scumm::drawString(int a) {
byte buf[256];
byte *space;
int i;
@@ -561,8 +553,7 @@ void Scumm::drawString(int a)
}
}
-byte *Scumm::addMessageToStack(byte *msg)
-{
+byte *Scumm::addMessageToStack(byte *msg) {
int num, numorg;
unsigned char *ptr, chr;
@@ -677,8 +668,7 @@ byte *Scumm::addMessageToStack(byte *msg)
return msg;
}
-void Scumm::addIntToStack(int var)
-{
+void Scumm::addIntToStack(int var) {
int num, max;
byte flag;
@@ -762,8 +752,7 @@ void Scumm::addNameToStack(int var)
}
}
-void Scumm::addStringToStack(int var)
-{
+void Scumm::addStringToStack(int var) {
byte *ptr;
if (_features & GF_AFTER_V6 || _gameId == GID_INDY3_256)
@@ -793,8 +782,7 @@ void Scumm::addStringToStack(int var)
addMessageToStack((byte *)"");
}
-void Scumm::initCharset(int charsetno)
-{
+void Scumm::initCharset(int charsetno) {
int i;
if (_features & GF_OLD256)
@@ -812,8 +800,7 @@ void Scumm::initCharset(int charsetno)
_charsetColorMap[i] = _charsetData[_charset->getCurID()][i];
}
-int indexCompare(const void *p1, const void *p2)
-{
+int indexCompare(const void *p1, const void *p2) {
struct langIndexNode *i1 = (struct langIndexNode *) p1;
struct langIndexNode *i2 = (struct langIndexNode *) p2;
@@ -838,7 +825,7 @@ void Scumm::loadLanguageBundle() {
}
size = file.size();
- _languageBuffer = (char*)malloc(size);
+ _languageBuffer = (char *)malloc(size);
file.read(_languageBuffer, size);
file.close();
@@ -916,7 +903,7 @@ void Scumm::translateText(byte *text, byte *trans_buff) {
target.tag[l] = toupper(text[l + 1]);
target.tag[l] = 0;
- found = (struct langIndexNode *) bsearch(&target, _languageIndex, _languageStrCount, sizeof(struct langIndexNode), indexCompare);
+ found = (struct langIndexNode *)bsearch(&target, _languageIndex, _languageStrCount, sizeof(struct langIndexNode), indexCompare);
if (found != NULL) {
File file;
@@ -967,7 +954,7 @@ void Scumm::translateText(byte *text, byte *trans_buff) {
// skip translation if flag 'h' exist
if (buf[pos] == 'h') {
pos += 3;
- byte *pointer = (byte *)strchr((char*)text + 1, '/');
+ byte *pointer = (byte *)strchr((char *)text + 1, '/');
if (pointer != NULL)
memcpy(trans_buff, pointer + 1, resStrLen(pointer + 1) + 1);
else
@@ -1028,7 +1015,7 @@ void Scumm::translateText(byte *text, byte *trans_buff) {
}
if (text[0] == '/') {
- byte *pointer = (byte *)strchr((char*)text + 1, '/');
+ byte *pointer = (byte *)strchr((char *)text + 1, '/');
if (pointer != NULL)
memcpy(trans_buff, pointer + 1, resStrLen(pointer + 1) + 1);
else
diff --git a/scumm/usage_bits.cpp b/scumm/usage_bits.cpp
index f9103bf652..2291158112 100644
--- a/scumm/usage_bits.cpp
+++ b/scumm/usage_bits.cpp
@@ -21,8 +21,7 @@
#include "scumm.h"
#include "usage_bits.h"
-void Scumm::upgradeGfxUsageBits()
-{
+void Scumm::upgradeGfxUsageBits() {
int i;
for (i = 409; i >= 0; i--) {
@@ -37,29 +36,25 @@ void Scumm::upgradeGfxUsageBits()
}
}
-void Scumm::setGfxUsageBit(int strip, int bit)
-{
+void Scumm::setGfxUsageBit(int strip, int bit) {
assert(1 <= bit && bit <= 96);
bit--;
gfxUsageBits[3 * strip + bit / 32] |= (1 << (bit % 32));
}
-void Scumm::clearGfxUsageBit(int strip, int bit)
-{
+void Scumm::clearGfxUsageBit(int strip, int bit) {
assert(1 <= bit && bit <= 96);
bit--;
gfxUsageBits[3 * strip + bit / 32] &= ~(1 << (bit % 32));
}
-bool Scumm::testGfxUsageBit(int strip, int bit)
-{
+bool Scumm::testGfxUsageBit(int strip, int bit) {
assert(1 <= bit && bit <= 96);
bit--;
return (gfxUsageBits[3 * strip + bit / 32] & (1 << (bit % 32))) != 0;
}
-bool Scumm::testGfxAnyUsageBits(int strip)
-{
+bool Scumm::testGfxAnyUsageBits(int strip) {
// Exclude the DIRTY and RESTORED bits from the test
uint32 bitmask[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0x3FFFFFFF };
int i;
@@ -71,8 +66,7 @@ bool Scumm::testGfxAnyUsageBits(int strip)
return false;
}
-bool Scumm::testGfxOtherUsageBits(int strip, int bit)
-{
+bool Scumm::testGfxOtherUsageBits(int strip, int bit) {
// Don't exclude the DIRTY and RESTORED bits from the test
uint32 bitmask[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };
int i;
diff --git a/scumm/vars.cpp b/scumm/vars.cpp
index 31c8950b56..ef8f0f4b8c 100644
--- a/scumm/vars.cpp
+++ b/scumm/vars.cpp
@@ -25,8 +25,7 @@
#include "scumm.h"
#include "intern.h"
-void Scumm::setupScummVars()
-{
+void Scumm::setupScummVars() {
VAR_KEYPRESS = 0;
VAR_EGO = 1;
VAR_CAMERA_POS_X = 2;
@@ -112,8 +111,7 @@ void Scumm::setupScummVars()
VAR_V6_SOUNDMODE = 9;
}
-void Scumm_v6::setupScummVars()
-{
+void Scumm_v6::setupScummVars() {
// Many vars are the same as in V5 games, so just call the inherited method first
Scumm::setupScummVars();
@@ -124,8 +122,7 @@ void Scumm_v6::setupScummVars()
VAR_TIMEDATE_MINUTE = 126;
}
-void Scumm_v7::setupScummVars()
-{
+void Scumm_v7::setupScummVars() {
VAR_MOUSE_X = 1;
VAR_MOUSE_Y = 2;
VAR_VIRT_MOUSE_X = 3;
@@ -215,8 +212,7 @@ void Scumm_v7::setupScummVars()
VAR_STRING2DRAW = 130;
}
-void Scumm_v8::setupScummVars()
-{
+void Scumm_v8::setupScummVars() {
// VAR_ROOM_HEIGHT = 1;
// VAR_ROOM_WIDTH = 2;
diff --git a/scumm/verbs.cpp b/scumm/verbs.cpp
index 23d5a17053..26be20b750 100644
--- a/scumm/verbs.cpp
+++ b/scumm/verbs.cpp
@@ -27,8 +27,7 @@
#include "scumm.h"
#include "verbs.h"
-void Scumm::redrawVerbs()
-{
+void Scumm::redrawVerbs() {
int i;
for (i = 0; i < _maxVerbs; i++)
drawVerb(i, 0);
@@ -36,8 +35,7 @@ void Scumm::redrawVerbs()
_verbRedraw = false;
}
-void Scumm::checkExecVerbs()
-{
+void Scumm::checkExecVerbs() {
int i, over;
VerbSlot *vs;
@@ -78,8 +76,7 @@ void Scumm::checkExecVerbs()
}
}
-void Scumm::verbMouseOver(int verb)
-{
+void Scumm::verbMouseOver(int verb) {
if (_verbMouseOver == verb)
return;
@@ -94,8 +91,7 @@ void Scumm::verbMouseOver(int verb)
}
}
-int Scumm::checkMouseOver(int x, int y)
-{
+int Scumm::checkMouseOver(int x, int y) {
VerbSlot *vs;
int i = _maxVerbs - 1;
@@ -116,8 +112,7 @@ int Scumm::checkMouseOver(int x, int y)
return 0;
}
-void Scumm::drawVerb(int verb, int mode)
-{
+void Scumm::drawVerb(int verb, int mode) {
VerbSlot *vs;
bool tmp;
@@ -192,8 +187,7 @@ void Scumm::drawVerb(int verb, int mode)
}
}
-void Scumm::restoreVerbBG(int verb)
-{
+void Scumm::restoreVerbBG(int verb) {
VerbSlot *vs;
vs = &_verbs[verb];
@@ -204,8 +198,7 @@ void Scumm::restoreVerbBG(int verb)
}
}
-void Scumm::drawVerbBitmap(int verb, int x, int y)
-{
+void Scumm::drawVerbBitmap(int verb, int x, int y) {
VirtScreen *vs;
VerbSlot *vst;
byte twobufs, *imptr;
@@ -280,8 +273,7 @@ void Scumm::drawVerbBitmap(int verb, int x, int y)
vs->alloctwobuffers = twobufs;
}
-int Scumm::getVerbSlot(int id, int mode)
-{
+int Scumm::getVerbSlot(int id, int mode) {
int i;
for (i = 1; i < _maxVerbs; i++) {
if (_verbs[i].verbid == id && _verbs[i].saveid == mode) {
@@ -291,8 +283,7 @@ int Scumm::getVerbSlot(int id, int mode)
return 0;
}
-void Scumm::killVerb(int slot)
-{
+void Scumm::killVerb(int slot) {
VerbSlot *vs;
if (slot == 0)
@@ -311,8 +302,7 @@ void Scumm::killVerb(int slot)
vs->saveid = 0;
}
-void Scumm::setVerbObject(uint room, uint object, uint verb)
-{
+void Scumm::setVerbObject(uint room, uint object, uint verb) {
byte *obimptr;
byte *obcdptr;
uint32 size, size2;