Skip to content

Commit

Permalink
DIRECTOR: LINGO: Refactor cb_v4theentityassign()
Browse files Browse the repository at this point in the history
  • Loading branch information
sev- committed Jan 14, 2020
1 parent 91d1a7a commit f6213c2
Showing 1 changed file with 48 additions and 43 deletions.
91 changes: 48 additions & 43 deletions engines/director/lingo/lingo-bytecode.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -362,50 +362,55 @@ void LC::cb_v4theentityassign() {
result.type = VOID; result.type = VOID;


int key = (bank << 8) + firstArg.u.i; int key = (bank << 8) + firstArg.u.i;
if (g_lingo->_lingoV4TheEntity.contains(key)) { if (!g_lingo->_lingoV4TheEntity.contains(key)) {
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;
switch (g_lingo->_lingoV4TheEntity[key]->type) {
case kTEANOArgs:
{
Datum id;
id.u.s = NULL;
id.type = VOID;
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, "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("cb_v4theentityassign: STUB: kTEAString");
}
break;
case kTEAMenuIdItemId:
{
/*Datum menuId = */g_lingo->pop();
/*Datum itemId = */g_lingo->pop();
warning("cb_v4theentityassign: STUB: kTEAMenuIdItemId");
}
break;
default:
warning("cb_v4theentityassign: unknown call type %d", g_lingo->_lingoV4TheEntity[key]->type);
break;
}
} else {
warning("cb_v4theentityassign: non-writable mapping 0x%02x 0x%02x", bank, firstArg.u.i);
}
} else {
warning("cb_v4theentityassign: unhandled mapping 0x%02x 0x%02x", bank, firstArg.u.i); warning("cb_v4theentityassign: unhandled mapping 0x%02x 0x%02x", bank, firstArg.u.i);

return;
}

debugC(3, kDebugLingoExec, "cb_v4theentityassign: mapping 0x%02x, 0x%02x", bank, firstArg.u.i);

if (!g_lingo->_lingoV4TheEntity[key]->writable) {
warning("cb_v4theentityassign: non-writable mapping 0x%02x 0x%02x", bank, firstArg.u.i);

return;
}

int entity = g_lingo->_lingoV4TheEntity[key]->entity;
int field = g_lingo->_lingoV4TheEntity[key]->field;
switch (g_lingo->_lingoV4TheEntity[key]->type) {
case kTEANOArgs:
{
Datum id;
id.u.s = NULL;
id.type = VOID;
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, "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("cb_v4theentityassign: STUB: kTEAString");
}
break;
case kTEAMenuIdItemId:
{
/*Datum menuId = */g_lingo->pop();
/*Datum itemId = */g_lingo->pop();
warning("cb_v4theentityassign: STUB: kTEAMenuIdItemId");
}
break;
default:
warning("cb_v4theentityassign: unknown call type %d", g_lingo->_lingoV4TheEntity[key]->type);
break;
} }
} }


Expand Down

0 comments on commit f6213c2

Please sign in to comment.