[Scummvm-cvs-logs] CVS: scummvm/queen logic.cpp,1.144,1.145
Gregory Montoir
cyx at users.sourceforge.net
Mon Dec 29 12:52:02 CET 2003
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/queen command.cpp,1.47,1.48 debug.cpp,1.5,1.6 display.cpp,1.38,1.39 graphics.cpp,1.60,1.61 journal.cpp,1.11,1.12 queen.cpp,1.60,1.61 walk.cpp,1.32,1.33 walk.h,1.17,1.18 xref.txt,1.50,1.51
- Next message: [Scummvm-cvs-logs] CVS: scummvm/queen command.cpp,1.48,1.49 cutaway.cpp,1.92,1.93 display.cpp,1.39,1.40 display.h,1.29,1.30 input.cpp,1.17,1.18 logic.cpp,1.145,1.146 talk.cpp,1.63,1.64
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/queen
In directory sc8-pr-cvs1:/tmp/cvs-serv8064/queen
Modified Files:
logic.cpp
Log Message:
cleanup & use BobSlot::curPos() when possible
Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/logic.cpp,v
retrieving revision 1.144
retrieving revision 1.145
diff -u -d -r1.144 -r1.145
--- logic.cpp 29 Dec 2003 20:17:43 -0000 1.144
+++ logic.cpp 29 Dec 2003 20:51:28 -0000 1.145
@@ -95,8 +95,7 @@
// the following table isn't available in demo version
if (_vm->resource()->isDemo()) {
_sfxName = NULL;
- }
- else {
+ } else {
_sfxName = new uint16[_numRooms + 1];
_sfxName[0] = 0;
for (i = 1; i <= _numRooms; i++) {
@@ -345,19 +344,16 @@
++bobnum;
}
}
- }
- else {
+ } else {
if(img <= -10) {
// object has been turned off, but the image order hasn't been updated
if(_graphicData[-(img + 10)].lastFrame != 0) {
bobtype = 1;
}
- }
- else if(img == -2) {
+ } else if(img == -2) {
// -1 static, -2 animated
bobtype = 1;
- }
- else if(img > 0) {
+ } else if(img > 0) {
if(_graphicData[img].lastFrame != 0) {
bobtype = 1;
}
@@ -370,12 +366,10 @@
if(img <= -10) {
if(_graphicData[-(img + 10)].lastFrame != 0) {
++idxAnimated;
- }
- else {
+ } else {
++idxStatic;
}
- }
- else if(img > 0) {
+ } else if(img > 0) {
if(img > 5000) {
img -= 5000;
}
@@ -385,15 +379,12 @@
if(_graphicData[img].lastFrame != 0) {
++idxAnimated;
- }
- else {
+ } else {
++idxStatic;
}
- }
- else if(img == -1) {
+ } else if(img == -1) {
++idxStatic;
- }
- else if(img == -2) {
+ } else if(img == -2) {
++idxAnimated;
}
}
@@ -402,8 +393,7 @@
if(idxStatic > 0) {
bobnum = 19 + _numFurnitureStatic + idxStatic;
}
- }
- else {
+ } else {
// animated bob
if(idxAnimated > 0) {
bobnum = 4 + _numFurnitureAnimated + idxAnimated;
@@ -433,8 +423,7 @@
if(bobnum <= 3) {
framenum = 29 + FRAMES_JOE_XTRA + bobnum;
}
- }
- else {
+ } else {
uint16 idx = 0;
for(i = _roomData[room] + 1; i < obj; ++i) {
img = _objectData[i].image;
@@ -443,16 +432,13 @@
if(pgd->lastFrame != 0) {
// skip all the frames of the animation
idx += ABS(pgd->lastFrame) - pgd->firstFrame + 1;
- }
- else {
+ } else {
// static bob, skip one frame
++idx;
}
- }
- else if(img == -1) {
+ } else if(img == -1) {
++idx;
- }
- else if(img > 0) {
+ } else if(img > 0) {
if(img > 5000) {
img -= 5000;
}
@@ -460,11 +446,9 @@
uint16 lastFrame = ABS(pgd->lastFrame);
if(pgd->firstFrame < 0) {
idx += lastFrame;
- }
- else if(lastFrame != 0) {
+ } else if(lastFrame != 0) {
idx += (lastFrame - pgd->firstFrame) + 1;
- }
- else {
+ } else {
++idx;
}
}
@@ -475,12 +459,10 @@
GraphicData* pgd = &_graphicData[-(img + 10)];
if(pgd->lastFrame != 0) {
idx += ABS(pgd->lastFrame) - pgd->firstFrame + 1;
- }
- else {
+ } else {
++idx;
}
- }
- else if(img == -1 || img > 0) {
+ } else if(img == -1 || img > 0) {
++idx;
}
@@ -619,8 +601,7 @@
uint16 zone = zoneIn(screen, x, y);
if (zone <= _objMax[_currentRoom]) {
zone = 0;
- }
- else {
+ } else {
zone -= _objMax[_currentRoom];
}
return zone;
@@ -695,8 +676,7 @@
if (_currentRoom >= 114) {
_vm->display()->palFadeOut(0, 255, _currentRoom);
- }
- else {
+ } else {
_vm->display()->palFadeOut(0, 223, _currentRoom);
}
@@ -718,13 +698,11 @@
if (pod->name == 0) {
// object has been deleted, invalidate image
pod->image = 0;
- }
- else if (pod->image > -4000 && pod->image <= -10) {
+ } else if (pod->image > -4000 && pod->image <= -10) {
if (_graphicData[ABS(pod->image + 10)].lastFrame == 0) {
// static Bob
pod->image = -1;
- }
- else {
+ } else {
// animated Bob
pod->image = -2;
}
@@ -772,9 +750,7 @@
_vm->graphics()->bankUnpack(pgd->firstFrame, curImage, 15);
++_numFrames;
BobSlot *pbs = _vm->graphics()->bob(19 + _numFurnitureStatic);
- pbs->active = true;
- pbs->x = pgd->x;
- pbs->y = pgd->y;
+ pbs->curPos(pgd->x, pgd->y);
pbs->frameNum = curImage;
}
}
@@ -806,8 +782,7 @@
}
BobSlot *pbs = _vm->graphics()->bob(5 + curBob);
pbs->animNormal(image, curImage, pgd->speed / 4, rebound, false);
- pbs->x = pgd->x;
- pbs->y = pgd->y;
+ pbs->curPos(pgd->x, pgd->y);
++curBob;
}
}
@@ -858,13 +833,11 @@
// create a blank frame for the for the OFF object
++_numFrames;
++curImage;
- }
- else if(pod->image == -2) {
+ } else if(pod->image == -2) {
// animated OFF Bob
curBob = 5 + _numFurnitureAnimated + numObjectAnimated;
++numObjectAnimated;
- }
- else if(pod->image > 0 && pod->image < 5000) {
+ } else if(pod->image > 0 && pod->image < 5000) {
GraphicData *pgd = &_graphicData[pod->image];
int16 lastFrame = pgd->lastFrame;
bool rebound = false;
@@ -878,8 +851,7 @@
animSetup(pgd, curImage + 1, curBob + numObjectAnimated, pod->name > 0);
curImage += pgd->lastFrame;
++numObjectAnimated;
- }
- else if (lastFrame != 0) {
+ } else if (lastFrame != 0) {
// animated objects
uint16 j;
uint16 firstFrame = curImage + 1;
@@ -891,17 +863,14 @@
curBob = 5 + _numFurnitureAnimated + numObjectAnimated;
if (pod->name > 0) {
BobSlot *pbs = _vm->graphics()->bob(curBob);
- pbs->active = true;
- pbs->x = pgd->x;
- pbs->y = pgd->y;
+ pbs->curPos(pgd->x, pgd->y);
pbs->frameNum = firstFrame;
if (pgd->speed > 0) {
pbs->animNormal(firstFrame, curImage, pgd->speed / 4, rebound, false);
}
}
++numObjectAnimated;
- }
- else {
+ } else {
// static objects
curBob = 20 + _numFurnitureStatic + numObjectStatic;
++curImage;
@@ -913,9 +882,7 @@
++_numFrames;
if (pod->name > 0) {
BobSlot *pbs = _vm->graphics()->bob(curBob);
- pbs->active = true;
- pbs->x = pgd->x;
- pbs->y = pgd->y;
+ pbs->curPos(pgd->x, pgd->y);
pbs->frameNum = curImage;
}
++numObjectStatic;
@@ -931,8 +898,7 @@
uint16 noun = i - _roomData[_currentRoom];
if (pod->name > 0) {
curImage = personSetup(noun, curImage);
- }
- else {
+ } else {
curImage = personAllocate(noun, curImage);
}
}
@@ -986,8 +952,7 @@
// a person object
if (pod->name <= 0) {
_vm->graphics()->bobClear(curBob);
- }
- else {
+ } else {
// find person number
uint16 pNum = 1;
uint16 i = _roomData[_currentRoom] + 1;
@@ -1031,8 +996,7 @@
if (pgd->firstFrame < 0) {
animSetup(pgd, curImage, curBob, pod->name != 0);
curImage += pgd->lastFrame - 1;
- }
- else if (lastFrame != 0) {
+ } else if (lastFrame != 0) {
// turn on an animated bob
_vm->graphics()->bankUnpack(pgd->firstFrame, 2, 15);
pbs->animating = false;
@@ -1043,21 +1007,16 @@
++curImage;
_vm->graphics()->bankUnpack(j, curImage, 15);
}
- pbs->active = true;
- pbs->x = pgd->x;
- pbs->y = pgd->y;
+ pbs->curPos(pgd->x, pgd->y);
pbs->frameNum = firstImage;
if (pgd->speed > 0) {
pbs->animNormal(firstImage, curImage, pgd->speed / 4, rebound, false);
}
- }
- else {
+ } else {
// frame 2 is used as a buffer frame to prevent BOB flickering
_vm->graphics()->bankUnpack(pgd->firstFrame, 2, 15);
_vm->graphics()->bankUnpack(pgd->firstFrame, curImage, 15);
- pbs->active = true;
- pbs->x = pgd->x;
- pbs->y = pgd->y;
+ pbs->curPos(pgd->x, pgd->y);
pbs->frameNum = curImage;
}
@@ -1109,8 +1068,7 @@
BobSlot *joe = _vm->graphics()->bob(0);
if (IS_CD_INTRO_ROOM(_currentRoom)) {
_vm->display()->palFadeIn(0, 255, _currentRoom, joe->active, joe->x, joe->y);
- }
- else {
+ } else {
_vm->display()->palFadeIn(0, 223, _currentRoom, joe->active, joe->x, joe->y);
}
}
@@ -1173,8 +1131,7 @@
pp->name = _aName[pp->actor->name];
if (pp->actor->anim != 0) {
pp->anim = _aAnim[pp->actor->anim];
- }
- else {
+ } else {
pp->anim = NULL;
}
@@ -1220,10 +1177,8 @@
xflip = true;
}
BobSlot *pbs = _vm->graphics()->bob(pad->bobNum);
- pbs->active = true;
+ pbs->curPos(pad->x, pad->y);
pbs->scale = scale;
- pbs->x = pad->x;
- pbs->y = pad->y;
pbs->frameNum = p.bobFrame;
pbs->xflip = xflip;
@@ -1232,8 +1187,7 @@
if (p.anim != NULL) {
_personFrames[pad->bobNum] = curImage + 1;
curImage = animCreate(curImage, &p);
- }
- else {
+ } else {
animErase(pad->bobNum);
}
return curImage;
@@ -1309,8 +1263,7 @@
if (f1 > 500) {
// SFX
allocatedFrames[f1 - 500] = 1;
- }
- else {
+ } else {
allocatedFrames[f1] = 1;
}
@@ -1331,8 +1284,7 @@
uint16 frameNum = animFrames[i].frame;
if (frameNum > 500) {
animFrames[i].frame = curImage + allocatedFrames[frameNum - 500] + 500;
- }
- else {
+ } else {
animFrames[i].frame = curImage + allocatedFrames[frameNum];
}
}
@@ -1416,8 +1368,7 @@
BobSlot *pbs = _vm->graphics()->bob(bobNum);
pbs->animating = false;
if (visible) {
- pbs->x = gd->x;
- pbs->y = gd->y;
+ pbs->curPos(gd->x, gd->y);
if (tempFrames[0] < 0) {
pbs->xflip = true;
}
@@ -1431,8 +1382,7 @@
if (pga->frame - 500 == tempFrames[j - 1]) {
frameNr = j + firstImage - 1 + 500;
}
- }
- else if (pga->frame == tempFrames[j - 1]) {
+ } else if (pga->frame == tempFrames[j - 1]) {
frameNr = j + firstImage - 1;
}
}
@@ -1486,16 +1436,14 @@
if (!autoPosition || joeX() != 0 || joeY() != 0) {
oldx = joeX();
oldy = joeY();
- }
- else {
+ } else {
// find the walk off point for the entry object and make
// Joe walking to that point
pwo = walkOffPointForObject(_entryObj);
if (pwo != NULL) {
oldx = pwo->x;
oldy = pwo->y;
- }
- else {
+ } else {
// no walk off point, use object position
oldx = pod->x;
oldy = pod->y;
@@ -1506,13 +1454,11 @@
if (scale > 0 && scale < 100) {
joeScale(scale);
- }
- else {
+ } else {
uint16 a = zoneInArea(ZONE_ROOM, oldx, oldy);
if (a > 0) {
joeScale(currentRoomArea(a)->calcScale(oldy));
- }
- else {
+ } else {
joeScale(100);
}
}
@@ -1520,8 +1466,7 @@
if (joeCutFacing() > 0) {
joeFacing(joeCutFacing());
joeCutFacing(0);
- }
- else {
+ } else {
// check to see which way Joe entered room
switch (State::findDirection(pod->state)) {
case DIR_BACK:
@@ -1556,9 +1501,7 @@
}
joeFace();
- pbs->active = true;
- pbs->x = oldx;
- pbs->y = oldy;
+ pbs->curPos(oldx, oldy);
pbs->frameNum = 29 + FRAMES_JOE_XTRA;
joeX(0);
joeY(0);
@@ -1578,8 +1521,7 @@
uint16 frame;
if (_currentRoom == 108) {
frame = 1;
- }
- else {
+ } else {
frame = 33;
if (joeFacing() == DIR_FRONT) {
if (joePrevFacing() == DIR_BACK) {
@@ -1587,15 +1529,13 @@
update();
}
frame = 34;
- }
- else if (joeFacing() == DIR_BACK) {
+ } else if (joeFacing() == DIR_BACK) {
if (joePrevFacing() == DIR_FRONT) {
pbs->frameNum = 33 + FRAMES_JOE_XTRA;
update();
}
frame = 35;
- }
- else if ((joeFacing() == DIR_LEFT && joePrevFacing() == DIR_RIGHT)
+ } else if ((joeFacing() == DIR_LEFT && joePrevFacing() == DIR_RIGHT)
|| (joeFacing() == DIR_RIGHT && joePrevFacing() == DIR_LEFT)) {
pbs->frameNum = 34 + FRAMES_JOE_XTRA;
update();
@@ -1635,11 +1575,9 @@
case STATE_GRAB_MID:
if (joeFacing() == DIR_BACK) {
frame = 6;
- }
- else if (joeFacing() == DIR_FRONT) {
+ } else if (joeFacing() == DIR_FRONT) {
frame = 4;
- }
- else {
+ } else {
frame = 2;
}
break;
@@ -1647,8 +1585,7 @@
case STATE_GRAB_DOWN:
if (joeFacing() == DIR_BACK) {
frame = 9;
- }
- else {
+ } else {
frame = 8;
}
break;
@@ -1692,8 +1629,7 @@
if (gameState(VAR_DRESSING_MODE) == 0) {
playCutaway("cdres.CUT");
inventoryInsertItem(ITEM_CLOTHES);
- }
- else {
+ } else {
playCutaway("cudrs.CUT");
}
}
@@ -1856,8 +1792,7 @@
// unpack frame for object and draw it
_vm->graphics()->bankUnpack(_itemData[itemNum].frame, dstFrame, 14);
_vm->graphics()->bobDrawInventoryItem(dstFrame, x, 14);
- }
- else {
+ } else {
// no object, clear the panel
_vm->graphics()->bobDrawInventoryItem(0, x, 14);
}
@@ -2058,8 +1993,7 @@
case ROOM_AMAZON_HIDEOUT:
if (walkDataNum == 4) {
playCutaway("c17a.CUT", nextCut);
- }
- else if (walkDataNum == 2) {
+ } else if (walkDataNum == 2) {
playCutaway("c17b.CUT", nextCut);
}
break;
@@ -2103,12 +2037,10 @@
_gameState[VAR_ESCAPE_FROM_HOTEL_COUNT] = 1;
joeUseUnderwear();
joeFace();
- }
- else if (_gameState[VAR_ESCAPE_FROM_HOTEL_COUNT] == 1) {
+ } else if (_gameState[VAR_ESCAPE_FROM_HOTEL_COUNT] == 1) {
playCutaway("c73b.CUT");
_gameState[VAR_ESCAPE_FROM_HOTEL_COUNT] = 2;
- }
- else if (_gameState[VAR_ESCAPE_FROM_HOTEL_COUNT] == 2) {
+ } else if (_gameState[VAR_ESCAPE_FROM_HOTEL_COUNT] == 2) {
playCutaway("c73c.CUT");
}
break;
@@ -2126,8 +2058,7 @@
if (areaNum == 3) {
if (_gameState[VAR_BYPASS_FLODA_RECEPTIONIST] == 1) {
playCutaway("c103e.CUT", nextCut);
- }
- else if (_gameState[VAR_BYPASS_FLODA_RECEPTIONIST] == 0) {
+ } else if (_gameState[VAR_BYPASS_FLODA_RECEPTIONIST] == 0) {
playCutaway("c103b.CUT", nextCut);
_gameState[VAR_BYPASS_FLODA_RECEPTIONIST] = 1;
}
@@ -2474,8 +2405,7 @@
if (_vm->resource()->isDemo()) {
makePersonSpeak("This is a demo, so I can't load or save games*14", NULL, "");
- }
- else {
+ } else {
// XXX save some vars
//
@@ -2516,8 +2446,7 @@
// check talkspeed value
if (_talkSpeed < 4) {
_talkSpeed = 4;
- }
- else if (_talkSpeed > 95) {
+ } else if (_talkSpeed > 95) {
_talkSpeed = 100;
}
@@ -2919,8 +2848,7 @@
int i = _vm->graphics()->bob(0)->x - 160;
if (i < 0) {
i = 0;
- }
- else if (i > 320) {
+ } else if (i > 320) {
i = 320;
}
_vm->graphics()->cameraBob(-1);
@@ -2932,8 +2860,7 @@
}
update();
}
- }
- else {
+ } else {
while (_vm->display()->horizontalScroll() < i) {
_vm->display()->horizontalScroll(_vm->display()->horizontalScroll() + 16);
if (_vm->display()->horizontalScroll() > i ) {
@@ -2972,8 +2899,7 @@
if (bobJoe->x - bobAzura->x > 128) {
bobAzura->x += 10;
bobJoe->x += 6;
- }
- else {
+ } else {
bobAzura->x += 8;
bobJoe->x += 8;
}
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/queen command.cpp,1.47,1.48 debug.cpp,1.5,1.6 display.cpp,1.38,1.39 graphics.cpp,1.60,1.61 journal.cpp,1.11,1.12 queen.cpp,1.60,1.61 walk.cpp,1.32,1.33 walk.h,1.17,1.18 xref.txt,1.50,1.51
- Next message: [Scummvm-cvs-logs] CVS: scummvm/queen command.cpp,1.48,1.49 cutaway.cpp,1.92,1.93 display.cpp,1.39,1.40 display.h,1.29,1.30 input.cpp,1.17,1.18 logic.cpp,1.145,1.146 talk.cpp,1.63,1.64
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list