mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-04 01:46:42 +00:00
ADL: Use template for direction opcode
This commit is contained in:
parent
64cf93198f
commit
eaacfe1eed
@ -330,13 +330,13 @@ void AdlEngine::setupOpcodeTables() {
|
||||
Opcode(o1_setItemPic);
|
||||
// 0x14
|
||||
Opcode(o1_resetPic);
|
||||
Opcode(o1_goDirection);
|
||||
Opcode(o1_goDirection);
|
||||
Opcode(o1_goDirection);
|
||||
Opcode(o1_goDirection<IDI_DIR_NORTH>);
|
||||
Opcode(o1_goDirection<IDI_DIR_SOUTH>);
|
||||
Opcode(o1_goDirection<IDI_DIR_EAST>);
|
||||
// 0x18
|
||||
Opcode(o1_goDirection);
|
||||
Opcode(o1_goDirection);
|
||||
Opcode(o1_goDirection);
|
||||
Opcode(o1_goDirection<IDI_DIR_WEST>);
|
||||
Opcode(o1_goDirection<IDI_DIR_UP>);
|
||||
Opcode(o1_goDirection<IDI_DIR_DOWN>);
|
||||
Opcode(o1_takeItem);
|
||||
// 0x1c
|
||||
Opcode(o1_dropItem);
|
||||
@ -1017,8 +1017,9 @@ bool AdlEngine::o1_resetPic(ScriptEnv &env) {
|
||||
return true;
|
||||
}
|
||||
|
||||
template <Direction D>
|
||||
bool AdlEngine::o1_goDirection(ScriptEnv &env) {
|
||||
byte room = getCurRoom().connections[ARG(0) - IDO_ACT_GO_NORTH];
|
||||
byte room = getCurRoom().connections[D];
|
||||
|
||||
if (room == 0) {
|
||||
printMessage(_messageIds.cantGoThere);
|
||||
|
@ -90,9 +90,19 @@ typedef Common::Functor1<ScriptEnv &, bool> Opcode;
|
||||
|
||||
#define IDI_WORD_SIZE 8
|
||||
|
||||
enum Direction {
|
||||
IDI_DIR_NORTH,
|
||||
IDI_DIR_SOUTH,
|
||||
IDI_DIR_EAST,
|
||||
IDI_DIR_WEST,
|
||||
IDI_DIR_UP,
|
||||
IDI_DIR_DOWN,
|
||||
IDI_DIR_TOTAL
|
||||
};
|
||||
|
||||
struct Room {
|
||||
byte description;
|
||||
byte connections[6];
|
||||
byte connections[IDI_DIR_TOTAL];
|
||||
byte track;
|
||||
byte sector;
|
||||
byte offset;
|
||||
@ -207,6 +217,7 @@ protected:
|
||||
bool o1_placeItem(ScriptEnv &env);
|
||||
bool o1_setItemPic(ScriptEnv &env);
|
||||
bool o1_resetPic(ScriptEnv &env);
|
||||
template <Direction D>
|
||||
bool o1_goDirection(ScriptEnv &env);
|
||||
bool o1_takeItem(ScriptEnv &env);
|
||||
bool o1_dropItem(ScriptEnv &env);
|
||||
|
Loading…
x
Reference in New Issue
Block a user