aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Percival2019-12-02 01:11:08 +0800
committerScott Percival2019-12-02 21:57:10 +0800
commita17f406bef2d19931685f139f8c352df5a486360 (patch)
treed24a8c2e1d6c49f51d27dff95def67cffbd780f4
parent472e7f138051be17533b878be2efc6fa1111e1c5 (diff)
downloadscummvm-rg350-a17f406bef2d19931685f139f8c352df5a486360.tar.gz
scummvm-rg350-a17f406bef2d19931685f139f8c352df5a486360.tar.bz2
scummvm-rg350-a17f406bef2d19931685f139f8c352df5a486360.zip
DIRECTOR: Adjust naming of some instructions
-rw-r--r--engines/director/lingo/lingo-bytecode.cpp50
-rw-r--r--engines/director/lingo/lingo-bytecode.h4
-rw-r--r--engines/director/lingo/lingo-code.cpp8
-rw-r--r--engines/director/lingo/lingo.h9
4 files changed, 37 insertions, 34 deletions
diff --git a/engines/director/lingo/lingo-bytecode.cpp b/engines/director/lingo/lingo-bytecode.cpp
index 131dbb7c66..462650e408 100644
--- a/engines/director/lingo/lingo-bytecode.cpp
+++ b/engines/director/lingo/lingo-bytecode.cpp
@@ -60,16 +60,16 @@ static LingoV4Bytecode lingoV4[] = {
{ 0x45, Lingo::c_symbolpush, "b" },
{ 0x53, Lingo::c_jump, "jb" },
{ 0x54, Lingo::c_jump, "jbn" },
- { 0x55, Lingo::c_jumpif, "jb" },
- { 0x5c, Lingo::c_v4theentitypush, "b" },
- { 0x5d, Lingo::c_v4theentityassign, "b" },
+ { 0x55, Lingo::c_jumpifz, "jb" },
+ { 0x5c, Lingo::cb_v4theentitypush, "b" },
+ { 0x5d, Lingo::cb_v4theentityassign, "b" },
{ 0x81, Lingo::c_intpush, "w" },
{ 0x82, Lingo::c_argspush, "w" },
{ 0x83, Lingo::c_arraypush, "w" },
{ 0x84, Lingo::c_constpush, "wv" },
{ 0x93, Lingo::c_jump, "jw" },
{ 0x94, Lingo::c_jump, "jwn" },
- { 0x95, Lingo::c_jumpif, "jw" },
+ { 0x95, Lingo::c_jumpifz, "jw" },
{ 0, 0, 0 }
};
@@ -166,7 +166,7 @@ static LingoV4TheEntity lingoV4TheEntity[] = {
{ 0x0c, 0x07, kTheField, kTheTextSize, true, kTEAItemId },
{ 0x0d, 0x0f, kTheCast, kTheDirectToStage, true, kTEAItemId },
{ 0x0d, 0x10, kTheCast, kTheSound, true, kTEAItemId },
- { -1, 0, 0, 0, false, kTEANOArgs }
+ { 0xff, 0, 0, 0, false, kTEANOArgs }
};
@@ -175,13 +175,13 @@ void Lingo::initBytecode() {
_lingoV4[op->opcode] = op;
}
- for (LingoV4TheEntity *ent = lingoV4TheEntity; ent->bank != -1; ent++) {
+ for (LingoV4TheEntity *ent = lingoV4TheEntity; ent->bank != 0xff; ent++) {
_lingoV4TheEntity[(ent->bank << 8) + ent->firstArg] = ent;
}
}
-void Lingo::c_v4theentitypush() {
+void Lingo::cb_v4theentitypush() {
int bank = g_lingo->readInt();
Datum firstArg = g_lingo->pop();
@@ -192,7 +192,7 @@ void Lingo::c_v4theentitypush() {
if (firstArg.type == INT) {
int key = (bank << 8) + firstArg.u.i;
if (g_lingo->_lingoV4TheEntity.contains(key)) {
- debugC(3, kDebugLingoExec, "c_v4theentitypush: mapping 0x%02x, 0x%02x", bank, firstArg.u.i);
+ debugC(3, kDebugLingoExec, "cb_v4theentitypush: mapping 0x%02x, 0x%02x", bank, firstArg.u.i);
int entity = g_lingo->_lingoV4TheEntity[key]->entity;
int field = g_lingo->_lingoV4TheEntity[key]->field;
switch (g_lingo->_lingoV4TheEntity[key]->type) {
@@ -201,47 +201,47 @@ void Lingo::c_v4theentitypush() {
Datum id;
id.u.s = NULL;
id.type = VOID;
- debugC(3, kDebugLingoExec, "c_v4theentitypush: calling getTheEntity(0x%02x, NULL, 0x%02x)", entity, field);
+ debugC(3, kDebugLingoExec, "cb_v4theentitypush: calling getTheEntity(0x%02x, NULL, 0x%02x)", entity, field);
result = g_lingo->getTheEntity(entity, id, field);
}
break;
case kTEAItemId:
{
Datum id = g_lingo->pop();
- debugC(3, kDebugLingoExec, "c_v4theentitypush: calling getTheEntity(0x%02x, id, 0x%02x)", entity, field);
+ debugC(3, kDebugLingoExec, "cb_v4theentitypush: calling getTheEntity(0x%02x, id, 0x%02x)", entity, field);
result = g_lingo->getTheEntity(entity, id, field);
}
break;
case kTEAString:
{
/*Datum stringArg = */g_lingo->pop();
- warning("c_v4theentitypush: STUB: kTEAString");
+ warning("cb_v4theentitypush: STUB: kTEAString");
}
break;
case kTEAMenuIdItemId:
{
/*Datum menuId = */g_lingo->pop();
/*Datum itemId = */g_lingo->pop();
- warning("c_v4theentitypush: STUB: kTEAMenuIdItemId");
+ warning("cb_v4theentitypush: STUB: kTEAMenuIdItemId");
}
break;
default:
- warning("c_v4theentitypush: unknown call type %d", g_lingo->_lingoV4TheEntity[key]->type);
+ warning("cb_v4theentitypush: unknown call type %d", g_lingo->_lingoV4TheEntity[key]->type);
break;
}
} else {
- warning("c_v4theentitypush: unhandled mapping 0x%02x 0x%02x", bank, firstArg.u.i);
+ warning("cb_v4theentitypush: unhandled mapping 0x%02x 0x%02x", bank, firstArg.u.i);
}
} else {
- warning("c_v4theentitypush: first arg should be of type INT, not %s", firstArg.type2str());
+ warning("cb_v4theentitypush: first arg should be of type INT, not %s", firstArg.type2str());
}
g_lingo->push(result);
}
-void Lingo::c_v4theentityassign() {
+void Lingo::cb_v4theentityassign() {
int bank = g_lingo->readInt();
Datum firstArg = g_lingo->pop();
@@ -253,7 +253,7 @@ void Lingo::c_v4theentityassign() {
if (firstArg.type == INT) {
int key = (bank << 8) + firstArg.u.i;
if (g_lingo->_lingoV4TheEntity.contains(key)) {
- debugC(3, kDebugLingoExec, "c_v4theentityassign: mapping 0x%02x, 0x%02x", bank, firstArg.u.i);
+ debugC(3, kDebugLingoExec, "cb_v4theentityassign: mapping 0x%02x, 0x%02x", bank, firstArg.u.i);
if (g_lingo->_lingoV4TheEntity[key]->writable) {
int entity = g_lingo->_lingoV4TheEntity[key]->entity;
int field = g_lingo->_lingoV4TheEntity[key]->field;
@@ -263,43 +263,43 @@ void Lingo::c_v4theentityassign() {
Datum id;
id.u.s = NULL;
id.type = VOID;
- debugC(3, kDebugLingoExec, "c_v4theentityassign: calling setTheEntity(0x%02x, NULL, 0x%02x, value)", entity, field);
+ debugC(3, kDebugLingoExec, "cb_v4theentityassign: calling setTheEntity(0x%02x, NULL, 0x%02x, value)", entity, field);
g_lingo->setTheEntity(entity, id, field, value);
}
break;
case kTEAItemId:
{
Datum id = g_lingo->pop();
- debugC(3, kDebugLingoExec, "c_v4theentityassign: calling setTheEntity(0x%02x, id, 0x%02x, value)", entity, field);
+ debugC(3, kDebugLingoExec, "cb_v4theentityassign: calling setTheEntity(0x%02x, id, 0x%02x, value)", entity, field);
g_lingo->setTheEntity(entity, id, field, value);
}
break;
case kTEAString:
{
/*Datum stringArg = */g_lingo->pop();
- warning("c_v4theentityassign: STUB: kTEAString");
+ warning("cb_v4theentityassign: STUB: kTEAString");
}
break;
case kTEAMenuIdItemId:
{
/*Datum menuId = */g_lingo->pop();
/*Datum itemId = */g_lingo->pop();
- warning("c_v4theentityassign: STUB: kTEAMenuIdItemId");
+ warning("cb_v4theentityassign: STUB: kTEAMenuIdItemId");
}
break;
default:
- warning("c_v4theentityassign: unknown call type %d", g_lingo->_lingoV4TheEntity[key]->type);
+ warning("cb_v4theentityassign: unknown call type %d", g_lingo->_lingoV4TheEntity[key]->type);
break;
}
} else {
- warning("c_v4theentityassign: non-writable mapping 0x%02x 0x%02x", bank, firstArg.u.i);
+ warning("cb_v4theentityassign: non-writable mapping 0x%02x 0x%02x", bank, firstArg.u.i);
}
} else {
- warning("c_v4theentityassign: unhandled mapping 0x%02x 0x%02x", bank, firstArg.u.i);
+ warning("cb_v4theentityassign: unhandled mapping 0x%02x 0x%02x", bank, firstArg.u.i);
}
} else {
- warning("c_v4theentityassign: first arg should be of type INT, not %s", firstArg.type2str());
+ warning("cb_v4theentityassign: first arg should be of type INT, not %s", firstArg.type2str());
}
}
diff --git a/engines/director/lingo/lingo-bytecode.h b/engines/director/lingo/lingo-bytecode.h
index 0e5f9b40e8..1f21f215d7 100644
--- a/engines/director/lingo/lingo-bytecode.h
+++ b/engines/director/lingo/lingo-bytecode.h
@@ -41,8 +41,8 @@ enum TheEntityArgsType {
};
struct LingoV4TheEntity {
- const int bank;
- const int firstArg;
+ const uint8 bank;
+ const uint8 firstArg;
const int entity;
const int field;
const bool writable;
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index f823209b88..fd0020561d 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -72,8 +72,6 @@ static struct FuncDescr {
{ Lingo::c_eval, "c_eval", "s" },
{ Lingo::c_theentitypush,"c_theentitypush","ii" }, // entity, field
{ Lingo::c_theentityassign,"c_theentityassign","ii" },
- { Lingo::c_v4theentitypush,"c_v4theentitypush","i" },
- { Lingo::c_v4theentityassign,"c_v4theentityassign","i" },
{ Lingo::c_swap, "c_swap", "" },
{ Lingo::c_add, "c_add", "" },
{ Lingo::c_sub, "c_sub", "" },
@@ -109,7 +107,7 @@ static struct FuncDescr {
{ Lingo::c_ge, "c_ge", "" },
{ Lingo::c_le, "c_le", "" },
{ Lingo::c_jump, "c_jump", "i" },
- { Lingo::c_jumpif, "c_jumpif", "i" },
+ { Lingo::c_jumpifz, "c_jumpifz", "i" },
{ Lingo::c_repeatwhilecode,"c_repeatwhilecode","oo" },
{ Lingo::c_repeatwithcode,"c_repeatwithcode","ooooos" },
{ Lingo::c_exitRepeat, "c_exitRepeat", "" },
@@ -134,6 +132,8 @@ static struct FuncDescr {
{ Lingo::c_unk, "c_unk", "i" },
{ Lingo::c_unk1, "c_unk1", "ii" },
{ Lingo::c_unk2, "c_unk2", "iii" },
+ { Lingo::cb_v4theentitypush,"c_v4theentitypush","i" },
+ { Lingo::cb_v4theentityassign,"c_v4theentityassign","i" },
{ 0, 0, 0 }
};
@@ -881,7 +881,7 @@ void Lingo::c_jump() {
g_lingo->_pc = jump;
}
-void Lingo::c_jumpif() {
+void Lingo::c_jumpifz() {
uint jump = g_lingo->readInt();
Datum test = g_lingo->pop();
test.toInt();
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index d434bdabac..633f78b1f8 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -301,8 +301,6 @@ public:
static void c_theentitypush();
static void c_theentityassign();
- static void c_v4theentitypush();
- static void c_v4theentityassign();
static void c_repeatwhilecode();
static void c_repeatwithcode();
@@ -319,7 +317,7 @@ public:
static void c_ge();
static void c_le();
static void c_jump();
- static void c_jumpif();
+ static void c_jumpifz();
static void c_call();
void call(Common::String name, int nargs);
@@ -347,11 +345,16 @@ public:
static void c_unk1();
static void c_unk2();
+ // bytecode-related instructions
+ static void cb_v4theentitypush();
+ static void cb_v4theentityassign();
+
void printSTUBWithArglist(const char *funcname, int nargs, const char *prefix = "STUB:");
void convertVOIDtoString(int arg, int nargs);
void dropStack(int nargs);
void drop(uint num);
+ // builtin functions
static void b_abs(int nargs);
static void b_atan(int nargs);
static void b_cos(int nargs);