CHEWY: Create JungleRoom base class for shared entry/exit logic

This commit is contained in:
Paul Gilbert 2022-01-30 08:11:31 -08:00
parent 282235ef64
commit 97c902b455
10 changed files with 80 additions and 66 deletions

View File

@ -34,6 +34,54 @@ const int16 SURIMY_TAF19_PHASEN[4][2] = {
{ 0, 0 }
};
void JungleRoom::topEntry() {
_G(cur_hide_flag) = 0;
hide_cur();
set_person_pos(236, 110, P_CHEWY, P_RIGHT);
set_person_pos(263, 85, P_NICHELLE, P_RIGHT);
set_person_pos(285, 78, P_HOWARD, P_RIGHT);
go_auto_xy(266, 113, P_HOWARD, ANI_WAIT);
show_cur();
}
void JungleRoom::leftEntry() {
set_person_pos(31, 118, P_CHEWY, P_RIGHT);
set_person_pos(71, 104, P_NICHELLE, P_RIGHT);
set_person_pos(6, 111, P_HOWARD, P_RIGHT);
}
void JungleRoom::rightEntry() {
set_person_pos(587, 114, P_CHEWY, P_LEFT);
set_person_pos(613, 103, P_NICHELLE, P_LEFT);
set_person_pos(561, 112, P_HOWARD, P_LEFT);
}
void JungleRoom::setup_func() {
calc_person_look();
const int posX = spieler_vector[P_CHEWY].Xypos[0];
int howDestX, nicDestX;
if (posX < 40) {
howDestX = 52;
nicDestX = 100;
} else if (posX < 230) {
howDestX = 83;
nicDestX = 163;
} else if (posX < 445) {
howDestX = 261;
nicDestX = 329;
} else {
howDestX = 493;
nicDestX = 543;
}
go_auto_xy(howDestX, 111, P_HOWARD, ANI_GO);
go_auto_xy(nicDestX, 110, P_NICHELLE, ANI_GO);
}
Room::Room() {
room_timer.TimerAnz = 0;
room_timer.TimerStart = 0;

View File

@ -19,8 +19,8 @@
*
*/
#ifndef CHEWY_RAUM_H
#define CHEWY_RAUM_H
#ifndef CHEWY_ROOM_H
#define CHEWY_ROOM_H
#include "chewy/objekt.h"
@ -44,6 +44,17 @@ extern const int16 SURIMY_TAF19_PHASEN[4][2];
#define R_GEPDATEI 2
#define R_SPEZTAF 3
class JungleRoom {
protected:
static void topEntry();
static void leftEntry();
static void rightEntry();
static void setup_func();
};
struct RaumBlk {
byte *LowPalMem;
const char *InvFile;

View File

@ -74,51 +74,5 @@ void Room70::xit(int16 eib_nr) {
}
}
void Room70::topEntry() {
_G(cur_hide_flag) = 0;
hide_cur();
set_person_pos(236, 110, P_CHEWY, P_RIGHT);
set_person_pos(263, 85, P_NICHELLE, P_RIGHT);
set_person_pos(285, 78, P_HOWARD, P_RIGHT);
go_auto_xy(266, 113, P_HOWARD, ANI_WAIT);
show_cur();
}
void Room70::leftEntry() {
set_person_pos(31, 118, P_CHEWY, P_RIGHT);
set_person_pos(71, 104, P_NICHELLE, P_RIGHT);
set_person_pos(6, 111, P_HOWARD, P_RIGHT);
}
void Room70::rightEntry() {
set_person_pos(587, 114, P_CHEWY, P_LEFT);
set_person_pos(613, 103, P_NICHELLE, P_LEFT);
set_person_pos(561, 112, P_HOWARD, P_LEFT);
}
void Room70::setup_func() {
calc_person_look();
const int posX = spieler_vector[P_CHEWY].Xypos[0];
int howDestX, nicDestX;
if (posX < 40) {
howDestX = 52;
nicDestX = 100;
} else if (posX < 230) {
howDestX = 83;
nicDestX = 163;
} else if (posX < 445) {
howDestX = 261;
nicDestX = 329;
} else {
howDestX = 493;
nicDestX = 543;
}
go_auto_xy(howDestX, 111, P_HOWARD, ANI_GO);
go_auto_xy(nicDestX, 110, P_NICHELLE, ANI_GO);
}
} // namespace Rooms
} // namespace Chewy

