Skip to content

Commit

Permalink
NEVERHOOD: Start with Module2500
Browse files Browse the repository at this point in the history
- Implement Scene2501
- Add Scene::removeSprite
  • Loading branch information
johndoe123 authored and wjp committed May 8, 2013
1 parent b2175ad commit bbb23cd
Show file tree
Hide file tree
Showing 9 changed files with 563 additions and 2 deletions.
15 changes: 14 additions & 1 deletion engines/neverhood/gamemodule.cpp
Expand Up @@ -37,6 +37,7 @@
#include "neverhood/module2100.h"
#include "neverhood/module2200.h"
#include "neverhood/module2300.h"
#include "neverhood/module2500.h"
#include "neverhood/module2600.h"
#include "neverhood/module2700.h"
#include "neverhood/module2800.h"
Expand Down Expand Up @@ -327,10 +328,15 @@ void GameModule::startup() {
_vm->gameState().sceneNum = 1;
createModule(2700, -1);
#endif
#if 1
#if 0
_vm->gameState().sceneNum = 11;
createModule(2800, -1);
#endif
#if 1
_vm->gameState().which = 2;
_vm->gameState().sceneNum = 0;
createModule(2500, -1);
#endif
}

void GameModule::createModule(int moduleNum, int which) {
Expand Down Expand Up @@ -394,6 +400,10 @@ void GameModule::createModule(int moduleNum, int which) {
setGlobalVar(0x91080831, 0x1A214010);
_childObject = new Module2300(_vm, this, which);
break;
case 2500:
setGlobalVar(0x91080831, 0x29220120);
_childObject = new Module2500(_vm, this, which);
break;
case 2600:
setGlobalVar(0x91080831, 0x40271018);
_childObject = new Module2600(_vm, this, which);
Expand Down Expand Up @@ -513,6 +523,9 @@ void GameModule::updateModule() {
createModule(1000, 1);
}
break;
case 2500:
createModule(2600, 1);
break;
case 2600:
if (_moduleResult == 1) {
createModule(2500, 0);
Expand Down
51 changes: 51 additions & 0 deletions engines/neverhood/klayman.cpp
Expand Up @@ -5215,6 +5215,57 @@ void KmScene2247::sub453520() {
FinalizeState(&Klayman::stStartWalkingDone);
}

KmScene2501::KmScene2501(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y)
: Klayman(vm, parentScene, x, y, 1000, 1000), _isSittingInTeleporter(false) {
// Empty
}

uint32 KmScene2501::xHandleMessage(int messageNum, const MessageParam &param) {
uint32 messageResult = 0;
switch (messageNum) {
case 0x2000:
_isSittingInTeleporter = param.asInteger() != 0;
messageResult = 1;
break;
case 0x4001:
case 0x4800:
startWalkToX(param.asPoint().x, false);
break;
case 0x4004:
if (_isSittingInTeleporter)
GotoState(&Klayman::sub421350);
else
GotoState(&Klayman::stTryStandIdle);
break;
case 0x4817:
setDoDeltaX(param.asInteger());
gotoNextStateExt();
break;
case 0x481D:
if (_isSittingInTeleporter)
GotoState(&Klayman::stTurnToUseInTeleporter);
break;
case 0x481E:
if (_isSittingInTeleporter)
GotoState(&Klayman::stReturnFromUseInTeleporter);
break;
case 0x4834:
GotoState(&Klayman::stStepOver);
break;
case 0x4835:
sendMessage(_parentScene, 0x2000, 1);
_isSittingInTeleporter = true;
GotoState(&Klayman::stSitInTeleporter);
break;
case 0x4836:
sendMessage(_parentScene, 0x2000, 0);
_isSittingInTeleporter = false;
GotoState(&Klayman::stGetUpFromTeleporter);
break;
}
return messageResult;
}

KmScene2801::KmScene2801(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y)
: Klayman(vm, parentScene, x, y, 1000, 1000) {
// Empty
Expand Down
8 changes: 8 additions & 0 deletions engines/neverhood/klayman.h
Expand Up @@ -578,6 +578,14 @@ class KmScene2247 : public Klayman {
void sub453520();
};

class KmScene2501 : public Klayman {
public:
KmScene2501(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y);
protected:
bool _isSittingInTeleporter;
uint32 xHandleMessage(int messageNum, const MessageParam &param);
};

class KmScene2801 : public Klayman {
public:
KmScene2801(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y);
Expand Down
1 change: 1 addition & 0 deletions engines/neverhood/module.mk
Expand Up @@ -25,6 +25,7 @@ MODULE_OBJS = \
module2100.o \
module2200.o \
module2300.o \
module2500.o \
module2600.o \
module2700.o \
module2800.o \
Expand Down

0 comments on commit bbb23cd

Please sign in to comment.