FULLPIPE: Implement global_messageHandler1()

This commit is contained in:
Eugene Sandulenko
2013-09-06 14:51:13 +03:00
parent cee12678dc
commit c12ea8bd2b
15 changed files with 307 additions and 29 deletions
+19
View File
@@ -29,9 +29,24 @@ namespace Fullpipe {
#define ANI_IN1MAN 5110
#define ANI_INV_MAP 5321
#define ANI_MAN 322
#define MSG_DISABLESAVES 5201
#define MSG_ENABLESAVES 5202
#define MSG_HMRKICK_METAL 4764
#define MSG_HMRKICK_STUCCO 4765
#define MSG_MANSHADOWSOFF 5196
#define MSG_MANSHADOWSON 5197
#define MSG_SC1_SHOWOSK 1019
#define MSG_SC1_SHOWOSK2 468
#define MSG_SC1_UTRUBACLICK 1100
#define MV_MAN_GOLADDER 451
#define MV_MAN_GOLADDER2 2844
#define MV_MAN_LOOKUP 4773
#define MV_MAN_STARTLADDER 452
#define MV_MAN_STARTLADDER2 2842
#define MV_MAN_STOPLADDER 454
#define MV_MAN_STOPLADDER2 2845
#define MV_MAN_TOLADDER 448
#define MV_MAN_TOLADDER2 2841
#define MV_MAN_TURN_LU 486
#define PIC_CMN_EVAL 3468
#define PIC_CSR_ARCADE1 4901
@@ -120,12 +135,16 @@ namespace Fullpipe {
#define SC_MAP 5222
#define SC_TEST 903
#define SC_TITLES 5166
#define SND_CMN_031 3516
#define SND_CMN_070 5199
#define ST_LBN_2N 2756
#define ST_MAN_EMPTY 476
#define ST_MAN_RIGHT 325
#define TrubaDown 697
#define TrubaLeft 474
#define TrubaRight 696
#define TrubaUp 680
#define rMV_MAN_LOOKUP 4775
} // End of namespace Fullpipe
+11 -5
View File
@@ -105,6 +105,8 @@ FullpipeEngine::FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc)
_mouseVirtX = 0;
_mouseVirtY = 0;
_currSelectedInventoryItemId = 0;
_behaviorManager = 0;
_cursorId = 0;
@@ -254,8 +256,7 @@ void FullpipeEngine::updateEvents() {
ex->handle();
}
_mouseX = event.mouse.x;
_mouseY = event.mouse.y;
_mouseScreenPos = event.mouse;
break;
case Common::EVENT_QUIT:
_gameContinue = false;
@@ -311,8 +312,8 @@ void FullpipeEngine::cleanup() {
}
void FullpipeEngine::updateScreen() {
_mouseVirtX = _mouseX + _sceneRect.left;
_mouseVirtY = _mouseY + _sceneRect.top;
_mouseVirtX = _mouseScreenPos.x + _sceneRect.left;
_mouseVirtY = _mouseScreenPos.y + _sceneRect.top;
//if (inputArFlag)
// updateGame_inputArFlag();
@@ -348,7 +349,7 @@ void FullpipeEngine::updateScreen() {
} else {
//vrtRectangle(*(_DWORD *)g_vrtHandle, 0, 0, 0, 800, 600);
}
_inputController->drawCursor(_mouseX, _mouseY);
_inputController->drawCursor(_mouseScreenPos.x, _mouseScreenPos.y);
++_updateTicks;
}
@@ -404,4 +405,9 @@ void FullpipeEngine::updateMapPiece(int mapId, int update) {
}
}
void FullpipeEngine::disableSaves(ExCommand *ex) {
warning("STUB: FullpipeEngine::disableSaves()");
}
} // End of namespace Fullpipe
+17 -2
View File
@@ -88,7 +88,6 @@ public:
Common::RandomSource *_rnd;
int _mouseX, _mouseY;
Common::KeyCode _keyState;
uint16 _buttonState;
@@ -106,7 +105,6 @@ public:
int _gameProjectVersion;
int _pictureScale;
int _scrollSpeed;
bool _savesEnabled;
bool _updateFlag;
bool _flgCanOpenMap;
bool _gamePaused;
@@ -126,11 +124,18 @@ public:
CInputController *_inputController;
bool _inputDisabled;
void defHandleKeyDown(int key);
SoundList *_currSoundList1[11];
int _currSoundListCount;
bool _soundEnabled;
bool _flgSoundList;
void stopAllSounds();
void toggleMute();
void playSound(int id, int flag);
void startSceneTrack();
int _sfxVolume;
GlobalMessageQueueList *_globalMessageQueueList;
@@ -146,6 +151,7 @@ public:
int _mouseVirtX;
int _mouseVirtY;
Common::Point _mouseScreenPos;
BehaviorManager *_behaviorManager;
@@ -163,6 +169,9 @@ public:
bool _flgPlayIntro;
int _musicAllowed;
void enableSaves() { _isSaveAllowed = true; }
void disableSaves(ExCommand *ex);
void initObjectStates();
void setLevelStates();
void setSwallowedEggsState();
@@ -179,6 +188,7 @@ public:
Scene *_inventoryScene;
CInventory2 *_inventory;
int _currSelectedInventoryItemId;
int32 _updateTicks;
int32 _lastInputTicks;
@@ -190,6 +200,7 @@ public:
int (*_updateCursorCallback)();
int _cursorId;
void setCursor(int id);
int getObjectState(const char *objname);
void setObjectState(const char *name, int state);
@@ -201,6 +212,10 @@ public:
NGIArchive *_currArchive;
void openMap();
void openHelp();
void openMainMenu();
public:
bool _isSaveAllowed;
+1 -1
View File
@@ -311,7 +311,7 @@ void CGameLoader::updateSystems(int counterdiff) {
_updateCounter++;
_exCommand._messageNum = 33;
_exCommand._excFlags = 0;
postMessage(&_exCommand);
_exCommand.postMessage();
}
processMessages();
+13
View File
@@ -82,6 +82,10 @@ void CInputController::drawCursor(int x, int y) {
warning("STUB: CInputController::drawCursor(%d, %d)", x, y);
}
void CInputController::setCursor(int id) {
warning("STUB: CInputController::setCursor(%d)", id);
}
CursorInfo::CursorInfo() {
pictureId = 0;
picture = 0;
@@ -104,4 +108,13 @@ CursorInfo::CursorInfo(CursorInfo *src) {
height = src->height;
}
void FullpipeEngine::setCursor(int id) {
if (_inputController)
_inputController->setCursor(id);
}
void FullpipeEngine::defHandleKeyDown(int key) {
warning("STUB: FullpipeEngine::defHandleKeyDown(%d)", key);
}
} // End of namespace Fullpipe
+1
View File
@@ -65,6 +65,7 @@ class CInputController {
void setCursorMode(bool mode);
void drawCursor(int x, int y);
void setCursor(int id);
};
} // End of namespace Fullpipe
+30
View File
@@ -110,4 +110,34 @@ void CInventory2::draw() {
warning("STUB: CInventory2::draw()");
}
void CInventory2::slideOut() {
_isInventoryOut = true;
ExCommand *ex = new ExCommand(0, 17, 65, 0, 0, 0, 1, 0, 0, 0);
ex->_field_2C = 10;
ex->_field_14 = _isInventoryOut;
ex->_field_20 = !_isInventoryOut;
ex->_excFlags |= 3;
ex->postMessage();
}
int CInventory2::handleLeftClick(ExCommand *cmd) {
warning("STUB: CInventory2::handleLeftClick()");
return 0;
}
int CInventory2::unselectItem(bool flag) {
warning("STUB: CInventory2::unselectItem()");
return 0;
}
int CInventory2::getHoveredItem(Common::Point *point) {
warning("STUB: CInventory2::getHoveredItem()");
return 0;
}
} // End of namespace Fullpipe
+11 -2
View File
@@ -87,8 +87,8 @@ class CInventory2 : public CInventory {
InventoryIcons _inventoryIcons;
int _selectedId;
int _field_48;
int _isInventoryOut;
int _isLocked;
bool _isInventoryOut;
bool _isLocked;
int _topOffset;
Scene *_scene;
BigPicture *_picture;
@@ -100,7 +100,16 @@ class CInventory2 : public CInventory {
void rebuildItemRects();
Scene *getScene() { return _scene; }
bool getIsLocked() { return _isLocked; }
void setIsLocked(bool val) { _isLocked = val; }
bool getIsInventoryOut() { return _isInventoryOut; }
int getSelectedItemId() { return _selectedId < 0 ? 0 : _selectedId; }
int getHoveredItem(Common::Point *point);
void slideOut();
int handleLeftClick(ExCommand *cmd);
int unselectItem(bool flag);
void draw();
};
+5 -5
View File
@@ -106,13 +106,17 @@ void ExCommand::sendMessage() {
processMessages();
}
void ExCommand::postMessage() {
g_fullpipe->_exCommandList.push_back(this);
}
void ExCommand::handle() {
if (g_fullpipe->_modalObject) {
g_fullpipe->_modalObject->handleMessage(this);
delete this;
} else {
postMessage(this);
postMessage();
}
}
@@ -624,10 +628,6 @@ void clearMessageHandlers() {
}
}
void postMessage(ExCommand *ex) {
g_fullpipe->_exCommandList.push_back(ex);
}
void processMessages() {
if (!g_fullpipe->_isProcessingMessages) {
g_fullpipe->_isProcessingMessages = true;
+1 -1
View File
@@ -72,6 +72,7 @@ class ExCommand : public Message {
bool handleMessage();
void sendMessage();
void postMessage();
void handle();
};
@@ -153,7 +154,6 @@ int getMessageHandlersCount();
bool addMessageHandlerByIndex(int (*callback)(ExCommand *), int index, int16 id);
bool insertMessageHandler(int (*callback)(ExCommand *), int index, int16 id);
void clearMessageHandlers();
void postMessage(ExCommand *ex);
void processMessages();
void updateGlobalMessageQueue(int id, int objid);
+12
View File
@@ -91,4 +91,16 @@ bool CModalIntro::handleMessage(ExCommand *message) {
return true;
}
void FullpipeEngine::openMap() {
warning("STUB: FullpipeEngine::openMap()");
}
void FullpipeEngine::openHelp() {
warning("STUB: FullpipeEngine::openHelp()");
}
void FullpipeEngine::openMainMenu() {
warning("STUB: FullpipeEngine::openMainMenu()");
}
} // End of namespace Fullpipe
+168 -3
View File
@@ -91,7 +91,7 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {
_scrollSpeed = 8;
_savesEnabled = true;
_isSaveAllowed = true;
_updateFlag = true;
_flgCanOpenMap = true;
@@ -651,8 +651,173 @@ void setElevatorButton(const char *name, int state) {
var->setSubVarAsInt(name, state);
}
void global_messageHandler_KickStucco() {
warning("STUB: global_messageHandler_KickStucco()");
}
void global_messageHandler_KickMetal() {
warning("STUB: global_messageHandler_KickMetal()");
}
int global_messageHandler1(ExCommand *cmd) {
warning("STUB: global_messageHandler1()");
if (cmd->_excFlags & 0x10000) {
if (cmd->_messageNum == MV_MAN_TOLADDER)
cmd->_messageNum = MV_MAN_TOLADDER2;
if (cmd->_messageNum == MV_MAN_STARTLADDER)
cmd->_messageNum = MV_MAN_STARTLADDER2;
if (cmd->_messageNum == MV_MAN_GOLADDER)
cmd->_messageNum = MV_MAN_GOLADDER2;
if (cmd->_messageNum == MV_MAN_STOPLADDER)
cmd->_messageNum = MV_MAN_STOPLADDER2;
}
if (g_fullpipe->_inputDisabled) {
if (cmd->_messageKind == 17) {
switch (cmd->_messageNum) {
case 29:
case 30:
case 36:
case 106:
cmd->_messageKind = 0;
break;
default:
break;
}
}
} else if (cmd->_messageKind == 17) {
switch (cmd->_messageNum) {
case MSG_MANSHADOWSON:
g_fullpipe->_aniMan->_shadowsOn = 1;
break;
case MSG_HMRKICK_STUCCO:
global_messageHandler_KickStucco();
break;
case MSG_MANSHADOWSOFF:
g_fullpipe->_aniMan->_shadowsOn = 0;
break;
case MSG_DISABLESAVES:
g_fullpipe->disableSaves(cmd);
break;
case MSG_ENABLESAVES:
g_fullpipe->enableSaves();
break;
case MSG_HMRKICK_METAL:
global_messageHandler_KickMetal();
break;
case 29: // left mouse
if (g_fullpipe->_inventoryScene) {
if (getGameLoaderInventory()->handleLeftClick(cmd))
cmd->_messageKind = 0;
}
break;
case 107: // right mouse
if (getGameLoaderInventory()->getSelectedItemId()) {
getGameLoaderInventory()->unselectItem(0);
cmd->_messageKind = 0;
}
break;
case 36: // keydown
switch (cmd->_keyCode) {
case '\x1B': // ESC
if (g_fullpipe->_currentScene) {
getGameLoaderInventory()->unselectItem(0);
g_fullpipe->openMainMenu();
cmd->_messageKind = 0;
}
break;
case 't':
g_fullpipe->stopAllSounds();
cmd->_messageKind = 0;
break;
case 'u':
g_fullpipe->toggleMute();
cmd->_messageKind = 0;
break;
case ' ':
if (getGameLoaderInventory()->getIsLocked()) {
if (getGameLoaderInventory()->getIsInventoryOut()) {
getGameLoaderInventory()->setIsLocked(0);
}
} else {
getGameLoaderInventory()->slideOut();
getGameLoaderInventory()->setIsLocked(1);
}
break;
case '\t':
if (g_fullpipe->_flgCanOpenMap)
g_fullpipe->openMap();
cmd->_messageKind = 0;
break;
case 'p':
if (g_fullpipe->_flgCanOpenMap)
g_fullpipe->openHelp();
cmd->_messageKind = 0;
break;
default:
g_fullpipe->defHandleKeyDown(cmd->_keyCode);
break;
}
break;
case 33:
if (!g_fullpipe->_inventoryScene)
break;
int invItem;
if (g_fullpipe->_updateFlag && (invItem = g_fullpipe->_inventory->getHoveredItem(&g_fullpipe->_mouseScreenPos))) {
g_fullpipe->_cursorId = PIC_CSR_ITN;
if (!g_fullpipe->_currSelectedInventoryItemId && !g_fullpipe->_aniMan->_movement &&
!(g_fullpipe->_aniMan->_flags & 0x100) && g_fullpipe->_aniMan->isIdle()) {
int st = g_fullpipe->_aniMan->_statics->_staticsId;
ExCommand *newex;
if (st == ST_MAN_RIGHT) {
newex = new ExCommand(g_fullpipe->_aniMan->_id, 1, rMV_MAN_LOOKUP, 0, 0, 0, 1, 0, 0, 0);
} else if (st == (0x4000 | ST_MAN_RIGHT)) {
newex = new ExCommand(g_fullpipe->_aniMan->_id, 1, MV_MAN_LOOKUP, 0, 0, 0, 1, 0, 0, 0);
}
newex->_keyCode = g_fullpipe->_aniMan->_field_4;
newex->_excFlags |= 3;
newex->postMessage();
}
if (g_fullpipe->_currSelectedInventoryItemId != invItem)
g_fullpipe->playSound(SND_CMN_070, 0);
g_fullpipe->_currSelectedInventoryItemId = invItem;
g_fullpipe->setCursor(g_fullpipe->_cursorId);
break;
}
if (g_fullpipe->_updateCursorCallback)
g_fullpipe->_updateCursorCallback();
g_fullpipe->_currSelectedInventoryItemId = 0;
g_fullpipe->setCursor(g_fullpipe->_cursorId);
break;
case 65: // open map
if (cmd->_field_2C == 11 && cmd->_field_14 == ANI_INV_MAP && g_fullpipe->_flgCanOpenMap)
g_fullpipe->openMap();
break;
default:
break;
}
}
if (cmd->_messageKind == 56) {
getGameLoaderInventory()->rebuildItemRects();
ExCommand *newex = new ExCommand(0, 35, SND_CMN_031, 0, 0, 0, 1, 0, 0, 0);
newex->_field_14 = 1;
newex->_excFlags |= 3;
newex->postMessage();
return 1;
} else if (cmd->_messageKind == 57) {
getGameLoaderInventory()->rebuildItemRects();
return 1;
}
return 0;
}
@@ -784,7 +949,7 @@ int sceneHandler01(ExCommand *cmd) {
}
g_fullpipe->_behaviorManager->updateBehaviors();
startSceneTrack();
g_fullpipe->startSceneTrack();
return res;
}
+16 -2
View File
@@ -110,8 +110,22 @@ void FullpipeEngine::setSceneMusicParameters(CGameVar *var) {
warning("STUB: FullpipeEngine::setSceneMusicParameters()");
}
void startSceneTrack() {
warning("STUB: startSceneTrack()");
void FullpipeEngine::startSceneTrack() {
warning("STUB: FullpipeEngine::startSceneTrack()");
}
void FullpipeEngine::stopAllSounds() {
warning("STUB: FullpipeEngine::stopAllSounds()");
}
void FullpipeEngine::toggleMute() {
warning("STUB: FullpipeEngine::toggleMute()");
}
void FullpipeEngine::playSound(int id, int flag) {
warning("STUB: FullpipeEngine::playSounds(%d, %d)", id, flag);
}
} // End of namespace Fullpipe
-2
View File
@@ -25,8 +25,6 @@
namespace Fullpipe {
void startSceneTrack();
class Sound : public MemoryObject {
int _id;
char *_description;
+2 -6
View File
@@ -81,9 +81,7 @@ class DynamicPhase : public StaticPhase {
};
class Statics : public DynamicPhase {
friend class StaticANIObject;
friend class Movement;
public:
int16 _staticsId;
int16 _field_86;
char *_staticsName;
@@ -158,9 +156,7 @@ class Movement : public GameObject {
};
class StaticANIObject : public GameObject {
friend class FullpipeEngine;
protected:
public:
Movement *_movement;
Statics *_statics;
int _shadowsOn;