mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-17 23:44:22 +00:00
Replaced explicit bitmasks with function calls.
svn-id: r26855
This commit is contained in:
parent
b3c582e4c7
commit
f243227f09
@ -93,7 +93,7 @@ Animation *Parallaction::parseAnimation(Script& script, AnimationList &list, cha
|
||||
int16 _si = _zoneTypeNames->lookup(_tokens[1]);
|
||||
if (_si != -1) {
|
||||
vD0->_type |= 1 << (_si-1);
|
||||
if (((vD0->_type & 0xFFFF) != kZoneNone) && ((vD0->_type & 0xFFFF) != kZoneCommand)) {
|
||||
if ((vD0->type() != kZoneNone) && (vD0->type() != kZoneCommand)) {
|
||||
parseZoneTypeBlock(script, vD0);
|
||||
}
|
||||
}
|
||||
|
@ -301,15 +301,15 @@ void _c_frankenstein(void *parm) {
|
||||
pal0[(i+FIRST_BASE_COLOR)] = _vm->_gfx->_palette[i];
|
||||
pal0[(i+FIRST_BASE_COLOR)*3+1] = 0;
|
||||
pal0[(i+FIRST_BASE_COLOR)*3+2] = 0;
|
||||
pal0[(i+FIRST_EHB_COLOR)*3+1] = 0;
|
||||
pal0[(i+FIRST_EHB_COLOR)*3+2] = 0;
|
||||
// pal0[(i+FIRST_EHB_COLOR)*3+1] = 0;
|
||||
// pal0[(i+FIRST_EHB_COLOR)*3+2] = 0;
|
||||
}
|
||||
|
||||
for (uint16 _di = 0; _di < 30; _di++) {
|
||||
g_system->delayMillis(20);
|
||||
_vm->_gfx->setPalette(pal0, FIRST_BASE_COLOR, BASE_PALETTE_COLORS);
|
||||
g_system->delayMillis(20);
|
||||
_vm->_gfx->setPalette(pal0, FIRST_EHB_COLOR, EHB_PALETTE_COLORS);
|
||||
// g_system->delayMillis(20);
|
||||
// _vm->_gfx->setPalette(pal0, FIRST_EHB_COLOR, EHB_PALETTE_COLORS);
|
||||
}
|
||||
|
||||
_vm->_gfx->setPalette(_vm->_gfx->_palette);
|
||||
@ -369,8 +369,7 @@ void _c_finito(void *parm) {
|
||||
_vm->_gfx->displayCenteredString(130, v2C[_language]);
|
||||
_vm->_gfx->displayCenteredString(160, v1C[_language]);
|
||||
|
||||
_vm->_gfx->copyScreen(Gfx::kBitFront, Gfx::kBitBack);
|
||||
_vm->_gfx->copyScreen(Gfx::kBitFront, Gfx::kBit2);
|
||||
_vm->_gfx->updateScreen();
|
||||
waitUntilLeftClick();
|
||||
|
||||
strcpy(_vm->_location._name, "estgrotta.drki");
|
||||
@ -383,8 +382,7 @@ void _c_finito(void *parm) {
|
||||
_vm->_gfx->displayCenteredString(130, v6C[_language]);
|
||||
_vm->_gfx->displayCenteredString(160, v5C[_language]);
|
||||
|
||||
_vm->_gfx->copyScreen(Gfx::kBitFront, Gfx::kBitBack);
|
||||
_vm->_gfx->copyScreen(Gfx::kBitFront, Gfx::kBit2);
|
||||
_vm->_gfx->updateScreen();
|
||||
waitUntilLeftClick();
|
||||
|
||||
_vm->_menu->selectCharacter();
|
||||
|
@ -283,7 +283,7 @@ void Parallaction::runCommands(CommandList& list, Zone *z) {
|
||||
if (u->_zone != NULL) {
|
||||
u->_zone->_flags &= ~kFlagsRemove;
|
||||
u->_zone->_flags |= kFlagsActive;
|
||||
if ((u->_zone->_type & 0xFFFF) == kZoneGet) {
|
||||
if (u->_zone->type() == kZoneGet) {
|
||||
addJob(&jobDisplayDroppedItem, u->_zone, kPriority17 );
|
||||
}
|
||||
}
|
||||
|
@ -561,7 +561,7 @@ Parallaction::InputData *Parallaction::translateInput() {
|
||||
return &_input;
|
||||
}
|
||||
|
||||
if (((_mouseButtons == kMouseLeftUp) && (_activeItem._id == 0) && ((_engineFlags & kEngineWalking) == 0)) && ((z == NULL) || ((z->_type & 0xFFFF) != kZoneCommand))) {
|
||||
if (((_mouseButtons == kMouseLeftUp) && (_activeItem._id == 0) && ((_engineFlags & kEngineWalking) == 0)) && ((z == NULL) || (z->type() != kZoneCommand))) {
|
||||
_input._event = kEvWalk;
|
||||
return &_input;
|
||||
}
|
||||
@ -584,7 +584,7 @@ Parallaction::InputData *Parallaction::translateInput() {
|
||||
return &_input;
|
||||
}
|
||||
|
||||
if ((_mouseButtons == kMouseLeftUp) && ((_activeItem._id != 0) || ((z->_type & 0xFFFF) == kZoneCommand))) {
|
||||
if ((_mouseButtons == kMouseLeftUp) && ((_activeItem._id != 0) || (z->type() == kZoneCommand))) {
|
||||
|
||||
_input._zone = z;
|
||||
if (z->_flags & kFlagsNoWalk) {
|
||||
|
@ -121,8 +121,8 @@ void Parallaction::freeZones() {
|
||||
// but we need to check it separately here. The same workaround is applied in hitZone.
|
||||
if (((z->_top == -1) ||
|
||||
((z->_left == -2) && (
|
||||
(((z->_type & 0xFFFF) == kZoneMerge) && ((isItemInInventory(MAKE_INVENTORY_ID(z->u.merge->_obj1)) != 0) || (isItemInInventory(MAKE_INVENTORY_ID(z->u.merge->_obj2)) != 0))) ||
|
||||
(((z->_type & 0xFFFF) == kZoneGet) && ((isItemInInventory(MAKE_INVENTORY_ID(z->u.get->_icon)) != 0)))
|
||||
((z->type() == kZoneMerge) && ((isItemInInventory(MAKE_INVENTORY_ID(z->u.merge->_obj1)) != 0) || (isItemInInventory(MAKE_INVENTORY_ID(z->u.merge->_obj2)) != 0))) ||
|
||||
((z->type() == kZoneGet) && ((isItemInInventory(MAKE_INVENTORY_ID(z->u.get->_icon)) != 0)))
|
||||
))) &&
|
||||
((_engineFlags & kEngineQuit) == 0)) {
|
||||
|
||||
@ -152,7 +152,7 @@ void Parallaction::parseZoneTypeBlock(Script &script, Zone *z) {
|
||||
|
||||
TypeData *u = &z->u;
|
||||
|
||||
switch (z->_type & 0xFFFF) {
|
||||
switch (z->type()) {
|
||||
case kZoneExamine: // examine Zone alloc
|
||||
u->examine = new ExamineData;
|
||||
break;
|
||||
@ -185,7 +185,7 @@ void Parallaction::parseZoneTypeBlock(Script &script, Zone *z) {
|
||||
|
||||
do {
|
||||
|
||||
switch (z->_type & 0xFFFF) {
|
||||
switch (z->type()) {
|
||||
case kZoneExamine: // examine Zone init
|
||||
if (!scumm_stricmp(_tokens[0], "file")) {
|
||||
u->examine->_filename = (char*)malloc(strlen(_tokens[1])+1);
|
||||
@ -374,10 +374,8 @@ void Parallaction::displayItemComment(ExamineData *data) {
|
||||
uint16 Parallaction::runZone(Zone *z) {
|
||||
debugC(3, kDebugLocation, "runZone (%s)", z->_label._text);
|
||||
|
||||
uint16 subtype = z->_type & 0xFFFF;
|
||||
|
||||
debugC(3, kDebugLocation, "type = %x, object = %x", subtype, (z->_type & 0xFFFF0000) >> 16);
|
||||
switch(subtype) {
|
||||
debugC(3, kDebugLocation, "type = %x, id = %x",z->type(), z->boundId() >> 16);
|
||||
switch(z->type()) {
|
||||
|
||||
case kZoneExamine:
|
||||
if (z->u.examine->_filename) {
|
||||
@ -544,15 +542,15 @@ Zone *Parallaction::hitZone(uint32 type, uint16 x, uint16 y) {
|
||||
// WORKAROUND: this huge condition is needed because we made TypeData a collection of structs
|
||||
// instead of an union. So, merge->_obj1 and get->_icon were just aliases in the original engine,
|
||||
// but we need to check it separately here. The same workaround is applied in freeZones.
|
||||
if ((((z->_type & 0xFFFF) == kZoneMerge) && (((_si == z->u.merge->_obj1) && (_di == z->u.merge->_obj2)) || ((_si == z->u.merge->_obj2) && (_di == z->u.merge->_obj1)))) ||
|
||||
(((z->_type & 0xFFFF) == kZoneGet) && ((_si == z->u.get->_icon) || (_di == z->u.get->_icon)))) {
|
||||
if (((z->type() == kZoneMerge) && (((_si == z->u.merge->_obj1) && (_di == z->u.merge->_obj2)) || ((_si == z->u.merge->_obj2) && (_di == z->u.merge->_obj1)))) ||
|
||||
((z->type() == kZoneGet) && ((_si == z->u.get->_icon) || (_di == z->u.get->_icon)))) {
|
||||
|
||||
// special Zone
|
||||
if ((type == 0) && ((z->_type & 0xFFFF0000) == 0))
|
||||
if ((type == 0) && (z->boundId() == 0 == 0))
|
||||
return z;
|
||||
if (z->_type == type)
|
||||
return z;
|
||||
if ((z->_type & 0xFFFF0000) == type)
|
||||
if (z->boundId() == type)
|
||||
return z;
|
||||
|
||||
}
|
||||
@ -572,11 +570,11 @@ Zone *Parallaction::hitZone(uint32 type, uint16 x, uint16 y) {
|
||||
}
|
||||
|
||||
// normal Zone
|
||||
if ((type == 0) && ((z->_type & 0xFFFF0000) == 0))
|
||||
if ((type == 0) && (z->boundId() == 0))
|
||||
return z;
|
||||
if (z->_type == type)
|
||||
return z;
|
||||
if ((z->_type & 0xFFFF0000) == type)
|
||||
if (z->boundId() == type)
|
||||
return z;
|
||||
|
||||
}
|
||||
@ -592,8 +590,8 @@ Zone *Parallaction::hitZone(uint32 type, uint16 x, uint16 y) {
|
||||
_f = ((_di >= a->_top + a->height()) || (_di <= a->_top)) ? 0 : 1; // _f: vertical range
|
||||
|
||||
_b = ((type != 0) || (a->_type == kZoneYou)) ? 0 : 1; // _b: (no type specified) AND (Animation is not the character)
|
||||
_c = (a->_type & 0xFFFF0000) ? 0 : 1; // _c: Animation is not an object
|
||||
_d = ((a->_type & 0xFFFF0000) != type) ? 0 : 1; // _d: Animation is an object of the same type
|
||||
_c = (a->boundId()) ? 0 : 1; // _c: Animation is not an object
|
||||
_d = (a->boundId() != type) ? 0 : 1; // _d: Animation is an object of the same type
|
||||
|
||||
if ((_a != 0 && _e != 0 && _f != 0) && ((_b != 0 && _c != 0) || (a->_type == type) || (_d != 0))) {
|
||||
|
||||
@ -617,7 +615,7 @@ Zone::Zone() {
|
||||
Zone::~Zone() {
|
||||
// printf("~Zone(%s)\n", _label._text);
|
||||
|
||||
switch (_type & 0xFFFF) {
|
||||
switch (type()) {
|
||||
case kZoneExamine:
|
||||
free(u.examine->_filename);
|
||||
free(u.examine->_description);
|
||||
|
@ -48,7 +48,6 @@ enum ZoneTypes {
|
||||
kZoneCommand = 0x800
|
||||
};
|
||||
|
||||
|
||||
enum ZoneFlags {
|
||||
kFlagsClosed = 1, // Zone: door is closed / switch is off
|
||||
kFlagsActive = 2, // Zone/Animation: object is visible
|
||||
@ -64,7 +63,6 @@ enum ZoneFlags {
|
||||
kFlagsNoWalk = 0x800 // Zone: character doesn't need to walk towards object to interact
|
||||
};
|
||||
|
||||
|
||||
#define NUM_ANSWERS 5
|
||||
|
||||
struct Command;
|
||||
@ -214,6 +212,13 @@ struct Zone {
|
||||
void translate(int16 x, int16 y);
|
||||
virtual uint16 width() const;
|
||||
virtual uint16 height() const;
|
||||
|
||||
uint32 type() {
|
||||
return _type & 0xFFFF;
|
||||
}
|
||||
uint32 boundId() {
|
||||
return (_type & 0xFFFF0000);
|
||||
}
|
||||
};
|
||||
|
||||
typedef Zone* ZonePointer;
|
||||
|
Loading…
x
Reference in New Issue
Block a user