View File

@ -22,18 +22,15 @@
#ifndef CHEWY_ROOMS_ROOM70_H
#define CHEWY_ROOMS_ROOM70_H
#include "chewy/room.h"
namespace Chewy {
namespace Rooms {
class Room70 {
class Room70 : public JungleRoom {
public:
static void entry(int16 eib_nr);
static void xit(int16 eib_nr);
static void setup_func();
static void topEntry();
static void leftEntry();
static void rightEntry();
};
} // namespace Rooms

View File

@ -41,7 +41,7 @@ void Room73::entry(int16 eib_nr) {
_G(zoom_horizont) = 110;
flags.ZoomMov = true;
_G(zoom_mov_fak) = 3;
SetUpScreenFunc = Room70::setup_func;
SetUpScreenFunc = setup_func;
if (_G(spieler).flags28_20)
det->show_static_spr(3+ (_G(spieler).R63Feuer ? 1 : 0)); // flags25_40
@ -50,10 +50,10 @@ void Room73::entry(int16 eib_nr) {
switch (eib_nr) {
case 106:
Room70::topEntry();
topEntry();
break;
case 115:
Room70::leftEntry();
leftEntry();
default:
break;
}

View File

@ -25,7 +25,7 @@
namespace Chewy {
namespace Rooms {
class Room73 {
class Room73 : public JungleRoom {
public:
static void entry(int16 eib_nr);
static void xit(int16 eib_nr);

View File

@ -42,7 +42,7 @@ void Room74::entry(int16 eib_nr) {
_G(zoom_horizont) = 110;
flags.ZoomMov = true;
_G(zoom_mov_fak) = 3;
SetUpScreenFunc = Room70::setup_func;
SetUpScreenFunc = setup_func;
if (_G(spieler).flags29_1)
det->start_detail(0, 255, false);
@ -52,14 +52,14 @@ void Room74::entry(int16 eib_nr) {
switch (eib_nr) {
case 105:
Room70::leftEntry();
leftEntry();
break;
case 108:
_G(spieler).scrollx = 188;
Room75::proc1();
break;
case 109:
Room70::rightEntry();
rightEntry();
break;
default:
break;

View File

@ -22,10 +22,12 @@
#ifndef CHEWY_ROOMS_ROOM74_H
#define CHEWY_ROOMS_ROOM74_H
#include "chewy/room.h"
namespace Chewy {
namespace Rooms {
class Room74 {
class Room74 : public JungleRoom {
public:
static void entry(int16 eib_nr);
static void xit(int16 eib_nr);

View File

@ -41,7 +41,7 @@ void Room75::entry(int16 eib_nr) {
_G(zoom_horizont) = 110;
flags.ZoomMov = true;
_G(zoom_mov_fak) = 3;
SetUpScreenFunc = Room70::setup_func;
SetUpScreenFunc = setup_func;
if (flags.LoadGame)
return;
@ -52,10 +52,10 @@ void Room75::entry(int16 eib_nr) {
proc1();
break;
case 104:
Room70::rightEntry();
rightEntry();
break;
case 111:
Room70::leftEntry();
leftEntry();
break;
default:
break;

View File

@ -22,10 +22,12 @@
#ifndef CHEWY_ROOMS_ROOM75_H
#define CHEWY_ROOMS_ROOM75_H
#include "chewy/room.h"
namespace Chewy {
namespace Rooms {
class Room75 {
class Room75 : public JungleRoom {
public:
static void entry(int16 eib_nr);
static void xit(int16 eib_nr);