[Scummvm-cvs-logs] CVS: scummvm/queen graphics.cpp,1.56,1.57 graphics.h,1.47,1.48 logic.cpp,1.135,1.136 queen.cpp,1.56,1.57 queen.h,1.20,1.21 xref.txt,1.48,1.49
Gregory Montoir
cyx at users.sourceforge.net
Fri Dec 19 01:23:01 CET 2003
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/queen journal.h,1.4,1.5 journal.cpp,1.9,1.10
- Next message: [Scummvm-cvs-logs] CVS: scummvm/sword1 debug.h,1.1,1.2 eventman.cpp,1.1,1.2 logic.cpp,1.13,1.14 memman.cpp,1.1,1.2 mouse.cpp,1.7,1.8 mouse.h,1.4,1.5 objectman.h,1.1,1.2 resman.cpp,1.5,1.6 resman.h,1.2,1.3 router.cpp,1.5,1.6 router.h,1.3,1.4 screen.cpp,1.10,1.11 screen.h,1.4,1.5 sound.cpp,1.8,1.9 sword1.cpp,1.12,1.13 sword1.h,1.3,1.4 sworddefs.h,1.7,1.8
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/queen
In directory sc8-pr-cvs1:/tmp/cvs-serv1703/queen
Modified Files:
graphics.cpp graphics.h logic.cpp queen.cpp queen.h xref.txt
Log Message:
put all 'bam' related stuff in a class and allow load/save during a 'bam' scene
Index: graphics.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/graphics.cpp,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -d -r1.56 -r1.57
--- graphics.cpp 11 Dec 2003 22:16:34 -0000 1.56
+++ graphics.cpp 19 Dec 2003 09:22:19 -0000 1.57
@@ -26,6 +26,7 @@
#include "queen/logic.h"
#include "queen/queen.h"
#include "queen/resource.h"
+#include "queen/sound.h"
namespace Queen {
@@ -598,10 +599,12 @@
}
break;
case ROOM_CAR_CHASE:
- updateCarBamScene();
+ _vm->bam()->updateCarAnimation();
+// updateCarBamScene();
break;
case ROOM_FINAL_FIGHT:
- updateFightBamScene();
+ _vm->bam()->updateFightAnimation();
+// updateFightBamScene();
break;
case ROOM_INTRO_RITA_JOE_HEADS: // CR 2 - CD-Rom pan right while Rita talks...
_cameraBob = -1;
@@ -735,49 +738,32 @@
}
-void Graphics::initCarBamScene() {
-
- bobClear(5);
- _bobs[5].active = true;
- bobClear(6);
- _bobs[6].active = true;
- bobClear(7);
- _bobs[7].active = true;
- _bam.flag = 1;
- _bam.index = 0;
-}
-
-
-void Graphics::updateCarBamScene() {
+void BamScene::updateCarAnimation() {
- if (_bam.flag) {
- const BamDataBlock *bdb = &_bam._carData[_bam.index];
- BobSlot *pbob;
+ if (_flag != F_STOP) {
+ const BamDataBlock *bdb = &_carData[_index];
// Truck
- pbob = &_bobs[5];
- pbob->curPos(bdb->obj1.x, bdb->obj1.y);
- pbob->frameNum = 40 + bdb->obj1.frame;
+ _obj1->curPos(bdb->obj1.x, bdb->obj1.y);
+ _obj1->frameNum = 40 + bdb->obj1.frame;
// Rico
- pbob = &_bobs[6];
- pbob->curPos(bdb->obj2.x, bdb->obj2.y);
- pbob->frameNum = 30 + bdb->obj2.frame;
+ _obj2->curPos(bdb->obj2.x, bdb->obj2.y);
+ _obj2->frameNum = 30 + bdb->obj2.frame;
// FX
- pbob = &_bobs[7];
- pbob->curPos(bdb->fx.x, bdb->fx.y);
- pbob->frameNum = 41 + bdb->fx.frame;
+ _objfx->curPos(bdb->fx.x, bdb->fx.y);
+ _objfx->frameNum = 41 + bdb->fx.frame;
if (bdb->sfx < 0) {
- // XXX playsong(-bdb->sfx);
+ _vm->sound()->playSong(-bdb->sfx);
}
if (bdb->sfx == 99) {
- _bam.index = 0;
+ _index = 0;
}
else {
- ++_bam.index;
+ ++_index;
}
// Play BKG SFX
// XXX if(bamsfx==2 && SFXTOGGLE) sfxplay(NULLstr);
@@ -785,69 +771,41 @@
}
-void Graphics::cleanupCarBamScene(uint16 oilBobNum) {
-
- _bam.flag = 0;
- //CR 2 - Turn off big oil splat and gun shots!
- _bobs[oilBobNum].active = false;
- _bobs[7].active = false;
-}
-
-
-void Graphics::initFightBamScene() {
-
- bobClear(5);
- _bobs[5].active = true;
- bobClear(6);
- _bobs[6].active = true;
- bobClear(7);
- _bobs[7].active = true;
- _bam.flag = 1;
- _bam.index = 0;
- _bam._screenShaked = false;
- _bam._fightData = _bam._fight1Data;
-}
-
-
-void Graphics::updateFightBamScene() {
+void BamScene::updateFightAnimation() {
- if (_bam.flag) {
- const BamDataBlock *bdb = &_bam._fightData[_bam.index];
- BobSlot *pbob;
+ if (_flag != F_STOP) {
+ const BamDataBlock *bdb = &_fightData[_index];
// Frank
- pbob = &_bobs[5];
- pbob->curPos(bdb->obj1.x, bdb->obj1.y);
- pbob->frameNum = 40 + ABS(bdb->obj1.frame);
- pbob->xflip = (bdb->obj1.frame < 0);
+ _obj1->curPos(bdb->obj1.x, bdb->obj1.y);
+ _obj1->frameNum = 40 + ABS(bdb->obj1.frame);
+ _obj1->xflip = (bdb->obj1.frame < 0);
// Robot
- pbob = &_bobs[6];
- pbob->curPos(bdb->obj2.x, bdb->obj2.y);
- pbob->frameNum = 40 + ABS(bdb->obj2.frame);
- pbob->xflip = (bdb->obj2.frame < 0);
-
+ _obj2->curPos(bdb->obj2.x, bdb->obj2.y);
+ _obj2->frameNum = 40 + ABS(bdb->obj2.frame);
+ _obj2->xflip = (bdb->obj2.frame < 0);
+
// FX
- pbob = &_bobs[7];
- pbob->curPos(bdb->fx.x, bdb->fx.y);
- pbob->frameNum = 40 + ABS(bdb->fx.frame);
- pbob->xflip = (bdb->fx.frame < 0);
+ _objfx->curPos(bdb->fx.x, bdb->fx.y);
+ _objfx->frameNum = 40 + ABS(bdb->fx.frame);
+ _objfx->xflip = (bdb->fx.frame < 0);
if (bdb->sfx < 0) {
- // XXX playsong(-bdb->sfx);
+ _vm->sound()->playSong(-bdb->sfx);
}
- ++_bam.index;
+ ++_index;
switch (bdb->sfx) {
case 0: // nothing, so reset shaked screen if necessary
- if (_bam._screenShaked) {
+ if (_screenShaked) {
OSystem::instance()->set_shake_pos(0);
- _bam._screenShaked = false;
+ _screenShaked = false;
}
break;
case 1: // shake screen
OSystem::instance()->set_shake_pos(3);
- _bam._screenShaked = true;
+ _screenShaked = true;
break;
case 2: // play background sfx
// XXX if(SFXTOGGLE) sfxplay(NULLstr);
@@ -855,18 +813,18 @@
case 3: // play background sfx and shake screen
// XXX if(SFXTOGGLE) sfxplay(NULLstr);
OSystem::instance()->set_shake_pos(3);
- _bam._screenShaked = true;
+ _screenShaked = true;
break;
case 99: // end of BAM data
- _bam.index = 0;
+ _index = 0;
const BamDataBlock *data[] = {
- _bam._fight1Data,
- _bam._fight2Data,
- _bam._fight3Data
+ _fight1Data,
+ _fight2Data,
+ _fight3Data
};
- _bam._fightData = data[_vm->randomizer.getRandomNumber(2)];
- if (_bam.flag == 2) {
- _bam.flag = 0;
+ _fightData = data[_vm->randomizer.getRandomNumber(2)];
+ if (_flag == F_REQ_STOP) {
+ _flag = F_STOP;
}
break;
}
@@ -1008,7 +966,30 @@
-const BamDataBlock BamData::_carData[] = {
+BamScene::BamScene(QueenEngine *vm)
+ : _flag(F_STOP), _screenShaked(false), _fightData(_fight1Data), _vm(vm) {
+}
+
+
+void BamScene::prepareAnimation() {
+
+ _obj1 = _vm->graphics()->bob(BOB_OBJ1);
+ _vm->graphics()->bobClear(BOB_OBJ1);
+ _obj1->active = true;
+
+ _obj2 = _vm->graphics()->bob(BOB_OBJ2);
+ _vm->graphics()->bobClear(BOB_OBJ2);
+ _obj2->active = true;
+
+ _objfx = _vm->graphics()->bob(BOB_FX);
+ _vm->graphics()->bobClear(BOB_FX);
+ _objfx->active = true;
+
+ _index = 0;
+}
+
+
+const BamDataBlock BamScene::_carData[] = {
{ { 310, 105, 1 }, { 314, 106, 17 }, { 366, 101, 1 }, 0 },
{ { 303, 105, 1 }, { 307, 106, 17 }, { 214, 0, 10 }, 0 },
{ { 297, 104, 1 }, { 301, 105, 17 }, { 214, 0, 10 }, 0 },
@@ -1086,7 +1067,7 @@
{ { 310, 110, 1 }, { 314, 111, 17 }, { 214, 0, 10 }, 99 }
};
-const BamDataBlock BamData::_fight1Data[] = {
+const BamDataBlock BamScene::_fight1Data[] = {
{ { 75, 96, 1 }, { 187, 96, -23 }, { 58, 37, 46 }, 0 },
{ { 75, 96, 2 }, { 187, 96, -23 }, { 58, 37, 46 }, 0 },
{ { 75, 96, 3 }, { 187, 96, -23 }, { 58, 37, 46 }, 0 },
@@ -1135,7 +1116,7 @@
{ { 75, 96, 1 }, { 187, 96, -23 }, { 0, 0, 0 }, 99 }
};
-const BamDataBlock BamData::_fight2Data[] = {
+const BamDataBlock BamScene::_fight2Data[] = {
{ { 75, 96, 1 }, { 187, 96, -23 }, { 150, 45, 35 }, 0 },
{ { 78, 96, 2 }, { 187, 96, -23 }, { 150, 45, 35 }, 0 },
{ { 81, 96, 3 }, { 189, 96, -18 }, { 150, 45, 35 }, 0 },
@@ -1193,7 +1174,7 @@
{ { 75, 96, 5 }, { 187, 96, -23 }, { 224, 53, 53 }, 99 }
};
-const BamDataBlock BamData::_fight3Data[] = {
+const BamDataBlock BamScene::_fight3Data[] = {
{ { 75, 96, 1 }, { 187, 96, -23 }, { 150, 45, 35 }, 0 },
{ { 77, 96, 2 }, { 187, 96, -22 }, { 150, 45, 35 }, 0 },
{ { 80, 96, 3 }, { 185, 96, -17 }, { 150, 45, 35 }, 0 },
Index: graphics.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/graphics.h,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- graphics.h 11 Dec 2003 22:16:35 -0000 1.47
+++ graphics.h 19 Dec 2003 09:22:20 -0000 1.48
@@ -102,34 +102,6 @@
};
-struct BamDataObj {
- int16 x, y;
- int16 frame;
-};
-
-struct BamDataBlock {
- BamDataObj obj1; // truck / Frank
- BamDataObj obj2; // Rico / robot
- BamDataObj fx;
- int16 sfx;
-};
-
-struct BamData {
-
- BamData() : flag(0), index(0) {}
-
- int16 flag;
- int16 index;
-
- bool _screenShaked;
- const BamDataBlock *_fightData;
- static const BamDataBlock _carData[];
- static const BamDataBlock _fight1Data[];
- static const BamDataBlock _fight2Data[];
- static const BamDataBlock _fight3Data[];
-};
-
-
class QueenEngine;
class Graphics {
@@ -182,15 +154,6 @@
void cameraBob(int bobNum) { _cameraBob = bobNum; }
int cameraBob() const { return _cameraBob; }
- BamData *bamData() { return &_bam; }
-
- void initCarBamScene();
- void updateCarBamScene();
- void cleanupCarBamScene(uint16 i);
-
- void initFightBamScene();
- void updateFightBamScene();
-
void update(uint16 room);
enum {
@@ -233,9 +196,59 @@
int _cameraBob;
- BamData _bam;
+ QueenEngine *_vm;
+};
+
+
+struct BamDataObj {
+ int16 x, y;
+ int16 frame;
+};
+
+struct BamDataBlock {
+ BamDataObj obj1; // truck / Frank
+ BamDataObj obj2; // Rico / robot
+ BamDataObj fx;
+ int16 sfx;
+};
+
+class BamScene {
+public:
+
+ BamScene(QueenEngine *vm);
+
+ void prepareAnimation();
+ void updateCarAnimation();
+ void updateFightAnimation();
+
+ enum {
+ BOB_OBJ1 = 5,
+ BOB_OBJ2 = 6,
+ BOB_FX = 7
+ };
+
+ enum {
+ F_STOP = 0,
+ F_PLAY = 1,
+ F_REQ_STOP = 2
+ };
+
+ uint16 _flag, _index;
+
+private:
+
+ BobSlot *_obj1;
+ BobSlot *_obj2;
+ BobSlot *_objfx;
+ bool _screenShaked;
+ const BamDataBlock *_fightData;
QueenEngine *_vm;
+
+ static const BamDataBlock _carData[];
+ static const BamDataBlock _fight1Data[];
+ static const BamDataBlock _fight2Data[];
+ static const BamDataBlock _fight3Data[];
};
} // End of namespace Queen
Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/logic.cpp,v
retrieving revision 1.135
retrieving revision 1.136
diff -u -d -r1.135 -r1.136
--- logic.cpp 15 Dec 2003 13:00:48 -0000 1.135
+++ logic.cpp 19 Dec 2003 09:22:20 -0000 1.136
@@ -2297,7 +2297,7 @@
_walkOffData[i].writeTo(ptr);
WRITE_BE_UINT16(ptr, _joe.facing); ptr += 2;
- WRITE_BE_UINT16(ptr, 0); ptr += 2; //TODO: tmpbamflag
+ WRITE_BE_UINT16(ptr, _vm->bam()->_flag); ptr += 2;
WRITE_BE_UINT16(ptr, 0); ptr += 2; //TODO: lastoverride
//TODO: lastmerge, lastalter, altmrgpri
@@ -2365,7 +2365,7 @@
_walkOffData[i].readFrom(ptr);
joeFacing(READ_BE_UINT16(ptr)); ptr += 2;
- READ_BE_UINT16(ptr); ptr += 2; //TODO: tmpbamflag
+ _vm->bam()->_flag = READ_BE_UINT16(ptr); ptr += 2;
READ_BE_UINT16(ptr); ptr += 2; //TODO: lastoverride
//_vm->sound()->playSound(_vm->sound()->lastOverride())
@@ -2379,6 +2379,10 @@
return false;
}
+ if (_vm->bam()->_flag != BamScene::F_STOP) {
+ _vm->bam()->prepareAnimation();
+ }
+
joeCutFacing(joeFacing());
joeFace();
@@ -2389,19 +2393,19 @@
_entryObj = 0;
switch (gameState(VAR_DRESSING_MODE)) {
- case 0:
- joeUseClothes(false);
- break;
- case 1:
- joeUseUnderwear();
- break;
- case 2:
- joeUseDress(false);
- break;
+ case 0:
+ joeUseClothes(false);
+ break;
+ case 1:
+ joeUseUnderwear();
+ break;
+ case 2:
+ joeUseDress(false);
+ break;
}
+
inventoryRefresh();
- //bamflag = ..
-
+
delete[] saveData;
return true;
}
@@ -2680,21 +2684,25 @@
void Logic::asmStartCarAnimation() {
// Carbam background animation - room 74
- _vm->graphics()->initCarBamScene();
+ _vm->bam()->_flag = BamScene::F_PLAY;
+ _vm->bam()->prepareAnimation();
}
void Logic::asmStopCarAnimation() {
- // CR 2 - Turn off big oil splat and gun shots!
- _vm->graphics()->cleanupCarBamScene(findBob(594)); // Oil object
+ _vm->bam()->_flag = BamScene::F_STOP;
+ //CR 2 - Turn off big oil splat and gun shots!
+ _vm->graphics()->bob(findBob(594))->active = false; // Oil object
+ _vm->graphics()->bob(7)->active = false;
}
void Logic::asmStartFightAnimation() {
// Fight1 background animation - room 69
- _vm->graphics()->initFightBamScene();
+ _vm->bam()->_flag = BamScene::F_PLAY;
+ _vm->bam()->prepareAnimation();
gameState(148, 1);
}
@@ -2702,8 +2710,8 @@
void Logic::asmWaitForFrankPosition() {
// c69e.cut
- _vm->graphics()->bamData()->flag = 2;
- while (_vm->graphics()->bamData()->flag) {
+ _vm->bam()->_flag = BamScene::F_REQ_STOP;
+ while (_vm->bam()->_flag != BamScene::F_STOP) {
update();
}
}
@@ -2775,8 +2783,8 @@
for (i = 0; i < 40; ++i) {
update();
}
- OSystem::instance()->quit();
debug(0, "Game completed");
+ OSystem::instance()->quit();
}
@@ -3032,7 +3040,7 @@
void Logic::asmWaitForCarPosition() {
// Wait for car to reach correct position before pouring oil
- while (_vm->graphics()->bamData()->index != 60) {
+ while (_vm->bam()->_index != 60) {
update();
}
}
Index: queen.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/queen.cpp,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -d -r1.56 -r1.57
--- queen.cpp 14 Dec 2003 00:33:21 -0000 1.56
+++ queen.cpp 19 Dec 2003 09:22:20 -0000 1.57
@@ -102,6 +102,7 @@
QueenEngine::~QueenEngine() {
_timer->removeTimerProc(&timerHandler);
+ delete _bam;
delete _resource;
delete _command;
delete _display;
@@ -159,6 +160,7 @@
void QueenEngine::initialise(void) {
+ _bam = new BamScene(this);
_resource = new Resource(_gameDataPath, _system->get_savefile_manager(), getSavePath());
_command = new Command(this);
_display = new Display(this, _resource->getLanguage(), _system);
Index: queen.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/queen.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- queen.h 14 Dec 2003 00:33:21 -0000 1.20
+++ queen.h 19 Dec 2003 09:22:20 -0000 1.21
@@ -28,6 +28,7 @@
namespace Queen {
+class BamScene;
class Command;
class Display;
class Graphics;
@@ -44,6 +45,7 @@
QueenEngine(GameDetector *detector, OSystem *syst);
virtual ~QueenEngine();
+ BamScene *bam() const { return _bam; }
Command *command() const { return _command; }
Display *display() const { return _display; }
Graphics *graphics() const { return _graphics; }
@@ -67,6 +69,7 @@
static void timerHandler(void *ptr);
void gotTimerTick();
+ BamScene *_bam;
Command *_command;
Display *_display;
Graphics *_graphics;
Index: xref.txt
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/xref.txt,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- xref.txt 13 Dec 2003 20:05:28 -0000 1.48
+++ xref.txt 19 Dec 2003 09:22:20 -0000 1.49
@@ -232,8 +232,8 @@
ACTOR_DATA_MAX Logic::_numActors
AREA Logic::_area
AREAMAX Logic::_areaMax
-bamflag Graphics::_bam.flag
-bamindex Graphics::_bam.index
+bamflag BamScene::_flag
+bamindex BamScene::_index
DESCTOT Logic::_numDescriptions
ENTRY_OBJ Logic::_entryObj
FMAX Logic::_numFurnitureStatic
@@ -343,7 +343,6 @@
LASTSONG Sound::_previousSong
CURRSONG Sound::_currentSong
SFXNAME Sound::_sfxName
-tmpbamflag
VOLUME
@@ -497,3 +496,4 @@
WORDstr
JOE2str,PERSON2str // locals in Talk::initialTalk
SUBJECT
+tmpbamflag
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/queen journal.h,1.4,1.5 journal.cpp,1.9,1.10
- Next message: [Scummvm-cvs-logs] CVS: scummvm/sword1 debug.h,1.1,1.2 eventman.cpp,1.1,1.2 logic.cpp,1.13,1.14 memman.cpp,1.1,1.2 mouse.cpp,1.7,1.8 mouse.h,1.4,1.5 objectman.h,1.1,1.2 resman.cpp,1.5,1.6 resman.h,1.2,1.3 router.cpp,1.5,1.6 router.h,1.3,1.4 screen.cpp,1.10,1.11 screen.h,1.4,1.5 sound.cpp,1.8,1.9 sword1.cpp,1.12,1.13 sword1.h,1.3,1.4 sworddefs.h,1.7,1.8
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list