[Scummvm-cvs-logs] scummvm master -> 8f9af262928242eebf10f5a51b9f461e7d47d610
dreammaster
dreammaster at scummvm.org
Sun Sep 4 13:13:17 CEST 2011
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
8f9af26292 TSAGE: Added missing default item response code logic in Blue Force
Commit: 8f9af262928242eebf10f5a51b9f461e7d47d610
https://github.com/scummvm/scummvm/commit/8f9af262928242eebf10f5a51b9f461e7d47d610
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2011-09-04T04:09:22-07:00
Commit Message:
TSAGE: Added missing default item response code logic in Blue Force
Changed paths:
engines/tsage/blue_force/blueforce_dialogs.cpp
engines/tsage/blue_force/blueforce_logic.cpp
engines/tsage/blue_force/blueforce_logic.h
engines/tsage/events.h
engines/tsage/globals.cpp
engines/tsage/globals.h
diff --git a/engines/tsage/blue_force/blueforce_dialogs.cpp b/engines/tsage/blue_force/blueforce_dialogs.cpp
index be72b78..f71d3d7 100644
--- a/engines/tsage/blue_force/blueforce_dialogs.cpp
+++ b/engines/tsage/blue_force/blueforce_dialogs.cpp
@@ -342,7 +342,7 @@ void AmmoBeltDialog::draw() {
// Draw the first clip if necessary
if (clip1) {
- GfxSurface clipSurface = surfaceFromRes(9, 6, BF_GLOBALS._clip1Frame);
+ GfxSurface clipSurface = surfaceFromRes(9, 6, BF_GLOBALS._clip1Bullets);
_clip1Rect.resize(clipSurface, _clip1Rect.left, _clip1Rect.top, 100);
_globals->gfxManager().copyFrom(clipSurface, bounds.left + _clip1Rect.left,
bounds.top + _clip1Rect.top);
@@ -350,7 +350,7 @@ void AmmoBeltDialog::draw() {
// Draw the second clip if necessary
if (clip2) {
- GfxSurface clipSurface = surfaceFromRes(9, 6, BF_GLOBALS._clip2Frame);
+ GfxSurface clipSurface = surfaceFromRes(9, 6, BF_GLOBALS._clip2Bullets);
_clip2Rect.resize(clipSurface, _clip2Rect.left, _clip2Rect.top, 100);
_globals->gfxManager().copyFrom(clipSurface, bounds.left + _clip2Rect.left,
bounds.top + _clip2Rect.top);
diff --git a/engines/tsage/blue_force/blueforce_logic.cpp b/engines/tsage/blue_force/blueforce_logic.cpp
index 3eafac7..41d16ad 100644
--- a/engines/tsage/blue_force/blueforce_logic.cpp
+++ b/engines/tsage/blue_force/blueforce_logic.cpp
@@ -340,10 +340,9 @@ void NamedObject::startAction(CursorType action) {
handled = false;
break;
}
-/*
+
if (!handled)
((SceneExt *)BF_GLOBALS._sceneManager._scene)->display(action);
-*/
}
void NamedObject::setup(int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode, SceneItem *item) {
@@ -501,20 +500,58 @@ void SceneExt::loadScene(int sceneNum) {
}
void SceneExt::checkGun() {
- if (BF_GLOBALS.getFlag(fLoadedSpare) && (BF_GLOBALS._v4CEBA > 0)) {
- if (--BF_GLOBALS._v4CEBA == 0)
+ // Remove a bullet from the currently loaded clip
+ if (BF_GLOBALS.getFlag(fLoadedSpare) && (BF_GLOBALS._clip2Bullets > 0)) {
+ if (--BF_GLOBALS._clip2Bullets == 0)
BF_GLOBALS.clearFlag(fGunLoaded);
} else {
- if (BF_GLOBALS._v4CEB8 > 0)
- --BF_GLOBALS._v4CEB8;
+ if (BF_GLOBALS._clip1Bullets > 0)
+ --BF_GLOBALS._clip1Bullets;
- if (!BF_GLOBALS._v4CEB8)
+ if (!BF_GLOBALS._clip1Bullets)
BF_GLOBALS.clearFlag(fGunLoaded);
}
BF_GLOBALS._sound3.play(4);
}
+void SceneExt::display(CursorType action) {
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(9000, BF_GLOBALS._randomSource.getRandomNumber(2));
+ break;
+ case CURSOR_USE:
+ SceneItem::display2(9000, BF_GLOBALS._randomSource.getRandomNumber(2) + 6);
+ break;
+ case CURSOR_TALK:
+ SceneItem::display2(9000, BF_GLOBALS._randomSource.getRandomNumber(2) + 3);
+ break;
+ case INV_COLT45:
+ gunDisplay();
+ break;
+ default:
+ if (action < BF_LAST_INVENT)
+ SceneItem::display2(9002, (int)action);
+ break;
+ }
+}
+
+void SceneExt::gunDisplay() {
+ if (!BF_GLOBALS.getFlag(gunDrawn)) {
+ // Gun not drawn
+ SceneItem::display2(1, BF_GLOBALS.getFlag(fCanDrawGun) ? 0 : 4);
+ } else if (!BF_GLOBALS.getFlag(fGunLoaded)) {
+ // Gun not loaded
+ SceneItem::display2(1, 1);
+ } else if (!BF_GLOBALS.getHasBullets()) {
+ // Out of ammunition
+ SceneItem::display2(1, 2);
+ } else {
+ // Check scene for whether gun can fire
+ checkGun();
+ }
+}
+
/*--------------------------------------------------------------------------*/
GameScene::GameScene() {
diff --git a/engines/tsage/blue_force/blueforce_logic.h b/engines/tsage/blue_force/blueforce_logic.h
index 5d2c3a7..ddc32d4 100644
--- a/engines/tsage/blue_force/blueforce_logic.h
+++ b/engines/tsage/blue_force/blueforce_logic.h
@@ -137,6 +137,8 @@ public:
};
class SceneExt: public Scene {
+private:
+ void gunDisplay();
public:
AObjectArray _timerList, _objArray2;
int _field372;
@@ -156,6 +158,7 @@ public:
void addTimer(Timer *timer) { _timerList.add(timer); }
void removeTimer(Timer *timer) { _timerList.remove(timer); }
+ void display(CursorType action);
};
class GameScene: public SceneExt {
diff --git a/engines/tsage/events.h b/engines/tsage/events.h
index d23e9db..ee77c6f 100644
--- a/engines/tsage/events.h
+++ b/engines/tsage/events.h
@@ -80,6 +80,7 @@ enum CursorType {
INV_9MM_BULLETS = 54, INV_SCHEDULE = 55, INV_GRENADES = 56, INV_YELLOW_CORD = 57,
INV_HALF_YELLOW_CORD = 58, INV_BLACK_CORD = 59, INV_HALF_BLACK_CORD = 61, INV_WARRANT = 62,
INV_JACKET = 63, INV_GREENS_KNIFE = 64, INV_DOG_WHISTLE = 65, INV_AMMO_BELT = 66,
+ BF_LAST_INVENT = 67,
// Cursors
CURSOR_WALK = 0x100, CURSOR_LOOK = 0x200, CURSOR_700 = 700, CURSOR_USE = 0x400, CURSOR_TALK = 0x800,
diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp
index 9d48fa5..086720d 100644
--- a/engines/tsage/globals.cpp
+++ b/engines/tsage/globals.cpp
@@ -212,14 +212,18 @@ void BlueForceGlobals::reset() {
_dayNumber = 0;
_v4CEA4 = 0;
_v4CEA8 = 0;
- _v4CEB8 = 0;
- _v4CEBA = 0;
_v4CF9E = 0;
_v4E238 = 0;
_v501FC = 0;
_v51C42 = 0;
- _clip1Frame = 8;
- _clip2Frame = 8;
+ _clip1Bullets = 8;
+ _clip2Bullets = 8;
+}
+
+bool BlueForceGlobals::getHasBullets() {
+ if (!getFlag(fGunLoaded))
+ return false;
+ return BF_GLOBALS.getFlag(fLoadedSpare) ? (_clip2Bullets > 0) : (_clip1Bullets > 0);
}
} // end of namespace BlueForce
diff --git a/engines/tsage/globals.h b/engines/tsage/globals.h
index c8eb21a..3148225 100644
--- a/engines/tsage/globals.h
+++ b/engines/tsage/globals.h
@@ -169,8 +169,6 @@ public:
int _dayNumber;
int _v4CEA4;
int _v4CEA8;
- int _v4CEB8;
- int _v4CEBA;
int _driveFromScene;
int _driveToScene;
int _v4CF9E;
@@ -181,10 +179,11 @@ public:
int _interfaceY;
Bookmark _bookmark;
int _mapLocationId;
- int _clip1Frame, _clip2Frame;
+ int _clip1Bullets, _clip2Bullets;
BlueForceGlobals();
void reset();
+ bool getHasBullets();
virtual Common::String getClassName() { return "BFGlobals"; }
virtual void synchronize(Serializer &s);
More information about the Scummvm-git-logs
mailing list