mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-04 17:29:11 +00:00
Cleanup
svn-id: r22289
This commit is contained in:
parent
2552f6e17e
commit
91a67d1150
@ -344,6 +344,9 @@ void SimonEngine::scrollScreen() {
|
||||
|
||||
_scrollY += _scrollFlag;
|
||||
vcWriteVar(250, _scrollY);
|
||||
|
||||
memcpy(_backBuf, _frontBuf, _screenWidth * _screenHeight);
|
||||
memcpy(_backGroundBuf, _backBuf, _screenHeight * _scrollWidth);
|
||||
} else {
|
||||
if (_scrollFlag < 0) {
|
||||
memmove(dst + 8, dst, _screenWidth * _scrollHeight - 8);
|
||||
@ -367,10 +370,10 @@ void SimonEngine::scrollScreen() {
|
||||
|
||||
_scrollX += _scrollFlag;
|
||||
vcWriteVar(251, _scrollX);
|
||||
}
|
||||
|
||||
memcpy(_backBuf, _frontBuf, _screenWidth * _screenHeight);
|
||||
memcpy(_backGroundBuf, _backBuf, _scrollHeight * _screenWidth);
|
||||
memcpy(_backBuf, _frontBuf, _screenWidth * _screenHeight);
|
||||
memcpy(_backGroundBuf, _backBuf, _scrollHeight * _screenWidth);
|
||||
}
|
||||
|
||||
_scrollFlag = 0;
|
||||
}
|
||||
|
@ -1187,7 +1187,7 @@ void SimonEngine::o_setDollar() {
|
||||
|
||||
void SimonEngine::o_isBox() {
|
||||
// 142: is hitarea 0x40 clear
|
||||
setScriptCondition(is_hitarea_0x40_clear(getVarOrWord()));
|
||||
setScriptCondition(isBoxDead(getVarOrWord()));
|
||||
}
|
||||
|
||||
void SimonEngine::o_doTable() {
|
||||
@ -1625,9 +1625,9 @@ void SimonEngine::o1_specialFade() {
|
||||
|
||||
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);
|
||||
paletteFadeOut((uint32 *)_videoBuf1, 32);
|
||||
paletteFadeOut((uint32 *)_videoBuf1 + 32 + 16, 144);
|
||||
paletteFadeOut((uint32 *)_videoBuf1 + 32 + 16 + 144 + 16, 48);
|
||||
|
||||
_system->setPalette(_videoBuf1, 0, 256);
|
||||
if (_fade)
|
||||
|
@ -344,7 +344,7 @@ void SimonEngine::listSaveGames(int n) {
|
||||
j--;
|
||||
}
|
||||
|
||||
if (!(in = _saveFileMan->openForLoading(gen_savename(j))))
|
||||
if (!(in = _saveFileMan->openForLoading(genSaveName(j))))
|
||||
break;
|
||||
in->read(b, 100);
|
||||
delete in;
|
||||
@ -376,7 +376,7 @@ void SimonEngine::saveUserGame(int slot) {
|
||||
window->textRow = (slot + 1 - window->scrollY) * 15;
|
||||
window->textColumn = 26;
|
||||
|
||||
if ((in = _saveFileMan->openForLoading(gen_savename(readVariable(55))))) {
|
||||
if ((in = _saveFileMan->openForLoading(genSaveName(readVariable(55))))) {
|
||||
in->read(name, 100);
|
||||
delete in;
|
||||
}
|
||||
|
@ -38,13 +38,13 @@ int SimonEngine::countSaveGames() {
|
||||
uint i = 1;
|
||||
bool marks[256];
|
||||
|
||||
char *prefix = gen_savename(999);
|
||||
char *prefix = genSaveName(999);
|
||||
prefix[strlen(prefix)-3] = '\0';
|
||||
_saveFileMan->listSavefiles(prefix, marks, 256);
|
||||
|
||||
while (i < 256) {
|
||||
if (marks[i] &&
|
||||
(f = _saveFileMan->openForLoading(gen_savename(i)))) {
|
||||
(f = _saveFileMan->openForLoading(genSaveName(i)))) {
|
||||
i++;
|
||||
delete f;
|
||||
} else
|
||||
@ -64,7 +64,7 @@ int SimonEngine::displaySaveGameList(int curpos, bool load, char *dst) {
|
||||
slot = curpos;
|
||||
|
||||
while (curpos + 6 > slot) {
|
||||
if (!(in = _saveFileMan->openForLoading(gen_savename(slot))))
|
||||
if (!(in = _saveFileMan->openForLoading(genSaveName(slot))))
|
||||
break;
|
||||
|
||||
in->read(dst, 18);
|
||||
@ -88,7 +88,7 @@ int SimonEngine::displaySaveGameList(int curpos, bool load, char *dst) {
|
||||
}
|
||||
} else {
|
||||
if (curpos + 6 == slot) {
|
||||
if ((in = _saveFileMan->openForLoading(gen_savename(slot)))) {
|
||||
if ((in = _saveFileMan->openForLoading(genSaveName(slot)))) {
|
||||
slot++;
|
||||
delete in;
|
||||
}
|
||||
@ -107,7 +107,7 @@ void SimonEngine::quickLoadOrSave() {
|
||||
bool success;
|
||||
char buf[50];
|
||||
|
||||
char *filename = gen_savename(_saveLoadSlot);
|
||||
char *filename = genSaveName(_saveLoadSlot);
|
||||
if (_saveLoadType == 2) {
|
||||
Subroutine *sub;
|
||||
success = loadGame(_saveLoadSlot);
|
||||
@ -486,7 +486,7 @@ bool SimonEngine::saveGame(uint slot, char *caption) {
|
||||
|
||||
_lockWord |= 0x100;
|
||||
|
||||
f = _saveFileMan->openForSaving(gen_savename(slot));
|
||||
f = _saveFileMan->openForSaving(genSaveName(slot));
|
||||
if (f == NULL) {
|
||||
_lockWord &= ~0x100;
|
||||
return false;
|
||||
@ -583,7 +583,7 @@ bool SimonEngine::saveGame(uint slot, char *caption) {
|
||||
return result;
|
||||
}
|
||||
|
||||
char *SimonEngine::gen_savename(int slot) {
|
||||
char *SimonEngine::genSaveName(int slot) {
|
||||
static char buf[15];
|
||||
|
||||
if (getGameType() == GType_FF) {
|
||||
@ -606,7 +606,7 @@ bool SimonEngine::loadGame(uint slot) {
|
||||
|
||||
_lockWord |= 0x100;
|
||||
|
||||
f = _saveFileMan->openForLoading(gen_savename(slot));
|
||||
f = _saveFileMan->openForLoading(genSaveName(slot));
|
||||
if (f == NULL) {
|
||||
_lockWord &= ~0x100;
|
||||
return false;
|
||||
|
@ -616,7 +616,7 @@ void SimonEngine::errorString(const char *buf1, char *buf2) {
|
||||
}
|
||||
}
|
||||
|
||||
void SimonEngine::palette_fadeout(uint32 *pal_values, uint num) {
|
||||
void SimonEngine::paletteFadeOut(uint32 *pal_values, uint num) {
|
||||
byte *p = (byte *)pal_values;
|
||||
|
||||
do {
|
||||
@ -1276,6 +1276,18 @@ void SimonEngine::loadZone(uint vga_res) {
|
||||
}
|
||||
}
|
||||
|
||||
void SimonEngine::setZoneBuffers() {
|
||||
byte *alloced;
|
||||
|
||||
alloced = (byte *)malloc(VGA_MEM_SIZE);
|
||||
|
||||
_vgaBufFreeStart = alloced;
|
||||
_vgaBufStart = alloced;
|
||||
_vgaFileBufOrg = alloced;
|
||||
_vgaFileBufOrg2 = alloced;
|
||||
_vgaBufEnd = alloced + VGA_MEM_SIZE;
|
||||
}
|
||||
|
||||
byte *SimonEngine::allocBlock(uint32 size) {
|
||||
byte *block, *blockEnd;
|
||||
|
||||
@ -1303,18 +1315,6 @@ byte *SimonEngine::allocBlock(uint32 size) {
|
||||
}
|
||||
}
|
||||
|
||||
void SimonEngine::setup_vga_file_buf_pointers() {
|
||||
byte *alloced;
|
||||
|
||||
alloced = (byte *)malloc(VGA_MEM_SIZE);
|
||||
|
||||
_vgaBufFreeStart = alloced;
|
||||
_vgaBufStart = alloced;
|
||||
_vgaFileBufOrg = alloced;
|
||||
_vgaFileBufOrg2 = alloced;
|
||||
_vgaBufEnd = alloced + VGA_MEM_SIZE;
|
||||
}
|
||||
|
||||
void SimonEngine::checkNoOverWrite(byte *end) {
|
||||
VgaPointersEntry *vpe;
|
||||
|
||||
@ -1726,42 +1726,6 @@ void SimonEngine::pause() {
|
||||
|
||||
}
|
||||
|
||||
void SimonEngine::video_toggle_colors(HitArea * ha, byte a, byte b, byte c, byte d) {
|
||||
byte *src, color;
|
||||
int w, h, i;
|
||||
|
||||
_lockWord |= 0x8000;
|
||||
src = getFrontBuf() + ha->y * _dxSurfacePitch + ha->x;
|
||||
|
||||
w = ha->width;
|
||||
h = ha->height;
|
||||
|
||||
// Works around bug in original Simon the Sorcerer 2
|
||||
// Animations continue in background when load/save dialog is open
|
||||
// often causing the savegame name highlighter to be cut short
|
||||
if (!(h > 0 && w > 0 && ha->x + w <= _screenWidth && ha->y + h <= _screenHeight)) {
|
||||
debug(1,"Invalid coordinates in video_toggle_colors (%d,%d,%d,%d)", ha->x, ha->y, ha->width, ha->height);
|
||||
_lockWord &= ~0x8000;
|
||||
return;
|
||||
}
|
||||
|
||||
do {
|
||||
for (i = 0; i != w; ++i) {
|
||||
color = src[i];
|
||||
if (a >= color && b < color) {
|
||||
if (c >= color)
|
||||
color += d;
|
||||
else
|
||||
color -= d;
|
||||
src[i] = color;
|
||||
}
|
||||
}
|
||||
src += _dxSurfacePitch;
|
||||
} while (--h);
|
||||
|
||||
_lockWord &= ~0x8000;
|
||||
}
|
||||
|
||||
void SimonEngine::loadSprite(uint windowNum, uint zoneNum, uint vgaSpriteId, uint x, uint y, uint palette) {
|
||||
VgaSprite *vsp;
|
||||
VgaPointersEntry *vpe;
|
||||
@ -1911,7 +1875,7 @@ int SimonEngine::go() {
|
||||
allocItemHeap();
|
||||
allocTablesHeap();
|
||||
|
||||
setup_vga_file_buf_pointers();
|
||||
setZoneBuffers();
|
||||
|
||||
_debugger = new Debugger(this);
|
||||
_moviePlay = new MoviePlayer(this, _mixer);
|
||||
|
@ -506,7 +506,7 @@ protected:
|
||||
void loadSound(uint sound, int pan, int vol, uint type);
|
||||
void loadVoice(uint speechId);
|
||||
|
||||
void palette_fadeout(uint32 *pal_values, uint num);
|
||||
void paletteFadeOut(uint32 *pal_values, uint num);
|
||||
|
||||
byte *allocateItem(uint size);
|
||||
byte *allocateTable(uint size);
|
||||
@ -581,13 +581,10 @@ protected:
|
||||
void stopAnimateSimon1(uint a);
|
||||
void stopAnimateSimon2(uint a, uint b);
|
||||
|
||||
void changeWindow(uint a);
|
||||
void closeWindow(uint a);
|
||||
|
||||
void enableBox(uint hitarea);
|
||||
void disableBox(uint hitarea);
|
||||
void moveBox(uint hitarea, int x, int y);
|
||||
bool is_hitarea_0x40_clear(uint hitarea);
|
||||
bool isBoxDead(uint hitarea);
|
||||
void undefineBox(uint hitarea);
|
||||
void defineBox(int id, int x, int y, int width, int height, int flags, int verb, Item *item_ptr);
|
||||
HitArea *findEmptyHitArea();
|
||||
@ -597,16 +594,14 @@ protected:
|
||||
void hitarea_leave(HitArea * ha, bool state = false);
|
||||
void leaveHitAreaById(uint hitarea_id);
|
||||
|
||||
void waitForSync(uint a);
|
||||
void skipSpeech();
|
||||
void sendSync(uint a);
|
||||
void freezeBottom();
|
||||
void killAllTimers();
|
||||
void waitForSync(uint a);
|
||||
|
||||
uint getOffsetOfChild2Param(SubObject *child, uint prop);
|
||||
void setTextColor(uint color);
|
||||
void scriptMouseOn();
|
||||
void scriptMouseOff();
|
||||
void freezeBottom();
|
||||
void unfreezeBottom();
|
||||
|
||||
TextLocation *getTextLocation(uint a);
|
||||
@ -648,6 +643,7 @@ protected:
|
||||
|
||||
void invokeTimeEvent(TimeEvent *te);
|
||||
bool kickoffTimeEvents();
|
||||
void killAllTimers();
|
||||
|
||||
void endCutscene();
|
||||
void runSubroutine101();
|
||||
@ -657,23 +653,23 @@ protected:
|
||||
void inventoryUp(WindowBlock *window);
|
||||
void inventoryDown(WindowBlock *window);
|
||||
|
||||
void resetNameWindow();
|
||||
void printVerbOf(uint hitarea_id);
|
||||
HitArea *findBox(uint hitarea_id);
|
||||
|
||||
void showActionString(const byte *string);
|
||||
void windowPutChar(WindowBlock *window, byte c, byte b = 0);
|
||||
void clearWindow(WindowBlock *window);
|
||||
void video_toggle_colors(HitArea * ha, byte a, byte b, byte c, byte d);
|
||||
|
||||
WindowBlock *openWindow(uint x, uint y, uint w, uint h, uint flags, uint fill_color, uint text_color);
|
||||
uint getWindowNum(WindowBlock *window);
|
||||
void clearWindow(WindowBlock *window);
|
||||
void changeWindow(uint a);
|
||||
void closeWindow(uint a);
|
||||
void windowPutChar(WindowBlock *window, byte c, byte b = 0);
|
||||
|
||||
HitArea *findBox(uint hitarea_id);
|
||||
void boxController(uint x, uint y, uint mode);
|
||||
void handleVerbClicked(uint verb);
|
||||
void clearName();
|
||||
void displayName(HitArea * ha);
|
||||
void resetNameWindow();
|
||||
void displayBoxStars();
|
||||
void hitarea_stuff();
|
||||
void invertBox(HitArea *ha, bool state);
|
||||
void invertBox_FF(HitArea *ha, bool state);
|
||||
void invertBox(HitArea * ha, byte a, byte b, byte c, byte d);
|
||||
|
||||
void handleMouseMoved();
|
||||
void pollMouseXY();
|
||||
@ -705,21 +701,22 @@ protected:
|
||||
void showmessage_helper_3(uint a, uint b);
|
||||
void showmessage_print_char(byte chr);
|
||||
|
||||
void handleVerbClicked(uint verb);
|
||||
|
||||
void set_video_mode_internal(uint16 mode, uint16 vga_res_id);
|
||||
|
||||
void loadZone(uint vga_res);
|
||||
|
||||
void loadSprite(uint windowNum, uint vga_res, uint vga_sprite_id, uint x, uint y, uint palette);
|
||||
void playSpeech(uint speech_id, uint vga_sprite_id);
|
||||
WindowBlock *openWindow(uint x, uint y, uint w, uint h, uint flags, uint fill_color, uint text_color);
|
||||
void skipSpeech();
|
||||
|
||||
bool printTextOf(uint a, uint x, uint y);
|
||||
bool printNameOf(Item *item, uint x, uint y);
|
||||
void printInteractText(uint16 num, const char *string);
|
||||
void sendInteractText(uint16 num, const char *fmt, ...);
|
||||
bool printTextOf(uint a, uint x, uint y);
|
||||
void printVerbOf(uint hitarea_id);
|
||||
void showActionString(const byte *string);
|
||||
|
||||
void printScreenText(uint vga_sprite_id, uint color, const char *string_ptr, int16 x, int16 y, int16 width);
|
||||
void sendInteractText(uint16 num, const char *fmt, ...);
|
||||
void printInteractText(uint16 num, const char *string);
|
||||
|
||||
void renderStringAmiga(uint vga_sprite_id, uint color, uint width, uint height, const char *txt);
|
||||
void renderString(uint vga_sprite_id, uint color, uint width, uint height, const char *txt);
|
||||
@ -729,8 +726,7 @@ protected:
|
||||
void checkRunningAnims(byte *end);
|
||||
void checkAnims(uint a, byte *end);
|
||||
void checkZonePtrs(byte *end);
|
||||
|
||||
void setup_vga_file_buf_pointers();
|
||||
void setZoneBuffers();
|
||||
|
||||
void runVgaScript();
|
||||
|
||||
@ -1152,9 +1148,7 @@ protected:
|
||||
int countSaveGames();
|
||||
int displaySaveGameList(int curpos, bool load, char *dst);
|
||||
|
||||
void show_it(void *buf);
|
||||
|
||||
char *gen_savename(int slot);
|
||||
char *genSaveName(int slot);
|
||||
};
|
||||
|
||||
} // End of namespace Simon
|
||||
|
@ -443,7 +443,7 @@ void SimonEngine::undefineBox(uint hitarea) {
|
||||
}
|
||||
}
|
||||
|
||||
bool SimonEngine::is_hitarea_0x40_clear(uint hitarea) {
|
||||
bool SimonEngine::isBoxDead(uint hitarea) {
|
||||
HitArea *ha = findBox(hitarea);
|
||||
if (ha == NULL)
|
||||
return false;
|
||||
@ -560,13 +560,13 @@ void SimonEngine::setVerb(HitArea *ha) {
|
||||
if (getGameType() == GType_SIMON1) {
|
||||
if (tmp != NULL) {
|
||||
tmp->flags |= kBFInvertTouch;
|
||||
video_toggle_colors(tmp, 0xd5, 0xd0, 0xd5, 0xA);
|
||||
invertBox(tmp, 213, 208, 213, 10);
|
||||
}
|
||||
|
||||
if (ha->flags & kBFBoxSelected)
|
||||
video_toggle_colors(ha, 0xda, 0xd5, 0xd5, 5);
|
||||
invertBox(ha, 218, 213, 213, 5);
|
||||
else
|
||||
video_toggle_colors(ha, 0xdf, 0xda, 0xda, 0xA);
|
||||
invertBox(ha, 223, 218, 218, 10);
|
||||
|
||||
ha->flags &= ~(kBFBoxSelected + kBFInvertTouch);
|
||||
} else {
|
||||
@ -581,11 +581,11 @@ void SimonEngine::setVerb(HitArea *ha) {
|
||||
|
||||
void SimonEngine::hitarea_leave(HitArea *ha, bool state) {
|
||||
if (getGameType() == GType_FF) {
|
||||
invertBox(ha, state);
|
||||
invertBox_FF(ha, state);
|
||||
} else if (getGameType() == GType_SIMON2) {
|
||||
video_toggle_colors(ha, 0xe7, 0xe5, 0xe6, 1);
|
||||
invertBox(ha, 231, 229, 230, 1);
|
||||
} else {
|
||||
video_toggle_colors(ha, 0xdf, 0xd5, 0xda, 5);
|
||||
invertBox(ha, 223, 213, 218, 5);
|
||||
}
|
||||
}
|
||||
|
||||
@ -601,7 +601,7 @@ void SimonEngine::checkUp(WindowBlock *window) {
|
||||
if (((_variableArray[31] - _variableArray[30]) == 40) && (_variableArray[31] > 52)) {
|
||||
k = (((_variableArray[31] / 52) - 2) % 3);
|
||||
j = k * 6;
|
||||
if (!is_hitarea_0x40_clear(j + 201)) {
|
||||
if (!isBoxDead(j + 201)) {
|
||||
uint index = getWindowNum(window);
|
||||
drawIconArray(index, window->iconPtr->itemRef, 0, window->iconPtr->classMask);
|
||||
loadSprite(4, 9, k + 34, 0, 0, 0);
|
||||
@ -610,7 +610,7 @@ void SimonEngine::checkUp(WindowBlock *window) {
|
||||
if ((_variableArray[31] - _variableArray[30]) == 76) {
|
||||
k = ((_variableArray[31] / 52) % 3);
|
||||
j = k * 6;
|
||||
if (is_hitarea_0x40_clear(j + 201)) {
|
||||
if (isBoxDead(j + 201)) {
|
||||
loadSprite(4, 9, k + 31, 0, 0, 0);
|
||||
undefineBox(j + 201);
|
||||
undefineBox(j + 202);
|
||||
@ -637,7 +637,7 @@ void SimonEngine::checkDown(WindowBlock *window) {
|
||||
if (((_variableArray[31] - _variableArray[30]) == 40) && (_variableArray[30] > 52)) {
|
||||
k = (((_variableArray[31] / 52) + 1) % 3);
|
||||
j = k * 6;
|
||||
if (is_hitarea_0x40_clear(j + 201)) {
|
||||
if (isBoxDead(j + 201)) {
|
||||
loadSprite(4, 9, k + 28, 0, 0, 0);
|
||||
undefineBox(j + 201);
|
||||
undefineBox(j + 202);
|
||||
@ -810,7 +810,7 @@ void SimonEngine::displayName(HitArea *ha) {
|
||||
_lastNameOn = ha;
|
||||
}
|
||||
|
||||
void SimonEngine::invertBox(HitArea *ha, bool state) {
|
||||
void SimonEngine::invertBox_FF(HitArea *ha, bool state) {
|
||||
if (getBitFlag(205) || getBitFlag(206)) {
|
||||
if (state != 0) {
|
||||
_mouseAnimMax = _oldMouseAnimMax;
|
||||
@ -853,4 +853,42 @@ void SimonEngine::invertBox(HitArea *ha, bool state) {
|
||||
}
|
||||
}
|
||||
|
||||
void SimonEngine::invertBox(HitArea * ha, byte a, byte b, byte c, byte d) {
|
||||
byte *src, color;
|
||||
int w, h, i;
|
||||
|
||||
_lockWord |= 0x8000;
|
||||
src = getFrontBuf() + ha->y * _dxSurfacePitch + ha->x;
|
||||
|
||||
_hitarea_unk_3 = true;
|
||||
|
||||
w = ha->width;
|
||||
h = ha->height;
|
||||
|
||||
// Works around bug in original Simon the Sorcerer 2
|
||||
// Animations continue in background when load/save dialog is open
|
||||
// often causing the savegame name highlighter to be cut short
|
||||
if (!(h > 0 && w > 0 && ha->x + w <= _screenWidth && ha->y + h <= _screenHeight)) {
|
||||
debug(1,"Invalid coordinates in invertBox (%d,%d,%d,%d)", ha->x, ha->y, ha->width, ha->height);
|
||||
_lockWord &= ~0x8000;
|
||||
return;
|
||||
}
|
||||
|
||||
do {
|
||||
for (i = 0; i != w; ++i) {
|
||||
color = src[i];
|
||||
if (a >= color && b < color) {
|
||||
if (c >= color)
|
||||
color += d;
|
||||
else
|
||||
color -= d;
|
||||
src[i] = color;
|
||||
}
|
||||
}
|
||||
src += _dxSurfacePitch;
|
||||
} while (--h);
|
||||
|
||||
_lockWord &= ~0x8000;
|
||||
}
|
||||
|
||||
} // End of namespace Simon
|
||||
|
@ -2217,7 +2217,7 @@ void SimonEngine::vc62_fastFadeOut() {
|
||||
|
||||
memcpy(_videoBuf1, _paletteBackup, _videoNumPalColors * 4);
|
||||
for (i = NUM_PALETTE_FADEOUT; i != 0; --i) {
|
||||
palette_fadeout((uint32 *)_videoBuf1, _videoNumPalColors);
|
||||
paletteFadeOut((uint32 *)_videoBuf1, _videoNumPalColors);
|
||||
_system->setPalette(_videoBuf1, 0, _videoNumPalColors);
|
||||
if (_fade)
|
||||
_system->updateScreen();
|
||||
|
Loading…
x
Reference in New Issue
Block a user