diff options
author | Max Horn | 2002-07-07 19:31:51 +0000 |
---|---|---|
committer | Max Horn | 2002-07-07 19:31:51 +0000 |
commit | cb86e115836006b017e27ca9b2b4158cbe815269 (patch) | |
tree | 9714b9ad78f3607971da99fbc756f80ec50cb760 | |
parent | 7ed45a6ef9f7c243274cf26de64195966413f2e4 (diff) | |
download | scummvm-rg350-cb86e115836006b017e27ca9b2b4158cbe815269.tar.gz scummvm-rg350-cb86e115836006b017e27ca9b2b4158cbe815269.tar.bz2 scummvm-rg350-cb86e115836006b017e27ca9b2b4158cbe815269.zip |
indent run
svn-id: r4478
-rw-r--r-- | actor.cpp | 87 | ||||
-rw-r--r-- | actor.h | 54 | ||||
-rw-r--r-- | akos.cpp | 63 | ||||
-rw-r--r-- | akos.h | 120 | ||||
-rw-r--r-- | config-file.cpp | 61 | ||||
-rw-r--r-- | config-file.h | 38 |
6 files changed, 202 insertions, 221 deletions
@@ -180,7 +180,7 @@ int Actor::remapDirection(int dir) byte flags; bool flipX; bool flipY; - + if (!ignoreBoxes) { specdir = _vm->_extraBoxFlags[walkbox]; if (specdir) { @@ -201,7 +201,6 @@ int Actor::remapDirection(int dir) dir = 360 - dir; flipX = !flipX; } - // Check for Y-Flip if ((flags & 0x10) || _vm->getClass(number, 0x1D)) { dir = 180 - dir; @@ -210,14 +209,14 @@ int Actor::remapDirection(int dir) switch (flags & 7) { case 1: - if (moving&~MF_TURN) // Actor is walking + if (moving & ~MF_TURN) // Actor is walking return flipX ? 90 : 270; - else // Actor is standing/turning + else // Actor is standing/turning return (dir == 90) ? 90 : 270; case 2: - if (moving&~MF_TURN) // Actor is walking + if (moving & ~MF_TURN) // Actor is walking return flipY ? 180 : 0; - else // Actor is standing/turning + else // Actor is standing/turning return (dir == 0) ? 0 : 180; case 3: return 270; @@ -241,21 +240,21 @@ int Actor::updateActorDirection() int dir; int num; bool shouldInterpolate; - + dirType = _vm->akos_hasManyDirections(this); from = Scumm::toSimpleDir(dirType, facing); dir = remapDirection(newDirection); shouldInterpolate = (dir & 1024); to = Scumm::toSimpleDir(dirType, dir & 1023); - diff = to - from; + diff = to - from; num = Scumm::numSimpleDirDirections(dirType); if (shouldInterpolate) { // Turn left or right, depending on which is shorter. if (abs(diff) > (num >> 1)) diff = -diff; - + if (diff == 0) { } else if (diff > 0) { from++; @@ -264,7 +263,7 @@ int Actor::updateActorDirection() } } else from = to; - + dir = Scumm::fromSimpleDir(dirType, from & (num - 1)); return dir; @@ -300,27 +299,23 @@ int Actor::actorWalkStep() actorX = x; actorY = y; - if (walkbox != walkdata.curbox && - _vm->checkXYInBoxBounds(walkdata.curbox, actorX, actorY)) { + if (walkbox != walkdata.curbox && _vm->checkXYInBoxBounds(walkdata.curbox, actorX, actorY)) { setActorBox(walkdata.curbox); } distX = abs(walkdata.newx - walkdata.x); distY = abs(walkdata.newy - walkdata.y); - if (abs(actorX - walkdata.x) >= distX && - abs(actorY - walkdata.y) >= distY) { + if (abs(actorX - walkdata.x) >= distX && abs(actorY - walkdata.y) >= distY) { moving &= ~MF_IN_LEG; return 0; } - tmpX = ((actorX + 8000) << 16) + walkdata.xfrac + - (walkdata.XYFactor >> 8) * scalex; + tmpX = ((actorX + 8000) << 16) + walkdata.xfrac + (walkdata.XYFactor >> 8) * scalex; walkdata.xfrac = (uint16)tmpX; actorX = (tmpX >> 16) - 8000; - tmpY = (actorY << 16) + walkdata.yfrac + - (walkdata.YXFactor >> 8) * scalex; + tmpY = (actorY << 16) + walkdata.yfrac + (walkdata.YXFactor >> 8) * scalex; walkdata.yfrac = (uint16)tmpY; actorY = (tmpY >> 16); @@ -344,8 +339,8 @@ void Actor::setupActorScale() byte *resptr; // FIXME: Special 'no scaling' class for MI1 VGA Floppy - // Not totally sure if this is correct. - if(_vm->_gameId == GID_MONKEY_VGA && _vm->getClass(number, 0x96)) + // Not totally sure if this is correct. + if (_vm->_gameId == GID_MONKEY_VGA && _vm->getClass(number, 0x96)) return; if (_vm->_features & GF_NO_SCALLING) { @@ -357,7 +352,7 @@ void Actor::setupActorScale() if (ignoreBoxes != 0) return; - if(_vm->getBoxFlags(walkbox) & 0x20) + if (_vm->getBoxFlags(walkbox) & 0x20) return; scale = _vm->getBoxScale(walkbox); @@ -379,7 +374,7 @@ void Actor::setupActorScale() warning("Actor %d at %d, scale %d out of range", number, y, scale); // FIXME - Quick fix to ft's fuel tower bug (by yazoo) - if(scale == 1 && _vm->_currentRoom == 76) + if (scale == 1 && _vm->_currentRoom == 76) scale = 0xFF; scalex = (byte)scale; @@ -388,7 +383,7 @@ void Actor::setupActorScale() void Actor::startAnimActor(int frame) { - if (_vm->_features & GF_NEW_COSTUMES) { + if (_vm->_features & GF_NEW_COSTUMES) { switch (frame) { case 1001: frame = initFrame; @@ -522,8 +517,7 @@ void Actor::setActorDirection(int direction) void Scumm::putActor(Actor * a, int dstX, int dstY, byte room) { - if (a->visible && _currentRoom != room - && _vars[VAR_TALK_ACTOR] == a->number) { + if (a->visible && _currentRoom != room && _vars[VAR_TALK_ACTOR] == a->number) { clearMsgQueue(); } @@ -667,7 +661,7 @@ void Actor::adjustActorPos() if (_vm->_features & GF_AFTER_V7) { stopActorMoving(); } - + flags = _vm->getBoxFlags(walkbox); if (flags & 7) { turnToDirection(facing); @@ -806,7 +800,7 @@ void Actor::startWalkAnim(int cmd, int angle) * find a proper fix * note: walk scripts aren't required to make the game * work as usual */ - + /* int16 args[16]; if (walk_script != 0) { @@ -814,7 +808,7 @@ void Actor::startWalkAnim(int cmd, int angle) args[0] = number; args[1] = cmd; _vm->runScript(walk_script, 1, 0, args); - } else*/ { + } else*/ { switch (cmd) { case 1: /* start walk */ setActorDirection(angle); @@ -880,8 +874,7 @@ void Actor::walkActor() } j = getPathToDestBox(walkbox, walkdata.destbox); if (j == -1) { - error("walkActor: no path found between %d and %d", walkbox, - walkdata.destbox); + error("walkActor: no path found between %d and %d", walkbox, walkdata.destbox); } walkdata.curbox = j; @@ -959,17 +952,16 @@ void Scumm::processActors() } if (!numactors) return; - + end = actors + numactors; // Sort actors by position before we draw them (to ensure that actors in // front are drawn after those "behind" them). - for (ac = end-1; ac >= actors; --ac) { - for (ac2 = actors; ac2 != ac; ++ac2) - { - if (DRAW_ORDER(*ac2) > DRAW_ORDER(*(ac2+1))) { - tmp = *(ac2+1); - *(ac2+1) = *ac2; + for (ac = end - 1; ac >= actors; --ac) { + for (ac2 = actors; ac2 != ac; ++ac2) { + if (DRAW_ORDER(*ac2) > DRAW_ORDER(*(ac2 + 1))) { + tmp = *(ac2 + 1); + *(ac2 + 1) = *ac2; *ac2 = tmp; } } @@ -993,14 +985,14 @@ void Actor::drawActorCostume() if (!needRedraw) return; - + if (_vm->getClass(number, 20)) mask = 0; else if (_vm->getClass(number, 21)) forceClip = 1; // FIXME: ugly fix for samnmax inventory - if (_vm->_gameId==GID_SAMNMAX && _vm->getState(995)) + if (_vm->_gameId == GID_SAMNMAX && _vm->getState(995)) return; needRedraw = false; @@ -1148,8 +1140,7 @@ int Scumm::getActorFromPos(int x, int y) return 0; for (i = 1; i < NUM_ACTORS; i++) { Actor *a = derefActor(i); - if (drawbits & (1 << i) && !getClass(i, 32) && y >= a->top - && y <= a->bottom) { + if (drawbits & (1 << i) && !getClass(i, 32) && y >= a->top && y <= a->bottom) { return i; } } @@ -1163,8 +1154,7 @@ void Scumm::actorTalk() _msgPtrToAdd = charset._buffer; _messagePtr = addMessageToStack(_messagePtr); - assert((int)(_msgPtrToAdd - charset._buffer) < - (int)(sizeof(charset._buffer))); + assert((int)(_msgPtrToAdd - charset._buffer) < (int)(sizeof(charset._buffer))); if (_actorToPrintStrFor == 0xFF) { if (!_keepText) @@ -1245,8 +1235,7 @@ void Actor::startWalkActor(int destX, int destY, int dir) } else { abr = adjustXYToBeInBox(abr.x, abr.y, walkbox); } - if (moving && walkdata.destdir == dir - && walkdata.destx == abr.x && walkdata.desty == abr.y) + if (moving && walkdata.destdir == dir && walkdata.destx == abr.x && walkdata.desty == abr.y) return; } @@ -1273,8 +1262,7 @@ byte *Actor::getActorName() return ptr; } -void Actor::remapActor(int r_fact, int g_fact, int b_fact, - int threshold) +void Actor::remapActor(int r_fact, int g_fact, int b_fact, int threshold) { byte *akos, *rgbs, *akpl; int akpl_size, i; @@ -1303,8 +1291,7 @@ void Actor::remapActor(int r_fact, int g_fact, int b_fact, rgbs = findResource(MKID('RGBS'), akos); if (!rgbs) { - warning("Can't remap actor %d costume %d doesn't contain an RGB block", - number, costume); + warning("Can't remap actor %d costume %d doesn't contain an RGB block", number, costume); return; } // skip resource header @@ -1440,7 +1427,7 @@ void Scumm::resetActorBgs() if (onlyActorFlags & 1 && a->top != 0xFF && a->needBgReset) { gfxUsageBits[_screenStartStrip + i] ^= bitpos; - if((a->bottom - a->top) >=0) + if ((a->bottom - a->top) >= 0) gdi.resetBackground(a->top, a->bottom, i); } bitpos <<= 1; @@ -37,14 +37,14 @@ enum MoveFlags { }; struct ActorWalkData { - int16 destx,desty; // Final destination + int16 destx, desty; // Final destination byte destbox; int16 destdir; byte curbox; - int16 x,y; // Current position - int16 newx,newy; // Next position on our way to the destination + int16 x, y; // Current position + int16 newx, newy; // Next position on our way to the destination int32 XYFactor, YXFactor; - uint16 xfrac,yfrac; + uint16 xfrac, yfrac; int point3x, point3y; }; @@ -57,16 +57,13 @@ struct CostumeData { uint16 start[16]; uint16 end[16]; uint16 frame[16]; - - void reset() - { + + void reset() { stopped = 0; for (int i = 0; i < 16; i++) { active[i] = 0; curpos[i] = start[i] = end[i] = frame[i] = 0xFFFF; - } -} -}; +}}}; class Actor { @@ -79,7 +76,7 @@ public: uint16 costume; byte room; byte talkColor; - byte scalex,scaley; + byte scalex, scaley; byte charset; int16 newDirection; byte moving; @@ -89,12 +86,12 @@ public: bool needRedraw, needBgReset, costumeNeedsInit, visible; byte shadow_mode; bool flip; - uint speedx,speedy; + uint speedx, speedy; byte frame; byte walkbox; byte mask; byte animProgress, animSpeed; - int16 new_1,new_2; + int16 new_1, new_2; uint16 talk_script, walk_script; byte new_3; int8 layer; @@ -105,13 +102,16 @@ public: byte palette[64]; protected: - Scumm *_vm; + Scumm *_vm; public: // Constructor, sets all data to 0 - Actor() { memset(this, 0, sizeof(Actor)); } - void initActorClass(Scumm *scumm) {_vm = scumm;} + Actor() { + memset(this, 0, sizeof(Actor)); + } void initActorClass(Scumm *scumm) { + _vm = scumm; + } //protected: void hideActor(); void showActor(); @@ -131,7 +131,7 @@ public: void setActorDirection(int direction); AdjustBoxResult adjustXYToBeInBox(int dstX, int dstY, int pathfrom); - void adjustActorPos(); + void adjustActorPos(); void turnToDirection(int newdir); void walkActor(); void drawActorCostume(); @@ -139,17 +139,25 @@ public: void setActorCostume(int c); byte *getActorName(); void startWalkActor(int x, int y, int dir); - + void remapActor(int b, int c, int d, int e); void walkActorOld(); void animateActor(int anim); - - bool isInCurrentRoom() { return room == _vm->_currentRoom; } - int getRoom() { return room; } - int getAnimVar(byte var) { return animVariable[var]; } - void setAnimVar(byte var, int value) { animVariable[var] = value; } + bool isInCurrentRoom() { + return room == _vm->_currentRoom; + } + int getRoom() { + return room; + } + + int getAnimVar(byte var) { + return animVariable[var]; + } + void setAnimVar(byte var, int value) { + animVariable[var] = value; + } }; @@ -200,12 +200,12 @@ bool AkosRenderer::drawCostumeChannel(int chan) srcptr = akcd + READ_LE_UINT32(&off->akcd); the_akci = (AkosCI *) (akci + READ_LE_UINT16(&off->akci)); - move_x_cur = move_x + (int16) READ_LE_UINT16(&the_akci->rel_x); - move_y_cur = move_y + (int16) READ_LE_UINT16(&the_akci->rel_y); + move_x_cur = move_x + (int16)READ_LE_UINT16(&the_akci->rel_x); + move_y_cur = move_y + (int16)READ_LE_UINT16(&the_akci->rel_y); width = READ_LE_UINT16(&the_akci->width); height = READ_LE_UINT16(&the_akci->height); - move_x += (int16) READ_LE_UINT16(&the_akci->move_x); - move_y -= (int16) READ_LE_UINT16(&the_akci->move_y); + move_x += (int16)READ_LE_UINT16(&the_akci->move_x); + move_y -= (int16)READ_LE_UINT16(&the_akci->move_y); switch (codec) { case 1: @@ -233,8 +233,8 @@ bool AkosRenderer::drawCostumeChannel(int chan) srcptr = akcd + READ_LE_UINT32(&off->akcd); the_akci = (AkosCI *) (akci + READ_LE_UINT16(&off->akci)); - move_x_cur = move_x + (int16) READ_LE_UINT16(p + 0); - move_y_cur = move_y + (int16) READ_LE_UINT16(p + 2); + move_x_cur = move_x + (int16)READ_LE_UINT16(p + 0); + move_y_cur = move_y + (int16)READ_LE_UINT16(p + 2); p += (p[4] & 0x80) ? 6 : 5; @@ -338,8 +338,7 @@ void akos_generic_decode(AkosRenderer * ar) do { if (*scaleytab++ < ar->scale_y) { if (color && y < ar->outheight - && (!ar->v1.mask_ptr - || !((mask[0] | mask[ar->v1.imgbufoffs]) & maskbit))) { + && (!ar->v1.mask_ptr || !((mask[0] | mask[ar->v1.imgbufoffs]) & maskbit))) { *dst = ar->palette[color]; } mask += 40; @@ -404,11 +403,10 @@ void akos_c1_spec1(AkosRenderer * ar) do { if (*scaleytab++ < ar->scale_y) { if (color && y < ar->outheight - && (!ar->v1.mask_ptr - || !((mask[0] | mask[ar->v1.imgbufoffs]) & maskbit))) { + && (!ar->v1.mask_ptr || !((mask[0] | mask[ar->v1.imgbufoffs]) & maskbit))) { pcolor = ar->palette[color]; if (pcolor == 13) - pcolor = ar->shadow_table[*dst]; + pcolor = ar->shadow_table[*dst]; *dst = pcolor; } mask += 40; @@ -557,7 +555,7 @@ void AkosRenderer::codec1() - if(_vm->isGlobInMemory(rtString,_vm->_vars[_vm->VAR_CUSTOMSCALETABLE])) { + if (_vm->isGlobInMemory(rtString, _vm->_vars[_vm->VAR_CUSTOMSCALETABLE])) { v1.scaletable = _vm->getStringAddressVar(_vm->VAR_CUSTOMSCALETABLE); } else { v1.scaletable = default_scale_table; @@ -746,23 +744,21 @@ void AkosRenderer::codec1() draw_bottom = y_bottom; if (cur_x == -1) - cur_x = 0; /* ?? */ + cur_x = 0; /* ?? */ v1.destptr = outptr + cur_x + cur_y * outwidth; masking = false; if (clipping) { masking = _vm->isMaskActiveAt(x_left, y_top, x_right, y_bottom, - _vm->getResourceAddress(rtBuffer, 9) + - _vm->gdi._imgBufOffs[clipping] + - _vm->_screenStartStrip) != 0; + _vm->getResourceAddress(rtBuffer, 9) + + _vm->gdi._imgBufOffs[clipping] + _vm->_screenStartStrip) != 0; } v1.mask_ptr = NULL; if (masking || charsetmask || shadow_mode) { - v1.mask_ptr = - _vm->getResourceAddress(rtBuffer, 9) + cur_y * 40 + _vm->_screenStartStrip; + v1.mask_ptr = _vm->getResourceAddress(rtBuffer, 9) + cur_y * 40 + _vm->_screenStartStrip; v1.imgbufoffs = _vm->gdi._imgBufOffs[clipping]; if (!charsetmask && masking) { v1.mask_ptr += v1.imgbufoffs; @@ -879,33 +875,33 @@ void AkosRenderer::codec5() vs = &_vm->virtscr[0]; //setBlastObjectMode(shadow_mode); // not implemented yet - moveX=move_x_cur; - moveY=move_y_cur; + moveX = move_x_cur; + moveY = move_y_cur; if (!mirror) { left = (x - moveX - width) + 1; } else { - left = x + moveX -1; + left = x + moveX - 1; } - var_20=0; + var_20 = 0; max_width = outwidth; right = left + width - 1; top = y + moveY; bottom = top + height; - if(left < 0) + if (left < 0) left = 0; - if(left > max_width) + if (left > max_width) left -= left - max_width; // Yazoo: this is not correct, but fix a lots of bugs for the momment - + draw_top = 0; draw_bottom = vs->height; - _vm->updateDirtyRect(0, left, right+1, top, bottom+1, 1 << dirty_id); + _vm->updateDirtyRect(0, left, right + 1, top, bottom + 1, 1 << dirty_id); bdd.dataptr = srcptr; bdd.out = vs->screenPtr; @@ -915,10 +911,10 @@ void AkosRenderer::codec5() bdd.scale_y = 0xFF; bdd.srcheight = height; bdd.srcwidth = width; - bdd.x = left+1; + bdd.x = left + 1; bdd.y = top; - _vm->drawBomp(&bdd,0,bdd.dataptr,0,0); + _vm->drawBomp(&bdd, 0, bdd.dataptr, 0, 0); } void AkosRenderer::codec16() @@ -952,8 +948,7 @@ bool Scumm::akos_increaseAnims(byte *akos, Actor * a) #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; @@ -1057,7 +1052,7 @@ bool Scumm::akos_increaseAnim(Actor * a, int chan, byte *aksq, uint16 *akfo, switch (code) { case AKC_StartAnimInActor: akos_queCommand(4, derefActorSafe(a->getAnimVar(GB(2)), - "akos_increaseAnim:29"), a->getAnimVar(GB(3)), 0); + "akos_increaseAnim:29"), a->getAnimVar(GB(3)), 0); continue; case AKC_Random: @@ -1099,8 +1094,7 @@ bool Scumm::akos_increaseAnim(Actor * a, int chan, byte *aksq, uint16 *akfo, akos_queCommand(4, a, a->getAnimVar(GB(2)), 0); continue; case AKC_SetVarInActor: - derefActorSafe(a->getAnimVar(GB(2)), "akos_increaseAnim:9")->setAnimVar( - GB(3), GW(4) + derefActorSafe(a->getAnimVar(GB(2)), "akos_increaseAnim:9")->setAnimVar(GB(3), GW(4) ); continue; case AKC_HideActor: @@ -1174,8 +1168,7 @@ bool Scumm::akos_increaseAnim(Actor * a, int chan, byte *aksq, uint16 *akfo, int code2 = aksq[curpos]; if (code2 & 0x80) code2 = (code2 << 8) | aksq[curpos + 1]; - assert((code2 & 0xC000) != 0xC000 || code2 == AKC_ComplexChan - || code2 == AKC_Return); + assert((code2 & 0xC000) != 0xC000 || code2 == AKC_ComplexChan || code2 == AKC_Return); a->cost.curpos[chan] = curpos; @@ -23,8 +23,8 @@ #if !defined(__GNUC__) - #pragma START_PACK_STRUCTS -#endif +#pragma START_PACK_STRUCTS +#endif struct CostumeData; @@ -43,52 +43,52 @@ struct AkosOffset { } GCC_PACK; struct AkosCI { - uint16 width,height; + uint16 width, height; int16 rel_x, rel_y; int16 move_x, move_y; } GCC_PACK; #if !defined(__GNUC__) - #pragma END_PACK_STRUCTS -#endif +#pragma END_PACK_STRUCTS +#endif struct AkosRenderer { //protected: CostumeData *cd; - int x,y; /* where to draw costume */ - byte scale_x, scale_y; /* scaling */ - byte clipping; /* clip mask */ + int x, y; /* where to draw costume */ + byte scale_x, scale_y; /* scaling */ + byte clipping; /* clip mask */ bool charsetmask; byte shadow_mode; uint16 codec; - bool mirror; /* draw actor mirrored */ + bool mirror; /* draw actor mirrored */ byte dirty_id; byte *outptr; uint outwidth, outheight; - + /* pointer to various parts of the costume resource */ byte *akos; AkosHeader *akhd; - + /* current move offset */ int move_x, move_y; /* movement of cel to decode */ int move_x_cur, move_y_cur; /* width and height of cel to decode */ - int width,height; - + int width, height; + byte *srcptr; byte *shadow_table; struct { /* codec stuff */ const byte *scaletable; - byte mask,shl; + byte mask, shl; bool doContinue; byte repcolor; byte replen; int scaleXstep; - int x,y; + int x, y; int tmp_x, tmp_y; int y_pitch; int skip_width; @@ -99,24 +99,25 @@ struct AkosRenderer { /* put less used stuff at the bottom to optimize opcodes */ int draw_top, draw_bottom; - byte *akpl,*akci,*aksq; + byte *akpl, *akci, *aksq; AkosOffset *akof; byte *akcd; byte palette[256]; protected: - Scumm *_vm; + Scumm *_vm; public: // Constructor, sets all data to 0 - AkosRenderer(Scumm *scumm) { memset(this, 0, sizeof(AkosRenderer)); _vm = scumm; } - - bool drawCostume(); + AkosRenderer(Scumm *scumm) { + memset(this, 0, sizeof(AkosRenderer)); + _vm = scumm; + } bool drawCostume(); void setPalette(byte *palette); void setCostume(int costume); - void setFacing(Actor *a); + void setFacing(Actor * a); bool drawCostumeChannel(int chan); void codec1(); void codec5(); @@ -126,45 +127,44 @@ public: void c1_spec3(); }; -enum AkosOpcodes{ - AKC_Return = 0xC001, - AKC_SetVar = 0xC010, - AKC_CmdQue3 = 0xC015, - AKC_ComplexChan = 0xC020, - AKC_Jump = 0xC030, - AKC_JumpIfSet = 0xC031, - AKC_AddVar = 0xC040, - AKC_Ignore = 0xC050, - AKC_IncVar = 0xC060, - AKC_CmdQue3Quick = 0xC061, +enum AkosOpcodes { + AKC_Return = 0xC001, + AKC_SetVar = 0xC010, + AKC_CmdQue3 = 0xC015, + AKC_ComplexChan = 0xC020, + AKC_Jump = 0xC030, + AKC_JumpIfSet = 0xC031, + AKC_AddVar = 0xC040, + AKC_Ignore = 0xC050, + AKC_IncVar = 0xC060, + AKC_CmdQue3Quick = 0xC061, AKC_SkipStart = 0xC070, - AKC_SkipE = 0xC070, - AKC_SkipNE = 0xC071, - AKC_SkipL = 0xC072, - AKC_SkipLE = 0xC073, - AKC_SkipG = 0xC074, - AKC_SkipGE = 0xC075, - AKC_StartAnim = 0xC080, - AKC_StartVarAnim = 0xC081, - AKC_Random = 0xC082, - AKC_SetActorClip = 0xC083, - AKC_StartAnimInActor = 0xC084, - AKC_SetVarInActor = 0xC085, - AKC_HideActor = 0xC086, - AKC_SetDrawOffs = 0xC087, - AKC_JumpTable = 0xC088, - AKC_SoundStuff = 0xC089, - AKC_Flip = 0xC08A, - AKC_Cmd3 = 0xC08B, - AKC_Ignore3 = 0xC08C, - AKC_Ignore2 = 0xC08D, + AKC_SkipE = 0xC070, + AKC_SkipNE = 0xC071, + AKC_SkipL = 0xC072, + AKC_SkipLE = 0xC073, + AKC_SkipG = 0xC074, + AKC_SkipGE = 0xC075, + AKC_StartAnim = 0xC080, + AKC_StartVarAnim = 0xC081, + AKC_Random = 0xC082, + AKC_SetActorClip = 0xC083, + AKC_StartAnimInActor = 0xC084, + AKC_SetVarInActor = 0xC085, + AKC_HideActor = 0xC086, + AKC_SetDrawOffs = 0xC087, + AKC_JumpTable = 0xC088, + AKC_SoundStuff = 0xC089, + AKC_Flip = 0xC08A, + AKC_Cmd3 = 0xC08B, + AKC_Ignore3 = 0xC08C, + AKC_Ignore2 = 0xC08D, AKC_JumpStart = 0xC090, - AKC_JumpE = 0xC090, - AKC_JumpNE = 0xC091, - AKC_JumpL = 0xC092, - AKC_JumpLE = 0xC093, - AKC_JumpG = 0xC094, - AKC_JumpGE = 0xC095, - AKC_ClearFlag = 0xC09F + AKC_JumpE = 0xC090, + AKC_JumpNE = 0xC091, + AKC_JumpL = 0xC092, + AKC_JumpLE = 0xC093, + AKC_JumpG = 0xC094, + AKC_JumpGE = 0xC095, + AKC_ClearFlag = 0xC09F }; - diff --git a/config-file.cpp b/config-file.cpp index d7e77bcb8b..9b562ad514 100644 --- a/config-file.cpp +++ b/config-file.cpp @@ -33,8 +33,7 @@ static char *ltrim(char *t) { - for (; *t && (*t == ' '); t++) - ; + for (; *t && (*t == ' '); t++); return t; } @@ -54,8 +53,8 @@ static char *rtrim(char *t) class hashconfig { public: - hashconfig(const char *); - ~hashconfig(); + hashconfig (const char *); + ~hashconfig (); bool is_domain(const char *) const; const char *get(const char *) const; const char *set(const char *, const char *); @@ -69,13 +68,12 @@ private: int nkeys; }; -hashconfig::hashconfig(const char *dom):domain(dom ? Scumm::Strdup(dom) : 0), +hashconfig::hashconfig (const char *dom):domain(dom ? Scumm::Strdup(dom) : 0), keys(0), values(0), nkeys(0) { } -hashconfig::~hashconfig() -{ +hashconfig::~hashconfig () { xfree(domain); } @@ -120,7 +118,7 @@ const char *hashconfig::getdomain() const return domain; } -void hashconfig::flush(FILE * cfg_file) const +void hashconfig::flush(FILE *cfg_file) const { int i; @@ -143,7 +141,7 @@ void hashconfig::rename(const char *d) domain = d ? Scumm::Strdup(d) : 0; } -void hashconfig::merge(const hashconfig * h) +void hashconfig::merge(const hashconfig *h) { int i; @@ -154,8 +152,9 @@ void hashconfig::merge(const hashconfig * h) // The config-class itself. -Config::Config(const char *cfg, const char *d) - : filename(Scumm::Strdup(cfg)), domain(d ? Scumm::Strdup(d) : 0), hash(0), ndomains(0), willwrite(false) +Config::Config (const char *cfg, const char *d) +: filename(Scumm::Strdup(cfg)), domain(d ? Scumm::Strdup(d) : 0), hash(0), ndomains(0), +willwrite(false) { FILE *cfg_file; char t[MAXLINELEN]; @@ -171,8 +170,7 @@ Config::Config(const char *cfg, const char *d) // It's a new domain which begins here. char *p = strchr(t, ']'); if (!p) { - debug(1, - "Config file buggy: no ] at the end of the domain name.\n"); + debug(1, "Config file buggy: no ] at the end of the domain name.\n"); } else { *p = 0; set_domain(t + 1); @@ -180,8 +178,7 @@ Config::Config(const char *cfg, const char *d) } else { // It's a new key in the domain. if (!domain) { - debug(1, - "Config file buggy: we have a key without a domain first.\n"); + debug(1, "Config file buggy: we have a key without a domain first.\n"); } char *p = strchr(t, '\n'); if (p) @@ -208,8 +205,7 @@ Config::Config(const char *cfg, const char *d) } } -Config::~Config() -{ +Config::~Config () { int i; xfree(filename); @@ -251,9 +247,8 @@ const char *Config::set(const char *key, const char *value, const char *d) } ndomains++; - hash = - (hashconfig **) realloc(hash, ndomains * sizeof(hashconfig *)); - hash[ndomains - 1] = new hashconfig(d); + hash = (hashconfig **)realloc(hash, ndomains * sizeof(hashconfig *)); + hash[ndomains - 1] = new hashconfig (d); return hash[ndomains - 1]->set(key, value); } @@ -275,9 +270,8 @@ const char *Config::set(const char *key, int value_i, const char *d) } ndomains++; - hash = - (hashconfig **) realloc(hash, ndomains * sizeof(hashconfig *)); - hash[ndomains - 1] = new hashconfig(d); + hash = (hashconfig **)realloc(hash, ndomains * sizeof(hashconfig *)); + hash[ndomains - 1] = new hashconfig (d); return hash[ndomains - 1]->set(key, value); } @@ -293,18 +287,17 @@ void Config::set_domain(const char *d) return; } ndomains++; - hash = - (hashconfig **) realloc(hash, ndomains * sizeof(hashconfig *)); - hash[ndomains - 1] = new hashconfig(domain); + hash = (hashconfig **)realloc(hash, ndomains * sizeof(hashconfig *)); + hash[ndomains - 1] = new hashconfig (domain); } void Config::flush() const { FILE *cfg_file; int i; - + if (!willwrite) - return; + return; if (!(cfg_file = fopen(filename, "w"))) { debug(1, "Unable to write configuration file: %s.\n", filename); @@ -357,7 +350,7 @@ void Config::change_filename(const char *f) filename = f ? Scumm::Strdup(f) : 0; } -void Config::merge_config(const Config * c) +void Config::merge_config(const Config *c) { int i, j; bool found; @@ -373,14 +366,14 @@ void Config::merge_config(const Config * c) } if (!found) { ndomains++; - hash = - (hashconfig **) realloc(hash, ndomains * sizeof(hashconfig *)); - hash[ndomains - 1] = new hashconfig(domain); + hash = (hashconfig **)realloc(hash, ndomains * sizeof(hashconfig *)); + hash[ndomains - 1] = new hashconfig (domain); hash[ndomains - 1]->merge(c->hash[i]); } } } -void Config::set_writing(bool w) { - willwrite = w; +void Config::set_writing(bool w) +{ + willwrite = w; } diff --git a/config-file.h b/config-file.h index 3932a40f4e..d1df1347ac 100644 --- a/config-file.h +++ b/config-file.h @@ -26,27 +26,27 @@ class hashconfig; class Config { - public: - Config(const char * = "config.cfg", const char * = "default"); - ~Config(); - const char * get(const char *, const char * = 0) const; - const char * set(const char *, const char *, const char * = 0); - const char * set(const char *, int, const char * = 0); - void set_domain(const char *); - void flush() const; - void rename_domain(const char *); - void delete_domain(const char *); - void change_filename(const char *); - void merge_config(const Config *); - void set_writing(bool); - private: - char * filename, * domain; - hashconfig ** hash; - int ndomains; - bool willwrite; +public: + Config (const char * = "config.cfg", const char * = "default"); + ~Config (); + const char *get(const char *, const char * = 0) const; + const char *set(const char *, const char *, const char * = 0); + const char *set(const char *, int, const char * = 0); + void set_domain(const char *); + void flush() const; + void rename_domain(const char *); + void delete_domain(const char *); + void change_filename(const char *); + void merge_config(const Config *); + void set_writing(bool); +private: + char *filename, *domain; + hashconfig **hash; + int ndomains; + bool willwrite; }; // The global config object -extern Config * scummcfg; +extern Config *scummcfg; #endif |