Merge fadeToBlack() into o1_specialFade() and cleanup

svn-id: r22214
This commit is contained in:
Travis Howell 2006-04-29 12:25:15 +00:00
parent 7e02709e7d
commit d9ed515f90
4 changed files with 56 additions and 61 deletions

View File

@ -1618,7 +1618,24 @@ void SimonEngine::o1_loadStrings() {
void SimonEngine::o1_specialFade() {
// 187: fade to black
fadeToBlack();
uint i;
memcpy(_videoBuf1, _paletteBackup, 1024);
i = NUM_PALETTE_FADEOUT;
do {
palette_fadeout((uint32 *)_videoBuf1, 32);
palette_fadeout((uint32 *)_videoBuf1 + 32 + 16, 144);
palette_fadeout((uint32 *)_videoBuf1 + 32 + 16 + 144 + 16, 48);
_system->setPalette(_videoBuf1, 0, 256);
if (_fade)
_system->updateScreen();
delay(5);
} while (--i);
memcpy(_paletteBackup, _videoBuf1, 1024);
memcpy(_palette, _videoBuf1, 1024);
}
// -----------------------------------------------------------------------

View File

@ -2337,27 +2337,6 @@ void SimonEngine::set_video_mode_internal(uint16 mode, uint16 vga_res_id) {
}
}
void SimonEngine::fadeToBlack() {
uint i;
memcpy(_videoBuf1, _paletteBackup, 1024);
i = NUM_PALETTE_FADEOUT;
do {
palette_fadeout((uint32 *)_videoBuf1, 32);
palette_fadeout((uint32 *)_videoBuf1 + 32 + 16, 144);
palette_fadeout((uint32 *)_videoBuf1 + 32 + 16 + 144 + 16, 48);
_system->setPalette(_videoBuf1, 0, 256);
if (_fade)
_system->updateScreen();
delay(5);
} while (--i);
memcpy(_paletteBackup, _videoBuf1, 1024);
memcpy(_palette, _videoBuf1, 1024);
}
void SimonEngine::addVgaEvent(uint16 num, const byte *code_ptr, uint16 cur_sprite, uint16 curZoneNum, int32 param) {
VgaTimerEntry *vte;
@ -2863,44 +2842,6 @@ void SimonEngine::timer_callback() {
}
}
bool SimonEngine::itemIsSiblingOf(uint16 a) {
Item *item;
CHECK_BOUNDS(a, _objectArray);
item = _objectArray[a];
if (item == NULL)
return true;
return me()->parent == item->parent;
}
bool SimonEngine::itemIsParentOf(uint16 a, uint16 b) {
Item *item_a, *item_b;
CHECK_BOUNDS(a, _objectArray);
CHECK_BOUNDS(b, _objectArray);
item_a = _objectArray[a];
item_b = _objectArray[b];
if (item_a == NULL || item_b == NULL)
return true;
return derefItem(item_a->parent) == item_b;
}
bool SimonEngine::vc_maybe_skip_proc_1(uint16 a, int16 b) {
Item *item;
CHECK_BOUNDS(a, _objectArray);
item = _objectArray[a];
if (item == NULL)
return true;
return item->state == b;
}
void SimonEngine::closeWindow(uint a) {
if (_windowArray[a] == NULL)
return;

View File

@ -602,7 +602,6 @@ protected:
void scriptMouseOn();
void scriptMouseOff();
void unfreezeBottom();
void fadeToBlack();
TextLocation *getTextLocation(uint a);
void setup_cond_c_helper();

View File

@ -152,6 +152,44 @@ void SimonEngine::runVgaScript() {
}
}
bool SimonEngine::itemIsSiblingOf(uint16 a) {
Item *item;
CHECK_BOUNDS(a, _objectArray);
item = _objectArray[a];
if (item == NULL)
return true;
return me()->parent == item->parent;
}
bool SimonEngine::itemIsParentOf(uint16 a, uint16 b) {
Item *item_a, *item_b;
CHECK_BOUNDS(a, _objectArray);
CHECK_BOUNDS(b, _objectArray);
item_a = _objectArray[a];
item_b = _objectArray[b];
if (item_a == NULL || item_b == NULL)
return true;
return derefItem(item_a->parent) == item_b;
}
bool SimonEngine::vc_maybe_skip_proc_1(uint16 a, int16 b) {
Item *item;
CHECK_BOUNDS(a, _objectArray);
item = _objectArray[a];
if (item == NULL)
return true;
return item->state == b;
}
int SimonEngine::vcReadVarOrWord() {
int16 var = vcReadNextWord();
if (var < 0)