[Scummvm-cvs-logs] SF.net SVN: scummvm: [22289] scummvm/trunk/engines/simon
kirben at users.sourceforge.net
kirben at users.sourceforge.net
Tue May 2 18:13:01 CEST 2006
Revision: 22289
Author: kirben
Date: 2006-05-02 18:11:50 -0700 (Tue, 02 May 2006)
ViewCVS: http://svn.sourceforge.net/scummvm/?rev=22289&view=rev
Log Message:
-----------
Cleanup
Modified Paths:
--------------
scummvm/trunk/engines/simon/draw.cpp
scummvm/trunk/engines/simon/items.cpp
scummvm/trunk/engines/simon/oracle.cpp
scummvm/trunk/engines/simon/saveload.cpp
scummvm/trunk/engines/simon/simon.cpp
scummvm/trunk/engines/simon/simon.h
scummvm/trunk/engines/simon/verb.cpp
scummvm/trunk/engines/simon/vga.cpp
Modified: scummvm/trunk/engines/simon/draw.cpp
===================================================================
--- scummvm/trunk/engines/simon/draw.cpp 2006-05-02 23:46:23 UTC (rev 22288)
+++ scummvm/trunk/engines/simon/draw.cpp 2006-05-03 01:11:50 UTC (rev 22289)
@@ -344,6 +344,9 @@
_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,11 +370,11 @@
_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;
}
Modified: scummvm/trunk/engines/simon/items.cpp
===================================================================
--- scummvm/trunk/engines/simon/items.cpp 2006-05-02 23:46:23 UTC (rev 22288)
+++ scummvm/trunk/engines/simon/items.cpp 2006-05-03 01:11:50 UTC (rev 22289)
@@ -1187,7 +1187,7 @@
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 @@
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)
Modified: scummvm/trunk/engines/simon/oracle.cpp
===================================================================
--- scummvm/trunk/engines/simon/oracle.cpp 2006-05-02 23:46:23 UTC (rev 22288)
+++ scummvm/trunk/engines/simon/oracle.cpp 2006-05-03 01:11:50 UTC (rev 22289)
@@ -344,7 +344,7 @@
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 @@
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;
}
Modified: scummvm/trunk/engines/simon/saveload.cpp
===================================================================
--- scummvm/trunk/engines/simon/saveload.cpp 2006-05-02 23:46:23 UTC (rev 22288)
+++ scummvm/trunk/engines/simon/saveload.cpp 2006-05-03 01:11:50 UTC (rev 22289)
@@ -38,13 +38,13 @@
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 @@
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 @@
}
} 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 @@
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 @@
_lockWord |= 0x100;
- f = _saveFileMan->openForSaving(gen_savename(slot));
+ f = _saveFileMan->openForSaving(genSaveName(slot));
if (f == NULL) {
_lockWord &= ~0x100;
return false;
@@ -583,7 +583,7 @@
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 @@
_lockWord |= 0x100;
- f = _saveFileMan->openForLoading(gen_savename(slot));
+ f = _saveFileMan->openForLoading(genSaveName(slot));
if (f == NULL) {
_lockWord &= ~0x100;
return false;
Modified: scummvm/trunk/engines/simon/simon.cpp
===================================================================
--- scummvm/trunk/engines/simon/simon.cpp 2006-05-02 23:46:23 UTC (rev 22288)
+++ scummvm/trunk/engines/simon/simon.cpp 2006-05-03 01:11:50 UTC (rev 22289)
@@ -616,7 +616,7 @@
}
}
-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::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 @@
}
}
-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::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 @@
allocItemHeap();
allocTablesHeap();
- setup_vga_file_buf_pointers();
+ setZoneBuffers();
_debugger = new Debugger(this);
_moviePlay = new MoviePlayer(this, _mixer);
Modified: scummvm/trunk/engines/simon/simon.h
===================================================================
--- scummvm/trunk/engines/simon/simon.h 2006-05-02 23:46:23 UTC (rev 22288)
+++ scummvm/trunk/engines/simon/simon.h 2006-05-03 01:11:50 UTC (rev 22289)
@@ -506,7 +506,7 @@
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 @@
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 @@
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 @@
void invokeTimeEvent(TimeEvent *te);
bool kickoffTimeEvents();
+ void killAllTimers();
void endCutscene();
void runSubroutine101();
@@ -657,23 +653,23 @@
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);
+ 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 video_toggle_colors(HitArea * ha, byte a, byte b, byte c, byte d);
+ void changeWindow(uint a);
+ void closeWindow(uint a);
+ void windowPutChar(WindowBlock *window, byte c, byte b = 0);
- uint getWindowNum(WindowBlock *window);
-
+ 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 @@
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,9 +726,8 @@
void checkRunningAnims(byte *end);
void checkAnims(uint a, byte *end);
void checkZonePtrs(byte *end);
+ void setZoneBuffers();
- void setup_vga_file_buf_pointers();
-
void runVgaScript();
public:
@@ -1152,9 +1148,7 @@
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
Modified: scummvm/trunk/engines/simon/verb.cpp
===================================================================
--- scummvm/trunk/engines/simon/verb.cpp 2006-05-02 23:46:23 UTC (rev 22288)
+++ scummvm/trunk/engines/simon/verb.cpp 2006-05-03 01:11:50 UTC (rev 22289)
@@ -443,7 +443,7 @@
}
}
-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 @@
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::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 @@
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 @@
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 @@
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 @@
_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, 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
Modified: scummvm/trunk/engines/simon/vga.cpp
===================================================================
--- scummvm/trunk/engines/simon/vga.cpp 2006-05-02 23:46:23 UTC (rev 22288)
+++ scummvm/trunk/engines/simon/vga.cpp 2006-05-03 01:11:50 UTC (rev 22289)
@@ -2217,7 +2217,7 @@
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();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list