[Scummvm-git-logs] scummvm master -> 872ecc438e10e6d46c8b513feb8327434e7eeefb
sev-
noreply at scummvm.org
Mon Sep 8 14:51:23 UTC 2025
This automated email contains information about 120 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
c2dac529c7 TOT: Engine start
5c49d4deb1 TOT: Fixes list trackers with the right type
2a6e701f96 TOT: Fixes bug with pot jar
6b26302475 TOT: Fixes issue with pedestal items
02d03c8ff8 TOT: Restore music
8036fff971 TOT: Fixes credit screen
f0ba758468 TOT: Fixes encoding of special chars
a673e4f07b TOT: Fixes palette issues and sound with TV
3f688ebd80 TOT: Fixes secondanimation positioning
b176b6fa56 TOT: Fixes positioning of Jacob before endgame
465e1ac94b TOT: Fixes palette issues on FLC anims
f78cd95152 TOT: Fixes fade in to red color in sacrifice scene
e6c74942b0 TOT: Fixes fountain pixels overlapping interface
4f55719fd5 TOT: Fixes alcove animations
a814cf7b0f TOT: Implements sound menu (with no effect yet)
08a8d903da TOT: Implements sound volume changes
84acb764f4 TOT: Consolidates graphics functions
dddcc2c4fa TOT: Fixes palette issue on part 2 of the game
3e7f4a1247 TOT: Implements missing effect 11
ed259e7300 TOT: Adds a common clock for effects
f2e8a62c6c TOT: Autosave when the original game does it
66f2808da6 TOT: Fix exiting the game during conversations
d646b6dfac TOT: Implements resume game
fde9ba1a99 TOT: Maps error codes to original description
21953a315c TOT: Maps remaining errors
72d6c49ad2 TOT: Fixes error when saving rooms
ee117dabc6 TOT: Continues palette animations in FLCs
b92670b2b1 TOT: Cleans up unused vars
9f388196f4 TOT: Restore the game starting on first part
25628ca716 TOT: Change boolean's for bool's
6df0fd7336 TOT: Moves debug methods into console commands
b08262afa6 TOT: Refactors hardcoded text to be translatable
f9301e3f4e TOT: Clears pointers upon exit
f9e7bd9dc0 TOT: Restricts savegames in cutscenes
0f008a393f TOT: Adds preliminary support for English
4afd17a621 TOT: Adds offsets for English version FLCs
d5a5d52419 TOT: Fixes conversations breaking in English version
ab3d9e2841 TOT: Play intro automatically on the first run
58e7cc1962 TOT: Implements English intro
6662321cb1 TOT: Implements English interlude and ending
f8334ed516 TOT: Fixes odd delay on menu animation
958cec5732 TOT: Fixes code with latest PCSpeaker changes
b450f816ea TOT: Uses custom FM patches
5f0369d014 TOT: Sound and graphics cleanup
3fee3e19a6 TOT: Mouse cleanup
ae919ffc07 TOT: Cleanup sound manager
a69d30964c TOT: Cleanup of graphics
2b4a9489ef TOT: Cleanup of global vars
17dd611f4d TOT: Extra cleanup of global variables
598883d88c TOT: Merge texts and offsets into statics
6227954cb7 TOT: Fixes diploma saving & chrono adjustments
1e9785c9ff TOT: Fixes bug when freeing animation pointers
26803025a3 TOT: Additional cleanup of graphics
0df576285f TOT: Merges game and tot source files
93b9a54496 TOT: Remove global vars from
2ad357ff17 TOT: Refactor midi fade in/out
efbec6bcb4 TOT: Renames initialization functions
4643050ab3 TOT: Remove global variables on animations
f2ba02a0cf TOT: Remove global vars on dialogue
8a7828563c TOT: Remove remaining warnings
ae527dc4da TOT: Extra cleanup
90de7190aa TOT: Replace custom linkedlist for Common::List
a2da43994d TOT: Fixes crash on starting new game
aec89256ed TOT: Improve detection
21587a41dc TOT: Fixes timing issues with FLICs
df05df6886 TOT: Fixes crash when exiting from main menu
faf55f8c26 TOT: Improve naming
5c38724e73 TOT: Allow speed changes from FLIs
21dc9d0b9e TOT: Rework transition effects
3efffbbaf8 TOT: Disable enforcement of a given effect
ede6df991a TOT: Adds option to disable transitions
1ca66ecb1a TOT: Remove unnecessary logs
70f6f3b89c TOT: Remove unnecessary files
bacb530485 TOT: Fixes crash when loading from main menu
a41fc929e3 TOT: Fixes occasional error due to GamePart not being initialized
e979d4065b TOT: moves file reading into resources.cpp
3787be797f TOT: Fixes issue with game crashing on start
58911b4d16 TOT: Fixes glitch with inputting 8+ name
71a4c8db8b TOT: Make dirty areas into class members
4f0613b5a0 TOT: Fixes glitch when restarting from part 2
bec8294e00 TOT: Fixes crash when loading
95783adf98 TOT: Fixes dirty rect calculation on FLICs
3084eede9f TOT: Fixes timing issues with FLIs
006e8134ec TOT: Fixes printing of name in diploma
9ba70d6989 TOT: Removes gitignore
99f47964c6 TOT: Initializes variables for Windows compiler
e9138bd885 TOT: Seeking issues on Windows
0f047dbfae TOT: Remove global vars from Chrono
43053ed45d TOT: Gives all engine vars an initial value
f2cddc9d91 TOT: Removes pointer to reference in credits
de98ec80b7 TOT: Replaces usage of NULL for nullptr
ab37711636 TOT: Adds translation to POTFILES
eec084d54e TOT: Creates localization helper functions
4a102eeeac TOT: Passes strings by ref when possible
aa4d99a30d TOT: Changes to safe types
0f1bab1dc8 TOT: Formatting & cosmetics
24980a2bef TOT: Add engine credits
ccd40000a8 TOT: Properly initialize resource pointers
8b0ee82daa GRAPHICS: FONTS: Add support for Borland BGI fonts
107abe9138 TOT: Switch to BGI to graphics/fonts
2c1ccc22c3 GRAPHICS: FONTS: Adds DosFont as a Renderable font
22fe69465a TOT: Switch DosFont to fonts/dosfont
4f46c115d0 TOT: Turns all fonts into pointers
8c325d03a9 TOT: Move save/load into the right file
74b39b302f TOT: Adds EXE to detection
80601dd7b6 TOT: Error messages in English
63801e6efd TOT: Cleanup of includes
34e6212255 TOT: Adds string in saveload to translatables
3a2479aedd TOT: Remove unused Random function
21adf5fadc TOT: Changes key events to EVENT_KEYDOWN
d21d63ea54 TOT: fix palette indices on sacrifice scene
d3c4b7bff7 TOT: Renames Random function
a1f764d24e TOT: Original save/load screen
c09bf646a0 TOT: Cleanup original save screen
c2f6695078 TOT: Implements copy protection
d36873c018 TOT: Fixes audio with PCSpeaker
68c9d97592 TOT: Enhance save pattern selection
075835aaf5 TOT: Make fonts ready for 16 & 32 bpp
c2fca28a46 TOT: Use PCSpeaker rather than PCSpeakerStream
872ecc438e GRAPHICS: FONT: Add tot to BGIFont headers
Commit: c2dac529c77b9b1c47ebd0be43e5ef727310708c
https://github.com/scummvm/scummvm/commit/c2dac529c77b9b1c47ebd0be43e5ef727310708c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-09-08T16:49:45+02:00
Commit Message:
TOT: Engine start
Changed paths:
A engines/tot/.gitignore
A engines/tot/POTFILES
A engines/tot/anims.cpp
A engines/tot/anims.h
A engines/tot/chrono.cpp
A engines/tot/chrono.h
A engines/tot/configure.engine
A engines/tot/console.cpp
A engines/tot/console.h
A engines/tot/credits.pl
A engines/tot/decoder/TotFlicDecoder.cpp
A engines/tot/decoder/TotFlicDecoder.h
A engines/tot/detection.cpp
A engines/tot/detection.h
A engines/tot/detection_tables.h
A engines/tot/dialog.cpp
A engines/tot/dialog.h
A engines/tot/font/bgifont.cpp
A engines/tot/font/bgifont.h
A engines/tot/font/biosfont.cpp
A engines/tot/font/biosfont.h
A engines/tot/forest.cpp
A engines/tot/forest.h
A engines/tot/game.cpp
A engines/tot/graphics.cpp
A engines/tot/graphics.h
A engines/tot/graphman.cpp
A engines/tot/graphman.h
A engines/tot/metaengine.cpp
A engines/tot/metaengine.h
A engines/tot/module.mk
A engines/tot/mouse.cpp
A engines/tot/mouse.h
A engines/tot/mouseman.cpp
A engines/tot/mouseman.h
A engines/tot/playanim.cpp
A engines/tot/playanim.h
A engines/tot/routines.cpp
A engines/tot/routines.h
A engines/tot/routines2.cpp
A engines/tot/routines2.h
A engines/tot/saveload.cpp
A engines/tot/sound.cpp
A engines/tot/sound.h
A engines/tot/soundman.cpp
A engines/tot/soundman.h
A engines/tot/tot.cpp
A engines/tot/tot.h
A engines/tot/util.cpp
A engines/tot/util.h
diff --git a/engines/tot/.gitignore b/engines/tot/.gitignore
new file mode 100644
index 00000000000..d9720be462c
--- /dev/null
+++ b/engines/tot/.gitignore
@@ -0,0 +1,4 @@
+.vscode/
+*.o
+.deps
+*.a
diff --git a/engines/tot/POTFILES b/engines/tot/POTFILES
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/engines/tot/anims.cpp b/engines/tot/anims.cpp
new file mode 100644
index 00000000000..6a053592cd5
--- /dev/null
+++ b/engines/tot/anims.cpp
@@ -0,0 +1,771 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/debug.h"
+#include "common/events.h"
+#include "common/file.h"
+#include "common/substream.h"
+#include "common/system.h"
+#include "common/textconsole.h"
+#include "graphics/paletteman.h"
+
+#include "tot/decoder/TotFlicDecoder.h"
+#include "tot/anims.h"
+#include "tot/graphics.h"
+#include "tot/playanim.h"
+#include "tot/tot.h"
+
+namespace Tot {
+
+const int sizefrase = 320 * 30 + 4;
+
+int32 posflicfile;
+uint numerovuelta, posrelfli;
+byte *punterofondofrase = (byte *)malloc(sizefrase);
+byte framecontador;
+boolean primeravuelta;
+
+palette palpasoflic;
+
+void drawText(uint xfrase, uint yfrase, Common::String str1, Common::String str2, Common::String str3, Common::String str4, Common::String str5, byte colorfrase, byte colorborde) {
+
+ outtextxy(xfrase, (yfrase + 3), str1, colorborde);
+ outtextxy(xfrase, (yfrase + 13), str2, colorborde);
+ outtextxy(xfrase, (yfrase + 23), str3, colorborde);
+ outtextxy(xfrase, (yfrase + 33), str4, colorborde);
+ outtextxy(xfrase, (yfrase + 43), str5, colorborde);
+ g_engine->_screen->update();
+ delay(enforcedTextAnimDelay);
+ outtextxy(xfrase, (yfrase + 1), str1, colorborde);
+ outtextxy(xfrase, (yfrase + 11), str2, colorborde);
+ outtextxy(xfrase, (yfrase + 21), str3, colorborde);
+ outtextxy(xfrase, (yfrase + 31), str4, colorborde);
+ outtextxy(xfrase, (yfrase + 41), str5, colorborde);
+ g_engine->_screen->update();
+ delay(enforcedTextAnimDelay);
+ outtextxy(xfrase + 1, (yfrase + 2), str1, colorborde);
+ outtextxy(xfrase + 1, (yfrase + 12), str2, colorborde);
+ outtextxy(xfrase + 1, (yfrase + 22), str3, colorborde);
+ outtextxy(xfrase + 1, (yfrase + 32), str4, colorborde);
+ outtextxy(xfrase + 1, (yfrase + 42), str5, colorborde);
+ g_engine->_screen->update();
+ delay(enforcedTextAnimDelay);
+ outtextxy(xfrase - 1, (yfrase + 2), str1, colorborde);
+ outtextxy(xfrase - 1, (yfrase + 12), str2, colorborde);
+ outtextxy(xfrase - 1, (yfrase + 22), str3, colorborde);
+ outtextxy(xfrase - 1, (yfrase + 32), str4, colorborde);
+ outtextxy(xfrase - 1, (yfrase + 42), str5, colorborde);
+ g_engine->_screen->update();
+ delay(enforcedTextAnimDelay);
+ outtextxy(xfrase, (yfrase + 2), str1, colorfrase);
+ outtextxy(xfrase, (yfrase + 12), str2, colorfrase);
+ outtextxy(xfrase, (yfrase + 22), str3, colorfrase);
+ outtextxy(xfrase, (yfrase + 32), str4, colorfrase);
+ outtextxy(xfrase, (yfrase + 42), str5, colorfrase);
+ g_engine->_screen->update();
+}
+
+void removeText(uint xfrase1, uint yfrase1, uint xfrase2, uint yfrase2, byte colorrelleno) {
+ for (int j = yfrase1; j < yfrase2; j++) {
+ for (int i = xfrase1; i < xfrase2; i++) {
+ *((byte *)g_engine->_screen->getBasePtr(i, j)) = 0;
+ }
+ }
+ g_engine->_screen->addDirtyRect(Common::Rect(xfrase1, yfrase1, xfrase2, yfrase2));
+}
+
+void handleFlcEvent(byte numero_del_evento) {
+ switch (numero_del_evento) {
+ case 0:
+ if (contadorpc > 103)
+ error("handleFlcEvent(): ioresult! (274)");
+ break;
+ case 1:
+ if (framecontador == 3)
+
+ switch (numerovuelta) {
+ case 2:
+ drawText(80, 0, "Las �ltimas encuestas realizadas",
+ "acerca de la siniestralidad en ",
+ "los transportes arrojan resultados",
+ "alentadores...", "", 253, 0);
+ break;
+ case 13:
+ removeText(80, 0, 319, 53, 0);
+ break;
+ case 14:
+ drawText(80, 0, "El cien por cien de los encuestados",
+ "declararon no haber sufrido nunca un",
+ "accidente mortal...", "", "", 253, 0);
+ break;
+ case 25:
+ removeText(80, 0, 319, 53, 0);
+ break;
+ case 26:
+ drawText(80, 0, "Es una noticia que nos anima a salir",
+ "de viaje con m�s seguridad.", "", "", "", 253, 0);
+ break;
+ case 35:
+ removeText(80, 0, 319, 53, 0);
+ break;
+ case 36:
+ drawText(2, 100, "��Por un tornillo!!...",
+ "Por un m�sero y simple",
+ "tornillo del tr�fugo",
+ "del trapecio...", "", 255, 0);
+ break;
+ case 47:
+ removeText(2, 100, 134, 199, 0);
+ break;
+ case 48:
+ drawText(2, 100, "Si lo hubiese apretado",
+ "bien, no estar�a ahora",
+ "sin trabajo...", "", "", 255, 0);
+ break;
+ case 59:
+ removeText(2, 100, 134, 199, 0);
+ break;
+ case 60:
+ drawText(80, 0, "��Noticia de �ltima hora!!", "", "", "", "", 253, 0);
+ break;
+ case 63:
+ drawText(2, 100, "Llevo sin dormir toda",
+ "la noche, pensando qu�",
+ "voy a hacer.", "", "", 255, 0);
+ break;
+ case 75:
+ removeText(2, 100, 135, 199, 0);
+ break;
+ case 76:
+ removeText(80, 0, 319, 53, 0);
+ break;
+ case 77:
+ drawText(2, 100, "Seguramente no podr�",
+ "encontrar trabajo en",
+ "mucho tiempo...",
+ "Aunque ponga mucha f�",
+ "la oficina de empleo.", 255, 0);
+ break;
+ case 89:
+ removeText(2, 100, 135, 199, 0);
+ break;
+ case 90:
+ drawText(2, 100, "Y para animarme m�s",
+ "todav�a, ma�ana noche",
+ "es HALLOWEEN...", "",
+ "Es que tengo la negra.", 255, 0);
+ break;
+ case 102:
+ removeText(2, 100, 135, 199, 0);
+ break;
+ case 103:
+ drawText(80, 0, "Grave accidente en TWELVE MOTORS...",
+ "un empleado olvid� apretar un tornillo",
+ "y media cadena de montaje ha quedado",
+ "para chatarra...",
+ "las p�rdidas se estiman cuantiosas...", 253, 0);
+ break;
+ case 120:
+ removeText(80, 0, 319, 53, 0);
+ break;
+ case 121:
+ drawText(80, 0, "No se descartan las acciones legales",
+ "contra ese inconsciente...", "", "", "", 253, 0);
+ break;
+ case 125:
+ drawText(2, 100, "�Dios mio!... hasta en",
+ "la televisi�n...",
+ "Seguro que hasta mi",
+ "perro encuentra curro",
+ "antes que yo...", 255, 0);
+ break;
+ case 135: {
+ removeText(80, 0, 319, 53, 0);
+ removeText(2, 100, 135, 199, 0);
+ } break;
+ }
+ break;
+ case 2:
+ switch (framecontador) {
+ case 1: {
+ removeText(2, 100, 135, 199, 0);
+ removeText(80, 0, 319, 53, 0);
+ } break;
+ case 7:
+ playVoc("MANDO", 142001, 11469);
+ break;
+ case 20:
+ drawText(2, 100, "�HORROR!...una factura", "", "", "", "", 255, 0);
+ break;
+ case 58: {
+ removeText(2, 100, 135, 199, 0);
+ drawText(2, 100, "�Oficina de empleo?...",
+ "�y para m�?...", "",
+ "�Se habr�n equivocado!", "", 255, 0);
+ } break;
+ case 74: {
+ delay(1500);
+ removeText(2, 100, 135, 199, 0);
+ drawText(2, 100, "�Tan pronto lograron",
+ "encontrarme trabajo?", "",
+ "Claro... antes de ver",
+ "las noticias...", 255, 0);
+ delay(4000);
+ removeText(2, 100, 135, 199, 0);
+ drawText(80, 0, "Estimado se�or: Nos dirigimos a",
+ "usted para comunicarle que su",
+ "solicitud n�:93435 fu� aceptada",
+ "y le hemos encontrado un puesto",
+ "de acuerdo con sus aptitudes...", 253, 0);
+ delay(7000);
+ removeText(80, 0, 319, 53, 0);
+ drawText(80, 0, "Deber� presentarse ma�ana, dia",
+ "31 de Octubre en la direcci�n",
+ "abajo indicada, para ocupar el",
+ "puesto de ENCARGADO GENERAL.", "", 253, 0);
+ delay(7000);
+ removeText(80, 0, 319, 53, 0);
+ drawText(80, 0, "Le adjuntamos las credenciales",
+ "de presentaci�n.",
+ "Deseando no verle por aqu� en",
+ "mucho tiempo se despide:",
+ " Leonor Scott.", 253, 0);
+ delay(7000);
+ removeText(80, 0, 319, 53, 0);
+ drawText(2, 100, "��Que ilu!! encargado",
+ "general... si ya me",
+ "lo decia mi madre...",
+ "<<nene tienes cara de",
+ "encargado general>>", 255, 0);
+ delay(6000);
+ removeText(2, 100, 135, 199, 0);
+ drawText(2, 100, "Tendr� que conseguir",
+ "ropa m�s de acuerdo",
+ "con mi nuevo cargo.", "",
+ "Manos a la obra...", 255, 0);
+ delay(6000);
+ } break;
+ }
+ break;
+ case 3:
+ switch (framecontador) {
+ case 15:
+ playVoc("FRENAZO", 165322, 15073);
+ break;
+ case 26:
+ delay(1000);
+ break;
+ case 43:
+ playVoc("PORTAZO", 434988, 932);
+ break;
+ case 60:
+ getImg(0, 0, 319, 29, punterofondofrase);
+ break;
+ }
+ break;
+ case 4:
+ if (framecontador == 3)
+ playVoc("TIMBRAZO", 423775, 11213);
+ break;
+ case 5:
+ if ((numerovuelta == 1) && (framecontador == 2)) {
+
+ delay(2000);
+ drawText(5, 1, "�V�yase!... no queremos vendedores...",
+ "y menos de planes de jubilaci�n.", "", "", "", 255, 249);
+ delay(3500);
+ putImg(0, 0, punterofondofrase);
+ drawText(5, 1, "No soy ning�n vendedor... me envia la oficina",
+ "de empleo... tenga mis credenciales.", "", "", "", 255, 0);
+ }
+ break;
+ case 6:
+ if ((numerovuelta == 1) && (framecontador == 3)) {
+ putImg(0, 0, punterofondofrase);
+ drawText(5, 1, "�Vaya! eres t�...llegas con retraso. Los ancianos est�n",
+ "esper�ndote en el sal�n. Debes cuidarlos muy bien.",
+ "", "", "", 255, 249);
+ }
+ break;
+ case 7:
+ if ((numerovuelta == 1) && (framecontador == 3)) {
+ putImg(0, 0, punterofondofrase);
+ drawText(5, 1, "Lo siento, no sab�a a que hora deb�a presentarme, en",
+ "la oficina de empleo no me lo dijeron.",
+ "", "", "", 255, 0);
+ }
+ break;
+ case 8:
+ if ((numerovuelta == 1) && (framecontador == 3)) {
+ putImg(0, 0, punterofondofrase);
+ drawText(5, 1, "Bueno... no importa... ya est�s aqu�.",
+ "Ese coche es tuyo �no?...", "", "", "", 255, 249);
+ }
+ break;
+ case 9:
+ if ((numerovuelta == 1) && (framecontador == 3)) {
+ putImg(0, 0, punterofondofrase);
+ drawText(5, 1, "Si... es precioso �verdad?...", "", "", "", "", 255, 0);
+ }
+ break;
+ case 10:
+ if ((numerovuelta == 1) && (framecontador == 3)) {
+ putImg(0, 0, punterofondofrase);
+ drawText(5, 1, "Vaya... 200 caballos... elevalunas el�ctricos... ",
+ "inyecci�n electr�nica, llantas de aleaci�n...",
+ "", "", "", 255, 249);
+ }
+ break;
+ case 11:
+ if ((numerovuelta == 1) && (framecontador == 3)) {
+ putImg(0, 0, punterofondofrase);
+ drawText(5, 1, "Pues si...", "", "", "", "", 255, 0);
+ }
+ break;
+ case 12:
+ if ((numerovuelta == 1) && (framecontador == 3)) {
+ putImg(0, 0, punterofondofrase);
+ drawText(5, 1, "Airbag... asientos envolventes... aire acondicionado",
+ "", "", "", "", 255, 249);
+ }
+ break;
+ case 13:
+ if ((numerovuelta == 1) && (framecontador == 3)) {
+ putImg(0, 0, punterofondofrase);
+ drawText(5, 1, "Es el m�s alto de la gama...", "", "", "", "", 255, 0);
+ }
+ break;
+ case 14:
+ if ((numerovuelta == 1) && (framecontador == 3)) {
+ putImg(0, 0, punterofondofrase);
+ drawText(5, 1, "ABS, equipo de m�sica con CD, estructura reforzada",
+ "indeformable, detector de radar...", "", "", "", 255, 249);
+ }
+ break;
+ case 15:
+ if ((numerovuelta == 1) && (framecontador == 3)) {
+ putImg(0, 0, punterofondofrase);
+ drawText(5, 1, "Parece que te gusta, �no?", "", "", "", "", 255, 0);
+ }
+ break;
+ case 16:
+ if ((numerovuelta == 1) && (framecontador == 3)) {
+ putImg(0, 0, punterofondofrase);
+ drawText(5, 1, "Bueno, no est� mal... pero... gracias de todos modos.",
+ "", "", "", "", 255, 249);
+ }
+ break;
+ case 17:
+ switch (framecontador) {
+ case 1:
+ putImg(0, 0, punterofondofrase);
+ break;
+ case 17:
+ delay(500);
+ break;
+ case 18:
+ playVoc("ACELERON", 30200, 42398);
+ break;
+ }
+ break;
+ case 18:
+ if ((numerovuelta == 1) && (framecontador == 3)) {
+ putImg(0, 0, punterofondofrase);
+ drawText(5, 1, "�Gracias?... �qu�?... �espera!... ese es mi coche...",
+ "", "", "", "", 255, 0);
+ }
+ break;
+ case 19:
+ if (framecontador == 1)
+ drawText(5, 121, "Toma una copita, te la has ganado...",
+ "", "", "", "", 253, 249);
+ break;
+ case 20:
+ switch (numerovuelta) {
+ case 1:
+ switch (framecontador) {
+ case 1:
+ getImg(0, 0, 319, 29, punterofondofrase);
+ break;
+ case 3:
+ drawText(15, 1, "�Donde estoy? ... �Qu� me ha pasado?",
+ "", "", "", "", 255, 0);
+ break;
+ }
+ break;
+ case 3:
+ switch (framecontador) {
+ case 1:
+ putImg(0, 0, punterofondofrase);
+ break;
+ case 3:
+ drawText(15, 1, "Tranquilizate, no est�s muerto...",
+ "Est�s tras la puerta de acero...", "", "", "", 230, 249);
+ break;
+ }
+ break;
+ case 6:
+ switch (framecontador) {
+ case 1:
+ putImg(0, 0, punterofondofrase);
+ break;
+ case 3:
+ drawText(15, 1, "Te necesitamos para encontrar a Jacob,",
+ "nuestro Gran Maestre.", "", "", "", 230, 249);
+ break;
+ }
+ break;
+ case 9:
+ switch (framecontador) {
+ case 1:
+ putImg(0, 0, punterofondofrase);
+ break;
+ case 3:
+ drawText(15, 1, "Hace unos dias se puso a estudiar el libro",
+ "que me diste y desapareci�...", "", "", "", 230, 249);
+ break;
+ }
+ break;
+ case 12:
+ switch (framecontador) {
+ case 1:
+ putImg(0, 0, punterofondofrase);
+ break;
+ case 3:
+ drawText(15, 1, Common::String("Creemos que realiz� un conjuro sin darse") + " cuenta...", "", "", "", "", 230, 249);
+ break;
+ }
+ break;
+ case 15:
+ switch (framecontador) {
+ case 1:
+ putImg(0, 0, punterofondofrase);
+ break;
+ case 3:
+ drawText(15, 1, "Por fortuna, pudimos ponernos en contacto",
+ "con �l, y nos dijo que est� en problemas...",
+ "", "", "", 230, 249);
+ break;
+ }
+ break;
+ case 18:
+ switch (framecontador) {
+ case 1:
+ putImg(0, 0, punterofondofrase);
+ break;
+ case 3:
+ drawText(15, 1, "Nos pidi� que envi�semos a alguien en su ayuda,",
+ "y TU eres el elegido...", "", "", "", 230, 249);
+ break;
+ }
+ break;
+ case 21:
+ switch (framecontador) {
+ case 1:
+ putImg(0, 0, punterofondofrase);
+ break;
+ case 3:
+ drawText(15, 1, "Para ir a las CAVERNAS ETERNAS debes morir...",
+ "Ning�n cuerpo con alma puede estar all�...", "", "", "", 230, 249);
+ break;
+ }
+ break;
+ case 24:
+ switch (framecontador) {
+ case 1:
+ putImg(0, 0, punterofondofrase);
+ break;
+ case 3:
+ drawText(15, 1, Common::String("Haremos un ritual para crear un v�nculo entre") + " tu", "cuerpo y tu alma, s�lo as� podr�s volver a la vida...",
+ "", "", "", 230, 249);
+ break;
+ }
+ break;
+ case 27:
+ switch (framecontador) {
+ case 1:
+ putImg(0, 0, punterofondofrase);
+ break;
+ case 3:
+ drawText(15, 1, Common::String("Si rescatas a Jacob, el v�nculo te traer�") + " de regreso...", "", "", "", "", 230, 249);
+ break;
+ }
+ break;
+ case 30:
+ switch (framecontador) {
+ case 1:
+ putImg(0, 0, punterofondofrase);
+ break;
+ case 3:
+ drawText(15, 1, "Ahora... �Prep�rate!... Ha llegado tu hora...",
+ "", "", "", "", 230, 249);
+ break;
+ }
+ break;
+ case 33:
+ if (framecontador == 17)
+ putImg(0, 0, punterofondofrase);
+ break;
+ }
+ break;
+ case 21:
+ switch (framecontador) {
+ case 1:
+ playVoc("TRIDEN", 409405, 14370);
+ break;
+ case 5:
+ playVoc("PUFF", 191183, 18001);
+ break;
+ }
+ break;
+ case 22:
+ if (framecontador == 24)
+ playVoc("PUFF", 191183, 18001);
+ break;
+ case 23:
+ switch (framecontador) {
+ case 8:
+ playVoc("AFILAR", 0, 6433);
+ break;
+ case 18:
+ pitavocmem();
+ break;
+ }
+ break;
+ case 24:
+ if (framecontador == 8)
+ playVoc("DECAPITA", 354269, 1509);
+ break;
+ case 25:
+ if (framecontador == 97)
+ playVoc("PUFF2", 209184, 14514);
+ break;
+ case 26:
+ switch (numerovuelta) {
+ case 1:
+ switch (framecontador) {
+ case 2:
+ getImg(0, 0, 319, 29, punterofondofrase);
+ break;
+ case 3:
+ drawText(65, 1, "�Gracias ILUSO!...", "", "", "", "", 253, 249);
+ break;
+ }
+ break;
+ case 2:
+ switch (framecontador) {
+ case 1:
+ putImg(0, 0, punterofondofrase);
+ break;
+ case 2:
+ drawText(65, 1, "Ahora tendr� un cuerpo nuevo y podr�",
+ "volver a la vida...", "", "", "", 253, 249);
+ break;
+ }
+ break;
+ case 5:
+ switch (framecontador) {
+ case 1:
+ putImg(0, 0, punterofondofrase);
+ break;
+ case 2:
+ drawText(65, 1, "Tu mientras tanto, puedes seguir en",
+ "las CAVERNAS ETERNAS...", "", "", "", 253, 249);
+ break;
+ }
+ break;
+ case 8:
+ switch (framecontador) {
+ case 1:
+ putImg(0, 0, punterofondofrase);
+ break;
+ case 2:
+ drawText(65, 1, "No te preocupes, seguro que nos mandan",
+ "otro encargado... JA,JA,JA...", "", "", "", 253, 249);
+ break;
+ }
+ break;
+ }
+ break;
+ case 27:
+ if (framecontador == 148)
+ playVoc("DECAPITA", 354269, 1509);
+ break;
+ }
+}
+
+void drawFlc(uint flicx, uint flicy, int32 posicionfli, uint loop,
+ byte veloc, byte numevento, boolean palcompleta, boolean permitesalida,
+ boolean doscientos, boolean &salidaflis);
+
+static void exitProcedure(boolean &salir_bucle, boolean &permitesalida) {
+
+ salir_bucle = false;
+ if (permitesalida) {
+ Common::Event e;
+ while (g_system->getEventManager()->pollEvent(e)) {
+ if (e.type == Common::EVENT_KEYDOWN || (e.type == Common::EVENT_LBUTTONUP)) {
+ salir_bucle = true;
+ debug("Exiting from exitProcedure!");
+ }
+ }
+ }
+}
+
+static fliheader readHeader(Common::File *file) {
+ fliheader headerfile;
+
+ headerfile.size = file->readSint32LE();
+ headerfile.magic = file->readSint16LE();
+ headerfile.frames = file->readSint16LE();
+ headerfile.width = file->readSint16LE();
+ headerfile.heigth = file->readSint16LE();
+ headerfile.depth = file->readSint16LE();
+ headerfile.flags = file->readSint16LE();
+ headerfile.speed = file->readSint32LE();
+ headerfile.reserved1 = file->readSint16LE();
+ headerfile.created = file->readSint32LE();
+ file->read(headerfile.creator, 4);
+ headerfile.updated = file->readSint32LE();
+ file->read(headerfile.updator, 4);
+ headerfile.aspectx = file->readSint16LE();
+ headerfile.aspecty = file->readSint16LE();
+ // Note: probably shouldnt just harcode 2 here
+ file->read(headerfile.reserved2, 19 * 2);
+ headerfile.ofsframe1 = file->readSint32LE();
+ headerfile.ofsframe2 = file->readSint32LE();
+ // Note: probably shouldnt just harcode 2 here
+ file->read(headerfile.reserved2, 20 * 2);
+ return headerfile;
+}
+
+static void loadFlc(
+ uint &loop,
+ boolean &permitesalida,
+ boolean &salidaflis,
+ byte &numevento,
+ boolean &palcompleta,
+ boolean &doscientos,
+ byte &veloc,
+ uint &flicx,
+ uint &flicy) {
+
+ framecontador = 0;
+ numerovuelta = 0;
+
+ Common::File animationsFile;
+ Common::String fileName;
+ if (loop == 60000)
+ fileName = "OBJGIRO.DAT";
+ else
+ fileName = "FILMS.DAT";
+
+ if (!animationsFile.open(Common::Path(fileName))) {
+ error("readFlcXms(): ioresult! (272)");
+ }
+ animationsFile.seek(posflicfile, SEEK_SET);
+ // Need to read header to get the total size of the FLIC file.
+ fliheader header = readHeader(&animationsFile);
+ Common::SeekableSubReadStream *thisFlic = new Common::SeekableSubReadStream(
+ &animationsFile,
+ posflicfile,
+ posflicfile + header.size);
+
+ TotFlicDecoder flic = TotFlicDecoder();
+ flic.loadStream(thisFlic);
+
+ flic.start();
+
+ do {
+ g_engine->_chrono->updateChrono();
+ numerovuelta++;
+ do {
+ g_engine->_chrono->updateChrono();
+ exitProcedure(salidaflis, permitesalida);
+ if (salidaflis) {
+ debug("Salidaflis!");
+ goto Lsalir_proc;
+ }
+ if (tocapintar){
+ framecontador++;
+ handleFlcEvent(numevento);
+ const Graphics::Surface *frame = flic.decodeNextFrame();
+ if (frame) {
+ Common::Rect boundingBox = Common::Rect(flicx, flicy, flicx + flic.getWidth() + 1, flicy + flic.getHeight() + 1);
+ g_engine->_graphics->blit(frame, boundingBox);
+
+ if (flic.hasDirtyPalette()) {
+ byte *palette = (byte *)flic.getPalette();
+ // game fixes background to 0
+ palette[0] = 0;
+ palette[1] = 0;
+ palette[2] = 0;
+ if (palcompleta) {
+ g_engine->_graphics->changePalette(g_engine->_graphics->getPalette(), palette);
+ } else {
+ int limit = doscientos ? 200 : 256;
+ g_engine->_graphics->setPalette(palette, limit);
+ }
+ }
+ tocapintar = false;
+ } else {
+ break;
+ }
+ }
+ g_system->delayMillis(10);
+ } while (!flic.endOfVideo() && !g_engine->shouldQuit());
+
+ if (flic.endOfVideo()) {
+ if (flic.isRewindable()) {
+ flic.rewind();
+ }
+ framecontador = 0;
+ primeravuelta = false;
+ }
+ g_system->delayMillis(10);
+ } while (numerovuelta <= loop && !g_engine->shouldQuit());
+ flic.stop();
+Lsalir_proc:
+ animationsFile.close();
+}
+
+void drawFlc(
+ uint flicx,
+ uint flicy,
+ int32 posicionfli,
+ uint loop,
+ byte veloc,
+ byte numevento,
+ boolean palcompleta,
+ boolean permitesalida,
+ boolean doscientos,
+ boolean &salidaflis) {
+
+ primeravuelta = true;
+ posflicfile = posicionfli;
+ posrelfli = flicx + flicy * 320;
+ // punterofondofrase = malloc(sizefrase);
+ loadFlc(loop, permitesalida, salidaflis, numevento, palcompleta, doscientos, veloc, flicx, flicy);
+ debug("Salida flis: %d", salidaflis);
+ // free(punterofondofrase);
+}
+
+} // End of namespace Tot
diff --git a/engines/tot/anims.h b/engines/tot/anims.h
new file mode 100644
index 00000000000..49b26bedc51
--- /dev/null
+++ b/engines/tot/anims.h
@@ -0,0 +1,60 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+#ifndef TOT_ANIMS_H
+#define TOT_ANIMS_H
+
+#include "common/scummsys.h"
+
+#include "tot/sound.h"
+
+namespace Tot {
+
+void drawFlc(uint flicx, uint flicy, int32 posicionfli, uint loop,
+ byte veloc, byte numevento, boolean palcompleta, boolean permitesalida,
+ boolean doscientos, boolean& salidaflis);
+
+/**
+ * Header of an Autodesk Animator FLIC file.
+ */
+struct fliheader {
+ int32 size; // file size
+ uint magic, // format id
+ frames, // number of animation frames
+ width, // anim width
+ heigth, // anim height
+ depth, // 8 bits per pixel
+ flags;
+ int32 speed; // time delay between frames
+ uint reserved1; // all set to zero
+ int32 created; // creation date in DOS format
+ byte creator[3]; // serial of creator program
+ int32 updated; // update date in DOS format
+ byte updator[3]; // serial of updating program
+ uint aspectx, // aspect ratio
+ aspecty; // aspect ratio
+ uint reserved2[19]; // all zeroes
+ int32 ofsframe1, // Offset to frame 1 (FLC only)
+ ofsframe2; // Offset to frame 2 (FLC only)
+ uint reserved3[20]; // All zeroes
+};
+
+} // End of namespace Tot
+#endif
diff --git a/engines/tot/chrono.cpp b/engines/tot/chrono.cpp
new file mode 100644
index 00000000000..e63aa2d396c
--- /dev/null
+++ b/engines/tot/chrono.cpp
@@ -0,0 +1,93 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/system.h"
+
+#include "tot/chrono.h"
+#include "tot/tot.h"
+
+namespace Tot {
+
+bool tocapintar = false;
+bool tocapintar2 = false;
+bool tocapintareffect = false;
+
+ChronoManager::ChronoManager(/* args */) : _lastTick(0), _lastDoubleTick(0) {
+}
+
+ChronoManager::~ChronoManager() {
+}
+
+void ChronoManager::updateChrono() {
+ uint32 currentTime = g_system->getMillis();
+
+ if ((currentTime - _lastTick) >= kFrameMs / _speedMultiplier) {
+ tocapintar = true;
+ tocapintarTick++;
+ if(tocapintarTick == kDoubleFrameMultiplier){
+ tocapintarTick = 0;
+ tocapintar2 = true;
+ }
+ else {
+ tocapintar2 = false;
+ }
+ _lastTick = currentTime;
+ } else {
+ tocapintar = false;
+ }
+
+ if ((currentTime - _lastTickEffect) >= kFrameEffectMs) {
+ tocapintareffect = true;
+ _lastTickEffect = currentTime;
+ }
+ else {
+ tocapintareffect = false;
+ }
+}
+
+bool ChronoManager::shouldPaintEffect(){
+ uint32 currentTime = g_system->getMillis();
+ uint32 diff = (currentTime - _lastTickEffect);
+ if (diff >= kFrameEffectMs){
+ _lastTickEffect = currentTime;
+ return true;
+ }
+ return false;
+}
+
+void Tot::ChronoManager::delay(int ms) {
+ if(ms > 10) {
+ debug("Starting delay of %d", ms);
+ }
+ uint32 delayStart = g_system->getMillis();
+ Common::Event e;
+ ms = ms / _speedMultiplier;
+ while ((g_system->getMillis() - delayStart) < ms && !g_engine->shouldQuit()) {
+ while (g_system->getEventManager()->pollEvent(e)) {
+ }
+ if(ms > 10) {
+ g_system->delayMillis(10);
+ }
+ g_engine->_screen->update();
+ }
+}
+
+} // End of namespace Tot
diff --git a/engines/tot/chrono.h b/engines/tot/chrono.h
new file mode 100644
index 00000000000..d3d9ba4df3e
--- /dev/null
+++ b/engines/tot/chrono.h
@@ -0,0 +1,56 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+#ifndef TOT_CHRONO_H
+#define TOT_CHRONO_H
+
+#include "common/scummsys.h"
+
+namespace Tot {
+
+/**
+ * Flags for animations
+ */
+extern bool tocapintar, tocapintar2, tocapintareffect;
+
+//Set to 30 for ease of dev
+const int kFrameMs = 30;
+// const int kFrameMs = 50;
+const int kDoubleFrameMultiplier = 3;
+const int kFrameEffectMs = 5;
+
+class ChronoManager {
+private:
+ uint32 _lastTick = 0;
+ uint32 _lastTickEffect = 0;
+ uint32 _lastDoubleTick = 0;
+ byte tocapintarTick = 0;
+
+public:
+ ChronoManager(/* args */);
+ ~ChronoManager();
+ void updateChrono();
+ void delay(int ms);
+ bool shouldPaintEffect();
+ byte _speedMultiplier = 1;
+};
+
+} // End of namespace Tot
+#endif
diff --git a/engines/tot/configure.engine b/engines/tot/configure.engine
new file mode 100644
index 00000000000..60afa8bad52
--- /dev/null
+++ b/engines/tot/configure.engine
@@ -0,0 +1,3 @@
+# This file is included from the main "configure" script
+# add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps]
+add_engine tot "Tot" no "" "" ""
diff --git a/engines/tot/console.cpp b/engines/tot/console.cpp
new file mode 100644
index 00000000000..3246036c695
--- /dev/null
+++ b/engines/tot/console.cpp
@@ -0,0 +1,38 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "tot/console.h"
+
+namespace Tot {
+
+Console::Console() : GUI::Debugger() {
+ registerCmd("test", WRAP_METHOD(Console, Cmd_test));
+}
+
+Console::~Console() {
+}
+
+bool Console::Cmd_test(int argc, const char **argv) {
+ debugPrintf("Test\n");
+ return true;
+}
+
+} // End of namespace Tot
diff --git a/engines/tot/console.h b/engines/tot/console.h
new file mode 100644
index 00000000000..69893a1ca4e
--- /dev/null
+++ b/engines/tot/console.h
@@ -0,0 +1,40 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef TOT_CONSOLE_H
+#define TOT_CONSOLE_H
+
+#include "gui/debugger.h"
+
+namespace Tot {
+
+class Console : public GUI::Debugger {
+private:
+ bool Cmd_test(int argc, const char **argv);
+public:
+ Console();
+ ~Console() override;
+};
+
+} // End of namespace Tot
+
+#endif // TOT_CONSOLE_H
diff --git a/engines/tot/credits.pl b/engines/tot/credits.pl
new file mode 100644
index 00000000000..e9c0c47ab04
--- /dev/null
+++ b/engines/tot/credits.pl
@@ -0,0 +1,3 @@
+begin_section("Tot");
+ add_person("Name 1", "Handle 1", "");
+end_section();
diff --git a/engines/tot/decoder/TotFlicDecoder.cpp b/engines/tot/decoder/TotFlicDecoder.cpp
new file mode 100644
index 00000000000..5043c7949d7
--- /dev/null
+++ b/engines/tot/decoder/TotFlicDecoder.cpp
@@ -0,0 +1,140 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+#include "common/stream.h"
+#include "graphics/surface.h"
+#include "video/flic_decoder.h"
+
+#include "tot/decoder/TotFlicDecoder.h"
+
+namespace Tot {
+
+#define FLI_SETPAL 4
+#define FLI_SS2 7
+#define FLI_BLACK 13
+#define FLI_BRUN 15
+#define FLI_COPY 16
+#define PSTAMP 18
+#define FLC_FILE_HEADER 0x2420
+
+bool TotFlicDecoder::loadStream(Common::SeekableReadStream *stream) {
+ close();
+
+ /* uint32 frameSize = */ stream->readUint32LE();
+ uint16 frameType = stream->readUint16LE();
+
+ // Check FLC magic number
+ if (frameType != FLC_FILE_HEADER) {
+ warning("FlicDecoder::loadStream(): attempted to load non-FLC data (type = 0x%04X)", frameType);
+ return false;
+ }
+
+ uint16 frameCount = stream->readUint16LE();
+ uint16 width = stream->readUint16LE();
+ uint16 height = stream->readUint16LE();
+ uint16 colorDepth = stream->readUint16LE();
+ if (colorDepth != 8) {
+ warning("FlicDecoder::loadStream(): attempted to load an FLC with a palette of color depth %d. Only 8-bit color palettes are supported", colorDepth);
+ return false;
+ }
+
+ addTrack(new TotVideoTrack(stream, frameCount, width, height));
+ return true;
+}
+
+TotFlicDecoder::TotVideoTrack::TotVideoTrack(Common::SeekableReadStream *stream, uint16 frameCount, uint16 width, uint16 height) : Video::FlicDecoder::FlicVideoTrack(stream, frameCount, width, height, true) {
+
+ readHeader();
+}
+
+TotFlicDecoder::TotVideoTrack::~TotVideoTrack() {
+}
+
+void TotFlicDecoder::TotVideoTrack::handleFrame() {
+ uint16 chunkCount = _fileStream->readUint16LE();
+ // Note: The overridden delay is a 16-bit integer (word), whereas the normal delay is a 32-bit integer (dword)
+ // the frame delay is the FLIC "speed", in milliseconds.
+ uint16 newFrameDelay = _fileStream->readUint16LE(); // "speed", in milliseconds
+ if (newFrameDelay > 0)
+ _frameDelay = newFrameDelay;
+
+ _fileStream->readUint16LE(); // reserved, always 0
+ uint16 newWidth = _fileStream->readUint16LE();
+ uint16 newHeight = _fileStream->readUint16LE();
+
+ if ((newWidth != 0) || (newHeight != 0)) {
+ if (newWidth == 0)
+ newWidth = _surface->w;
+ if (newHeight == 0)
+ newHeight = _surface->h;
+
+ _surface->free();
+ delete _surface;
+ _surface = new Graphics::Surface();
+ _surface->create(newWidth, newHeight, Graphics::PixelFormat::createFormatCLUT8());
+ }
+
+ // Read subchunks
+ for (uint32 i = 0; i < chunkCount; ++i) {
+ uint32 frameSize = _fileStream->readUint32LE();
+ uint16 frameType = _fileStream->readUint16LE();
+ uint8 *data;
+
+ if (frameType == FLI_COPY) {
+ // data seems to be in a different format for COPY chunks so we adjust for that
+ data = new uint8[frameSize - 4];
+ _fileStream->read(data, frameSize - 4);
+ } else {
+ data = new uint8[frameSize - 6];
+ _fileStream->read(data, frameSize - 6);
+ }
+
+ switch (frameType) {
+ case FLI_SETPAL:
+ unpackPalette(data);
+ _dirtyPalette = true;
+ break;
+ case FLI_SS2:
+ decodeDeltaFLC(data);
+ break;
+ case FLI_BLACK:
+ _surface->fillRect(Common::Rect(0, 0, getWidth(), getHeight()), 0);
+ _dirtyRects.clear();
+ _dirtyRects.push_back(Common::Rect(0, 0, getWidth(), getHeight()));
+ break;
+ case FLI_BRUN:
+ decodeByteRun(data);
+ break;
+ case FLI_COPY:
+ copyFrame(data);
+ break;
+ case PSTAMP:
+ /* PSTAMP - skip for now */
+ break;
+ default:
+ error("FlicDecoder::decodeNextFrame(): unknown subchunk type (type = 0x%02X)", frameType);
+ break;
+ }
+
+ delete[] data;
+ }
+}
+
+} // End of namespace Tot
diff --git a/engines/tot/decoder/TotFlicDecoder.h b/engines/tot/decoder/TotFlicDecoder.h
new file mode 100644
index 00000000000..de556aecf59
--- /dev/null
+++ b/engines/tot/decoder/TotFlicDecoder.h
@@ -0,0 +1,49 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef TOT_FLICDECODER_H
+#define TOT_FLICDECODER_H
+
+#include "video/flic_decoder.h"
+
+namespace Tot {
+
+class TotFlicDecoder : public Video::FlicDecoder {
+public:
+ TotFlicDecoder() : Video::FlicDecoder() {}
+ ~TotFlicDecoder() {}
+ bool loadStream(Common::SeekableReadStream *stream) override;
+
+private:
+ class TotVideoTrack : public Video::FlicDecoder::FlicVideoTrack {
+ public:
+ TotVideoTrack(Common::SeekableReadStream *stream, uint16 frameCount, uint16 width, uint16 height);
+ ~TotVideoTrack() override;
+
+ private:
+ void handleFrame() override;
+ };
+};
+
+} // End namespace Tot
+
+#endif
diff --git a/engines/tot/detection.cpp b/engines/tot/detection.cpp
new file mode 100644
index 00000000000..fe89f8a2a9e
--- /dev/null
+++ b/engines/tot/detection.cpp
@@ -0,0 +1,45 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "base/plugins.h"
+#include "common/config-manager.h"
+#include "common/file.h"
+#include "common/md5.h"
+#include "common/str-array.h"
+#include "common/translation.h"
+#include "common/util.h"
+#include "tot/detection.h"
+#include "tot/detection_tables.h"
+
+const DebugChannelDef TotMetaEngineDetection::debugFlagList[] = {
+ { Tot::kDebugGraphics, "Graphics", "Graphics debug level" },
+ { Tot::kDebugPath, "Path", "Pathfinding debug level" },
+ { Tot::kDebugFilePath, "FilePath", "File path debug level" },
+ { Tot::kDebugScan, "Scan", "Scan for unrecognised games" },
+ { Tot::kDebugScript, "Script", "Enable debug script dump" },
+ DEBUG_CHANNEL_END
+};
+
+TotMetaEngineDetection::TotMetaEngineDetection() : AdvancedMetaEngineDetection(
+ Tot::gameDescriptions, Tot::totGames) {
+}
+
+REGISTER_PLUGIN_STATIC(TOT_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, TotMetaEngineDetection);
diff --git a/engines/tot/detection.h b/engines/tot/detection.h
new file mode 100644
index 00000000000..362b9cf58cf
--- /dev/null
+++ b/engines/tot/detection.h
@@ -0,0 +1,69 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef TOT_DETECTION_H
+#define TOT_DETECTION_H
+
+#include "engines/advancedDetector.h"
+
+namespace Tot {
+
+enum TotDebugChannels {
+ kDebugGraphics = 1,
+ kDebugPath,
+ kDebugScan,
+ kDebugFilePath,
+ kDebugScript,
+};
+
+extern const PlainGameDescriptor totGames[];
+
+extern const ADGameDescription gameDescriptions[];
+
+#define GAMEOPTION_ORIGINAL_SAVELOAD GUIO_GAMEOPTIONS1
+
+} // End of namespace Tot
+
+class TotMetaEngineDetection : public AdvancedMetaEngineDetection<ADGameDescription> {
+ static const DebugChannelDef debugFlagList[];
+
+public:
+ TotMetaEngineDetection();
+ ~TotMetaEngineDetection() override {}
+
+ const char *getName() const override {
+ return "tot";
+ }
+
+ const char *getEngineName() const override {
+ return "Tot";
+ }
+
+ const char *getOriginalCopyright() const override {
+ return "Tot (C)";
+ }
+
+ const DebugChannelDef *getDebugChannels() const override {
+ return debugFlagList;
+ }
+};
+
+#endif // TOT_DETECTION_H
diff --git a/engines/tot/detection_tables.h b/engines/tot/detection_tables.h
new file mode 100644
index 00000000000..55de44d58f6
--- /dev/null
+++ b/engines/tot/detection_tables.h
@@ -0,0 +1,43 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace Tot {
+
+const PlainGameDescriptor totGames[] = {
+ { "tot", "Tot" },
+ { 0, 0 }
+};
+
+const ADGameDescription gameDescriptions[] = {
+ {
+ "tot",
+ nullptr,
+ AD_ENTRY1s("CREDITOS.DAT", "6885c1fadd25a0c0da1c88f071a30e63", 130080),
+ Common::EN_ANY,
+ Common::kPlatformDOS,
+ ADGF_UNSTABLE,
+ GUIO1(GUIO_NONE)
+ },
+
+ AD_TABLE_END_MARKER
+};
+
+} // End of namespace Tot
diff --git a/engines/tot/dialog.cpp b/engines/tot/dialog.cpp
new file mode 100644
index 00000000000..e70c29fde46
--- /dev/null
+++ b/engines/tot/dialog.cpp
@@ -0,0 +1,595 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#define __conversa_implementation__
+
+#include "common/scummsys.h"
+#include "common/textconsole.h"
+
+#include "tot/chrono.h"
+#include "tot/dialog.h"
+#include "tot/playanim.h"
+#include "tot/routines.h"
+#include "tot/routines2.h"
+#include "tot/tot.h"
+
+namespace Tot {
+
+byte conversationIndex;
+
+plista l1, l;
+Tree ar, auxTree, step;
+
+boolean endOfConversation;
+
+
+Common::String decrypt(Common::String tEncriptado) {
+ for (int i = 0; i < tEncriptado.size(); i++) {
+ debug("decrypting char = %c into %c", tEncriptado[i], encriptado[i] ^ tEncriptado[i]);
+ tEncriptado.setChar(encriptado[i] ^ (char)tEncriptado[i], i);
+ }
+ return tEncriptado;
+}
+
+void findDialogLine(byte persona);
+
+static void findDownwards(Tree paso, boolean &desciende) {
+ if (paso != NULL) {
+ if (paso->element.dicho != '1') {
+ desciende = true;
+ return;
+ } else {
+ findDownwards(leftChild(paso), desciende);
+ findDownwards(rightSibling(paso), desciende);
+ }
+ }
+}
+
+void findDialogLine(byte persona) {
+ boolean hecho, decir, subida, desciende, borde, adelanta;
+
+ auxTree = ar;
+ auxTree = auxTree->child;
+ hecho = false;
+ l = new lista;
+ l->siguiente = NULL;
+ l1 = l;
+ borde = false;
+ subida = false;
+ do {
+ switch (auxTree->element.dicho) {
+ case '0':
+ case '2':
+ case 'H':
+ decir = true;
+ break;
+ case '1': {
+ decir = false;
+ step = auxTree->child;
+ desciende = false;
+ findDownwards(step, desciende);
+ if (!(desciende))
+ subida = true;
+ step = NULL;
+ } break;
+ case '3':
+ if (libro[0] && (persona == 3)) {
+ decir = false;
+ subida = true;
+ } else
+ decir = true;
+ break;
+ case '4':
+ if (primera[persona - 1]) {
+ decir = false;
+ subida = true;
+ } else
+ decir = true;
+ break;
+ case '5':
+ if (libro[persona - 1] && lprimera[persona - 1])
+ decir = true;
+ else {
+ decir = false;
+ subida = true;
+ }
+ break;
+ case '6':
+ if (libro[persona - 1] && !lprimera[persona - 1])
+ decir = true;
+ else {
+ decir = false;
+ subida = true;
+ }
+ break;
+ case '7':
+ if (libro[persona - 1]) {
+ decir = false;
+ subida = true;
+ } else if (!primera[persona - 1])
+ decir = true;
+ else {
+ decir = false;
+ subida = true;
+ }
+ break;
+ case '8':
+ if (caramelos[persona - 1] && cprimera[persona - 1])
+ decir = true;
+ else {
+ decir = false;
+ subida = true;
+ }
+ break;
+ case '9':
+ if (caramelos[persona - 1] && !cprimera[persona - 1])
+ decir = true;
+ else {
+ decir = false;
+ subida = true;
+ }
+ break;
+ case 'A':
+ if (!caramelos[persona - 1] && !primera[persona - 1])
+ decir = true;
+ else {
+ decir = false;
+ subida = true;
+ }
+ break;
+ case 'B':
+ if (cavernas[0] && !primera[8])
+ decir = true;
+ else
+ decir = false;
+ break;
+ case 'C':
+ if (cavernas[1] && !primera[8])
+ decir = true;
+ else
+ decir = false;
+ break;
+ case 'D':
+ if ((cavernas[0] && cavernas[1]) && !primera[8])
+ decir = true;
+ else
+ decir = false;
+ break;
+ case 'E':
+ if ((cavernas[0] && !cavernas[2]) && !primera[8])
+ decir = true;
+ else
+ decir = false;
+ break;
+ case 'F':
+ if (!cavernas[3])
+ decir = true;
+ else
+ decir = false;
+ break;
+ case 'G':
+ if (!cavernas[4])
+ decir = true;
+ else
+ decir = false;
+ break;
+ case 'I':
+ if (!sello_quitado)
+ decir = true;
+ else
+ decir = false;
+ break;
+ case 'Z':
+ decir = false;
+ break;
+ }
+ if (decir) {
+ if (auxTree->element.dicho == '2')
+ if (!borde) {
+ borde = true;
+ switch (persona) {
+ case 1:
+ if (primera[persona - 1]) {
+ l1->elemento = 12;
+ adelanta = true;
+ } else if (libro[persona - 1]) {
+ adelanta = true;
+ l1->elemento = 33;
+ } else {
+ l1->elemento = 21;
+ adelanta = true;
+ }
+ break;
+ case 3:
+ if (primera[persona - 1]) {
+ l1->elemento = 103;
+ adelanta = true;
+ } else {
+ l1->elemento = 112;
+ adelanta = true;
+ }
+ break;
+ default: {
+ l1->elemento = auxTree->element.index;
+ adelanta = true;
+ }
+ }
+ } else {
+ ;
+ }
+ else {
+ l1->elemento = auxTree->element.index;
+ adelanta = true;
+ }
+ if (adelanta) {
+ adelanta = false;
+ l1->siguiente = new lista;
+ l1 = l1->siguiente;
+ l1->siguiente = NULL;
+ }
+ if (rightSibling(auxTree) != NULL)
+ auxTree = rightSibling(auxTree);
+ else {
+ do {
+ if (!root(parent(auxTree)))
+ auxTree = parent(auxTree);
+ else
+ break;
+ } while (!(auxTree->element.dicho == '1' && rightSibling(auxTree) != NULL));
+ if (rightSibling(auxTree) != NULL)
+ auxTree = rightSibling(auxTree);
+ else
+ hecho = true;
+ }
+ } else if (subida) {
+ subida = false;
+ if (rightSibling(auxTree) != NULL)
+ auxTree = rightSibling(auxTree);
+ else {
+ do {
+ if (!root(parent(auxTree)))
+ auxTree = parent(auxTree);
+ else
+ break;
+ } while (!((auxTree->element.dicho == '1') &&
+ (rightSibling(auxTree) != NULL)));
+ if (rightSibling(auxTree) != NULL)
+ auxTree = rightSibling(auxTree);
+ else
+ hecho = true;
+ }
+ } else if (leftChild(auxTree) != NULL)
+ auxTree = leftChild(auxTree);
+ else if (rightSibling(auxTree) != NULL)
+ auxTree = rightSibling(auxTree);
+ else {
+ auxTree = parent(auxTree);
+ if (rightSibling(auxTree) != NULL)
+ auxTree = rightSibling(auxTree);
+ else {
+ do {
+ auxTree = parent(auxTree);
+ } while (!(root(auxTree) || rightSibling(auxTree) != NULL));
+ if (root(auxTree))
+ hecho = true;
+ else
+ auxTree = rightSibling(auxTree);
+ }
+ }
+ } while (!hecho);
+ auxTree = NULL;
+ step = NULL;
+ l1 = NULL;
+}
+
+void modifyTree(uint nodonew) {
+ boolean encontrado;
+
+ encontrado = false;
+ auxTree = ar->child;
+ do {
+ if (auxTree->element.index == nodonew) {
+
+ if ((auxTree->element.dicho != '2') && (auxTree->element.dicho != 'H'))
+ auxTree->element.dicho = '1';
+ else if (auxTree->element.dicho != 'H')
+ auxTree->element.dicho = 'Z';
+ encontrado = true;
+ } else {
+ if (leftChild(auxTree) != NULL)
+ auxTree = leftChild(auxTree);
+ else if (rightSibling(auxTree) != NULL)
+ auxTree = rightSibling(auxTree);
+ else {
+ do {
+ auxTree = parent(auxTree);
+ } while (!(rightSibling(auxTree) != NULL));
+ auxTree = rightSibling(auxTree);
+ }
+ }
+ } while (!encontrado);
+}
+
+void drawTalkMenu() {
+ byte ytextaux;
+ g_engine->_mouseManager->hide();
+ for (ytextaux = 25; ytextaux >= 1; ytextaux--)
+ rectangle(0, 175 - ytextaux, 319, 174 + ytextaux, 0);
+ for (ytextaux = 1; ytextaux <= 25; ytextaux++)
+ buttonBorder(0, 175 - ytextaux, 319, 174 + ytextaux, 253, 253, 253, 253, 0, 0, "");
+ drawMenu(5);
+ g_engine->_mouseManager->show();
+}
+
+void fixTree(Tree paso) {
+ if (paso != NULL) {
+ if (paso->element.dicho == 'Z')
+ paso->element.dicho = '2';
+ else {
+ fixTree(leftChild(paso));
+ fixTree(rightSibling(paso));
+ }
+ }
+}
+
+void showDialogLine(Common::String matrizconversa[16], uint &charlaelegida) {
+ byte primeraconv, buscanodo, convselec;
+
+ primeraconv = 1;
+ convselec = 0;
+ g_engine->_mouseManager->hide();
+
+ drawMenu(5);
+ outtextxy(6, 151, matrizconversa[1], 255, true);
+ outtextxy(6, 162, matrizconversa[2], 255, true);
+ outtextxy(6, 173, matrizconversa[3], 255, true);
+ outtextxy(6, 184, matrizconversa[4], 255, true);
+ g_engine->_mouseManager->show();
+ Common::Event e;
+ do {
+ bool lMouseClicked = false;
+ bool rMouseClicked = false;
+ do {
+ g_engine->_chrono->updateChrono();
+ g_engine->_mouseManager->animateMouseIfNeeded();
+
+ while (g_system->getEventManager()->pollEvent(e)) {
+ if (e.type == Common::EVENT_LBUTTONUP) {
+ lMouseClicked = true;
+ pulsax = e.mouse.x;
+ pulsay = e.mouse.y;
+ } else if (e.type == Common::EVENT_RBUTTONUP) {
+ rMouseClicked = true;
+ pulsax = e.mouse.x;
+ pulsay = e.mouse.y;
+ }
+ }
+
+ if (tocapintar) {
+ if (roomData->banderapaleta && saltospal >= 4) {
+ saltospal = 0;
+ if (movidapaleta > 6)
+ movidapaleta = 0;
+ else
+ movidapaleta += 1;
+ updatePalette(movidapaleta);
+ } else
+ saltospal += 1;
+ }
+ g_system->delayMillis(10);
+ g_engine->_screen->update();
+ } while (!lMouseClicked && !rMouseClicked && !g_engine->shouldQuit());
+
+ if (lMouseClicked) {
+ if (pulsay < 143)
+ convselec = 0;
+ else {
+ if (pulsax >= 0 && pulsax <= 280) {
+ if (pulsay >= 143 && pulsay <= 155) {
+ convselec = primeraconv;
+ } else if (pulsay >= 156 && pulsay <= 166) {
+ convselec = primeraconv + 1;
+ } else if (pulsay >= 167 && pulsay <= 177) {
+ convselec = primeraconv + 2;
+ } else if (pulsay >= 178 && pulsay <= 186) {
+ convselec = primeraconv + 3;
+ }
+ } else if (pulsax >= 281 && pulsax <= 319) {
+ if (pulsay >= 143 && pulsay <= 165) {
+ if (primeraconv > 1) {
+ convselec = 0;
+ primeraconv -= 1;
+ g_engine->_mouseManager->hide();
+ drawMenu(5);
+ outtextxy(6, 151, matrizconversa[primeraconv], 255, true);
+ outtextxy(6, 162, matrizconversa[primeraconv + 1], 255, true);
+ outtextxy(6, 173, matrizconversa[primeraconv + 2], 255, true);
+ outtextxy(6, 184, matrizconversa[primeraconv + 3], 255, true);
+ g_engine->_mouseManager->show();
+ }
+ } else if (pulsay >= 167 && pulsay <= 186) {
+ if (primeraconv < 12) {
+ convselec = 0;
+ primeraconv += 1;
+ g_engine->_mouseManager->hide();
+ drawMenu(5);
+ outtextxy(6, 151, matrizconversa[primeraconv], 255, true);
+ outtextxy(6, 162, matrizconversa[primeraconv + 1], 255, true);
+ outtextxy(6, 173, matrizconversa[primeraconv + 2], 255, true);
+ outtextxy(6, 184, matrizconversa[primeraconv + 3], 255, true);
+ g_engine->_mouseManager->show();
+ }
+ }
+ }
+ }
+ } else if (rMouseClicked)
+ convselec = conversationIndex;
+ } while (!((convselec > 0) && (convselec <= conversationIndex)) && !g_engine->shouldQuit());
+
+ if (convselec == conversationIndex)
+ endOfConversation = true;
+ for (buscanodo = 1; buscanodo <= (convselec - 1); buscanodo++)
+ l1 = l1->siguiente;
+ charlaelegida = l1->elemento;
+}
+
+void talk(byte person) {
+ debug("Talking to persona: %d", person);
+ uint pasorespuesta, nuevonodo;
+ regismht pasoh;
+ byte auxilcadena, insertarnombre, indicemochila;
+
+ Common::String matrizconversa[16];
+ drawTalkMenu();
+ endOfConversation = false;
+ assignText();
+ // The original game makes a copy of the file upon starting a new game. .007 is the current game (the game
+ // that resumes when clicking "continue game" in the main menu. Part of the savegame data is this 007
+ // conversation file which marks conversatino topics as already gone through or not.
+ readTree(*conversationData, ar, person - 1);
+ loadTalkAnimations();
+ do {
+
+ for (int i = 0; i < 16; i++) {
+ matrizconversa[i] = "";
+ }
+
+ findDialogLine(person);
+ conversationIndex = 0;
+ l1 = l;
+ do {
+ verb.seek(verbRegSize * l1->elemento);
+ conversationIndex += 1;
+ pasoh = readVerbRegister();
+ insertarnombre = 0;
+ matrizconversa[conversationIndex] = decrypt(pasoh.cadenatext);
+
+ for (int i = 0; i < matrizconversa[conversationIndex].size(); i++) {
+ if (matrizconversa[conversationIndex][i] == '@')
+ insertarnombre = i;
+ }
+ if (insertarnombre > 0) {
+ matrizconversa[conversationIndex].deleteChar(insertarnombre);
+ matrizconversa[conversationIndex].insertString(nombrepersonaje, insertarnombre);
+ }
+ if (matrizconversa[conversationIndex].size() > 45) {
+ auxilcadena = 45;
+ do {
+ auxilcadena -= 1;
+ } while (matrizconversa[conversationIndex][auxilcadena] != ' ');
+ matrizconversa[conversationIndex] = matrizconversa[conversationIndex].substr(0, auxilcadena);
+ matrizconversa[conversationIndex].insertString(" ...", auxilcadena);
+ }
+ l1 = l1->siguiente;
+ } while ((l1->siguiente != NULL) && (l1 != NULL));
+ l1 = l;
+ showDialogLine(matrizconversa, nuevonodo);
+ delete l;
+ hypertext(nuevonodo, 255, 0, pasorespuesta, true);
+ auxilcadena = 0;
+ modifyTree(nuevonodo);
+ // verifyCopyProtection();
+ while (pasorespuesta > 0) {
+ nuevonodo = pasorespuesta;
+ auxilcadena += 1;
+ if (odd(auxilcadena))
+ hypertext(nuevonodo, 253, 249, pasorespuesta, true);
+ else
+ hypertext(nuevonodo, 255, 0, pasorespuesta, true);
+ switch (nuevonodo) {
+ case 9: {
+ lista1 = true;
+ indicemochila = 0;
+ while (mobj[indicemochila].code != 0) {
+ indicemochila += 1;
+ }
+ mobj[indicemochila].bitmapIndex = indicelista1;
+ mobj[indicemochila].code = codigolista1;
+ mobj[indicemochila].objectName = "LISTA ";
+ } break;
+ case 25: {
+ lista2 = true;
+ indicemochila = 0;
+ while (mobj[indicemochila].code != 0) {
+ indicemochila += 1;
+ }
+ mobj[indicemochila].bitmapIndex = indicelista2;
+ mobj[indicemochila].code = codigolista2;
+ mobj[indicemochila].objectName = "LISTA";
+ } break;
+ }
+ }
+ g_system->delayMillis(10);
+ } while (!endOfConversation && !g_engine->shouldQuit());
+ unloadTalkAnimations();
+ step = ar;
+ fixTree(step);
+ saveConversations(conversationData, ar, person - 1);
+
+ verb.close();
+ delete ar;
+ l1 = NULL;
+ g_engine->_mouseManager->hide();
+
+ for (int i = 25; i >= 1; i--)
+ rectangle(0, 175 - i, 319, 174 + i, 0);
+ mask();
+ drawBackpack();
+ g_engine->_mouseManager->show();
+
+ // release(marca);
+ if (person < 5) {
+ if (primera[person - 1])
+ primera[person - 1] = false;
+ if (lprimera[person - 1])
+ lprimera[person - 1] = false;
+ if (cprimera[person - 1])
+ cprimera[person - 1] = false;
+ } else if (person == 8)
+ primera[8] = false;
+}
+
+void talkScreenObject() {
+ int x_del_raton = (pulsax + 7) / factorx;
+ int y_del_raton = (pulsay + 7) / factory;
+ uint objeto_de_la_pantalla = roomData->indexadoobjetos[roomData->mouseGrid[x_del_raton][y_del_raton]]->indicefichero;
+ if (objeto_de_la_pantalla == 0)
+ return;
+
+ // verifyCopyProtection2();
+ readItemRegister(objeto_de_la_pantalla);
+ goToObject(roomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory],
+ roomData->rejapantalla[x_del_raton][y_del_raton]);
+
+ if (regobj.habla > 0) {
+ talk(regobj.habla);
+ }
+ else {
+ assignText();
+ hypertext((Random(10) + 1039), 255, 0, kaka, false);
+ verb.close();
+ if (contadorpc > 198)
+ error("Error contadorpc = 274");
+ }
+}
+
+} // End of namespace Tot
+
diff --git a/engines/tot/dialog.h b/engines/tot/dialog.h
new file mode 100644
index 00000000000..3ac3cc3dab9
--- /dev/null
+++ b/engines/tot/dialog.h
@@ -0,0 +1,49 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+#ifndef TOT_DIALOG_H
+#define TOT_DIALOG_H
+
+#include "common/scummsys.h"
+
+#include "tot/forest.h"
+#include "tot/util.h"
+
+namespace Tot {
+
+
+typedef struct lista *plista;
+
+struct lista {
+ uint elemento;
+ plista siguiente;
+};
+
+extern byte conversationIndex;
+extern plista l1, l;
+extern Tree ar, auxTree, step;
+extern boolean endOfConversation;
+
+
+void talkScreenObject();
+
+} // End of namespace Tot
+
+#endif
diff --git a/engines/tot/font/bgifont.cpp b/engines/tot/font/bgifont.cpp
new file mode 100644
index 00000000000..cb88f9c3bc3
--- /dev/null
+++ b/engines/tot/font/bgifont.cpp
@@ -0,0 +1,205 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "tot/font/bgifont.h"
+
+namespace Graphics {
+
+BgiFont::BgiFont() {
+}
+
+BgiFont::~BgiFont() {
+}
+
+bool BgiFont::loadChr(const Common::Path &fileName) {
+
+ Common::File fontFile;
+ if (!fontFile.open(fileName)) {
+ error("unable to load font file %s", fileName.toString().c_str());
+ }
+ return loadChr(fontFile);
+}
+
+bool BgiFont::loadChr(Common::SeekableReadStream &stream) {
+ uint16 fileSignature = stream.readUint16LE();
+ /*
+ Description until finding value 0x1A
+ */
+ Common::String description = stream.readString(0x1A);
+ uint16 headerSize = stream.readUint16LE();
+ Common::String name = stream.readString(0, 4);
+ uint16 fontSize = stream.readUint16LE();
+ byte majorVersion = stream.readByte();
+ byte minorVersion = stream.readByte();
+ byte majorRevision = stream.readByte();
+ byte minorRevision = stream.readByte();
+
+ int remainingBytes = headerSize - (description.size() + 1 + 14);
+ stream.seek(remainingBytes, SEEK_CUR);
+
+ char signature = stream.readByte();
+ _charCount = stream.readUint16LE();
+ // undefined byte
+ stream.skip(1);
+
+ _firstChar = stream.readByte();
+ uint16 strokeOffset = stream.readUint16LE();
+ /*byte scanFlag = */ stream.readByte();
+
+ // Distance from the origin to the font's highest point
+ _originToAscender = stream.readByte();
+ // Distance from the origin to the font's baseline (typically 0). Ignored.
+ /*signed char originToBaseline = */ stream.readByte();
+ // Distance from the origin to the font's lowest point.
+ _originToDescender = stream.readByte();
+ /**
+ * ----------- originToAscender
+ *
+ *
+ *
+ * ----------- 0
+ *
+ * ----------- originToDescender
+ * totalHeight is the distance between originToAscender and originToDescender plus 1 (the baseline or the zero)
+ */
+ _totalHeight = (_originToAscender - _originToDescender) + 1;
+ // Unused bytes
+ stream.skip(5);
+
+ _glyphs = new GlyphEntry[_charCount];
+
+ // Glyph offsets
+ for (int i = 0; i < _charCount; i++) {
+ _glyphs[i].offset = stream.readUint16LE();
+ }
+ _maxWidth = 0;
+ // Glyph widths
+ for (int i = 0; i < _charCount; i++) {
+ _glyphs[i].charWidth = stream.readByte();
+ if (_maxWidth < _glyphs[i].charWidth)
+ _maxWidth = _glyphs[i].charWidth;
+ }
+ int64 pos = stream.pos();
+
+ // Read drawing instructions until next glyph definition
+ for (int i = 0; i < _charCount; i++) {
+ _totalWidth += _glyphs[i].charWidth;
+ stream.seek(_glyphs[i].offset, pos);
+ int m;
+ do {
+ DrawingInstruction *inst = new DrawingInstruction();
+ byte instructionX = stream.readByte();
+ byte instructionY = stream.readByte();
+ // Grabs the most significant bit which is the opcode
+ m = instructionX >> 7 & 0x1;
+ m += m + (instructionY >> 7 & 0x1);
+ instructionX = fixSign(instructionX);
+ instructionY = fixSign(instructionY);
+
+ inst->opCode = m;
+ inst->xCoord = instructionX;
+ inst->yCoord = instructionY;
+ _glyphs[i].insts.push_back(inst);
+
+ } while (m);
+ }
+ _fontCache.push_back(drawCachedFont(1));
+ return false;
+}
+
+byte Graphics::BgiFont::fixSign(byte original) {
+ // If negative shifts the sign bit to the right position
+ return original & 0x7F | ((original & 0x40) << 1);
+}
+
+BgiFont::CachedFont *BgiFont::drawCachedFont(int size) {
+ CachedFont *cachedFont = new CachedFont();
+ Graphics::Surface *surface = new Graphics::Surface();
+ surface->create(_totalWidth, _totalHeight, Graphics::PixelFormat::createFormatCLUT8());
+ uint32 offsetCount = 0;
+ for (int i = 0; i < _charCount; i++) {
+
+ int curPosX = offsetCount;
+ int curPosY = 0;
+ cachedFont->offsets[i] = offsetCount;
+ cachedFont->widths[i] = _glyphs[i].charWidth;
+
+ for (int j = 0; j < _glyphs[i].insts.size(); j++) {
+ int opCode = _glyphs[i].insts[j]->opCode;
+ // Need to normalize Y coord because the stroke instructions start at origin and extend upwards up ti originAscender, downwards to originToDescender
+ int adjustedY = _originToAscender - _glyphs[i].insts[j]->yCoord;
+
+ switch (opCode) {
+ case OPCODE_END:
+ break;
+ case OPCODE_MOVE:
+ break;
+ case OPCODE_DRAW:
+ surface->drawLine(
+ curPosX,
+ curPosY,
+ offsetCount + _glyphs[i].insts[j]->xCoord,
+ adjustedY,
+ 255);
+ break;
+ default:
+ /* nothing to do */
+ break;
+ };
+ curPosX = offsetCount + _glyphs[i].insts[j]->xCoord;
+ curPosY = adjustedY;
+ }
+ offsetCount += _glyphs[i].charWidth;
+ }
+
+ cachedFont->surface = surface;
+ return cachedFont;
+}
+
+void Graphics::BgiFont::close() {
+}
+
+int BgiFont::getCharWidth(uint32 chr) const {
+ return _glyphs[characterToIndex(chr)].charWidth;
+}
+
+void BgiFont::drawChar(Surface *dst, uint32 chr, int x, int y, uint32 color) const {
+ CachedFont *font = _fontCache[0];
+ uint16 charIndex = characterToIndex(chr);
+ int charWidth = font->widths[charIndex];
+
+ for (uint16 i = 0; i < _totalHeight; i++) {
+ for (uint16 j = 0; j < charWidth; j++) {
+ if (font->surface->getPixel(font->offsets[charIndex] + j, i)) {
+ *((byte *)dst->getBasePtr(x + j, y + i)) = color;
+ }
+ }
+ }
+}
+
+uint16 BgiFont::characterToIndex(uint32 character) const {
+ if (character - _firstChar >= 0 && character - _firstChar < _charCount) {
+ return character - _firstChar;
+ } else
+ return _firstChar;
+}
+
+} // End of namespace Graphics
diff --git a/engines/tot/font/bgifont.h b/engines/tot/font/bgifont.h
new file mode 100644
index 00000000000..3603f2884b7
--- /dev/null
+++ b/engines/tot/font/bgifont.h
@@ -0,0 +1,93 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+#ifndef GRAPHICS_FONTS_BGIFONT_H
+#define GRAPHICS_FONTS_BGIFONT_H
+
+#include "common/file.h"
+#include "common/std/vector.h"
+#include "graphics/font.h"
+#include "graphics/surface.h"
+
+namespace Graphics {
+
+const int OPCODE_END = 0;
+const int OPCODE_DOSCAN = 1;
+const int OPCODE_MOVE = 2;
+const int OPCODE_DRAW = 3;
+
+class BgiFont : public Font {
+public:
+ BgiFont();
+ ~BgiFont();
+
+ bool loadChr(const Common::Path &fileName);
+ bool loadChr(Common::SeekableReadStream &stream);
+
+ void close();
+
+ int getFontHeight() const { return _totalHeight; }
+ int getCharWidth(uint32 chr) const;
+ int getMaxCharWidth() const { return _maxWidth; }
+ void drawChar(Surface *dst, uint32 chr, int x, int y, uint32 color) const;
+
+private:
+ struct DrawingInstruction {
+ int opCode;
+ int8 xCoord;
+ int8 yCoord;
+ };
+
+ struct GlyphEntry {
+ GlyphEntry() {
+ charWidth = 0;
+ offset = 0;
+ }
+ ~GlyphEntry();
+
+ uint16 charWidth;
+ uint32 offset;
+ Common::Array<DrawingInstruction *> insts;
+ } *_glyphs;
+
+ struct CachedFont {
+ int widths[256];
+ int offsets[256];
+ Graphics::Surface *surface;
+ };
+
+ uint16 _charCount;
+ byte _firstChar;
+ // uint16 _pixHeight;
+ uint16 _maxWidth = 10;
+ uint32 _totalWidth = 0;
+ int16 _totalHeight = 0;
+ int8 _originToAscender = 0;
+ int8 _originToDescender = 0;
+ Common::Array<CachedFont *> _fontCache;
+
+ uint16 characterToIndex(uint32 character) const;
+ byte fixSign(byte original);
+ CachedFont *drawCachedFont(int size);
+};
+
+} // namespace Graphics
+
+#endif
diff --git a/engines/tot/font/biosfont.cpp b/engines/tot/font/biosfont.cpp
new file mode 100644
index 00000000000..86fd7a40fd7
--- /dev/null
+++ b/engines/tot/font/biosfont.cpp
@@ -0,0 +1,65 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+#include "graphics/fonts/dosfont.h"
+#include "graphics/surface.h"
+
+#include "tot/tot.h"
+#include "tot/font/biosfont.h"
+
+
+namespace Tot {
+
+BiosFont::BiosFont() { }
+
+int BiosFont::getFontHeight() const {
+ return 8;
+}
+
+int BiosFont::getMaxCharWidth() const {
+ return 8;
+}
+
+int BiosFont::getCharWidth(uint32 chr) const {
+ return 8;
+}
+
+void BiosFont::drawChar(Graphics::Surface *dst, uint32 chr, int x, int y, uint32 color) const {
+ drawBiosFontGlyph(chr, x, y, color);
+}
+
+void BiosFont::drawBiosFontGlyph(uint8 chr, int x, int y, uint8 color) const {
+ byte *ptr = (byte *)g_engine->_screen->getBasePtr(x, y);
+ int srcPixel = chr * 8;
+ for (int sy = 0; sy < 8; sy++) {
+ for (int sx = 0; sx < 8; sx++) {
+ if (Graphics::DosFont::fontData_PCBIOS[srcPixel] & 1 << (7 - sx)) {
+ *ptr = color;
+ }
+ ptr++;
+ }
+ srcPixel++;
+ ptr -= 8;
+ ptr += (g_engine->_screen->pitch);
+ }
+}
+
+} // namespace Darkseed
diff --git a/engines/tot/font/biosfont.h b/engines/tot/font/biosfont.h
new file mode 100644
index 00000000000..4186d0f9815
--- /dev/null
+++ b/engines/tot/font/biosfont.h
@@ -0,0 +1,45 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef TOT_BIG5FONT_H
+#define TOT_BIG5FONT_H
+
+#include "graphics/font.h"
+#include "graphics/big5.h"
+#include "graphics/surface.h"
+
+namespace Tot {
+
+class BiosFont : public Graphics::Font {
+public:
+ BiosFont();
+
+ int getFontHeight() const override;
+ int getMaxCharWidth() const override;
+ int getCharWidth(uint32 chr) const override;
+ void drawChar(Graphics::Surface *dst, uint32 chr, int x, int y, uint32 color) const override;
+private:
+ void drawBiosFontGlyph(uint8 chr, int x, int y, uint8 color) const;
+};
+
+} // End of namespace Tot
+
+#endif // TOT_BIG5FONT_H
diff --git a/engines/tot/forest.cpp b/engines/tot/forest.cpp
new file mode 100644
index 00000000000..ce17ee394cb
--- /dev/null
+++ b/engines/tot/forest.cpp
@@ -0,0 +1,216 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/file.h"
+#include "common/debug.h"
+
+#include "tot/forest.h"
+
+namespace Tot {
+
+void initTree(Tree& a, nodeElement dato) {
+ a = new treeDef;
+ a->element = dato;
+ a->parent = NULL;
+ a->sibling = NULL;
+ a->child = NULL;
+}
+
+boolean root(Tree nodo) {
+ boolean raiz_result;
+ if (nodo->parent == NULL)
+ raiz_result = true;
+ else raiz_result = false;
+ return raiz_result;
+}
+
+Tree rightSibling(Tree nodo) {
+ Tree hermanoder_result;
+ hermanoder_result = nodo->sibling;
+ return hermanoder_result;
+}
+
+Tree parent(Tree nodo) {
+ Tree padre_result;
+ padre_result = nodo->parent;
+ return padre_result;
+}
+
+Tree leftChild(Tree nodo) {
+ Tree hijoizq_result;
+ hijoizq_result = nodo->child;
+ return hijoizq_result;
+}
+
+
+int depth(Tree nodo) {
+ Tree auxiliar;
+ int contador;
+
+ int profundidad_result;
+ contador = 0;
+ auxiliar = nodo;
+ while (auxiliar->parent != NULL) {
+ contador += 1;
+ auxiliar = parent(auxiliar);
+ }
+ profundidad_result = contador;
+ return profundidad_result;
+}
+
+void expandNode(Tree& nodo, nodeElement dato) {
+ Tree auxiliar;
+
+ auxiliar = nodo;
+ if (auxiliar->child != NULL) {
+
+ auxiliar = leftChild(auxiliar);
+ while (auxiliar->sibling != NULL)
+ auxiliar = rightSibling(auxiliar);;
+ auxiliar->sibling = new treeDef;
+ auxiliar = auxiliar->sibling;
+ auxiliar->element = dato;
+ auxiliar->sibling = NULL;
+ auxiliar->child = NULL;
+ auxiliar->parent = nodo;
+ } else {
+
+ auxiliar->child = new treeDef;
+ auxiliar = auxiliar->child;
+ auxiliar->element = dato;
+ auxiliar->sibling = NULL;
+ auxiliar->child = NULL;
+ auxiliar->parent = nodo;
+ }
+}
+
+void preOrder(Tree a, Common::String& cadena) {
+ if (a != NULL) {
+ cadena = Common::String::format("%s%d%cN%d@", cadena.c_str(), a->element.index, a->element.dicho, depth(a));
+ preOrder(leftChild(a), cadena);
+ preOrder(rightSibling(a), cadena);
+ }
+}
+
+void saveExpression(Common::SeekableWriteStream *s, Common::String expression) {
+ s->writeByte(expression.size());
+ s->writeString(expression);
+ int paddingSize = 255 - expression.size();
+ if (paddingSize > 0) {
+ debug("Writing padding of %d", paddingSize);
+ char *padding = (char *)malloc(paddingSize);
+ for (int i = 0; i < paddingSize; i++) {
+ padding[i] = '\0';
+ }
+ // 8 max char name
+ s->write(padding, paddingSize);
+ free(padding);
+ }
+}
+
+const int chatRegSize = 256;
+
+void saveConversations(Common::SeekableWriteStream *s, Tree a, uint sitio) {
+
+ Common::String expression = "";
+ preOrder(a, expression);
+ debug("Pos-Expression=%s", expression.c_str());
+ debug("saving in position = %d", sitio);
+ s->seek(sitio * chatRegSize, SEEK_SET);
+ saveExpression(s, expression);
+}
+
+void readTree(Common::SeekableReadStream &stream, Tree &a, uint lugar) {
+
+ const nodeElement vacio = {'0', 0};
+ nodeElement dato;
+
+ Common::String strInd, exppaso;
+ Tree arbolaux;
+ byte posicion,
+
+ nivel,
+ nivelact;
+
+ Common::String nivelstr;
+
+ stream.seek(chatRegSize * lugar);
+
+ Common::String expresion;
+ expresion = stream.readPascalString();
+ debug("Pre-Expression=%s", expresion.c_str());
+
+ initTree(a, vacio);
+ arbolaux = a;
+ posicion = 0;
+ nivelact = 0;
+ do {
+
+ exppaso = "";
+ do {
+ exppaso = exppaso + expresion[posicion];
+ } while (expresion[posicion++] != '@');
+ dato.dicho = '0';
+ dato.index = 0;
+
+ int nIndex = exppaso.find('N');
+ strInd = exppaso.substr(0, nIndex - 1);
+
+ dato.dicho = exppaso[nIndex - 1];
+ dato.index = atoi(strInd.c_str());
+
+ nivelstr = "";
+ nivelstr = exppaso.substr(nIndex + 1, exppaso.size() - nIndex - 2);
+ nivel = atoi(nivelstr.c_str());
+
+ if (nivel == 0)
+ arbolaux->element = dato;
+ else if (nivel == (nivelact + 1))
+ expandNode(arbolaux, dato);
+ else if (nivel > (nivelact + 1)) {
+ arbolaux = leftChild(arbolaux);
+ nivelact += 1;
+ while (rightSibling(arbolaux) != NULL)
+ arbolaux = rightSibling(arbolaux);
+ expandNode(arbolaux, dato);
+ } else {
+ do {
+ nivelact -= 1;
+ arbolaux = parent(arbolaux);
+ } while (!(nivelact < nivel));
+ expandNode(arbolaux, dato);
+ }
+
+ } while (posicion != expresion.size());
+}
+
+void readTree(Common::String f, Tree &a, uint lugar) {
+
+ Common::File fichero;
+ debug("Filename = %s", f.c_str());
+ if (!fichero.open(Common::Path(f))) {
+ error("error opening conversation file (314)");
+ }
+ readTree(fichero, a, lugar);
+ fichero.close();
+}
+
+} // End of namespace Tot
diff --git a/engines/tot/forest.h b/engines/tot/forest.h
new file mode 100644
index 00000000000..825db9c974f
--- /dev/null
+++ b/engines/tot/forest.h
@@ -0,0 +1,67 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+#ifndef TOT_FOREST_H
+#define TOT_FOREST_H
+
+#include "common/scummsys.h"
+#include "common/str.h"
+#include "common/stream.h"
+
+#include "util.h"
+
+namespace Tot {
+
+struct nodeElement {
+ char dicho;
+ uint index;
+};
+
+typedef struct treeDef *Tree;
+
+struct treeDef {
+ nodeElement element;
+ Tree parent, sibling, child;
+};
+
+void initTree(Tree& a, nodeElement data);
+
+boolean root(Tree node);
+
+Tree rightSibling(Tree node);
+
+Tree parent(Tree node);
+
+Tree leftChild(Tree node);
+
+int depth(Tree node);
+
+void expandNode(Tree& node, nodeElement data);
+
+void preOrder(Tree a, Common::String& string_);
+
+void saveConversations(Common::SeekableWriteStream *s, Tree a, uint location);
+
+void readTree(Common::SeekableReadStream &f, Tree& a, uint location);
+void readTree(Common::String f, Tree& a, uint location);
+
+} // End of namespace Tot
+#endif
+
diff --git a/engines/tot/game.cpp b/engines/tot/game.cpp
new file mode 100644
index 00000000000..f9a611fcf47
--- /dev/null
+++ b/engines/tot/game.cpp
@@ -0,0 +1,1220 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/config-manager.h"
+#include "common/textconsole.h"
+
+#include "tot/dialog.h"
+#include "tot/graphics.h"
+#include "tot/mouse.h"
+#include "tot/playanim.h"
+#include "tot/routines.h"
+#include "tot/routines2.h"
+#include "tot/sound.h"
+#include "tot/tot.h"
+#include "tot/util.h"
+
+namespace Tot {
+byte iaux, iaux2;
+
+bool showMouseGrid = false;
+bool showScreenGrid = false;
+bool showGameGrid = false;
+bool drawObjectAreas = false;
+
+void loadTemporaryGame() {
+ // uint indiaux, indiaux2;
+
+ // assign(partida, "GAME07.SAV");
+
+ // if (ioresult != 0)
+ // error("engine_start(): ioresult (322)");
+ // partida >> regpartida;
+ // drawMouseBackground(xraton, yraton);
+ // longtray = regpartida.longtray;
+ // indicetray = regpartida.indicetray;
+ // codigoobjmochila = regpartida.codigoobjmochila;
+ // volumenfxderecho = regpartida.volumenfxderecho;
+ // volumenfxizquierdo = regpartida.volumenfxizquierdo;
+ // volumenmelodiaderecho = regpartida.volumenmelodiaderecho;
+ // volumenmelodiaizquierdo = regpartida.volumenmelodiaizquierdo;
+ // oldxrejilla = regpartida.oldxrejilla;
+ // oldyrejilla = regpartida.oldyrejilla;
+ // animado.profundidad = regpartida.animadoprofundidad;
+ // animado.dir = regpartida.animadodir;
+ // animado.posx = regpartida.animadoposx;
+ // animado.posy = regpartida.animadoposy;
+ // iframe2 = regpartida.animadoiframe2;
+ // zonaactual = regpartida.zonaactual;
+ // zonadestino = regpartida.zonadestino;
+ // oldzonadestino = regpartida.oldzonadestino;
+ // posicioninv = regpartida.posicioninv;
+ // numeroaccion = regpartida.numeroaccion;
+ // oldnumeroacc = regpartida.oldnumeroacc;
+ // pasos = regpartida.pasos;
+ // indicepuertas = regpartida.indicepuertas;
+ // direccionmovimiento = regpartida.direccionmovimiento;
+ // iframe = regpartida.iframe;
+ // if (regpartida.parte_del_juego != parte_del_juego) {
+ // parte_del_juego = regpartida.parte_del_juego;
+ // freeInventory();
+ // loadObjects();
+ // }
+ // sello_quitado = regpartida.sello_quitado;
+ // lista1 = regpartida.lista1;
+ // lista2 = regpartida.lista2;
+ // completadalista1 = regpartida.completadalista1;
+ // completadalista2 = regpartida.completadalista2;
+ // vasijapuesta = regpartida.vasijapuesta;
+ // guadagna = regpartida.guadagna;
+ // tridente = regpartida.tridente;
+ // torno = regpartida.torno;
+ // barro = regpartida.barro;
+ // diablillo_verde = regpartida.diablillo_verde;
+ // rojo_capturado = regpartida.rojo_capturado;
+ // manual_torno = regpartida.manual_torno;
+ // alacena_abierta = regpartida.alacena_abierta;
+ // baul_abierto = regpartida.baul_abierto;
+ // teleencendida = regpartida.teleencendida;
+ // trampa_puesta = regpartida.trampa_puesta;
+ // for (indiaux = 0; indiaux < inventoryIconCount; indiaux++) {
+ // mobj[indiaux].bitmapIndex = regpartida.mobj[indiaux].bitmapIndex;
+ // mobj[indiaux].codigo = regpartida.mobj[indiaux].codigo;
+ // mobj[indiaux].nombreobj = regpartida.mobj[indiaux].nombreobj;
+ // }
+ // elemento1 = regpartida.elemento1;
+ // elemento2 = regpartida.elemento2;
+ // characterPosX = regpartida.xframe;
+ // characterPosY = regpartida.yframe;
+ // xframe2 = regpartida.xframe2;
+ // yframe2 = regpartida.yframe2;
+ // oldobjmochila = regpartida.oldobjmochila;
+ // objetomochila = regpartida.objetomochila;
+ // nombrepersonaje = regpartida.nombrepersonaje;
+ // for(int i = 0; i < routePointCount; i++) {
+ // regpartida.mainRoute[i].x = mainRoute[i].x;
+ // regpartida.mainRoute[i].y = mainRoute[i].y;
+ // }
+ // for (indiaux = 0; indiaux < 300; indiaux++) {
+ // trayec[indiaux].x = regpartida.trayec[indiaux].x;
+ // trayec[indiaux].y = regpartida.trayec[indiaux].y;
+ // }
+ // for (indiaux = 0; indiaux < maxpersonajes; indiaux++) {
+ // primera[indiaux] = regpartida.primera[indiaux];
+ // lprimera[indiaux] = regpartida.lprimera[indiaux];
+ // cprimera[indiaux] = regpartida.cprimera[indiaux];
+ // libro[indiaux] = regpartida.libro[indiaux];
+ // caramelos[indiaux] = regpartida.caramelos[indiaux];
+ // }
+
+ // for (indiaux = 0; indiaux < 5; indiaux++) {
+ // cavernas[indiaux] = regpartida.cavernas[indiaux];
+ // firstList[indiaux] = regpartida.firstList[indiaux];
+ // secondList[indiaux] = regpartida.secondList[indiaux];
+ // }
+ // for (indiaux = 0; indiaux < 4; indiaux++) {
+ // hornacina[0][indiaux] = regpartida.hornacina[0][indiaux];
+ // hornacina[1][indiaux] = regpartida.hornacina[1][indiaux];
+ // }
+ // close(partida);
+ // totalFadeOut(0);
+ // clear();
+ // loadPalette("DEFAULT");
+ // loadScreenData(regpartida.numeropantalla);
+ // switch (roomData->codigo) {
+ // case 2: {
+ // if (teleencendida)
+ // autoPlayVoc("PARASITO", 355778, 20129);
+ // else
+ // cargatele();
+ // setSfxVolume(volumenfxizquierdo, volumenfxderecho);
+ // } break;
+ // case 4: {
+ // loadVoc("GOTA", 140972, 1029);
+ // setSfxVolume(volumenfxizquierdo, volumenfxderecho);
+ // } break;
+ // case 5: {
+ // setSfxVolume(volumenfxizquierdo, 0);
+ // autoPlayVoc("CALDERA", 6433, 15386);
+ // } break;
+ // case 6: {
+ // setSfxVolume(volumenfxizquierdo, volumenfxderecho);
+ // autoPlayVoc("CALDERA", 6433, 15386);
+ // } break;
+ // case 17: {
+ // if ((libro[0] == true) && (roomData->banderamovimiento == true))
+ // disableSecondAnimation();
+ // } break;
+ // case 20: {
+ // switch (hornacina[0][hornacina[0][3]]) {
+ // case 0:
+ // roomData->indexadoobjetos[9]->objectName = "HORNACINA";
+ // break;
+ // case 561:
+ // roomData->indexadoobjetos[9]->objectName = "ESTATUA DIVINA";
+ // break;
+ // case 563:
+ // roomData->indexadoobjetos[9]->objectName = "MANUAL DE ALFARERO";
+ // break;
+ // case 615:
+ // roomData->indexadoobjetos[9]->objectName = "ESTATUA GROTESCA";
+ // break;
+ // }
+ // } break;
+ // case 23: {
+ // autoPlayVoc("FUENTE", 0, 0);
+ // setSfxVolume(volumenfxizquierdo, volumenfxderecho);
+ // } break;
+ // case 24: {
+ // switch (hornacina[1][hornacina[1][3]]) {
+ // case 0:
+ // roomData->indexadoobjetos[8]->objectName = "HORNACINA";
+ // break;
+ // case 561:
+ // roomData->indexadoobjetos[8]->objectName = "ESTATUA DIVINA";
+ // break;
+ // case 615:
+ // roomData->indexadoobjetos[8]->objectName = "ESTATUA GROTESCA";
+ // break;
+ // case 622:
+ // roomData->indexadoobjetos[8]->objectName = "PARED";
+ // break;
+ // case 623:
+ // roomData->indexadoobjetos[8]->objectName = "TORNO";
+ // break;
+ // }
+ // if (trampa_puesta) {
+ // roomData->banderamovimiento = true;
+ // loadAnimation(roomData->nombremovto);
+ // iframe2 = 1;
+ // indicetray2 = 1;
+ // animado.dir = roomData->dir2[indicetray2];
+ // roomData->tray2[indicetray2 - 1].x = 214 - 15;
+ // roomData->tray2[indicetray2 - 1].y = 115 - 42;
+ // animado.posx = roomData->tray2[indicetray2 - 1].x;
+ // animado.posy = roomData->tray2[indicetray2 - 1].y;
+ // animado.profundidad = 15;
+ // for (indiaux = 1; indiaux <= maxrejax; indiaux++)
+ // for (indiaux2 = 1; indiaux2 <= maxrejay; indiaux2++)
+ // if (rejamascararaton[indiaux][indiaux2] > 0)
+
+ // roomData->mouseGrid[oldposx + indiaux - 1][oldposy + indiaux2 - 1] = rejamascararaton[indiaux][indiaux2];
+ // }
+ // assembleScreen();
+ // } break;
+ // }
+ // effect(13, false, fondo);
+ // contadorpc = contadorpc2;
+ // mask();
+ // posicioninv = 0;
+ // drawBackpack();
+ // if ((rojo_capturado == false) && (roomData->codigo == 24) &&
+ // (trampa_puesta == false))
+ // runaroundRed();
+ // drawMouseMask(iraton, xraton, yraton);
+ // completadalista2 = true;
+}
+
+int startGame();
+
+int newGame() {
+ g_engine->_mouseManager->hide();
+ obtainName(nombrepersonaje);
+
+ if(!g_engine->shouldQuit()){
+ totalFadeOut(0);
+ clear();
+ processingActive();
+ freeInventory();
+ loadObjects();
+ resetGameState();
+ dentro_del_juego = true;
+ for (int i = 0; i < inventoryIconCount; i++) {
+ mobj[i].bitmapIndex = 34;
+ mobj[i].code = 0;
+ mobj[i].objectName = "VACIO";
+ }
+ readConversationFile(Common::String("CONVERSA.TRE"));
+ initializeScreenFile();
+ initializeObjectFile();
+ loadPalette("DEFAULT");
+ loadScreenData(1);
+ effect(13, false, fondo);
+ mask();
+ posicioninv = 0;
+ drawBackpack();
+ iframe = 0;
+ g_engine->_mouseManager->show();
+ }
+
+}
+
+int engine_start() {
+ if (ConfMan.hasKey("save_slot")) {
+ return startGame();
+ }
+ clear();
+ processingActive();
+
+ loadCharAnimation();
+ loadObjects();
+
+ setMidiVolume(0, 0);
+ playMidiFile("SILENT", false);
+
+ setMouseArea(0, 0, 305, 185);
+ playMidiFile("SILENT", true);
+
+ totalFadeOut(0);
+ clear();
+
+ loadPalette("DEFAULT");
+ loadScreenMemory();
+
+ // initialLogo();
+ playMidiFile("INTRODUC", true);
+ setMidiVolume(3, 3);
+
+ // firstIntroduction();
+ setMousePos(1, xraton, yraton);
+ initialMenu(hechaprimeravez);
+ if (partidanueva && !g_engine->shouldQuit()) {
+ newGame();
+ } else if (continuarpartida && !g_engine->shouldQuit()) {
+ g_engine->loadGameState(g_engine->getMetaEngine()->getAutosaveSlot());
+ } else {
+ desactivagrabar = true;
+ g_engine->openMainMenuDialog();
+ desactivagrabar = false;
+ }
+
+ boolean enforceSecondPart = false;
+ if(enforceSecondPart) { //DEBUG
+ completadalista1 = true;
+ completadalista2 = true;
+ parte_del_juego = 1;
+ }
+
+ return startGame();
+}
+
+int startGame() {
+ lowerMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
+ switch (parte_del_juego) {
+ case 1:
+ // playMidiFile("PRIMERA", true);
+ break;
+ case 2:
+ // playMidiFile("SEGUNDA", true);
+ break;
+ }
+ contadorpc2 = contadorpc;
+ restoreMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
+ dentro_del_juego = true;
+
+ Common::Event e;
+ while (!salirdeljuego && !g_engine->shouldQuit()) {
+ bool escapePressed = false;
+ g_engine->_chrono->updateChrono();
+ g_engine->_mouseManager->animateMouseIfNeeded();
+ // debug
+ while (g_system->getEventManager()->pollEvent(e)) {
+ if (isMouseEvent(e)) {
+ g_engine->_mouseManager->setMousePos(e.mouse);
+ xraton = e.mouse.x;
+ yraton = e.mouse.y;
+ }
+ if (e.type == Common::EVENT_KEYUP) {
+ changeGameSpeed(e);
+
+ switch (e.kbd.keycode) {
+ case Common::KEYCODE_ESCAPE:
+ escapePressed = true;
+ break;
+ case Common::KEYCODE_F1:
+ soundControls();
+ break;
+ case Common::KEYCODE_F2:
+ g_engine->openMainMenuDialog();
+ // saveLoad();
+ break;
+ /* Debug */
+ {
+ case Common::KEYCODE_5:
+ showMouseGrid = !showMouseGrid;
+ break;
+ case Common::KEYCODE_6:
+ showScreenGrid = !showScreenGrid;
+ break;
+ case Common::KEYCODE_7:
+ showGameGrid = !showGameGrid;
+ break;
+ case Common::KEYCODE_0:
+ effect(13, false, fondo);
+ break;
+ case Common::KEYCODE_8:
+ drawObjectAreas = !drawObjectAreas;
+ break;
+ case Common::KEYCODE_1:
+ setRoomTrajectories(altoanimado, anchoanimado, RESTORE);
+ break;
+ case Common::KEYCODE_2:
+ setRoomTrajectories(altoanimado, anchoanimado, SET_WITH_ANIM);
+ break;
+ }
+ /* End debug */
+ case Common::KEYCODE_a: // open
+ numeroaccion = 5;
+ action();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ break;
+ case Common::KEYCODE_e: // close
+ numeroaccion = 6;
+ action();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ break;
+ case Common::KEYCODE_c: // pickup
+ numeroaccion = 2;
+ action();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ break;
+ case Common::KEYCODE_h: // talk
+ numeroaccion = 1;
+ action();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ break;
+ case Common::KEYCODE_m: // look
+ numeroaccion = 3;
+ action();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ break;
+ case Common::KEYCODE_u: // use
+ numeroaccion = 4;
+ action();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ break;
+ default:
+ numeroaccion = 0; // go to
+ }
+ } else if (e.type == Common::EVENT_LBUTTONUP) {
+ pulsax = e.mouse.x;
+ pulsay = e.mouse.y;
+ if (pulsay > 0 && pulsay < 131) {
+ switch (numeroaccion) {
+ case 0: // go to
+ contadorpc2 = contadorpc;
+ // gets the area where the character is now standing. Area is calculated using xframe,yframe plus some adjustments to get the center of the feet
+ zonaactual = roomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory];
+ if (zonaactual < 10) {
+ xframe2 = pulsax + 7;
+ yframe2 = pulsay + 7;
+ // obtains the target area from the clicked coordinates
+ zonadestino = roomData->rejapantalla[xframe2 / factorx][yframe2 / factory];
+ if (roomData->codigo == 21 && roomData->banderamovimiento) {
+ if ((zonadestino >= 1 && zonadestino <= 5) ||
+ (zonadestino >= 9 && zonadestino <= 13) ||
+ (zonadestino >= 18 && zonadestino <= 21) ||
+ zonadestino == 24 || zonadestino == 25) {
+
+ zonadestino = 7;
+ pulsax = 232;
+ pulsay = 75;
+
+ xframe2 = pulsax + 7;
+ yframe2 = pulsay + 7;
+ }
+ }
+
+ if (oldzonadestino != zonadestino || zonadestino < 10) {
+ oldzonadestino = zonadestino;
+ // Resets the entire route
+ calculateRoute(zonaactual, zonadestino);
+
+ indicepuertas = 0;
+ cambiopantalla = false;
+
+ for(indicepuertas = 0; indicepuertas < 5; indicepuertas++) {
+ if (roomData->doors[indicepuertas].codigopuerta == zonadestino) {
+
+ if (roomData->doors[indicepuertas].abiertacerrada == 1) {
+ cambiopantalla = true;
+ break;
+ } else if (roomData->codigo == 5 && zonadestino == 27 || roomData->codigo == 6 && zonadestino == 21) {
+ ;
+ } else {
+ pasos -= 1;
+ }
+ }
+ }
+ // Sets xframe2 again due to the substraction when closed doors
+ xframe2 = pasos;
+ } else
+ xframe2 = 0;
+ }
+ break;
+ case 1: // talk
+ cambiopantalla = false;
+ numeroaccion = 0;
+ talkScreenObject();
+ contadorpc2 = contadorpc;
+ break;
+ case 2: // pick up
+ cambiopantalla = false;
+ numeroaccion = 0;
+ pickupScreenObject();
+ contadorpc = contadorpc2;
+ break;
+ case 3: // look at
+ cambiopantalla = false;
+ destinox_paso = (pulsax + 7) / factorx;
+ destinoy_paso = (pulsay + 7) / factory;
+ if (roomData->indexadoobjetos[roomData->mouseGrid[destinox_paso][destinoy_paso]]->indicefichero > 0) {
+ goToObject(
+ roomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory],
+ roomData->rejapantalla[destinox_paso][destinoy_paso]);
+ if (roomData->indexadoobjetos[roomData->mouseGrid[destinox_paso][destinoy_paso]]->indicefichero == 562)
+
+ switch (roomData->codigo) {
+ case 20:
+ if (hornacina[0][hornacina[0][3]] > 0)
+ readItemRegister(hornacina[0][hornacina[0][3]]);
+ else
+ readItemRegister(562);
+ break;
+ case 24:
+ if (hornacina[1][hornacina[1][3]] > 0)
+ readItemRegister(hornacina[1][hornacina[1][3]]);
+ else
+ readItemRegister(562);
+ break;
+ }
+ else
+ readItemRegister(roomData->indexadoobjetos[roomData->mouseGrid[destinox_paso][destinoy_paso]]->indicefichero);
+ if (regobj.lookAtTextRef > 0)
+ drawText(regobj.lookAtTextRef);
+ numeroaccion = 0;
+ }
+ break;
+ case 4: //use
+ cambiopantalla = false;
+ numeroaccion = 0;
+ useScreenObject();
+ contadorpc = contadorpc2;
+ break;
+ case 5: // open
+ cambiopantalla = false;
+ numeroaccion = 0;
+ openScreenObject();
+ break;
+ case 6: { // close
+ cambiopantalla = false;
+ numeroaccion = 0;
+ closeScreenObject();
+ contadorpc = contadorpc2;
+ } break;
+ }
+ } else if (pulsay > 148 && pulsay < 158) {
+ if (pulsax >= 3 && pulsax <= 53) {
+ numeroaccion = 1;
+ action();
+ break;
+ } else if (pulsax >= 58 && pulsax <= 103) {
+ numeroaccion = 2;
+ action();
+ break;
+ } else if (pulsax >= 108 && pulsax <= 153) {
+ numeroaccion = 3;
+ action();
+ break;
+ } else if (pulsax >= 158 && pulsax <= 198) {
+ numeroaccion = 4;
+ action();
+ break;
+ } else if (pulsax >= 203 && pulsax <= 248) {
+ numeroaccion = 5;
+ action();
+ break;
+ } else if (pulsax >= 253 && pulsax <= 311) {
+ numeroaccion = 6;
+ action();
+ break;
+ } else {
+ numeroaccion = 0;
+ action();
+ contadorpc2 = contadorpc;
+ }
+ } else if (pulsay > 166 && pulsay < 199) {
+ if (pulsax >= 3 && pulsax <= 19) {
+ inventory(0, 33);
+ break;
+ } else if (pulsax >= 26 && pulsax <= 65) {
+ handleAction(posicioninv);
+ break;
+ } else if (pulsax >= 70 && pulsax <= 108) {
+ handleAction(posicioninv + 1);
+ break;
+ } else if (pulsax >= 113 && pulsax <= 151) {
+ handleAction(posicioninv + 2);
+ break;
+ } else if (pulsax >= 156 && pulsax <= 194) {
+ handleAction(posicioninv + 3);
+ break;
+ } else if (pulsax >= 199 && pulsax <= 237) {
+ handleAction(posicioninv + 4);
+ break;
+ } else if (pulsax >= 242 && pulsax <= 280) {
+ handleAction(posicioninv + 5);
+ break;
+ } else if (pulsax >= 290 && pulsax <= 311) {
+ inventory(1, 33);
+ break;
+ } else {
+ numeroaccion = 0;
+ action();
+ }
+ }
+ } else if (e.type == Common::EVENT_RBUTTONUP) {
+ pulsax = e.mouse.x;
+ pulsay = e.mouse.y;
+ destinox_paso = (pulsax + 7) / factorx;
+ destinoy_paso = (pulsay + 7) / factory;
+ contadorpc2 = contadorpc;
+ if (destinoy_paso < 28) {
+ RoomObjectListEntry obj = *roomData->indexadoobjetos[roomData->mouseGrid[destinox_paso][destinoy_paso]];
+ if (obj.indicefichero > 0) {
+
+ drawLookAtItem(obj);
+ goToObject(roomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], roomData->rejapantalla[destinox_paso][destinoy_paso]);
+ if (obj.indicefichero == 562)
+
+ switch (roomData->codigo) {
+ case 20:
+ if (hornacina[0][hornacina[0][3]] > 0)
+ readItemRegister(hornacina[0][hornacina[0][3]]);
+ else
+ readItemRegister(562);
+ break;
+ case 24:
+ if (hornacina[1][hornacina[1][3]] > 0)
+ readItemRegister(hornacina[1][hornacina[1][3]]);
+ else
+ readItemRegister(562);
+ break;
+ }
+ else
+ readItemRegister(obj.indicefichero);
+ if (regobj.lookAtTextRef > 0)
+ drawText(regobj.lookAtTextRef);
+ numeroaccion = 0;
+ }
+ }
+ }
+ }
+
+ checkMouseGrid();
+ advanceAnimations(false, true);
+
+ // Scene changes
+ if (xframe2 == 0 && cambiopantalla) {
+ cambiopantalla = false;
+ contadorpc = contadorpc2;
+ setRoomTrajectories(altoanimado, anchoanimado, RESTORE);
+ saveRoomData(roomData, rooms);
+
+ // verifyCopyProtection();
+ // fichpanta << datospantalla;
+ // close(fichpanta);
+ // setSfxVolume(volumenfxizquierdo, volumenfxderecho);
+
+ switch (roomData->doors[indicepuertas].pantallaquecarga) {
+ case 2: {
+ tipoefectofundido = Random(15) + 1;
+ iframe = 0;
+ indicetray = 0;
+ characterPosX = roomData->doors[indicepuertas].posxsalida - rectificacionx;
+ characterPosY = roomData->doors[indicepuertas].posysalida - rectificaciony;
+ trayec[indicetray].x = characterPosX;
+ trayec[indicetray].y = characterPosY;
+ freeAnimation();
+ freeObject();
+ g_engine->_mouseManager->hide();
+
+ effect(tipoefectofundido, true, NULL);
+ stopVoc();
+ loadScreenData(roomData->doors[indicepuertas].pantallaquecarga);
+ if (contadorpc > 89)
+ error("engine_start(): contadorpc (274)");
+ setSfxVolume(volumenfxizquierdo, volumenfxderecho);
+ if (teleencendida)
+ autoPlayVoc("PARASITO", 355778, 20129);
+ else
+ cargatele();
+ effect(tipoefectofundido, false, fondo);
+ contadorpc = contadorpc2;
+ g_engine->_mouseManager->show();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ } break;
+ case 5: {
+ if (roomData->codigo != 6) {
+ tipoefectofundido = Random(15) + 1;
+ iframe = 0;
+ indicetray = 0;
+ characterPosX = roomData->doors[indicepuertas].posxsalida - rectificacionx;
+ characterPosY = roomData->doors[indicepuertas].posysalida - rectificaciony + 15;
+ trayec[indicetray].x = characterPosX;
+ trayec[indicetray].y = characterPosY;
+ freeAnimation();
+ freeObject();
+ g_engine->_mouseManager->hide();
+ effect(tipoefectofundido, true, NULL);
+ loadScreenData(roomData->doors[indicepuertas].pantallaquecarga);
+ stopVoc();
+ autoPlayVoc("CALDERA", 6433, 15386);
+ setSfxVolume(volumenfxizquierdo, 0);
+ effect(tipoefectofundido, false, fondo);
+ g_engine->_mouseManager->show();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ checkMouseGrid();
+ } else {
+
+ zonaactual = roomData->rejapantalla[((characterPosX + rectificacionx) / factorx)][((characterPosY + rectificaciony) / factory)];
+ zonadestino = 21;
+ goToObject(zonaactual, zonadestino);
+ freeAnimation();
+ freeObject();
+ g_engine->_mouseManager->hide();
+ setSfxVolume(volumenfxizquierdo, 0);
+ loadScrollData(roomData->doors[indicepuertas].pantallaquecarga, true, 22, -2);
+ g_engine->_mouseManager->show();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ checkMouseGrid();
+ }
+ } break;
+ case 6: {
+ zonaactual = roomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory];
+ zonadestino = 27;
+ goToObject(zonaactual, zonadestino);
+ freeAnimation();
+ freeObject();
+ g_engine->_mouseManager->hide();
+ setSfxVolume(volumenfxizquierdo, volumenfxderecho);
+ loadScrollData(roomData->doors[indicepuertas].pantallaquecarga, false, 22, 2);
+ g_engine->_mouseManager->show();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ checkMouseGrid();
+ } break;
+ case 9: {
+ tipoefectofundido = Random(15) + 1;
+ freeAnimation();
+ freeObject();
+ g_engine->_mouseManager->hide();
+ effect(tipoefectofundido, true, NULL);
+ iframe = 0;
+ indicetray = 0;
+ characterPosX = roomData->doors[indicepuertas].posxsalida - rectificacionx;
+ characterPosY = roomData->doors[indicepuertas].posysalida - rectificaciony;
+ trayec[indicetray].x = characterPosX;
+ trayec[indicetray].y = characterPosY;
+ loadScreenData(roomData->doors[indicepuertas].pantallaquecarga);
+ effect(tipoefectofundido, false, fondo);
+ g_engine->_mouseManager->show();
+
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ checkMouseGrid();
+ } break;
+ case 12: {
+ if (roomData->codigo != 13) {
+ tipoefectofundido = Random(15) + 1;
+ iframe = 0;
+ indicetray = 0;
+ characterPosX = roomData->doors[indicepuertas].posxsalida - rectificacionx;
+ characterPosY = roomData->doors[indicepuertas].posysalida - rectificaciony;
+ trayec[indicetray].x = characterPosX;
+ trayec[indicetray].y = characterPosY;
+ freeAnimation();
+ freeObject();
+ g_engine->_mouseManager->hide();
+ effect(tipoefectofundido, true, NULL);
+ loadScreenData(roomData->doors[indicepuertas].pantallaquecarga);
+ effect(tipoefectofundido, false, fondo);
+ g_engine->_mouseManager->show();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ g_engine->_mouseManager->show();
+ } else {
+
+ zonaactual = roomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory];
+ goToObject(zonaactual, zonadestino);
+ freeAnimation();
+ freeObject();
+ g_engine->_mouseManager->hide();
+ loadScrollData(roomData->doors[indicepuertas].pantallaquecarga, false, 64, 0);
+ g_engine->_mouseManager->show();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ checkMouseGrid();
+ }
+ } break;
+ case 13: {
+ switch (roomData->codigo) {
+ case 12: {
+ zonaactual = roomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory];
+ goToObject(zonaactual, zonadestino);
+ freeAnimation();
+ freeObject();
+ g_engine->_mouseManager->hide();
+ loadScrollData(roomData->doors[indicepuertas].pantallaquecarga, true, 64, 0);
+ g_engine->_mouseManager->show();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ checkMouseGrid();
+ } break;
+ case 14: {
+ zonaactual = roomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory];
+ goToObject(zonaactual, zonadestino);
+ freeAnimation();
+ freeObject();
+ g_engine->_mouseManager->hide();
+ loadScrollData(roomData->doors[indicepuertas].pantallaquecarga, false, 56, 0);
+ g_engine->_mouseManager->show();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ checkMouseGrid();
+ } break;
+ }
+ } break;
+ case 14: {
+ if (roomData->codigo != 13) {
+ tipoefectofundido = Random(15) + 1;
+ iframe = 0;
+ indicetray = 0;
+ characterPosX = roomData->doors[indicepuertas].posxsalida - rectificacionx;
+ characterPosY = roomData->doors[indicepuertas].posysalida - rectificaciony;
+ trayec[indicetray].x = characterPosX;
+ trayec[indicetray].y = characterPosY;
+ freeAnimation();
+ freeObject();
+ g_engine->_mouseManager->hide();
+ effect(tipoefectofundido, true, NULL);
+ loadScreenData(roomData->doors[indicepuertas].pantallaquecarga);
+ effect(tipoefectofundido, false, fondo);
+ g_engine->_mouseManager->show();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ checkMouseGrid();
+ } else {
+
+ zonaactual = roomData->rejapantalla[((characterPosX + rectificacionx) / factorx)][((characterPosY + rectificaciony) / factory)];
+ goToObject(zonaactual, zonadestino);
+ freeAnimation();
+ freeObject();
+ g_engine->_mouseManager->hide();
+ loadScrollData(roomData->doors[indicepuertas].pantallaquecarga, true, 56, 0);
+ g_engine->_mouseManager->show();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ checkMouseGrid();
+ }
+ } break;
+ case 17: {
+ tipoefectofundido = Random(15) + 1;
+ iframe = 0;
+ indicetray = 0;
+ characterPosX = roomData->doors[indicepuertas].posxsalida - rectificacionx;
+ characterPosY = roomData->doors[indicepuertas].posysalida - rectificaciony;
+ trayec[indicetray].x = characterPosX;
+ trayec[indicetray].y = characterPosY;
+ freeAnimation();
+ freeObject();
+ g_engine->_mouseManager->hide();
+ effect(tipoefectofundido, true, NULL);
+ stopVoc();
+ loadScreenData(roomData->doors[indicepuertas].pantallaquecarga);
+ if (libro[0] == true && roomData->banderamovimiento == true)
+ disableSecondAnimation();
+ if (contadorpc > 89)
+ error("engine_start(): contadorpc (274)");
+ setSfxVolume(volumenfxizquierdo, volumenfxderecho);
+ effect(tipoefectofundido, false, fondo);
+ contadorpc = contadorpc2;
+ g_engine->_mouseManager->show();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ checkMouseGrid();
+ } break;
+ case 18: {
+ if (roomData->codigo != 19) {
+ tipoefectofundido = Random(15) + 1;
+ iframe = 0;
+ indicetray = 0;
+ characterPosX = roomData->doors[indicepuertas].posxsalida - rectificacionx;
+ characterPosY = roomData->doors[indicepuertas].posysalida - rectificaciony;
+ trayec[indicetray].x = characterPosX;
+ trayec[indicetray].y = characterPosY;
+ freeAnimation();
+ freeObject();
+ g_engine->_mouseManager->hide();
+ effect(tipoefectofundido, true, NULL);
+ loadScreenData(roomData->doors[indicepuertas].pantallaquecarga);
+ effect(tipoefectofundido, false, fondo);
+ g_engine->_mouseManager->show();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ checkMouseGrid();
+ } else {
+
+ zonaactual = roomData->rejapantalla[((characterPosX + rectificacionx) / factorx)][((characterPosY + rectificaciony) / factory)];
+ goToObject(zonaactual, zonadestino);
+ freeAnimation();
+ freeObject();
+ g_engine->_mouseManager->hide();
+ loadScrollData(roomData->doors[indicepuertas].pantallaquecarga, true, 131, -1);
+ g_engine->_mouseManager->show();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ checkMouseGrid();
+ }
+ } break;
+ case 19: {
+ if (roomData->codigo != 18) {
+ tipoefectofundido = Random(15) + 1;
+ iframe = 0;
+ indicetray = 0;
+ characterPosX = roomData->doors[indicepuertas].posxsalida - rectificacionx;
+ characterPosY = roomData->doors[indicepuertas].posysalida - rectificaciony;
+ trayec[indicetray].x = characterPosX;
+ trayec[indicetray].y = characterPosY;
+ freeAnimation();
+ freeObject();
+ g_engine->_mouseManager->hide();
+ effect(tipoefectofundido, true, NULL);
+ loadScreenData(roomData->doors[indicepuertas].pantallaquecarga);
+ effect(tipoefectofundido, false, fondo);
+ g_engine->_mouseManager->show();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ checkMouseGrid();
+ } else {
+
+ zonaactual = roomData->rejapantalla[((characterPosX + rectificacionx) / factorx)][((characterPosY + rectificaciony) / factory)];
+ goToObject(zonaactual, zonadestino);
+ freeAnimation();
+ freeObject();
+ g_engine->_mouseManager->hide();
+ loadScrollData(roomData->doors[indicepuertas].pantallaquecarga, false, 131, 1);
+ g_engine->_mouseManager->show();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ checkMouseGrid();
+ }
+ } break;
+ case 20: {
+ tipoefectofundido = Random(15) + 1;
+ iframe = 0;
+ indicetray = 0;
+ characterPosX = roomData->doors[indicepuertas].posxsalida - rectificacionx;
+ characterPosY = roomData->doors[indicepuertas].posysalida - rectificaciony;
+ trayec[indicetray].x = characterPosX;
+ trayec[indicetray].y = characterPosY;
+ freeAnimation();
+ freeObject();
+ g_engine->_mouseManager->hide();
+ effect(tipoefectofundido, true, NULL);
+ stopVoc();
+ loadScreenData(roomData->doors[indicepuertas].pantallaquecarga);
+ switch (hornacina[0][hornacina[0][3]]) {
+ case 0:
+ roomData->indexadoobjetos[9]->objectName = "HORNACINA";
+ break;
+ case 561:
+ roomData->indexadoobjetos[9]->objectName = "ESTATUA DIVINA";
+ break;
+ case 563:
+ roomData->indexadoobjetos[9]->objectName = "MANUAL DE ALFARERO";
+ break;
+ case 615:
+ roomData->indexadoobjetos[9]->objectName = "ESTATUA GROTESCA";
+ break;
+ }
+ if (contadorpc > 89)
+ error("engine_start(): contadorpc (274)");
+ setSfxVolume(volumenfxizquierdo, volumenfxderecho);
+ if (roomData->codigo == 4)
+ loadVoc("GOTA", 140972, 1029);
+ effect(tipoefectofundido, false, fondo);
+ contadorpc = contadorpc2;
+ g_engine->_mouseManager->show();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ checkMouseGrid();
+ } break;
+ case 24: {
+ tipoefectofundido = Random(15) + 1;
+ iframe = 0;
+ indicetray = 0;
+ characterPosX = roomData->doors[indicepuertas].posxsalida - rectificacionx;
+ characterPosY = roomData->doors[indicepuertas].posysalida - rectificaciony;
+ trayec[indicetray].x = characterPosX;
+ trayec[indicetray].y = characterPosY;
+ freeAnimation();
+ freeObject();
+ g_engine->_mouseManager->hide();
+ effect(tipoefectofundido, true, NULL);
+ stopVoc();
+ loadScreenData(roomData->doors[indicepuertas].pantallaquecarga);
+ switch (hornacina[1][hornacina[1][3]]) {
+ case 0:
+ roomData->indexadoobjetos[8]->objectName = "HORNACINA";
+ break;
+ case 561:
+ roomData->indexadoobjetos[8]->objectName = "ESTATUA DIVINA";
+ break;
+ case 615:
+ roomData->indexadoobjetos[8]->objectName = "ESTATUA GROTESCA";
+ break;
+ case 622:
+ roomData->indexadoobjetos[8]->objectName = "PARED";
+ break;
+ case 623:
+ roomData->indexadoobjetos[8]->objectName = "TORNO";
+ break;
+ }
+ if (contadorpc > 89)
+ error("engine_start(): contadorpc (274)");
+ setSfxVolume(volumenfxizquierdo, volumenfxderecho);
+ if (trampa_puesta) {
+ roomData->banderamovimiento = true;
+ loadAnimation(roomData->nombremovto);
+ iframe2 = 0;
+ indicetray2 = 1;
+ roomData->tray2[indicetray2 - 1].x = 214 - 15;
+ roomData->tray2[indicetray2 - 1].y = 115 - 42;
+ animado.dir = roomData->dir2[indicetray2 - 1];
+ animado.posx = roomData->tray2[indicetray2 - 1].x;
+ animado.posy = roomData->tray2[indicetray2 - 1].y;
+ animado.profundidad = 14;
+
+ for (iaux = 0; iaux < maxrejax; iaux++)
+ for (iaux2 = 0; iaux2 < maxrejay; iaux2++) {
+ if (rejamascaramovto[iaux][iaux2] > 0){
+ roomData->rejapantalla[oldposx + iaux][oldposy + iaux2] = rejamascaramovto[iaux][iaux2];
+ }
+ if (rejamascararaton[iaux][iaux2] > 0)
+ roomData->mouseGrid[oldposx + iaux][oldposy + iaux2] = rejamascararaton[iaux][iaux2];
+ }
+ assembleScreen();
+ }
+ effect(tipoefectofundido, false, fondo);
+ if ((rojo_capturado == false) && (trampa_puesta == false))
+ runaroundRed();
+ contadorpc = contadorpc2;
+ g_engine->_mouseManager->show();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ checkMouseGrid();
+ } break;
+ case 255:
+ wcScene();
+ break;
+ default: {
+ tipoefectofundido = Random(15) + 1;
+ iframe = 0;
+ indicetray = 0;
+ characterPosX = roomData->doors[indicepuertas].posxsalida - rectificacionx;
+ characterPosY = roomData->doors[indicepuertas].posysalida - rectificaciony;
+ trayec[indicetray].x = characterPosX;
+ trayec[indicetray].y = characterPosY;
+ freeAnimation();
+ freeObject();
+ g_engine->_mouseManager->hide();
+ effect(tipoefectofundido, true, NULL);
+ stopVoc();
+ loadScreenData(roomData->doors[indicepuertas].pantallaquecarga);
+ if (contadorpc > 89)
+ error("engine_start(): contadorpc (274)");
+ setSfxVolume(volumenfxizquierdo, volumenfxderecho);
+ switch (roomData->codigo) {
+ case 4:
+ loadVoc("GOTA", 140972, 1029);
+ break;
+ case 23:
+ autoPlayVoc("FUENTE", 0, 0);
+ break;
+ }
+ effect(tipoefectofundido, false, fondo);
+ contadorpc = contadorpc2;
+ g_engine->_mouseManager->show();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ checkMouseGrid();
+ }
+ }
+ oldzonadestino = 0;
+ }
+
+ if (escapePressed && xframe2 == 0) {
+ freeAnimation();
+ freeObject();
+ contadorpc2 = contadorpc;
+ partidanueva = false;
+ continuarpartida = false;
+ g_engine->saveAutosaveIfEnabled();
+ totalFadeOut(0);
+ lowerMidiVolume(volumenmelodiaizquierdo,
+ volumenmelodiaderecho);
+ clear();
+ playMidiFile("INTRODUC", true);
+ restoreMidiVolume(volumenmelodiaizquierdo,
+ volumenmelodiaderecho);
+ initialMenu(true);
+ verifyCopyProtection2();
+ if (partidanueva) {
+ newGame();
+ } else if (continuarpartida)
+ loadTemporaryGame();
+ else {
+ desactivagrabar = true;
+ saveLoad();
+ contadorpc = contadorpc2;
+ desactivagrabar = false;
+ }
+ lowerMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
+ switch (parte_del_juego) {
+ case 1:
+ playMidiFile("PRIMERA", true);
+ break;
+ case 2:
+ playMidiFile("SEGUNDA", true);
+ break;
+ }
+ restoreMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
+ }
+
+ switch (parte_del_juego) {
+ case 1:
+ if (completadalista1 && completadalista2) {
+ completadalista1 = false;
+ completadalista2 = false;
+ contadorpc = contadorpc2;
+ parte_del_juego = 2;
+ iframe = 0;
+ freeInventory();
+ freeAnimation();
+ freeObject();
+ g_engine->_mouseManager->hide();
+ partialFadeOut(234);
+ lowerMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
+ playMidiFile("CREDITOS", true);
+ restoreMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
+ if (contadorpc2 > 43)
+ _exit(274);
+ // sacrifice();
+ clear();
+ loadObjects();
+ loadPalette("SEGUNDA");
+ indicetray = 0;
+ characterPosX = 160;
+ characterPosY = 60;
+ trayec[indicetray].x = characterPosX;
+ trayec[indicetray].y = characterPosY;
+ loadScreenData(20);
+ lowerMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
+ playMidiFile("SEGUNDA", true);
+ restoreMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
+ effect(1, false, fondo);
+ mask();
+ posicioninv = 0;
+ drawBackpack();
+ g_engine->_mouseManager->show();
+
+ primera[8] = true;
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ checkMouseGrid();
+ }
+ break;
+ }
+
+ // Debug graphics
+ {
+ g_engine->_graphics->euroText(Common::String::format("Room: %d", roomNumber), 0, 0, 220, Graphics::kTextAlignLeft);
+ // g_engine->_mouseManager->printPos(xraton, yraton, 220, 0);
+ // printPos(characterPosX, characterPosY, 220, 10, "CharPos");
+ if (showMouseGrid) {
+ drawMouseGrid(roomData);
+ }
+ if (showScreenGrid) {
+ drawScreenGrid(roomData);
+ }
+ if (showGameGrid) {
+ drawGrid();
+ }
+
+ if (drawObjectAreas) {
+ for (int indice = 0; indice < nivelesdeprof; indice++) {
+ if (objetos[indice] != NULL) {
+ if (true) {
+ // debug
+ uint16 w = READ_LE_UINT16(objetos[indice]);
+ uint16 h = READ_LE_UINT16(objetos[indice] + 2);
+ Common::Rect r = Common::Rect(profundidad[indice].posx, profundidad[indice].posy, profundidad[indice].posx + w, profundidad[indice].posy + h);
+ drawRect(180, profundidad[indice].posx, profundidad[indice].posy, profundidad[indice].posx + w, profundidad[indice].posy + h);
+
+ outtextxy(r.left, r.top, Common::String().format("%d", indice), 0);
+ }
+ }
+ }
+ }
+ g_engine->_screen->markAllDirty();
+ g_engine->_screen->update();
+ }
+
+ g_engine->_screen->update();
+ g_system->delayMillis(10);
+ }
+ g_engine->_mouseManager->hide();
+ if(!g_engine->shouldQuit()){
+ ending();
+ }
+ if(!g_engine->shouldQuit()){
+ obtainName(nombreficherofoto);
+ }
+ if(!g_engine->shouldQuit()){
+ generateDiploma(nombreficherofoto);
+ }
+ if(!g_engine->shouldQuit()){
+ credits();
+ }
+ return EXIT_SUCCESS;
+}
+
+} // end of namespace Tot
diff --git a/engines/tot/graphics.cpp b/engines/tot/graphics.cpp
new file mode 100644
index 00000000000..cf013c7ff9f
--- /dev/null
+++ b/engines/tot/graphics.cpp
@@ -0,0 +1,932 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/endian.h"
+#include "common/file.h"
+#include "common/memstream.h"
+#include "common/system.h"
+#include "common/textconsole.h"
+#include "graphics/paletteman.h"
+
+#include "tot/graphics.h"
+#include "tot/tot.h"
+#include "tot/util.h"
+
+namespace Tot {
+
+signed char datosfundido[256][256];
+int ipal, jpal;
+
+void rectangle(int x1, int y1, int x2, int y2, byte color) {
+ g_engine->_screen->drawLine(x1, y1, x2, y1, color);
+ g_engine->_screen->drawLine(x2, y1, x2, y2, color);
+ g_engine->_screen->drawLine(x1, y2, x2, y2, color);
+ g_engine->_screen->drawLine(x1, y1, x1, y2, color);
+ g_engine->_screen->addDirtyRect(Common::Rect(x1, y1, x2, y2));
+}
+
+void rectangle(uint x1, uint y1, uint x2, uint y2, byte color) {
+ g_engine->_screen->drawLine(x1, y1, x2, y1, color);
+ g_engine->_screen->drawLine(x2, y1, x2, y2, color);
+ g_engine->_screen->drawLine(x1, y2, x2, y2, color);
+ g_engine->_screen->drawLine(x1, y1, x1, y2, color);
+ g_engine->_screen->addDirtyRect(Common::Rect(x1, y1, x2, y2));
+}
+
+// Copies the rectangle delimited by getCoord** from backgroundScreen into image
+void getVirtualImg(
+ uint getcoordx1, // xframe
+ uint getcoordy1, // yframe
+ uint getcoordx2, // xframe + pasoFrameW
+ uint getcoordy2, // yframe + pasoFrameH
+ byte *backgroundScreen, // fondo
+ byte *image // fondsprite
+) {
+ uint16 w = getcoordx2 - getcoordx1;
+ uint16 h = getcoordy2 - getcoordy1;
+
+ WRITE_UINT16(image, w);
+ WRITE_UINT16(image + 2, h);
+ w++;
+ h++;
+ int posAbs = 4 + getcoordx1 + (getcoordy1 * 320);
+
+ int sourcePtr = 0;
+ byte *destPtr = 4 + image; // Start writing after width and height
+
+ for (int i = 0; i < h; i++) {
+ for (int j = 0; j < w; j++) {
+ *destPtr++ = backgroundScreen[posAbs + sourcePtr++];
+ }
+ sourcePtr += (320 - w); // Move to the beginning of the next row in PantFondo
+ }
+}
+// puts an image into a buffer in the given position, asuming 320 width
+void putVirtualImg(uint putcoordx, uint putcoordy, byte *backgroundScreen, byte *image) {
+ uint16 w, h;
+
+ w = READ_LE_UINT16(image);
+ h = READ_LE_UINT16(image + 2);
+
+ w++;
+ h++;
+ int posAbs = 4 + putcoordx + (putcoordy * 320);
+
+ int sourcePtr = 0;
+ byte *destPtr = 4 + image; // Start writing after width and height
+
+ for (int i = 0; i < h; i++) {
+ for (int j = 0; j < w; j++) {
+ // if(destPtr > 0)
+ backgroundScreen[posAbs + sourcePtr++] = *destPtr++;
+ }
+ sourcePtr += (320 - w); // Move to the beginning of the next row in PantFondo
+ }
+}
+
+void getImg(uint coordx1, uint coordy1, uint coordx2, uint coordy2, byte *image) {
+
+ uint16 width = coordx2 - coordx1;
+ uint16 height = coordy2 - coordy1;
+
+ WRITE_LE_UINT16(image, width);
+ WRITE_LE_UINT16(image + 2, height);
+
+ width++;
+ height++;
+
+ for (int j = 0; j < width; j++) {
+ for (int i = 0; i < height; i++) {
+ int idx = 4 + i * width + j;
+ *(image + idx) = *(byte *)g_engine->_screen->getBasePtr(coordx1 + j, coordy1 + i);
+ }
+ }
+}
+
+void putShape(uint coordx, uint coordy, byte *image) {
+ putImg(coordx, coordy, image, true);
+}
+
+void drawFullScreen(byte *screen) {
+ Common::copy(screen, screen + 64000, (byte *)g_engine->_screen->getPixels());
+}
+
+void copyFromScreen(byte *&screen) {
+ byte *src = (byte *)g_engine->_screen->getPixels();
+ Common::copy(src, src + 64000, screen);
+}
+
+void drawScreen(byte *screen, boolean offsetSize) {
+ int offset = offsetSize ? 4:0;
+ for (int i1 = 0; i1 < 320; i1++) {
+ for (int j1 = 0; j1 < 140; j1++) {
+ ((byte *)g_engine->_screen->getPixels())[j1 * 320 + i1] = ((byte *)screen)[offset + j1 * 320 + i1];
+ }
+ }
+ g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
+}
+
+void putImg(uint coordx, uint coordy, byte *image, boolean transparency) {
+ uint16 w, h;
+
+ w = READ_LE_UINT16(image);
+ h = READ_LE_UINT16(image + 2);
+
+ w++;
+ h++;
+ for (int i = 0; i < w; i++) {
+ for (int j = 0; j < h; j++) {
+ int index = 4 + (j * w + i);
+ if (!transparency || image[index] != 0) {
+ *(byte *)g_engine->_screen->getBasePtr(coordx + i, coordy + j) = image[index];
+ }
+ }
+ }
+ g_engine->_screen->addDirtyRect(Common::Rect(coordx, coordy, coordx + w, coordy + h));
+}
+
+void clear() {
+ g_engine->_screen->clear();
+}
+
+void loadPalette(Common::String paletteName) {
+
+ Common::File fichero;
+
+ if (!fichero.open(Common::Path(paletteName + ".PAL")))
+ error("unable to load palette %s (310)", paletteName.c_str());
+ fichero.read(pal, 768);
+ fichero.close();
+
+ g_engine->_graphics->fixPalette(pal, 768);
+ g_engine->_graphics->setPalette(pal);
+}
+
+void effect(byte numeroefecto, boolean pasaranegro, byte *pantalla2) {
+
+ int i1, i2, i3, j1, j2, j3;
+ byte oldcolor;
+ palette palpaso;
+ bool enabled = false;
+ // numeroefecto = 1;
+
+ byte * screenBuf = (byte *)g_engine->_screen->getPixels();
+ // Disable effects for now
+ if (!enabled) {
+ debug("Effects disabled! requested effect is %d, with fadeToBlack =%d", numeroefecto, pasaranegro);
+ if (!pasaranegro) {
+ drawScreen(pantalla2);
+ }
+ } else {
+ contadorpc2 = contadorpc;
+ if (contadorpc > 145)
+ error("effect(): contadorpc (274)");
+ debug("Effect %d, pasaraanegro=%d", numeroefecto, pasaranegro);
+ if (pasaranegro)
+
+ switch (numeroefecto) {
+ case 1: {
+ for (i1 = 0; i1 <= 69; i1++) {
+ line(0, (i1 * 2), 319, (i1 * 2), 0);
+ g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
+ g_engine->_screen->update();
+ delay(5);
+ }
+ for (i1 = 70; i1 >= 1; i1--) {
+ line(0, (i1 * 2 - 1), 319, (i1 * 2 - 1), 0);
+ g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
+ g_engine->_screen->update();
+ delay(5);
+ }
+ } break;
+ case 2: {
+ for (i1 = 70; i1 >= 1; i1--) {
+ line(0, (i1 * 2 - 1), 319, (i1 * 2 - 1), 0);
+ g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
+ g_engine->_screen->update();
+ delay(5);
+ }
+ for (i1 = 0; i1 <= 69; i1++) {
+ line(0, (i1 * 2), 319, (i1 * 2), 0);
+ g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
+ g_engine->_screen->update();
+ delay(5);
+ }
+ } break;
+ case 3: {
+ for (i2 = 1; i2 <= 9; i2++) {
+ i1 = 10;
+ do {
+ j1 = 10;
+ do {
+ bar((i1 - i2), (j1 - i2), (i1 + i2), (j1 + i2), 0);
+ if(j1 % 40 == 0) {
+ g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
+ g_engine->_screen->update();
+ }
+ j1 += 20;
+ } while (j1 != 150);
+ i1 += 20;
+ } while (i1 != 330);
+ }
+ bar(0, 0, 319, 139, 0);
+ g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
+ g_engine->_screen->update();
+ } break;
+ case 4: {
+ for (i2 = 1; i2 <= 22; i2++) {
+ for (i1 = 1; i1 <= 16; i1++)
+ for (j1 = 1; j1 <= 7; j1++) {
+ if ((i1 + j1) == (i2 + 1)) {
+ bar(((i1 - 1) * 20), ((j1 - 1) * 20), ((i1 - 1) * 20 + 19), ((j1 - 1) * 20 + 19), 0);
+ g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
+ g_engine->_screen->update();
+ delay(8);
+ }
+ }
+ }
+ } break;
+ case 5: {
+ for (j1 = 0; j1 <= 139; j1++) {
+ line(0, j1, 319, (139 - j1), 0);
+ if(j1 % 5 == 0) {
+ g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
+ g_engine->_screen->update();
+ }
+ }
+ for (j1 = 318; j1 >= 1; j1--) {
+ line(j1, 0, (319 - j1), 139, 0);
+ if(j1 % 5 == 0) {
+ g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
+ g_engine->_screen->update();
+ }
+ }
+ } break;
+ case 6: {
+ for (i1 = 0; i1 < 70; i1++) {
+ rectangle(i1, i1, (319 - i1), (139 - i1), 0);
+ delay(5);
+ g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
+ g_engine->_screen->update();
+ }
+ } break;
+ case 7: {
+ for (i1 = 69; i1 >= 0; i1--) {
+ rectangle(i1, i1, (319 - i1), (139 - i1), 0);
+ g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
+ g_engine->_screen->update();
+ }
+ } break;
+ case 8: {
+
+ for (i1 = 0; i1 <= 319; i1++) {
+ line(0, 139, i1, 0, 0);
+ if(i1 % 5 == 0) {
+ g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
+ g_engine->_screen->update();
+ }
+ }
+ for (i1 = 1; i1 <= 139; i1++) {
+ line(0, 139, 319, i1, 0);
+ if(i1 % 5 == 0) {
+ g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
+ g_engine->_screen->update();
+ }
+ }
+ } break;
+ case 9: {
+
+ for (i1 = 319; i1 >= 0; i1--) {
+ line(319, 139, i1, 0, 0);
+ if(i1 % 5 == 0) {
+ g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
+ g_engine->_screen->update();
+ }
+ }
+ for (i1 = 1; i1 <= 139; i1++) {
+ line(319, 139, 0, i1, 0);
+ if(i1 % 5 == 0) {
+ g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
+ g_engine->_screen->update();
+ }
+ }
+ } break;
+ case 10: {
+ for (j1 = 1; j1 <= 7; j1++) {
+ if ((j1 % 2) == 0)
+ for (i1 = 1; i1 <= 16; i1++) {
+ bar(((i1 - 1) * 20), ((j1 - 1) * 20), ((i1 - 1) * 20 + 19), ((j1 - 1) * 20 + 19), 0);
+ g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
+ g_engine->_screen->update();
+ delay(8);
+ }
+ else
+ for (i1 = 16; i1 >= 1; i1--) {
+ bar(((i1 - 1) * 20), ((j1 - 1) * 20), ((i1 - 1) * 20 + 19), ((j1 - 1) * 20 + 19), 0);
+ g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
+ g_engine->_screen->update();
+ delay(8);
+ }
+ }
+ } break;
+ case 11: {
+ // for (i2 = 0; i2 <= 3; i2++) {
+ // j1 = 1 + i2;
+ // for (i1 = (1 + i2); i1 <= (16 - i2); i1++) {
+ // bar(((i1 - 1) * 20), ((j1 - 1) * 20), ((i1 - 1) * 20 + 19), ((j1 - 1) * 20 + 19), 0);
+ // delay(8);
+ // }
+ // for (j1 = (2 + i2); j1 <= (7 - i2); j1++) {
+ // bar(((i1 - 1) * 20), ((j1 - 1) * 20), ((i1 - 1) * 20 + 19), ((j1 - 1) * 20 + 19), 0);
+ // delay(8);
+ // }
+ // for (i1 = (16 - i2); i1 >= (1 + i2); i1--) {
+ // bar(((i1 - 1) * 20), ((j1 - 1) * 20), ((i1 - 1) * 20 + 19), ((j1 - 1) * 20 + 19), 0);
+ // delay(8);
+ // }
+ // for (j1 = (6 - i2); j1 >= (2 + i2); j1--) {
+ // bar(((i1 - 1) * 20), ((j1 - 1) * 20), ((i1 - 1) * 20 + 19), ((j1 - 1) * 20 + 19), 0);
+ // delay(8);
+ // }
+ // }
+ drawScreen(pantalla2);
+ } break;
+ case 12: {
+ for (i1 = 1; i1 <= 15000; i1++) {
+ i2 = Random(318);
+ j2 = Random(138);
+ bar(i2, j2, (i2 + 2), (j2 + 2), 0);
+ putpixel(Random(320), Random(139), 0);
+ if(i1 % 100 == 0) {
+ g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
+ g_engine->_screen->update();
+ }
+ }
+ bar(0, 0, 319, 139, 0);
+ g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
+ g_engine->_screen->update();
+ } break;
+ case 13: {
+ for (i1 = 319; i1 >= 0; i1--) {
+ line(i1, 0, i1, 139, 0);
+ if(i1 % 5 == 0) {
+ g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
+ g_engine->_screen->update();
+ }
+ }
+ } break;
+ case 14: {
+ for (i1 = 0; i1 <= 319; i1++) {
+ line(i1, 0, i1, 139, 0);
+ if(i1 % 5 == 0) {
+ g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
+ g_engine->_screen->update();
+ }
+ }
+ } break;
+ case 15: {
+
+ for (j1 = 0; j1 <= 70; j1++) {
+ Common::copy(screenBuf + (j1 * 320), screenBuf + (j1 * 320) + 320, screenBuf + ((j1 + 1) *320));
+ // move(ptr(0xa000, (j1 * 320)), ptr(0xa000, ((j1 + 1) * 320)), 320);
+ line(0, j1, 319, j1, 0);
+ Common::copy(screenBuf + ((139 - j1) * 320), screenBuf + ((139 - j1) * 320) + 320, screenBuf + ((138 - j1) * 320));
+ // move(ptr(0xa000, ((139 - j1) * 320)), ptr(0xa000, ((138 - j1) * 320)), 320);
+ line(0, (139 - j1), 319, (139 - j1), 0);
+ delay(2);
+ g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
+ g_engine->_screen->update();
+ }
+ delay(5);
+ for (j1 = 0; j1 <= 160; j1++) {
+ line(0, 68, j1, 68, 0);
+ line(319, 68, (319 - j1), 68, 0);
+ g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
+ g_engine->_screen->update();
+ }
+ } break;
+ }
+ else
+ switch (numeroefecto) {
+ case 1: {
+ for (i1 = 0; i1 <= 69; i1++) {
+ byte *src = pantalla2 + (i1 * 640) + 4;
+ Common::copy(src, src + 320, screenBuf + (i1 * 640));
+ // move(ptr(seg(pantalla2), (ofs(pantalla2) + (i1 * 640) + 4)), ptr(0xa000, (i1 * 640)), 320);
+ g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
+ g_engine->_screen->update();
+ delay(5);
+ }
+ for (i1 = 70; i1 >= 1; i1--) {
+ byte *src = pantalla2 + (i1 * 640) - 320 + 4;
+ Common::copy(src, src + 320, screenBuf + (i1 * 640) - 320);
+ // move(ptr(seg(pantalla2), (ofs(pantalla2) + ((i1 * 640) - 320) + 4)), ptr(0xa000, ((i1 * 640) - 320)), 320);
+ g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
+ g_engine->_screen->update();
+ delay(5);
+
+ // delay(5);
+ }
+ } break;
+ case 2:
+ case 5:
+ case 8:
+ case 9: {
+ for (i1 = 70; i1 >= 1; i1--) {
+ byte *src = pantalla2 + ((i1 * 640) - 320) + 4;
+ Common::copy(src, src + 320, screenBuf + (i1 * 640) - 320);
+ // move(ptr(seg(pantalla2), (ofs(pantalla2) + ((i1 * 640) - 320) + 4)), ptr(0xa000, ((i1 * 640) - 320)), 320);
+ g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
+ g_engine->_screen->update();
+ delay(5);
+ }
+ for (i1 = 0; i1 <= 69; i1++) {
+ byte *src = pantalla2 + (i1 * 640) + 4;
+ Common::copy(src, src + 320, screenBuf + (i1 * 640));
+ // move(ptr(seg(pantalla2), (ofs(pantalla2) + (i1 * 640) + 4)), ptr(0xa000, (i1 * 640)), 320);
+ g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
+ g_engine->_screen->update();
+ delay(5);
+ }
+ } break;
+ case 3:
+ case 7: {
+ for (i2 = 1; i2 <= 9; i2++) {
+ i1 = 10;
+ do {
+ j1 = 10;
+ do {
+ for (i3 = (j1 - i2); i3 <= (j1 + i2); i3++) {
+ byte *src = pantalla2 + + 4 + (i3 * 320) + + (i1 - i2);
+ Common::copy(src, src + (i2 * 2), screenBuf + (i3 * 320) + (i1 - i2));
+ // move(ptr(seg(pantalla2), (ofs(pantalla2) + 4 + (i3 * 320) + (i1 - i2))), ptr(0xa000, ((i3 * 320) + (i1 - i2))), (i2 * 2));
+ }
+ j1 += 20;
+ } while (j1 != 150);
+ if(i1 % 40 == 0) {
+ g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
+ g_engine->_screen->update();
+ }
+ i1 += 20;
+ } while (i1 != 330);
+ }
+ drawScreen(pantalla2);
+ } break;
+ case 4: {
+ for (i2 = 1; i2 <= 22; i2++) {
+ for (i1 = 1; i1 <= 16; i1++)
+ for (j1 = 1; j1 <= 7; j1++) {
+ if ((i1 + j1) == (i2 + 1)) {
+ for (i3 = ((j1 - 1) * 20); i3 <= ((j1 - 1) * 20 + 19); i3++) {
+ byte *src = pantalla2 + + 4 + (i3 * 320) + ((i1 - 1) * 20);
+ Common::copy(src, src + 20, screenBuf + (i3 * 320) + ((i1 - 1) * 20));
+ // move(ptr(seg(pantalla2), (ofs(pantalla2) + 4 + (i3 * 320) + ((i1 - 1) * 20))), ptr(0xa000, ((i3 * 320) + ((i1 - 1) * 20))), 20);
+ if(i3 % 4 == 0) {
+ g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
+ g_engine->_screen->update();
+ }
+ }
+ delay(8);
+ }
+ }
+ }
+ } break;
+ case 6: {
+ for (i1 = 70; i1 >= 0; i1--) {
+ for (j1 = i1; j1 <= (139 - i1); j1++) {
+ byte *src = pantalla2 + 4 + (j1 * 320) + i1;
+ Common::copy(src, src + 319 - (i1 * 2), screenBuf + (j1 * 320) + i1);
+ // move(ptr(seg(pantalla2), (ofs(pantalla2) + 4 + (j1 * 320) + i1)), ptr(0xa000, ((j1 * 320) + i1)), (319 - (i1 * 2)));
+ }
+ g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
+ g_engine->_screen->update();
+ }
+ } break;
+ case 10: {
+ for (j1 = 1; j1 <= 7; j1++) {
+ if ((j1 % 2) == 0)
+ for (i1 = 1; i1 <= 16; i1++) {
+ for (j3 = ((j1 - 1) * 20); j3 <= ((j1 - 1) * 20 + 19); j3++) {
+ byte *src = pantalla2 + 4 + (j3 * 320) + ((i1 - 1) *20);
+
+ Common::copy(src, src + 20, screenBuf + (j3 * 320) + ((i1 - 1) * 20));
+ // move(ptr(seg(pantalla2), (ofs(pantalla2) + 4 + (j3 * 320) + ((i1 - 1) * 20))), ptr(0xa000, ((j3 * 320) + ((i1 - 1) * 20))), 20);
+ }
+ // if(i1 % 300 == 0) {
+ g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
+ g_engine->_screen->update();
+ // }
+ delay(8);
+ }
+ else
+ for (i1 = 16; i1 >= 1; i1--) {
+ for (j3 = ((j1 - 1) * 20); j3 <= ((j1 - 1) * 20 + 19); j3++) {
+ byte *src = pantalla2 + 4 + (j3 * 320) + ((i1 - 1) *20);
+ Common::copy(src, src + 20, screenBuf + (j3 * 320) + ((i1 - 1) * 20));
+ }
+ g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
+ g_engine->_screen->update();
+ delay(8);
+ }
+ }
+ } break;
+ case 11: {
+ // for (i2 = 0; i2 <= 3; i2 ++) {
+ // j1 = 1 + i2;
+ // for (i1 = (1 + i2); i1 <= (16 - i2); i1 ++) {
+ // for (j3 = ((j1 - 1) * 20); j3 <= ((j1 - 1) * 20 + 19); j3 ++){
+ // byte *buf = pantalla2 + 4 + (j3 * 320) + ((i1 - 1) * 20);
+ // Common::copy(buf, buf + 20, screenBuf + (j3 * 320) + ((i1 - 1) * 20));
+ // g_engine->_screen->markAllDirty();
+ // g_engine->_screen->update();
+ // }
+ // // delay(8);
+ // }
+ // for (j1 = (2 + i2); j1 <= (7 - i2); j1 ++) {
+ // for (j3 = ((j1 - 1) * 20); j3 <= ((j1 - 1) * 20 + 19); j3 ++) {
+ // byte *buf = pantalla2 + 4 + (j3 * 320) + ((i1 - 1) * 20);
+ // Common::copy(buf, buf + 20, screenBuf + (j3 * 320) + ((i1 - 1) * 20));
+ // g_engine->_screen->markAllDirty();
+ // g_engine->_screen->update();
+ // // move(ptr(seg(pantalla2), (ofs(pantalla2) +4 + (j3 * 320) + ((i1 - 1) * 20))), ptr(0xa000, ((j3 * 320) + ((i1 - 1) * 20))), 20);
+ // }
+ // // delay(8);
+ // }
+ // for (i1 = (16 - i2); i1 > (1 + i2); i1 --) {
+ // for (j3 = ((j1 - 1) * 20); j3 <= ((j1 - 1) * 20 + 19); j3 ++) {
+ // byte *buf = pantalla2 + 4 + (j3 * 320) + ((i1 - 1) * 20);
+ // Common::copy(buf, buf + 20, screenBuf + (j3 * 320) + ((i1 - 1) * 20));
+ // g_engine->_screen->markAllDirty();
+ // g_engine->_screen->update();
+ // // move(ptr(seg(pantalla2), (ofs(pantalla2) +4 + (j3 * 320) + ((i1 - 1) * 20))), ptr(0xa000, ((j3 * 320) + ((i1 - 1) * 20))), 20);
+ // }
+ // delay(8);
+ // }
+ // // i1 = 1;
+ // for (j1 = (6 - i2); j1 >= (2 + i2); j1 --) {
+ // for (j3 = ((j1 - 1) * 20); j3 <= ((j1 - 1) * 20 + 19); j3 ++) {
+ // byte *buf = pantalla2 + 4 + (j3 * 320) + ((i1 - 1) * 20);
+ // Common::copy(buf, buf + 20, screenBuf + (j3 * 320) + ((i1 - 1) * 20));
+ // g_engine->_screen->markAllDirty();
+ // g_engine->_screen->update();
+ // // move(ptr(seg(pantalla2), (ofs(pantalla2) +4 + (j3 * 320) + ((i1 - 1) * 20))), ptr(0xa000, ((j3 * 320) + ((i1 - 1) * 20))), 20);
+ // }
+ // delay(8);
+ // }
+ // }
+ drawScreen(pantalla2);
+
+ } break;
+ case 12: {
+ for (i1 = 1; i1 <= 15000; i1++) {
+ i2 = Random(318);
+ j2 = Random(138);
+
+ byte *src1 = pantalla2 + 4 + (j2 * 320) + i2;
+ byte *src2 = pantalla2 + 4 + ((j2 + 1) * 320) + i2;
+ Common::copy(src1, src1 + 2, screenBuf + j2 * 320 + i2);
+ // move(ptr(seg(pantalla2), (ofs(pantalla2) + 4 + (j2 * 320) + i2)), ptr(0xa000, ((j2 * 320) + i2)), 2);
+
+ Common::copy(src2, src2 + 2, screenBuf + (j2 + 1) * 320 + i2);
+ // move(ptr(seg(pantalla2), (ofs(pantalla2) + 4 + ((j2 + 1) * 320) + i2)), ptr(0xa000, (((j2 + 1) * 320) + i2)), 2);
+ i2 = Random(320);
+ j2 = Random(140);
+
+ byte *src3 = pantalla2 + 4 + (j2 * 320) + i2;
+ Common::copy(src3, src3 + 1, screenBuf + (j2 * 320) + i2);
+
+ if(i1 % 300 == 0) {
+ g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
+ g_engine->_screen->update();
+ }
+ // move(ptr(seg(pantalla2), (ofs(pantalla2) + 4 + (j2 * 320) + i2)), ptr(0xa000, ((j2 * 320) + i2)), 1);
+ }
+ drawScreen(pantalla2);
+ } break;
+ case 13: {
+ debug("case 13!");
+
+ for (i1 = 0; i1 <= 319; i1++) {
+ for (j1 = 0; j1 <= 139; j1++) {
+ int color = pantalla2[4 + (j1 * 320) + i1];
+ *((byte *)g_engine->_screen->getBasePtr(i1, j1)) = color;
+
+
+ }
+ // if (g_engine->_chrono->shouldPaintEffect()) {
+ if(i1 % 10 == 0) {
+ g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
+ g_engine->_screen->update();
+ }
+ }
+ } break;
+ case 14: {
+ for (i1 = 320; i1 > 0; i1--) {
+ for (j1 = 0; j1 < 140; j1++) {
+ int color = pantalla2[4 + (j1 * 320) + i1];
+ *((byte *)g_engine->_screen->getBasePtr(i1, j1)) = color;
+ }
+ if(i1 % 10 == 0) {
+ g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
+ g_engine->_screen->update();
+ }
+ }
+ } break;
+ case 15: {
+ for (j1 = 160; j1 > 0; j1--) {
+ line(j1, 69, (319 - j1), 69, 255);
+ if(j1 % 4 == 0) {
+ g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
+ g_engine->_screen->update();
+ }
+ }
+ // delay(5);
+ for (j1 = 70; j1 > 0; j1--) {
+ byte *src1 = pantalla2 + 4 + j1 * 320;
+ byte *src2 = pantalla2 + 4 + (139 - j1) * 320;
+ Common::copy(src1, src1 + 320, screenBuf + j1 * 320);
+
+ Common::copy(src2, src2 + 320, screenBuf + (139 - j1) * 320);
+ if(j1 % 2 == 0) {
+ g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
+ g_engine->_screen->update();
+ }
+ }
+ } break;
+ }
+ }
+}
+
+void changeRGBBlock(byte initialColor, uint numColors, void *rgb) {
+ g_system->getPaletteManager()->setPalette((byte *)rgb, initialColor, numColors);
+}
+
+void changePalette(palette depaleta, palette apaleta) {
+ palette palpaso;
+ int auxpaso;
+
+ copyPalette(depaleta, palpaso);
+ for (jpal = 32; jpal >= 0; jpal--) {
+ for (ipal = 0; ipal < 256; ipal++) {
+ auxpaso = apaleta[3 * ipal + 0] - palpaso[3 * ipal + 0];
+ if (auxpaso > 0)
+ palpaso[3 * ipal + 0] = palpaso[3 * ipal + 0] + datosfundido[auxpaso][jpal];
+ else
+ palpaso[3 * ipal + 0] = palpaso[3 * ipal + 0] - datosfundido[-auxpaso][jpal];
+
+ auxpaso = apaleta[3 * ipal + 1] - palpaso[3 * ipal + 1];
+ if (auxpaso > 0)
+ palpaso[3 * ipal + 1] = palpaso[3 * ipal + 1] + datosfundido[auxpaso][jpal];
+ else
+ palpaso[3 * ipal + 1] = palpaso[3 * ipal + 1] - datosfundido[-auxpaso][jpal];
+
+ auxpaso = apaleta[3 * ipal + 2] - palpaso[3 * ipal + 2];
+ if (auxpaso > 0)
+ palpaso[3 * ipal + 2] = palpaso[3 * ipal + 2] + datosfundido[auxpaso][jpal];
+ else
+ palpaso[3 * ipal + 2] = palpaso[3 * ipal + 2] - datosfundido[-auxpaso][jpal];
+ }
+ changeRGBBlock(0, 256, palpaso);
+ g_engine->_screen->markAllDirty();
+ g_engine->_screen->update();
+ }
+}
+
+void turnLightOn() {
+ Common::File paletteFile;
+ palette palpaso;
+
+ if (!paletteFile.open("PALETAS.DAT")) {
+ error("turnLightOn(): ioresult (311)");
+ }
+ paletteFile.seek(1536);
+ paletteFile.read(palpaso, 768);
+ paletteFile.close();
+ for (int i = 0; i < 256; i++) {
+ if (i >= 201) {
+ palpaso[3 * i + 0] = pal[3 * i + 0];
+ palpaso[3 * i + 1] = pal[3 * i + 1];
+ palpaso[3 * i + 2] = pal[3 * i + 2];
+ // }
+ } else {
+ palpaso[3 * i + 0] = palpaso[3 * i + 0] << 2;
+ palpaso[3 * i + 1] = palpaso[3 * i + 1] << 2;
+ palpaso[3 * i + 2] = palpaso[3 * i + 2] << 2;
+ }
+ }
+ changePalette(pal, palpaso);
+ copyPalette(palpaso, pal);
+}
+
+void totalFadeOut(byte rojo) {
+ palette palpaso;
+
+ for (ipal = 0; ipal <= 255; ipal++) {
+ palpaso[3 * ipal + 0] = rojo;
+ palpaso[3 * ipal + 1] = 0;
+ palpaso[3 * ipal + 2] = 0;
+ }
+ changePalette(pal, palpaso);
+ copyPalette(palpaso, pal);
+}
+
+void partialFadeOut(byte numcol) {
+ palette palpaso;
+
+ for (ipal = 0; ipal <= numcol; ipal++) {
+ palpaso[3 * ipal + 0] = 0;
+ palpaso[3 * ipal + 1] = 0;
+ palpaso[3 * ipal + 2] = 0;
+ }
+ for (ipal = (numcol + 1); ipal <= 255; ipal++) {
+ palpaso[3 * ipal + 0] = pal[3 * ipal + 0];
+ palpaso[3 * ipal + 1] = pal[3 * ipal + 1];
+ palpaso[3 * ipal + 2] = pal[3 * ipal + 2];
+ }
+ changePalette(pal, palpaso);
+ copyPalette(palpaso, pal);
+}
+
+void partialFadeIn(byte numcol) {
+ palette palnegro;
+
+ for (ipal = 0; ipal <= numcol; ipal++) {
+ palnegro[3 * ipal + 0] = 0;
+ palnegro[3 * ipal + 1] = 0;
+ palnegro[3 * ipal + 2] = 0;
+ }
+ for (ipal = (numcol + 1); ipal <= 255; ipal++) {
+ palnegro[3 * ipal + 0] = pal[3 * ipal + 0];
+ palnegro[3 * ipal + 1] = pal[3 * ipal + 1];
+ palnegro[3 * ipal + 2] = pal[3 * ipal + 2];
+ }
+ changePalette(palnegro, pal);
+}
+
+void totalFadeIn(uint numeropaleta, Common::String nombrepaleta) {
+ palette palpaso, palnegro;
+ Common::File fichpaleta;
+ if (numeropaleta > 0) {
+ if (!fichpaleta.open("PALETAS.DAT"))
+ error("totalFadeIn(): ioresult (311)");
+ fichpaleta.seek(numeropaleta);
+ fichpaleta.read(palpaso, 768);
+ fichpaleta.close();
+ } else {
+ if (!fichpaleta.open(Common::Path(Common::String(nombrepaleta + ".PAL")))) {
+ error("totalFadeIn(): ioresult (311)");
+ }
+ fichpaleta.read(palpaso, 768);
+ fichpaleta.close();
+ }
+ for (ipal = 0; ipal <= 255; ipal++) {
+ palnegro[3 * ipal + 0] = 0;
+ palnegro[3 * ipal + 1] = 0;
+ palnegro[3 * ipal + 2] = 0;
+ // 6-bit color correction
+ palpaso[3 * ipal + 0] = palpaso[3 * ipal + 0] << 2;
+ palpaso[3 * ipal + 1] = palpaso[3 * ipal + 1] << 2;
+ palpaso[3 * ipal + 2] = palpaso[3 * ipal + 2] << 2;
+ }
+
+ changePalette(palnegro, palpaso);
+ copyPalette(palpaso, pal);
+}
+
+void redFadeIn(palette palpaso) {
+ palette palnegro;
+
+ for (ipal = 0; ipal < 256; ipal++) {
+ palnegro[3 * ipal + 0] = 0;
+ palnegro[3 * ipal + 1] = 0;
+ palnegro[3 * ipal + 2] = 0;
+ }
+ changePalette(pal, palnegro);
+ changePalette(palnegro, palpaso);
+ copyPalette(palpaso, pal);
+}
+
+void updatePalette(byte indicepaleta) {
+ int ip;
+
+ switch (parte_del_juego) {
+ case 1: {
+ for (ipal = 0; ipal <= 5; ipal++) {
+ pal[(ipal + 195) * 3 + 0] = movimientopal[(indicepaleta * 6 + ipal) * 3 + 0];
+ pal[(ipal + 195)* 3 + 1] = movimientopal[(indicepaleta * 6 + ipal) * 3 + 1];
+ pal[(ipal + 195) * 2 + 1] = movimientopal[(indicepaleta * 6 + ipal) * 3 + 2];
+ }
+ changeRGBBlock(195, 6, &pal[195 * 3 + 0]);
+ } break;
+ case 2: {
+ switch (indicepaleta) {
+ case 0:
+ ip = 0;
+ break;
+ case 1:
+ ip = 4;
+ break;
+ case 2:
+ ip = 8;
+ break;
+ case 3:
+ ip = 4;
+ break;
+ case 4:
+ ip = 0;
+ break;
+ case 5:
+ ip = -4;
+ break;
+ case 6:
+ ip = -8;
+ break;
+ case 7:
+ ip = -4;
+ break;
+ }
+ byte *palette = g_engine->_graphics->getPalette();
+
+ palette[131 * 3 + 0] = palette[131 * 3 + 0] - ip;
+ palette[131 * 3 + 1] = palette[131 * 3 + 1] - ip;
+ palette[131 * 3 + 2] = palette[131 * 3 + 2] - ip;
+
+ palette[134 * 3 + 0] = palette[134 * 3 + 0] - ip;
+ palette[134 * 3 + 1] = palette[134 * 3 + 1] - ip;
+ palette[134 * 3 + 2] = palette[134 * 3 + 2] - ip;
+
+ palette[143 * 3 + 0] = palette[143 * 3 + 0] - ip;
+ palette[143 * 3 + 1] = palette[143 * 3 + 1] - ip;
+ palette[143 * 3 + 2] = palette[143 * 3 + 2] - ip;
+
+ palette[187 * 3 + 0] = palette[187 * 3 + 0] - ip;
+ palette[187 * 3 + 1] = palette[187 * 3 + 1] - ip;
+ palette[187 * 3 + 2] = palette[187 * 3 + 2] - ip;
+
+ g_engine->_graphics->setPalette(palette);
+
+ } break;
+ }
+}
+
+void processingActive() {
+
+ setRGBPalette(255, 63, 63, 63);
+ outtextxy(121, 72, "PROCESANDO......", 0);
+ g_engine->_screen->update();
+ delay(enforcedTextAnimDelay);
+ outtextxy(120, 71, "PROCESANDO......", 0);
+ g_engine->_screen->update();
+ delay(enforcedTextAnimDelay);
+ outtextxy(119, 72, "PROCESANDO......", 0);
+ g_engine->_screen->update();
+ delay(enforcedTextAnimDelay);
+ outtextxy(120, 73, "PROCESANDO......", 0);
+ g_engine->_screen->update();
+ delay(enforcedTextAnimDelay);
+ outtextxy(120, 72, "PROCESANDO......", 255);
+ g_engine->_screen->update();
+
+ // enforce a delay for now so it's visible
+ g_system->delayMillis(200);
+}
+
+void initGraph() {
+ for (int i = 0; i < 256; i++)
+ for (int j = 0; j < 256; j++)
+ datosfundido[i][j] = i / (j + 1);
+}
+
+void handPantallaToFondo() {
+ Common::copy(handpantalla + 4, handpantalla + sizepantalla, fondo + 4);
+}
+
+void copyPalette(palette from, palette to) {
+ Common::copy(from, from + 768, to);
+}
+
+void loadAnimationIntoBuffer(Common::SeekableReadStream *stream, byte *&buf, int sizeanimado) {
+ buf = (byte *)malloc(sizeanimado);
+ stream->read(buf, sizeanimado);
+ Common::copy(buf, buf + sizeanimado, pasoanimado);
+}
+
+} // End of namespace Tot
diff --git a/engines/tot/graphics.h b/engines/tot/graphics.h
new file mode 100644
index 00000000000..6d98594946e
--- /dev/null
+++ b/engines/tot/graphics.h
@@ -0,0 +1,60 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+#ifndef TOT_GRAPHICS_H
+#define TOT_GRAPHICS_H
+
+#include "playanim.h"
+#include "util.h"
+
+namespace Tot {
+
+
+void initGraph();
+void getVirtualImg(uint getcoordx1, uint getcoordy1, uint getcoordx2, uint getcoordy2,
+ byte *backgroundScreen, byte *image);
+void putVirtualImg(uint putcoordx, uint putcoordy, byte *backgroundScreen, byte *image);
+void clear();
+void drawFullScreen(byte *screen);
+void copyFromScreen(byte *&screen);
+void drawScreen(byte *screen, boolean offsetSize = true);
+void putImg(uint coordx, uint coordy, byte *image, boolean transparency = false);
+void putShape(uint coordx, uint coordy, byte *image);
+void getImg(uint coordx1, uint coordy1, uint coordx2, uint coordy2, byte *image);
+void loadPalette(Common::String image);
+void effect(byte effectNumber, boolean fadeToBlack, byte *screen);
+void turnLightOn();
+void totalFadeOut(byte red);
+void partialFadeOut(byte numCol);
+void totalFadeIn(uint paletteNumber, Common::String paletteName);
+void redFadeIn(palette palette);
+void partialFadeIn(byte numCol);
+void updatePalette(byte paletteIndex);
+void changePalette(palette fromPalette, palette toPalette);
+void changeRGBBlock(byte initialColor, uint numColors, void *rgb);
+void processingActive();
+void rectangle(int x1, int y1, int x2, int y2, byte color);
+void rectangle(uint x1, uint y1, uint x2, uint y2, byte color);
+void handPantallaToFondo();
+void copyPalette(palette from, palette to);
+void loadAnimationIntoBuffer(Common::SeekableReadStream *stream, byte *&buf, int sizeanimado);
+} // End of namespace Tot
+
+#endif
diff --git a/engines/tot/graphman.cpp b/engines/tot/graphman.cpp
new file mode 100644
index 00000000000..adf0b728c92
--- /dev/null
+++ b/engines/tot/graphman.cpp
@@ -0,0 +1,305 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+#include "common/debug.h"
+#include "common/system.h"
+#include "graphics/font.h"
+#include "graphics/paletteman.h"
+
+#include "tot/font/biosfont.h"
+#include "tot/graphman.h"
+#include "tot/tot.h"
+
+namespace Tot {
+
+GraphicsManager::GraphicsManager() {
+ for (int i = 0; i < 256; i++)
+ for (int j = 0; j < 256; j++)
+ datosfundido[i][j] = i / (j + 1);
+
+ Common::File exeFile;
+ if (!exeFile.open(Common::Path("TOT.EXE"))) {
+ error("Could not open executable file!");
+ }
+ exeFile.seek(FONT_LITT_OFFSET);
+ _litt.loadChr(exeFile);
+ exeFile.seek(FONT_EURO_OFFSET);
+ _euro.loadChr(exeFile);
+ exeFile.close();
+ _bios = new BiosFont();
+}
+
+GraphicsManager::~GraphicsManager() {
+}
+
+void GraphicsManager::restoreBackground(uint x, uint y, uint x2, uint y2) {
+ for (int j = y; j < y2; j++) {
+ for (int i = x; i < x2; i++) {
+ *((byte *)g_engine->_screen->getBasePtr(i, j)) = 0;
+ }
+ }
+ g_engine->_screen->addDirtyRect(Common::Rect(x, y, x2, y2));
+}
+
+void GraphicsManager::clear() {
+ g_engine->_screen->clear();
+ updateScreen();
+}
+
+void GraphicsManager::clearActionLine() {
+ restoreBackground(0, 140, 319, 149);
+}
+
+void GraphicsManager::writeActionLine(const Common::String &str) {
+ euroText(str, 0, 144, 255, Graphics::kTextAlignCenter, true);
+}
+
+void GraphicsManager::setPalette(byte *palette, uint num) {
+ g_system->getPaletteManager()->setPalette(palette, 0, num);
+}
+
+void GraphicsManager::fixPalette(byte *palette, uint num) {
+ for (int i = 0; i < num; i++) {
+ palette[i] = palette[i] << 2;
+ }
+}
+
+void GraphicsManager::getPalette(byte *palette) {
+ g_system->getPaletteManager()->grabPalette(palette, 0, 256);
+}
+byte *GraphicsManager::getPalette() {
+ byte *palette = (byte *)malloc(768);
+ getPalette(palette);
+ return palette;
+}
+
+void GraphicsManager::changePalette(byte origin[768], byte target[768]) {
+ byte palpaso[768] = {0};
+
+ int auxpaso;
+ for (int i = 0; i < 768; i++) {
+ palpaso[i] = origin[i];
+ }
+
+ for (int jpal = 31; jpal >= 0; jpal--) {
+ for (int ipal = 0; ipal <= 255; ipal++) {
+ int indexR = 3 * ipal + 0;
+ int indexG = 3 * ipal + 1;
+ int indexB = 3 * ipal + 2;
+ auxpaso = target[indexR] - palpaso[indexR];
+
+ if (auxpaso > 0)
+ palpaso[indexR] = palpaso[indexR] + datosfundido[auxpaso][jpal];
+ else
+ palpaso[indexR] = palpaso[indexR] - datosfundido[-auxpaso][jpal];
+
+ auxpaso = target[indexG] - palpaso[indexG];
+ if (auxpaso > 0)
+ palpaso[indexG] = palpaso[indexG] + datosfundido[auxpaso][jpal];
+ else
+ palpaso[indexG] = palpaso[indexG] - datosfundido[-auxpaso][jpal];
+
+ auxpaso = target[indexB] - palpaso[indexB];
+ if (auxpaso > 0)
+ palpaso[indexB] = palpaso[indexB] + datosfundido[auxpaso][jpal];
+ else
+ palpaso[indexB] = palpaso[indexB] - datosfundido[-auxpaso][jpal];
+ }
+ setPalette(palpaso);
+ g_engine->_screen->markAllDirty();
+ g_engine->_screen->update();
+ }
+}
+
+byte *GraphicsManager::loadPalette(Common::String fileName) {
+ Common::File paletteFile;
+ if (!paletteFile.open(Common::Path(fileName)))
+ error("unable to load palette %s (310)", fileName.c_str());
+ byte *palette = (byte *)malloc(768);
+ paletteFile.read(palette, 768);
+ paletteFile.close();
+ fixPalette(palette);
+ setPalette(palette);
+ return palette;
+}
+
+void GraphicsManager::fadeIn(uint numeropaleta, Common::String nombrepaleta) {
+ byte *palette;
+
+ byte blackPalette[768];
+ for (int i = 0; i < 768; i++) {
+ blackPalette[i] = 0;
+ }
+ if (numeropaleta > 0) {
+ palette = loadPalette("PALETAS.DAT");
+ } else {
+ palette = loadPalette(nombrepaleta + ".PAL");
+ }
+ changePalette(blackPalette, palette);
+}
+
+void GraphicsManager::fadeOut(byte rojo) {
+ byte palpaso[768];
+
+ for (int i = 0; i <= 255; i++) {
+ palpaso[i * 3 + 0] = rojo;
+ palpaso[i * 3 + 1] = 0;
+ palpaso[i * 3 + 2] = 0;
+ }
+ changePalette(getPalette(), palpaso);
+}
+
+
+// Debug function just to print a palette on the screen
+void GraphicsManager::printPalette() {
+
+ int x = 0;
+ int y = 0;
+ int width = 64;
+ int height = 256 / width;
+ int squareHeight = 3;
+ for (uint16 i = 0; i <= height; i++) {
+ for (uint16 j = 0; j <= width; j++) {
+ for (int k = 0; k < squareHeight; k++) {
+ for (int l = 0; l < squareHeight; l++) {
+ *((byte *)g_engine->_screen->getBasePtr(x + j * squareHeight + l, y + i * squareHeight + k)) = i * j;
+ }
+ }
+ }
+ }
+ // updateScreen();
+}
+
+void GraphicsManager::printColor(int x, int y, int color) {
+ int squareHeight = 10;
+ for (int k = 0; k < squareHeight; k++) {
+ for (int l = 0; l < squareHeight; l++) {
+ g_engine->_screen->setPixel(x + l, y + k, color);
+ }
+ }
+}
+
+void GraphicsManager::littText(const Common::String &str, int x, int y, uint32 color, Graphics::TextAlign align, bool alignCenterY) {
+ int height = _euro.getFontHeight();
+ if (alignCenterY) {
+ y = y - _euro.getFontHeight() / 2 + 2;
+ }
+ _litt.drawString(g_engine->_screen, str, x, y, 320, color, align);
+}
+
+void GraphicsManager::euroText(const Common::String &str, int x, int y, uint32 color, Graphics::TextAlign align, bool alignCenterY) {
+ if (alignCenterY) {
+ y = y - _euro.getFontHeight() / 2;
+ }
+ _euro.drawString(g_engine->_screen, str, x, y, 320, color, align);
+}
+
+void GraphicsManager::biosText(const Common::String &str, int x, int y, uint32 color) {
+ _bios->drawString(g_engine->_screen, str, x, y, 320, color, Graphics::TextAlign::kTextAlignLeft);
+}
+
+void GraphicsManager::blit(const Graphics::Surface *src, Common::Rect bounds) {
+ int16 height = bounds.bottom - bounds.top;
+ int16 width = bounds.right - bounds.left;
+ Graphics::Surface dest = g_engine->_screen->getSubArea(bounds);
+
+ for (int i = 0; i < height - 1; i++) {
+ for (int j = 0; j < width - 1; j++) {
+ *((byte *)dest.getBasePtr(j, i)) = *((byte *)src->getBasePtr(j, i));
+ }
+ }
+ g_engine->_screen->addDirtyRect(bounds);
+ updateScreen();
+}
+
+void GraphicsManager::copyPixels(int x, int y, byte *pixels, uint size) {
+ byte *destP = (byte *)g_engine->_screen->getPixels() + y * 320 + x;
+ Common::copy(pixels, pixels + size, destP);
+ updateScreen();
+}
+
+void GraphicsManager::copyRect(Common::Rect rect, byte *pixels) {
+ int width = rect.right - rect.left;
+ int height = rect.bottom - rect.top;
+ for (int j = rect.top; j < rect.bottom; j++) {
+ for (int i = rect.left; i < rect.right; i++) {
+ *((byte *)g_engine->_screen->getBasePtr(i, j)) = pixels[(j - height) * width + (i - width)];
+ }
+ }
+}
+
+void GraphicsManager::effect(int effectNumber, bool toBlack) {
+ if (toBlack) {
+ switch (effectNumber) {
+ case 1:
+ for (int i = 0; i <= 69; i++) {
+ g_engine->_screen->drawLine(0, (i * 2), 319, i * 2, 0);
+ g_system->delayMillis(5);
+ }
+ for (int i = 70; i >= 1; i--) {
+ g_engine->_screen->drawLine(0, (i * 2 - 1), 319, (i * 2, -1), 0);
+ g_system->delayMillis(5);
+ }
+ break;
+ case 2:
+ for (int i = 70; i >= 1; i--) {
+ g_engine->_screen->drawLine(0, (i * 2 - 1), 319, (i * 2 - 1), 0);
+ g_system->delayMillis(5);
+ }
+ for (int i = 0; i <= 69; i++) {
+ g_engine->_screen->drawLine(0, (i * 2), 319, (i * 2), 0);
+ g_system->delayMillis(5);
+ }
+ break;
+
+ default:
+ break;
+ }
+ } else {
+ switch (effectNumber) {
+ case 13:
+ // for (int i1 = 0; i1 <= 319; i1 ++)
+ // for (int j1 = 0; j1 <= 139; j1 ++)
+
+ // move(ptr(seg(pantalla2), (ofs(pantalla2) +4 + (j1 * 320) + i1)),
+ // ptr(0xa000, ((j1 * 320) + i1)), 1);
+ break;
+
+ default:
+ break;
+ }
+ }
+}
+
+void GraphicsManager::updateScreen() {
+ g_engine->_screen->markAllDirty();
+ g_engine->_screen->update();
+}
+
+void GraphicsManager::updateScreen(const Common::Rect &r) {
+ g_engine->_screen->addDirtyRect(r);
+ g_engine->_screen->update();
+}
+
+// void GraphicsManager::restoreBackground(const Common::Rect &r) {
+// g_engine->_screen->blitFrom(_backBuffer, r, r);
+// }
+
+} // End of namespace Tot
diff --git a/engines/tot/graphman.h b/engines/tot/graphman.h
new file mode 100644
index 00000000000..fd3d4ab230c
--- /dev/null
+++ b/engines/tot/graphman.h
@@ -0,0 +1,80 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+#ifndef TOT_GRAPHMAN_H
+#define TOT_GRAPHMAN_H
+
+#include "common/scummsys.h"
+#include "common/system.h"
+#include "graphics/font.h"
+
+#include "tot/font/bgifont.h"
+#include "tot/font/biosfont.h"
+
+namespace Tot {
+
+class GraphicsManager {
+public:
+ GraphicsManager();
+ ~GraphicsManager();
+
+ void printPalette();
+
+ void fixPalette(byte palette[768], uint num = 768);
+ void getPalette(byte *palette);
+ byte *getPalette();
+ void setPalette(byte palette[768], uint num = 256);
+ void changePalette(byte origin[768], byte target[768]);
+ byte *loadPalette(Common::String fileName);
+
+ void fadeOut(byte rojo = 0);
+ void fadeIn(uint numeropaleta, Common::String nombrepaleta);
+
+ void littText(const Common::String &str, int x, int y, uint32 color, Graphics::TextAlign align = Graphics::kTextAlignLeft, bool alignCenterY = false);
+ void euroText(const Common::String &str, int x, int y, uint32 color, Graphics::TextAlign align = Graphics::kTextAlignLeft, bool alignCenterY = false);
+ void biosText(const Common::String &str, int x, int y, uint32 color);
+ void blit(const Graphics::Surface *src, Common::Rect bounds);
+ void copyPixels(int x, int y, byte *pixels, uint size);
+ void copyRect(Common::Rect rect, byte *pixels);
+
+ void effect(int effectNumber, bool toBlack);
+
+ void restoreBackground(uint x, uint y, uint x2, uint y2);
+ void clear();
+ void clearActionLine();
+ void writeActionLine(const Common::String &str);
+ void printColor(int x, int y, int color);
+ Graphics::BgiFont _litt;
+ Graphics::BgiFont _euro;
+ Graphics::Font *_bios;
+
+private:
+ const int FONT_LITT_OFFSET = 153584;
+ const int FONT_EURO_OFFSET = 159681;
+ signed char datosfundido[256][256];
+ void updateScreen();
+ void updateScreen(const Common::Rect &r);
+ // void restoreBackground(const Common::Rect &r);
+ Graphics::Surface *_currentBuffer;
+ Graphics::Surface *_backBuffer;
+};
+
+} // End of namespace Tot
+#endif
diff --git a/engines/tot/metaengine.cpp b/engines/tot/metaengine.cpp
new file mode 100644
index 00000000000..6e7410021f7
--- /dev/null
+++ b/engines/tot/metaengine.cpp
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "tot/metaengine.h"
+#include "tot/detection.h"
+#include "tot/tot.h"
+
+const char *TotMetaEngine::getName() const {
+ return "tot";
+}
+
+Common::Error TotMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
+ *engine = new Tot::TotEngine(syst, desc);
+ return Common::kNoError;
+}
+
+bool TotMetaEngine::hasFeature(MetaEngineFeature f) const {
+ return checkExtendedSaves(f) ||
+ (f == kSupportsLoadingDuringStartup);
+}
+
+#if PLUGIN_ENABLED_DYNAMIC(TOT)
+REGISTER_PLUGIN_DYNAMIC(TOT, PLUGIN_TYPE_ENGINE, TotMetaEngine);
+#else
+REGISTER_PLUGIN_STATIC(TOT, PLUGIN_TYPE_ENGINE, TotMetaEngine);
+#endif
diff --git a/engines/tot/metaengine.h b/engines/tot/metaengine.h
new file mode 100644
index 00000000000..e33a2d0de90
--- /dev/null
+++ b/engines/tot/metaengine.h
@@ -0,0 +1,41 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef TOT_METAENGINE_H
+#define TOT_METAENGINE_H
+
+#include "engines/advancedDetector.h"
+
+class TotMetaEngine : public AdvancedMetaEngine<ADGameDescription> {
+public:
+ const char *getName() const override;
+
+ Common::Error createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const override;
+
+ /**
+ * Determine whether the engine supports the specified MetaEngine feature.
+ *
+ * Used by e.g. the launcher to determine whether to enable the Load button.
+ */
+ bool hasFeature(MetaEngineFeature f) const override;
+};
+
+#endif // TOT_METAENGINE_H
diff --git a/engines/tot/module.mk b/engines/tot/module.mk
new file mode 100644
index 00000000000..c8e102b59b5
--- /dev/null
+++ b/engines/tot/module.mk
@@ -0,0 +1,36 @@
+MODULE := engines/tot
+
+MODULE_OBJS = \
+ tot.o \
+ console.o \
+ metaengine.o \
+ forest.o \
+ util.o \
+ playanim.o \
+ graphics.o \
+ mouse.o \
+ sound.o \
+ anims.o \
+ routines2.o \
+ routines.o \
+ dialog.o \
+ game.o \
+ font/bgifont.o \
+ font/biosfont.o \
+ decoder/TotFlicDecoder.o \
+ soundman.o \
+ graphman.o \
+ mouseman.o \
+ chrono.o \
+ saveload.o
+
+# This module can be built as a plugin
+ifeq ($(ENABLE_TOT), DYNAMIC_PLUGIN)
+PLUGIN := 1
+endif
+
+# Include common rules
+include $(srcdir)/rules.mk
+
+# Detection objects
+DETECT_OBJS += $(MODULE)/detection.o
diff --git a/engines/tot/mouse.cpp b/engines/tot/mouse.cpp
new file mode 100644
index 00000000000..1704c6d460b
--- /dev/null
+++ b/engines/tot/mouse.cpp
@@ -0,0 +1,37 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/textconsole.h"
+
+#include "tot/mouse.h"
+#include "tot/tot.h"
+
+namespace Tot {
+
+void setMousePos(byte nummascara, uint posx, uint posy) {
+ g_engine->_mouseManager->warpMouse(nummascara, posx, posy);
+}
+
+void setMouseArea(uint mih, uint miv, uint mah, uint mav) {
+ debug("Defining mouse area to %d ,%d ,%d ,%d ", mih, miv, mah, mav);
+ g_engine->_mouseManager->setMouseArea(Common::Rect(mih, miv, mah, mav));
+}
+} // End of namespace Tot
diff --git a/engines/tot/mouse.h b/engines/tot/mouse.h
new file mode 100644
index 00000000000..bc168f5f6df
--- /dev/null
+++ b/engines/tot/mouse.h
@@ -0,0 +1,35 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+#ifndef TOT_MOUSE_H
+#define TOT_MOUSE_H
+
+#include "common/scummsys.h"
+
+#include "tot/graphics.h"
+#include "tot/util.h"
+
+namespace Tot {
+void setMousePos(byte maskNumber, uint posx, uint posy);
+void setMouseArea(uint mih, uint miv, uint mah, uint mav);
+
+} // End of namespace Tot
+
+#endif
diff --git a/engines/tot/mouseman.cpp b/engines/tot/mouseman.cpp
new file mode 100644
index 00000000000..7c4e163a191
--- /dev/null
+++ b/engines/tot/mouseman.cpp
@@ -0,0 +1,109 @@
+#include "mouseman.h"
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/file.h"
+#include "common/system.h"
+#include "graphics/cursorman.h"
+
+#include "tot/mouseman.h"
+#include "tot/tot.h"
+
+namespace Tot {
+
+MouseManager::MouseManager() {
+ _mouseArea = Common::Rect(0, 0, 320, 200);
+ loadMasks();
+}
+
+MouseManager::~MouseManager() {
+}
+
+void MouseManager::drawMask(int idx) {
+ CursorMan.replaceCursor(_mouseMasks[idx].mask, 15, 15, 0, 0, 0);
+}
+
+void MouseManager::animateMouseIfNeeded() {
+ if (tocapintar) {
+ setMouseMask(_currentMouseMask);
+ if (_currentMouseMask < 7) {
+ // sync this with frame time
+ _currentMouseMask++;
+ } else
+ _currentMouseMask = 0;
+ CursorMan.showMouse(true);
+ }
+}
+
+
+void MouseManager::hide() {
+ CursorMan.showMouse(false);
+}
+
+void MouseManager::show() {
+ CursorMan.showMouse(true);
+}
+
+void MouseManager::setMouseArea(Common::Rect rect) {
+ _mouseArea = rect;
+}
+
+void MouseManager::setMousePos(Common::Point p) {
+ p.x = CLIP<int16>(p.x, _mouseArea.left, _mouseArea.right);
+ p.y = CLIP<int16>(p.y, _mouseArea.top, _mouseArea.bottom);
+
+ g_system->warpMouse(p.x, p.y);
+}
+
+void MouseManager::printPos(int x, int y, int screenPosX, int screenPosY) {
+ g_engine->_graphics->restoreBackground(screenPosX, screenPosY, screenPosX + 100, screenPosY + 10);
+ g_engine->_graphics->euroText(Common::String::format("MousePos: %d, %d", x + 7, y + 7), screenPosX, screenPosY, Graphics::kTextAlignLeft);
+}
+
+void MouseManager::warpMouse(int mask, int x, int y) {
+ setMouseMask(_currentMouseMask);
+ g_system->warpMouse(x, y);
+}
+
+void MouseManager::loadMasks() {
+ Common::File mouseMaskFile;
+ if (!mouseMaskFile.open(Common::Path("RATON.ACA")))
+ error("loadMouseMask(): ioresult! (317)");
+
+ int numMouseMasks = mouseMaskFile.readByte();
+ int mouseMaskSize = mouseMaskFile.readUint16LE();
+
+ for (int i = 0; i < numMouseMasks; i++) {
+ _mouseMasks[i].width = mouseMaskFile.readUint16LE();
+ _mouseMasks[i].height = mouseMaskFile.readUint16LE();
+ // mouseMaskFile.readUint16LE();
+ _mouseMasks[i].mask = (byte *)malloc(mouseMaskSize - 4);
+ mouseMaskFile.read(_mouseMasks[i].mask, mouseMaskSize - 4);
+ }
+ mouseMaskFile.close();
+}
+
+void MouseManager::setMouseMask(int numMask) {
+ drawMask(numMask);
+ CursorMan.showMouse(true);
+}
+
+} // End of namespace Tot
diff --git a/engines/tot/mouseman.h b/engines/tot/mouseman.h
new file mode 100644
index 00000000000..e05be0a443a
--- /dev/null
+++ b/engines/tot/mouseman.h
@@ -0,0 +1,59 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+#ifndef TOT_MOUSEMAN_H
+#define TOT_MOUSEMAN_H
+
+#include "common/scummsys.h"
+#include "common/rect.h"
+
+#include "tot/chrono.h"
+
+namespace Tot {
+struct MouseMask {
+ void *mask;
+ uint width;
+ uint height;
+};
+
+class MouseManager {
+public:
+ MouseManager();
+ ~MouseManager();
+ void drawMask(int idx);
+ void warpMouse(int mask, int x, int y);
+ void setMask(int maskNum);
+ void animateMouseIfNeeded();
+ void hide();
+ void show();
+ void setMouseArea(Common::Rect rect);
+ void setMousePos(Common::Point p);
+ void printPos(int x, int y, int screenPosX, int screenPosY);
+private:
+ Common::Rect _mouseArea;
+ int _currentMouseMask = 0;
+ MouseMask _mouseMasks[8];
+ void loadMasks();
+ void setMouseMask(int numMask);
+};
+
+} // End of namespace Tot
+
+#endif
diff --git a/engines/tot/playanim.cpp b/engines/tot/playanim.cpp
new file mode 100644
index 00000000000..adf8a3823d0
--- /dev/null
+++ b/engines/tot/playanim.cpp
@@ -0,0 +1,1151 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/file.h"
+#include "common/textconsole.h"
+
+#include "tot/chrono.h"
+#include "tot/playanim.h"
+
+namespace Tot {
+
+int doserror = 0;
+int exitcode = 0;
+
+
+Common::MemorySeekableReadWriteStream *conversationData;
+Common::MemorySeekableReadWriteStream *rooms;
+Common::MemorySeekableReadWriteStream *invItemData;
+
+byte iraton;
+
+uint xraton, yraton;
+
+uint pulsax, pulsay;
+
+uint npraton2, npraton;
+
+uint oldxrejilla, oldyrejilla;
+
+regispartida regpartida;
+
+boolean sello_quitado;
+
+boolean cambiopantalla;
+boolean teleencendida,
+ vasijapuesta,
+ guadagna,
+ tridente,
+ torno,
+ barro,
+ diablillo_verde,
+ rojo_capturado,
+ manual_torno,
+ alacena_abierta,
+ baul_abierto,
+ trampa_puesta,
+ peteractivo;
+
+boolean dentro_del_juego;
+
+boolean hechaprimeravez;
+
+boolean salirdeljuego;
+
+boolean partidanueva;
+
+boolean continuarpartida;
+
+boolean desactivagrabar;
+
+boolean pintaractivo;
+
+boolean animacion2;
+
+palette movimientopal;
+
+palette pal;
+
+reginventario mobj[inventoryIconCount];
+
+inventoryBitmaps mochilaxms;
+
+byte saltospal;
+
+byte posicioninv;
+
+byte numeroaccion;
+
+byte oldnumeroacc;
+
+byte pasos;
+
+byte indicepuertas;
+
+byte movidapaleta;
+
+byte rejillaquetoca;
+
+byte parte_del_juego;
+byte encripcod1;
+
+byte secondaryAnimationFrameCount;
+
+byte numerodir;
+
+byte contadorpc, contadorpc2;
+
+byte indaux1, indaux2;
+
+byte destinox_paso, destinoy_paso;
+
+byte direccionmovimiento;
+
+uint anchoanimado, altoanimado;
+
+uint tiempo;
+
+uint codigoobjmochila;
+
+uint kaka;
+
+uint oldposx, oldposy;
+uint volumenfxderecho, volumenfxizquierdo;
+uint segpasoicono;
+uint ofspasoicono;
+uint volumenmelodiaderecho, volumenmelodiaizquierdo;
+
+
+int elemento1, elemento2;
+
+int characterPosX, characterPosY;
+
+int xframe2, yframe2;
+
+Common::File verb;
+
+Common::String oldobjmochila, objetomochila;
+
+Common::String nombreficherofoto;
+
+Common::String nombrepersonaje;
+
+char *encriptado;
+uint hornacina[2][4];
+
+RoomFileRegister *roomData;
+
+InvItemRegister regobj;
+
+route mainRoute;
+
+Common::Point trayec[300];
+
+uint longtray;
+
+uint indicetray;
+
+uint indicetray2;
+
+byte zonaactual, zonadestino, oldzonadestino;
+
+byte maxrejax, maxrejay;
+
+byte rejafondomovto[10][10];
+
+byte rejafondoraton[10][10];
+
+byte rejamascaramovto[10][10];
+
+byte rejamascararaton[10][10];
+
+boolean completadalista1, completadalista2,
+ lista1, lista2;
+
+
+boolean primera[maxpersonajes],
+ lprimera[maxpersonajes],
+ cprimera[maxpersonajes],
+ libro[maxpersonajes],
+ caramelos[maxpersonajes];
+
+boolean cavernas[5];
+
+boolean firstList[5], secondList[5];
+
+regsecuencia secuencia;
+reganimado animado;
+uint sizeframe,
+ segpasoframe,
+ ofspasoframe,
+ sizeanimado,
+ segpasoanimado,
+ ofspasoanimado,
+ _handpantalla,
+ segfondo,
+ offfondo;
+
+byte fotogramamax2;
+
+byte tipoefectofundido;
+
+byte iframe, iframe2;
+
+long sizepantalla;
+
+datosobj profundidad[numobjetosconv];
+
+byte *objetos[numobjetosconv];
+
+byte *pasoframe;
+
+byte *pasoanimado;
+
+byte *fondo;
+
+byte *characterDirtyRect;
+
+byte *handpantalla;
+
+uint roomNumber;
+
+boolean isLoadingFromLauncher;
+
+
+void clearObj() {
+ byte indpasolimpiador1, indpasolimpiador2;
+
+ regobj.code = 0;
+ regobj.altura = 0;
+ regobj.name = "";
+ regobj.lookAtTextRef = 0;
+ regobj.beforeUseTextRef = 0;
+ regobj.afterUseTextRef = 0;
+ regobj.pickTextRef = 0;
+ regobj.useTextRef = 0;
+ regobj.habla = 0;
+ regobj.abrir = false;
+ regobj.cerrar = false;
+ for (indpasolimpiador1 = 0; indpasolimpiador1 <= 7; indpasolimpiador1++)
+ regobj.usar[indpasolimpiador1] = 0;
+ regobj.coger = false;
+ regobj.usarcon = 0;
+ regobj.reemplazarpor = 0;
+ regobj.profundidad = 0;
+ regobj.punterobitmap = 0;
+ regobj.tambitmap = 0;
+ regobj.punteroframesgiro = 0;
+ regobj.punteropaletagiro = 0;
+ regobj.xparche = 0;
+ regobj.yparche = 0;
+ regobj.puntparche = 0;
+ regobj.tamparche = 0;
+ regobj.objectIconBitmap = 0;
+ regobj.xrej1 = 0;
+ regobj.yrej1 = 0;
+ regobj.xrej2 = 0;
+ regobj.yrej2 = 0;
+ for (indpasolimpiador1 = 0; indpasolimpiador1 < 10; indpasolimpiador1++) {
+ for (indpasolimpiador2 = 0; indpasolimpiador2 < 10; indpasolimpiador2++) {
+ regobj.parcherejapantalla[indpasolimpiador1][indpasolimpiador2] = 0;
+ regobj.parcherejaraton[indpasolimpiador1][indpasolimpiador2] = 0;
+ }
+ }
+ contadorpc2 = contadorpc;
+}
+
+void clearScreenData() {
+ // debug("Clearing screen data! Shouldnt be necessary now!");
+ // byte ilocal1, ilocal2, ilocal3;
+ // uint ilocal4;
+
+ // contadorpc2 = contadorpc;
+ // roomData->codigo = 0;
+ // roomData->puntimagenpantalla = 0;
+ // roomData->tamimagenpantalla = 0;
+ // for (ilocal1 = 0; ilocal1 <= 39; ilocal1++)
+ // for (ilocal2 = 0; ilocal2 <= 27; ilocal2++) {
+ // roomData->rejapantalla[ilocal1][ilocal2] = 0;
+ // roomData->mouseGrid[ilocal1][ilocal2] = 0;
+ // }
+ // for (ilocal1 = 1; ilocal1 <= 9; ilocal1++)
+ // for (ilocal2 = 1; ilocal2 <= 30; ilocal2++)
+ // for (ilocal3 = 1; ilocal3 <= 5; ilocal3++) {
+ // roomData->trayectories[ilocal1][ilocal2][ilocal3].x = 9999;
+ // roomData->trayectories[ilocal1][ilocal2][ilocal3].y = 9999;
+ // }
+ // for (ilocal1 = 1; ilocal1 <= 5; ilocal1++) {
+ // roomData->doors[ilocal1].pantallaquecarga = 0;
+ // roomData->doors[ilocal1].posxsalida = 0;
+ // roomData->doors[ilocal1].posysalida = 0;
+ // roomData->doors[ilocal1].abiertacerrada = 0;
+ // roomData->doors[ilocal1].codigopuerta = 0;
+ // }
+ // for (ilocal1 = 1; ilocal1 <= 15; ilocal1++) {
+ // roomData->bitmapasociados[ilocal1].puntbitmap = 0;
+ // roomData->bitmapasociados[ilocal1].tambitmap = 0;
+ // roomData->bitmapasociados[ilocal1].coordx = 0;
+ // roomData->bitmapasociados[ilocal1].coordy = 0;
+ // roomData->bitmapasociados[ilocal1].profund = 0;
+ // }
+ // for (ilocal1 = 0; ilocal1 <= 50; ilocal1++) {
+ // // if(roomData->indexadoobjetos[ilocal1] != NULL) {
+ // // roomData->indexadoobjetos[ilocal1]->indicefichero = 0;
+ // // roomData->indexadoobjetos[ilocal1]->objectName = "";
+ // // }
+ // }
+ // roomData->banderamovimiento = false;
+ // roomData->nombremovto = "QQQQQQQQ";
+ // roomData->movementNameSize = 8;
+ // roomData->banderapaleta = false;
+ // roomData->puntpaleta = 0;
+ // for (ilocal4 = 1; ilocal4 <= 300; ilocal4++) {
+ // roomData->tray2[ilocal4].x = 0;
+ // roomData->tray2[ilocal4].y = 0;
+ // roomData->dir2[ilocal4] = 0;
+ // }
+ // roomData->longtray2 = 0;
+}
+
+/**
+ * Originally the Room file contains 8 copies of each room, one for every save plus the baseline (which is 0).
+ * To put this into memory we need to get the baseline of each room and then put them continuously in a byte stream.addr
+ * Whenever the game access a room instead of accessing the room for the autosave or the current save,
+ * we assume only one room register is there.
+ *
+ * To save a game we merely copy the entire stream into the save.
+*/
+void initializeScreenFile() {
+
+ Common::File roomFile;
+ if (!roomFile.open(Common::Path("PANTALLA.DAT"))) {
+ error("Error opening room files: ioresult (320)");
+ }
+ int roomNumber = 0;
+ int64 fileSize = roomFile.size();
+ delete (rooms);
+
+
+ byte *roomData = (byte *)malloc(roomRegSize * 32);
+ int roomCount = 0;
+
+ while (!roomFile.eos()) {
+ if (fileSize - roomFile.pos() >= roomRegSize) {
+ roomFile.read(roomData + roomRegSize * roomCount, roomRegSize);
+ // This one doesnt work for some reason:
+ // rooms->writeStream(roomFile.readStream(roomRegSize), roomRegSize);
+ roomFile.skip(roomRegSize * 7);
+ roomCount++;
+ } else {
+ break;
+ }
+ }
+ rooms = new Common::MemorySeekableReadWriteStream(roomData, roomRegSize * roomCount, DisposeAfterUse::NO);
+ roomFile.close();
+}
+
+void final_varanima() {
+ // switch (exitcode) {
+ // case 0: {
+ // output << "Gracias por jugar con otro producto ACA Soft." << NL;
+ // freemem(pasoicono, sizeicono);
+ // } break;
+ // case 1:
+ // output << "Error 1: Funci�n no existe." << NL;
+ // break;
+ // case 2:
+ // output << "Error 2: Fichero no encontrado." << NL;
+ // break;
+ // case 3:
+ // output << "Error 3: Camino no encontrado." << NL;
+ // break;
+ // case 4:
+ // output << "Error 4: Demasiados ficheros abiertos." << NL;
+ // break;
+ // case 5:
+ // output << "Error 5: Acceso denegado." << NL;
+ // break;
+ // case 6:
+ // output << "Error 6: Asignacion de fichero incorrecta." << NL;
+ // break;
+ // case RANGE_5(7, 11):
+ // output << "Error " << exitcode << string(": Espera... La placa madre est�") + " teniendo gemelos." << NL;
+ // break;
+ // case 12:
+ // output << "Error 12: C�digo de acceso a fichero incorrecto." << NL;
+ // break;
+ // case 13:
+ // case 14:
+ // output << "Error " << exitcode << string(": �Alguien ha visto por ah� un") + " bol�grafo?." << NL;
+ // break;
+ // case 15:
+ // output << "Error 15: Unidad incorrecta." << NL;
+ // break;
+ // case 16:
+ // output << "Error 16: No se puede borrar el directorio." << NL;
+ // break;
+ // case 17:
+ // output << "Error 17: No se puede renombrar en distintas unidades." << NL;
+ // break;
+ // case 18:
+ // output << "Error 18: No hay m�s ficheros." << NL;
+ // break;
+ // case 19 ... 99:
+ // output << "Error " << exitcode << ": Mi, mi, mi, mi, mi.... etc." << NL;
+ // break;
+ // case 100:
+ // output << "Error 100: No se pudo leer del disco." << NL;
+ // break;
+ // case 101:
+ // output << "Error 101: No se pudo escribir en el disco." << NL;
+ // break;
+ // case 102:
+ // output << "Error 102: Fichero sin asignar." << NL;
+ // break;
+ // case 103:
+ // output << "Error 103: Fichero sin abrir." << NL;
+ // break;
+ // case 104:
+ // output << "Error 104: Fichero abierto para salida." << NL;
+ // break;
+ // case 105:
+ // output << "Error 105: Fichero abierto para entrada." << NL;
+ // break;
+ // case 106:
+ // output << "Error 106: Formato num�rico no v�lido." << NL;
+ // break;
+ // case 107 ... 149:
+ // output << "Error " << exitcode << ": Tr�fico intenso en el bus de datos." << NL;
+ // break;
+ // case 150:
+ // output << "Error 150: Disco protegido contra escritura." << NL;
+ // break;
+ // case 151:
+ // output << string("Error 151: El driver del disco devuelve una estructura") +
+ // " incorrecta."
+ // << NL;
+ // break;
+ // case 152:
+ // output << "Error 152: Unidad no preparada." << NL;
+ // break;
+ // case 153:
+ // output << "Error " << exitcode << ": JOZU!! que Barbari�." << NL;
+ // break;
+ // case 154:
+ // output << string("Error 154: Comprobaci�n err�nea en el control de redundancia") +
+ // " c�clica."
+ // << NL;
+ // break;
+ // case 155:
+ // output << "Error " << exitcode << ": Cerrado por vacaciones." << NL;
+ // break;
+ // case 156:
+ // output << "Error 156: Posicionamiento err�neo en el fichero." << NL;
+ // break;
+ // case 157:
+ // output << "Error 157: Disco de formato desconocido." << NL;
+ // break;
+ // case 158:
+ // output << "Error 158: Sector no encontrado en el disco." << NL;
+ // break;
+ // case 159:
+ // output << "Error 159: Impresora sin papel." << NL;
+ // break;
+ // case 160:
+ // output << "Error 160: No se pudo escribir en el dispositivo." << NL;
+ // break;
+ // case 161:
+ // output << "Error 161: No se pudo leer del dispositivo." << NL;
+ // break;
+ // case 162:
+ // output << "Error 162: Problema con el dispositivo." << NL;
+ // break;
+ // case 163 ... 199:
+ // output << "Error " << exitcode << ": No sabe, no contesta." << NL;
+ // break;
+ // case 200:
+ // output << "Error 200: Division por cero." << NL;
+ // break;
+ // case 201:
+ // output << "Error 201: Variable fuera de rango." << NL;
+ // break;
+ // case 202:
+ // output << "Error 202: Desbordamiento en la pila." << NL;
+ // break;
+ // case 203:
+ // output << "Error 203: Desbordamiento en la memoria din�mica." << NL;
+ // break;
+ // case 204:
+ // output << "Error 204: Operaci�n err�nea con un puntero." << NL;
+ // break;
+ // case 205:
+ // output << "Error 205: Desbordamiento en coma flotante." << NL;
+ // break;
+ // case 206:
+ // output << "Error 206: Desbordamiento negativo en coma flotante." << NL;
+ // break;
+ // case 207:
+ // output << "Error 207: Operaci�n err�nea de coma flotante." << NL;
+ // break;
+ // case 208:
+ // output << "Error 208: Gestor de solapamiento sin instalar." << NL;
+ // break;
+ // case 209:
+ // output << "Error 209: Lectura err�nea del fichero de solapamiento." << NL;
+ // break;
+ // case 210:
+ // output << "Error 210: Objeto sin inicializar." << NL;
+ // break;
+ // case 211:
+ // output << "Error 211: Llamada a un metodo abstracto." << NL;
+ // break;
+ // case 212:
+ // output << "Error 212: Cadena de asignaci�n del objeto err�nea." << NL;
+ // break;
+ // case 213:
+ // output << "Error 213: Indice para colecci�n fuera de rango." << NL;
+ // break;
+ // case 214:
+ // output << "Error 214: Desbordamiento en la colecci�n." << NL;
+ // break;
+ // case 215:
+ // output << "Error 215: Desbordamiento en operaci�n aritm�tica." << NL;
+ // break;
+ // case 216:
+ // output << "Error 216: Acceso a memoria sin asignar." << NL;
+ // break;
+ // case 217 ... 249:
+ // output << "Error " << exitcode << ": Dios mio... estoy lleno de chips." << NL;
+ // break;
+ // case 250:
+ // output << "Error 250: El driver de AdLib no est� instalado." << NL;
+ // break;
+ // case 251:
+ // output << "Error 251: Libre para AdLib." << NL;
+ // break;
+ // case 252:
+ // output << string("Error 252: No se encontr� el fichero de efectos") + " para SBlaster." << NL;
+ // break;
+ // case 253:
+ // output << string("Error 253: No se encontr� el fichero de m�sica ") + "para SBlaster." << NL;
+ // break;
+ // case 254:
+ // output << string("Error 254: Libre para el fichero de configuraci�n del") +
+ // " sonido."
+ // << NL;
+ // break;
+ // case 255:
+ // output << "Error 255: Detectado Ctrl-Break." << NL;
+ // break;
+ // case 256:
+ // output << string("Error 256: La tarjeta de video no soporta el modo gr�fico ") + "requerido." << NL;
+ // break;
+ // case 257:
+ // output << "Error 257: El tipo de pantalla no es correcto." << NL;
+ // break;
+ // case 258:
+ // output << "Error 258: No se encontr� el fichero con la imagen del menu." << NL;
+ // break;
+ // case 259:
+ // output << "Error 259: Clave de protecci�n erronea." << NL;
+ // break;
+ // case 260:
+ // output << "Error 260: No se encontr� el driver del modo X de v�deo." << NL;
+ // break;
+ // case 261:
+ // output << string("Error 261: No se encontr� el fichero de datos de los ") + "objetos." << NL;
+ // break;
+ // case 262:
+ // output << "Error 262: No se encontr� el fichero de los BITMAP." << NL;
+ // break;
+ // case 263:
+ // output << string("Error 263: No se encontr� el fichero de paleta para la ") + "imagen girando." << NL;
+ // break;
+ // case 264:
+ // output << "Error 264: Se desbord� la pila de montaje de bitmaps" << NL;
+ // break;
+ // case 265:
+ // output << "Error 265: No se encontr� el fichero de la animaci�n." << NL;
+ // break;
+ // case 266:
+ // output << "Error 266: No se encontr� el fichero del efecto de sonido." << NL;
+ // break;
+ // case 267:
+ // output << "Error 267: No se encontr� el fichero de la melodia." << NL;
+ // break;
+ // case 268:
+ // output << "Error 268: No se encontr� el driver de sonido MIDI." << NL;
+ // break;
+ // case 269:
+ // output << "Error 269: No se pudo capturar un vector de interrupci�n." << NL;
+ // break;
+ // case 270:
+ // output << "Error 270: No se encontr� el fichero de los cr�ditos." << NL;
+ // break;
+ // case 271:
+ // output << "Error 271: No se encontr� el fichero del BitMap del sello." << NL;
+ // break;
+ // case 272:
+ // output << "Error 272: No se encontr� el fichero de la animaci�n." << NL;
+ // break;
+ // case 273:
+ // output << string("Error 273: No se encontraron los �ndices de los modos X de") +
+ // " acceso a v�deo."
+ // << NL;
+ // break;
+ // case 274:
+ // output << string("Error 274: Fichero de datos corrupto, instale de nuevo el") +
+ // " programa."
+ // << NL;
+ // break;
+ // case 275:
+ // output << "Error 275: Posici�n incorrecta del Sprite." << NL;
+ // break;
+ // case 276:
+ // output << "Error 276: Alineaci�n incorrecta del driver de sonido." << NL;
+ // break;
+ // case 277:
+ // output << "Error 277: No se encontr� el fichero de la animaci�n." << NL;
+ // break;
+ // case 278:
+ // output << "Error 278: No se encontr� el fichero para la actualizaci�n." << NL;
+ // break;
+ // case 279:
+ // output << "Error 279: No se actualiz� el puntero del rat�n." << NL;
+ // break;
+ // case 280:
+ // output << "Error 280: No se encontr� el puntero de video." << NL;
+ // break;
+ // case 281:
+ // output << "Error 281: No se actualiz� el puntero de video." << NL;
+ // break;
+ // case 282:
+ // output << "Error 282: No se actualiz� el flag del trace." << NL;
+ // break;
+ // case RANGE_16(283, 298):
+ // output << "Error " << exitcode << ": Coffe not found. Operator Halted." << NL;
+ // break;
+ // case 299:
+ // output << "Error 299: No se pudo reubicar los datos en la memoria XMS." << NL;
+ // break;
+ // case 300:
+ // output << "Error 300: No hay memoria XMS suficiente." << NL;
+ // break;
+ // case 301:
+ // output << "Error 301: No se pudo reservar memoria XMS suficiente." << NL;
+ // break;
+ // case 302:
+ // output << "Error 302: No se pudo liberar la memoria XMS." << NL;
+ // break;
+ // case 303:
+ // output << "Error 303: No se encuentra disponible un handle para XMS." << NL;
+ // break;
+ // case 304:
+ // output << "Error 304: No se encontr� el fichero de gr�ficos." << NL;
+ // break;
+ // case 305:
+ // output << string("Error 305: Necesita una versi�n 6.0 o posterior del driver") + " del rat�n." << NL;
+ // break;
+ // case 306:
+ // output << string("Error 306: No se pudo inicializar correctamente el driver ") + "del rat�n." << NL;
+ // break;
+ // case 307:
+ // output << "Error 307: No hay memoria baja suficiente. " << memavail() / 1024 << NL;
+ // break;
+ // case 308:
+ // output << string("Error 308: No se pudo inicializar correctamente el modo") + " gr�fico." << NL;
+ // break;
+ // case 309:
+ // output << string("Error 309: No se pudieron inicializar correctamente los ") + "tipos de letra." << NL;
+ // break;
+ // case 310:
+ // output << "Error 310: No se encontr� el fichero de paleta." << NL;
+ // break;
+ // case 311:
+ // output << "Error 311: No se encontr� el fichero de paleta para fundido." << NL;
+ // break;
+ // case 312:
+ // output << string("Error 312: No se encontr� el fichero de los BITMAP del ") + "inventario." << NL;
+ // break;
+ // case 313:
+ // output << "Error 313: No se encontr� el fichero de hipertexto." << NL;
+ // break;
+ // case 314:
+ // output << string("Error 314: No se encontr� el fichero del arbol de ") + "conversaciones." << NL;
+ // break;
+ // case 315:
+ // output << string("Error 315: No se encontr� el fichero de la pantalla a ") + "pintar." << NL;
+ // break;
+ // case 316:
+ // output << string("Error 316: No se encontr� el fichero de la pantalla a") + " cargar." << NL;
+ // break;
+ // case 317:
+ // output << string("Error 317: No se encontr� el fichero de las mascaras del") + " rat�n." << NL;
+ // break;
+ // case 318:
+ // output << "Error 318: No se encontr� el fichero del diploma." << NL;
+ // break;
+ // case 319:
+ // output << string("Error 319: No se encontr� el fichero de los objetos en") + " pantalla." << NL;
+ // break;
+ // case 320:
+ // output << string("Error 320: No se encontr� el fichero de la rejilla de") + " pantalla." << NL;
+ // break;
+ // case 321:
+ // output << "Error 321: No se encontr� el fichero del objeto rotando." << NL;
+ // break;
+ // case 322:
+ // output << "Error 322: No se encontr� el fichero de la partida salvada." << NL;
+ // break;
+ // case 323:
+ // output << "Error 323: No se encontr� el fichero de configuraci�n." << NL;
+ // break;
+ // default:
+ // output << "Error " << exitcode << ": La parab�lica est� mal orientada." << NL;
+ // }
+ if (exitcode != 0) {
+ // output << "Restaurando ficheros...." << NL;
+ // initializeScreenFile();
+ // // initializeObjectFile();
+ // assign(kkfile, "GAME07.SAV");
+
+ // if (ioresult == 0) {
+ // close(kkfile);
+ // erase(kkfile);
+ // }
+ // // movefile(diractual, diractual, "CONVERSA.TRE", "007");
+ // output << "La partida temporal se ha eliminado." << NL;
+ }
+}
+
+void resetGameState() {
+
+ characterPosX = 160;
+ characterPosY = 80;
+ iframe = 0;
+ trayec[0].x = characterPosX;
+ trayec[0].y = characterPosY;
+ xframe2 = 0;
+ yframe2 = 1;
+ zonaactual = 1;
+ zonadestino = 1;
+ oldzonadestino = 0;
+ direccionmovimiento = 1;
+ primera[0] = true;
+ primera[1] = true;
+ primera[2] = true;
+ primera[3] = true;
+ primera[4] = true;
+ primera[5] = true;
+ primera[6] = true;
+ primera[7] = true;
+ primera[8] = true;
+ lprimera[0] = false;
+ lprimera[1] = false;
+ lprimera[2] = false;
+ lprimera[3] = false;
+ lprimera[4] = false;
+ lprimera[5] = false;
+ lprimera[6] = false;
+ lprimera[7] = false;
+ lprimera[8] = false;
+
+ cprimera[0] = false;
+ cprimera[1] = false;
+ cprimera[2] = false;
+ cprimera[3] = false;
+ cprimera[4] = false;
+ cprimera[5] = false;
+ cprimera[6] = false;
+ cprimera[7] = false;
+ cprimera[8] = false;
+
+ libro[0] = false;
+ libro[1] = false;
+ libro[2] = false;
+ libro[3] = false;
+ libro[4] = false;
+ libro[5] = false;
+ libro[6] = false;
+ libro[7] = false;
+ libro[8] = false;
+
+ caramelos[0] = false;
+ caramelos[1] = false;
+ caramelos[2] = false;
+ caramelos[3] = false;
+ caramelos[4] = false;
+ caramelos[5] = false;
+ caramelos[6] = false;
+ caramelos[7] = false;
+ caramelos[8] = false;
+
+ cavernas[0] = false;
+ cavernas[1] = false;
+ cavernas[2] = false;
+ cavernas[3] = false;
+ cavernas[4] = false;
+
+ animacion2 = false;
+ secuencia.profundidad = 0;
+ volumenfxderecho = 6;
+ volumenfxizquierdo = 6;
+ volumenmelodiaderecho = 3;
+ volumenmelodiaizquierdo = 3;
+
+ pintaractivo = true;
+ desactivagrabar = false;
+ partidanueva = false;
+ salirdeljuego = false;
+ lista1 = false;
+ lista2 = false;
+
+ completadalista1 = false;
+ completadalista2 = false;
+
+ movidapaleta = 0;
+ parte_del_juego = 1;
+
+ vasijapuesta = false;
+ guadagna = false;
+ tridente = false;
+ torno = false;
+ barro = false;
+ sello_quitado = false;
+
+ diablillo_verde = false;
+ rojo_capturado = false;
+ alacena_abierta = false;
+ baul_abierto = false;
+
+ teleencendida = false;
+ trampa_puesta = false;
+ saltospal = 0;
+
+ hornacina[0][0] = 563;
+ hornacina[0][1] = 561;
+ hornacina[0][2] = 0;
+ hornacina[0][3] = 2;
+
+ hornacina[1][0] = 615;
+ hornacina[1][1] = 622;
+ hornacina[1][2] = 623;
+ hornacina[1][3] = 0;
+
+ indicetray = 0;
+ posicioninv = 0;
+}
+
+void initPlayAnim() {
+ debug("initplayanim!");
+ isLoadingFromLauncher = false;
+ encriptado = "23313212133122121312132132312312122132322131221322222112121"
+ "32121121212112111212112333131232323213222132123211213221231"
+ "32132213232333333213132132132322113212132121322123121232332"
+ "23123221322213233221112312231221233232122332211112233122321"
+ "222312211322312223";
+
+ rooms = nullptr;
+ conversationData = nullptr;
+ invItemData = nullptr;
+ // encriptado[0] = encripcod1;
+ // encriptado[1] = '\63';
+ // encriptado[2] = '\63';
+ // encriptado[3] = encripcod1 - 1;
+ // encriptado[4] = '\63';
+ // encriptado[5] = encripcod1;
+ // encriptado[6] = encripcod1 - 1;
+ // encriptado[7] = encripcod1;
+ // encriptado[8] = encripcod1 - 1;
+ // encriptado[9] = '\63';
+ // encriptado[10] = '\63';
+ // encriptado[11] = encripcod1 - 1;
+ // encriptado[12] = encripcod1;
+ // encriptado[13] = encripcod1;
+ // encriptado[14] = encripcod1 - 1;
+ // encriptado[15] = encripcod1;
+ // encriptado[16] = encripcod1 - 1;
+ // encriptado[17] = '\63';
+ // encriptado[18] = encripcod1 - 1;
+ // encriptado[19] = encripcod1;
+ // encriptado[20] = encripcod1 - 1;
+ // encriptado[21] = '\63';
+ // encriptado[22] = encripcod1;
+ // encriptado[23] = encripcod1 - 1;
+ // encriptado[24] = '\63';
+ // encriptado[25] = encripcod1;
+ // encriptado[26] = '\63';
+ // encriptado[27] = encripcod1 - 1;
+ // encriptado[28] = encripcod1;
+ // encriptado[29] = '\63';
+ // encriptado[30] = encripcod1 - 1;
+ // encriptado[31] = encripcod1;
+ // encriptado[32] = encripcod1 - 1;
+ // encriptado[33] = encripcod1;
+ // encriptado[34] = encripcod1;
+ // encriptado[35] = encripcod1 - 1;
+ // encriptado[36] = '\63';
+ // encriptado[37] = encripcod1;
+ // encriptado[38] = '\63';
+ // encriptado[39] = encripcod1;
+ // encriptado[40] = encripcod1;
+ // encriptado[41] = encripcod1 - 1;
+ // encriptado[42] = '\63';
+ // encriptado[43] = encripcod1 - 1;
+ // encriptado[44] = encripcod1;
+ // encriptado[45] = encripcod1;
+ // encriptado[46] = encripcod1 - 1;
+ // encriptado[47] = '\63';
+ // encriptado[48] = encripcod1;
+ // encriptado[49] = encripcod1;
+ // encriptado[50] = encripcod1;
+ // encriptado[51] = encripcod1;
+ // encriptado[52] = encripcod1;
+ // encriptado[53] = encripcod1 - 1;
+ // encriptado[54] = encripcod1 - 1;
+ // encriptado[55] = encripcod1;
+ // encriptado[56] = encripcod1 - 1;
+ // encriptado[57] = encripcod1;
+ // encriptado[58] = encripcod1 - 1;
+ // encriptado[59] = '\63';
+ // encriptado[60] = encripcod1;
+ // encriptado[61] = encripcod1 - 1;
+ // encriptado[62] = encripcod1;
+ // encriptado[63] = encripcod1 - 1;
+ // encriptado[64] = encripcod1 - 1;
+ // encriptado[65] = encripcod1;
+ // encriptado[66] = encripcod1 - 1;
+ // encriptado[67] = encripcod1;
+ // encriptado[68] = encripcod1 - 1;
+ // encriptado[69] = encripcod1;
+ // encriptado[70] = encripcod1 - 1;
+ // encriptado[71] = encripcod1 - 1;
+ // encriptado[72] = encripcod1;
+ // encriptado[73] = encripcod1 - 1;
+ // encriptado[74] = encripcod1 - 1;
+ // encriptado[75] = encripcod1 - 1;
+ // encriptado[76] = encripcod1;
+ // encriptado[77] = encripcod1 - 1;
+ // encriptado[78] = encripcod1;
+ // encriptado[79] = encripcod1 - 1;
+ // encriptado[80] = encripcod1 - 1;
+ // encriptado[81] = encripcod1;
+ // encriptado[82] = '\63';
+ // encriptado[83] = '\63';
+ // encriptado[84] = '\63';
+ // encriptado[85] = encripcod1 - 1;
+ // encriptado[86] = '\63';
+ // encriptado[87] = encripcod1 - 1;
+ // encriptado[88] = encripcod1;
+ // encriptado[89] = '\63';
+ // encriptado[90] = encripcod1;
+ // encriptado[91] = '\63';
+ // encriptado[92] = encripcod1;
+ // encriptado[93] = '\63';
+ // encriptado[94] = encripcod1;
+ // encriptado[95] = encripcod1 - 1;
+ // encriptado[96] = '\63';
+ // encriptado[97] = encripcod1;
+ // encriptado[98] = encripcod1;
+ // encriptado[99] = encripcod1;
+ // encriptado[100] = encripcod1 - 1;
+ // encriptado[101] = '\63';
+ // encriptado[102] = encripcod1;
+ // encriptado[103] = encripcod1 - 1;
+ // encriptado[104] = encripcod1;
+ // encriptado[105] = '\63';
+ // encriptado[106] = encripcod1;
+ // encriptado[107] = encripcod1 - 1;
+ // encriptado[108] = encripcod1 - 1;
+ // encriptado[109] = encripcod1;
+ // encriptado[110] = encripcod1 - 1;
+ // encriptado[111] = '\63';
+ // encriptado[112] = encripcod1;
+ // encriptado[113] = encripcod1;
+ // encriptado[114] = encripcod1 - 1;
+ // encriptado[115] = encripcod1;
+ // encriptado[116] = '\63';
+ // encriptado[117] = encripcod1 - 1;
+ // encriptado[118] = '\63';
+ // encriptado[119] = encripcod1;
+ // encriptado[120] = encripcod1 - 1;
+ // encriptado[121] = '\63';
+ // encriptado[122] = encripcod1;
+ // encriptado[123] = encripcod1;
+ // encriptado[124] = encripcod1 - 1;
+ // encriptado[125] = '\63';
+ // encriptado[126] = encripcod1;
+ // encriptado[127] = '\63';
+ // encriptado[128] = encripcod1;
+ // encriptado[129] = '\63';
+ // encriptado[130] = '\63';
+ // encriptado[131] = '\63';
+ // encriptado[132] = '\63';
+ // encriptado[133] = '\63';
+ // encriptado[134] = '\63';
+ // encriptado[135] = encripcod1;
+ // encriptado[136] = encripcod1 - 1;
+ // encriptado[137] = '\63';
+ // encriptado[138] = encripcod1 - 1;
+ // encriptado[139] = '\63';
+ // encriptado[140] = encripcod1;
+ // encriptado[141] = encripcod1 - 1;
+ // encriptado[142] = '\63';
+ // encriptado[143] = encripcod1;
+ // encriptado[144] = encripcod1 - 1;
+ // encriptado[145] = '\63';
+ // encriptado[146] = encripcod1;
+ // encriptado[147] = '\63';
+ // encriptado[148] = encripcod1;
+ // encriptado[149] = encripcod1;
+ // encriptado[150] = encripcod1 - 1;
+ // encriptado[151] = encripcod1 - 1;
+ // encriptado[152] = '\63';
+ // encriptado[153] = encripcod1;
+ // encriptado[154] = encripcod1 - 1;
+ // encriptado[155] = encripcod1;
+ // encriptado[156] = encripcod1 - 1;
+ // encriptado[157] = '\63';
+ // encriptado[158] = encripcod1;
+ // encriptado[159] = encripcod1 - 1;
+ // encriptado[160] = encripcod1;
+ // encriptado[161] = encripcod1 - 1;
+ // encriptado[162] = '\63';
+ // encriptado[163] = encripcod1;
+ // encriptado[164] = encripcod1;
+ // encriptado[165] = encripcod1 - 1;
+ // encriptado[166] = encripcod1;
+ // encriptado[167] = '\63';
+ // encriptado[168] = encripcod1 - 1;
+ // encriptado[169] = encripcod1;
+ // encriptado[170] = encripcod1 - 1;
+ // encriptado[171] = encripcod1;
+ // encriptado[172] = '\63';
+ // encriptado[173] = encripcod1;
+ // encriptado[174] = '\63';
+ // encriptado[175] = '\63';
+ // encriptado[176] = encripcod1;
+ // encriptado[177] = encripcod1;
+ // encriptado[178] = '\63';
+ // encriptado[179] = encripcod1 - 1;
+ // encriptado[180] = encripcod1;
+ // encriptado[181] = '\63';
+ // encriptado[182] = encripcod1;
+ // encriptado[183] = encripcod1;
+ // encriptado[184] = encripcod1 - 1;
+ // encriptado[185] = '\63';
+ // encriptado[186] = encripcod1;
+ // encriptado[187] = encripcod1;
+ // encriptado[188] = encripcod1;
+ // encriptado[189] = encripcod1 - 1;
+ // encriptado[190] = '\63';
+ // encriptado[191] = encripcod1;
+ // encriptado[192] = '\63';
+ // encriptado[193] = '\63';
+ // encriptado[194] = encripcod1;
+ // encriptado[195] = encripcod1;
+ // encriptado[196] = encripcod1 - 1;
+ // encriptado[197] = encripcod1 - 1;
+ // encriptado[198] = encripcod1 - 1;
+ // encriptado[199] = encripcod1;
+ // encriptado[200] = '\63';
+ // encriptado[201] = encripcod1 - 1;
+ // encriptado[202] = encripcod1;
+ // encriptado[203] = encripcod1;
+ // encriptado[204] = '\63';
+ // encriptado[205] = encripcod1 - 1;
+ // encriptado[206] = encripcod1;
+ // encriptado[207] = encripcod1;
+ // encriptado[208] = encripcod1 - 1;
+ // encriptado[209] = encripcod1;
+ // encriptado[210] = '\63';
+ // encriptado[211] = '\63';
+ // encriptado[212] = encripcod1;
+ // encriptado[213] = '\63';
+ // encriptado[214] = encripcod1;
+ // encriptado[215] = encripcod1 - 1;
+ // encriptado[216] = encripcod1;
+ // encriptado[217] = encripcod1;
+ // encriptado[218] = '\63';
+ // encriptado[219] = '\63';
+ // encriptado[220] = encripcod1;
+ // encriptado[221] = encripcod1;
+ // encriptado[222] = encripcod1 - 1;
+ // encriptado[223] = encripcod1 - 1;
+ // encriptado[224] = encripcod1 - 1;
+ // encriptado[225] = encripcod1 - 1;
+ // encriptado[226] = encripcod1;
+ // encriptado[227] = encripcod1;
+ // encriptado[228] = '\63';
+ // encriptado[229] = '\63';
+ // encriptado[230] = encripcod1 - 1;
+ // encriptado[231] = encripcod1;
+ // encriptado[232] = encripcod1;
+ // encriptado[233] = '\63';
+ // encriptado[234] = encripcod1;
+ // encriptado[235] = encripcod1 - 1;
+ // encriptado[236] = encripcod1;
+ // encriptado[237] = encripcod1;
+ // encriptado[238] = encripcod1;
+ // encriptado[239] = '\63';
+ // encriptado[240] = encripcod1 - 1;
+ // encriptado[241] = encripcod1;
+ // encriptado[242] = encripcod1;
+ // encriptado[243] = encripcod1 - 1;
+ // encriptado[244] = encripcod1 - 1;
+ // encriptado[245] = '\63';
+ // encriptado[246] = encripcod1;
+ // encriptado[247] = encripcod1;
+ // encriptado[248] = '\63';
+ // encriptado[249] = encripcod1 - 1;
+ // encriptado[250] = encripcod1;
+ // encriptado[251] = encripcod1;
+ // encriptado[252] = encripcod1;
+ // encriptado[253] = '\63';
+ tocapintar = false;
+ for (int i = 0; i < numobjetosconv; i++) {
+ objetos[i] = NULL;
+ }
+ xraton = 160;
+ yraton = 100;
+ pulsax = xraton;
+ pulsay = yraton;
+ iraton = 1;
+
+ resetGameState();
+ firstList[0] = 222;
+ firstList[1] = 295;
+ firstList[2] = 402;
+ firstList[3] = 223;
+ firstList[4] = 521;
+ secondList[0] = 221;
+ secondList[1] = 423;
+ secondList[2] = 308;
+ secondList[3] = 362;
+ secondList[4] = 537;
+ contadorpc = 0;
+ contadorpc2 = 0;
+ continuarpartida = true;
+ hechaprimeravez = false;
+ dentro_del_juego = false;
+}
+
+} // End of namespace Tot
diff --git a/engines/tot/playanim.h b/engines/tot/playanim.h
new file mode 100644
index 00000000000..40090ed4f0a
--- /dev/null
+++ b/engines/tot/playanim.h
@@ -0,0 +1,656 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+#ifndef TOT_PLAYANIM_H
+#define TOT_PLAYANIM_H
+
+#include "common/scummsys.h"
+#include "common/file.h"
+#include "common/memstream.h"
+
+#include "tot/util.h"
+
+namespace Tot {
+
+const int verbRegSize = 263;
+const int roomRegSize = 10856;
+const int itemRegSize = 279;
+
+// Enforces a small delay when text reveal is supposed to happen
+const int enforcedTextAnimDelay = 0;
+
+const int indicelista1 = 19;
+const int indicelista2 = 20;
+const int codigolista1 = 149;
+const int codigolista2 = 150;
+const int memoriaminima = 130000;
+/**
+ * Num of icons in the inventory
+ */
+const int inventoryIconCount = 34;
+const int numobjetosconv = 15;
+/**
+ * Num of depth levels
+ */
+const int nivelesdeprof = 15;
+/**
+ * Num of frames of the main character in a single direction
+ */
+const int walkFrameCount = 16;
+/**
+ * Num of frames in the secondary animation
+ */
+const int secAnimationFrameCount = 50;
+/**
+ * Screen size
+ */
+const int tampan = 320 * 140;
+/**
+ * X factor of the screen grid
+ * This results in 320/8 = 40 quadrants.
+ */
+const int factorx = 8;
+/**
+ * Y factor of the screen grid
+ * This results in 140/5 = 28 quadrants.
+ */
+const int factory = 5;
+/**
+ * Adjustment of feet on frame 49
+ */
+const int rectificaciony = 49;
+/**
+ * Adjustment of feet on frame 28
+ */
+const int rectificacionx = 14;
+const int longitudnombreobjeto = 20;
+const int maxpersonajes = 9;
+/**
+ * Num of reserved colors at the end of the game's palette
+ */
+const int coloresreservados = 28;
+/**
+ * Size of an inventory icon (39x26)
+ */
+const int sizeicono = 1018;
+const int tamcarahablando = 7206;
+/**
+ * Number of points in a
+ */
+const int routePointCount = 7;
+/**
+ * Trajectory changes
+ */
+typedef Common::Point route[routePointCount];
+
+struct datosobj {
+ uint16 codigo, posx, posy, posx2, posy2;
+};
+
+struct regsecuencia {
+ uint16 profundidad;
+ byte *bitmap[4][walkFrameCount + 30]; // 30 = 3 actions * 10 frames each
+};
+
+struct reganimado {
+ uint16 profundidad, dir, posx, posy;
+ byte *dib[4][secAnimationFrameCount];
+};
+
+struct reginventario {
+ uint16 bitmapIndex;
+ uint16 code;
+ Common::String objectName;
+};
+
+struct inventoryBitmaps {
+ byte *bitmap[inventoryIconCount];
+};
+
+/**
+ * Hypertext struct
+ */
+struct regismht {
+ Common::String cadenatext; // string
+ boolean encadenado; // true if the next entry is a continuation of this one
+ uint16 respuesta; // entry number of reply
+ int32 punteronil;
+};
+
+struct InvItemRegister {
+ /**
+ * registry number
+ */
+ uint16 code;
+ byte altura; /* 0 top 1 middle 2 bottom*/
+ Common::String name; /*name for mouseover*/
+ uint16 lookAtTextRef; /* Registro al mirar el objeto en pantalla */
+ uint16 beforeUseTextRef; /* Registro antes de usar el objeto en mochila */
+ uint16 afterUseTextRef; /* Registro despues de usar el objeto en mochila */
+ uint16 pickTextRef; /* Registro al coger el objeto */
+ uint16 useTextRef; /* Registro al usar el objeto */
+ byte habla; /* number of character to respond */
+ boolean abrir; /* true if it can be opened */
+ boolean cerrar; /* true if it can be closed*/
+ byte usar[8];
+ boolean coger;
+ uint16 usarcon,
+ reemplazarpor; /*Numero del objeto por el que se reemplaza en el
+ caso de que se utilize con un objeto de la mochila
+ y haya que cambiarlo por otro.*/
+ byte profundidad;
+ uint32 punterobitmap; /*Puntero al fichero de bitmap para el
+ objeto que se suelta en la pantalla*/
+ uint16 tambitmap;
+ uint32 punteroframesgiro; /*Puntero al fichero de
+ bitmap para el objeto girando*/
+ uint16 punteropaletagiro, /*Puntero al fichero de paletas para
+ la imagen girando*/
+ xparche, yparche;
+ uint32 puntparche;
+ uint16 tamparche, objectIconBitmap;
+ byte xrej1, yrej1, xrej2, yrej2;
+
+ byte parcherejapantalla[10][10];
+ byte parcherejaraton[10][10];
+};
+
+struct DoorRegistry {
+ uint16 pantallaquecarga,
+ posxsalida, posysalida; /*Coordenadas x e y de salida del
+ personaje en la siguiente pantalla*/
+ byte abiertacerrada, codigopuerta;
+};
+
+struct RoomObjectListEntry {
+ uint16 indicefichero;
+ Common::String objectName;
+};
+
+struct RoomBitmapRegister {
+ int32 puntbitmap;
+ uint16 tambitmap;
+ uint16 coordx, coordy, profund;
+};
+
+struct RoomFileRegister {
+ uint16 codigo;
+ int32 puntimagenpantalla;
+ uint16 tamimagenpantalla;
+ byte rejapantalla[40][28]; /* movement grid */
+ byte mouseGrid[40][28]; /* mousegrid with index to indexadoObjetos */
+ /**
+ * This is a preset matrix of trajectories from different areas of the game.action
+ * Each room is divided into a number of areas according to the screen grid [rejapantalla].action
+ *
+ * A given coordinate in the game (x,y) is mapped into a grid position by dividing the x with factorx (8)
+ * and the y coordinate by factory (5). With each room being 320x140 this results in
+ * 40 horizontal divisions and 28 vertical divisions which matches the [rejapantalla] matrix.action
+ *
+ * When obtaining the grid position a given (x,y) coordinate matches to, [rejapantalla] returns an
+ * area number.action
+ *
+ * trayectorias then has a precalculated route from each possible combination of two areas in the game.
+ * pixel by pixel translation within the area is done by bresenham algorithm in the trajectory function.
+ */
+ Common::Point trayectories[9][30][5];
+ DoorRegistry doors[5]; /* doors in the room */
+ RoomBitmapRegister bitmapasociados[15];
+ RoomObjectListEntry *indexadoobjetos[51] = {NULL}; /* includes name of objects for mouseover + index to object file*/
+ boolean banderamovimiento; /* true if another character is moving */
+ Common::String nombremovto; /* name of the secondary animation, 8 chars*/
+ boolean banderapaleta; /* true if there exist palette animation */
+ uint16 puntpaleta; /* points to the screen palette */
+ Common::Point tray2[300]; /* trajectory of the secondary animation */
+ uint16 dir2[300]; /* directions of the secondary trajectory. Pos 300 reflects object code. */
+ uint16 longtray2; /* longitude of the trajectory of the secondary animation */
+};
+
+struct regispartida {
+ uint numeropantalla,
+ longtray,
+ indicetray,
+ codigoobjmochila,
+ volumenfxderecho,
+ volumenfxizquierdo,
+ volumenmelodiaderecho,
+ volumenmelodiaizquierdo,
+ oldxrejilla,
+ oldyrejilla,
+ animadoprofundidad,
+ animadodir,
+ animadoposx,
+ animadoposy,
+ animadoiframe2;
+ byte zonaactual,
+ zonadestino,
+ oldzonadestino,
+ posicioninv,
+ numeroaccion,
+ oldnumeroacc,
+ pasos,
+ indicepuertas,
+ direccionmovimiento,
+ iframe,
+ parte_del_juego;
+ boolean sello_quitado,
+ manual_torno,
+ lista1,
+ lista2,
+ completadalista1,
+ completadalista2,
+ vasijapuesta,
+ guadagna,
+ tridente,
+ torno,
+ barro,
+ diablillo_verde,
+ alacena_abierta,
+ baul_abierto,
+ teleencendida,
+ trampa_puesta,
+ rojo_capturado;
+ reginventario mobj[inventoryIconCount];
+ int elemento1,
+ elemento2,
+ xframe,
+ yframe,
+ xframe2,
+ yframe2;
+ Common::String oldobjmochila,
+ objetomochila;
+ Common::String nombrepersonaje;
+ route mainRoute;
+ boolean firstList[5], secondList[5];
+ Common::Point trayec[300];
+ boolean primera[maxpersonajes],
+ lprimera[maxpersonajes],
+ cprimera[maxpersonajes],
+ libro[maxpersonajes],
+ caramelos[maxpersonajes];
+
+ boolean cavernas[5];
+ uint hornacina[2][4];
+};
+
+typedef byte palette[768];
+
+extern Common::MemorySeekableReadWriteStream *conversationData;
+extern Common::MemorySeekableReadWriteStream *rooms;
+extern Common::MemorySeekableReadWriteStream *invItemData;
+/**
+ * Frame index of the mouse mask
+ */
+extern byte iraton;
+/**
+ * Coords of the mouse sprite
+ */
+extern uint xraton, yraton;
+/**
+ * Coords of mouse clicks
+ */
+extern uint pulsax, pulsay;
+/**
+ * Mouse clicks for both buttons
+ */
+extern uint npraton2, npraton;
+
+/**
+ * Previous positions of the mouse within the screen grid
+ */
+extern uint oldxrejilla, oldyrejilla;
+
+extern regispartida regpartida;
+
+extern boolean sello_quitado;
+
+/**
+ * Flag to enable screen/room change
+ */
+extern boolean cambiopantalla;
+extern boolean teleencendida,
+ vasijapuesta,
+ guadagna,
+ tridente,
+ torno,
+ barro,
+ diablillo_verde,
+ rojo_capturado,
+ manual_torno,
+ alacena_abierta,
+ baul_abierto,
+ trampa_puesta,
+ peteractivo;
+
+/**
+ * Flag for temporary savegame
+ */
+extern boolean dentro_del_juego;
+/**
+ * Flag for first time run of the game.
+ */
+extern boolean hechaprimeravez;
+/**
+ * Flag to exit program.
+ */
+extern boolean salirdeljuego;
+/**
+ * Flag to initialize game
+ */
+extern boolean partidanueva;
+/**
+ * Flag to resume game
+ */
+extern boolean continuarpartida;
+/**
+ * Flag to load a game upon start.
+ */
+extern boolean desactivagrabar;
+/**
+ * true if sprites should be drawn
+ */
+extern boolean pintaractivo;
+/**
+ * Flag for secondary animation
+ */
+extern boolean animacion2;
+/**
+ * 54 color palette slice.
+ */
+extern palette movimientopal;
+/**
+ * General palette
+ */
+extern palette pal;
+
+/**
+ * These are the icons currnetly in the inventory
+ */
+extern reginventario mobj[inventoryIconCount];
+/**
+ * Keeps an array of all inventory icons
+ */
+extern inventoryBitmaps mochilaxms;
+
+/**
+ * Delay of palette animation
+ */
+extern byte saltospal;
+/**
+ * Position within inventory
+ */
+extern byte posicioninv;
+/**
+ * Currently selected action.
+ */
+extern byte numeroaccion;
+/**
+ * Previously selected action.
+ */
+extern byte oldnumeroacc;
+/**
+ * Number of trajectory changes
+ */
+extern byte pasos;
+/**
+ * index of currently selected door.
+ */
+extern byte indicepuertas;
+/**
+ * Aux for palette animation
+ */
+extern byte movidapaleta;
+/**
+ * Index of patch for grid within XMS
+ */
+extern byte rejillaquetoca;
+/**
+ * 1 first part, 2 second part
+ */
+extern byte parte_del_juego;
+extern byte encripcod1;
+/**
+ * Number of frames of secondary animation
+ */
+extern byte secondaryAnimationFrameCount;
+/**
+ * Number of directions of the secondary animation
+ */
+extern byte numerodir;
+/**
+ * Data protection control
+ */
+extern byte contadorpc, contadorpc2;
+/**
+ * Auxiliary indices
+ */
+extern byte indaux1, indaux2;
+/**
+ * Coordinates of target step
+ */
+extern byte destinox_paso, destinoy_paso;
+/**
+ * Current character facing direction
+ * 0: upwards
+ * 1: right
+ * 2: downwards
+ * 3: left
+ */
+extern byte direccionmovimiento;
+
+/**
+ * Width and height of secondary animation
+ */
+extern uint anchoanimado, altoanimado;
+/**
+ * Time window between candle decrease
+ */
+extern uint tiempo;
+/**
+ * Code of selected object in the backpack
+ */
+extern uint codigoobjmochila;
+/**
+ * Foo
+ */
+extern uint kaka;
+/**
+ * Auxiliary vars for grid update
+ */
+extern uint oldposx, oldposy;
+extern uint volumenfxderecho, volumenfxizquierdo;
+extern uint segpasoicono;
+extern uint ofspasoicono;
+extern uint volumenmelodiaderecho, volumenmelodiaizquierdo;
+
+/**
+ * Amplitude of movement
+ */
+extern int elemento1, elemento2;
+/**
+ * Current position of the main character
+ */
+extern int characterPosX, characterPosY;
+/**
+ * Target position of the main character?
+ */
+extern int xframe2, yframe2;
+/**
+ * Text map
+ */
+extern Common::File verb;
+/**
+ * Auxiliary vars with current inventory object name.
+ */
+extern Common::String oldobjmochila, objetomochila;
+
+extern Common::String nombreficherofoto;
+/**
+ * Name of player
+ */
+extern Common::String nombrepersonaje;
+
+// Text decryption key
+extern char *encriptado;
+extern uint hornacina[2][4];
+
+extern RoomFileRegister *roomData;
+
+extern InvItemRegister regobj;
+/**
+ * New movement to execute.
+ */
+extern route mainRoute;
+/**
+ * Matrix of positions for a trajectory between two points
+ */
+extern Common::Point trayec[300];
+
+/**
+ * Longitude of the trajectory matrix.
+ */
+extern uint longtray;
+/**
+ * Position within the trajectory matrix
+ */
+extern uint indicetray;
+/**
+ * Position within the trajectory matrix for secondary animation
+ */
+extern uint indicetray2;
+/**
+ * Screen areas
+ */
+extern byte zonaactual, zonadestino, oldzonadestino;
+/**
+ * Amplitude of grid slices
+ */
+extern byte maxrejax, maxrejay;
+
+/**
+ * capture of movement grid of secondary animation
+ */
+extern byte rejafondomovto[10][10];
+/**
+ * capture of mouse grid of secondary animation
+ */
+extern byte rejafondoraton[10][10];
+/**
+ * movement mask for grid of secondary animation
+ */
+extern byte rejamascaramovto[10][10];
+
+/**
+ * mouse mask for grid of secondary animation
+ */
+extern byte rejamascararaton[10][10];
+
+extern boolean completadalista1, completadalista2,
+ lista1, lista2;
+
+
+extern boolean primera[maxpersonajes],
+ lprimera[maxpersonajes],
+ cprimera[maxpersonajes],
+ libro[maxpersonajes],
+ caramelos[maxpersonajes];
+
+extern boolean cavernas[5];
+/**
+ * First and second lists of objects to retrieve in the game
+ */
+extern boolean firstList[5],
+ secondList[5];
+/**
+ * Animation sequence
+ */
+extern regsecuencia secuencia;
+extern reganimado animado;
+extern uint sizeframe,
+ segpasoframe,
+ ofspasoframe,
+ sizeanimado,
+ segpasoanimado,
+ ofspasoanimado,
+ _handpantalla,
+ segfondo,
+ offfondo;
+/**
+ * Flags for animations
+ */
+// extern boolean tocapintar, tocapintar2;
+/**
+ * Max num of loaded frames for secondary animation
+ */
+extern byte fotogramamax2;
+/**
+ * Index of fade effect for room change
+ */
+extern byte tipoefectofundido;
+/**
+ * Frame number for the animations
+ */
+extern byte iframe, iframe2;
+
+extern long sizepantalla;
+
+/**
+ * Depth of screenobjects
+ */
+extern datosobj profundidad[numobjetosconv];
+/**
+ * Bitmaps of screenobjects
+ */
+extern byte *objetos[numobjetosconv];
+/**
+ * Current frame of main character
+ */
+extern byte *pasoframe;
+/**
+ * Current frame of secondary animation
+ */
+extern byte *pasoanimado;
+
+/**
+ * Pointer storing the screen as it displays on the game
+ */
+extern byte *fondo;
+
+/**
+ * Dirty patch of screen to repaint on every frame
+ */
+extern byte *characterDirtyRect;
+/**
+ * Stores a copy of the background bitmap
+ */
+extern byte *handpantalla;
+
+extern uint roomNumber;
+
+extern boolean isLoadingFromLauncher;
+
+void initializeScreenFile();
+void clearObj();
+void clearScreenData();
+void initPlayAnim();
+void resetGameState();
+
+} // End of namespace Tot
+#endif
diff --git a/engines/tot/routines.cpp b/engines/tot/routines.cpp
new file mode 100644
index 00000000000..d3afeaa52ad
--- /dev/null
+++ b/engines/tot/routines.cpp
@@ -0,0 +1,5571 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/debug.h"
+#include "common/endian.h"
+
+#include "tot/routines.h"
+#include "tot/tot.h"
+
+// Remove after debug
+#include "tot/routines2.h"
+
+namespace Tot {
+
+void drawText(uint numero) {
+ assignText();
+ hypertext(numero, 255, 0, kaka, false);
+ verb.close();
+}
+
+void runaroundRed() {
+ const uint trayseg[91][2] = {
+ {204, 47}, {204, 49}, {203, 51}, {203, 53}, {201, 55}, {199, 57}, {197, 59}, {195, 61},
+ {193, 63}, {192, 65}, {192, 67}, {192, 69}, {192, 71}, {192, 73}, {191, 75}, {191, 77},
+ {191, 79}, {191, 81}, {191, 83}, {191, 85}, {191, 87}, {192, 89}, {192, 91}, {192, 93},
+ {192, 95}, {193, 97}, {194, 99}, {195, 101}, {196, 103}, {197, 105}, {198, 107}, {199, 109},
+ {200, 111}, {201, 111}, {203, 111}, {205, 111}, {207, 111}, {209, 111}, {211, 111}, {213, 111},
+ {215, 110}, {217, 110}, {219, 110}, {221, 110}, {223, 110}, {225, 110}, {227, 110}, {229, 110},
+ {231, 110}, {232, 109}, {234, 108}, {236, 107}, {238, 106}, {240, 105}, {242, 104}, {244, 103},
+ {246, 102}, {248, 101}, {250, 100}, {252, 99}, {254, 98}, {256, 97}, {258, 96}, {260, 95},
+ {261, 93}, {262, 91}, {263, 89}, {264, 87}, {265, 85}, {266, 83}, {267, 81}, {268, 79},
+ {269, 77}, {270, 75}, {271, 73}, {272, 71}, {273, 69}, {274, 67}, {275, 65}, {276, 63},
+ {277, 61}, {278, 59}, {279, 57}, {280, 55}, {281, 53}, {282, 52}, {282, 52}, {282, 52},
+ {282, 52}, {282, 52}, {282, 52}
+ };
+
+ byte iframe2seg;
+ uint anchoaniseg, altoaniseg,
+ itrayseg, longtrayseg;
+ boolean salir_del_bucle;
+
+ salir_del_bucle = false;
+ loadDevil();
+ itrayseg = 0;
+ longtrayseg = 82;
+ iframe2 = 0;
+ animacion2 = true;
+ do {
+ g_engine->_chrono->updateChrono();
+ if (tocapintar) {
+ if (itrayseg == longtrayseg)
+ salir_del_bucle = true;
+ itrayseg += 1;
+ if (iframe2 >= secondaryAnimationFrameCount - 1)
+ iframe2 = 0;
+ else
+ iframe2++;
+ animado.posx = trayseg[itrayseg][0] - 15;
+ animado.posy = trayseg[itrayseg][1] - 42;
+ if (itrayseg >= 0 && itrayseg <= 8) {
+ animado.dir = 2;
+ animado.profundidad = 1;
+ } else if (itrayseg >= 9 && itrayseg <= 33) {
+ animado.dir = 2;
+ animado.profundidad = 14;
+ } else if (itrayseg >= 34 && itrayseg <= 63) {
+ animado.dir = 1;
+ animado.profundidad = 14;
+ } else {
+ animado.dir = 0;
+ animado.profundidad = 3;
+ }
+
+ tocapintar2 = true;
+ sprites(false);
+ tocapintar = false;
+ if (saltospal >= 4) {
+ saltospal = 0;
+ if (movidapaleta > 6)
+ movidapaleta = 0;
+ else
+ movidapaleta += 1;
+ updatePalette(movidapaleta);
+ } else
+ saltospal += 1;
+ g_engine->_screen->update();
+ }
+ } while (!salir_del_bucle && !g_engine->shouldQuit());
+ freeAnimation();
+ handPantallaToFondo();
+ assembleScreen();
+ drawScreen(fondo);
+}
+
+void updateMovementCells() {
+ uint j1arm, j2arm;
+ byte i1arm, i2arm;
+
+ j1arm = (roomData->tray2[indicetray2 - 1].x / factorx) + 1;
+ j2arm = (roomData->tray2[indicetray2 - 1].y / factory) + 1;
+ if ((oldposx != j1arm) || (oldposy != j2arm)) {
+
+ for (i1arm = 0; i1arm < maxrejax; i1arm++)
+ for (i2arm = 0; i2arm < maxrejay; i2arm++) {
+ roomData->rejapantalla[oldposx + i1arm][oldposy + i2arm] = rejafondomovto[i1arm][i2arm];
+ roomData->mouseGrid[oldposx + i1arm][oldposy + i2arm] = rejafondoraton[i1arm][i2arm];
+ }
+
+
+ for (i1arm = 0; i1arm < maxrejax; i1arm++)
+ for (i2arm = 0; i2arm < maxrejay; i2arm++) {
+ rejafondomovto[i1arm][i2arm] = roomData->rejapantalla[j1arm + i1arm][j2arm + i2arm];
+ if (rejamascaramovto[i1arm][i2arm] > 0)
+ roomData->rejapantalla[j1arm + i1arm][j2arm + i2arm] = rejamascaramovto[i1arm][i2arm];
+
+ rejafondoraton[i1arm][i2arm] = roomData->mouseGrid[j1arm + i1arm][j2arm + i2arm];
+ if (rejamascararaton[i1arm][i2arm] > 0)
+ roomData->mouseGrid[j1arm + i1arm][j2arm + i2arm] = rejamascararaton[i1arm][i2arm];
+ }
+
+ oldposx = j1arm;
+ oldposy = j2arm;
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ }
+}
+
+void sprites(boolean pintapersonaje);
+
+static uint indice;
+/**
+ * Calculated using the position of the character
+ */
+static uint posfondox,
+ posfondoy;
+/**
+ * Calculated using the position of the character + dimension
+ */
+static uint posfondox2, posfondoy2;
+
+static void assembleBackground() {
+ uint posabs;
+
+ // XMStoPointer(ptr(segfondo, (offfondo + 4)), handpantalla, 4, (sizepantalla - longint(4)));
+
+ // copies the entire clean background in handpantalla back into fondo
+ handPantallaToFondo();
+
+ posabs = 4 + posfondoy * 320 + posfondox;
+ // debug("posabs = %d, posfondox = %d, posfondoy=%d", posabs, posfondox, posfondoy);
+ uint16 w, h;
+ w = READ_LE_UINT16(characterDirtyRect);
+ h = READ_LE_UINT16(characterDirtyRect + 2);
+ w++;
+ h++;
+
+ posfondox2 = posfondox + w;
+ posfondoy2 = posfondoy + h;
+
+ for (int j = 0; j < h; j++) {
+ for (int i = 0; i < w; i++) {
+ int pos = posabs + j * 320 + i;
+ int destPos = 4 + (j * w + i);
+ characterDirtyRect[destPos] = fondo[pos];
+ }
+ }
+}
+
+/**
+ * calculates the overlapping area between the source image and the background,
+ * then "blits" (copies) the pixels from the image to the overlapping area of the background, respecting transparency.
+ */
+static void assembleImage(byte *imagen, uint posimagenx, uint posimageny) { // Near;
+
+ uint x, // starting point of the overlap
+ y;
+ uint incx, // width and height of the overlapping area
+ incy;
+
+ uint16 wImg = READ_LE_UINT16(imagen) + 1;
+ uint16 hImg = READ_LE_UINT16(imagen + 2) + 1;
+
+ uint16 wFondo = READ_LE_UINT16(characterDirtyRect) + 1;
+ uint16 hFondo = READ_LE_UINT16(characterDirtyRect + 2) + 1;
+
+ // This region calculates the overlapping area of (x, incx, y, incy)
+ {
+ if (posimagenx < posfondox)
+ x = posfondox;
+ else
+ x = posimagenx;
+
+ if (posimagenx + wImg < posfondox + wFondo)
+ incx = posimagenx + wImg - x;
+ else
+ incx = posfondox + wFondo - x;
+
+ if (posimageny < posfondoy)
+ y = posfondoy;
+ else
+ y = posimageny;
+
+ if (posimageny + hImg < posfondoy + hFondo)
+ incy = posimageny + hImg - y;
+ else
+ incy = posfondoy + hFondo - y;
+ } // end of region calculating overlapping area
+
+ for (int j = 0; j < incy; j++) {
+ for (int i = 0; i < incx; i++) {
+ int orfondo = 4 + ((y - posfondoy) + j) * wFondo + i + (x - posfondox);
+ int orimg = 4 + (y - posimageny + j) * wImg + i + (x - posimagenx);
+ if (imagen[orimg] != 0) {
+ characterDirtyRect[orfondo] = imagen[orimg];
+ }
+ }
+ }
+}
+
+static void overlayObject() {
+ if (objetos[indice] != NULL) {
+ if (
+ (profundidad[indice].posx <= posfondox2) &&
+ (profundidad[indice].posx2 > posfondox) &&
+ (profundidad[indice].posy < posfondoy2) &&
+ (profundidad[indice].posy2 > posfondoy)
+ ) {
+ uint16 w = READ_LE_UINT16(objetos[indice]);
+ uint16 h = READ_LE_UINT16(objetos[indice] + 2);
+
+ assembleImage(objetos[indice], profundidad[indice].posx, profundidad[indice].posy);
+ }
+ }
+}
+
+void drawMainCharacter() {
+
+ bool debug = false;
+ if (debug) {
+ effect(13, false, fondo);
+ }
+
+ uint16 tempW;
+ uint16 tempH;
+ tempW = READ_LE_UINT16(pasoframe);
+ tempH = READ_LE_UINT16(pasoframe + 2);
+ tempW += 6;
+ tempH += 6;
+
+ characterDirtyRect = (byte *)malloc((tempW + 1) * (tempH + 1) + 4);
+
+ WRITE_LE_UINT16(characterDirtyRect, tempW);
+ WRITE_LE_UINT16(characterDirtyRect + 2, tempH);
+
+ assembleBackground();
+ indice = 0;
+ while (indice != nivelesdeprof) {
+
+ overlayObject();
+ if (secuencia.profundidad == indice)
+ assembleImage(pasoframe, characterPosX, characterPosY);
+ indice += 1;
+ }
+
+ putImg(posfondox, posfondoy, characterDirtyRect);
+
+ if (debug) {
+ // draw background dirty area
+ drawRect(2, posfondox, posfondoy, posfondox + tempW, posfondoy + tempH);
+
+ // drawRect(225, posfondox, posfondoy, posfondox2, posfondoy2);
+
+ uint16 wImg = READ_LE_UINT16(pasoframe);
+ uint16 hImg = READ_LE_UINT16(pasoframe + 2);
+
+ drawPos(xframe2, yframe2, 218);
+ // draw patch of characters sprite
+ // drawRect(223, xframe, yframe, xframe + wImg, yframe + hImg);
+ }
+ free(characterDirtyRect);
+}
+
+void sprites(boolean pintapersonaje) {
+ // grabs the current frame from the walk cycle
+ pasoframe = secuencia.bitmap[direccionmovimiento][iframe];
+
+ posfondox = characterPosX - 3;
+ posfondoy = characterPosY - 3;
+ if (animacion2) {
+ if (roomData->longtray2 > 1)
+ updateMovementCells();
+ if (tocapintar2) {
+ if (peteractivo && !g_engine->_sound->isVocPlaying()) {
+ iframe2 = 0;
+ }
+ pasoanimado = animado.dib[animado.dir][iframe2];
+ }
+ uint16 pasoframeW = READ_LE_UINT16(pasoframe);
+ uint16 pasoframeH = READ_LE_UINT16(pasoframe + 2);
+
+ uint16 pasoanimadoW = READ_LE_UINT16(pasoanimado);
+ uint16 pasoanimadoH = READ_LE_UINT16(pasoanimado + 2);
+
+ if (
+ ((animado.posx < (characterPosX + pasoframeW) + 4) &&
+ ((animado.posx + pasoanimadoW + 1) > posfondox) &&
+ (animado.posy < (characterPosY + pasoframeH + 4))) &&
+ ((animado.posy + pasoanimadoH + 1) > posfondoy)) { // Character is in the area of the animation
+
+ if (animado.posx < characterPosX)
+ posfondox = animado.posx - 3;
+ if (animado.posy < characterPosY)
+ posfondoy = animado.posy - 3;
+
+ uint16 patchW = pasoanimadoW + pasoframeW + 6;
+
+ uint16 patchH;
+ if ((pasoframeH + characterPosY) > (animado.posy + pasoanimadoH)) {
+ patchH = pasoframeH + 6 + abs(characterPosY - (int)animado.posy);
+ } else {
+ patchH = pasoanimadoH + 6 + abs(characterPosY - (int)animado.posy);
+ }
+
+ characterDirtyRect = (byte *)malloc((patchW + 1) * (patchH + 1) + 4);
+
+ WRITE_LE_UINT16(characterDirtyRect, patchW);
+ WRITE_LE_UINT16(characterDirtyRect + 2, patchH);
+
+ assembleBackground(); // {Montar el Sprite Total}
+ indice = 0;
+ while (indice != nivelesdeprof){
+ overlayObject();
+ if (animado.profundidad == indice)
+ assembleImage(pasoanimado, animado.posx, animado.posy);
+ if (secuencia.profundidad == indice)
+ assembleImage(pasoframe, characterPosX, characterPosY);
+ indice += 1;
+ }
+ putImg(posfondox, posfondoy, characterDirtyRect);
+ } else { // character and animation are in different parts of the screen
+
+ if (pintapersonaje) {
+ drawMainCharacter();
+ }
+
+ posfondox = animado.posx - 3;
+ posfondoy = animado.posy - 3;
+
+ uint16 pasoanimadoW = READ_LE_UINT16(pasoanimado) + 6;
+ uint16 pasoanimadoH = READ_LE_UINT16(pasoanimado + 2) + 6;
+
+ characterDirtyRect = (byte *)malloc((pasoanimadoW + 1) * (pasoanimadoH + 1) + 4);
+ WRITE_LE_UINT16(characterDirtyRect, pasoanimadoW);
+ WRITE_LE_UINT16(characterDirtyRect + 2, pasoanimadoH);
+
+ assembleBackground();
+ indice = 0;
+ while (indice != nivelesdeprof) {
+ overlayObject();
+ if (animado.profundidad == indice)
+ assembleImage(pasoanimado, animado.posx, animado.posy);
+ indice += 1;
+ }
+ putImg(posfondox, posfondoy, characterDirtyRect);
+ }
+ } else if (pintapersonaje) {
+ drawMainCharacter();
+ }
+}
+
+void adjustKey() {
+ iframe = 0;
+ calculateTrajectory(129, 13);
+ direccionmovimiento = 0;
+ do {
+ characterPosX = trayec[indicetray].x;
+ characterPosY = trayec[indicetray].y;
+ iframe++;
+ indicetray += 1;
+ emptyLoop();
+ tocapintar = false;
+ if (saltospal >= 4) {
+ saltospal = 0;
+ if (movidapaleta > 6)
+ movidapaleta = 0;
+ else
+ movidapaleta += 1;
+ updatePalette(movidapaleta);
+ } else
+ saltospal += 1;
+ sprites(true);
+ } while (indicetray != longtray);
+ direccionmovimiento = 3;
+ emptyLoop();
+ tocapintar = false;
+ sprites(true);
+}
+
+void adjustKey2() {
+ iframe = 0;
+ direccionmovimiento = 2;
+ longtray = 1;
+ do {
+ characterPosX = trayec[indicetray].x;
+ characterPosY = trayec[indicetray].y;
+ iframe++;
+ indicetray -= 1;
+ emptyLoop();
+ tocapintar = false;
+ if (saltospal >= 4) {
+ saltospal = 0;
+ if (movidapaleta > 6)
+ movidapaleta = 0;
+ else
+ movidapaleta += 1;
+ updatePalette(movidapaleta);
+ } else
+ saltospal += 1;
+ sprites(true);
+ } while (indicetray != 0);
+ emptyLoop();
+ tocapintar = false;
+ sprites(true);
+}
+
+void animatedSequence(uint numSequence) {
+ Common::File animationFile;
+ uint indicerep, indiceani;
+ uint16 tamsecani;
+ uint animx, animy;
+ int guadaxframe;
+ byte numframessec, pasocode;
+ byte *animptr;
+
+ switch (numSequence) {
+ case 1: {
+ guadaxframe = characterPosX;
+ characterPosX = 3;
+ if (!animationFile.open("POZO01.DAT")) {
+ boolean exists = animationFile.exists("POZOATR.DAT");
+ error("277");
+ }
+ animx = 127;
+ animy = 70;
+ tamsecani = animationFile.readUint16LE();
+ numframessec = animationFile.readByte();
+ pasocode = animationFile.readByte();
+ animptr = (byte *)malloc(tamsecani);
+ for (indicerep = 1; indicerep <= 3; indicerep++) {
+ playVoc("POZO", 180395, 6034);
+ indiceani = 0;
+ do {
+ emptyLoop();
+ tocapintar = false;
+ if (tocapintar2) {
+ if (indicetray2 >= roomData->longtray2)
+ indicetray2 = 1;
+ else
+ indicetray2 += 1;
+ animado.posx = roomData->tray2[indicetray2 - 1].x;
+ animado.posy = roomData->tray2[indicetray2 - 1].y;
+ animado.dir = roomData->dir2[indicetray2 - 1];
+ if (iframe2 >= secondaryAnimationFrameCount - 1)
+ iframe2 = 0;
+ else
+ iframe2++;
+ sprites(false);
+ animationFile.read(animptr, tamsecani);
+ putImg(animx, animy, animptr);
+ indiceani += 1;
+ }
+ } while (indiceani != numframessec && !g_engine->shouldQuit());
+ animationFile.seek(4);
+ }
+ free(animptr);
+ animationFile.close();
+ characterPosX = guadaxframe;
+ } break;
+ case 2: {
+ if (!animationFile.open("POZOATR.DAT")) {
+ boolean exists = animationFile.exists("POZOATR.DAT");
+ error("277");
+ }
+ animx = 127;
+ guadaxframe = characterPosX;
+ characterPosX = 3;
+ animy = 70;
+
+ tamsecani = animationFile.readUint16LE();
+ numframessec = animationFile.readByte();
+ pasocode = animationFile.readByte();
+ animptr = (byte *)malloc(tamsecani);
+ for (indicerep = 1; indicerep <= 3; indicerep++) {
+ playVoc("POZO", 180395, 6034);
+ indiceani = 0;
+ do {
+ emptyLoop();
+ tocapintar = false;
+ if (tocapintar2) {
+ if (indicetray2 >= roomData->longtray2)
+ indicetray2 = 1;
+ else
+ indicetray2 += 1;
+ animado.posx = roomData->tray2[indicetray2 - 1].x;
+ animado.posy = roomData->tray2[indicetray2 - 1].y;
+ animado.dir = roomData->dir2[indicetray2 - 1];
+ if (iframe2 >= secondaryAnimationFrameCount - 1)
+ iframe2 = 0;
+ else
+ iframe2++;
+ sprites(false);
+ animationFile.read(animptr, tamsecani);
+ putImg(animx, animy, animptr);
+ indiceani += 1;
+ }
+ } while (indiceani != numframessec && !g_engine->shouldQuit());
+ animationFile.seek(4);
+ // seek(ficherosecuenciaanimada, 4);
+ }
+ stopVoc();
+ free(animptr);
+ animationFile.close();
+ characterPosX = guadaxframe;
+ } break;
+ case 3: {
+ guadaxframe = characterPosX;
+ characterPosX = 3;
+ if (!animationFile.open("POZO02.DAT")) {
+ error("277");
+ }
+ animx = 127;
+ animy = 70;
+
+ tamsecani = animationFile.readUint16LE();
+ numframessec = animationFile.readByte();
+ pasocode = animationFile.readByte();
+ animptr = (byte *)malloc(tamsecani);
+ indiceani = 0;
+ do {
+ emptyLoop();
+ tocapintar = false;
+ if (tocapintar2) {
+ if (indicetray2 >= roomData->longtray2)
+ indicetray2 = 1;
+ else
+ indicetray2 += 1;
+ animado.posx = roomData->tray2[indicetray2 - 1].x;
+ animado.posy = roomData->tray2[indicetray2 - 1].y;
+ animado.dir = roomData->dir2[indicetray2 - 1];
+ if (iframe2 >= secondaryAnimationFrameCount - 1)
+ iframe2 = 0;
+ else
+ iframe2++;
+ sprites(false);
+ animationFile.read(animptr, tamsecani);
+ putImg(animx, animy, animptr);
+ indiceani += 1;
+ }
+ } while (indiceani != numframessec && !g_engine->shouldQuit());
+ free(animptr);
+ animationFile.close();
+ iframe = 0;
+ direccionmovimiento = 2;
+ emptyLoop();
+ tocapintar = false;
+ characterPosX = guadaxframe;
+ sprites(true);
+ } break;
+ case 4: {
+ adjustKey();
+ if (!animationFile.open("TIOLLAVE.DAT")) {
+ error("277");
+ }
+ animx = 85;
+ animy = 15;
+
+ tamsecani = animationFile.readUint16LE();
+ numframessec = animationFile.readByte();
+ pasocode = animationFile.readByte();
+ animptr = (byte *)malloc(tamsecani);
+
+ for (indiceani = 1; indiceani <= 31; indiceani++) {
+ animationFile.read(animptr, tamsecani);
+ emptyLoop();
+ tocapintar = false;
+ if (saltospal >= 4) {
+ saltospal = 0;
+ if (movidapaleta > 6)
+ movidapaleta = 0;
+ else
+ movidapaleta += 1;
+ updatePalette(movidapaleta);
+ } else
+ saltospal += 1;
+ putShape(animx, animy, animptr);
+ }
+ objetos[regobj.profundidad - 1] = NULL;
+ handPantallaToFondo();
+ indiceani = secuencia.profundidad;
+ secuencia.profundidad = 30;
+ objetos[13] = animptr;
+ profundidad[13].posx = animx;
+ profundidad[13].posy = animy;
+ assembleScreen();
+ drawScreen(fondo);
+ objetos[13] = NULL;
+ secuencia.profundidad = indiceani;
+ drawBackpack();
+ for (indiceani = 32; indiceani <= numframessec; indiceani++) {
+ animationFile.read(animptr, tamsecani);
+ emptyLoop();
+ tocapintar = false;
+ if (saltospal >= 4) {
+ saltospal = 0;
+ if (movidapaleta > 6)
+ movidapaleta = 0;
+ else
+ movidapaleta += 1;
+ updatePalette(movidapaleta);
+ } else
+ saltospal += 1;
+ putImg(animx, animy, animptr);
+ if (g_engine->shouldQuit()) {
+ break;
+ }
+ }
+ adjustKey2();
+ free(animptr);
+ animationFile.close();
+ } break;
+ case 5: {
+ if (!animationFile.open("TIOSACO.DAT")) {
+ error("277");
+ }
+ animx = 204;
+ animy = 44;
+ tamsecani = animationFile.readUint16LE();
+ numframessec = animationFile.readByte();
+ pasocode = animationFile.readByte();
+ animptr = (byte *)malloc(tamsecani);
+ for (indiceani = 1; indiceani <= 8; indiceani++) {
+ animationFile.read(animptr, tamsecani);
+ emptyLoop();
+ tocapintar = false;
+ putShape(animx, animy, animptr);
+ if (g_engine->shouldQuit()) {
+ break;
+ }
+ }
+ indiceani = secuencia.profundidad;
+ secuencia.profundidad = 30;
+ objetos[12] = animptr;
+ profundidad[12].posx = animx;
+ profundidad[12].posy = animy;
+ disableSecondAnimation();
+ objetos[12] = NULL;
+ secuencia.profundidad = indiceani;
+ drawScreen(fondo);
+ for (indiceani = 9; indiceani <= numframessec; indiceani++) {
+ animationFile.read(animptr, tamsecani);
+ emptyLoop();
+ tocapintar = false;
+ emptyLoop();
+ tocapintar = false;
+ putShape(animx, animy, animptr);
+ if (g_engine->shouldQuit()) {
+ break;
+ }
+ }
+ free(animptr);
+ animationFile.close();
+ iframe = 0;
+ direccionmovimiento = 2;
+ emptyLoop();
+ tocapintar = false;
+ sprites(true);
+ } break;
+ case 6: {
+ roomData->banderamovimiento = false;
+ if (!animationFile.open("AZCCOG.DAT")) {
+ error("277");
+ }
+ tamsecani = animationFile.readUint16LE();
+ numframessec = animationFile.readByte();
+ pasocode = animationFile.readByte();
+ objetos[6] = (byte *)malloc(tamsecani);
+ // objetos[7] = ptr(segfondo, (offfondo + 44900));
+ profundidad[6].posx = animado.posx + 5;
+ profundidad[6].posy = animado.posy - 6;
+ indiceani = 0;
+ do {
+ emptyLoop();
+ tocapintar = false;
+ if (saltospal >= 4) {
+ saltospal = 0;
+ if (movidapaleta > 6)
+ movidapaleta = 0;
+ else
+ movidapaleta += 1;
+ updatePalette(movidapaleta);
+ } else
+ saltospal += 1;
+ if (tocapintar2) {
+ animationFile.read(objetos[6], tamsecani);
+ Common::copy(objetos[6], objetos[6] + tamsecani, fondo + 44900);
+ // blockread(ficherosecuenciaanimada, objetos[7], tamsecani);
+ handPantallaToFondo();
+ assembleScreen();
+ drawScreen(fondo);
+ indiceani += 1;
+ if (indiceani == 8)
+ playVoc("PUFF", 191183, 18001);
+ }
+ } while (indiceani != numframessec && !g_engine->shouldQuit());
+ animationFile.close();
+ stopVoc();
+ objetos[6] = NULL;
+ roomData->banderamovimiento = true;
+ } break;
+ }
+}
+
+DoorRegistry readRegPuertas(Common::SeekableReadStream *screenDataFile) {
+ DoorRegistry doorMetadata;
+ doorMetadata.pantallaquecarga = screenDataFile->readUint16LE();
+ doorMetadata.posxsalida = screenDataFile->readUint16LE();
+ doorMetadata.posysalida = screenDataFile->readUint16LE();
+ doorMetadata.abiertacerrada = screenDataFile->readByte();
+ doorMetadata.codigopuerta = screenDataFile->readByte();
+
+ return doorMetadata;
+}
+
+Common::Point readPunto(Common::SeekableReadStream *screenDataFile) {
+ Common::Point point;
+ point.x = screenDataFile->readUint16LE();
+ point.y = screenDataFile->readUint16LE();
+ return point;
+}
+
+RoomBitmapRegister readBitmapAux(Common::SeekableReadStream *screenDataFile) {
+ RoomBitmapRegister bitmapMetadata = RoomBitmapRegister();
+ bitmapMetadata.puntbitmap = screenDataFile->readSint32LE();
+ bitmapMetadata.tambitmap = screenDataFile->readUint16LE();
+ bitmapMetadata.coordx = screenDataFile->readUint16LE();
+ bitmapMetadata.coordy = screenDataFile->readUint16LE();
+ bitmapMetadata.profund = screenDataFile->readUint16LE();
+ return bitmapMetadata;
+}
+
+RoomObjectListEntry *readRegIndexadoObjetos(Common::SeekableReadStream *screenDataFile) {
+ RoomObjectListEntry *objectMetadata = new RoomObjectListEntry();
+ objectMetadata->indicefichero = screenDataFile->readUint16LE();
+ objectMetadata->objectName = screenDataFile->readPascalString();
+
+ screenDataFile->skip(20 - objectMetadata->objectName.size());
+
+ return objectMetadata;
+}
+
+RoomFileRegister* readScreenDataFile(Common::SeekableReadStream *screenDataFile) {
+ RoomFileRegister* screenData = new RoomFileRegister();
+ screenData->codigo = screenDataFile->readUint16LE();
+ screenData->puntimagenpantalla = screenDataFile->readUint32LE();
+ screenData->tamimagenpantalla = screenDataFile->readUint16LE();
+ screenDataFile->read(screenData->rejapantalla, 40 * 28);
+ screenDataFile->read(screenData->mouseGrid, 40 * 28);
+ // read puntos
+ for (int i = 0; i < 9; i++) {
+ for (int j = 0; j < 30; j++) {
+ for (int k = 0; k < 5; k++) {
+ screenData->trayectories[i][j][k] = readPunto(screenDataFile);
+ }
+ }
+ }
+
+ for (int i = 0; i < 5; i++) {
+ screenData->doors[i] = readRegPuertas(screenDataFile);
+ }
+ for (int i = 0; i < 15; i++) {
+ screenData->bitmapasociados[i] = readBitmapAux(screenDataFile);
+ }
+ for (int i = 0; i < 51; i++) {
+ screenData->indexadoobjetos[i] = readRegIndexadoObjetos(screenDataFile);
+ }
+
+ screenData->banderamovimiento = screenDataFile->readByte();
+ screenData->nombremovto = screenDataFile->readPascalString();
+ screenDataFile->skip(8 - screenData->nombremovto.size());
+ screenData->banderapaleta = screenDataFile->readByte();
+ screenData->puntpaleta = screenDataFile->readUint16LE();
+ for (int i = 0; i < 300; i++) {
+ screenData->tray2[i] = readPunto(screenDataFile);
+ }
+ screenDataFile->read(screenData->dir2, 600);
+ screenData->longtray2 = screenDataFile->readUint16LE();
+ return screenData;
+}
+
+void loadScreenData(uint screenNumber) {
+ debug("Opening screen %d", screenNumber);
+ roomNumber = screenNumber;
+
+ rooms->seek(screenNumber * roomRegSize, SEEK_SET);
+ clearScreenData();
+ roomData = readScreenDataFile(rooms);
+ loadScreen();
+ for (int i = 0; i < 15; i++) {
+ RoomBitmapRegister &bitmap = roomData->bitmapasociados[i];
+ if (bitmap.tambitmap > 0) {
+ debug("-----------------------------");
+ debug("loading bitmap %d, which has a depth = %d, pointer =%d", i, bitmap.profund, bitmap.puntbitmap);
+ loadItem(bitmap.coordx, bitmap.coordy, bitmap.tambitmap, bitmap.puntbitmap, bitmap.profund);
+ }
+ }
+ if (roomData->banderamovimiento && roomData->codigo != 24) {
+ loadAnimation(roomData->nombremovto);
+ iframe2 = 0;
+ indicetray2 = 1;
+ animado.dir = roomData->dir2[indicetray2 - 1];
+ animado.posx = roomData->tray2[indicetray2 - 1].x;
+ animado.posy = roomData->tray2[indicetray2 - 1].y;
+ if (roomData->nombremovto == "FUENTE01")
+ animado.profundidad = 0;
+ else {
+ updateSecondaryAnimationDepth();
+ }
+ for (int i = 0; i < maxrejax; i++)
+ for (int j = 0; j < maxrejay; j++) {
+ if (rejamascaramovto[i][j] > 0)
+ roomData->rejapantalla[oldposx + i][oldposy + j] = rejamascaramovto[i][j];
+ if (rejamascararaton[i][j] > 0)
+ roomData->mouseGrid[oldposx + i][oldposy + j] = rejamascararaton[i][j];
+ }
+ } else
+ roomData->banderamovimiento = false;
+
+ updateMainCharacterDepth();
+ assembleScreen();
+ movidapaleta = 0;
+}
+
+/**
+ * Calculates a trajectory between the current position (xframe, yframe)
+ * and the target position (finalx, finaly) using bresenham's algorithm
+ */
+void calculateTrajectory(uint finalx, uint finaly) {
+
+ int deltaX = finalx - characterPosX;
+ int deltaY = finaly - characterPosY;
+
+ int incrXDiag = (deltaX >= 0) ? 1 : -1;
+ int incrYDiag = (deltaY >= 0) ? 1 : -1;
+
+ deltaX = abs(deltaX);
+ deltaY = abs(deltaY);
+
+ bool horizontalDominant = (deltaX >= deltaY);
+ if (!horizontalDominant) {
+ int tmp = deltaX;
+ deltaX = deltaY;
+ deltaY = tmp;
+ }
+
+ // step increments for straight moves
+ int incrXRecto = horizontalDominant ? incrXDiag : 0;
+ int incrYRecto = horizontalDominant ? 0 : incrYDiag;
+
+ int contRecto = 2 * deltaY;
+ int contDiag = contRecto - (2 * deltaX);
+ int BX = contRecto - deltaX; // decision variable
+
+ // start at initial position
+ uint x = characterPosX, y = characterPosY;
+ int steps = deltaX + 1; // number of steps
+
+ indicetray = 0;
+ longtray = 0;
+ trayec[longtray].x = x;
+ trayec[longtray].y = y;
+ longtray++;
+ while (--steps) {
+ if (BX >= 0) {
+ x += incrXDiag;
+ y += incrYDiag;
+ BX += contDiag;
+ } else {
+ x += incrXRecto;
+ y += incrYRecto;
+ BX += contRecto;
+ }
+ trayec[longtray].x = x;
+ trayec[longtray].y = y;
+ longtray++;
+ }
+
+ // Ensure last value is also final position to account for overflow of the route
+ trayec[longtray].x = finalx;
+ trayec[longtray].y = finaly;
+ trayec[longtray + 1].x = finalx;
+ trayec[longtray + 1].y = finaly;
+
+ // longtray--; // decrement because of 1-starting arrays
+}
+
+void lookInventoryObject(byte numeroobjeto) {
+ byte tipofundido, yaux;
+
+ Common::String cadenadescripcion;
+ boolean kkaux;
+ regismht reghpt;
+ palette paletaseg;
+
+ kkaux = false;
+ contadorpc2 = contadorpc;
+ g_engine->_mouseManager->hide();
+ copyPalette(pal, paletaseg);
+ readItemRegister(mobj[numeroobjeto].code);
+ getImg(0, 0, 319, 139, fondo);
+ partialFadeOut(234);
+ bar(0, 0, 319, 139, 0);
+ for (yaux = 1; yaux <= 12; yaux++)
+ buttonBorder(
+ 120 - (yaux * 5), // x1
+ 80 - (yaux * 5), // y1
+ 200 + (yaux * 5), // x2
+ 70 + (yaux * 5), // y2
+ 251, // color1
+ 251, // color2
+ 251, // color3
+ 251, // color4
+ 0, // color5
+ 0, // xtext
+ "" // text
+ );
+
+ drawMenu(4);
+
+ if (regobj.usar[0] != 9) {
+ if (regobj.beforeUseTextRef != 0) {
+ assignText();
+ reghpt = readVerbRegister(regobj.beforeUseTextRef);
+ cadenadescripcion = reghpt.cadenatext;
+ for (yaux = 0; yaux < reghpt.cadenatext.size(); yaux++)
+ cadenadescripcion.setChar(encriptado[yaux] ^ reghpt.cadenatext[yaux], yaux);
+ hipercadena(cadenadescripcion, 60, 15, 33, 255, 0);
+ verb.close();
+ } else {
+ cadenadescripcion = mobj[numeroobjeto].objectName;
+ hipercadena(cadenadescripcion, 60, 15, 33, 255, 0);
+ }
+ } else {
+
+ if (regobj.afterUseTextRef != 0) {
+ assignText();
+ reghpt = readVerbRegister(regobj.afterUseTextRef);
+ cadenadescripcion = reghpt.cadenatext;
+ for (yaux = 0; yaux < reghpt.cadenatext.size(); yaux++)
+ cadenadescripcion.setChar(encriptado[yaux] ^ reghpt.cadenatext[yaux], yaux);
+ hipercadena(cadenadescripcion, 60, 15, 33, 255, 0);
+ verb.close();
+ } else {
+ cadenadescripcion = mobj[numeroobjeto].objectName;
+ hipercadena(cadenadescripcion, 60, 15, 33, 255, 0);
+ }
+ }
+
+ drawFlc(125, 70, regobj.punteroframesgiro, 60000, 9, 0, false, true, true, kkaux);
+
+ effect(3, true, NULL);
+ partialFadeOut(234);
+ assembleScreen();
+ drawScreen(fondo);
+ copyPalette(paletaseg, pal);
+ partialFadeIn(234);
+ g_engine->_mouseManager->show();
+}
+
+void useInventoryObjectWithInventoryObject(uint numobj1, uint numobj2) {
+ byte indicemochila, indobj1, indobj2;
+ uint tamobjaux;
+
+ debug("Reading item register %d", numobj1);
+ readItemRegister(invItemData, numobj1, regobj);
+ // verifyCopyProtection2();
+ if (regobj.usar[0] != 1 || regobj.usarcon != numobj2) {
+ drawText(Random(11) + 1022);
+ return;
+ }
+
+ indicemochila = 0;
+ while (mobj[indicemochila].code != numobj1) {
+ indicemochila += 1;
+ }
+ indobj1 = indicemochila;
+
+ indicemochila = 0;
+ while (mobj[indicemochila].code != numobj2) {
+ indicemochila += 1;
+ }
+
+ indobj2 = indicemochila;
+ kaka = regobj.useTextRef;
+
+ if (regobj.reemplazarpor == 0) {
+ readItemRegister(invItemData, numobj1, regobj);
+ // seek(fichobj, numobj1);
+ // limpiaregobj();
+ // fichobj >> regobj;
+ regobj.usar[0] = 9;
+ saveItemRegister(regobj, invItemData);
+ // fichobj.seek(numobj1);
+ //TODO: SAVING!
+ // readItemRegister(fichobj, numobj1);
+ // seek(fichobj, numobj1);
+ // fichobj << regobj;
+ readItemRegister(invItemData, numobj2, regobj);
+
+ // seek(fichobj, numobj2);
+ // limpiaregobj();
+ // fichobj >> regobj;
+ regobj.usar[0] = 9;
+ saveItemRegister(regobj, invItemData);
+ //TODO: SAVING!
+ // seek(fichobj, numobj2);
+ // fichobj << regobj;
+ // fichobj.close();
+ } else {
+ readItemRegister(invItemData, regobj.reemplazarpor, regobj);
+ // fichobj.close();
+ mobj[indobj1].bitmapIndex = regobj.objectIconBitmap;
+ mobj[indobj1].code = regobj.code;
+ mobj[indobj1].objectName = regobj.name;
+ for (indobj1 = indobj2; indobj1 < (inventoryIconCount - 1); indobj1++) {
+ mobj[indobj1].bitmapIndex = mobj[indobj1 + 1].bitmapIndex;
+ mobj[indobj1].code = mobj[indobj1 + 1].code;
+ mobj[indobj1].objectName = mobj[indobj1 + 1].objectName;
+ }
+ g_engine->_mouseManager->hide();
+ drawBackpack();
+ g_engine->_mouseManager->show();
+ }
+ if (kaka > 0)
+ drawText(kaka);
+}
+
+void calculateRoute(byte zona1, byte zona2, boolean extraCorrection, boolean zonavedada) {
+ // Resets the entire route
+ for (pasos = 0; pasos < 7; pasos++) {
+ mainRoute[pasos].x = 0;
+ mainRoute[pasos].y = 0;
+ }
+ pasos = 0;
+
+ // Starts first element of route with current position
+ mainRoute[0].x = characterPosX;
+ mainRoute[0].y = characterPosY;
+ Common::Point point;
+ do {
+ pasos += 1;
+ point = roomData->trayectories[zona1 - 1][zona2 - 1][pasos - 1];
+
+ if (point.x < (rectificacionx + 3))
+ mainRoute[pasos].x = 3;
+ else
+ mainRoute[pasos].x = point.x - rectificacionx;
+ if (point.y < (rectificaciony + 3))
+ mainRoute[pasos].y = 3;
+ else
+ mainRoute[pasos].y = point.y - rectificaciony;
+
+ } while (point.y != 9999 && pasos != 5);
+
+ if (zona2 < 10) {
+ if (point.y == 9999) {
+ mainRoute[pasos].x = xframe2 - rectificacionx;
+ mainRoute[pasos].y = yframe2 - rectificaciony;
+ } else {
+ mainRoute[6].x = xframe2 - rectificacionx;
+ mainRoute[6].y = yframe2 - rectificaciony;
+ pasos = 6;
+ }
+ } else {
+ if ((mainRoute[pasos].y + rectificaciony) == 9999) {
+ pasos -= 1;
+ }
+ if(extraCorrection) {
+ switch (roomData->codigo) {
+ case 5:
+ if (zona2 == 27)
+ pasos += 1;
+ break;
+ case 6:
+ if (zona2 == 21)
+ pasos += 1;
+ break;
+ }
+ }
+ }
+ if (extraCorrection && zonavedada) {
+ pasos -= 1;
+ }
+
+ // Sets xframe2 now to be the number of steps in the route
+ xframe2 = pasos;
+ // Sets yframe2 to now be current step
+ yframe2 = 1;
+ longtray = 10;
+ indicetray = 30;
+}
+
+void goToObject(byte zona1, byte zona2) {
+ boolean zonavedada = false;
+
+ contadorpc2 = contadorpc;
+
+ for(int indicepaso = 0; indicepaso < 5; indicepaso++) {
+ if (roomData->doors[indicepaso].codigopuerta == zona2) {
+ zonavedada = true;
+ break;
+ }
+ }
+
+ if (roomData->codigo == 21 && roomData->banderamovimiento) {
+ if ((zona2 >= 1 && zona2 <= 5) ||
+ (zona2 >= 9 && zona2 <= 13) ||
+ (zona2 >= 18 && zona2 <= 21) ||
+ zona2 == 24 || zona2 == 25) {
+
+ zonadestino = 7;
+ pulsax = 232;
+ pulsay = 75;
+ zona2 = 7;
+ }
+ if (zona2 == 24) {
+ zonavedada = false;
+ }
+ }
+ if (zona1 < 10) {
+ xframe2 = pulsax + 7;
+ yframe2 = pulsay + 7;
+
+ g_engine->_mouseManager->hide();
+ calculateRoute(zona1, zona2, true, zonavedada);
+ Common::Event e;
+ do {
+ g_engine->_chrono->updateChrono();
+ while (g_system->getEventManager()->pollEvent(e)) {
+ changeGameSpeed(e);
+ }
+ advanceAnimations(zonavedada, false);
+ g_engine->_screen->update();
+ g_system->delayMillis(10);
+ } while (!xframe2 == 0);
+
+ iframe = 0;
+ sprites(true);
+ g_engine->_mouseManager->show();
+ }
+}
+
+void updateSecondaryAnimationDepth() {
+ uint animadoposition = animado.posy + altoanimado - 1;
+ if (animadoposition >= 0 && animadoposition <= 56) {
+ animado.profundidad = 0;
+ } else if (animadoposition >= 57 && animadoposition <= 66) {
+ animado.profundidad = 1;
+ } else if (animadoposition >= 65 && animadoposition <= 74) {
+ animado.profundidad = 2;
+ } else if (animadoposition >= 73 && animadoposition <= 82) {
+ animado.profundidad = 3;
+ } else if (animadoposition >= 81 && animadoposition <= 90) {
+ animado.profundidad = 4;
+ } else if (animadoposition >= 89 && animadoposition <= 98) {
+ animado.profundidad = 5;
+ } else if (animadoposition >= 97 && animadoposition <= 106) {
+ animado.profundidad = 6;
+ } else if (animadoposition >= 105 && animadoposition <= 114) {
+ animado.profundidad = 7;
+ } else if (animadoposition >= 113 && animadoposition <= 122) {
+ animado.profundidad = 8;
+ } else if (animadoposition >= 121 && animadoposition <= 140) {
+ animado.profundidad = 9;
+ }
+}
+
+void updateMainCharacterDepth() {
+ if (characterPosY >= 0 && characterPosY <= 7) {
+ secuencia.profundidad = 0;
+ } else if (characterPosY >= 8 && characterPosY <= 17) {
+ secuencia.profundidad = 1;
+ } else if (characterPosY >= 18 && characterPosY <= 25) {
+ secuencia.profundidad = 2;
+ } else if (characterPosY >= 26 && characterPosY <= 33) {
+ secuencia.profundidad = 3;
+ } else if (characterPosY >= 34 && characterPosY <= 41) {
+ secuencia.profundidad = 4;
+ } else if (characterPosY >= 42 && characterPosY <= 49) {
+ secuencia.profundidad = 5;
+ } else if (characterPosY >= 50 && characterPosY <= 57) {
+ secuencia.profundidad = 6;
+ } else if (characterPosY >= 58 && characterPosY <= 65) {
+ secuencia.profundidad = 7;
+ } else if (characterPosY >= 66 && characterPosY <= 73) {
+ secuencia.profundidad = 8;
+ } else if (characterPosY >= 74 && characterPosY <= 139) {
+ secuencia.profundidad = 9;
+ }
+}
+
+void advanceAnimations(boolean zonavedada, boolean animateMouse) {
+ if (tocapintar) {
+ if (roomData->banderamovimiento && tocapintar2) {
+ if (peteractivo && (Random(100) == 1) && !g_engine->_sound->isVocPlaying() && caramelos[0] == false) {
+ debug("Playing tos");
+ playVoc("TOS", 258006, 14044);
+ }
+ if (indicetray2 >= roomData->longtray2)
+ indicetray2 = 1;
+ else
+ indicetray2 += 1;
+ if (iframe2 >= secondaryAnimationFrameCount - 1)
+ iframe2 = 0;
+ else
+ iframe2 ++;
+ animado.posx = roomData->tray2[indicetray2 - 1].x;
+ animado.posy = roomData->tray2[indicetray2 - 1].y;
+ animado.dir = roomData->dir2[indicetray2 - 1];
+ switch (roomData->codigo) {
+ case 23:
+ animado.profundidad = 0;
+ break;
+ case 24:
+ animado.profundidad = 14;
+ break;
+ default:
+ updateSecondaryAnimationDepth();
+ }
+ }
+
+ // This means character needs to walk
+ if (xframe2 > 0) {
+ if (direccionmovimiento == 1 || direccionmovimiento == 3) {
+ indicetray += 1;
+ }
+ indicetray += 1;
+ // yframe2, xframe2 now represent max steps and current step
+ if (yframe2 <= xframe2) {
+ if (indicetray > longtray) {
+ elemento1 = mainRoute[yframe2].x - mainRoute[yframe2 - 1].x;
+ elemento2 = mainRoute[yframe2].y - mainRoute[yframe2 - 1].y;
+
+ if ((abs(elemento1) > 2) || (abs(elemento2) > 2)) {
+ if (abs(elemento2) > (abs(elemento1) + 5)) {
+ if (elemento2 < 0)
+ direccionmovimiento = 0;
+ else
+ direccionmovimiento = 2;
+ } else {
+ if (elemento1 > 0)
+ direccionmovimiento = 1;
+ else
+ direccionmovimiento = 3;
+ }
+ }
+ yframe2 += 1;
+ calculateTrajectory(mainRoute[yframe2 - 1].x, mainRoute[yframe2 - 1].y);
+ }
+ } else if (indicetray >= longtray) {
+ xframe2 = 0;
+ if (!cambiopantalla) {
+ elemento1 = (xraton + 7) - (characterPosX + rectificacionx);
+ elemento2 = (yraton + 7) - (characterPosY + rectificaciony);
+ if (abs(elemento2) > (abs(elemento1) + 20)) {
+ if (elemento2 < 0)
+ direccionmovimiento = 0;
+ else
+ direccionmovimiento = 2;
+ } else {
+ if (elemento1 > 0)
+ direccionmovimiento = 1;
+ else
+ direccionmovimiento = 3;
+ }
+ }
+ }
+ iframe++;
+ if (iframe > walkFrameCount)
+ iframe = 0;
+ } else {
+ iframe = 0;
+ if (zonavedada == false && !cambiopantalla) {
+ elemento1 = (xraton + 7) - (characterPosX + rectificacionx);
+ elemento2 = (yraton + 7) - (characterPosY + rectificaciony);
+ if (abs(elemento2) > (abs(elemento1) + 20)) {
+ if (elemento2 < 0)
+ direccionmovimiento = 0;
+ else
+ direccionmovimiento = 2;
+ } else {
+ if (elemento1 > 0)
+ direccionmovimiento = 1;
+ else
+ direccionmovimiento = 3;
+ }
+ }
+ }
+ characterPosX = trayec[indicetray].x;
+ characterPosY = trayec[indicetray].y;
+
+ updateMainCharacterDepth();
+
+ if (pintaractivo) {
+ sprites(true);
+ }
+
+ tocapintar = false;
+ if (roomData->banderapaleta && saltospal >= 4) {
+ saltospal = 0;
+ if (movidapaleta > 6)
+ movidapaleta = 0;
+ else
+ movidapaleta += 1;
+ if (roomData->codigo == 4 && movidapaleta == 4)
+ pitavocmem();
+ updatePalette(movidapaleta);
+ } else {
+ saltospal += 1;
+ }
+ }
+}
+
+void actionLineText(Common::String actionLine) {
+ outtextxy(160, 144, actionLine, 255, true, Graphics::kTextAlignCenter);
+}
+
+void animateGive(uint cogedir, uint cogealt) {
+ direccionmovimiento = cogedir;
+ for (uint i = 0; i < 5; i++) {
+ emptyLoop();
+ tocapintar = false;
+ // Must add 1 to i because the original game uses 1-based indices
+ iframe = 15 + 6 + 5 + cogealt * 10 - (i + 1);
+
+ if (roomData->banderapaleta && saltospal >= 4) {
+ saltospal = 0;
+ if (movidapaleta > 6)
+ movidapaleta = 0;
+ else
+ movidapaleta += 1;
+ updatePalette(movidapaleta);
+ } else
+ saltospal += 1;
+ sprites(true);
+ }
+ iframe = 0;
+}
+
+// Lean over to pick
+void animatePickup1(uint cogedir, uint cogealt) {
+ direccionmovimiento = cogedir;
+ for (uint i = 0; i < 5; i++) {
+ emptyLoop();
+ tocapintar = false;
+ iframe = 15 + cogealt * 10 + (i + 1);
+
+ if (roomData->banderapaleta && saltospal >= 4) {
+ saltospal = 0;
+ if (movidapaleta > 6)
+ movidapaleta = 0;
+ else
+ movidapaleta += 1;
+ updatePalette(movidapaleta);
+ } else
+ saltospal += 1;
+ sprites(true);
+ g_engine->_screen->update();
+ }
+}
+
+// Lean back after pick
+void animatePickup2(uint cogedir, uint cogealt) {
+ direccionmovimiento = cogedir;
+ ChronoManager *thisChrono = new ChronoManager();
+
+ for (uint i = 0; i < 5; i++) {
+ emptyLoop();
+ tocapintar = false;
+
+ iframe = 15 + 5 + cogealt * 10 + (i + 1);
+
+ if (roomData->banderapaleta && saltospal >= 4) {
+ saltospal = 0;
+ if (movidapaleta > 6)
+ movidapaleta = 0;
+ else
+ movidapaleta += 1;
+ updatePalette(movidapaleta);
+ } else
+ saltospal += 1;
+ sprites(true);
+ g_engine->_screen->update();
+ }
+ emptyLoop();
+ tocapintar = false;
+ sprites(true);
+ iframe = 0;
+}
+
+void animateOpen2(uint cogedir, uint cogealt) {
+ direccionmovimiento = cogedir;
+ contadorpc = contadorpc2;
+ for (uint i = 0; i < 5; i++) {
+ emptyLoop();
+ tocapintar = false;
+ iframe = 15 + 6 + cogealt * 10 - (i + 1);
+
+ if (roomData->banderapaleta && saltospal >= 4) {
+ saltospal = 0;
+ if (movidapaleta > 6)
+ movidapaleta = 0;
+ else
+ movidapaleta += 1;
+ updatePalette(movidapaleta);
+ } else
+ saltospal += 1;
+ sprites(true);
+ }
+ emptyLoop();
+ tocapintar = false;
+ sprites(true);
+ iframe = 0;
+}
+
+void animateBat() {
+ const uint trayseg[91][2] = {
+ {288, 40}, {289, 38}, {289, 36}, {289, 34}, {290, 32}, {290, 30}, {289, 31}, {288, 32},
+ {288, 34}, {286, 36}, {284, 38}, {282, 40}, {280, 42}, {278, 44}, {276, 46}, {274, 48},
+ {272, 50}, {270, 48}, {268, 46}, {266, 48}, {265, 50}, {264, 52}, {263, 54}, {263, 56},
+ {262, 58}, {261, 60}, {261, 62}, {261, 64}, {260, 66}, {260, 68}, {260, 70}, {260, 72},
+ {259, 74}, {259, 76}, {260, 78}, {262, 76}, {264, 74}, {266, 72}, {266, 74}, {266, 76},
+ {268, 78}, {270, 80}, {272, 82}, {274, 84}, {276, 86}, {278, 88}, {279, 90}, {280, 88},
+ {281, 86}, {282, 84}, {283, 82}, {283, 84}, {283, 86}, {283, 88}, {284, 90}, {284, 92},
+ {284, 94}, {284, 96}, {285, 98}, {285, 100}, {286, 98}, {288, 96}, {290, 94}, {290, 92},
+ {290, 90}, {289, 92}, {289, 94}, {289, 96}, {289, 98}, {289, 100}, {289, 102}, {288, 104},
+ {287, 106}, {287, 108}, {288, 110}, {288, 112}, {288, 114}, {289, 116}, {289, 114}, {289, 112},
+ {290, 110}, {290, 112}, {290, 114}, {289, 116}, {289, 118}, {289, 120}, {289, 122}, {289, 124},
+ {290, 122}, {290, 120}, {290, 118}
+ };
+ byte iframe2seg;
+ uint anchoaniseg, altoaniseg,
+ itrayseg, longtrayseg, xseg, yseg, profseg, dirseg;
+
+ boolean salir_del_bucle = false;
+ if (roomData->banderamovimiento) {
+ iframe2seg = iframe2;
+ xseg = animado.posx;
+ yseg = animado.posy;
+ anchoaniseg = anchoanimado;
+ altoaniseg = altoanimado;
+ profseg = animado.profundidad;
+ dirseg = animado.dir;
+ freeAnimation();
+ }
+ loadBat();
+ stopVoc();
+ loadVoc("MURCIEL", 160848, 4474);
+ pitavocmem();
+ itrayseg = 0;
+ longtrayseg = 87;
+ iframe2 = 0;
+ animado.profundidad = 14;
+ do {
+ g_engine->_chrono->updateChrono();
+ if (tocapintar) {
+ if (itrayseg == longtrayseg)
+ salir_del_bucle = true;
+ itrayseg += 1;
+ if (iframe2 >= secondaryAnimationFrameCount - 1)
+ iframe2 = 0;
+ else
+ iframe2++;
+
+ animado.posx = trayseg[itrayseg][0] - 20;
+ animado.posy = trayseg[itrayseg][1];
+ animado.dir = 0;
+ sprites(true);
+ tocapintar = false;
+ if (itrayseg % 24 == 0)
+ pitavocmem();
+ if (saltospal >= 4) {
+ saltospal = 0;
+ if (movidapaleta > 6)
+ movidapaleta = 0;
+ else
+ movidapaleta += 1;
+ updatePalette(movidapaleta);
+ } else
+ saltospal += 1;
+ }
+ g_engine->_screen->update();
+ g_system->delayMillis(10);
+ } while (!salir_del_bucle && !g_engine->shouldQuit());
+
+ stopVoc();
+ freeAnimation();
+ if (roomData->banderamovimiento) {
+ anchoanimado = anchoaniseg;
+ altoanimado = altoaniseg;
+ setRoomTrajectories(altoanimado, anchoanimado, RESTORE, false);
+ loadAnimation(roomData->nombremovto);
+ iframe2 = iframe2seg;
+ animado.posx = xseg;
+ animado.posy = yseg;
+ animado.profundidad = profseg;
+ animado.dir = dirseg;
+ }
+ handPantallaToFondo();
+ assembleScreen();
+ drawScreen(fondo);
+}
+
+void updateVideo() {
+ readBitmap(regobj.puntparche, objetos[regobj.profundidad - 1], regobj.tamparche, 319);
+ handPantallaToFondo();
+ assembleScreen();
+ drawScreen(fondo);
+}
+
+void alcoveAnimation(byte direccionhn, int32 dibujo) {
+ uint posdibhn, indicehn;
+ int incrementohn;
+
+ if (roomData->codigo == 24) {
+ objetos[1] = (byte *)malloc(3660);
+ readBitmap(1382874, objetos[1], 3652, 319);
+ uint16 object2Width = READ_LE_UINT16(objetos[1]);
+ uint16 object2Height = READ_LE_UINT16(objetos[1] + 2);
+ profundidad[1].posx = 211;
+ profundidad[1].posy = 16;
+ profundidad[1].posx2 = 211 + object2Width + 1;
+ profundidad[1].posy2 = 16 + object2Height + 1;
+ }
+
+ switch (direccionhn) {
+ case 0: {
+ posdibhn = 44904;
+ incrementohn = 1;
+ Common::copy(objetos[0], objetos[0] + 892, fondo + 44900);
+ readBitmap(dibujo, objetos[0], 892, 319);
+ Common::copy(objetos[0] + 4, objetos[0] + 4 + 888, fondo + 44900 + 892);
+ } break;
+ case 1: {
+ posdibhn = 892 + 44900;
+ incrementohn = -1;
+ readBitmap(dibujo, fondo + 44900, 892, 319);
+ Common::copy(objetos[0] + 4, objetos[0] + 4 + (888 - 4), fondo + 44900 + 892);
+ } break;
+ }
+ uint16 object1Width = READ_LE_UINT16(objetos[0]);
+ uint16 object1Height = READ_LE_UINT16(objetos[0] + 2);
+
+
+ *(fondo + 44900 + 2)= *(objetos[0] + 2) * 2 + 1;
+ handPantallaToFondo();
+
+ for (indicehn = 1; indicehn <= object1Height; indicehn++) {
+ posdibhn = posdibhn + (incrementohn * fondo[44900] + 1);
+
+ Common::copy(fondo + posdibhn, fondo + posdibhn + 888, objetos[0] + 4);
+ assembleScreen();
+ drawScreen(fondo);
+ g_engine->_screen->update();
+ }
+ readBitmap(dibujo, objetos[0], 892, 319);
+
+ handPantallaToFondo();
+ assembleScreen();
+ drawScreen(fondo);
+
+ if (roomData->codigo == 24) {
+ free(objetos[1]);
+ objetos[1] = NULL;
+ }
+}
+
+void pickupScreenObject() {
+ byte indicemochila, indicex, indicey;
+ uint screenObject;
+
+ uint mouseX = (pulsax + 7) / factorx;
+ uint mouseY = (pulsay + 7) / factory;
+ screenObject = roomData->indexadoobjetos[roomData->mouseGrid[mouseX][mouseY]]->indicefichero;
+ if (screenObject == 0)
+ return;
+ readItemRegister(screenObject);
+ goToObject(
+ roomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory],
+ roomData->rejapantalla[mouseX][mouseY]);
+ verifyCopyProtection();
+ if (regobj.coger) {
+ g_engine->_mouseManager->hide();
+ switch (regobj.code) {
+ case 521: { // Corridor lamp
+ roomData->mouseGrid[10][11] = 19;
+ roomData->mouseGrid[9][12] = 18;
+ roomData->mouseGrid[10][12] = 18;
+ } break;
+ case 567: { // Pickup rubble
+ if (roomData->banderamovimiento) {
+ g_engine->_mouseManager->show();
+ drawText(3226);
+ return;
+ }
+ } break;
+ case 590: // Ectoplasm
+ cavernas[1] = true;
+ break;
+ case 665: // Bird
+ cavernas[0] = true;
+ break;
+ case 676:
+ case 688: {
+ cavernas[4] = true;
+ vasijapuesta = false;
+ } break;
+ }
+ switch (regobj.altura) {
+ case 0: { //Pick up above
+ switch (regobj.code) {
+ case 590: { //Ectoplasm
+ animatePickup1(3, 0);
+ animatePickup2(3, 0);
+ } break;
+ default: {
+ animatePickup1(direccionmovimiento, 0);
+ objetos[regobj.profundidad - 1] = NULL;
+ handPantallaToFondo();
+ assembleScreen();
+ drawScreen(fondo);
+ animatePickup2(direccionmovimiento, 0);
+ }
+ }
+ } break;
+ case 1: { // Waist level
+ switch (regobj.code) {
+ case 218: { // Necronomicon
+ animatePickup1(0, 1);
+ animatePickup2(0, 1);
+ } break;
+ case 223: { // table cloths
+ animatePickup1(0, 1);
+ roomData->indexadoobjetos[roomData->mouseGrid[mouseX][mouseY]]->indicefichero = regobj.reemplazarpor;
+ updateVideo();
+ animatePickup2(0, 1);
+ } break;
+ case 308: { // Mistletoe
+ animatePickup1(0, 1);
+ animatePickup2(0, 1);
+ } break;
+ case 402: { //Kitchen table
+ animatePickup1(0, 1);
+ updateVideo();
+ animatePickup2(0, 1);
+ } break;
+ case 479: { // Scissors
+ animatePickup1(3, 1);
+ animatePickup2(3, 1);
+ } break;
+ case 517: { // mints
+ animatePickup1(0, 1);
+ animatePickup2(0, 1);
+ } break;
+ case 521: { // Puts plaster and key on the floor
+ animatePickup1(0, 1);
+ {
+ RoomBitmapRegister &with = roomData->bitmapasociados[1];
+
+ with.puntbitmap = 775611;
+ with.tambitmap = 36;
+ with.coordx = 80;
+ with.coordy = 56;
+ with.profund = 2;
+ loadItem(with.coordx, with.coordy, with.tambitmap, with.puntbitmap, with.profund);
+ }
+ {
+ RoomBitmapRegister &with = roomData->bitmapasociados[2];
+
+ with.puntbitmap = 730743;
+ with.tambitmap = 64;
+ with.coordx = 76;
+ with.coordy = 62;
+ with.profund = 1;
+ loadItem(with.coordx, with.coordy, with.tambitmap, with.puntbitmap, with.profund);
+ }
+ objetos[regobj.profundidad - 1] = NULL;
+ handPantallaToFondo();
+
+ assembleScreen();
+ drawScreen(fondo);
+ animatePickup2(0, 1);
+ } break;
+ case 562: { // alcove
+ switch (roomData->codigo) {
+ case 20: { //First scene with alcove
+ if (hornacina[0][hornacina[0][3]] > 0) {
+ //Possibly
+ if (hornacina[0][3] == 2 || hornacina[0][hornacina[0][3]] == 563) {
+ readItemRegister(hornacina[0][hornacina[0][3]]);
+ hornacina[0][hornacina[0][3]] = 0;
+ roomData->indexadoobjetos[9]->objectName = "HORNACINA";
+ animatePickup1(3, 1);
+ readBitmap(1190768, objetos[regobj.profundidad - 1], 892, 319);
+ roomData->bitmapasociados[1].puntbitmap = 1190768;
+ roomData->bitmapasociados[1].tambitmap = 892;
+ roomData->bitmapasociados[1].coordx = 66;
+ roomData->bitmapasociados[1].coordy = 35;
+ roomData->bitmapasociados[1].profund = 1;
+ handPantallaToFondo();
+ assembleScreen();
+ drawScreen(fondo);
+ animatePickup2(3, 1);
+ } else {
+ readItemRegister(hornacina[0][hornacina[0][3]]);
+ hornacina[0][hornacina[0][3]] = 0;
+ hornacina[0][3] += 1;
+ hornacina[1][3] -= 1;
+ roomData->indexadoobjetos[9]->objectName = " ";
+ animatePickup1(3, 1);
+ readBitmap(1190768, objetos[regobj.profundidad - 1],
+ 892, 319);
+ handPantallaToFondo();
+ assembleScreen();
+ drawScreen(fondo);
+ animatePickup2(3, 1);
+ playVoc("PLATAF", 375907, 14724);
+ roomData->bitmapasociados[1].tambitmap = 892;
+ roomData->bitmapasociados[1].coordx = 66;
+ roomData->bitmapasociados[1].coordy = 35;
+ roomData->bitmapasociados[1].profund = 1;
+ switch (hornacina[0][hornacina[0][3]]) {
+ case 0: {
+ roomData->indexadoobjetos[9]->objectName = "HORNACINA";
+ alcoveAnimation(0, 1190768);
+ roomData->bitmapasociados[1].puntbitmap = 1190768;
+ } break;
+ case 561: {
+ roomData->indexadoobjetos[9]->objectName = "ESTATUA DIVINA";
+ alcoveAnimation(0, 1182652);
+ roomData->bitmapasociados[1].puntbitmap = 1182652;
+ } break;
+ case 563: {
+ roomData->indexadoobjetos[9]->objectName = "MANUAL DE ALFARERO";
+ alcoveAnimation(0, 1186044);
+ roomData->bitmapasociados[1].puntbitmap = 1186044;
+ } break;
+ case 615: {
+ roomData->indexadoobjetos[9]->objectName = "ESTATUA GROTESCA";
+ alcoveAnimation(0, 1181760);
+ roomData->bitmapasociados[1].puntbitmap = 1181760;
+ } break;
+ }
+ updateAltScreen(24);
+ }
+ } else {
+
+ g_engine->_mouseManager->show();
+ drawText(1049 + Random(10));
+ g_engine->_mouseManager->hide();
+ return;
+ }
+ } break;
+ case 24: { //Second scene with alcove
+ if (hornacina[1][hornacina[1][3]] > 0 && hornacina[1][3] != 1) {
+ if (hornacina[1][3] == 2) {
+ readItemRegister(hornacina[1][2]);
+ hornacina[1][2] = 0;
+ roomData->indexadoobjetos[8]->objectName = "HORNACINA";
+ animatePickup1(0, 1);
+ readBitmap(1399610, objetos[regobj.profundidad - 1], 892, 319);
+ roomData->bitmapasociados[0].puntbitmap = 1399610;
+ roomData->bitmapasociados[0].tambitmap = 892;
+ roomData->bitmapasociados[0].coordx = 217;
+ roomData->bitmapasociados[0].coordy = 48;
+ roomData->bitmapasociados[0].profund = 1;
+ handPantallaToFondo();
+ assembleScreen();
+ drawScreen(fondo);
+ animatePickup2(0, 1);
+ } else {
+ readItemRegister(hornacina[1][hornacina[1][3]]);
+ hornacina[1][hornacina[1][3]] = 622;
+ hornacina[1][3] += 1;
+ hornacina[0][3] -= 1;
+ roomData->indexadoobjetos[8]->objectName = " ";
+ animatePickup1(0, 1);
+ readBitmap(1399610, objetos[0], 892, 319);
+ handPantallaToFondo();
+ assembleScreen();
+ drawScreen(fondo);
+ animatePickup2(0, 1);
+ playVoc("PLATAF", 375907, 14724);
+ roomData->bitmapasociados[0].tambitmap = 892;
+ roomData->bitmapasociados[0].coordx = 217;
+ roomData->bitmapasociados[0].coordy = 48;
+ roomData->bitmapasociados[0].profund = 1;
+ switch (hornacina[1][hornacina[1][3]]) {
+ case 0: {
+ roomData->indexadoobjetos[8]->objectName = "HORNACINA";
+ alcoveAnimation(0, 1399610);
+ roomData->bitmapasociados[0].puntbitmap = 1399610;
+ } break;
+ case 561: {
+ roomData->indexadoobjetos[8]->objectName = "ESTATUA DIVINA";
+ alcoveAnimation(0, 1381982);
+ roomData->bitmapasociados[0].puntbitmap = 1381982;
+ } break;
+ case 615: {
+ roomData->indexadoobjetos[8]->objectName = "ESTATUA GROTESCA";
+ alcoveAnimation(0, 1381090);
+ roomData->bitmapasociados[0].puntbitmap = 1381090;
+ } break;
+ case 622: {
+ roomData->indexadoobjetos[8]->objectName = "PARED";
+ alcoveAnimation(0, 1400502);
+ roomData->bitmapasociados[0].puntbitmap = 1400502;
+ } break;
+ case 623: {
+ roomData->indexadoobjetos[8]->objectName = "TORNO";
+ alcoveAnimation(0, 1398718);
+ roomData->bitmapasociados[0].puntbitmap = 1398718;
+ } break;
+ }
+ updateAltScreen(20);
+ }
+ } else {
+ g_engine->_mouseManager->show();
+ drawText(1049 + Random(10));
+ g_engine->_mouseManager->hide();
+ return;
+ }
+ } break;
+ }
+ } break;
+ case 624: { // red devil
+ animatePickup1(2, 1);
+ {
+ RoomBitmapRegister &with = roomData->bitmapasociados[3];
+
+ with.puntbitmap = 0;
+ with.tambitmap = 0;
+ with.coordx = 0;
+ with.coordy = 0;
+ with.profund = 0;
+ }
+ objetos[3] = NULL;
+ disableSecondAnimation();
+ drawScreen(fondo);
+ animatePickup2(2, 1);
+ rojo_capturado = true;
+ trampa_puesta = false;
+ } break;
+ default: {
+ animatePickup1(direccionmovimiento, 1);
+ objetos[regobj.profundidad - 1] = NULL;
+ handPantallaToFondo();
+ assembleScreen();
+ drawScreen(fondo);
+ animatePickup2(direccionmovimiento, 1);
+ }
+ }
+ } break;
+ case 2: { //Pick up feet level
+ switch (regobj.code) {
+ case 216: { // chisel
+ animatePickup1(0, 2);
+ roomData->indexadoobjetos[roomData->mouseGrid
+ [mouseX][mouseY]]
+ ->indicefichero = regobj.reemplazarpor;
+ updateVideo();
+ animatePickup2(0, 2);
+ } break;
+ case 295: { // candles
+ animatePickup1(3, 2);
+ roomData->indexadoobjetos[roomData->mouseGrid
+ [mouseX][mouseY]]
+ ->indicefichero = regobj.reemplazarpor;
+ updateVideo();
+ animatePickup2(3, 2);
+ } break;
+ case 362: { // charcoal
+ animatePickup1(0, 2);
+ animatePickup2(0, 2);
+ } break;
+ case 598: { // mud
+ animatePickup1(3, 2);
+ animatePickup2(3, 2);
+ } break;
+ case 659: { // spider web, puts bird and ring on the floor
+ animatePickup1(3, 2);
+ objetos[regobj.profundidad - 1] = NULL;
+ { // bird
+ RoomBitmapRegister &with = roomData->bitmapasociados[2];
+
+ with.puntbitmap = 1545924;
+ with.tambitmap = 172;
+ with.coordx = 38;
+ with.coordy = 58;
+ with.profund = 1;
+ loadItem(with.coordx, with.coordy, with.tambitmap, with.puntbitmap, with.profund);
+ }
+ { // ring
+ RoomBitmapRegister &with = roomData->bitmapasociados[1];
+
+ with.puntbitmap = 1591272;
+ with.tambitmap = 92;
+ with.coordx = 50;
+ with.coordy = 58;
+ with.profund = 3;
+ loadItem(with.coordx, with.coordy, with.tambitmap, with.puntbitmap, with.profund);
+ }
+ handPantallaToFondo();
+ assembleScreen();
+ drawScreen(fondo);
+ animatePickup2(3, 2);
+ } break;
+ default: {
+ animatePickup1(direccionmovimiento, 2);
+ objetos[regobj.profundidad - 1] = NULL;
+ assembleScreen();
+ drawScreen(fondo);
+ animatePickup2(direccionmovimiento, 2);
+ }
+ }
+ } break;
+ case 9: { // bat
+ kaka = regobj.pickTextRef;
+ readItemRegister(204);
+ animatePickup1(0, 1);
+ animateOpen2(0, 1);
+ animateBat();
+ g_engine->_mouseManager->show();
+ drawText(kaka);
+ roomData->mouseGrid[34][8] = 24;
+ numeroaccion = 0;
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ checkMouseGrid();
+ return;
+ } break;
+ }
+ g_engine->_mouseManager->show();
+
+ if (regobj.code != 624)
+ for (indicey = regobj.yrej1; indicey <= regobj.yrej2; indicey++)
+ for (indicex = regobj.xrej1; indicex <= regobj.xrej2; indicex++) {
+ roomData->rejapantalla[indicex][indicey] = regobj.parcherejapantalla[indicex - regobj.xrej1][indicey - regobj.yrej1];
+ roomData->mouseGrid[indicex][indicey] = regobj.parcherejaraton[indicex - regobj.xrej1][indicey - regobj.yrej1];
+ }
+ switch (regobj.code) {
+ case 216: { // chisel
+ roomData->bitmapasociados[5].puntbitmap = 517485;
+ roomData->bitmapasociados[5].tambitmap = 964;
+ roomData->bitmapasociados[5].coordx = 223;
+ roomData->bitmapasociados[5].coordy = 34;
+ roomData->bitmapasociados[5].profund = 1;
+ } break;
+ case 218:; // necronomicon
+ break;
+ case 223: { // table cloth
+ roomData->bitmapasociados[6].puntbitmap = 436752;
+ roomData->bitmapasociados[6].tambitmap = 1372;
+ roomData->bitmapasociados[6].coordx = 174;
+ roomData->bitmapasociados[6].coordy = 32;
+ roomData->bitmapasociados[6].profund = 1;
+ } break;
+ case 295: { // candles
+ roomData->bitmapasociados[3].puntbitmap = 1130756;
+ roomData->bitmapasociados[3].tambitmap = 1764;
+ roomData->bitmapasociados[3].coordx = 100;
+ roomData->bitmapasociados[3].coordy = 28;
+ roomData->bitmapasociados[3].profund = 1;
+ } break;
+ case 308:; // mistletoe
+ break;
+ case 362:;// charcoal
+ break;
+ case 402: {
+ roomData->bitmapasociados[5].puntbitmap = 68130;
+ roomData->bitmapasociados[5].tambitmap = 2564;
+ roomData->bitmapasociados[5].coordx = 148;
+ roomData->bitmapasociados[5].coordy = 49;
+ roomData->bitmapasociados[5].profund = 7;
+ } break;
+ case 479:; // scissors
+ break;
+ case 517:; // mints
+ break;
+ case 590:; // ectoplasm
+ break;
+ case 598:; // mud
+ break;
+ case 624:; // red devil
+ break;
+ default: {
+ for (indicex = 0; indicex < 15; indicex++)
+ if (roomData->bitmapasociados[indicex].puntbitmap ==
+ regobj.punterobitmap) {
+ roomData->bitmapasociados[indicex].puntbitmap = 0;
+ roomData->bitmapasociados[indicex].tambitmap = 0;
+ roomData->bitmapasociados[indicex].coordx = 0;
+ roomData->bitmapasociados[indicex].coordy = 0;
+ roomData->bitmapasociados[indicex].profund = 0;
+ }
+ }
+ }
+ } else {
+ if (regobj.pickTextRef > 0)
+ drawText(regobj.pickTextRef);
+ numeroaccion = 0;
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ checkMouseGrid();
+ return;
+ }
+ indicemochila = 0;
+
+ while (mobj[indicemochila].code != 0){
+ indicemochila += 1;
+ }
+
+ mobj[indicemochila].bitmapIndex =regobj.objectIconBitmap;
+ mobj[indicemochila].code = regobj.code;
+ mobj[indicemochila].objectName = regobj.name;
+ g_engine->_mouseManager->hide();
+ drawBackpack();
+ g_engine->_mouseManager->show();
+ if (regobj.pickTextRef > 0)
+ drawText(regobj.pickTextRef);
+ numeroaccion = 0;
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ checkMouseGrid();
+}
+
+void replaceBackpack(byte indicador1, uint indicador2) {
+ byte indicepaso, indicex, indicey;
+
+ readItemRegister(indicador2);
+ mobj[indicador1].bitmapIndex = regobj.objectIconBitmap;
+ mobj[indicador1].code = indicador2;
+ mobj[indicador1].objectName = regobj.name;
+ contadorpc = contadorpc2;
+}
+
+void dropObjectInScreen(InvItemRegister regobjsustituto) {
+ byte indicepaso, indicex, indicey;
+
+ if (regobjsustituto.tambitmap > 0) {
+ indicepaso = 0;
+ while (!(roomData->bitmapasociados[indicepaso].tambitmap == 0) || indicepaso == 15) {
+ indicepaso ++;
+ }
+ if (roomData->bitmapasociados[indicepaso].tambitmap == 0) {
+ {
+ RoomBitmapRegister &with = roomData->bitmapasociados[indicepaso];
+
+ with.puntbitmap = regobjsustituto.punterobitmap;
+ with.tambitmap = regobjsustituto.tambitmap;
+ with.coordx = regobjsustituto.xparche;
+ with.coordy = regobjsustituto.yparche;
+ with.profund = regobjsustituto.profundidad - 1;
+ loadItem(with.coordx, with.coordy, with.tambitmap, with.puntbitmap, with.profund);
+ }
+ for (indicey = regobjsustituto.yrej1; indicey <= regobjsustituto.yrej2; indicey++)
+ for (indicex = regobjsustituto.xrej1; indicex <= regobjsustituto.xrej2; indicex++) {
+ roomData->rejapantalla[indicex][indicey] = regobjsustituto.parcherejapantalla[indicex - regobjsustituto.xrej1][indicey - regobjsustituto.yrej1];
+ roomData->mouseGrid[indicex][indicey] = regobjsustituto.parcherejaraton[indicex - regobjsustituto.xrej1][indicey - regobjsustituto.yrej1];
+ }
+ } else
+ _exit(264);
+ }
+}
+
+void useScreenObject() {
+ byte indicemochila, indlista, aciertoslista, indmoch,
+ indicex, indicey;
+ boolean controlarlista, basurillalog;
+
+ uint mouseX = (pulsax + 7) / factorx;
+ uint mouseY = (pulsay + 7) / factory;
+ uint screenObject = roomData->indexadoobjetos[roomData->mouseGrid[mouseX][mouseY]]->indicefichero;
+
+ if (objetomochila != "") {
+ indicemochila = 0;
+ while (mobj[indicemochila].objectName != objetomochila) {
+ indicemochila += 1;
+ }
+
+ readItemRegister(mobj[indicemochila].code);
+
+ goToObject(
+ roomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory],
+ roomData->rejapantalla[mouseX][mouseY]
+ );
+
+ if (regobj.usarcon == screenObject && screenObject > 0 && regobj.usar[0] == 5) {
+ switch (regobj.usarcon) {
+ case 30: { // corn with rooster
+ drawText(regobj.useTextRef);
+ g_engine->_mouseManager->hide();
+
+ animateGive(1, 2);
+ animatePickup2(1, 2);
+
+ updateItem(regobj.code);
+ roomData->indexadoobjetos[27]->indicefichero = 201;
+ do {
+ g_engine->_chrono->updateChrono();
+ if (iframe2 >= secondaryAnimationFrameCount - 1)
+ iframe2 = 0;
+ else
+ iframe2++;
+ if (indicetray2 >= roomData->longtray2)
+ indicetray2 = 1;
+ else
+ indicetray2 += 1;
+ animado.dir = roomData->dir2[indicetray2 - 1];
+ animado.posx = roomData->tray2[indicetray2 - 1].x;
+ animado.posy = roomData->tray2[indicetray2 - 1].y;
+ emptyLoop();
+ tocapintar = false;
+ emptyLoop2();
+ sprites(true);
+ g_engine->_screen->update();
+ } while (indicetray2 != 4);
+
+ for (indlista = 0; indlista < maxrejax; indlista++)
+ for (indmoch = 0; indmoch < maxrejay; indmoch++) {
+ roomData->rejapantalla[oldposx + indlista][oldposy + indmoch] = rejafondomovto[indlista][indmoch];
+ roomData->mouseGrid[oldposx + indlista][oldposy + indmoch] = rejafondoraton[indlista][indmoch];
+ }
+
+ freeAnimation();
+ animado.posx = roomData->tray2[indicetray2 - 1].x + 8;
+ animado.posy = roomData->tray2[indicetray2 - 1].y;
+ roomData->nombremovto = "GALLOPIC";
+ roomData->dir2[299] = 201;
+ loadAnimation("GALLOPIC");
+ roomData->dir2[0] = 0;
+ roomData->tray2[0].x = animado.posx;
+ roomData->tray2[0].y = animado.posy;
+ indicetray2 = 1;
+ roomData->longtray2 = 1;
+
+ for (indlista = 0; indlista < maxrejax; indlista++)
+ for (indmoch = 0; indmoch < maxrejay; indmoch++) {
+ if (rejamascaramovto[indlista][indmoch] > 0)
+ roomData->rejapantalla[oldposx + indlista][oldposy + indmoch] = rejamascaramovto[indlista][indmoch];
+ if (rejamascararaton[indlista][indmoch] > 0)
+ roomData->mouseGrid[oldposx + indlista][oldposy + indmoch] = rejamascararaton[indlista][indmoch];
+ }
+ g_engine->_mouseManager->show();
+ } break;
+ case 153: { // oil with well
+ drawText(regobj.useTextRef);
+ g_engine->_mouseManager->hide();
+ playVoc("BLUP", 330921, 3858);
+ animateGive(3, 1);
+ animatePickup2(3, 1);
+ g_engine->_mouseManager->show();
+ updateItem(regobj.code);
+ roomData->indexadoobjetos[21]->indicefichero = 154;
+ } break;
+ case 157: { // giving something to john
+ controlarlista = false;
+ if (lista1) {
+ for (indlista = 0; indlista < 5; indlista++) {
+ if (mobj[indicemochila].code == firstList[indlista])
+ controlarlista = true;
+ }
+ if (controlarlista) {
+ aciertoslista = 0;
+ for (indlista = 0; indlista < 5; indlista++) {
+ for (indmoch = 0; indmoch < inventoryIconCount; indmoch++) {
+ if (mobj[indmoch].code == firstList[indlista]) {
+ aciertoslista += 1;
+ break;
+ }
+ }
+ }
+ if (aciertoslista == 5) {
+ lista1 = false;
+ completadalista1 = true;
+ assignText();
+ hypertext(1018, 255, 0, kaka, false);
+ hypertext(kaka, 253, 249, kaka, true);
+ verb.close();
+
+ g_engine->_mouseManager->hide();
+ animateGive(direccionmovimiento, 1);
+ animateOpen2(direccionmovimiento, 1);
+ for (indlista = 0; indlista < 5; indlista++) {
+ indmoch = 0;
+ while (mobj[indmoch].code != firstList[indlista]) {
+ indmoch += 1;
+ }
+ updateInventory(indmoch);
+ }
+ indlista = 0;
+ while (mobj[indlista].code != 149) {
+ indlista += 1;
+ }
+ updateInventory(indlista);
+ drawBackpack();
+ g_engine->_mouseManager->show();
+ } else {
+ assignText();
+ hypertext(regobj.useTextRef, 255, 0, kaka, false);
+ g_engine->_mouseManager->hide();
+ animateGive(direccionmovimiento, 1);
+ animateOpen2(direccionmovimiento, 1);
+ g_engine->_mouseManager->show();
+ hypertext(kaka, 253, 249, kaka, true);
+ verb.close();
+ }
+ }
+ }
+ controlarlista = false;
+ if (lista2) {
+ for (indlista = 0; indlista < 5; indlista++)
+ if (mobj[indicemochila].code == secondList[indlista])
+ controlarlista = true;
+ if (controlarlista) {
+ aciertoslista = 0;
+ for (indlista = 0; indlista < 5; indlista++) {
+ for (indmoch = 0; indmoch <= inventoryIconCount; indmoch++) {
+ if (mobj[indmoch].code == secondList[indlista]) {
+ aciertoslista += 1;
+ break;
+ }
+ }
+ }
Commit: 5c49d4deb1d6f6a8fc04c5d5774bf56df2af792a
https://github.com/scummvm/scummvm/commit/5c49d4deb1d6f6a8fc04c5d5774bf56df2af792a
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:45+02:00
Commit Message:
TOT: Fixes list trackers with the right type
Changed paths:
engines/tot/playanim.cpp
engines/tot/playanim.h
engines/tot/routines.cpp
engines/tot/saveload.cpp
diff --git a/engines/tot/playanim.cpp b/engines/tot/playanim.cpp
index adf8a3823d0..338872b3e05 100644
--- a/engines/tot/playanim.cpp
+++ b/engines/tot/playanim.cpp
@@ -189,7 +189,7 @@ boolean primera[maxpersonajes],
boolean cavernas[5];
-boolean firstList[5], secondList[5];
+uint16 firstList[5], secondList[5];
regsecuencia secuencia;
reganimado animado;
@@ -1136,6 +1136,7 @@ void initPlayAnim() {
firstList[2] = 402;
firstList[3] = 223;
firstList[4] = 521;
+
secondList[0] = 221;
secondList[1] = 423;
secondList[2] = 308;
diff --git a/engines/tot/playanim.h b/engines/tot/playanim.h
index 40090ed4f0a..b754dd2b55c 100644
--- a/engines/tot/playanim.h
+++ b/engines/tot/playanim.h
@@ -278,7 +278,7 @@ struct regispartida {
objetomochila;
Common::String nombrepersonaje;
route mainRoute;
- boolean firstList[5], secondList[5];
+ uint16 firstList[5], secondList[5];
Common::Point trayec[300];
boolean primera[maxpersonajes],
lprimera[maxpersonajes],
@@ -576,7 +576,7 @@ extern boolean cavernas[5];
/**
* First and second lists of objects to retrieve in the game
*/
-extern boolean firstList[5],
+extern uint16 firstList[5],
secondList[5];
/**
* Animation sequence
diff --git a/engines/tot/routines.cpp b/engines/tot/routines.cpp
index d3afeaa52ad..01b5207b093 100644
--- a/engines/tot/routines.cpp
+++ b/engines/tot/routines.cpp
@@ -2192,6 +2192,8 @@ void useScreenObject() {
} break;
case 157: { // giving something to john
controlarlista = false;
+ debug("lista1 = %d, %d, %d, %d, %d", firstList[0], firstList[1], firstList[2], firstList[3], firstList[4]);
+ debug("used object = %d", mobj[indicemochila].code);
if (lista1) {
for (indlista = 0; indlista < 5; indlista++) {
if (mobj[indicemochila].code == firstList[indlista])
diff --git a/engines/tot/saveload.cpp b/engines/tot/saveload.cpp
index b23c6a61fdf..2c527fadd94 100644
--- a/engines/tot/saveload.cpp
+++ b/engines/tot/saveload.cpp
@@ -129,8 +129,8 @@ boolean syncGeneralData(Common::Serializer &s, regispartida &game) {
for (int indiaux = 0; indiaux < 5; indiaux++) {
s.syncAsByte(game.cavernas[indiaux]);
- s.syncAsByte(game.firstList[indiaux]);
- s.syncAsByte(game.secondList[indiaux]);
+ s.syncAsUint16LE(game.firstList[indiaux]);
+ s.syncAsUint16LE(game.secondList[indiaux]);
}
for (int indiaux = 0; indiaux < 4; indiaux++) {
Commit: 2a6e701f96c3a1030adbd9f3accb0ff4f068fae9
https://github.com/scummvm/scummvm/commit/2a6e701f96c3a1030adbd9f3accb0ff4f068fae9
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:45+02:00
Commit Message:
TOT: Fixes bug with pot jar
Changed paths:
engines/tot/dialog.cpp
engines/tot/game.cpp
engines/tot/graphics.cpp
engines/tot/playanim.cpp
engines/tot/playanim.h
engines/tot/routines.cpp
engines/tot/routines2.cpp
engines/tot/saveload.cpp
engines/tot/util.cpp
diff --git a/engines/tot/dialog.cpp b/engines/tot/dialog.cpp
index e70c29fde46..33bb70c9598 100644
--- a/engines/tot/dialog.cpp
+++ b/engines/tot/dialog.cpp
@@ -43,8 +43,7 @@ boolean endOfConversation;
Common::String decrypt(Common::String tEncriptado) {
for (int i = 0; i < tEncriptado.size(); i++) {
- debug("decrypting char = %c into %c", tEncriptado[i], encriptado[i] ^ tEncriptado[i]);
- tEncriptado.setChar(encriptado[i] ^ (char)tEncriptado[i], i);
+ tEncriptado.setChar(decryptionKey[i] ^ (char)tEncriptado[i], i);
}
return tEncriptado;
}
@@ -384,7 +383,7 @@ void showDialogLine(Common::String matrizconversa[16], uint &charlaelegida) {
}
if (tocapintar) {
- if (roomData->banderapaleta && saltospal >= 4) {
+ if (currentRoomData->banderapaleta && saltospal >= 4) {
saltospal = 0;
if (movidapaleta > 6)
movidapaleta = 0;
@@ -570,14 +569,14 @@ void talk(byte person) {
void talkScreenObject() {
int x_del_raton = (pulsax + 7) / factorx;
int y_del_raton = (pulsay + 7) / factory;
- uint objeto_de_la_pantalla = roomData->indexadoobjetos[roomData->mouseGrid[x_del_raton][y_del_raton]]->indicefichero;
+ uint objeto_de_la_pantalla = currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[x_del_raton][y_del_raton]]->indicefichero;
if (objeto_de_la_pantalla == 0)
return;
// verifyCopyProtection2();
readItemRegister(objeto_de_la_pantalla);
- goToObject(roomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory],
- roomData->rejapantalla[x_del_raton][y_del_raton]);
+ goToObject(currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory],
+ currentRoomData->rejapantalla[x_del_raton][y_del_raton]);
if (regobj.habla > 0) {
talk(regobj.habla);
diff --git a/engines/tot/game.cpp b/engines/tot/game.cpp
index f9a611fcf47..69d9b6a5a4c 100644
--- a/engines/tot/game.cpp
+++ b/engines/tot/game.cpp
@@ -235,7 +235,7 @@ void loadTemporaryGame() {
int startGame();
-int newGame() {
+void newGame() {
g_engine->_mouseManager->hide();
obtainName(nombrepersonaje);
@@ -428,13 +428,13 @@ int startGame() {
case 0: // go to
contadorpc2 = contadorpc;
// gets the area where the character is now standing. Area is calculated using xframe,yframe plus some adjustments to get the center of the feet
- zonaactual = roomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory];
+ zonaactual = currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory];
if (zonaactual < 10) {
xframe2 = pulsax + 7;
yframe2 = pulsay + 7;
// obtains the target area from the clicked coordinates
- zonadestino = roomData->rejapantalla[xframe2 / factorx][yframe2 / factory];
- if (roomData->codigo == 21 && roomData->banderamovimiento) {
+ zonadestino = currentRoomData->rejapantalla[xframe2 / factorx][yframe2 / factory];
+ if (currentRoomData->codigo == 21 && currentRoomData->banderamovimiento) {
if ((zonadestino >= 1 && zonadestino <= 5) ||
(zonadestino >= 9 && zonadestino <= 13) ||
(zonadestino >= 18 && zonadestino <= 21) ||
@@ -458,12 +458,12 @@ int startGame() {
cambiopantalla = false;
for(indicepuertas = 0; indicepuertas < 5; indicepuertas++) {
- if (roomData->doors[indicepuertas].codigopuerta == zonadestino) {
+ if (currentRoomData->doors[indicepuertas].codigopuerta == zonadestino) {
- if (roomData->doors[indicepuertas].abiertacerrada == 1) {
+ if (currentRoomData->doors[indicepuertas].abiertacerrada == 1) {
cambiopantalla = true;
break;
- } else if (roomData->codigo == 5 && zonadestino == 27 || roomData->codigo == 6 && zonadestino == 21) {
+ } else if ((currentRoomData->codigo == 5 && zonadestino == 27) || (currentRoomData->codigo == 6 && zonadestino == 21)) {
;
} else {
pasos -= 1;
@@ -492,13 +492,13 @@ int startGame() {
cambiopantalla = false;
destinox_paso = (pulsax + 7) / factorx;
destinoy_paso = (pulsay + 7) / factory;
- if (roomData->indexadoobjetos[roomData->mouseGrid[destinox_paso][destinoy_paso]]->indicefichero > 0) {
+ if (currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[destinox_paso][destinoy_paso]]->indicefichero > 0) {
goToObject(
- roomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory],
- roomData->rejapantalla[destinox_paso][destinoy_paso]);
- if (roomData->indexadoobjetos[roomData->mouseGrid[destinox_paso][destinoy_paso]]->indicefichero == 562)
+ currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory],
+ currentRoomData->rejapantalla[destinox_paso][destinoy_paso]);
+ if (currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[destinox_paso][destinoy_paso]]->indicefichero == 562)
- switch (roomData->codigo) {
+ switch (currentRoomData->codigo) {
case 20:
if (hornacina[0][hornacina[0][3]] > 0)
readItemRegister(hornacina[0][hornacina[0][3]]);
@@ -513,7 +513,7 @@ int startGame() {
break;
}
else
- readItemRegister(roomData->indexadoobjetos[roomData->mouseGrid[destinox_paso][destinoy_paso]]->indicefichero);
+ readItemRegister(currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[destinox_paso][destinoy_paso]]->indicefichero);
if (regobj.lookAtTextRef > 0)
drawText(regobj.lookAtTextRef);
numeroaccion = 0;
@@ -604,14 +604,14 @@ int startGame() {
destinoy_paso = (pulsay + 7) / factory;
contadorpc2 = contadorpc;
if (destinoy_paso < 28) {
- RoomObjectListEntry obj = *roomData->indexadoobjetos[roomData->mouseGrid[destinox_paso][destinoy_paso]];
+ RoomObjectListEntry obj = *currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[destinox_paso][destinoy_paso]];
if (obj.indicefichero > 0) {
drawLookAtItem(obj);
- goToObject(roomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], roomData->rejapantalla[destinox_paso][destinoy_paso]);
+ goToObject(currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], currentRoomData->rejapantalla[destinox_paso][destinoy_paso]);
if (obj.indicefichero == 562)
- switch (roomData->codigo) {
+ switch (currentRoomData->codigo) {
case 20:
if (hornacina[0][hornacina[0][3]] > 0)
readItemRegister(hornacina[0][hornacina[0][3]]);
@@ -643,20 +643,20 @@ int startGame() {
cambiopantalla = false;
contadorpc = contadorpc2;
setRoomTrajectories(altoanimado, anchoanimado, RESTORE);
- saveRoomData(roomData, rooms);
+ saveRoomData(currentRoomData, rooms);
// verifyCopyProtection();
// fichpanta << datospantalla;
// close(fichpanta);
// setSfxVolume(volumenfxizquierdo, volumenfxderecho);
- switch (roomData->doors[indicepuertas].pantallaquecarga) {
+ switch (currentRoomData->doors[indicepuertas].pantallaquecarga) {
case 2: {
tipoefectofundido = Random(15) + 1;
iframe = 0;
indicetray = 0;
- characterPosX = roomData->doors[indicepuertas].posxsalida - rectificacionx;
- characterPosY = roomData->doors[indicepuertas].posysalida - rectificaciony;
+ characterPosX = currentRoomData->doors[indicepuertas].posxsalida - rectificacionx;
+ characterPosY = currentRoomData->doors[indicepuertas].posysalida - rectificaciony;
trayec[indicetray].x = characterPosX;
trayec[indicetray].y = characterPosY;
freeAnimation();
@@ -665,7 +665,7 @@ int startGame() {
effect(tipoefectofundido, true, NULL);
stopVoc();
- loadScreenData(roomData->doors[indicepuertas].pantallaquecarga);
+ loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
if (contadorpc > 89)
error("engine_start(): contadorpc (274)");
setSfxVolume(volumenfxizquierdo, volumenfxderecho);
@@ -680,19 +680,19 @@ int startGame() {
oldyrejilla = 0;
} break;
case 5: {
- if (roomData->codigo != 6) {
+ if (currentRoomData->codigo != 6) {
tipoefectofundido = Random(15) + 1;
iframe = 0;
indicetray = 0;
- characterPosX = roomData->doors[indicepuertas].posxsalida - rectificacionx;
- characterPosY = roomData->doors[indicepuertas].posysalida - rectificaciony + 15;
+ characterPosX = currentRoomData->doors[indicepuertas].posxsalida - rectificacionx;
+ characterPosY = currentRoomData->doors[indicepuertas].posysalida - rectificaciony + 15;
trayec[indicetray].x = characterPosX;
trayec[indicetray].y = characterPosY;
freeAnimation();
freeObject();
g_engine->_mouseManager->hide();
effect(tipoefectofundido, true, NULL);
- loadScreenData(roomData->doors[indicepuertas].pantallaquecarga);
+ loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
stopVoc();
autoPlayVoc("CALDERA", 6433, 15386);
setSfxVolume(volumenfxizquierdo, 0);
@@ -703,14 +703,14 @@ int startGame() {
checkMouseGrid();
} else {
- zonaactual = roomData->rejapantalla[((characterPosX + rectificacionx) / factorx)][((characterPosY + rectificaciony) / factory)];
+ zonaactual = currentRoomData->rejapantalla[((characterPosX + rectificacionx) / factorx)][((characterPosY + rectificaciony) / factory)];
zonadestino = 21;
goToObject(zonaactual, zonadestino);
freeAnimation();
freeObject();
g_engine->_mouseManager->hide();
setSfxVolume(volumenfxizquierdo, 0);
- loadScrollData(roomData->doors[indicepuertas].pantallaquecarga, true, 22, -2);
+ loadScrollData(currentRoomData->doors[indicepuertas].pantallaquecarga, true, 22, -2);
g_engine->_mouseManager->show();
oldxrejilla = 0;
oldyrejilla = 0;
@@ -718,14 +718,14 @@ int startGame() {
}
} break;
case 6: {
- zonaactual = roomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory];
+ zonaactual = currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory];
zonadestino = 27;
goToObject(zonaactual, zonadestino);
freeAnimation();
freeObject();
g_engine->_mouseManager->hide();
setSfxVolume(volumenfxizquierdo, volumenfxderecho);
- loadScrollData(roomData->doors[indicepuertas].pantallaquecarga, false, 22, 2);
+ loadScrollData(currentRoomData->doors[indicepuertas].pantallaquecarga, false, 22, 2);
g_engine->_mouseManager->show();
oldxrejilla = 0;
oldyrejilla = 0;
@@ -739,11 +739,11 @@ int startGame() {
effect(tipoefectofundido, true, NULL);
iframe = 0;
indicetray = 0;
- characterPosX = roomData->doors[indicepuertas].posxsalida - rectificacionx;
- characterPosY = roomData->doors[indicepuertas].posysalida - rectificaciony;
+ characterPosX = currentRoomData->doors[indicepuertas].posxsalida - rectificacionx;
+ characterPosY = currentRoomData->doors[indicepuertas].posysalida - rectificaciony;
trayec[indicetray].x = characterPosX;
trayec[indicetray].y = characterPosY;
- loadScreenData(roomData->doors[indicepuertas].pantallaquecarga);
+ loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
effect(tipoefectofundido, false, fondo);
g_engine->_mouseManager->show();
@@ -752,19 +752,19 @@ int startGame() {
checkMouseGrid();
} break;
case 12: {
- if (roomData->codigo != 13) {
+ if (currentRoomData->codigo != 13) {
tipoefectofundido = Random(15) + 1;
iframe = 0;
indicetray = 0;
- characterPosX = roomData->doors[indicepuertas].posxsalida - rectificacionx;
- characterPosY = roomData->doors[indicepuertas].posysalida - rectificaciony;
+ characterPosX = currentRoomData->doors[indicepuertas].posxsalida - rectificacionx;
+ characterPosY = currentRoomData->doors[indicepuertas].posysalida - rectificaciony;
trayec[indicetray].x = characterPosX;
trayec[indicetray].y = characterPosY;
freeAnimation();
freeObject();
g_engine->_mouseManager->hide();
effect(tipoefectofundido, true, NULL);
- loadScreenData(roomData->doors[indicepuertas].pantallaquecarga);
+ loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
effect(tipoefectofundido, false, fondo);
g_engine->_mouseManager->show();
oldxrejilla = 0;
@@ -772,12 +772,12 @@ int startGame() {
g_engine->_mouseManager->show();
} else {
- zonaactual = roomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory];
+ zonaactual = currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory];
goToObject(zonaactual, zonadestino);
freeAnimation();
freeObject();
g_engine->_mouseManager->hide();
- loadScrollData(roomData->doors[indicepuertas].pantallaquecarga, false, 64, 0);
+ loadScrollData(currentRoomData->doors[indicepuertas].pantallaquecarga, false, 64, 0);
g_engine->_mouseManager->show();
oldxrejilla = 0;
oldyrejilla = 0;
@@ -785,26 +785,26 @@ int startGame() {
}
} break;
case 13: {
- switch (roomData->codigo) {
+ switch (currentRoomData->codigo) {
case 12: {
- zonaactual = roomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory];
+ zonaactual = currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory];
goToObject(zonaactual, zonadestino);
freeAnimation();
freeObject();
g_engine->_mouseManager->hide();
- loadScrollData(roomData->doors[indicepuertas].pantallaquecarga, true, 64, 0);
+ loadScrollData(currentRoomData->doors[indicepuertas].pantallaquecarga, true, 64, 0);
g_engine->_mouseManager->show();
oldxrejilla = 0;
oldyrejilla = 0;
checkMouseGrid();
} break;
case 14: {
- zonaactual = roomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory];
+ zonaactual = currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory];
goToObject(zonaactual, zonadestino);
freeAnimation();
freeObject();
g_engine->_mouseManager->hide();
- loadScrollData(roomData->doors[indicepuertas].pantallaquecarga, false, 56, 0);
+ loadScrollData(currentRoomData->doors[indicepuertas].pantallaquecarga, false, 56, 0);
g_engine->_mouseManager->show();
oldxrejilla = 0;
oldyrejilla = 0;
@@ -813,19 +813,19 @@ int startGame() {
}
} break;
case 14: {
- if (roomData->codigo != 13) {
+ if (currentRoomData->codigo != 13) {
tipoefectofundido = Random(15) + 1;
iframe = 0;
indicetray = 0;
- characterPosX = roomData->doors[indicepuertas].posxsalida - rectificacionx;
- characterPosY = roomData->doors[indicepuertas].posysalida - rectificaciony;
+ characterPosX = currentRoomData->doors[indicepuertas].posxsalida - rectificacionx;
+ characterPosY = currentRoomData->doors[indicepuertas].posysalida - rectificaciony;
trayec[indicetray].x = characterPosX;
trayec[indicetray].y = characterPosY;
freeAnimation();
freeObject();
g_engine->_mouseManager->hide();
effect(tipoefectofundido, true, NULL);
- loadScreenData(roomData->doors[indicepuertas].pantallaquecarga);
+ loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
effect(tipoefectofundido, false, fondo);
g_engine->_mouseManager->show();
oldxrejilla = 0;
@@ -833,12 +833,12 @@ int startGame() {
checkMouseGrid();
} else {
- zonaactual = roomData->rejapantalla[((characterPosX + rectificacionx) / factorx)][((characterPosY + rectificaciony) / factory)];
+ zonaactual = currentRoomData->rejapantalla[((characterPosX + rectificacionx) / factorx)][((characterPosY + rectificaciony) / factory)];
goToObject(zonaactual, zonadestino);
freeAnimation();
freeObject();
g_engine->_mouseManager->hide();
- loadScrollData(roomData->doors[indicepuertas].pantallaquecarga, true, 56, 0);
+ loadScrollData(currentRoomData->doors[indicepuertas].pantallaquecarga, true, 56, 0);
g_engine->_mouseManager->show();
oldxrejilla = 0;
oldyrejilla = 0;
@@ -849,8 +849,8 @@ int startGame() {
tipoefectofundido = Random(15) + 1;
iframe = 0;
indicetray = 0;
- characterPosX = roomData->doors[indicepuertas].posxsalida - rectificacionx;
- characterPosY = roomData->doors[indicepuertas].posysalida - rectificaciony;
+ characterPosX = currentRoomData->doors[indicepuertas].posxsalida - rectificacionx;
+ characterPosY = currentRoomData->doors[indicepuertas].posysalida - rectificaciony;
trayec[indicetray].x = characterPosX;
trayec[indicetray].y = characterPosY;
freeAnimation();
@@ -858,8 +858,8 @@ int startGame() {
g_engine->_mouseManager->hide();
effect(tipoefectofundido, true, NULL);
stopVoc();
- loadScreenData(roomData->doors[indicepuertas].pantallaquecarga);
- if (libro[0] == true && roomData->banderamovimiento == true)
+ loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
+ if (libro[0] == true && currentRoomData->banderamovimiento == true)
disableSecondAnimation();
if (contadorpc > 89)
error("engine_start(): contadorpc (274)");
@@ -872,19 +872,19 @@ int startGame() {
checkMouseGrid();
} break;
case 18: {
- if (roomData->codigo != 19) {
+ if (currentRoomData->codigo != 19) {
tipoefectofundido = Random(15) + 1;
iframe = 0;
indicetray = 0;
- characterPosX = roomData->doors[indicepuertas].posxsalida - rectificacionx;
- characterPosY = roomData->doors[indicepuertas].posysalida - rectificaciony;
+ characterPosX = currentRoomData->doors[indicepuertas].posxsalida - rectificacionx;
+ characterPosY = currentRoomData->doors[indicepuertas].posysalida - rectificaciony;
trayec[indicetray].x = characterPosX;
trayec[indicetray].y = characterPosY;
freeAnimation();
freeObject();
g_engine->_mouseManager->hide();
effect(tipoefectofundido, true, NULL);
- loadScreenData(roomData->doors[indicepuertas].pantallaquecarga);
+ loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
effect(tipoefectofundido, false, fondo);
g_engine->_mouseManager->show();
oldxrejilla = 0;
@@ -892,12 +892,12 @@ int startGame() {
checkMouseGrid();
} else {
- zonaactual = roomData->rejapantalla[((characterPosX + rectificacionx) / factorx)][((characterPosY + rectificaciony) / factory)];
+ zonaactual = currentRoomData->rejapantalla[((characterPosX + rectificacionx) / factorx)][((characterPosY + rectificaciony) / factory)];
goToObject(zonaactual, zonadestino);
freeAnimation();
freeObject();
g_engine->_mouseManager->hide();
- loadScrollData(roomData->doors[indicepuertas].pantallaquecarga, true, 131, -1);
+ loadScrollData(currentRoomData->doors[indicepuertas].pantallaquecarga, true, 131, -1);
g_engine->_mouseManager->show();
oldxrejilla = 0;
oldyrejilla = 0;
@@ -905,19 +905,19 @@ int startGame() {
}
} break;
case 19: {
- if (roomData->codigo != 18) {
+ if (currentRoomData->codigo != 18) {
tipoefectofundido = Random(15) + 1;
iframe = 0;
indicetray = 0;
- characterPosX = roomData->doors[indicepuertas].posxsalida - rectificacionx;
- characterPosY = roomData->doors[indicepuertas].posysalida - rectificaciony;
+ characterPosX = currentRoomData->doors[indicepuertas].posxsalida - rectificacionx;
+ characterPosY = currentRoomData->doors[indicepuertas].posysalida - rectificaciony;
trayec[indicetray].x = characterPosX;
trayec[indicetray].y = characterPosY;
freeAnimation();
freeObject();
g_engine->_mouseManager->hide();
effect(tipoefectofundido, true, NULL);
- loadScreenData(roomData->doors[indicepuertas].pantallaquecarga);
+ loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
effect(tipoefectofundido, false, fondo);
g_engine->_mouseManager->show();
oldxrejilla = 0;
@@ -925,12 +925,12 @@ int startGame() {
checkMouseGrid();
} else {
- zonaactual = roomData->rejapantalla[((characterPosX + rectificacionx) / factorx)][((characterPosY + rectificaciony) / factory)];
+ zonaactual = currentRoomData->rejapantalla[((characterPosX + rectificacionx) / factorx)][((characterPosY + rectificaciony) / factory)];
goToObject(zonaactual, zonadestino);
freeAnimation();
freeObject();
g_engine->_mouseManager->hide();
- loadScrollData(roomData->doors[indicepuertas].pantallaquecarga, false, 131, 1);
+ loadScrollData(currentRoomData->doors[indicepuertas].pantallaquecarga, false, 131, 1);
g_engine->_mouseManager->show();
oldxrejilla = 0;
oldyrejilla = 0;
@@ -941,8 +941,8 @@ int startGame() {
tipoefectofundido = Random(15) + 1;
iframe = 0;
indicetray = 0;
- characterPosX = roomData->doors[indicepuertas].posxsalida - rectificacionx;
- characterPosY = roomData->doors[indicepuertas].posysalida - rectificaciony;
+ characterPosX = currentRoomData->doors[indicepuertas].posxsalida - rectificacionx;
+ characterPosY = currentRoomData->doors[indicepuertas].posysalida - rectificaciony;
trayec[indicetray].x = characterPosX;
trayec[indicetray].y = characterPosY;
freeAnimation();
@@ -950,25 +950,25 @@ int startGame() {
g_engine->_mouseManager->hide();
effect(tipoefectofundido, true, NULL);
stopVoc();
- loadScreenData(roomData->doors[indicepuertas].pantallaquecarga);
+ loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
switch (hornacina[0][hornacina[0][3]]) {
case 0:
- roomData->indexadoobjetos[9]->objectName = "HORNACINA";
+ currentRoomData->indexadoobjetos[9]->objectName = "HORNACINA";
break;
case 561:
- roomData->indexadoobjetos[9]->objectName = "ESTATUA DIVINA";
+ currentRoomData->indexadoobjetos[9]->objectName = "ESTATUA DIVINA";
break;
case 563:
- roomData->indexadoobjetos[9]->objectName = "MANUAL DE ALFARERO";
+ currentRoomData->indexadoobjetos[9]->objectName = "MANUAL DE ALFARERO";
break;
case 615:
- roomData->indexadoobjetos[9]->objectName = "ESTATUA GROTESCA";
+ currentRoomData->indexadoobjetos[9]->objectName = "ESTATUA GROTESCA";
break;
}
if (contadorpc > 89)
error("engine_start(): contadorpc (274)");
setSfxVolume(volumenfxizquierdo, volumenfxderecho);
- if (roomData->codigo == 4)
+ if (currentRoomData->codigo == 4)
loadVoc("GOTA", 140972, 1029);
effect(tipoefectofundido, false, fondo);
contadorpc = contadorpc2;
@@ -981,8 +981,8 @@ int startGame() {
tipoefectofundido = Random(15) + 1;
iframe = 0;
indicetray = 0;
- characterPosX = roomData->doors[indicepuertas].posxsalida - rectificacionx;
- characterPosY = roomData->doors[indicepuertas].posysalida - rectificaciony;
+ characterPosX = currentRoomData->doors[indicepuertas].posxsalida - rectificacionx;
+ characterPosY = currentRoomData->doors[indicepuertas].posysalida - rectificaciony;
trayec[indicetray].x = characterPosX;
trayec[indicetray].y = characterPosY;
freeAnimation();
@@ -990,46 +990,46 @@ int startGame() {
g_engine->_mouseManager->hide();
effect(tipoefectofundido, true, NULL);
stopVoc();
- loadScreenData(roomData->doors[indicepuertas].pantallaquecarga);
+ loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
switch (hornacina[1][hornacina[1][3]]) {
case 0:
- roomData->indexadoobjetos[8]->objectName = "HORNACINA";
+ currentRoomData->indexadoobjetos[8]->objectName = "HORNACINA";
break;
case 561:
- roomData->indexadoobjetos[8]->objectName = "ESTATUA DIVINA";
+ currentRoomData->indexadoobjetos[8]->objectName = "ESTATUA DIVINA";
break;
case 615:
- roomData->indexadoobjetos[8]->objectName = "ESTATUA GROTESCA";
+ currentRoomData->indexadoobjetos[8]->objectName = "ESTATUA GROTESCA";
break;
case 622:
- roomData->indexadoobjetos[8]->objectName = "PARED";
+ currentRoomData->indexadoobjetos[8]->objectName = "PARED";
break;
case 623:
- roomData->indexadoobjetos[8]->objectName = "TORNO";
+ currentRoomData->indexadoobjetos[8]->objectName = "TORNO";
break;
}
if (contadorpc > 89)
error("engine_start(): contadorpc (274)");
setSfxVolume(volumenfxizquierdo, volumenfxderecho);
if (trampa_puesta) {
- roomData->banderamovimiento = true;
- loadAnimation(roomData->nombremovto);
+ currentRoomData->banderamovimiento = true;
+ loadAnimation(currentRoomData->nombremovto);
iframe2 = 0;
indicetray2 = 1;
- roomData->tray2[indicetray2 - 1].x = 214 - 15;
- roomData->tray2[indicetray2 - 1].y = 115 - 42;
- animado.dir = roomData->dir2[indicetray2 - 1];
- animado.posx = roomData->tray2[indicetray2 - 1].x;
- animado.posy = roomData->tray2[indicetray2 - 1].y;
+ currentRoomData->tray2[indicetray2 - 1].x = 214 - 15;
+ currentRoomData->tray2[indicetray2 - 1].y = 115 - 42;
+ animado.dir = currentRoomData->dir2[indicetray2 - 1];
+ animado.posx = currentRoomData->tray2[indicetray2 - 1].x;
+ animado.posy = currentRoomData->tray2[indicetray2 - 1].y;
animado.profundidad = 14;
for (iaux = 0; iaux < maxrejax; iaux++)
for (iaux2 = 0; iaux2 < maxrejay; iaux2++) {
if (rejamascaramovto[iaux][iaux2] > 0){
- roomData->rejapantalla[oldposx + iaux][oldposy + iaux2] = rejamascaramovto[iaux][iaux2];
+ currentRoomData->rejapantalla[oldposx + iaux][oldposy + iaux2] = rejamascaramovto[iaux][iaux2];
}
if (rejamascararaton[iaux][iaux2] > 0)
- roomData->mouseGrid[oldposx + iaux][oldposy + iaux2] = rejamascararaton[iaux][iaux2];
+ currentRoomData->mouseGrid[oldposx + iaux][oldposy + iaux2] = rejamascararaton[iaux][iaux2];
}
assembleScreen();
}
@@ -1049,8 +1049,8 @@ int startGame() {
tipoefectofundido = Random(15) + 1;
iframe = 0;
indicetray = 0;
- characterPosX = roomData->doors[indicepuertas].posxsalida - rectificacionx;
- characterPosY = roomData->doors[indicepuertas].posysalida - rectificaciony;
+ characterPosX = currentRoomData->doors[indicepuertas].posxsalida - rectificacionx;
+ characterPosY = currentRoomData->doors[indicepuertas].posysalida - rectificaciony;
trayec[indicetray].x = characterPosX;
trayec[indicetray].y = characterPosY;
freeAnimation();
@@ -1058,11 +1058,11 @@ int startGame() {
g_engine->_mouseManager->hide();
effect(tipoefectofundido, true, NULL);
stopVoc();
- loadScreenData(roomData->doors[indicepuertas].pantallaquecarga);
+ loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
if (contadorpc > 89)
error("engine_start(): contadorpc (274)");
setSfxVolume(volumenfxizquierdo, volumenfxderecho);
- switch (roomData->codigo) {
+ switch (currentRoomData->codigo) {
case 4:
loadVoc("GOTA", 140972, 1029);
break;
@@ -1137,7 +1137,7 @@ int startGame() {
restoreMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
if (contadorpc2 > 43)
_exit(274);
- // sacrifice();
+ sacrifice();
clear();
loadObjects();
loadPalette("SEGUNDA");
@@ -1166,14 +1166,14 @@ int startGame() {
// Debug graphics
{
- g_engine->_graphics->euroText(Common::String::format("Room: %d", roomNumber), 0, 0, 220, Graphics::kTextAlignLeft);
+ g_engine->_graphics->euroText(Common::String::format("Room: %d", currentRoomNumber), 0, 0, 220, Graphics::kTextAlignLeft);
// g_engine->_mouseManager->printPos(xraton, yraton, 220, 0);
// printPos(characterPosX, characterPosY, 220, 10, "CharPos");
if (showMouseGrid) {
- drawMouseGrid(roomData);
+ drawMouseGrid(currentRoomData);
}
if (showScreenGrid) {
- drawScreenGrid(roomData);
+ drawScreenGrid(currentRoomData);
}
if (showGameGrid) {
drawGrid();
diff --git a/engines/tot/graphics.cpp b/engines/tot/graphics.cpp
index cf013c7ff9f..35d38356e1b 100644
--- a/engines/tot/graphics.cpp
+++ b/engines/tot/graphics.cpp
@@ -183,8 +183,6 @@ void loadPalette(Common::String paletteName) {
void effect(byte numeroefecto, boolean pasaranegro, byte *pantalla2) {
int i1, i2, i3, j1, j2, j3;
- byte oldcolor;
- palette palpaso;
bool enabled = false;
// numeroefecto = 1;
@@ -923,10 +921,10 @@ void copyPalette(palette from, palette to) {
Common::copy(from, from + 768, to);
}
-void loadAnimationIntoBuffer(Common::SeekableReadStream *stream, byte *&buf, int sizeanimado) {
- buf = (byte *)malloc(sizeanimado);
- stream->read(buf, sizeanimado);
- Common::copy(buf, buf + sizeanimado, pasoanimado);
+void loadAnimationIntoBuffer(Common::SeekableReadStream *stream, byte *&buf, int animSize) {
+ buf = (byte *)malloc(animSize);
+ stream->read(buf, animSize);
+ Common::copy(buf, buf + animSize, pasoanimado);
}
} // End of namespace Tot
diff --git a/engines/tot/playanim.cpp b/engines/tot/playanim.cpp
index 338872b3e05..547e6b7adf5 100644
--- a/engines/tot/playanim.cpp
+++ b/engines/tot/playanim.cpp
@@ -148,10 +148,12 @@ Common::String nombreficherofoto;
Common::String nombrepersonaje;
-char *encriptado;
+// Text decryption key
+Common::String decryptionKey;
+
uint hornacina[2][4];
-RoomFileRegister *roomData;
+RoomFileRegister *currentRoomData;
InvItemRegister regobj;
@@ -199,7 +201,6 @@ uint sizeframe,
sizeanimado,
segpasoanimado,
ofspasoanimado,
- _handpantalla,
segfondo,
offfondo;
@@ -225,7 +226,7 @@ byte *characterDirtyRect;
byte *handpantalla;
-uint roomNumber;
+uint currentRoomNumber;
boolean isLoadingFromLauncher;
@@ -339,7 +340,7 @@ void initializeScreenFile() {
if (!roomFile.open(Common::Path("PANTALLA.DAT"))) {
error("Error opening room files: ioresult (320)");
}
- int roomNumber = 0;
+
int64 fileSize = roomFile.size();
delete (rooms);
@@ -857,7 +858,7 @@ void resetGameState() {
void initPlayAnim() {
debug("initplayanim!");
isLoadingFromLauncher = false;
- encriptado = "23313212133122121312132132312312122132322131221322222112121"
+ decryptionKey = "23313212133122121312132132312312122132322131221322222112121"
"32121121212112111212112333131232323213222132123211213221231"
"32132213232333333213132132132322113212132121322123121232332"
"23123221322213233221112312231221233232122332211112233122321"
diff --git a/engines/tot/playanim.h b/engines/tot/playanim.h
index b754dd2b55c..7470cb41fc8 100644
--- a/engines/tot/playanim.h
+++ b/engines/tot/playanim.h
@@ -507,11 +507,11 @@ extern Common::String nombreficherofoto;
*/
extern Common::String nombrepersonaje;
-// Text decryption key
-extern char *encriptado;
+extern Common::String decryptionKey;
+
extern uint hornacina[2][4];
-extern RoomFileRegister *roomData;
+extern RoomFileRegister *currentRoomData;
extern InvItemRegister regobj;
/**
@@ -562,8 +562,10 @@ extern byte rejamascaramovto[10][10];
*/
extern byte rejamascararaton[10][10];
-extern boolean completadalista1, completadalista2,
- lista1, lista2;
+extern boolean completadalista1,
+ completadalista2,
+ lista1, // whether we've been given list 1
+ lista2; // whether we've been given list 2
extern boolean primera[maxpersonajes],
@@ -589,7 +591,6 @@ extern uint sizeframe,
sizeanimado,
segpasoanimado,
ofspasoanimado,
- _handpantalla,
segfondo,
offfondo;
/**
@@ -642,7 +643,7 @@ extern byte *characterDirtyRect;
*/
extern byte *handpantalla;
-extern uint roomNumber;
+extern uint currentRoomNumber;
extern boolean isLoadingFromLauncher;
diff --git a/engines/tot/routines.cpp b/engines/tot/routines.cpp
index 01b5207b093..a7db8b47785 100644
--- a/engines/tot/routines.cpp
+++ b/engines/tot/routines.cpp
@@ -52,12 +52,9 @@ void runaroundRed() {
{282, 52}, {282, 52}, {282, 52}
};
- byte iframe2seg;
- uint anchoaniseg, altoaniseg,
- itrayseg, longtrayseg;
- boolean salir_del_bucle;
+ uint itrayseg, longtrayseg;
- salir_del_bucle = false;
+ boolean exitLoop = false;
loadDevil();
itrayseg = 0;
longtrayseg = 82;
@@ -67,7 +64,7 @@ void runaroundRed() {
g_engine->_chrono->updateChrono();
if (tocapintar) {
if (itrayseg == longtrayseg)
- salir_del_bucle = true;
+ exitLoop = true;
itrayseg += 1;
if (iframe2 >= secondaryAnimationFrameCount - 1)
iframe2 = 0;
@@ -103,7 +100,7 @@ void runaroundRed() {
saltospal += 1;
g_engine->_screen->update();
}
- } while (!salir_del_bucle && !g_engine->shouldQuit());
+ } while (!exitLoop && !g_engine->shouldQuit());
freeAnimation();
handPantallaToFondo();
assembleScreen();
@@ -114,26 +111,26 @@ void updateMovementCells() {
uint j1arm, j2arm;
byte i1arm, i2arm;
- j1arm = (roomData->tray2[indicetray2 - 1].x / factorx) + 1;
- j2arm = (roomData->tray2[indicetray2 - 1].y / factory) + 1;
+ j1arm = (currentRoomData->tray2[indicetray2 - 1].x / factorx) + 1;
+ j2arm = (currentRoomData->tray2[indicetray2 - 1].y / factory) + 1;
if ((oldposx != j1arm) || (oldposy != j2arm)) {
for (i1arm = 0; i1arm < maxrejax; i1arm++)
for (i2arm = 0; i2arm < maxrejay; i2arm++) {
- roomData->rejapantalla[oldposx + i1arm][oldposy + i2arm] = rejafondomovto[i1arm][i2arm];
- roomData->mouseGrid[oldposx + i1arm][oldposy + i2arm] = rejafondoraton[i1arm][i2arm];
+ currentRoomData->rejapantalla[oldposx + i1arm][oldposy + i2arm] = rejafondomovto[i1arm][i2arm];
+ currentRoomData->mouseGrid[oldposx + i1arm][oldposy + i2arm] = rejafondoraton[i1arm][i2arm];
}
for (i1arm = 0; i1arm < maxrejax; i1arm++)
for (i2arm = 0; i2arm < maxrejay; i2arm++) {
- rejafondomovto[i1arm][i2arm] = roomData->rejapantalla[j1arm + i1arm][j2arm + i2arm];
+ rejafondomovto[i1arm][i2arm] = currentRoomData->rejapantalla[j1arm + i1arm][j2arm + i2arm];
if (rejamascaramovto[i1arm][i2arm] > 0)
- roomData->rejapantalla[j1arm + i1arm][j2arm + i2arm] = rejamascaramovto[i1arm][i2arm];
+ currentRoomData->rejapantalla[j1arm + i1arm][j2arm + i2arm] = rejamascaramovto[i1arm][i2arm];
- rejafondoraton[i1arm][i2arm] = roomData->mouseGrid[j1arm + i1arm][j2arm + i2arm];
+ rejafondoraton[i1arm][i2arm] = currentRoomData->mouseGrid[j1arm + i1arm][j2arm + i2arm];
if (rejamascararaton[i1arm][i2arm] > 0)
- roomData->mouseGrid[j1arm + i1arm][j2arm + i2arm] = rejamascararaton[i1arm][i2arm];
+ currentRoomData->mouseGrid[j1arm + i1arm][j2arm + i2arm] = rejamascararaton[i1arm][i2arm];
}
oldposx = j1arm;
@@ -243,9 +240,6 @@ static void overlayObject() {
(profundidad[indice].posy < posfondoy2) &&
(profundidad[indice].posy2 > posfondoy)
) {
- uint16 w = READ_LE_UINT16(objetos[indice]);
- uint16 h = READ_LE_UINT16(objetos[indice] + 2);
-
assembleImage(objetos[indice], profundidad[indice].posx, profundidad[indice].posy);
}
}
@@ -288,8 +282,8 @@ void drawMainCharacter() {
// drawRect(225, posfondox, posfondoy, posfondox2, posfondoy2);
- uint16 wImg = READ_LE_UINT16(pasoframe);
- uint16 hImg = READ_LE_UINT16(pasoframe + 2);
+ // uint16 wImg = READ_LE_UINT16(pasoframe);
+ // uint16 hImg = READ_LE_UINT16(pasoframe + 2);
drawPos(xframe2, yframe2, 218);
// draw patch of characters sprite
@@ -305,8 +299,9 @@ void sprites(boolean pintapersonaje) {
posfondox = characterPosX - 3;
posfondoy = characterPosY - 3;
if (animacion2) {
- if (roomData->longtray2 > 1)
+ if (currentRoomData->longtray2 > 1) {
updateMovementCells();
+ }
if (tocapintar2) {
if (peteractivo && !g_engine->_sound->isVocPlaying()) {
iframe2 = 0;
@@ -325,10 +320,12 @@ void sprites(boolean pintapersonaje) {
(animado.posy < (characterPosY + pasoframeH + 4))) &&
((animado.posy + pasoanimadoH + 1) > posfondoy)) { // Character is in the area of the animation
- if (animado.posx < characterPosX)
+ if (animado.posx < characterPosX) {
posfondox = animado.posx - 3;
- if (animado.posy < characterPosY)
+ }
+ if (animado.posy < characterPosY) {
posfondoy = animado.posy - 3;
+ }
uint16 patchW = pasoanimadoW + pasoframeW + 6;
@@ -364,8 +361,8 @@ void sprites(boolean pintapersonaje) {
posfondox = animado.posx - 3;
posfondoy = animado.posy - 3;
- uint16 pasoanimadoW = READ_LE_UINT16(pasoanimado) + 6;
- uint16 pasoanimadoH = READ_LE_UINT16(pasoanimado + 2) + 6;
+ pasoanimadoW = READ_LE_UINT16(pasoanimado) + 6;
+ pasoanimadoH = READ_LE_UINT16(pasoanimado + 2) + 6;
characterDirtyRect = (byte *)malloc((pasoanimadoW + 1) * (pasoanimadoH + 1) + 4);
WRITE_LE_UINT16(characterDirtyRect, pasoanimadoW);
@@ -447,7 +444,7 @@ void animatedSequence(uint numSequence) {
uint16 tamsecani;
uint animx, animy;
int guadaxframe;
- byte numframessec, pasocode;
+ byte numframessec;
byte *animptr;
switch (numSequence) {
@@ -455,14 +452,13 @@ void animatedSequence(uint numSequence) {
guadaxframe = characterPosX;
characterPosX = 3;
if (!animationFile.open("POZO01.DAT")) {
- boolean exists = animationFile.exists("POZOATR.DAT");
error("277");
}
animx = 127;
animy = 70;
tamsecani = animationFile.readUint16LE();
numframessec = animationFile.readByte();
- pasocode = animationFile.readByte();
+ animationFile.readByte();
animptr = (byte *)malloc(tamsecani);
for (indicerep = 1; indicerep <= 3; indicerep++) {
playVoc("POZO", 180395, 6034);
@@ -471,13 +467,13 @@ void animatedSequence(uint numSequence) {
emptyLoop();
tocapintar = false;
if (tocapintar2) {
- if (indicetray2 >= roomData->longtray2)
+ if (indicetray2 >= currentRoomData->longtray2)
indicetray2 = 1;
else
indicetray2 += 1;
- animado.posx = roomData->tray2[indicetray2 - 1].x;
- animado.posy = roomData->tray2[indicetray2 - 1].y;
- animado.dir = roomData->dir2[indicetray2 - 1];
+ animado.posx = currentRoomData->tray2[indicetray2 - 1].x;
+ animado.posy = currentRoomData->tray2[indicetray2 - 1].y;
+ animado.dir = currentRoomData->dir2[indicetray2 - 1];
if (iframe2 >= secondaryAnimationFrameCount - 1)
iframe2 = 0;
else
@@ -496,7 +492,6 @@ void animatedSequence(uint numSequence) {
} break;
case 2: {
if (!animationFile.open("POZOATR.DAT")) {
- boolean exists = animationFile.exists("POZOATR.DAT");
error("277");
}
animx = 127;
@@ -506,7 +501,7 @@ void animatedSequence(uint numSequence) {
tamsecani = animationFile.readUint16LE();
numframessec = animationFile.readByte();
- pasocode = animationFile.readByte();
+ animationFile.readByte();
animptr = (byte *)malloc(tamsecani);
for (indicerep = 1; indicerep <= 3; indicerep++) {
playVoc("POZO", 180395, 6034);
@@ -515,13 +510,13 @@ void animatedSequence(uint numSequence) {
emptyLoop();
tocapintar = false;
if (tocapintar2) {
- if (indicetray2 >= roomData->longtray2)
+ if (indicetray2 >= currentRoomData->longtray2)
indicetray2 = 1;
else
indicetray2 += 1;
- animado.posx = roomData->tray2[indicetray2 - 1].x;
- animado.posy = roomData->tray2[indicetray2 - 1].y;
- animado.dir = roomData->dir2[indicetray2 - 1];
+ animado.posx = currentRoomData->tray2[indicetray2 - 1].x;
+ animado.posy = currentRoomData->tray2[indicetray2 - 1].y;
+ animado.dir = currentRoomData->dir2[indicetray2 - 1];
if (iframe2 >= secondaryAnimationFrameCount - 1)
iframe2 = 0;
else
@@ -551,20 +546,20 @@ void animatedSequence(uint numSequence) {
tamsecani = animationFile.readUint16LE();
numframessec = animationFile.readByte();
- pasocode = animationFile.readByte();
+ animationFile.readByte();
animptr = (byte *)malloc(tamsecani);
indiceani = 0;
do {
emptyLoop();
tocapintar = false;
if (tocapintar2) {
- if (indicetray2 >= roomData->longtray2)
+ if (indicetray2 >= currentRoomData->longtray2)
indicetray2 = 1;
else
indicetray2 += 1;
- animado.posx = roomData->tray2[indicetray2 - 1].x;
- animado.posy = roomData->tray2[indicetray2 - 1].y;
- animado.dir = roomData->dir2[indicetray2 - 1];
+ animado.posx = currentRoomData->tray2[indicetray2 - 1].x;
+ animado.posy = currentRoomData->tray2[indicetray2 - 1].y;
+ animado.dir = currentRoomData->dir2[indicetray2 - 1];
if (iframe2 >= secondaryAnimationFrameCount - 1)
iframe2 = 0;
else
@@ -594,7 +589,7 @@ void animatedSequence(uint numSequence) {
tamsecani = animationFile.readUint16LE();
numframessec = animationFile.readByte();
- pasocode = animationFile.readByte();
+ animationFile.readByte();
animptr = (byte *)malloc(tamsecani);
for (indiceani = 1; indiceani <= 31; indiceani++) {
@@ -654,7 +649,7 @@ void animatedSequence(uint numSequence) {
animy = 44;
tamsecani = animationFile.readUint16LE();
numframessec = animationFile.readByte();
- pasocode = animationFile.readByte();
+ animationFile.readByte();
animptr = (byte *)malloc(tamsecani);
for (indiceani = 1; indiceani <= 8; indiceani++) {
animationFile.read(animptr, tamsecani);
@@ -694,13 +689,13 @@ void animatedSequence(uint numSequence) {
sprites(true);
} break;
case 6: {
- roomData->banderamovimiento = false;
+ currentRoomData->banderamovimiento = false;
if (!animationFile.open("AZCCOG.DAT")) {
error("277");
}
tamsecani = animationFile.readUint16LE();
numframessec = animationFile.readByte();
- pasocode = animationFile.readByte();
+ animationFile.readByte();
objetos[6] = (byte *)malloc(tamsecani);
// objetos[7] = ptr(segfondo, (offfondo + 44900));
profundidad[6].posx = animado.posx + 5;
@@ -733,7 +728,7 @@ void animatedSequence(uint numSequence) {
animationFile.close();
stopVoc();
objetos[6] = NULL;
- roomData->banderamovimiento = true;
+ currentRoomData->banderamovimiento = true;
} break;
}
}
@@ -817,28 +812,26 @@ RoomFileRegister* readScreenDataFile(Common::SeekableReadStream *screenDataFile)
void loadScreenData(uint screenNumber) {
debug("Opening screen %d", screenNumber);
- roomNumber = screenNumber;
+ currentRoomNumber = screenNumber;
rooms->seek(screenNumber * roomRegSize, SEEK_SET);
clearScreenData();
- roomData = readScreenDataFile(rooms);
+ currentRoomData = readScreenDataFile(rooms);
loadScreen();
for (int i = 0; i < 15; i++) {
- RoomBitmapRegister &bitmap = roomData->bitmapasociados[i];
+ RoomBitmapRegister &bitmap = currentRoomData->bitmapasociados[i];
if (bitmap.tambitmap > 0) {
- debug("-----------------------------");
- debug("loading bitmap %d, which has a depth = %d, pointer =%d", i, bitmap.profund, bitmap.puntbitmap);
loadItem(bitmap.coordx, bitmap.coordy, bitmap.tambitmap, bitmap.puntbitmap, bitmap.profund);
}
}
- if (roomData->banderamovimiento && roomData->codigo != 24) {
- loadAnimation(roomData->nombremovto);
+ if (currentRoomData->banderamovimiento && currentRoomData->codigo != 24) {
+ loadAnimation(currentRoomData->nombremovto);
iframe2 = 0;
indicetray2 = 1;
- animado.dir = roomData->dir2[indicetray2 - 1];
- animado.posx = roomData->tray2[indicetray2 - 1].x;
- animado.posy = roomData->tray2[indicetray2 - 1].y;
- if (roomData->nombremovto == "FUENTE01")
+ animado.dir = currentRoomData->dir2[indicetray2 - 1];
+ animado.posx = currentRoomData->tray2[indicetray2 - 1].x;
+ animado.posy = currentRoomData->tray2[indicetray2 - 1].y;
+ if (currentRoomData->nombremovto == "FUENTE01")
animado.profundidad = 0;
else {
updateSecondaryAnimationDepth();
@@ -846,12 +839,12 @@ void loadScreenData(uint screenNumber) {
for (int i = 0; i < maxrejax; i++)
for (int j = 0; j < maxrejay; j++) {
if (rejamascaramovto[i][j] > 0)
- roomData->rejapantalla[oldposx + i][oldposy + j] = rejamascaramovto[i][j];
+ currentRoomData->rejapantalla[oldposx + i][oldposy + j] = rejamascaramovto[i][j];
if (rejamascararaton[i][j] > 0)
- roomData->mouseGrid[oldposx + i][oldposy + j] = rejamascararaton[i][j];
+ currentRoomData->mouseGrid[oldposx + i][oldposy + j] = rejamascararaton[i][j];
}
} else
- roomData->banderamovimiento = false;
+ currentRoomData->banderamovimiento = false;
updateMainCharacterDepth();
assembleScreen();
@@ -922,7 +915,7 @@ void calculateTrajectory(uint finalx, uint finaly) {
}
void lookInventoryObject(byte numeroobjeto) {
- byte tipofundido, yaux;
+ byte yaux;
Common::String cadenadescripcion;
boolean kkaux;
@@ -960,7 +953,7 @@ void lookInventoryObject(byte numeroobjeto) {
reghpt = readVerbRegister(regobj.beforeUseTextRef);
cadenadescripcion = reghpt.cadenatext;
for (yaux = 0; yaux < reghpt.cadenatext.size(); yaux++)
- cadenadescripcion.setChar(encriptado[yaux] ^ reghpt.cadenatext[yaux], yaux);
+ cadenadescripcion.setChar(decryptionKey[yaux] ^ reghpt.cadenatext[yaux], yaux);
hipercadena(cadenadescripcion, 60, 15, 33, 255, 0);
verb.close();
} else {
@@ -974,7 +967,7 @@ void lookInventoryObject(byte numeroobjeto) {
reghpt = readVerbRegister(regobj.afterUseTextRef);
cadenadescripcion = reghpt.cadenatext;
for (yaux = 0; yaux < reghpt.cadenatext.size(); yaux++)
- cadenadescripcion.setChar(encriptado[yaux] ^ reghpt.cadenatext[yaux], yaux);
+ cadenadescripcion.setChar(decryptionKey[yaux] ^ reghpt.cadenatext[yaux], yaux);
hipercadena(cadenadescripcion, 60, 15, 33, 255, 0);
verb.close();
} else {
@@ -996,7 +989,6 @@ void lookInventoryObject(byte numeroobjeto) {
void useInventoryObjectWithInventoryObject(uint numobj1, uint numobj2) {
byte indicemochila, indobj1, indobj2;
- uint tamobjaux;
debug("Reading item register %d", numobj1);
readItemRegister(invItemData, numobj1, regobj);
@@ -1076,7 +1068,7 @@ void calculateRoute(byte zona1, byte zona2, boolean extraCorrection, boolean zon
Common::Point point;
do {
pasos += 1;
- point = roomData->trayectories[zona1 - 1][zona2 - 1][pasos - 1];
+ point = currentRoomData->trayectories[zona1 - 1][zona2 - 1][pasos - 1];
if (point.x < (rectificacionx + 3))
mainRoute[pasos].x = 3;
@@ -1103,7 +1095,7 @@ void calculateRoute(byte zona1, byte zona2, boolean extraCorrection, boolean zon
pasos -= 1;
}
if(extraCorrection) {
- switch (roomData->codigo) {
+ switch (currentRoomData->codigo) {
case 5:
if (zona2 == 27)
pasos += 1;
@@ -1133,13 +1125,13 @@ void goToObject(byte zona1, byte zona2) {
contadorpc2 = contadorpc;
for(int indicepaso = 0; indicepaso < 5; indicepaso++) {
- if (roomData->doors[indicepaso].codigopuerta == zona2) {
+ if (currentRoomData->doors[indicepaso].codigopuerta == zona2) {
zonavedada = true;
break;
}
}
- if (roomData->codigo == 21 && roomData->banderamovimiento) {
+ if (currentRoomData->codigo == 21 && currentRoomData->banderamovimiento) {
if ((zona2 >= 1 && zona2 <= 5) ||
(zona2 >= 9 && zona2 <= 13) ||
(zona2 >= 18 && zona2 <= 21) ||
@@ -1169,7 +1161,7 @@ void goToObject(byte zona1, byte zona2) {
advanceAnimations(zonavedada, false);
g_engine->_screen->update();
g_system->delayMillis(10);
- } while (!xframe2 == 0);
+ } while (xframe2 != 0);
iframe = 0;
sprites(true);
@@ -1228,12 +1220,12 @@ void updateMainCharacterDepth() {
void advanceAnimations(boolean zonavedada, boolean animateMouse) {
if (tocapintar) {
- if (roomData->banderamovimiento && tocapintar2) {
+ if (currentRoomData->banderamovimiento && tocapintar2) {
if (peteractivo && (Random(100) == 1) && !g_engine->_sound->isVocPlaying() && caramelos[0] == false) {
debug("Playing tos");
playVoc("TOS", 258006, 14044);
}
- if (indicetray2 >= roomData->longtray2)
+ if (indicetray2 >= currentRoomData->longtray2)
indicetray2 = 1;
else
indicetray2 += 1;
@@ -1241,10 +1233,10 @@ void advanceAnimations(boolean zonavedada, boolean animateMouse) {
iframe2 = 0;
else
iframe2 ++;
- animado.posx = roomData->tray2[indicetray2 - 1].x;
- animado.posy = roomData->tray2[indicetray2 - 1].y;
- animado.dir = roomData->dir2[indicetray2 - 1];
- switch (roomData->codigo) {
+ animado.posx = currentRoomData->tray2[indicetray2 - 1].x;
+ animado.posy = currentRoomData->tray2[indicetray2 - 1].y;
+ animado.dir = currentRoomData->dir2[indicetray2 - 1];
+ switch (currentRoomData->codigo) {
case 23:
animado.profundidad = 0;
break;
@@ -1333,13 +1325,13 @@ void advanceAnimations(boolean zonavedada, boolean animateMouse) {
}
tocapintar = false;
- if (roomData->banderapaleta && saltospal >= 4) {
+ if (currentRoomData->banderapaleta && saltospal >= 4) {
saltospal = 0;
if (movidapaleta > 6)
movidapaleta = 0;
else
movidapaleta += 1;
- if (roomData->codigo == 4 && movidapaleta == 4)
+ if (currentRoomData->codigo == 4 && movidapaleta == 4)
pitavocmem();
updatePalette(movidapaleta);
} else {
@@ -1360,7 +1352,7 @@ void animateGive(uint cogedir, uint cogealt) {
// Must add 1 to i because the original game uses 1-based indices
iframe = 15 + 6 + 5 + cogealt * 10 - (i + 1);
- if (roomData->banderapaleta && saltospal >= 4) {
+ if (currentRoomData->banderapaleta && saltospal >= 4) {
saltospal = 0;
if (movidapaleta > 6)
movidapaleta = 0;
@@ -1382,7 +1374,7 @@ void animatePickup1(uint cogedir, uint cogealt) {
tocapintar = false;
iframe = 15 + cogealt * 10 + (i + 1);
- if (roomData->banderapaleta && saltospal >= 4) {
+ if (currentRoomData->banderapaleta && saltospal >= 4) {
saltospal = 0;
if (movidapaleta > 6)
movidapaleta = 0;
@@ -1399,7 +1391,6 @@ void animatePickup1(uint cogedir, uint cogealt) {
// Lean back after pick
void animatePickup2(uint cogedir, uint cogealt) {
direccionmovimiento = cogedir;
- ChronoManager *thisChrono = new ChronoManager();
for (uint i = 0; i < 5; i++) {
emptyLoop();
@@ -1407,7 +1398,7 @@ void animatePickup2(uint cogedir, uint cogealt) {
iframe = 15 + 5 + cogealt * 10 + (i + 1);
- if (roomData->banderapaleta && saltospal >= 4) {
+ if (currentRoomData->banderapaleta && saltospal >= 4) {
saltospal = 0;
if (movidapaleta > 6)
movidapaleta = 0;
@@ -1433,7 +1424,7 @@ void animateOpen2(uint cogedir, uint cogealt) {
tocapintar = false;
iframe = 15 + 6 + cogealt * 10 - (i + 1);
- if (roomData->banderapaleta && saltospal >= 4) {
+ if (currentRoomData->banderapaleta && saltospal >= 4) {
saltospal = 0;
if (movidapaleta > 6)
movidapaleta = 0;
@@ -1470,7 +1461,7 @@ void animateBat() {
itrayseg, longtrayseg, xseg, yseg, profseg, dirseg;
boolean salir_del_bucle = false;
- if (roomData->banderamovimiento) {
+ if (currentRoomData->banderamovimiento) {
iframe2seg = iframe2;
xseg = animado.posx;
yseg = animado.posy;
@@ -1522,11 +1513,11 @@ void animateBat() {
stopVoc();
freeAnimation();
- if (roomData->banderamovimiento) {
+ if (currentRoomData->banderamovimiento) {
anchoanimado = anchoaniseg;
altoanimado = altoaniseg;
setRoomTrajectories(altoanimado, anchoanimado, RESTORE, false);
- loadAnimation(roomData->nombremovto);
+ loadAnimation(currentRoomData->nombremovto);
iframe2 = iframe2seg;
animado.posx = xseg;
animado.posy = yseg;
@@ -1549,7 +1540,7 @@ void alcoveAnimation(byte direccionhn, int32 dibujo) {
uint posdibhn, indicehn;
int incrementohn;
- if (roomData->codigo == 24) {
+ if (currentRoomData->codigo == 24) {
objetos[1] = (byte *)malloc(3660);
readBitmap(1382874, objetos[1], 3652, 319);
uint16 object2Width = READ_LE_UINT16(objetos[1]);
@@ -1575,7 +1566,7 @@ void alcoveAnimation(byte direccionhn, int32 dibujo) {
Common::copy(objetos[0] + 4, objetos[0] + 4 + (888 - 4), fondo + 44900 + 892);
} break;
}
- uint16 object1Width = READ_LE_UINT16(objetos[0]);
+ // uint16 object1Width = READ_LE_UINT16(objetos[0]);
uint16 object1Height = READ_LE_UINT16(objetos[0] + 2);
@@ -1596,7 +1587,7 @@ void alcoveAnimation(byte direccionhn, int32 dibujo) {
assembleScreen();
drawScreen(fondo);
- if (roomData->codigo == 24) {
+ if (currentRoomData->codigo == 24) {
free(objetos[1]);
objetos[1] = NULL;
}
@@ -1608,24 +1599,24 @@ void pickupScreenObject() {
uint mouseX = (pulsax + 7) / factorx;
uint mouseY = (pulsay + 7) / factory;
- screenObject = roomData->indexadoobjetos[roomData->mouseGrid[mouseX][mouseY]]->indicefichero;
+ screenObject = currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[mouseX][mouseY]]->indicefichero;
if (screenObject == 0)
return;
readItemRegister(screenObject);
goToObject(
- roomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory],
- roomData->rejapantalla[mouseX][mouseY]);
+ currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory],
+ currentRoomData->rejapantalla[mouseX][mouseY]);
verifyCopyProtection();
if (regobj.coger) {
g_engine->_mouseManager->hide();
switch (regobj.code) {
case 521: { // Corridor lamp
- roomData->mouseGrid[10][11] = 19;
- roomData->mouseGrid[9][12] = 18;
- roomData->mouseGrid[10][12] = 18;
+ currentRoomData->mouseGrid[10][11] = 19;
+ currentRoomData->mouseGrid[9][12] = 18;
+ currentRoomData->mouseGrid[10][12] = 18;
} break;
case 567: { // Pickup rubble
- if (roomData->banderamovimiento) {
+ if (currentRoomData->banderamovimiento) {
g_engine->_mouseManager->show();
drawText(3226);
return;
@@ -1668,7 +1659,7 @@ void pickupScreenObject() {
} break;
case 223: { // table cloths
animatePickup1(0, 1);
- roomData->indexadoobjetos[roomData->mouseGrid[mouseX][mouseY]]->indicefichero = regobj.reemplazarpor;
+ currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[mouseX][mouseY]]->indicefichero = regobj.reemplazarpor;
updateVideo();
animatePickup2(0, 1);
} break;
@@ -1692,7 +1683,7 @@ void pickupScreenObject() {
case 521: { // Puts plaster and key on the floor
animatePickup1(0, 1);
{
- RoomBitmapRegister &with = roomData->bitmapasociados[1];
+ RoomBitmapRegister &with = currentRoomData->bitmapasociados[1];
with.puntbitmap = 775611;
with.tambitmap = 36;
@@ -1702,7 +1693,7 @@ void pickupScreenObject() {
loadItem(with.coordx, with.coordy, with.tambitmap, with.puntbitmap, with.profund);
}
{
- RoomBitmapRegister &with = roomData->bitmapasociados[2];
+ RoomBitmapRegister &with = currentRoomData->bitmapasociados[2];
with.puntbitmap = 730743;
with.tambitmap = 64;
@@ -1719,21 +1710,21 @@ void pickupScreenObject() {
animatePickup2(0, 1);
} break;
case 562: { // alcove
- switch (roomData->codigo) {
+ switch (currentRoomData->codigo) {
case 20: { //First scene with alcove
if (hornacina[0][hornacina[0][3]] > 0) {
//Possibly
if (hornacina[0][3] == 2 || hornacina[0][hornacina[0][3]] == 563) {
readItemRegister(hornacina[0][hornacina[0][3]]);
hornacina[0][hornacina[0][3]] = 0;
- roomData->indexadoobjetos[9]->objectName = "HORNACINA";
+ currentRoomData->indexadoobjetos[9]->objectName = "HORNACINA";
animatePickup1(3, 1);
readBitmap(1190768, objetos[regobj.profundidad - 1], 892, 319);
- roomData->bitmapasociados[1].puntbitmap = 1190768;
- roomData->bitmapasociados[1].tambitmap = 892;
- roomData->bitmapasociados[1].coordx = 66;
- roomData->bitmapasociados[1].coordy = 35;
- roomData->bitmapasociados[1].profund = 1;
+ currentRoomData->bitmapasociados[1].puntbitmap = 1190768;
+ currentRoomData->bitmapasociados[1].tambitmap = 892;
+ currentRoomData->bitmapasociados[1].coordx = 66;
+ currentRoomData->bitmapasociados[1].coordy = 35;
+ currentRoomData->bitmapasociados[1].profund = 1;
handPantallaToFondo();
assembleScreen();
drawScreen(fondo);
@@ -1743,7 +1734,7 @@ void pickupScreenObject() {
hornacina[0][hornacina[0][3]] = 0;
hornacina[0][3] += 1;
hornacina[1][3] -= 1;
- roomData->indexadoobjetos[9]->objectName = " ";
+ currentRoomData->indexadoobjetos[9]->objectName = " ";
animatePickup1(3, 1);
readBitmap(1190768, objetos[regobj.profundidad - 1],
892, 319);
@@ -1752,30 +1743,30 @@ void pickupScreenObject() {
drawScreen(fondo);
animatePickup2(3, 1);
playVoc("PLATAF", 375907, 14724);
- roomData->bitmapasociados[1].tambitmap = 892;
- roomData->bitmapasociados[1].coordx = 66;
- roomData->bitmapasociados[1].coordy = 35;
- roomData->bitmapasociados[1].profund = 1;
+ currentRoomData->bitmapasociados[1].tambitmap = 892;
+ currentRoomData->bitmapasociados[1].coordx = 66;
+ currentRoomData->bitmapasociados[1].coordy = 35;
+ currentRoomData->bitmapasociados[1].profund = 1;
switch (hornacina[0][hornacina[0][3]]) {
case 0: {
- roomData->indexadoobjetos[9]->objectName = "HORNACINA";
+ currentRoomData->indexadoobjetos[9]->objectName = "HORNACINA";
alcoveAnimation(0, 1190768);
- roomData->bitmapasociados[1].puntbitmap = 1190768;
+ currentRoomData->bitmapasociados[1].puntbitmap = 1190768;
} break;
case 561: {
- roomData->indexadoobjetos[9]->objectName = "ESTATUA DIVINA";
+ currentRoomData->indexadoobjetos[9]->objectName = "ESTATUA DIVINA";
alcoveAnimation(0, 1182652);
- roomData->bitmapasociados[1].puntbitmap = 1182652;
+ currentRoomData->bitmapasociados[1].puntbitmap = 1182652;
} break;
case 563: {
- roomData->indexadoobjetos[9]->objectName = "MANUAL DE ALFARERO";
+ currentRoomData->indexadoobjetos[9]->objectName = "MANUAL DE ALFARERO";
alcoveAnimation(0, 1186044);
- roomData->bitmapasociados[1].puntbitmap = 1186044;
+ currentRoomData->bitmapasociados[1].puntbitmap = 1186044;
} break;
case 615: {
- roomData->indexadoobjetos[9]->objectName = "ESTATUA GROTESCA";
+ currentRoomData->indexadoobjetos[9]->objectName = "ESTATUA GROTESCA";
alcoveAnimation(0, 1181760);
- roomData->bitmapasociados[1].puntbitmap = 1181760;
+ currentRoomData->bitmapasociados[1].puntbitmap = 1181760;
} break;
}
updateAltScreen(24);
@@ -1793,14 +1784,14 @@ void pickupScreenObject() {
if (hornacina[1][3] == 2) {
readItemRegister(hornacina[1][2]);
hornacina[1][2] = 0;
- roomData->indexadoobjetos[8]->objectName = "HORNACINA";
+ currentRoomData->indexadoobjetos[8]->objectName = "HORNACINA";
animatePickup1(0, 1);
readBitmap(1399610, objetos[regobj.profundidad - 1], 892, 319);
- roomData->bitmapasociados[0].puntbitmap = 1399610;
- roomData->bitmapasociados[0].tambitmap = 892;
- roomData->bitmapasociados[0].coordx = 217;
- roomData->bitmapasociados[0].coordy = 48;
- roomData->bitmapasociados[0].profund = 1;
+ currentRoomData->bitmapasociados[0].puntbitmap = 1399610;
+ currentRoomData->bitmapasociados[0].tambitmap = 892;
+ currentRoomData->bitmapasociados[0].coordx = 217;
+ currentRoomData->bitmapasociados[0].coordy = 48;
+ currentRoomData->bitmapasociados[0].profund = 1;
handPantallaToFondo();
assembleScreen();
drawScreen(fondo);
@@ -1810,7 +1801,7 @@ void pickupScreenObject() {
hornacina[1][hornacina[1][3]] = 622;
hornacina[1][3] += 1;
hornacina[0][3] -= 1;
- roomData->indexadoobjetos[8]->objectName = " ";
+ currentRoomData->indexadoobjetos[8]->objectName = " ";
animatePickup1(0, 1);
readBitmap(1399610, objetos[0], 892, 319);
handPantallaToFondo();
@@ -1818,35 +1809,35 @@ void pickupScreenObject() {
drawScreen(fondo);
animatePickup2(0, 1);
playVoc("PLATAF", 375907, 14724);
- roomData->bitmapasociados[0].tambitmap = 892;
- roomData->bitmapasociados[0].coordx = 217;
- roomData->bitmapasociados[0].coordy = 48;
- roomData->bitmapasociados[0].profund = 1;
+ currentRoomData->bitmapasociados[0].tambitmap = 892;
+ currentRoomData->bitmapasociados[0].coordx = 217;
+ currentRoomData->bitmapasociados[0].coordy = 48;
+ currentRoomData->bitmapasociados[0].profund = 1;
switch (hornacina[1][hornacina[1][3]]) {
case 0: {
- roomData->indexadoobjetos[8]->objectName = "HORNACINA";
+ currentRoomData->indexadoobjetos[8]->objectName = "HORNACINA";
alcoveAnimation(0, 1399610);
- roomData->bitmapasociados[0].puntbitmap = 1399610;
+ currentRoomData->bitmapasociados[0].puntbitmap = 1399610;
} break;
case 561: {
- roomData->indexadoobjetos[8]->objectName = "ESTATUA DIVINA";
+ currentRoomData->indexadoobjetos[8]->objectName = "ESTATUA DIVINA";
alcoveAnimation(0, 1381982);
- roomData->bitmapasociados[0].puntbitmap = 1381982;
+ currentRoomData->bitmapasociados[0].puntbitmap = 1381982;
} break;
case 615: {
- roomData->indexadoobjetos[8]->objectName = "ESTATUA GROTESCA";
+ currentRoomData->indexadoobjetos[8]->objectName = "ESTATUA GROTESCA";
alcoveAnimation(0, 1381090);
- roomData->bitmapasociados[0].puntbitmap = 1381090;
+ currentRoomData->bitmapasociados[0].puntbitmap = 1381090;
} break;
case 622: {
- roomData->indexadoobjetos[8]->objectName = "PARED";
+ currentRoomData->indexadoobjetos[8]->objectName = "PARED";
alcoveAnimation(0, 1400502);
- roomData->bitmapasociados[0].puntbitmap = 1400502;
+ currentRoomData->bitmapasociados[0].puntbitmap = 1400502;
} break;
case 623: {
- roomData->indexadoobjetos[8]->objectName = "TORNO";
+ currentRoomData->indexadoobjetos[8]->objectName = "TORNO";
alcoveAnimation(0, 1398718);
- roomData->bitmapasociados[0].puntbitmap = 1398718;
+ currentRoomData->bitmapasociados[0].puntbitmap = 1398718;
} break;
}
updateAltScreen(20);
@@ -1863,7 +1854,7 @@ void pickupScreenObject() {
case 624: { // red devil
animatePickup1(2, 1);
{
- RoomBitmapRegister &with = roomData->bitmapasociados[3];
+ RoomBitmapRegister &with = currentRoomData->bitmapasociados[3];
with.puntbitmap = 0;
with.tambitmap = 0;
@@ -1892,7 +1883,7 @@ void pickupScreenObject() {
switch (regobj.code) {
case 216: { // chisel
animatePickup1(0, 2);
- roomData->indexadoobjetos[roomData->mouseGrid
+ currentRoomData->indexadoobjetos[currentRoomData->mouseGrid
[mouseX][mouseY]]
->indicefichero = regobj.reemplazarpor;
updateVideo();
@@ -1900,7 +1891,7 @@ void pickupScreenObject() {
} break;
case 295: { // candles
animatePickup1(3, 2);
- roomData->indexadoobjetos[roomData->mouseGrid
+ currentRoomData->indexadoobjetos[currentRoomData->mouseGrid
[mouseX][mouseY]]
->indicefichero = regobj.reemplazarpor;
updateVideo();
@@ -1918,7 +1909,7 @@ void pickupScreenObject() {
animatePickup1(3, 2);
objetos[regobj.profundidad - 1] = NULL;
{ // bird
- RoomBitmapRegister &with = roomData->bitmapasociados[2];
+ RoomBitmapRegister &with = currentRoomData->bitmapasociados[2];
with.puntbitmap = 1545924;
with.tambitmap = 172;
@@ -1928,7 +1919,7 @@ void pickupScreenObject() {
loadItem(with.coordx, with.coordy, with.tambitmap, with.puntbitmap, with.profund);
}
{ // ring
- RoomBitmapRegister &with = roomData->bitmapasociados[1];
+ RoomBitmapRegister &with = currentRoomData->bitmapasociados[1];
with.puntbitmap = 1591272;
with.tambitmap = 92;
@@ -1959,7 +1950,7 @@ void pickupScreenObject() {
animateBat();
g_engine->_mouseManager->show();
drawText(kaka);
- roomData->mouseGrid[34][8] = 24;
+ currentRoomData->mouseGrid[34][8] = 24;
numeroaccion = 0;
oldxrejilla = 0;
oldyrejilla = 0;
@@ -1972,43 +1963,43 @@ void pickupScreenObject() {
if (regobj.code != 624)
for (indicey = regobj.yrej1; indicey <= regobj.yrej2; indicey++)
for (indicex = regobj.xrej1; indicex <= regobj.xrej2; indicex++) {
- roomData->rejapantalla[indicex][indicey] = regobj.parcherejapantalla[indicex - regobj.xrej1][indicey - regobj.yrej1];
- roomData->mouseGrid[indicex][indicey] = regobj.parcherejaraton[indicex - regobj.xrej1][indicey - regobj.yrej1];
+ currentRoomData->rejapantalla[indicex][indicey] = regobj.parcherejapantalla[indicex - regobj.xrej1][indicey - regobj.yrej1];
+ currentRoomData->mouseGrid[indicex][indicey] = regobj.parcherejaraton[indicex - regobj.xrej1][indicey - regobj.yrej1];
}
switch (regobj.code) {
case 216: { // chisel
- roomData->bitmapasociados[5].puntbitmap = 517485;
- roomData->bitmapasociados[5].tambitmap = 964;
- roomData->bitmapasociados[5].coordx = 223;
- roomData->bitmapasociados[5].coordy = 34;
- roomData->bitmapasociados[5].profund = 1;
+ currentRoomData->bitmapasociados[5].puntbitmap = 517485;
+ currentRoomData->bitmapasociados[5].tambitmap = 964;
+ currentRoomData->bitmapasociados[5].coordx = 223;
+ currentRoomData->bitmapasociados[5].coordy = 34;
+ currentRoomData->bitmapasociados[5].profund = 1;
} break;
case 218:; // necronomicon
break;
case 223: { // table cloth
- roomData->bitmapasociados[6].puntbitmap = 436752;
- roomData->bitmapasociados[6].tambitmap = 1372;
- roomData->bitmapasociados[6].coordx = 174;
- roomData->bitmapasociados[6].coordy = 32;
- roomData->bitmapasociados[6].profund = 1;
+ currentRoomData->bitmapasociados[6].puntbitmap = 436752;
+ currentRoomData->bitmapasociados[6].tambitmap = 1372;
+ currentRoomData->bitmapasociados[6].coordx = 174;
+ currentRoomData->bitmapasociados[6].coordy = 32;
+ currentRoomData->bitmapasociados[6].profund = 1;
} break;
case 295: { // candles
- roomData->bitmapasociados[3].puntbitmap = 1130756;
- roomData->bitmapasociados[3].tambitmap = 1764;
- roomData->bitmapasociados[3].coordx = 100;
- roomData->bitmapasociados[3].coordy = 28;
- roomData->bitmapasociados[3].profund = 1;
+ currentRoomData->bitmapasociados[3].puntbitmap = 1130756;
+ currentRoomData->bitmapasociados[3].tambitmap = 1764;
+ currentRoomData->bitmapasociados[3].coordx = 100;
+ currentRoomData->bitmapasociados[3].coordy = 28;
+ currentRoomData->bitmapasociados[3].profund = 1;
} break;
case 308:; // mistletoe
break;
case 362:;// charcoal
break;
case 402: {
- roomData->bitmapasociados[5].puntbitmap = 68130;
- roomData->bitmapasociados[5].tambitmap = 2564;
- roomData->bitmapasociados[5].coordx = 148;
- roomData->bitmapasociados[5].coordy = 49;
- roomData->bitmapasociados[5].profund = 7;
+ currentRoomData->bitmapasociados[5].puntbitmap = 68130;
+ currentRoomData->bitmapasociados[5].tambitmap = 2564;
+ currentRoomData->bitmapasociados[5].coordx = 148;
+ currentRoomData->bitmapasociados[5].coordy = 49;
+ currentRoomData->bitmapasociados[5].profund = 7;
} break;
case 479:; // scissors
break;
@@ -2022,13 +2013,13 @@ void pickupScreenObject() {
break;
default: {
for (indicex = 0; indicex < 15; indicex++)
- if (roomData->bitmapasociados[indicex].puntbitmap ==
+ if (currentRoomData->bitmapasociados[indicex].puntbitmap ==
regobj.punterobitmap) {
- roomData->bitmapasociados[indicex].puntbitmap = 0;
- roomData->bitmapasociados[indicex].tambitmap = 0;
- roomData->bitmapasociados[indicex].coordx = 0;
- roomData->bitmapasociados[indicex].coordy = 0;
- roomData->bitmapasociados[indicex].profund = 0;
+ currentRoomData->bitmapasociados[indicex].puntbitmap = 0;
+ currentRoomData->bitmapasociados[indicex].tambitmap = 0;
+ currentRoomData->bitmapasociados[indicex].coordx = 0;
+ currentRoomData->bitmapasociados[indicex].coordy = 0;
+ currentRoomData->bitmapasociados[indicex].profund = 0;
}
}
}
@@ -2062,8 +2053,6 @@ void pickupScreenObject() {
}
void replaceBackpack(byte indicador1, uint indicador2) {
- byte indicepaso, indicex, indicey;
-
readItemRegister(indicador2);
mobj[indicador1].bitmapIndex = regobj.objectIconBitmap;
mobj[indicador1].code = indicador2;
@@ -2076,24 +2065,24 @@ void dropObjectInScreen(InvItemRegister regobjsustituto) {
if (regobjsustituto.tambitmap > 0) {
indicepaso = 0;
- while (!(roomData->bitmapasociados[indicepaso].tambitmap == 0) || indicepaso == 15) {
+ while (!(currentRoomData->bitmapasociados[indicepaso].tambitmap == 0) || indicepaso == 15) {
indicepaso ++;
}
- if (roomData->bitmapasociados[indicepaso].tambitmap == 0) {
+ if (currentRoomData->bitmapasociados[indicepaso].tambitmap == 0) {
{
- RoomBitmapRegister &with = roomData->bitmapasociados[indicepaso];
+ RoomBitmapRegister &with = currentRoomData->bitmapasociados[indicepaso];
with.puntbitmap = regobjsustituto.punterobitmap;
with.tambitmap = regobjsustituto.tambitmap;
with.coordx = regobjsustituto.xparche;
with.coordy = regobjsustituto.yparche;
- with.profund = regobjsustituto.profundidad - 1;
+ with.profund = regobjsustituto.profundidad;
loadItem(with.coordx, with.coordy, with.tambitmap, with.puntbitmap, with.profund);
}
for (indicey = regobjsustituto.yrej1; indicey <= regobjsustituto.yrej2; indicey++)
for (indicex = regobjsustituto.xrej1; indicex <= regobjsustituto.xrej2; indicex++) {
- roomData->rejapantalla[indicex][indicey] = regobjsustituto.parcherejapantalla[indicex - regobjsustituto.xrej1][indicey - regobjsustituto.yrej1];
- roomData->mouseGrid[indicex][indicey] = regobjsustituto.parcherejaraton[indicex - regobjsustituto.xrej1][indicey - regobjsustituto.yrej1];
+ currentRoomData->rejapantalla[indicex][indicey] = regobjsustituto.parcherejapantalla[indicex - regobjsustituto.xrej1][indicey - regobjsustituto.yrej1];
+ currentRoomData->mouseGrid[indicex][indicey] = regobjsustituto.parcherejaraton[indicex - regobjsustituto.xrej1][indicey - regobjsustituto.yrej1];
}
} else
_exit(264);
@@ -2107,7 +2096,7 @@ void useScreenObject() {
uint mouseX = (pulsax + 7) / factorx;
uint mouseY = (pulsay + 7) / factory;
- uint screenObject = roomData->indexadoobjetos[roomData->mouseGrid[mouseX][mouseY]]->indicefichero;
+ uint screenObject = currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[mouseX][mouseY]]->indicefichero;
if (objetomochila != "") {
indicemochila = 0;
@@ -2118,8 +2107,8 @@ void useScreenObject() {
readItemRegister(mobj[indicemochila].code);
goToObject(
- roomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory],
- roomData->rejapantalla[mouseX][mouseY]
+ currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory],
+ currentRoomData->rejapantalla[mouseX][mouseY]
);
if (regobj.usarcon == screenObject && screenObject > 0 && regobj.usar[0] == 5) {
@@ -2132,20 +2121,20 @@ void useScreenObject() {
animatePickup2(1, 2);
updateItem(regobj.code);
- roomData->indexadoobjetos[27]->indicefichero = 201;
+ currentRoomData->indexadoobjetos[27]->indicefichero = 201;
do {
g_engine->_chrono->updateChrono();
if (iframe2 >= secondaryAnimationFrameCount - 1)
iframe2 = 0;
else
iframe2++;
- if (indicetray2 >= roomData->longtray2)
+ if (indicetray2 >= currentRoomData->longtray2)
indicetray2 = 1;
else
indicetray2 += 1;
- animado.dir = roomData->dir2[indicetray2 - 1];
- animado.posx = roomData->tray2[indicetray2 - 1].x;
- animado.posy = roomData->tray2[indicetray2 - 1].y;
+ animado.dir = currentRoomData->dir2[indicetray2 - 1];
+ animado.posx = currentRoomData->tray2[indicetray2 - 1].x;
+ animado.posy = currentRoomData->tray2[indicetray2 - 1].y;
emptyLoop();
tocapintar = false;
emptyLoop2();
@@ -2155,28 +2144,28 @@ void useScreenObject() {
for (indlista = 0; indlista < maxrejax; indlista++)
for (indmoch = 0; indmoch < maxrejay; indmoch++) {
- roomData->rejapantalla[oldposx + indlista][oldposy + indmoch] = rejafondomovto[indlista][indmoch];
- roomData->mouseGrid[oldposx + indlista][oldposy + indmoch] = rejafondoraton[indlista][indmoch];
+ currentRoomData->rejapantalla[oldposx + indlista][oldposy + indmoch] = rejafondomovto[indlista][indmoch];
+ currentRoomData->mouseGrid[oldposx + indlista][oldposy + indmoch] = rejafondoraton[indlista][indmoch];
}
freeAnimation();
- animado.posx = roomData->tray2[indicetray2 - 1].x + 8;
- animado.posy = roomData->tray2[indicetray2 - 1].y;
- roomData->nombremovto = "GALLOPIC";
- roomData->dir2[299] = 201;
+ animado.posx = currentRoomData->tray2[indicetray2 - 1].x + 8;
+ animado.posy = currentRoomData->tray2[indicetray2 - 1].y;
+ currentRoomData->nombremovto = "GALLOPIC";
+ currentRoomData->dir2[299] = 201;
loadAnimation("GALLOPIC");
- roomData->dir2[0] = 0;
- roomData->tray2[0].x = animado.posx;
- roomData->tray2[0].y = animado.posy;
+ currentRoomData->dir2[0] = 0;
+ currentRoomData->tray2[0].x = animado.posx;
+ currentRoomData->tray2[0].y = animado.posy;
indicetray2 = 1;
- roomData->longtray2 = 1;
+ currentRoomData->longtray2 = 1;
for (indlista = 0; indlista < maxrejax; indlista++)
for (indmoch = 0; indmoch < maxrejay; indmoch++) {
if (rejamascaramovto[indlista][indmoch] > 0)
- roomData->rejapantalla[oldposx + indlista][oldposy + indmoch] = rejamascaramovto[indlista][indmoch];
+ currentRoomData->rejapantalla[oldposx + indlista][oldposy + indmoch] = rejamascaramovto[indlista][indmoch];
if (rejamascararaton[indlista][indmoch] > 0)
- roomData->mouseGrid[oldposx + indlista][oldposy + indmoch] = rejamascararaton[indlista][indmoch];
+ currentRoomData->mouseGrid[oldposx + indlista][oldposy + indmoch] = rejamascararaton[indlista][indmoch];
}
g_engine->_mouseManager->show();
} break;
@@ -2188,11 +2177,10 @@ void useScreenObject() {
animatePickup2(3, 1);
g_engine->_mouseManager->show();
updateItem(regobj.code);
- roomData->indexadoobjetos[21]->indicefichero = 154;
+ currentRoomData->indexadoobjetos[21]->indicefichero = 154;
} break;
case 157: { // giving something to john
controlarlista = false;
- debug("lista1 = %d, %d, %d, %d, %d", firstList[0], firstList[1], firstList[2], firstList[3], firstList[4]);
debug("used object = %d", mobj[indicemochila].code);
if (lista1) {
for (indlista = 0; indlista < 5; indlista++) {
@@ -2367,7 +2355,7 @@ void useScreenObject() {
drawBackpack();
disableSecondAnimation();
{
- RoomBitmapRegister &with = roomData->bitmapasociados[0];
+ RoomBitmapRegister &with = currentRoomData->bitmapasociados[0];
with.puntbitmap = 1545820;
with.tambitmap = 104;
@@ -2376,7 +2364,7 @@ void useScreenObject() {
with.profund = 1;
loadItem(with.coordx, with.coordy, with.tambitmap, with.puntbitmap, with.profund);
}
- roomData->mouseGrid[15][12] = 7;
+ currentRoomData->mouseGrid[15][12] = 7;
g_engine->_mouseManager->show();
} else {
assignText();
@@ -2412,7 +2400,7 @@ void useScreenObject() {
drawBackpack();
disableSecondAnimation();
{
- RoomBitmapRegister &with = roomData->bitmapasociados[0];
+ RoomBitmapRegister &with = currentRoomData->bitmapasociados[0];
with.puntbitmap = 1545820;
with.tambitmap = 104;
@@ -2421,7 +2409,7 @@ void useScreenObject() {
with.profund = 1;
loadItem(with.coordx, with.coordy, with.tambitmap, with.puntbitmap, with.profund);
}
- roomData->mouseGrid[15][12] = 7;
+ currentRoomData->mouseGrid[15][12] = 7;
g_engine->_mouseManager->show();
} else {
assignText();
@@ -2457,7 +2445,7 @@ void useScreenObject() {
drawBackpack();
disableSecondAnimation();
{
- RoomBitmapRegister &with = roomData->bitmapasociados[0];
+ RoomBitmapRegister &with = currentRoomData->bitmapasociados[0];
with.puntbitmap = 1545820;
with.tambitmap = 104;
@@ -2466,7 +2454,7 @@ void useScreenObject() {
with.profund = 1;
loadItem(with.coordx, with.coordy, with.tambitmap, with.puntbitmap, with.profund);
}
- roomData->mouseGrid[15][12] = 7;
+ currentRoomData->mouseGrid[15][12] = 7;
g_engine->_mouseManager->show();
} else {
assignText();
@@ -2502,7 +2490,7 @@ void useScreenObject() {
drawBackpack();
disableSecondAnimation();
{
- RoomBitmapRegister &with = roomData->bitmapasociados[0];
+ RoomBitmapRegister &with = currentRoomData->bitmapasociados[0];
with.puntbitmap = 1545820;
with.tambitmap = 104;
@@ -2511,7 +2499,7 @@ void useScreenObject() {
with.profund = 1;
loadItem(with.coordx, with.coordy, with.tambitmap, with.puntbitmap, with.profund);
}
- roomData->mouseGrid[15][12] = 7;
+ currentRoomData->mouseGrid[15][12] = 7;
g_engine->_mouseManager->show();
} else {
assignText();
@@ -2539,18 +2527,18 @@ void useScreenObject() {
iframe2 = 0;
else
iframe2++;
- if (indicetray2 >= roomData->longtray2)
+ if (indicetray2 >= currentRoomData->longtray2)
indicetray2 = 1;
else
indicetray2 += 1;
- animado.dir = roomData->dir2[indicetray2 - 1];
- animado.posx = roomData->tray2[indicetray2 - 1].x;
- animado.posy = roomData->tray2[indicetray2 - 1].y;
+ animado.dir = currentRoomData->dir2[indicetray2 - 1];
+ animado.posx = currentRoomData->tray2[indicetray2 - 1].x;
+ animado.posy = currentRoomData->tray2[indicetray2 - 1].y;
emptyLoop();
tocapintar = false;
emptyLoop2();
sprites(true);
- } while (!(indicetray2 == (roomData->longtray2 / 2)));
+ } while (!(indicetray2 == (currentRoomData->longtray2 / 2)));
animateGive(3, 2);
updateInventory(indicemochila);
@@ -2563,19 +2551,19 @@ void useScreenObject() {
iframe2 = 0;
else
iframe2++;
- if (indicetray2 >= roomData->longtray2)
+ if (indicetray2 >= currentRoomData->longtray2)
indicetray2 = 1;
else
indicetray2 += 1;
- animado.dir = roomData->dir2[indicetray2 - 1];
- animado.posx = roomData->tray2[indicetray2 - 1].x;
- animado.posy = roomData->tray2[indicetray2 - 1].y;
+ animado.dir = currentRoomData->dir2[indicetray2 - 1];
+ animado.posx = currentRoomData->tray2[indicetray2 - 1].x;
+ animado.posy = currentRoomData->tray2[indicetray2 - 1].y;
emptyLoop();
tocapintar = false;
emptyLoop2();
sprites(true);
- } while (indicetray2 != roomData->longtray2);
+ } while (indicetray2 != currentRoomData->longtray2);
disableSecondAnimation();
drawScreen(fondo);
g_engine->_mouseManager->show();
@@ -2625,19 +2613,19 @@ void useScreenObject() {
readItemRegister(536);
for (indicex = 12; indicex <= 13; indicex++)
for (indicey = 7; indicey <= 14; indicey++)
- roomData->mouseGrid[indicex][indicey] = 14;
+ currentRoomData->mouseGrid[indicex][indicey] = 14;
for (indicey = 8; indicey <= 12; indicey++)
- roomData->mouseGrid[14][indicey] = 14;
- roomData->mouseGrid[9][10] = 1;
- roomData->mouseGrid[10][10] = 1;
+ currentRoomData->mouseGrid[14][indicey] = 14;
+ currentRoomData->mouseGrid[9][10] = 1;
+ currentRoomData->mouseGrid[10][10] = 1;
for (indicex = 0; indicex < 15; indicex++)
- if (roomData->bitmapasociados[indicex].puntbitmap ==
+ if (currentRoomData->bitmapasociados[indicex].puntbitmap ==
regobj.punterobitmap) {
- roomData->bitmapasociados[indicex].puntbitmap = 0;
- roomData->bitmapasociados[indicex].tambitmap = 0;
- roomData->bitmapasociados[indicex].coordx = 0;
- roomData->bitmapasociados[indicex].coordy = 0;
- roomData->bitmapasociados[indicex].profund = 0;
+ currentRoomData->bitmapasociados[indicex].puntbitmap = 0;
+ currentRoomData->bitmapasociados[indicex].tambitmap = 0;
+ currentRoomData->bitmapasociados[indicex].coordx = 0;
+ currentRoomData->bitmapasociados[indicex].coordy = 0;
+ currentRoomData->bitmapasociados[indicex].profund = 0;
}
indicemochila = 0;
while (mobj[indicemochila].code != 0) {
@@ -2678,9 +2666,7 @@ void useScreenObject() {
g_engine->_mouseManager->hide();
animatePickup1(2, 0);
playVoc("TIJERAS", 252764, 5242);
- do {
- ;
- } while (!estadovoc != 0);
+ g_engine->_sound->waitForSoundEnd();
animatePickup2(2, 0);
drawBackpack();
g_engine->_mouseManager->show();
@@ -2718,7 +2704,7 @@ void useScreenObject() {
loadVoc("GOTA", 140972, 1029);
g_engine->_mouseManager->show();
drawText(regobj.useTextRef);
- roomData->doors[2].abiertacerrada = 0;
+ currentRoomData->doors[2].abiertacerrada = 0;
} break;
case 446: {
drawText(regobj.useTextRef);
@@ -2739,7 +2725,7 @@ void useScreenObject() {
updateInventory(indicemochila);
drawBackpack();
g_engine->_mouseManager->show();
- roomData->mouseGrid[27][8] = 22;
+ currentRoomData->mouseGrid[27][8] = 22;
} break;
case 549: {
updateItem(regobj.code);
@@ -2749,10 +2735,10 @@ void useScreenObject() {
animateOpen2(1, 1);
g_engine->_mouseManager->show();
drawText(regobj.useTextRef);
- roomData->doors[0].abiertacerrada = 0;
+ currentRoomData->doors[0].abiertacerrada = 0;
} break;
case 562: { // put any object in the alcoves
- switch (roomData->codigo) {
+ switch (currentRoomData->codigo) {
case 20: {
if (hornacina[0][hornacina[0][3]] == 0) {
@@ -2760,24 +2746,24 @@ void useScreenObject() {
hornacina[0][0] = regobj.code;
drawText(regobj.useTextRef);
g_engine->_mouseManager->hide();
- roomData->indexadoobjetos[9]->objectName = " ";
+ currentRoomData->indexadoobjetos[9]->objectName = " ";
animateGive(3, 1);
switch (hornacina[0][0]) {
case 561: {
- roomData->indexadoobjetos[9]->objectName = "ESTATUA DIVINA";
+ currentRoomData->indexadoobjetos[9]->objectName = "ESTATUA DIVINA";
readBitmap(1182652, objetos[0], 892, 319);
- roomData->bitmapasociados[1].puntbitmap = 1182652;
+ currentRoomData->bitmapasociados[1].puntbitmap = 1182652;
} break;
case 615: {
- roomData->indexadoobjetos[9]->objectName = "ESTATUA GROTESCA";
+ currentRoomData->indexadoobjetos[9]->objectName = "ESTATUA GROTESCA";
readBitmap(1181760, objetos[0], 892, 319);
- roomData->bitmapasociados[1].puntbitmap = 1181760;
+ currentRoomData->bitmapasociados[1].puntbitmap = 1181760;
} break;
}
- roomData->bitmapasociados[1].tambitmap = 892;
- roomData->bitmapasociados[1].coordx = 66;
- roomData->bitmapasociados[1].coordy = 35;
- roomData->bitmapasociados[1].profund = 1;
+ currentRoomData->bitmapasociados[1].tambitmap = 892;
+ currentRoomData->bitmapasociados[1].coordx = 66;
+ currentRoomData->bitmapasociados[1].coordy = 35;
+ currentRoomData->bitmapasociados[1].profund = 1;
handPantallaToFondo();
// XMStoPointer(ptr(segfondo, (offfondo + 4)), _handpantalla, 4, (sizepantalla - int32(4)));
assembleScreen();
@@ -2808,34 +2794,34 @@ void useScreenObject() {
animateOpen2(3, 1);
updateInventory(indicemochila);
drawBackpack();
- roomData->indexadoobjetos[9]->objectName = " ";
+ currentRoomData->indexadoobjetos[9]->objectName = " ";
playVoc("PLATAF", 375907, 14724);
switch (hornacina[0][hornacina[0][3]]) {
case 0: {
- roomData->indexadoobjetos[9]->objectName = "HORNACINA";
+ currentRoomData->indexadoobjetos[9]->objectName = "HORNACINA";
alcoveAnimation(1, 1190768);
- roomData->bitmapasociados[1].puntbitmap = 1190768;
+ currentRoomData->bitmapasociados[1].puntbitmap = 1190768;
} break;
case 561: {
- roomData->indexadoobjetos[9]->objectName = "ESTATUA DIVINA";
+ currentRoomData->indexadoobjetos[9]->objectName = "ESTATUA DIVINA";
alcoveAnimation(1, 1182652);
- roomData->bitmapasociados[1].puntbitmap = 1182652;
+ currentRoomData->bitmapasociados[1].puntbitmap = 1182652;
} break;
case 563: {
- roomData->indexadoobjetos[9]->objectName = "MANUAL DE ALFARERO";
+ currentRoomData->indexadoobjetos[9]->objectName = "MANUAL DE ALFARERO";
alcoveAnimation(1, 1186044);
- roomData->bitmapasociados[1].puntbitmap = 1186044;
+ currentRoomData->bitmapasociados[1].puntbitmap = 1186044;
} break;
case 615: {
- roomData->indexadoobjetos[9]->objectName = "ESTATUA GROTESCA";
+ currentRoomData->indexadoobjetos[9]->objectName = "ESTATUA GROTESCA";
alcoveAnimation(1, 1181760);
- roomData->bitmapasociados[1].puntbitmap = 1181760;
+ currentRoomData->bitmapasociados[1].puntbitmap = 1181760;
} break;
}
- roomData->bitmapasociados[1].tambitmap = 892;
- roomData->bitmapasociados[1].coordx = 66;
- roomData->bitmapasociados[1].coordy = 35;
- roomData->bitmapasociados[1].profund = 1;
+ currentRoomData->bitmapasociados[1].tambitmap = 892;
+ currentRoomData->bitmapasociados[1].coordx = 66;
+ currentRoomData->bitmapasociados[1].coordy = 35;
+ currentRoomData->bitmapasociados[1].profund = 1;
g_engine->_mouseManager->show();
updateAltScreen(24);
}
@@ -2851,24 +2837,24 @@ void useScreenObject() {
hornacina[1][0] = regobj.code;
drawText(regobj.useTextRef);
g_engine->_mouseManager->hide();
- roomData->indexadoobjetos[8]->objectName = " ";
+ currentRoomData->indexadoobjetos[8]->objectName = " ";
animateGive(0, 1);
switch (hornacina[1][0]) {
case 561: {
- roomData->indexadoobjetos[8]->objectName = "ESTATUA DIVINA";
+ currentRoomData->indexadoobjetos[8]->objectName = "ESTATUA DIVINA";
readBitmap(1381982, objetos[0], 892, 319);
- roomData->bitmapasociados[0].puntbitmap = 1381982;
+ currentRoomData->bitmapasociados[0].puntbitmap = 1381982;
} break;
case 615: {
- roomData->indexadoobjetos[8]->objectName = "ESTATUA GROTESCA";
+ currentRoomData->indexadoobjetos[8]->objectName = "ESTATUA GROTESCA";
readBitmap(1381090, objetos[0], 892, 319);
- roomData->bitmapasociados[0].puntbitmap = 1381090;
+ currentRoomData->bitmapasociados[0].puntbitmap = 1381090;
} break;
}
- roomData->bitmapasociados[0].tambitmap = 892;
- roomData->bitmapasociados[0].coordx = 217;
- roomData->bitmapasociados[0].coordy = 48;
- roomData->bitmapasociados[0].profund = 1;
+ currentRoomData->bitmapasociados[0].tambitmap = 892;
+ currentRoomData->bitmapasociados[0].coordx = 217;
+ currentRoomData->bitmapasociados[0].coordy = 48;
+ currentRoomData->bitmapasociados[0].profund = 1;
handPantallaToFondo();
// XMStoPointer(ptr(segfondo, (offfondo + 4)), _handpantalla, 4, (sizepantalla - int32(4)));
assembleScreen();
@@ -2903,39 +2889,39 @@ void useScreenObject() {
animateOpen2(0, 1);
updateInventory(indicemochila);
drawBackpack();
- roomData->indexadoobjetos[8]->objectName = " ";
+ currentRoomData->indexadoobjetos[8]->objectName = " ";
playVoc("PLATAF", 375907, 14724);
switch (hornacina[1][hornacina[1][3]]) {
case 0: {
- roomData->indexadoobjetos[8]->objectName = "HORNACINA";
+ currentRoomData->indexadoobjetos[8]->objectName = "HORNACINA";
alcoveAnimation(1, 1399610);
- roomData->bitmapasociados[0].puntbitmap = 1399610;
+ currentRoomData->bitmapasociados[0].puntbitmap = 1399610;
} break;
case 561: {
- roomData->indexadoobjetos[8]->objectName = "ESTATUA DIVINA";
+ currentRoomData->indexadoobjetos[8]->objectName = "ESTATUA DIVINA";
alcoveAnimation(1, 1381982);
- roomData->bitmapasociados[0].puntbitmap = 1381982;
+ currentRoomData->bitmapasociados[0].puntbitmap = 1381982;
} break;
case 615: {
- roomData->indexadoobjetos[8]->objectName = "ESTATUA GROTESCA";
+ currentRoomData->indexadoobjetos[8]->objectName = "ESTATUA GROTESCA";
alcoveAnimation(1, 1381090);
- roomData->bitmapasociados[0].puntbitmap = 1381090;
+ currentRoomData->bitmapasociados[0].puntbitmap = 1381090;
} break;
case 622: {
- roomData->indexadoobjetos[8]->objectName = "PARED";
+ currentRoomData->indexadoobjetos[8]->objectName = "PARED";
alcoveAnimation(1, 1400502);
- roomData->bitmapasociados[0].puntbitmap = 1400502;
+ currentRoomData->bitmapasociados[0].puntbitmap = 1400502;
} break;
case 623: {
- roomData->indexadoobjetos[8]->objectName = "TORNO";
+ currentRoomData->indexadoobjetos[8]->objectName = "TORNO";
alcoveAnimation(1, 1398718);
- roomData->bitmapasociados[0].puntbitmap = 1398718;
+ currentRoomData->bitmapasociados[0].puntbitmap = 1398718;
} break;
}
- roomData->bitmapasociados[0].tambitmap = 892;
- roomData->bitmapasociados[0].coordx = 217;
- roomData->bitmapasociados[0].coordy = 48;
- roomData->bitmapasociados[0].profund = 1;
+ currentRoomData->bitmapasociados[0].tambitmap = 892;
+ currentRoomData->bitmapasociados[0].coordx = 217;
+ currentRoomData->bitmapasociados[0].coordy = 48;
+ currentRoomData->bitmapasociados[0].profund = 1;
g_engine->_mouseManager->show();
updateAltScreen(20);
}
@@ -2951,14 +2937,14 @@ void useScreenObject() {
drawFlc(140, 34, 2124896, 0, 9, 24, false, false, true, basurillalog);
g_engine->_mouseManager->show();
updateItem(regobj.code);
- roomData->indexadoobjetos[7]->indicefichero = 716;
- roomData->mouseGrid[19][9] = 14;
- roomData->mouseGrid[22][16] = 15;
+ currentRoomData->indexadoobjetos[7]->indicefichero = 716;
+ currentRoomData->mouseGrid[19][9] = 14;
+ currentRoomData->mouseGrid[22][16] = 15;
for (indlista = 21; indlista <= 22; indlista++)
for (indmoch = 17; indmoch <= 20; indmoch++)
- roomData->mouseGrid[indlista][indmoch] = 17;
+ currentRoomData->mouseGrid[indlista][indmoch] = 17;
{
- RoomBitmapRegister &with = roomData->bitmapasociados[0];
+ RoomBitmapRegister &with = currentRoomData->bitmapasociados[0];
with.puntbitmap = 1243652;
with.tambitmap = 2718;
@@ -2967,7 +2953,7 @@ void useScreenObject() {
with.profund = 6;
}
{
- RoomBitmapRegister &with = roomData->bitmapasociados[1];
+ RoomBitmapRegister &with = currentRoomData->bitmapasociados[1];
with.puntbitmap = 1240474;
with.tambitmap = 344;
@@ -2977,7 +2963,7 @@ void useScreenObject() {
loadItem(with.coordx, with.coordy, with.tambitmap, with.puntbitmap, with.profund);
}
{
- RoomBitmapRegister &with = roomData->bitmapasociados[2];
+ RoomBitmapRegister &with = currentRoomData->bitmapasociados[2];
with.puntbitmap = 1240818;
with.tambitmap = 116;
@@ -3003,12 +2989,12 @@ void useScreenObject() {
} break;
case 608: {
drawText(regobj.useTextRef);
- goToObject(roomData->rejapantalla[mouseX][mouseY], 26);
+ goToObject(currentRoomData->rejapantalla[mouseX][mouseY], 26);
g_engine->_mouseManager->hide();
animateGive(2, 2);
animateOpen2(2, 2);
{
- RoomBitmapRegister &with = roomData->bitmapasociados[3];
+ RoomBitmapRegister &with = currentRoomData->bitmapasociados[3];
with.puntbitmap = 1546096;
with.tambitmap = 372;
@@ -3037,39 +3023,39 @@ void useScreenObject() {
drawScreen(fondo);
animateOpen2(direccionmovimiento, 1);
g_engine->_mouseManager->show();
- goToObject(roomData->rejapantalla[((characterPosX + rectificacionx) / factorx)][((characterPosY + rectificaciony) / factory)], 14);
+ goToObject(currentRoomData->rejapantalla[((characterPosX + rectificacionx) / factorx)][((characterPosY + rectificaciony) / factory)], 14);
g_engine->_mouseManager->hide();
playVoc("PUFF", 191183, 18001);
drawFlc(180, 60, 2216848, 0, 9, 0, false, false, true, basurillalog);
- roomData->bitmapasociados[2].puntbitmap = 1545820;
- roomData->bitmapasociados[2].tambitmap = 104;
- roomData->bitmapasociados[2].coordx = 277;
- roomData->bitmapasociados[2].coordy = 104;
- roomData->bitmapasociados[2].profund = 1;
+ currentRoomData->bitmapasociados[2].puntbitmap = 1545820;
+ currentRoomData->bitmapasociados[2].tambitmap = 104;
+ currentRoomData->bitmapasociados[2].coordx = 277;
+ currentRoomData->bitmapasociados[2].coordy = 104;
+ currentRoomData->bitmapasociados[2].profund = 1;
profundidad[0].posy = 104;
readBitmap(1545820, objetos[0], 104, 319);
- roomData->bitmapasociados[4].puntbitmap = 1447508;
- roomData->bitmapasociados[4].tambitmap = 464;
- roomData->bitmapasociados[4].coordx = 186;
- roomData->bitmapasociados[4].coordy = 64;
- roomData->bitmapasociados[4].profund = 8;
+ currentRoomData->bitmapasociados[4].puntbitmap = 1447508;
+ currentRoomData->bitmapasociados[4].tambitmap = 464;
+ currentRoomData->bitmapasociados[4].coordx = 186;
+ currentRoomData->bitmapasociados[4].coordy = 64;
+ currentRoomData->bitmapasociados[4].profund = 8;
loadItem(186, 63, 464, 1447508, 7);
handPantallaToFondo();
// XMStoPointer(ptr(segfondo, (offfondo + 4)), _handpantalla, 4,(sizepantalla - int32(4)));
assembleScreen();
drawScreen(fondo);
g_engine->_mouseManager->show();
- goToObject(roomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], 18);
+ goToObject(currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], 18);
g_engine->_mouseManager->hide();
animatePickup1(1, 1);
replaceBackpack(indicemochila, 638);
- roomData->bitmapasociados[4].puntbitmap = 0;
- roomData->bitmapasociados[4].tambitmap = 0;
- roomData->bitmapasociados[4].coordx = 0;
- roomData->bitmapasociados[4].coordy = 0;
- roomData->bitmapasociados[4].profund = 0;
+ currentRoomData->bitmapasociados[4].puntbitmap = 0;
+ currentRoomData->bitmapasociados[4].tambitmap = 0;
+ currentRoomData->bitmapasociados[4].coordx = 0;
+ currentRoomData->bitmapasociados[4].coordy = 0;
+ currentRoomData->bitmapasociados[4].profund = 0;
objetos[7] = NULL;
handPantallaToFondo();
assembleScreen();
@@ -3079,7 +3065,7 @@ void useScreenObject() {
g_engine->_mouseManager->show();
for (indlista = 35; indlista <= 37; indlista++)
for (indmoch = 21; indmoch <= 25; indmoch++)
- roomData->mouseGrid[indlista][indmoch] = 11;
+ currentRoomData->mouseGrid[indlista][indmoch] = 11;
guadagna = true;
if (tridente)
cavernas[3] = true;
@@ -3094,39 +3080,39 @@ void useScreenObject() {
drawScreen(fondo);
animateOpen2(3, 1);
g_engine->_mouseManager->show();
- goToObject(roomData->rejapantalla[((characterPosX + rectificacionx) / factorx)][((characterPosY + rectificaciony) / factory)], 10);
+ goToObject(currentRoomData->rejapantalla[((characterPosX + rectificacionx) / factorx)][((characterPosY + rectificaciony) / factory)], 10);
g_engine->_mouseManager->hide();
playVoc("PUFF", 191183, 18001);
drawFlc(0, 47, 2209158, 0, 9, 0, false, false, true, basurillalog);
- roomData->bitmapasociados[3].puntbitmap = 1591272;
- roomData->bitmapasociados[3].tambitmap = 92;
- roomData->bitmapasociados[3].coordx = 18;
- roomData->bitmapasociados[3].coordy = 60;
- roomData->bitmapasociados[3].profund = 3;
+ currentRoomData->bitmapasociados[3].puntbitmap = 1591272;
+ currentRoomData->bitmapasociados[3].tambitmap = 92;
+ currentRoomData->bitmapasociados[3].coordx = 18;
+ currentRoomData->bitmapasociados[3].coordy = 60;
+ currentRoomData->bitmapasociados[3].profund = 3;
profundidad[2].posx = 18;
profundidad[2].posy = 60;
readBitmap(1591272, objetos[2], 92, 319);
- roomData->bitmapasociados[4].puntbitmap = 1746554;
- roomData->bitmapasociados[4].tambitmap = 384;
- roomData->bitmapasociados[4].coordx = 82;
- roomData->bitmapasociados[4].coordy = 53;
- roomData->bitmapasociados[4].profund = 8;
+ currentRoomData->bitmapasociados[4].puntbitmap = 1746554;
+ currentRoomData->bitmapasociados[4].tambitmap = 384;
+ currentRoomData->bitmapasociados[4].coordx = 82;
+ currentRoomData->bitmapasociados[4].coordy = 53;
+ currentRoomData->bitmapasociados[4].profund = 8;
loadItem(82, 53, 384, 1746554, 7);
// XMStoPointer(ptr(segfondo, (offfondo + 4)), _handpantalla, 4,(sizepantalla - int32(4)));
assembleScreen();
drawScreen(fondo);
g_engine->_mouseManager->show();
- goToObject(roomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], 15);
+ goToObject(currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], 15);
g_engine->_mouseManager->hide();
animatePickup1(3, 1);
replaceBackpack(indicemochila, 637);
- roomData->bitmapasociados[4].puntbitmap = 0;
- roomData->bitmapasociados[4].tambitmap = 0;
- roomData->bitmapasociados[4].coordx = 0;
- roomData->bitmapasociados[4].coordy = 0;
- roomData->bitmapasociados[4].profund = 0;
+ currentRoomData->bitmapasociados[4].puntbitmap = 0;
+ currentRoomData->bitmapasociados[4].tambitmap = 0;
+ currentRoomData->bitmapasociados[4].coordx = 0;
+ currentRoomData->bitmapasociados[4].coordy = 0;
+ currentRoomData->bitmapasociados[4].profund = 0;
objetos[7] = NULL;
handPantallaToFondo();
// XMStoPointer(ptr(segfondo, (offfondo + 4)), _handpantalla, 4, (sizepantalla - int32(4)));
@@ -3137,23 +3123,23 @@ void useScreenObject() {
g_engine->_mouseManager->show();
for (indlista = 0; indlista <= 2; indlista++)
for (indmoch = 10; indmoch <= 12; indmoch++)
- roomData->mouseGrid[indlista][indmoch] = 10;
+ currentRoomData->mouseGrid[indlista][indmoch] = 10;
tridente = true;
if (guadagna)
cavernas[3] = true;
} break;
case 643: {
- if (roomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory] != 5)
+ if (currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory] != 5)
drawText(regobj.useTextRef);
pulsax = 149 - 7;
pulsay = 126 - 7;
- goToObject(roomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], 5);
+ goToObject(currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], 5);
g_engine->_mouseManager->hide();
updateInventory(indicemochila);
drawBackpack();
drawFlc(133, 0, 2076280, 0, 9, 22, false, false, true, basurillalog);
{
- RoomBitmapRegister &with = roomData->bitmapasociados[2];
+ RoomBitmapRegister &with = currentRoomData->bitmapasociados[2];
with.puntbitmap = 1744230;
with.tambitmap = 824;
@@ -3165,7 +3151,7 @@ void useScreenObject() {
updateAltScreen(31);
for (indlista = 18; indlista <= 20; indlista++)
for (indmoch = 8; indmoch <= 14; indmoch++)
- roomData->mouseGrid[indlista][indmoch] = 12;
+ currentRoomData->mouseGrid[indlista][indmoch] = 12;
sello_quitado = true;
cavernas[1] = false;
cavernas[0] = false;
@@ -3176,7 +3162,7 @@ void useScreenObject() {
drawText(regobj.useTextRef);
pulsax = 178 - 7;
pulsay = 71 - 7;
- goToObject(roomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], 3);
+ goToObject(currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], 3);
g_engine->_mouseManager->hide();
playVoc("AFILAR", 0, 6433);
drawFlc(160, 15, 2441804, 0, 9, 23, false, false, true, basurillalog);
@@ -3200,14 +3186,14 @@ void useScreenObject() {
animateOpen2(1, 1);
for (indlista = 19; indlista <= 21; indlista++)
for (indmoch = 10; indmoch <= 13; indmoch++)
- roomData->mouseGrid[indlista][indmoch] = 13;
+ currentRoomData->mouseGrid[indlista][indmoch] = 13;
g_engine->_mouseManager->show();
} break;
case 689: {
drawText(regobj.useTextRef);
pulsax = 124 - 7;
pulsay = 133 - 7;
- goToObject(roomData->rejapantalla[((characterPosX + rectificacionx) / factorx)][((characterPosY + rectificaciony) / factory)], 9);
+ goToObject(currentRoomData->rejapantalla[((characterPosX + rectificacionx) / factorx)][((characterPosY + rectificaciony) / factory)], 9);
g_engine->_mouseManager->hide();
drawFlc(110, 79, 2361800, 0, 9, 0, false, false, true, basurillalog);
replaceBackpack(indicemochila, 701);
@@ -3218,50 +3204,50 @@ void useScreenObject() {
drawScreen(fondo);
g_engine->_mouseManager->show();
for (indlista = 18; indlista <= 20; indlista++)
- roomData->mouseGrid[indlista][26] = 10;
+ currentRoomData->mouseGrid[indlista][26] = 10;
for (indlista = 17; indlista <= 21; indlista++)
- roomData->mouseGrid[indlista][27] = 10;
+ currentRoomData->mouseGrid[indlista][27] = 10;
} break;
case 700: {
drawText(regobj.useTextRef);
pulsax = 224 - 7;
pulsay = 91 - 7;
- goToObject(roomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], 7);
+ goToObject(currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], 7);
g_engine->_mouseManager->hide();
drawFlc(208, 0, 2382552, 0, 9, 21, false, false, true, basurillalog);
- roomData->bitmapasociados[0].puntbitmap = 0;
- roomData->bitmapasociados[0].tambitmap = 0;
- roomData->bitmapasociados[0].coordx = 0;
- roomData->bitmapasociados[0].coordy = 0;
- roomData->bitmapasociados[0].profund = 0;
+ currentRoomData->bitmapasociados[0].puntbitmap = 0;
+ currentRoomData->bitmapasociados[0].tambitmap = 0;
+ currentRoomData->bitmapasociados[0].coordx = 0;
+ currentRoomData->bitmapasociados[0].coordy = 0;
+ currentRoomData->bitmapasociados[0].profund = 0;
objetos[2] = NULL;
for (indmoch = 6; indmoch <= 9; indmoch++)
- roomData->mouseGrid[26][indmoch] = 3;
+ currentRoomData->mouseGrid[26][indmoch] = 3;
for (indmoch = 3; indmoch <= 5; indmoch++)
- roomData->mouseGrid[27][indmoch] = 3;
+ currentRoomData->mouseGrid[27][indmoch] = 3;
for (indmoch = 6; indmoch <= 10; indmoch++)
- roomData->mouseGrid[27][indmoch] = 4;
+ currentRoomData->mouseGrid[27][indmoch] = 4;
for (indmoch = 11; indmoch <= 12; indmoch++)
- roomData->mouseGrid[27][indmoch] = 7;
+ currentRoomData->mouseGrid[27][indmoch] = 7;
for (indmoch = 2; indmoch <= 10; indmoch++)
- roomData->mouseGrid[28][indmoch] = 4;
+ currentRoomData->mouseGrid[28][indmoch] = 4;
for (indmoch = 11; indmoch <= 12; indmoch++)
- roomData->mouseGrid[28][indmoch] = 7;
- roomData->mouseGrid[28][13] = 4;
+ currentRoomData->mouseGrid[28][indmoch] = 7;
+ currentRoomData->mouseGrid[28][13] = 4;
for (indmoch = 1; indmoch <= 14; indmoch++)
- roomData->mouseGrid[29][indmoch] = 4;
+ currentRoomData->mouseGrid[29][indmoch] = 4;
for (indlista = 30; indlista <= 32; indlista++)
for (indmoch = 0; indmoch <= 15; indmoch++)
- roomData->mouseGrid[indlista][indmoch] = 4;
+ currentRoomData->mouseGrid[indlista][indmoch] = 4;
for (indmoch = 1; indmoch <= 14; indmoch++)
- roomData->mouseGrid[33][indmoch] = 4;
+ currentRoomData->mouseGrid[33][indmoch] = 4;
for (indmoch = 2; indmoch <= 14; indmoch++)
- roomData->mouseGrid[34][indmoch] = 4;
+ currentRoomData->mouseGrid[34][indmoch] = 4;
for (indmoch = 3; indmoch <= 8; indmoch++)
- roomData->mouseGrid[35][indmoch] = 4;
+ currentRoomData->mouseGrid[35][indmoch] = 4;
for (indmoch = 9; indmoch <= 11; indmoch++)
- roomData->mouseGrid[35][indmoch] = 7;
- roomData->doors[1].abiertacerrada = 1;
+ currentRoomData->mouseGrid[35][indmoch] = 7;
+ currentRoomData->doors[1].abiertacerrada = 1;
g_engine->_mouseManager->show();
updateItem(regobj.code);
} break;
@@ -3272,7 +3258,7 @@ void useScreenObject() {
animatePickup1(0, 1);
playVoc("TIZA", 390631, 18774);
{
- RoomBitmapRegister &with = roomData->bitmapasociados[1];
+ RoomBitmapRegister &with = currentRoomData->bitmapasociados[1];
with.puntbitmap = 1745054;
with.tambitmap = 1500;
@@ -3296,7 +3282,7 @@ void useScreenObject() {
} break;
}
} else {
- goToObject(roomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], roomData->rejapantalla[mouseX][mouseY]);
+ goToObject(currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], currentRoomData->rejapantalla[mouseX][mouseY]);
if (regobj.code == 536 || regobj.code == 220)
drawText(Random(6) + 1033);
else
@@ -3305,7 +3291,7 @@ void useScreenObject() {
} else {
if (screenObject > 0) {
readItemRegister(screenObject);
- goToObject(roomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], roomData->rejapantalla[mouseX][mouseY]);
+ goToObject(currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], currentRoomData->rejapantalla[mouseX][mouseY]);
switch (regobj.usar[0]) {
case 0: {
if (regobj.useTextRef > 0)
@@ -3353,12 +3339,12 @@ void useScreenObject() {
teleencendida = !(teleencendida);
if (teleencendida) {
playVoc("CLICK", 27742, 2458);
- roomData->banderapaleta = true;
+ currentRoomData->banderapaleta = true;
autoPlayVoc("PARASITO", 355778, 20129);
} else {
stopVoc();
playVoc("CLICK", 27742, 2458);
- roomData->banderapaleta = false;
+ currentRoomData->banderapaleta = false;
for (indicex = 195; indicex <= 200; indicex++) {
pal[indicex * 3 + 0] = 2 << 2;
pal[indicex * 3 + 1] = 2 << 2;
@@ -3380,9 +3366,9 @@ void useScreenObject() {
autoPlayVoc("CALDERA", 6433, 15386);
turnLightOn();
g_engine->_mouseManager->show();
- roomData->puntpaleta = 1536;
- roomData->indexadoobjetos[1]->indicefichero = 424;
- roomData->doors[1].abiertacerrada = 1;
+ currentRoomData->puntpaleta = 1536;
+ currentRoomData->indexadoobjetos[1]->indicefichero = 424;
+ currentRoomData->doors[1].abiertacerrada = 1;
} break;
case 359: {
drawText(regobj.useTextRef);
@@ -3394,10 +3380,10 @@ void useScreenObject() {
animateOpen2(0, 0);
g_engine->_mouseManager->show();
updateItem(regobj.code);
- roomData->indexadoobjetos[16]->indicefichero = 362;
- roomData->indexadoobjetos[16]->objectName = "CARBON";
- roomData->indexadoobjetos[1]->indicefichero = 347;
- roomData->indexadoobjetos[1]->objectName = "BOMBILLA";
+ currentRoomData->indexadoobjetos[16]->indicefichero = 362;
+ currentRoomData->indexadoobjetos[16]->objectName = "CARBON";
+ currentRoomData->indexadoobjetos[1]->indicefichero = 347;
+ currentRoomData->indexadoobjetos[1]->objectName = "BOMBILLA";
debug("Enabled bombilla!");
stopVoc();
autoPlayVoc("CALDERA", 6433, 15386);
@@ -3413,7 +3399,7 @@ void useScreenObject() {
if (vasijapuesta) {
drawFlc(108, 0, 2296092, 0, 9, 0, false, false, true, basurillalog);
{
- RoomBitmapRegister &with = roomData->bitmapasociados[0];
+ RoomBitmapRegister &with = currentRoomData->bitmapasociados[0];
with.puntbitmap = 1636796;
with.tambitmap = 628;
@@ -3423,7 +3409,7 @@ void useScreenObject() {
}
for (indlista = 19; indlista <= 21; indlista++)
for (indmoch = 10; indmoch <= 13; indmoch++)
- roomData->mouseGrid[indlista][indmoch] = 12;
+ currentRoomData->mouseGrid[indlista][indmoch] = 12;
} else
drawFlc(108, 0, 2231140, 0, 9, 0, false, false, true, basurillalog);
g_engine->_mouseManager->show();
@@ -3449,14 +3435,14 @@ void openScreenObject() {
uint mouseX = (pulsax + 7) / factorx;
uint mouseY = (pulsay + 7) / factory;
- uint screenObject = roomData->indexadoobjetos[roomData->mouseGrid[mouseX][mouseY]]->indicefichero;
+ uint screenObject = currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[mouseX][mouseY]]->indicefichero;
if (screenObject == 0)
return;
readItemRegister(screenObject);
debug("Read screen object = %s, with code = %d, depth=%d", regobj.name.c_str(), regobj.code, regobj.profundidad);
- goToObject(roomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory],
- roomData->rejapantalla[mouseX][mouseY]);
+ goToObject(currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory],
+ currentRoomData->rejapantalla[mouseX][mouseY]);
if (regobj.abrir == false) {
drawText(Random(9) + 1059);
@@ -3473,23 +3459,23 @@ void openScreenObject() {
sueltapegote = true;
break;
case 415:
- if (roomData->doors[2].abiertacerrada == 2)
+ if (currentRoomData->doors[2].abiertacerrada == 2)
sueltapegote = true;
else {
g_engine->_mouseManager->hide();
animatePickup1(0, 1);
objetos[regobj.profundidad - 1] = NULL;
indicey = 0;
- while (roomData->bitmapasociados[indicey].profund != regobj.profundidad && indicey != 15) {
+ while (currentRoomData->bitmapasociados[indicey].profund != regobj.profundidad && indicey != 15) {
indicey ++;
}
- debug("changing bitmap at %d, with depth = %d", indicey, roomData->bitmapasociados[indicey].profund);
- roomData->bitmapasociados[indicey].puntbitmap = 0;
- roomData->bitmapasociados[indicey].tambitmap = 0;
- roomData->bitmapasociados[indicey].coordx = 0;
- roomData->bitmapasociados[indicey].coordy = 0;
- roomData->bitmapasociados[indicey].profund = 0;
- roomData->doors[2].abiertacerrada = 1;
+ debug("changing bitmap at %d, with depth = %d", indicey, currentRoomData->bitmapasociados[indicey].profund);
+ currentRoomData->bitmapasociados[indicey].puntbitmap = 0;
+ currentRoomData->bitmapasociados[indicey].tambitmap = 0;
+ currentRoomData->bitmapasociados[indicey].coordx = 0;
+ currentRoomData->bitmapasociados[indicey].coordy = 0;
+ currentRoomData->bitmapasociados[indicey].profund = 0;
+ currentRoomData->doors[2].abiertacerrada = 1;
handPantallaToFondo();
assembleScreen();
drawScreen(fondo);
@@ -3497,9 +3483,9 @@ void openScreenObject() {
g_engine->_mouseManager->show();
for (indicey = 0; indicey <= 12; indicey++)
for (indicex = 33; indicex <= 36; indicex++)
- roomData->mouseGrid[indicex][indicey] = 43;
+ currentRoomData->mouseGrid[indicex][indicey] = 43;
for (indicex = 33; indicex <= 35; indicex++)
- roomData->mouseGrid[indicex][13] = 43;
+ currentRoomData->mouseGrid[indicex][13] = 43;
numeroaccion = 0;
oldxrejilla = 0;
oldyrejilla = 0;
@@ -3509,22 +3495,22 @@ void openScreenObject() {
}
break;
case 548:
- if (roomData->doors[0].abiertacerrada == 2)
+ if (currentRoomData->doors[0].abiertacerrada == 2)
sueltapegote = true;
else {
g_engine->_mouseManager->hide();
animatePickup1(1, 1);
objetos[regobj.profundidad - 1] = NULL;
indicey = 0;
- while (roomData->bitmapasociados[indicey].profund != regobj.profundidad && indicey != 14) {
+ while (currentRoomData->bitmapasociados[indicey].profund != regobj.profundidad && indicey != 14) {
indicey ++;
}
- roomData->bitmapasociados[indicey].puntbitmap = 0;
- roomData->bitmapasociados[indicey].tambitmap = 0;
- roomData->bitmapasociados[indicey].coordx = 0;
- roomData->bitmapasociados[indicey].coordy = 0;
- roomData->bitmapasociados[indicey].profund = 0;
- roomData->doors[0].abiertacerrada = 1;
+ currentRoomData->bitmapasociados[indicey].puntbitmap = 0;
+ currentRoomData->bitmapasociados[indicey].tambitmap = 0;
+ currentRoomData->bitmapasociados[indicey].coordx = 0;
+ currentRoomData->bitmapasociados[indicey].coordy = 0;
+ currentRoomData->bitmapasociados[indicey].profund = 0;
+ currentRoomData->doors[0].abiertacerrada = 1;
handPantallaToFondo();
assembleScreen();
drawScreen(fondo);
@@ -3532,22 +3518,22 @@ void openScreenObject() {
g_engine->_mouseManager->show();
indicex = 30;
for (indicey = 17; indicey <= 18; indicey++)
- roomData->mouseGrid[indicex][indicey] = 8;
+ currentRoomData->mouseGrid[indicex][indicey] = 8;
indicex += 1;
for (indicey = 4; indicey <= 20; indicey++)
- roomData->mouseGrid[indicex][indicey] = 8;
+ currentRoomData->mouseGrid[indicex][indicey] = 8;
indicex += 1;
for (indicey = 0; indicey <= 20; indicey++)
- roomData->mouseGrid[indicex][indicey] = 8;
+ currentRoomData->mouseGrid[indicex][indicey] = 8;
indicex += 1;
for (indicey = 0; indicey <= 17; indicey++)
- roomData->mouseGrid[indicex][indicey] = 8;
+ currentRoomData->mouseGrid[indicex][indicey] = 8;
indicex += 1;
for (indicey = 0; indicey <= 12; indicey++)
- roomData->mouseGrid[indicex][indicey] = 8;
+ currentRoomData->mouseGrid[indicex][indicey] = 8;
for (indicex = 35; indicex <= 39; indicex++)
for (indicey = 0; indicey <= 10; indicey++)
- roomData->mouseGrid[indicex][indicey] = 8;
+ currentRoomData->mouseGrid[indicex][indicey] = 8;
numeroaccion = 0;
oldxrejilla = 0;
oldyrejilla = 0;
@@ -3560,7 +3546,7 @@ void openScreenObject() {
drawText(Random(9) + 1059);
return;
}
- roomData->indexadoobjetos[roomData->mouseGrid[mouseX][mouseY]]->indicefichero = regobj.reemplazarpor;
+ currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[mouseX][mouseY]]->indicefichero = regobj.reemplazarpor;
g_engine->_mouseManager->hide();
switch (regobj.altura) {
case 0: {
@@ -3582,13 +3568,13 @@ void openScreenObject() {
g_engine->_mouseManager->show();
for (indicey = regobj.yrej1; indicey <= regobj.yrej2; indicey++)
for (indicex = regobj.xrej1; indicex <= regobj.xrej2; indicex++) {
- roomData->rejapantalla[indicex][indicey] = regobj.parcherejapantalla[indicex - regobj.xrej1][indicey - regobj.yrej1];
- roomData->mouseGrid[indicex][indicey] = regobj.parcherejaraton[indicex - regobj.xrej1][indicey - regobj.yrej1];
+ currentRoomData->rejapantalla[indicex][indicey] = regobj.parcherejapantalla[indicex - regobj.xrej1][indicey - regobj.yrej1];
+ currentRoomData->mouseGrid[indicex][indicey] = regobj.parcherejaraton[indicex - regobj.xrej1][indicey - regobj.yrej1];
}
for (indicex = 0; indicex < 15; indicex++)
- if (roomData->bitmapasociados[indicex].puntbitmap == regobj.punterobitmap) {
- roomData->bitmapasociados[indicex].puntbitmap = regobj.puntparche;
- roomData->bitmapasociados[indicex].tambitmap = regobj.tamparche;
+ if (currentRoomData->bitmapasociados[indicex].puntbitmap == regobj.punterobitmap) {
+ currentRoomData->bitmapasociados[indicex].puntbitmap = regobj.puntparche;
+ currentRoomData->bitmapasociados[indicex].tambitmap = regobj.tamparche;
}
numeroaccion = 0;
}
@@ -3604,13 +3590,13 @@ void closeScreenObject() {
x_del_raton = ((pulsax + 7) / factorx);
y_del_raton = ((pulsay + 7) / factory);
- objeto_de_la_pantalla = roomData->indexadoobjetos[roomData->mouseGrid[x_del_raton][y_del_raton]]->indicefichero;
+ objeto_de_la_pantalla = currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[x_del_raton][y_del_raton]]->indicefichero;
if (objeto_de_la_pantalla == 0)
return;
// verifyCopyProtection2();
readItemRegister(objeto_de_la_pantalla);
- goToObject(roomData->rejapantalla[((characterPosX + rectificacionx) / factorx)][((characterPosY + rectificaciony) / factory)],
- roomData->rejapantalla[x_del_raton][y_del_raton]);
+ goToObject(currentRoomData->rejapantalla[((characterPosX + rectificacionx) / factorx)][((characterPosY + rectificaciony) / factory)],
+ currentRoomData->rejapantalla[x_del_raton][y_del_raton]);
if (regobj.cerrar == false) {
drawText((Random(10) + 1068));
return;
@@ -3632,7 +3618,7 @@ void closeScreenObject() {
drawText(Random(10) + 1068);
return;
}
- roomData->indexadoobjetos[roomData->mouseGrid[x_del_raton][y_del_raton]]->indicefichero = regobj.reemplazarpor;
+ currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[x_del_raton][y_del_raton]]->indicefichero = regobj.reemplazarpor;
g_engine->_mouseManager->hide();
switch (regobj.altura) {
case 0: {
@@ -3654,13 +3640,13 @@ void closeScreenObject() {
g_engine->_mouseManager->show();
for (indicey = regobj.yrej1; indicey <= regobj.yrej2; indicey++)
for (indicex = regobj.xrej1; indicex <= regobj.xrej2; indicex++) {
- roomData->rejapantalla[indicex][indicey] = regobj.parcherejapantalla[indicex - regobj.xrej1][indicey - regobj.yrej1];
- roomData->mouseGrid[indicex][indicey] = regobj.parcherejaraton[indicex - regobj.xrej1][indicey - regobj.yrej1];
+ currentRoomData->rejapantalla[indicex][indicey] = regobj.parcherejapantalla[indicex - regobj.xrej1][indicey - regobj.yrej1];
+ currentRoomData->mouseGrid[indicex][indicey] = regobj.parcherejaraton[indicex - regobj.xrej1][indicey - regobj.yrej1];
}
for (indicex = 0; indicex < 15; indicex++)
- if (roomData->bitmapasociados[indicex].puntbitmap == regobj.punterobitmap) {
- roomData->bitmapasociados[indicex].puntbitmap = regobj.puntparche;
- roomData->bitmapasociados[indicex].tambitmap = regobj.tamparche;
+ if (currentRoomData->bitmapasociados[indicex].puntbitmap == regobj.punterobitmap) {
+ currentRoomData->bitmapasociados[indicex].puntbitmap = regobj.puntparche;
+ currentRoomData->bitmapasociados[indicex].tambitmap = regobj.tamparche;
}
numeroaccion = 0;
}
@@ -3858,7 +3844,6 @@ static void getScreen(byte *background) {
}
static void scrollRight(uint &horizontalPos) {
- uint indicesc;
int characterPos = 25 + (320 - (characterPosX + rectificacionx * 2));
// We scroll 4 by 4 pixels so we divide by 4 to find out the number of necessary steps
@@ -3871,9 +3856,9 @@ static void scrollRight(uint &horizontalPos) {
memmove(fondo + 4, fondo + 8, numBytes);
horizontalPos += 4;
- for (int i = 0; i < 140; i++) {
+ for (int k = 0; k < 140; k++) {
for (int j = 0; j < 4; j++) {
- fondo[320 + i * 320 + j] = handpantalla[horizontalPos + i * 320 + j];
+ fondo[320 + k * 320 + j] = handpantalla[horizontalPos + k * 320 + j];
}
}
if (characterPos > 0) {
@@ -3925,9 +3910,9 @@ static void scrollLeft(uint &poshor) {
}
poshor -= 4;
- for (int i = 0; i < 140; i++) {
+ for (int k = 0; k < 140; k++) {
for (int j = 0; j < 4; j++) {
- fondo[4 + i * 320 + j] = handpantalla[4 + poshor + i * 320 + j];
+ fondo[4 + k * 320 + j] = handpantalla[4 + poshor + k * 320 + j];
}
}
@@ -3982,13 +3967,13 @@ void loadScrollData(uint numpantalla, boolean scrollder, uint poshor, int correc
Common::File fichpanta;
rooms->seek(numpantalla * roomRegSize, SEEK_SET);
- roomData = readScreenDataFile(rooms);
+ currentRoomData = readScreenDataFile(rooms);
loadScreen();
// Fondo now contains background B, handpantalla contains background B
for (indicecarga = 0; indicecarga < 15; indicecarga++) {
{
- RoomBitmapRegister &with = roomData->bitmapasociados[indicecarga];
+ RoomBitmapRegister &with = currentRoomData->bitmapasociados[indicecarga];
if (with.tambitmap > 0)
loadItem(with.coordx, with.coordy, with.tambitmap, with.puntbitmap, with.profund);
}
@@ -4190,7 +4175,7 @@ void saveGame(byte numeropartida) {
void saveGameToRegister() {
uint indiaux;
- regpartida.numeropantalla = roomData->codigo;
+ regpartida.numeropantalla = currentRoomData->codigo;
regpartida.longtray = longtray;
regpartida.indicetray = indicetray;
regpartida.codigoobjmochila = codigoobjmochila;
@@ -4384,7 +4369,7 @@ void loadGame(regispartida game) {
loadPalette("DEFAULT");
loadScreenData(game.numeropantalla);
- switch (roomData->codigo) {
+ switch (currentRoomData->codigo) {
case 2: {
if (teleencendida)
autoPlayVoc("PARASITO", 355778, 20129);
@@ -4405,22 +4390,22 @@ void loadGame(regispartida game) {
autoPlayVoc("CALDERA", 6433, 15386);
} break;
case 17: {
- if (libro[0] == true && roomData->banderamovimiento)
+ if (libro[0] == true && currentRoomData->banderamovimiento)
disableSecondAnimation();
} break;
case 20: {
switch (hornacina[0][hornacina[0][3]]) {
case 0:
- roomData->indexadoobjetos[9]->objectName = "HORNACINA";
+ currentRoomData->indexadoobjetos[9]->objectName = "HORNACINA";
break;
case 561:
- roomData->indexadoobjetos[9]->objectName = "ESTATUA DIVINA";
+ currentRoomData->indexadoobjetos[9]->objectName = "ESTATUA DIVINA";
break;
case 563:
- roomData->indexadoobjetos[9]->objectName = "MANUAL DE ALFARERO";
+ currentRoomData->indexadoobjetos[9]->objectName = "MANUAL DE ALFARERO";
break;
case 615:
- roomData->indexadoobjetos[9]->objectName = "ESTATUA GROTESCA";
+ currentRoomData->indexadoobjetos[9]->objectName = "ESTATUA GROTESCA";
break;
}
} break;
@@ -4431,39 +4416,39 @@ void loadGame(regispartida game) {
case 24: {
switch (hornacina[1][hornacina[1][3]]) {
case 0:
- roomData->indexadoobjetos[8]->objectName = "HORNACINA";
+ currentRoomData->indexadoobjetos[8]->objectName = "HORNACINA";
break;
case 561:
- roomData->indexadoobjetos[8]->objectName = "ESTATUA DIVINA";
+ currentRoomData->indexadoobjetos[8]->objectName = "ESTATUA DIVINA";
break;
case 615:
- roomData->indexadoobjetos[8]->objectName = "ESTATUA GROTESCA";
+ currentRoomData->indexadoobjetos[8]->objectName = "ESTATUA GROTESCA";
break;
case 622:
- roomData->indexadoobjetos[8]->objectName = "PARED";
+ currentRoomData->indexadoobjetos[8]->objectName = "PARED";
break;
case 623:
- roomData->indexadoobjetos[8]->objectName = "TORNO";
+ currentRoomData->indexadoobjetos[8]->objectName = "TORNO";
break;
}
if (trampa_puesta) {
- roomData->banderamovimiento = true;
- loadAnimation(roomData->nombremovto);
+ currentRoomData->banderamovimiento = true;
+ loadAnimation(currentRoomData->nombremovto);
iframe2 = 0;
indicetray2 = 1;
- roomData->tray2[indicetray2 - 1].x = 214 - 15;
- roomData->tray2[indicetray2 - 1].y = 115 - 42;
- animado.dir = roomData->dir2[indicetray2 - 1];
- animado.posx = roomData->tray2[indicetray2 - 1].x;
- animado.posy = roomData->tray2[indicetray2 - 1].y;
+ currentRoomData->tray2[indicetray2 - 1].x = 214 - 15;
+ currentRoomData->tray2[indicetray2 - 1].y = 115 - 42;
+ animado.dir = currentRoomData->dir2[indicetray2 - 1];
+ animado.posx = currentRoomData->tray2[indicetray2 - 1].x;
+ animado.posy = currentRoomData->tray2[indicetray2 - 1].y;
animado.profundidad = 14;
for (indiaux = 0; indiaux < maxrejax; indiaux++)
for (indiaux2 = 0; indiaux2 < maxrejay; indiaux2++) {
if (rejamascaramovto[indiaux][indiaux2] > 0)
- roomData->rejapantalla[oldposx + indiaux][oldposy + indiaux2] = rejamascaramovto[indiaux][indiaux2];
+ currentRoomData->rejapantalla[oldposx + indiaux][oldposy + indiaux2] = rejamascaramovto[indiaux][indiaux2];
if (rejamascararaton[indiaux][indiaux2] > 0)
- roomData->mouseGrid[oldposx + indiaux][oldposy + indiaux2] = rejamascararaton[indiaux][indiaux2];
+ currentRoomData->mouseGrid[oldposx + indiaux][oldposy + indiaux2] = rejamascararaton[indiaux][indiaux2];
}
}
assembleScreen();
@@ -4473,7 +4458,7 @@ void loadGame(regispartida game) {
mask();
posicioninv = 0;
drawBackpack();
- if (rojo_capturado == false && roomData->codigo == 24 && trampa_puesta == false)
+ if (rojo_capturado == false && currentRoomData->codigo == 24 && trampa_puesta == false)
runaroundRed();
effect(tipoefectofundido, false, fondo);
}
@@ -4743,7 +4728,7 @@ void saveLoad() {
else {
regindfich.ultimapartida = 1;
for (int i = 0; i < 6; i++) {
- regindfich.listapartidas[i] = Common::String("DISPONIBLE " + (char)(i + 48));
+ regindfich.listapartidas[i] = Common::String().format("DISPONIBLE %d", i);
}
}
salirmenufunciones = false;
@@ -4756,8 +4741,8 @@ void saveLoad() {
getImg(50, 10, 270, 120, puntfondmenu);
for (int i = 0; i < 6; i++) {
- uint ytext = i + 1;
- buttonBorder((120 - (ytext * 10)), (80 - (ytext * 10)), (200 + (ytext * 10)), (60 + (ytext * 10)), 251, 251, 251, 251, 0, 0, "");
+ uint textY = i + 1;
+ buttonBorder((120 - (textY * 10)), (80 - (textY * 10)), (200 + (textY * 10)), (60 + (textY * 10)), 251, 251, 251, 251, 0, 0, "");
}
drawMenu(2);
if (desactivagrabar) {
@@ -4802,7 +4787,7 @@ void saveLoad() {
pulsax = e.mouse.x;
pulsay = e.mouse.y;
}
- else if (e.type = Common::EVENT_KEYUP){
+ else if (e.type == Common::EVENT_KEYUP){
keyPressed = true;
}
}
@@ -4812,7 +4797,7 @@ void saveLoad() {
g_system->delayMillis(10);
} while (!keyPressed && !mouseClicked && !g_engine->shouldQuit());
- if(mouseClicked)
+ if(mouseClicked) {
if(pulsay >= 13 && pulsay <= 16){
if(pulsax >= 54 && pulsax <=124){
if (partidaselecc > 0 && !desactivagrabar && (nombrepartida != Common::String("DISPONIBLE ") + (char)(partidaselecc + 48)) && (nombrepartida != "")) {
@@ -4925,6 +4910,7 @@ void saveLoad() {
seleccionaPartida(regindfich, 5);
nombrepartida = regindfich.listapartidas[5];
}
+ }
if (partidaselecc > 0 && keypressed()) {
g_engine->_mouseManager->hide();
@@ -4949,15 +4935,13 @@ void loadTalkAnimations() {
if (!fichcani.open("TIOHABLA.SEC")) {
error("Error opening file animation (265)");
}
- int32 posfilehabla, pasosize;
- uint size;
+ int32 posfilehabla;
sizeframe = fichcani.readUint16LE();
posfilehabla = sizeframe * 16;
posfilehabla = (posfilehabla * direccionmovimiento) + 2;
fichcani.seek(posfilehabla);
- pasosize = 0;
debug("LoadTalk direccionmovimiento=%d", direccionmovimiento);
for (int i = 0; i < 16; i++) {
secuencia.bitmap[0][i] = (byte *)malloc(sizeframe);
@@ -4965,7 +4949,7 @@ void loadTalkAnimations() {
}
fichcani.close();
- if ((roomData->nombremovto != "PETER") && (roomData->nombremovto != "ARZCAEL")) {
+ if ((currentRoomData->nombremovto != "PETER") && (currentRoomData->nombremovto != "ARZCAEL")) {
iframe2 = 0;
free(pasoanimado);
boolean result;
@@ -4977,7 +4961,7 @@ void loadTalkAnimations() {
result = fichcani.open("ALFRED.SEC");
break;
default:
- result = fichcani.open(Common::Path(roomData->nombremovto + Common::String(".SEC")));
+ result = fichcani.open(Common::Path(currentRoomData->nombremovto + Common::String(".SEC")));
}
if (!result)
@@ -4987,7 +4971,6 @@ void loadTalkAnimations() {
numerodir = fichcani.readByte();
pasoanimado = (byte *)malloc(sizeanimado);
- pasosize = 0;
if (numerodir != 0) {
secondaryAnimationFrameCount = secondaryAnimationFrameCount / 4;
for (int i = 0; i <= 3; i++) {
@@ -5003,9 +4986,6 @@ void loadTalkAnimations() {
void unloadTalkAnimations() {
- int32 pasosize;
- uint size, indice1;
-
Common::File fichcani;
if (!fichcani.open("PERSONAJ.SPT")) {
error("Error loading character sprite! 265");
@@ -5018,8 +4998,8 @@ void unloadTalkAnimations() {
}
fichcani.close();
- if ((roomData->nombremovto != "PETER") && (roomData->nombremovto != "ARZCAEL")) {
- if (!fichcani.open(Common::Path(roomData->nombremovto + ".DAT"))) {
+ if ((currentRoomData->nombremovto != "PETER") && (currentRoomData->nombremovto != "ARZCAEL")) {
+ if (!fichcani.open(Common::Path(currentRoomData->nombremovto + ".DAT"))) {
error("loading secondary animation after talk (265)");
}
sizeanimado = fichcani.readUint16LE();
@@ -5074,7 +5054,7 @@ void hypertext(
byte *fondotextht;
byte matrizsaltosht[15];
g_engine->_mouseManager->hide();
- switch (roomData->codigo) {
+ switch (currentRoomData->codigo) {
case 2: { // Leisure room
xht = 10;
yht = 2;
@@ -5151,7 +5131,7 @@ void hypertext(
insertarnombre = 0;
for (int i = 0; i < regmht.cadenatext.size(); i++) {
- regmht.cadenatext.setChar(encriptado[i] ^ regmht.cadenatext[i], i);
+ regmht.cadenatext.setChar(decryptionKey[i] ^ regmht.cadenatext[i], i);
if (regmht.cadenatext[i] == '@')
insertarnombre = i;
}
@@ -5209,7 +5189,6 @@ void hypertext(
for (lineaht = 1; lineaht <= iteracionesht; lineaht++) {
- int size = matrizsaltosht[lineaht] - matrizsaltosht[lineaht - 1];
Common::String lineString = Common::String(regmht.cadenatext.c_str() + matrizsaltosht[lineaht - 1], regmht.cadenatext.c_str() + matrizsaltosht[lineaht]);
outtextxy(xht + 1, yht + ((lineaht - 1) * 11), lineString, colorsombraht);
@@ -5269,13 +5248,13 @@ void hypertext(
sprites(true);
direccionmovimiento = direccionmovimientopaso;
} else {
- if (indicetray2 >= roomData->longtray2)
+ if (indicetray2 >= currentRoomData->longtray2)
indicetray2 = 1;
else
indicetray2 += 1;
- animado.posx = roomData->tray2[indicetray2 - 1].x;
- animado.posy = roomData->tray2[indicetray2 - 1].y;
- animado.dir = roomData->dir2[indicetray2 - 1];
+ animado.posx = currentRoomData->tray2[indicetray2 - 1].x;
+ animado.posy = currentRoomData->tray2[indicetray2 - 1].y;
+ animado.dir = currentRoomData->dir2[indicetray2 - 1];
if (iframe2 >= secondaryAnimationFrameCount - 1)
iframe2 = 0;
else
@@ -5283,13 +5262,13 @@ void hypertext(
sprites(false);
}
}
- if (roomData->banderapaleta && saltospal >= 4) {
+ if (currentRoomData->banderapaleta && saltospal >= 4) {
saltospal = 0;
if (movidapaleta > 6)
movidapaleta = 0;
else
movidapaleta += 1;
- if (roomData->codigo == 4 && movidapaleta == 4)
+ if (currentRoomData->codigo == 4 && movidapaleta == 4)
pitavocmem();
updatePalette(movidapaleta);
} else
@@ -5310,7 +5289,7 @@ void hypertext(
void wcScene() {
palette palwater;
- zonaactual = roomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory];
+ zonaactual = currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory];
goToObject(zonaactual, zonadestino);
copyPalette(pal, palwater);
@@ -5480,7 +5459,6 @@ void initializeObjectFile() {
error("initializeObjectFile(): ioresult (261)");
}
delete (invItemData);
- int objIndex = 0;
byte *objectData = (byte *)malloc(objFile.size());
objFile.read(objectData, objFile.size());
invItemData = new Common::MemorySeekableReadWriteStream(objectData, objFile.size(), DisposeAfterUse::NO);
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
index 478efb42732..786872218ca 100644
--- a/engines/tot/routines2.cpp
+++ b/engines/tot/routines2.cpp
@@ -75,13 +75,13 @@ void loadAnimation(Common::String animacion) {
}
fichcani.close();
- debug("Read all frames! longtray2=%d", roomData->longtray2);
+ debug("Read all frames! longtray2=%d", currentRoomData->longtray2);
anchoanimado = READ_LE_UINT16(animado.dib[0][1]);
altoanimado = READ_LE_UINT16(animado.dib[0][1] + 2);
setRoomTrajectories(altoanimado, anchoanimado, SET_WITH_ANIM, false);
- readItemRegister(roomData->dir2[299]);
+ readItemRegister(currentRoomData->dir2[299]);
maxrejax = (regobj.xrej2 - regobj.xrej1 + 1);
maxrejay = (regobj.yrej2 - regobj.yrej1 + 1);
oldposx = regobj.xrej1 + 1;
@@ -99,8 +99,8 @@ void loadAnimation(Common::String animacion) {
for (int j = 0; j < maxrejay; j++) {
rejamascaramovto[i][j] = regobj.parcherejapantalla[i][j];
rejamascararaton[i][j] = regobj.parcherejaraton[i][j];
- rejafondomovto[i][j] = roomData->rejapantalla[oldposx + i][oldposy + j];
- rejafondoraton[i][j] = roomData->mouseGrid[oldposx + i][oldposy + j];
+ rejafondomovto[i][j] = currentRoomData->rejapantalla[oldposx + i][oldposy + j];
+ rejafondoraton[i][j] = currentRoomData->mouseGrid[oldposx + i][oldposy + j];
}
iframe2 = 0;
debug("Finished loading animation!");
@@ -116,95 +116,95 @@ void updateAltScreen(byte otherScreenNumber) {
uint i22;
uint i11;
- byte currentScreen = roomData->codigo;
+ byte currentScreen = currentRoomData->codigo;
setRoomTrajectories(altoanimado, anchoanimado, RESTORE);
//Save current room
- saveRoomData(roomData, rooms);
+ saveRoomData(currentRoomData, rooms);
//Load other screen
rooms->seek(otherScreenNumber * roomRegSize, SEEK_SET);
- roomData = readScreenDataFile(rooms);
+ currentRoomData = readScreenDataFile(rooms);
switch (otherScreenNumber) {
case 20: {
switch (hornacina[0][hornacina[0][3]]) {
case 0: {
- roomData->indexadoobjetos[9]->objectName = "HORNACINA";
- roomData->bitmapasociados[1].puntbitmap = 1190768;
+ currentRoomData->indexadoobjetos[9]->objectName = "HORNACINA";
+ currentRoomData->bitmapasociados[1].puntbitmap = 1190768;
} break;
case 561: {
- roomData->indexadoobjetos[9]->objectName = "ESTATUA DIVINA";
- roomData->bitmapasociados[1].puntbitmap = 1182652;
+ currentRoomData->indexadoobjetos[9]->objectName = "ESTATUA DIVINA";
+ currentRoomData->bitmapasociados[1].puntbitmap = 1182652;
} break;
case 563: {
- roomData->indexadoobjetos[9]->objectName = "MANUAL DE ALFARERO";
- roomData->bitmapasociados[1].puntbitmap = 1186044;
+ currentRoomData->indexadoobjetos[9]->objectName = "MANUAL DE ALFARERO";
+ currentRoomData->bitmapasociados[1].puntbitmap = 1186044;
} break;
case 615: {
- roomData->indexadoobjetos[9]->objectName = "ESTATUA GROTESCA";
- roomData->bitmapasociados[1].puntbitmap = 1181760;
+ currentRoomData->indexadoobjetos[9]->objectName = "ESTATUA GROTESCA";
+ currentRoomData->bitmapasociados[1].puntbitmap = 1181760;
} break;
}
- roomData->bitmapasociados[1].tambitmap = 892;
- roomData->bitmapasociados[1].coordx = 66;
- roomData->bitmapasociados[1].coordy = 35;
- roomData->bitmapasociados[1].profund = 1;
+ currentRoomData->bitmapasociados[1].tambitmap = 892;
+ currentRoomData->bitmapasociados[1].coordx = 66;
+ currentRoomData->bitmapasociados[1].coordy = 35;
+ currentRoomData->bitmapasociados[1].profund = 1;
} break;
case 24: {
switch (hornacina[1][hornacina[1][3]]) {
case 0: {
- roomData->indexadoobjetos[8]->objectName = "HORNACINA";
- roomData->bitmapasociados[0].puntbitmap = 1399610;
+ currentRoomData->indexadoobjetos[8]->objectName = "HORNACINA";
+ currentRoomData->bitmapasociados[0].puntbitmap = 1399610;
} break;
case 561: {
- roomData->indexadoobjetos[8]->objectName = "ESTATUA DIVINA";
- roomData->bitmapasociados[0].puntbitmap = 1381982;
+ currentRoomData->indexadoobjetos[8]->objectName = "ESTATUA DIVINA";
+ currentRoomData->bitmapasociados[0].puntbitmap = 1381982;
} break;
case 615: {
- roomData->indexadoobjetos[8]->objectName = "ESTATUA GROTESCA";
- roomData->bitmapasociados[0].puntbitmap = 1381090;
+ currentRoomData->indexadoobjetos[8]->objectName = "ESTATUA GROTESCA";
+ currentRoomData->bitmapasociados[0].puntbitmap = 1381090;
} break;
case 622: {
- roomData->indexadoobjetos[8]->objectName = "PARED";
- roomData->bitmapasociados[0].puntbitmap = 1400502;
+ currentRoomData->indexadoobjetos[8]->objectName = "PARED";
+ currentRoomData->bitmapasociados[0].puntbitmap = 1400502;
} break;
case 623: {
- roomData->indexadoobjetos[8]->objectName = "TORNO";
- roomData->bitmapasociados[0].puntbitmap = 1398718;
+ currentRoomData->indexadoobjetos[8]->objectName = "TORNO";
+ currentRoomData->bitmapasociados[0].puntbitmap = 1398718;
} break;
}
- roomData->bitmapasociados[0].tambitmap = 892;
- roomData->bitmapasociados[0].coordx = 217;
- roomData->bitmapasociados[0].coordy = 48;
- roomData->bitmapasociados[0].profund = 1;
+ currentRoomData->bitmapasociados[0].tambitmap = 892;
+ currentRoomData->bitmapasociados[0].coordx = 217;
+ currentRoomData->bitmapasociados[0].coordy = 48;
+ currentRoomData->bitmapasociados[0].profund = 1;
} break;
case 31: {
for (i11 = 23; i11 <= 25; i11++)
for (i22 = 4; i22 <= 9; i22++)
- roomData->mouseGrid[i11][i22] = 4;
+ currentRoomData->mouseGrid[i11][i22] = 4;
for (i11 = 23; i11 <= 25; i11++)
for (i22 = 10; i22 <= 11; i22++)
- roomData->mouseGrid[i11][i22] = 3;
+ currentRoomData->mouseGrid[i11][i22] = 3;
- roomData->bitmapasociados[0].tambitmap = 0;
- roomData->bitmapasociados[0].puntbitmap = 0;
- roomData->bitmapasociados[0].coordx = 0;
- roomData->bitmapasociados[0].coordy = 0;
- roomData->bitmapasociados[0].profund = 0;
+ currentRoomData->bitmapasociados[0].tambitmap = 0;
+ currentRoomData->bitmapasociados[0].puntbitmap = 0;
+ currentRoomData->bitmapasociados[0].coordx = 0;
+ currentRoomData->bitmapasociados[0].coordy = 0;
+ currentRoomData->bitmapasociados[0].profund = 0;
} break;
}
setRoomTrajectories(altoanimado, anchoanimado, RESTORE);
// Save other screen
- saveRoomData(roomData, rooms);
+ saveRoomData(currentRoomData, rooms);
// Restore current room again
rooms->seek(currentScreen * roomRegSize, SEEK_SET);
- roomData = readScreenDataFile(rooms);
+ currentRoomData = readScreenDataFile(rooms);
setRoomTrajectories(altoanimado, anchoanimado, SET_WITH_ANIM);
}
@@ -258,7 +258,7 @@ void cargatele() {
if (!fichct.open("PALETAS.DAT")) {
error("cargatele(): ioresult (310)");
}
- fichct.seek(roomData->puntpaleta + 603);
+ fichct.seek(currentRoomData->puntpaleta + 603);
fichct.read(movimientopal, 144);
fichct.close();
@@ -274,17 +274,17 @@ void loadScreen() {
Common::File fichcp;
palette palcp;
- sizepantalla = roomData->tamimagenpantalla;
- readBitmap(roomData->puntimagenpantalla, fondo, sizepantalla, 316);
+ sizepantalla = currentRoomData->tamimagenpantalla;
+ readBitmap(currentRoomData->puntimagenpantalla, fondo, sizepantalla, 316);
Common::copy(fondo, fondo + sizepantalla, handpantalla);
switch (parte_del_juego) {
case 1: {
if (!fichcp.open("PALETAS.DAT")) {
error("loadScreen(): ioresult (310)");
}
- fichcp.seek(roomData->puntpaleta);
+ fichcp.seek(currentRoomData->puntpaleta);
fichcp.read(palcp, 603);
- if (roomData->banderapaleta) {
+ if (currentRoomData->banderapaleta) {
fichcp.read(movimientopal, 144);
for (int i = 0; i <= 48; i++) {
movimientopal[i * 3 + 0] = movimientopal[i * 3 + 0] << 2;
@@ -302,7 +302,7 @@ void loadScreen() {
} break;
case 2: {
loadPalette("SEGUNDA");
- roomData->banderapaleta = true;
+ currentRoomData->banderapaleta = true;
} break;
}
}
@@ -401,8 +401,6 @@ void loadItemWithFixedDepth(uint coordx, uint coordy, uint tamdibujo, int32 dibu
uint16 w, h;
w = READ_LE_UINT16(objetos[prof]);
h = READ_LE_UINT16(objetos[prof] + 2);
- debug("Reading objeto with depth=%d, posx=%d,posy=%d", prof, coordx, coordy);
- debug("-------------------------");
profundidad[prof].posx = coordx;
profundidad[prof].posy = coordy;
profundidad[prof].posx2 = coordx + w + 1;
@@ -805,36 +803,36 @@ void checkMouseGrid() {
if(yraton >= 0 && yraton <= 131) {
xrejilla = (xraton + 7) / factorx;
yrejilla = (yraton + 7) / factory;
- if (roomData->mouseGrid[xrejilla][yrejilla] != roomData->mouseGrid[oldxrejilla][oldyrejilla] || oldobjmochila != "") {
+ if (currentRoomData->mouseGrid[xrejilla][yrejilla] != currentRoomData->mouseGrid[oldxrejilla][oldyrejilla] || oldobjmochila != "") {
bar(0, 140, 319, 149, 0);
Common::String actionLine;
switch (numeroaccion) {
case 0:
- actionLine = Common::String("IR A ") + roomData->indexadoobjetos[roomData->mouseGrid[xrejilla][yrejilla]]->objectName;
+ actionLine = Common::String("IR A ") + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
break;
case 1:
- actionLine = Common::String("HABLAR CON ") + roomData->indexadoobjetos[roomData->mouseGrid[xrejilla][yrejilla]]->objectName;
+ actionLine = Common::String("HABLAR CON ") + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
break;
case 2:
- actionLine = Common::String("COGER ") + roomData->indexadoobjetos[roomData->mouseGrid[xrejilla][yrejilla]]->objectName;
+ actionLine = Common::String("COGER ") + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
break;
case 3:
- actionLine = Common::String("MIRAR ") + roomData->indexadoobjetos[roomData->mouseGrid[xrejilla][yrejilla]]->objectName;
+ actionLine = Common::String("MIRAR ") + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
break;
case 4:
if (objetomochila != "")
- actionLine = Common::String("USAR ") + objetomochila + " CON " + roomData->indexadoobjetos[roomData->mouseGrid[xrejilla][yrejilla]]->objectName;
+ actionLine = Common::String("USAR ") + objetomochila + " CON " + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
else
- actionLine = Common::String("USAR ") + roomData->indexadoobjetos[roomData->mouseGrid[xrejilla][yrejilla]]->objectName;
+ actionLine = Common::String("USAR ") + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
break;
case 5:
- actionLine = Common::String("ABRIR ") + roomData->indexadoobjetos[roomData->mouseGrid[xrejilla][yrejilla]]->objectName;
+ actionLine = Common::String("ABRIR ") + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
break;
case 6:
- actionLine = Common::String("CERRAR ") + roomData->indexadoobjetos[roomData->mouseGrid[xrejilla][yrejilla]]->objectName;
+ actionLine = Common::String("CERRAR ") + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
break;
default:
- actionLine = Common::String("IR A ") + roomData->indexadoobjetos[roomData->mouseGrid[xrejilla][yrejilla]]->objectName;
+ actionLine = Common::String("IR A ") + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
}
actionLineText(actionLine);
g_engine->_mouseManager->show();
@@ -1086,9 +1084,6 @@ void hipercadena(
matrizsaltoshc[iteracioneshc] = cadenatextnueva.size();
for (lineahc = 1; lineahc <= iteracioneshc; lineahc++) {
-
- int size = matrizsaltoshc[lineahc] - matrizsaltoshc[lineahc - 1];
-
Common::String lineString = cadenatextnueva.substr(matrizsaltoshc[lineahc - 1], matrizsaltoshc[lineahc] - matrizsaltoshc[lineahc - 1]);
outtextxy((xhcnueva + 1), (yhcnueva + ((lineahc - 1) * 11) + 1), lineString, colorsombrahc, true);
g_engine->_screen->update();
@@ -1122,18 +1117,18 @@ void buttonBorder(uint x1, uint y1, uint x2, uint y2,
void copyProtection();
-static void buttonPress(uint xx1, uint yy1, uint xx2, uint yy2, boolean bandera) {
- g_engine->_mouseManager->hide();
+// static void buttonPress(uint xx1, uint yy1, uint xx2, uint yy2, boolean bandera) {
+// g_engine->_mouseManager->hide();
- byte color = bandera ? 249 : 255;
+// byte color = bandera ? 249 : 255;
- line(xx1, yy1, (xx2 - 1), yy1, color);
- line(xx1, yy1, xx1, (yy2 - 1), color);
- color = bandera ? 255 : 249;
- line((xx1 + 1), yy2, xx2, yy2, color);
- line(xx2, (yy1 + 1), xx2, yy2, color);
- g_engine->_mouseManager->show();
-}
+// line(xx1, yy1, (xx2 - 1), yy1, color);
+// line(xx1, yy1, xx1, (yy2 - 1), color);
+// color = bandera ? 255 : 249;
+// line((xx1 + 1), yy2, xx2, yy2, color);
+// line(xx2, (yy1 + 1), xx2, yy2, color);
+// g_engine->_mouseManager->show();
+// }
void copyProtection() {
// const int retardopitido = 100;
@@ -1461,8 +1456,8 @@ void drawCreditsScreen(byte *&fondopp, uint &sizefondo2, byte *&fondo2) {
fichpp.read(fondopp, 64000);
fichpp.close();
- uint16 sizehor2 = READ_LE_UINT16(fondopp);
- uint16 sizever2 = READ_LE_UINT16(fondopp + 2);
+ // uint16 sizehor2 = READ_LE_UINT16(fondopp);
+ // uint16 sizever2 = READ_LE_UINT16(fondopp + 2);
drawFullScreen(fondopp);
@@ -1491,7 +1486,7 @@ void drawCreditsScreen(byte *&fondopp, uint &sizefondo2, byte *&fondo2) {
void putCreditsImg(uint x, uint y, byte *imagen1, byte *imagen2, boolean direct) {
uint16 wImagen1, hImagen1;
- uint auxhor, kaka;
+ uint auxhor;
uint incremento, incremento2;
byte *paso;
@@ -1521,7 +1516,7 @@ void putCreditsImg(uint x, uint y, byte *imagen1, byte *imagen2, boolean direct)
kaka = kk + y;
for (int jj = 0; jj <= wImagen1; jj++) {
incremento = incremento2 + jj;
- if(direct && imagen1[incremento] > 0 || (imagen1[incremento] > 16 && kaka >= 66 && kaka <= 192)) {
+ if((direct && imagen1[incremento] > 0) || (imagen1[incremento] > 16 && kaka >= 66 && kaka <= 192)) {
paso[incremento] = imagen1[incremento];
}
else if (imagen1[incremento] > 16) {
@@ -1666,7 +1661,7 @@ void removeTitle(byte *&fondo2) {
byte *src2 = fondo2 + 4 + ((j2 + 1) * 320) + i2;
byte *dest2 = ((byte *)g_engine->_screen->getPixels()) + ((j2 + 1) * 320) + i2;
- Common::copy(src2, src2 + 2, dest);
+ Common::copy(src2, src2 + 2, dest2);
i2 = Random(320);
j2 = Random(60);
@@ -1771,7 +1766,6 @@ void credits() {
if (keyPressed() || salirpitando)
goto Lsalida;
copyFromScreen(fondopp);
- (fondopp);
if (keyPressed() || salirpitando)
goto Lsalida;
scrollCredit(121308, 8004, pal2, fondopp, salirpitando, 80, false, true);
@@ -2191,7 +2185,6 @@ void exitToDOS() {
}
} else if (e.type == Common::EVENT_LBUTTONUP) {
uint x = e.mouse.x;
- uint y = e.mouse.y;
if (x < 145) {
free(puntfondcontroles);
// exit game
@@ -2215,8 +2208,8 @@ void exitToDOS() {
void soundControls() {
uint oldxraton, oldyraton, tamfondcontroles, tamslade, tamfondoslade,
- xfade, oldxfade, ypaso, volumenfx, volumenmelodia;
- byte ytext, oldiraton, oldcolorcontroles;
+ volumenfx, volumenmelodia;
+ byte ytext, oldiraton;
boolean salirmenucontroles;
salirmenucontroles = false;
@@ -2352,8 +2345,8 @@ void sacrifice() {
palette palaux;
stopVoc();
- boolean pulsada_salida = roomData->banderapaleta;
- roomData->banderapaleta = false;
+ boolean pulsada_salida = currentRoomData->banderapaleta;
+ currentRoomData->banderapaleta = false;
bar(0, 139, 319, 149, 0);
bar(10, 10, 300, 120, 0);
@@ -2646,7 +2639,7 @@ void sacrifice() {
}
delay(2000);
totalFadeOut(0);
- roomData->banderapaleta = pulsada_salida;
+ currentRoomData->banderapaleta = pulsada_salida;
}
void ending() {
@@ -2714,14 +2707,13 @@ void loadDevil() {
void assembleCompleteBackground(byte *image, uint coordx, uint coordy) {
uint16 w, h;
- uint16 wFondo, hFondo;
+ uint16 wFondo;
w = READ_LE_UINT16(image);
h = READ_LE_UINT16(image + 2);
wFondo = READ_LE_UINT16(fondo);
- hFondo = READ_LE_UINT16(fondo + 2);
+
wFondo++;
- hFondo++;
w++;
h++;
for (int i = 0; i < w; i++) {
@@ -2748,17 +2740,15 @@ void assembleScreen(boolean scroll) {
if (!scroll && secuencia.profundidad == indice) {
assembleCompleteBackground(secuencia.bitmap[direccionmovimiento][iframe], characterPosX, characterPosY);
}
- if (!scroll && roomData->banderamovimiento && animado.profundidad == indice) {
+ if (!scroll && currentRoomData->banderamovimiento && animado.profundidad == indice) {
assembleCompleteBackground(pasoanimado, animado.posx, animado.posy);
}
}
}
void disableSecondAnimation() {
- uint ii11, ii22;
-
setRoomTrajectories(altoanimado, anchoanimado, RESTORE);
- roomData->banderamovimiento = false;
+ currentRoomData->banderamovimiento = false;
freeAnimation();
handPantallaToFondo();
assembleScreen();
@@ -2866,29 +2856,29 @@ void drawGrid() {
void setRoomTrajectories(int animationHeight, int animationWidth, TRAJECTORIES_OP op, boolean fixGrids) {
// add to restore the room, subtract to adjust before loading the screen
- if (roomData->banderamovimiento && roomData->nombremovto != "QQQQQQQQ") {
- for (int i = 0; i < roomData->longtray2; i++) {
+ if (currentRoomData->banderamovimiento && currentRoomData->nombremovto != "QQQQQQQQ") {
+ for (int i = 0; i < currentRoomData->longtray2; i++) {
if(op == RESTORE) {
- roomData->tray2[i].x = roomData->tray2[i].x + (animationWidth >> 1);
- roomData->tray2[i].y = roomData->tray2[i].y + animationHeight;
+ currentRoomData->tray2[i].x = currentRoomData->tray2[i].x + (animationWidth >> 1);
+ currentRoomData->tray2[i].y = currentRoomData->tray2[i].y + animationHeight;
}
else {
- roomData->tray2[i].x = roomData->tray2[i].x - (animationWidth >> 1);
- roomData->tray2[i].y = roomData->tray2[i].y - animationHeight;
+ currentRoomData->tray2[i].x = currentRoomData->tray2[i].x - (animationWidth >> 1);
+ currentRoomData->tray2[i].y = currentRoomData->tray2[i].y - animationHeight;
}
}
if(fixGrids) {
for (int i = 0; i < maxrejax; i++) {
for (int j = 0; j < maxrejay; j++) {
if(op == RESTORE){
- roomData->rejapantalla[oldposx + i][oldposy + j] = rejafondomovto[i][j];
- roomData->mouseGrid[oldposx + i][oldposy + j] = rejafondoraton[i][j];
+ currentRoomData->rejapantalla[oldposx + i][oldposy + j] = rejafondomovto[i][j];
+ currentRoomData->mouseGrid[oldposx + i][oldposy + j] = rejafondoraton[i][j];
}
else {
if (rejamascaramovto[i][j] > 0)
- roomData->rejapantalla[oldposx + i][oldposy + j] = rejamascaramovto[i][j];
+ currentRoomData->rejapantalla[oldposx + i][oldposy + j] = rejamascaramovto[i][j];
if (rejamascararaton[i][j] > 0)
- roomData->mouseGrid[oldposx + i][oldposy + j] = rejamascararaton[i][j];
+ currentRoomData->mouseGrid[oldposx + i][oldposy + j] = rejamascararaton[i][j];
}
}
}
diff --git a/engines/tot/saveload.cpp b/engines/tot/saveload.cpp
index 2c527fadd94..2caeba650bc 100644
--- a/engines/tot/saveload.cpp
+++ b/engines/tot/saveload.cpp
@@ -150,7 +150,7 @@ boolean syncRoomData(Common::Serializer &s, Common::MemorySeekableReadWriteStrea
//Restore trajectory
setRoomTrajectories(altoanimado, anchoanimado, RESTORE);
//Make sure to save any unsaved changes in the room
- saveRoomData(roomData, rooms);
+ saveRoomData(currentRoomData, rooms);
// Do not fix screen grids, they will be fixed differently below
setRoomTrajectories(altoanimado, anchoanimado, SET_WITH_ANIM);
diff --git a/engines/tot/util.cpp b/engines/tot/util.cpp
index 57d6fb49509..6c0ec87eaa5 100644
--- a/engines/tot/util.cpp
+++ b/engines/tot/util.cpp
@@ -70,8 +70,6 @@ unsigned int imagesize(int x, int y, int x2, int y2) {
void bar(int x1, int y1, int x2, int y2, byte color) {
x2 = x2 + 1;
y2 = y2 + 1;
- int w = x2 - x1;
- int h = y2 - y1;
for (int i = x1; i < x2; i++) {
for (int j = y1; j < y2; j++) {
*((byte *)g_engine->_screen->getBasePtr(i, j)) = color;
Commit: 6b263024751d7ac690dea46f26ed5ae5f58c8a06
https://github.com/scummvm/scummvm/commit/6b263024751d7ac690dea46f26ed5ae5f58c8a06
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:46+02:00
Commit Message:
TOT: Fixes issue with pedestal items
Changed paths:
engines/tot/routines.cpp
diff --git a/engines/tot/routines.cpp b/engines/tot/routines.cpp
index a7db8b47785..fe6b709703b 100644
--- a/engines/tot/routines.cpp
+++ b/engines/tot/routines.cpp
@@ -3016,18 +3016,22 @@ void useScreenObject() {
drawText(regobj.useTextRef);
g_engine->_mouseManager->hide();
animateGive(direccionmovimiento, 1);
- loadItem(187, 70, 104, 1545820, 7);
+
+ //Show feather on pedestal
+ loadItem(187, 70, 104, 1545820, 8);
handPantallaToFondo();
- // XMStoPointer(ptr(segfondo, (offfondo + 4)), _handpantalla, 4, (sizepantalla - int32(4)));
assembleScreen();
drawScreen(fondo);
+ g_engine->_screen->update();
+
animateOpen2(direccionmovimiento, 1);
g_engine->_mouseManager->show();
- goToObject(currentRoomData->rejapantalla[((characterPosX + rectificacionx) / factorx)][((characterPosY + rectificaciony) / factory)], 14);
+ goToObject(currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], 14);
g_engine->_mouseManager->hide();
playVoc("PUFF", 191183, 18001);
+ //Animate to scythe
drawFlc(180, 60, 2216848, 0, 9, 0, false, false, true, basurillalog);
-
+ //load Scythe
currentRoomData->bitmapasociados[2].puntbitmap = 1545820;
currentRoomData->bitmapasociados[2].tambitmap = 104;
currentRoomData->bitmapasociados[2].coordx = 277;
@@ -3041,9 +3045,9 @@ void useScreenObject() {
currentRoomData->bitmapasociados[4].coordx = 186;
currentRoomData->bitmapasociados[4].coordy = 64;
currentRoomData->bitmapasociados[4].profund = 8;
- loadItem(186, 63, 464, 1447508, 7);
+ loadItem(186, 63, 464, 1447508, 8);
+
handPantallaToFondo();
- // XMStoPointer(ptr(segfondo, (offfondo + 4)), _handpantalla, 4,(sizepantalla - int32(4)));
assembleScreen();
drawScreen(fondo);
g_engine->_mouseManager->show();
@@ -3073,14 +3077,15 @@ void useScreenObject() {
case 633: {
drawText(regobj.useTextRef);
g_engine->_mouseManager->hide();
+
animateGive(3, 1);
- loadItem(86, 55, 92, 1591272, 7);
+ loadItem(86, 55, 92, 1591272, 8);
handPantallaToFondo();
assembleScreen();
drawScreen(fondo);
animateOpen2(3, 1);
g_engine->_mouseManager->show();
- goToObject(currentRoomData->rejapantalla[((characterPosX + rectificacionx) / factorx)][((characterPosY + rectificaciony) / factory)], 10);
+ goToObject(currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], 10);
g_engine->_mouseManager->hide();
playVoc("PUFF", 191183, 18001);
drawFlc(0, 47, 2209158, 0, 9, 0, false, false, true, basurillalog);
@@ -3099,8 +3104,7 @@ void useScreenObject() {
currentRoomData->bitmapasociados[4].coordx = 82;
currentRoomData->bitmapasociados[4].coordy = 53;
currentRoomData->bitmapasociados[4].profund = 8;
- loadItem(82, 53, 384, 1746554, 7);
- // XMStoPointer(ptr(segfondo, (offfondo + 4)), _handpantalla, 4,(sizepantalla - int32(4)));
+ loadItem(82, 53, 384, 1746554, 8);
assembleScreen();
drawScreen(fondo);
g_engine->_mouseManager->show();
Commit: 02d03c8ff87eb97773a70ea1b6512d0faa540356
https://github.com/scummvm/scummvm/commit/02d03c8ff87eb97773a70ea1b6512d0faa540356
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:46+02:00
Commit Message:
TOT: Restore music
Changed paths:
engines/tot/game.cpp
engines/tot/sound.cpp
diff --git a/engines/tot/game.cpp b/engines/tot/game.cpp
index 69d9b6a5a4c..9f181c30f0b 100644
--- a/engines/tot/game.cpp
+++ b/engines/tot/game.cpp
@@ -320,10 +320,10 @@ int startGame() {
lowerMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
switch (parte_del_juego) {
case 1:
- // playMidiFile("PRIMERA", true);
+ playMidiFile("PRIMERA", true);
break;
case 2:
- // playMidiFile("SEGUNDA", true);
+ playMidiFile("SEGUNDA", true);
break;
}
contadorpc2 = contadorpc;
diff --git a/engines/tot/sound.cpp b/engines/tot/sound.cpp
index fcd1ffbb98d..41592b6df6c 100644
--- a/engines/tot/sound.cpp
+++ b/engines/tot/sound.cpp
@@ -71,9 +71,9 @@ boolean loopmid,
existevocsb,
existemidsbdrv;
+byte *midmusica;
// pointer sbexitproc,
// musicavoc,
-// midmusica,
// driversbpromid;
int32 contadorvoc,
@@ -382,16 +382,16 @@ void playVoc(Common::String vocfile, int32 posinicio, uint tamvocleer) {
void playMidiFile(Common::String nomfich, boolean loop) {
// Disabled to avoid annoying music
- // Common::File ficheromus;
- // if(!ficheromus.open(Common::Path(nomfich + ".MUS"))){
- // error("pitamidfich(): ioresult! (267)");
- // }
- // mid_reset();
- // midmusica = malloc(ficheromus.size());
- // ficheromus.read(midmusica, ficheromus.size());
+ Common::File ficheromus;
+ if(!ficheromus.open(Common::Path(nomfich + ".MUS"))){
+ error("pitamidfich(): ioresult! (267)");
+ }
+ mid_reset();
+ midmusica = (byte *)malloc(ficheromus.size());
+ ficheromus.read(midmusica, ficheromus.size());
- // g_engine->_sound->playMidi((byte *)midmusica, ficheromus.size(), true);
- // ficheromus.close();
+ g_engine->_sound->playMidi((byte *)midmusica, ficheromus.size(), true);
+ ficheromus.close();
}
boolean disponiblemid() {
Commit: 8036fff9719c2f0358fd28450c14b3868eadeac2
https://github.com/scummvm/scummvm/commit/8036fff9719c2f0358fd28450c14b3868eadeac2
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:46+02:00
Commit Message:
TOT: Fixes credit screen
Changed paths:
engines/tot/routines2.cpp
engines/tot/util.cpp
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
index 786872218ca..6057392d6ce 100644
--- a/engines/tot/routines2.cpp
+++ b/engines/tot/routines2.cpp
@@ -1651,7 +1651,6 @@ void removeTitle(byte *&fondo2) {
for (int i1 = 1; i1 <= 15000; i1++) {
while (g_system->getEventManager()->pollEvent(e)) {
}
- g_engine->_chrono->updateChrono();
i2 = Random(318);
j2 = Random(58);
byte *src = fondo2 + 4 + (j2 * 320) + i2;
@@ -1665,10 +1664,11 @@ void removeTitle(byte *&fondo2) {
i2 = Random(320);
j2 = Random(60);
+
byte *src3 = fondo2 + 4 + (j2 * 320) + i2;
byte *dest3 = ((byte *)g_engine->_screen->getPixels()) + (j2 * 320) + i2;
Common::copy(src3, src3 + 1, dest3);
- if (tocapintareffect) {
+ if (i1 % 200 == 0) {
debug("Toca pintar!");
g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 60));
g_engine->_screen->update();
diff --git a/engines/tot/util.cpp b/engines/tot/util.cpp
index 6c0ec87eaa5..656a322105f 100644
--- a/engines/tot/util.cpp
+++ b/engines/tot/util.cpp
@@ -132,6 +132,6 @@ void waitForKey() {
}
unsigned int Random(unsigned int range) { return g_engine->getRandomNumber(range); }
-int Random(int range) { return g_engine->getRandomNumber(range); }
+int Random(int range) { return g_engine->getRandomNumber(range - 1); }
} // End of namespace Tot
Commit: f0ba7584686e86380327d7433b02b426833b3675
https://github.com/scummvm/scummvm/commit/f0ba7584686e86380327d7433b02b426833b3675
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:46+02:00
Commit Message:
TOT: Fixes encoding of special chars
Changed paths:
engines/tot/anims.cpp
engines/tot/routines2.cpp
diff --git a/engines/tot/anims.cpp b/engines/tot/anims.cpp
index 6a053592cd5..05c06dac883 100644
--- a/engines/tot/anims.cpp
+++ b/engines/tot/anims.cpp
@@ -103,7 +103,7 @@ void handleFlcEvent(byte numero_del_evento) {
switch (numerovuelta) {
case 2:
- drawText(80, 0, "Las �ltimas encuestas realizadas",
+ drawText(80, 0, "Las \xA3ltimas encuestas realizadas",
"acerca de la siniestralidad en ",
"los transportes arrojan resultados",
"alentadores...", "", 253, 0);
@@ -121,15 +121,15 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 26:
drawText(80, 0, "Es una noticia que nos anima a salir",
- "de viaje con m�s seguridad.", "", "", "", 253, 0);
+ "de viaje con m\xA0s seguridad.", "", "", "", 253, 0);
break;
case 35:
removeText(80, 0, 319, 53, 0);
break;
case 36:
- drawText(2, 100, "��Por un tornillo!!...",
- "Por un m�sero y simple",
- "tornillo del tr�fugo",
+ drawText(2, 100, "\xAD\xADPor un tornillo!!...",
+ "Por un m\xA1sero y simple",
+ "tornillo del tr\xA1""fugo",
"del trapecio...", "", 255, 0);
break;
case 47:
@@ -137,18 +137,18 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 48:
drawText(2, 100, "Si lo hubiese apretado",
- "bien, no estar�a ahora",
+ "bien, no estar\xA1""a ahora",
"sin trabajo...", "", "", 255, 0);
break;
case 59:
removeText(2, 100, 134, 199, 0);
break;
case 60:
- drawText(80, 0, "��Noticia de �ltima hora!!", "", "", "", "", 253, 0);
+ drawText(80, 0, "\xAD\xADNoticia de \xA3ltima hora!!", "", "", "", "", 253, 0);
break;
case 63:
drawText(2, 100, "Llevo sin dormir toda",
- "la noche, pensando qu�",
+ "la noche, pensando qu\x82",
"voy a hacer.", "", "", 255, 0);
break;
case 75:
@@ -158,18 +158,18 @@ void handleFlcEvent(byte numero_del_evento) {
removeText(80, 0, 319, 53, 0);
break;
case 77:
- drawText(2, 100, "Seguramente no podr�",
+ drawText(2, 100, "Seguramente no podr\x82",
"encontrar trabajo en",
"mucho tiempo...",
- "Aunque ponga mucha f�",
+ "Aunque ponga mucha f\x82",
"la oficina de empleo.", 255, 0);
break;
case 89:
removeText(2, 100, 135, 199, 0);
break;
case 90:
- drawText(2, 100, "Y para animarme m�s",
- "todav�a, ma�ana noche",
+ drawText(2, 100, "Y para animarme m\xA0s",
+ "todav\xAD""a, ma\xA4""ana noche",
"es HALLOWEEN...", "",
"Es que tengo la negra.", 255, 0);
break;
@@ -178,10 +178,10 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 103:
drawText(80, 0, "Grave accidente en TWELVE MOTORS...",
- "un empleado olvid� apretar un tornillo",
+ "un empleado olvid\xA2 apretar un tornillo",
"y media cadena de montaje ha quedado",
"para chatarra...",
- "las p�rdidas se estiman cuantiosas...", 253, 0);
+ "las p\x82rdidas se estiman cuantiosas...", 253, 0);
break;
case 120:
removeText(80, 0, 319, 53, 0);
@@ -191,8 +191,8 @@ void handleFlcEvent(byte numero_del_evento) {
"contra ese inconsciente...", "", "", "", 253, 0);
break;
case 125:
- drawText(2, 100, "�Dios mio!... hasta en",
- "la televisi�n...",
+ drawText(2, 100, "\xAD""Dios mio!... hasta en",
+ "la televisi\xA2n...",
"Seguro que hasta mi",
"perro encuentra curro",
"antes que yo...", 255, 0);
@@ -213,52 +213,52 @@ void handleFlcEvent(byte numero_del_evento) {
playVoc("MANDO", 142001, 11469);
break;
case 20:
- drawText(2, 100, "�HORROR!...una factura", "", "", "", "", 255, 0);
+ drawText(2, 100, "\xADHORROR!...una factura", "", "", "", "", 255, 0);
break;
case 58: {
removeText(2, 100, 135, 199, 0);
- drawText(2, 100, "�Oficina de empleo?...",
- "�y para m�?...", "",
- "�Se habr�n equivocado!", "", 255, 0);
+ drawText(2, 100, "\xA8""Oficina de empleo?...",
+ "\xA8""y para m\xA1?...", "",
+ "\xADSe habr\xA0n equivocado!", "", 255, 0);
} break;
case 74: {
delay(1500);
removeText(2, 100, 135, 199, 0);
- drawText(2, 100, "�Tan pronto lograron",
+ drawText(2, 100, "\xA8Tan pronto lograron",
"encontrarme trabajo?", "",
"Claro... antes de ver",
"las noticias...", 255, 0);
delay(4000);
removeText(2, 100, 135, 199, 0);
- drawText(80, 0, "Estimado se�or: Nos dirigimos a",
+ drawText(80, 0, "Estimado se\xA4or: Nos dirigimos a",
"usted para comunicarle que su",
- "solicitud n�:93435 fu� aceptada",
+ "solicitud n\xA7:93435 fu\x82 aceptada",
"y le hemos encontrado un puesto",
"de acuerdo con sus aptitudes...", 253, 0);
delay(7000);
removeText(80, 0, 319, 53, 0);
- drawText(80, 0, "Deber� presentarse ma�ana, dia",
- "31 de Octubre en la direcci�n",
+ drawText(80, 0, "Deber\xA0 presentarse ma\xA4""ana, dia",
+ "31 de Octubre en la direcci\xA2n",
"abajo indicada, para ocupar el",
"puesto de ENCARGADO GENERAL.", "", 253, 0);
delay(7000);
removeText(80, 0, 319, 53, 0);
drawText(80, 0, "Le adjuntamos las credenciales",
- "de presentaci�n.",
- "Deseando no verle por aqu� en",
+ "de presentaci\xA2n.",
+ "Deseando no verle por aqu\xA1 en",
"mucho tiempo se despide:",
" Leonor Scott.", 253, 0);
delay(7000);
removeText(80, 0, 319, 53, 0);
- drawText(2, 100, "��Que ilu!! encargado",
+ drawText(2, 100, "\xAD\xADQue ilu!! encargado",
"general... si ya me",
"lo decia mi madre...",
"<<nene tienes cara de",
"encargado general>>", 255, 0);
delay(6000);
removeText(2, 100, 135, 199, 0);
- drawText(2, 100, "Tendr� que conseguir",
- "ropa m�s de acuerdo",
+ drawText(2, 100, "Tendr\x82 que conseguir",
+ "ropa m\xA0s de acuerdo",
"con mi nuevo cargo.", "",
"Manos a la obra...", 255, 0);
delay(6000);
@@ -289,26 +289,26 @@ void handleFlcEvent(byte numero_del_evento) {
if ((numerovuelta == 1) && (framecontador == 2)) {
delay(2000);
- drawText(5, 1, "�V�yase!... no queremos vendedores...",
- "y menos de planes de jubilaci�n.", "", "", "", 255, 249);
+ drawText(5, 1, "\xADV\xA0yase!... no queremos vendedores...",
+ "y menos de planes de jubilaci\xA2n.", "", "", "", 255, 249);
delay(3500);
putImg(0, 0, punterofondofrase);
- drawText(5, 1, "No soy ning�n vendedor... me envia la oficina",
+ drawText(5, 1, "No soy ning\xA3n vendedor... me envia la oficina",
"de empleo... tenga mis credenciales.", "", "", "", 255, 0);
}
break;
case 6:
if ((numerovuelta == 1) && (framecontador == 3)) {
putImg(0, 0, punterofondofrase);
- drawText(5, 1, "�Vaya! eres t�...llegas con retraso. Los ancianos est�n",
- "esper�ndote en el sal�n. Debes cuidarlos muy bien.",
+ drawText(5, 1, "\xADVaya! eres t\xA3...llegas con retraso. Los ancianos est\xA0n",
+ "esper\xA0ndote en el sal\xA2n. Debes cuidarlos muy bien.",
"", "", "", 255, 249);
}
break;
case 7:
if ((numerovuelta == 1) && (framecontador == 3)) {
putImg(0, 0, punterofondofrase);
- drawText(5, 1, "Lo siento, no sab�a a que hora deb�a presentarme, en",
+ drawText(5, 1, "Lo siento, no sab\xA1""a a que hora deb\xA1""a presentarme, en",
"la oficina de empleo no me lo dijeron.",
"", "", "", 255, 0);
}
@@ -316,21 +316,21 @@ void handleFlcEvent(byte numero_del_evento) {
case 8:
if ((numerovuelta == 1) && (framecontador == 3)) {
putImg(0, 0, punterofondofrase);
- drawText(5, 1, "Bueno... no importa... ya est�s aqu�.",
- "Ese coche es tuyo �no?...", "", "", "", 255, 249);
+ drawText(5, 1, "Bueno... no importa... ya est\xA0s aqu\xA1.",
+ "Ese coche es tuyo \xA8no?...", "", "", "", 255, 249);
}
break;
case 9:
if ((numerovuelta == 1) && (framecontador == 3)) {
putImg(0, 0, punterofondofrase);
- drawText(5, 1, "Si... es precioso �verdad?...", "", "", "", "", 255, 0);
+ drawText(5, 1, "Si... es precioso \xA8verdad?...", "", "", "", "", 255, 0);
}
break;
case 10:
if ((numerovuelta == 1) && (framecontador == 3)) {
putImg(0, 0, punterofondofrase);
- drawText(5, 1, "Vaya... 200 caballos... elevalunas el�ctricos... ",
- "inyecci�n electr�nica, llantas de aleaci�n...",
+ drawText(5, 1, "Vaya... 200 caballos... elevalunas el\x82""ctricos... ",
+ "inyecci\xA2n electr\xA2nica, llantas de aleaci\xA2n...",
"", "", "", 255, 249);
}
break;
@@ -350,26 +350,26 @@ void handleFlcEvent(byte numero_del_evento) {
case 13:
if ((numerovuelta == 1) && (framecontador == 3)) {
putImg(0, 0, punterofondofrase);
- drawText(5, 1, "Es el m�s alto de la gama...", "", "", "", "", 255, 0);
+ drawText(5, 1, "Es el m\xA0s alto de la gama...", "", "", "", "", 255, 0);
}
break;
case 14:
if ((numerovuelta == 1) && (framecontador == 3)) {
putImg(0, 0, punterofondofrase);
- drawText(5, 1, "ABS, equipo de m�sica con CD, estructura reforzada",
+ drawText(5, 1, "ABS, equipo de m\xA3sica con CD, estructura reforzada",
"indeformable, detector de radar...", "", "", "", 255, 249);
}
break;
case 15:
if ((numerovuelta == 1) && (framecontador == 3)) {
putImg(0, 0, punterofondofrase);
- drawText(5, 1, "Parece que te gusta, �no?", "", "", "", "", 255, 0);
+ drawText(5, 1, "Parece que te gusta, \xA8no?", "", "", "", "", 255, 0);
}
break;
case 16:
if ((numerovuelta == 1) && (framecontador == 3)) {
putImg(0, 0, punterofondofrase);
- drawText(5, 1, "Bueno, no est� mal... pero... gracias de todos modos.",
+ drawText(5, 1, "Bueno, no est\xA0 mal... pero... gracias de todos modos.",
"", "", "", "", 255, 249);
}
break;
@@ -389,7 +389,7 @@ void handleFlcEvent(byte numero_del_evento) {
case 18:
if ((numerovuelta == 1) && (framecontador == 3)) {
putImg(0, 0, punterofondofrase);
- drawText(5, 1, "�Gracias?... �qu�?... �espera!... ese es mi coche...",
+ drawText(5, 1, "\xA8Gracias?... \xA8qu\x82?... \xAD""espera!... ese es mi coche...",
"", "", "", "", 255, 0);
}
break;
@@ -406,7 +406,7 @@ void handleFlcEvent(byte numero_del_evento) {
getImg(0, 0, 319, 29, punterofondofrase);
break;
case 3:
- drawText(15, 1, "�Donde estoy? ... �Qu� me ha pasado?",
+ drawText(15, 1, "\xA8""Donde estoy? ... \xA8Qu\x82 me ha pasado?",
"", "", "", "", 255, 0);
break;
}
@@ -417,8 +417,8 @@ void handleFlcEvent(byte numero_del_evento) {
putImg(0, 0, punterofondofrase);
break;
case 3:
- drawText(15, 1, "Tranquilizate, no est�s muerto...",
- "Est�s tras la puerta de acero...", "", "", "", 230, 249);
+ drawText(15, 1, "Tranquilizate, no est\xA0s muerto...",
+ "Est\xA0s tras la puerta de acero...", "", "", "", 230, 249);
break;
}
break;
@@ -440,7 +440,7 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 3:
drawText(15, 1, "Hace unos dias se puso a estudiar el libro",
- "que me diste y desapareci�...", "", "", "", 230, 249);
+ "que me diste y desapareci\xA2...", "", "", "", 230, 249);
break;
}
break;
@@ -450,7 +450,7 @@ void handleFlcEvent(byte numero_del_evento) {
putImg(0, 0, punterofondofrase);
break;
case 3:
- drawText(15, 1, Common::String("Creemos que realiz� un conjuro sin darse") + " cuenta...", "", "", "", "", 230, 249);
+ drawText(15, 1, Common::String("Creemos que realiz\xA2 un conjuro sin darse") + " cuenta...", "", "", "", "", 230, 249);
break;
}
break;
@@ -461,7 +461,7 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 3:
drawText(15, 1, "Por fortuna, pudimos ponernos en contacto",
- "con �l, y nos dijo que est� en problemas...",
+ "con \x82l, y nos dijo que est\xA0 en problemas...",
"", "", "", 230, 249);
break;
}
@@ -472,7 +472,7 @@ void handleFlcEvent(byte numero_del_evento) {
putImg(0, 0, punterofondofrase);
break;
case 3:
- drawText(15, 1, "Nos pidi� que envi�semos a alguien en su ayuda,",
+ drawText(15, 1, "Nos pidi\xA2 que envi\xA0semos a alguien en su ayuda,",
"y TU eres el elegido...", "", "", "", 230, 249);
break;
}
@@ -484,7 +484,7 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 3:
drawText(15, 1, "Para ir a las CAVERNAS ETERNAS debes morir...",
- "Ning�n cuerpo con alma puede estar all�...", "", "", "", 230, 249);
+ "Ning\xA3n cuerpo con alma puede estar all\xA1...", "", "", "", 230, 249);
break;
}
break;
@@ -494,7 +494,7 @@ void handleFlcEvent(byte numero_del_evento) {
putImg(0, 0, punterofondofrase);
break;
case 3:
- drawText(15, 1, Common::String("Haremos un ritual para crear un v�nculo entre") + " tu", "cuerpo y tu alma, s�lo as� podr�s volver a la vida...",
+ drawText(15, 1, Common::String("Haremos un ritual para crear un v\xA1nculo entre") + " tu", "cuerpo y tu alma, s\xA2lo as\xA1 podr\xA0s volver a la vida...",
"", "", "", 230, 249);
break;
}
@@ -505,7 +505,7 @@ void handleFlcEvent(byte numero_del_evento) {
putImg(0, 0, punterofondofrase);
break;
case 3:
- drawText(15, 1, Common::String("Si rescatas a Jacob, el v�nculo te traer�") + " de regreso...", "", "", "", "", 230, 249);
+ drawText(15, 1, Common::String("Si rescatas a Jacob, el v\xA1nculo te traer\xA0") + " de regreso...", "", "", "", "", 230, 249);
break;
}
break;
@@ -515,7 +515,7 @@ void handleFlcEvent(byte numero_del_evento) {
putImg(0, 0, punterofondofrase);
break;
case 3:
- drawText(15, 1, "Ahora... �Prep�rate!... Ha llegado tu hora...",
+ drawText(15, 1, "Ahora... \xADPrep\xA0rate!... Ha llegado tu hora...",
"", "", "", "", 230, 249);
break;
}
@@ -566,7 +566,7 @@ void handleFlcEvent(byte numero_del_evento) {
getImg(0, 0, 319, 29, punterofondofrase);
break;
case 3:
- drawText(65, 1, "�Gracias ILUSO!...", "", "", "", "", 253, 249);
+ drawText(65, 1, "\xADGracias ILUSO!...", "", "", "", "", 253, 249);
break;
}
break;
@@ -576,7 +576,7 @@ void handleFlcEvent(byte numero_del_evento) {
putImg(0, 0, punterofondofrase);
break;
case 2:
- drawText(65, 1, "Ahora tendr� un cuerpo nuevo y podr�",
+ drawText(65, 1, "Ahora tendr\x82 un cuerpo nuevo y podr\x82",
"volver a la vida...", "", "", "", 253, 249);
break;
}
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
index 6057392d6ce..1782679355f 100644
--- a/engines/tot/routines2.cpp
+++ b/engines/tot/routines2.cpp
@@ -711,14 +711,14 @@ static void loadDiploma(Common::String &nombrefoto, Common::String &clave) {
// // settextstyle(defaultfont, horizdir, 1);
// FIXME: proper font
- outtextxyBios(91, 16, "CERTIFICADO N�:" + clave, 255);
- outtextxyBios(90, 15, "CERTIFICADO N�:" + clave, 13);
+ outtextxyBios(91, 16, "CERTIFICADO N\xA7:" + clave, 255);
+ outtextxyBios(90, 15, "CERTIFICADO N\xA7:" + clave, 13);
outtextxyBios(81, 61, "Yo, Jacob, el Gran Maestre ", 0);
outtextxyBios(61, 81, "de la Hermandad de Sek Umh Nejl", 0);
outtextxyBios(31, 101, "certifico que: " + nombrepersonaje, 0);
outtextxyBios(31, 121, "me ha liberado de las Cavernas", 0);
- outtextxyBios(31, 141, "Eternas, por lo cual le estar� ", 0);
+ outtextxyBios(31, 141, "Eternas, por lo cual le estar\x82 ", 0);
outtextxyBios(31, 161, "por siempre agradecido.", 0);
outtextxyBios(80, 60, "Yo, Jacob, el Gran Maestre ", 15);
@@ -728,7 +728,7 @@ static void loadDiploma(Common::String &nombrefoto, Common::String &clave) {
outtextxyBios(150, 100, nombrepersonaje, 13);
outtextxyBios(30, 120, "me ha liberado de las Cavernas", 15);
- outtextxyBios(30, 140, "Eternas, por lo cual le estar� ", 15);
+ outtextxyBios(30, 140, "Eternas, por lo cual le estar\x82 ", 15);
outtextxyBios(30, 160, "por siempre agradecido.", 15);
delay(1500);
playVoc("PORTAZO", 434988, 932);
@@ -1669,7 +1669,6 @@ void removeTitle(byte *&fondo2) {
byte *dest3 = ((byte *)g_engine->_screen->getPixels()) + (j2 * 320) + i2;
Common::copy(src3, src3 + 1, dest3);
if (i1 % 200 == 0) {
- debug("Toca pintar!");
g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 60));
g_engine->_screen->update();
}
@@ -1804,12 +1803,12 @@ void introduction() {
totalFadeOut(0);
cleardevice();
- outtextxy(25, 20, " ... Despu�s de estar durante ocho horas", 253);
+ outtextxy(25, 20, " ... Despu\x82s de estar durante ocho horas", 253);
outtextxy(25, 35, "conduciendo, haberte perdido tres veces", 253);
- outtextxy(25, 50, "y haber hecho doscientos kil�metros de m�s", 253);
+ outtextxy(25, 50, "y haber hecho doscientos kil\xA2metros de m\xA0s", 253);
outtextxy(25, 65, "llegas a una casa que se encuentra en un", 253);
outtextxy(25, 80, "paraje muy tranquilo y apartado del mundanal", 253);
- outtextxy(25, 95, "ruido. (��Y TAN APARTADO!!) ...", 253);
+ outtextxy(25, 95, "ruido. (\xAD\xADY TAN APARTADO!!) ...", 253);
outtextxy(25, 120, "Pero esto no tiene importancia ... ", 253);
outtextxy(25, 140, "Hay que encarar el trabajo con una actitud", 253);
outtextxy(25, 155, "optimista y positiva...", 253);
@@ -2354,7 +2353,7 @@ void sacrifice() {
outtextxy(10, 10, " A pesar de todo, no lo has hecho tan mal.", 200);
outtextxy(10, 30, " Has conseguido todo lo que te pidieron, y", 200);
outtextxy(10, 50, " van a poder celebrar su fiesta de Halloween.", 200);
- outtextxy(10, 70, " Es todo un detalle que t� seas el invitado", 200);
+ outtextxy(10, 70, " Es todo un detalle que t\xA3 seas el invitado", 200);
outtextxy(10, 90, " de honor...", 200);
for (int i = 0; i <= 28; i++)
@@ -2369,9 +2368,9 @@ void sacrifice() {
bar(10, 10, 300, 120, 0);
outtextxy(10, 10, " Como recompensa a tus esfuerzos te mandan a", 200);
- outtextxy(10, 30, " darte una vuelta por ah� mientras ellos se", 200);
+ outtextxy(10, 30, " darte una vuelta por ah\xA1 mientras ellos se", 200);
outtextxy(10, 50, " encargan de los preparativos de la fiesta.", 200);
- outtextxy(10, 70, " T�, obviamente, aceptas de inmediato y te", 200);
+ outtextxy(10, 70, " T\xA3, obviamente, aceptas de inmediato y te", 200);
outtextxy(10, 90, " vas a tomar el fresco un rato...", 200);
for (int i = 0; i <= 28; i++)
@@ -2384,9 +2383,9 @@ void sacrifice() {
setRGBPalette(200, i * 2, i * 2, i * 2);
bar(10, 10, 300, 120, 0);
- outtextxy(10, 10, " Horas m�s tarde... ", 200);
- outtextxy(10, 50, " La fiesta ya est� preparada, regresas al", 200);
- outtextxy(10, 70, " sal�n a recibir tus merecidos honores, tras", 200);
+ outtextxy(10, 10, " Horas m\xA0s tarde... ", 200);
+ outtextxy(10, 50, " La fiesta ya est\xA0 preparada, regresas al", 200);
+ outtextxy(10, 70, " sal\xA2n a recibir tus merecidos honores, tras", 200);
outtextxy(10, 90, " un completo dia de trabajo... ", 200);
for (int i = 0; i <= 28; i++)
@@ -2436,10 +2435,10 @@ void sacrifice() {
restoreMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
clear();
- outtextxy(10, 31, " Despu�s de todo lo que hice por ellos...", 254);
- outtextxy(10, 29, " Despu�s de todo lo que hice por ellos...", 254);
- outtextxy(11, 30, " Despu�s de todo lo que hice por ellos...", 254);
- outtextxy(9, 30, " Despu�s de todo lo que hice por ellos...", 254);
+ outtextxy(10, 31, " Despu\x82s de todo lo que hice por ellos...", 254);
+ outtextxy(10, 29, " Despu\x82s de todo lo que hice por ellos...", 254);
+ outtextxy(11, 30, " Despu\x82s de todo lo que hice por ellos...", 254);
+ outtextxy(9, 30, " Despu\x82s de todo lo que hice por ellos...", 254);
outtextxy(10, 51, " Todos mis esfuerzos y desvelos para esto...", 254);
outtextxy(10, 49, " Todos mis esfuerzos y desvelos para esto...", 254);
outtextxy(11, 50, " Todos mis esfuerzos y desvelos para esto...", 254);
@@ -2449,7 +2448,7 @@ void sacrifice() {
outtextxy(11, 70, " Morir envenenado, ese era mi destino...", 254);
outtextxy(9, 70, " Morir envenenado, ese era mi destino...", 254);
- outtextxy(10, 30, " Despu�s de todo lo que hice por ellos...", 255);
+ outtextxy(10, 30, " Despu\x82s de todo lo que hice por ellos...", 255);
outtextxy(10, 50, " Todos mis esfuerzos y desvelos para esto...", 255);
outtextxy(10, 70, " Morir envenenado, ese era mi destino...", 255);
@@ -2503,18 +2502,18 @@ void sacrifice() {
stopVoc();
clear();
- outtextxy(10, 21, " Presta atenci�n, pues esta puede ser la �ltima", 254);
- outtextxy(10, 19, " Presta atenci�n, pues esta puede ser la �ltima", 254);
- outtextxy(11, 20, " Presta atenci�n, pues esta puede ser la �ltima", 254);
- outtextxy(9, 20, " Presta atenci�n, pues esta puede ser la �ltima", 254);
- outtextxy(10, 41, " vez que hablemos contigo. Definitivamente est�s", 254);
- outtextxy(10, 39, " vez que hablemos contigo. Definitivamente est�s", 254);
- outtextxy(11, 40, " vez que hablemos contigo. Definitivamente est�s", 254);
- outtextxy(9, 40, " vez que hablemos contigo. Definitivamente est�s", 254);
- outtextxy(10, 61, " muerto, pero a�n es posible reunir tu alma con", 254);
- outtextxy(10, 59, " muerto, pero a�n es posible reunir tu alma con", 254);
- outtextxy(11, 60, " muerto, pero a�n es posible reunir tu alma con", 254);
- outtextxy(9, 60, " muerto, pero a�n es posible reunir tu alma con", 254);
+ outtextxy(10, 21, " Presta atenci\xA2n, pues esta puede ser la \xA3ltima", 254);
+ outtextxy(10, 19, " Presta atenci\xA2n, pues esta puede ser la \xA3ltima", 254);
+ outtextxy(11, 20, " Presta atenci\xA2n, pues esta puede ser la \xA3ltima", 254);
+ outtextxy(9, 20, " Presta atenci\xA2n, pues esta puede ser la \xA3ltima", 254);
+ outtextxy(10, 41, " vez que hablemos contigo. Definitivamente est\xA0s", 254);
+ outtextxy(10, 39, " vez que hablemos contigo. Definitivamente est\xA0s", 254);
+ outtextxy(11, 40, " vez que hablemos contigo. Definitivamente est\xA0s", 254);
+ outtextxy(9, 40, " vez que hablemos contigo. Definitivamente est\xA0s", 254);
+ outtextxy(10, 61, " muerto, pero a\xA3n es posible reunir tu alma con", 254);
+ outtextxy(10, 59, " muerto, pero a\xA3n es posible reunir tu alma con", 254);
+ outtextxy(11, 60, " muerto, pero a\xA3n es posible reunir tu alma con", 254);
+ outtextxy(9, 60, " muerto, pero a\xA3n es posible reunir tu alma con", 254);
outtextxy(10, 81, " tu cuerpo, para ello debes buscar a Jacob y", 254);
outtextxy(10, 79, " tu cuerpo, para ello debes buscar a Jacob y", 254);
outtextxy(11, 80, " tu cuerpo, para ello debes buscar a Jacob y", 254);
@@ -2532,9 +2531,9 @@ void sacrifice() {
outtextxy(11, 140, " mundo de los vivos.", 254);
outtextxy(9, 140, " mundo de los vivos.", 254);
- outtextxy(10, 20, " Presta atenci�n, pues esta puede ser la �ltima", 255);
- outtextxy(10, 40, " vez que hablemos contigo. Definitivamente est�s", 255);
- outtextxy(10, 60, " muerto, pero a�n es posible reunir tu alma con", 255);
+ outtextxy(10, 20, " Presta atenci\xA2n, pues esta puede ser la \xA3ltima", 255);
+ outtextxy(10, 40, " vez que hablemos contigo. Definitivamente est\xA0s", 255);
+ outtextxy(10, 60, " muerto, pero a\xA3n es posible reunir tu alma con", 255);
outtextxy(10, 80, " tu cuerpo, para ello debes buscar a Jacob y", 255);
outtextxy(10, 100, " liberarlo de aquello que lo retenga. Cuando lo", 255);
outtextxy(10, 120, " consigas podremos traeros a ambos de vuelta al", 255);
@@ -2556,42 +2555,42 @@ void sacrifice() {
return;
clear();
- outtextxy(10, 21, " Pero debes darte prisa pues el v�nculo con tu", 254);
- outtextxy(10, 19, " Pero debes darte prisa pues el v�nculo con tu", 254);
- outtextxy(11, 20, " Pero debes darte prisa pues el v�nculo con tu", 254);
- outtextxy(9, 20, " Pero debes darte prisa pues el v�nculo con tu", 254);
- outtextxy(10, 41, " cuerpo se debilita y tu alma podr�a quedar", 254);
- outtextxy(10, 39, " cuerpo se debilita y tu alma podr�a quedar", 254);
- outtextxy(11, 40, " cuerpo se debilita y tu alma podr�a quedar", 254);
- outtextxy(9, 40, " cuerpo se debilita y tu alma podr�a quedar", 254);
+ outtextxy(10, 21, " Pero debes darte prisa pues el v\xA1nculo con tu", 254);
+ outtextxy(10, 19, " Pero debes darte prisa pues el v\xA1nculo con tu", 254);
+ outtextxy(11, 20, " Pero debes darte prisa pues el v\xA1nculo con tu", 254);
+ outtextxy(9, 20, " Pero debes darte prisa pues el v\xA1nculo con tu", 254);
+ outtextxy(10, 41, " cuerpo se debilita y tu alma podr\xA1""a quedar", 254);
+ outtextxy(10, 39, " cuerpo se debilita y tu alma podr\xA1""a quedar", 254);
+ outtextxy(11, 40, " cuerpo se debilita y tu alma podr\xA1""a quedar", 254);
+ outtextxy(9, 40, " cuerpo se debilita y tu alma podr\xA1""a quedar", 254);
outtextxy(10, 61, " atrapada para siempre en las Cavernas Eternas.", 254);
outtextxy(10, 59, " atrapada para siempre en las Cavernas Eternas.", 254);
outtextxy(11, 60, " atrapada para siempre en las Cavernas Eternas.", 254);
outtextxy(9, 60, " atrapada para siempre en las Cavernas Eternas.", 254);
- outtextxy(10, 81, " Si necesitaras m�s energ�a de la que tienes, ", 254);
- outtextxy(10, 79, " Si necesitaras m�s energ�a de la que tienes, ", 254);
- outtextxy(11, 80, " Si necesitaras m�s energ�a de la que tienes, ", 254);
- outtextxy(9, 80, " Si necesitaras m�s energ�a de la que tienes, ", 254);
- outtextxy(10, 101, " recuerda que all� donde vas un cuerpo contiene", 254);
- outtextxy(10, 99, " recuerda que all� donde vas un cuerpo contiene", 254);
- outtextxy(11, 100, " recuerda que all� donde vas un cuerpo contiene", 254);
- outtextxy(9, 100, " recuerda que all� donde vas un cuerpo contiene", 254);
- outtextxy(10, 121, " m�s energ�a que un alma al contrario que en el", 254);
- outtextxy(10, 119, " m�s energ�a que un alma al contrario que en el", 254);
- outtextxy(11, 120, " m�s energ�a que un alma al contrario que en el", 254);
- outtextxy(9, 120, " m�s energ�a que un alma al contrario que en el", 254);
- outtextxy(10, 141, " mundo f�sico.", 254);
- outtextxy(10, 139, " mundo f�sico.", 254);
- outtextxy(11, 140, " mundo f�sico.", 254);
- outtextxy(9, 140, " mundo f�sico.", 254);
-
- outtextxy(10, 20, " Pero debes darte prisa pues el v�nculo con tu", 255);
- outtextxy(10, 40, " cuerpo se debilita y tu alma podr�a quedar", 255);
+ outtextxy(10, 81, " Si necesitaras m\xA0s energ\xA1""a de la que tienes, ", 254);
+ outtextxy(10, 79, " Si necesitaras m\xA0s energ\xA1""a de la que tienes, ", 254);
+ outtextxy(11, 80, " Si necesitaras m\xA0s energ\xA1""a de la que tienes, ", 254);
+ outtextxy(9, 80, " Si necesitaras m\xA0s energ\xA1""a de la que tienes, ", 254);
+ outtextxy(10, 101, " recuerda que all\xA0 donde vas un cuerpo contiene", 254);
+ outtextxy(10, 99, " recuerda que all\xA0 donde vas un cuerpo contiene", 254);
+ outtextxy(11, 100, " recuerda que all\xA0 donde vas un cuerpo contiene", 254);
+ outtextxy(9, 100, " recuerda que all\xA0 donde vas un cuerpo contiene", 254);
+ outtextxy(10, 121, " m\xA0s energ\xA1""a que un alma al contrario que en el", 254);
+ outtextxy(10, 119, " m\xA0s energ\xA1""a que un alma al contrario que en el", 254);
+ outtextxy(11, 120, " m\xA0s energ\xA1""a que un alma al contrario que en el", 254);
+ outtextxy(9, 120, " m\xA0s energ\xA1""a que un alma al contrario que en el", 254);
+ outtextxy(10, 141, " mundo f\xA1sico.", 254);
+ outtextxy(10, 139, " mundo f\xA1sico.", 254);
+ outtextxy(11, 140, " mundo f\xA1sico.", 254);
+ outtextxy(9, 140, " mundo f\xA1sico.", 254);
+
+ outtextxy(10, 20, " Pero debes darte prisa pues el v\xA1nculo con tu", 255);
+ outtextxy(10, 40, " cuerpo se debilita y tu alma podr\xA1""a quedar", 255);
outtextxy(10, 60, " atrapada para siempre en las Cavernas Eternas.", 255);
- outtextxy(10, 80, " Si necesitaras m�s energ�a de la que tienes, ", 255);
- outtextxy(10, 100, " recuerda que all� donde vas un cuerpo contiene", 255);
- outtextxy(10, 120, " m�s energ�a que un alma al contrario que en el", 255);
- outtextxy(10, 140, " mundo f�sico.", 255);
+ outtextxy(10, 80, " Si necesitaras m\xA0s energ\xA1""a de la que tienes, ", 255);
+ outtextxy(10, 100, " recuerda que all\xA0 donde vas un cuerpo contiene", 255);
+ outtextxy(10, 120, " m\xA0s energ\xA1""a que un alma al contrario que en el", 255);
+ outtextxy(10, 140, " mundo f\xA1sico.", 255);
for (int i = 0; i < 32; i++) {
setRGBPalette(255, 32 + i, i * 2, i * 2);
@@ -2649,13 +2648,13 @@ void ending() {
outtextxy(10, 39, " Al fin lo has conseguido....", 249);
outtextxy(11, 40, " Al fin lo has conseguido....", 249);
outtextxy(9, 40, " Al fin lo has conseguido....", 249);
- outtextxy(10, 61, " ���Soy LIBREEEEE!!!", 249);
- outtextxy(10, 59, " ���Soy LIBREEEEE!!!", 249);
- outtextxy(11, 60, " ���Soy LIBREEEEE!!!", 249);
- outtextxy(9, 60, " ���Soy LIBREEEEE!!!", 249);
+ outtextxy(10, 61, " \xAD\xAD\xADSoy LIBREEEEE!!!", 249);
+ outtextxy(10, 59, " \xAD\xAD\xADSoy LIBREEEEE!!!", 249);
+ outtextxy(11, 60, " \xAD\xAD\xADSoy LIBREEEEE!!!", 249);
+ outtextxy(9, 60, " \xAD\xAD\xADSoy LIBREEEEE!!!", 249);
outtextxy(10, 40, " Al fin lo has conseguido....", 253);
- outtextxy(10, 60, " ���Soy LIBREEEEE!!!", 253);
+ outtextxy(10, 60, " \xAD\xAD\xADSoy LIBREEEEE!!!", 253);
delay(4000);
totalFadeOut(0);
clear();
Commit: a673e4f07bb1732bbf614baf738dccbf812c2583
https://github.com/scummvm/scummvm/commit/a673e4f07bb1732bbf614baf738dccbf812c2583
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:46+02:00
Commit Message:
TOT: Fixes palette issues and sound with TV
Changed paths:
engines/tot/graphics.cpp
engines/tot/routines.cpp
engines/tot/routines2.cpp
diff --git a/engines/tot/graphics.cpp b/engines/tot/graphics.cpp
index 35d38356e1b..91596b78ed6 100644
--- a/engines/tot/graphics.cpp
+++ b/engines/tot/graphics.cpp
@@ -829,8 +829,8 @@ void updatePalette(byte indicepaleta) {
case 1: {
for (ipal = 0; ipal <= 5; ipal++) {
pal[(ipal + 195) * 3 + 0] = movimientopal[(indicepaleta * 6 + ipal) * 3 + 0];
- pal[(ipal + 195)* 3 + 1] = movimientopal[(indicepaleta * 6 + ipal) * 3 + 1];
- pal[(ipal + 195) * 2 + 1] = movimientopal[(indicepaleta * 6 + ipal) * 3 + 2];
+ pal[(ipal + 195) * 3 + 1] = movimientopal[(indicepaleta * 6 + ipal) * 3 + 1];
+ pal[(ipal + 195) * 3 + 2] = movimientopal[(indicepaleta * 6 + ipal) * 3 + 2];
}
changeRGBBlock(195, 6, &pal[195 * 3 + 0]);
} break;
diff --git a/engines/tot/routines.cpp b/engines/tot/routines.cpp
index fe6b709703b..771f2f20d07 100644
--- a/engines/tot/routines.cpp
+++ b/engines/tot/routines.cpp
@@ -3343,6 +3343,7 @@ void useScreenObject() {
teleencendida = !(teleencendida);
if (teleencendida) {
playVoc("CLICK", 27742, 2458);
+ g_engine->_sound->waitForSoundEnd();
currentRoomData->banderapaleta = true;
autoPlayVoc("PARASITO", 355778, 20129);
} else {
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
index 1782679355f..084c7afa5f2 100644
--- a/engines/tot/routines2.cpp
+++ b/engines/tot/routines2.cpp
@@ -260,12 +260,17 @@ void cargatele() {
}
fichct.seek(currentRoomData->puntpaleta + 603);
fichct.read(movimientopal, 144);
+ for (int i = 0; i <= 48; i++) {
+ movimientopal[i * 3 + 0] = movimientopal[i * 3 + 0] << 2;
+ movimientopal[i * 3 + 1] = movimientopal[i * 3 + 1] << 2;
+ movimientopal[i * 3 + 2] = movimientopal[i * 3 + 2] << 2;
+ }
fichct.close();
for (int ix = 195; ix <= 200; ix++) {
- pal[ix * 3 + 0] = 2;
- pal[ix * 3 + 1] = 2;
- pal[ix * 3 + 2] = 2;
+ pal[ix * 3 + 0] = 2 << 2;
+ pal[ix * 3 + 1] = 2 << 2;
+ pal[ix * 3 + 2] = 2 << 2;
setRGBPalette(ix, 2, 2, 2);
}
}
Commit: 3f688ebd809e6a6866c4e3fa17d45272ba55d4bc
https://github.com/scummvm/scummvm/commit/3f688ebd809e6a6866c4e3fa17d45272ba55d4bc
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:46+02:00
Commit Message:
TOT: Fixes secondanimation positioning
Changed paths:
engines/tot/routines2.cpp
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
index 084c7afa5f2..5b32c80ed11 100644
--- a/engines/tot/routines2.cpp
+++ b/engines/tot/routines2.cpp
@@ -76,8 +76,8 @@ void loadAnimation(Common::String animacion) {
fichcani.close();
debug("Read all frames! longtray2=%d", currentRoomData->longtray2);
- anchoanimado = READ_LE_UINT16(animado.dib[0][1]);
- altoanimado = READ_LE_UINT16(animado.dib[0][1] + 2);
+ anchoanimado = READ_LE_UINT16(animado.dib[0][1]) + 1;
+ altoanimado = READ_LE_UINT16(animado.dib[0][1] + 2) + 1;
setRoomTrajectories(altoanimado, anchoanimado, SET_WITH_ANIM, false);
Commit: b176b6fa566aee2018ecdc1bf2b4f894bbbc559c
https://github.com/scummvm/scummvm/commit/b176b6fa566aee2018ecdc1bf2b4f894bbbc559c
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:46+02:00
Commit Message:
TOT: Fixes positioning of Jacob before endgame
Changed paths:
engines/tot/game.cpp
engines/tot/routines2.cpp
engines/tot/sound.cpp
diff --git a/engines/tot/game.cpp b/engines/tot/game.cpp
index 9f181c30f0b..87b4ada7cc5 100644
--- a/engines/tot/game.cpp
+++ b/engines/tot/game.cpp
@@ -1137,7 +1137,7 @@ int startGame() {
restoreMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
if (contadorpc2 > 43)
_exit(274);
- sacrifice();
+ // sacrifice();
clear();
loadObjects();
loadPalette("SEGUNDA");
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
index 5b32c80ed11..1e7d0ff6e95 100644
--- a/engines/tot/routines2.cpp
+++ b/engines/tot/routines2.cpp
@@ -125,7 +125,7 @@ void updateAltScreen(byte otherScreenNumber) {
//Load other screen
- rooms->seek(otherScreenNumber * roomRegSize, SEEK_SET);
+ // rooms->seek(otherScreenNumber * roomRegSize, SEEK_SET);
currentRoomData = readScreenDataFile(rooms);
switch (otherScreenNumber) {
@@ -197,7 +197,7 @@ void updateAltScreen(byte otherScreenNumber) {
} break;
}
- setRoomTrajectories(altoanimado, anchoanimado, RESTORE);
+ // setRoomTrajectories(altoanimado, anchoanimado, RESTORE);
// Save other screen
saveRoomData(currentRoomData, rooms);
diff --git a/engines/tot/sound.cpp b/engines/tot/sound.cpp
index 41592b6df6c..c143bb26466 100644
--- a/engines/tot/sound.cpp
+++ b/engines/tot/sound.cpp
@@ -380,18 +380,18 @@ void playVoc(Common::String vocfile, int32 posinicio, uint tamvocleer) {
}
void playMidiFile(Common::String nomfich, boolean loop) {
- // Disabled to avoid annoying music
+ // // Disabled to avoid annoying music
- Common::File ficheromus;
- if(!ficheromus.open(Common::Path(nomfich + ".MUS"))){
- error("pitamidfich(): ioresult! (267)");
- }
- mid_reset();
- midmusica = (byte *)malloc(ficheromus.size());
- ficheromus.read(midmusica, ficheromus.size());
+ // Common::File ficheromus;
+ // if(!ficheromus.open(Common::Path(nomfich + ".MUS"))){
+ // error("pitamidfich(): ioresult! (267)");
+ // }
+ // mid_reset();
+ // midmusica = (byte *)malloc(ficheromus.size());
+ // ficheromus.read(midmusica, ficheromus.size());
- g_engine->_sound->playMidi((byte *)midmusica, ficheromus.size(), true);
- ficheromus.close();
+ // g_engine->_sound->playMidi((byte *)midmusica, ficheromus.size(), true);
+ // ficheromus.close();
}
boolean disponiblemid() {
Commit: 465e1ac94b776fdf9cd9c3ca3890bbe2380412d5
https://github.com/scummvm/scummvm/commit/465e1ac94b776fdf9cd9c3ca3890bbe2380412d5
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:46+02:00
Commit Message:
TOT: Fixes palette issues on FLC anims
Changed paths:
engines/tot/game.cpp
engines/tot/graphman.cpp
engines/tot/routines.cpp
engines/tot/routines2.cpp
diff --git a/engines/tot/game.cpp b/engines/tot/game.cpp
index 87b4ada7cc5..078fda8ddbd 100644
--- a/engines/tot/game.cpp
+++ b/engines/tot/game.cpp
@@ -306,7 +306,7 @@ int engine_start() {
desactivagrabar = false;
}
- boolean enforceSecondPart = false;
+ boolean enforceSecondPart = true;
if(enforceSecondPart) { //DEBUG
completadalista1 = true;
completadalista2 = true;
diff --git a/engines/tot/graphman.cpp b/engines/tot/graphman.cpp
index adf0b728c92..9f1d041e145 100644
--- a/engines/tot/graphman.cpp
+++ b/engines/tot/graphman.cpp
@@ -72,6 +72,7 @@ void GraphicsManager::writeActionLine(const Common::String &str) {
}
void GraphicsManager::setPalette(byte *palette, uint num) {
+
g_system->getPaletteManager()->setPalette(palette, 0, num);
}
@@ -91,6 +92,7 @@ byte *GraphicsManager::getPalette() {
}
void GraphicsManager::changePalette(byte origin[768], byte target[768]) {
+
byte palpaso[768] = {0};
int auxpaso;
diff --git a/engines/tot/routines.cpp b/engines/tot/routines.cpp
index 771f2f20d07..a08d8885d6a 100644
--- a/engines/tot/routines.cpp
+++ b/engines/tot/routines.cpp
@@ -1220,6 +1220,7 @@ void updateMainCharacterDepth() {
void advanceAnimations(boolean zonavedada, boolean animateMouse) {
if (tocapintar) {
+
if (currentRoomData->banderamovimiento && tocapintar2) {
if (peteractivo && (Random(100) == 1) && !g_engine->_sound->isVocPlaying() && caramelos[0] == false) {
debug("Playing tos");
@@ -1323,7 +1324,6 @@ void advanceAnimations(boolean zonavedada, boolean animateMouse) {
if (pintaractivo) {
sprites(true);
}
-
tocapintar = false;
if (currentRoomData->banderapaleta && saltospal >= 4) {
saltospal = 0;
@@ -2934,7 +2934,7 @@ void useScreenObject() {
case 583: {
drawText(regobj.useTextRef);
g_engine->_mouseManager->hide();
- drawFlc(140, 34, 2124896, 0, 9, 24, false, false, true, basurillalog);
+ drawFlc(140, 34, 2124896, 0, 9, 24, false, false, false, basurillalog);
g_engine->_mouseManager->show();
updateItem(regobj.code);
currentRoomData->indexadoobjetos[7]->indicefichero = 716;
@@ -3030,7 +3030,9 @@ void useScreenObject() {
g_engine->_mouseManager->hide();
playVoc("PUFF", 191183, 18001);
//Animate to scythe
- drawFlc(180, 60, 2216848, 0, 9, 0, false, false, true, basurillalog);
+ debug("Start anim!");
+ drawFlc(180, 60, 2216848, 0, 9, 0, false, false, false, basurillalog);
+ debug("End Anim!");
//load Scythe
currentRoomData->bitmapasociados[2].puntbitmap = 1545820;
currentRoomData->bitmapasociados[2].tambitmap = 104;
@@ -3088,7 +3090,7 @@ void useScreenObject() {
goToObject(currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], 10);
g_engine->_mouseManager->hide();
playVoc("PUFF", 191183, 18001);
- drawFlc(0, 47, 2209158, 0, 9, 0, false, false, true, basurillalog);
+ drawFlc(0, 47, 2209158, 0, 9, 0, false, false, false, basurillalog);
currentRoomData->bitmapasociados[3].puntbitmap = 1591272;
currentRoomData->bitmapasociados[3].tambitmap = 92;
@@ -3132,7 +3134,7 @@ void useScreenObject() {
if (guadagna)
cavernas[3] = true;
} break;
- case 643: {
+ case 643: { //Urn with altar
if (currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory] != 5)
drawText(regobj.useTextRef);
pulsax = 149 - 7;
@@ -3141,7 +3143,7 @@ void useScreenObject() {
g_engine->_mouseManager->hide();
updateInventory(indicemochila);
drawBackpack();
- drawFlc(133, 0, 2076280, 0, 9, 22, false, false, true, basurillalog);
+ drawFlc(133, 0, 2076280, 0, 9, 22, false, false, false, basurillalog);
{
RoomBitmapRegister &with = currentRoomData->bitmapasociados[2];
@@ -3162,14 +3164,14 @@ void useScreenObject() {
cavernas[4] = false;
g_engine->_mouseManager->show();
} break;
- case 657: {
+ case 657: { //sharpen scythe
drawText(regobj.useTextRef);
pulsax = 178 - 7;
pulsay = 71 - 7;
goToObject(currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], 3);
g_engine->_mouseManager->hide();
playVoc("AFILAR", 0, 6433);
- drawFlc(160, 15, 2441804, 0, 9, 23, false, false, true, basurillalog);
+ drawFlc(160, 15, 2441804, 0, 9, 23, false, false, false, basurillalog);
replaceBackpack(indicemochila, 715);
drawBackpack();
g_engine->_mouseManager->show();
@@ -3183,7 +3185,6 @@ void useScreenObject() {
updateInventory(indicemochila);
dropObjectInScreen(regobj);
handPantallaToFondo();
- // XMStoPointer(ptr(segfondo, (offfondo + 4)), _handpantalla, 4,(sizepantalla - int32(4)));
assembleScreen();
drawScreen(fondo);
drawBackpack();
@@ -3193,17 +3194,16 @@ void useScreenObject() {
currentRoomData->mouseGrid[indlista][indmoch] = 13;
g_engine->_mouseManager->show();
} break;
- case 689: {
+ case 689: { //rope
drawText(regobj.useTextRef);
pulsax = 124 - 7;
pulsay = 133 - 7;
- goToObject(currentRoomData->rejapantalla[((characterPosX + rectificacionx) / factorx)][((characterPosY + rectificaciony) / factory)], 9);
+ goToObject(currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], 9);
g_engine->_mouseManager->hide();
- drawFlc(110, 79, 2361800, 0, 9, 0, false, false, true, basurillalog);
+ drawFlc(110, 79, 2361800, 0, 9, 0, false, false, false, basurillalog);
replaceBackpack(indicemochila, 701);
drawBackpack();
handPantallaToFondo();
- // XMStoPointer(ptr(segfondo, (offfondo + 4)), _handpantalla, 4, (sizepantalla - int32(4)));
assembleScreen();
drawScreen(fondo);
g_engine->_mouseManager->show();
@@ -3212,13 +3212,13 @@ void useScreenObject() {
for (indlista = 17; indlista <= 21; indlista++)
currentRoomData->mouseGrid[indlista][27] = 10;
} break;
- case 700: {
+ case 700: { //Trident
drawText(regobj.useTextRef);
pulsax = 224 - 7;
pulsay = 91 - 7;
goToObject(currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], 7);
g_engine->_mouseManager->hide();
- drawFlc(208, 0, 2382552, 0, 9, 21, false, false, true, basurillalog);
+ drawFlc(208, 0, 2382552, 0, 9, 21, false, false, false, basurillalog);
currentRoomData->bitmapasociados[0].puntbitmap = 0;
currentRoomData->bitmapasociados[0].tambitmap = 0;
currentRoomData->bitmapasociados[0].coordx = 0;
@@ -3279,7 +3279,7 @@ void useScreenObject() {
g_engine->_sound->waitForSoundEnd();
playVoc("PUFF", 191183, 18001);
animateOpen2(0, 1);
- drawFlc(180, 50, 2464240, 0, 9, 22, false, false, true, basurillalog);
+ drawFlc(180, 50, 2464240, 0, 9, 22, false, false, false, basurillalog);
salirdeljuego = true;
} else
drawText(Random(11) + 1022);
@@ -3402,7 +3402,7 @@ void useScreenObject() {
animateOpen2(0, 1);
playVoc("FUEGO", 72598, 9789);
if (vasijapuesta) {
- drawFlc(108, 0, 2296092, 0, 9, 0, false, false, true, basurillalog);
+ drawFlc(108, 0, 2296092, 0, 9, 0, false, false, false, basurillalog);
{
RoomBitmapRegister &with = currentRoomData->bitmapasociados[0];
@@ -3416,7 +3416,7 @@ void useScreenObject() {
for (indmoch = 10; indmoch <= 13; indmoch++)
currentRoomData->mouseGrid[indlista][indmoch] = 12;
} else
- drawFlc(108, 0, 2231140, 0, 9, 0, false, false, true, basurillalog);
+ drawFlc(108, 0, 2231140, 0, 9, 0, false, false, false, basurillalog);
g_engine->_mouseManager->show();
} break;
}
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
index 1e7d0ff6e95..b5e2881d4d8 100644
--- a/engines/tot/routines2.cpp
+++ b/engines/tot/routines2.cpp
@@ -125,7 +125,7 @@ void updateAltScreen(byte otherScreenNumber) {
//Load other screen
- // rooms->seek(otherScreenNumber * roomRegSize, SEEK_SET);
+ rooms->seek(otherScreenNumber * roomRegSize, SEEK_SET);
currentRoomData = readScreenDataFile(rooms);
switch (otherScreenNumber) {
@@ -197,7 +197,6 @@ void updateAltScreen(byte otherScreenNumber) {
} break;
}
- // setRoomTrajectories(altoanimado, anchoanimado, RESTORE);
// Save other screen
saveRoomData(currentRoomData, rooms);
Commit: f78cd951522e223f46b5f6f8fbfa286a43a1380a
https://github.com/scummvm/scummvm/commit/f78cd951522e223f46b5f6f8fbfa286a43a1380a
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:46+02:00
Commit Message:
TOT: Fixes fade in to red color in sacrifice scene
Changed paths:
engines/tot/routines2.cpp
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
index b5e2881d4d8..aa6f5c0f626 100644
--- a/engines/tot/routines2.cpp
+++ b/engines/tot/routines2.cpp
@@ -2478,8 +2478,8 @@ void sacrifice() {
for(int i = 0; i < 256; i++) {
palaux[i * 3 + 0] = palaux[i * 3 + 0] << 2;
- palaux[i * 3 + 0] = palaux[i * 3 + 0] << 2;
- palaux[i * 3 + 0] = palaux[i * 3 + 0] << 2;
+ palaux[i * 3 + 1] = palaux[i * 3 + 1] << 2;
+ palaux[i * 3 + 2] = palaux[i * 3 + 2] << 2;
}
fich.read(fondo, 64000);
Commit: e6c74942b0508e2c59e5c8146087eb9ede91fdad
https://github.com/scummvm/scummvm/commit/e6c74942b0508e2c59e5c8146087eb9ede91fdad
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:46+02:00
Commit Message:
TOT: Fixes fountain pixels overlapping interface
Changed paths:
engines/tot/anims.cpp
engines/tot/routines.cpp
engines/tot/routines2.cpp
diff --git a/engines/tot/anims.cpp b/engines/tot/anims.cpp
index 05c06dac883..7d5e711b84b 100644
--- a/engines/tot/anims.cpp
+++ b/engines/tot/anims.cpp
@@ -84,8 +84,9 @@ void drawText(uint xfrase, uint yfrase, Common::String str1, Common::String str2
}
void removeText(uint xfrase1, uint yfrase1, uint xfrase2, uint yfrase2, byte colorrelleno) {
- for (int j = yfrase1; j < yfrase2; j++) {
- for (int i = xfrase1; i < xfrase2; i++) {
+
+ for (int j = yfrase1; j < yfrase2 + 1; j++) {
+ for (int i = xfrase1; i < xfrase2 + 1; i++) {
*((byte *)g_engine->_screen->getBasePtr(i, j)) = 0;
}
}
diff --git a/engines/tot/routines.cpp b/engines/tot/routines.cpp
index a08d8885d6a..b54724735d5 100644
--- a/engines/tot/routines.cpp
+++ b/engines/tot/routines.cpp
@@ -331,9 +331,17 @@ void sprites(boolean pintapersonaje) {
uint16 patchH;
if ((pasoframeH + characterPosY) > (animado.posy + pasoanimadoH)) {
- patchH = pasoframeH + 6 + abs(characterPosY - (int)animado.posy);
+ patchH = pasoframeH + 6 + abs(characterPosY - animado.posy);
} else {
- patchH = pasoanimadoH + 6 + abs(characterPosY - (int)animado.posy);
+ patchH = pasoanimadoH + 6 + abs(characterPosY - animado.posy);
+ }
+
+ if(posfondoy + patchH > 140) {
+ patchH -= (posfondoy + patchH) - 140 + 1;
+ }
+
+ if(posfondox + patchW > 320) {
+ patchW -= (posfondox + patchW) - 320 + 1;
}
characterDirtyRect = (byte *)malloc((patchW + 1) * (patchH + 1) + 4);
@@ -364,6 +372,14 @@ void sprites(boolean pintapersonaje) {
pasoanimadoW = READ_LE_UINT16(pasoanimado) + 6;
pasoanimadoH = READ_LE_UINT16(pasoanimado + 2) + 6;
+ if(posfondoy + pasoanimadoH > 140) {
+ pasoanimadoH -= (posfondoy + pasoanimadoH) - 140 + 1;
+ }
+
+ if(posfondox + pasoanimadoW > 320) {
+ pasoanimadoW -= (posfondox + pasoanimadoW) - 320 + 1;
+ }
+
characterDirtyRect = (byte *)malloc((pasoanimadoW + 1) * (pasoanimadoH + 1) + 4);
WRITE_LE_UINT16(characterDirtyRect, pasoanimadoW);
WRITE_LE_UINT16(characterDirtyRect + 2, pasoanimadoH);
@@ -1014,30 +1030,15 @@ void useInventoryObjectWithInventoryObject(uint numobj1, uint numobj2) {
if (regobj.reemplazarpor == 0) {
readItemRegister(invItemData, numobj1, regobj);
- // seek(fichobj, numobj1);
- // limpiaregobj();
- // fichobj >> regobj;
regobj.usar[0] = 9;
saveItemRegister(regobj, invItemData);
- // fichobj.seek(numobj1);
- //TODO: SAVING!
- // readItemRegister(fichobj, numobj1);
- // seek(fichobj, numobj1);
- // fichobj << regobj;
- readItemRegister(invItemData, numobj2, regobj);
- // seek(fichobj, numobj2);
- // limpiaregobj();
- // fichobj >> regobj;
+ readItemRegister(invItemData, numobj2, regobj);
regobj.usar[0] = 9;
saveItemRegister(regobj, invItemData);
- //TODO: SAVING!
- // seek(fichobj, numobj2);
- // fichobj << regobj;
- // fichobj.close();
+
} else {
readItemRegister(invItemData, regobj.reemplazarpor, regobj);
- // fichobj.close();
mobj[indobj1].bitmapIndex = regobj.objectIconBitmap;
mobj[indobj1].code = regobj.code;
mobj[indobj1].objectName = regobj.name;
@@ -3121,7 +3122,6 @@ void useScreenObject() {
currentRoomData->bitmapasociados[4].profund = 0;
objetos[7] = NULL;
handPantallaToFondo();
- // XMStoPointer(ptr(segfondo, (offfondo + 4)), _handpantalla, 4, (sizepantalla - int32(4)));
assembleScreen();
drawScreen(fondo);
animatePickup2(3, 1);
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
index aa6f5c0f626..30e651e7d6c 100644
--- a/engines/tot/routines2.cpp
+++ b/engines/tot/routines2.cpp
@@ -664,7 +664,6 @@ static void loadDiploma(Common::String &nombrefoto, Common::String &clave) {
byte *pantalla;
uint size;
byte *sello;
- // registers reg;
Common::File fich;
if (!fich.open("DIPLOMA.PAN")) {
@@ -713,8 +712,6 @@ static void loadDiploma(Common::String &nombrefoto, Common::String &clave) {
clave.append(passArray, passArray + 10);
- // // settextstyle(defaultfont, horizdir, 1);
- // FIXME: proper font
outtextxyBios(91, 16, "CERTIFICADO N\xA7:" + clave, 255);
outtextxyBios(90, 15, "CERTIFICADO N\xA7:" + clave, 13);
Commit: 4f55719fd564b7f11a6e6cbcd23debf28b86cf5e
https://github.com/scummvm/scummvm/commit/4f55719fd564b7f11a6e6cbcd23debf28b86cf5e
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:46+02:00
Commit Message:
TOT: Fixes alcove animations
Changed paths:
engines/tot/game.cpp
engines/tot/graphics.cpp
engines/tot/graphics.h
engines/tot/playanim.cpp
engines/tot/playanim.h
engines/tot/routines.cpp
engines/tot/routines2.cpp
diff --git a/engines/tot/game.cpp b/engines/tot/game.cpp
index 078fda8ddbd..2f12c80bc22 100644
--- a/engines/tot/game.cpp
+++ b/engines/tot/game.cpp
@@ -257,7 +257,7 @@ void newGame() {
initializeObjectFile();
loadPalette("DEFAULT");
loadScreenData(1);
- effect(13, false, fondo);
+ effect(13, false, background);
mask();
posicioninv = 0;
drawBackpack();
@@ -368,7 +368,7 @@ int startGame() {
showGameGrid = !showGameGrid;
break;
case Common::KEYCODE_0:
- effect(13, false, fondo);
+ effect(13, false, background);
break;
case Common::KEYCODE_8:
drawObjectAreas = !drawObjectAreas;
@@ -673,7 +673,7 @@ int startGame() {
autoPlayVoc("PARASITO", 355778, 20129);
else
cargatele();
- effect(tipoefectofundido, false, fondo);
+ effect(tipoefectofundido, false, background);
contadorpc = contadorpc2;
g_engine->_mouseManager->show();
oldxrejilla = 0;
@@ -696,7 +696,7 @@ int startGame() {
stopVoc();
autoPlayVoc("CALDERA", 6433, 15386);
setSfxVolume(volumenfxizquierdo, 0);
- effect(tipoefectofundido, false, fondo);
+ effect(tipoefectofundido, false, background);
g_engine->_mouseManager->show();
oldxrejilla = 0;
oldyrejilla = 0;
@@ -744,7 +744,7 @@ int startGame() {
trayec[indicetray].x = characterPosX;
trayec[indicetray].y = characterPosY;
loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
- effect(tipoefectofundido, false, fondo);
+ effect(tipoefectofundido, false, background);
g_engine->_mouseManager->show();
oldxrejilla = 0;
@@ -765,7 +765,7 @@ int startGame() {
g_engine->_mouseManager->hide();
effect(tipoefectofundido, true, NULL);
loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
- effect(tipoefectofundido, false, fondo);
+ effect(tipoefectofundido, false, background);
g_engine->_mouseManager->show();
oldxrejilla = 0;
oldyrejilla = 0;
@@ -826,7 +826,7 @@ int startGame() {
g_engine->_mouseManager->hide();
effect(tipoefectofundido, true, NULL);
loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
- effect(tipoefectofundido, false, fondo);
+ effect(tipoefectofundido, false, background);
g_engine->_mouseManager->show();
oldxrejilla = 0;
oldyrejilla = 0;
@@ -864,7 +864,7 @@ int startGame() {
if (contadorpc > 89)
error("engine_start(): contadorpc (274)");
setSfxVolume(volumenfxizquierdo, volumenfxderecho);
- effect(tipoefectofundido, false, fondo);
+ effect(tipoefectofundido, false, background);
contadorpc = contadorpc2;
g_engine->_mouseManager->show();
oldxrejilla = 0;
@@ -885,7 +885,7 @@ int startGame() {
g_engine->_mouseManager->hide();
effect(tipoefectofundido, true, NULL);
loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
- effect(tipoefectofundido, false, fondo);
+ effect(tipoefectofundido, false, background);
g_engine->_mouseManager->show();
oldxrejilla = 0;
oldyrejilla = 0;
@@ -918,7 +918,7 @@ int startGame() {
g_engine->_mouseManager->hide();
effect(tipoefectofundido, true, NULL);
loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
- effect(tipoefectofundido, false, fondo);
+ effect(tipoefectofundido, false, background);
g_engine->_mouseManager->show();
oldxrejilla = 0;
oldyrejilla = 0;
@@ -970,7 +970,7 @@ int startGame() {
setSfxVolume(volumenfxizquierdo, volumenfxderecho);
if (currentRoomData->codigo == 4)
loadVoc("GOTA", 140972, 1029);
- effect(tipoefectofundido, false, fondo);
+ effect(tipoefectofundido, false, background);
contadorpc = contadorpc2;
g_engine->_mouseManager->show();
oldxrejilla = 0;
@@ -1033,7 +1033,7 @@ int startGame() {
}
assembleScreen();
}
- effect(tipoefectofundido, false, fondo);
+ effect(tipoefectofundido, false, background);
if ((rojo_capturado == false) && (trampa_puesta == false))
runaroundRed();
contadorpc = contadorpc2;
@@ -1070,7 +1070,7 @@ int startGame() {
autoPlayVoc("FUENTE", 0, 0);
break;
}
- effect(tipoefectofundido, false, fondo);
+ effect(tipoefectofundido, false, background);
contadorpc = contadorpc2;
g_engine->_mouseManager->show();
oldxrejilla = 0;
@@ -1150,7 +1150,7 @@ int startGame() {
lowerMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
playMidiFile("SEGUNDA", true);
restoreMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
- effect(1, false, fondo);
+ effect(1, false, background);
mask();
posicioninv = 0;
drawBackpack();
@@ -1181,13 +1181,13 @@ int startGame() {
if (drawObjectAreas) {
for (int indice = 0; indice < nivelesdeprof; indice++) {
- if (objetos[indice] != NULL) {
+ if (screenObjects[indice] != NULL) {
if (true) {
// debug
- uint16 w = READ_LE_UINT16(objetos[indice]);
- uint16 h = READ_LE_UINT16(objetos[indice] + 2);
- Common::Rect r = Common::Rect(profundidad[indice].posx, profundidad[indice].posy, profundidad[indice].posx + w, profundidad[indice].posy + h);
- drawRect(180, profundidad[indice].posx, profundidad[indice].posy, profundidad[indice].posx + w, profundidad[indice].posy + h);
+ uint16 w = READ_LE_UINT16(screenObjects[indice]);
+ uint16 h = READ_LE_UINT16(screenObjects[indice] + 2);
+ Common::Rect r = Common::Rect(depthMap[indice].posx, depthMap[indice].posy, depthMap[indice].posx + w, depthMap[indice].posy + h);
+ drawRect(180, depthMap[indice].posx, depthMap[indice].posy, depthMap[indice].posx + w, depthMap[indice].posy + h);
outtextxy(r.left, r.top, Common::String().format("%d", indice), 0);
}
diff --git a/engines/tot/graphics.cpp b/engines/tot/graphics.cpp
index 91596b78ed6..c76c0c9cce4 100644
--- a/engines/tot/graphics.cpp
+++ b/engines/tot/graphics.cpp
@@ -913,8 +913,8 @@ void initGraph() {
datosfundido[i][j] = i / (j + 1);
}
-void handPantallaToFondo() {
- Common::copy(handpantalla + 4, handpantalla + sizepantalla, fondo + 4);
+void handPantallaToBackground() {
+ Common::copy(handpantalla + 4, handpantalla + sizepantalla, background + 4);
}
void copyPalette(palette from, palette to) {
diff --git a/engines/tot/graphics.h b/engines/tot/graphics.h
index 6d98594946e..cdee5db983e 100644
--- a/engines/tot/graphics.h
+++ b/engines/tot/graphics.h
@@ -52,7 +52,7 @@ void changeRGBBlock(byte initialColor, uint numColors, void *rgb);
void processingActive();
void rectangle(int x1, int y1, int x2, int y2, byte color);
void rectangle(uint x1, uint y1, uint x2, uint y2, byte color);
-void handPantallaToFondo();
+void handPantallaToBackground();
void copyPalette(palette from, palette to);
void loadAnimationIntoBuffer(Common::SeekableReadStream *stream, byte *&buf, int sizeanimado);
} // End of namespace Tot
diff --git a/engines/tot/playanim.cpp b/engines/tot/playanim.cpp
index 547e6b7adf5..bd637fb2d6f 100644
--- a/engines/tot/playanim.cpp
+++ b/engines/tot/playanim.cpp
@@ -212,15 +212,15 @@ byte iframe, iframe2;
long sizepantalla;
-datosobj profundidad[numobjetosconv];
+datosobj depthMap[numobjetosconv];
-byte *objetos[numobjetosconv];
+byte *screenObjects[numobjetosconv];
byte *pasoframe;
byte *pasoanimado;
-byte *fondo;
+byte *background;
byte *characterDirtyRect;
@@ -1123,7 +1123,7 @@ void initPlayAnim() {
// encriptado[253] = '\63';
tocapintar = false;
for (int i = 0; i < numobjetosconv; i++) {
- objetos[i] = NULL;
+ screenObjects[i] = NULL;
}
xraton = 160;
yraton = 100;
diff --git a/engines/tot/playanim.h b/engines/tot/playanim.h
index 7470cb41fc8..0f2491ff812 100644
--- a/engines/tot/playanim.h
+++ b/engines/tot/playanim.h
@@ -615,11 +615,11 @@ extern long sizepantalla;
/**
* Depth of screenobjects
*/
-extern datosobj profundidad[numobjetosconv];
+extern datosobj depthMap[numobjetosconv];
/**
* Bitmaps of screenobjects
*/
-extern byte *objetos[numobjetosconv];
+extern byte *screenObjects[numobjetosconv];
/**
* Current frame of main character
*/
@@ -632,7 +632,7 @@ extern byte *pasoanimado;
/**
* Pointer storing the screen as it displays on the game
*/
-extern byte *fondo;
+extern byte *background;
/**
* Dirty patch of screen to repaint on every frame
diff --git a/engines/tot/routines.cpp b/engines/tot/routines.cpp
index b54724735d5..5afe22a1254 100644
--- a/engines/tot/routines.cpp
+++ b/engines/tot/routines.cpp
@@ -102,9 +102,9 @@ void runaroundRed() {
}
} while (!exitLoop && !g_engine->shouldQuit());
freeAnimation();
- handPantallaToFondo();
+ handPantallaToBackground();
assembleScreen();
- drawScreen(fondo);
+ drawScreen(background);
}
void updateMovementCells() {
@@ -159,7 +159,7 @@ static void assembleBackground() {
// XMStoPointer(ptr(segfondo, (offfondo + 4)), handpantalla, 4, (sizepantalla - longint(4)));
// copies the entire clean background in handpantalla back into fondo
- handPantallaToFondo();
+ handPantallaToBackground();
posabs = 4 + posfondoy * 320 + posfondox;
// debug("posabs = %d, posfondox = %d, posfondoy=%d", posabs, posfondox, posfondoy);
@@ -176,7 +176,7 @@ static void assembleBackground() {
for (int i = 0; i < w; i++) {
int pos = posabs + j * 320 + i;
int destPos = 4 + (j * w + i);
- characterDirtyRect[destPos] = fondo[pos];
+ characterDirtyRect[destPos] = background[pos];
}
}
}
@@ -233,14 +233,14 @@ static void assembleImage(byte *imagen, uint posimagenx, uint posimageny) { // N
}
static void overlayObject() {
- if (objetos[indice] != NULL) {
+ if (screenObjects[indice] != NULL) {
if (
- (profundidad[indice].posx <= posfondox2) &&
- (profundidad[indice].posx2 > posfondox) &&
- (profundidad[indice].posy < posfondoy2) &&
- (profundidad[indice].posy2 > posfondoy)
+ (depthMap[indice].posx <= posfondox2) &&
+ (depthMap[indice].posx2 > posfondox) &&
+ (depthMap[indice].posy < posfondoy2) &&
+ (depthMap[indice].posy2 > posfondoy)
) {
- assembleImage(objetos[indice], profundidad[indice].posx, profundidad[indice].posy);
+ assembleImage(screenObjects[indice], depthMap[indice].posx, depthMap[indice].posy);
}
}
}
@@ -249,7 +249,7 @@ void drawMainCharacter() {
bool debug = false;
if (debug) {
- effect(13, false, fondo);
+ effect(13, false, background);
}
uint16 tempW;
@@ -623,16 +623,16 @@ void animatedSequence(uint numSequence) {
saltospal += 1;
putShape(animx, animy, animptr);
}
- objetos[regobj.profundidad - 1] = NULL;
- handPantallaToFondo();
+ screenObjects[regobj.profundidad - 1] = NULL;
+ handPantallaToBackground();
indiceani = secuencia.profundidad;
secuencia.profundidad = 30;
- objetos[13] = animptr;
- profundidad[13].posx = animx;
- profundidad[13].posy = animy;
+ screenObjects[13] = animptr;
+ depthMap[13].posx = animx;
+ depthMap[13].posy = animy;
assembleScreen();
- drawScreen(fondo);
- objetos[13] = NULL;
+ drawScreen(background);
+ screenObjects[13] = NULL;
secuencia.profundidad = indiceani;
drawBackpack();
for (indiceani = 32; indiceani <= numframessec; indiceani++) {
@@ -678,13 +678,13 @@ void animatedSequence(uint numSequence) {
}
indiceani = secuencia.profundidad;
secuencia.profundidad = 30;
- objetos[12] = animptr;
- profundidad[12].posx = animx;
- profundidad[12].posy = animy;
+ screenObjects[12] = animptr;
+ depthMap[12].posx = animx;
+ depthMap[12].posy = animy;
disableSecondAnimation();
- objetos[12] = NULL;
+ screenObjects[12] = NULL;
secuencia.profundidad = indiceani;
- drawScreen(fondo);
+ drawScreen(background);
for (indiceani = 9; indiceani <= numframessec; indiceani++) {
animationFile.read(animptr, tamsecani);
emptyLoop();
@@ -712,10 +712,10 @@ void animatedSequence(uint numSequence) {
tamsecani = animationFile.readUint16LE();
numframessec = animationFile.readByte();
animationFile.readByte();
- objetos[6] = (byte *)malloc(tamsecani);
+ screenObjects[6] = (byte *)malloc(tamsecani);
// objetos[7] = ptr(segfondo, (offfondo + 44900));
- profundidad[6].posx = animado.posx + 5;
- profundidad[6].posy = animado.posy - 6;
+ depthMap[6].posx = animado.posx + 5;
+ depthMap[6].posy = animado.posy - 6;
indiceani = 0;
do {
emptyLoop();
@@ -730,12 +730,12 @@ void animatedSequence(uint numSequence) {
} else
saltospal += 1;
if (tocapintar2) {
- animationFile.read(objetos[6], tamsecani);
- Common::copy(objetos[6], objetos[6] + tamsecani, fondo + 44900);
+ animationFile.read(screenObjects[6], tamsecani);
+ Common::copy(screenObjects[6], screenObjects[6] + tamsecani, background + 44900);
// blockread(ficherosecuenciaanimada, objetos[7], tamsecani);
- handPantallaToFondo();
+ handPantallaToBackground();
assembleScreen();
- drawScreen(fondo);
+ drawScreen(background);
indiceani += 1;
if (indiceani == 8)
playVoc("PUFF", 191183, 18001);
@@ -743,7 +743,7 @@ void animatedSequence(uint numSequence) {
} while (indiceani != numframessec && !g_engine->shouldQuit());
animationFile.close();
stopVoc();
- objetos[6] = NULL;
+ screenObjects[6] = NULL;
currentRoomData->banderamovimiento = true;
} break;
}
@@ -943,7 +943,7 @@ void lookInventoryObject(byte numeroobjeto) {
g_engine->_mouseManager->hide();
copyPalette(pal, paletaseg);
readItemRegister(mobj[numeroobjeto].code);
- getImg(0, 0, 319, 139, fondo);
+ getImg(0, 0, 319, 139, background);
partialFadeOut(234);
bar(0, 0, 319, 139, 0);
for (yaux = 1; yaux <= 12; yaux++)
@@ -997,7 +997,7 @@ void lookInventoryObject(byte numeroobjeto) {
effect(3, true, NULL);
partialFadeOut(234);
assembleScreen();
- drawScreen(fondo);
+ drawScreen(background);
copyPalette(paletaseg, pal);
partialFadeIn(234);
g_engine->_mouseManager->show();
@@ -1525,72 +1525,81 @@ void animateBat() {
animado.profundidad = profseg;
animado.dir = dirseg;
}
- handPantallaToFondo();
+ handPantallaToBackground();
assembleScreen();
- drawScreen(fondo);
+ drawScreen(background);
}
void updateVideo() {
- readBitmap(regobj.puntparche, objetos[regobj.profundidad - 1], regobj.tamparche, 319);
- handPantallaToFondo();
+ readBitmap(regobj.puntparche, screenObjects[regobj.profundidad - 1], regobj.tamparche, 319);
+ handPantallaToBackground();
assembleScreen();
- drawScreen(fondo);
+ drawScreen(background);
}
-void alcoveAnimation(byte direccionhn, int32 dibujo) {
+void alcoveAnimation(byte direccionhn, int32 bitmap) {
uint posdibhn, indicehn;
int incrementohn;
+ // Room with Red
if (currentRoomData->codigo == 24) {
- objetos[1] = (byte *)malloc(3660);
- readBitmap(1382874, objetos[1], 3652, 319);
- uint16 object2Width = READ_LE_UINT16(objetos[1]);
- uint16 object2Height = READ_LE_UINT16(objetos[1] + 2);
- profundidad[1].posx = 211;
- profundidad[1].posy = 16;
- profundidad[1].posx2 = 211 + object2Width + 1;
- profundidad[1].posy2 = 16 + object2Height + 1;
+ screenObjects[1] = (byte *)malloc(3660);
+ readBitmap(1382874, screenObjects[1], 3652, 319);
+ uint16 object1Width = READ_LE_UINT16(screenObjects[1]);
+ uint16 object1Height = READ_LE_UINT16(screenObjects[1] + 2);
+ depthMap[1].posx = 211;
+ depthMap[1].posy = 16;
+ depthMap[1].posx2 = 211 + object1Width + 1;
+ depthMap[1].posy2 = 16 + object1Height + 1;
}
+ uint16 dibW;
+ uint16 dibH;
+ debug("direccion=%d", direccionhn);
switch (direccionhn) {
case 0: {
posdibhn = 44904;
incrementohn = 1;
- Common::copy(objetos[0], objetos[0] + 892, fondo + 44900);
- readBitmap(dibujo, objetos[0], 892, 319);
- Common::copy(objetos[0] + 4, objetos[0] + 4 + 888, fondo + 44900 + 892);
+ Common::copy(screenObjects[0], screenObjects[0] + 892, background + 44900);
+ readBitmap(bitmap, screenObjects[0], 892, 319);
+ Common::copy(screenObjects[0] + 4, screenObjects[0] + 4 + 888, background + 44900 + 892);
} break;
- case 1: {
+ case 1: { // object slides to reveal empty stand
posdibhn = 892 + 44900;
incrementohn = -1;
- readBitmap(dibujo, fondo + 44900, 892, 319);
- Common::copy(objetos[0] + 4, objetos[0] + 4 + (888 - 4), fondo + 44900 + 892);
+ // Reads the empty alcove into a non-visible part of fondo
+ readBitmap(bitmap, background + 44900, 892, 319);
+ // Copies whatever is currently on the alcove in a non-visible part of fondo contiguous with the above
+ Common::copy(screenObjects[0] + 4, screenObjects[0] + 4 + 888, background + 44900 + 892);
+ // We now have in consecutive pixels the empty stand and the object
+
} break;
}
- // uint16 object1Width = READ_LE_UINT16(objetos[0]);
- uint16 object1Height = READ_LE_UINT16(objetos[0] + 2);
+ uint16 alcoveWidth = READ_LE_UINT16(screenObjects[0]);
+ uint16 alcoveHeight = READ_LE_UINT16(screenObjects[0] + 2);
+ // Set the height to double to animate 2 images of the same height moving up/down
+ *(background + 44900 + 2) = (alcoveHeight * 2) + 1;
- *(fondo + 44900 + 2)= *(objetos[0] + 2) * 2 + 1;
- handPantallaToFondo();
+ handPantallaToBackground();
- for (indicehn = 1; indicehn <= object1Height; indicehn++) {
- posdibhn = posdibhn + (incrementohn * fondo[44900] + 1);
+ for (indicehn = 1; indicehn <= alcoveHeight; indicehn++) {
- Common::copy(fondo + posdibhn, fondo + posdibhn + 888, objetos[0] + 4);
+ posdibhn = posdibhn + (incrementohn * (alcoveWidth + 1));
+ Common::copy(background + posdibhn, background + posdibhn + 888, screenObjects[0] + 4);
assembleScreen();
- drawScreen(fondo);
+ drawScreen(background);
g_engine->_screen->update();
}
- readBitmap(dibujo, objetos[0], 892, 319);
+ readBitmap(bitmap, screenObjects[0], 892, 319);
- handPantallaToFondo();
+ handPantallaToBackground();
assembleScreen();
- drawScreen(fondo);
+ drawScreen(background);
if (currentRoomData->codigo == 24) {
- free(objetos[1]);
- objetos[1] = NULL;
+ free(screenObjects[1]);
+ screenObjects[1] = NULL;
}
}
@@ -1644,10 +1653,10 @@ void pickupScreenObject() {
} break;
default: {
animatePickup1(direccionmovimiento, 0);
- objetos[regobj.profundidad - 1] = NULL;
- handPantallaToFondo();
+ screenObjects[regobj.profundidad - 1] = NULL;
+ handPantallaToBackground();
assembleScreen();
- drawScreen(fondo);
+ drawScreen(background);
animatePickup2(direccionmovimiento, 0);
}
}
@@ -1703,11 +1712,11 @@ void pickupScreenObject() {
with.profund = 1;
loadItem(with.coordx, with.coordy, with.tambitmap, with.puntbitmap, with.profund);
}
- objetos[regobj.profundidad - 1] = NULL;
- handPantallaToFondo();
+ screenObjects[regobj.profundidad - 1] = NULL;
+ handPantallaToBackground();
assembleScreen();
- drawScreen(fondo);
+ drawScreen(background);
animatePickup2(0, 1);
} break;
case 562: { // alcove
@@ -1720,15 +1729,15 @@ void pickupScreenObject() {
hornacina[0][hornacina[0][3]] = 0;
currentRoomData->indexadoobjetos[9]->objectName = "HORNACINA";
animatePickup1(3, 1);
- readBitmap(1190768, objetos[regobj.profundidad - 1], 892, 319);
+ readBitmap(1190768, screenObjects[regobj.profundidad - 1], 892, 319);
currentRoomData->bitmapasociados[1].puntbitmap = 1190768;
currentRoomData->bitmapasociados[1].tambitmap = 892;
currentRoomData->bitmapasociados[1].coordx = 66;
currentRoomData->bitmapasociados[1].coordy = 35;
currentRoomData->bitmapasociados[1].profund = 1;
- handPantallaToFondo();
+ handPantallaToBackground();
assembleScreen();
- drawScreen(fondo);
+ drawScreen(background);
animatePickup2(3, 1);
} else {
readItemRegister(hornacina[0][hornacina[0][3]]);
@@ -1737,11 +1746,11 @@ void pickupScreenObject() {
hornacina[1][3] -= 1;
currentRoomData->indexadoobjetos[9]->objectName = " ";
animatePickup1(3, 1);
- readBitmap(1190768, objetos[regobj.profundidad - 1],
+ readBitmap(1190768, screenObjects[regobj.profundidad - 1],
892, 319);
- handPantallaToFondo();
+ handPantallaToBackground();
assembleScreen();
- drawScreen(fondo);
+ drawScreen(background);
animatePickup2(3, 1);
playVoc("PLATAF", 375907, 14724);
currentRoomData->bitmapasociados[1].tambitmap = 892;
@@ -1787,15 +1796,15 @@ void pickupScreenObject() {
hornacina[1][2] = 0;
currentRoomData->indexadoobjetos[8]->objectName = "HORNACINA";
animatePickup1(0, 1);
- readBitmap(1399610, objetos[regobj.profundidad - 1], 892, 319);
+ readBitmap(1399610, screenObjects[regobj.profundidad - 1], 892, 319);
currentRoomData->bitmapasociados[0].puntbitmap = 1399610;
currentRoomData->bitmapasociados[0].tambitmap = 892;
currentRoomData->bitmapasociados[0].coordx = 217;
currentRoomData->bitmapasociados[0].coordy = 48;
currentRoomData->bitmapasociados[0].profund = 1;
- handPantallaToFondo();
+ handPantallaToBackground();
assembleScreen();
- drawScreen(fondo);
+ drawScreen(background);
animatePickup2(0, 1);
} else {
readItemRegister(hornacina[1][hornacina[1][3]]);
@@ -1804,10 +1813,10 @@ void pickupScreenObject() {
hornacina[0][3] -= 1;
currentRoomData->indexadoobjetos[8]->objectName = " ";
animatePickup1(0, 1);
- readBitmap(1399610, objetos[0], 892, 319);
- handPantallaToFondo();
+ readBitmap(1399610, screenObjects[0], 892, 319);
+ handPantallaToBackground();
assembleScreen();
- drawScreen(fondo);
+ drawScreen(background);
animatePickup2(0, 1);
playVoc("PLATAF", 375907, 14724);
currentRoomData->bitmapasociados[0].tambitmap = 892;
@@ -1863,19 +1872,19 @@ void pickupScreenObject() {
with.coordy = 0;
with.profund = 0;
}
- objetos[3] = NULL;
+ screenObjects[3] = NULL;
disableSecondAnimation();
- drawScreen(fondo);
+ drawScreen(background);
animatePickup2(2, 1);
rojo_capturado = true;
trampa_puesta = false;
} break;
default: {
animatePickup1(direccionmovimiento, 1);
- objetos[regobj.profundidad - 1] = NULL;
- handPantallaToFondo();
+ screenObjects[regobj.profundidad - 1] = NULL;
+ handPantallaToBackground();
assembleScreen();
- drawScreen(fondo);
+ drawScreen(background);
animatePickup2(direccionmovimiento, 1);
}
}
@@ -1908,7 +1917,7 @@ void pickupScreenObject() {
} break;
case 659: { // spider web, puts bird and ring on the floor
animatePickup1(3, 2);
- objetos[regobj.profundidad - 1] = NULL;
+ screenObjects[regobj.profundidad - 1] = NULL;
{ // bird
RoomBitmapRegister &with = currentRoomData->bitmapasociados[2];
@@ -1929,16 +1938,16 @@ void pickupScreenObject() {
with.profund = 3;
loadItem(with.coordx, with.coordy, with.tambitmap, with.puntbitmap, with.profund);
}
- handPantallaToFondo();
+ handPantallaToBackground();
assembleScreen();
- drawScreen(fondo);
+ drawScreen(background);
animatePickup2(3, 2);
} break;
default: {
animatePickup1(direccionmovimiento, 2);
- objetos[regobj.profundidad - 1] = NULL;
+ screenObjects[regobj.profundidad - 1] = NULL;
assembleScreen();
- drawScreen(fondo);
+ drawScreen(background);
animatePickup2(direccionmovimiento, 2);
}
}
@@ -2566,7 +2575,7 @@ void useScreenObject() {
sprites(true);
} while (indicetray2 != currentRoomData->longtray2);
disableSecondAnimation();
- drawScreen(fondo);
+ drawScreen(background);
g_engine->_mouseManager->show();
} break;
case 201: {
@@ -2607,7 +2616,7 @@ void useScreenObject() {
animateOpen2(3, 2);
updateItem(regobj.code);
disableSecondAnimation();
- drawScreen(fondo);
+ drawScreen(background);
g_engine->_mouseManager->show();
drawText(2652);
g_engine->_mouseManager->hide();
@@ -2752,12 +2761,12 @@ void useScreenObject() {
switch (hornacina[0][0]) {
case 561: {
currentRoomData->indexadoobjetos[9]->objectName = "ESTATUA DIVINA";
- readBitmap(1182652, objetos[0], 892, 319);
+ readBitmap(1182652, screenObjects[0], 892, 319);
currentRoomData->bitmapasociados[1].puntbitmap = 1182652;
} break;
case 615: {
currentRoomData->indexadoobjetos[9]->objectName = "ESTATUA GROTESCA";
- readBitmap(1181760, objetos[0], 892, 319);
+ readBitmap(1181760, screenObjects[0], 892, 319);
currentRoomData->bitmapasociados[1].puntbitmap = 1181760;
} break;
}
@@ -2765,10 +2774,10 @@ void useScreenObject() {
currentRoomData->bitmapasociados[1].coordx = 66;
currentRoomData->bitmapasociados[1].coordy = 35;
currentRoomData->bitmapasociados[1].profund = 1;
- handPantallaToFondo();
+ handPantallaToBackground();
// XMStoPointer(ptr(segfondo, (offfondo + 4)), _handpantalla, 4, (sizepantalla - int32(4)));
assembleScreen();
- drawScreen(fondo);
+ drawScreen(background);
animateOpen2(3, 1);
updateInventory(indicemochila);
drawBackpack();
@@ -2783,15 +2792,15 @@ void useScreenObject() {
animateGive(3, 1);
switch (regobj.code) {
case 561:
- readBitmap(1182652, objetos[0], 892, 319);
+ readBitmap(1182652, screenObjects[0], 892, 319);
break;
case 615:
- readBitmap(1181760, objetos[0], 892, 319);
+ readBitmap(1181760, screenObjects[0], 892, 319);
break;
}
- handPantallaToFondo();
+ handPantallaToBackground();
assembleScreen();
- drawScreen(fondo);
+ drawScreen(background);
animateOpen2(3, 1);
updateInventory(indicemochila);
drawBackpack();
@@ -2843,12 +2852,12 @@ void useScreenObject() {
switch (hornacina[1][0]) {
case 561: {
currentRoomData->indexadoobjetos[8]->objectName = "ESTATUA DIVINA";
- readBitmap(1381982, objetos[0], 892, 319);
+ readBitmap(1381982, screenObjects[0], 892, 319);
currentRoomData->bitmapasociados[0].puntbitmap = 1381982;
} break;
case 615: {
currentRoomData->indexadoobjetos[8]->objectName = "ESTATUA GROTESCA";
- readBitmap(1381090, objetos[0], 892, 319);
+ readBitmap(1381090, screenObjects[0], 892, 319);
currentRoomData->bitmapasociados[0].puntbitmap = 1381090;
} break;
}
@@ -2856,10 +2865,10 @@ void useScreenObject() {
currentRoomData->bitmapasociados[0].coordx = 217;
currentRoomData->bitmapasociados[0].coordy = 48;
currentRoomData->bitmapasociados[0].profund = 1;
- handPantallaToFondo();
+ handPantallaToBackground();
// XMStoPointer(ptr(segfondo, (offfondo + 4)), _handpantalla, 4, (sizepantalla - int32(4)));
assembleScreen();
- drawScreen(fondo);
+ drawScreen(background);
animateOpen2(0, 1);
updateInventory(indicemochila);
drawBackpack();
@@ -2875,18 +2884,18 @@ void useScreenObject() {
switch (regobj.code) {
case 561:
- readBitmap(1381982, objetos[regobj.profundidad - 1],
+ readBitmap(1381982, screenObjects[regobj.profundidad - 1],
892, 319);
break;
case 615:
- readBitmap(1381090, objetos[regobj.profundidad - 1],
+ readBitmap(1381090, screenObjects[regobj.profundidad - 1],
892, 319);
break;
}
- handPantallaToFondo();
+ handPantallaToBackground();
// XMStoPointer(ptr(segfondo, (offfondo + 4)), _handpantalla, 4, (sizepantalla - int32(4)));
assembleScreen();
- drawScreen(fondo);
+ drawScreen(background);
animateOpen2(0, 1);
updateInventory(indicemochila);
drawBackpack();
@@ -2973,11 +2982,11 @@ void useScreenObject() {
with.profund = 1;
loadItem(with.coordx, with.coordy, with.tambitmap, with.puntbitmap, with.profund);
}
- readBitmap(1243652, objetos[5], 2718, 319);
- handPantallaToFondo();
+ readBitmap(1243652, screenObjects[5], 2718, 319);
+ handPantallaToBackground();
// XMStoPointer(ptr(segfondo, (offfondo + 4)), _handpantalla, 4, (sizepantalla - int32(4)));
assembleScreen();
- drawScreen(fondo);
+ drawScreen(background);
} break;
case 594: {
drawText(regobj.useTextRef);
@@ -3004,10 +3013,10 @@ void useScreenObject() {
with.profund = 4;
loadItem(with.coordx, with.coordy, with.tambitmap, with.puntbitmap, with.profund);
}
- handPantallaToFondo();
+ handPantallaToBackground();
// XMStoPointer(ptr(segfondo, (offfondo + 4)), _handpantalla, 4,(sizepantalla - int32(4)));
assembleScreen();
- drawScreen(fondo);
+ drawScreen(background);
updateInventory(indicemochila);
drawBackpack();
trampa_puesta = true;
@@ -3020,9 +3029,9 @@ void useScreenObject() {
//Show feather on pedestal
loadItem(187, 70, 104, 1545820, 8);
- handPantallaToFondo();
+ handPantallaToBackground();
assembleScreen();
- drawScreen(fondo);
+ drawScreen(background);
g_engine->_screen->update();
animateOpen2(direccionmovimiento, 1);
@@ -3040,8 +3049,8 @@ void useScreenObject() {
currentRoomData->bitmapasociados[2].coordx = 277;
currentRoomData->bitmapasociados[2].coordy = 104;
currentRoomData->bitmapasociados[2].profund = 1;
- profundidad[0].posy = 104;
- readBitmap(1545820, objetos[0], 104, 319);
+ depthMap[0].posy = 104;
+ readBitmap(1545820, screenObjects[0], 104, 319);
currentRoomData->bitmapasociados[4].puntbitmap = 1447508;
currentRoomData->bitmapasociados[4].tambitmap = 464;
@@ -3050,9 +3059,9 @@ void useScreenObject() {
currentRoomData->bitmapasociados[4].profund = 8;
loadItem(186, 63, 464, 1447508, 8);
- handPantallaToFondo();
+ handPantallaToBackground();
assembleScreen();
- drawScreen(fondo);
+ drawScreen(background);
g_engine->_mouseManager->show();
goToObject(currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], 18);
g_engine->_mouseManager->hide();
@@ -3063,10 +3072,10 @@ void useScreenObject() {
currentRoomData->bitmapasociados[4].coordx = 0;
currentRoomData->bitmapasociados[4].coordy = 0;
currentRoomData->bitmapasociados[4].profund = 0;
- objetos[7] = NULL;
- handPantallaToFondo();
+ screenObjects[7] = NULL;
+ handPantallaToBackground();
assembleScreen();
- drawScreen(fondo);
+ drawScreen(background);
animatePickup2(1, 1);
drawBackpack();
g_engine->_mouseManager->show();
@@ -3083,9 +3092,9 @@ void useScreenObject() {
animateGive(3, 1);
loadItem(86, 55, 92, 1591272, 8);
- handPantallaToFondo();
+ handPantallaToBackground();
assembleScreen();
- drawScreen(fondo);
+ drawScreen(background);
animateOpen2(3, 1);
g_engine->_mouseManager->show();
goToObject(currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], 10);
@@ -3098,9 +3107,9 @@ void useScreenObject() {
currentRoomData->bitmapasociados[3].coordx = 18;
currentRoomData->bitmapasociados[3].coordy = 60;
currentRoomData->bitmapasociados[3].profund = 3;
- profundidad[2].posx = 18;
- profundidad[2].posy = 60;
- readBitmap(1591272, objetos[2], 92, 319);
+ depthMap[2].posx = 18;
+ depthMap[2].posy = 60;
+ readBitmap(1591272, screenObjects[2], 92, 319);
currentRoomData->bitmapasociados[4].puntbitmap = 1746554;
currentRoomData->bitmapasociados[4].tambitmap = 384;
@@ -3109,7 +3118,7 @@ void useScreenObject() {
currentRoomData->bitmapasociados[4].profund = 8;
loadItem(82, 53, 384, 1746554, 8);
assembleScreen();
- drawScreen(fondo);
+ drawScreen(background);
g_engine->_mouseManager->show();
goToObject(currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], 15);
g_engine->_mouseManager->hide();
@@ -3120,10 +3129,10 @@ void useScreenObject() {
currentRoomData->bitmapasociados[4].coordx = 0;
currentRoomData->bitmapasociados[4].coordy = 0;
currentRoomData->bitmapasociados[4].profund = 0;
- objetos[7] = NULL;
- handPantallaToFondo();
+ screenObjects[7] = NULL;
+ handPantallaToBackground();
assembleScreen();
- drawScreen(fondo);
+ drawScreen(background);
animatePickup2(3, 1);
drawBackpack();
g_engine->_mouseManager->show();
@@ -3184,9 +3193,9 @@ void useScreenObject() {
animateGive(1, 1);
updateInventory(indicemochila);
dropObjectInScreen(regobj);
- handPantallaToFondo();
+ handPantallaToBackground();
assembleScreen();
- drawScreen(fondo);
+ drawScreen(background);
drawBackpack();
animateOpen2(1, 1);
for (indlista = 19; indlista <= 21; indlista++)
@@ -3203,9 +3212,9 @@ void useScreenObject() {
drawFlc(110, 79, 2361800, 0, 9, 0, false, false, false, basurillalog);
replaceBackpack(indicemochila, 701);
drawBackpack();
- handPantallaToFondo();
+ handPantallaToBackground();
assembleScreen();
- drawScreen(fondo);
+ drawScreen(background);
g_engine->_mouseManager->show();
for (indlista = 18; indlista <= 20; indlista++)
currentRoomData->mouseGrid[indlista][26] = 10;
@@ -3224,7 +3233,7 @@ void useScreenObject() {
currentRoomData->bitmapasociados[0].coordx = 0;
currentRoomData->bitmapasociados[0].coordy = 0;
currentRoomData->bitmapasociados[0].profund = 0;
- objetos[2] = NULL;
+ screenObjects[2] = NULL;
for (indmoch = 6; indmoch <= 9; indmoch++)
currentRoomData->mouseGrid[26][indmoch] = 3;
for (indmoch = 3; indmoch <= 5; indmoch++)
@@ -3271,10 +3280,10 @@ void useScreenObject() {
with.profund = 1;
loadItem(with.coordx, with.coordy, with.tambitmap, with.puntbitmap, with.profund);
}
- handPantallaToFondo();
+ handPantallaToBackground();
// XMStoPointer(ptr(segfondo, (offfondo + 4)), _handpantalla, 4,(sizepantalla - int32(4)));
assembleScreen();
- drawScreen(fondo);
+ drawScreen(background);
g_engine->_sound->waitForSoundEnd();
playVoc("PUFF", 191183, 18001);
@@ -3469,7 +3478,7 @@ void openScreenObject() {
else {
g_engine->_mouseManager->hide();
animatePickup1(0, 1);
- objetos[regobj.profundidad - 1] = NULL;
+ screenObjects[regobj.profundidad - 1] = NULL;
indicey = 0;
while (currentRoomData->bitmapasociados[indicey].profund != regobj.profundidad && indicey != 15) {
indicey ++;
@@ -3481,9 +3490,9 @@ void openScreenObject() {
currentRoomData->bitmapasociados[indicey].coordy = 0;
currentRoomData->bitmapasociados[indicey].profund = 0;
currentRoomData->doors[2].abiertacerrada = 1;
- handPantallaToFondo();
+ handPantallaToBackground();
assembleScreen();
- drawScreen(fondo);
+ drawScreen(background);
animateOpen2(0, 1);
g_engine->_mouseManager->show();
for (indicey = 0; indicey <= 12; indicey++)
@@ -3505,7 +3514,7 @@ void openScreenObject() {
else {
g_engine->_mouseManager->hide();
animatePickup1(1, 1);
- objetos[regobj.profundidad - 1] = NULL;
+ screenObjects[regobj.profundidad - 1] = NULL;
indicey = 0;
while (currentRoomData->bitmapasociados[indicey].profund != regobj.profundidad && indicey != 14) {
indicey ++;
@@ -3516,9 +3525,9 @@ void openScreenObject() {
currentRoomData->bitmapasociados[indicey].coordy = 0;
currentRoomData->bitmapasociados[indicey].profund = 0;
currentRoomData->doors[0].abiertacerrada = 1;
- handPantallaToFondo();
+ handPantallaToBackground();
assembleScreen();
- drawScreen(fondo);
+ drawScreen(background);
animateOpen2(1, 1);
g_engine->_mouseManager->show();
indicex = 30;
@@ -3845,7 +3854,7 @@ static void montaimagenvir(byte *image1, byte *image2) { // Near;
*/
static void getScreen(byte *background) {
byte *screenBuf = (byte *)g_engine->_screen->getPixels();
- Common::copy(screenBuf, screenBuf + (22400 * 2), fondo + 4);
+ Common::copy(screenBuf, screenBuf + (22400 * 2), background + 4);
}
static void scrollRight(uint &horizontalPos) {
@@ -3858,12 +3867,12 @@ static void scrollRight(uint &horizontalPos) {
size_t numBytes = 44796;
for (int i = 0; i < stepCount; i++) {
// move everything to the left
- memmove(fondo + 4, fondo + 8, numBytes);
+ memmove(background + 4, background + 8, numBytes);
horizontalPos += 4;
for (int k = 0; k < 140; k++) {
for (int j = 0; j < 4; j++) {
- fondo[320 + k * 320 + j] = handpantalla[horizontalPos + k * 320 + j];
+ background[320 + k * 320 + j] = handpantalla[horizontalPos + k * 320 + j];
}
}
if (characterPos > 0) {
@@ -3881,20 +3890,20 @@ static void scrollRight(uint &horizontalPos) {
Common::copy(pasoframe, pasoframe + sizeframe, assembledCharacterFrame);
// puts the original captured background back in the background for next iteration
- putVirtualImg(characterPosX - 2, characterPosY, fondo, fondsprite);
+ putVirtualImg(characterPosX - 2, characterPosY, background, fondsprite);
uint16 pasoframeW = READ_LE_UINT16(assembledCharacterFrame);
uint16 pasoframeH = READ_LE_UINT16(assembledCharacterFrame + 2);
// Grabs current area surrounding character (which might contain parts of A and B)
- getVirtualImg(characterPosX, characterPosY, characterPosX + pasoframeW, characterPosY + pasoframeH, fondo, fondsprite);
+ getVirtualImg(characterPosX, characterPosY, characterPosX + pasoframeW, characterPosY + pasoframeH, background, fondsprite);
// blits over the character sprite, only on black pixels
montaimagenvir(fondsprite, assembledCharacterFrame);
// puts it back in the background (character + piece of background)
- putVirtualImg(characterPosX, characterPosY, fondo, assembledCharacterFrame);
+ putVirtualImg(characterPosX, characterPosY, background, assembledCharacterFrame);
} else
characterPosX -= 4;
g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
g_engine->_screen->update();
- drawScreen(fondo);
+ drawScreen(background);
}
free(assembledCharacterFrame);
}
@@ -3911,13 +3920,13 @@ static void scrollLeft(uint &poshor) {
for (int i = numpasos; i >= 1; i--) {
for (int j = numBytes; j > 0; j--) {
// move the previous background to the right
- fondo[j + 4] = fondo[j];
+ background[j + 4] = background[j];
}
poshor -= 4;
for (int k = 0; k < 140; k++) {
for (int j = 0; j < 4; j++) {
- fondo[4 + k * 320 + j] = handpantalla[4 + poshor + k * 320 + j];
+ background[4 + k * 320 + j] = handpantalla[4 + poshor + k * 320 + j];
}
}
@@ -3933,20 +3942,20 @@ static void scrollLeft(uint &poshor) {
pasoframe = secuencia.bitmap[3][iframe];
Common::copy(pasoframe, pasoframe + sizeframe, assembledCharacterFrame);
- putVirtualImg(characterPosX + 2, characterPosY, fondo, fondsprite);
+ putVirtualImg(characterPosX + 2, characterPosY, background, fondsprite);
uint16 pasoframeW = READ_LE_UINT16(assembledCharacterFrame);
uint16 pasoframeH = READ_LE_UINT16(assembledCharacterFrame + 2);
- getVirtualImg(characterPosX, characterPosY, characterPosX + pasoframeW, characterPosY + pasoframeH, fondo, fondsprite);
+ getVirtualImg(characterPosX, characterPosY, characterPosX + pasoframeW, characterPosY + pasoframeH, background, fondsprite);
montaimagenvir(fondsprite, assembledCharacterFrame);
- putVirtualImg(characterPosX, characterPosY, fondo, assembledCharacterFrame);
+ putVirtualImg(characterPosX, characterPosY, background, assembledCharacterFrame);
} else
characterPosX += 4;
g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
g_engine->_screen->update();
- drawScreen(fondo);
+ drawScreen(background);
}
free(assembledCharacterFrame);
}
@@ -3958,7 +3967,7 @@ static void scrollLeft(uint &poshor) {
void loadScrollData(uint numpantalla, boolean scrollder, uint poshor, int correccionscroll) {
uint indicecarga;
- handPantallaToFondo();
+ handPantallaToBackground();
// Fondo now contains background A, handpantalla contains background A
uint pasoframeW = READ_LE_UINT16(pasoframe);
@@ -3966,7 +3975,7 @@ void loadScrollData(uint numpantalla, boolean scrollder, uint poshor, int correc
debug("characterPos=%d,%d, size=%d,%d", characterPosX, characterPosY, pasoframeW, pasoframeH);
/* Copy the area with the player from previous scren*/
fondsprite = (byte *)malloc(4 + (pasoframeW + 8) * (pasoframeH + 8));
- getVirtualImg(characterPosX, characterPosY, characterPosX + pasoframeW, characterPosY + pasoframeH, fondo, fondsprite);
+ getVirtualImg(characterPosX, characterPosY, characterPosX + pasoframeW, characterPosY + pasoframeH, background, fondsprite);
// Start screen 2
Common::File fichpanta;
@@ -3988,26 +3997,26 @@ void loadScrollData(uint numpantalla, boolean scrollder, uint poshor, int correc
// Fondo contains background B + objects, handpantalla contains plain background B
// Copies the contents of fondo into handpantalla
- Common::copy(fondo, fondo + 44804, handpantalla);
+ Common::copy(background, background + 44804, handpantalla);
// Fondo contains background B + objects, handpantalla contains background B + objects
movidapaleta = 0;
- getScreen(fondo);
+ getScreen(background);
// Fondo now contains full background A again, handpantalla contains background B + objects
- drawScreen(fondo);
+ drawScreen(background);
if (scrollder)
scrollRight(poshor);
else
scrollLeft(poshor);
// After scroll is done, handpantalla will now contain the resulting fondo (background B + objects)
- Common::copy(handpantalla, handpantalla + 44804, fondo);
+ Common::copy(handpantalla, handpantalla + 44804, background);
characterPosX += correccionscroll;
assembleScreen();
- drawScreen(fondo);
+ drawScreen(background);
free(fondsprite);
loadScreen();
trayec[indicetray].x = characterPosX;
@@ -4465,7 +4474,7 @@ void loadGame(regispartida game) {
drawBackpack();
if (rojo_capturado == false && currentRoomData->codigo == 24 && trampa_puesta == false)
runaroundRed();
- effect(tipoefectofundido, false, fondo);
+ effect(tipoefectofundido, false, background);
}
void loadGame(byte numeropartida) {
@@ -5330,9 +5339,9 @@ void wcScene() {
characterPosX = 76 - rectificacionx;
characterPosY = 78 - rectificaciony;
copyPalette(palwater, pal);
- handPantallaToFondo();
+ handPantallaToBackground();
assembleScreen();
- drawScreen(fondo);
+ drawScreen(background);
partialFadeIn(234);
xframe2 = 0;
indicetray = 0;
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
index 30e651e7d6c..8e78a35ec9d 100644
--- a/engines/tot/routines2.cpp
+++ b/engines/tot/routines2.cpp
@@ -36,7 +36,7 @@ namespace Tot {
void loadScreenMemory() {
sizepantalla = 65520;
- fondo = (byte *)malloc(sizepantalla);
+ background = (byte *)malloc(sizepantalla);
handpantalla = (byte *)malloc(sizepantalla);
}
@@ -279,8 +279,8 @@ void loadScreen() {
palette palcp;
sizepantalla = currentRoomData->tamimagenpantalla;
- readBitmap(currentRoomData->puntimagenpantalla, fondo, sizepantalla, 316);
- Common::copy(fondo, fondo + sizepantalla, handpantalla);
+ readBitmap(currentRoomData->puntimagenpantalla, background, sizepantalla, 316);
+ Common::copy(background, background + sizepantalla, handpantalla);
switch (parte_del_juego) {
case 1: {
if (!fichcp.open("PALETAS.DAT")) {
@@ -338,9 +338,9 @@ void freeObject() {
uint indicecarga;
for (indicecarga = 0; indicecarga < numobjetosconv; indicecarga++) {
- if (objetos[indicecarga] != NULL)
- free(objetos[indicecarga]);
- objetos[indicecarga] = NULL;
+ if (screenObjects[indicecarga] != NULL)
+ free(screenObjects[indicecarga]);
+ screenObjects[indicecarga] = NULL;
}
// if (liberadormem != nil) {
@@ -399,16 +399,16 @@ void verifyCopyProtection2() {
// }
}
void loadItemWithFixedDepth(uint coordx, uint coordy, uint tamdibujo, int32 dibujo, uint prof) {
- objetos[prof] = (byte *)malloc(tamdibujo);
- readBitmap(dibujo, objetos[prof], tamdibujo, 319);
+ screenObjects[prof] = (byte *)malloc(tamdibujo);
+ readBitmap(dibujo, screenObjects[prof], tamdibujo, 319);
uint16 w, h;
- w = READ_LE_UINT16(objetos[prof]);
- h = READ_LE_UINT16(objetos[prof] + 2);
- profundidad[prof].posx = coordx;
- profundidad[prof].posy = coordy;
- profundidad[prof].posx2 = coordx + w + 1;
- profundidad[prof].posy2 = coordy + h + 1;
+ w = READ_LE_UINT16(screenObjects[prof]);
+ h = READ_LE_UINT16(screenObjects[prof] + 2);
+ depthMap[prof].posx = coordx;
+ depthMap[prof].posy = coordy;
+ depthMap[prof].posx2 = coordx + w + 1;
+ depthMap[prof].posy2 = coordy + h + 1;
}
void loadItem(uint coordx, uint coordy, uint tamdibujo, int32 dibujo, uint prof) {
@@ -1586,7 +1586,7 @@ void scrollCredit(
error("scrollcredit1(): ioresult! (270)");
}
fich.seek(posicion);
- fich.read(fondo, tam);
+ fich.read(background, tam);
fich.read(pal2, 768);
fich.close();
@@ -1612,7 +1612,7 @@ void scrollCredit(
keyPressed = true;
}
}
- putCreditsImg(85, i, fondo, fondopp, !withFade);
+ putCreditsImg(85, i, background, fondopp, !withFade);
if (keyPressed) {
salirpitando = true;
break;
@@ -2404,7 +2404,7 @@ void sacrifice() {
error("sacrifice(): ioresult! (318)");
}
fich.read(palaux, 768);
- fich.read(fondo, 44800);
+ fich.read(background, 44800);
fich.close();
pal[0] = 0;
@@ -2417,7 +2417,7 @@ void sacrifice() {
}
//We dont have the width and height here in the byte buffer
- drawScreen(fondo, false);
+ drawScreen(background, false);
partialFadeIn(234);
stopVoc();
@@ -2479,9 +2479,9 @@ void sacrifice() {
palaux[i * 3 + 2] = palaux[i * 3 + 2] << 2;
}
- fich.read(fondo, 64000);
+ fich.read(background, 64000);
fich.close();
- drawFullScreen(fondo);
+ drawFullScreen(background);
palaux[0] = 0;
palaux[1] = 0;
@@ -2711,7 +2711,7 @@ void assembleCompleteBackground(byte *image, uint coordx, uint coordy) {
w = READ_LE_UINT16(image);
h = READ_LE_UINT16(image + 2);
- wFondo = READ_LE_UINT16(fondo);
+ wFondo = READ_LE_UINT16(background);
wFondo++;
w++;
@@ -2720,7 +2720,7 @@ void assembleCompleteBackground(byte *image, uint coordx, uint coordy) {
for (int j = 0; j < h; j++) {
int color = image[4 + j * w + i];
if (color != 0) {
- fondo[4 + (coordy + j) * wFondo + (coordx + i)] = color;
+ background[4 + (coordy + j) * wFondo + (coordx + i)] = color;
}
}
}
@@ -2734,8 +2734,8 @@ void assembleCompleteBackground(byte *image, uint coordx, uint coordy) {
void assembleScreen(boolean scroll) {
for (int indice = 0; indice < nivelesdeprof; indice++) {
- if (objetos[indice] != NULL) {
- assembleCompleteBackground(objetos[indice], profundidad[indice].posx, profundidad[indice].posy);
+ if (screenObjects[indice] != NULL) {
+ assembleCompleteBackground(screenObjects[indice], depthMap[indice].posx, depthMap[indice].posy);
}
if (!scroll && secuencia.profundidad == indice) {
assembleCompleteBackground(secuencia.bitmap[direccionmovimiento][iframe], characterPosX, characterPosY);
@@ -2750,7 +2750,7 @@ void disableSecondAnimation() {
setRoomTrajectories(altoanimado, anchoanimado, RESTORE);
currentRoomData->banderamovimiento = false;
freeAnimation();
- handPantallaToFondo();
+ handPantallaToBackground();
assembleScreen();
}
Commit: a814cf7b0f998454a0f568baa3e4d75b2304ba00
https://github.com/scummvm/scummvm/commit/a814cf7b0f998454a0f568baa3e4d75b2304ba00
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:47+02:00
Commit Message:
TOT: Implements sound menu (with no effect yet)
Changed paths:
engines/tot/game.cpp
engines/tot/graphics.cpp
engines/tot/playanim.cpp
engines/tot/playanim.h
engines/tot/routines.cpp
engines/tot/routines2.cpp
engines/tot/routines2.h
engines/tot/saveload.cpp
diff --git a/engines/tot/game.cpp b/engines/tot/game.cpp
index 2f12c80bc22..70ac83e890d 100644
--- a/engines/tot/game.cpp
+++ b/engines/tot/game.cpp
@@ -246,7 +246,7 @@ void newGame() {
freeInventory();
loadObjects();
resetGameState();
- dentro_del_juego = true;
+ inGame = true;
for (int i = 0; i < inventoryIconCount; i++) {
mobj[i].bitmapIndex = 34;
mobj[i].code = 0;
@@ -264,9 +264,10 @@ void newGame() {
iframe = 0;
g_engine->_mouseManager->show();
}
-
}
+void sceneChange();
+
int engine_start() {
if (ConfMan.hasKey("save_slot")) {
return startGame();
@@ -306,19 +307,19 @@ int engine_start() {
desactivagrabar = false;
}
- boolean enforceSecondPart = true;
- if(enforceSecondPart) { //DEBUG
- completadalista1 = true;
- completadalista2 = true;
- parte_del_juego = 1;
- }
+ // boolean enforceSecondPart = true;
+ // if(enforceSecondPart) { //DEBUG
+ // completadalista1 = true;
+ // completadalista2 = true;
+ // gamePart = 1;
+ // }
return startGame();
}
int startGame() {
lowerMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
- switch (parte_del_juego) {
+ switch (gamePart) {
case 1:
playMidiFile("PRIMERA", true);
break;
@@ -328,7 +329,7 @@ int startGame() {
}
contadorpc2 = contadorpc;
restoreMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
- dentro_del_juego = true;
+ inGame = true;
Common::Event e;
while (!salirdeljuego && !g_engine->shouldQuit()) {
@@ -640,475 +641,37 @@ int startGame() {
// Scene changes
if (xframe2 == 0 && cambiopantalla) {
- cambiopantalla = false;
- contadorpc = contadorpc2;
- setRoomTrajectories(altoanimado, anchoanimado, RESTORE);
- saveRoomData(currentRoomData, rooms);
-
- // verifyCopyProtection();
- // fichpanta << datospantalla;
- // close(fichpanta);
- // setSfxVolume(volumenfxizquierdo, volumenfxderecho);
-
- switch (currentRoomData->doors[indicepuertas].pantallaquecarga) {
- case 2: {
- tipoefectofundido = Random(15) + 1;
- iframe = 0;
- indicetray = 0;
- characterPosX = currentRoomData->doors[indicepuertas].posxsalida - rectificacionx;
- characterPosY = currentRoomData->doors[indicepuertas].posysalida - rectificaciony;
- trayec[indicetray].x = characterPosX;
- trayec[indicetray].y = characterPosY;
- freeAnimation();
- freeObject();
- g_engine->_mouseManager->hide();
-
- effect(tipoefectofundido, true, NULL);
- stopVoc();
- loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
- if (contadorpc > 89)
- error("engine_start(): contadorpc (274)");
- setSfxVolume(volumenfxizquierdo, volumenfxderecho);
- if (teleencendida)
- autoPlayVoc("PARASITO", 355778, 20129);
- else
- cargatele();
- effect(tipoefectofundido, false, background);
- contadorpc = contadorpc2;
- g_engine->_mouseManager->show();
- oldxrejilla = 0;
- oldyrejilla = 0;
- } break;
- case 5: {
- if (currentRoomData->codigo != 6) {
- tipoefectofundido = Random(15) + 1;
- iframe = 0;
- indicetray = 0;
- characterPosX = currentRoomData->doors[indicepuertas].posxsalida - rectificacionx;
- characterPosY = currentRoomData->doors[indicepuertas].posysalida - rectificaciony + 15;
- trayec[indicetray].x = characterPosX;
- trayec[indicetray].y = characterPosY;
- freeAnimation();
- freeObject();
- g_engine->_mouseManager->hide();
- effect(tipoefectofundido, true, NULL);
- loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
- stopVoc();
- autoPlayVoc("CALDERA", 6433, 15386);
- setSfxVolume(volumenfxizquierdo, 0);
- effect(tipoefectofundido, false, background);
- g_engine->_mouseManager->show();
- oldxrejilla = 0;
- oldyrejilla = 0;
- checkMouseGrid();
- } else {
-
- zonaactual = currentRoomData->rejapantalla[((characterPosX + rectificacionx) / factorx)][((characterPosY + rectificaciony) / factory)];
- zonadestino = 21;
- goToObject(zonaactual, zonadestino);
- freeAnimation();
- freeObject();
- g_engine->_mouseManager->hide();
- setSfxVolume(volumenfxizquierdo, 0);
- loadScrollData(currentRoomData->doors[indicepuertas].pantallaquecarga, true, 22, -2);
- g_engine->_mouseManager->show();
- oldxrejilla = 0;
- oldyrejilla = 0;
- checkMouseGrid();
- }
- } break;
- case 6: {
- zonaactual = currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory];
- zonadestino = 27;
- goToObject(zonaactual, zonadestino);
- freeAnimation();
- freeObject();
- g_engine->_mouseManager->hide();
- setSfxVolume(volumenfxizquierdo, volumenfxderecho);
- loadScrollData(currentRoomData->doors[indicepuertas].pantallaquecarga, false, 22, 2);
- g_engine->_mouseManager->show();
- oldxrejilla = 0;
- oldyrejilla = 0;
- checkMouseGrid();
- } break;
- case 9: {
- tipoefectofundido = Random(15) + 1;
- freeAnimation();
- freeObject();
- g_engine->_mouseManager->hide();
- effect(tipoefectofundido, true, NULL);
- iframe = 0;
- indicetray = 0;
- characterPosX = currentRoomData->doors[indicepuertas].posxsalida - rectificacionx;
- characterPosY = currentRoomData->doors[indicepuertas].posysalida - rectificaciony;
- trayec[indicetray].x = characterPosX;
- trayec[indicetray].y = characterPosY;
- loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
- effect(tipoefectofundido, false, background);
- g_engine->_mouseManager->show();
-
- oldxrejilla = 0;
- oldyrejilla = 0;
- checkMouseGrid();
- } break;
- case 12: {
- if (currentRoomData->codigo != 13) {
- tipoefectofundido = Random(15) + 1;
- iframe = 0;
- indicetray = 0;
- characterPosX = currentRoomData->doors[indicepuertas].posxsalida - rectificacionx;
- characterPosY = currentRoomData->doors[indicepuertas].posysalida - rectificaciony;
- trayec[indicetray].x = characterPosX;
- trayec[indicetray].y = characterPosY;
- freeAnimation();
- freeObject();
- g_engine->_mouseManager->hide();
- effect(tipoefectofundido, true, NULL);
- loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
- effect(tipoefectofundido, false, background);
- g_engine->_mouseManager->show();
- oldxrejilla = 0;
- oldyrejilla = 0;
- g_engine->_mouseManager->show();
- } else {
-
- zonaactual = currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory];
- goToObject(zonaactual, zonadestino);
- freeAnimation();
- freeObject();
- g_engine->_mouseManager->hide();
- loadScrollData(currentRoomData->doors[indicepuertas].pantallaquecarga, false, 64, 0);
- g_engine->_mouseManager->show();
- oldxrejilla = 0;
- oldyrejilla = 0;
- checkMouseGrid();
- }
- } break;
- case 13: {
- switch (currentRoomData->codigo) {
- case 12: {
- zonaactual = currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory];
- goToObject(zonaactual, zonadestino);
- freeAnimation();
- freeObject();
- g_engine->_mouseManager->hide();
- loadScrollData(currentRoomData->doors[indicepuertas].pantallaquecarga, true, 64, 0);
- g_engine->_mouseManager->show();
- oldxrejilla = 0;
- oldyrejilla = 0;
- checkMouseGrid();
- } break;
- case 14: {
- zonaactual = currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory];
- goToObject(zonaactual, zonadestino);
- freeAnimation();
- freeObject();
- g_engine->_mouseManager->hide();
- loadScrollData(currentRoomData->doors[indicepuertas].pantallaquecarga, false, 56, 0);
- g_engine->_mouseManager->show();
- oldxrejilla = 0;
- oldyrejilla = 0;
- checkMouseGrid();
- } break;
- }
- } break;
- case 14: {
- if (currentRoomData->codigo != 13) {
- tipoefectofundido = Random(15) + 1;
- iframe = 0;
- indicetray = 0;
- characterPosX = currentRoomData->doors[indicepuertas].posxsalida - rectificacionx;
- characterPosY = currentRoomData->doors[indicepuertas].posysalida - rectificaciony;
- trayec[indicetray].x = characterPosX;
- trayec[indicetray].y = characterPosY;
- freeAnimation();
- freeObject();
- g_engine->_mouseManager->hide();
- effect(tipoefectofundido, true, NULL);
- loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
- effect(tipoefectofundido, false, background);
- g_engine->_mouseManager->show();
- oldxrejilla = 0;
- oldyrejilla = 0;
- checkMouseGrid();
- } else {
-
- zonaactual = currentRoomData->rejapantalla[((characterPosX + rectificacionx) / factorx)][((characterPosY + rectificaciony) / factory)];
- goToObject(zonaactual, zonadestino);
- freeAnimation();
- freeObject();
- g_engine->_mouseManager->hide();
- loadScrollData(currentRoomData->doors[indicepuertas].pantallaquecarga, true, 56, 0);
- g_engine->_mouseManager->show();
- oldxrejilla = 0;
- oldyrejilla = 0;
- checkMouseGrid();
- }
- } break;
- case 17: {
- tipoefectofundido = Random(15) + 1;
- iframe = 0;
- indicetray = 0;
- characterPosX = currentRoomData->doors[indicepuertas].posxsalida - rectificacionx;
- characterPosY = currentRoomData->doors[indicepuertas].posysalida - rectificaciony;
- trayec[indicetray].x = characterPosX;
- trayec[indicetray].y = characterPosY;
- freeAnimation();
- freeObject();
- g_engine->_mouseManager->hide();
- effect(tipoefectofundido, true, NULL);
- stopVoc();
- loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
- if (libro[0] == true && currentRoomData->banderamovimiento == true)
- disableSecondAnimation();
- if (contadorpc > 89)
- error("engine_start(): contadorpc (274)");
- setSfxVolume(volumenfxizquierdo, volumenfxderecho);
- effect(tipoefectofundido, false, background);
- contadorpc = contadorpc2;
- g_engine->_mouseManager->show();
- oldxrejilla = 0;
- oldyrejilla = 0;
- checkMouseGrid();
- } break;
- case 18: {
- if (currentRoomData->codigo != 19) {
- tipoefectofundido = Random(15) + 1;
- iframe = 0;
- indicetray = 0;
- characterPosX = currentRoomData->doors[indicepuertas].posxsalida - rectificacionx;
- characterPosY = currentRoomData->doors[indicepuertas].posysalida - rectificaciony;
- trayec[indicetray].x = characterPosX;
- trayec[indicetray].y = characterPosY;
- freeAnimation();
- freeObject();
- g_engine->_mouseManager->hide();
- effect(tipoefectofundido, true, NULL);
- loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
- effect(tipoefectofundido, false, background);
- g_engine->_mouseManager->show();
- oldxrejilla = 0;
- oldyrejilla = 0;
- checkMouseGrid();
- } else {
-
- zonaactual = currentRoomData->rejapantalla[((characterPosX + rectificacionx) / factorx)][((characterPosY + rectificaciony) / factory)];
- goToObject(zonaactual, zonadestino);
- freeAnimation();
- freeObject();
- g_engine->_mouseManager->hide();
- loadScrollData(currentRoomData->doors[indicepuertas].pantallaquecarga, true, 131, -1);
- g_engine->_mouseManager->show();
- oldxrejilla = 0;
- oldyrejilla = 0;
- checkMouseGrid();
- }
- } break;
- case 19: {
- if (currentRoomData->codigo != 18) {
- tipoefectofundido = Random(15) + 1;
- iframe = 0;
- indicetray = 0;
- characterPosX = currentRoomData->doors[indicepuertas].posxsalida - rectificacionx;
- characterPosY = currentRoomData->doors[indicepuertas].posysalida - rectificaciony;
- trayec[indicetray].x = characterPosX;
- trayec[indicetray].y = characterPosY;
- freeAnimation();
- freeObject();
- g_engine->_mouseManager->hide();
- effect(tipoefectofundido, true, NULL);
- loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
- effect(tipoefectofundido, false, background);
- g_engine->_mouseManager->show();
- oldxrejilla = 0;
- oldyrejilla = 0;
- checkMouseGrid();
- } else {
-
- zonaactual = currentRoomData->rejapantalla[((characterPosX + rectificacionx) / factorx)][((characterPosY + rectificaciony) / factory)];
- goToObject(zonaactual, zonadestino);
- freeAnimation();
- freeObject();
- g_engine->_mouseManager->hide();
- loadScrollData(currentRoomData->doors[indicepuertas].pantallaquecarga, false, 131, 1);
- g_engine->_mouseManager->show();
- oldxrejilla = 0;
- oldyrejilla = 0;
- checkMouseGrid();
- }
- } break;
- case 20: {
- tipoefectofundido = Random(15) + 1;
- iframe = 0;
- indicetray = 0;
- characterPosX = currentRoomData->doors[indicepuertas].posxsalida - rectificacionx;
- characterPosY = currentRoomData->doors[indicepuertas].posysalida - rectificaciony;
- trayec[indicetray].x = characterPosX;
- trayec[indicetray].y = characterPosY;
- freeAnimation();
- freeObject();
- g_engine->_mouseManager->hide();
- effect(tipoefectofundido, true, NULL);
- stopVoc();
- loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
- switch (hornacina[0][hornacina[0][3]]) {
- case 0:
- currentRoomData->indexadoobjetos[9]->objectName = "HORNACINA";
- break;
- case 561:
- currentRoomData->indexadoobjetos[9]->objectName = "ESTATUA DIVINA";
- break;
- case 563:
- currentRoomData->indexadoobjetos[9]->objectName = "MANUAL DE ALFARERO";
- break;
- case 615:
- currentRoomData->indexadoobjetos[9]->objectName = "ESTATUA GROTESCA";
- break;
- }
- if (contadorpc > 89)
- error("engine_start(): contadorpc (274)");
- setSfxVolume(volumenfxizquierdo, volumenfxderecho);
- if (currentRoomData->codigo == 4)
- loadVoc("GOTA", 140972, 1029);
- effect(tipoefectofundido, false, background);
- contadorpc = contadorpc2;
- g_engine->_mouseManager->show();
- oldxrejilla = 0;
- oldyrejilla = 0;
- checkMouseGrid();
- } break;
- case 24: {
- tipoefectofundido = Random(15) + 1;
- iframe = 0;
- indicetray = 0;
- characterPosX = currentRoomData->doors[indicepuertas].posxsalida - rectificacionx;
- characterPosY = currentRoomData->doors[indicepuertas].posysalida - rectificaciony;
- trayec[indicetray].x = characterPosX;
- trayec[indicetray].y = characterPosY;
- freeAnimation();
- freeObject();
- g_engine->_mouseManager->hide();
- effect(tipoefectofundido, true, NULL);
- stopVoc();
- loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
- switch (hornacina[1][hornacina[1][3]]) {
- case 0:
- currentRoomData->indexadoobjetos[8]->objectName = "HORNACINA";
- break;
- case 561:
- currentRoomData->indexadoobjetos[8]->objectName = "ESTATUA DIVINA";
- break;
- case 615:
- currentRoomData->indexadoobjetos[8]->objectName = "ESTATUA GROTESCA";
- break;
- case 622:
- currentRoomData->indexadoobjetos[8]->objectName = "PARED";
- break;
- case 623:
- currentRoomData->indexadoobjetos[8]->objectName = "TORNO";
- break;
- }
- if (contadorpc > 89)
- error("engine_start(): contadorpc (274)");
- setSfxVolume(volumenfxizquierdo, volumenfxderecho);
- if (trampa_puesta) {
- currentRoomData->banderamovimiento = true;
- loadAnimation(currentRoomData->nombremovto);
- iframe2 = 0;
- indicetray2 = 1;
- currentRoomData->tray2[indicetray2 - 1].x = 214 - 15;
- currentRoomData->tray2[indicetray2 - 1].y = 115 - 42;
- animado.dir = currentRoomData->dir2[indicetray2 - 1];
- animado.posx = currentRoomData->tray2[indicetray2 - 1].x;
- animado.posy = currentRoomData->tray2[indicetray2 - 1].y;
- animado.profundidad = 14;
-
- for (iaux = 0; iaux < maxrejax; iaux++)
- for (iaux2 = 0; iaux2 < maxrejay; iaux2++) {
- if (rejamascaramovto[iaux][iaux2] > 0){
- currentRoomData->rejapantalla[oldposx + iaux][oldposy + iaux2] = rejamascaramovto[iaux][iaux2];
- }
- if (rejamascararaton[iaux][iaux2] > 0)
- currentRoomData->mouseGrid[oldposx + iaux][oldposy + iaux2] = rejamascararaton[iaux][iaux2];
- }
- assembleScreen();
- }
- effect(tipoefectofundido, false, background);
- if ((rojo_capturado == false) && (trampa_puesta == false))
- runaroundRed();
- contadorpc = contadorpc2;
- g_engine->_mouseManager->show();
- oldxrejilla = 0;
- oldyrejilla = 0;
- checkMouseGrid();
- } break;
- case 255:
- wcScene();
- break;
- default: {
- tipoefectofundido = Random(15) + 1;
- iframe = 0;
- indicetray = 0;
- characterPosX = currentRoomData->doors[indicepuertas].posxsalida - rectificacionx;
- characterPosY = currentRoomData->doors[indicepuertas].posysalida - rectificaciony;
- trayec[indicetray].x = characterPosX;
- trayec[indicetray].y = characterPosY;
- freeAnimation();
- freeObject();
- g_engine->_mouseManager->hide();
- effect(tipoefectofundido, true, NULL);
- stopVoc();
- loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
- if (contadorpc > 89)
- error("engine_start(): contadorpc (274)");
- setSfxVolume(volumenfxizquierdo, volumenfxderecho);
- switch (currentRoomData->codigo) {
- case 4:
- loadVoc("GOTA", 140972, 1029);
- break;
- case 23:
- autoPlayVoc("FUENTE", 0, 0);
- break;
- }
- effect(tipoefectofundido, false, background);
- contadorpc = contadorpc2;
- g_engine->_mouseManager->show();
- oldxrejilla = 0;
- oldyrejilla = 0;
- checkMouseGrid();
- }
- }
- oldzonadestino = 0;
+ sceneChange();
}
if (escapePressed && xframe2 == 0) {
freeAnimation();
- freeObject();
+ freeScreenObjects();
contadorpc2 = contadorpc;
partidanueva = false;
continuarpartida = false;
g_engine->saveAutosaveIfEnabled();
totalFadeOut(0);
- lowerMidiVolume(volumenmelodiaizquierdo,
- volumenmelodiaderecho);
+ lowerMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
clear();
playMidiFile("INTRODUC", true);
- restoreMidiVolume(volumenmelodiaizquierdo,
- volumenmelodiaderecho);
+ restoreMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
initialMenu(true);
verifyCopyProtection2();
+
if (partidanueva) {
newGame();
} else if (continuarpartida)
loadTemporaryGame();
else {
desactivagrabar = true;
- saveLoad();
+ g_engine->openMainMenuDialog();
+ // saveLoad();
contadorpc = contadorpc2;
desactivagrabar = false;
}
lowerMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
- switch (parte_del_juego) {
+ switch (gamePart) {
case 1:
playMidiFile("PRIMERA", true);
break;
@@ -1119,17 +682,17 @@ int startGame() {
restoreMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
}
- switch (parte_del_juego) {
+ switch (gamePart) {
case 1:
if (completadalista1 && completadalista2) {
completadalista1 = false;
completadalista2 = false;
contadorpc = contadorpc2;
- parte_del_juego = 2;
+ gamePart = 2;
iframe = 0;
freeInventory();
freeAnimation();
- freeObject();
+ freeScreenObjects();
g_engine->_mouseManager->hide();
partialFadeOut(234);
lowerMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
@@ -1137,7 +700,7 @@ int startGame() {
restoreMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
if (contadorpc2 > 43)
_exit(274);
- // sacrifice();
+ sacrificeScene();
clear();
loadObjects();
loadPalette("SEGUNDA");
@@ -1217,4 +780,445 @@ int startGame() {
return EXIT_SUCCESS;
}
+void sceneChange() {
+ cambiopantalla = false;
+ contadorpc = contadorpc2;
+ setRoomTrajectories(altoanimado, anchoanimado, RESTORE);
+ saveRoomData(currentRoomData, rooms);
+
+ // verifyCopyProtection();
+ // fichpanta << datospantalla;
+ // close(fichpanta);
+ // setSfxVolume(volumenfxizquierdo, volumenfxderecho);
+
+ switch (currentRoomData->doors[indicepuertas].pantallaquecarga) {
+ case 2: {
+ tipoefectofundido = Random(15) + 1;
+ iframe = 0;
+ indicetray = 0;
+ characterPosX = currentRoomData->doors[indicepuertas].posxsalida - rectificacionx;
+ characterPosY = currentRoomData->doors[indicepuertas].posysalida - rectificaciony;
+ trayec[indicetray].x = characterPosX;
+ trayec[indicetray].y = characterPosY;
+ freeAnimation();
+ freeScreenObjects();
+ g_engine->_mouseManager->hide();
+
+ effect(tipoefectofundido, true, NULL);
+ stopVoc();
+ loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
+ if (contadorpc > 89)
+ error("engine_start(): contadorpc (274)");
+ setSfxVolume(volumenfxizquierdo, volumenfxderecho);
+ if (teleencendida)
+ autoPlayVoc("PARASITO", 355778, 20129);
+ else
+ cargatele();
+ effect(tipoefectofundido, false, background);
+ contadorpc = contadorpc2;
+ g_engine->_mouseManager->show();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ } break;
+ case 5: {
+ if (currentRoomData->codigo != 6) {
+ tipoefectofundido = Random(15) + 1;
+ iframe = 0;
+ indicetray = 0;
+ characterPosX = currentRoomData->doors[indicepuertas].posxsalida - rectificacionx;
+ characterPosY = currentRoomData->doors[indicepuertas].posysalida - rectificaciony + 15;
+ trayec[indicetray].x = characterPosX;
+ trayec[indicetray].y = characterPosY;
+ freeAnimation();
+ freeScreenObjects();
+ g_engine->_mouseManager->hide();
+ effect(tipoefectofundido, true, NULL);
+ loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
+ stopVoc();
+ autoPlayVoc("CALDERA", 6433, 15386);
+ setSfxVolume(volumenfxizquierdo, 0);
+ effect(tipoefectofundido, false, background);
+ g_engine->_mouseManager->show();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ checkMouseGrid();
+ } else {
+
+ zonaactual = currentRoomData->rejapantalla[((characterPosX + rectificacionx) / factorx)][((characterPosY + rectificaciony) / factory)];
+ zonadestino = 21;
+ goToObject(zonaactual, zonadestino);
+ freeAnimation();
+ freeScreenObjects();
+ g_engine->_mouseManager->hide();
+ setSfxVolume(volumenfxizquierdo, 0);
+ loadScrollData(currentRoomData->doors[indicepuertas].pantallaquecarga, true, 22, -2);
+ g_engine->_mouseManager->show();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ checkMouseGrid();
+ }
+ } break;
+ case 6: {
+ zonaactual = currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory];
+ zonadestino = 27;
+ goToObject(zonaactual, zonadestino);
+ freeAnimation();
+ freeScreenObjects();
+ g_engine->_mouseManager->hide();
+ setSfxVolume(volumenfxizquierdo, volumenfxderecho);
+ loadScrollData(currentRoomData->doors[indicepuertas].pantallaquecarga, false, 22, 2);
+ g_engine->_mouseManager->show();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ checkMouseGrid();
+ } break;
+ case 9: {
+ tipoefectofundido = Random(15) + 1;
+ freeAnimation();
+ freeScreenObjects();
+ g_engine->_mouseManager->hide();
+ effect(tipoefectofundido, true, NULL);
+ iframe = 0;
+ indicetray = 0;
+ characterPosX = currentRoomData->doors[indicepuertas].posxsalida - rectificacionx;
+ characterPosY = currentRoomData->doors[indicepuertas].posysalida - rectificaciony;
+ trayec[indicetray].x = characterPosX;
+ trayec[indicetray].y = characterPosY;
+ loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
+ effect(tipoefectofundido, false, background);
+ g_engine->_mouseManager->show();
+
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ checkMouseGrid();
+ } break;
+ case 12: {
+ if (currentRoomData->codigo != 13) {
+ tipoefectofundido = Random(15) + 1;
+ iframe = 0;
+ indicetray = 0;
+ characterPosX = currentRoomData->doors[indicepuertas].posxsalida - rectificacionx;
+ characterPosY = currentRoomData->doors[indicepuertas].posysalida - rectificaciony;
+ trayec[indicetray].x = characterPosX;
+ trayec[indicetray].y = characterPosY;
+ freeAnimation();
+ freeScreenObjects();
+ g_engine->_mouseManager->hide();
+ effect(tipoefectofundido, true, NULL);
+ loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
+ effect(tipoefectofundido, false, background);
+ g_engine->_mouseManager->show();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ g_engine->_mouseManager->show();
+ } else {
+
+ zonaactual = currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory];
+ goToObject(zonaactual, zonadestino);
+ freeAnimation();
+ freeScreenObjects();
+ g_engine->_mouseManager->hide();
+ loadScrollData(currentRoomData->doors[indicepuertas].pantallaquecarga, false, 64, 0);
+ g_engine->_mouseManager->show();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ checkMouseGrid();
+ }
+ } break;
+ case 13: {
+ switch (currentRoomData->codigo) {
+ case 12: {
+ zonaactual = currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory];
+ goToObject(zonaactual, zonadestino);
+ freeAnimation();
+ freeScreenObjects();
+ g_engine->_mouseManager->hide();
+ loadScrollData(currentRoomData->doors[indicepuertas].pantallaquecarga, true, 64, 0);
+ g_engine->_mouseManager->show();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ checkMouseGrid();
+ } break;
+ case 14: {
+ zonaactual = currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory];
+ goToObject(zonaactual, zonadestino);
+ freeAnimation();
+ freeScreenObjects();
+ g_engine->_mouseManager->hide();
+ loadScrollData(currentRoomData->doors[indicepuertas].pantallaquecarga, false, 56, 0);
+ g_engine->_mouseManager->show();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ checkMouseGrid();
+ } break;
+ }
+ } break;
+ case 14: {
+ if (currentRoomData->codigo != 13) {
+ tipoefectofundido = Random(15) + 1;
+ iframe = 0;
+ indicetray = 0;
+ characterPosX = currentRoomData->doors[indicepuertas].posxsalida - rectificacionx;
+ characterPosY = currentRoomData->doors[indicepuertas].posysalida - rectificaciony;
+ trayec[indicetray].x = characterPosX;
+ trayec[indicetray].y = characterPosY;
+ freeAnimation();
+ freeScreenObjects();
+ g_engine->_mouseManager->hide();
+ effect(tipoefectofundido, true, NULL);
+ loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
+ effect(tipoefectofundido, false, background);
+ g_engine->_mouseManager->show();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ checkMouseGrid();
+ } else {
+
+ zonaactual = currentRoomData->rejapantalla[((characterPosX + rectificacionx) / factorx)][((characterPosY + rectificaciony) / factory)];
+ goToObject(zonaactual, zonadestino);
+ freeAnimation();
+ freeScreenObjects();
+ g_engine->_mouseManager->hide();
+ loadScrollData(currentRoomData->doors[indicepuertas].pantallaquecarga, true, 56, 0);
+ g_engine->_mouseManager->show();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ checkMouseGrid();
+ }
+ } break;
+ case 17: {
+ tipoefectofundido = Random(15) + 1;
+ iframe = 0;
+ indicetray = 0;
+ characterPosX = currentRoomData->doors[indicepuertas].posxsalida - rectificacionx;
+ characterPosY = currentRoomData->doors[indicepuertas].posysalida - rectificaciony;
+ trayec[indicetray].x = characterPosX;
+ trayec[indicetray].y = characterPosY;
+ freeAnimation();
+ freeScreenObjects();
+ g_engine->_mouseManager->hide();
+ effect(tipoefectofundido, true, NULL);
+ stopVoc();
+ loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
+ if (libro[0] == true && currentRoomData->banderamovimiento == true)
+ disableSecondAnimation();
+ if (contadorpc > 89)
+ error("engine_start(): contadorpc (274)");
+ setSfxVolume(volumenfxizquierdo, volumenfxderecho);
+ effect(tipoefectofundido, false, background);
+ contadorpc = contadorpc2;
+ g_engine->_mouseManager->show();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ checkMouseGrid();
+ } break;
+ case 18: {
+ if (currentRoomData->codigo != 19) {
+ tipoefectofundido = Random(15) + 1;
+ iframe = 0;
+ indicetray = 0;
+ characterPosX = currentRoomData->doors[indicepuertas].posxsalida - rectificacionx;
+ characterPosY = currentRoomData->doors[indicepuertas].posysalida - rectificaciony;
+ trayec[indicetray].x = characterPosX;
+ trayec[indicetray].y = characterPosY;
+ freeAnimation();
+ freeScreenObjects();
+ g_engine->_mouseManager->hide();
+ effect(tipoefectofundido, true, NULL);
+ loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
+ effect(tipoefectofundido, false, background);
+ g_engine->_mouseManager->show();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ checkMouseGrid();
+ } else {
+
+ zonaactual = currentRoomData->rejapantalla[((characterPosX + rectificacionx) / factorx)][((characterPosY + rectificaciony) / factory)];
+ goToObject(zonaactual, zonadestino);
+ freeAnimation();
+ freeScreenObjects();
+ g_engine->_mouseManager->hide();
+ loadScrollData(currentRoomData->doors[indicepuertas].pantallaquecarga, true, 131, -1);
+ g_engine->_mouseManager->show();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ checkMouseGrid();
+ }
+ } break;
+ case 19: {
+ if (currentRoomData->codigo != 18) {
+ tipoefectofundido = Random(15) + 1;
+ iframe = 0;
+ indicetray = 0;
+ characterPosX = currentRoomData->doors[indicepuertas].posxsalida - rectificacionx;
+ characterPosY = currentRoomData->doors[indicepuertas].posysalida - rectificaciony;
+ trayec[indicetray].x = characterPosX;
+ trayec[indicetray].y = characterPosY;
+ freeAnimation();
+ freeScreenObjects();
+ g_engine->_mouseManager->hide();
+ effect(tipoefectofundido, true, NULL);
+ loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
+ effect(tipoefectofundido, false, background);
+ g_engine->_mouseManager->show();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ checkMouseGrid();
+ } else {
+
+ zonaactual = currentRoomData->rejapantalla[((characterPosX + rectificacionx) / factorx)][((characterPosY + rectificaciony) / factory)];
+ goToObject(zonaactual, zonadestino);
+ freeAnimation();
+ freeScreenObjects();
+ g_engine->_mouseManager->hide();
+ loadScrollData(currentRoomData->doors[indicepuertas].pantallaquecarga, false, 131, 1);
+ g_engine->_mouseManager->show();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ checkMouseGrid();
+ }
+ } break;
+ case 20: {
+ tipoefectofundido = Random(15) + 1;
+ iframe = 0;
+ indicetray = 0;
+ characterPosX = currentRoomData->doors[indicepuertas].posxsalida - rectificacionx;
+ characterPosY = currentRoomData->doors[indicepuertas].posysalida - rectificaciony;
+ trayec[indicetray].x = characterPosX;
+ trayec[indicetray].y = characterPosY;
+ freeAnimation();
+ freeScreenObjects();
+ g_engine->_mouseManager->hide();
+ effect(tipoefectofundido, true, NULL);
+ stopVoc();
+ loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
+ switch (hornacina[0][hornacina[0][3]]) {
+ case 0:
+ currentRoomData->indexadoobjetos[9]->objectName = "HORNACINA";
+ break;
+ case 561:
+ currentRoomData->indexadoobjetos[9]->objectName = "ESTATUA DIVINA";
+ break;
+ case 563:
+ currentRoomData->indexadoobjetos[9]->objectName = "MANUAL DE ALFARERO";
+ break;
+ case 615:
+ currentRoomData->indexadoobjetos[9]->objectName = "ESTATUA GROTESCA";
+ break;
+ }
+ if (contadorpc > 89)
+ error("engine_start(): contadorpc (274)");
+ setSfxVolume(volumenfxizquierdo, volumenfxderecho);
+ if (currentRoomData->codigo == 4)
+ loadVoc("GOTA", 140972, 1029);
+ effect(tipoefectofundido, false, background);
+ contadorpc = contadorpc2;
+ g_engine->_mouseManager->show();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ checkMouseGrid();
+ } break;
+ case 24: {
+ tipoefectofundido = Random(15) + 1;
+ iframe = 0;
+ indicetray = 0;
+ characterPosX = currentRoomData->doors[indicepuertas].posxsalida - rectificacionx;
+ characterPosY = currentRoomData->doors[indicepuertas].posysalida - rectificaciony;
+ trayec[indicetray].x = characterPosX;
+ trayec[indicetray].y = characterPosY;
+ freeAnimation();
+ freeScreenObjects();
+ g_engine->_mouseManager->hide();
+ effect(tipoefectofundido, true, NULL);
+ stopVoc();
+ loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
+ switch (hornacina[1][hornacina[1][3]]) {
+ case 0:
+ currentRoomData->indexadoobjetos[8]->objectName = "HORNACINA";
+ break;
+ case 561:
+ currentRoomData->indexadoobjetos[8]->objectName = "ESTATUA DIVINA";
+ break;
+ case 615:
+ currentRoomData->indexadoobjetos[8]->objectName = "ESTATUA GROTESCA";
+ break;
+ case 622:
+ currentRoomData->indexadoobjetos[8]->objectName = "PARED";
+ break;
+ case 623:
+ currentRoomData->indexadoobjetos[8]->objectName = "TORNO";
+ break;
+ }
+ if (contadorpc > 89)
+ error("engine_start(): contadorpc (274)");
+ setSfxVolume(volumenfxizquierdo, volumenfxderecho);
+ if (trampa_puesta) {
+ currentRoomData->banderamovimiento = true;
+ loadAnimation(currentRoomData->nombremovto);
+ iframe2 = 0;
+ indicetray2 = 1;
+ currentRoomData->tray2[indicetray2 - 1].x = 214 - 15;
+ currentRoomData->tray2[indicetray2 - 1].y = 115 - 42;
+ animado.dir = currentRoomData->dir2[indicetray2 - 1];
+ animado.posx = currentRoomData->tray2[indicetray2 - 1].x;
+ animado.posy = currentRoomData->tray2[indicetray2 - 1].y;
+ animado.profundidad = 14;
+
+ for (iaux = 0; iaux < maxrejax; iaux++)
+ for (iaux2 = 0; iaux2 < maxrejay; iaux2++) {
+ if (rejamascaramovto[iaux][iaux2] > 0){
+ currentRoomData->rejapantalla[oldposx + iaux][oldposy + iaux2] = rejamascaramovto[iaux][iaux2];
+ }
+ if (rejamascararaton[iaux][iaux2] > 0)
+ currentRoomData->mouseGrid[oldposx + iaux][oldposy + iaux2] = rejamascararaton[iaux][iaux2];
+ }
+ assembleScreen();
+ }
+ effect(tipoefectofundido, false, background);
+ if ((rojo_capturado == false) && (trampa_puesta == false))
+ runaroundRed();
+ contadorpc = contadorpc2;
+ g_engine->_mouseManager->show();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ checkMouseGrid();
+ } break;
+ case 255:
+ wcScene();
+ break;
+ default: {
+ tipoefectofundido = Random(15) + 1;
+ iframe = 0;
+ indicetray = 0;
+ characterPosX = currentRoomData->doors[indicepuertas].posxsalida - rectificacionx;
+ characterPosY = currentRoomData->doors[indicepuertas].posysalida - rectificaciony;
+ trayec[indicetray].x = characterPosX;
+ trayec[indicetray].y = characterPosY;
+ freeAnimation();
+ freeScreenObjects();
+ g_engine->_mouseManager->hide();
+ effect(tipoefectofundido, true, NULL);
+ stopVoc();
+ loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
+ if (contadorpc > 89)
+ error("engine_start(): contadorpc (274)");
+ setSfxVolume(volumenfxizquierdo, volumenfxderecho);
+ switch (currentRoomData->codigo) {
+ case 4:
+ loadVoc("GOTA", 140972, 1029);
+ break;
+ case 23:
+ autoPlayVoc("FUENTE", 0, 0);
+ break;
+ }
+ effect(tipoefectofundido, false, background);
+ contadorpc = contadorpc2;
+ g_engine->_mouseManager->show();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ checkMouseGrid();
+ }
+ }
+ oldzonadestino = 0;
+}
} // end of namespace Tot
diff --git a/engines/tot/graphics.cpp b/engines/tot/graphics.cpp
index c76c0c9cce4..4fe4cf921e0 100644
--- a/engines/tot/graphics.cpp
+++ b/engines/tot/graphics.cpp
@@ -825,7 +825,7 @@ void redFadeIn(palette palpaso) {
void updatePalette(byte indicepaleta) {
int ip;
- switch (parte_del_juego) {
+ switch (gamePart) {
case 1: {
for (ipal = 0; ipal <= 5; ipal++) {
pal[(ipal + 195) * 3 + 0] = movimientopal[(indicepaleta * 6 + ipal) * 3 + 0];
diff --git a/engines/tot/playanim.cpp b/engines/tot/playanim.cpp
index bd637fb2d6f..99685fb8c25 100644
--- a/engines/tot/playanim.cpp
+++ b/engines/tot/playanim.cpp
@@ -64,7 +64,7 @@ boolean teleencendida,
trampa_puesta,
peteractivo;
-boolean dentro_del_juego;
+boolean inGame;
boolean hechaprimeravez;
@@ -104,7 +104,7 @@ byte movidapaleta;
byte rejillaquetoca;
-byte parte_del_juego;
+byte gamePart;
byte encripcod1;
byte secondaryAnimationFrameCount;
@@ -823,7 +823,7 @@ void resetGameState() {
completadalista2 = false;
movidapaleta = 0;
- parte_del_juego = 1;
+ gamePart = 1;
vasijapuesta = false;
guadagna = false;
@@ -1147,7 +1147,7 @@ void initPlayAnim() {
contadorpc2 = 0;
continuarpartida = true;
hechaprimeravez = false;
- dentro_del_juego = false;
+ inGame = false;
}
} // End of namespace Tot
diff --git a/engines/tot/playanim.h b/engines/tot/playanim.h
index 0f2491ff812..557947bb02b 100644
--- a/engines/tot/playanim.h
+++ b/engines/tot/playanim.h
@@ -342,7 +342,7 @@ extern boolean teleencendida,
/**
* Flag for temporary savegame
*/
-extern boolean dentro_del_juego;
+extern boolean inGame;
/**
* Flag for first time run of the game.
*/
@@ -424,7 +424,7 @@ extern byte rejillaquetoca;
/**
* 1 first part, 2 second part
*/
-extern byte parte_del_juego;
+extern byte gamePart;
extern byte encripcod1;
/**
* Number of frames of secondary animation
diff --git a/engines/tot/routines.cpp b/engines/tot/routines.cpp
index 5afe22a1254..5669747d0ef 100644
--- a/engines/tot/routines.cpp
+++ b/engines/tot/routines.cpp
@@ -3783,7 +3783,7 @@ void handleAction(byte posinv) {
void loadObjects() {
Common::File ficheroobj;
- switch (parte_del_juego) {
+ switch (gamePart) {
case 1:
ficheroobj.open("OBJMOCH.DAT");
break;
@@ -4216,7 +4216,7 @@ void saveGameToRegister() {
regpartida.indicepuertas = indicepuertas;
regpartida.direccionmovimiento = direccionmovimiento;
regpartida.iframe = iframe;
- regpartida.parte_del_juego = parte_del_juego;
+ regpartida.parte_del_juego = gamePart;
regpartida.sello_quitado = sello_quitado;
regpartida.lista1 = lista1;
@@ -4284,7 +4284,7 @@ void saveGameToRegister() {
void loadGame(regispartida game) {
freeAnimation();
- freeObject();
+ freeScreenObjects();
uint indiaux, indiaux2;
tipoefectofundido = Random(15) + 1;
@@ -4313,8 +4313,8 @@ void loadGame(regispartida game) {
indicepuertas = game.indicepuertas;
direccionmovimiento = game.direccionmovimiento;
iframe = game.iframe;
- if (game.parte_del_juego != parte_del_juego) {
- parte_del_juego = game.parte_del_juego;
+ if (game.parte_del_juego != gamePart) {
+ gamePart = game.parte_del_juego;
for(int i = 0; i < inventoryIconCount; i++) {
free(mochilaxms.bitmap[i]);
}
@@ -4840,7 +4840,7 @@ void saveLoad() {
free(puntfondmenu);
if (!desactivagrabar) {
freeAnimation();
- freeObject();
+ freeScreenObjects();
}
loadGame(partidaselecc);
xraton = oldxraton;
@@ -4873,7 +4873,7 @@ void saveLoad() {
}
}
else if (pulsax >= 200 && pulsax <= 250) {
- if (dentro_del_juego && !desactivagrabar) {
+ if (inGame && !desactivagrabar) {
putImg(50, 10, puntfondmenu);
salirmenufunciones = true;
partidaselecc = 0;
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
index 8e78a35ec9d..bfac96d18c8 100644
--- a/engines/tot/routines2.cpp
+++ b/engines/tot/routines2.cpp
@@ -281,7 +281,7 @@ void loadScreen() {
sizepantalla = currentRoomData->tamimagenpantalla;
readBitmap(currentRoomData->puntimagenpantalla, background, sizepantalla, 316);
Common::copy(background, background + sizepantalla, handpantalla);
- switch (parte_del_juego) {
+ switch (gamePart) {
case 1: {
if (!fichcp.open("PALETAS.DAT")) {
error("loadScreen(): ioresult (310)");
@@ -334,7 +334,7 @@ void loadCharAnimation() {
characterFile.close();
}
-void freeObject() {
+void freeScreenObjects() {
uint indicecarga;
for (indicecarga = 0; indicecarga < numobjetosconv; indicecarga++) {
@@ -1958,22 +1958,6 @@ void initialMenu(boolean fundido) {
continuarpartida = false;
opcionvalida = true;
} else if (x > 173 && x < 267) {
- // {
- // freeAnimation();
- // freeObject();
- // initializeScreenFile();
- // initializeObjectFile();
- // mask();
- // drawBackpack();
- // loadScreenData(1);
- // effect(13, 0, fondo);
- // g_engine->_mouseManager->hide();
- // partialFadeOut(234);
- // sacrifice();
- // g_engine->_mouseManager->show();
-
- // }
-
credits();
drawFlc(0, 0, 837602, 0, 9, 0, true, false, false, kklogica);
}
@@ -2207,8 +2191,17 @@ void exitToDOS() {
}
void soundControls() {
- uint oldxraton, oldyraton, tamfondcontroles, tamslade, tamfondoslade,
- volumenfx, volumenmelodia;
+ uint oldxraton,
+ oldyraton,
+ tamfondcontroles,
+ tamslade,
+ tamfondoslade,
+ volumenfx,
+ volumenmelodia,
+ xfade,
+ oldxfade,
+ ypaso;
+
byte ytext, oldiraton;
boolean salirmenucontroles;
@@ -2216,13 +2209,12 @@ void soundControls() {
oldxraton = xraton;
oldyraton = yraton;
oldiraton = iraton;
- // drawMouseBackground(xraton, yraton);
+ g_engine->_mouseManager->hide();
tamfondcontroles = imagesize(50, 10, 270, 120);
byte *puntfondcontroles = (byte *)malloc(tamfondcontroles);
getImg(50, 10, 270, 120, puntfondcontroles);
- // settextstyle(peque2, horizdir, 4);
xraton = 150;
yraton = 60;
iraton = 1;
@@ -2230,16 +2222,16 @@ void soundControls() {
setMouseArea(55, 13, 250, 105);
for (ytext = 1; ytext <= 6; ytext++)
- buttonBorder((120 - (ytext * 10)), (80 - (ytext * 10)), (200 + (ytext * 10)),
- (60 + (ytext * 10)), 251, 251, 251, 251, 0, 0, "");
+ buttonBorder(120 - (ytext * 10), 80 - (ytext * 10), 200 + (ytext * 10), 60 + (ytext * 10), 251, 251, 251, 251, 0, 0, "");
buttonBorder(86, 31, 94, 44, 0, 0, 0, 0, 0, 0, "");
+
line(90, 31, 90, 44, 255);
tamslade = imagesize(86, 31, 94, 44);
byte *slade = (byte *)malloc(tamslade);
-
getImg(86, 31, 94, 44, slade);
+
drawMenu(3);
tamfondoslade = imagesize(86, 31, 234, 44);
@@ -2247,80 +2239,110 @@ void soundControls() {
byte *fondoslade2 = (byte *)malloc(tamfondoslade);
getImg(86, 31, 234, 44, fondoslade1);
getImg(86, 76, 234, 89, fondoslade2);
- volumenfx = round(((volumenfxderecho + volumenfxizquierdo) / 2) * 20);
- volumenmelodia = round(((volumenmelodiaderecho + volumenmelodiaizquierdo) / 2) * 20);
- putImg((volumenfx + 86), 31, slade);
- putImg((volumenmelodia + 86), 76, slade);
+
+ // volumenfx = round(((volumenfxderecho + volumenfxizquierdo) / 2) * 20);
+ // volumenmelodia = round(((volumenmelodiaderecho + volumenmelodiaizquierdo) / 2) * 20);
+ volumenfx = 0;
+ volumenmelodia = 0;
+ putImg(volumenfx + 86, 31, slade);
+ putImg(volumenmelodia + 86, 76, slade);
setMousePos(1, xraton, yraton);
+ boolean keyPressed = false;
+ boolean mouseClicked = false;
+ Common::Event e;
do {
- // do {
- // g_engine->_chrono->updateChrono();
- // g_engine->_mouseManager->animateMouseIfNeeded();
- // // getMouseClickCoords(0, npraton, pulsax, pulsay);
- // g_engine->_screen->update();
- // } while (!((npraton > 0) || (keyPressed()) && ! g_engine->shouldQuit()));
+ g_engine->_chrono->updateChrono();
+ do {
+ g_engine->_chrono->updateChrono();
+ g_engine->_mouseManager->animateMouseIfNeeded();
+ while (g_system->getEventManager()->pollEvent(e)) {
+ if (e.type == Common::EVENT_KEYUP) {
+ keyPressed = true;
+ }
+ if (e.type == Common::EVENT_LBUTTONDOWN) {
+ mouseClicked = true;
+ pulsax = e.mouse.x;
+ pulsay = e.mouse.y;
+ }
+ }
+ g_engine->_screen->update();
+ } while ((!keyPressed && !mouseClicked) && !g_engine->shouldQuit());
g_engine->_chrono->updateChrono();
g_engine->_mouseManager->animateMouseIfNeeded();
- // if (keyPressed())
- // salirmenucontroles = true;
- // if (npraton > 0)
-
- // switch (pulsay) {
- // case RANGE_16(22, 37): {
- // drawMouseBackground(xraton, yraton);
- // xfade = 86 + volumenfx;
- // do {
- // oldxfade = xfade;
- // getMousePos(xfade, ypaso);
- // if (xfade < 86)
- // xfade = 86;
- // else if (xfade > 226)
- // xfade = 226;
- // if (oldxfade != xfade) {
- // putImg(86, 31, fondoslade1);
- // putImg(xfade, 31, slade);
- // volumenfx = xfade - 86;
- // volumenfxderecho = round_((real)(volumenfx) / 20);
- // volumenfxizquierdo = round_((real)(volumenfx) / 20);
- // setSfxVolume((byte)(volumenfxizquierdo),
- // (byte)(volumenfxderecho));
- // }
- // getMouseClickCoords(0, npraton, pulsax, pulsay);
- // } while (!(npraton > 0));
- // drawMouseMask(iraton, xraton, yraton);
- // } break;
- // case RANGE_16(67, 82): {
- // drawMouseBackground(xraton, yraton);
- // xfade = 86 + volumenmelodia;
- // do {
- // oldxfade = xfade;
- // getMousePos(xfade, ypaso);
- // if (xfade < 86)
- // xfade = 86;
- // else if (xfade > 226)
- // xfade = 226;
- // if (oldxfade != xfade) {
- // putImg(86, 76, fondoslade2);
- // putImg(xfade, 76, slade);
- // volumenmelodia = xfade - 86;
- // volumenmelodiaderecho = round_((real)(volumenmelodia) / 20);
- // volumenmelodiaizquierdo = round_((real)(volumenmelodia) / 20);
- // setMidiVolume((byte)(volumenmelodiaizquierdo),
- // (byte)(volumenmelodiaderecho));
- // }
- // getMouseClickCoords(0, npraton, pulsax, pulsay);
- // } while (!(npraton > 0));
- // drawMouseMask(iraton, xraton, yraton);
- // } break;
- // case RANGE_11(97, 107):
- // salirmenucontroles = true;
- // break;
- // }
- // clearMouseAndKeyboard(npraton, npraton2);
- // if ((npraton > 0) || (npraton2 > 0))
- // error("controls(): npraton! (285)");
+ if (keyPressed) {
+ salirmenucontroles = true;
+ }
+ if (mouseClicked) {
+ if (pulsay >= 22 && pulsay <= 37) {
+ g_engine->_mouseManager->hide();
+ xfade = 86 + volumenfx;
+ boolean mouseReleased = false;
+ do {
+ while (g_system->getEventManager()->pollEvent(e)) {
+ if (e.type == Common::EVENT_LBUTTONUP) {
+ mouseReleased = true;
+ } else if (e.type == Common::EVENT_MOUSEMOVE) {
+ xfade = e.mouse.x;
+ ypaso = e.mouse.y;
+ }
+ }
+ if (xfade < 86) {
+ xfade = 86;
+ } else if (xfade > 226) {
+ xfade = 226;
+ }
+
+ if (oldxfade != xfade) {
+ putImg(86, 31, fondoslade1);
+ putImg(xfade, 31, slade);
+ volumenfx = xfade - 86;
+ // volumenfxderecho = round_((real)(volumenfx) / 20);
+ // volumenfxizquierdo = round_((real)(volumenfx) / 20);
+ setSfxVolume(volumenfxizquierdo, volumenfxderecho);
+ }
+ g_engine->_screen->update();
+ } while (!mouseReleased);
+
+ g_engine->_mouseManager->show();
+ } else if (pulsay >= 67 && pulsay <= 82) {
+ g_engine->_mouseManager->hide();
+ xfade = 86 + volumenmelodia;
+ boolean mouseReleased = false;
+ do {
+ while (g_system->getEventManager()->pollEvent(e)) {
+ if (e.type == Common::EVENT_LBUTTONUP) {
+ mouseReleased = true;
+ } else if (e.type == Common::EVENT_MOUSEMOVE) {
+ xfade = e.mouse.x;
+ ypaso = e.mouse.y;
+ }
+ }
+ if (xfade < 86) {
+ xfade = 86;
+ } else if (xfade > 226) {
+ xfade = 226;
+ }
+
+ if (oldxfade != xfade) {
+ putImg(86, 76, fondoslade2);
+ putImg(xfade, 76, slade);
+ volumenmelodia = xfade - 86;
+ // volumenmelodiaderecho = round_((real)(volumenmelodia) / 20);
+ // volumenmelodiaizquierdo = round_((real)(volumenmelodia) / 20);
+ setMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
+ setSfxVolume(volumenfxizquierdo, volumenfxderecho);
+ }
+ g_engine->_screen->update();
+ } while (!mouseReleased);
+
+ g_engine->_mouseManager->show();
+ } else if (pulsay >= 97 && pulsay <= 107) {
+ salirmenucontroles = true;
+ }
+ mouseClicked = false;
+ }
g_system->delayMillis(10);
g_engine->_screen->update();
} while (!salirmenucontroles && !g_engine->shouldQuit());
@@ -2341,7 +2363,7 @@ void soundControls() {
setMouseArea(0, 0, 305, 185);
}
-void sacrifice() {
+void sacrificeScene() {
palette palaux;
stopVoc();
diff --git a/engines/tot/routines2.h b/engines/tot/routines2.h
index 11993caec29..885e172bb5a 100644
--- a/engines/tot/routines2.h
+++ b/engines/tot/routines2.h
@@ -47,7 +47,7 @@ void verifyCopyProtection2();
void cargatele();
void loadScreen();
void loadCharAnimation();
-void freeObject();
+void freeScreenObjects();
void freeAnimation();
void freeInventory();
void loadItem(uint coordx, uint coordy, uint picSize, int32 pic, uint prof);
@@ -78,7 +78,7 @@ void initialLogo();
void initialMenu(boolean fade);
void exitToDOS();
void soundControls();
-void sacrifice();
+void sacrificeScene();
void ending();
void loadBat();
void loadDevil();
diff --git a/engines/tot/saveload.cpp b/engines/tot/saveload.cpp
index 2caeba650bc..fa0cf2db25d 100644
--- a/engines/tot/saveload.cpp
+++ b/engines/tot/saveload.cpp
@@ -302,7 +302,7 @@ bool TotEngine::canLoadGameStateCurrently(Common::U32String *msg) {
return true;
}
bool TotEngine::canSaveGameStateCurrently(Common::U32String *msg) {
- return dentro_del_juego;
+ return inGame;
}
} // End of namespace Tot
Commit: 08a8d903da6cf4fccc5bd23de9e22868aca788e1
https://github.com/scummvm/scummvm/commit/08a8d903da6cf4fccc5bd23de9e22868aca788e1
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:47+02:00
Commit Message:
TOT: Implements sound volume changes
Changed paths:
engines/tot/routines.cpp
engines/tot/routines2.cpp
engines/tot/sound.cpp
engines/tot/sound.h
engines/tot/soundman.cpp
engines/tot/soundman.h
diff --git a/engines/tot/routines.cpp b/engines/tot/routines.cpp
index 5669747d0ef..47e25e631c6 100644
--- a/engines/tot/routines.cpp
+++ b/engines/tot/routines.cpp
@@ -3398,7 +3398,6 @@ void useScreenObject() {
currentRoomData->indexadoobjetos[16]->objectName = "CARBON";
currentRoomData->indexadoobjetos[1]->indicefichero = 347;
currentRoomData->indexadoobjetos[1]->objectName = "BOMBILLA";
- debug("Enabled bombilla!");
stopVoc();
autoPlayVoc("CALDERA", 6433, 15386);
} break;
@@ -4994,8 +4993,7 @@ void loadTalkAnimations() {
loadAnimationForDirection(&fichcani, 0);
}
fichcani.close();
- } else
- estadovoc = 1;
+ }
}
void unloadTalkAnimations() {
@@ -5030,8 +5028,7 @@ void unloadTalkAnimations() {
loadAnimationForDirection(&fichcani, 0);
}
fichcani.close();
- } else
- estadovoc = 0;
+ }
}
regismht readVerbRegister(uint numRegister) {
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
index bfac96d18c8..b8a87977399 100644
--- a/engines/tot/routines2.cpp
+++ b/engines/tot/routines2.cpp
@@ -2240,10 +2240,8 @@ void soundControls() {
getImg(86, 31, 234, 44, fondoslade1);
getImg(86, 76, 234, 89, fondoslade2);
- // volumenfx = round(((volumenfxderecho + volumenfxizquierdo) / 2) * 20);
- // volumenmelodia = round(((volumenmelodiaderecho + volumenmelodiaizquierdo) / 2) * 20);
- volumenfx = 0;
- volumenmelodia = 0;
+ volumenfx = round(((volumenfxderecho + volumenfxizquierdo) / 2) * 20);
+ volumenmelodia = round(((volumenmelodiaderecho + volumenmelodiaizquierdo) / 2) * 20);
putImg(volumenfx + 86, 31, slade);
putImg(volumenmelodia + 86, 76, slade);
@@ -2297,9 +2295,12 @@ void soundControls() {
if (oldxfade != xfade) {
putImg(86, 31, fondoslade1);
putImg(xfade, 31, slade);
+ //This yields a volume between 0 and 140
volumenfx = xfade - 86;
- // volumenfxderecho = round_((real)(volumenfx) / 20);
- // volumenfxizquierdo = round_((real)(volumenfx) / 20);
+
+ debug("volumefx=%d", volumenfx);
+ volumenfxderecho = round((float)volumenfx / 20);
+ volumenfxizquierdo = round((float)volumenfx / 20);
setSfxVolume(volumenfxizquierdo, volumenfxderecho);
}
g_engine->_screen->update();
@@ -2329,10 +2330,9 @@ void soundControls() {
putImg(86, 76, fondoslade2);
putImg(xfade, 76, slade);
volumenmelodia = xfade - 86;
- // volumenmelodiaderecho = round_((real)(volumenmelodia) / 20);
- // volumenmelodiaizquierdo = round_((real)(volumenmelodia) / 20);
+ volumenmelodiaderecho = round((float)(volumenmelodia) / 20);
+ volumenmelodiaizquierdo = round((float)(volumenmelodia) / 20);
setMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
- setSfxVolume(volumenfxizquierdo, volumenfxderecho);
}
g_engine->_screen->update();
} while (!mouseReleased);
diff --git a/engines/tot/sound.cpp b/engines/tot/sound.cpp
index c143bb26466..2a91324f391 100644
--- a/engines/tot/sound.cpp
+++ b/engines/tot/sound.cpp
@@ -27,308 +27,54 @@
namespace Tot {
-uint estadovoc, midestatus;
-
-// pointer exitproc = nil;
-
-const char ctmidi[] = "CTMidi.drv";
-const int tamdrctmidi = 17000;
-const int tambuffmid = 25000;
-const uint tambuffvoc = (uint)(65536 - tambuffmid);
-// const array<0, 3, byte> regpag8 = {{0x87, 0x83, 0x81, 0x82}};
-// const array<0, 7, byte> regpag16 = {{0x87, 0x83, 0x81, 0x82, 0, 0x8b, 0x89, 0x8a}};
-// const array<0, 3, byte> dirbase8 = {{0, 2, 4, 6}};
-// const array<0, 7, byte> dirbase16 = {{0xc0, 0xc4, 0xc8, 0xcc, 0xc0, 0xc4, 0xc8, 0xcc}};
-// const array<0, 3, byte> contpal8 = {{1, 3, 5, 7}};
-// const array<0, 7, byte> contpal16 = {{0xc2, 0xc6, 0xca, 0xce, 0xc2, 0xc6, 0xca, 0xce}};
-// const array<0, 15, byte> sbirq = {{
-// 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf,
-// 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77
-// }
-// };
-
-byte frecvoc,
- codigodsp,
- dmacontpal,
- loopvoc;
-uint prefseg,
- segdatosvoc,
- ofsdatosvoc,
- sbdma,
- sbint,
- irqlevel,
- dmaregpag,
- dmadirbase,
- sbtipo,
- sbdirbase,
- sbmixdirbase,
- cuentavueltasvoc,
- musicaactiva;
-
-
-boolean loopmid,
- existemidadl,
- existevocsb,
- existemidsbdrv;
-
byte *midmusica;
-// pointer sbexitproc,
-// musicavoc,
-// driversbpromid;
-
-int32 contadorvoc,
- dirdatos;
-
-
-
-void guarda_oldirq() {
- warning("STUB: guarda_oldirq");
-}
-
-void instalairq() {
- warning("STUB: instalairq");
-}
-
-void desinstalairq() {
- warning("STUB: desinstalairq");
-}
-
-void activacanaldmaauto() {
- warning("STUB: activacanaldmaauto");
-}
-
-void activacanaldma() {
- warning("STUB: activacanaldma");
-}
-
-void writedsp(byte dato) {
- warning("STUB: writedsp");
-}
-
-void readdsp(byte& dato) {
- warning("STUB: readdsp");
-}
-
-void resetdsp() {
- warning("STUB: resetdsp");
-}
-
-void writemixer(byte funcion, byte dato) {
- warning("STUB: writemixer");
-}
-
-void resetmixer() {
- warning("STUB: resetmixer");
-}
-
-byte mixerdata3(byte voll, byte volr) {
- warning("STUB: mixerdata3");
-}
-
-byte mixerdata2(byte vol) {
- warning("STUB: mixerdata2");
-}
-
-uint mid_version() {
- warning("STUB: mid_version");
-}
-
-uint mid_setenv(uint segenv, uint ofsenv) {
- warning("STUB: mid_setenv");
-}
-
-void mid_mapper(uint wmapper) {
- warning("STUB: mid_mapper");
-}
-
-uint mid_init() {
- warning("STUB: mid_init");
-}
-
-void mid_finaldrv() {
- warning("STUB: mid_finaldrv");
-}
-
-uint mid_setstuint() {
- warning("STUB: mid_setstuint");
-}
-
-void mid_reset() {
- warning("STUB: mid_reset");
-}
-
-void mid_stopmusic() {
- warning("STUB: mid_stopmusic");
-}
-
-void mid_instala1c() {
- warning("STUB: mid_instala1c");
-}
-
-void mid_desinstala1c() {
- warning("STUB: mid_desinstala1c");
-}
void stopVoc() {
g_engine->_sound->stopVoc();
- // resetdsp();
- estadovoc = 0;
}
-
void setSfxVolume(byte voll, byte volr) {
- // if (existevocsb) {
- // switch (codigodsp) {
- // case 2:
- // writemixer(0xa, (mixerdata2((voll + volr))));
- // break;
- // case 3:
- // case 4:
- // writemixer(0x4, (mixerdata3(voll, volr)));
- // break;
- // }
- // }
+
+ if(voll == volr) {
+ int volume = (voll)/(float)7 * 255;
+ g_engine->_sound->setSfxVolume(volume);
+ g_engine->_sound->setSfxBalance(true, true);
+ }
+ else {
+ if(voll == 0) {
+ g_engine->_sound->setSfxBalance(false, true);
+ }
+ else {
+ g_engine->_sound->setSfxBalance(true, false);
+ }
+ }
}
void setMidiVolume(byte voll, byte volr) {
- if (existemidsbdrv)
-
- switch (codigodsp) {
- case 2:
- writemixer(0x6, mixerdata3(0, (voll + volr) >> 1));
- break;
- case 3:
- case 4:
- writemixer(0x26, mixerdata3(voll, volr));
- break;
- }
+ int volume = (voll)/(float)7 * 255;
+ g_engine->_sound->setMusicVolume(volume);
}
void lowerMidiVolume(byte voll, byte volr) {
- // byte volpaso = (voll + volr) / 2;
- // for (int ivol = volpaso; ivol >= 0; ivol --) {
- // setMidiVolume(ivol, ivol);
- // delay(10);
- // }
+ byte volpaso = (voll + volr) / 2;
+ for (int ivol = volpaso; ivol >= 0; ivol --) {
+ setMidiVolume(ivol, ivol);
+ delay(10);
+ }
}
void restoreMidiVolume(byte voll, byte volr) {
- // byte ivol, volpaso;
+ byte ivol, volpaso;
- // volpaso = (voll + volr) / 2;
- // for (ivol = 0; ivol <= volpaso; ivol ++) {
- // setMidiVolume(ivol, ivol);
- // delay(10);
- // }
+ volpaso = (voll + volr) / 2;
+ for (ivol = 0; ivol <= volpaso; ivol ++) {
+ setMidiVolume(ivol, ivol);
+ delay(10);
+ }
}
void setMasterVolume(byte voll, byte volr) {
- if (existemidsbdrv || existevocsb)
-
- switch (codigodsp) {
- case 2:
- writemixer(0x2, mixerdata3(0, (voll + volr) >> 1));
- break;
- case 3:
- case 4:
- writemixer(0x22, mixerdata3(voll, volr));
- break;
- }
-}
-
-void inicializasb() {
- // varying_string<64> entornoblaster;
- // varying_string<4> cadenapaso;
- // uint indice, errcode;
- // array<1, 2, byte> version;
-
- // sbtipo = 0;
- // sbmixdirbase = 0;
- // entornoblaster = _stubGetEnv("Blaster");
- // indice = 1;
- // do {
- // switch (entornoblaster[indice]) {
- // case 'A' : {
- // indice += 1;
- // cadenapaso = string('$') + entornoblaster[indice]
- // + entornoblaster[indice + 1]
- // + entornoblaster[indice + 2];
- // val(cadenapaso, sbdirbase, errcode);
- // indice = indice + 4;
- // }
- // break;
- // case 'I' : {
- // indice += 1;
- // val(entornoblaster[indice], irqlevel, errcode);
- // sbint = sbirq[irqlevel];
- // indice += 1;
- // }
- // break;
- // case 'D' : {
- // existevocsb = true;
- // indice += 1;
- // val(entornoblaster[indice], sbdma, errcode);
- // indice += 1;
- // dmaregpag = regpag8[sbdma];
- // dmadirbase = dirbase8[sbdma];
- // dmacontpal = contpal8[sbdma];
- // }
- // break;
- // case 'T' : {
- // indice += 1;
- // val(entornoblaster[indice], sbtipo, errcode);
- // indice += 1;
- // }
- // break;
- // case 'H' : {
- // indice += 1;
- // }
- // break;
- // case 'M' : {
- // indice += 5;
- // }
- // break;
- // case 'P' : {
- // indice += 1;
- // }
- // break;
- // case 'L' : {
- // indice += 1;
- // if (entornoblaster[indice] == 'P') {
- // indice += 1;
- // switch (entornoblaster[indice]) {
- // case 'T' : {
- // indice = indice + 2;
- // }
- // break;
- // case 'I' : {
- // indice = indice + 2;
- // }
- // break;
- // }
- // }
- // }
- // break;
- // default:
- // indice += 1;
- // }
- // } while (!(indice > length(entornoblaster)));
- // if (existevocsb) {
- // sbmixdirbase = sbdirbase;
- // resetdsp();
- // resetmixer();
-
- // writedsp(0xe1);
- // readdsp(version[2]);
- // readdsp(version[1]);
-
- // if (memw[seg(version) * 1337 + ofs(version)] < 0x201)
- // codigodsp = 1;
- // else codigodsp = version[2];
- // setMasterVolume(0xff, 0xff);
- // setSfxVolume(6, 6);
- // }
}
void loadVoc(Common::String vocfile, int32 posinicio, uint tamvocleer) {
@@ -338,40 +84,10 @@ void loadVoc(Common::String vocfile, int32 posinicio, uint tamvocleer) {
void autoPlayVoc(Common::String vocfile, int32 posinicio, uint tamvocleer) {
g_engine->_sound->loadVoc(vocfile, posinicio, tamvocleer);
g_engine->_sound->autoPlayVoc();
- // uint indice;
- // byte dato;
- estadovoc = 1;
- // if (existevocsb) {
- // loopvoc = 0;
- // resetdsp();
- // loadVoc(vocfile, posinicio, tamvocleer);
- // writedsp(0xd1);
- // activacanaldmaauto();
- // writedsp(0x40);
- // writedsp(frecvoc);
- // writedsp(0x48);
- // writedsp(lo(contadorvoc));
- // writedsp(hi(contadorvoc));
- // // estadovoc = 0xffff;
- // writedsp(0x1c);
- // }
}
void pitavocmem() {
g_engine->_sound->playVoc();
- estadovoc = 1;
- // if (existevocsb) {
- // loopvoc = 0;
- // resetdsp();
- // writedsp(0xd1);
- // activacanaldma();
- // writedsp(0x40);
- // writedsp(frecvoc);
- // writedsp(0x14);
- // writedsp(lo(contadorvoc));
- // writedsp(hi(contadorvoc));
- // estadovoc = 0xffff;
- // }
}
void playVoc(Common::String vocfile, int32 posinicio, uint tamvocleer) {
@@ -380,122 +96,23 @@ void playVoc(Common::String vocfile, int32 posinicio, uint tamvocleer) {
}
void playMidiFile(Common::String nomfich, boolean loop) {
- // // Disabled to avoid annoying music
-
- // Common::File ficheromus;
- // if(!ficheromus.open(Common::Path(nomfich + ".MUS"))){
- // error("pitamidfich(): ioresult! (267)");
- // }
- // mid_reset();
- // midmusica = (byte *)malloc(ficheromus.size());
- // ficheromus.read(midmusica, ficheromus.size());
-
- // g_engine->_sound->playMidi((byte *)midmusica, ficheromus.size(), true);
- // ficheromus.close();
-}
-
-boolean disponiblemid() {
- boolean disponiblemid_result;
- disponiblemid_result = existemidsbdrv;
- return disponiblemid_result;
-}
-
-boolean cargasbdrvmid() {
- // uint _error;
- // string entornoblaster;
- // untyped_file ficheromus;
-
- // boolean cargasbdrvmid_result;
- // cargasbdrvmid_result = false;
- // assign(ficheromus, ctmidi);
- // if (ioresult != 0) error("cargasbdrvmid(): ioresult! (268)");
- // if (ofs(driversbpromid) == 0) {
- // blockread(ficheromus, driversbpromid, tamdrctmidi, _error);
- // if (mid_version() >= 0x100) {
- // entornoblaster = _stubGetEnv("BLASTER") + chr(0) + chr(0);
- // if (mid_setenv(seg(entornoblaster), ofs(entornoblaster)) == 0) {
- // mid_reset();
- // if (mid_init() == 0)
-
- // if (mid_setstuint() == 0) {
- // cargasbdrvmid_result = true;
- // existemidsbdrv = true;
- // mid_mapper(0);
- // setMidiVolume(3, 3);
- // }
- // }
- // }
- // }
- // close(ficheromus);
- // return cargasbdrvmid_result;
- return 0;
-}
-
-void initsbmid() {
- warning("STUB! initsbmi");
- // uint alineacion;
- // pointer basurapointer;
-
- // getmem(driversbpromid, tamdrctmidi);
- // alineacion = ofs(driversbpromid);
- // if (alineacion != 0) {
- // freemem(driversbpromid, tamdrctmidi);
- // getmem(basurapointer, (16 - alineacion));
- // getmem(driversbpromid, tamdrctmidi);
- // freemem(basurapointer, (16 - alineacion));
- // alineacion = ofs(driversbpromid);
- // }
- // if (alineacion != 0) error("initsbmid(): alineacion! (276)");
-
- // midmusica = malloc(tambuffvoc);
- // if (cargasbdrvmid())
+ Common::File ficheromus;
+ if(!ficheromus.open(Common::Path(nomfich + ".MUS"))){
+ error("pitamidfich(): ioresult! (267)");
+ }
+ midmusica = (byte *)malloc(ficheromus.size());
+ ficheromus.read(midmusica, ficheromus.size());
- // if (existemidsbdrv) {
- // // midmusica = ptr(0x9000, tambuffvoc);
- // mid_reset();
- // } else
- // freemem(driversbpromid, tamdrctmidi);
+ g_engine->_sound->playMidi(midmusica, ficheromus.size(), true);
+ ficheromus.close();
}
-
-void salidasbunit() {
- desinstalairq();
- resetdsp();
- writedsp(0xd3);
- if (existemidsbdrv) {
- mid_stopmusic();
- delay(100);
- mid_reset();
- delay(100);
- mid_finaldrv();
- // free(driversbpromid);
- }
-}
-
void initSound() {
- // existevocsb = false;
- // existemidsbdrv = false;
- // estadovoc = 0;
- // cuentavueltasvoc = 0;
- // loopvoc = 0;
- // inicializasb();
- // if (existevocsb) {
- // musicavoc = ptr(0x9000, 0);
- // ofsdatosvoc = ofs(musicavoc);
- // segdatosvoc = seg(musicavoc);
- // // initsbmid();
- // guarda_oldirq();
- // instalairq();
- // sbexitproc = exitproc;
-
- // warning("STUB: exitproc assignment");
- // //exitproc=&salidasbunit;
- // setMidiVolume(0, 0);
- // playMidiFile("Silent", false);
- // }
+ setMidiVolume(3, 3);
+ playMidiFile("Silent", false);
+ setSfxVolume(6, 6);
}
-} // End of namespace Totficheromus.size()
-;
+} // End of namespace Tot
diff --git a/engines/tot/sound.h b/engines/tot/sound.h
index 40461647b9b..fa2cd61ce49 100644
--- a/engines/tot/sound.h
+++ b/engines/tot/sound.h
@@ -25,8 +25,6 @@
namespace Tot {
-extern uint estadovoc, midestatus;
-
void initSound();
void setSfxVolume(byte voll, byte volr);
void setMidiVolume(byte voll, byte volr);
@@ -34,14 +32,12 @@ void lowerMidiVolume(byte voll, byte volr);
void restoreMidiVolume(byte voll, byte volr);
void setMasterVolume(byte voll, byte volr);
void loadVoc(Common::String vocFile, int32 startPos, uint vocSize);
-void autoPlayVoc(Common::String vocFile, int32 startPos,
- uint vocSize);
+void autoPlayVoc(Common::String vocFile, int32 startPos, uint vocSize);
void pitavocmem();
void playVoc(Common::String vocFile, int32 startPos, uint vocSize);
void stopVoc();
void playMidiFile(Common::String nomfich, boolean loop);
void pitamidmem();
-boolean disponiblemid();
void loopactivo(boolean mid_loop);
} // End of namespace Tot
diff --git a/engines/tot/soundman.cpp b/engines/tot/soundman.cpp
index e40927383e9..11ec8c28305 100644
--- a/engines/tot/soundman.cpp
+++ b/engines/tot/soundman.cpp
@@ -25,6 +25,7 @@
#include "audio/midiplayer.h"
#include "audio/mixer.h"
#include "audio/softsynth/pcspk.h"
+#include "common/config-manager.h"
#include "common/substream.h"
#include "tot/soundman.h"
@@ -37,6 +38,8 @@ SoundManager::SoundManager(Audio::Mixer *mixer) : _mixer(mixer) {
_musicPlayer = new MusicPlayer();
+ g_engine->syncSoundSettings();
+
_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, 100);
_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, 100);
_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, 100);
@@ -109,14 +112,42 @@ void SoundManager::beep(int32 frequency, int32 ms) {
speaker->setVolume(255);
speaker->play(Audio::PCSpeaker::kWaveFormSine, frequency, ms);
_mixer->playStream(Audio::Mixer::kSFXSoundType, &_speakerHandle,
- speaker, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);
+ speaker,
+ -1,
+ Audio::Mixer::kMaxChannelVolume,
+ 0,
+ DisposeAfterUse::NO,
+ true
+ );
+}
+
+void SoundManager::setSfxVolume(int volume) {
+ debug("Setting sfx volume to =%d", volume);
+ _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, volume);
+ ConfMan.setInt("sfx_volume", volume);
+ ConfMan.flushToDisk();
+}
+
+void SoundManager::setSfxBalance(bool left, bool right) {
+ int balance = left? -127: 127;
+ _mixer->setChannelBalance(_soundHandle, balance);
+ // _mixer->setChannelBalance();
}
+void SoundManager::setMusicVolume(int volume) {
+
+ debug("Setting music volume to =%d", volume);
+ _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, volume);
+ ConfMan.setInt("music_volume", volume);
+ ConfMan.flushToDisk();
+
+ _musicPlayer->syncVolume();
+}
MusicPlayer::MusicPlayer() {
_data = nullptr;
- MidiPlayer::createDriver(MDT_MIDI | MDT_ADLIB | MDT_PREFER_GM);
+ MidiPlayer::createDriver(MDT_MIDI | MDT_ADLIB);
int ret = _driver->open();
if (ret == 0) {
diff --git a/engines/tot/soundman.h b/engines/tot/soundman.h
index b3ab44d6707..9c8a6500210 100644
--- a/engines/tot/soundman.h
+++ b/engines/tot/soundman.h
@@ -66,6 +66,9 @@ public:
void toggleMusic();
void beep(int32 frequency, int32 ms);
void waitForSoundEnd();
+ void setSfxVolume(int volume);
+ void setMusicVolume(int volume);
+ void setSfxBalance(bool left, bool right);
private:
Audio::SoundHandle _soundHandle;
Commit: 84acb764f4b50c7fc5ccd815387bd7aab22a08d1
https://github.com/scummvm/scummvm/commit/84acb764f4b50c7fc5ccd815387bd7aab22a08d1
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:47+02:00
Commit Message:
TOT: Consolidates graphics functions
Changed paths:
engines/tot/anims.cpp
engines/tot/graphman.cpp
engines/tot/graphman.h
engines/tot/tot.cpp
diff --git a/engines/tot/anims.cpp b/engines/tot/anims.cpp
index 7d5e711b84b..2e84d193ea1 100644
--- a/engines/tot/anims.cpp
+++ b/engines/tot/anims.cpp
@@ -658,6 +658,20 @@ static fliheader readHeader(Common::File *file) {
return headerfile;
}
+ void blit(const Graphics::Surface *src, Common::Rect bounds) {
+ int16 height = bounds.bottom - bounds.top;
+ int16 width = bounds.right - bounds.left;
+ Graphics::Surface dest = g_engine->_screen->getSubArea(bounds);
+
+ for (int i = 0; i < height - 1; i++) {
+ for (int j = 0; j < width - 1; j++) {
+ *((byte *)dest.getBasePtr(j, i)) = *((byte *)src->getBasePtr(j, i));
+ }
+ }
+ g_engine->_screen->addDirtyRect(bounds);
+ g_engine->_screen->update();
+}
+
static void loadFlc(
uint &loop,
boolean &permitesalida,
@@ -711,7 +725,7 @@ static void loadFlc(
const Graphics::Surface *frame = flic.decodeNextFrame();
if (frame) {
Common::Rect boundingBox = Common::Rect(flicx, flicy, flicx + flic.getWidth() + 1, flicy + flic.getHeight() + 1);
- g_engine->_graphics->blit(frame, boundingBox);
+ blit(frame, boundingBox);
if (flic.hasDirtyPalette()) {
byte *palette = (byte *)flic.getPalette();
@@ -720,7 +734,7 @@ static void loadFlc(
palette[1] = 0;
palette[2] = 0;
if (palcompleta) {
- g_engine->_graphics->changePalette(g_engine->_graphics->getPalette(), palette);
+ changePalette(g_engine->_graphics->getPalette(), palette);
} else {
int limit = doscientos ? 200 : 256;
g_engine->_graphics->setPalette(palette, limit);
diff --git a/engines/tot/graphman.cpp b/engines/tot/graphman.cpp
index 9f1d041e145..37c19bce05a 100644
--- a/engines/tot/graphman.cpp
+++ b/engines/tot/graphman.cpp
@@ -60,7 +60,8 @@ void GraphicsManager::restoreBackground(uint x, uint y, uint x2, uint y2) {
void GraphicsManager::clear() {
g_engine->_screen->clear();
- updateScreen();
+ g_engine->_screen->markAllDirty();
+ g_engine->_screen->update();
}
void GraphicsManager::clearActionLine() {
@@ -91,45 +92,6 @@ byte *GraphicsManager::getPalette() {
return palette;
}
-void GraphicsManager::changePalette(byte origin[768], byte target[768]) {
-
- byte palpaso[768] = {0};
-
- int auxpaso;
- for (int i = 0; i < 768; i++) {
- palpaso[i] = origin[i];
- }
-
- for (int jpal = 31; jpal >= 0; jpal--) {
- for (int ipal = 0; ipal <= 255; ipal++) {
- int indexR = 3 * ipal + 0;
- int indexG = 3 * ipal + 1;
- int indexB = 3 * ipal + 2;
- auxpaso = target[indexR] - palpaso[indexR];
-
- if (auxpaso > 0)
- palpaso[indexR] = palpaso[indexR] + datosfundido[auxpaso][jpal];
- else
- palpaso[indexR] = palpaso[indexR] - datosfundido[-auxpaso][jpal];
-
- auxpaso = target[indexG] - palpaso[indexG];
- if (auxpaso > 0)
- palpaso[indexG] = palpaso[indexG] + datosfundido[auxpaso][jpal];
- else
- palpaso[indexG] = palpaso[indexG] - datosfundido[-auxpaso][jpal];
-
- auxpaso = target[indexB] - palpaso[indexB];
- if (auxpaso > 0)
- palpaso[indexB] = palpaso[indexB] + datosfundido[auxpaso][jpal];
- else
- palpaso[indexB] = palpaso[indexB] - datosfundido[-auxpaso][jpal];
- }
- setPalette(palpaso);
- g_engine->_screen->markAllDirty();
- g_engine->_screen->update();
- }
-}
-
byte *GraphicsManager::loadPalette(Common::String fileName) {
Common::File paletteFile;
if (!paletteFile.open(Common::Path(fileName)))
@@ -142,33 +104,6 @@ byte *GraphicsManager::loadPalette(Common::String fileName) {
return palette;
}
-void GraphicsManager::fadeIn(uint numeropaleta, Common::String nombrepaleta) {
- byte *palette;
-
- byte blackPalette[768];
- for (int i = 0; i < 768; i++) {
- blackPalette[i] = 0;
- }
- if (numeropaleta > 0) {
- palette = loadPalette("PALETAS.DAT");
- } else {
- palette = loadPalette(nombrepaleta + ".PAL");
- }
- changePalette(blackPalette, palette);
-}
-
-void GraphicsManager::fadeOut(byte rojo) {
- byte palpaso[768];
-
- for (int i = 0; i <= 255; i++) {
- palpaso[i * 3 + 0] = rojo;
- palpaso[i * 3 + 1] = 0;
- palpaso[i * 3 + 2] = 0;
- }
- changePalette(getPalette(), palpaso);
-}
-
-
// Debug function just to print a palette on the screen
void GraphicsManager::printPalette() {
@@ -217,91 +152,4 @@ void GraphicsManager::biosText(const Common::String &str, int x, int y, uint32 c
_bios->drawString(g_engine->_screen, str, x, y, 320, color, Graphics::TextAlign::kTextAlignLeft);
}
-void GraphicsManager::blit(const Graphics::Surface *src, Common::Rect bounds) {
- int16 height = bounds.bottom - bounds.top;
- int16 width = bounds.right - bounds.left;
- Graphics::Surface dest = g_engine->_screen->getSubArea(bounds);
-
- for (int i = 0; i < height - 1; i++) {
- for (int j = 0; j < width - 1; j++) {
- *((byte *)dest.getBasePtr(j, i)) = *((byte *)src->getBasePtr(j, i));
- }
- }
- g_engine->_screen->addDirtyRect(bounds);
- updateScreen();
-}
-
-void GraphicsManager::copyPixels(int x, int y, byte *pixels, uint size) {
- byte *destP = (byte *)g_engine->_screen->getPixels() + y * 320 + x;
- Common::copy(pixels, pixels + size, destP);
- updateScreen();
-}
-
-void GraphicsManager::copyRect(Common::Rect rect, byte *pixels) {
- int width = rect.right - rect.left;
- int height = rect.bottom - rect.top;
- for (int j = rect.top; j < rect.bottom; j++) {
- for (int i = rect.left; i < rect.right; i++) {
- *((byte *)g_engine->_screen->getBasePtr(i, j)) = pixels[(j - height) * width + (i - width)];
- }
- }
-}
-
-void GraphicsManager::effect(int effectNumber, bool toBlack) {
- if (toBlack) {
- switch (effectNumber) {
- case 1:
- for (int i = 0; i <= 69; i++) {
- g_engine->_screen->drawLine(0, (i * 2), 319, i * 2, 0);
- g_system->delayMillis(5);
- }
- for (int i = 70; i >= 1; i--) {
- g_engine->_screen->drawLine(0, (i * 2 - 1), 319, (i * 2, -1), 0);
- g_system->delayMillis(5);
- }
- break;
- case 2:
- for (int i = 70; i >= 1; i--) {
- g_engine->_screen->drawLine(0, (i * 2 - 1), 319, (i * 2 - 1), 0);
- g_system->delayMillis(5);
- }
- for (int i = 0; i <= 69; i++) {
- g_engine->_screen->drawLine(0, (i * 2), 319, (i * 2), 0);
- g_system->delayMillis(5);
- }
- break;
-
- default:
- break;
- }
- } else {
- switch (effectNumber) {
- case 13:
- // for (int i1 = 0; i1 <= 319; i1 ++)
- // for (int j1 = 0; j1 <= 139; j1 ++)
-
- // move(ptr(seg(pantalla2), (ofs(pantalla2) +4 + (j1 * 320) + i1)),
- // ptr(0xa000, ((j1 * 320) + i1)), 1);
- break;
-
- default:
- break;
- }
- }
-}
-
-void GraphicsManager::updateScreen() {
- g_engine->_screen->markAllDirty();
- g_engine->_screen->update();
-}
-
-void GraphicsManager::updateScreen(const Common::Rect &r) {
- g_engine->_screen->addDirtyRect(r);
- g_engine->_screen->update();
-}
-
-// void GraphicsManager::restoreBackground(const Common::Rect &r) {
-// g_engine->_screen->blitFrom(_backBuffer, r, r);
-// }
-
} // End of namespace Tot
diff --git a/engines/tot/graphman.h b/engines/tot/graphman.h
index fd3d4ab230c..88c53d32e91 100644
--- a/engines/tot/graphman.h
+++ b/engines/tot/graphman.h
@@ -41,22 +41,12 @@ public:
void getPalette(byte *palette);
byte *getPalette();
void setPalette(byte palette[768], uint num = 256);
- void changePalette(byte origin[768], byte target[768]);
byte *loadPalette(Common::String fileName);
- void fadeOut(byte rojo = 0);
- void fadeIn(uint numeropaleta, Common::String nombrepaleta);
-
+ void restoreBackground(uint x, uint y, uint x2, uint y2);
void littText(const Common::String &str, int x, int y, uint32 color, Graphics::TextAlign align = Graphics::kTextAlignLeft, bool alignCenterY = false);
void euroText(const Common::String &str, int x, int y, uint32 color, Graphics::TextAlign align = Graphics::kTextAlignLeft, bool alignCenterY = false);
void biosText(const Common::String &str, int x, int y, uint32 color);
- void blit(const Graphics::Surface *src, Common::Rect bounds);
- void copyPixels(int x, int y, byte *pixels, uint size);
- void copyRect(Common::Rect rect, byte *pixels);
-
- void effect(int effectNumber, bool toBlack);
-
- void restoreBackground(uint x, uint y, uint x2, uint y2);
void clear();
void clearActionLine();
void writeActionLine(const Common::String &str);
@@ -69,11 +59,6 @@ private:
const int FONT_LITT_OFFSET = 153584;
const int FONT_EURO_OFFSET = 159681;
signed char datosfundido[256][256];
- void updateScreen();
- void updateScreen(const Common::Rect &r);
- // void restoreBackground(const Common::Rect &r);
- Graphics::Surface *_currentBuffer;
- Graphics::Surface *_backBuffer;
};
} // End of namespace Tot
diff --git a/engines/tot/tot.cpp b/engines/tot/tot.cpp
index 4149f631d30..07cb35ac3cb 100644
--- a/engines/tot/tot.cpp
+++ b/engines/tot/tot.cpp
@@ -69,9 +69,6 @@ Common::Error TotEngine::run() {
initGraphics(320, 200);
//Static initializations
- initSound();
- initGraph();
- initPlayAnim();
_screen = new Graphics::Screen();
_graphics = new GraphicsManager();
@@ -79,6 +76,11 @@ Common::Error TotEngine::run() {
_chrono = new ChronoManager();
// _room = new RoomManager();
_mouseManager = new MouseManager();
+
+ initSound();
+ initGraph();
+ initPlayAnim();
+
// _inventoryManager = new InventoryManager();
// _totGame = new TotGame();
// Set the engine's debugger console
Commit: dddcc2c4faaa558a8f2e593f1dfc511c8251df7e
https://github.com/scummvm/scummvm/commit/dddcc2c4faaa558a8f2e593f1dfc511c8251df7e
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:47+02:00
Commit Message:
TOT: Fixes palette issue on part 2 of the game
Changed paths:
engines/tot/anims.cpp
engines/tot/game.cpp
engines/tot/graphics.cpp
engines/tot/graphics.h
engines/tot/graphman.cpp
engines/tot/graphman.h
engines/tot/routines.cpp
diff --git a/engines/tot/anims.cpp b/engines/tot/anims.cpp
index 2e84d193ea1..7c3f91fc127 100644
--- a/engines/tot/anims.cpp
+++ b/engines/tot/anims.cpp
@@ -43,8 +43,6 @@ byte *punterofondofrase = (byte *)malloc(sizefrase);
byte framecontador;
boolean primeravuelta;
-palette palpasoflic;
-
void drawText(uint xfrase, uint yfrase, Common::String str1, Common::String str2, Common::String str3, Common::String str4, Common::String str5, byte colorfrase, byte colorborde) {
outtextxy(xfrase, (yfrase + 3), str1, colorborde);
@@ -735,9 +733,18 @@ static void loadFlc(
palette[2] = 0;
if (palcompleta) {
changePalette(g_engine->_graphics->getPalette(), palette);
+ // copyPalette(palette, pal);
+ } else if (doscientos) {
+ debug("Doscientos!!");
+ g_engine->_graphics->setPalette(palette, 200);
+ for (int i = 0; i <= 200; i ++) {
+ pal[i * 3 + 0] = palette[i * 3 + 0];
+ pal[i * 3 + 1] = palette[i * 3 + 1];
+ pal[i * 3 + 2] = palette[i * 3 + 2];
+ }
} else {
- int limit = doscientos ? 200 : 256;
- g_engine->_graphics->setPalette(palette, limit);
+ g_engine->_graphics->setPalette(palette);
+ copyPalette(palette, pal);
}
}
tocapintar = false;
@@ -748,6 +755,7 @@ static void loadFlc(
g_system->delayMillis(10);
} while (!flic.endOfVideo() && !g_engine->shouldQuit());
+
if (flic.endOfVideo()) {
if (flic.isRewindable()) {
flic.rewind();
diff --git a/engines/tot/game.cpp b/engines/tot/game.cpp
index 70ac83e890d..c65da95dca2 100644
--- a/engines/tot/game.cpp
+++ b/engines/tot/game.cpp
@@ -307,12 +307,12 @@ int engine_start() {
desactivagrabar = false;
}
- // boolean enforceSecondPart = true;
- // if(enforceSecondPart) { //DEBUG
- // completadalista1 = true;
- // completadalista2 = true;
- // gamePart = 1;
- // }
+ boolean enforceSecondPart = true;
+ if(enforceSecondPart) { //DEBUG
+ completadalista1 = true;
+ completadalista2 = true;
+ gamePart = 1;
+ }
return startGame();
}
@@ -700,7 +700,7 @@ int startGame() {
restoreMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
if (contadorpc2 > 43)
_exit(274);
- sacrificeScene();
+ // sacrificeScene();
clear();
loadObjects();
loadPalette("SEGUNDA");
diff --git a/engines/tot/graphics.cpp b/engines/tot/graphics.cpp
index 4fe4cf921e0..6cd3b7f0805 100644
--- a/engines/tot/graphics.cpp
+++ b/engines/tot/graphics.cpp
@@ -673,8 +673,8 @@ void effect(byte numeroefecto, boolean pasaranegro, byte *pantalla2) {
}
}
-void changeRGBBlock(byte initialColor, uint numColors, void *rgb) {
- g_system->getPaletteManager()->setPalette((byte *)rgb, initialColor, numColors);
+void changeRGBBlock(byte initialColor, uint numColors, byte *rgb) {
+ g_system->getPaletteManager()->setPalette(rgb, initialColor, numColors);
}
void changePalette(palette depaleta, palette apaleta) {
@@ -861,26 +861,13 @@ void updatePalette(byte indicepaleta) {
ip = -4;
break;
}
- byte *palette = g_engine->_graphics->getPalette();
-
- palette[131 * 3 + 0] = palette[131 * 3 + 0] - ip;
- palette[131 * 3 + 1] = palette[131 * 3 + 1] - ip;
- palette[131 * 3 + 2] = palette[131 * 3 + 2] - ip;
-
- palette[134 * 3 + 0] = palette[134 * 3 + 0] - ip;
- palette[134 * 3 + 1] = palette[134 * 3 + 1] - ip;
- palette[134 * 3 + 2] = palette[134 * 3 + 2] - ip;
-
- palette[143 * 3 + 0] = palette[143 * 3 + 0] - ip;
- palette[143 * 3 + 1] = palette[143 * 3 + 1] - ip;
- palette[143 * 3 + 2] = palette[143 * 3 + 2] - ip;
-
- palette[187 * 3 + 0] = palette[187 * 3 + 0] - ip;
- palette[187 * 3 + 1] = palette[187 * 3 + 1] - ip;
- palette[187 * 3 + 2] = palette[187 * 3 + 2] - ip;
-
- g_engine->_graphics->setPalette(palette);
-
+ for (int i = 0; i < 3; i++) {
+ pal[131 * 3 + i] = pal[131 * 3 + i] - ip;
+ pal[134 * 3 + i] = pal[134 * 3 + i] - ip;
+ pal[143 * 3 + i] = pal[143 * 3 + i] - ip;
+ pal[187 * 3 + i] = pal[187 * 3 + i] - ip;
+ }
+ g_engine->_graphics->setPalette(pal);
} break;
}
}
diff --git a/engines/tot/graphics.h b/engines/tot/graphics.h
index cdee5db983e..d0828c8aa6b 100644
--- a/engines/tot/graphics.h
+++ b/engines/tot/graphics.h
@@ -48,7 +48,7 @@ void redFadeIn(palette palette);
void partialFadeIn(byte numCol);
void updatePalette(byte paletteIndex);
void changePalette(palette fromPalette, palette toPalette);
-void changeRGBBlock(byte initialColor, uint numColors, void *rgb);
+void changeRGBBlock(byte initialColor, uint numColors, byte *rgb);
void processingActive();
void rectangle(int x1, int y1, int x2, int y2, byte color);
void rectangle(uint x1, uint y1, uint x2, uint y2, byte color);
diff --git a/engines/tot/graphman.cpp b/engines/tot/graphman.cpp
index 37c19bce05a..da6d8f2e3cf 100644
--- a/engines/tot/graphman.cpp
+++ b/engines/tot/graphman.cpp
@@ -92,18 +92,6 @@ byte *GraphicsManager::getPalette() {
return palette;
}
-byte *GraphicsManager::loadPalette(Common::String fileName) {
- Common::File paletteFile;
- if (!paletteFile.open(Common::Path(fileName)))
- error("unable to load palette %s (310)", fileName.c_str());
- byte *palette = (byte *)malloc(768);
- paletteFile.read(palette, 768);
- paletteFile.close();
- fixPalette(palette);
- setPalette(palette);
- return palette;
-}
-
// Debug function just to print a palette on the screen
void GraphicsManager::printPalette() {
diff --git a/engines/tot/graphman.h b/engines/tot/graphman.h
index 88c53d32e91..92f742fa88c 100644
--- a/engines/tot/graphman.h
+++ b/engines/tot/graphman.h
@@ -37,11 +37,10 @@ public:
void printPalette();
- void fixPalette(byte palette[768], uint num = 768);
+ void fixPalette(byte *palette, uint num = 768);
void getPalette(byte *palette);
byte *getPalette();
void setPalette(byte palette[768], uint num = 256);
- byte *loadPalette(Common::String fileName);
void restoreBackground(uint x, uint y, uint x2, uint y2);
void littText(const Common::String &str, int x, int y, uint32 color, Graphics::TextAlign align = Graphics::kTextAlignLeft, bool alignCenterY = false);
diff --git a/engines/tot/routines.cpp b/engines/tot/routines.cpp
index 47e25e631c6..9b7eedee8d5 100644
--- a/engines/tot/routines.cpp
+++ b/engines/tot/routines.cpp
@@ -2944,7 +2944,7 @@ void useScreenObject() {
case 583: {
drawText(regobj.useTextRef);
g_engine->_mouseManager->hide();
- drawFlc(140, 34, 2124896, 0, 9, 24, false, false, false, basurillalog);
+ drawFlc(140, 34, 2124896, 0, 9, 24, false, false, true, basurillalog);
g_engine->_mouseManager->show();
updateItem(regobj.code);
currentRoomData->indexadoobjetos[7]->indicefichero = 716;
@@ -2984,7 +2984,6 @@ void useScreenObject() {
}
readBitmap(1243652, screenObjects[5], 2718, 319);
handPantallaToBackground();
- // XMStoPointer(ptr(segfondo, (offfondo + 4)), _handpantalla, 4, (sizepantalla - int32(4)));
assembleScreen();
drawScreen(background);
} break;
@@ -3041,7 +3040,7 @@ void useScreenObject() {
playVoc("PUFF", 191183, 18001);
//Animate to scythe
debug("Start anim!");
- drawFlc(180, 60, 2216848, 0, 9, 0, false, false, false, basurillalog);
+ drawFlc(180, 60, 2216848, 0, 9, 0, false, false, true, basurillalog);
debug("End Anim!");
//load Scythe
currentRoomData->bitmapasociados[2].puntbitmap = 1545820;
@@ -3100,7 +3099,7 @@ void useScreenObject() {
goToObject(currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], 10);
g_engine->_mouseManager->hide();
playVoc("PUFF", 191183, 18001);
- drawFlc(0, 47, 2209158, 0, 9, 0, false, false, false, basurillalog);
+ drawFlc(0, 47, 2209158, 0, 9, 0, false, false, true, basurillalog);
currentRoomData->bitmapasociados[3].puntbitmap = 1591272;
currentRoomData->bitmapasociados[3].tambitmap = 92;
@@ -3152,7 +3151,7 @@ void useScreenObject() {
g_engine->_mouseManager->hide();
updateInventory(indicemochila);
drawBackpack();
- drawFlc(133, 0, 2076280, 0, 9, 22, false, false, false, basurillalog);
+ drawFlc(133, 0, 2076280, 0, 9, 22, false, false, true, basurillalog);
{
RoomBitmapRegister &with = currentRoomData->bitmapasociados[2];
@@ -3180,7 +3179,7 @@ void useScreenObject() {
goToObject(currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], 3);
g_engine->_mouseManager->hide();
playVoc("AFILAR", 0, 6433);
- drawFlc(160, 15, 2441804, 0, 9, 23, false, false, false, basurillalog);
+ drawFlc(160, 15, 2441804, 0, 9, 23, false, false, true, basurillalog);
replaceBackpack(indicemochila, 715);
drawBackpack();
g_engine->_mouseManager->show();
@@ -3209,7 +3208,7 @@ void useScreenObject() {
pulsay = 133 - 7;
goToObject(currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], 9);
g_engine->_mouseManager->hide();
- drawFlc(110, 79, 2361800, 0, 9, 0, false, false, false, basurillalog);
+ drawFlc(110, 79, 2361800, 0, 9, 0, false, false, true, basurillalog);
replaceBackpack(indicemochila, 701);
drawBackpack();
handPantallaToBackground();
@@ -3227,7 +3226,7 @@ void useScreenObject() {
pulsay = 91 - 7;
goToObject(currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], 7);
g_engine->_mouseManager->hide();
- drawFlc(208, 0, 2382552, 0, 9, 21, false, false, false, basurillalog);
+ drawFlc(208, 0, 2382552, 0, 9, 21, false, false, true, basurillalog);
currentRoomData->bitmapasociados[0].puntbitmap = 0;
currentRoomData->bitmapasociados[0].tambitmap = 0;
currentRoomData->bitmapasociados[0].coordx = 0;
@@ -3288,7 +3287,7 @@ void useScreenObject() {
g_engine->_sound->waitForSoundEnd();
playVoc("PUFF", 191183, 18001);
animateOpen2(0, 1);
- drawFlc(180, 50, 2464240, 0, 9, 22, false, false, false, basurillalog);
+ drawFlc(180, 50, 2464240, 0, 9, 22, false, false, true, basurillalog);
salirdeljuego = true;
} else
drawText(Random(11) + 1022);
@@ -3410,7 +3409,7 @@ void useScreenObject() {
animateOpen2(0, 1);
playVoc("FUEGO", 72598, 9789);
if (vasijapuesta) {
- drawFlc(108, 0, 2296092, 0, 9, 0, false, false, false, basurillalog);
+ drawFlc(108, 0, 2296092, 0, 9, 0, false, false, true, basurillalog);
{
RoomBitmapRegister &with = currentRoomData->bitmapasociados[0];
@@ -3424,7 +3423,7 @@ void useScreenObject() {
for (indmoch = 10; indmoch <= 13; indmoch++)
currentRoomData->mouseGrid[indlista][indmoch] = 12;
} else
- drawFlc(108, 0, 2231140, 0, 9, 0, false, false, false, basurillalog);
+ drawFlc(108, 0, 2231140, 0, 9, 0, false, false, true, basurillalog);
g_engine->_mouseManager->show();
} break;
}
Commit: 3e7f4a1247720e6f0f9b08f1cad4a17f4aff9e06
https://github.com/scummvm/scummvm/commit/3e7f4a1247720e6f0f9b08f1cad4a17f4aff9e06
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:47+02:00
Commit Message:
TOT: Implements missing effect 11
Changed paths:
engines/tot/game.cpp
engines/tot/graphics.cpp
engines/tot/soundman.cpp
engines/tot/util.cpp
diff --git a/engines/tot/game.cpp b/engines/tot/game.cpp
index c65da95dca2..8dbcfa41d7d 100644
--- a/engines/tot/game.cpp
+++ b/engines/tot/game.cpp
@@ -307,7 +307,7 @@ int engine_start() {
desactivagrabar = false;
}
- boolean enforceSecondPart = true;
+ boolean enforceSecondPart = false;
if(enforceSecondPart) { //DEBUG
completadalista1 = true;
completadalista2 = true;
diff --git a/engines/tot/graphics.cpp b/engines/tot/graphics.cpp
index 6cd3b7f0805..20c299f7043 100644
--- a/engines/tot/graphics.cpp
+++ b/engines/tot/graphics.cpp
@@ -180,11 +180,15 @@ void loadPalette(Common::String paletteName) {
g_engine->_graphics->setPalette(pal);
}
+void updateSceneArea() {
+ g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
+ g_engine->_screen->update();
+}
void effect(byte numeroefecto, boolean pasaranegro, byte *pantalla2) {
int i1, i2, i3, j1, j2, j3;
- bool enabled = false;
- // numeroefecto = 1;
+ // bool enabled = false;
+ bool enabled = true;
byte * screenBuf = (byte *)g_engine->_screen->getPixels();
// Disable effects for now
@@ -199,7 +203,6 @@ void effect(byte numeroefecto, boolean pasaranegro, byte *pantalla2) {
error("effect(): contadorpc (274)");
debug("Effect %d, pasaraanegro=%d", numeroefecto, pasaranegro);
if (pasaranegro)
-
switch (numeroefecto) {
case 1: {
for (i1 = 0; i1 <= 69; i1++) {
@@ -346,26 +349,28 @@ void effect(byte numeroefecto, boolean pasaranegro, byte *pantalla2) {
}
} break;
case 11: {
- // for (i2 = 0; i2 <= 3; i2++) {
- // j1 = 1 + i2;
- // for (i1 = (1 + i2); i1 <= (16 - i2); i1++) {
- // bar(((i1 - 1) * 20), ((j1 - 1) * 20), ((i1 - 1) * 20 + 19), ((j1 - 1) * 20 + 19), 0);
- // delay(8);
- // }
- // for (j1 = (2 + i2); j1 <= (7 - i2); j1++) {
- // bar(((i1 - 1) * 20), ((j1 - 1) * 20), ((i1 - 1) * 20 + 19), ((j1 - 1) * 20 + 19), 0);
- // delay(8);
- // }
- // for (i1 = (16 - i2); i1 >= (1 + i2); i1--) {
- // bar(((i1 - 1) * 20), ((j1 - 1) * 20), ((i1 - 1) * 20 + 19), ((j1 - 1) * 20 + 19), 0);
- // delay(8);
- // }
- // for (j1 = (6 - i2); j1 >= (2 + i2); j1--) {
- // bar(((i1 - 1) * 20), ((j1 - 1) * 20), ((i1 - 1) * 20 + 19), ((j1 - 1) * 20 + 19), 0);
- // delay(8);
- // }
- // }
- drawScreen(pantalla2);
+ for (i2 = 0; i2 <= 3; i2++) {
+ j1 = 1 + i2;
+ for (i1 = (1 + i2); i1 <= (16 - i2); i1++) {
+ bar(((i1 - 1) * 20), ((j1 - 1) * 20), ((i1 - 1) * 20 + 19), ((j1 - 1) * 20 + 19), 0);
+ delay(8);
+ }
+ i1--;
+ for (j1 = (2 + i2); j1 <= (7 - i2); j1++) {
+ bar(((i1 - 1) * 20), ((j1 - 1) * 20), ((i1 - 1) * 20 + 19), ((j1 - 1) * 20 + 19), 0);
+ delay(8);
+ }
+ j1--;
+ for (i1 = (16 - i2); i1 >= (1 + i2); i1--) {
+ bar(((i1 - 1) * 20), ((j1 - 1) * 20), ((i1 - 1) * 20 + 19), ((j1 - 1) * 20 + 19), 0);
+ delay(8);
+ }
+ i1++;
+ for (j1 = (6 - i2); j1 >= (2 + i2); j1--) {
+ bar(((i1 - 1) * 20), ((j1 - 1) * 20), ((i1 - 1) * 20 + 19), ((j1 - 1) * 20 + 19), 0);
+ delay(8);
+ }
+ }
} break;
case 12: {
for (i1 = 1; i1 <= 15000; i1++) {
@@ -547,51 +552,51 @@ void effect(byte numeroefecto, boolean pasaranegro, byte *pantalla2) {
}
} break;
case 11: {
- // for (i2 = 0; i2 <= 3; i2 ++) {
- // j1 = 1 + i2;
- // for (i1 = (1 + i2); i1 <= (16 - i2); i1 ++) {
- // for (j3 = ((j1 - 1) * 20); j3 <= ((j1 - 1) * 20 + 19); j3 ++){
- // byte *buf = pantalla2 + 4 + (j3 * 320) + ((i1 - 1) * 20);
- // Common::copy(buf, buf + 20, screenBuf + (j3 * 320) + ((i1 - 1) * 20));
- // g_engine->_screen->markAllDirty();
- // g_engine->_screen->update();
- // }
- // // delay(8);
- // }
- // for (j1 = (2 + i2); j1 <= (7 - i2); j1 ++) {
- // for (j3 = ((j1 - 1) * 20); j3 <= ((j1 - 1) * 20 + 19); j3 ++) {
- // byte *buf = pantalla2 + 4 + (j3 * 320) + ((i1 - 1) * 20);
- // Common::copy(buf, buf + 20, screenBuf + (j3 * 320) + ((i1 - 1) * 20));
- // g_engine->_screen->markAllDirty();
- // g_engine->_screen->update();
- // // move(ptr(seg(pantalla2), (ofs(pantalla2) +4 + (j3 * 320) + ((i1 - 1) * 20))), ptr(0xa000, ((j3 * 320) + ((i1 - 1) * 20))), 20);
- // }
- // // delay(8);
- // }
- // for (i1 = (16 - i2); i1 > (1 + i2); i1 --) {
- // for (j3 = ((j1 - 1) * 20); j3 <= ((j1 - 1) * 20 + 19); j3 ++) {
- // byte *buf = pantalla2 + 4 + (j3 * 320) + ((i1 - 1) * 20);
- // Common::copy(buf, buf + 20, screenBuf + (j3 * 320) + ((i1 - 1) * 20));
- // g_engine->_screen->markAllDirty();
- // g_engine->_screen->update();
- // // move(ptr(seg(pantalla2), (ofs(pantalla2) +4 + (j3 * 320) + ((i1 - 1) * 20))), ptr(0xa000, ((j3 * 320) + ((i1 - 1) * 20))), 20);
- // }
- // delay(8);
- // }
- // // i1 = 1;
- // for (j1 = (6 - i2); j1 >= (2 + i2); j1 --) {
- // for (j3 = ((j1 - 1) * 20); j3 <= ((j1 - 1) * 20 + 19); j3 ++) {
- // byte *buf = pantalla2 + 4 + (j3 * 320) + ((i1 - 1) * 20);
- // Common::copy(buf, buf + 20, screenBuf + (j3 * 320) + ((i1 - 1) * 20));
- // g_engine->_screen->markAllDirty();
- // g_engine->_screen->update();
- // // move(ptr(seg(pantalla2), (ofs(pantalla2) +4 + (j3 * 320) + ((i1 - 1) * 20))), ptr(0xa000, ((j3 * 320) + ((i1 - 1) * 20))), 20);
- // }
- // delay(8);
- // }
- // }
- drawScreen(pantalla2);
+ g_engine->_screen->drawLine(0, 141, 320, 141, 220);
+
+ for (i2 = 0; i2 <= 3; i2 ++) {
+ j1 = 1 + i2;
+ for (i1 = (1 + i2); i1 <= (16 - i2); i1 ++) {
+ for (j3 = ((j1 - 1) * 20); j3 <= ((j1 - 1) * 20 + 19); j3 ++) {
+ byte *buf = pantalla2 + 4 + (j3 * 320) + ((i1 - 1) * 20);
+ Common::copy(buf, buf + 20, screenBuf + ((j3 * 320) + ((i1 - 1) * 20)));
+ // move(ptr(seg(pantalla2), (ofs(pantalla2) +4 + (j3 * 320) + ((i1 - 1) * 20))), ptr(0xa000, ((j3 * 320) + ((i1 - 1) * 20))), 20);
+ }
+ updateSceneArea();
+ delay(8);
+ }
+ i1--;
+ for (j1 = (2 + i2); j1 <= (7 - i2); j1 ++) {
+ for (j3 = ((j1 - 1) * 20); j3 <= ((j1 - 1) * 20 + 19); j3 ++) {
+ byte *buf = pantalla2 + 4 + (j3 * 320) + ((i1 - 1) * 20);
+ Common::copy(buf, buf + 20, screenBuf + ((j3 * 320) + ((i1 - 1) * 20)));
+ // move(ptr(seg(pantalla2), (ofs(pantalla2) +4 + (j3 * 320) + ((i1 - 1) * 20))), ptr(0xa000, ((j3 * 320) + ((i1 - 1) * 20))), 20);
+ }
+ updateSceneArea();
+ delay(8);
+ }
+ j1--;
+ for (i1 = (16 - i2); i1 >= (1 + i2); i1 --) {
+ for (j3 = ((j1 - 1) * 20); j3 <= ((j1 - 1) * 20 + 19); j3 ++) {
+ byte *buf = pantalla2 + 4 + (j3 * 320) + ((i1 - 1) * 20);
+ Common::copy(buf, buf + 20, screenBuf + ((j3 * 320) + ((i1 - 1) * 20)));
+ // move(ptr(seg(pantalla2), (ofs(pantalla2) +4 + (j3 * 320) + ((i1 - 1) * 20))), ptr(0xa000, ((j3 * 320) + ((i1 - 1) * 20))), 20);
+ }
+ updateSceneArea();
+ delay(8);
+ }
+ i1++;
+ for (j1 = (6 - i2); j1 >= (2 + i2); j1 --) {
+ for (j3 = ((j1 - 1) * 20); j3 <= ((j1 - 1) * 20 + 19); j3 ++) {
+ byte *buf = pantalla2 + 4 + (j3 * 320) + ((i1 - 1) * 20);
+ Common::copy(buf, buf + 20, screenBuf + ((j3 * 320) + ((i1 - 1) * 20)));
+ // move(ptr(seg(pantalla2), (ofs(pantalla2) +4 + (j3 * 320) + ((i1 - 1) * 20))), ptr(0xa000, ((j3 * 320) + ((i1 - 1) * 20))), 20);
+ }
+ updateSceneArea();
+ delay(8);
+ }
+ }
} break;
case 12: {
for (i1 = 1; i1 <= 15000; i1++) {
diff --git a/engines/tot/soundman.cpp b/engines/tot/soundman.cpp
index 11ec8c28305..d32657eac97 100644
--- a/engines/tot/soundman.cpp
+++ b/engines/tot/soundman.cpp
@@ -136,7 +136,7 @@ void SoundManager::setSfxBalance(bool left, bool right) {
void SoundManager::setMusicVolume(int volume) {
- debug("Setting music volume to =%d", volume);
+ // debug("Setting music volume to =%d", volume);
_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, volume);
ConfMan.setInt("music_volume", volume);
ConfMan.flushToDisk();
diff --git a/engines/tot/util.cpp b/engines/tot/util.cpp
index 656a322105f..fbd1776ecc0 100644
--- a/engines/tot/util.cpp
+++ b/engines/tot/util.cpp
@@ -120,7 +120,7 @@ void waitForKey() {
while (!teclapulsada && !g_engine->shouldQuit())
{
while (g_system->getEventManager()->pollEvent(e)) {
- if (e.type == Common::EVENT_KEYUP) {
+ if (e.type == Common::EVENT_KEYDOWN) {
teclapulsada = true;
}
}
Commit: ed259e730060470ea21a217e1b955310ea69ef15
https://github.com/scummvm/scummvm/commit/ed259e730060470ea21a217e1b955310ea69ef15
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:47+02:00
Commit Message:
TOT: Adds a common clock for effects
Changed paths:
engines/tot/chrono.cpp
engines/tot/chrono.h
engines/tot/graphics.cpp
diff --git a/engines/tot/chrono.cpp b/engines/tot/chrono.cpp
index e63aa2d396c..12270be22f9 100644
--- a/engines/tot/chrono.cpp
+++ b/engines/tot/chrono.cpp
@@ -54,23 +54,16 @@ void ChronoManager::updateChrono() {
tocapintar = false;
}
- if ((currentTime - _lastTickEffect) >= kFrameEffectMs) {
- tocapintareffect = true;
- _lastTickEffect = currentTime;
- }
- else {
- tocapintareffect = false;
- }
}
-bool ChronoManager::shouldPaintEffect(){
- uint32 currentTime = g_system->getMillis();
- uint32 diff = (currentTime - _lastTickEffect);
- if (diff >= kFrameEffectMs){
- _lastTickEffect = currentTime;
+bool ChronoManager::shouldPaintEffect(int speed){
+ uint32 curTime = g_system->getMillis();
+ // _lastEffectRender += g_system->getMillis();
+ if((curTime - _lastEffectRender) >= kFrameEffectMs * speed) {
+ _lastEffectRender = curTime;
return true;
}
- return false;
+ else return false;
}
void Tot::ChronoManager::delay(int ms) {
diff --git a/engines/tot/chrono.h b/engines/tot/chrono.h
index d3d9ba4df3e..55cd7b6008d 100644
--- a/engines/tot/chrono.h
+++ b/engines/tot/chrono.h
@@ -34,7 +34,7 @@ extern bool tocapintar, tocapintar2, tocapintareffect;
const int kFrameMs = 30;
// const int kFrameMs = 50;
const int kDoubleFrameMultiplier = 3;
-const int kFrameEffectMs = 5;
+const int kFrameEffectMs = 10;
class ChronoManager {
private:
@@ -42,13 +42,14 @@ private:
uint32 _lastTickEffect = 0;
uint32 _lastDoubleTick = 0;
byte tocapintarTick = 0;
+ uint32 _lastEffectRender = 0;
public:
ChronoManager(/* args */);
~ChronoManager();
void updateChrono();
void delay(int ms);
- bool shouldPaintEffect();
+ bool shouldPaintEffect(int speed);
byte _speedMultiplier = 1;
};
diff --git a/engines/tot/graphics.cpp b/engines/tot/graphics.cpp
index 20c299f7043..f10ddeb98c8 100644
--- a/engines/tot/graphics.cpp
+++ b/engines/tot/graphics.cpp
@@ -180,9 +180,11 @@ void loadPalette(Common::String paletteName) {
g_engine->_graphics->setPalette(pal);
}
-void updateSceneArea() {
- g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
- g_engine->_screen->update();
+void updateSceneAreaIfNeeded(int speed = 1) {
+ if(g_engine->_chrono->shouldPaintEffect(speed)) {
+ g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
+ g_engine->_screen->update();
+ }
}
void effect(byte numeroefecto, boolean pasaranegro, byte *pantalla2) {
@@ -190,6 +192,7 @@ void effect(byte numeroefecto, boolean pasaranegro, byte *pantalla2) {
// bool enabled = false;
bool enabled = true;
+ // numeroefecto = 13;
byte * screenBuf = (byte *)g_engine->_screen->getPixels();
// Disable effects for now
if (!enabled) {
@@ -207,28 +210,24 @@ void effect(byte numeroefecto, boolean pasaranegro, byte *pantalla2) {
case 1: {
for (i1 = 0; i1 <= 69; i1++) {
line(0, (i1 * 2), 319, (i1 * 2), 0);
- g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
- g_engine->_screen->update();
+ updateSceneAreaIfNeeded();
delay(5);
}
for (i1 = 70; i1 >= 1; i1--) {
line(0, (i1 * 2 - 1), 319, (i1 * 2 - 1), 0);
- g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
- g_engine->_screen->update();
+ updateSceneAreaIfNeeded();
delay(5);
}
} break;
case 2: {
for (i1 = 70; i1 >= 1; i1--) {
line(0, (i1 * 2 - 1), 319, (i1 * 2 - 1), 0);
- g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
- g_engine->_screen->update();
+ updateSceneAreaIfNeeded();
delay(5);
}
for (i1 = 0; i1 <= 69; i1++) {
line(0, (i1 * 2), 319, (i1 * 2), 0);
- g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
- g_engine->_screen->update();
+ updateSceneAreaIfNeeded();
delay(5);
}
} break;
@@ -239,18 +238,15 @@ void effect(byte numeroefecto, boolean pasaranegro, byte *pantalla2) {
j1 = 10;
do {
bar((i1 - i2), (j1 - i2), (i1 + i2), (j1 + i2), 0);
- if(j1 % 40 == 0) {
- g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
- g_engine->_screen->update();
- }
+ // updateSceneAreaIfNeeded();
j1 += 20;
} while (j1 != 150);
i1 += 20;
+ updateSceneAreaIfNeeded();
} while (i1 != 330);
}
bar(0, 0, 319, 139, 0);
- g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
- g_engine->_screen->update();
+ updateSceneAreaIfNeeded();
} break;
case 4: {
for (i2 = 1; i2 <= 22; i2++) {
@@ -258,8 +254,7 @@ void effect(byte numeroefecto, boolean pasaranegro, byte *pantalla2) {
for (j1 = 1; j1 <= 7; j1++) {
if ((i1 + j1) == (i2 + 1)) {
bar(((i1 - 1) * 20), ((j1 - 1) * 20), ((i1 - 1) * 20 + 19), ((j1 - 1) * 20 + 19), 0);
- g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
- g_engine->_screen->update();
+ updateSceneAreaIfNeeded();
delay(8);
}
}
@@ -268,66 +263,46 @@ void effect(byte numeroefecto, boolean pasaranegro, byte *pantalla2) {
case 5: {
for (j1 = 0; j1 <= 139; j1++) {
line(0, j1, 319, (139 - j1), 0);
- if(j1 % 5 == 0) {
- g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
- g_engine->_screen->update();
- }
+ updateSceneAreaIfNeeded();
}
for (j1 = 318; j1 >= 1; j1--) {
line(j1, 0, (319 - j1), 139, 0);
- if(j1 % 5 == 0) {
- g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
- g_engine->_screen->update();
- }
+ updateSceneAreaIfNeeded();
}
} break;
case 6: {
for (i1 = 0; i1 < 70; i1++) {
rectangle(i1, i1, (319 - i1), (139 - i1), 0);
delay(5);
- g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
- g_engine->_screen->update();
+ updateSceneAreaIfNeeded();
}
} break;
case 7: {
for (i1 = 69; i1 >= 0; i1--) {
rectangle(i1, i1, (319 - i1), (139 - i1), 0);
- g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
- g_engine->_screen->update();
+ updateSceneAreaIfNeeded();
}
} break;
case 8: {
for (i1 = 0; i1 <= 319; i1++) {
line(0, 139, i1, 0, 0);
- if(i1 % 5 == 0) {
- g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
- g_engine->_screen->update();
- }
+ updateSceneAreaIfNeeded();
}
for (i1 = 1; i1 <= 139; i1++) {
line(0, 139, 319, i1, 0);
- if(i1 % 5 == 0) {
- g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
- g_engine->_screen->update();
- }
+ updateSceneAreaIfNeeded();
}
} break;
case 9: {
for (i1 = 319; i1 >= 0; i1--) {
line(319, 139, i1, 0, 0);
- if(i1 % 5 == 0) {
- g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
- g_engine->_screen->update();
- }
+ updateSceneAreaIfNeeded();
}
for (i1 = 1; i1 <= 139; i1++) {
line(319, 139, 0, i1, 0);
- if(i1 % 5 == 0) {
- g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
- g_engine->_screen->update();
- }
+ updateSceneAreaIfNeeded();
}
} break;
case 10: {
@@ -335,15 +310,13 @@ void effect(byte numeroefecto, boolean pasaranegro, byte *pantalla2) {
if ((j1 % 2) == 0)
for (i1 = 1; i1 <= 16; i1++) {
bar(((i1 - 1) * 20), ((j1 - 1) * 20), ((i1 - 1) * 20 + 19), ((j1 - 1) * 20 + 19), 0);
- g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
- g_engine->_screen->update();
+ updateSceneAreaIfNeeded();
delay(8);
}
else
for (i1 = 16; i1 >= 1; i1--) {
bar(((i1 - 1) * 20), ((j1 - 1) * 20), ((i1 - 1) * 20 + 19), ((j1 - 1) * 20 + 19), 0);
- g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
- g_engine->_screen->update();
+ updateSceneAreaIfNeeded();
delay(8);
}
}
@@ -353,21 +326,25 @@ void effect(byte numeroefecto, boolean pasaranegro, byte *pantalla2) {
j1 = 1 + i2;
for (i1 = (1 + i2); i1 <= (16 - i2); i1++) {
bar(((i1 - 1) * 20), ((j1 - 1) * 20), ((i1 - 1) * 20 + 19), ((j1 - 1) * 20 + 19), 0);
+ updateSceneAreaIfNeeded();
delay(8);
}
i1--;
for (j1 = (2 + i2); j1 <= (7 - i2); j1++) {
bar(((i1 - 1) * 20), ((j1 - 1) * 20), ((i1 - 1) * 20 + 19), ((j1 - 1) * 20 + 19), 0);
+ updateSceneAreaIfNeeded();
delay(8);
}
j1--;
for (i1 = (16 - i2); i1 >= (1 + i2); i1--) {
bar(((i1 - 1) * 20), ((j1 - 1) * 20), ((i1 - 1) * 20 + 19), ((j1 - 1) * 20 + 19), 0);
+ updateSceneAreaIfNeeded();
delay(8);
}
i1++;
for (j1 = (6 - i2); j1 >= (2 + i2); j1--) {
bar(((i1 - 1) * 20), ((j1 - 1) * 20), ((i1 - 1) * 20 + 19), ((j1 - 1) * 20 + 19), 0);
+ updateSceneAreaIfNeeded();
delay(8);
}
}
@@ -378,52 +355,38 @@ void effect(byte numeroefecto, boolean pasaranegro, byte *pantalla2) {
j2 = Random(138);
bar(i2, j2, (i2 + 2), (j2 + 2), 0);
putpixel(Random(320), Random(139), 0);
- if(i1 % 100 == 0) {
- g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
- g_engine->_screen->update();
- }
+ updateSceneAreaIfNeeded(5);
}
bar(0, 0, 319, 139, 0);
- g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
- g_engine->_screen->update();
+ updateSceneAreaIfNeeded();
} break;
case 13: {
for (i1 = 319; i1 >= 0; i1--) {
line(i1, 0, i1, 139, 0);
- if(i1 % 5 == 0) {
- g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
- g_engine->_screen->update();
- }
+ updateSceneAreaIfNeeded();
}
} break;
case 14: {
for (i1 = 0; i1 <= 319; i1++) {
line(i1, 0, i1, 139, 0);
- if(i1 % 5 == 0) {
- g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
- g_engine->_screen->update();
- }
+ updateSceneAreaIfNeeded();
}
} break;
case 15: {
for (j1 = 0; j1 <= 70; j1++) {
Common::copy(screenBuf + (j1 * 320), screenBuf + (j1 * 320) + 320, screenBuf + ((j1 + 1) *320));
- // move(ptr(0xa000, (j1 * 320)), ptr(0xa000, ((j1 + 1) * 320)), 320);
line(0, j1, 319, j1, 0);
Common::copy(screenBuf + ((139 - j1) * 320), screenBuf + ((139 - j1) * 320) + 320, screenBuf + ((138 - j1) * 320));
- // move(ptr(0xa000, ((139 - j1) * 320)), ptr(0xa000, ((138 - j1) * 320)), 320);
line(0, (139 - j1), 319, (139 - j1), 0);
delay(2);
- g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
- g_engine->_screen->update();
+ updateSceneAreaIfNeeded();
}
delay(5);
for (j1 = 0; j1 <= 160; j1++) {
line(0, 68, j1, 68, 0);
line(319, 68, (319 - j1), 68, 0);
- g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
- g_engine->_screen->update();
+ updateSceneAreaIfNeeded();
}
} break;
}
@@ -433,20 +396,15 @@ void effect(byte numeroefecto, boolean pasaranegro, byte *pantalla2) {
for (i1 = 0; i1 <= 69; i1++) {
byte *src = pantalla2 + (i1 * 640) + 4;
Common::copy(src, src + 320, screenBuf + (i1 * 640));
- // move(ptr(seg(pantalla2), (ofs(pantalla2) + (i1 * 640) + 4)), ptr(0xa000, (i1 * 640)), 320);
- g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
- g_engine->_screen->update();
+
+ updateSceneAreaIfNeeded();
delay(5);
}
for (i1 = 70; i1 >= 1; i1--) {
byte *src = pantalla2 + (i1 * 640) - 320 + 4;
Common::copy(src, src + 320, screenBuf + (i1 * 640) - 320);
- // move(ptr(seg(pantalla2), (ofs(pantalla2) + ((i1 * 640) - 320) + 4)), ptr(0xa000, ((i1 * 640) - 320)), 320);
- g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
- g_engine->_screen->update();
+ updateSceneAreaIfNeeded();
delay(5);
-
- // delay(5);
}
} break;
case 2:
@@ -456,17 +414,13 @@ void effect(byte numeroefecto, boolean pasaranegro, byte *pantalla2) {
for (i1 = 70; i1 >= 1; i1--) {
byte *src = pantalla2 + ((i1 * 640) - 320) + 4;
Common::copy(src, src + 320, screenBuf + (i1 * 640) - 320);
- // move(ptr(seg(pantalla2), (ofs(pantalla2) + ((i1 * 640) - 320) + 4)), ptr(0xa000, ((i1 * 640) - 320)), 320);
- g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
- g_engine->_screen->update();
+ updateSceneAreaIfNeeded();
delay(5);
}
for (i1 = 0; i1 <= 69; i1++) {
byte *src = pantalla2 + (i1 * 640) + 4;
Common::copy(src, src + 320, screenBuf + (i1 * 640));
- // move(ptr(seg(pantalla2), (ofs(pantalla2) + (i1 * 640) + 4)), ptr(0xa000, (i1 * 640)), 320);
- g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
- g_engine->_screen->update();
+ updateSceneAreaIfNeeded();
delay(5);
}
} break;
@@ -480,14 +434,10 @@ void effect(byte numeroefecto, boolean pasaranegro, byte *pantalla2) {
for (i3 = (j1 - i2); i3 <= (j1 + i2); i3++) {
byte *src = pantalla2 + + 4 + (i3 * 320) + + (i1 - i2);
Common::copy(src, src + (i2 * 2), screenBuf + (i3 * 320) + (i1 - i2));
- // move(ptr(seg(pantalla2), (ofs(pantalla2) + 4 + (i3 * 320) + (i1 - i2))), ptr(0xa000, ((i3 * 320) + (i1 - i2))), (i2 * 2));
}
j1 += 20;
} while (j1 != 150);
- if(i1 % 40 == 0) {
- g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
- g_engine->_screen->update();
- }
+ updateSceneAreaIfNeeded();
i1 += 20;
} while (i1 != 330);
}
@@ -501,11 +451,7 @@ void effect(byte numeroefecto, boolean pasaranegro, byte *pantalla2) {
for (i3 = ((j1 - 1) * 20); i3 <= ((j1 - 1) * 20 + 19); i3++) {
byte *src = pantalla2 + + 4 + (i3 * 320) + ((i1 - 1) * 20);
Common::copy(src, src + 20, screenBuf + (i3 * 320) + ((i1 - 1) * 20));
- // move(ptr(seg(pantalla2), (ofs(pantalla2) + 4 + (i3 * 320) + ((i1 - 1) * 20))), ptr(0xa000, ((i3 * 320) + ((i1 - 1) * 20))), 20);
- if(i3 % 4 == 0) {
- g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
- g_engine->_screen->update();
- }
+ updateSceneAreaIfNeeded();
}
delay(8);
}
@@ -517,10 +463,8 @@ void effect(byte numeroefecto, boolean pasaranegro, byte *pantalla2) {
for (j1 = i1; j1 <= (139 - i1); j1++) {
byte *src = pantalla2 + 4 + (j1 * 320) + i1;
Common::copy(src, src + 319 - (i1 * 2), screenBuf + (j1 * 320) + i1);
- // move(ptr(seg(pantalla2), (ofs(pantalla2) + 4 + (j1 * 320) + i1)), ptr(0xa000, ((j1 * 320) + i1)), (319 - (i1 * 2)));
}
- g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
- g_engine->_screen->update();
+ updateSceneAreaIfNeeded();
}
} break;
case 10: {
@@ -531,12 +475,8 @@ void effect(byte numeroefecto, boolean pasaranegro, byte *pantalla2) {
byte *src = pantalla2 + 4 + (j3 * 320) + ((i1 - 1) *20);
Common::copy(src, src + 20, screenBuf + (j3 * 320) + ((i1 - 1) * 20));
- // move(ptr(seg(pantalla2), (ofs(pantalla2) + 4 + (j3 * 320) + ((i1 - 1) * 20))), ptr(0xa000, ((j3 * 320) + ((i1 - 1) * 20))), 20);
}
- // if(i1 % 300 == 0) {
- g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
- g_engine->_screen->update();
- // }
+ updateSceneAreaIfNeeded();
delay(8);
}
else
@@ -545,24 +485,23 @@ void effect(byte numeroefecto, boolean pasaranegro, byte *pantalla2) {
byte *src = pantalla2 + 4 + (j3 * 320) + ((i1 - 1) *20);
Common::copy(src, src + 20, screenBuf + (j3 * 320) + ((i1 - 1) * 20));
}
- g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
- g_engine->_screen->update();
+ updateSceneAreaIfNeeded();
delay(8);
}
}
} break;
case 11: {
g_engine->_screen->drawLine(0, 141, 320, 141, 220);
-
+ long lastRender = 0;
+ long rendertime = 10;
for (i2 = 0; i2 <= 3; i2 ++) {
j1 = 1 + i2;
for (i1 = (1 + i2); i1 <= (16 - i2); i1 ++) {
for (j3 = ((j1 - 1) * 20); j3 <= ((j1 - 1) * 20 + 19); j3 ++) {
byte *buf = pantalla2 + 4 + (j3 * 320) + ((i1 - 1) * 20);
Common::copy(buf, buf + 20, screenBuf + ((j3 * 320) + ((i1 - 1) * 20)));
- // move(ptr(seg(pantalla2), (ofs(pantalla2) +4 + (j3 * 320) + ((i1 - 1) * 20))), ptr(0xa000, ((j3 * 320) + ((i1 - 1) * 20))), 20);
}
- updateSceneArea();
+ updateSceneAreaIfNeeded();
delay(8);
}
i1--;
@@ -570,9 +509,8 @@ void effect(byte numeroefecto, boolean pasaranegro, byte *pantalla2) {
for (j3 = ((j1 - 1) * 20); j3 <= ((j1 - 1) * 20 + 19); j3 ++) {
byte *buf = pantalla2 + 4 + (j3 * 320) + ((i1 - 1) * 20);
Common::copy(buf, buf + 20, screenBuf + ((j3 * 320) + ((i1 - 1) * 20)));
- // move(ptr(seg(pantalla2), (ofs(pantalla2) +4 + (j3 * 320) + ((i1 - 1) * 20))), ptr(0xa000, ((j3 * 320) + ((i1 - 1) * 20))), 20);
}
- updateSceneArea();
+ updateSceneAreaIfNeeded();
delay(8);
}
j1--;
@@ -580,20 +518,17 @@ void effect(byte numeroefecto, boolean pasaranegro, byte *pantalla2) {
for (j3 = ((j1 - 1) * 20); j3 <= ((j1 - 1) * 20 + 19); j3 ++) {
byte *buf = pantalla2 + 4 + (j3 * 320) + ((i1 - 1) * 20);
Common::copy(buf, buf + 20, screenBuf + ((j3 * 320) + ((i1 - 1) * 20)));
- // move(ptr(seg(pantalla2), (ofs(pantalla2) +4 + (j3 * 320) + ((i1 - 1) * 20))), ptr(0xa000, ((j3 * 320) + ((i1 - 1) * 20))), 20);
}
- updateSceneArea();
+ updateSceneAreaIfNeeded();
delay(8);
}
i1++;
for (j1 = (6 - i2); j1 >= (2 + i2); j1 --) {
for (j3 = ((j1 - 1) * 20); j3 <= ((j1 - 1) * 20 + 19); j3 ++) {
-
byte *buf = pantalla2 + 4 + (j3 * 320) + ((i1 - 1) * 20);
Common::copy(buf, buf + 20, screenBuf + ((j3 * 320) + ((i1 - 1) * 20)));
- // move(ptr(seg(pantalla2), (ofs(pantalla2) +4 + (j3 * 320) + ((i1 - 1) * 20))), ptr(0xa000, ((j3 * 320) + ((i1 - 1) * 20))), 20);
}
- updateSceneArea();
+ updateSceneAreaIfNeeded();
delay(8);
}
}
@@ -616,29 +551,20 @@ void effect(byte numeroefecto, boolean pasaranegro, byte *pantalla2) {
byte *src3 = pantalla2 + 4 + (j2 * 320) + i2;
Common::copy(src3, src3 + 1, screenBuf + (j2 * 320) + i2);
- if(i1 % 300 == 0) {
- g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
- g_engine->_screen->update();
- }
+ updateSceneAreaIfNeeded();
// move(ptr(seg(pantalla2), (ofs(pantalla2) + 4 + (j2 * 320) + i2)), ptr(0xa000, ((j2 * 320) + i2)), 1);
}
drawScreen(pantalla2);
} break;
case 13: {
debug("case 13!");
-
for (i1 = 0; i1 <= 319; i1++) {
for (j1 = 0; j1 <= 139; j1++) {
int color = pantalla2[4 + (j1 * 320) + i1];
*((byte *)g_engine->_screen->getBasePtr(i1, j1)) = color;
-
-
- }
- // if (g_engine->_chrono->shouldPaintEffect()) {
- if(i1 % 10 == 0) {
- g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
- g_engine->_screen->update();
}
+ delay(2);
+ updateSceneAreaIfNeeded(3);
}
} break;
case 14: {
@@ -647,31 +573,22 @@ void effect(byte numeroefecto, boolean pasaranegro, byte *pantalla2) {
int color = pantalla2[4 + (j1 * 320) + i1];
*((byte *)g_engine->_screen->getBasePtr(i1, j1)) = color;
}
- if(i1 % 10 == 0) {
- g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
- g_engine->_screen->update();
- }
+ updateSceneAreaIfNeeded();
}
} break;
case 15: {
for (j1 = 160; j1 > 0; j1--) {
line(j1, 69, (319 - j1), 69, 255);
- if(j1 % 4 == 0) {
- g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
- g_engine->_screen->update();
- }
+ updateSceneAreaIfNeeded();
}
- // delay(5);
+ delay(5);
for (j1 = 70; j1 > 0; j1--) {
byte *src1 = pantalla2 + 4 + j1 * 320;
byte *src2 = pantalla2 + 4 + (139 - j1) * 320;
Common::copy(src1, src1 + 320, screenBuf + j1 * 320);
Common::copy(src2, src2 + 320, screenBuf + (139 - j1) * 320);
- if(j1 % 2 == 0) {
- g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
- g_engine->_screen->update();
- }
+ updateSceneAreaIfNeeded();
}
} break;
}
Commit: f2e8a62c6c40ced0f0aa4cf0ab5279f8e4cb05a4
https://github.com/scummvm/scummvm/commit/f2e8a62c6c40ced0f0aa4cf0ab5279f8e4cb05a4
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:47+02:00
Commit Message:
TOT: Autosave when the original game does it
Changed paths:
engines/tot/dialog.cpp
engines/tot/game.cpp
engines/tot/routines.cpp
engines/tot/routines2.cpp
diff --git a/engines/tot/dialog.cpp b/engines/tot/dialog.cpp
index 33bb70c9598..7610f2b4776 100644
--- a/engines/tot/dialog.cpp
+++ b/engines/tot/dialog.cpp
@@ -542,6 +542,8 @@ void talk(byte person) {
step = ar;
fixTree(step);
saveConversations(conversationData, ar, person - 1);
+ // Make sure to autosave
+ g_engine->saveAutosaveIfEnabled();
verb.close();
delete ar;
diff --git a/engines/tot/game.cpp b/engines/tot/game.cpp
index 8dbcfa41d7d..cd597a5de05 100644
--- a/engines/tot/game.cpp
+++ b/engines/tot/game.cpp
@@ -785,10 +785,7 @@ void sceneChange() {
contadorpc = contadorpc2;
setRoomTrajectories(altoanimado, anchoanimado, RESTORE);
saveRoomData(currentRoomData, rooms);
-
// verifyCopyProtection();
- // fichpanta << datospantalla;
- // close(fichpanta);
// setSfxVolume(volumenfxizquierdo, volumenfxderecho);
switch (currentRoomData->doors[indicepuertas].pantallaquecarga) {
diff --git a/engines/tot/routines.cpp b/engines/tot/routines.cpp
index 9b7eedee8d5..a4aef545360 100644
--- a/engines/tot/routines.cpp
+++ b/engines/tot/routines.cpp
@@ -5053,7 +5053,7 @@ void hypertext(
/** Whether the text being said is part of a conversation or just descriptions */
boolean banderaconversa
) {
-
+ debug("hypertext");
regismht regmht;
byte insertarnombre, iht, iteracionesht, lineaht, anchoht;
@@ -5458,6 +5458,8 @@ void saveRoom(RoomFileRegister *room, Common::SeekableWriteStream *screenDataStr
void saveRoomData(RoomFileRegister *room, Common::SeekableWriteStream *stream) {
rooms->seek(room->codigo * roomRegSize, SEEK_SET);
saveRoom(room, stream);
+ // Make sure to autosave
+ g_engine->saveAutosaveIfEnabled();
}
/**
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
index b8a87977399..7bcea2862d5 100644
--- a/engines/tot/routines2.cpp
+++ b/engines/tot/routines2.cpp
@@ -439,7 +439,8 @@ void updateItem(uint itemPosition) {
regobj.usar[0] = 9;
invItemData->seek(itemPosition);
saveItemRegister(regobj, invItemData);
- debug("saved item %s", regobj.name.c_str());
+ // Make sure to autosave
+ g_engine->saveAutosaveIfEnabled();
}
void readItemRegister(Common::SeekableReadStream *stream, uint itemPos, InvItemRegister &thisRegObj) {
Commit: 66f2808da6530326f83c4d6c09a9cb959fcd3a6d
https://github.com/scummvm/scummvm/commit/66f2808da6530326f83c4d6c09a9cb959fcd3a6d
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:47+02:00
Commit Message:
TOT: Fix exiting the game during conversations
Changed paths:
engines/tot/dialog.cpp
engines/tot/graphics.cpp
engines/tot/routines.cpp
diff --git a/engines/tot/dialog.cpp b/engines/tot/dialog.cpp
index 7610f2b4776..f9ae4cc913a 100644
--- a/engines/tot/dialog.cpp
+++ b/engines/tot/dialog.cpp
@@ -498,7 +498,7 @@ void talk(byte person) {
matrizconversa[conversationIndex].insertString(" ...", auxilcadena);
}
l1 = l1->siguiente;
- } while ((l1->siguiente != NULL) && (l1 != NULL));
+ } while ((l1->siguiente != NULL) && (l1 != NULL) && !g_engine->shouldQuit());
l1 = l;
showDialogLine(matrizconversa, nuevonodo);
delete l;
@@ -506,7 +506,7 @@ void talk(byte person) {
auxilcadena = 0;
modifyTree(nuevonodo);
// verifyCopyProtection();
- while (pasorespuesta > 0) {
+ while (pasorespuesta > 0 && !g_engine->shouldQuit()) {
nuevonodo = pasorespuesta;
auxilcadena += 1;
if (odd(auxilcadena))
@@ -538,14 +538,18 @@ void talk(byte person) {
}
g_system->delayMillis(10);
} while (!endOfConversation && !g_engine->shouldQuit());
+
unloadTalkAnimations();
step = ar;
fixTree(step);
saveConversations(conversationData, ar, person - 1);
+
// Make sure to autosave
g_engine->saveAutosaveIfEnabled();
-
verb.close();
+ if(g_engine->shouldQuit()) {
+ return;
+ }
delete ar;
l1 = NULL;
g_engine->_mouseManager->hide();
diff --git a/engines/tot/graphics.cpp b/engines/tot/graphics.cpp
index f10ddeb98c8..d0dc09d2c27 100644
--- a/engines/tot/graphics.cpp
+++ b/engines/tot/graphics.cpp
@@ -491,7 +491,6 @@ void effect(byte numeroefecto, boolean pasaranegro, byte *pantalla2) {
}
} break;
case 11: {
- g_engine->_screen->drawLine(0, 141, 320, 141, 220);
long lastRender = 0;
long rendertime = 10;
for (i2 = 0; i2 <= 3; i2 ++) {
diff --git a/engines/tot/routines.cpp b/engines/tot/routines.cpp
index a4aef545360..44a8857a5b4 100644
--- a/engines/tot/routines.cpp
+++ b/engines/tot/routines.cpp
@@ -5292,7 +5292,7 @@ void hypertext(
free(fondotextht);
g_system->delayMillis(10);
- } while (regmht.encadenado);
+ } while (regmht.encadenado && !g_engine->shouldQuit());
numresp = regmht.respuesta;
g_engine->_mouseManager->show();
}
Commit: d646b6dfacdb4a5e4b4b9e95ed2fcaf8ddd62fde
https://github.com/scummvm/scummvm/commit/d646b6dfacdb4a5e4b4b9e95ed2fcaf8ddd62fde
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:47+02:00
Commit Message:
TOT: Implements resume game
Changed paths:
engines/tot/game.cpp
engines/tot/saveload.cpp
diff --git a/engines/tot/game.cpp b/engines/tot/game.cpp
index cd597a5de05..3c72e3120e2 100644
--- a/engines/tot/game.cpp
+++ b/engines/tot/game.cpp
@@ -41,196 +41,7 @@ bool showGameGrid = false;
bool drawObjectAreas = false;
void loadTemporaryGame() {
- // uint indiaux, indiaux2;
-
- // assign(partida, "GAME07.SAV");
-
- // if (ioresult != 0)
- // error("engine_start(): ioresult (322)");
- // partida >> regpartida;
- // drawMouseBackground(xraton, yraton);
- // longtray = regpartida.longtray;
- // indicetray = regpartida.indicetray;
- // codigoobjmochila = regpartida.codigoobjmochila;
- // volumenfxderecho = regpartida.volumenfxderecho;
- // volumenfxizquierdo = regpartida.volumenfxizquierdo;
- // volumenmelodiaderecho = regpartida.volumenmelodiaderecho;
- // volumenmelodiaizquierdo = regpartida.volumenmelodiaizquierdo;
- // oldxrejilla = regpartida.oldxrejilla;
- // oldyrejilla = regpartida.oldyrejilla;
- // animado.profundidad = regpartida.animadoprofundidad;
- // animado.dir = regpartida.animadodir;
- // animado.posx = regpartida.animadoposx;
- // animado.posy = regpartida.animadoposy;
- // iframe2 = regpartida.animadoiframe2;
- // zonaactual = regpartida.zonaactual;
- // zonadestino = regpartida.zonadestino;
- // oldzonadestino = regpartida.oldzonadestino;
- // posicioninv = regpartida.posicioninv;
- // numeroaccion = regpartida.numeroaccion;
- // oldnumeroacc = regpartida.oldnumeroacc;
- // pasos = regpartida.pasos;
- // indicepuertas = regpartida.indicepuertas;
- // direccionmovimiento = regpartida.direccionmovimiento;
- // iframe = regpartida.iframe;
- // if (regpartida.parte_del_juego != parte_del_juego) {
- // parte_del_juego = regpartida.parte_del_juego;
- // freeInventory();
- // loadObjects();
- // }
- // sello_quitado = regpartida.sello_quitado;
- // lista1 = regpartida.lista1;
- // lista2 = regpartida.lista2;
- // completadalista1 = regpartida.completadalista1;
- // completadalista2 = regpartida.completadalista2;
- // vasijapuesta = regpartida.vasijapuesta;
- // guadagna = regpartida.guadagna;
- // tridente = regpartida.tridente;
- // torno = regpartida.torno;
- // barro = regpartida.barro;
- // diablillo_verde = regpartida.diablillo_verde;
- // rojo_capturado = regpartida.rojo_capturado;
- // manual_torno = regpartida.manual_torno;
- // alacena_abierta = regpartida.alacena_abierta;
- // baul_abierto = regpartida.baul_abierto;
- // teleencendida = regpartida.teleencendida;
- // trampa_puesta = regpartida.trampa_puesta;
- // for (indiaux = 0; indiaux < inventoryIconCount; indiaux++) {
- // mobj[indiaux].bitmapIndex = regpartida.mobj[indiaux].bitmapIndex;
- // mobj[indiaux].codigo = regpartida.mobj[indiaux].codigo;
- // mobj[indiaux].nombreobj = regpartida.mobj[indiaux].nombreobj;
- // }
- // elemento1 = regpartida.elemento1;
- // elemento2 = regpartida.elemento2;
- // characterPosX = regpartida.xframe;
- // characterPosY = regpartida.yframe;
- // xframe2 = regpartida.xframe2;
- // yframe2 = regpartida.yframe2;
- // oldobjmochila = regpartida.oldobjmochila;
- // objetomochila = regpartida.objetomochila;
- // nombrepersonaje = regpartida.nombrepersonaje;
- // for(int i = 0; i < routePointCount; i++) {
- // regpartida.mainRoute[i].x = mainRoute[i].x;
- // regpartida.mainRoute[i].y = mainRoute[i].y;
- // }
- // for (indiaux = 0; indiaux < 300; indiaux++) {
- // trayec[indiaux].x = regpartida.trayec[indiaux].x;
- // trayec[indiaux].y = regpartida.trayec[indiaux].y;
- // }
- // for (indiaux = 0; indiaux < maxpersonajes; indiaux++) {
- // primera[indiaux] = regpartida.primera[indiaux];
- // lprimera[indiaux] = regpartida.lprimera[indiaux];
- // cprimera[indiaux] = regpartida.cprimera[indiaux];
- // libro[indiaux] = regpartida.libro[indiaux];
- // caramelos[indiaux] = regpartida.caramelos[indiaux];
- // }
-
- // for (indiaux = 0; indiaux < 5; indiaux++) {
- // cavernas[indiaux] = regpartida.cavernas[indiaux];
- // firstList[indiaux] = regpartida.firstList[indiaux];
- // secondList[indiaux] = regpartida.secondList[indiaux];
- // }
- // for (indiaux = 0; indiaux < 4; indiaux++) {
- // hornacina[0][indiaux] = regpartida.hornacina[0][indiaux];
- // hornacina[1][indiaux] = regpartida.hornacina[1][indiaux];
- // }
- // close(partida);
- // totalFadeOut(0);
- // clear();
- // loadPalette("DEFAULT");
- // loadScreenData(regpartida.numeropantalla);
- // switch (roomData->codigo) {
- // case 2: {
- // if (teleencendida)
- // autoPlayVoc("PARASITO", 355778, 20129);
- // else
- // cargatele();
- // setSfxVolume(volumenfxizquierdo, volumenfxderecho);
- // } break;
- // case 4: {
- // loadVoc("GOTA", 140972, 1029);
- // setSfxVolume(volumenfxizquierdo, volumenfxderecho);
- // } break;
- // case 5: {
- // setSfxVolume(volumenfxizquierdo, 0);
- // autoPlayVoc("CALDERA", 6433, 15386);
- // } break;
- // case 6: {
- // setSfxVolume(volumenfxizquierdo, volumenfxderecho);
- // autoPlayVoc("CALDERA", 6433, 15386);
- // } break;
- // case 17: {
- // if ((libro[0] == true) && (roomData->banderamovimiento == true))
- // disableSecondAnimation();
- // } break;
- // case 20: {
- // switch (hornacina[0][hornacina[0][3]]) {
- // case 0:
- // roomData->indexadoobjetos[9]->objectName = "HORNACINA";
- // break;
- // case 561:
- // roomData->indexadoobjetos[9]->objectName = "ESTATUA DIVINA";
- // break;
- // case 563:
- // roomData->indexadoobjetos[9]->objectName = "MANUAL DE ALFARERO";
- // break;
- // case 615:
- // roomData->indexadoobjetos[9]->objectName = "ESTATUA GROTESCA";
- // break;
- // }
- // } break;
- // case 23: {
- // autoPlayVoc("FUENTE", 0, 0);
- // setSfxVolume(volumenfxizquierdo, volumenfxderecho);
- // } break;
- // case 24: {
- // switch (hornacina[1][hornacina[1][3]]) {
- // case 0:
- // roomData->indexadoobjetos[8]->objectName = "HORNACINA";
- // break;
- // case 561:
- // roomData->indexadoobjetos[8]->objectName = "ESTATUA DIVINA";
- // break;
- // case 615:
- // roomData->indexadoobjetos[8]->objectName = "ESTATUA GROTESCA";
- // break;
- // case 622:
- // roomData->indexadoobjetos[8]->objectName = "PARED";
- // break;
- // case 623:
- // roomData->indexadoobjetos[8]->objectName = "TORNO";
- // break;
- // }
- // if (trampa_puesta) {
- // roomData->banderamovimiento = true;
- // loadAnimation(roomData->nombremovto);
- // iframe2 = 1;
- // indicetray2 = 1;
- // animado.dir = roomData->dir2[indicetray2];
- // roomData->tray2[indicetray2 - 1].x = 214 - 15;
- // roomData->tray2[indicetray2 - 1].y = 115 - 42;
- // animado.posx = roomData->tray2[indicetray2 - 1].x;
- // animado.posy = roomData->tray2[indicetray2 - 1].y;
- // animado.profundidad = 15;
- // for (indiaux = 1; indiaux <= maxrejax; indiaux++)
- // for (indiaux2 = 1; indiaux2 <= maxrejay; indiaux2++)
- // if (rejamascararaton[indiaux][indiaux2] > 0)
-
- // roomData->mouseGrid[oldposx + indiaux - 1][oldposy + indiaux2 - 1] = rejamascararaton[indiaux][indiaux2];
- // }
- // assembleScreen();
- // } break;
- // }
- // effect(13, false, fondo);
- // contadorpc = contadorpc2;
- // mask();
- // posicioninv = 0;
- // drawBackpack();
- // if ((rojo_capturado == false) && (roomData->codigo == 24) &&
- // (trampa_puesta == false))
- // runaroundRed();
- // drawMouseMask(iraton, xraton, yraton);
- // completadalista2 = true;
+ g_engine->loadGameState(g_engine->getMetaEngine()->getAutosaveSlot());
}
int startGame();
@@ -300,7 +111,7 @@ int engine_start() {
if (partidanueva && !g_engine->shouldQuit()) {
newGame();
} else if (continuarpartida && !g_engine->shouldQuit()) {
- g_engine->loadGameState(g_engine->getMetaEngine()->getAutosaveSlot());
+ loadTemporaryGame();
} else {
desactivagrabar = true;
g_engine->openMainMenuDialog();
@@ -659,14 +470,13 @@ int startGame() {
initialMenu(true);
verifyCopyProtection2();
- if (partidanueva) {
+ if (partidanueva && !g_engine->shouldQuit()) {
newGame();
- } else if (continuarpartida)
+ } else if (continuarpartida && !g_engine->shouldQuit())
loadTemporaryGame();
else {
desactivagrabar = true;
g_engine->openMainMenuDialog();
- // saveLoad();
contadorpc = contadorpc2;
desactivagrabar = false;
}
diff --git a/engines/tot/saveload.cpp b/engines/tot/saveload.cpp
index fa0cf2db25d..1a3c5efa34d 100644
--- a/engines/tot/saveload.cpp
+++ b/engines/tot/saveload.cpp
@@ -248,9 +248,10 @@ Common::Error TotEngine::syncGame(Common::Serializer &s) {
Common::Error result;
if(s.isLoading()){
+ debug("Loading game!!");
regispartida loadedGame;
// Means we are loading from before the game has started
- if(rooms == nullptr) {
+ // if(rooms == nullptr) {
clear();
processingActive();
@@ -266,7 +267,7 @@ Common::Error TotEngine::syncGame(Common::Serializer &s) {
initializeScreenFile();
initializeObjectFile();
readConversationFile(Common::String("CONVERSA.TRE"));
- }
+ // }
result = syncSaveData(s, loadedGame);
loadGame(loadedGame);
} else {
Commit: fde9ba1a99ff797dee7a07b1a7196d67c4eb6c18
https://github.com/scummvm/scummvm/commit/fde9ba1a99ff797dee7a07b1a7196d67c4eb6c18
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:47+02:00
Commit Message:
TOT: Maps error codes to original description
Changed paths:
engines/tot/anims.cpp
engines/tot/anims.h
engines/tot/chrono.cpp
engines/tot/chrono.h
engines/tot/dialog.cpp
engines/tot/dialog.h
engines/tot/font/biosfont.cpp
engines/tot/font/biosfont.h
engines/tot/forest.cpp
engines/tot/game.cpp
engines/tot/graphics.cpp
engines/tot/graphics.h
engines/tot/graphman.h
engines/tot/mouseman.cpp
engines/tot/mouseman.h
engines/tot/playanim.cpp
engines/tot/playanim.h
engines/tot/routines.cpp
engines/tot/routines.h
engines/tot/routines2.cpp
engines/tot/routines2.h
engines/tot/saveload.cpp
engines/tot/sound.cpp
engines/tot/sound.h
engines/tot/soundman.cpp
engines/tot/util.cpp
engines/tot/util.h
diff --git a/engines/tot/anims.cpp b/engines/tot/anims.cpp
index 7c3f91fc127..794e92ce3f4 100644
--- a/engines/tot/anims.cpp
+++ b/engines/tot/anims.cpp
@@ -27,8 +27,8 @@
#include "common/textconsole.h"
#include "graphics/paletteman.h"
-#include "tot/decoder/TotFlicDecoder.h"
#include "tot/anims.h"
+#include "tot/decoder/TotFlicDecoder.h"
#include "tot/graphics.h"
#include "tot/playanim.h"
#include "tot/tot.h"
@@ -95,7 +95,7 @@ void handleFlcEvent(byte numero_del_evento) {
switch (numero_del_evento) {
case 0:
if (contadorpc > 103)
- error("handleFlcEvent(): ioresult! (274)");
+ showError(274);
break;
case 1:
if (framecontador == 3)
@@ -128,7 +128,8 @@ void handleFlcEvent(byte numero_del_evento) {
case 36:
drawText(2, 100, "\xAD\xADPor un tornillo!!...",
"Por un m\xA1sero y simple",
- "tornillo del tr\xA1""fugo",
+ "tornillo del tr\xA1"
+ "fugo",
"del trapecio...", "", 255, 0);
break;
case 47:
@@ -136,7 +137,8 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 48:
drawText(2, 100, "Si lo hubiese apretado",
- "bien, no estar\xA1""a ahora",
+ "bien, no estar\xA1"
+ "a ahora",
"sin trabajo...", "", "", 255, 0);
break;
case 59:
@@ -168,7 +170,9 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 90:
drawText(2, 100, "Y para animarme m\xA0s",
- "todav\xAD""a, ma\xA4""ana noche",
+ "todav\xAD"
+ "a, ma\xA4"
+ "ana noche",
"es HALLOWEEN...", "",
"Es que tengo la negra.", 255, 0);
break;
@@ -190,7 +194,8 @@ void handleFlcEvent(byte numero_del_evento) {
"contra ese inconsciente...", "", "", "", 253, 0);
break;
case 125:
- drawText(2, 100, "\xAD""Dios mio!... hasta en",
+ drawText(2, 100, "\xAD"
+ "Dios mio!... hasta en",
"la televisi\xA2n...",
"Seguro que hasta mi",
"perro encuentra curro",
@@ -216,8 +221,11 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 58: {
removeText(2, 100, 135, 199, 0);
- drawText(2, 100, "\xA8""Oficina de empleo?...",
- "\xA8""y para m\xA1?...", "",
+ drawText(2, 100, "\xA8"
+ "Oficina de empleo?...",
+ "\xA8"
+ "y para m\xA1?...",
+ "",
"\xADSe habr\xA0n equivocado!", "", 255, 0);
} break;
case 74: {
@@ -236,7 +244,8 @@ void handleFlcEvent(byte numero_del_evento) {
"de acuerdo con sus aptitudes...", 253, 0);
delay(7000);
removeText(80, 0, 319, 53, 0);
- drawText(80, 0, "Deber\xA0 presentarse ma\xA4""ana, dia",
+ drawText(80, 0, "Deber\xA0 presentarse ma\xA4"
+ "ana, dia",
"31 de Octubre en la direcci\xA2n",
"abajo indicada, para ocupar el",
"puesto de ENCARGADO GENERAL.", "", 253, 0);
@@ -307,7 +316,9 @@ void handleFlcEvent(byte numero_del_evento) {
case 7:
if ((numerovuelta == 1) && (framecontador == 3)) {
putImg(0, 0, punterofondofrase);
- drawText(5, 1, "Lo siento, no sab\xA1""a a que hora deb\xA1""a presentarme, en",
+ drawText(5, 1, "Lo siento, no sab\xA1"
+ "a a que hora deb\xA1"
+ "a presentarme, en",
"la oficina de empleo no me lo dijeron.",
"", "", "", 255, 0);
}
@@ -328,7 +339,8 @@ void handleFlcEvent(byte numero_del_evento) {
case 10:
if ((numerovuelta == 1) && (framecontador == 3)) {
putImg(0, 0, punterofondofrase);
- drawText(5, 1, "Vaya... 200 caballos... elevalunas el\x82""ctricos... ",
+ drawText(5, 1, "Vaya... 200 caballos... elevalunas el\x82"
+ "ctricos... ",
"inyecci\xA2n electr\xA2nica, llantas de aleaci\xA2n...",
"", "", "", 255, 249);
}
@@ -388,7 +400,8 @@ void handleFlcEvent(byte numero_del_evento) {
case 18:
if ((numerovuelta == 1) && (framecontador == 3)) {
putImg(0, 0, punterofondofrase);
- drawText(5, 1, "\xA8Gracias?... \xA8qu\x82?... \xAD""espera!... ese es mi coche...",
+ drawText(5, 1, "\xA8Gracias?... \xA8qu\x82?... \xAD"
+ "espera!... ese es mi coche...",
"", "", "", "", 255, 0);
}
break;
@@ -405,7 +418,8 @@ void handleFlcEvent(byte numero_del_evento) {
getImg(0, 0, 319, 29, punterofondofrase);
break;
case 3:
- drawText(15, 1, "\xA8""Donde estoy? ... \xA8Qu\x82 me ha pasado?",
+ drawText(15, 1, "\xA8"
+ "Donde estoy? ... \xA8Qu\x82 me ha pasado?",
"", "", "", "", 255, 0);
break;
}
@@ -656,7 +670,7 @@ static fliheader readHeader(Common::File *file) {
return headerfile;
}
- void blit(const Graphics::Surface *src, Common::Rect bounds) {
+void blit(const Graphics::Surface *src, Common::Rect bounds) {
int16 height = bounds.bottom - bounds.top;
int16 width = bounds.right - bounds.left;
Graphics::Surface dest = g_engine->_screen->getSubArea(bounds);
@@ -692,7 +706,7 @@ static void loadFlc(
fileName = "FILMS.DAT";
if (!animationsFile.open(Common::Path(fileName))) {
- error("readFlcXms(): ioresult! (272)");
+ showError(272);
}
animationsFile.seek(posflicfile, SEEK_SET);
// Need to read header to get the total size of the FLIC file.
@@ -717,7 +731,7 @@ static void loadFlc(
debug("Salidaflis!");
goto Lsalir_proc;
}
- if (tocapintar){
+ if (tocapintar) {
framecontador++;
handleFlcEvent(numevento);
const Graphics::Surface *frame = flic.decodeNextFrame();
@@ -737,7 +751,7 @@ static void loadFlc(
} else if (doscientos) {
debug("Doscientos!!");
g_engine->_graphics->setPalette(palette, 200);
- for (int i = 0; i <= 200; i ++) {
+ for (int i = 0; i <= 200; i++) {
pal[i * 3 + 0] = palette[i * 3 + 0];
pal[i * 3 + 1] = palette[i * 3 + 1];
pal[i * 3 + 2] = palette[i * 3 + 2];
@@ -755,7 +769,6 @@ static void loadFlc(
g_system->delayMillis(10);
} while (!flic.endOfVideo() && !g_engine->shouldQuit());
-
if (flic.endOfVideo()) {
if (flic.isRewindable()) {
flic.rewind();
diff --git a/engines/tot/anims.h b/engines/tot/anims.h
index 49b26bedc51..026cb541637 100644
--- a/engines/tot/anims.h
+++ b/engines/tot/anims.h
@@ -28,32 +28,32 @@
namespace Tot {
void drawFlc(uint flicx, uint flicy, int32 posicionfli, uint loop,
- byte veloc, byte numevento, boolean palcompleta, boolean permitesalida,
- boolean doscientos, boolean& salidaflis);
+ byte veloc, byte numevento, boolean palcompleta, boolean permitesalida,
+ boolean doscientos, boolean &salidaflis);
/**
* Header of an Autodesk Animator FLIC file.
*/
struct fliheader {
- int32 size; // file size
- uint magic, // format id
- frames, // number of animation frames
- width, // anim width
- heigth, // anim height
- depth, // 8 bits per pixel
- flags;
- int32 speed; // time delay between frames
- uint reserved1; // all set to zero
- int32 created; // creation date in DOS format
- byte creator[3]; // serial of creator program
- int32 updated; // update date in DOS format
- byte updator[3]; // serial of updating program
- uint aspectx, // aspect ratio
- aspecty; // aspect ratio
- uint reserved2[19]; // all zeroes
- int32 ofsframe1, // Offset to frame 1 (FLC only)
- ofsframe2; // Offset to frame 2 (FLC only)
- uint reserved3[20]; // All zeroes
+ int32 size; // file size
+ uint magic, // format id
+ frames, // number of animation frames
+ width, // anim width
+ heigth, // anim height
+ depth, // 8 bits per pixel
+ flags;
+ int32 speed; // time delay between frames
+ uint reserved1; // all set to zero
+ int32 created; // creation date in DOS format
+ byte creator[3]; // serial of creator program
+ int32 updated; // update date in DOS format
+ byte updator[3]; // serial of updating program
+ uint aspectx, // aspect ratio
+ aspecty; // aspect ratio
+ uint reserved2[19]; // all zeroes
+ int32 ofsframe1, // Offset to frame 1 (FLC only)
+ ofsframe2; // Offset to frame 2 (FLC only)
+ uint reserved3[20]; // All zeroes
};
} // End of namespace Tot
diff --git a/engines/tot/chrono.cpp b/engines/tot/chrono.cpp
index 12270be22f9..f467f39d86c 100644
--- a/engines/tot/chrono.cpp
+++ b/engines/tot/chrono.cpp
@@ -42,32 +42,30 @@ void ChronoManager::updateChrono() {
if ((currentTime - _lastTick) >= kFrameMs / _speedMultiplier) {
tocapintar = true;
tocapintarTick++;
- if(tocapintarTick == kDoubleFrameMultiplier){
+ if (tocapintarTick == kDoubleFrameMultiplier) {
tocapintarTick = 0;
tocapintar2 = true;
- }
- else {
+ } else {
tocapintar2 = false;
}
_lastTick = currentTime;
} else {
tocapintar = false;
}
-
}
-bool ChronoManager::shouldPaintEffect(int speed){
+bool ChronoManager::shouldPaintEffect(int speed) {
uint32 curTime = g_system->getMillis();
// _lastEffectRender += g_system->getMillis();
- if((curTime - _lastEffectRender) >= kFrameEffectMs * speed) {
+ if ((curTime - _lastEffectRender) >= kFrameEffectMs * speed) {
_lastEffectRender = curTime;
return true;
- }
- else return false;
+ } else
+ return false;
}
void Tot::ChronoManager::delay(int ms) {
- if(ms > 10) {
+ if (ms > 10) {
debug("Starting delay of %d", ms);
}
uint32 delayStart = g_system->getMillis();
@@ -76,7 +74,7 @@ void Tot::ChronoManager::delay(int ms) {
while ((g_system->getMillis() - delayStart) < ms && !g_engine->shouldQuit()) {
while (g_system->getEventManager()->pollEvent(e)) {
}
- if(ms > 10) {
+ if (ms > 10) {
g_system->delayMillis(10);
}
g_engine->_screen->update();
diff --git a/engines/tot/chrono.h b/engines/tot/chrono.h
index 55cd7b6008d..55270b30489 100644
--- a/engines/tot/chrono.h
+++ b/engines/tot/chrono.h
@@ -30,7 +30,7 @@ namespace Tot {
*/
extern bool tocapintar, tocapintar2, tocapintareffect;
-//Set to 30 for ease of dev
+// Set to 30 for ease of dev
const int kFrameMs = 30;
// const int kFrameMs = 50;
const int kDoubleFrameMultiplier = 3;
diff --git a/engines/tot/dialog.cpp b/engines/tot/dialog.cpp
index f9ae4cc913a..90708a6aeb7 100644
--- a/engines/tot/dialog.cpp
+++ b/engines/tot/dialog.cpp
@@ -40,7 +40,6 @@ Tree ar, auxTree, step;
boolean endOfConversation;
-
Common::String decrypt(Common::String tEncriptado) {
for (int i = 0; i < tEncriptado.size(); i++) {
tEncriptado.setChar(decryptionKey[i] ^ (char)tEncriptado[i], i);
@@ -547,7 +546,7 @@ void talk(byte person) {
// Make sure to autosave
g_engine->saveAutosaveIfEnabled();
verb.close();
- if(g_engine->shouldQuit()) {
+ if (g_engine->shouldQuit()) {
return;
}
delete ar;
@@ -586,15 +585,13 @@ void talkScreenObject() {
if (regobj.habla > 0) {
talk(regobj.habla);
- }
- else {
+ } else {
assignText();
hypertext((Random(10) + 1039), 255, 0, kaka, false);
verb.close();
if (contadorpc > 198)
- error("Error contadorpc = 274");
+ showError(274);
}
}
} // End of namespace Tot
-
diff --git a/engines/tot/dialog.h b/engines/tot/dialog.h
index 3ac3cc3dab9..e47003d19d5 100644
--- a/engines/tot/dialog.h
+++ b/engines/tot/dialog.h
@@ -28,7 +28,6 @@
namespace Tot {
-
typedef struct lista *plista;
struct lista {
@@ -41,7 +40,6 @@ extern plista l1, l;
extern Tree ar, auxTree, step;
extern boolean endOfConversation;
-
void talkScreenObject();
} // End of namespace Tot
diff --git a/engines/tot/font/biosfont.cpp b/engines/tot/font/biosfont.cpp
index 86fd7a40fd7..771a13bf16f 100644
--- a/engines/tot/font/biosfont.cpp
+++ b/engines/tot/font/biosfont.cpp
@@ -1,34 +1,33 @@
/* ScummVM - Graphic Adventure Engine
-*
-* ScummVM is the legal property of its developers, whose names
-* are too numerous to list here. Please refer to the COPYRIGHT
-* file distributed with this source distribution.
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-*/
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
#include "graphics/fonts/dosfont.h"
#include "graphics/surface.h"
-#include "tot/tot.h"
#include "tot/font/biosfont.h"
-
+#include "tot/tot.h"
namespace Tot {
-BiosFont::BiosFont() { }
+BiosFont::BiosFont() {}
int BiosFont::getFontHeight() const {
return 8;
@@ -62,4 +61,4 @@ void BiosFont::drawBiosFontGlyph(uint8 chr, int x, int y, uint8 color) const {
}
}
-} // namespace Darkseed
+} // namespace Tot
diff --git a/engines/tot/font/biosfont.h b/engines/tot/font/biosfont.h
index 4186d0f9815..0db0e1d26ca 100644
--- a/engines/tot/font/biosfont.h
+++ b/engines/tot/font/biosfont.h
@@ -22,8 +22,8 @@
#ifndef TOT_BIG5FONT_H
#define TOT_BIG5FONT_H
-#include "graphics/font.h"
#include "graphics/big5.h"
+#include "graphics/font.h"
#include "graphics/surface.h"
namespace Tot {
@@ -36,6 +36,7 @@ public:
int getMaxCharWidth() const override;
int getCharWidth(uint32 chr) const override;
void drawChar(Graphics::Surface *dst, uint32 chr, int x, int y, uint32 color) const override;
+
private:
void drawBiosFontGlyph(uint8 chr, int x, int y, uint8 color) const;
};
diff --git a/engines/tot/forest.cpp b/engines/tot/forest.cpp
index ce17ee394cb..98d0c3e1e00 100644
--- a/engines/tot/forest.cpp
+++ b/engines/tot/forest.cpp
@@ -19,14 +19,14 @@
*
*/
-#include "common/file.h"
#include "common/debug.h"
+#include "common/file.h"
#include "tot/forest.h"
namespace Tot {
-void initTree(Tree& a, nodeElement dato) {
+void initTree(Tree &a, nodeElement dato) {
a = new treeDef;
a->element = dato;
a->parent = NULL;
@@ -38,7 +38,8 @@ boolean root(Tree nodo) {
boolean raiz_result;
if (nodo->parent == NULL)
raiz_result = true;
- else raiz_result = false;
+ else
+ raiz_result = false;
return raiz_result;
}
@@ -60,7 +61,6 @@ Tree leftChild(Tree nodo) {
return hijoizq_result;
}
-
int depth(Tree nodo) {
Tree auxiliar;
int contador;
@@ -76,7 +76,7 @@ int depth(Tree nodo) {
return profundidad_result;
}
-void expandNode(Tree& nodo, nodeElement dato) {
+void expandNode(Tree &nodo, nodeElement dato) {
Tree auxiliar;
auxiliar = nodo;
@@ -84,7 +84,8 @@ void expandNode(Tree& nodo, nodeElement dato) {
auxiliar = leftChild(auxiliar);
while (auxiliar->sibling != NULL)
- auxiliar = rightSibling(auxiliar);;
+ auxiliar = rightSibling(auxiliar);
+ ;
auxiliar->sibling = new treeDef;
auxiliar = auxiliar->sibling;
auxiliar->element = dato;
@@ -102,7 +103,7 @@ void expandNode(Tree& nodo, nodeElement dato) {
}
}
-void preOrder(Tree a, Common::String& cadena) {
+void preOrder(Tree a, Common::String &cadena) {
if (a != NULL) {
cadena = Common::String::format("%s%d%cN%d@", cadena.c_str(), a->element.index, a->element.dicho, depth(a));
preOrder(leftChild(a), cadena);
@@ -207,7 +208,7 @@ void readTree(Common::String f, Tree &a, uint lugar) {
Common::File fichero;
debug("Filename = %s", f.c_str());
if (!fichero.open(Common::Path(f))) {
- error("error opening conversation file (314)");
+ showError(314);
}
readTree(fichero, a, lugar);
fichero.close();
diff --git a/engines/tot/game.cpp b/engines/tot/game.cpp
index 3c72e3120e2..52d11baf993 100644
--- a/engines/tot/game.cpp
+++ b/engines/tot/game.cpp
@@ -50,7 +50,7 @@ void newGame() {
g_engine->_mouseManager->hide();
obtainName(nombrepersonaje);
- if(!g_engine->shouldQuit()){
+ if (!g_engine->shouldQuit()) {
totalFadeOut(0);
clear();
processingActive();
@@ -119,7 +119,7 @@ int engine_start() {
}
boolean enforceSecondPart = false;
- if(enforceSecondPart) { //DEBUG
+ if (enforceSecondPart) { // DEBUG
completadalista1 = true;
completadalista2 = true;
gamePart = 1;
@@ -131,297 +131,184 @@ int engine_start() {
int startGame() {
lowerMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
switch (gamePart) {
- case 1:
- playMidiFile("PRIMERA", true);
- break;
- case 2:
- playMidiFile("SEGUNDA", true);
- break;
- }
- contadorpc2 = contadorpc;
- restoreMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
- inGame = true;
+ case 1:
+ playMidiFile("PRIMERA", true);
+ break;
+ case 2:
+ playMidiFile("SEGUNDA", true);
+ break;
+ }
+ contadorpc2 = contadorpc;
+ restoreMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
+ inGame = true;
- Common::Event e;
- while (!salirdeljuego && !g_engine->shouldQuit()) {
- bool escapePressed = false;
- g_engine->_chrono->updateChrono();
- g_engine->_mouseManager->animateMouseIfNeeded();
- // debug
- while (g_system->getEventManager()->pollEvent(e)) {
- if (isMouseEvent(e)) {
- g_engine->_mouseManager->setMousePos(e.mouse);
- xraton = e.mouse.x;
- yraton = e.mouse.y;
- }
- if (e.type == Common::EVENT_KEYUP) {
- changeGameSpeed(e);
+ Common::Event e;
+ while (!salirdeljuego && !g_engine->shouldQuit()) {
+ bool escapePressed = false;
+ g_engine->_chrono->updateChrono();
+ g_engine->_mouseManager->animateMouseIfNeeded();
+ // debug
+ while (g_system->getEventManager()->pollEvent(e)) {
+ if (isMouseEvent(e)) {
+ g_engine->_mouseManager->setMousePos(e.mouse);
+ xraton = e.mouse.x;
+ yraton = e.mouse.y;
+ }
+ if (e.type == Common::EVENT_KEYUP) {
+ changeGameSpeed(e);
- switch (e.kbd.keycode) {
- case Common::KEYCODE_ESCAPE:
- escapePressed = true;
- break;
- case Common::KEYCODE_F1:
- soundControls();
- break;
- case Common::KEYCODE_F2:
- g_engine->openMainMenuDialog();
- // saveLoad();
+ switch (e.kbd.keycode) {
+ case Common::KEYCODE_ESCAPE:
+ escapePressed = true;
+ break;
+ case Common::KEYCODE_F1:
+ soundControls();
+ break;
+ case Common::KEYCODE_F2:
+ g_engine->openMainMenuDialog();
+ // saveLoad();
+ break;
+ /* Debug */
+ {
+ case Common::KEYCODE_5:
+ showMouseGrid = !showMouseGrid;
break;
- /* Debug */
- {
- case Common::KEYCODE_5:
- showMouseGrid = !showMouseGrid;
- break;
- case Common::KEYCODE_6:
- showScreenGrid = !showScreenGrid;
- break;
- case Common::KEYCODE_7:
- showGameGrid = !showGameGrid;
- break;
- case Common::KEYCODE_0:
- effect(13, false, background);
- break;
- case Common::KEYCODE_8:
- drawObjectAreas = !drawObjectAreas;
- break;
- case Common::KEYCODE_1:
- setRoomTrajectories(altoanimado, anchoanimado, RESTORE);
- break;
- case Common::KEYCODE_2:
- setRoomTrajectories(altoanimado, anchoanimado, SET_WITH_ANIM);
- break;
- }
- /* End debug */
- case Common::KEYCODE_a: // open
- numeroaccion = 5;
- action();
- oldxrejilla = 0;
- oldyrejilla = 0;
+ case Common::KEYCODE_6:
+ showScreenGrid = !showScreenGrid;
break;
- case Common::KEYCODE_e: // close
- numeroaccion = 6;
- action();
- oldxrejilla = 0;
- oldyrejilla = 0;
+ case Common::KEYCODE_7:
+ showGameGrid = !showGameGrid;
break;
- case Common::KEYCODE_c: // pickup
- numeroaccion = 2;
- action();
- oldxrejilla = 0;
- oldyrejilla = 0;
+ case Common::KEYCODE_0:
+ effect(13, false, background);
break;
- case Common::KEYCODE_h: // talk
- numeroaccion = 1;
- action();
- oldxrejilla = 0;
- oldyrejilla = 0;
+ case Common::KEYCODE_8:
+ drawObjectAreas = !drawObjectAreas;
break;
- case Common::KEYCODE_m: // look
- numeroaccion = 3;
- action();
- oldxrejilla = 0;
- oldyrejilla = 0;
+ case Common::KEYCODE_1:
+ setRoomTrajectories(altoanimado, anchoanimado, RESTORE);
break;
- case Common::KEYCODE_u: // use
- numeroaccion = 4;
- action();
- oldxrejilla = 0;
- oldyrejilla = 0;
+ case Common::KEYCODE_2:
+ setRoomTrajectories(altoanimado, anchoanimado, SET_WITH_ANIM);
break;
- default:
- numeroaccion = 0; // go to
}
- } else if (e.type == Common::EVENT_LBUTTONUP) {
- pulsax = e.mouse.x;
- pulsay = e.mouse.y;
- if (pulsay > 0 && pulsay < 131) {
- switch (numeroaccion) {
- case 0: // go to
- contadorpc2 = contadorpc;
- // gets the area where the character is now standing. Area is calculated using xframe,yframe plus some adjustments to get the center of the feet
- zonaactual = currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory];
- if (zonaactual < 10) {
- xframe2 = pulsax + 7;
- yframe2 = pulsay + 7;
- // obtains the target area from the clicked coordinates
- zonadestino = currentRoomData->rejapantalla[xframe2 / factorx][yframe2 / factory];
- if (currentRoomData->codigo == 21 && currentRoomData->banderamovimiento) {
- if ((zonadestino >= 1 && zonadestino <= 5) ||
- (zonadestino >= 9 && zonadestino <= 13) ||
- (zonadestino >= 18 && zonadestino <= 21) ||
- zonadestino == 24 || zonadestino == 25) {
+ /* End debug */
+ case Common::KEYCODE_a: // open
+ numeroaccion = 5;
+ action();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ break;
+ case Common::KEYCODE_e: // close
+ numeroaccion = 6;
+ action();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ break;
+ case Common::KEYCODE_c: // pickup
+ numeroaccion = 2;
+ action();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ break;
+ case Common::KEYCODE_h: // talk
+ numeroaccion = 1;
+ action();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ break;
+ case Common::KEYCODE_m: // look
+ numeroaccion = 3;
+ action();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ break;
+ case Common::KEYCODE_u: // use
+ numeroaccion = 4;
+ action();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ break;
+ default:
+ numeroaccion = 0; // go to
+ }
+ } else if (e.type == Common::EVENT_LBUTTONUP) {
+ pulsax = e.mouse.x;
+ pulsay = e.mouse.y;
+ if (pulsay > 0 && pulsay < 131) {
+ switch (numeroaccion) {
+ case 0: // go to
+ contadorpc2 = contadorpc;
+ // gets the area where the character is now standing. Area is calculated using xframe,yframe plus some adjustments to get the center of the feet
+ zonaactual = currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory];
+ if (zonaactual < 10) {
+ xframe2 = pulsax + 7;
+ yframe2 = pulsay + 7;
+ // obtains the target area from the clicked coordinates
+ zonadestino = currentRoomData->rejapantalla[xframe2 / factorx][yframe2 / factory];
+ if (currentRoomData->codigo == 21 && currentRoomData->banderamovimiento) {
+ if ((zonadestino >= 1 && zonadestino <= 5) ||
+ (zonadestino >= 9 && zonadestino <= 13) ||
+ (zonadestino >= 18 && zonadestino <= 21) ||
+ zonadestino == 24 || zonadestino == 25) {
- zonadestino = 7;
- pulsax = 232;
- pulsay = 75;
+ zonadestino = 7;
+ pulsax = 232;
+ pulsay = 75;
- xframe2 = pulsax + 7;
- yframe2 = pulsay + 7;
- }
+ xframe2 = pulsax + 7;
+ yframe2 = pulsay + 7;
}
+ }
- if (oldzonadestino != zonadestino || zonadestino < 10) {
- oldzonadestino = zonadestino;
- // Resets the entire route
- calculateRoute(zonaactual, zonadestino);
+ if (oldzonadestino != zonadestino || zonadestino < 10) {
+ oldzonadestino = zonadestino;
+ // Resets the entire route
+ calculateRoute(zonaactual, zonadestino);
- indicepuertas = 0;
- cambiopantalla = false;
+ indicepuertas = 0;
+ cambiopantalla = false;
- for(indicepuertas = 0; indicepuertas < 5; indicepuertas++) {
- if (currentRoomData->doors[indicepuertas].codigopuerta == zonadestino) {
+ for (indicepuertas = 0; indicepuertas < 5; indicepuertas++) {
+ if (currentRoomData->doors[indicepuertas].codigopuerta == zonadestino) {
- if (currentRoomData->doors[indicepuertas].abiertacerrada == 1) {
- cambiopantalla = true;
- break;
- } else if ((currentRoomData->codigo == 5 && zonadestino == 27) || (currentRoomData->codigo == 6 && zonadestino == 21)) {
- ;
- } else {
- pasos -= 1;
- }
+ if (currentRoomData->doors[indicepuertas].abiertacerrada == 1) {
+ cambiopantalla = true;
+ break;
+ } else if ((currentRoomData->codigo == 5 && zonadestino == 27) || (currentRoomData->codigo == 6 && zonadestino == 21)) {
+ ;
+ } else {
+ pasos -= 1;
}
}
- // Sets xframe2 again due to the substraction when closed doors
- xframe2 = pasos;
- } else
- xframe2 = 0;
- }
- break;
- case 1: // talk
- cambiopantalla = false;
- numeroaccion = 0;
- talkScreenObject();
- contadorpc2 = contadorpc;
- break;
- case 2: // pick up
- cambiopantalla = false;
- numeroaccion = 0;
- pickupScreenObject();
- contadorpc = contadorpc2;
- break;
- case 3: // look at
- cambiopantalla = false;
- destinox_paso = (pulsax + 7) / factorx;
- destinoy_paso = (pulsay + 7) / factory;
- if (currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[destinox_paso][destinoy_paso]]->indicefichero > 0) {
- goToObject(
- currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory],
- currentRoomData->rejapantalla[destinox_paso][destinoy_paso]);
- if (currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[destinox_paso][destinoy_paso]]->indicefichero == 562)
-
- switch (currentRoomData->codigo) {
- case 20:
- if (hornacina[0][hornacina[0][3]] > 0)
- readItemRegister(hornacina[0][hornacina[0][3]]);
- else
- readItemRegister(562);
- break;
- case 24:
- if (hornacina[1][hornacina[1][3]] > 0)
- readItemRegister(hornacina[1][hornacina[1][3]]);
- else
- readItemRegister(562);
- break;
- }
- else
- readItemRegister(currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[destinox_paso][destinoy_paso]]->indicefichero);
- if (regobj.lookAtTextRef > 0)
- drawText(regobj.lookAtTextRef);
- numeroaccion = 0;
- }
- break;
- case 4: //use
- cambiopantalla = false;
- numeroaccion = 0;
- useScreenObject();
- contadorpc = contadorpc2;
- break;
- case 5: // open
- cambiopantalla = false;
- numeroaccion = 0;
- openScreenObject();
- break;
- case 6: { // close
- cambiopantalla = false;
- numeroaccion = 0;
- closeScreenObject();
- contadorpc = contadorpc2;
- } break;
- }
- } else if (pulsay > 148 && pulsay < 158) {
- if (pulsax >= 3 && pulsax <= 53) {
- numeroaccion = 1;
- action();
- break;
- } else if (pulsax >= 58 && pulsax <= 103) {
- numeroaccion = 2;
- action();
- break;
- } else if (pulsax >= 108 && pulsax <= 153) {
- numeroaccion = 3;
- action();
- break;
- } else if (pulsax >= 158 && pulsax <= 198) {
- numeroaccion = 4;
- action();
- break;
- } else if (pulsax >= 203 && pulsax <= 248) {
- numeroaccion = 5;
- action();
- break;
- } else if (pulsax >= 253 && pulsax <= 311) {
- numeroaccion = 6;
- action();
- break;
- } else {
- numeroaccion = 0;
- action();
- contadorpc2 = contadorpc;
- }
- } else if (pulsay > 166 && pulsay < 199) {
- if (pulsax >= 3 && pulsax <= 19) {
- inventory(0, 33);
- break;
- } else if (pulsax >= 26 && pulsax <= 65) {
- handleAction(posicioninv);
- break;
- } else if (pulsax >= 70 && pulsax <= 108) {
- handleAction(posicioninv + 1);
- break;
- } else if (pulsax >= 113 && pulsax <= 151) {
- handleAction(posicioninv + 2);
- break;
- } else if (pulsax >= 156 && pulsax <= 194) {
- handleAction(posicioninv + 3);
- break;
- } else if (pulsax >= 199 && pulsax <= 237) {
- handleAction(posicioninv + 4);
- break;
- } else if (pulsax >= 242 && pulsax <= 280) {
- handleAction(posicioninv + 5);
- break;
- } else if (pulsax >= 290 && pulsax <= 311) {
- inventory(1, 33);
- break;
- } else {
- numeroaccion = 0;
- action();
+ }
+ // Sets xframe2 again due to the substraction when closed doors
+ xframe2 = pasos;
+ } else
+ xframe2 = 0;
}
- }
- } else if (e.type == Common::EVENT_RBUTTONUP) {
- pulsax = e.mouse.x;
- pulsay = e.mouse.y;
- destinox_paso = (pulsax + 7) / factorx;
- destinoy_paso = (pulsay + 7) / factory;
- contadorpc2 = contadorpc;
- if (destinoy_paso < 28) {
- RoomObjectListEntry obj = *currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[destinox_paso][destinoy_paso]];
- if (obj.indicefichero > 0) {
-
- drawLookAtItem(obj);
- goToObject(currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], currentRoomData->rejapantalla[destinox_paso][destinoy_paso]);
- if (obj.indicefichero == 562)
+ break;
+ case 1: // talk
+ cambiopantalla = false;
+ numeroaccion = 0;
+ talkScreenObject();
+ contadorpc2 = contadorpc;
+ break;
+ case 2: // pick up
+ cambiopantalla = false;
+ numeroaccion = 0;
+ pickupScreenObject();
+ contadorpc = contadorpc2;
+ break;
+ case 3: // look at
+ cambiopantalla = false;
+ destinox_paso = (pulsax + 7) / factorx;
+ destinoy_paso = (pulsay + 7) / factory;
+ if (currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[destinox_paso][destinoy_paso]]->indicefichero > 0) {
+ goToObject(
+ currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory],
+ currentRoomData->rejapantalla[destinox_paso][destinoy_paso]);
+ if (currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[destinox_paso][destinoy_paso]]->indicefichero == 562)
switch (currentRoomData->codigo) {
case 20:
@@ -438,156 +325,269 @@ int startGame() {
break;
}
else
- readItemRegister(obj.indicefichero);
+ readItemRegister(currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[destinox_paso][destinoy_paso]]->indicefichero);
if (regobj.lookAtTextRef > 0)
drawText(regobj.lookAtTextRef);
numeroaccion = 0;
}
+ break;
+ case 4: // use
+ cambiopantalla = false;
+ numeroaccion = 0;
+ useScreenObject();
+ contadorpc = contadorpc2;
+ break;
+ case 5: // open
+ cambiopantalla = false;
+ numeroaccion = 0;
+ openScreenObject();
+ break;
+ case 6: { // close
+ cambiopantalla = false;
+ numeroaccion = 0;
+ closeScreenObject();
+ contadorpc = contadorpc2;
+ } break;
+ }
+ } else if (pulsay > 148 && pulsay < 158) {
+ if (pulsax >= 3 && pulsax <= 53) {
+ numeroaccion = 1;
+ action();
+ break;
+ } else if (pulsax >= 58 && pulsax <= 103) {
+ numeroaccion = 2;
+ action();
+ break;
+ } else if (pulsax >= 108 && pulsax <= 153) {
+ numeroaccion = 3;
+ action();
+ break;
+ } else if (pulsax >= 158 && pulsax <= 198) {
+ numeroaccion = 4;
+ action();
+ break;
+ } else if (pulsax >= 203 && pulsax <= 248) {
+ numeroaccion = 5;
+ action();
+ break;
+ } else if (pulsax >= 253 && pulsax <= 311) {
+ numeroaccion = 6;
+ action();
+ break;
+ } else {
+ numeroaccion = 0;
+ action();
+ contadorpc2 = contadorpc;
+ }
+ } else if (pulsay > 166 && pulsay < 199) {
+ if (pulsax >= 3 && pulsax <= 19) {
+ inventory(0, 33);
+ break;
+ } else if (pulsax >= 26 && pulsax <= 65) {
+ handleAction(posicioninv);
+ break;
+ } else if (pulsax >= 70 && pulsax <= 108) {
+ handleAction(posicioninv + 1);
+ break;
+ } else if (pulsax >= 113 && pulsax <= 151) {
+ handleAction(posicioninv + 2);
+ break;
+ } else if (pulsax >= 156 && pulsax <= 194) {
+ handleAction(posicioninv + 3);
+ break;
+ } else if (pulsax >= 199 && pulsax <= 237) {
+ handleAction(posicioninv + 4);
+ break;
+ } else if (pulsax >= 242 && pulsax <= 280) {
+ handleAction(posicioninv + 5);
+ break;
+ } else if (pulsax >= 290 && pulsax <= 311) {
+ inventory(1, 33);
+ break;
+ } else {
+ numeroaccion = 0;
+ action();
+ }
+ }
+ } else if (e.type == Common::EVENT_RBUTTONUP) {
+ pulsax = e.mouse.x;
+ pulsay = e.mouse.y;
+ destinox_paso = (pulsax + 7) / factorx;
+ destinoy_paso = (pulsay + 7) / factory;
+ contadorpc2 = contadorpc;
+ if (destinoy_paso < 28) {
+ RoomObjectListEntry obj = *currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[destinox_paso][destinoy_paso]];
+ if (obj.indicefichero > 0) {
+
+ drawLookAtItem(obj);
+ goToObject(currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], currentRoomData->rejapantalla[destinox_paso][destinoy_paso]);
+ if (obj.indicefichero == 562)
+
+ switch (currentRoomData->codigo) {
+ case 20:
+ if (hornacina[0][hornacina[0][3]] > 0)
+ readItemRegister(hornacina[0][hornacina[0][3]]);
+ else
+ readItemRegister(562);
+ break;
+ case 24:
+ if (hornacina[1][hornacina[1][3]] > 0)
+ readItemRegister(hornacina[1][hornacina[1][3]]);
+ else
+ readItemRegister(562);
+ break;
+ }
+ else
+ readItemRegister(obj.indicefichero);
+ if (regobj.lookAtTextRef > 0)
+ drawText(regobj.lookAtTextRef);
+ numeroaccion = 0;
}
}
}
+ }
- checkMouseGrid();
- advanceAnimations(false, true);
+ checkMouseGrid();
+ advanceAnimations(false, true);
- // Scene changes
- if (xframe2 == 0 && cambiopantalla) {
- sceneChange();
+ // Scene changes
+ if (xframe2 == 0 && cambiopantalla) {
+ sceneChange();
+ }
+
+ if (escapePressed && xframe2 == 0) {
+ freeAnimation();
+ freeScreenObjects();
+ contadorpc2 = contadorpc;
+ partidanueva = false;
+ continuarpartida = false;
+ g_engine->saveAutosaveIfEnabled();
+ totalFadeOut(0);
+ lowerMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
+ clear();
+ playMidiFile("INTRODUC", true);
+ restoreMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
+ initialMenu(true);
+ verifyCopyProtection2();
+
+ if (partidanueva && !g_engine->shouldQuit()) {
+ newGame();
+ } else if (continuarpartida && !g_engine->shouldQuit())
+ loadTemporaryGame();
+ else {
+ desactivagrabar = true;
+ g_engine->openMainMenuDialog();
+ contadorpc = contadorpc2;
+ desactivagrabar = false;
+ }
+ lowerMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
+ switch (gamePart) {
+ case 1:
+ playMidiFile("PRIMERA", true);
+ break;
+ case 2:
+ playMidiFile("SEGUNDA", true);
+ break;
}
+ restoreMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
+ }
- if (escapePressed && xframe2 == 0) {
+ switch (gamePart) {
+ case 1:
+ if (completadalista1 && completadalista2) {
+ completadalista1 = false;
+ completadalista2 = false;
+ contadorpc = contadorpc2;
+ gamePart = 2;
+ iframe = 0;
+ freeInventory();
freeAnimation();
freeScreenObjects();
- contadorpc2 = contadorpc;
- partidanueva = false;
- continuarpartida = false;
- g_engine->saveAutosaveIfEnabled();
- totalFadeOut(0);
+ g_engine->_mouseManager->hide();
+ partialFadeOut(234);
lowerMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
- clear();
- playMidiFile("INTRODUC", true);
+ playMidiFile("CREDITOS", true);
restoreMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
- initialMenu(true);
- verifyCopyProtection2();
-
- if (partidanueva && !g_engine->shouldQuit()) {
- newGame();
- } else if (continuarpartida && !g_engine->shouldQuit())
- loadTemporaryGame();
- else {
- desactivagrabar = true;
- g_engine->openMainMenuDialog();
- contadorpc = contadorpc2;
- desactivagrabar = false;
- }
+ if (contadorpc2 > 43)
+ showError(274);
+ // sacrificeScene();
+ clear();
+ loadObjects();
+ loadPalette("SEGUNDA");
+ indicetray = 0;
+ characterPosX = 160;
+ characterPosY = 60;
+ trayec[indicetray].x = characterPosX;
+ trayec[indicetray].y = characterPosY;
+ loadScreenData(20);
lowerMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
- switch (gamePart) {
- case 1:
- playMidiFile("PRIMERA", true);
- break;
- case 2:
- playMidiFile("SEGUNDA", true);
- break;
- }
+ playMidiFile("SEGUNDA", true);
restoreMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
- }
+ effect(1, false, background);
+ mask();
+ posicioninv = 0;
+ drawBackpack();
+ g_engine->_mouseManager->show();
- switch (gamePart) {
- case 1:
- if (completadalista1 && completadalista2) {
- completadalista1 = false;
- completadalista2 = false;
- contadorpc = contadorpc2;
- gamePart = 2;
- iframe = 0;
- freeInventory();
- freeAnimation();
- freeScreenObjects();
- g_engine->_mouseManager->hide();
- partialFadeOut(234);
- lowerMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
- playMidiFile("CREDITOS", true);
- restoreMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
- if (contadorpc2 > 43)
- _exit(274);
- // sacrificeScene();
- clear();
- loadObjects();
- loadPalette("SEGUNDA");
- indicetray = 0;
- characterPosX = 160;
- characterPosY = 60;
- trayec[indicetray].x = characterPosX;
- trayec[indicetray].y = characterPosY;
- loadScreenData(20);
- lowerMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
- playMidiFile("SEGUNDA", true);
- restoreMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
- effect(1, false, background);
- mask();
- posicioninv = 0;
- drawBackpack();
- g_engine->_mouseManager->show();
-
- primera[8] = true;
- oldxrejilla = 0;
- oldyrejilla = 0;
- checkMouseGrid();
- }
- break;
+ primera[8] = true;
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ checkMouseGrid();
}
+ break;
+ }
- // Debug graphics
- {
- g_engine->_graphics->euroText(Common::String::format("Room: %d", currentRoomNumber), 0, 0, 220, Graphics::kTextAlignLeft);
- // g_engine->_mouseManager->printPos(xraton, yraton, 220, 0);
- // printPos(characterPosX, characterPosY, 220, 10, "CharPos");
- if (showMouseGrid) {
- drawMouseGrid(currentRoomData);
- }
- if (showScreenGrid) {
- drawScreenGrid(currentRoomData);
- }
- if (showGameGrid) {
- drawGrid();
- }
+ // Debug graphics
+ {
+ g_engine->_graphics->euroText(Common::String::format("Room: %d", currentRoomNumber), 0, 0, 220, Graphics::kTextAlignLeft);
+ // g_engine->_mouseManager->printPos(xraton, yraton, 220, 0);
+ // printPos(characterPosX, characterPosY, 220, 10, "CharPos");
+ if (showMouseGrid) {
+ drawMouseGrid(currentRoomData);
+ }
+ if (showScreenGrid) {
+ drawScreenGrid(currentRoomData);
+ }
+ if (showGameGrid) {
+ drawGrid();
+ }
- if (drawObjectAreas) {
- for (int indice = 0; indice < nivelesdeprof; indice++) {
- if (screenObjects[indice] != NULL) {
- if (true) {
- // debug
- uint16 w = READ_LE_UINT16(screenObjects[indice]);
- uint16 h = READ_LE_UINT16(screenObjects[indice] + 2);
- Common::Rect r = Common::Rect(depthMap[indice].posx, depthMap[indice].posy, depthMap[indice].posx + w, depthMap[indice].posy + h);
- drawRect(180, depthMap[indice].posx, depthMap[indice].posy, depthMap[indice].posx + w, depthMap[indice].posy + h);
+ if (drawObjectAreas) {
+ for (int indice = 0; indice < nivelesdeprof; indice++) {
+ if (screenObjects[indice] != NULL) {
+ if (true) {
+ // debug
+ uint16 w = READ_LE_UINT16(screenObjects[indice]);
+ uint16 h = READ_LE_UINT16(screenObjects[indice] + 2);
+ Common::Rect r = Common::Rect(depthMap[indice].posx, depthMap[indice].posy, depthMap[indice].posx + w, depthMap[indice].posy + h);
+ drawRect(180, depthMap[indice].posx, depthMap[indice].posy, depthMap[indice].posx + w, depthMap[indice].posy + h);
- outtextxy(r.left, r.top, Common::String().format("%d", indice), 0);
- }
+ outtextxy(r.left, r.top, Common::String().format("%d", indice), 0);
}
}
}
- g_engine->_screen->markAllDirty();
- g_engine->_screen->update();
}
-
+ g_engine->_screen->markAllDirty();
g_engine->_screen->update();
- g_system->delayMillis(10);
- }
- g_engine->_mouseManager->hide();
- if(!g_engine->shouldQuit()){
- ending();
}
- if(!g_engine->shouldQuit()){
- obtainName(nombreficherofoto);
- }
- if(!g_engine->shouldQuit()){
- generateDiploma(nombreficherofoto);
- }
- if(!g_engine->shouldQuit()){
- credits();
- }
- return EXIT_SUCCESS;
+
+ g_engine->_screen->update();
+ g_system->delayMillis(10);
+ }
+ g_engine->_mouseManager->hide();
+ if (!g_engine->shouldQuit()) {
+ ending();
+ }
+ if (!g_engine->shouldQuit()) {
+ obtainName(nombreficherofoto);
+ }
+ if (!g_engine->shouldQuit()) {
+ generateDiploma(nombreficherofoto);
+ }
+ if (!g_engine->shouldQuit()) {
+ credits();
+ }
+ return EXIT_SUCCESS;
}
void sceneChange() {
@@ -615,7 +615,7 @@ void sceneChange() {
stopVoc();
loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
if (contadorpc > 89)
- error("engine_start(): contadorpc (274)");
+ showError(274);
setSfxVolume(volumenfxizquierdo, volumenfxderecho);
if (teleencendida)
autoPlayVoc("PARASITO", 355778, 20129);
@@ -810,7 +810,7 @@ void sceneChange() {
if (libro[0] == true && currentRoomData->banderamovimiento == true)
disableSecondAnimation();
if (contadorpc > 89)
- error("engine_start(): contadorpc (274)");
+ showError(274);
setSfxVolume(volumenfxizquierdo, volumenfxderecho);
effect(tipoefectofundido, false, background);
contadorpc = contadorpc2;
@@ -914,7 +914,7 @@ void sceneChange() {
break;
}
if (contadorpc > 89)
- error("engine_start(): contadorpc (274)");
+ showError(274);
setSfxVolume(volumenfxizquierdo, volumenfxderecho);
if (currentRoomData->codigo == 4)
loadVoc("GOTA", 140972, 1029);
@@ -957,7 +957,7 @@ void sceneChange() {
break;
}
if (contadorpc > 89)
- error("engine_start(): contadorpc (274)");
+ showError(274);
setSfxVolume(volumenfxizquierdo, volumenfxderecho);
if (trampa_puesta) {
currentRoomData->banderamovimiento = true;
@@ -973,7 +973,7 @@ void sceneChange() {
for (iaux = 0; iaux < maxrejax; iaux++)
for (iaux2 = 0; iaux2 < maxrejay; iaux2++) {
- if (rejamascaramovto[iaux][iaux2] > 0){
+ if (rejamascaramovto[iaux][iaux2] > 0) {
currentRoomData->rejapantalla[oldposx + iaux][oldposy + iaux2] = rejamascaramovto[iaux][iaux2];
}
if (rejamascararaton[iaux][iaux2] > 0)
@@ -1008,7 +1008,7 @@ void sceneChange() {
stopVoc();
loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
if (contadorpc > 89)
- error("engine_start(): contadorpc (274)");
+ showError(274);
setSfxVolume(volumenfxizquierdo, volumenfxderecho);
switch (currentRoomData->codigo) {
case 4:
diff --git a/engines/tot/graphics.cpp b/engines/tot/graphics.cpp
index d0dc09d2c27..f8413bf5e4d 100644
--- a/engines/tot/graphics.cpp
+++ b/engines/tot/graphics.cpp
@@ -135,7 +135,7 @@ void copyFromScreen(byte *&screen) {
}
void drawScreen(byte *screen, boolean offsetSize) {
- int offset = offsetSize ? 4:0;
+ int offset = offsetSize ? 4 : 0;
for (int i1 = 0; i1 < 320; i1++) {
for (int j1 = 0; j1 < 140; j1++) {
((byte *)g_engine->_screen->getPixels())[j1 * 320 + i1] = ((byte *)screen)[offset + j1 * 320 + i1];
@@ -172,7 +172,7 @@ void loadPalette(Common::String paletteName) {
Common::File fichero;
if (!fichero.open(Common::Path(paletteName + ".PAL")))
- error("unable to load palette %s (310)", paletteName.c_str());
+ showError(310);
fichero.read(pal, 768);
fichero.close();
@@ -181,7 +181,7 @@ void loadPalette(Common::String paletteName) {
}
void updateSceneAreaIfNeeded(int speed = 1) {
- if(g_engine->_chrono->shouldPaintEffect(speed)) {
+ if (g_engine->_chrono->shouldPaintEffect(speed)) {
g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
g_engine->_screen->update();
}
@@ -193,7 +193,7 @@ void effect(byte numeroefecto, boolean pasaranegro, byte *pantalla2) {
bool enabled = true;
// numeroefecto = 13;
- byte * screenBuf = (byte *)g_engine->_screen->getPixels();
+ byte *screenBuf = (byte *)g_engine->_screen->getPixels();
// Disable effects for now
if (!enabled) {
debug("Effects disabled! requested effect is %d, with fadeToBlack =%d", numeroefecto, pasaranegro);
@@ -203,7 +203,7 @@ void effect(byte numeroefecto, boolean pasaranegro, byte *pantalla2) {
} else {
contadorpc2 = contadorpc;
if (contadorpc > 145)
- error("effect(): contadorpc (274)");
+ showError(274);
debug("Effect %d, pasaraanegro=%d", numeroefecto, pasaranegro);
if (pasaranegro)
switch (numeroefecto) {
@@ -375,7 +375,7 @@ void effect(byte numeroefecto, boolean pasaranegro, byte *pantalla2) {
case 15: {
for (j1 = 0; j1 <= 70; j1++) {
- Common::copy(screenBuf + (j1 * 320), screenBuf + (j1 * 320) + 320, screenBuf + ((j1 + 1) *320));
+ Common::copy(screenBuf + (j1 * 320), screenBuf + (j1 * 320) + 320, screenBuf + ((j1 + 1) * 320));
line(0, j1, 319, j1, 0);
Common::copy(screenBuf + ((139 - j1) * 320), screenBuf + ((139 - j1) * 320) + 320, screenBuf + ((138 - j1) * 320));
line(0, (139 - j1), 319, (139 - j1), 0);
@@ -432,7 +432,7 @@ void effect(byte numeroefecto, boolean pasaranegro, byte *pantalla2) {
j1 = 10;
do {
for (i3 = (j1 - i2); i3 <= (j1 + i2); i3++) {
- byte *src = pantalla2 + + 4 + (i3 * 320) + + (i1 - i2);
+ byte *src = pantalla2 + +4 + (i3 * 320) + +(i1 - i2);
Common::copy(src, src + (i2 * 2), screenBuf + (i3 * 320) + (i1 - i2));
}
j1 += 20;
@@ -449,7 +449,7 @@ void effect(byte numeroefecto, boolean pasaranegro, byte *pantalla2) {
for (j1 = 1; j1 <= 7; j1++) {
if ((i1 + j1) == (i2 + 1)) {
for (i3 = ((j1 - 1) * 20); i3 <= ((j1 - 1) * 20 + 19); i3++) {
- byte *src = pantalla2 + + 4 + (i3 * 320) + ((i1 - 1) * 20);
+ byte *src = pantalla2 + +4 + (i3 * 320) + ((i1 - 1) * 20);
Common::copy(src, src + 20, screenBuf + (i3 * 320) + ((i1 - 1) * 20));
updateSceneAreaIfNeeded();
}
@@ -472,7 +472,7 @@ void effect(byte numeroefecto, boolean pasaranegro, byte *pantalla2) {
if ((j1 % 2) == 0)
for (i1 = 1; i1 <= 16; i1++) {
for (j3 = ((j1 - 1) * 20); j3 <= ((j1 - 1) * 20 + 19); j3++) {
- byte *src = pantalla2 + 4 + (j3 * 320) + ((i1 - 1) *20);
+ byte *src = pantalla2 + 4 + (j3 * 320) + ((i1 - 1) * 20);
Common::copy(src, src + 20, screenBuf + (j3 * 320) + ((i1 - 1) * 20));
}
@@ -482,7 +482,7 @@ void effect(byte numeroefecto, boolean pasaranegro, byte *pantalla2) {
else
for (i1 = 16; i1 >= 1; i1--) {
for (j3 = ((j1 - 1) * 20); j3 <= ((j1 - 1) * 20 + 19); j3++) {
- byte *src = pantalla2 + 4 + (j3 * 320) + ((i1 - 1) *20);
+ byte *src = pantalla2 + 4 + (j3 * 320) + ((i1 - 1) * 20);
Common::copy(src, src + 20, screenBuf + (j3 * 320) + ((i1 - 1) * 20));
}
updateSceneAreaIfNeeded();
@@ -493,10 +493,10 @@ void effect(byte numeroefecto, boolean pasaranegro, byte *pantalla2) {
case 11: {
long lastRender = 0;
long rendertime = 10;
- for (i2 = 0; i2 <= 3; i2 ++) {
+ for (i2 = 0; i2 <= 3; i2++) {
j1 = 1 + i2;
- for (i1 = (1 + i2); i1 <= (16 - i2); i1 ++) {
- for (j3 = ((j1 - 1) * 20); j3 <= ((j1 - 1) * 20 + 19); j3 ++) {
+ for (i1 = (1 + i2); i1 <= (16 - i2); i1++) {
+ for (j3 = ((j1 - 1) * 20); j3 <= ((j1 - 1) * 20 + 19); j3++) {
byte *buf = pantalla2 + 4 + (j3 * 320) + ((i1 - 1) * 20);
Common::copy(buf, buf + 20, screenBuf + ((j3 * 320) + ((i1 - 1) * 20)));
}
@@ -504,8 +504,8 @@ void effect(byte numeroefecto, boolean pasaranegro, byte *pantalla2) {
delay(8);
}
i1--;
- for (j1 = (2 + i2); j1 <= (7 - i2); j1 ++) {
- for (j3 = ((j1 - 1) * 20); j3 <= ((j1 - 1) * 20 + 19); j3 ++) {
+ for (j1 = (2 + i2); j1 <= (7 - i2); j1++) {
+ for (j3 = ((j1 - 1) * 20); j3 <= ((j1 - 1) * 20 + 19); j3++) {
byte *buf = pantalla2 + 4 + (j3 * 320) + ((i1 - 1) * 20);
Common::copy(buf, buf + 20, screenBuf + ((j3 * 320) + ((i1 - 1) * 20)));
}
@@ -513,8 +513,8 @@ void effect(byte numeroefecto, boolean pasaranegro, byte *pantalla2) {
delay(8);
}
j1--;
- for (i1 = (16 - i2); i1 >= (1 + i2); i1 --) {
- for (j3 = ((j1 - 1) * 20); j3 <= ((j1 - 1) * 20 + 19); j3 ++) {
+ for (i1 = (16 - i2); i1 >= (1 + i2); i1--) {
+ for (j3 = ((j1 - 1) * 20); j3 <= ((j1 - 1) * 20 + 19); j3++) {
byte *buf = pantalla2 + 4 + (j3 * 320) + ((i1 - 1) * 20);
Common::copy(buf, buf + 20, screenBuf + ((j3 * 320) + ((i1 - 1) * 20)));
}
@@ -522,8 +522,8 @@ void effect(byte numeroefecto, boolean pasaranegro, byte *pantalla2) {
delay(8);
}
i1++;
- for (j1 = (6 - i2); j1 >= (2 + i2); j1 --) {
- for (j3 = ((j1 - 1) * 20); j3 <= ((j1 - 1) * 20 + 19); j3 ++) {
+ for (j1 = (6 - i2); j1 >= (2 + i2); j1--) {
+ for (j3 = ((j1 - 1) * 20); j3 <= ((j1 - 1) * 20 + 19); j3++) {
byte *buf = pantalla2 + 4 + (j3 * 320) + ((i1 - 1) * 20);
Common::copy(buf, buf + 20, screenBuf + ((j3 * 320) + ((i1 - 1) * 20)));
}
@@ -583,7 +583,7 @@ void effect(byte numeroefecto, boolean pasaranegro, byte *pantalla2) {
delay(5);
for (j1 = 70; j1 > 0; j1--) {
byte *src1 = pantalla2 + 4 + j1 * 320;
- byte *src2 = pantalla2 + 4 + (139 - j1) * 320;
+ byte *src2 = pantalla2 + 4 + (139 - j1) * 320;
Common::copy(src1, src1 + 320, screenBuf + j1 * 320);
Common::copy(src2, src2 + 320, screenBuf + (139 - j1) * 320);
@@ -634,7 +634,7 @@ void turnLightOn() {
palette palpaso;
if (!paletteFile.open("PALETAS.DAT")) {
- error("turnLightOn(): ioresult (311)");
+ showError(311);
}
paletteFile.seek(1536);
paletteFile.read(palpaso, 768);
@@ -644,7 +644,7 @@ void turnLightOn() {
palpaso[3 * i + 0] = pal[3 * i + 0];
palpaso[3 * i + 1] = pal[3 * i + 1];
palpaso[3 * i + 2] = pal[3 * i + 2];
- // }
+ // }
} else {
palpaso[3 * i + 0] = palpaso[3 * i + 0] << 2;
palpaso[3 * i + 1] = palpaso[3 * i + 1] << 2;
@@ -705,13 +705,13 @@ void totalFadeIn(uint numeropaleta, Common::String nombrepaleta) {
Common::File fichpaleta;
if (numeropaleta > 0) {
if (!fichpaleta.open("PALETAS.DAT"))
- error("totalFadeIn(): ioresult (311)");
+ showError(311);
fichpaleta.seek(numeropaleta);
fichpaleta.read(palpaso, 768);
fichpaleta.close();
} else {
if (!fichpaleta.open(Common::Path(Common::String(nombrepaleta + ".PAL")))) {
- error("totalFadeIn(): ioresult (311)");
+ showError(311);
}
fichpaleta.read(palpaso, 768);
fichpaleta.close();
diff --git a/engines/tot/graphics.h b/engines/tot/graphics.h
index d0828c8aa6b..869f1b7f62d 100644
--- a/engines/tot/graphics.h
+++ b/engines/tot/graphics.h
@@ -26,7 +26,6 @@
namespace Tot {
-
void initGraph();
void getVirtualImg(uint getcoordx1, uint getcoordy1, uint getcoordx2, uint getcoordy2,
byte *backgroundScreen, byte *image);
diff --git a/engines/tot/graphman.h b/engines/tot/graphman.h
index 92f742fa88c..712b0384938 100644
--- a/engines/tot/graphman.h
+++ b/engines/tot/graphman.h
@@ -43,7 +43,7 @@ public:
void setPalette(byte palette[768], uint num = 256);
void restoreBackground(uint x, uint y, uint x2, uint y2);
- void littText(const Common::String &str, int x, int y, uint32 color, Graphics::TextAlign align = Graphics::kTextAlignLeft, bool alignCenterY = false);
+ void littText(const Common::String &str, int x, int y, uint32 color, Graphics::TextAlign align = Graphics::kTextAlignLeft, bool alignCenterY = false);
void euroText(const Common::String &str, int x, int y, uint32 color, Graphics::TextAlign align = Graphics::kTextAlignLeft, bool alignCenterY = false);
void biosText(const Common::String &str, int x, int y, uint32 color);
void clear();
diff --git a/engines/tot/mouseman.cpp b/engines/tot/mouseman.cpp
index 7c4e163a191..16d00476630 100644
--- a/engines/tot/mouseman.cpp
+++ b/engines/tot/mouseman.cpp
@@ -53,7 +53,6 @@ void MouseManager::animateMouseIfNeeded() {
}
}
-
void MouseManager::hide() {
CursorMan.showMouse(false);
}
@@ -86,7 +85,7 @@ void MouseManager::warpMouse(int mask, int x, int y) {
void MouseManager::loadMasks() {
Common::File mouseMaskFile;
if (!mouseMaskFile.open(Common::Path("RATON.ACA")))
- error("loadMouseMask(): ioresult! (317)");
+ _exit(317);
int numMouseMasks = mouseMaskFile.readByte();
int mouseMaskSize = mouseMaskFile.readUint16LE();
diff --git a/engines/tot/mouseman.h b/engines/tot/mouseman.h
index e05be0a443a..f3e47a109c7 100644
--- a/engines/tot/mouseman.h
+++ b/engines/tot/mouseman.h
@@ -21,8 +21,8 @@
#ifndef TOT_MOUSEMAN_H
#define TOT_MOUSEMAN_H
-#include "common/scummsys.h"
#include "common/rect.h"
+#include "common/scummsys.h"
#include "tot/chrono.h"
@@ -46,6 +46,7 @@ public:
void setMouseArea(Common::Rect rect);
void setMousePos(Common::Point p);
void printPos(int x, int y, int screenPosX, int screenPosY);
+
private:
Common::Rect _mouseArea;
int _currentMouseMask = 0;
diff --git a/engines/tot/playanim.cpp b/engines/tot/playanim.cpp
index 99685fb8c25..24b455f0ef4 100644
--- a/engines/tot/playanim.cpp
+++ b/engines/tot/playanim.cpp
@@ -30,7 +30,6 @@ namespace Tot {
int doserror = 0;
int exitcode = 0;
-
Common::MemorySeekableReadWriteStream *conversationData;
Common::MemorySeekableReadWriteStream *rooms;
Common::MemorySeekableReadWriteStream *invItemData;
@@ -133,7 +132,6 @@ uint segpasoicono;
uint ofspasoicono;
uint volumenmelodiaderecho, volumenmelodiaizquierdo;
-
int elemento1, elemento2;
int characterPosX, characterPosY;
@@ -182,14 +180,13 @@ byte rejamascararaton[10][10];
boolean completadalista1, completadalista2,
lista1, lista2;
+boolean primera[maxpersonajes],
+ lprimera[maxpersonajes],
+ cprimera[maxpersonajes],
+ libro[maxpersonajes],
+ caramelos[maxpersonajes];
-boolean primera[maxpersonajes],
- lprimera[maxpersonajes],
- cprimera[maxpersonajes],
- libro[maxpersonajes],
- caramelos[maxpersonajes];
-
-boolean cavernas[5];
+boolean cavernas[5];
uint16 firstList[5], secondList[5];
@@ -230,7 +227,6 @@ uint currentRoomNumber;
boolean isLoadingFromLauncher;
-
void clearObj() {
byte indpasolimpiador1, indpasolimpiador2;
@@ -274,56 +270,7 @@ void clearObj() {
}
void clearScreenData() {
- // debug("Clearing screen data! Shouldnt be necessary now!");
- // byte ilocal1, ilocal2, ilocal3;
- // uint ilocal4;
-
- // contadorpc2 = contadorpc;
- // roomData->codigo = 0;
- // roomData->puntimagenpantalla = 0;
- // roomData->tamimagenpantalla = 0;
- // for (ilocal1 = 0; ilocal1 <= 39; ilocal1++)
- // for (ilocal2 = 0; ilocal2 <= 27; ilocal2++) {
- // roomData->rejapantalla[ilocal1][ilocal2] = 0;
- // roomData->mouseGrid[ilocal1][ilocal2] = 0;
- // }
- // for (ilocal1 = 1; ilocal1 <= 9; ilocal1++)
- // for (ilocal2 = 1; ilocal2 <= 30; ilocal2++)
- // for (ilocal3 = 1; ilocal3 <= 5; ilocal3++) {
- // roomData->trayectories[ilocal1][ilocal2][ilocal3].x = 9999;
- // roomData->trayectories[ilocal1][ilocal2][ilocal3].y = 9999;
- // }
- // for (ilocal1 = 1; ilocal1 <= 5; ilocal1++) {
- // roomData->doors[ilocal1].pantallaquecarga = 0;
- // roomData->doors[ilocal1].posxsalida = 0;
- // roomData->doors[ilocal1].posysalida = 0;
- // roomData->doors[ilocal1].abiertacerrada = 0;
- // roomData->doors[ilocal1].codigopuerta = 0;
- // }
- // for (ilocal1 = 1; ilocal1 <= 15; ilocal1++) {
- // roomData->bitmapasociados[ilocal1].puntbitmap = 0;
- // roomData->bitmapasociados[ilocal1].tambitmap = 0;
- // roomData->bitmapasociados[ilocal1].coordx = 0;
- // roomData->bitmapasociados[ilocal1].coordy = 0;
- // roomData->bitmapasociados[ilocal1].profund = 0;
- // }
- // for (ilocal1 = 0; ilocal1 <= 50; ilocal1++) {
- // // if(roomData->indexadoobjetos[ilocal1] != NULL) {
- // // roomData->indexadoobjetos[ilocal1]->indicefichero = 0;
- // // roomData->indexadoobjetos[ilocal1]->objectName = "";
- // // }
- // }
- // roomData->banderamovimiento = false;
- // roomData->nombremovto = "QQQQQQQQ";
- // roomData->movementNameSize = 8;
- // roomData->banderapaleta = false;
- // roomData->puntpaleta = 0;
- // for (ilocal4 = 1; ilocal4 <= 300; ilocal4++) {
- // roomData->tray2[ilocal4].x = 0;
- // roomData->tray2[ilocal4].y = 0;
- // roomData->dir2[ilocal4] = 0;
- // }
- // roomData->longtray2 = 0;
+ // Do nothing
}
/**
@@ -333,18 +280,17 @@ void clearScreenData() {
* we assume only one room register is there.
*
* To save a game we merely copy the entire stream into the save.
-*/
+ */
void initializeScreenFile() {
Common::File roomFile;
if (!roomFile.open(Common::Path("PANTALLA.DAT"))) {
- error("Error opening room files: ioresult (320)");
+ showError(320);
}
int64 fileSize = roomFile.size();
delete (rooms);
-
byte *roomData = (byte *)malloc(roomRegSize * 32);
int roomCount = 0;
@@ -363,380 +309,6 @@ void initializeScreenFile() {
roomFile.close();
}
-void final_varanima() {
- // switch (exitcode) {
- // case 0: {
- // output << "Gracias por jugar con otro producto ACA Soft." << NL;
- // freemem(pasoicono, sizeicono);
- // } break;
- // case 1:
- // output << "Error 1: Funci�n no existe." << NL;
- // break;
- // case 2:
- // output << "Error 2: Fichero no encontrado." << NL;
- // break;
- // case 3:
- // output << "Error 3: Camino no encontrado." << NL;
- // break;
- // case 4:
- // output << "Error 4: Demasiados ficheros abiertos." << NL;
- // break;
- // case 5:
- // output << "Error 5: Acceso denegado." << NL;
- // break;
- // case 6:
- // output << "Error 6: Asignacion de fichero incorrecta." << NL;
- // break;
- // case RANGE_5(7, 11):
- // output << "Error " << exitcode << string(": Espera... La placa madre est�") + " teniendo gemelos." << NL;
- // break;
- // case 12:
- // output << "Error 12: C�digo de acceso a fichero incorrecto." << NL;
- // break;
- // case 13:
- // case 14:
- // output << "Error " << exitcode << string(": �Alguien ha visto por ah� un") + " bol�grafo?." << NL;
- // break;
- // case 15:
- // output << "Error 15: Unidad incorrecta." << NL;
- // break;
- // case 16:
- // output << "Error 16: No se puede borrar el directorio." << NL;
- // break;
- // case 17:
- // output << "Error 17: No se puede renombrar en distintas unidades." << NL;
- // break;
- // case 18:
- // output << "Error 18: No hay m�s ficheros." << NL;
- // break;
- // case 19 ... 99:
- // output << "Error " << exitcode << ": Mi, mi, mi, mi, mi.... etc." << NL;
- // break;
- // case 100:
- // output << "Error 100: No se pudo leer del disco." << NL;
- // break;
- // case 101:
- // output << "Error 101: No se pudo escribir en el disco." << NL;
- // break;
- // case 102:
- // output << "Error 102: Fichero sin asignar." << NL;
- // break;
- // case 103:
- // output << "Error 103: Fichero sin abrir." << NL;
- // break;
- // case 104:
- // output << "Error 104: Fichero abierto para salida." << NL;
- // break;
- // case 105:
- // output << "Error 105: Fichero abierto para entrada." << NL;
- // break;
- // case 106:
- // output << "Error 106: Formato num�rico no v�lido." << NL;
- // break;
- // case 107 ... 149:
- // output << "Error " << exitcode << ": Tr�fico intenso en el bus de datos." << NL;
- // break;
- // case 150:
- // output << "Error 150: Disco protegido contra escritura." << NL;
- // break;
- // case 151:
- // output << string("Error 151: El driver del disco devuelve una estructura") +
- // " incorrecta."
- // << NL;
- // break;
- // case 152:
- // output << "Error 152: Unidad no preparada." << NL;
- // break;
- // case 153:
- // output << "Error " << exitcode << ": JOZU!! que Barbari�." << NL;
- // break;
- // case 154:
- // output << string("Error 154: Comprobaci�n err�nea en el control de redundancia") +
- // " c�clica."
- // << NL;
- // break;
- // case 155:
- // output << "Error " << exitcode << ": Cerrado por vacaciones." << NL;
- // break;
- // case 156:
- // output << "Error 156: Posicionamiento err�neo en el fichero." << NL;
- // break;
- // case 157:
- // output << "Error 157: Disco de formato desconocido." << NL;
- // break;
- // case 158:
- // output << "Error 158: Sector no encontrado en el disco." << NL;
- // break;
- // case 159:
- // output << "Error 159: Impresora sin papel." << NL;
- // break;
- // case 160:
- // output << "Error 160: No se pudo escribir en el dispositivo." << NL;
- // break;
- // case 161:
- // output << "Error 161: No se pudo leer del dispositivo." << NL;
- // break;
- // case 162:
- // output << "Error 162: Problema con el dispositivo." << NL;
- // break;
- // case 163 ... 199:
- // output << "Error " << exitcode << ": No sabe, no contesta." << NL;
- // break;
- // case 200:
- // output << "Error 200: Division por cero." << NL;
- // break;
- // case 201:
- // output << "Error 201: Variable fuera de rango." << NL;
- // break;
- // case 202:
- // output << "Error 202: Desbordamiento en la pila." << NL;
- // break;
- // case 203:
- // output << "Error 203: Desbordamiento en la memoria din�mica." << NL;
- // break;
- // case 204:
- // output << "Error 204: Operaci�n err�nea con un puntero." << NL;
- // break;
- // case 205:
- // output << "Error 205: Desbordamiento en coma flotante." << NL;
- // break;
- // case 206:
- // output << "Error 206: Desbordamiento negativo en coma flotante." << NL;
- // break;
- // case 207:
- // output << "Error 207: Operaci�n err�nea de coma flotante." << NL;
- // break;
- // case 208:
- // output << "Error 208: Gestor de solapamiento sin instalar." << NL;
- // break;
- // case 209:
- // output << "Error 209: Lectura err�nea del fichero de solapamiento." << NL;
- // break;
- // case 210:
- // output << "Error 210: Objeto sin inicializar." << NL;
- // break;
- // case 211:
- // output << "Error 211: Llamada a un metodo abstracto." << NL;
- // break;
- // case 212:
- // output << "Error 212: Cadena de asignaci�n del objeto err�nea." << NL;
- // break;
- // case 213:
- // output << "Error 213: Indice para colecci�n fuera de rango." << NL;
- // break;
- // case 214:
- // output << "Error 214: Desbordamiento en la colecci�n." << NL;
- // break;
- // case 215:
- // output << "Error 215: Desbordamiento en operaci�n aritm�tica." << NL;
- // break;
- // case 216:
- // output << "Error 216: Acceso a memoria sin asignar." << NL;
- // break;
- // case 217 ... 249:
- // output << "Error " << exitcode << ": Dios mio... estoy lleno de chips." << NL;
- // break;
- // case 250:
- // output << "Error 250: El driver de AdLib no est� instalado." << NL;
- // break;
- // case 251:
- // output << "Error 251: Libre para AdLib." << NL;
- // break;
- // case 252:
- // output << string("Error 252: No se encontr� el fichero de efectos") + " para SBlaster." << NL;
- // break;
- // case 253:
- // output << string("Error 253: No se encontr� el fichero de m�sica ") + "para SBlaster." << NL;
- // break;
- // case 254:
- // output << string("Error 254: Libre para el fichero de configuraci�n del") +
- // " sonido."
- // << NL;
- // break;
- // case 255:
- // output << "Error 255: Detectado Ctrl-Break." << NL;
- // break;
- // case 256:
- // output << string("Error 256: La tarjeta de video no soporta el modo gr�fico ") + "requerido." << NL;
- // break;
- // case 257:
- // output << "Error 257: El tipo de pantalla no es correcto." << NL;
- // break;
- // case 258:
- // output << "Error 258: No se encontr� el fichero con la imagen del menu." << NL;
- // break;
- // case 259:
- // output << "Error 259: Clave de protecci�n erronea." << NL;
- // break;
- // case 260:
- // output << "Error 260: No se encontr� el driver del modo X de v�deo." << NL;
- // break;
- // case 261:
- // output << string("Error 261: No se encontr� el fichero de datos de los ") + "objetos." << NL;
- // break;
- // case 262:
- // output << "Error 262: No se encontr� el fichero de los BITMAP." << NL;
- // break;
- // case 263:
- // output << string("Error 263: No se encontr� el fichero de paleta para la ") + "imagen girando." << NL;
- // break;
- // case 264:
- // output << "Error 264: Se desbord� la pila de montaje de bitmaps" << NL;
- // break;
- // case 265:
- // output << "Error 265: No se encontr� el fichero de la animaci�n." << NL;
- // break;
- // case 266:
- // output << "Error 266: No se encontr� el fichero del efecto de sonido." << NL;
- // break;
- // case 267:
- // output << "Error 267: No se encontr� el fichero de la melodia." << NL;
- // break;
- // case 268:
- // output << "Error 268: No se encontr� el driver de sonido MIDI." << NL;
- // break;
- // case 269:
- // output << "Error 269: No se pudo capturar un vector de interrupci�n." << NL;
- // break;
- // case 270:
- // output << "Error 270: No se encontr� el fichero de los cr�ditos." << NL;
- // break;
- // case 271:
- // output << "Error 271: No se encontr� el fichero del BitMap del sello." << NL;
- // break;
- // case 272:
- // output << "Error 272: No se encontr� el fichero de la animaci�n." << NL;
- // break;
- // case 273:
- // output << string("Error 273: No se encontraron los �ndices de los modos X de") +
- // " acceso a v�deo."
- // << NL;
- // break;
- // case 274:
- // output << string("Error 274: Fichero de datos corrupto, instale de nuevo el") +
- // " programa."
- // << NL;
- // break;
- // case 275:
- // output << "Error 275: Posici�n incorrecta del Sprite." << NL;
- // break;
- // case 276:
- // output << "Error 276: Alineaci�n incorrecta del driver de sonido." << NL;
- // break;
- // case 277:
- // output << "Error 277: No se encontr� el fichero de la animaci�n." << NL;
- // break;
- // case 278:
- // output << "Error 278: No se encontr� el fichero para la actualizaci�n." << NL;
- // break;
- // case 279:
- // output << "Error 279: No se actualiz� el puntero del rat�n." << NL;
- // break;
- // case 280:
- // output << "Error 280: No se encontr� el puntero de video." << NL;
- // break;
- // case 281:
- // output << "Error 281: No se actualiz� el puntero de video." << NL;
- // break;
- // case 282:
- // output << "Error 282: No se actualiz� el flag del trace." << NL;
- // break;
- // case RANGE_16(283, 298):
- // output << "Error " << exitcode << ": Coffe not found. Operator Halted." << NL;
- // break;
- // case 299:
- // output << "Error 299: No se pudo reubicar los datos en la memoria XMS." << NL;
- // break;
- // case 300:
- // output << "Error 300: No hay memoria XMS suficiente." << NL;
- // break;
- // case 301:
- // output << "Error 301: No se pudo reservar memoria XMS suficiente." << NL;
- // break;
- // case 302:
- // output << "Error 302: No se pudo liberar la memoria XMS." << NL;
- // break;
- // case 303:
- // output << "Error 303: No se encuentra disponible un handle para XMS." << NL;
- // break;
- // case 304:
- // output << "Error 304: No se encontr� el fichero de gr�ficos." << NL;
- // break;
- // case 305:
- // output << string("Error 305: Necesita una versi�n 6.0 o posterior del driver") + " del rat�n." << NL;
- // break;
- // case 306:
- // output << string("Error 306: No se pudo inicializar correctamente el driver ") + "del rat�n." << NL;
- // break;
- // case 307:
- // output << "Error 307: No hay memoria baja suficiente. " << memavail() / 1024 << NL;
- // break;
- // case 308:
- // output << string("Error 308: No se pudo inicializar correctamente el modo") + " gr�fico." << NL;
- // break;
- // case 309:
- // output << string("Error 309: No se pudieron inicializar correctamente los ") + "tipos de letra." << NL;
- // break;
- // case 310:
- // output << "Error 310: No se encontr� el fichero de paleta." << NL;
- // break;
- // case 311:
- // output << "Error 311: No se encontr� el fichero de paleta para fundido." << NL;
- // break;
- // case 312:
- // output << string("Error 312: No se encontr� el fichero de los BITMAP del ") + "inventario." << NL;
- // break;
- // case 313:
- // output << "Error 313: No se encontr� el fichero de hipertexto." << NL;
- // break;
- // case 314:
- // output << string("Error 314: No se encontr� el fichero del arbol de ") + "conversaciones." << NL;
- // break;
- // case 315:
- // output << string("Error 315: No se encontr� el fichero de la pantalla a ") + "pintar." << NL;
- // break;
- // case 316:
- // output << string("Error 316: No se encontr� el fichero de la pantalla a") + " cargar." << NL;
- // break;
- // case 317:
- // output << string("Error 317: No se encontr� el fichero de las mascaras del") + " rat�n." << NL;
- // break;
- // case 318:
- // output << "Error 318: No se encontr� el fichero del diploma." << NL;
- // break;
- // case 319:
- // output << string("Error 319: No se encontr� el fichero de los objetos en") + " pantalla." << NL;
- // break;
- // case 320:
- // output << string("Error 320: No se encontr� el fichero de la rejilla de") + " pantalla." << NL;
- // break;
- // case 321:
- // output << "Error 321: No se encontr� el fichero del objeto rotando." << NL;
- // break;
- // case 322:
- // output << "Error 322: No se encontr� el fichero de la partida salvada." << NL;
- // break;
- // case 323:
- // output << "Error 323: No se encontr� el fichero de configuraci�n." << NL;
- // break;
- // default:
- // output << "Error " << exitcode << ": La parab�lica est� mal orientada." << NL;
- // }
- if (exitcode != 0) {
- // output << "Restaurando ficheros...." << NL;
- // initializeScreenFile();
- // // initializeObjectFile();
- // assign(kkfile, "GAME07.SAV");
-
- // if (ioresult == 0) {
- // close(kkfile);
- // erase(kkfile);
- // }
- // // movefile(diractual, diractual, "CONVERSA.TRE", "007");
- // output << "La partida temporal se ha eliminado." << NL;
- }
-}
-
void resetGameState() {
characterPosX = 160;
@@ -859,268 +431,268 @@ void initPlayAnim() {
debug("initplayanim!");
isLoadingFromLauncher = false;
decryptionKey = "23313212133122121312132132312312122132322131221322222112121"
- "32121121212112111212112333131232323213222132123211213221231"
- "32132213232333333213132132132322113212132121322123121232332"
- "23123221322213233221112312231221233232122332211112233122321"
- "222312211322312223";
+ "32121121212112111212112333131232323213222132123211213221231"
+ "32132213232333333213132132132322113212132121322123121232332"
+ "23123221322213233221112312231221233232122332211112233122321"
+ "222312211322312223";
rooms = nullptr;
conversationData = nullptr;
invItemData = nullptr;
// encriptado[0] = encripcod1;
- // encriptado[1] = '\63';
- // encriptado[2] = '\63';
- // encriptado[3] = encripcod1 - 1;
- // encriptado[4] = '\63';
- // encriptado[5] = encripcod1;
- // encriptado[6] = encripcod1 - 1;
- // encriptado[7] = encripcod1;
- // encriptado[8] = encripcod1 - 1;
- // encriptado[9] = '\63';
- // encriptado[10] = '\63';
- // encriptado[11] = encripcod1 - 1;
- // encriptado[12] = encripcod1;
- // encriptado[13] = encripcod1;
- // encriptado[14] = encripcod1 - 1;
- // encriptado[15] = encripcod1;
- // encriptado[16] = encripcod1 - 1;
- // encriptado[17] = '\63';
- // encriptado[18] = encripcod1 - 1;
- // encriptado[19] = encripcod1;
- // encriptado[20] = encripcod1 - 1;
- // encriptado[21] = '\63';
- // encriptado[22] = encripcod1;
- // encriptado[23] = encripcod1 - 1;
- // encriptado[24] = '\63';
- // encriptado[25] = encripcod1;
- // encriptado[26] = '\63';
- // encriptado[27] = encripcod1 - 1;
- // encriptado[28] = encripcod1;
- // encriptado[29] = '\63';
- // encriptado[30] = encripcod1 - 1;
- // encriptado[31] = encripcod1;
- // encriptado[32] = encripcod1 - 1;
- // encriptado[33] = encripcod1;
- // encriptado[34] = encripcod1;
- // encriptado[35] = encripcod1 - 1;
- // encriptado[36] = '\63';
- // encriptado[37] = encripcod1;
- // encriptado[38] = '\63';
- // encriptado[39] = encripcod1;
- // encriptado[40] = encripcod1;
- // encriptado[41] = encripcod1 - 1;
- // encriptado[42] = '\63';
- // encriptado[43] = encripcod1 - 1;
- // encriptado[44] = encripcod1;
- // encriptado[45] = encripcod1;
- // encriptado[46] = encripcod1 - 1;
- // encriptado[47] = '\63';
- // encriptado[48] = encripcod1;
- // encriptado[49] = encripcod1;
- // encriptado[50] = encripcod1;
- // encriptado[51] = encripcod1;
- // encriptado[52] = encripcod1;
- // encriptado[53] = encripcod1 - 1;
- // encriptado[54] = encripcod1 - 1;
- // encriptado[55] = encripcod1;
- // encriptado[56] = encripcod1 - 1;
- // encriptado[57] = encripcod1;
- // encriptado[58] = encripcod1 - 1;
- // encriptado[59] = '\63';
- // encriptado[60] = encripcod1;
- // encriptado[61] = encripcod1 - 1;
- // encriptado[62] = encripcod1;
- // encriptado[63] = encripcod1 - 1;
- // encriptado[64] = encripcod1 - 1;
- // encriptado[65] = encripcod1;
- // encriptado[66] = encripcod1 - 1;
- // encriptado[67] = encripcod1;
- // encriptado[68] = encripcod1 - 1;
- // encriptado[69] = encripcod1;
- // encriptado[70] = encripcod1 - 1;
- // encriptado[71] = encripcod1 - 1;
- // encriptado[72] = encripcod1;
- // encriptado[73] = encripcod1 - 1;
- // encriptado[74] = encripcod1 - 1;
- // encriptado[75] = encripcod1 - 1;
- // encriptado[76] = encripcod1;
- // encriptado[77] = encripcod1 - 1;
- // encriptado[78] = encripcod1;
- // encriptado[79] = encripcod1 - 1;
- // encriptado[80] = encripcod1 - 1;
- // encriptado[81] = encripcod1;
- // encriptado[82] = '\63';
- // encriptado[83] = '\63';
- // encriptado[84] = '\63';
- // encriptado[85] = encripcod1 - 1;
- // encriptado[86] = '\63';
- // encriptado[87] = encripcod1 - 1;
- // encriptado[88] = encripcod1;
- // encriptado[89] = '\63';
- // encriptado[90] = encripcod1;
- // encriptado[91] = '\63';
- // encriptado[92] = encripcod1;
- // encriptado[93] = '\63';
- // encriptado[94] = encripcod1;
- // encriptado[95] = encripcod1 - 1;
- // encriptado[96] = '\63';
- // encriptado[97] = encripcod1;
- // encriptado[98] = encripcod1;
- // encriptado[99] = encripcod1;
- // encriptado[100] = encripcod1 - 1;
- // encriptado[101] = '\63';
- // encriptado[102] = encripcod1;
- // encriptado[103] = encripcod1 - 1;
- // encriptado[104] = encripcod1;
- // encriptado[105] = '\63';
- // encriptado[106] = encripcod1;
- // encriptado[107] = encripcod1 - 1;
- // encriptado[108] = encripcod1 - 1;
- // encriptado[109] = encripcod1;
- // encriptado[110] = encripcod1 - 1;
- // encriptado[111] = '\63';
- // encriptado[112] = encripcod1;
- // encriptado[113] = encripcod1;
- // encriptado[114] = encripcod1 - 1;
- // encriptado[115] = encripcod1;
- // encriptado[116] = '\63';
- // encriptado[117] = encripcod1 - 1;
- // encriptado[118] = '\63';
- // encriptado[119] = encripcod1;
- // encriptado[120] = encripcod1 - 1;
- // encriptado[121] = '\63';
- // encriptado[122] = encripcod1;
- // encriptado[123] = encripcod1;
- // encriptado[124] = encripcod1 - 1;
- // encriptado[125] = '\63';
- // encriptado[126] = encripcod1;
- // encriptado[127] = '\63';
- // encriptado[128] = encripcod1;
- // encriptado[129] = '\63';
- // encriptado[130] = '\63';
- // encriptado[131] = '\63';
- // encriptado[132] = '\63';
- // encriptado[133] = '\63';
- // encriptado[134] = '\63';
- // encriptado[135] = encripcod1;
- // encriptado[136] = encripcod1 - 1;
- // encriptado[137] = '\63';
- // encriptado[138] = encripcod1 - 1;
- // encriptado[139] = '\63';
- // encriptado[140] = encripcod1;
- // encriptado[141] = encripcod1 - 1;
- // encriptado[142] = '\63';
- // encriptado[143] = encripcod1;
- // encriptado[144] = encripcod1 - 1;
- // encriptado[145] = '\63';
- // encriptado[146] = encripcod1;
- // encriptado[147] = '\63';
- // encriptado[148] = encripcod1;
- // encriptado[149] = encripcod1;
- // encriptado[150] = encripcod1 - 1;
- // encriptado[151] = encripcod1 - 1;
- // encriptado[152] = '\63';
- // encriptado[153] = encripcod1;
- // encriptado[154] = encripcod1 - 1;
- // encriptado[155] = encripcod1;
- // encriptado[156] = encripcod1 - 1;
- // encriptado[157] = '\63';
- // encriptado[158] = encripcod1;
- // encriptado[159] = encripcod1 - 1;
- // encriptado[160] = encripcod1;
- // encriptado[161] = encripcod1 - 1;
- // encriptado[162] = '\63';
- // encriptado[163] = encripcod1;
- // encriptado[164] = encripcod1;
- // encriptado[165] = encripcod1 - 1;
- // encriptado[166] = encripcod1;
- // encriptado[167] = '\63';
- // encriptado[168] = encripcod1 - 1;
- // encriptado[169] = encripcod1;
- // encriptado[170] = encripcod1 - 1;
- // encriptado[171] = encripcod1;
- // encriptado[172] = '\63';
- // encriptado[173] = encripcod1;
- // encriptado[174] = '\63';
- // encriptado[175] = '\63';
- // encriptado[176] = encripcod1;
- // encriptado[177] = encripcod1;
- // encriptado[178] = '\63';
- // encriptado[179] = encripcod1 - 1;
- // encriptado[180] = encripcod1;
- // encriptado[181] = '\63';
- // encriptado[182] = encripcod1;
- // encriptado[183] = encripcod1;
- // encriptado[184] = encripcod1 - 1;
- // encriptado[185] = '\63';
- // encriptado[186] = encripcod1;
- // encriptado[187] = encripcod1;
- // encriptado[188] = encripcod1;
- // encriptado[189] = encripcod1 - 1;
- // encriptado[190] = '\63';
- // encriptado[191] = encripcod1;
- // encriptado[192] = '\63';
- // encriptado[193] = '\63';
- // encriptado[194] = encripcod1;
- // encriptado[195] = encripcod1;
- // encriptado[196] = encripcod1 - 1;
- // encriptado[197] = encripcod1 - 1;
- // encriptado[198] = encripcod1 - 1;
- // encriptado[199] = encripcod1;
- // encriptado[200] = '\63';
- // encriptado[201] = encripcod1 - 1;
- // encriptado[202] = encripcod1;
- // encriptado[203] = encripcod1;
- // encriptado[204] = '\63';
- // encriptado[205] = encripcod1 - 1;
- // encriptado[206] = encripcod1;
- // encriptado[207] = encripcod1;
- // encriptado[208] = encripcod1 - 1;
- // encriptado[209] = encripcod1;
- // encriptado[210] = '\63';
- // encriptado[211] = '\63';
- // encriptado[212] = encripcod1;
- // encriptado[213] = '\63';
- // encriptado[214] = encripcod1;
- // encriptado[215] = encripcod1 - 1;
- // encriptado[216] = encripcod1;
- // encriptado[217] = encripcod1;
- // encriptado[218] = '\63';
- // encriptado[219] = '\63';
- // encriptado[220] = encripcod1;
- // encriptado[221] = encripcod1;
- // encriptado[222] = encripcod1 - 1;
- // encriptado[223] = encripcod1 - 1;
- // encriptado[224] = encripcod1 - 1;
- // encriptado[225] = encripcod1 - 1;
- // encriptado[226] = encripcod1;
- // encriptado[227] = encripcod1;
- // encriptado[228] = '\63';
- // encriptado[229] = '\63';
- // encriptado[230] = encripcod1 - 1;
- // encriptado[231] = encripcod1;
- // encriptado[232] = encripcod1;
- // encriptado[233] = '\63';
- // encriptado[234] = encripcod1;
- // encriptado[235] = encripcod1 - 1;
- // encriptado[236] = encripcod1;
- // encriptado[237] = encripcod1;
- // encriptado[238] = encripcod1;
- // encriptado[239] = '\63';
- // encriptado[240] = encripcod1 - 1;
- // encriptado[241] = encripcod1;
- // encriptado[242] = encripcod1;
- // encriptado[243] = encripcod1 - 1;
- // encriptado[244] = encripcod1 - 1;
- // encriptado[245] = '\63';
- // encriptado[246] = encripcod1;
- // encriptado[247] = encripcod1;
- // encriptado[248] = '\63';
- // encriptado[249] = encripcod1 - 1;
- // encriptado[250] = encripcod1;
- // encriptado[251] = encripcod1;
- // encriptado[252] = encripcod1;
- // encriptado[253] = '\63';
+ // encriptado[1] = '\63';
+ // encriptado[2] = '\63';
+ // encriptado[3] = encripcod1 - 1;
+ // encriptado[4] = '\63';
+ // encriptado[5] = encripcod1;
+ // encriptado[6] = encripcod1 - 1;
+ // encriptado[7] = encripcod1;
+ // encriptado[8] = encripcod1 - 1;
+ // encriptado[9] = '\63';
+ // encriptado[10] = '\63';
+ // encriptado[11] = encripcod1 - 1;
+ // encriptado[12] = encripcod1;
+ // encriptado[13] = encripcod1;
+ // encriptado[14] = encripcod1 - 1;
+ // encriptado[15] = encripcod1;
+ // encriptado[16] = encripcod1 - 1;
+ // encriptado[17] = '\63';
+ // encriptado[18] = encripcod1 - 1;
+ // encriptado[19] = encripcod1;
+ // encriptado[20] = encripcod1 - 1;
+ // encriptado[21] = '\63';
+ // encriptado[22] = encripcod1;
+ // encriptado[23] = encripcod1 - 1;
+ // encriptado[24] = '\63';
+ // encriptado[25] = encripcod1;
+ // encriptado[26] = '\63';
+ // encriptado[27] = encripcod1 - 1;
+ // encriptado[28] = encripcod1;
+ // encriptado[29] = '\63';
+ // encriptado[30] = encripcod1 - 1;
+ // encriptado[31] = encripcod1;
+ // encriptado[32] = encripcod1 - 1;
+ // encriptado[33] = encripcod1;
+ // encriptado[34] = encripcod1;
+ // encriptado[35] = encripcod1 - 1;
+ // encriptado[36] = '\63';
+ // encriptado[37] = encripcod1;
+ // encriptado[38] = '\63';
+ // encriptado[39] = encripcod1;
+ // encriptado[40] = encripcod1;
+ // encriptado[41] = encripcod1 - 1;
+ // encriptado[42] = '\63';
+ // encriptado[43] = encripcod1 - 1;
+ // encriptado[44] = encripcod1;
+ // encriptado[45] = encripcod1;
+ // encriptado[46] = encripcod1 - 1;
+ // encriptado[47] = '\63';
+ // encriptado[48] = encripcod1;
+ // encriptado[49] = encripcod1;
+ // encriptado[50] = encripcod1;
+ // encriptado[51] = encripcod1;
+ // encriptado[52] = encripcod1;
+ // encriptado[53] = encripcod1 - 1;
+ // encriptado[54] = encripcod1 - 1;
+ // encriptado[55] = encripcod1;
+ // encriptado[56] = encripcod1 - 1;
+ // encriptado[57] = encripcod1;
+ // encriptado[58] = encripcod1 - 1;
+ // encriptado[59] = '\63';
+ // encriptado[60] = encripcod1;
+ // encriptado[61] = encripcod1 - 1;
+ // encriptado[62] = encripcod1;
+ // encriptado[63] = encripcod1 - 1;
+ // encriptado[64] = encripcod1 - 1;
+ // encriptado[65] = encripcod1;
+ // encriptado[66] = encripcod1 - 1;
+ // encriptado[67] = encripcod1;
+ // encriptado[68] = encripcod1 - 1;
+ // encriptado[69] = encripcod1;
+ // encriptado[70] = encripcod1 - 1;
+ // encriptado[71] = encripcod1 - 1;
+ // encriptado[72] = encripcod1;
+ // encriptado[73] = encripcod1 - 1;
+ // encriptado[74] = encripcod1 - 1;
+ // encriptado[75] = encripcod1 - 1;
+ // encriptado[76] = encripcod1;
+ // encriptado[77] = encripcod1 - 1;
+ // encriptado[78] = encripcod1;
+ // encriptado[79] = encripcod1 - 1;
+ // encriptado[80] = encripcod1 - 1;
+ // encriptado[81] = encripcod1;
+ // encriptado[82] = '\63';
+ // encriptado[83] = '\63';
+ // encriptado[84] = '\63';
+ // encriptado[85] = encripcod1 - 1;
+ // encriptado[86] = '\63';
+ // encriptado[87] = encripcod1 - 1;
+ // encriptado[88] = encripcod1;
+ // encriptado[89] = '\63';
+ // encriptado[90] = encripcod1;
+ // encriptado[91] = '\63';
+ // encriptado[92] = encripcod1;
+ // encriptado[93] = '\63';
+ // encriptado[94] = encripcod1;
+ // encriptado[95] = encripcod1 - 1;
+ // encriptado[96] = '\63';
+ // encriptado[97] = encripcod1;
+ // encriptado[98] = encripcod1;
+ // encriptado[99] = encripcod1;
+ // encriptado[100] = encripcod1 - 1;
+ // encriptado[101] = '\63';
+ // encriptado[102] = encripcod1;
+ // encriptado[103] = encripcod1 - 1;
+ // encriptado[104] = encripcod1;
+ // encriptado[105] = '\63';
+ // encriptado[106] = encripcod1;
+ // encriptado[107] = encripcod1 - 1;
+ // encriptado[108] = encripcod1 - 1;
+ // encriptado[109] = encripcod1;
+ // encriptado[110] = encripcod1 - 1;
+ // encriptado[111] = '\63';
+ // encriptado[112] = encripcod1;
+ // encriptado[113] = encripcod1;
+ // encriptado[114] = encripcod1 - 1;
+ // encriptado[115] = encripcod1;
+ // encriptado[116] = '\63';
+ // encriptado[117] = encripcod1 - 1;
+ // encriptado[118] = '\63';
+ // encriptado[119] = encripcod1;
+ // encriptado[120] = encripcod1 - 1;
+ // encriptado[121] = '\63';
+ // encriptado[122] = encripcod1;
+ // encriptado[123] = encripcod1;
+ // encriptado[124] = encripcod1 - 1;
+ // encriptado[125] = '\63';
+ // encriptado[126] = encripcod1;
+ // encriptado[127] = '\63';
+ // encriptado[128] = encripcod1;
+ // encriptado[129] = '\63';
+ // encriptado[130] = '\63';
+ // encriptado[131] = '\63';
+ // encriptado[132] = '\63';
+ // encriptado[133] = '\63';
+ // encriptado[134] = '\63';
+ // encriptado[135] = encripcod1;
+ // encriptado[136] = encripcod1 - 1;
+ // encriptado[137] = '\63';
+ // encriptado[138] = encripcod1 - 1;
+ // encriptado[139] = '\63';
+ // encriptado[140] = encripcod1;
+ // encriptado[141] = encripcod1 - 1;
+ // encriptado[142] = '\63';
+ // encriptado[143] = encripcod1;
+ // encriptado[144] = encripcod1 - 1;
+ // encriptado[145] = '\63';
+ // encriptado[146] = encripcod1;
+ // encriptado[147] = '\63';
+ // encriptado[148] = encripcod1;
+ // encriptado[149] = encripcod1;
+ // encriptado[150] = encripcod1 - 1;
+ // encriptado[151] = encripcod1 - 1;
+ // encriptado[152] = '\63';
+ // encriptado[153] = encripcod1;
+ // encriptado[154] = encripcod1 - 1;
+ // encriptado[155] = encripcod1;
+ // encriptado[156] = encripcod1 - 1;
+ // encriptado[157] = '\63';
+ // encriptado[158] = encripcod1;
+ // encriptado[159] = encripcod1 - 1;
+ // encriptado[160] = encripcod1;
+ // encriptado[161] = encripcod1 - 1;
+ // encriptado[162] = '\63';
+ // encriptado[163] = encripcod1;
+ // encriptado[164] = encripcod1;
+ // encriptado[165] = encripcod1 - 1;
+ // encriptado[166] = encripcod1;
+ // encriptado[167] = '\63';
+ // encriptado[168] = encripcod1 - 1;
+ // encriptado[169] = encripcod1;
+ // encriptado[170] = encripcod1 - 1;
+ // encriptado[171] = encripcod1;
+ // encriptado[172] = '\63';
+ // encriptado[173] = encripcod1;
+ // encriptado[174] = '\63';
+ // encriptado[175] = '\63';
+ // encriptado[176] = encripcod1;
+ // encriptado[177] = encripcod1;
+ // encriptado[178] = '\63';
+ // encriptado[179] = encripcod1 - 1;
+ // encriptado[180] = encripcod1;
+ // encriptado[181] = '\63';
+ // encriptado[182] = encripcod1;
+ // encriptado[183] = encripcod1;
+ // encriptado[184] = encripcod1 - 1;
+ // encriptado[185] = '\63';
+ // encriptado[186] = encripcod1;
+ // encriptado[187] = encripcod1;
+ // encriptado[188] = encripcod1;
+ // encriptado[189] = encripcod1 - 1;
+ // encriptado[190] = '\63';
+ // encriptado[191] = encripcod1;
+ // encriptado[192] = '\63';
+ // encriptado[193] = '\63';
+ // encriptado[194] = encripcod1;
+ // encriptado[195] = encripcod1;
+ // encriptado[196] = encripcod1 - 1;
+ // encriptado[197] = encripcod1 - 1;
+ // encriptado[198] = encripcod1 - 1;
+ // encriptado[199] = encripcod1;
+ // encriptado[200] = '\63';
+ // encriptado[201] = encripcod1 - 1;
+ // encriptado[202] = encripcod1;
+ // encriptado[203] = encripcod1;
+ // encriptado[204] = '\63';
+ // encriptado[205] = encripcod1 - 1;
+ // encriptado[206] = encripcod1;
+ // encriptado[207] = encripcod1;
+ // encriptado[208] = encripcod1 - 1;
+ // encriptado[209] = encripcod1;
+ // encriptado[210] = '\63';
+ // encriptado[211] = '\63';
+ // encriptado[212] = encripcod1;
+ // encriptado[213] = '\63';
+ // encriptado[214] = encripcod1;
+ // encriptado[215] = encripcod1 - 1;
+ // encriptado[216] = encripcod1;
+ // encriptado[217] = encripcod1;
+ // encriptado[218] = '\63';
+ // encriptado[219] = '\63';
+ // encriptado[220] = encripcod1;
+ // encriptado[221] = encripcod1;
+ // encriptado[222] = encripcod1 - 1;
+ // encriptado[223] = encripcod1 - 1;
+ // encriptado[224] = encripcod1 - 1;
+ // encriptado[225] = encripcod1 - 1;
+ // encriptado[226] = encripcod1;
+ // encriptado[227] = encripcod1;
+ // encriptado[228] = '\63';
+ // encriptado[229] = '\63';
+ // encriptado[230] = encripcod1 - 1;
+ // encriptado[231] = encripcod1;
+ // encriptado[232] = encripcod1;
+ // encriptado[233] = '\63';
+ // encriptado[234] = encripcod1;
+ // encriptado[235] = encripcod1 - 1;
+ // encriptado[236] = encripcod1;
+ // encriptado[237] = encripcod1;
+ // encriptado[238] = encripcod1;
+ // encriptado[239] = '\63';
+ // encriptado[240] = encripcod1 - 1;
+ // encriptado[241] = encripcod1;
+ // encriptado[242] = encripcod1;
+ // encriptado[243] = encripcod1 - 1;
+ // encriptado[244] = encripcod1 - 1;
+ // encriptado[245] = '\63';
+ // encriptado[246] = encripcod1;
+ // encriptado[247] = encripcod1;
+ // encriptado[248] = '\63';
+ // encriptado[249] = encripcod1 - 1;
+ // encriptado[250] = encripcod1;
+ // encriptado[251] = encripcod1;
+ // encriptado[252] = encripcod1;
+ // encriptado[253] = '\63';
tocapintar = false;
for (int i = 0; i < numobjetosconv; i++) {
screenObjects[i] = NULL;
diff --git a/engines/tot/playanim.h b/engines/tot/playanim.h
index 557947bb02b..1c523566bad 100644
--- a/engines/tot/playanim.h
+++ b/engines/tot/playanim.h
@@ -21,9 +21,9 @@
#ifndef TOT_PLAYANIM_H
#define TOT_PLAYANIM_H
-#include "common/scummsys.h"
#include "common/file.h"
#include "common/memstream.h"
+#include "common/scummsys.h"
#include "tot/util.h"
@@ -130,7 +130,7 @@ struct inventoryBitmaps {
struct regismht {
Common::String cadenatext; // string
boolean encadenado; // true if the next entry is a continuation of this one
- uint16 respuesta; // entry number of reply
+ uint16 respuesta; // entry number of reply
int32 punteronil;
};
@@ -139,13 +139,13 @@ struct InvItemRegister {
* registry number
*/
uint16 code;
- byte altura; /* 0 top 1 middle 2 bottom*/
- Common::String name; /*name for mouseover*/
- uint16 lookAtTextRef; /* Registro al mirar el objeto en pantalla */
+ byte altura; /* 0 top 1 middle 2 bottom*/
+ Common::String name; /*name for mouseover*/
+ uint16 lookAtTextRef; /* Registro al mirar el objeto en pantalla */
uint16 beforeUseTextRef; /* Registro antes de usar el objeto en mochila */
- uint16 afterUseTextRef; /* Registro despues de usar el objeto en mochila */
- uint16 pickTextRef; /* Registro al coger el objeto */
- uint16 useTextRef; /* Registro al usar el objeto */
+ uint16 afterUseTextRef; /* Registro despues de usar el objeto en mochila */
+ uint16 pickTextRef; /* Registro al coger el objeto */
+ uint16 useTextRef; /* Registro al usar el objeto */
byte habla; /* number of character to respond */
boolean abrir; /* true if it can be opened */
boolean cerrar; /* true if it can be closed*/
@@ -281,10 +281,10 @@ struct regispartida {
uint16 firstList[5], secondList[5];
Common::Point trayec[300];
boolean primera[maxpersonajes],
- lprimera[maxpersonajes],
- cprimera[maxpersonajes],
- libro[maxpersonajes],
- caramelos[maxpersonajes];
+ lprimera[maxpersonajes],
+ cprimera[maxpersonajes],
+ libro[maxpersonajes],
+ caramelos[maxpersonajes];
boolean cavernas[5];
uint hornacina[2][4];
@@ -567,19 +567,18 @@ extern boolean completadalista1,
lista1, // whether we've been given list 1
lista2; // whether we've been given list 2
+extern boolean primera[maxpersonajes],
+ lprimera[maxpersonajes],
+ cprimera[maxpersonajes],
+ libro[maxpersonajes],
+ caramelos[maxpersonajes];
-extern boolean primera[maxpersonajes],
- lprimera[maxpersonajes],
- cprimera[maxpersonajes],
- libro[maxpersonajes],
- caramelos[maxpersonajes];
-
-extern boolean cavernas[5];
+extern boolean cavernas[5];
/**
* First and second lists of objects to retrieve in the game
*/
-extern uint16 firstList[5],
- secondList[5];
+extern uint16 firstList[5],
+ secondList[5];
/**
* Animation sequence
*/
diff --git a/engines/tot/routines.cpp b/engines/tot/routines.cpp
index 44a8857a5b4..1666bd89f8d 100644
--- a/engines/tot/routines.cpp
+++ b/engines/tot/routines.cpp
@@ -121,7 +121,6 @@ void updateMovementCells() {
currentRoomData->mouseGrid[oldposx + i1arm][oldposy + i2arm] = rejafondoraton[i1arm][i2arm];
}
-
for (i1arm = 0; i1arm < maxrejax; i1arm++)
for (i2arm = 0; i2arm < maxrejay; i2arm++) {
rejafondomovto[i1arm][i2arm] = currentRoomData->rejapantalla[j1arm + i1arm][j2arm + i2arm];
@@ -151,7 +150,7 @@ static uint posfondox,
/**
* Calculated using the position of the character + dimension
*/
-static uint posfondox2, posfondoy2;
+static uint posfondox2, posfondoy2;
static void assembleBackground() {
uint posabs;
@@ -238,8 +237,7 @@ static void overlayObject() {
(depthMap[indice].posx <= posfondox2) &&
(depthMap[indice].posx2 > posfondox) &&
(depthMap[indice].posy < posfondoy2) &&
- (depthMap[indice].posy2 > posfondoy)
- ) {
+ (depthMap[indice].posy2 > posfondoy)) {
assembleImage(screenObjects[indice], depthMap[indice].posx, depthMap[indice].posy);
}
}
@@ -333,14 +331,14 @@ void sprites(boolean pintapersonaje) {
if ((pasoframeH + characterPosY) > (animado.posy + pasoanimadoH)) {
patchH = pasoframeH + 6 + abs(characterPosY - animado.posy);
} else {
- patchH = pasoanimadoH + 6 + abs(characterPosY - animado.posy);
+ patchH = pasoanimadoH + 6 + abs(characterPosY - animado.posy);
}
- if(posfondoy + patchH > 140) {
+ if (posfondoy + patchH > 140) {
patchH -= (posfondoy + patchH) - 140 + 1;
}
- if(posfondox + patchW > 320) {
+ if (posfondox + patchW > 320) {
patchW -= (posfondox + patchW) - 320 + 1;
}
@@ -351,7 +349,7 @@ void sprites(boolean pintapersonaje) {
assembleBackground(); // {Montar el Sprite Total}
indice = 0;
- while (indice != nivelesdeprof){
+ while (indice != nivelesdeprof) {
overlayObject();
if (animado.profundidad == indice)
assembleImage(pasoanimado, animado.posx, animado.posy);
@@ -372,11 +370,11 @@ void sprites(boolean pintapersonaje) {
pasoanimadoW = READ_LE_UINT16(pasoanimado) + 6;
pasoanimadoH = READ_LE_UINT16(pasoanimado + 2) + 6;
- if(posfondoy + pasoanimadoH > 140) {
+ if (posfondoy + pasoanimadoH > 140) {
pasoanimadoH -= (posfondoy + pasoanimadoH) - 140 + 1;
}
- if(posfondox + pasoanimadoW > 320) {
+ if (posfondox + pasoanimadoW > 320) {
pasoanimadoW -= (posfondox + pasoanimadoW) - 320 + 1;
}
@@ -468,7 +466,7 @@ void animatedSequence(uint numSequence) {
guadaxframe = characterPosX;
characterPosX = 3;
if (!animationFile.open("POZO01.DAT")) {
- error("277");
+ showError(277);
}
animx = 127;
animy = 70;
@@ -508,7 +506,7 @@ void animatedSequence(uint numSequence) {
} break;
case 2: {
if (!animationFile.open("POZOATR.DAT")) {
- error("277");
+ showError(277);
}
animx = 127;
guadaxframe = characterPosX;
@@ -555,7 +553,7 @@ void animatedSequence(uint numSequence) {
guadaxframe = characterPosX;
characterPosX = 3;
if (!animationFile.open("POZO02.DAT")) {
- error("277");
+ showError(277);
}
animx = 127;
animy = 70;
@@ -598,7 +596,7 @@ void animatedSequence(uint numSequence) {
case 4: {
adjustKey();
if (!animationFile.open("TIOLLAVE.DAT")) {
- error("277");
+ showError(277);
}
animx = 85;
animy = 15;
@@ -659,7 +657,7 @@ void animatedSequence(uint numSequence) {
} break;
case 5: {
if (!animationFile.open("TIOSACO.DAT")) {
- error("277");
+ showError(277);
}
animx = 204;
animy = 44;
@@ -707,7 +705,7 @@ void animatedSequence(uint numSequence) {
case 6: {
currentRoomData->banderamovimiento = false;
if (!animationFile.open("AZCCOG.DAT")) {
- error("277");
+ showError(277);
}
tamsecani = animationFile.readUint16LE();
numframessec = animationFile.readByte();
@@ -787,8 +785,8 @@ RoomObjectListEntry *readRegIndexadoObjetos(Common::SeekableReadStream *screenDa
return objectMetadata;
}
-RoomFileRegister* readScreenDataFile(Common::SeekableReadStream *screenDataFile) {
- RoomFileRegister* screenData = new RoomFileRegister();
+RoomFileRegister *readScreenDataFile(Common::SeekableReadStream *screenDataFile) {
+ RoomFileRegister *screenData = new RoomFileRegister();
screenData->codigo = screenDataFile->readUint16LE();
screenData->puntimagenpantalla = screenDataFile->readUint32LE();
screenData->tamimagenpantalla = screenDataFile->readUint16LE();
@@ -1093,19 +1091,19 @@ void calculateRoute(byte zona1, byte zona2, boolean extraCorrection, boolean zon
}
} else {
if ((mainRoute[pasos].y + rectificaciony) == 9999) {
- pasos -= 1;
+ pasos -= 1;
}
- if(extraCorrection) {
+ if (extraCorrection) {
switch (currentRoomData->codigo) {
- case 5:
- if (zona2 == 27)
- pasos += 1;
- break;
- case 6:
- if (zona2 == 21)
- pasos += 1;
- break;
- }
+ case 5:
+ if (zona2 == 27)
+ pasos += 1;
+ break;
+ case 6:
+ if (zona2 == 21)
+ pasos += 1;
+ break;
+ }
}
}
if (extraCorrection && zonavedada) {
@@ -1125,7 +1123,7 @@ void goToObject(byte zona1, byte zona2) {
contadorpc2 = contadorpc;
- for(int indicepaso = 0; indicepaso < 5; indicepaso++) {
+ for (int indicepaso = 0; indicepaso < 5; indicepaso++) {
if (currentRoomData->doors[indicepaso].codigopuerta == zona2) {
zonavedada = true;
break;
@@ -1234,7 +1232,7 @@ void advanceAnimations(boolean zonavedada, boolean animateMouse) {
if (iframe2 >= secondaryAnimationFrameCount - 1)
iframe2 = 0;
else
- iframe2 ++;
+ iframe2++;
animado.posx = currentRoomData->tray2[indicetray2 - 1].x;
animado.posy = currentRoomData->tray2[indicetray2 - 1].y;
animado.dir = currentRoomData->dir2[indicetray2 - 1];
@@ -1645,9 +1643,9 @@ void pickupScreenObject() {
} break;
}
switch (regobj.altura) {
- case 0: { //Pick up above
+ case 0: { // Pick up above
switch (regobj.code) {
- case 590: { //Ectoplasm
+ case 590: { // Ectoplasm
animatePickup1(3, 0);
animatePickup2(3, 0);
} break;
@@ -1677,7 +1675,7 @@ void pickupScreenObject() {
animatePickup1(0, 1);
animatePickup2(0, 1);
} break;
- case 402: { //Kitchen table
+ case 402: { // Kitchen table
animatePickup1(0, 1);
updateVideo();
animatePickup2(0, 1);
@@ -1721,9 +1719,9 @@ void pickupScreenObject() {
} break;
case 562: { // alcove
switch (currentRoomData->codigo) {
- case 20: { //First scene with alcove
+ case 20: { // First scene with alcove
if (hornacina[0][hornacina[0][3]] > 0) {
- //Possibly
+ // Possibly
if (hornacina[0][3] == 2 || hornacina[0][hornacina[0][3]] == 563) {
readItemRegister(hornacina[0][hornacina[0][3]]);
hornacina[0][hornacina[0][3]] = 0;
@@ -1789,7 +1787,7 @@ void pickupScreenObject() {
return;
}
} break;
- case 24: { //Second scene with alcove
+ case 24: { // Second scene with alcove
if (hornacina[1][hornacina[1][3]] > 0 && hornacina[1][3] != 1) {
if (hornacina[1][3] == 2) {
readItemRegister(hornacina[1][2]);
@@ -1889,12 +1887,12 @@ void pickupScreenObject() {
}
}
} break;
- case 2: { //Pick up feet level
+ case 2: { // Pick up feet level
switch (regobj.code) {
case 216: { // chisel
animatePickup1(0, 2);
currentRoomData->indexadoobjetos[currentRoomData->mouseGrid
- [mouseX][mouseY]]
+ [mouseX][mouseY]]
->indicefichero = regobj.reemplazarpor;
updateVideo();
animatePickup2(0, 2);
@@ -1902,7 +1900,7 @@ void pickupScreenObject() {
case 295: { // candles
animatePickup1(3, 2);
currentRoomData->indexadoobjetos[currentRoomData->mouseGrid
- [mouseX][mouseY]]
+ [mouseX][mouseY]]
->indicefichero = regobj.reemplazarpor;
updateVideo();
animatePickup2(3, 2);
@@ -2002,7 +2000,7 @@ void pickupScreenObject() {
} break;
case 308:; // mistletoe
break;
- case 362:;// charcoal
+ case 362:; // charcoal
break;
case 402: {
currentRoomData->bitmapasociados[5].puntbitmap = 68130;
@@ -2044,11 +2042,11 @@ void pickupScreenObject() {
}
indicemochila = 0;
- while (mobj[indicemochila].code != 0){
+ while (mobj[indicemochila].code != 0) {
indicemochila += 1;
}
- mobj[indicemochila].bitmapIndex =regobj.objectIconBitmap;
+ mobj[indicemochila].bitmapIndex = regobj.objectIconBitmap;
mobj[indicemochila].code = regobj.code;
mobj[indicemochila].objectName = regobj.name;
g_engine->_mouseManager->hide();
@@ -2076,7 +2074,7 @@ void dropObjectInScreen(InvItemRegister regobjsustituto) {
if (regobjsustituto.tambitmap > 0) {
indicepaso = 0;
while (!(currentRoomData->bitmapasociados[indicepaso].tambitmap == 0) || indicepaso == 15) {
- indicepaso ++;
+ indicepaso++;
}
if (currentRoomData->bitmapasociados[indicepaso].tambitmap == 0) {
{
@@ -2095,7 +2093,7 @@ void dropObjectInScreen(InvItemRegister regobjsustituto) {
currentRoomData->mouseGrid[indicex][indicey] = regobjsustituto.parcherejaraton[indicex - regobjsustituto.xrej1][indicey - regobjsustituto.yrej1];
}
} else
- _exit(264);
+ showError(264);
}
}
@@ -2118,8 +2116,7 @@ void useScreenObject() {
goToObject(
currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory],
- currentRoomData->rejapantalla[mouseX][mouseY]
- );
+ currentRoomData->rejapantalla[mouseX][mouseY]);
if (regobj.usarcon == screenObject && screenObject > 0 && regobj.usar[0] == 5) {
switch (regobj.usarcon) {
@@ -2659,16 +2656,10 @@ void useScreenObject() {
indicemochila += 1;
}
- // Common::File fichobj;
- // if (!fichobj.open("OBJETOS.DAT")) {
- // error("261");
- // }
-
invItemData->seek(regobj.code);
- // TODO:Save!
- // fichobj << regobj;
+
+ saveItem(regobj, invItemData);
readItemRegister(invItemData, 221, regobj);
- // fichobj.close();
mobj[indicemochila].bitmapIndex = regobj.objectIconBitmap;
mobj[indicemochila].code = regobj.code;
mobj[indicemochila].objectName = regobj.name;
@@ -3026,7 +3017,7 @@ void useScreenObject() {
g_engine->_mouseManager->hide();
animateGive(direccionmovimiento, 1);
- //Show feather on pedestal
+ // Show feather on pedestal
loadItem(187, 70, 104, 1545820, 8);
handPantallaToBackground();
assembleScreen();
@@ -3038,11 +3029,11 @@ void useScreenObject() {
goToObject(currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], 14);
g_engine->_mouseManager->hide();
playVoc("PUFF", 191183, 18001);
- //Animate to scythe
+ // Animate to scythe
debug("Start anim!");
drawFlc(180, 60, 2216848, 0, 9, 0, false, false, true, basurillalog);
debug("End Anim!");
- //load Scythe
+ // load Scythe
currentRoomData->bitmapasociados[2].puntbitmap = 1545820;
currentRoomData->bitmapasociados[2].tambitmap = 104;
currentRoomData->bitmapasociados[2].coordx = 277;
@@ -3142,7 +3133,7 @@ void useScreenObject() {
if (guadagna)
cavernas[3] = true;
} break;
- case 643: { //Urn with altar
+ case 643: { // Urn with altar
if (currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory] != 5)
drawText(regobj.useTextRef);
pulsax = 149 - 7;
@@ -3172,7 +3163,7 @@ void useScreenObject() {
cavernas[4] = false;
g_engine->_mouseManager->show();
} break;
- case 657: { //sharpen scythe
+ case 657: { // sharpen scythe
drawText(regobj.useTextRef);
pulsax = 178 - 7;
pulsay = 71 - 7;
@@ -3202,7 +3193,7 @@ void useScreenObject() {
currentRoomData->mouseGrid[indlista][indmoch] = 13;
g_engine->_mouseManager->show();
} break;
- case 689: { //rope
+ case 689: { // rope
drawText(regobj.useTextRef);
pulsax = 124 - 7;
pulsay = 133 - 7;
@@ -3220,7 +3211,7 @@ void useScreenObject() {
for (indlista = 17; indlista <= 21; indlista++)
currentRoomData->mouseGrid[indlista][27] = 10;
} break;
- case 700: { //Trident
+ case 700: { // Trident
drawText(regobj.useTextRef);
pulsax = 224 - 7;
pulsay = 91 - 7;
@@ -3479,7 +3470,7 @@ void openScreenObject() {
screenObjects[regobj.profundidad - 1] = NULL;
indicey = 0;
while (currentRoomData->bitmapasociados[indicey].profund != regobj.profundidad && indicey != 15) {
- indicey ++;
+ indicey++;
}
debug("changing bitmap at %d, with depth = %d", indicey, currentRoomData->bitmapasociados[indicey].profund);
currentRoomData->bitmapasociados[indicey].puntbitmap = 0;
@@ -3515,7 +3506,7 @@ void openScreenObject() {
screenObjects[regobj.profundidad - 1] = NULL;
indicey = 0;
while (currentRoomData->bitmapasociados[indicey].profund != regobj.profundidad && indicey != 14) {
- indicey ++;
+ indicey++;
}
currentRoomData->bitmapasociados[indicey].puntbitmap = 0;
currentRoomData->bitmapasociados[indicey].tambitmap = 0;
@@ -3708,7 +3699,7 @@ void handleAction(byte posinv) {
drawText((Random(10) + 1039));
numeroaccion = 0;
if (contadorpc > 130)
- _exit(274);
+ showError(274);
oldxrejilla = 0;
oldyrejilla = 0;
checkMouseGrid();
@@ -3717,7 +3708,7 @@ void handleAction(byte posinv) {
g_engine->_mouseManager->hide();
actionLineText(Common::String("COGER ") + mobj[posinv].objectName);
if (contadorpc2 > 13)
- _exit(274);
+ showError(274);
g_engine->_mouseManager->show();
drawText((Random(10) + 1049));
numeroaccion = 0;
@@ -3746,7 +3737,7 @@ void handleAction(byte posinv) {
numeroaccion = 0;
if (contadorpc > 25)
- _exit(274);
+ showError(274);
useInventoryObjectWithInventoryObject(codigoobjmochila, mobj[posinv].code);
oldxrejilla = 0;
oldyrejilla = 0;
@@ -3770,7 +3761,7 @@ void handleAction(byte posinv) {
drawText(Random(10) + 1068);
numeroaccion = 0;
if (contadorpc2 > 35)
- _exit(274);
+ showError(274);
oldxrejilla = 0;
oldyrejilla = 0;
checkMouseGrid();
@@ -3791,13 +3782,13 @@ void loadObjects() {
}
if (!ficheroobj.isOpen())
- error("Error opening object file! 312");
+ showError(312);
for (int i = 0; i < inventoryIconCount; i++) {
mochilaxms.bitmap[i] = (byte *)malloc(sizeicono);
ficheroobj.read(mochilaxms.bitmap[i], sizeicono);
}
if (contadorpc > 65)
- error("Error contadorpc 274");
+ showError(274);
for (int i = 0; i < inventoryIconCount; i++) {
mobj[i].bitmapIndex = 34;
mobj[i].code = 0;
@@ -4021,170 +4012,6 @@ void loadScrollData(uint numpantalla, boolean scrollder, uint poshor, int correc
trayec[indicetray].y = characterPosY;
}
-
-void saveGame(byte numeropartida) {
- // varying_string<1> numpartidastr;
- // uint numeropantallaaux, indiaux;
- // byte zonasitio, iiii1, iiii2;
-
- // processingActive();
- // str(numeropartida, numpartidastr);
- // assign(partida, string("GAME") + numpartidastr + ".SAV");
- // rewrite(partida);
- // regpartida.indicetray = indicetray;
- // zonasitio = roomData->rejapantalla[((characterPosX + rectificacionx) / factorx)][((characterPosY + rectificaciony) / factory)];
- // if (zonasitio > 9) {
- // do {
- // indicetray -= 1;
- // characterPosX = trayec[indicetray].x;
- // characterPosY = trayec[indicetray].y;
- // zonasitio = roomData->rejapantalla[((characterPosX + rectificacionx) / factorx)][((characterPosY + rectificaciony) / factory)];
- // } while (!((indicetray == 1) || (zonasitio < 10)));
- // }
- // if (zonasitio < 10) {
- // regpartida.xframe = characterPosX;
- // regpartida.yframe = characterPosY;
- // } else {
- // indicetray = regpartida.indicetray;
- // do {
- // indicetray += 1;
- // characterPosX = trayec[indicetray].x;
- // characterPosY = trayec[indicetray].y;
- // zonasitio = roomData->rejapantalla[((characterPosX + rectificacionx) / factorx)][((characterPosY + rectificaciony) / factory)];
- // } while (!((zonasitio < 10) || (indicetray == longtray)));
- // if (zonasitio < 10) {
- // regpartida.xframe = characterPosX;
- // regpartida.yframe = characterPosY;
- // } else
- // _exit(275);
- // }
- // if (contadorpc2 > 65)
- // _exit(274);
- // regpartida.numeropantalla = roomData->codigo;
- // regpartida.longtray = longtray;
- // regpartida.indicetray = indicetray;
- // regpartida.codigoobjmochila = codigoobjmochila;
- // regpartida.volumenfxderecho = volumenfxderecho;
- // regpartida.volumenfxizquierdo = volumenfxizquierdo;
- // regpartida.volumenmelodiaderecho = volumenmelodiaderecho;
- // regpartida.volumenmelodiaizquierdo = volumenmelodiaizquierdo;
- // regpartida.oldxrejilla = oldxrejilla;
- // regpartida.oldyrejilla = oldyrejilla;
- // regpartida.animadoprofundidad = animado.profundidad;
- // regpartida.animadodir = animado.dir;
- // regpartida.animadoposx = animado.posx;
- // regpartida.animadoposy = animado.posy;
- // regpartida.animadoiframe2 = iframe2;
- // regpartida.zonaactual = zonaactual;
- // regpartida.zonadestino = zonadestino;
- // regpartida.oldzonadestino = oldzonadestino;
- // regpartida.posicioninv = posicioninv;
- // regpartida.numeroaccion = numeroaccion;
- // regpartida.oldnumeroacc = oldnumeroacc;
- // regpartida.pasos = pasos;
- // regpartida.indicepuertas = indicepuertas;
- // regpartida.direccionmovimiento = direccionmovimiento;
- // regpartida.iframe = iframe;
- // regpartida.parte_del_juego = parte_del_juego;
- // regpartida.sello_quitado = sello_quitado;
- // regpartida.lista1 = lista1;
- // regpartida.lista2 = lista2;
- // regpartida.completadalista1 = completadalista1;
- // regpartida.completadalista2 = completadalista2;
- // regpartida.vasijapuesta = vasijapuesta;
- // regpartida.guadagna = guadagna;
- // regpartida.tridente = tridente;
- // regpartida.torno = torno;
- // regpartida.barro = barro;
- // regpartida.diablillo_verde = diablillo_verde;
- // regpartida.rojo_capturado = rojo_capturado;
- // regpartida.manual_torno = manual_torno;
- // regpartida.alacena_abierta = alacena_abierta;
- // regpartida.baul_abierto = baul_abierto;
- // regpartida.teleencendida = teleencendida;
- // regpartida.trampa_puesta = trampa_puesta;
- // for (indiaux = 0; indiaux < inventoryIconCount; indiaux++) {
- // regpartida.mobj[indiaux].bitmapIndex = mobj[indiaux].bitmapIndex;
- // regpartida.mobj[indiaux].code = mobj[indiaux].code;
- // regpartida.mobj[indiaux].objectName = mobj[indiaux].objectName;
- // }
- // regpartida.elemento1 = elemento1;
- // regpartida.elemento2 = elemento2;
- // regpartida.xframe = characterPosX;
- // regpartida.yframe = characterPosY;
- // regpartida.xframe2 = xframe2;
- // regpartida.yframe2 = yframe2;
- // regpartida.oldobjmochila = oldobjmochila;
- // regpartida.objetomochila = objetomochila;
- // regpartida.nombrepersonaje = nombrepersonaje;
- // for(int i = 0; i < routePointCount; i++) {
- // regpartida.mainRoute[i].x = mainRoute[i].x;
- // regpartida.mainRoute[i].y = mainRoute[i].y;
- // }
-
- // for (indiaux = 0; indiaux < 300; indiaux++) {
- // regpartida.trayec[indiaux].x = trayec[indiaux].x;
- // regpartida.trayec[indiaux].y = trayec[indiaux].y;
- // }
- // for (indiaux = 0; indiaux < maxpersonajes; indiaux++) {
- // regpartida.primera[indiaux] = primera[indiaux];
- // regpartida.lprimera[indiaux] = lprimera[indiaux];
- // regpartida.cprimera[indiaux] = cprimera[indiaux];
- // regpartida.libro[indiaux] = libro[indiaux];
- // regpartida.caramelos[indiaux] = caramelos[indiaux];
- // }
-
- // for (indiaux = 0; indiaux < 5; indiaux++) {
- // regpartida.cavernas[indiaux] = cavernas[indiaux];
- // regpartida.firstList[indiaux] = firstList[indiaux];
- // regpartida.secondList[indiaux] = secondList[indiaux];
- // }
- // for (indiaux = 0; indiaux < 4; indiaux++) {
- // regpartida.hornacina[0][indiaux] = hornacina[0][indiaux];
- // regpartida.hornacina[1][indiaux] = hornacina[1][indiaux];
- // }
- // partida << regpartida;
- // close(partida);
- // // assign(fichobj, "OBJETOS.DAT");
-
- // // if (ioresult != 0)
- // // _exit(261);
- // // do {
- // // clearObj();
- // // fichobj >> regobj;
- // // if (regobj.usar[numeropartida] != regobj.usar[0]) {
- // // regobj.usar[numeropartida] = regobj.usar[0];
- // // seek(fichobj, (filepos(fichobj) - 1));
- // // fichobj << regobj;
- // // }
- // // } while (!(eof(fichobj)));
- // close(fichobj);
- // numeropantallaaux = ((roomData->codigo * 8) + 7);
- // setRoomTrajectories(altoanimado, anchoanimado, true);
-
- // assign(fichpanta, "PANTALLA.DAT");
-
- // if (ioresult != 0)
- // _exit(320);
- // seek(fichpanta, ((roomData->codigo * 8) + 7));
- // // fichpanta << roomData;
- // seek(fichpanta, 7);
- // do {
- // clearScreenData();
- // // fichpanta >> roomData;
- // seek(fichpanta, (filepos(fichpanta) - (8 - numeropartida)));
- // // fichpanta << roomData;
- // seek(fichpanta, (filepos(fichpanta) + 7 + (7 - numeropartida)));
- // } while (!(eof(fichpanta)));
- // seek(fichpanta, numeropantallaaux);
- // clearScreenData();
- // // fichpanta >> roomData;
- // close(fichpanta);
- // // movefile(diractual, diractual, "CONVERSA.007", (string("00") + numpartidastr));
- // setRoomTrajectories(altoanimado, anchoanimado, false);
-}
-
-
void saveGameToRegister() {
uint indiaux;
regpartida.numeropantalla = currentRoomData->codigo;
@@ -4203,7 +4030,6 @@ void saveGameToRegister() {
regpartida.animadoposy = animado.posy;
regpartida.animadoiframe2 = iframe2;
-
regpartida.zonaactual = zonaactual;
regpartida.zonadestino = zonadestino;
regpartida.oldzonadestino = oldzonadestino;
@@ -4251,7 +4077,7 @@ void saveGameToRegister() {
regpartida.objetomochila = objetomochila;
regpartida.nombrepersonaje = nombrepersonaje;
- for(int i = 0; i < routePointCount; i++) {
+ for (int i = 0; i < routePointCount; i++) {
regpartida.mainRoute[i].x = mainRoute[i].x;
regpartida.mainRoute[i].y = mainRoute[i].y;
}
@@ -4279,7 +4105,6 @@ void saveGameToRegister() {
}
}
-
void loadGame(regispartida game) {
freeAnimation();
freeScreenObjects();
@@ -4313,7 +4138,7 @@ void loadGame(regispartida game) {
iframe = game.iframe;
if (game.parte_del_juego != gamePart) {
gamePart = game.parte_del_juego;
- for(int i = 0; i < inventoryIconCount; i++) {
+ for (int i = 0; i < inventoryIconCount; i++) {
free(mochilaxms.bitmap[i]);
}
loadObjects();
@@ -4326,7 +4151,7 @@ void loadGame(regispartida game) {
vasijapuesta = game.vasijapuesta;
guadagna = game.guadagna;
if (contadorpc > 24)
- _exit(274);
+ showError(274);
tridente = game.tridente;
torno = game.torno;
barro = game.barro;
@@ -4351,7 +4176,7 @@ void loadGame(regispartida game) {
oldobjmochila = game.oldobjmochila;
objetomochila = game.objetomochila;
nombrepersonaje = game.nombrepersonaje;
- for(int i = 0; i < routePointCount; i++) {
+ for (int i = 0; i < routePointCount; i++) {
mainRoute[i].x = game.mainRoute[i].x;
mainRoute[i].y = game.mainRoute[i].y;
}
@@ -4475,232 +4300,6 @@ void loadGame(regispartida game) {
effect(tipoefectofundido, false, background);
}
-void loadGame(byte numeropartida) {
- // varying_string<1> numpartidastr;
- // uint indiaux, indiaux2;
-
- // processingActive();
- // str(numeropartida, numpartidastr);
- // assign(partida, string("GAME") + numpartidastr + ".SAV");
-
- // if (ioresult != 0)
- // _exit(322);
- // partida >> regpartida;
- // tipoefectofundido = Random(15) + 1;
- // longtray = regpartida.longtray;
- // indicetray = regpartida.indicetray;
- // codigoobjmochila = regpartida.codigoobjmochila;
- // volumenfxderecho = regpartida.volumenfxderecho;
- // volumenfxizquierdo = regpartida.volumenfxizquierdo;
- // volumenmelodiaderecho = regpartida.volumenmelodiaderecho;
- // volumenmelodiaizquierdo = regpartida.volumenmelodiaizquierdo;
- // oldxrejilla = regpartida.oldxrejilla;
- // oldyrejilla = regpartida.oldyrejilla;
- // animado.profundidad = regpartida.animadoprofundidad;
- // animado.dir = regpartida.animadodir;
- // animado.posx = regpartida.animadoposx;
- // animado.posy = regpartida.animadoposy;
- // iframe2 = regpartida.animadoiframe2;
- // zonaactual = regpartida.zonaactual;
- // zonadestino = regpartida.zonadestino;
- // oldzonadestino = regpartida.oldzonadestino;
- // posicioninv = regpartida.posicioninv;
- // numeroaccion = regpartida.numeroaccion;
- // oldnumeroacc = regpartida.oldnumeroacc;
- // pasos = regpartida.pasos;
- // indicepuertas = regpartida.indicepuertas;
- // direccionmovimiento = regpartida.direccionmovimiento;
- // iframe = regpartida.iframe;
- // if (regpartida.parte_del_juego != parte_del_juego) {
- // parte_del_juego = regpartida.parte_del_juego;
- // for(int i = 1; i <= numeroiconos; i++) {
- // free(mochilaxms.dib[i]);
- // }
- // loadObjects();
- // }
- // sello_quitado = regpartida.sello_quitado;
- // lista1 = regpartida.lista1;
- // lista2 = regpartida.lista2;
- // completadalista1 = regpartida.completadalista1;
- // completadalista2 = regpartida.completadalista2;
- // vasijapuesta = regpartida.vasijapuesta;
- // guadagna = regpartida.guadagna;
- // if (contadorpc > 24)
- // _exit(274);
- // tridente = regpartida.tridente;
- // torno = regpartida.torno;
- // barro = regpartida.barro;
- // diablillo_verde = regpartida.diablillo_verde;
- // rojo_capturado = regpartida.rojo_capturado;
- // manual_torno = regpartida.manual_torno;
- // alacena_abierta = regpartida.alacena_abierta;
- // baul_abierto = regpartida.baul_abierto;
- // teleencendida = regpartida.teleencendida;
- // trampa_puesta = regpartida.trampa_puesta;
- // for (indiaux = 1; indiaux <= numeroiconos; indiaux++) {
- // mobj[indiaux].dibu = regpartida.mobj[indiaux].dibu;
- // mobj[indiaux].codigo = regpartida.mobj[indiaux].codigo;
- // mobj[indiaux].nombreobj = regpartida.mobj[indiaux].nombreobj;
- // }
- // elemento1 = regpartida.elemento1;
- // elemento2 = regpartida.elemento2;
- // characterPosX = regpartida.xframe;
- // characterPosY = regpartida.yframe;
- // xframe2 = regpartida.xframe2;
- // yframe2 = regpartida.yframe2;
- // oldobjmochila = regpartida.oldobjmochila;
- // objetomochila = regpartida.objetomochila;
- // nombrepersonaje = regpartida.nombrepersonaje;
- // rutaprincipal = regpartida.rutaprincipal;
- // for (indiaux = 1; indiaux <= 300; indiaux++) {
- // trayec[indiaux][1] = regpartida.trayec[indiaux][1];
- // trayec[indiaux][2] = regpartida.trayec[indiaux][2];
- // }
- // for (indiaux = 1; indiaux <= maxpersonajes; indiaux++) {
- // primera[indiaux] = regpartida.primera[indiaux];
- // lprimera[indiaux] = regpartida.lprimera[indiaux];
- // cprimera[indiaux] = regpartida.cprimera[indiaux];
- // libro[indiaux] = regpartida.libro[indiaux];
- // caramelos[indiaux] = regpartida.caramelos[indiaux];
- // }
- // for (indiaux = 1; indiaux <= 5; indiaux++) {
- // cavernas[indiaux] = regpartida.cavernas[indiaux];
- // listauno[indiaux] = regpartida.listauno[indiaux];
- // listados[indiaux] = regpartida.listados[indiaux];
- // }
- // for (indiaux = 1; indiaux <= 4; indiaux++) {
- // hornacina[1][indiaux] = regpartida.hornacina[1][indiaux];
- // hornacina[2][indiaux] = regpartida.hornacina[2][indiaux];
- // }
- // close(partida);
- // assign(fichobj, "OBJETOS.DAT");
-
- // if (ioresult != 0)
- // _exit(261);
- // do {
- // limpiaregobj();
- // fichobj >> regobj;
- // if (regobj.usar[0] != regobj.usar[numeropartida]) {
- // regobj.usar[0] = regobj.usar[numeropartida];
- // seek(fichobj, (filepos(fichobj) - 1));
- // fichobj << regobj;
- // }
- // } while (!(eof(fichobj)));
- // close(fichobj);
- // assign(fichpanta, "PANTALLA.DAT");
-
- // if (ioresult != 0)
- // _exit(320);
- // seek(fichpanta, numeropartida);
- // do {
- // clearScreenData();
- // fichpanta >> datospantalla;
- // seek(fichpanta, (filepos(fichpanta) + (6 - numeropartida)));
- // fichpanta << datospantalla;
- // seek(fichpanta, (filepos(fichpanta) + numeropartida));
- // } while (!(eof(fichpanta)));
- // close(fichpanta);
- // movefile(diractual, diractual, string("CONVERSA.00") + numpartidastr, "007");
- // totalFadeOut(0);
- // cleardevice();
- // loadPalette("DEFAULT");
- // loadScreenData(regpartida.numeropantalla);
- // switch (datospantalla.codigo) {
- // case 2: {
- // if (teleencendida)
- // autoPlayVoc("PARASITO", 355778, 20129);
- // else
- // cargatele();
- // setSfxVolume(volumenfxizquierdo, volumenfxderecho);
- // } break;
- // case 4: {
- // loadVoc("GOTA", 140972, 1029);
- // setSfxVolume(volumenfxizquierdo, volumenfxderecho);
- // } break;
- // case 5: {
- // setSfxVolume(volumenfxizquierdo, 0);
- // autoPlayVoc("CALDERA", 6433, 15386);
- // } break;
- // case 6: {
- // setSfxVolume(volumenfxizquierdo, volumenfxderecho);
- // autoPlayVoc("CALDERA", 6433, 15386);
- // } break;
- // case 17: {
- // if ((libro[1] == true) && (datospantalla.banderamovimiento == true))
- // disableSecondAnimation();
- // } break;
- // case 20: {
- // switch (hornacina[1][hornacina[1][4]]) {
- // case 0:
- // datospantalla.indexadoobjetos[9]->objectName = "HORNACINA";
- // break;
- // case 561:
- // datospantalla.indexadoobjetos[9]->objectName = "ESTATUA DIVINA";
- // break;
- // case 563:
- // datospantalla.indexadoobjetos[9]->objectName = "MANUAL DE ALFARERO";
- // break;
- // case 615:
- // datospantalla.indexadoobjetos[9]->objectName = "ESTATUA GROTESCA";
- // break;
- // }
- // } break;
- // case 23: {
- // autoPlayVoc("Fuente", 0, 0);
- // setSfxVolume(volumenfxizquierdo, volumenfxderecho);
- // } break;
- // case 24: {
- // switch (hornacina[2][hornacina[2][4]]) {
- // case 0:
- // datospantalla.indexadoobjetos[8]->objectName = "HORNACINA";
- // break;
- // case 561:
- // datospantalla.indexadoobjetos[8]->objectName = "ESTATUA DIVINA";
- // break;
- // case 615:
- // datospantalla.indexadoobjetos[8]->objectName = "ESTATUA GROTESCA";
- // break;
- // case 622:
- // datospantalla.indexadoobjetos[8]->objectName = "PARED";
- // break;
- // case 623:
- // datospantalla.indexadoobjetos[8]->objectName = "TORNO";
- // break;
- // }
- // if (trampa_puesta) {
- // datospantalla.banderamovimiento = true;
- // loadAnimation(datospantalla.nombremovto);
- // iframe2 = 1;
- // indicetray2 = 1;
- // datospantalla.tray2[indicetray2].x = 214 - 15;
- // datospantalla.tray2[indicetray2].y = 115 - 42;
- // animado.dir = datospantalla.dir2[indicetray2];
- // animado.posx = datospantalla.tray2[indicetray2].x;
- // animado.posy = datospantalla.tray2[indicetray2].y;
- // animado.profundidad = 15;
- // for (indiaux = 1; indiaux <= maxrejax; indiaux++)
- // for (indiaux2 = 1; indiaux2 <= maxrejay; indiaux2++) {
- // if (rejamascaramovto[indiaux][indiaux2] > 0)
-
- // datospantalla.rejapantalla[(oldposx + indiaux - 1)][(oldposy + indiaux2 - 1)] = rejamascaramovto[indiaux][indiaux2];
- // if (rejamascararaton[indiaux][indiaux2] > 0)
-
- // datospantalla.rejaraton[(oldposx + indiaux - 1)][(oldposy + indiaux2 - 1)] = rejamascararaton[indiaux][indiaux2];
- // }
- // }
- // assembleScreen();
- // } break;
- // }
- // mask();
- // posicioninv = 1;
- // drawBackpack();
- // if ((rojo_capturado == false) && (datospantalla.codigo == 24) &&
- // (trampa_puesta == false))
- // runaroundRed();
- // effect(tipoefectofundido, false, fondo);
-}
-
-
struct indicepart {
byte ultimapartida;
Common::String listapartidas[6];
@@ -4708,7 +4307,7 @@ struct indicepart {
void seleccionaPartida(indicepart regindfich, int numSeleccion) {
g_engine->_mouseManager->hide();
- for(int i = 0; i < 6; i++){
+ for (int i = 0; i < 6; i++) {
int color = i == numSeleccion ? 255 : 253;
outtextxy(65, 29, regindfich.listapartidas[i], color);
}
@@ -4727,17 +4326,16 @@ void saveLoad() {
indicepart regindfich;
Common::File fichindice;
- if(fichindice.open("PARTIDAS.INX")){
+ if (fichindice.open("PARTIDAS.INX")) {
regindfich.ultimapartida = fichindice.readByte();
- for(int i = 0; i < 6; i++) {
+ for (int i = 0; i < 6; i++) {
int nameSize = fichindice.readByte();
char *name = (char *)malloc(nameSize);
fichindice.read(name, nameSize);
fichindice.skip(255 - nameSize);
regindfich.listapartidas[i] = Common::String(name, name + nameSize);
}
- }
- else {
+ } else {
regindfich.ultimapartida = 1;
for (int i = 0; i < 6; i++) {
regindfich.listapartidas[i] = Common::String().format("DISPONIBLE %d", i);
@@ -4769,7 +4367,7 @@ void saveLoad() {
outtextxy(65, 89, regindfich.listapartidas[4], 253);
outtextxy(65, 104, regindfich.listapartidas[5], 253);
if (contadorpc2 > 17)
- error("274");
+ showError(274);
xraton = 150;
yraton = 60;
// iraton = 1;
@@ -4798,29 +4396,20 @@ void saveLoad() {
mouseClicked = true;
pulsax = e.mouse.x;
pulsay = e.mouse.y;
- }
- else if (e.type == Common::EVENT_KEYUP){
+ } else if (e.type == Common::EVENT_KEYUP) {
keyPressed = true;
}
}
-
g_engine->_screen->update();
g_system->delayMillis(10);
} while (!keyPressed && !mouseClicked && !g_engine->shouldQuit());
- if(mouseClicked) {
- if(pulsay >= 13 && pulsay <= 16){
- if(pulsax >= 54 && pulsax <=124){
+ if (mouseClicked) {
+ if (pulsay >= 13 && pulsay <= 16) {
+ if (pulsax >= 54 && pulsax <= 124) {
if (partidaselecc > 0 && !desactivagrabar && (nombrepartida != Common::String("DISPONIBLE ") + (char)(partidaselecc + 48)) && (nombrepartida != "")) {
saveGame(partidaselecc);
- // rewrite(fichindice);
- // regindfich.ultimapartida = partidaselecc;
- // if (modificada)
- // regindfich.listapartidas[partidaselecc] =
- // nombrepartida;
- // fichindice << regindfich;
- // close(fichindice);
fichindice.close();
putImg(50, 10, puntfondmenu);
salirmenufunciones = true;
@@ -4828,8 +4417,7 @@ void saveLoad() {
} else {
sound(100, 300);
}
- }
- else if (pulsax >= 130 && pulsax <= 194){
+ } else if (pulsax >= 130 && pulsax <= 194) {
if ((partidaselecc > 0) && !((modificada))) {
if (regindfich.listapartidas[partidaselecc] != (Common::String("DISPONIBLE ") + (char)(partidaselecc + 48))) {
@@ -4869,8 +4457,7 @@ void saveLoad() {
outtextxy(65, 104, regindfich.listapartidas[6], 253);
g_engine->_mouseManager->show();
}
- }
- else if (pulsax >= 200 && pulsax <= 250) {
+ } else if (pulsax >= 200 && pulsax <= 250) {
if (inGame && !desactivagrabar) {
putImg(50, 10, puntfondmenu);
salirmenufunciones = true;
@@ -4879,43 +4466,37 @@ void saveLoad() {
sound(100, 300);
}
}
- }
- else if (pulsay >= 24 && pulsay <= 32) {
+ } else if (pulsay >= 24 && pulsay <= 32) {
partidaselecc = 0;
modificada = false;
ytext = 29;
seleccionaPartida(regindfich, 0);
nombrepartida = regindfich.listapartidas[0];
- }
- else if (pulsay >= 39 && pulsay <= 47) {
+ } else if (pulsay >= 39 && pulsay <= 47) {
partidaselecc = 1;
modificada = false;
ytext = 44;
seleccionaPartida(regindfich, 1);
nombrepartida = regindfich.listapartidas[1];
- }
- else if (pulsay >= 54 && pulsay <= 62) {
+ } else if (pulsay >= 54 && pulsay <= 62) {
partidaselecc = 2;
modificada = false;
ytext = 59;
seleccionaPartida(regindfich, 2);
nombrepartida = regindfich.listapartidas[2];
- }
- else if (pulsay >= 69 && pulsay <= 77) {
+ } else if (pulsay >= 69 && pulsay <= 77) {
partidaselecc = 3;
modificada = false;
ytext = 74;
seleccionaPartida(regindfich, 3);
nombrepartida = regindfich.listapartidas[3];
- }
- else if (pulsay >= 84 && pulsay <= 92) {
+ } else if (pulsay >= 84 && pulsay <= 92) {
partidaselecc = 4;
modificada = false;
ytext = 89;
seleccionaPartida(regindfich, 4);
nombrepartida = regindfich.listapartidas[4];
- }
- else if (pulsay >= 99 && pulsay <= 107) {
+ } else if (pulsay >= 99 && pulsay <= 107) {
partidaselecc = 5;
modificada = false;
ytext = 0;
@@ -4945,7 +4526,7 @@ void loadTalkAnimations() {
Common::File fichcani;
if (!fichcani.open("TIOHABLA.SEC")) {
- error("Error opening file animation (265)");
+ showError(265);
}
int32 posfilehabla;
@@ -4977,7 +4558,7 @@ void loadTalkAnimations() {
}
if (!result)
- error("Could not open secondary animation file! 265");
+ showError(265);
sizeanimado = fichcani.readUint16LE();
secondaryAnimationFrameCount = fichcani.readByte();
numerodir = fichcani.readByte();
@@ -4999,7 +4580,7 @@ void unloadTalkAnimations() {
Common::File fichcani;
if (!fichcani.open("PERSONAJ.SPT")) {
- error("Error loading character sprite! 265");
+ showError(265);
}
sizeframe = fichcani.readUint16LE();
@@ -5011,7 +4592,7 @@ void unloadTalkAnimations() {
if ((currentRoomData->nombremovto != "PETER") && (currentRoomData->nombremovto != "ARZCAEL")) {
if (!fichcani.open(Common::Path(currentRoomData->nombremovto + ".DAT"))) {
- error("loading secondary animation after talk (265)");
+ showError(265);
}
sizeanimado = fichcani.readUint16LE();
secondaryAnimationFrameCount = fichcani.readByte();
@@ -5051,8 +4632,7 @@ void hypertext(
byte colorsombraht,
uint &numresp,
/** Whether the text being said is part of a conversation or just descriptions */
- boolean banderaconversa
-) {
+ boolean banderaconversa) {
debug("hypertext");
regismht regmht;
@@ -5354,7 +4934,7 @@ void readConversationFile(Common::String f) {
Common::File conversationFile;
debug("Filename = %s", f.c_str());
if (!conversationFile.open(Common::Path(f))) {
- error("error opening conversation file (314)");
+ showError(314);
}
int64 fileSize = conversationFile.size();
// TODO: Will this be freed automatically by the `MemorySeekableReadWriteStream`?
@@ -5468,7 +5048,7 @@ void saveRoomData(RoomFileRegister *room, Common::SeekableWriteStream *stream) {
void initializeObjectFile() {
Common::File objFile;
if (!objFile.open(Common::Path("OBJETOS.DAT"))) {
- error("initializeObjectFile(): ioresult (261)");
+ showError(261);
}
delete (invItemData);
byte *objectData = (byte *)malloc(objFile.size());
@@ -5537,27 +5117,10 @@ void saveItemRegister(InvItemRegister object, Common::SeekableWriteStream *strea
void printHornacinas() {
debug("| | %03d | %03d | %03d | %03d |", 0, 1, 2, 3);
- debug("| 0 | %03d | %03d | %03d | %03d |", hornacina[0][0],hornacina[0][1],hornacina[0][2],hornacina[0][3]);
- debug("| 1 | %03d | %03d | %03d | %03d |", hornacina[1][0],hornacina[1][1],hornacina[1][2],hornacina[1][3]);
+ debug("| 0 | %03d | %03d | %03d | %03d |", hornacina[0][0], hornacina[0][1], hornacina[0][2], hornacina[0][3]);
+ debug("| 1 | %03d | %03d | %03d | %03d |", hornacina[1][0], hornacina[1][1], hornacina[1][2], hornacina[1][3]);
debug("hornacina[0][hornacina[0][3]] = %d", hornacina[0][hornacina[0][3]]);
debug("hornacina[1][hornacina[1][3]] = %d", hornacina[1][hornacina[1][3]]);
}
-void dumpRoomFile(Common::String name) {
-
- Common::DumpFile fich;
- fich.open(Common::Path("TEST/" + name), true);
- if (!fich.isOpen()) {
- error("Could not open output file!");
- }
- rooms->seek(0, 0);
- byte *buf = (byte *)malloc(rooms->size());
- rooms->read(buf, rooms->size());
- fich.write(buf, rooms->size());
- fich.finalize();
- fich.close();
- free(buf);
- debug("Written %s", name.c_str());
-}
-
} // End of namespace Tot
diff --git a/engines/tot/routines.h b/engines/tot/routines.h
index e7cb9a27c9b..258abc5433e 100644
--- a/engines/tot/routines.h
+++ b/engines/tot/routines.h
@@ -37,7 +37,7 @@ void drawText(uint number);
void runaroundRed();
void sprites(boolean drawCharacter);
void loadScreenData(uint screenNumber);
-RoomFileRegister* readScreenDataFile(Common::SeekableReadStream *screenDataFile);
+RoomFileRegister *readScreenDataFile(Common::SeekableReadStream *screenDataFile);
void saveRoomData(RoomFileRegister *room, Common::SeekableWriteStream *stream);
void calculateTrajectory(uint finalx, uint finaly);
void lookInventoryObject(byte objectNumber);
@@ -71,7 +71,6 @@ regismht readVerbRegister();
void readConversationFile(Common::String f);
void printHornacinas();
-void dumpRoomFile(Common::String name);
} // End of namespace Tot
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
index 7bcea2862d5..7e91d3bb8b8 100644
--- a/engines/tot/routines2.cpp
+++ b/engines/tot/routines2.cpp
@@ -57,7 +57,7 @@ void loadAnimation(Common::String animacion) {
animacion2 = true;
if (!fichcani.open(Common::Path(animacion + ".DAT"))) {
- error("loadAnimation(): ioresult (265)");
+ showError(265);
}
sizeanimado = fichcani.readUint16LE();
@@ -67,7 +67,7 @@ void loadAnimation(Common::String animacion) {
if (numerodir != 0) {
secondaryAnimationFrameCount = secondaryAnimationFrameCount / 4;
- for (int i = 0; i <= 3; i++){
+ for (int i = 0; i <= 3; i++) {
loadAnimationForDirection(&fichcani, i);
}
} else {
@@ -108,7 +108,7 @@ void loadAnimation(Common::String animacion) {
void assignText() {
if (!verb.open("CONVERSA.TXT")) {
- error("assignText(): ioresult (313)");
+ showError(313);
}
}
@@ -120,11 +120,10 @@ void updateAltScreen(byte otherScreenNumber) {
setRoomTrajectories(altoanimado, anchoanimado, RESTORE);
- //Save current room
+ // Save current room
saveRoomData(currentRoomData, rooms);
-
- //Load other screen
+ // Load other screen
rooms->seek(otherScreenNumber * roomRegSize, SEEK_SET);
currentRoomData = readScreenDataFile(rooms);
@@ -200,7 +199,6 @@ void updateAltScreen(byte otherScreenNumber) {
// Save other screen
saveRoomData(currentRoomData, rooms);
-
// Restore current room again
rooms->seek(currentScreen * roomRegSize, SEEK_SET);
currentRoomData = readScreenDataFile(rooms);
@@ -255,7 +253,7 @@ void cargatele() {
Common::File fichct;
if (!fichct.open("PALETAS.DAT")) {
- error("cargatele(): ioresult (310)");
+ showError(310);
}
fichct.seek(currentRoomData->puntpaleta + 603);
fichct.read(movimientopal, 144);
@@ -284,7 +282,7 @@ void loadScreen() {
switch (gamePart) {
case 1: {
if (!fichcp.open("PALETAS.DAT")) {
- error("loadScreen(): ioresult (310)");
+ showError(310);
}
fichcp.seek(currentRoomData->puntpaleta);
fichcp.read(palcp, 603);
@@ -315,7 +313,7 @@ void loadCharAnimation() {
Common::File characterFile;
contadorpc = contadorpc2;
if (!characterFile.open("PERSONAJ.SPT"))
- error("loadCharAnimation(): ioresult (265)");
+ showError(265);
sizeframe = characterFile.readUint16LE();
@@ -358,7 +356,7 @@ void freeAnimation() {
}
void freeInventory() {
- for(int i = 0; i < inventoryIconCount; i++) {
+ for (int i = 0; i < inventoryIconCount; i++) {
free(mochilaxms.bitmap[i]);
}
}
@@ -427,7 +425,7 @@ void updateInventory(byte indicador) {
void readBitmap(int32 posbm, byte *puntbm, uint tambm, uint errorbm) {
Common::File fichbitmap;
if (!fichbitmap.open("BITMAPS.DAT")) {
- error("readBitmap(): ioresult! (%d)", errorbm);
+ showError(errorbm);
}
fichbitmap.seek(posbm);
fichbitmap.read(puntbm, tambm);
@@ -497,7 +495,7 @@ void drawLookAtItem(RoomObjectListEntry obj) {
}
void putIcon(uint posiconx, uint posicony, uint numicon) {
- //substract 1 to account for 1-based indices
+ // substract 1 to account for 1-based indices
putImg(posiconx, posicony, mochilaxms.bitmap[mobj[numicon].bitmapIndex - 1]);
}
@@ -564,7 +562,7 @@ void inventory(byte direccion, byte tope) {
turnOffRight();
g_engine->_mouseManager->show();
if (contadorpc > 145)
- error("drawMouseBackground(): contadorpc (274)");
+ showError(274);
}
void mask() {
@@ -592,7 +590,7 @@ void drawMenu(byte nummenu) {
Common::File menuFile;
if (!menuFile.open("MENUS.DAT")) {
- error("Could not read menu file! (258)");
+ showError(258);
}
switch (nummenu) {
@@ -616,7 +614,7 @@ void drawMenu(byte nummenu) {
} break;
case 4: {
if (contadorpc2 > 20)
- error("drawMenu(): contadorpc (274)");
+ showError(274);
tampunteromenu = 26745;
posicionmenu = 65074;
xmenu = 50;
@@ -624,7 +622,7 @@ void drawMenu(byte nummenu) {
} break;
case 5: {
if (contadorpc > 23)
- error("drawMenu(): contadorpc (274)");
+ showError(274);
tampunteromenu = 16004;
posicionmenu = 91819;
xmenu = 0;
@@ -668,7 +666,7 @@ static void loadDiploma(Common::String &nombrefoto, Common::String &clave) {
Common::File fich;
if (!fich.open("DIPLOMA.PAN")) {
- error("loadDiploma(): ioresult (318)");
+ showError(318);
}
fich.read(palauxlocal, 768);
@@ -678,7 +676,7 @@ static void loadDiploma(Common::String &nombrefoto, Common::String &clave) {
fich.close();
if (!fich.open(Common::Path("DIPLOMA/SELLO.BMP")))
- error("loadDiploma(): ioresult (271)");
+ showError(271);
sello = (byte *)malloc(2054);
fich.read(sello, 2054);
fich.close();
@@ -801,8 +799,8 @@ void checkMouseGrid() {
uint xrejilla, yrejilla;
Common::String objmochila;
if (contadorpc2 > 120)
- error("checkMouseGrid(): ioresult (274)");
- if(yraton >= 0 && yraton <= 131) {
+ showError(274);
+ if (yraton >= 0 && yraton <= 131) {
xrejilla = (xraton + 7) / factorx;
yrejilla = (yraton + 7) / factory;
if (currentRoomData->mouseGrid[xrejilla][yrejilla] != currentRoomData->mouseGrid[oldxrejilla][oldyrejilla] || oldobjmochila != "") {
@@ -843,8 +841,7 @@ void checkMouseGrid() {
}
oldnumeroacc = 253;
oldobjmochila = "";
- }
- else if (yraton >= 132 && yraton <= 165) {
+ } else if (yraton >= 132 && yraton <= 165) {
if (numeroaccion != oldnumeroacc) {
bar(0, 140, 319, 149, 0);
Common::String actionLine;
@@ -881,27 +878,20 @@ void checkMouseGrid() {
oldxrejilla = 0;
oldyrejilla = 0;
}
- }
- else if (yraton >= 166 && yraton <= 199) {
- if(xraton >= 26 && xraton <= 65) {
+ } else if (yraton >= 166 && yraton <= 199) {
+ if (xraton >= 26 && xraton <= 65) {
objmochila = mobj[posicioninv].objectName;
- }
- else if(xraton >= 70 && xraton <= 108) {
+ } else if (xraton >= 70 && xraton <= 108) {
objmochila = mobj[posicioninv + 1].objectName;
- }
- else if(xraton >= 113 && xraton <= 151) {
+ } else if (xraton >= 113 && xraton <= 151) {
objmochila = mobj[posicioninv + 2].objectName;
- }
- else if(xraton >= 156 && xraton <= 194) {
+ } else if (xraton >= 156 && xraton <= 194) {
objmochila = mobj[posicioninv + 3].objectName;
- }
- else if(xraton >= 199 && xraton <= 237) {
+ } else if (xraton >= 199 && xraton <= 237) {
objmochila = mobj[posicioninv + 4].objectName;
- }
- else if(xraton >= 242 && xraton <= 280) {
+ } else if (xraton >= 242 && xraton <= 280) {
objmochila = mobj[posicioninv + 5].objectName;
- }
- else {
+ } else {
objmochila = ' ';
}
@@ -1451,16 +1441,13 @@ void drawCreditsScreen(byte *&fondopp, uint &sizefondo2, byte *&fondo2) {
Common::File fichpp;
if (!fichpp.open("DIPLOMA.PAN")) {
- error("drawCreditsScreen(): ioresult! (315)");
+ showError(315);
}
fondopp = (byte *)malloc(64000);
fichpp.read(palpaso, 768);
fichpp.read(fondopp, 64000);
fichpp.close();
- // uint16 sizehor2 = READ_LE_UINT16(fondopp);
- // uint16 sizever2 = READ_LE_UINT16(fondopp + 2);
-
drawFullScreen(fondopp);
sizefondo2 = imagesize(0, 0, 319, 59);
@@ -1482,7 +1469,7 @@ void drawCreditsScreen(byte *&fondopp, uint &sizefondo2, byte *&fondo2) {
changePalette(palnegro, palpaso);
copyPalette(palpaso, pal);
if (contadorpc2 > 9)
- error("drawCreditsScreen(): contadorpc2! (274)");
+ showError(274);
}
void putCreditsImg(uint x, uint y, byte *imagen1, byte *imagen2, boolean direct) {
@@ -1518,10 +1505,9 @@ void putCreditsImg(uint x, uint y, byte *imagen1, byte *imagen2, boolean direct)
kaka = kk + y;
for (int jj = 0; jj <= wImagen1; jj++) {
incremento = incremento2 + jj;
- if((direct && imagen1[incremento] > 0) || (imagen1[incremento] > 16 && kaka >= 66 && kaka <= 192)) {
+ if ((direct && imagen1[incremento] > 0) || (imagen1[incremento] > 16 && kaka >= 66 && kaka <= 192)) {
paso[incremento] = imagen1[incremento];
- }
- else if (imagen1[incremento] > 16) {
+ } else if (imagen1[incremento] > 16) {
switch (kaka) {
case 59:
case 199:
@@ -1580,11 +1566,10 @@ void scrollCredit(
boolean &salirpitando,
int minHeight,
boolean withFade,
- boolean refresh
-) {
+ boolean refresh) {
Common::File fich;
if (!fich.open("CREDITOS.DAT")) {
- error("scrollcredit1(): ioresult! (270)");
+ showError(270);
}
fich.seek(posicion);
fich.read(background, tam);
@@ -1623,7 +1608,7 @@ void scrollCredit(
if (g_engine->shouldQuit())
break;
}
- if(refresh) {
+ if (refresh) {
copyFromScreen(fondopp);
}
}
@@ -1633,8 +1618,7 @@ void scrollSingleCredit(
uint tam,
palette &pal2,
byte *&fondopp,
- boolean &salirpitando
-) {
+ boolean &salirpitando) {
scrollCredit(
posicion,
tam,
@@ -1643,8 +1627,7 @@ void scrollSingleCredit(
salirpitando,
8,
true,
- false
- );
+ false);
}
void removeTitle(byte *&fondo2) {
@@ -1791,7 +1774,7 @@ void introduction() {
totalFadeOut(0);
if (contadorpc > 6)
- error("introduction(): contadorpc! (270)");
+ showError(270);
cleardevice();
drawFlc(136, 53, 888366, 136, 9, 1, true, true, false, pulsada_salida);
if (pulsada_salida)
@@ -1932,7 +1915,7 @@ void initialMenu(boolean fundido) {
else
drawFlc(0, 0, 837602, 0, 9, 0, false, false, false, kklogica);
if (contadorpc2 > 10)
- error("initialMenu(): contadorpc! (274)");
+ showError(274);
xraton = 160;
yraton = 95;
iraton = 1;
@@ -2120,7 +2103,7 @@ void saveTemporaryGame() {
void exitGame() {
g_system->quit();
- //Should do cleanup here!
+ // Should do cleanup here!
free(conversationData);
}
@@ -2162,7 +2145,7 @@ void exitToDOS() {
} else if (e.kbd.keycode == Common::KEYCODE_s) {
debug("would exit game now");
free(puntfondcontroles);
- //CLEAR MEMORY!!
+ // CLEAR MEMORY!!
exitGame();
// exit game
} else if (e.kbd.keycode == Common::KEYCODE_n) {
@@ -2296,7 +2279,7 @@ void soundControls() {
if (oldxfade != xfade) {
putImg(86, 31, fondoslade1);
putImg(xfade, 31, slade);
- //This yields a volume between 0 and 140
+ // This yields a volume between 0 and 140
volumenfx = xfade - 86;
debug("volumefx=%d", volumenfx);
@@ -2359,7 +2342,7 @@ void soundControls() {
free(fondoslade2);
if (contadorpc > 7)
- error("controls(): contadorpc! (274)");
+ showError(274);
setMouseArea(0, 0, 305, 185);
}
@@ -2384,8 +2367,8 @@ void sacrificeScene() {
setRGBPalette(200, i * 2, i * 2, i * 2);
delay(10000);
- if(g_engine->shouldQuit())
- return;
+ if (g_engine->shouldQuit())
+ return;
for (int i = 28; i >= 0; i--)
setRGBPalette(200, i * 2, i * 2, i * 2);
@@ -2400,8 +2383,8 @@ void sacrificeScene() {
for (int i = 0; i <= 28; i++)
setRGBPalette(200, i * 2, i * 2, i * 2);
delay(10000);
- if(g_engine->shouldQuit())
- return;
+ if (g_engine->shouldQuit())
+ return;
for (int i = 28; i >= 0; i--)
setRGBPalette(200, i * 2, i * 2, i * 2);
@@ -2415,16 +2398,16 @@ void sacrificeScene() {
for (int i = 0; i <= 28; i++)
setRGBPalette(200, i * 2, i * 2, i * 2);
delay(10000);
- if(g_engine->shouldQuit())
- return;
+ if (g_engine->shouldQuit())
+ return;
for (int i = 28; i >= 0; i--)
setRGBPalette(200, i * 2, i * 2, i * 2);
bar(10, 10, 300, 120, 0);
Common::File fich;
- if(!fich.open("SALONREC.PAN")){
- error("sacrifice(): ioresult! (318)");
+ if (!fich.open("SALONREC.PAN")) {
+ showError(318);
}
fich.read(palaux, 768);
fich.read(background, 44800);
@@ -2439,20 +2422,20 @@ void sacrificeScene() {
pal[i * 3 + 3] = palaux[i * 3 + 3] << 2;
}
- //We dont have the width and height here in the byte buffer
+ // We dont have the width and height here in the byte buffer
drawScreen(background, false);
partialFadeIn(234);
stopVoc();
- if(g_engine->shouldQuit())
- return;
+ if (g_engine->shouldQuit())
+ return;
drawFlc(0, 0, 1712400, 0, 9, 19, false, false, true, pulsada_salida);
totalFadeOut(128);
stopVoc();
delay(1000);
- if(g_engine->shouldQuit())
- return;
+ if (g_engine->shouldQuit())
+ return;
lowerMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
playMidiFile("SACRIFIC", true);
@@ -2482,7 +2465,7 @@ void sacrificeScene() {
}
delay(10000);
- if(g_engine->shouldQuit())
+ if (g_engine->shouldQuit())
return;
for (int i = 32; i > 0; i--) {
@@ -2491,12 +2474,12 @@ void sacrificeScene() {
}
delay(2000);
- if(!fich.open("SACRIFIC.PAN")){
- error("sacrifice(): ioresult! (318)");
+ if (!fich.open("SACRIFIC.PAN")) {
+ showError(318);
}
fich.read(palaux, 768);
- for(int i = 0; i < 256; i++) {
+ for (int i = 0; i < 256; i++) {
palaux[i * 3 + 0] = palaux[i * 3 + 0] << 2;
palaux[i * 3 + 1] = palaux[i * 3 + 1] << 2;
palaux[i * 3 + 2] = palaux[i * 3 + 2] << 2;
@@ -2514,13 +2497,13 @@ void sacrificeScene() {
drawFlc(112, 57, 1783054, 33, 9, 20, true, false, true, pulsada_salida);
autoPlayVoc("REZOS", 0, 0);
- if(g_engine->shouldQuit())
- return;
+ if (g_engine->shouldQuit())
+ return;
drawFlc(42, 30, 1806212, 0, 9, 27, false, false, false, pulsada_salida);
- if(g_engine->shouldQuit())
- return;
+ if (g_engine->shouldQuit())
+ return;
totalFadeOut(128);
stopVoc();
@@ -2567,53 +2550,83 @@ void sacrificeScene() {
setRGBPalette(254, 32 - i, 0, 0);
}
delay(16000);
- if(g_engine->shouldQuit())
- return;
+ if (g_engine->shouldQuit())
+ return;
for (int i = 31; i >= 0; i--) {
setRGBPalette(255, 63 - (32 - i), i * 2, i * 2);
setRGBPalette(254, 32 - i, 0, 0);
}
delay(2000);
- if(g_engine->shouldQuit())
- return;
+ if (g_engine->shouldQuit())
+ return;
clear();
outtextxy(10, 21, " Pero debes darte prisa pues el v\xA1nculo con tu", 254);
outtextxy(10, 19, " Pero debes darte prisa pues el v\xA1nculo con tu", 254);
outtextxy(11, 20, " Pero debes darte prisa pues el v\xA1nculo con tu", 254);
outtextxy(9, 20, " Pero debes darte prisa pues el v\xA1nculo con tu", 254);
- outtextxy(10, 41, " cuerpo se debilita y tu alma podr\xA1""a quedar", 254);
- outtextxy(10, 39, " cuerpo se debilita y tu alma podr\xA1""a quedar", 254);
- outtextxy(11, 40, " cuerpo se debilita y tu alma podr\xA1""a quedar", 254);
- outtextxy(9, 40, " cuerpo se debilita y tu alma podr\xA1""a quedar", 254);
+ outtextxy(10, 41, " cuerpo se debilita y tu alma podr\xA1"
+ "a quedar",
+ 254);
+ outtextxy(10, 39, " cuerpo se debilita y tu alma podr\xA1"
+ "a quedar",
+ 254);
+ outtextxy(11, 40, " cuerpo se debilita y tu alma podr\xA1"
+ "a quedar",
+ 254);
+ outtextxy(9, 40, " cuerpo se debilita y tu alma podr\xA1"
+ "a quedar",
+ 254);
outtextxy(10, 61, " atrapada para siempre en las Cavernas Eternas.", 254);
outtextxy(10, 59, " atrapada para siempre en las Cavernas Eternas.", 254);
outtextxy(11, 60, " atrapada para siempre en las Cavernas Eternas.", 254);
outtextxy(9, 60, " atrapada para siempre en las Cavernas Eternas.", 254);
- outtextxy(10, 81, " Si necesitaras m\xA0s energ\xA1""a de la que tienes, ", 254);
- outtextxy(10, 79, " Si necesitaras m\xA0s energ\xA1""a de la que tienes, ", 254);
- outtextxy(11, 80, " Si necesitaras m\xA0s energ\xA1""a de la que tienes, ", 254);
- outtextxy(9, 80, " Si necesitaras m\xA0s energ\xA1""a de la que tienes, ", 254);
+ outtextxy(10, 81, " Si necesitaras m\xA0s energ\xA1"
+ "a de la que tienes, ",
+ 254);
+ outtextxy(10, 79, " Si necesitaras m\xA0s energ\xA1"
+ "a de la que tienes, ",
+ 254);
+ outtextxy(11, 80, " Si necesitaras m\xA0s energ\xA1"
+ "a de la que tienes, ",
+ 254);
+ outtextxy(9, 80, " Si necesitaras m\xA0s energ\xA1"
+ "a de la que tienes, ",
+ 254);
outtextxy(10, 101, " recuerda que all\xA0 donde vas un cuerpo contiene", 254);
outtextxy(10, 99, " recuerda que all\xA0 donde vas un cuerpo contiene", 254);
outtextxy(11, 100, " recuerda que all\xA0 donde vas un cuerpo contiene", 254);
outtextxy(9, 100, " recuerda que all\xA0 donde vas un cuerpo contiene", 254);
- outtextxy(10, 121, " m\xA0s energ\xA1""a que un alma al contrario que en el", 254);
- outtextxy(10, 119, " m\xA0s energ\xA1""a que un alma al contrario que en el", 254);
- outtextxy(11, 120, " m\xA0s energ\xA1""a que un alma al contrario que en el", 254);
- outtextxy(9, 120, " m\xA0s energ\xA1""a que un alma al contrario que en el", 254);
+ outtextxy(10, 121, " m\xA0s energ\xA1"
+ "a que un alma al contrario que en el",
+ 254);
+ outtextxy(10, 119, " m\xA0s energ\xA1"
+ "a que un alma al contrario que en el",
+ 254);
+ outtextxy(11, 120, " m\xA0s energ\xA1"
+ "a que un alma al contrario que en el",
+ 254);
+ outtextxy(9, 120, " m\xA0s energ\xA1"
+ "a que un alma al contrario que en el",
+ 254);
outtextxy(10, 141, " mundo f\xA1sico.", 254);
outtextxy(10, 139, " mundo f\xA1sico.", 254);
outtextxy(11, 140, " mundo f\xA1sico.", 254);
outtextxy(9, 140, " mundo f\xA1sico.", 254);
outtextxy(10, 20, " Pero debes darte prisa pues el v\xA1nculo con tu", 255);
- outtextxy(10, 40, " cuerpo se debilita y tu alma podr\xA1""a quedar", 255);
+ outtextxy(10, 40, " cuerpo se debilita y tu alma podr\xA1"
+ "a quedar",
+ 255);
outtextxy(10, 60, " atrapada para siempre en las Cavernas Eternas.", 255);
- outtextxy(10, 80, " Si necesitaras m\xA0s energ\xA1""a de la que tienes, ", 255);
+ outtextxy(10, 80, " Si necesitaras m\xA0s energ\xA1"
+ "a de la que tienes, ",
+ 255);
outtextxy(10, 100, " recuerda que all\xA0 donde vas un cuerpo contiene", 255);
- outtextxy(10, 120, " m\xA0s energ\xA1""a que un alma al contrario que en el", 255);
+ outtextxy(10, 120, " m\xA0s energ\xA1"
+ "a que un alma al contrario que en el",
+ 255);
outtextxy(10, 140, " mundo f\xA1sico.", 255);
for (int i = 0; i < 32; i++) {
@@ -2621,16 +2634,16 @@ void sacrificeScene() {
setRGBPalette(254, 32 - i, 0, 0);
}
delay(13000);
- if(g_engine->shouldQuit())
- return;
+ if (g_engine->shouldQuit())
+ return;
for (int i = 32; i > 0; i--) {
setRGBPalette(255, 63 - (32 - i), i * 2, i * 2);
setRGBPalette(254, 32 - i, 0, 0);
}
delay(2000);
- if(g_engine->shouldQuit())
- return;
+ if (g_engine->shouldQuit())
+ return;
clear();
outtextxy(10, 61, " No te demores y recuerda...", 254);
outtextxy(10, 59, " No te demores y recuerda...", 254);
@@ -2654,7 +2667,7 @@ void sacrificeScene() {
setRGBPalette(254, 32 - i, 0, 0);
}
delay(7000);
- if(g_engine->shouldQuit())
+ if (g_engine->shouldQuit())
return;
for (int i = 32; i > 0; i--) {
setRGBPalette(255, 63 - (32 - i), i * 2, i * 2);
@@ -2697,8 +2710,8 @@ void loadBat() {
Common::File fichcani;
animacion2 = true;
- if(!fichcani.open("MURCIE.DAT")){
- error("loadBat(): ioresult! (265)");
+ if (!fichcani.open("MURCIE.DAT")) {
+ showError(265);
}
sizeanimado = fichcani.readUint16LE();
secondaryAnimationFrameCount = fichcani.readByte();
@@ -2712,8 +2725,8 @@ void loadDevil() {
Common::File fichcani;
animacion2 = true;
- if(!fichcani.open("ROJOMOV.DAT")) {
- error("loadDevil(): ioresult! (265)");
+ if (!fichcani.open("ROJOMOV.DAT")) {
+ showError(265);
}
sizeanimado = fichcani.readUint16LE();
secondaryAnimationFrameCount = fichcani.readByte();
@@ -2747,7 +2760,6 @@ void assembleCompleteBackground(byte *image, uint coordx, uint coordy) {
}
}
}
-
}
/**
@@ -2881,23 +2893,21 @@ void setRoomTrajectories(int animationHeight, int animationWidth, TRAJECTORIES_O
if (currentRoomData->banderamovimiento && currentRoomData->nombremovto != "QQQQQQQQ") {
for (int i = 0; i < currentRoomData->longtray2; i++) {
- if(op == RESTORE) {
+ if (op == RESTORE) {
currentRoomData->tray2[i].x = currentRoomData->tray2[i].x + (animationWidth >> 1);
currentRoomData->tray2[i].y = currentRoomData->tray2[i].y + animationHeight;
- }
- else {
+ } else {
currentRoomData->tray2[i].x = currentRoomData->tray2[i].x - (animationWidth >> 1);
currentRoomData->tray2[i].y = currentRoomData->tray2[i].y - animationHeight;
}
}
- if(fixGrids) {
+ if (fixGrids) {
for (int i = 0; i < maxrejax; i++) {
for (int j = 0; j < maxrejay; j++) {
- if(op == RESTORE){
+ if (op == RESTORE) {
currentRoomData->rejapantalla[oldposx + i][oldposy + j] = rejafondomovto[i][j];
currentRoomData->mouseGrid[oldposx + i][oldposy + j] = rejafondoraton[i][j];
- }
- else {
+ } else {
if (rejamascaramovto[i][j] > 0)
currentRoomData->rejapantalla[oldposx + i][oldposy + j] = rejamascaramovto[i][j];
if (rejamascararaton[i][j] > 0)
diff --git a/engines/tot/routines2.h b/engines/tot/routines2.h
index 885e172bb5a..9e7739cc283 100644
--- a/engines/tot/routines2.h
+++ b/engines/tot/routines2.h
@@ -31,13 +31,12 @@
namespace Tot {
enum TRAJECTORIES_OP {
- // Subtracts the animation dimensions to the trajectory coordinates to adjust movement
+ // Subtracts the animation dimensions to the trajectory coordinates to adjust movement
SET_WITH_ANIM = false,
- // Adds the animation dimensions to the trajectory coordinates to restore
+ // Adds the animation dimensions to the trajectory coordinates to restore
RESTORE = true
};
-
void loadScreenMemory();
void loadAnimation(Common::String animacion);
void assignText();
@@ -72,7 +71,7 @@ void firstIntroduction();
void readAlphaGraph(Common::String &dato, int long_, int posx, int posy, byte colorbarra);
void readAlphaGraphSmall(Common::String &data, int long_, int posx, int posy, byte colorbarra, byte textColor);
void hipercadena(Common::String cadenatextnueva, uint xhcnueva, uint yhcnueva, byte anchohc, byte colortextohc, byte colorsombrahc);
-void buttonBorder(uint x1, uint y1, uint x2, uint y2, byte color1 , byte color2, byte color3, byte color4, byte color5, uint xtexto, Common::String outputGameName);
+void buttonBorder(uint x1, uint y1, uint x2, uint y2, byte color1, byte color2, byte color3, byte color4, byte color5, uint xtexto, Common::String outputGameName);
void copyProtection();
void initialLogo();
void initialMenu(boolean fade);
diff --git a/engines/tot/saveload.cpp b/engines/tot/saveload.cpp
index 1a3c5efa34d..9a52e8b8e23 100644
--- a/engines/tot/saveload.cpp
+++ b/engines/tot/saveload.cpp
@@ -22,17 +22,17 @@
*
*/
+#include "gui/saveload.h"
#include "common/error.h"
#include "common/savefile.h"
#include "common/serializer.h"
#include "common/system.h"
#include "gui/message.h"
-#include "gui/saveload.h"
-#include "tot/tot.h"
#include "tot/forest.h"
#include "tot/playanim.h"
#include "tot/routines.h"
+#include "tot/tot.h"
namespace Tot {
@@ -118,7 +118,7 @@ boolean syncGeneralData(Common::Serializer &s, regispartida &game) {
}
for (int indiaux = 0; indiaux < maxpersonajes; indiaux++) {
- //interleave them just to avoid creating many loops
+ // interleave them just to avoid creating many loops
s.syncAsByte(game.primera[indiaux]);
s.syncAsByte(game.lprimera[indiaux]);
s.syncAsByte(game.cprimera[indiaux]);
@@ -126,7 +126,6 @@ boolean syncGeneralData(Common::Serializer &s, regispartida &game) {
s.syncAsByte(game.caramelos[indiaux]);
}
-
for (int indiaux = 0; indiaux < 5; indiaux++) {
s.syncAsByte(game.cavernas[indiaux]);
s.syncAsUint16LE(game.firstList[indiaux]);
@@ -147,31 +146,31 @@ boolean syncRoomData(Common::Serializer &s, Common::MemorySeekableReadWriteStrea
uint32 startBytes = s.bytesSynced();
if (s.isSaving()) {
- //Restore trajectory
+ // Restore trajectory
setRoomTrajectories(altoanimado, anchoanimado, RESTORE);
- //Make sure to save any unsaved changes in the room
+ // Make sure to save any unsaved changes in the room
saveRoomData(currentRoomData, rooms);
// Do not fix screen grids, they will be fixed differently below
setRoomTrajectories(altoanimado, anchoanimado, SET_WITH_ANIM);
int size = roomStream->size();
- byte *roomBuf = (byte *)malloc(size);
+ byte *roomBuf = (byte *)malloc(size);
roomStream->seek(0, 0);
roomStream->read(roomBuf, size);
- s.syncBytes(roomBuf, size);
- free(roomBuf);
+ s.syncBytes(roomBuf, size);
+ free(roomBuf);
debug("return room totalBytes synced %d", s.bytesSynced());
}
uint32 newBytes = s.bytesSynced();
if (s.isLoading()) {
int size = rooms->size();
delete (rooms);
- byte *roomBuf = (byte *)malloc(size);
- s.syncBytes(roomBuf, size);
+ byte *roomBuf = (byte *)malloc(size);
+ s.syncBytes(roomBuf, size);
debug("Loading room data now");
- //TODO: Will roomBuf be automatically freed?
+ // TODO: Will roomBuf be automatically freed?
rooms = new Common::MemorySeekableReadWriteStream(roomBuf, size, DisposeAfterUse::NO);
}
return true;
@@ -181,122 +180,122 @@ boolean syncConversationData(Common::Serializer &s, Common::MemorySeekableReadWr
uint32 startBytes = s.bytesSynced();
int size = conversations->size();
- if(s.isSaving()) {
+ if (s.isSaving()) {
byte *convBuf = (byte *)malloc(size);
conversations->seek(0, 0);
conversations->read(convBuf, size);
- s.syncBytes(convBuf, size);
- free(convBuf);
+ s.syncBytes(convBuf, size);
+ free(convBuf);
debug("return conversation totalBytes synced %d", s.bytesSynced());
}
- if(s.isLoading()) {
+ if (s.isLoading()) {
delete (conversationData);
- byte *convBuf = (byte *)malloc(size);
- s.syncBytes(convBuf, size);
+ byte *convBuf = (byte *)malloc(size);
+ s.syncBytes(convBuf, size);
debug("Loading conversation data now");
- //TODO: Will objBuf be automatically freed?
+ // TODO: Will objBuf be automatically freed?
conversationData = new Common::MemorySeekableReadWriteStream(convBuf, size, DisposeAfterUse::NO);
}
- return true;
+ return true;
}
boolean syncItemData(Common::Serializer &s, Common::MemorySeekableReadWriteStream *items) {
uint32 startBytes = s.bytesSynced();
int size = items->size();
if (s.isSaving()) {
- byte *objBuf = (byte *)malloc(size);
+ byte *objBuf = (byte *)malloc(size);
items->seek(0, 0);
items->read(objBuf, size);
- s.syncBytes(objBuf, size);
- free(objBuf);
+ s.syncBytes(objBuf, size);
+ free(objBuf);
debug("return items totalBytes synced %d", s.bytesSynced());
}
uint32 newBytes = s.bytesSynced();
if (s.isLoading()) {
delete (invItemData);
- byte *objBuf = (byte *)malloc(size);
- s.syncBytes(objBuf, size);
+ byte *objBuf = (byte *)malloc(size);
+ s.syncBytes(objBuf, size);
debug("Loading item data now");
- //TODO: Will objBuf be automatically freed?
+ // TODO: Will objBuf be automatically freed?
invItemData = new Common::MemorySeekableReadWriteStream(objBuf, size, DisposeAfterUse::NO);
}
- return true;
+ return true;
}
Common::Error syncSaveData(Common::Serializer &ser, regispartida &game) {
- if(!syncGeneralData(ser, game)) {
+ if (!syncGeneralData(ser, game)) {
warning("Error while synchronizing general data");
- return Common::kUnknownError;
- }
- if(!syncRoomData(ser, rooms)) {
- warning("Error while synchronizing room data");
- return Common::kUnknownError;
- }
- if(!syncItemData(ser, invItemData)) {
+ return Common::kUnknownError;
+ }
+ if (!syncRoomData(ser, rooms)) {
+ warning("Error while synchronizing room data");
+ return Common::kUnknownError;
+ }
+ if (!syncItemData(ser, invItemData)) {
warning("Error while syncrhonizing object data");
return Common::kUnknownError;
}
- if(!syncConversationData(ser, conversationData)) {
+ if (!syncConversationData(ser, conversationData)) {
warning("Error while syncrhonizing conversation data");
return Common::kUnknownError;
}
- return Common::kNoError;
+ return Common::kNoError;
}
Common::Error TotEngine::syncGame(Common::Serializer &s) {
- Common::Error result;
+ Common::Error result;
- if(s.isLoading()){
+ if (s.isLoading()) {
debug("Loading game!!");
- regispartida loadedGame;
+ regispartida loadedGame;
// Means we are loading from before the game has started
// if(rooms == nullptr) {
- clear();
- processingActive();
+ clear();
+ processingActive();
- loadCharAnimation();
- loadObjects();
+ loadCharAnimation();
+ loadObjects();
- loadPalette("DEFAULT");
- loadScreenMemory();
+ loadPalette("DEFAULT");
+ loadScreenMemory();
- totalFadeOut(0);
- clear();
- processingActive();
- initializeScreenFile();
- initializeObjectFile();
- readConversationFile(Common::String("CONVERSA.TRE"));
+ totalFadeOut(0);
+ clear();
+ processingActive();
+ initializeScreenFile();
+ initializeObjectFile();
+ readConversationFile(Common::String("CONVERSA.TRE"));
// }
- result = syncSaveData(s, loadedGame);
- loadGame(loadedGame);
- } else {
- saveGameToRegister();
- result = syncSaveData(s, regpartida);
- }
+ result = syncSaveData(s, loadedGame);
+ loadGame(loadedGame);
+ } else {
+ saveGameToRegister();
+ result = syncSaveData(s, regpartida);
+ }
return result;
}
Common::Error TotEngine::saveGameStream(Common::WriteStream *stream, bool isAutosave) {
- const byte version = SAVEGAME_CURRENT_VERSION;
- Common::Serializer s(nullptr, stream);
- s.setVersion(version);
- stream->writeByte(version);
+ const byte version = SAVEGAME_CURRENT_VERSION;
+ Common::Serializer s(nullptr, stream);
+ s.setVersion(version);
+ stream->writeByte(version);
- return syncGame(s);
+ return syncGame(s);
}
Common::Error TotEngine::loadGameStream(Common::SeekableReadStream *stream) {
- byte version = stream->readByte();
- if(version > SAVEGAME_CURRENT_VERSION) {
- GUI::MessageDialog dialog(Common::String("Saved game was created with a newer version of ScummVM. Unable to load."));
+ byte version = stream->readByte();
+ if (version > SAVEGAME_CURRENT_VERSION) {
+ GUI::MessageDialog dialog(Common::String("Saved game was created with a newer version of ScummVM. Unable to load."));
dialog.runModal();
return Common::kUnknownError;
- }
+ }
- Common::Serializer s(stream, nullptr);
- s.setVersion(version);
+ Common::Serializer s(stream, nullptr);
+ s.setVersion(version);
- return syncGame(s);
+ return syncGame(s);
}
bool TotEngine::canLoadGameStateCurrently(Common::U32String *msg) {
diff --git a/engines/tot/sound.cpp b/engines/tot/sound.cpp
index 2a91324f391..4a2976100f3 100644
--- a/engines/tot/sound.cpp
+++ b/engines/tot/sound.cpp
@@ -99,7 +99,7 @@ void playMidiFile(Common::String nomfich, boolean loop) {
Common::File ficheromus;
if(!ficheromus.open(Common::Path(nomfich + ".MUS"))){
- error("pitamidfich(): ioresult! (267)");
+ showError(267);
}
midmusica = (byte *)malloc(ficheromus.size());
ficheromus.read(midmusica, ficheromus.size());
diff --git a/engines/tot/sound.h b/engines/tot/sound.h
index fa2cd61ce49..206bdb6082f 100644
--- a/engines/tot/sound.h
+++ b/engines/tot/sound.h
@@ -32,7 +32,7 @@ void lowerMidiVolume(byte voll, byte volr);
void restoreMidiVolume(byte voll, byte volr);
void setMasterVolume(byte voll, byte volr);
void loadVoc(Common::String vocFile, int32 startPos, uint vocSize);
-void autoPlayVoc(Common::String vocFile, int32 startPos, uint vocSize);
+void autoPlayVoc(Common::String vocFile, int32 startPos, uint vocSize);
void pitavocmem();
void playVoc(Common::String vocFile, int32 startPos, uint vocSize);
void stopVoc();
diff --git a/engines/tot/soundman.cpp b/engines/tot/soundman.cpp
index d32657eac97..ca9bad3bf51 100644
--- a/engines/tot/soundman.cpp
+++ b/engines/tot/soundman.cpp
@@ -55,7 +55,7 @@ void SoundManager::loadVoc(Common::String fileName, long offset, int16 size) {
if (size == 0) {
if (!vocResource.open(Common::Path(fileName + ".VOC"))) {
- error("Error loading file %s", fileName.c_str());
+ _exit(266);
}
_lastSrcStream = vocResource.readStream((uint32)vocResource.size());
@@ -63,7 +63,7 @@ void SoundManager::loadVoc(Common::String fileName, long offset, int16 size) {
} else {
Common::File vocResource;
if (!vocResource.open("EFECTOS.DAT")) {
- error("loadVoc(): could not open SFX file! (266)");
+ _exit(266);
}
vocResource.seek(offset);
_lastSrcStream = vocResource.readStream((uint32)size);
@@ -182,7 +182,7 @@ void MusicPlayer::playMidi(const char *fileName, bool loop) {
debug("Opening music file %s", fileName);
musicFile.open(fileName);
if (!musicFile.isOpen()) {
- error("Cannot open music file %s", fileName);
+ _exit(267);
return;
}
byte *data = (byte *)malloc(musicFile.size());
diff --git a/engines/tot/util.cpp b/engines/tot/util.cpp
index fbd1776ecc0..f895e467341 100644
--- a/engines/tot/util.cpp
+++ b/engines/tot/util.cpp
@@ -7,8 +7,361 @@
namespace Tot {
-void _exit(int code) {
- warning("STUB: exit!");
+void showError(int code) {
+ switch (code) {
+ case 1:
+ error("Error 1: Funci\xA2n no existe.");
+ break;
+ case 2:
+ error("Error 2: Fichero no encontrado.");
+ break;
+ case 3:
+ error("Error 3: Camino no encontrado.");
+ break;
+ case 4:
+ error("Error 4: Demasiados ficheros abiertos.");
+ break;
+ case 5:
+ error("Error 5: Acceso denegado.");
+ break;
+ case 6:
+ error("Error 6: Asignacion de fichero incorrecta.");
+ break;
+ case 12:
+ error("Error 12: C\xA2"
+ "digo de acceso a fichero incorrecto.");
+ break;
+ case 13:
+ case 14:
+ error("Error %d: \xA8"
+ "Alguien ha visto por ah\xA1 un bol\xA1grafo?.",
+ code);
+ break;
+ case 15:
+ error("Error 15: Unidad incorrecta.");
+ break;
+ case 16:
+ error("Error 16: No se puede borrar el directorio.");
+ break;
+ case 17:
+ error("Error 17: No se puede renombrar en distintas unidades.");
+ break;
+ case 18:
+ error("Error 18: No hay m\xA0s ficheros.");
+ break;
+ case 100:
+ error("Error 100: No se pudo leer del disco.");
+ break;
+ case 101:
+ error("Error 101: No se pudo escribir en el disco.");
+ break;
+ case 102:
+ error("Error 102: Fichero sin asignar.");
+ break;
+ case 103:
+ error("Error 103: Fichero sin abrir.");
+ break;
+ case 104:
+ error("Error 104: Fichero abierto para salida.");
+ break;
+ case 105:
+ error("Error 105: Fichero abierto para entrada.");
+ break;
+ case 106:
+ error("Error 106: Formato num\x82rico no v\xA0lido.");
+ break;
+ case 150:
+ error("Error 150: Disco protegido contra escritura.");
+ break;
+ case 151:
+ error("Error 151: El driver del disco devuelve una estructura incorrecta.");
+ break;
+ case 152:
+ error("Error 152: Unidad no preparada.");
+ break;
+ case 153:
+ error("Error %d: JOZU!! que Barbari\xA0.");
+ break;
+ case 154:
+ error("Error 154: Comprobaci\xA2n err\xA2nea en el control de redundancia c\xA1"
+ "clica.");
+ break;
+ case 155:
+ error("Error %d: Cerrado por vacaciones.", code);
+ break;
+ case 156:
+ error("Error 156: Posicionamiento err\xA2neo en el fichero.");
+ break;
+ case 157:
+ error("Error 157: Disco de formato desconocido.");
+ break;
+ case 158:
+ error("Error 158: Sector no encontrado en el disco.");
+ break;
+ case 159:
+ error("Error 159: Impresora sin papel.");
+ break;
+ case 160:
+ error("Error 160: No se pudo escribir en el dispositivo.");
+ break;
+ case 161:
+ error("Error 161: No se pudo leer del dispositivo.");
+ break;
+ case 162:
+ error("Error 162: Problema con el dispositivo.");
+ break;
+ case 200:
+ error("Error 200: Division por cero.");
+ break;
+ case 201:
+ error("Error 201: Variable fuera de rango.");
+ break;
+ case 202:
+ error("Error 202: Desbordamiento en la pila.");
+ break;
+ case 203:
+ error("Error 203: Desbordamiento en la memoria din\xA0mica.");
+ break;
+ case 204:
+ error("Error 204: Operaci\xA2n err\xA2nea con un puntero.");
+ break;
+ case 205:
+ error("Error 205: Desbordamiento en coma flotante.");
+ break;
+ case 206:
+ error("Error 206: Desbordamiento negativo en coma flotante.");
+ break;
+ case 207:
+ error("Error 207: Operaci\xA2n err\xA2nea de coma flotante.");
+ break;
+ case 208:
+ error("Error 208: Gestor de solapamiento sin instalar.");
+ break;
+ case 209:
+ error("Error 209: Lectura err\xA2nea del fichero de solapamiento.");
+ break;
+ case 210:
+ error("Error 210: Objeto sin inicializar.");
+ break;
+ case 211:
+ error("Error 211: Llamada a un metodo abstracto.");
+ break;
+ case 212:
+ error("Error 212: Cadena de asignaci\xA2n del objeto err\xA2nea.");
+ break;
+ case 213:
+ error("Error 213: Indice para colecci\xA2n fuera de rango.");
+ break;
+ case 214:
+ error("Error 214: Desbordamiento en la colecci\xA2n.");
+ break;
+ case 215:
+ error("Error 215: Desbordamiento en operaci\xA2n aritm\x82tica.");
+ break;
+ case 216:
+ error("Error 216: Acceso a memoria sin asignar.");
+ break;
+ case 250:
+ error("Error 250: El driver de AdLib no est\xA0 instalado.");
+ break;
+ case 251:
+ error("Error 251: Libre para AdLib.");
+ break;
+ case 252:
+ error("Error 252: No se encontr\xA2 el fichero de efectos para SBlaster.");
+ break;
+ case 253:
+ error("Error 253: No se encontr\xA2 el fichero de m\xA3sica para SBlaster.");
+ break;
+ case 254:
+ error("Error 254: Libre para el fichero de configuraci\xA2n del sonido.");
+ break;
+ case 255:
+ error("Error 255: Detectado Ctrl-Break.");
+ break;
+ case 256:
+ error("Error 256: La tarjeta de video no soporta el modo gr\xA0"
+ "fico requerido.");
+ break;
+ case 257:
+ error("Error 257: El tipo de pantalla no es correcto.");
+ break;
+ case 258:
+ error("Error 258: No se encontr\xA2 el fichero con la imagen del menu.");
+ break;
+ case 259:
+ error("Error 259: Clave de protecci\xA2n erronea.");
+ break;
+ case 260:
+ error("Error 260: No se encontr\xA2 el driver del modo X de v\xA1"
+ "deo.");
+ break;
+ case 261:
+ error("Error 261: No se encontr\xA2 el fichero de datos de los objetos.");
+ break;
+ case 262:
+ error("Error 262: No se encontr\xA2 el fichero de los BITMAP.");
+ break;
+ case 263:
+ error("Error 263: No se encontr\xA2 el fichero de paleta para la imagen girando.");
+ break;
+ case 264:
+ error("Error 264: Se desbord\xA2 la pila de montaje de bitmaps");
+ break;
+ case 265:
+ error("Error 265: No se encontr\xA2 el fichero de la animaci\xA2n.");
+ break;
+ case 266:
+ error("Error 266: No se encontr\xA2 el fichero del efecto de sonido.");
+ break;
+ case 267:
+ error("Error 267: No se encontr\xA2 el fichero de la melodia.");
+ break;
+ case 268:
+ error("Error 268: No se encontr\xA2 el driver de sonido MIDI.");
+ break;
+ case 269:
+ error("Error 269: No se pudo capturar un vector de interrupci\xA2n.");
+ break;
+ case 270:
+ error("Error 270: No se encontr\xA2 el fichero de los cr\x82"
+ "ditos.");
+ break;
+ case 271:
+ error("Error 271: No se encontr\xA2 el fichero del BitMap del sello.");
+ break;
+ case 272:
+ error("Error 272: No se encontr\xA2 el fichero de la animaci\xA2n.");
+ break;
+ case 273:
+ error("Error 273: No se encontraron los \xA1"
+ "ndices de los modos X de acceso a v\xA1"
+ "deo.");
+ break;
+ case 274:
+ error("Error 274: Fichero de datos corrupto, instale de nuevo el programa.");
+ break;
+ case 275:
+ error("Error 275: Posici\xA2n incorrecta del Sprite.");
+ break;
+ case 276:
+ error("Error 276: Alineaci\xA2n incorrecta del driver de sonido.");
+ break;
+ case 277:
+ error("Error 277: No se encontr\xA2 el fichero de la animaci\xA2n.");
+ break;
+ case 278:
+ error("Error 278: No se encontr\xA2 el fichero para la actualizaci\xA2n.");
+ break;
+ case 279:
+ error("Error 279: No se actualiz\xA2 el puntero del rat\xA2n.");
+ break;
+ case 280:
+ error("Error 280: No se encontr\xA2 el puntero de video.");
+ break;
+ case 281:
+ error("Error 281: No se actualiz\xA2 el puntero de video.");
+ break;
+ case 282:
+ error("Error 282: No se actualiz\xA2 el flag del trace.");
+ break;
+ case 299:
+ error("Error 299: No se pudo reubicar los datos en la memoria XMS.");
+ break;
+ case 300:
+ error("Error 300: No hay memoria XMS suficiente.");
+ break;
+ case 301:
+ error("Error 301: No se pudo reservar memoria XMS suficiente.");
+ break;
+ case 302:
+ error("Error 302: No se pudo liberar la memoria XMS.");
+ break;
+ case 303:
+ error("Error 303: No se encuentra disponible un handle para XMS.");
+ break;
+ case 304:
+ error("Error 304: No se encontr\xA2 el fichero de gr\xA0"
+ "ficos.");
+ break;
+ case 305:
+ error("Error 305: Necesita una versi\xA2n 6.0 o posterior del driver del rat\xA2n.");
+ break;
+ case 306:
+ error("Error 306: No se pudo inicializar correctamente el driver del rat\xA2n.");
+ break;
+ case 307:
+ error("Error 307: No hay memoria baja suficiente.");
+ break;
+ case 308:
+ error("Error 308: No se pudo inicializar correctamente el modo gr\xA0"
+ "fico.");
+ break;
+ case 309:
+ error("Error 309: No se pudieron inicializar correctamente los tipos de letra.");
+ break;
+ case 310:
+ error("Error 310: No se encontr\xA2 el fichero de paleta.");
+ break;
+ case 311:
+ error("Error 311: No se encontr\xA2 el fichero de paleta para fundido.");
+ break;
+ case 312:
+ error("Error 312: No se encontr\xA2 el fichero de los BITMAP del inventario.");
+ break;
+ case 313:
+ error("Error 313: No se encontr\xA2 el fichero de hipertexto.");
+ break;
+ case 314:
+ error("Error 314: No se encontr\xA2 el fichero del arbol de conversaciones.");
+ break;
+ case 315:
+ error("Error 315: No se encontr\xA2 el fichero de la pantalla a pintar.");
+ break;
+ case 316:
+ error("Error 316: No se encontr\xA2 el fichero de la pantalla a cargar.");
+ break;
+ case 317:
+ error("Error 317: No se encontr\xA2 el fichero de las mascaras del rat\xA2n.");
+ break;
+ case 318:
+ error("Error 318: No se encontr\xA2 el fichero del diploma.");
+ break;
+ case 319:
+ error("Error 319: No se encontr\xA2 el fichero de los objetos en pantalla.");
+ break;
+ case 320:
+ error("Error 320: No se encontr\xA2 el fichero de la rejilla de pantalla.");
+ break;
+ case 321:
+ error("Error 321: No se encontr\xA2 el fichero del objeto rotando.");
+ break;
+ case 322:
+ error("Error 322: No se encontr\xA2 el fichero de la partida salvada.");
+ break;
+ case 323:
+ error("Error 323: No se encontr\xA2 el fichero de configuraci\xA2n.");
+ break;
+ default: {
+ if (code >= 7 && code <= 11) {
+ error("Error %d: Espera... Espera... La placa madre est\xA0 teniendo gemelos", code);
+ } else if (code >= 19 && code <= 99) {
+ error("Error %d: Mi, mi, mi, mi, mi.... etc.", code);
+ } else if (code >= 107 && code <= 149) {
+ error("Error %d: Tr\xA0"
+ "fico intenso en el bus de datos.",
+ code);
+ } else if (code >= 163 && code <= 199) {
+ error("Error %d: No sabe, no contesta.", code);
+ } else if (code >= 217 && code <= 249) {
+ error("Error %d: Dios mio... estoy lleno de chips.", code);
+ } else if (code >= 283 && code <= 298) {
+ error("Error %d: Coffe not found. Operator Halted.", code);
+ } else {
+ error("Error %d: La parab\xA2lica est\xA0 mal orientada.", code);
+ }
+ }
+ }
}
void delay(uint16 ms) {
@@ -51,7 +404,6 @@ void outtextxy(int x, int y, char const *text, byte color, bool euro, Graphics::
}
}
-
void outtextxyBios(int x, int y, Common::String text, byte color) {
g_engine->_graphics->biosText(text, x, y, color);
}
@@ -117,8 +469,7 @@ void waitForKey() {
bool teclapulsada = false;
Common::Event e;
debug("Waiting for key!");
- while (!teclapulsada && !g_engine->shouldQuit())
- {
+ while (!teclapulsada && !g_engine->shouldQuit()) {
while (g_system->getEventManager()->pollEvent(e)) {
if (e.type == Common::EVENT_KEYDOWN) {
teclapulsada = true;
@@ -128,7 +479,6 @@ void waitForKey() {
g_engine->_screen->update();
g_system->delayMillis(10);
}
-
}
unsigned int Random(unsigned int range) { return g_engine->getRandomNumber(range); }
diff --git a/engines/tot/util.h b/engines/tot/util.h
index f0e4dfc4ff0..244acb84a9e 100644
--- a/engines/tot/util.h
+++ b/engines/tot/util.h
@@ -11,7 +11,7 @@ namespace Tot {
typedef unsigned char boolean;
-void _exit(int code);
+void showError(int code);
// Delays a specified number of milliseconds.
void delay(uint16 ms);
@@ -25,7 +25,7 @@ void setRGBPalette(int color, int r, int g, int b);
void outtextxy(int x, int y, char const *text, byte color, bool euro = false, Graphics::TextAlign align = Graphics::kTextAlignStart);
-void outtextxy(int x, int y, Common::String text, byte color, bool euro= false, Graphics::TextAlign align = Graphics::kTextAlignStart);
+void outtextxy(int x, int y, Common::String text, byte color, bool euro = false, Graphics::TextAlign align = Graphics::kTextAlignStart);
void outtextxyBios(int x, int y, Common::String text, byte color);
@@ -48,11 +48,11 @@ void waitForKey();
void changeGameSpeed(Common::Event e);
inline int keypressed() {
- warning("Stub keypressed!");
+ warning("Stub keypressed!");
return 0;
}
-inline boolean odd(long i) { return i%2!= 0; }
+inline boolean odd(long i) { return i % 2 != 0; }
unsigned Random(unsigned range);
int Random(int range);
Commit: 21953a315cf446758ac1c315c40a6284467907d2
https://github.com/scummvm/scummvm/commit/21953a315cf446758ac1c315c40a6284467907d2
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:47+02:00
Commit Message:
TOT: Maps remaining errors
Changed paths:
engines/tot/mouseman.cpp
engines/tot/routines.cpp
engines/tot/routines.h
engines/tot/sound.cpp
engines/tot/soundman.cpp
diff --git a/engines/tot/mouseman.cpp b/engines/tot/mouseman.cpp
index 16d00476630..d3ba201317b 100644
--- a/engines/tot/mouseman.cpp
+++ b/engines/tot/mouseman.cpp
@@ -26,6 +26,7 @@
#include "tot/mouseman.h"
#include "tot/tot.h"
+#include "tot/util.h"
namespace Tot {
@@ -85,7 +86,7 @@ void MouseManager::warpMouse(int mask, int x, int y) {
void MouseManager::loadMasks() {
Common::File mouseMaskFile;
if (!mouseMaskFile.open(Common::Path("RATON.ACA")))
- _exit(317);
+ showError(317);
int numMouseMasks = mouseMaskFile.readByte();
int mouseMaskSize = mouseMaskFile.readUint16LE();
diff --git a/engines/tot/routines.cpp b/engines/tot/routines.cpp
index 1666bd89f8d..60d39d0b610 100644
--- a/engines/tot/routines.cpp
+++ b/engines/tot/routines.cpp
@@ -4409,7 +4409,7 @@ void saveLoad() {
if (pulsay >= 13 && pulsay <= 16) {
if (pulsax >= 54 && pulsax <= 124) {
if (partidaselecc > 0 && !desactivagrabar && (nombrepartida != Common::String("DISPONIBLE ") + (char)(partidaselecc + 48)) && (nombrepartida != "")) {
- saveGame(partidaselecc);
+ // saveGame(partidaselecc);
fichindice.close();
putImg(50, 10, puntfondmenu);
salirmenufunciones = true;
@@ -4428,7 +4428,7 @@ void saveLoad() {
freeAnimation();
freeScreenObjects();
}
- loadGame(partidaselecc);
+ // loadGame(partidaselecc);
xraton = oldxraton;
yraton = oldyraton;
diff --git a/engines/tot/routines.h b/engines/tot/routines.h
index 258abc5433e..c429bd0715c 100644
--- a/engines/tot/routines.h
+++ b/engines/tot/routines.h
@@ -65,6 +65,7 @@ void updateSecondaryAnimationDepth();
void updateMainCharacterDepth();
void actionLineText(Common::String actionLine);
void initializeObjectFile();
+void saveItem(InvItemRegister object, Common::SeekableWriteStream *objectDataStream);
regismht readVerbRegister(uint numRegister);
regismht readVerbRegister();
diff --git a/engines/tot/sound.cpp b/engines/tot/sound.cpp
index 4a2976100f3..9f7355ec29d 100644
--- a/engines/tot/sound.cpp
+++ b/engines/tot/sound.cpp
@@ -19,8 +19,8 @@
*
*/
-#include "common/textconsole.h"
#include "common/file.h"
+#include "common/textconsole.h"
#include "tot/sound.h"
#include "tot/tot.h"
@@ -35,30 +35,28 @@ void stopVoc() {
void setSfxVolume(byte voll, byte volr) {
- if(voll == volr) {
- int volume = (voll)/(float)7 * 255;
+ if (voll == volr) {
+ int volume = (voll) / (float)7 * 255;
g_engine->_sound->setSfxVolume(volume);
g_engine->_sound->setSfxBalance(true, true);
- }
- else {
- if(voll == 0) {
+ } else {
+ if (voll == 0) {
g_engine->_sound->setSfxBalance(false, true);
- }
- else {
+ } else {
g_engine->_sound->setSfxBalance(true, false);
}
}
}
void setMidiVolume(byte voll, byte volr) {
- int volume = (voll)/(float)7 * 255;
+ int volume = (voll) / (float)7 * 255;
g_engine->_sound->setMusicVolume(volume);
}
void lowerMidiVolume(byte voll, byte volr) {
byte volpaso = (voll + volr) / 2;
- for (int ivol = volpaso; ivol >= 0; ivol --) {
+ for (int ivol = volpaso; ivol >= 0; ivol--) {
setMidiVolume(ivol, ivol);
delay(10);
}
@@ -68,7 +66,7 @@ void restoreMidiVolume(byte voll, byte volr) {
byte ivol, volpaso;
volpaso = (voll + volr) / 2;
- for (ivol = 0; ivol <= volpaso; ivol ++) {
+ for (ivol = 0; ivol <= volpaso; ivol++) {
setMidiVolume(ivol, ivol);
delay(10);
}
@@ -98,7 +96,7 @@ void playVoc(Common::String vocfile, int32 posinicio, uint tamvocleer) {
void playMidiFile(Common::String nomfich, boolean loop) {
Common::File ficheromus;
- if(!ficheromus.open(Common::Path(nomfich + ".MUS"))){
+ if (!ficheromus.open(Common::Path(nomfich + ".MUS"))) {
showError(267);
}
midmusica = (byte *)malloc(ficheromus.size());
@@ -108,7 +106,6 @@ void playMidiFile(Common::String nomfich, boolean loop) {
ficheromus.close();
}
-
void initSound() {
setMidiVolume(3, 3);
playMidiFile("Silent", false);
diff --git a/engines/tot/soundman.cpp b/engines/tot/soundman.cpp
index ca9bad3bf51..72c0e5ee617 100644
--- a/engines/tot/soundman.cpp
+++ b/engines/tot/soundman.cpp
@@ -28,9 +28,10 @@
#include "common/config-manager.h"
#include "common/substream.h"
+#include "soundman.h"
#include "tot/soundman.h"
#include "tot/tot.h"
-#include "soundman.h"
+#include "tot/util.h"
namespace Tot {
@@ -55,7 +56,7 @@ void SoundManager::loadVoc(Common::String fileName, long offset, int16 size) {
if (size == 0) {
if (!vocResource.open(Common::Path(fileName + ".VOC"))) {
- _exit(266);
+ showError(266);
}
_lastSrcStream = vocResource.readStream((uint32)vocResource.size());
@@ -63,13 +64,12 @@ void SoundManager::loadVoc(Common::String fileName, long offset, int16 size) {
} else {
Common::File vocResource;
if (!vocResource.open("EFECTOS.DAT")) {
- _exit(266);
+ showError(266);
}
vocResource.seek(offset);
_lastSrcStream = vocResource.readStream((uint32)size);
}
_audioStream = Audio::makeVOCStream(_lastSrcStream, Audio::FLAG_UNSIGNED, DisposeAfterUse::NO);
-
}
void SoundManager::autoPlayVoc() {
_mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundHandle, Audio::makeLoopingAudioStream(_audioStream, 0), kSfxId, 255U, 0, DisposeAfterUse::NO);
@@ -112,13 +112,12 @@ void SoundManager::beep(int32 frequency, int32 ms) {
speaker->setVolume(255);
speaker->play(Audio::PCSpeaker::kWaveFormSine, frequency, ms);
_mixer->playStream(Audio::Mixer::kSFXSoundType, &_speakerHandle,
- speaker,
- -1,
- Audio::Mixer::kMaxChannelVolume,
- 0,
- DisposeAfterUse::NO,
- true
- );
+ speaker,
+ -1,
+ Audio::Mixer::kMaxChannelVolume,
+ 0,
+ DisposeAfterUse::NO,
+ true);
}
void SoundManager::setSfxVolume(int volume) {
@@ -129,7 +128,7 @@ void SoundManager::setSfxVolume(int volume) {
}
void SoundManager::setSfxBalance(bool left, bool right) {
- int balance = left? -127: 127;
+ int balance = left ? -127 : 127;
_mixer->setChannelBalance(_soundHandle, balance);
// _mixer->setChannelBalance();
}
@@ -182,7 +181,7 @@ void MusicPlayer::playMidi(const char *fileName, bool loop) {
debug("Opening music file %s", fileName);
musicFile.open(fileName);
if (!musicFile.isOpen()) {
- _exit(267);
+ showError(267);
return;
}
byte *data = (byte *)malloc(musicFile.size());
Commit: 72d6c49ad28f302a803957fde5288a10c469bdbe
https://github.com/scummvm/scummvm/commit/72d6c49ad28f302a803957fde5288a10c469bdbe
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:48+02:00
Commit Message:
TOT: Fixes error when saving rooms
Changed paths:
engines/tot/dialog.cpp
engines/tot/game.cpp
engines/tot/graphics.cpp
engines/tot/routines.cpp
engines/tot/routines2.cpp
diff --git a/engines/tot/dialog.cpp b/engines/tot/dialog.cpp
index 90708a6aeb7..96214d5777c 100644
--- a/engines/tot/dialog.cpp
+++ b/engines/tot/dialog.cpp
@@ -543,8 +543,6 @@ void talk(byte person) {
fixTree(step);
saveConversations(conversationData, ar, person - 1);
- // Make sure to autosave
- g_engine->saveAutosaveIfEnabled();
verb.close();
if (g_engine->shouldQuit()) {
return;
diff --git a/engines/tot/game.cpp b/engines/tot/game.cpp
index 52d11baf993..5e58270e5b4 100644
--- a/engines/tot/game.cpp
+++ b/engines/tot/game.cpp
@@ -510,7 +510,7 @@ int startGame() {
restoreMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
if (contadorpc2 > 43)
showError(274);
- // sacrificeScene();
+ sacrificeScene();
clear();
loadObjects();
loadPalette("SEGUNDA");
@@ -539,7 +539,7 @@ int startGame() {
// Debug graphics
{
- g_engine->_graphics->euroText(Common::String::format("Room: %d", currentRoomNumber), 0, 0, 220, Graphics::kTextAlignLeft);
+ // g_engine->_graphics->euroText(Common::String::format("Room: %d", currentRoomNumber), 0, 0, 220, Graphics::kTextAlignLeft);
// g_engine->_mouseManager->printPos(xraton, yraton, 220, 0);
// printPos(characterPosX, characterPosY, 220, 10, "CharPos");
if (showMouseGrid) {
@@ -567,8 +567,8 @@ int startGame() {
}
}
}
- g_engine->_screen->markAllDirty();
- g_engine->_screen->update();
+ // g_engine->_screen->markAllDirty();
+ // g_engine->_screen->update();
}
g_engine->_screen->update();
diff --git a/engines/tot/graphics.cpp b/engines/tot/graphics.cpp
index f8413bf5e4d..35d2def7fd8 100644
--- a/engines/tot/graphics.cpp
+++ b/engines/tot/graphics.cpp
@@ -189,10 +189,9 @@ void updateSceneAreaIfNeeded(int speed = 1) {
void effect(byte numeroefecto, boolean pasaranegro, byte *pantalla2) {
int i1, i2, i3, j1, j2, j3;
- // bool enabled = false;
- bool enabled = true;
+ bool enabled = false;
+ // bool enabled = true;
- // numeroefecto = 13;
byte *screenBuf = (byte *)g_engine->_screen->getPixels();
// Disable effects for now
if (!enabled) {
diff --git a/engines/tot/routines.cpp b/engines/tot/routines.cpp
index 60d39d0b610..ba0b3fdfe49 100644
--- a/engines/tot/routines.cpp
+++ b/engines/tot/routines.cpp
@@ -5038,8 +5038,6 @@ void saveRoom(RoomFileRegister *room, Common::SeekableWriteStream *screenDataStr
void saveRoomData(RoomFileRegister *room, Common::SeekableWriteStream *stream) {
rooms->seek(room->codigo * roomRegSize, SEEK_SET);
saveRoom(room, stream);
- // Make sure to autosave
- g_engine->saveAutosaveIfEnabled();
}
/**
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
index 7e91d3bb8b8..fe4afffdd7b 100644
--- a/engines/tot/routines2.cpp
+++ b/engines/tot/routines2.cpp
@@ -437,8 +437,6 @@ void updateItem(uint itemPosition) {
regobj.usar[0] = 9;
invItemData->seek(itemPosition);
saveItemRegister(regobj, invItemData);
- // Make sure to autosave
- g_engine->saveAutosaveIfEnabled();
}
void readItemRegister(Common::SeekableReadStream *stream, uint itemPos, InvItemRegister &thisRegObj) {
Commit: ee117dabc60684cb7df255115423c54276b9b943
https://github.com/scummvm/scummvm/commit/ee117dabc60684cb7df255115423c54276b9b943
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:48+02:00
Commit Message:
TOT: Continues palette animations in FLCs
Changed paths:
engines/tot/anims.cpp
engines/tot/dialog.cpp
engines/tot/game.cpp
engines/tot/graphics.cpp
engines/tot/graphman.cpp
engines/tot/playanim.h
engines/tot/routines.cpp
engines/tot/routines2.cpp
diff --git a/engines/tot/anims.cpp b/engines/tot/anims.cpp
index 794e92ce3f4..08728f3bec2 100644
--- a/engines/tot/anims.cpp
+++ b/engines/tot/anims.cpp
@@ -717,8 +717,8 @@ static void loadFlc(
posflicfile + header.size);
TotFlicDecoder flic = TotFlicDecoder();
- flic.loadStream(thisFlic);
+ flic.loadStream(thisFlic);
flic.start();
do {
@@ -738,7 +738,6 @@ static void loadFlc(
if (frame) {
Common::Rect boundingBox = Common::Rect(flicx, flicy, flicx + flic.getWidth() + 1, flicy + flic.getHeight() + 1);
blit(frame, boundingBox);
-
if (flic.hasDirtyPalette()) {
byte *palette = (byte *)flic.getPalette();
// game fixes background to 0
@@ -746,21 +745,36 @@ static void loadFlc(
palette[1] = 0;
palette[2] = 0;
if (palcompleta) {
+ debug("PALCOMPLETA! palette");
changePalette(g_engine->_graphics->getPalette(), palette);
- // copyPalette(palette, pal);
+ copyPalette(palette, pal);
} else if (doscientos) {
debug("Doscientos!!");
g_engine->_graphics->setPalette(palette, 200);
for (int i = 0; i <= 200; i++) {
+ if(gamePart == 2 && !salirdeljuego && (i == 131 || i == 134 || i == 143 || i == 187)) {
+ continue;
+ }
pal[i * 3 + 0] = palette[i * 3 + 0];
pal[i * 3 + 1] = palette[i * 3 + 1];
pal[i * 3 + 2] = palette[i * 3 + 2];
}
+
} else {
g_engine->_graphics->setPalette(palette);
+ debug("else palette");
copyPalette(palette, pal);
}
}
+ // Make sure we also update the palette animations! Esp. for part 2
+ if (currentRoomData != NULL && (currentRoomData->paletteAnimationFlag) && (saltospal >= 4) && !salirdeljuego) {
+ saltospal = 0;
+ if (movidapaleta > 6)
+ movidapaleta = 0;
+ else movidapaleta += 1;
+ updatePalette(movidapaleta);
+ } else saltospal += 1;
+
tocapintar = false;
} else {
break;
diff --git a/engines/tot/dialog.cpp b/engines/tot/dialog.cpp
index 96214d5777c..1ad258c444a 100644
--- a/engines/tot/dialog.cpp
+++ b/engines/tot/dialog.cpp
@@ -382,7 +382,7 @@ void showDialogLine(Common::String matrizconversa[16], uint &charlaelegida) {
}
if (tocapintar) {
- if (currentRoomData->banderapaleta && saltospal >= 4) {
+ if (currentRoomData->paletteAnimationFlag && saltospal >= 4) {
saltospal = 0;
if (movidapaleta > 6)
movidapaleta = 0;
diff --git a/engines/tot/game.cpp b/engines/tot/game.cpp
index 5e58270e5b4..9ce003ea610 100644
--- a/engines/tot/game.cpp
+++ b/engines/tot/game.cpp
@@ -118,7 +118,7 @@ int engine_start() {
desactivagrabar = false;
}
- boolean enforceSecondPart = false;
+ boolean enforceSecondPart = true;
if (enforceSecondPart) { // DEBUG
completadalista1 = true;
completadalista2 = true;
@@ -246,7 +246,7 @@ int startGame() {
yframe2 = pulsay + 7;
// obtains the target area from the clicked coordinates
zonadestino = currentRoomData->rejapantalla[xframe2 / factorx][yframe2 / factory];
- if (currentRoomData->codigo == 21 && currentRoomData->banderamovimiento) {
+ if (currentRoomData->codigo == 21 && currentRoomData->animationFlag) {
if ((zonadestino >= 1 && zonadestino <= 5) ||
(zonadestino >= 9 && zonadestino <= 13) ||
(zonadestino >= 18 && zonadestino <= 21) ||
@@ -510,7 +510,7 @@ int startGame() {
restoreMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
if (contadorpc2 > 43)
showError(274);
- sacrificeScene();
+ // sacrificeScene();
clear();
loadObjects();
loadPalette("SEGUNDA");
@@ -807,7 +807,7 @@ void sceneChange() {
effect(tipoefectofundido, true, NULL);
stopVoc();
loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
- if (libro[0] == true && currentRoomData->banderamovimiento == true)
+ if (libro[0] == true && currentRoomData->animationFlag == true)
disableSecondAnimation();
if (contadorpc > 89)
showError(274);
@@ -960,7 +960,7 @@ void sceneChange() {
showError(274);
setSfxVolume(volumenfxizquierdo, volumenfxderecho);
if (trampa_puesta) {
- currentRoomData->banderamovimiento = true;
+ currentRoomData->animationFlag = true;
loadAnimation(currentRoomData->nombremovto);
iframe2 = 0;
indicetray2 = 1;
diff --git a/engines/tot/graphics.cpp b/engines/tot/graphics.cpp
index 35d2def7fd8..aae31b40d7c 100644
--- a/engines/tot/graphics.cpp
+++ b/engines/tot/graphics.cpp
@@ -781,6 +781,13 @@ void updatePalette(byte indicepaleta) {
ip = -4;
break;
}
+ // debug("-----------BEFORE--------------- (adding %d)", ip);
+ // debug("Color 131: %d,%d,%d", pal[131 * 3 + 0], pal[131 * 3 + 1], pal[131 * 3 + 2]);
+ // debug("Color 134: %d,%d,%d", pal[134 * 3 + 0], pal[134 * 3 + 1], pal[134 * 3 + 2]);
+ // debug("Color 143: %d,%d,%d", pal[143 * 3 + 0], pal[143 * 3 + 1], pal[143 * 3 + 2]);
+ // debug("Color 187: %d,%d,%d", pal[187 * 3 + 0], pal[187 * 3 + 1], pal[187 * 3 + 2]);
+
+
for (int i = 0; i < 3; i++) {
pal[131 * 3 + i] = pal[131 * 3 + i] - ip;
pal[134 * 3 + i] = pal[134 * 3 + i] - ip;
@@ -788,6 +795,12 @@ void updatePalette(byte indicepaleta) {
pal[187 * 3 + i] = pal[187 * 3 + i] - ip;
}
g_engine->_graphics->setPalette(pal);
+
+ // debug("-----------AFTER--------------- (adding %d)", ip);
+ // debug("Color 131: %d,%d,%d", pal[131 * 3 + 0], pal[131 * 3 + 1], pal[131 * 3 + 2]);
+ // debug("Color 134: %d,%d,%d", pal[134 * 3 + 0], pal[134 * 3 + 1], pal[134 * 3 + 2]);
+ // debug("Color 143: %d,%d,%d", pal[143 * 3 + 0], pal[143 * 3 + 1], pal[143 * 3 + 2]);
+ // debug("Color 187: %d,%d,%d", pal[187 * 3 + 0], pal[187 * 3 + 1], pal[187 * 3 + 2]);
} break;
}
}
diff --git a/engines/tot/graphman.cpp b/engines/tot/graphman.cpp
index da6d8f2e3cf..fdf3770b0a0 100644
--- a/engines/tot/graphman.cpp
+++ b/engines/tot/graphman.cpp
@@ -73,7 +73,6 @@ void GraphicsManager::writeActionLine(const Common::String &str) {
}
void GraphicsManager::setPalette(byte *palette, uint num) {
-
g_system->getPaletteManager()->setPalette(palette, 0, num);
}
diff --git a/engines/tot/playanim.h b/engines/tot/playanim.h
index 1c523566bad..1ad8d50f87d 100644
--- a/engines/tot/playanim.h
+++ b/engines/tot/playanim.h
@@ -210,13 +210,13 @@ struct RoomFileRegister {
* trayectorias then has a precalculated route from each possible combination of two areas in the game.
* pixel by pixel translation within the area is done by bresenham algorithm in the trajectory function.
*/
- Common::Point trayectories[9][30][5];
+ Common::Point trajectories[9][30][5];
DoorRegistry doors[5]; /* doors in the room */
RoomBitmapRegister bitmapasociados[15];
RoomObjectListEntry *indexadoobjetos[51] = {NULL}; /* includes name of objects for mouseover + index to object file*/
- boolean banderamovimiento; /* true if another character is moving */
+ boolean animationFlag; /* true if there is a secondary animation */
Common::String nombremovto; /* name of the secondary animation, 8 chars*/
- boolean banderapaleta; /* true if there exist palette animation */
+ boolean paletteAnimationFlag; /* true if there exist palette animation */
uint16 puntpaleta; /* points to the screen palette */
Common::Point tray2[300]; /* trajectory of the secondary animation */
uint16 dir2[300]; /* directions of the secondary trajectory. Pos 300 reflects object code. */
diff --git a/engines/tot/routines.cpp b/engines/tot/routines.cpp
index ba0b3fdfe49..977d1b85e4b 100644
--- a/engines/tot/routines.cpp
+++ b/engines/tot/routines.cpp
@@ -703,7 +703,7 @@ void animatedSequence(uint numSequence) {
sprites(true);
} break;
case 6: {
- currentRoomData->banderamovimiento = false;
+ currentRoomData->animationFlag = false;
if (!animationFile.open("AZCCOG.DAT")) {
showError(277);
}
@@ -742,7 +742,7 @@ void animatedSequence(uint numSequence) {
animationFile.close();
stopVoc();
screenObjects[6] = NULL;
- currentRoomData->banderamovimiento = true;
+ currentRoomData->animationFlag = true;
} break;
}
}
@@ -796,7 +796,7 @@ RoomFileRegister *readScreenDataFile(Common::SeekableReadStream *screenDataFile)
for (int i = 0; i < 9; i++) {
for (int j = 0; j < 30; j++) {
for (int k = 0; k < 5; k++) {
- screenData->trayectories[i][j][k] = readPunto(screenDataFile);
+ screenData->trajectories[i][j][k] = readPunto(screenDataFile);
}
}
}
@@ -811,10 +811,10 @@ RoomFileRegister *readScreenDataFile(Common::SeekableReadStream *screenDataFile)
screenData->indexadoobjetos[i] = readRegIndexadoObjetos(screenDataFile);
}
- screenData->banderamovimiento = screenDataFile->readByte();
+ screenData->animationFlag = screenDataFile->readByte();
screenData->nombremovto = screenDataFile->readPascalString();
screenDataFile->skip(8 - screenData->nombremovto.size());
- screenData->banderapaleta = screenDataFile->readByte();
+ screenData->paletteAnimationFlag = screenDataFile->readByte();
screenData->puntpaleta = screenDataFile->readUint16LE();
for (int i = 0; i < 300; i++) {
screenData->tray2[i] = readPunto(screenDataFile);
@@ -838,7 +838,7 @@ void loadScreenData(uint screenNumber) {
loadItem(bitmap.coordx, bitmap.coordy, bitmap.tambitmap, bitmap.puntbitmap, bitmap.profund);
}
}
- if (currentRoomData->banderamovimiento && currentRoomData->codigo != 24) {
+ if (currentRoomData->animationFlag && currentRoomData->codigo != 24) {
loadAnimation(currentRoomData->nombremovto);
iframe2 = 0;
indicetray2 = 1;
@@ -858,7 +858,7 @@ void loadScreenData(uint screenNumber) {
currentRoomData->mouseGrid[oldposx + i][oldposy + j] = rejamascararaton[i][j];
}
} else
- currentRoomData->banderamovimiento = false;
+ currentRoomData->animationFlag = false;
updateMainCharacterDepth();
assembleScreen();
@@ -1067,7 +1067,7 @@ void calculateRoute(byte zona1, byte zona2, boolean extraCorrection, boolean zon
Common::Point point;
do {
pasos += 1;
- point = currentRoomData->trayectories[zona1 - 1][zona2 - 1][pasos - 1];
+ point = currentRoomData->trajectories[zona1 - 1][zona2 - 1][pasos - 1];
if (point.x < (rectificacionx + 3))
mainRoute[pasos].x = 3;
@@ -1130,7 +1130,7 @@ void goToObject(byte zona1, byte zona2) {
}
}
- if (currentRoomData->codigo == 21 && currentRoomData->banderamovimiento) {
+ if (currentRoomData->codigo == 21 && currentRoomData->animationFlag) {
if ((zona2 >= 1 && zona2 <= 5) ||
(zona2 >= 9 && zona2 <= 13) ||
(zona2 >= 18 && zona2 <= 21) ||
@@ -1220,7 +1220,7 @@ void updateMainCharacterDepth() {
void advanceAnimations(boolean zonavedada, boolean animateMouse) {
if (tocapintar) {
- if (currentRoomData->banderamovimiento && tocapintar2) {
+ if (currentRoomData->animationFlag && tocapintar2) {
if (peteractivo && (Random(100) == 1) && !g_engine->_sound->isVocPlaying() && caramelos[0] == false) {
debug("Playing tos");
playVoc("TOS", 258006, 14044);
@@ -1324,7 +1324,7 @@ void advanceAnimations(boolean zonavedada, boolean animateMouse) {
sprites(true);
}
tocapintar = false;
- if (currentRoomData->banderapaleta && saltospal >= 4) {
+ if (currentRoomData->paletteAnimationFlag && saltospal >= 4) {
saltospal = 0;
if (movidapaleta > 6)
movidapaleta = 0;
@@ -1351,7 +1351,7 @@ void animateGive(uint cogedir, uint cogealt) {
// Must add 1 to i because the original game uses 1-based indices
iframe = 15 + 6 + 5 + cogealt * 10 - (i + 1);
- if (currentRoomData->banderapaleta && saltospal >= 4) {
+ if (currentRoomData->paletteAnimationFlag && saltospal >= 4) {
saltospal = 0;
if (movidapaleta > 6)
movidapaleta = 0;
@@ -1373,7 +1373,7 @@ void animatePickup1(uint cogedir, uint cogealt) {
tocapintar = false;
iframe = 15 + cogealt * 10 + (i + 1);
- if (currentRoomData->banderapaleta && saltospal >= 4) {
+ if (currentRoomData->paletteAnimationFlag && saltospal >= 4) {
saltospal = 0;
if (movidapaleta > 6)
movidapaleta = 0;
@@ -1397,7 +1397,7 @@ void animatePickup2(uint cogedir, uint cogealt) {
iframe = 15 + 5 + cogealt * 10 + (i + 1);
- if (currentRoomData->banderapaleta && saltospal >= 4) {
+ if (currentRoomData->paletteAnimationFlag && saltospal >= 4) {
saltospal = 0;
if (movidapaleta > 6)
movidapaleta = 0;
@@ -1423,7 +1423,7 @@ void animateOpen2(uint cogedir, uint cogealt) {
tocapintar = false;
iframe = 15 + 6 + cogealt * 10 - (i + 1);
- if (currentRoomData->banderapaleta && saltospal >= 4) {
+ if (currentRoomData->paletteAnimationFlag && saltospal >= 4) {
saltospal = 0;
if (movidapaleta > 6)
movidapaleta = 0;
@@ -1460,7 +1460,7 @@ void animateBat() {
itrayseg, longtrayseg, xseg, yseg, profseg, dirseg;
boolean salir_del_bucle = false;
- if (currentRoomData->banderamovimiento) {
+ if (currentRoomData->animationFlag) {
iframe2seg = iframe2;
xseg = animado.posx;
yseg = animado.posy;
@@ -1512,7 +1512,7 @@ void animateBat() {
stopVoc();
freeAnimation();
- if (currentRoomData->banderamovimiento) {
+ if (currentRoomData->animationFlag) {
anchoanimado = anchoaniseg;
altoanimado = altoaniseg;
setRoomTrajectories(altoanimado, anchoanimado, RESTORE, false);
@@ -1624,7 +1624,7 @@ void pickupScreenObject() {
currentRoomData->mouseGrid[10][12] = 18;
} break;
case 567: { // Pickup rubble
- if (currentRoomData->banderamovimiento) {
+ if (currentRoomData->animationFlag) {
g_engine->_mouseManager->show();
drawText(3226);
return;
@@ -3076,10 +3076,12 @@ void useScreenObject() {
if (tridente)
cavernas[3] = true;
} break;
- case 633: {
+ case 633: { //Use ring!
drawText(regobj.useTextRef);
g_engine->_mouseManager->hide();
-
+ debug("-------------------------------------");
+ debug("USING RING WITH PEDESTAL");
+ debug("-------------------------------------");
animateGive(3, 1);
loadItem(86, 55, 92, 1591272, 8);
handPantallaToBackground();
@@ -3254,7 +3256,7 @@ void useScreenObject() {
g_engine->_mouseManager->show();
updateItem(regobj.code);
} break;
- case 709: {
+ case 709: { // rock with mural
if (sello_quitado) {
drawText(regobj.useTextRef);
g_engine->_mouseManager->hide();
@@ -3271,7 +3273,6 @@ void useScreenObject() {
loadItem(with.coordx, with.coordy, with.tambitmap, with.puntbitmap, with.profund);
}
handPantallaToBackground();
- // XMStoPointer(ptr(segfondo, (offfondo + 4)), _handpantalla, 4,(sizepantalla - int32(4)));
assembleScreen();
drawScreen(background);
@@ -3343,12 +3344,12 @@ void useScreenObject() {
if (teleencendida) {
playVoc("CLICK", 27742, 2458);
g_engine->_sound->waitForSoundEnd();
- currentRoomData->banderapaleta = true;
+ currentRoomData->paletteAnimationFlag = true;
autoPlayVoc("PARASITO", 355778, 20129);
} else {
stopVoc();
playVoc("CLICK", 27742, 2458);
- currentRoomData->banderapaleta = false;
+ currentRoomData->paletteAnimationFlag = false;
for (indicex = 195; indicex <= 200; indicex++) {
pal[indicex * 3 + 0] = 2 << 2;
pal[indicex * 3 + 1] = 2 << 2;
@@ -4227,7 +4228,7 @@ void loadGame(regispartida game) {
autoPlayVoc("CALDERA", 6433, 15386);
} break;
case 17: {
- if (libro[0] == true && currentRoomData->banderamovimiento)
+ if (libro[0] == true && currentRoomData->animationFlag)
disableSecondAnimation();
} break;
case 20: {
@@ -4269,7 +4270,7 @@ void loadGame(regispartida game) {
break;
}
if (trampa_puesta) {
- currentRoomData->banderamovimiento = true;
+ currentRoomData->animationFlag = true;
loadAnimation(currentRoomData->nombremovto);
iframe2 = 0;
indicetray2 = 1;
@@ -4633,7 +4634,6 @@ void hypertext(
uint &numresp,
/** Whether the text being said is part of a conversation or just descriptions */
boolean banderaconversa) {
- debug("hypertext");
regismht regmht;
byte insertarnombre, iht, iteracionesht, lineaht, anchoht;
@@ -4852,7 +4852,7 @@ void hypertext(
sprites(false);
}
}
- if (currentRoomData->banderapaleta && saltospal >= 4) {
+ if (currentRoomData->paletteAnimationFlag && saltospal >= 4) {
saltospal = 0;
if (movidapaleta > 6)
movidapaleta = 0;
@@ -4997,7 +4997,7 @@ void saveRoom(RoomFileRegister *room, Common::SeekableWriteStream *screenDataStr
for (int i = 0; i < 9; i++) {
for (int j = 0; j < 30; j++) {
for (int k = 0; k < 5; k++) {
- savePoint(room->trayectories[i][j][k], screenDataStream);
+ savePoint(room->trajectories[i][j][k], screenDataStream);
}
}
}
@@ -5011,7 +5011,7 @@ void saveRoom(RoomFileRegister *room, Common::SeekableWriteStream *screenDataStr
for (int i = 0; i < 51; i++) {
saveRoomObjectList(*room->indexadoobjetos[i], screenDataStream);
}
- screenDataStream->writeByte(room->banderamovimiento);
+ screenDataStream->writeByte(room->animationFlag);
screenDataStream->writeByte(room->nombremovto.size());
screenDataStream->writeString(room->nombremovto);
@@ -5026,7 +5026,7 @@ void saveRoom(RoomFileRegister *room, Common::SeekableWriteStream *screenDataStr
free(padding);
}
- screenDataStream->writeByte(room->banderapaleta);
+ screenDataStream->writeByte(room->paletteAnimationFlag);
screenDataStream->writeUint16LE(room->puntpaleta);
for (int i = 0; i < 300; i++) {
savePoint(room->tray2[i], screenDataStream);
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
index fe4afffdd7b..654a1fe1e76 100644
--- a/engines/tot/routines2.cpp
+++ b/engines/tot/routines2.cpp
@@ -286,7 +286,7 @@ void loadScreen() {
}
fichcp.seek(currentRoomData->puntpaleta);
fichcp.read(palcp, 603);
- if (currentRoomData->banderapaleta) {
+ if (currentRoomData->paletteAnimationFlag) {
fichcp.read(movimientopal, 144);
for (int i = 0; i <= 48; i++) {
movimientopal[i * 3 + 0] = movimientopal[i * 3 + 0] << 2;
@@ -304,7 +304,7 @@ void loadScreen() {
} break;
case 2: {
loadPalette("SEGUNDA");
- currentRoomData->banderapaleta = true;
+ currentRoomData->paletteAnimationFlag = true;
} break;
}
}
@@ -2349,8 +2349,8 @@ void sacrificeScene() {
palette palaux;
stopVoc();
- boolean pulsada_salida = currentRoomData->banderapaleta;
- currentRoomData->banderapaleta = false;
+ boolean pulsada_salida = currentRoomData->paletteAnimationFlag;
+ currentRoomData->paletteAnimationFlag = false;
bar(0, 139, 319, 149, 0);
bar(10, 10, 300, 120, 0);
@@ -2673,7 +2673,7 @@ void sacrificeScene() {
}
delay(2000);
totalFadeOut(0);
- currentRoomData->banderapaleta = pulsada_salida;
+ currentRoomData->paletteAnimationFlag = pulsada_salida;
}
void ending() {
@@ -2690,15 +2690,26 @@ void ending() {
outtextxy(10, 40, " Al fin lo has conseguido....", 253);
outtextxy(10, 60, " \xAD\xAD\xADSoy LIBREEEEE!!!", 253);
+ if(g_engine->shouldQuit()) {
+ return;
+ }
delay(4000);
totalFadeOut(0);
clear();
-
+ if(g_engine->shouldQuit()) {
+ return;
+ }
lowerMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
playMidiFile("SACRIFIC", true);
restoreMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
drawFlc(0, 0, 2481274, 12, 9, 26, true, false, false, pulsada_salida);
+ if(pulsada_salida){
+ return;
+ }
drawFlc(0, 0, 2554766, 0, 9, 0, false, false, false, pulsada_salida);
+ if(pulsada_salida){
+ return;
+ }
delay(1000);
playVoc("NOOO", 0, 0);
delay(3000);
@@ -2773,7 +2784,7 @@ void assembleScreen(boolean scroll) {
if (!scroll && secuencia.profundidad == indice) {
assembleCompleteBackground(secuencia.bitmap[direccionmovimiento][iframe], characterPosX, characterPosY);
}
- if (!scroll && currentRoomData->banderamovimiento && animado.profundidad == indice) {
+ if (!scroll && currentRoomData->animationFlag && animado.profundidad == indice) {
assembleCompleteBackground(pasoanimado, animado.posx, animado.posy);
}
}
@@ -2781,7 +2792,7 @@ void assembleScreen(boolean scroll) {
void disableSecondAnimation() {
setRoomTrajectories(altoanimado, anchoanimado, RESTORE);
- currentRoomData->banderamovimiento = false;
+ currentRoomData->animationFlag = false;
freeAnimation();
handPantallaToBackground();
assembleScreen();
@@ -2889,7 +2900,7 @@ void drawGrid() {
void setRoomTrajectories(int animationHeight, int animationWidth, TRAJECTORIES_OP op, boolean fixGrids) {
// add to restore the room, subtract to adjust before loading the screen
- if (currentRoomData->banderamovimiento && currentRoomData->nombremovto != "QQQQQQQQ") {
+ if (currentRoomData->animationFlag && currentRoomData->nombremovto != "QQQQQQQQ") {
for (int i = 0; i < currentRoomData->longtray2; i++) {
if (op == RESTORE) {
currentRoomData->tray2[i].x = currentRoomData->tray2[i].x + (animationWidth >> 1);
Commit: b92670b2b13edd97f47488dc676a93925e20d35e
https://github.com/scummvm/scummvm/commit/b92670b2b13edd97f47488dc676a93925e20d35e
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:48+02:00
Commit Message:
TOT: Cleans up unused vars
Changed paths:
engines/tot/graphics.cpp
engines/tot/routines.cpp
engines/tot/routines2.cpp
engines/tot/soundman.cpp
diff --git a/engines/tot/graphics.cpp b/engines/tot/graphics.cpp
index aae31b40d7c..6cd3190e074 100644
--- a/engines/tot/graphics.cpp
+++ b/engines/tot/graphics.cpp
@@ -490,8 +490,6 @@ void effect(byte numeroefecto, boolean pasaranegro, byte *pantalla2) {
}
} break;
case 11: {
- long lastRender = 0;
- long rendertime = 10;
for (i2 = 0; i2 <= 3; i2++) {
j1 = 1 + i2;
for (i1 = (1 + i2); i1 <= (16 - i2); i1++) {
diff --git a/engines/tot/routines.cpp b/engines/tot/routines.cpp
index 977d1b85e4b..4ebcafb1bc9 100644
--- a/engines/tot/routines.cpp
+++ b/engines/tot/routines.cpp
@@ -1551,9 +1551,6 @@ void alcoveAnimation(byte direccionhn, int32 bitmap) {
depthMap[1].posy2 = 16 + object1Height + 1;
}
- uint16 dibW;
- uint16 dibH;
- debug("direccion=%d", direccionhn);
switch (direccionhn) {
case 0: {
posdibhn = 44904;
@@ -3842,9 +3839,9 @@ static void montaimagenvir(byte *image1, byte *image2) { // Near;
/**
* Grabs the action area of the screen into a pointer
*/
-static void getScreen(byte *background) {
+static void getScreen(byte *bg) {
byte *screenBuf = (byte *)g_engine->_screen->getPixels();
- Common::copy(screenBuf, screenBuf + (22400 * 2), background + 4);
+ Common::copy(screenBuf, screenBuf + (22400 * 2), bg + 4);
}
static void scrollRight(uint &horizontalPos) {
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
index 654a1fe1e76..0cbba7bde2c 100644
--- a/engines/tot/routines2.cpp
+++ b/engines/tot/routines2.cpp
@@ -2181,8 +2181,7 @@ void soundControls() {
volumenfx,
volumenmelodia,
xfade,
- oldxfade,
- ypaso;
+ oldxfade;
byte ytext, oldiraton;
boolean salirmenucontroles;
@@ -2260,12 +2259,13 @@ void soundControls() {
xfade = 86 + volumenfx;
boolean mouseReleased = false;
do {
+
+ oldxfade = xfade;
while (g_system->getEventManager()->pollEvent(e)) {
if (e.type == Common::EVENT_LBUTTONUP) {
mouseReleased = true;
} else if (e.type == Common::EVENT_MOUSEMOVE) {
xfade = e.mouse.x;
- ypaso = e.mouse.y;
}
}
if (xfade < 86) {
@@ -2299,7 +2299,6 @@ void soundControls() {
mouseReleased = true;
} else if (e.type == Common::EVENT_MOUSEMOVE) {
xfade = e.mouse.x;
- ypaso = e.mouse.y;
}
}
if (xfade < 86) {
diff --git a/engines/tot/soundman.cpp b/engines/tot/soundman.cpp
index 72c0e5ee617..d5232a35a4d 100644
--- a/engines/tot/soundman.cpp
+++ b/engines/tot/soundman.cpp
@@ -62,7 +62,6 @@ void SoundManager::loadVoc(Common::String fileName, long offset, int16 size) {
_lastSrcStream = vocResource.readStream((uint32)vocResource.size());
} else {
- Common::File vocResource;
if (!vocResource.open("EFECTOS.DAT")) {
showError(266);
}
Commit: 9f388196f4639ac4a0eb6ffc70eb31ec6bc1b778
https://github.com/scummvm/scummvm/commit/9f388196f4639ac4a0eb6ffc70eb31ec6bc1b778
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:48+02:00
Commit Message:
TOT: Restore the game starting on first part
Changed paths:
engines/tot/game.cpp
diff --git a/engines/tot/game.cpp b/engines/tot/game.cpp
index 9ce003ea610..3ae6d64f4c1 100644
--- a/engines/tot/game.cpp
+++ b/engines/tot/game.cpp
@@ -118,7 +118,7 @@ int engine_start() {
desactivagrabar = false;
}
- boolean enforceSecondPart = true;
+ boolean enforceSecondPart = false;
if (enforceSecondPart) { // DEBUG
completadalista1 = true;
completadalista2 = true;
Commit: 25628ca716ee3639a46dce37d6092cfe9b3aa65d
https://github.com/scummvm/scummvm/commit/25628ca716ee3639a46dce37d6092cfe9b3aa65d
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:48+02:00
Commit Message:
TOT: Change boolean's for bool's
Changed paths:
engines/tot/anims.cpp
engines/tot/anims.h
engines/tot/dialog.cpp
engines/tot/dialog.h
engines/tot/forest.cpp
engines/tot/forest.h
engines/tot/game.cpp
engines/tot/graphics.cpp
engines/tot/graphics.h
engines/tot/playanim.cpp
engines/tot/playanim.h
engines/tot/routines.cpp
engines/tot/routines.h
engines/tot/routines2.cpp
engines/tot/routines2.h
engines/tot/saveload.cpp
engines/tot/sound.cpp
engines/tot/sound.h
engines/tot/util.h
diff --git a/engines/tot/anims.cpp b/engines/tot/anims.cpp
index 08728f3bec2..1547c1360c9 100644
--- a/engines/tot/anims.cpp
+++ b/engines/tot/anims.cpp
@@ -41,7 +41,7 @@ int32 posflicfile;
uint numerovuelta, posrelfli;
byte *punterofondofrase = (byte *)malloc(sizefrase);
byte framecontador;
-boolean primeravuelta;
+bool primeravuelta;
void drawText(uint xfrase, uint yfrase, Common::String str1, Common::String str2, Common::String str3, Common::String str4, Common::String str5, byte colorfrase, byte colorborde) {
@@ -626,10 +626,10 @@ void handleFlcEvent(byte numero_del_evento) {
}
void drawFlc(uint flicx, uint flicy, int32 posicionfli, uint loop,
- byte veloc, byte numevento, boolean palcompleta, boolean permitesalida,
- boolean doscientos, boolean &salidaflis);
+ byte veloc, byte numevento, bool palcompleta, bool permitesalida,
+ bool doscientos, bool &salidaflis);
-static void exitProcedure(boolean &salir_bucle, boolean &permitesalida) {
+static void exitProcedure(bool &salir_bucle, bool &permitesalida) {
salir_bucle = false;
if (permitesalida) {
@@ -686,11 +686,11 @@ void blit(const Graphics::Surface *src, Common::Rect bounds) {
static void loadFlc(
uint &loop,
- boolean &permitesalida,
- boolean &salidaflis,
+ bool &permitesalida,
+ bool &salidaflis,
byte &numevento,
- boolean &palcompleta,
- boolean &doscientos,
+ bool &palcompleta,
+ bool &doscientos,
byte &veloc,
uint &flicx,
uint &flicy) {
@@ -804,10 +804,10 @@ void drawFlc(
uint loop,
byte veloc,
byte numevento,
- boolean palcompleta,
- boolean permitesalida,
- boolean doscientos,
- boolean &salidaflis) {
+ bool palcompleta,
+ bool permitesalida,
+ bool doscientos,
+ bool &salidaflis) {
primeravuelta = true;
posflicfile = posicionfli;
diff --git a/engines/tot/anims.h b/engines/tot/anims.h
index 026cb541637..4875a4780c6 100644
--- a/engines/tot/anims.h
+++ b/engines/tot/anims.h
@@ -28,8 +28,8 @@
namespace Tot {
void drawFlc(uint flicx, uint flicy, int32 posicionfli, uint loop,
- byte veloc, byte numevento, boolean palcompleta, boolean permitesalida,
- boolean doscientos, boolean &salidaflis);
+ byte veloc, byte numevento, bool palcompleta, bool permitesalida,
+ bool doscientos, bool &salidaflis);
/**
* Header of an Autodesk Animator FLIC file.
diff --git a/engines/tot/dialog.cpp b/engines/tot/dialog.cpp
index 1ad258c444a..45b47cf9698 100644
--- a/engines/tot/dialog.cpp
+++ b/engines/tot/dialog.cpp
@@ -38,7 +38,7 @@ byte conversationIndex;
plista l1, l;
Tree ar, auxTree, step;
-boolean endOfConversation;
+bool endOfConversation;
Common::String decrypt(Common::String tEncriptado) {
for (int i = 0; i < tEncriptado.size(); i++) {
@@ -49,7 +49,7 @@ Common::String decrypt(Common::String tEncriptado) {
void findDialogLine(byte persona);
-static void findDownwards(Tree paso, boolean &desciende) {
+static void findDownwards(Tree paso, bool &desciende) {
if (paso != NULL) {
if (paso->element.dicho != '1') {
desciende = true;
@@ -62,7 +62,7 @@ static void findDownwards(Tree paso, boolean &desciende) {
}
void findDialogLine(byte persona) {
- boolean hecho, decir, subida, desciende, borde, adelanta;
+ bool hecho, decir, subida, desciende, borde, adelanta;
auxTree = ar;
auxTree = auxTree->child;
@@ -299,7 +299,7 @@ void findDialogLine(byte persona) {
}
void modifyTree(uint nodonew) {
- boolean encontrado;
+ bool encontrado;
encontrado = false;
auxTree = ar->child;
diff --git a/engines/tot/dialog.h b/engines/tot/dialog.h
index e47003d19d5..a7bc24a389d 100644
--- a/engines/tot/dialog.h
+++ b/engines/tot/dialog.h
@@ -38,7 +38,7 @@ struct lista {
extern byte conversationIndex;
extern plista l1, l;
extern Tree ar, auxTree, step;
-extern boolean endOfConversation;
+extern bool endOfConversation;
void talkScreenObject();
diff --git a/engines/tot/forest.cpp b/engines/tot/forest.cpp
index 98d0c3e1e00..f78ee2583af 100644
--- a/engines/tot/forest.cpp
+++ b/engines/tot/forest.cpp
@@ -34,8 +34,8 @@ void initTree(Tree &a, nodeElement dato) {
a->child = NULL;
}
-boolean root(Tree nodo) {
- boolean raiz_result;
+bool root(Tree nodo) {
+ bool raiz_result;
if (nodo->parent == NULL)
raiz_result = true;
else
diff --git a/engines/tot/forest.h b/engines/tot/forest.h
index 825db9c974f..91b652e9614 100644
--- a/engines/tot/forest.h
+++ b/engines/tot/forest.h
@@ -43,7 +43,7 @@ struct treeDef {
void initTree(Tree& a, nodeElement data);
-boolean root(Tree node);
+bool root(Tree node);
Tree rightSibling(Tree node);
diff --git a/engines/tot/game.cpp b/engines/tot/game.cpp
index 3ae6d64f4c1..ef6e9cab7e2 100644
--- a/engines/tot/game.cpp
+++ b/engines/tot/game.cpp
@@ -118,7 +118,7 @@ int engine_start() {
desactivagrabar = false;
}
- boolean enforceSecondPart = false;
+ bool enforceSecondPart = false;
if (enforceSecondPart) { // DEBUG
completadalista1 = true;
completadalista2 = true;
diff --git a/engines/tot/graphics.cpp b/engines/tot/graphics.cpp
index 6cd3190e074..43b84ab761c 100644
--- a/engines/tot/graphics.cpp
+++ b/engines/tot/graphics.cpp
@@ -134,7 +134,7 @@ void copyFromScreen(byte *&screen) {
Common::copy(src, src + 64000, screen);
}
-void drawScreen(byte *screen, boolean offsetSize) {
+void drawScreen(byte *screen, bool offsetSize) {
int offset = offsetSize ? 4 : 0;
for (int i1 = 0; i1 < 320; i1++) {
for (int j1 = 0; j1 < 140; j1++) {
@@ -144,7 +144,7 @@ void drawScreen(byte *screen, boolean offsetSize) {
g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
}
-void putImg(uint coordx, uint coordy, byte *image, boolean transparency) {
+void putImg(uint coordx, uint coordy, byte *image, bool transparency) {
uint16 w, h;
w = READ_LE_UINT16(image);
@@ -186,7 +186,7 @@ void updateSceneAreaIfNeeded(int speed = 1) {
g_engine->_screen->update();
}
}
-void effect(byte numeroefecto, boolean pasaranegro, byte *pantalla2) {
+void effect(byte numeroefecto, bool pasaranegro, byte *pantalla2) {
int i1, i2, i3, j1, j2, j3;
bool enabled = false;
diff --git a/engines/tot/graphics.h b/engines/tot/graphics.h
index 869f1b7f62d..00b2c97d64a 100644
--- a/engines/tot/graphics.h
+++ b/engines/tot/graphics.h
@@ -33,12 +33,12 @@ void putVirtualImg(uint putcoordx, uint putcoordy, byte *backgroundScreen, byte
void clear();
void drawFullScreen(byte *screen);
void copyFromScreen(byte *&screen);
-void drawScreen(byte *screen, boolean offsetSize = true);
-void putImg(uint coordx, uint coordy, byte *image, boolean transparency = false);
+void drawScreen(byte *screen, bool offsetSize = true);
+void putImg(uint coordx, uint coordy, byte *image, bool transparency = false);
void putShape(uint coordx, uint coordy, byte *image);
void getImg(uint coordx1, uint coordy1, uint coordx2, uint coordy2, byte *image);
void loadPalette(Common::String image);
-void effect(byte effectNumber, boolean fadeToBlack, byte *screen);
+void effect(byte effectNumber, bool fadeToBlack, byte *screen);
void turnLightOn();
void totalFadeOut(byte red);
void partialFadeOut(byte numCol);
diff --git a/engines/tot/playanim.cpp b/engines/tot/playanim.cpp
index 24b455f0ef4..ba61489ee00 100644
--- a/engines/tot/playanim.cpp
+++ b/engines/tot/playanim.cpp
@@ -46,10 +46,10 @@ uint oldxrejilla, oldyrejilla;
regispartida regpartida;
-boolean sello_quitado;
+bool sello_quitado;
-boolean cambiopantalla;
-boolean teleencendida,
+bool cambiopantalla;
+bool teleencendida,
vasijapuesta,
guadagna,
tridente,
@@ -63,21 +63,21 @@ boolean teleencendida,
trampa_puesta,
peteractivo;
-boolean inGame;
+bool inGame;
-boolean hechaprimeravez;
+bool hechaprimeravez;
-boolean salirdeljuego;
+bool salirdeljuego;
-boolean partidanueva;
+bool partidanueva;
-boolean continuarpartida;
+bool continuarpartida;
-boolean desactivagrabar;
+bool desactivagrabar;
-boolean pintaractivo;
+bool pintaractivo;
-boolean animacion2;
+bool animacion2;
palette movimientopal;
@@ -177,16 +177,16 @@ byte rejamascaramovto[10][10];
byte rejamascararaton[10][10];
-boolean completadalista1, completadalista2,
+bool completadalista1, completadalista2,
lista1, lista2;
-boolean primera[maxpersonajes],
+bool primera[maxpersonajes],
lprimera[maxpersonajes],
cprimera[maxpersonajes],
libro[maxpersonajes],
caramelos[maxpersonajes];
-boolean cavernas[5];
+bool cavernas[5];
uint16 firstList[5], secondList[5];
@@ -225,7 +225,7 @@ byte *handpantalla;
uint currentRoomNumber;
-boolean isLoadingFromLauncher;
+bool isLoadingFromLauncher;
void clearObj() {
byte indpasolimpiador1, indpasolimpiador2;
diff --git a/engines/tot/playanim.h b/engines/tot/playanim.h
index 1ad8d50f87d..bc800fb5b63 100644
--- a/engines/tot/playanim.h
+++ b/engines/tot/playanim.h
@@ -129,7 +129,7 @@ struct inventoryBitmaps {
*/
struct regismht {
Common::String cadenatext; // string
- boolean encadenado; // true if the next entry is a continuation of this one
+ bool encadenado; // true if the next entry is a continuation of this one
uint16 respuesta; // entry number of reply
int32 punteronil;
};
@@ -147,10 +147,10 @@ struct InvItemRegister {
uint16 pickTextRef; /* Registro al coger el objeto */
uint16 useTextRef; /* Registro al usar el objeto */
byte habla; /* number of character to respond */
- boolean abrir; /* true if it can be opened */
- boolean cerrar; /* true if it can be closed*/
+ bool abrir; /* true if it can be opened */
+ bool cerrar; /* true if it can be closed*/
byte usar[8];
- boolean coger;
+ bool coger;
uint16 usarcon,
reemplazarpor; /*Numero del objeto por el que se reemplaza en el
caso de que se utilize con un objeto de la mochila
@@ -214,9 +214,9 @@ struct RoomFileRegister {
DoorRegistry doors[5]; /* doors in the room */
RoomBitmapRegister bitmapasociados[15];
RoomObjectListEntry *indexadoobjetos[51] = {NULL}; /* includes name of objects for mouseover + index to object file*/
- boolean animationFlag; /* true if there is a secondary animation */
+ bool animationFlag; /* true if there is a secondary animation */
Common::String nombremovto; /* name of the secondary animation, 8 chars*/
- boolean paletteAnimationFlag; /* true if there exist palette animation */
+ bool paletteAnimationFlag; /* true if there exist palette animation */
uint16 puntpaleta; /* points to the screen palette */
Common::Point tray2[300]; /* trajectory of the secondary animation */
uint16 dir2[300]; /* directions of the secondary trajectory. Pos 300 reflects object code. */
@@ -250,7 +250,7 @@ struct regispartida {
direccionmovimiento,
iframe,
parte_del_juego;
- boolean sello_quitado,
+ bool sello_quitado,
manual_torno,
lista1,
lista2,
@@ -280,13 +280,13 @@ struct regispartida {
route mainRoute;
uint16 firstList[5], secondList[5];
Common::Point trayec[300];
- boolean primera[maxpersonajes],
+ bool primera[maxpersonajes],
lprimera[maxpersonajes],
cprimera[maxpersonajes],
libro[maxpersonajes],
caramelos[maxpersonajes];
- boolean cavernas[5];
+ bool cavernas[5];
uint hornacina[2][4];
};
@@ -319,13 +319,13 @@ extern uint oldxrejilla, oldyrejilla;
extern regispartida regpartida;
-extern boolean sello_quitado;
+extern bool sello_quitado;
/**
* Flag to enable screen/room change
*/
-extern boolean cambiopantalla;
-extern boolean teleencendida,
+extern bool cambiopantalla;
+extern bool teleencendida,
vasijapuesta,
guadagna,
tridente,
@@ -342,35 +342,35 @@ extern boolean teleencendida,
/**
* Flag for temporary savegame
*/
-extern boolean inGame;
+extern bool inGame;
/**
* Flag for first time run of the game.
*/
-extern boolean hechaprimeravez;
+extern bool hechaprimeravez;
/**
* Flag to exit program.
*/
-extern boolean salirdeljuego;
+extern bool salirdeljuego;
/**
* Flag to initialize game
*/
-extern boolean partidanueva;
+extern bool partidanueva;
/**
* Flag to resume game
*/
-extern boolean continuarpartida;
+extern bool continuarpartida;
/**
* Flag to load a game upon start.
*/
-extern boolean desactivagrabar;
+extern bool desactivagrabar;
/**
* true if sprites should be drawn
*/
-extern boolean pintaractivo;
+extern bool pintaractivo;
/**
* Flag for secondary animation
*/
-extern boolean animacion2;
+extern bool animacion2;
/**
* 54 color palette slice.
*/
@@ -562,18 +562,18 @@ extern byte rejamascaramovto[10][10];
*/
extern byte rejamascararaton[10][10];
-extern boolean completadalista1,
+extern bool completadalista1,
completadalista2,
lista1, // whether we've been given list 1
lista2; // whether we've been given list 2
-extern boolean primera[maxpersonajes],
+extern bool primera[maxpersonajes],
lprimera[maxpersonajes],
cprimera[maxpersonajes],
libro[maxpersonajes],
caramelos[maxpersonajes];
-extern boolean cavernas[5];
+extern bool cavernas[5];
/**
* First and second lists of objects to retrieve in the game
*/
@@ -592,10 +592,6 @@ extern uint sizeframe,
ofspasoanimado,
segfondo,
offfondo;
-/**
- * Flags for animations
- */
-// extern boolean tocapintar, tocapintar2;
/**
* Max num of loaded frames for secondary animation
*/
@@ -644,7 +640,7 @@ extern byte *handpantalla;
extern uint currentRoomNumber;
-extern boolean isLoadingFromLauncher;
+extern bool isLoadingFromLauncher;
void initializeScreenFile();
void clearObj();
diff --git a/engines/tot/routines.cpp b/engines/tot/routines.cpp
index 4ebcafb1bc9..c2e55a09430 100644
--- a/engines/tot/routines.cpp
+++ b/engines/tot/routines.cpp
@@ -54,7 +54,7 @@ void runaroundRed() {
uint itrayseg, longtrayseg;
- boolean exitLoop = false;
+ bool exitLoop = false;
loadDevil();
itrayseg = 0;
longtrayseg = 82;
@@ -139,7 +139,7 @@ void updateMovementCells() {
}
}
-void sprites(boolean pintapersonaje);
+void sprites(bool pintapersonaje);
static uint indice;
/**
@@ -290,7 +290,7 @@ void drawMainCharacter() {
free(characterDirtyRect);
}
-void sprites(boolean pintapersonaje) {
+void sprites(bool pintapersonaje) {
// grabs the current frame from the walk cycle
pasoframe = secuencia.bitmap[direccionmovimiento][iframe];
@@ -932,7 +932,7 @@ void lookInventoryObject(byte numeroobjeto) {
byte yaux;
Common::String cadenadescripcion;
- boolean kkaux;
+ bool kkaux;
regismht reghpt;
palette paletaseg;
@@ -1053,7 +1053,7 @@ void useInventoryObjectWithInventoryObject(uint numobj1, uint numobj2) {
drawText(kaka);
}
-void calculateRoute(byte zona1, byte zona2, boolean extraCorrection, boolean zonavedada) {
+void calculateRoute(byte zona1, byte zona2, bool extraCorrection, bool zonavedada) {
// Resets the entire route
for (pasos = 0; pasos < 7; pasos++) {
mainRoute[pasos].x = 0;
@@ -1119,7 +1119,7 @@ void calculateRoute(byte zona1, byte zona2, boolean extraCorrection, boolean zon
}
void goToObject(byte zona1, byte zona2) {
- boolean zonavedada = false;
+ bool zonavedada = false;
contadorpc2 = contadorpc;
@@ -1217,7 +1217,7 @@ void updateMainCharacterDepth() {
}
}
-void advanceAnimations(boolean zonavedada, boolean animateMouse) {
+void advanceAnimations(bool zonavedada, bool animateMouse) {
if (tocapintar) {
if (currentRoomData->animationFlag && tocapintar2) {
@@ -1459,7 +1459,7 @@ void animateBat() {
uint anchoaniseg, altoaniseg,
itrayseg, longtrayseg, xseg, yseg, profseg, dirseg;
- boolean salir_del_bucle = false;
+ bool salir_del_bucle = false;
if (currentRoomData->animationFlag) {
iframe2seg = iframe2;
xseg = animado.posx;
@@ -2097,7 +2097,7 @@ void dropObjectInScreen(InvItemRegister regobjsustituto) {
void useScreenObject() {
byte indicemochila, indlista, aciertoslista, indmoch,
indicex, indicey;
- boolean controlarlista, basurillalog;
+ bool controlarlista, basurillalog;
uint mouseX = (pulsax + 7) / factorx;
uint mouseY = (pulsay + 7) / factory;
@@ -3432,7 +3432,7 @@ void useScreenObject() {
void openScreenObject() {
byte indicex, indicey;
- boolean sueltapegote;
+ bool sueltapegote;
uint mouseX = (pulsax + 7) / factorx;
uint mouseY = (pulsay + 7) / factory;
@@ -3586,7 +3586,7 @@ void openScreenObject() {
void closeScreenObject() {
byte indicex, indicey, x_del_raton, y_del_raton;
- boolean sueltapegote;
+ bool sueltapegote;
uint objeto_de_la_pantalla;
x_del_raton = ((pulsax + 7) / factorx);
@@ -3814,7 +3814,7 @@ void obtainName(Common::String &nombrejugador) {
free(puntfondonom);
}
-void loadScrollData(uint numpantalla, boolean scrollder,
+void loadScrollData(uint numpantalla, bool scrollder,
uint poshor, int correccionscroll);
static byte *fondsprite;
@@ -3951,7 +3951,7 @@ static void scrollLeft(uint &poshor) {
* Scrolling happens between two screens. We grab the area surroudning the player from screen A,
* then transition to screen B.
*/
-void loadScrollData(uint numpantalla, boolean scrollder, uint poshor, int correccionscroll) {
+void loadScrollData(uint numpantalla, bool scrollder, uint poshor, int correccionscroll) {
uint indicecarga;
handPantallaToBackground();
@@ -4318,8 +4318,8 @@ void saveLoad() {
byte *puntfondmenu;
byte ytext;
byte partidaselecc;
- boolean modificada;
- boolean salirmenufunciones;
+ bool modificada;
+ bool salirmenufunciones;
Common::String nombrepartida;
indicepart regindfich;
@@ -4376,8 +4376,8 @@ void saveLoad() {
setMousePos(1, xraton, yraton);
do {
Common::Event e;
- boolean mouseClicked = false;
- boolean keyPressed = false;
+ bool mouseClicked = false;
+ bool keyPressed = false;
do {
if (tocapintar) {
g_engine->_chrono->updateChrono();
@@ -4543,7 +4543,7 @@ void loadTalkAnimations() {
if ((currentRoomData->nombremovto != "PETER") && (currentRoomData->nombremovto != "ARZCAEL")) {
iframe2 = 0;
free(pasoanimado);
- boolean result;
+ bool result;
switch (regobj.habla) {
case 1:
result = fichcani.open("JOHN.SEC");
@@ -4630,7 +4630,7 @@ void hypertext(
byte colorsombraht,
uint &numresp,
/** Whether the text being said is part of a conversation or just descriptions */
- boolean banderaconversa) {
+ bool banderaconversa) {
regismht regmht;
byte insertarnombre, iht, iteracionesht, lineaht, anchoht;
diff --git a/engines/tot/routines.h b/engines/tot/routines.h
index c429bd0715c..ec51752f850 100644
--- a/engines/tot/routines.h
+++ b/engines/tot/routines.h
@@ -35,7 +35,7 @@ namespace Tot {
void drawText(uint number);
void runaroundRed();
-void sprites(boolean drawCharacter);
+void sprites(bool drawCharacter);
void loadScreenData(uint screenNumber);
RoomFileRegister *readScreenDataFile(Common::SeekableReadStream *screenDataFile);
void saveRoomData(RoomFileRegister *room, Common::SeekableWriteStream *stream);
@@ -50,17 +50,17 @@ void action();
void handleAction(byte posinv);
void loadObjects();
void obtainName(Common::String &playerName);
-void loadScrollData(uint screenNumber, boolean scrollder, uint poshor, int correction);
+void loadScrollData(uint screenNumber, bool scrollder, uint poshor, int correction);
void loadGame(regispartida game);
void saveGameToRegister();
void saveLoad();
-void calculateRoute(byte zona1, byte zona2, boolean extraCorrection = false, boolean zonavedada = false);
+void calculateRoute(byte zona1, byte zona2, bool extraCorrection = false, bool zonavedada = false);
void goToObject(byte zone1, byte zone2);
void loadTalkAnimations();
void unloadTalkAnimations();
-void hypertext(uint numreght, byte colortextoht, byte colorsombraht, uint &numresp, boolean banderaconversa);
+void hypertext(uint numreght, byte colortextoht, byte colorsombraht, uint &numresp, bool banderaconversa);
void wcScene();
-void advanceAnimations(boolean zonavedada, boolean animateMouse);
+void advanceAnimations(bool zonavedada, bool animateMouse);
void updateSecondaryAnimationDepth();
void updateMainCharacterDepth();
void actionLineText(Common::String actionLine);
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
index 0cbba7bde2c..3b3890def87 100644
--- a/engines/tot/routines2.cpp
+++ b/engines/tot/routines2.cpp
@@ -780,7 +780,7 @@ void generateDiploma(Common::String &nombrefoto) {
loadDiploma(nombrefoto, clave);
Common::Event e;
- boolean keyPressed = false;
+ bool keyPressed = false;
do {
g_engine->_screen->update();
while (g_system->getEventManager()->pollEvent(e)) {
@@ -938,7 +938,7 @@ void readAlphaGraph(Common::String &dato, int long_, int posx, int posy, byte co
outtextxyBios(posx, posy, "_", 0);
Common::Event e;
- boolean done = false;
+ bool done = false;
while (!done && !g_engine->shouldQuit()) {
while (g_system->getEventManager()->pollEvent(e)) {
@@ -985,12 +985,12 @@ void readAlphaGraph(Common::String &dato, int long_, int posx, int posy, byte co
void readAlphaGraphSmall(Common::String &dato, int long_, int posx, int posy, byte colorbarra,
byte colortexto) {
int pun = 1;
- boolean borracursor;
+ bool borracursor;
bar(posx, posy + 2, posx + long_ * 6, posy + 9, colorbarra);
outtextxyBios(posx, posy, "-", colortexto);
Common::Event e;
- boolean done = false;
+ bool done = false;
while (!done && !g_engine->shouldQuit()) {
while (g_system->getEventManager()->pollEvent(e)) {
@@ -1107,7 +1107,7 @@ void buttonBorder(uint x1, uint y1, uint x2, uint y2,
void copyProtection();
-// static void buttonPress(uint xx1, uint yy1, uint xx2, uint yy2, boolean bandera) {
+// static void buttonPress(uint xx1, uint yy1, uint xx2, uint yy2, bool bandera) {
// g_engine->_mouseManager->hide();
// byte color = bandera ? 249 : 255;
@@ -1128,7 +1128,7 @@ void copyProtection() {
// byte filanum, columnanum, posicioncursor, intentos, ytext, oldiraton,
// oldcolorprotec;
// // textsettingstype oldstyle;
- // boolean salirprotec;
+ // bool salirprotec;
// char chaux;
// varying_string<5> clavetecleada, filastr, columnastr;
// int _error;
@@ -1470,7 +1470,7 @@ void drawCreditsScreen(byte *&fondopp, uint &sizefondo2, byte *&fondo2) {
showError(274);
}
-void putCreditsImg(uint x, uint y, byte *imagen1, byte *imagen2, boolean direct) {
+void putCreditsImg(uint x, uint y, byte *imagen1, byte *imagen2, bool direct) {
uint16 wImagen1, hImagen1;
uint auxhor;
@@ -1561,10 +1561,10 @@ void scrollCredit(
uint tam,
palette &pal2,
byte *&fondopp,
- boolean &salirpitando,
+ bool &salirpitando,
int minHeight,
- boolean withFade,
- boolean refresh) {
+ bool withFade,
+ bool refresh) {
Common::File fich;
if (!fich.open("CREDITOS.DAT")) {
showError(270);
@@ -1587,7 +1587,7 @@ void scrollCredit(
changeRGBBlock(16, 240, &pal[16 * 3 + 0]);
Common::Event e;
- boolean keyPressed = false;
+ bool keyPressed = false;
// Loops an image from the bottom of the screen to the top
for (int i = 199; i >= minHeight; i--) {
@@ -1616,7 +1616,7 @@ void scrollSingleCredit(
uint tam,
palette &pal2,
byte *&fondopp,
- boolean &salirpitando) {
+ bool &salirpitando) {
scrollCredit(
posicion,
tam,
@@ -1663,7 +1663,7 @@ void removeTitle(byte *&fondo2) {
g_engine->_screen->update();
}
-inline boolean keyPressed() {
+inline bool keyPressed() {
Common::Event e;
g_system->getEventManager()->pollEvent(e);
return e.type == Common::EVENT_KEYUP;
@@ -1676,7 +1676,7 @@ void credits() {
byte *fondopp;
byte *fondo2;
uint sizefondo2;
- boolean salirpitando;
+ bool salirpitando;
g_engine->_mouseManager->hide();
totalFadeOut(0);
@@ -1765,7 +1765,7 @@ Lsalida:
void introduction() {
g_engine->_mouseManager->hide();
- boolean pulsada_salida;
+ bool pulsada_salida;
uint contadorvueltas;
pulsada_salida = false;
@@ -1898,14 +1898,14 @@ void firstIntroduction() {
}
void initialLogo() {
- boolean basurillalogica = false;
+ bool basurillalogica = false;
drawFlc(0, 0, 0, 0, 18, 25, false, false, false, basurillalogica);
delay(1000);
}
-void initialMenu(boolean fundido) {
- boolean kklogica = false;
- boolean opcionvalida = false;
+void initialMenu(bool fundido) {
+ bool kklogica = false;
+ bool opcionvalida = false;
stopVoc();
if (fundido)
@@ -2184,7 +2184,7 @@ void soundControls() {
oldxfade;
byte ytext, oldiraton;
- boolean salirmenucontroles;
+ bool salirmenucontroles;
salirmenucontroles = false;
oldxraton = xraton;
@@ -2227,8 +2227,8 @@ void soundControls() {
putImg(volumenmelodia + 86, 76, slade);
setMousePos(1, xraton, yraton);
- boolean keyPressed = false;
- boolean mouseClicked = false;
+ bool keyPressed = false;
+ bool mouseClicked = false;
Common::Event e;
do {
g_engine->_chrono->updateChrono();
@@ -2257,7 +2257,7 @@ void soundControls() {
if (pulsay >= 22 && pulsay <= 37) {
g_engine->_mouseManager->hide();
xfade = 86 + volumenfx;
- boolean mouseReleased = false;
+ bool mouseReleased = false;
do {
oldxfade = xfade;
@@ -2292,7 +2292,7 @@ void soundControls() {
} else if (pulsay >= 67 && pulsay <= 82) {
g_engine->_mouseManager->hide();
xfade = 86 + volumenmelodia;
- boolean mouseReleased = false;
+ bool mouseReleased = false;
do {
while (g_system->getEventManager()->pollEvent(e)) {
if (e.type == Common::EVENT_LBUTTONUP) {
@@ -2348,7 +2348,7 @@ void sacrificeScene() {
palette palaux;
stopVoc();
- boolean pulsada_salida = currentRoomData->paletteAnimationFlag;
+ bool pulsada_salida = currentRoomData->paletteAnimationFlag;
currentRoomData->paletteAnimationFlag = false;
bar(0, 139, 319, 149, 0);
@@ -2676,7 +2676,7 @@ void sacrificeScene() {
}
void ending() {
- boolean pulsada_salida;
+ bool pulsada_salida;
outtextxy(10, 41, " Al fin lo has conseguido....", 249);
outtextxy(10, 39, " Al fin lo has conseguido....", 249);
@@ -2774,7 +2774,7 @@ void assembleCompleteBackground(byte *image, uint coordx, uint coordy) {
* Assemble the screen for scroll assembles only the objects because scrolling screens
* never have secondary animations and character animation is assembled elsewhere.
*/
-void assembleScreen(boolean scroll) {
+void assembleScreen(bool scroll) {
for (int indice = 0; indice < nivelesdeprof; indice++) {
if (screenObjects[indice] != NULL) {
@@ -2896,7 +2896,7 @@ void drawGrid() {
g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
}
-void setRoomTrajectories(int animationHeight, int animationWidth, TRAJECTORIES_OP op, boolean fixGrids) {
+void setRoomTrajectories(int animationHeight, int animationWidth, TRAJECTORIES_OP op, bool fixGrids) {
// add to restore the room, subtract to adjust before loading the screen
if (currentRoomData->animationFlag && currentRoomData->nombremovto != "QQQQQQQQ") {
diff --git a/engines/tot/routines2.h b/engines/tot/routines2.h
index 9e7739cc283..dc760207f14 100644
--- a/engines/tot/routines2.h
+++ b/engines/tot/routines2.h
@@ -74,7 +74,7 @@ void hipercadena(Common::String cadenatextnueva, uint xhcnueva, uint yhcnueva, b
void buttonBorder(uint x1, uint y1, uint x2, uint y2, byte color1, byte color2, byte color3, byte color4, byte color5, uint xtexto, Common::String outputGameName);
void copyProtection();
void initialLogo();
-void initialMenu(boolean fade);
+void initialMenu(bool fade);
void exitToDOS();
void soundControls();
void sacrificeScene();
@@ -82,9 +82,9 @@ void ending();
void loadBat();
void loadDevil();
void assembleCompleteBackground(byte *image, uint coordx, uint coordy);
-void assembleScreen(boolean scroll = false);
+void assembleScreen(bool scroll = false);
void disableSecondAnimation();
-void setRoomTrajectories(int alto, int ancho, TRAJECTORIES_OP op, boolean fixGrids = true);
+void setRoomTrajectories(int alto, int ancho, TRAJECTORIES_OP op, bool fixGrids = true);
void loadAnimationForDirection(Common::SeekableReadStream *stream, int direction);
// Debug methods
diff --git a/engines/tot/saveload.cpp b/engines/tot/saveload.cpp
index 9a52e8b8e23..e14cffdfae4 100644
--- a/engines/tot/saveload.cpp
+++ b/engines/tot/saveload.cpp
@@ -38,7 +38,7 @@ namespace Tot {
#define SAVEGAME_CURRENT_VERSION 1
-boolean syncGeneralData(Common::Serializer &s, regispartida &game) {
+bool syncGeneralData(Common::Serializer &s, regispartida &game) {
uint32 startBytes = s.bytesSynced();
// Uint16
s.syncAsUint16LE(game.numeropantalla);
@@ -142,7 +142,7 @@ boolean syncGeneralData(Common::Serializer &s, regispartida &game) {
return true;
}
-boolean syncRoomData(Common::Serializer &s, Common::MemorySeekableReadWriteStream *roomStream) {
+bool syncRoomData(Common::Serializer &s, Common::MemorySeekableReadWriteStream *roomStream) {
uint32 startBytes = s.bytesSynced();
if (s.isSaving()) {
@@ -176,7 +176,7 @@ boolean syncRoomData(Common::Serializer &s, Common::MemorySeekableReadWriteStrea
return true;
}
-boolean syncConversationData(Common::Serializer &s, Common::MemorySeekableReadWriteStream *conversations) {
+bool syncConversationData(Common::Serializer &s, Common::MemorySeekableReadWriteStream *conversations) {
uint32 startBytes = s.bytesSynced();
int size = conversations->size();
@@ -200,7 +200,7 @@ boolean syncConversationData(Common::Serializer &s, Common::MemorySeekableReadWr
return true;
}
-boolean syncItemData(Common::Serializer &s, Common::MemorySeekableReadWriteStream *items) {
+bool syncItemData(Common::Serializer &s, Common::MemorySeekableReadWriteStream *items) {
uint32 startBytes = s.bytesSynced();
int size = items->size();
if (s.isSaving()) {
diff --git a/engines/tot/sound.cpp b/engines/tot/sound.cpp
index 9f7355ec29d..852a21d13b5 100644
--- a/engines/tot/sound.cpp
+++ b/engines/tot/sound.cpp
@@ -93,7 +93,7 @@ void playVoc(Common::String vocfile, int32 posinicio, uint tamvocleer) {
pitavocmem();
}
-void playMidiFile(Common::String nomfich, boolean loop) {
+void playMidiFile(Common::String nomfich, bool loop) {
Common::File ficheromus;
if (!ficheromus.open(Common::Path(nomfich + ".MUS"))) {
diff --git a/engines/tot/sound.h b/engines/tot/sound.h
index 206bdb6082f..af801a04f1f 100644
--- a/engines/tot/sound.h
+++ b/engines/tot/sound.h
@@ -36,9 +36,9 @@ void autoPlayVoc(Common::String vocFile, int32 startPos, uint vocSize);
void pitavocmem();
void playVoc(Common::String vocFile, int32 startPos, uint vocSize);
void stopVoc();
-void playMidiFile(Common::String nomfich, boolean loop);
+void playMidiFile(Common::String nomfich, bool loop);
void pitamidmem();
-void loopactivo(boolean mid_loop);
+void loopactivo(bool mid_loop);
} // End of namespace Tot
diff --git a/engines/tot/util.h b/engines/tot/util.h
index 244acb84a9e..6fffe9e76af 100644
--- a/engines/tot/util.h
+++ b/engines/tot/util.h
@@ -9,8 +9,6 @@
namespace Tot {
-typedef unsigned char boolean;
-
void showError(int code);
// Delays a specified number of milliseconds.
@@ -52,7 +50,7 @@ inline int keypressed() {
return 0;
}
-inline boolean odd(long i) { return i % 2 != 0; }
+inline bool odd(long i) { return i % 2 != 0; }
unsigned Random(unsigned range);
int Random(int range);
Commit: 6df0fd7336b76019b51c5e77dbc499e7df23ef20
https://github.com/scummvm/scummvm/commit/6df0fd7336b76019b51c5e77dbc499e7df23ef20
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:48+02:00
Commit Message:
TOT: Moves debug methods into console commands
Changed paths:
engines/tot/console.cpp
engines/tot/console.h
engines/tot/game.cpp
engines/tot/tot.cpp
engines/tot/tot.h
diff --git a/engines/tot/console.cpp b/engines/tot/console.cpp
index 3246036c695..ed720fbe2e8 100644
--- a/engines/tot/console.cpp
+++ b/engines/tot/console.cpp
@@ -20,18 +20,82 @@
*/
#include "tot/console.h"
+#include "tot/playanim.h"
+#include "tot/routines.h"
namespace Tot {
-Console::Console() : GUI::Debugger() {
- registerCmd("test", WRAP_METHOD(Console, Cmd_test));
+TotConsole::TotConsole(TotEngine *engine) : _engine(engine) {
+ registerCmd("jumpToPart2", WRAP_METHOD(TotConsole, cmdJumpToPart2));
+ registerCmd("loadRoom", WRAP_METHOD(TotConsole, cmdLoadRoom));
+ registerCmd("showMouseGrid", WRAP_METHOD(TotConsole, cmdShowMouseGrid));
+ registerCmd("showGameGrid", WRAP_METHOD(TotConsole, cmdShowGameGrid));
+ registerCmd("showScreenGrid", WRAP_METHOD(TotConsole, cmdShowScreenGrid));
+ registerCmd("showObjectAreas", WRAP_METHOD(TotConsole, cmdShowObjectAreas));
+ registerCmd("clearLayers", WRAP_METHOD(TotConsole, cmdClearLayers));
}
-Console::~Console() {
+TotConsole::~TotConsole() {
+
+}
+
+
+bool TotConsole::cmdShowMouseGrid(int argc, const char **argv) {
+ _engine->_showMouseGrid = true;
+ debugPrintf("Enabled mouse hotspot grid");
+ return true;
+}
+
+bool TotConsole::cmdShowGameGrid(int argc, const char **argv) {
+ _engine->_showGameGrid = true;
+ debugPrintf("Enabled screen base grid");
+ return true;
+}
+
+bool TotConsole::cmdShowScreenGrid(int argc, const char **argv) {
+ _engine->_showScreenGrid = true;
+ debugPrintf("Enabled screen walk area grid");
+ return true;
}
-bool Console::Cmd_test(int argc, const char **argv) {
- debugPrintf("Test\n");
+bool TotConsole::cmdShowObjectAreas(int argc, const char **argv) {
+ _engine->_drawObjectAreas = true;
+ debugPrintf("Enabled room object area display");
+ return true;
+}
+
+bool TotConsole::cmdClearLayers(int argc, const char **argv) {
+ _engine->_drawObjectAreas = false;
+ _engine->_showScreenGrid = false;
+ _engine->_showGameGrid = false;
+ _engine->_showMouseGrid = false;
+ drawScreen(background);
+ debugPrintf("Cleared all debug layers");
+ return true;
+}
+
+bool TotConsole::cmdLoadRoom(int argc, const char **argv) {
+
+ int roomID = atoi(argv[1]);
+
+ if (roomID < 0 || roomID > 24) {
+ debugPrintf("Invalid RoomID %d!\n", roomID);
+ return true;
+ }
+ freeAnimation();
+ freeScreenObjects();
+ clearScreenData();
+ loadScreenData(roomID);
+ drawScreen(background);
+ debugPrintf("Loaded screen %d", roomID);
+ return true;
+}
+
+
+bool TotConsole::cmdJumpToPart2(int argc, const char **argv) {
+ completadalista1 = true;
+ completadalista2 = true;
+ debugPrintf("Moving on to part 2 of the game");
return true;
}
diff --git a/engines/tot/console.h b/engines/tot/console.h
index 69893a1ca4e..d4b269c195d 100644
--- a/engines/tot/console.h
+++ b/engines/tot/console.h
@@ -25,14 +25,23 @@
#include "gui/debugger.h"
+#include "tot/tot.h"
+
namespace Tot {
-class Console : public GUI::Debugger {
+class TotConsole : public GUI::Debugger {
private:
- bool Cmd_test(int argc, const char **argv);
+ TotEngine *_engine;
+ bool cmdJumpToPart2(int argc, const char **argv);
+ bool cmdLoadRoom(int argc, const char **argv);
+ bool cmdShowMouseGrid(int argc, const char **argv);
+ bool cmdShowScreenGrid(int argc, const char **argv);
+ bool cmdShowGameGrid(int argc, const char **argv);
+ bool cmdShowObjectAreas(int argc, const char **argv);
+ bool cmdClearLayers(int argc, const char **argv);
public:
- Console();
- ~Console() override;
+ TotConsole(TotEngine *engine);
+ ~TotConsole() override;
};
} // End of namespace Tot
diff --git a/engines/tot/game.cpp b/engines/tot/game.cpp
index ef6e9cab7e2..e006651ab52 100644
--- a/engines/tot/game.cpp
+++ b/engines/tot/game.cpp
@@ -35,11 +35,6 @@
namespace Tot {
byte iaux, iaux2;
-bool showMouseGrid = false;
-bool showScreenGrid = false;
-bool showGameGrid = false;
-bool drawObjectAreas = false;
-
void loadTemporaryGame() {
g_engine->loadGameState(g_engine->getMetaEngine()->getAutosaveSlot());
}
@@ -118,13 +113,6 @@ int engine_start() {
desactivagrabar = false;
}
- bool enforceSecondPart = false;
- if (enforceSecondPart) { // DEBUG
- completadalista1 = true;
- completadalista2 = true;
- gamePart = 1;
- }
-
return startGame();
}
@@ -168,31 +156,25 @@ int startGame() {
g_engine->openMainMenuDialog();
// saveLoad();
break;
- /* Debug */
- {
- case Common::KEYCODE_5:
- showMouseGrid = !showMouseGrid;
- break;
- case Common::KEYCODE_6:
- showScreenGrid = !showScreenGrid;
- break;
- case Common::KEYCODE_7:
- showGameGrid = !showGameGrid;
- break;
- case Common::KEYCODE_0:
- effect(13, false, background);
- break;
- case Common::KEYCODE_8:
- drawObjectAreas = !drawObjectAreas;
- break;
- case Common::KEYCODE_1:
- setRoomTrajectories(altoanimado, anchoanimado, RESTORE);
- break;
- case Common::KEYCODE_2:
- setRoomTrajectories(altoanimado, anchoanimado, SET_WITH_ANIM);
- break;
- }
- /* End debug */
+ // /* Debug */
+ // {
+ // case Common::KEYCODE_5:
+ // showMouseGrid = !showMouseGrid;
+ // break;
+ // case Common::KEYCODE_6:
+ // showScreenGrid = !showScreenGrid;
+ // break;
+ // case Common::KEYCODE_7:
+ // showGameGrid = !showGameGrid;
+ // break;
+ // case Common::KEYCODE_0:
+ // effect(13, false, background);
+ // break;
+ // case Common::KEYCODE_8:
+ // drawObjectAreas = !drawObjectAreas;
+ // break;
+ // }
+ // /* End debug */
case Common::KEYCODE_a: // open
numeroaccion = 5;
action();
@@ -542,17 +524,17 @@ int startGame() {
// g_engine->_graphics->euroText(Common::String::format("Room: %d", currentRoomNumber), 0, 0, 220, Graphics::kTextAlignLeft);
// g_engine->_mouseManager->printPos(xraton, yraton, 220, 0);
// printPos(characterPosX, characterPosY, 220, 10, "CharPos");
- if (showMouseGrid) {
+ if (g_engine->_showMouseGrid) {
drawMouseGrid(currentRoomData);
}
- if (showScreenGrid) {
+ if (g_engine->_showScreenGrid) {
drawScreenGrid(currentRoomData);
}
- if (showGameGrid) {
+ if (g_engine->_showGameGrid) {
drawGrid();
}
- if (drawObjectAreas) {
+ if (g_engine->_drawObjectAreas) {
for (int indice = 0; indice < nivelesdeprof; indice++) {
if (screenObjects[indice] != NULL) {
if (true) {
diff --git a/engines/tot/tot.cpp b/engines/tot/tot.cpp
index 07cb35ac3cb..896c97bd03a 100644
--- a/engines/tot/tot.cpp
+++ b/engines/tot/tot.cpp
@@ -84,7 +84,7 @@ Common::Error TotEngine::run() {
// _inventoryManager = new InventoryManager();
// _totGame = new TotGame();
// Set the engine's debugger console
- setDebugger(new Console());
+ setDebugger(new TotConsole(this));
// If a savegame was selected from the launcher, load it
int saveSlot = ConfMan.getInt("save_slot");
diff --git a/engines/tot/tot.h b/engines/tot/tot.h
index 1bffed545b7..23e71342831 100644
--- a/engines/tot/tot.h
+++ b/engines/tot/tot.h
@@ -69,6 +69,11 @@ public:
MouseManager *_mouseManager = nullptr;
ChronoManager *_chrono = nullptr;
+ bool _showMouseGrid = false;
+ bool _showScreenGrid = false;
+ bool _showGameGrid = false;
+ bool _drawObjectAreas = false;
+
public:
TotEngine(OSystem *syst, const ADGameDescription *gameDesc);
~TotEngine() override;
Commit: b08262afa68d0bf76b894a20c4e06632b2807a70
https://github.com/scummvm/scummvm/commit/b08262afa68d0bf76b894a20c4e06632b2807a70
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:48+02:00
Commit Message:
TOT: Refactors hardcoded text to be translatable
Changed paths:
A engines/tot/texts.h
engines/tot/anims.cpp
engines/tot/detection.h
engines/tot/detection_tables.h
engines/tot/dialog.cpp
engines/tot/game.cpp
engines/tot/graphman.cpp
engines/tot/graphman.h
engines/tot/routines.cpp
engines/tot/routines2.cpp
diff --git a/engines/tot/anims.cpp b/engines/tot/anims.cpp
index 1547c1360c9..4a71a65b81c 100644
--- a/engines/tot/anims.cpp
+++ b/engines/tot/anims.cpp
@@ -31,6 +31,7 @@
#include "tot/decoder/TotFlicDecoder.h"
#include "tot/graphics.h"
#include "tot/playanim.h"
+#include "tot/texts.h"
#include "tot/tot.h"
namespace Tot {
@@ -102,55 +103,82 @@ void handleFlcEvent(byte numero_del_evento) {
switch (numerovuelta) {
case 2:
- drawText(80, 0, "Las \xA3ltimas encuestas realizadas",
- "acerca de la siniestralidad en ",
- "los transportes arrojan resultados",
- "alentadores...", "", 253, 0);
+ drawText(80, 0,
+ animMessages_ES[0],
+ animMessages_ES[1],
+ animMessages_ES[2],
+ animMessages_ES[3],
+ animMessages_ES[4],
+ 253, 0);
break;
case 13:
removeText(80, 0, 319, 53, 0);
break;
case 14:
- drawText(80, 0, "El cien por cien de los encuestados",
- "declararon no haber sufrido nunca un",
- "accidente mortal...", "", "", 253, 0);
+ drawText(80, 0,
+ animMessages_ES[5],
+ animMessages_ES[6],
+ animMessages_ES[7],
+ animMessages_ES[8],
+ animMessages_ES[9],
+ 253, 0);
break;
case 25:
removeText(80, 0, 319, 53, 0);
break;
case 26:
- drawText(80, 0, "Es una noticia que nos anima a salir",
- "de viaje con m\xA0s seguridad.", "", "", "", 253, 0);
+ drawText(80, 0,
+ animMessages_ES[10],
+ animMessages_ES[11],
+ animMessages_ES[12],
+ animMessages_ES[13],
+ animMessages_ES[14],
+ 253, 0);
break;
case 35:
removeText(80, 0, 319, 53, 0);
break;
case 36:
- drawText(2, 100, "\xAD\xADPor un tornillo!!...",
- "Por un m\xA1sero y simple",
- "tornillo del tr\xA1"
- "fugo",
- "del trapecio...", "", 255, 0);
+ drawText(2, 100,
+ animMessages_ES[15],
+ animMessages_ES[16],
+ animMessages_ES[17],
+ animMessages_ES[18],
+ animMessages_ES[19],
+ 255, 0);
break;
case 47:
removeText(2, 100, 134, 199, 0);
break;
case 48:
- drawText(2, 100, "Si lo hubiese apretado",
- "bien, no estar\xA1"
- "a ahora",
- "sin trabajo...", "", "", 255, 0);
+ drawText(2, 100,
+ animMessages_ES[20],
+ animMessages_ES[21],
+ animMessages_ES[22],
+ animMessages_ES[23],
+ animMessages_ES[24],
+ 255, 0);
break;
case 59:
removeText(2, 100, 134, 199, 0);
break;
case 60:
- drawText(80, 0, "\xAD\xADNoticia de \xA3ltima hora!!", "", "", "", "", 253, 0);
+ drawText(80, 0,
+ animMessages_ES[25],
+ animMessages_ES[26],
+ animMessages_ES[27],
+ animMessages_ES[28],
+ animMessages_ES[29],
+ 253, 0);
break;
case 63:
- drawText(2, 100, "Llevo sin dormir toda",
- "la noche, pensando qu\x82",
- "voy a hacer.", "", "", 255, 0);
+ drawText(2, 100,
+ animMessages_ES[30],
+ animMessages_ES[31],
+ animMessages_ES[32],
+ animMessages_ES[33],
+ animMessages_ES[34],
+ 255, 0);
break;
case 75:
removeText(2, 100, 135, 199, 0);
@@ -159,47 +187,58 @@ void handleFlcEvent(byte numero_del_evento) {
removeText(80, 0, 319, 53, 0);
break;
case 77:
- drawText(2, 100, "Seguramente no podr\x82",
- "encontrar trabajo en",
- "mucho tiempo...",
- "Aunque ponga mucha f\x82",
- "la oficina de empleo.", 255, 0);
+ drawText(2, 100,
+ animMessages_ES[35],
+ animMessages_ES[36],
+ animMessages_ES[37],
+ animMessages_ES[38],
+ animMessages_ES[39],
+ 255, 0);
break;
case 89:
removeText(2, 100, 135, 199, 0);
break;
case 90:
- drawText(2, 100, "Y para animarme m\xA0s",
- "todav\xAD"
- "a, ma\xA4"
- "ana noche",
- "es HALLOWEEN...", "",
- "Es que tengo la negra.", 255, 0);
+ drawText(2, 100,
+ animMessages_ES[40],
+ animMessages_ES[41],
+ animMessages_ES[42],
+ animMessages_ES[43],
+ animMessages_ES[44],
+ 255, 0);
break;
case 102:
removeText(2, 100, 135, 199, 0);
break;
case 103:
- drawText(80, 0, "Grave accidente en TWELVE MOTORS...",
- "un empleado olvid\xA2 apretar un tornillo",
- "y media cadena de montaje ha quedado",
- "para chatarra...",
- "las p\x82rdidas se estiman cuantiosas...", 253, 0);
+ drawText(80, 0,
+ animMessages_ES[45],
+ animMessages_ES[46],
+ animMessages_ES[47],
+ animMessages_ES[48],
+ animMessages_ES[49],
+ 253, 0);
break;
case 120:
removeText(80, 0, 319, 53, 0);
break;
case 121:
- drawText(80, 0, "No se descartan las acciones legales",
- "contra ese inconsciente...", "", "", "", 253, 0);
+ drawText(80, 0,
+ animMessages_ES[50],
+ animMessages_ES[51],
+ animMessages_ES[52],
+ animMessages_ES[53],
+ animMessages_ES[54],
+ 253, 0);
break;
case 125:
- drawText(2, 100, "\xAD"
- "Dios mio!... hasta en",
- "la televisi\xA2n...",
- "Seguro que hasta mi",
- "perro encuentra curro",
- "antes que yo...", 255, 0);
+ drawText(2, 100,
+ animMessages_ES[55],
+ animMessages_ES[56],
+ animMessages_ES[57],
+ animMessages_ES[58],
+ animMessages_ES[59],
+ 255, 0);
break;
case 135: {
removeText(80, 0, 319, 53, 0);
@@ -217,58 +256,79 @@ void handleFlcEvent(byte numero_del_evento) {
playVoc("MANDO", 142001, 11469);
break;
case 20:
- drawText(2, 100, "\xADHORROR!...una factura", "", "", "", "", 255, 0);
+ drawText(2, 100,
+ animMessages_ES[60],
+ animMessages_ES[61],
+ animMessages_ES[62],
+ animMessages_ES[63],
+ animMessages_ES[64],
+ 255, 0);
break;
case 58: {
removeText(2, 100, 135, 199, 0);
- drawText(2, 100, "\xA8"
- "Oficina de empleo?...",
- "\xA8"
- "y para m\xA1?...",
- "",
- "\xADSe habr\xA0n equivocado!", "", 255, 0);
+ drawText(2, 100,
+ animMessages_ES[65],
+ animMessages_ES[66],
+ animMessages_ES[67],
+ animMessages_ES[68],
+ animMessages_ES[69],
+ 255, 0);
} break;
case 74: {
delay(1500);
removeText(2, 100, 135, 199, 0);
- drawText(2, 100, "\xA8Tan pronto lograron",
- "encontrarme trabajo?", "",
- "Claro... antes de ver",
- "las noticias...", 255, 0);
+ drawText(2, 100,
+ animMessages_ES[70],
+ animMessages_ES[71],
+ animMessages_ES[72],
+ animMessages_ES[73],
+ animMessages_ES[74],
+ 255, 0);
delay(4000);
removeText(2, 100, 135, 199, 0);
- drawText(80, 0, "Estimado se\xA4or: Nos dirigimos a",
- "usted para comunicarle que su",
- "solicitud n\xA7:93435 fu\x82 aceptada",
- "y le hemos encontrado un puesto",
- "de acuerdo con sus aptitudes...", 253, 0);
+ drawText(80, 0,
+ animMessages_ES[75],
+ animMessages_ES[76],
+ animMessages_ES[77],
+ animMessages_ES[78],
+ animMessages_ES[79],
+ 253, 0);
delay(7000);
removeText(80, 0, 319, 53, 0);
- drawText(80, 0, "Deber\xA0 presentarse ma\xA4"
- "ana, dia",
- "31 de Octubre en la direcci\xA2n",
- "abajo indicada, para ocupar el",
- "puesto de ENCARGADO GENERAL.", "", 253, 0);
+ drawText(80, 0,
+ animMessages_ES[80],
+ animMessages_ES[81],
+ animMessages_ES[82],
+ animMessages_ES[83],
+ animMessages_ES[84],
+ 253, 0);
delay(7000);
removeText(80, 0, 319, 53, 0);
- drawText(80, 0, "Le adjuntamos las credenciales",
- "de presentaci\xA2n.",
- "Deseando no verle por aqu\xA1 en",
- "mucho tiempo se despide:",
- " Leonor Scott.", 253, 0);
+ drawText(80, 0,
+ animMessages_ES[85],
+ animMessages_ES[86],
+ animMessages_ES[87],
+ animMessages_ES[88],
+ animMessages_ES[89],
+ 253, 0);
delay(7000);
removeText(80, 0, 319, 53, 0);
- drawText(2, 100, "\xAD\xADQue ilu!! encargado",
- "general... si ya me",
- "lo decia mi madre...",
- "<<nene tienes cara de",
- "encargado general>>", 255, 0);
+ drawText(2, 100,
+ animMessages_ES[90],
+ animMessages_ES[91],
+ animMessages_ES[92],
+ animMessages_ES[93],
+ animMessages_ES[94],
+ 255, 0);
delay(6000);
removeText(2, 100, 135, 199, 0);
- drawText(2, 100, "Tendr\x82 que conseguir",
- "ropa m\xA0s de acuerdo",
- "con mi nuevo cargo.", "",
- "Manos a la obra...", 255, 0);
+ drawText(2, 100,
+ animMessages_ES[95],
+ animMessages_ES[96],
+ animMessages_ES[97],
+ animMessages_ES[98],
+ animMessages_ES[99],
+ 255, 0);
delay(6000);
} break;
}
@@ -297,91 +357,154 @@ void handleFlcEvent(byte numero_del_evento) {
if ((numerovuelta == 1) && (framecontador == 2)) {
delay(2000);
- drawText(5, 1, "\xADV\xA0yase!... no queremos vendedores...",
- "y menos de planes de jubilaci\xA2n.", "", "", "", 255, 249);
+ drawText(5, 1,
+ animMessages_ES[100],
+ animMessages_ES[101],
+ animMessages_ES[102],
+ animMessages_ES[103],
+ animMessages_ES[104],
+ 255, 249);
delay(3500);
putImg(0, 0, punterofondofrase);
- drawText(5, 1, "No soy ning\xA3n vendedor... me envia la oficina",
- "de empleo... tenga mis credenciales.", "", "", "", 255, 0);
+ drawText(5, 1,
+ animMessages_ES[105],
+ animMessages_ES[106],
+ animMessages_ES[107],
+ animMessages_ES[108],
+ animMessages_ES[109],
+ 255, 0);
}
break;
case 6:
if ((numerovuelta == 1) && (framecontador == 3)) {
putImg(0, 0, punterofondofrase);
- drawText(5, 1, "\xADVaya! eres t\xA3...llegas con retraso. Los ancianos est\xA0n",
- "esper\xA0ndote en el sal\xA2n. Debes cuidarlos muy bien.",
- "", "", "", 255, 249);
+ drawText(5, 1,
+ animMessages_ES[110],
+ animMessages_ES[111],
+ animMessages_ES[112],
+ animMessages_ES[113],
+ animMessages_ES[114],
+ 255, 249);
}
break;
case 7:
if ((numerovuelta == 1) && (framecontador == 3)) {
putImg(0, 0, punterofondofrase);
- drawText(5, 1, "Lo siento, no sab\xA1"
- "a a que hora deb\xA1"
- "a presentarme, en",
- "la oficina de empleo no me lo dijeron.",
- "", "", "", 255, 0);
+ drawText(5, 1,
+ animMessages_ES[115],
+ animMessages_ES[116],
+ animMessages_ES[117],
+ animMessages_ES[118],
+ animMessages_ES[119],
+ 255, 0);
}
break;
case 8:
if ((numerovuelta == 1) && (framecontador == 3)) {
putImg(0, 0, punterofondofrase);
- drawText(5, 1, "Bueno... no importa... ya est\xA0s aqu\xA1.",
- "Ese coche es tuyo \xA8no?...", "", "", "", 255, 249);
+ drawText(5, 1,
+ animMessages_ES[120],
+ animMessages_ES[121],
+ animMessages_ES[122],
+ animMessages_ES[123],
+ animMessages_ES[124],
+ 255, 249);
}
break;
case 9:
if ((numerovuelta == 1) && (framecontador == 3)) {
putImg(0, 0, punterofondofrase);
- drawText(5, 1, "Si... es precioso \xA8verdad?...", "", "", "", "", 255, 0);
+ drawText(5, 1,
+ animMessages_ES[125],
+ animMessages_ES[126],
+ animMessages_ES[127],
+ animMessages_ES[128],
+ animMessages_ES[129],
+ 255, 0);
}
break;
case 10:
if ((numerovuelta == 1) && (framecontador == 3)) {
putImg(0, 0, punterofondofrase);
- drawText(5, 1, "Vaya... 200 caballos... elevalunas el\x82"
- "ctricos... ",
- "inyecci\xA2n electr\xA2nica, llantas de aleaci\xA2n...",
- "", "", "", 255, 249);
+ drawText(5, 1,
+ animMessages_ES[130],
+ animMessages_ES[131],
+ animMessages_ES[132],
+ animMessages_ES[133],
+ animMessages_ES[134],
+ 255, 249);
}
break;
case 11:
if ((numerovuelta == 1) && (framecontador == 3)) {
putImg(0, 0, punterofondofrase);
- drawText(5, 1, "Pues si...", "", "", "", "", 255, 0);
+ drawText(5, 1,
+ animMessages_ES[135],
+ animMessages_ES[136],
+ animMessages_ES[137],
+ animMessages_ES[138],
+ animMessages_ES[139],
+ 255, 0);
}
break;
case 12:
if ((numerovuelta == 1) && (framecontador == 3)) {
putImg(0, 0, punterofondofrase);
- drawText(5, 1, "Airbag... asientos envolventes... aire acondicionado",
- "", "", "", "", 255, 249);
+ drawText(5, 1,
+ animMessages_ES[140],
+ animMessages_ES[141],
+ animMessages_ES[142],
+ animMessages_ES[143],
+ animMessages_ES[144],
+ 255, 249);
}
break;
case 13:
if ((numerovuelta == 1) && (framecontador == 3)) {
putImg(0, 0, punterofondofrase);
- drawText(5, 1, "Es el m\xA0s alto de la gama...", "", "", "", "", 255, 0);
+ drawText(5, 1,
+ animMessages_ES[145],
+ animMessages_ES[146],
+ animMessages_ES[147],
+ animMessages_ES[148],
+ animMessages_ES[149],
+ 255, 0);
}
break;
case 14:
if ((numerovuelta == 1) && (framecontador == 3)) {
putImg(0, 0, punterofondofrase);
- drawText(5, 1, "ABS, equipo de m\xA3sica con CD, estructura reforzada",
- "indeformable, detector de radar...", "", "", "", 255, 249);
+ drawText(5, 1,
+ animMessages_ES[150],
+ animMessages_ES[151],
+ animMessages_ES[152],
+ animMessages_ES[153],
+ animMessages_ES[154],
+ 255, 249);
}
break;
case 15:
if ((numerovuelta == 1) && (framecontador == 3)) {
putImg(0, 0, punterofondofrase);
- drawText(5, 1, "Parece que te gusta, \xA8no?", "", "", "", "", 255, 0);
+ drawText(5, 1,
+ animMessages_ES[155],
+ animMessages_ES[156],
+ animMessages_ES[157],
+ animMessages_ES[158],
+ animMessages_ES[159],
+ 255, 0);
}
break;
case 16:
if ((numerovuelta == 1) && (framecontador == 3)) {
putImg(0, 0, punterofondofrase);
- drawText(5, 1, "Bueno, no est\xA0 mal... pero... gracias de todos modos.",
- "", "", "", "", 255, 249);
+ drawText(5, 1,
+ animMessages_ES[160],
+ animMessages_ES[161],
+ animMessages_ES[162],
+ animMessages_ES[163],
+ animMessages_ES[164],
+ 255, 249);
}
break;
case 17:
@@ -400,15 +523,24 @@ void handleFlcEvent(byte numero_del_evento) {
case 18:
if ((numerovuelta == 1) && (framecontador == 3)) {
putImg(0, 0, punterofondofrase);
- drawText(5, 1, "\xA8Gracias?... \xA8qu\x82?... \xAD"
- "espera!... ese es mi coche...",
- "", "", "", "", 255, 0);
+ drawText(5, 1,
+ animMessages_ES[165],
+ animMessages_ES[166],
+ animMessages_ES[167],
+ animMessages_ES[168],
+ animMessages_ES[169],
+ 255, 0);
}
break;
case 19:
if (framecontador == 1)
- drawText(5, 121, "Toma una copita, te la has ganado...",
- "", "", "", "", 253, 249);
+ drawText(5, 121,
+ animMessages_ES[170],
+ animMessages_ES[171],
+ animMessages_ES[172],
+ animMessages_ES[173],
+ animMessages_ES[174],
+ 253, 249);
break;
case 20:
switch (numerovuelta) {
@@ -418,9 +550,13 @@ void handleFlcEvent(byte numero_del_evento) {
getImg(0, 0, 319, 29, punterofondofrase);
break;
case 3:
- drawText(15, 1, "\xA8"
- "Donde estoy? ... \xA8Qu\x82 me ha pasado?",
- "", "", "", "", 255, 0);
+ drawText(15, 1,
+ animMessages_ES[175],
+ animMessages_ES[176],
+ animMessages_ES[177],
+ animMessages_ES[178],
+ animMessages_ES[179],
+ 255, 0);
break;
}
break;
@@ -430,8 +566,13 @@ void handleFlcEvent(byte numero_del_evento) {
putImg(0, 0, punterofondofrase);
break;
case 3:
- drawText(15, 1, "Tranquilizate, no est\xA0s muerto...",
- "Est\xA0s tras la puerta de acero...", "", "", "", 230, 249);
+ drawText(15, 1,
+ animMessages_ES[180],
+ animMessages_ES[181],
+ animMessages_ES[182],
+ animMessages_ES[183],
+ animMessages_ES[184],
+ 230, 249);
break;
}
break;
@@ -441,8 +582,13 @@ void handleFlcEvent(byte numero_del_evento) {
putImg(0, 0, punterofondofrase);
break;
case 3:
- drawText(15, 1, "Te necesitamos para encontrar a Jacob,",
- "nuestro Gran Maestre.", "", "", "", 230, 249);
+ drawText(15, 1,
+ animMessages_ES[185],
+ animMessages_ES[186],
+ animMessages_ES[187],
+ animMessages_ES[188],
+ animMessages_ES[189],
+ 230, 249);
break;
}
break;
@@ -452,8 +598,13 @@ void handleFlcEvent(byte numero_del_evento) {
putImg(0, 0, punterofondofrase);
break;
case 3:
- drawText(15, 1, "Hace unos dias se puso a estudiar el libro",
- "que me diste y desapareci\xA2...", "", "", "", 230, 249);
+ drawText(15, 1,
+ animMessages_ES[190],
+ animMessages_ES[191],
+ animMessages_ES[192],
+ animMessages_ES[193],
+ animMessages_ES[194],
+ 230, 249);
break;
}
break;
@@ -463,7 +614,13 @@ void handleFlcEvent(byte numero_del_evento) {
putImg(0, 0, punterofondofrase);
break;
case 3:
- drawText(15, 1, Common::String("Creemos que realiz\xA2 un conjuro sin darse") + " cuenta...", "", "", "", "", 230, 249);
+ drawText(15, 1,
+ animMessages_ES[195],
+ animMessages_ES[196],
+ animMessages_ES[197],
+ animMessages_ES[198],
+ animMessages_ES[199],
+ 230, 249);
break;
}
break;
@@ -473,9 +630,13 @@ void handleFlcEvent(byte numero_del_evento) {
putImg(0, 0, punterofondofrase);
break;
case 3:
- drawText(15, 1, "Por fortuna, pudimos ponernos en contacto",
- "con \x82l, y nos dijo que est\xA0 en problemas...",
- "", "", "", 230, 249);
+ drawText(15, 1,
+ animMessages_ES[200],
+ animMessages_ES[201],
+ animMessages_ES[202],
+ animMessages_ES[203],
+ animMessages_ES[204],
+ 230, 249);
break;
}
break;
@@ -485,8 +646,13 @@ void handleFlcEvent(byte numero_del_evento) {
putImg(0, 0, punterofondofrase);
break;
case 3:
- drawText(15, 1, "Nos pidi\xA2 que envi\xA0semos a alguien en su ayuda,",
- "y TU eres el elegido...", "", "", "", 230, 249);
+ drawText(15, 1,
+ animMessages_ES[205],
+ animMessages_ES[206],
+ animMessages_ES[207],
+ animMessages_ES[208],
+ animMessages_ES[209],
+ 230, 249);
break;
}
break;
@@ -496,8 +662,13 @@ void handleFlcEvent(byte numero_del_evento) {
putImg(0, 0, punterofondofrase);
break;
case 3:
- drawText(15, 1, "Para ir a las CAVERNAS ETERNAS debes morir...",
- "Ning\xA3n cuerpo con alma puede estar all\xA1...", "", "", "", 230, 249);
+ drawText(15, 1,
+ animMessages_ES[210],
+ animMessages_ES[211],
+ animMessages_ES[212],
+ animMessages_ES[213],
+ animMessages_ES[214],
+ 230, 249);
break;
}
break;
@@ -507,8 +678,13 @@ void handleFlcEvent(byte numero_del_evento) {
putImg(0, 0, punterofondofrase);
break;
case 3:
- drawText(15, 1, Common::String("Haremos un ritual para crear un v\xA1nculo entre") + " tu", "cuerpo y tu alma, s\xA2lo as\xA1 podr\xA0s volver a la vida...",
- "", "", "", 230, 249);
+ drawText(15, 1,
+ animMessages_ES[215],
+ animMessages_ES[216],
+ animMessages_ES[217],
+ animMessages_ES[218],
+ animMessages_ES[219],
+ 230, 249);
break;
}
break;
@@ -518,7 +694,13 @@ void handleFlcEvent(byte numero_del_evento) {
putImg(0, 0, punterofondofrase);
break;
case 3:
- drawText(15, 1, Common::String("Si rescatas a Jacob, el v\xA1nculo te traer\xA0") + " de regreso...", "", "", "", "", 230, 249);
+ drawText(15, 1,
+ animMessages_ES[220],
+ animMessages_ES[221],
+ animMessages_ES[222],
+ animMessages_ES[223],
+ animMessages_ES[224],
+ 230, 249);
break;
}
break;
@@ -528,8 +710,13 @@ void handleFlcEvent(byte numero_del_evento) {
putImg(0, 0, punterofondofrase);
break;
case 3:
- drawText(15, 1, "Ahora... \xADPrep\xA0rate!... Ha llegado tu hora...",
- "", "", "", "", 230, 249);
+ drawText(15, 1,
+ animMessages_ES[225],
+ animMessages_ES[226],
+ animMessages_ES[227],
+ animMessages_ES[228],
+ animMessages_ES[229],
+ 230, 249);
break;
}
break;
@@ -579,7 +766,13 @@ void handleFlcEvent(byte numero_del_evento) {
getImg(0, 0, 319, 29, punterofondofrase);
break;
case 3:
- drawText(65, 1, "\xADGracias ILUSO!...", "", "", "", "", 253, 249);
+ drawText(65, 1,
+ animMessages_ES[230],
+ animMessages_ES[231],
+ animMessages_ES[232],
+ animMessages_ES[233],
+ animMessages_ES[234],
+ 253, 249);
break;
}
break;
@@ -589,8 +782,13 @@ void handleFlcEvent(byte numero_del_evento) {
putImg(0, 0, punterofondofrase);
break;
case 2:
- drawText(65, 1, "Ahora tendr\x82 un cuerpo nuevo y podr\x82",
- "volver a la vida...", "", "", "", 253, 249);
+ drawText(65, 1,
+ animMessages_ES[235],
+ animMessages_ES[236],
+ animMessages_ES[237],
+ animMessages_ES[238],
+ animMessages_ES[239],
+ 253, 249);
break;
}
break;
@@ -600,8 +798,13 @@ void handleFlcEvent(byte numero_del_evento) {
putImg(0, 0, punterofondofrase);
break;
case 2:
- drawText(65, 1, "Tu mientras tanto, puedes seguir en",
- "las CAVERNAS ETERNAS...", "", "", "", 253, 249);
+ drawText(65, 1,
+ animMessages_ES[240],
+ animMessages_ES[241],
+ animMessages_ES[242],
+ animMessages_ES[243],
+ animMessages_ES[244],
+ 253, 249);
break;
}
break;
@@ -611,8 +814,13 @@ void handleFlcEvent(byte numero_del_evento) {
putImg(0, 0, punterofondofrase);
break;
case 2:
- drawText(65, 1, "No te preocupes, seguro que nos mandan",
- "otro encargado... JA,JA,JA...", "", "", "", 253, 249);
+ drawText(65, 1,
+ animMessages_ES[245],
+ animMessages_ES[246],
+ animMessages_ES[247],
+ animMessages_ES[248],
+ animMessages_ES[249],
+ 253, 249);
break;
}
break;
@@ -728,7 +936,6 @@ static void loadFlc(
g_engine->_chrono->updateChrono();
exitProcedure(salidaflis, permitesalida);
if (salidaflis) {
- debug("Salidaflis!");
goto Lsalir_proc;
}
if (tocapintar) {
@@ -745,11 +952,9 @@ static void loadFlc(
palette[1] = 0;
palette[2] = 0;
if (palcompleta) {
- debug("PALCOMPLETA! palette");
changePalette(g_engine->_graphics->getPalette(), palette);
copyPalette(palette, pal);
} else if (doscientos) {
- debug("Doscientos!!");
g_engine->_graphics->setPalette(palette, 200);
for (int i = 0; i <= 200; i++) {
if(gamePart == 2 && !salirdeljuego && (i == 131 || i == 134 || i == 143 || i == 187)) {
@@ -762,7 +967,6 @@ static void loadFlc(
} else {
g_engine->_graphics->setPalette(palette);
- debug("else palette");
copyPalette(palette, pal);
}
}
diff --git a/engines/tot/detection.h b/engines/tot/detection.h
index 362b9cf58cf..ee7fc5caea5 100644
--- a/engines/tot/detection.h
+++ b/engines/tot/detection.h
@@ -58,7 +58,7 @@ public:
}
const char *getOriginalCopyright() const override {
- return "Tot (C)";
+ return "(C) Todos los derechos reservados. ACA Soft. S.L. Granada Octubre de 1994";
}
const DebugChannelDef *getDebugChannels() const override {
diff --git a/engines/tot/detection_tables.h b/engines/tot/detection_tables.h
index 55de44d58f6..095b9501422 100644
--- a/engines/tot/detection_tables.h
+++ b/engines/tot/detection_tables.h
@@ -31,12 +31,20 @@ const ADGameDescription gameDescriptions[] = {
"tot",
nullptr,
AD_ENTRY1s("CREDITOS.DAT", "6885c1fadd25a0c0da1c88f071a30e63", 130080),
+ Common::ES_ESP,
+ Common::kPlatformDOS,
+ ADGF_UNSTABLE,
+ GUIO1(GUIO_NONE)
+ },
+ {
+ "tot",
+ nullptr,
+ AD_ENTRY1s("CREDITOS.DAT", "bca1c63cfee9ec8b722f7715e21b5e8e", 130080),
Common::EN_ANY,
Common::kPlatformDOS,
ADGF_UNSTABLE,
GUIO1(GUIO_NONE)
},
-
AD_TABLE_END_MARKER
};
diff --git a/engines/tot/dialog.cpp b/engines/tot/dialog.cpp
index 45b47cf9698..b731cd7d1d0 100644
--- a/engines/tot/dialog.cpp
+++ b/engines/tot/dialog.cpp
@@ -29,6 +29,7 @@
#include "tot/playanim.h"
#include "tot/routines.h"
#include "tot/routines2.h"
+#include "tot/texts.h"
#include "tot/tot.h"
namespace Tot {
@@ -521,7 +522,7 @@ void talk(byte person) {
}
mobj[indicemochila].bitmapIndex = indicelista1;
mobj[indicemochila].code = codigolista1;
- mobj[indicemochila].objectName = "LISTA ";
+ mobj[indicemochila].objectName = getObjectName(0);
} break;
case 25: {
lista2 = true;
@@ -531,7 +532,7 @@ void talk(byte person) {
}
mobj[indicemochila].bitmapIndex = indicelista2;
mobj[indicemochila].code = codigolista2;
- mobj[indicemochila].objectName = "LISTA";
+ mobj[indicemochila].objectName = getObjectName(1);
} break;
}
}
diff --git a/engines/tot/game.cpp b/engines/tot/game.cpp
index e006651ab52..4305fe8362b 100644
--- a/engines/tot/game.cpp
+++ b/engines/tot/game.cpp
@@ -29,6 +29,7 @@
#include "tot/routines.h"
#include "tot/routines2.h"
#include "tot/sound.h"
+#include "tot/texts.h"
#include "tot/tot.h"
#include "tot/util.h"
@@ -56,7 +57,7 @@ void newGame() {
for (int i = 0; i < inventoryIconCount; i++) {
mobj[i].bitmapIndex = 34;
mobj[i].code = 0;
- mobj[i].objectName = "VACIO";
+ mobj[i].objectName = getObjectName(10);
}
readConversationFile(Common::String("CONVERSA.TRE"));
initializeScreenFile();
@@ -131,6 +132,13 @@ int startGame() {
inGame = true;
Common::Event e;
+ const char hotKeyOpen = hotKeyFor(OPEN);
+ const char hotKeyClose = hotKeyFor(CLOSE);
+ const char hotKeyPickup = hotKeyFor(PICKUP);
+ const char hotKeyTalk = hotKeyFor(TALK);
+ const char hotKeyLook = hotKeyFor(LOOKAT);
+ const char hotKeyUse = hotKeyFor(USE);
+
while (!salirdeljuego && !g_engine->shouldQuit()) {
bool escapePressed = false;
g_engine->_chrono->updateChrono();
@@ -156,63 +164,46 @@ int startGame() {
g_engine->openMainMenuDialog();
// saveLoad();
break;
- // /* Debug */
- // {
- // case Common::KEYCODE_5:
- // showMouseGrid = !showMouseGrid;
- // break;
- // case Common::KEYCODE_6:
- // showScreenGrid = !showScreenGrid;
- // break;
- // case Common::KEYCODE_7:
- // showGameGrid = !showGameGrid;
- // break;
- // case Common::KEYCODE_0:
- // effect(13, false, background);
- // break;
- // case Common::KEYCODE_8:
- // drawObjectAreas = !drawObjectAreas;
- // break;
- // }
- // /* End debug */
- case Common::KEYCODE_a: // open
- numeroaccion = 5;
- action();
- oldxrejilla = 0;
- oldyrejilla = 0;
- break;
- case Common::KEYCODE_e: // close
- numeroaccion = 6;
- action();
- oldxrejilla = 0;
- oldyrejilla = 0;
- break;
- case Common::KEYCODE_c: // pickup
- numeroaccion = 2;
- action();
- oldxrejilla = 0;
- oldyrejilla = 0;
- break;
- case Common::KEYCODE_h: // talk
- numeroaccion = 1;
- action();
- oldxrejilla = 0;
- oldyrejilla = 0;
- break;
- case Common::KEYCODE_m: // look
- numeroaccion = 3;
- action();
- oldxrejilla = 0;
- oldyrejilla = 0;
- break;
- case Common::KEYCODE_u: // use
- numeroaccion = 4;
- action();
- oldxrejilla = 0;
- oldyrejilla = 0;
- break;
default:
- numeroaccion = 0; // go to
+ if(e.kbd.keycode == hotKeyOpen) {
+ numeroaccion = 5;
+ action();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ }
+ else if (e.kbd.keycode == hotKeyClose) {
+ numeroaccion = 6;
+ action();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ }
+ else if (e.kbd.keycode == hotKeyPickup) {
+ numeroaccion = 2;
+ action();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ }
+ else if (e.kbd.keycode == hotKeyTalk) {
+ numeroaccion = 1;
+ action();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ }
+ else if (e.kbd.keycode == hotKeyLook) {
+ numeroaccion = 3;
+ action();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ }
+ else if (e.kbd.keycode == hotKeyUse) {
+ numeroaccion = 4;
+ action();
+ oldxrejilla = 0;
+ oldyrejilla = 0;
+ }
+ else {
+ numeroaccion = 0; // go to
+ }
}
} else if (e.type == Common::EVENT_LBUTTONUP) {
pulsax = e.mouse.x;
@@ -883,16 +874,16 @@ void sceneChange() {
loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
switch (hornacina[0][hornacina[0][3]]) {
case 0:
- currentRoomData->indexadoobjetos[9]->objectName = "HORNACINA";
+ currentRoomData->indexadoobjetos[9]->objectName = getObjectName(4);
break;
case 561:
- currentRoomData->indexadoobjetos[9]->objectName = "ESTATUA DIVINA";
+ currentRoomData->indexadoobjetos[9]->objectName = getObjectName(5);
break;
case 563:
- currentRoomData->indexadoobjetos[9]->objectName = "MANUAL DE ALFARERO";
+ currentRoomData->indexadoobjetos[9]->objectName = getObjectName(6);
break;
case 615:
- currentRoomData->indexadoobjetos[9]->objectName = "ESTATUA GROTESCA";
+ currentRoomData->indexadoobjetos[9]->objectName = getObjectName(7);
break;
}
if (contadorpc > 89)
@@ -923,19 +914,19 @@ void sceneChange() {
loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
switch (hornacina[1][hornacina[1][3]]) {
case 0:
- currentRoomData->indexadoobjetos[8]->objectName = "HORNACINA";
+ currentRoomData->indexadoobjetos[8]->objectName = getObjectName(4);
break;
case 561:
- currentRoomData->indexadoobjetos[8]->objectName = "ESTATUA DIVINA";
+ currentRoomData->indexadoobjetos[8]->objectName = getObjectName(5);
break;
case 615:
- currentRoomData->indexadoobjetos[8]->objectName = "ESTATUA GROTESCA";
+ currentRoomData->indexadoobjetos[8]->objectName = getObjectName(7);
break;
case 622:
- currentRoomData->indexadoobjetos[8]->objectName = "PARED";
+ currentRoomData->indexadoobjetos[8]->objectName = getObjectName(8);
break;
case 623:
- currentRoomData->indexadoobjetos[8]->objectName = "TORNO";
+ currentRoomData->indexadoobjetos[8]->objectName = getObjectName(9);
break;
}
if (contadorpc > 89)
diff --git a/engines/tot/graphman.cpp b/engines/tot/graphman.cpp
index fdf3770b0a0..cb2ddfecf4f 100644
--- a/engines/tot/graphman.cpp
+++ b/engines/tot/graphman.cpp
@@ -38,9 +38,11 @@ GraphicsManager::GraphicsManager() {
if (!exeFile.open(Common::Path("TOT.EXE"))) {
error("Could not open executable file!");
}
- exeFile.seek(FONT_LITT_OFFSET);
+ exeFile.seek(FONT_LITT_OFFSET_ES);
+ // exeFile.seek(FONT_LITT_OFFSET_EN);
_litt.loadChr(exeFile);
- exeFile.seek(FONT_EURO_OFFSET);
+ exeFile.seek(FONT_EURO_OFFSET_ES);
+ // exeFile.seek(FONT_EURO_OFFSET_EN);
_euro.loadChr(exeFile);
exeFile.close();
_bios = new BiosFont();
diff --git a/engines/tot/graphman.h b/engines/tot/graphman.h
index 712b0384938..849e706a8a5 100644
--- a/engines/tot/graphman.h
+++ b/engines/tot/graphman.h
@@ -55,9 +55,12 @@ public:
Graphics::Font *_bios;
private:
- const int FONT_LITT_OFFSET = 153584;
- const int FONT_EURO_OFFSET = 159681;
signed char datosfundido[256][256];
+
+ const int FONT_LITT_OFFSET_ES = 153584;
+ const int FONT_EURO_OFFSET_ES = 159681;
+ const int FONT_LITT_OFFSET_EN = 153010;
+ const int FONT_EURO_OFFSET_EN = 159107;
};
} // End of namespace Tot
diff --git a/engines/tot/routines.cpp b/engines/tot/routines.cpp
index c2e55a09430..9aff1a770ab 100644
--- a/engines/tot/routines.cpp
+++ b/engines/tot/routines.cpp
@@ -23,11 +23,9 @@
#include "common/endian.h"
#include "tot/routines.h"
+#include "tot/texts.h"
#include "tot/tot.h"
-// Remove after debug
-#include "tot/routines2.h"
-
namespace Tot {
void drawText(uint numero) {
@@ -1535,7 +1533,7 @@ void updateVideo() {
drawScreen(background);
}
-void alcoveAnimation(byte direccionhn, int32 bitmap) {
+void nicheAnimation(byte direccionhn, int32 bitmap) {
uint posdibhn, indicehn;
int incrementohn;
@@ -1722,7 +1720,7 @@ void pickupScreenObject() {
if (hornacina[0][3] == 2 || hornacina[0][hornacina[0][3]] == 563) {
readItemRegister(hornacina[0][hornacina[0][3]]);
hornacina[0][hornacina[0][3]] = 0;
- currentRoomData->indexadoobjetos[9]->objectName = "HORNACINA";
+ currentRoomData->indexadoobjetos[9]->objectName = getObjectName(4);
animatePickup1(3, 1);
readBitmap(1190768, screenObjects[regobj.profundidad - 1], 892, 319);
currentRoomData->bitmapasociados[1].puntbitmap = 1190768;
@@ -1754,23 +1752,23 @@ void pickupScreenObject() {
currentRoomData->bitmapasociados[1].profund = 1;
switch (hornacina[0][hornacina[0][3]]) {
case 0: {
- currentRoomData->indexadoobjetos[9]->objectName = "HORNACINA";
- alcoveAnimation(0, 1190768);
+ currentRoomData->indexadoobjetos[9]->objectName = getObjectName(4);
+ nicheAnimation(0, 1190768);
currentRoomData->bitmapasociados[1].puntbitmap = 1190768;
} break;
case 561: {
- currentRoomData->indexadoobjetos[9]->objectName = "ESTATUA DIVINA";
- alcoveAnimation(0, 1182652);
+ currentRoomData->indexadoobjetos[9]->objectName = getObjectName(5);
+ nicheAnimation(0, 1182652);
currentRoomData->bitmapasociados[1].puntbitmap = 1182652;
} break;
case 563: {
- currentRoomData->indexadoobjetos[9]->objectName = "MANUAL DE ALFARERO";
- alcoveAnimation(0, 1186044);
+ currentRoomData->indexadoobjetos[9]->objectName = getObjectName(6);
+ nicheAnimation(0, 1186044);
currentRoomData->bitmapasociados[1].puntbitmap = 1186044;
} break;
case 615: {
- currentRoomData->indexadoobjetos[9]->objectName = "ESTATUA GROTESCA";
- alcoveAnimation(0, 1181760);
+ currentRoomData->indexadoobjetos[9]->objectName = getObjectName(7);
+ nicheAnimation(0, 1181760);
currentRoomData->bitmapasociados[1].puntbitmap = 1181760;
} break;
}
@@ -1789,7 +1787,7 @@ void pickupScreenObject() {
if (hornacina[1][3] == 2) {
readItemRegister(hornacina[1][2]);
hornacina[1][2] = 0;
- currentRoomData->indexadoobjetos[8]->objectName = "HORNACINA";
+ currentRoomData->indexadoobjetos[8]->objectName = getObjectName(4);
animatePickup1(0, 1);
readBitmap(1399610, screenObjects[regobj.profundidad - 1], 892, 319);
currentRoomData->bitmapasociados[0].puntbitmap = 1399610;
@@ -1820,28 +1818,28 @@ void pickupScreenObject() {
currentRoomData->bitmapasociados[0].profund = 1;
switch (hornacina[1][hornacina[1][3]]) {
case 0: {
- currentRoomData->indexadoobjetos[8]->objectName = "HORNACINA";
- alcoveAnimation(0, 1399610);
+ currentRoomData->indexadoobjetos[8]->objectName = getObjectName(4);
+ nicheAnimation(0, 1399610);
currentRoomData->bitmapasociados[0].puntbitmap = 1399610;
} break;
case 561: {
- currentRoomData->indexadoobjetos[8]->objectName = "ESTATUA DIVINA";
- alcoveAnimation(0, 1381982);
+ currentRoomData->indexadoobjetos[8]->objectName = getObjectName(5);
+ nicheAnimation(0, 1381982);
currentRoomData->bitmapasociados[0].puntbitmap = 1381982;
} break;
case 615: {
- currentRoomData->indexadoobjetos[8]->objectName = "ESTATUA GROTESCA";
- alcoveAnimation(0, 1381090);
+ currentRoomData->indexadoobjetos[8]->objectName = getObjectName(7);
+ nicheAnimation(0, 1381090);
currentRoomData->bitmapasociados[0].puntbitmap = 1381090;
} break;
case 622: {
- currentRoomData->indexadoobjetos[8]->objectName = "PARED";
- alcoveAnimation(0, 1400502);
+ currentRoomData->indexadoobjetos[8]->objectName = getObjectName(8);
+ nicheAnimation(0, 1400502);
currentRoomData->bitmapasociados[0].puntbitmap = 1400502;
} break;
case 623: {
- currentRoomData->indexadoobjetos[8]->objectName = "TORNO";
- alcoveAnimation(0, 1398718);
+ currentRoomData->indexadoobjetos[8]->objectName = getObjectName(9);
+ nicheAnimation(0, 1398718);
currentRoomData->bitmapasociados[0].puntbitmap = 1398718;
} break;
}
@@ -2748,12 +2746,12 @@ void useScreenObject() {
animateGive(3, 1);
switch (hornacina[0][0]) {
case 561: {
- currentRoomData->indexadoobjetos[9]->objectName = "ESTATUA DIVINA";
+ currentRoomData->indexadoobjetos[9]->objectName = getObjectName(5);
readBitmap(1182652, screenObjects[0], 892, 319);
currentRoomData->bitmapasociados[1].puntbitmap = 1182652;
} break;
case 615: {
- currentRoomData->indexadoobjetos[9]->objectName = "ESTATUA GROTESCA";
+ currentRoomData->indexadoobjetos[9]->objectName = getObjectName(7);
readBitmap(1181760, screenObjects[0], 892, 319);
currentRoomData->bitmapasociados[1].puntbitmap = 1181760;
} break;
@@ -2796,23 +2794,23 @@ void useScreenObject() {
playVoc("PLATAF", 375907, 14724);
switch (hornacina[0][hornacina[0][3]]) {
case 0: {
- currentRoomData->indexadoobjetos[9]->objectName = "HORNACINA";
- alcoveAnimation(1, 1190768);
+ currentRoomData->indexadoobjetos[9]->objectName = getObjectName(4);
+ nicheAnimation(1, 1190768);
currentRoomData->bitmapasociados[1].puntbitmap = 1190768;
} break;
case 561: {
- currentRoomData->indexadoobjetos[9]->objectName = "ESTATUA DIVINA";
- alcoveAnimation(1, 1182652);
+ currentRoomData->indexadoobjetos[9]->objectName = getObjectName(5);
+ nicheAnimation(1, 1182652);
currentRoomData->bitmapasociados[1].puntbitmap = 1182652;
} break;
case 563: {
- currentRoomData->indexadoobjetos[9]->objectName = "MANUAL DE ALFARERO";
- alcoveAnimation(1, 1186044);
+ currentRoomData->indexadoobjetos[9]->objectName = getObjectName(6);
+ nicheAnimation(1, 1186044);
currentRoomData->bitmapasociados[1].puntbitmap = 1186044;
} break;
case 615: {
- currentRoomData->indexadoobjetos[9]->objectName = "ESTATUA GROTESCA";
- alcoveAnimation(1, 1181760);
+ currentRoomData->indexadoobjetos[9]->objectName = getObjectName(7);
+ nicheAnimation(1, 1181760);
currentRoomData->bitmapasociados[1].puntbitmap = 1181760;
} break;
}
@@ -2839,12 +2837,12 @@ void useScreenObject() {
animateGive(0, 1);
switch (hornacina[1][0]) {
case 561: {
- currentRoomData->indexadoobjetos[8]->objectName = "ESTATUA DIVINA";
+ currentRoomData->indexadoobjetos[8]->objectName = getObjectName(5);
readBitmap(1381982, screenObjects[0], 892, 319);
currentRoomData->bitmapasociados[0].puntbitmap = 1381982;
} break;
case 615: {
- currentRoomData->indexadoobjetos[8]->objectName = "ESTATUA GROTESCA";
+ currentRoomData->indexadoobjetos[8]->objectName = getObjectName(7);
readBitmap(1381090, screenObjects[0], 892, 319);
currentRoomData->bitmapasociados[0].puntbitmap = 1381090;
} break;
@@ -2891,28 +2889,28 @@ void useScreenObject() {
playVoc("PLATAF", 375907, 14724);
switch (hornacina[1][hornacina[1][3]]) {
case 0: {
- currentRoomData->indexadoobjetos[8]->objectName = "HORNACINA";
- alcoveAnimation(1, 1399610);
+ currentRoomData->indexadoobjetos[8]->objectName = getObjectName(4);
+ nicheAnimation(1, 1399610);
currentRoomData->bitmapasociados[0].puntbitmap = 1399610;
} break;
case 561: {
- currentRoomData->indexadoobjetos[8]->objectName = "ESTATUA DIVINA";
- alcoveAnimation(1, 1381982);
+ currentRoomData->indexadoobjetos[8]->objectName = getObjectName(5);
+ nicheAnimation(1, 1381982);
currentRoomData->bitmapasociados[0].puntbitmap = 1381982;
} break;
case 615: {
- currentRoomData->indexadoobjetos[8]->objectName = "ESTATUA GROTESCA";
- alcoveAnimation(1, 1381090);
+ currentRoomData->indexadoobjetos[8]->objectName = getObjectName(7);
+ nicheAnimation(1, 1381090);
currentRoomData->bitmapasociados[0].puntbitmap = 1381090;
} break;
case 622: {
- currentRoomData->indexadoobjetos[8]->objectName = "PARED";
- alcoveAnimation(1, 1400502);
+ currentRoomData->indexadoobjetos[8]->objectName = getObjectName(8);
+ nicheAnimation(1, 1400502);
currentRoomData->bitmapasociados[0].puntbitmap = 1400502;
} break;
case 623: {
- currentRoomData->indexadoobjetos[8]->objectName = "TORNO";
- alcoveAnimation(1, 1398718);
+ currentRoomData->indexadoobjetos[8]->objectName = getObjectName(9);
+ nicheAnimation(1, 1398718);
currentRoomData->bitmapasociados[0].puntbitmap = 1398718;
} break;
}
@@ -3383,9 +3381,9 @@ void useScreenObject() {
g_engine->_mouseManager->show();
updateItem(regobj.code);
currentRoomData->indexadoobjetos[16]->indicefichero = 362;
- currentRoomData->indexadoobjetos[16]->objectName = "CARBON";
+ currentRoomData->indexadoobjetos[16]->objectName = getObjectName(2);
currentRoomData->indexadoobjetos[1]->indicefichero = 347;
- currentRoomData->indexadoobjetos[1]->objectName = "BOMBILLA";
+ currentRoomData->indexadoobjetos[1]->objectName = getObjectName(3);
stopVoc();
autoPlayVoc("CALDERA", 6433, 15386);
} break;
@@ -3661,26 +3659,26 @@ void action() {
Common::String actionLine;
switch (numeroaccion) {
case 0:
- actionLine = "IR A ";
+ actionLine = actionLine_ES[0];
break;
case 1:
- actionLine = "HABLAR CON ";
+ actionLine = actionLine_ES[1];
break;
case 2:
- actionLine = "COGER ";
+ actionLine = actionLine_ES[2];
break;
case 3:
- actionLine = "MIRAR ";
+ actionLine = actionLine_ES[3];
break;
case 4: {
- actionLine = "USAR ";
+ actionLine = actionLine_ES[4];
objetomochila = "";
} break;
case 5:
- actionLine = "ABRIR ";
+ actionLine = actionLine_ES[5];
break;
case 6:
- actionLine = "CERRAR ";
+ actionLine = actionLine_ES[6];
break;
}
actionLineText(actionLine);
@@ -3692,7 +3690,7 @@ void handleAction(byte posinv) {
switch (numeroaccion) {
case 1: {
g_engine->_mouseManager->hide();
- actionLineText(Common::String("HABLAR CON ") + mobj[posinv].objectName);
+ actionLineText(actionLine_ES[1] + mobj[posinv].objectName);
g_engine->_mouseManager->show();
drawText((Random(10) + 1039));
numeroaccion = 0;
@@ -3704,7 +3702,7 @@ void handleAction(byte posinv) {
} break;
case 2: {
g_engine->_mouseManager->hide();
- actionLineText(Common::String("COGER ") + mobj[posinv].objectName);
+ actionLineText(actionLine_ES[2] + mobj[posinv].objectName);
if (contadorpc2 > 13)
showError(274);
g_engine->_mouseManager->show();
@@ -3716,7 +3714,7 @@ void handleAction(byte posinv) {
} break;
case 3: {
g_engine->_mouseManager->hide();
- actionLineText(Common::String("MIRAR ") + mobj[posinv].objectName);
+ actionLineText(actionLine_ES[3] + mobj[posinv].objectName);
g_engine->_mouseManager->show();
numeroaccion = 0;
lookInventoryObject(posinv);
@@ -3727,7 +3725,7 @@ void handleAction(byte posinv) {
case 4:
if (objetomochila == "") {
g_engine->_mouseManager->hide();
- actionLineText(Common::String("USAR ") + mobj[posinv].objectName + " CON ");
+ actionLineText(actionLine_ES[4] + mobj[posinv].objectName + actionLine_ES[7]);
g_engine->_mouseManager->show();
objetomochila = mobj[posinv].objectName;
codigoobjmochila = mobj[posinv].code;
@@ -3744,7 +3742,7 @@ void handleAction(byte posinv) {
break;
case 5: {
g_engine->_mouseManager->hide();
- actionLineText(Common::String("ABRIR ") + mobj[posinv].objectName);
+ actionLineText(actionLine_ES[5] + mobj[posinv].objectName);
g_engine->_mouseManager->show();
drawText(Random(9) + 1059);
numeroaccion = 0;
@@ -3754,7 +3752,7 @@ void handleAction(byte posinv) {
} break;
case 6: {
g_engine->_mouseManager->hide();
- actionLineText(Common::String("CERRAR ") + mobj[posinv].objectName);
+ actionLineText(actionLine_ES[6] + mobj[posinv].objectName);
g_engine->_mouseManager->show();
drawText(Random(10) + 1068);
numeroaccion = 0;
@@ -4231,16 +4229,16 @@ void loadGame(regispartida game) {
case 20: {
switch (hornacina[0][hornacina[0][3]]) {
case 0:
- currentRoomData->indexadoobjetos[9]->objectName = "HORNACINA";
+ currentRoomData->indexadoobjetos[9]->objectName = getObjectName(4);
break;
case 561:
- currentRoomData->indexadoobjetos[9]->objectName = "ESTATUA DIVINA";
+ currentRoomData->indexadoobjetos[9]->objectName = getObjectName(5);
break;
case 563:
- currentRoomData->indexadoobjetos[9]->objectName = "MANUAL DE ALFARERO";
+ currentRoomData->indexadoobjetos[9]->objectName = getObjectName(6);
break;
case 615:
- currentRoomData->indexadoobjetos[9]->objectName = "ESTATUA GROTESCA";
+ currentRoomData->indexadoobjetos[9]->objectName = getObjectName(7);
break;
}
} break;
@@ -4251,19 +4249,19 @@ void loadGame(regispartida game) {
case 24: {
switch (hornacina[1][hornacina[1][3]]) {
case 0:
- currentRoomData->indexadoobjetos[8]->objectName = "HORNACINA";
+ currentRoomData->indexadoobjetos[8]->objectName = getObjectName(4);
break;
case 561:
- currentRoomData->indexadoobjetos[8]->objectName = "ESTATUA DIVINA";
+ currentRoomData->indexadoobjetos[8]->objectName = getObjectName(5);
break;
case 615:
- currentRoomData->indexadoobjetos[8]->objectName = "ESTATUA GROTESCA";
+ currentRoomData->indexadoobjetos[8]->objectName = getObjectName(7);
break;
case 622:
- currentRoomData->indexadoobjetos[8]->objectName = "PARED";
+ currentRoomData->indexadoobjetos[8]->objectName = getObjectName(8);
break;
case 623:
- currentRoomData->indexadoobjetos[8]->objectName = "TORNO";
+ currentRoomData->indexadoobjetos[8]->objectName = getObjectName(9);
break;
}
if (trampa_puesta) {
@@ -4884,25 +4882,25 @@ void wcScene() {
partialFadeOut(234);
- outtextxy(10, 20, "... MMPFFFF!! ...", 253);
+ outtextxy(10, 20, fullScreenMessages_ES[45], 253);
delay(1000);
bar(10, 20, 150, 30, 0);
delay(2000);
- outtextxy(100, 50, "... PPTRRFF!! ...", 255);
+ outtextxy(100, 50, fullScreenMessages_ES[46], 255);
delay(1000);
bar(100, 50, 250, 60, 0);
delay(2000);
- outtextxy(30, 110, "... GGNNNNN!! ...", 253);
+ outtextxy(30, 110, fullScreenMessages_ES[47], 253);
delay(1000);
bar(30, 110, 210, 120, 0);
delay(3000);
- outtextxy(50, 90, "... AAAHHHHH!! ...", 248);
+ outtextxy(50, 90, fullScreenMessages_ES[48], 248);
delay(1000);
playVoc("WATER", 272050, 47062);
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
index 3b3890def87..ebc44306434 100644
--- a/engines/tot/routines2.cpp
+++ b/engines/tot/routines2.cpp
@@ -29,6 +29,7 @@
#include "tot/routines.h"
#include "tot/routines2.h"
+#include "tot/texts.h"
#include "tot/tot.h"
#include "tot/util.h"
@@ -131,19 +132,19 @@ void updateAltScreen(byte otherScreenNumber) {
case 20: {
switch (hornacina[0][hornacina[0][3]]) {
case 0: {
- currentRoomData->indexadoobjetos[9]->objectName = "HORNACINA";
+ currentRoomData->indexadoobjetos[9]->objectName = getObjectName(4);
currentRoomData->bitmapasociados[1].puntbitmap = 1190768;
} break;
case 561: {
- currentRoomData->indexadoobjetos[9]->objectName = "ESTATUA DIVINA";
+ currentRoomData->indexadoobjetos[9]->objectName = getObjectName(5);
currentRoomData->bitmapasociados[1].puntbitmap = 1182652;
} break;
case 563: {
- currentRoomData->indexadoobjetos[9]->objectName = "MANUAL DE ALFARERO";
+ currentRoomData->indexadoobjetos[9]->objectName = getObjectName(6);
currentRoomData->bitmapasociados[1].puntbitmap = 1186044;
} break;
case 615: {
- currentRoomData->indexadoobjetos[9]->objectName = "ESTATUA GROTESCA";
+ currentRoomData->indexadoobjetos[9]->objectName = getObjectName(7);
currentRoomData->bitmapasociados[1].puntbitmap = 1181760;
} break;
}
@@ -155,23 +156,23 @@ void updateAltScreen(byte otherScreenNumber) {
case 24: {
switch (hornacina[1][hornacina[1][3]]) {
case 0: {
- currentRoomData->indexadoobjetos[8]->objectName = "HORNACINA";
+ currentRoomData->indexadoobjetos[8]->objectName = getObjectName(4);
currentRoomData->bitmapasociados[0].puntbitmap = 1399610;
} break;
case 561: {
- currentRoomData->indexadoobjetos[8]->objectName = "ESTATUA DIVINA";
+ currentRoomData->indexadoobjetos[8]->objectName = getObjectName(5);
currentRoomData->bitmapasociados[0].puntbitmap = 1381982;
} break;
case 615: {
- currentRoomData->indexadoobjetos[8]->objectName = "ESTATUA GROTESCA";
+ currentRoomData->indexadoobjetos[8]->objectName = getObjectName(7);
currentRoomData->bitmapasociados[0].puntbitmap = 1381090;
} break;
case 622: {
- currentRoomData->indexadoobjetos[8]->objectName = "PARED";
+ currentRoomData->indexadoobjetos[8]->objectName = getObjectName(8);
currentRoomData->bitmapasociados[0].puntbitmap = 1400502;
} break;
case 623: {
- currentRoomData->indexadoobjetos[8]->objectName = "TORNO";
+ currentRoomData->indexadoobjetos[8]->objectName = getObjectName(9);
currentRoomData->bitmapasociados[0].puntbitmap = 1398718;
} break;
}
@@ -709,25 +710,25 @@ static void loadDiploma(Common::String &nombrefoto, Common::String &clave) {
clave.append(passArray, passArray + 10);
- outtextxyBios(91, 16, "CERTIFICADO N\xA7:" + clave, 255);
- outtextxyBios(90, 15, "CERTIFICADO N\xA7:" + clave, 13);
+ outtextxyBios(91, 16, fullScreenMessages_ES[49] + clave, 255);
+ outtextxyBios(90, 15, fullScreenMessages_ES[49] + clave, 13);
- outtextxyBios(81, 61, "Yo, Jacob, el Gran Maestre ", 0);
- outtextxyBios(61, 81, "de la Hermandad de Sek Umh Nejl", 0);
- outtextxyBios(31, 101, "certifico que: " + nombrepersonaje, 0);
- outtextxyBios(31, 121, "me ha liberado de las Cavernas", 0);
- outtextxyBios(31, 141, "Eternas, por lo cual le estar\x82 ", 0);
- outtextxyBios(31, 161, "por siempre agradecido.", 0);
+ outtextxyBios(81, 61, fullScreenMessages_ES[50], 0);
+ outtextxyBios(61, 81, fullScreenMessages_ES[51], 0);
+ outtextxyBios(31, 101, fullScreenMessages_ES[52] + nombrepersonaje, 0);
+ outtextxyBios(31, 121, fullScreenMessages_ES[53], 0);
+ outtextxyBios(31, 141, fullScreenMessages_ES[54], 0);
+ outtextxyBios(31, 161, fullScreenMessages_ES[55], 0);
- outtextxyBios(80, 60, "Yo, Jacob, el Gran Maestre ", 15);
- outtextxyBios(60, 80, "de la Hermandad de Sek Umh Nejl", 15);
- outtextxyBios(30, 100, "certifico que: ", 15);
+ outtextxyBios(80, 60, fullScreenMessages_ES[50], 15);
+ outtextxyBios(60, 80, fullScreenMessages_ES[51], 15);
+ outtextxyBios(30, 100, fullScreenMessages_ES[52], 15);
outtextxyBios(150, 100, nombrepersonaje, 13);
- outtextxyBios(30, 120, "me ha liberado de las Cavernas", 15);
- outtextxyBios(30, 140, "Eternas, por lo cual le estar\x82 ", 15);
- outtextxyBios(30, 160, "por siempre agradecido.", 15);
+ outtextxyBios(30, 120, fullScreenMessages_ES[53], 15);
+ outtextxyBios(30, 140, fullScreenMessages_ES[54], 15);
+ outtextxyBios(30, 160, fullScreenMessages_ES[55], 15);
delay(1500);
playVoc("PORTAZO", 434988, 932);
// putShape(270, 161, (byte *)sello);
@@ -806,31 +807,31 @@ void checkMouseGrid() {
Common::String actionLine;
switch (numeroaccion) {
case 0:
- actionLine = Common::String("IR A ") + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
+ actionLine = actionLine_ES[0] + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
break;
case 1:
- actionLine = Common::String("HABLAR CON ") + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
+ actionLine = actionLine_ES[1] + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
break;
case 2:
- actionLine = Common::String("COGER ") + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
+ actionLine = actionLine_ES[2] + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
break;
case 3:
- actionLine = Common::String("MIRAR ") + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
+ actionLine = actionLine_ES[3] + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
break;
case 4:
if (objetomochila != "")
- actionLine = Common::String("USAR ") + objetomochila + " CON " + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
+ actionLine = actionLine_ES[4] + objetomochila + actionLine_ES[7] + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
else
- actionLine = Common::String("USAR ") + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
+ actionLine = actionLine_ES[4] + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
break;
case 5:
- actionLine = Common::String("ABRIR ") + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
+ actionLine = actionLine_ES[5] + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
break;
case 6:
- actionLine = Common::String("CERRAR ") + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
+ actionLine = actionLine_ES[6] + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
break;
default:
- actionLine = Common::String("IR A ") + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
+ actionLine = actionLine_ES[0] + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
}
actionLineText(actionLine);
g_engine->_mouseManager->show();
@@ -845,28 +846,28 @@ void checkMouseGrid() {
Common::String actionLine;
switch (numeroaccion) {
case 0:
- actionLine = "IR A ";
+ actionLine = actionLine_ES[0];
break;
case 1:
- actionLine = "HABLAR CON ";
+ actionLine = actionLine_ES[1];
break;
case 2:
- actionLine = "COGER ";
+ actionLine = actionLine_ES[2];
break;
case 3:
- actionLine = "MIRAR ";
+ actionLine = actionLine_ES[3];
break;
case 4:
if (objetomochila != "")
- actionLine = Common::String("USAR ") + objetomochila + " CON ";
+ actionLine = actionLine_ES[4] + objetomochila + actionLine_ES[7];
else
- actionLine = "USAR ";
+ actionLine = actionLine_ES[4];
break;
case 5:
- actionLine = "ABRIR ";
+ actionLine = actionLine_ES[5];
break;
case 6:
- actionLine = "CERRAR ";
+ actionLine = actionLine_ES[6];
break;
}
actionLineText(actionLine);
@@ -898,25 +899,25 @@ void checkMouseGrid() {
Common::String actionLine;
switch (numeroaccion) {
case 1:
- actionLine = Common::String("HABLAR CON ") + objmochila;
+ actionLine = actionLine_ES[1] + objmochila;
break;
case 2:
- actionLine = Common::String("COGER ") + objmochila;
+ actionLine = actionLine_ES[2] + objmochila;
break;
case 3:
- actionLine = Common::String("MIRAR ") + objmochila;
+ actionLine = actionLine_ES[3] + objmochila;
break;
case 4:
if (objetomochila == "")
- actionLine = Common::String("USAR ") + objmochila;
+ actionLine = actionLine_ES[4] + objmochila;
else
- actionLine = Common::String("USAR ") + objetomochila + " CON " + objmochila;
+ actionLine = actionLine_ES[4] + objetomochila + actionLine_ES[7] + objmochila;
break;
case 5:
- actionLine = Common::String("ABRIR ") + objmochila;
+ actionLine = actionLine_ES[5] + objmochila;
break;
case 6:
- actionLine = Common::String("CERRAR ") + objmochila;
+ actionLine = actionLine_ES[6] + objmochila;
break;
default:
outtextxy(160, 144, objmochila, 255, true, Graphics::kTextAlignCenter);
@@ -1786,15 +1787,15 @@ void introduction() {
totalFadeOut(0);
cleardevice();
- outtextxy(25, 20, " ... Despu\x82s de estar durante ocho horas", 253);
- outtextxy(25, 35, "conduciendo, haberte perdido tres veces", 253);
- outtextxy(25, 50, "y haber hecho doscientos kil\xA2metros de m\xA0s", 253);
- outtextxy(25, 65, "llegas a una casa que se encuentra en un", 253);
- outtextxy(25, 80, "paraje muy tranquilo y apartado del mundanal", 253);
- outtextxy(25, 95, "ruido. (\xAD\xADY TAN APARTADO!!) ...", 253);
- outtextxy(25, 120, "Pero esto no tiene importancia ... ", 253);
- outtextxy(25, 140, "Hay que encarar el trabajo con una actitud", 253);
- outtextxy(25, 155, "optimista y positiva...", 253);
+ outtextxy(25, 20, fullScreenMessages_ES[0], 253);
+ outtextxy(25, 35, fullScreenMessages_ES[1], 253);
+ outtextxy(25, 50, fullScreenMessages_ES[2], 253);
+ outtextxy(25, 65, fullScreenMessages_ES[3], 253);
+ outtextxy(25, 80, fullScreenMessages_ES[4], 253);
+ outtextxy(25, 95, fullScreenMessages_ES[5], 253);
+ outtextxy(25, 120, fullScreenMessages_ES[6], 253);
+ outtextxy(25, 140, fullScreenMessages_ES[7], 253);
+ outtextxy(25, 155, fullScreenMessages_ES[8], 253);
totalFadeIn(0, "DEFAULT");
g_engine->_screen->markAllDirty();
g_engine->_screen->update();
@@ -2128,6 +2129,8 @@ void exitToDOS() {
setMouseArea(115, 80, 190, 100);
setMousePos(iraton, xraton, yraton);
Common::Event e;
+ const char hotKeyYes = hotKeyFor(YES);
+ const char hotKeyNo = hotKeyFor(NO);
chpasosalida = '@';
do {
g_engine->_chrono->updateChrono();
@@ -2140,13 +2143,13 @@ void exitToDOS() {
if (e.type == Common::EVENT_KEYDOWN) {
if (e.kbd.keycode == Common::KEYCODE_ESCAPE) {
chpasosalida = '\33';
- } else if (e.kbd.keycode == Common::KEYCODE_s) {
+ } else if (e.kbd.keycode == hotKeyYes) {
debug("would exit game now");
free(puntfondcontroles);
// CLEAR MEMORY!!
exitGame();
// exit game
- } else if (e.kbd.keycode == Common::KEYCODE_n) {
+ } else if (e.kbd.keycode == hotKeyNo) {
chpasosalida = '\33';
}
} else if (e.type == Common::EVENT_LBUTTONUP) {
@@ -2354,11 +2357,11 @@ void sacrificeScene() {
bar(0, 139, 319, 149, 0);
bar(10, 10, 300, 120, 0);
- outtextxy(10, 10, " A pesar de todo, no lo has hecho tan mal.", 200);
- outtextxy(10, 30, " Has conseguido todo lo que te pidieron, y", 200);
- outtextxy(10, 50, " van a poder celebrar su fiesta de Halloween.", 200);
- outtextxy(10, 70, " Es todo un detalle que t\xA3 seas el invitado", 200);
- outtextxy(10, 90, " de honor...", 200);
+ outtextxy(10, 10, fullScreenMessages_ES[9], 200);
+ outtextxy(10, 30, fullScreenMessages_ES[10], 200);
+ outtextxy(10, 50, fullScreenMessages_ES[11], 200);
+ outtextxy(10, 70, fullScreenMessages_ES[12], 200);
+ outtextxy(10, 90, fullScreenMessages_ES[13], 200);
for (int i = 0; i <= 28; i++)
setRGBPalette(200, i * 2, i * 2, i * 2);
@@ -2371,11 +2374,11 @@ void sacrificeScene() {
setRGBPalette(200, i * 2, i * 2, i * 2);
bar(10, 10, 300, 120, 0);
- outtextxy(10, 10, " Como recompensa a tus esfuerzos te mandan a", 200);
- outtextxy(10, 30, " darte una vuelta por ah\xA1 mientras ellos se", 200);
- outtextxy(10, 50, " encargan de los preparativos de la fiesta.", 200);
- outtextxy(10, 70, " T\xA3, obviamente, aceptas de inmediato y te", 200);
- outtextxy(10, 90, " vas a tomar el fresco un rato...", 200);
+ outtextxy(10, 10, fullScreenMessages_ES[14], 200);
+ outtextxy(10, 30, fullScreenMessages_ES[15], 200);
+ outtextxy(10, 50, fullScreenMessages_ES[16], 200);
+ outtextxy(10, 70, fullScreenMessages_ES[17], 200);
+ outtextxy(10, 90, fullScreenMessages_ES[18], 200);
for (int i = 0; i <= 28; i++)
setRGBPalette(200, i * 2, i * 2, i * 2);
@@ -2387,10 +2390,10 @@ void sacrificeScene() {
setRGBPalette(200, i * 2, i * 2, i * 2);
bar(10, 10, 300, 120, 0);
- outtextxy(10, 10, " Horas m\xA0s tarde... ", 200);
- outtextxy(10, 50, " La fiesta ya est\xA0 preparada, regresas al", 200);
- outtextxy(10, 70, " sal\xA2n a recibir tus merecidos honores, tras", 200);
- outtextxy(10, 90, " un completo dia de trabajo... ", 200);
+ outtextxy(10, 10, fullScreenMessages_ES[19], 200);
+ outtextxy(10, 50, fullScreenMessages_ES[20] , 200);
+ outtextxy(10, 70, fullScreenMessages_ES[21] , 200);
+ outtextxy(10, 90, fullScreenMessages_ES[22], 200);
for (int i = 0; i <= 28; i++)
setRGBPalette(200, i * 2, i * 2, i * 2);
@@ -2439,22 +2442,24 @@ void sacrificeScene() {
restoreMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
clear();
- outtextxy(10, 31, " Despu\x82s de todo lo que hice por ellos...", 254);
- outtextxy(10, 29, " Despu\x82s de todo lo que hice por ellos...", 254);
- outtextxy(11, 30, " Despu\x82s de todo lo que hice por ellos...", 254);
- outtextxy(9, 30, " Despu\x82s de todo lo que hice por ellos...", 254);
- outtextxy(10, 51, " Todos mis esfuerzos y desvelos para esto...", 254);
- outtextxy(10, 49, " Todos mis esfuerzos y desvelos para esto...", 254);
- outtextxy(11, 50, " Todos mis esfuerzos y desvelos para esto...", 254);
- outtextxy(9, 50, " Todos mis esfuerzos y desvelos para esto...", 254);
- outtextxy(10, 71, " Morir envenenado, ese era mi destino...", 254);
- outtextxy(10, 69, " Morir envenenado, ese era mi destino...", 254);
- outtextxy(11, 70, " Morir envenenado, ese era mi destino...", 254);
- outtextxy(9, 70, " Morir envenenado, ese era mi destino...", 254);
-
- outtextxy(10, 30, " Despu\x82s de todo lo que hice por ellos...", 255);
- outtextxy(10, 50, " Todos mis esfuerzos y desvelos para esto...", 255);
- outtextxy(10, 70, " Morir envenenado, ese era mi destino...", 255);
+ outtextxy(10, 31, fullScreenMessages_ES[23], 254);
+ outtextxy(10, 29, fullScreenMessages_ES[23], 254);
+ outtextxy(11, 30, fullScreenMessages_ES[23], 254);
+ outtextxy(9, 30, fullScreenMessages_ES[23], 254);
+
+ outtextxy(10, 51, fullScreenMessages_ES[24], 254);
+ outtextxy(10, 49, fullScreenMessages_ES[24], 254);
+ outtextxy(11, 50, fullScreenMessages_ES[24], 254);
+ outtextxy(9, 50, fullScreenMessages_ES[24], 254);
+
+ outtextxy(10, 71, fullScreenMessages_ES[25], 254);
+ outtextxy(10, 69, fullScreenMessages_ES[25], 254);
+ outtextxy(11, 70, fullScreenMessages_ES[25], 254);
+ outtextxy(9, 70, fullScreenMessages_ES[25], 254);
+
+ outtextxy(10, 30, fullScreenMessages_ES[23], 255);
+ outtextxy(10, 50, fullScreenMessages_ES[24], 255);
+ outtextxy(10, 70, fullScreenMessages_ES[25], 255);
for (int i = 0; i < 32; i++) {
setRGBPalette(255, 32 + i, i * 2, i * 2);
@@ -2506,42 +2511,48 @@ void sacrificeScene() {
stopVoc();
clear();
- outtextxy(10, 21, " Presta atenci\xA2n, pues esta puede ser la \xA3ltima", 254);
- outtextxy(10, 19, " Presta atenci\xA2n, pues esta puede ser la \xA3ltima", 254);
- outtextxy(11, 20, " Presta atenci\xA2n, pues esta puede ser la \xA3ltima", 254);
- outtextxy(9, 20, " Presta atenci\xA2n, pues esta puede ser la \xA3ltima", 254);
- outtextxy(10, 41, " vez que hablemos contigo. Definitivamente est\xA0s", 254);
- outtextxy(10, 39, " vez que hablemos contigo. Definitivamente est\xA0s", 254);
- outtextxy(11, 40, " vez que hablemos contigo. Definitivamente est\xA0s", 254);
- outtextxy(9, 40, " vez que hablemos contigo. Definitivamente est\xA0s", 254);
- outtextxy(10, 61, " muerto, pero a\xA3n es posible reunir tu alma con", 254);
- outtextxy(10, 59, " muerto, pero a\xA3n es posible reunir tu alma con", 254);
- outtextxy(11, 60, " muerto, pero a\xA3n es posible reunir tu alma con", 254);
- outtextxy(9, 60, " muerto, pero a\xA3n es posible reunir tu alma con", 254);
- outtextxy(10, 81, " tu cuerpo, para ello debes buscar a Jacob y", 254);
- outtextxy(10, 79, " tu cuerpo, para ello debes buscar a Jacob y", 254);
- outtextxy(11, 80, " tu cuerpo, para ello debes buscar a Jacob y", 254);
- outtextxy(9, 80, " tu cuerpo, para ello debes buscar a Jacob y", 254);
- outtextxy(10, 101, " liberarlo de aquello que lo retenga. Cuando lo", 254);
- outtextxy(10, 99, " liberarlo de aquello que lo retenga. Cuando lo", 254);
- outtextxy(11, 100, " liberarlo de aquello que lo retenga. Cuando lo", 254);
- outtextxy(9, 100, " liberarlo de aquello que lo retenga. Cuando lo", 254);
- outtextxy(10, 121, " consigas podremos traeros a ambos de vuelta al", 254);
- outtextxy(10, 119, " consigas podremos traeros a ambos de vuelta al", 254);
- outtextxy(11, 120, " consigas podremos traeros a ambos de vuelta al", 254);
- outtextxy(9, 120, " consigas podremos traeros a ambos de vuelta al", 254);
- outtextxy(10, 141, " mundo de los vivos.", 254);
- outtextxy(10, 139, " mundo de los vivos.", 254);
- outtextxy(11, 140, " mundo de los vivos.", 254);
- outtextxy(9, 140, " mundo de los vivos.", 254);
-
- outtextxy(10, 20, " Presta atenci\xA2n, pues esta puede ser la \xA3ltima", 255);
- outtextxy(10, 40, " vez que hablemos contigo. Definitivamente est\xA0s", 255);
- outtextxy(10, 60, " muerto, pero a\xA3n es posible reunir tu alma con", 255);
- outtextxy(10, 80, " tu cuerpo, para ello debes buscar a Jacob y", 255);
- outtextxy(10, 100, " liberarlo de aquello que lo retenga. Cuando lo", 255);
- outtextxy(10, 120, " consigas podremos traeros a ambos de vuelta al", 255);
- outtextxy(10, 140, " mundo de los vivos.", 255);
+ outtextxy(10, 21, fullScreenMessages_ES[26], 254);
+ outtextxy(10, 19, fullScreenMessages_ES[26], 254);
+ outtextxy(11, 20, fullScreenMessages_ES[26], 254);
+ outtextxy(9, 20, fullScreenMessages_ES[26], 254);
+
+ outtextxy(10, 41, fullScreenMessages_ES[27], 254);
+ outtextxy(10, 39, fullScreenMessages_ES[27], 254);
+ outtextxy(11, 40, fullScreenMessages_ES[27], 254);
+ outtextxy(9, 40, fullScreenMessages_ES[27], 254);
+
+ outtextxy(10, 61, fullScreenMessages_ES[28], 254);
+ outtextxy(10, 59, fullScreenMessages_ES[28], 254);
+ outtextxy(11, 60, fullScreenMessages_ES[28], 254);
+ outtextxy(9, 60, fullScreenMessages_ES[28], 254);
+
+ outtextxy(10, 81, fullScreenMessages_ES[29], 254);
+ outtextxy(10, 79, fullScreenMessages_ES[29], 254);
+ outtextxy(11, 80, fullScreenMessages_ES[29], 254);
+ outtextxy(9, 80, fullScreenMessages_ES[29], 254);
+
+ outtextxy(10, 101, fullScreenMessages_ES[30], 254);
+ outtextxy(10, 99, fullScreenMessages_ES[30], 254);
+ outtextxy(11, 100, fullScreenMessages_ES[30], 254);
+ outtextxy(9, 100, fullScreenMessages_ES[30], 254);
+
+ outtextxy(10, 121, fullScreenMessages_ES[31], 254);
+ outtextxy(10, 119, fullScreenMessages_ES[31], 254);
+ outtextxy(11, 120, fullScreenMessages_ES[31], 254);
+ outtextxy(9, 120, fullScreenMessages_ES[31], 254);
+
+ outtextxy(10, 141, fullScreenMessages_ES[32], 254);
+ outtextxy(10, 139, fullScreenMessages_ES[32], 254);
+ outtextxy(11, 140, fullScreenMessages_ES[32], 254);
+ outtextxy(9, 140, fullScreenMessages_ES[32], 254);
+
+ outtextxy(10, 20, fullScreenMessages_ES[26], 255);
+ outtextxy(10, 40, fullScreenMessages_ES[27], 255);
+ outtextxy(10, 60, fullScreenMessages_ES[28], 255);
+ outtextxy(10, 80, fullScreenMessages_ES[29], 255);
+ outtextxy(10, 100, fullScreenMessages_ES[30], 255);
+ outtextxy(10, 120, fullScreenMessages_ES[31], 255);
+ outtextxy(10, 140, fullScreenMessages_ES[32], 255);
for (int i = 0; i <= 31; i++) {
setRGBPalette(255, 32 + i, i * 2, i * 2);
setRGBPalette(254, 32 - i, 0, 0);
@@ -2559,72 +2570,48 @@ void sacrificeScene() {
return;
clear();
- outtextxy(10, 21, " Pero debes darte prisa pues el v\xA1nculo con tu", 254);
- outtextxy(10, 19, " Pero debes darte prisa pues el v\xA1nculo con tu", 254);
- outtextxy(11, 20, " Pero debes darte prisa pues el v\xA1nculo con tu", 254);
- outtextxy(9, 20, " Pero debes darte prisa pues el v\xA1nculo con tu", 254);
- outtextxy(10, 41, " cuerpo se debilita y tu alma podr\xA1"
- "a quedar",
- 254);
- outtextxy(10, 39, " cuerpo se debilita y tu alma podr\xA1"
- "a quedar",
- 254);
- outtextxy(11, 40, " cuerpo se debilita y tu alma podr\xA1"
- "a quedar",
- 254);
- outtextxy(9, 40, " cuerpo se debilita y tu alma podr\xA1"
- "a quedar",
- 254);
- outtextxy(10, 61, " atrapada para siempre en las Cavernas Eternas.", 254);
- outtextxy(10, 59, " atrapada para siempre en las Cavernas Eternas.", 254);
- outtextxy(11, 60, " atrapada para siempre en las Cavernas Eternas.", 254);
- outtextxy(9, 60, " atrapada para siempre en las Cavernas Eternas.", 254);
- outtextxy(10, 81, " Si necesitaras m\xA0s energ\xA1"
- "a de la que tienes, ",
- 254);
- outtextxy(10, 79, " Si necesitaras m\xA0s energ\xA1"
- "a de la que tienes, ",
- 254);
- outtextxy(11, 80, " Si necesitaras m\xA0s energ\xA1"
- "a de la que tienes, ",
- 254);
- outtextxy(9, 80, " Si necesitaras m\xA0s energ\xA1"
- "a de la que tienes, ",
- 254);
- outtextxy(10, 101, " recuerda que all\xA0 donde vas un cuerpo contiene", 254);
- outtextxy(10, 99, " recuerda que all\xA0 donde vas un cuerpo contiene", 254);
- outtextxy(11, 100, " recuerda que all\xA0 donde vas un cuerpo contiene", 254);
- outtextxy(9, 100, " recuerda que all\xA0 donde vas un cuerpo contiene", 254);
- outtextxy(10, 121, " m\xA0s energ\xA1"
- "a que un alma al contrario que en el",
- 254);
- outtextxy(10, 119, " m\xA0s energ\xA1"
- "a que un alma al contrario que en el",
- 254);
- outtextxy(11, 120, " m\xA0s energ\xA1"
- "a que un alma al contrario que en el",
- 254);
- outtextxy(9, 120, " m\xA0s energ\xA1"
- "a que un alma al contrario que en el",
- 254);
- outtextxy(10, 141, " mundo f\xA1sico.", 254);
- outtextxy(10, 139, " mundo f\xA1sico.", 254);
- outtextxy(11, 140, " mundo f\xA1sico.", 254);
- outtextxy(9, 140, " mundo f\xA1sico.", 254);
-
- outtextxy(10, 20, " Pero debes darte prisa pues el v\xA1nculo con tu", 255);
- outtextxy(10, 40, " cuerpo se debilita y tu alma podr\xA1"
- "a quedar",
- 255);
- outtextxy(10, 60, " atrapada para siempre en las Cavernas Eternas.", 255);
- outtextxy(10, 80, " Si necesitaras m\xA0s energ\xA1"
- "a de la que tienes, ",
- 255);
- outtextxy(10, 100, " recuerda que all\xA0 donde vas un cuerpo contiene", 255);
- outtextxy(10, 120, " m\xA0s energ\xA1"
- "a que un alma al contrario que en el",
- 255);
- outtextxy(10, 140, " mundo f\xA1sico.", 255);
+ outtextxy(10, 21, fullScreenMessages_ES[33], 254);
+ outtextxy(10, 19, fullScreenMessages_ES[33], 254);
+ outtextxy(11, 20, fullScreenMessages_ES[33], 254);
+ outtextxy(9, 20, fullScreenMessages_ES[33], 254);
+
+ outtextxy(10, 41, fullScreenMessages_ES[34], 254);
+ outtextxy(10, 39, fullScreenMessages_ES[34], 254);
+ outtextxy(11, 40, fullScreenMessages_ES[34], 254);
+ outtextxy(9, 40, fullScreenMessages_ES[34], 254);
+
+ outtextxy(10, 61, fullScreenMessages_ES[35], 254);
+ outtextxy(10, 59, fullScreenMessages_ES[35], 254);
+ outtextxy(11, 60, fullScreenMessages_ES[35], 254);
+ outtextxy(9, 60, fullScreenMessages_ES[35], 254);
+
+ outtextxy(10, 81, fullScreenMessages_ES[36], 254);
+ outtextxy(10, 79, fullScreenMessages_ES[36], 254);
+ outtextxy(11, 80, fullScreenMessages_ES[36], 254);
+ outtextxy(9, 80, fullScreenMessages_ES[36], 254);
+
+ outtextxy(10, 101, fullScreenMessages_ES[37], 254);
+ outtextxy(10, 99, fullScreenMessages_ES[37], 254);
+ outtextxy(11, 100, fullScreenMessages_ES[37], 254);
+ outtextxy(9, 100, fullScreenMessages_ES[37], 254);
+
+ outtextxy(10, 121, fullScreenMessages_ES[38], 254);
+ outtextxy(10, 119, fullScreenMessages_ES[38], 254);
+ outtextxy(11, 120, fullScreenMessages_ES[38], 254);
+ outtextxy(9, 120, fullScreenMessages_ES[38], 254);
+
+ outtextxy(10, 141, fullScreenMessages_ES[39], 254);
+ outtextxy(10, 139, fullScreenMessages_ES[39], 254);
+ outtextxy(11, 140, fullScreenMessages_ES[39], 254);
+ outtextxy(9, 140, fullScreenMessages_ES[39], 254);
+
+ outtextxy(10, 20, fullScreenMessages_ES[33], 255);
+ outtextxy(10, 40, fullScreenMessages_ES[34], 255);
+ outtextxy(10, 60, fullScreenMessages_ES[35], 255);
+ outtextxy(10, 80, fullScreenMessages_ES[36], 255);
+ outtextxy(10, 100, fullScreenMessages_ES[37], 255);
+ outtextxy(10, 120, fullScreenMessages_ES[38], 255);
+ outtextxy(10, 140, fullScreenMessages_ES[39], 255);
for (int i = 0; i < 32; i++) {
setRGBPalette(255, 32 + i, i * 2, i * 2);
@@ -2642,22 +2629,24 @@ void sacrificeScene() {
if (g_engine->shouldQuit())
return;
clear();
- outtextxy(10, 61, " No te demores y recuerda...", 254);
- outtextxy(10, 59, " No te demores y recuerda...", 254);
- outtextxy(11, 60, " No te demores y recuerda...", 254);
- outtextxy(9, 60, " No te demores y recuerda...", 254);
- outtextxy(10, 81, " Si triunfas, el premio es la vida, si no...", 254);
- outtextxy(10, 79, " Si triunfas, el premio es la vida, si no...", 254);
- outtextxy(11, 80, " Si triunfas, el premio es la vida, si no...", 254);
- outtextxy(9, 80, " Si triunfas, el premio es la vida, si no...", 254);
- outtextxy(10, 101, " LA MUERTE ETERNA.", 254);
- outtextxy(10, 99, " LA MUERTE ETERNA.", 254);
- outtextxy(11, 100, " LA MUERTE ETERNA.", 254);
- outtextxy(9, 100, " LA MUERTE ETERNA.", 254);
-
- outtextxy(10, 60, " No te demores y recuerda...", 255);
- outtextxy(10, 80, " Si triunfas, el premio es la vida, si no...", 255);
- outtextxy(10, 100, " LA MUERTE ETERNA.", 255);
+ outtextxy(10, 61, fullScreenMessages_ES[40], 254);
+ outtextxy(10, 59, fullScreenMessages_ES[40], 254);
+ outtextxy(11, 60, fullScreenMessages_ES[40], 254);
+ outtextxy(9, 60, fullScreenMessages_ES[40], 254);
+
+ outtextxy(10, 81, fullScreenMessages_ES[41], 254);
+ outtextxy(10, 79, fullScreenMessages_ES[41], 254);
+ outtextxy(11, 80, fullScreenMessages_ES[41], 254);
+ outtextxy(9, 80, fullScreenMessages_ES[41], 254);
+
+ outtextxy(10, 101, fullScreenMessages_ES[42], 254);
+ outtextxy(10, 99, fullScreenMessages_ES[42], 254);
+ outtextxy(11, 100, fullScreenMessages_ES[42], 254);
+ outtextxy(9, 100, fullScreenMessages_ES[42], 254);
+
+ outtextxy(10, 60, fullScreenMessages_ES[40], 255);
+ outtextxy(10, 80, fullScreenMessages_ES[41], 255);
+ outtextxy(10, 100, fullScreenMessages_ES[42], 255);
for (int i = 0; i < 32; i++) {
setRGBPalette(255, 32 + i, i * 2, i * 2);
@@ -2678,17 +2667,18 @@ void sacrificeScene() {
void ending() {
bool pulsada_salida;
- outtextxy(10, 41, " Al fin lo has conseguido....", 249);
- outtextxy(10, 39, " Al fin lo has conseguido....", 249);
- outtextxy(11, 40, " Al fin lo has conseguido....", 249);
- outtextxy(9, 40, " Al fin lo has conseguido....", 249);
- outtextxy(10, 61, " \xAD\xAD\xADSoy LIBREEEEE!!!", 249);
- outtextxy(10, 59, " \xAD\xAD\xADSoy LIBREEEEE!!!", 249);
- outtextxy(11, 60, " \xAD\xAD\xADSoy LIBREEEEE!!!", 249);
- outtextxy(9, 60, " \xAD\xAD\xADSoy LIBREEEEE!!!", 249);
-
- outtextxy(10, 40, " Al fin lo has conseguido....", 253);
- outtextxy(10, 60, " \xAD\xAD\xADSoy LIBREEEEE!!!", 253);
+ outtextxy(10, 41, fullScreenMessages_ES[43], 249);
+ outtextxy(10, 39, fullScreenMessages_ES[43], 249);
+ outtextxy(11, 40, fullScreenMessages_ES[43], 249);
+ outtextxy(9, 40, fullScreenMessages_ES[43], 249);
+
+ outtextxy(10, 61, fullScreenMessages_ES[44], 249);
+ outtextxy(10, 59, fullScreenMessages_ES[44], 249);
+ outtextxy(11, 60, fullScreenMessages_ES[44], 249);
+ outtextxy(9, 60, fullScreenMessages_ES[44], 249);
+
+ outtextxy(10, 40, fullScreenMessages_ES[43], 253);
+ outtextxy(10, 60, fullScreenMessages_ES[44], 253);
if(g_engine->shouldQuit()) {
return;
}
diff --git a/engines/tot/texts.h b/engines/tot/texts.h
new file mode 100644
index 00000000000..45aa23927dd
--- /dev/null
+++ b/engines/tot/texts.h
@@ -0,0 +1,473 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+namespace Tot {
+
+#include "common/str.h"
+#include "common/keyboard.h"
+
+static const char *const animMessages_ES[] = {
+ "Las \xA3ltimas encuestas realizadas",
+ "acerca de la siniestralidad en ",
+ "los transportes arrojan resultados",
+ "alentadores...",
+ "",
+ // 5
+ "El cien por cien de los encuestados",
+ "declararon no haber sufrido nunca un",
+ "accidente mortal...",
+ "",
+ "",
+ // 10
+ "Es una noticia que nos anima a salir",
+ "de viaje con m\xA0s seguridad.",
+ "",
+ "",
+ "",
+ // 15
+ "\xAD\xADPor un tornillo!!...",
+ "Por un m\xA1sero y simple",
+ "tornillo del tr\xA1"
+ "fugo",
+ "del trapecio...",
+ "",
+ // 20
+ "Si lo hubiese apretado",
+ "bien, no estar\xA1"
+ "a ahora",
+ "sin trabajo...",
+ "",
+ "",
+ // 25
+ "\xAD\xADNoticia de \xA3ltima hora!!",
+ "",
+ "",
+ "",
+ "",
+ // 30
+ "Llevo sin dormir toda",
+ "la noche, pensando qu\x82",
+ "voy a hacer.",
+ "",
+ "",
+ // 35
+ "Seguramente no podr\x82",
+ "encontrar trabajo en",
+ "mucho tiempo...",
+ "Aunque ponga mucha f\x82",
+ "la oficina de empleo.",
+ // 40
+ "Y para animarme m\xA0s",
+ "todav\xAD""a, ma\xA4""ana noche",
+ "es HALLOWEEN...",
+ "",
+ "Es que tengo la negra.",
+ // 45
+ "Grave accidente en TWELVE MOTORS...",
+ "un empleado olvid\xA2 apretar un tornillo",
+ "y media cadena de montaje ha quedado",
+ "para chatarra...",
+ "las p\x82rdidas se estiman cuantiosas...",
+ // 50
+ "No se descartan las acciones legales",
+ "contra ese inconsciente...",
+ "",
+ "",
+ "",
+ // 55
+ "\xAD""Dios mio!... hasta en",
+ "la televisi\xA2n...",
+ "Seguro que hasta mi",
+ "perro encuentra curro",
+ "antes que yo...",
+ // 60
+ "\xADHORROR!...una factura",
+ "",
+ "",
+ "",
+ "",
+ // 65
+ "\xA8"
+ "Oficina de empleo?...",
+ "\xA8"
+ "y para m\xA1?...",
+ "",
+ "\xADSe habr\xA0n equivocado!", "",
+ // 70
+ "\xA8Tan pronto lograron",
+ "encontrarme trabajo?",
+ "",
+ "Claro... antes de ver",
+ "las noticias...",
+ // 75
+ "Estimado se\xA4or: Nos dirigimos a",
+ "usted para comunicarle que su",
+ "solicitud n\xA7:93435 fu\x82 aceptada",
+ "y le hemos encontrado un puesto",
+ "de acuerdo con sus aptitudes...",
+ // 80
+ "Deber\xA0 presentarse ma\xA4""ana, dia",
+ "31 de Octubre en la direcci\xA2n",
+ "abajo indicada, para ocupar el",
+ "puesto de ENCARGADO GENERAL.",
+ "",
+ //85
+ "Le adjuntamos las credenciales",
+ "de presentaci\xA2n.",
+ "Deseando no verle por aqu\xA1 en",
+ "mucho tiempo se despide:",
+ " Leonor Scott.",
+ // 90
+ "\xAD\xADQue ilu!! encargado",
+ "general... si ya me",
+ "lo decia mi madre...",
+ "<<nene tienes cara de",
+ "encargado general>>",
+ // 95
+ "Tendr\x82 que conseguir",
+ "ropa m\xA0s de acuerdo",
+ "con mi nuevo cargo.",
+ "",
+ "Manos a la obra...",
+ // 100
+ "\xADV\xA0yase!... no queremos vendedores...",
+ "y menos de planes de jubilaci\xA2n.",
+ "",
+ "",
+ "",
+ // 105
+ "No soy ning\xA3n vendedor... me envia la oficina",
+ "de empleo... tenga mis credenciales.",
+ "",
+ "",
+ "",
+ // 110
+ "\xADVaya! eres t\xA3...llegas con retraso. Los ancianos est\xA0n",
+ "esper\xA0ndote en el sal\xA2n. Debes cuidarlos muy bien.",
+ "",
+ "",
+ "",
+ // 115
+ "Lo siento, no sab\xA1""a a que hora deb\xA1""a presentarme, en",
+ "la oficina de empleo no me lo dijeron.",
+ "",
+ "",
+ "",
+ // 120
+ "Bueno... no importa... ya est\xA0s aqu\xA1.",
+ "Ese coche es tuyo \xA8no?...",
+ "",
+ "",
+ "",
+ // 125
+ "Si... es precioso \xA8verdad?...",
+ "",
+ "",
+ "",
+ "",
+ // 130
+ "Vaya... 200 caballos... elevalunas el\x82""ctricos... ",
+ "inyecci\xA2n electr\xA2nica, llantas de aleaci\xA2n...",
+ "",
+ "",
+ "",
+ // 135
+ "Pues si...",
+ "",
+ "",
+ "",
+ "",
+ // 140
+ "Airbag... asientos envolventes... aire acondicionado",
+ "",
+ "",
+ "",
+ "",
+ // 145
+ "Es el m\xA0s alto de la gama...",
+ "",
+ "",
+ "",
+ "",
+ // 150
+ "ABS, equipo de m\xA3sica con CD, estructura reforzada",
+ "indeformable, detector de radar...",
+ "",
+ "",
+ "",
+ // 155
+ "Parece que te gusta, \xA8no?", "", "", "", "",
+ // 160
+ "Bueno, no est\xA0 mal... pero... gracias de todos modos.", "", "", "", "",
+ // 165
+ "\xA8Gracias?... \xA8qu\x82?... \xAD"
+ "espera!... ese es mi coche...",
+ "",
+ "",
+ "",
+ "",
+ // 170
+ "Toma una copita, te la has ganado...", "", "", "", "",
+ // 175
+ "\xA8""Donde estoy? ... \xA8Qu\x82 me ha pasado?", "", "", "", "",
+ // 180
+ "Tranquilizate, no est\xA0s muerto...",
+ "Est\xA0s tras la puerta de acero...",
+ "",
+ "",
+ "",
+ // 185
+ "Te necesitamos para encontrar a Jacob,",
+ "nuestro Gran Maestre.",
+ "",
+ "",
+ "",
+ // 190
+ "Hace unos dias se puso a estudiar el libro",
+ "que me diste y desapareci\xA2...",
+ "",
+ "",
+ "",
+ // 195
+ "Creemos que realiz\xA2 un conjuro sin darse cuenta...",
+ "",
+ "",
+ "",
+ "",
+ // 200
+ "Por fortuna, pudimos ponernos en contacto",
+ "con \x82l, y nos dijo que est\xA0 en problemas...",
+ "",
+ "",
+ "",
+ // 205
+ "Nos pidi\xA2 que envi\xA0semos a alguien en su ayuda,",
+ "y TU eres el elegido...",
+ "",
+ "",
+ "",
+ // 210
+ "Para ir a las CAVERNAS ETERNAS debes morir...",
+ "Ning\xA3n cuerpo con alma puede estar all\xA1...",
+ "",
+ "",
+ "",
+ // 215
+ "Haremos un ritual para crear un v\xA1nculo entre tu",
+ "cuerpo y tu alma, s\xA2lo as\xA1 podr\xA0s volver a la vida...",
+ "",
+ "",
+ "",
+ // 220
+ "Si rescatas a Jacob, el v\xA1nculo te traer\xA0 de regreso...", "", "", "", "",
+ // 225
+ "Ahora... \xADPrep\xA0rate!... Ha llegado tu hora...", "", "", "", "",
+ // 230
+ "\xADGracias ILUSO!...", "", "", "", "",
+ // 235
+ "Ahora tendr\x82 un cuerpo nuevo y podr\x82",
+ "volver a la vida...",
+ "",
+ "",
+ "",
+ // 240
+ "Tu mientras tanto, puedes seguir en",
+ "las CAVERNAS ETERNAS...",
+ "",
+ "",
+ "",
+ // 245
+ "No te preocupes, seguro que nos mandan",
+ "otro encargado... JA,JA,JA...",
+ "",
+ "",
+ ""
+};
+
+static const char *const animMessages_EN[] = {
+
+};
+
+static const char *const fullScreenMessages_ES[] = {
+ // intro
+ " ... Despu\x82s de estar durante ocho horas",
+ "conduciendo, haberte perdido tres veces",
+ "y haber hecho doscientos kil\xA2metros de m\xA0s",
+ "llegas a una casa que se encuentra en un",
+ "paraje muy tranquilo y apartado del mundanal",
+ "ruido. (\xAD\xADY TAN APARTADO!!) ...",
+ "Pero esto no tiene importancia ... ",
+ "Hay que encarar el trabajo con una actitud",
+ "optimista y positiva...",
+ // sacrifice scene
+ // 9
+ " A pesar de todo, no lo has hecho tan mal.",
+ " Has conseguido todo lo que te pidieron, y",
+ " van a poder celebrar su fiesta de Halloween.",
+ " Es todo un detalle que t\xA3 seas el invitado",
+ " de honor...",
+ // 14
+ " Como recompensa a tus esfuerzos te mandan a",
+ " darte una vuelta por ah\xA1 mientras ellos se",
+ " encargan de los preparativos de la fiesta.",
+ " T\xA3, obviamente, aceptas de inmediato y te",
+ " vas a tomar el fresco un rato...",
+ //19
+ " Horas m\xA0s tarde... ",
+ " La fiesta ya est\xA0 preparada, regresas al",
+ " sal\xA2n a recibir tus merecidos honores, tras",
+ " un completo dia de trabajo... ",
+ // 23
+ " Despu\x82s de todo lo que hice por ellos...",
+ " Todos mis esfuerzos y desvelos para esto...",
+ " Morir envenenado, ese era mi destino...",
+ // 26
+ " Presta atenci\xA2n, pues esta puede ser la \xA3ltima",
+ " vez que hablemos contigo. Definitivamente est\xA0s",
+ " muerto, pero a\xA3n es posible reunir tu alma con",
+ " tu cuerpo, para ello debes buscar a Jacob y",
+ " liberarlo de aquello que lo retenga. Cuando lo",
+ " consigas podremos traeros a ambos de vuelta al",
+ " mundo de los vivos.",
+ // 33
+ " Pero debes darte prisa pues el v\xA1nculo con tu",
+ " cuerpo se debilita y tu alma podr\xA1""a quedar",
+ " atrapada para siempre en las Cavernas Eternas.",
+ " Si necesitaras m\xA0s energ\xA1""a de la que tienes, ",
+ " recuerda que all\xA0 donde vas un cuerpo contiene",
+ " m\xA0s energ\xA1""a que un alma al contrario que en el",
+ " mundo f\xA1sico.",
+ // 40
+ " No te demores y recuerda...",
+ " Si triunfas, el premio es la vida, si no...",
+ " LA MUERTE ETERNA.",
+ // 43
+ " Al fin lo has conseguido....",
+ " \xAD\xAD\xADSoy LIBREEEEE!!!",
+ // WC
+ // 45
+ "... MMPFFFF!! ...",
+ "... PPTRRFF!! ...",
+ "... GGNNNNN!! ...",
+ "... AAAHHHHH!! ...",
+ // Diploma
+ // 49
+ "CERTIFICADO N\xA7:",
+ "Yo, Jacob, el Gran Maestre ",
+ "de la Hermandad de Sek Umh Nejl",
+ "certifico que: ",
+ "me ha liberado de las Cavernas",
+ "Eternas, por lo cual le estar\x82 ",
+ "por siempre agradecido."
+};
+
+static const char *const fullScreenMessages_EN[] = {
+};
+
+static const char *const actionLine_ES[] = {
+ "IR A ",
+ "HABLAR CON ",
+ "COGER ",
+ "MIRAR ",
+ "USAR ",
+ "ABRIR ",
+ "CERRAR ",
+ " CON ",
+};
+
+static const char *const actionLine_EN[] = {
+ "GO TO ",
+ "TALK TO ",
+ "TAKE ",
+ "LOOK ",
+ "USE ",
+ "OPEN ",
+ "CLOSE ",
+ " WITH ",
+};
+
+static const char *const hardcodedObjects_ES[] = {
+ "LISTA ", // 0
+ "LISTA", // 1
+ "CARBON", // 2
+ "BOMBILLA", // 3
+ "HORNACINA", // 4
+ "ESTATUA DIVINA", // 5
+ "MANUAL DE ALFARERO", // 6
+ "ESTATUA GROTESCA",// 7
+ "PARED", // 8
+ "TORNO", // 9
+ "VACIO"
+};
+
+static const char *const hardcodedObjects_EN[] = {
+ "LIST ",
+ "LIST",
+ "COAL",
+ "LIGHT BULB",
+ "NICHE",
+ "DIVINE STATUE",
+ "POTTER''S HANDBOOK",
+ "GROTESQUE STATUE",
+ "WALL",
+ "POTTER''S WHEEL",
+ "FREE"
+};
+
+inline Common::String getObjectName(int idx) {
+ return hardcodedObjects_ES[idx];
+}
+
+enum HOTKEYS {
+ TALK,
+ PICKUP,
+ LOOKAT,
+ USE,
+ OPEN,
+ CLOSE,
+ YES,
+ NO
+};
+
+inline Common::KeyCode hotKeyFor(HOTKEYS hotkey) {
+ switch (hotkey)
+ {
+ case TALK:
+ return Common::KEYCODE_h;
+ case PICKUP:
+ return Common::KEYCODE_c;
+ case LOOKAT:
+ return Common::KEYCODE_m;
+ case USE:
+ return Common::KEYCODE_u;
+ case OPEN:
+ return Common::KEYCODE_a;
+ case CLOSE:
+ return Common::KEYCODE_e;
+ case YES:
+ return Common::KEYCODE_s;
+ case NO:
+ return Common::KEYCODE_n;
+ default:
+ break;
+ }
+};
+
+} // End of namespace Tot
Commit: f9301e3f4e817836801cdd68e65a45aaeda8c266
https://github.com/scummvm/scummvm/commit/f9301e3f4e817836801cdd68e65a45aaeda8c266
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:48+02:00
Commit Message:
TOT: Clears pointers upon exit
Changed paths:
engines/tot/anims.cpp
engines/tot/anims.h
engines/tot/game.cpp
engines/tot/graphics.h
engines/tot/graphman.cpp
engines/tot/playanim.cpp
engines/tot/playanim.h
engines/tot/routines.cpp
engines/tot/routines2.cpp
engines/tot/routines2.h
engines/tot/sound.cpp
engines/tot/sound.h
engines/tot/soundman.cpp
engines/tot/tot.cpp
diff --git a/engines/tot/anims.cpp b/engines/tot/anims.cpp
index 4a71a65b81c..aa56ba37d23 100644
--- a/engines/tot/anims.cpp
+++ b/engines/tot/anims.cpp
@@ -1016,10 +1016,11 @@ void drawFlc(
primeravuelta = true;
posflicfile = posicionfli;
posrelfli = flicx + flicy * 320;
- // punterofondofrase = malloc(sizefrase);
loadFlc(loop, permitesalida, salidaflis, numevento, palcompleta, doscientos, veloc, flicx, flicy);
debug("Salida flis: %d", salidaflis);
- // free(punterofondofrase);
}
+void clearAnims() {
+ free(punterofondofrase);
+}
} // End of namespace Tot
diff --git a/engines/tot/anims.h b/engines/tot/anims.h
index 4875a4780c6..b024eec0aff 100644
--- a/engines/tot/anims.h
+++ b/engines/tot/anims.h
@@ -31,6 +31,7 @@ void drawFlc(uint flicx, uint flicy, int32 posicionfli, uint loop,
byte veloc, byte numevento, bool palcompleta, bool permitesalida,
bool doscientos, bool &salidaflis);
+void clearAnims();
/**
* Header of an Autodesk Animator FLIC file.
*/
diff --git a/engines/tot/game.cpp b/engines/tot/game.cpp
index 4305fe8362b..75d5455c906 100644
--- a/engines/tot/game.cpp
+++ b/engines/tot/game.cpp
@@ -34,7 +34,6 @@
#include "tot/util.h"
namespace Tot {
-byte iaux, iaux2;
void loadTemporaryGame() {
g_engine->loadGameState(g_engine->getMetaEngine()->getAutosaveSlot());
@@ -944,13 +943,13 @@ void sceneChange() {
animado.posy = currentRoomData->tray2[indicetray2 - 1].y;
animado.profundidad = 14;
- for (iaux = 0; iaux < maxrejax; iaux++)
- for (iaux2 = 0; iaux2 < maxrejay; iaux2++) {
- if (rejamascaramovto[iaux][iaux2] > 0) {
- currentRoomData->rejapantalla[oldposx + iaux][oldposy + iaux2] = rejamascaramovto[iaux][iaux2];
+ for (int i = 0; i < maxrejax; i++)
+ for (int j = 0; j < maxrejay; j++) {
+ if (rejamascaramovto[i][j] > 0) {
+ currentRoomData->rejapantalla[oldposx + i][oldposy + j] = rejamascaramovto[i][j];
}
- if (rejamascararaton[iaux][iaux2] > 0)
- currentRoomData->mouseGrid[oldposx + iaux][oldposy + iaux2] = rejamascararaton[iaux][iaux2];
+ if (rejamascararaton[i][j] > 0)
+ currentRoomData->mouseGrid[oldposx + i][oldposy + j] = rejamascararaton[i][j];
}
assembleScreen();
}
diff --git a/engines/tot/graphics.h b/engines/tot/graphics.h
index 00b2c97d64a..e04259358e4 100644
--- a/engines/tot/graphics.h
+++ b/engines/tot/graphics.h
@@ -27,8 +27,7 @@
namespace Tot {
void initGraph();
-void getVirtualImg(uint getcoordx1, uint getcoordy1, uint getcoordx2, uint getcoordy2,
- byte *backgroundScreen, byte *image);
+void getVirtualImg(uint getcoordx1, uint getcoordy1, uint getcoordx2, uint getcoordy2, byte *backgroundScreen, byte *image);
void putVirtualImg(uint putcoordx, uint putcoordy, byte *backgroundScreen, byte *image);
void clear();
void drawFullScreen(byte *screen);
diff --git a/engines/tot/graphman.cpp b/engines/tot/graphman.cpp
index cb2ddfecf4f..23709b00e62 100644
--- a/engines/tot/graphman.cpp
+++ b/engines/tot/graphman.cpp
@@ -49,6 +49,7 @@ GraphicsManager::GraphicsManager() {
}
GraphicsManager::~GraphicsManager() {
+ delete(_bios);
}
void GraphicsManager::restoreBackground(uint x, uint y, uint x2, uint y2) {
diff --git a/engines/tot/playanim.cpp b/engines/tot/playanim.cpp
index ba61489ee00..cdd511f4b7d 100644
--- a/engines/tot/playanim.cpp
+++ b/engines/tot/playanim.cpp
@@ -85,7 +85,7 @@ palette pal;
reginventario mobj[inventoryIconCount];
-inventoryBitmaps mochilaxms;
+byte *mochilaxms[inventoryIconCount];
byte saltospal;
@@ -722,4 +722,49 @@ void initPlayAnim() {
inGame = false;
}
+void clearVars() {
+ if(pasoanimado != NULL) {
+ free(pasoanimado);
+ }
+ if(background != NULL) {
+ free(background);
+ }
+ if(handpantalla != NULL) {
+ free(handpantalla);
+ }
+ if(conversationData != NULL) {
+ free(conversationData);
+ }
+ if(rooms != NULL) {
+ free(rooms);
+ }
+ if(invItemData != NULL) {
+ free(invItemData);
+ }
+ for(int i = 0; i < numobjetosconv; i++) {
+ if(screenObjects[i] != NULL) {
+ free(screenObjects[i]);
+ }
+ }
+ for(int i = 0; i < inventoryIconCount; i++) {
+ if(mochilaxms[i] != NULL) {
+ free(mochilaxms[i]);
+ }
+ }
+ for(int i = 0; i < 4; i++) {
+ for(int j = 0; j < walkFrameCount + 30; j++) {
+ if(secuencia.bitmap[i][j] != NULL) {
+ free(secuencia.bitmap[i][j]);
+ }
+ }
+ }
+
+ for (int i = 0; i < 4; i++) {
+ for (int j = 0; j < secAnimationFrameCount; j++) {
+ if(animado.dib[i][j] != NULL){
+ free(animado.dib[i][j]);
+ }
+ }
+ }
+}
} // End of namespace Tot
diff --git a/engines/tot/playanim.h b/engines/tot/playanim.h
index bc800fb5b63..679bbbe6fdb 100644
--- a/engines/tot/playanim.h
+++ b/engines/tot/playanim.h
@@ -120,10 +120,6 @@ struct reginventario {
Common::String objectName;
};
-struct inventoryBitmaps {
- byte *bitmap[inventoryIconCount];
-};
-
/**
* Hypertext struct
*/
@@ -385,9 +381,9 @@ extern palette pal;
*/
extern reginventario mobj[inventoryIconCount];
/**
- * Keeps an array of all inventory icons
+ * Keeps an array of all inventory icon bitmaps
*/
-extern inventoryBitmaps mochilaxms;
+extern byte *mochilaxms[inventoryIconCount];
/**
* Delay of palette animation
@@ -647,6 +643,7 @@ void clearObj();
void clearScreenData();
void initPlayAnim();
void resetGameState();
+void clearVars();
} // End of namespace Tot
#endif
diff --git a/engines/tot/routines.cpp b/engines/tot/routines.cpp
index 9aff1a770ab..cd09ee7dcfc 100644
--- a/engines/tot/routines.cpp
+++ b/engines/tot/routines.cpp
@@ -3780,8 +3780,8 @@ void loadObjects() {
if (!ficheroobj.isOpen())
showError(312);
for (int i = 0; i < inventoryIconCount; i++) {
- mochilaxms.bitmap[i] = (byte *)malloc(sizeicono);
- ficheroobj.read(mochilaxms.bitmap[i], sizeicono);
+ mochilaxms[i] = (byte *)malloc(sizeicono);
+ ficheroobj.read(mochilaxms[i], sizeicono);
}
if (contadorpc > 65)
showError(274);
@@ -4135,7 +4135,7 @@ void loadGame(regispartida game) {
if (game.parte_del_juego != gamePart) {
gamePart = game.parte_del_juego;
for (int i = 0; i < inventoryIconCount; i++) {
- free(mochilaxms.bitmap[i]);
+ free(mochilaxms[i]);
}
loadObjects();
}
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
index ebc44306434..0448dd5edab 100644
--- a/engines/tot/routines2.cpp
+++ b/engines/tot/routines2.cpp
@@ -358,7 +358,7 @@ void freeAnimation() {
void freeInventory() {
for (int i = 0; i < inventoryIconCount; i++) {
- free(mochilaxms.bitmap[i]);
+ free(mochilaxms[i]);
}
}
@@ -495,7 +495,7 @@ void drawLookAtItem(RoomObjectListEntry obj) {
void putIcon(uint posiconx, uint posicony, uint numicon) {
// substract 1 to account for 1-based indices
- putImg(posiconx, posicony, mochilaxms.bitmap[mobj[numicon].bitmapIndex - 1]);
+ putImg(posiconx, posicony, mochilaxms[mobj[numicon].bitmapIndex - 1]);
}
void drawBackpack() {
@@ -2101,9 +2101,15 @@ void saveTemporaryGame() {
}
void exitGame() {
+ clear();
g_system->quit();
- // Should do cleanup here!
- free(conversationData);
+}
+
+void clearGame() {
+ debug("releasing game...");
+ resetGameState();
+ clearAnims();
+ clearVars();
}
void exitToDOS() {
@@ -2179,8 +2185,8 @@ void soundControls() {
uint oldxraton,
oldyraton,
tamfondcontroles,
- tamslade,
- tamfondoslade,
+ sliderSize,
+ sliderBgSize,
volumenfx,
volumenmelodia,
xfade,
@@ -2212,22 +2218,22 @@ void soundControls() {
line(90, 31, 90, 44, 255);
- tamslade = imagesize(86, 31, 94, 44);
- byte *slade = (byte *)malloc(tamslade);
- getImg(86, 31, 94, 44, slade);
+ sliderSize = imagesize(86, 31, 94, 44);
+ byte *slider = (byte *)malloc(sliderSize);
+ getImg(86, 31, 94, 44, slider);
drawMenu(3);
- tamfondoslade = imagesize(86, 31, 234, 44);
+ sliderBgSize = imagesize(86, 31, 234, 44);
- byte *fondoslade1 = (byte *)malloc(tamfondoslade);
- byte *fondoslade2 = (byte *)malloc(tamfondoslade);
- getImg(86, 31, 234, 44, fondoslade1);
- getImg(86, 76, 234, 89, fondoslade2);
+ byte *sliderBackground1 = (byte *)malloc(sliderBgSize);
+ byte *sliderBackground2 = (byte *)malloc(sliderBgSize);
+ getImg(86, 31, 234, 44, sliderBackground1);
+ getImg(86, 76, 234, 89, sliderBackground2);
volumenfx = round(((volumenfxderecho + volumenfxizquierdo) / 2) * 20);
volumenmelodia = round(((volumenmelodiaderecho + volumenmelodiaizquierdo) / 2) * 20);
- putImg(volumenfx + 86, 31, slade);
- putImg(volumenmelodia + 86, 76, slade);
+ putImg(volumenfx + 86, 31, slider);
+ putImg(volumenmelodia + 86, 76, slider);
setMousePos(1, xraton, yraton);
bool keyPressed = false;
@@ -2278,8 +2284,8 @@ void soundControls() {
}
if (oldxfade != xfade) {
- putImg(86, 31, fondoslade1);
- putImg(xfade, 31, slade);
+ putImg(86, 31, sliderBackground1);
+ putImg(xfade, 31, slider);
// This yields a volume between 0 and 140
volumenfx = xfade - 86;
@@ -2311,8 +2317,8 @@ void soundControls() {
}
if (oldxfade != xfade) {
- putImg(86, 76, fondoslade2);
- putImg(xfade, 76, slade);
+ putImg(86, 76, sliderBackground2);
+ putImg(xfade, 76, slider);
volumenmelodia = xfade - 86;
volumenmelodiaderecho = round((float)(volumenmelodia) / 20);
volumenmelodiaizquierdo = round((float)(volumenmelodia) / 20);
@@ -2337,9 +2343,9 @@ void soundControls() {
iraton = oldiraton;
setMousePos(iraton, xraton, yraton);
free(puntfondcontroles);
- free(slade);
- free(fondoslade1);
- free(fondoslade2);
+ free(slider);
+ free(sliderBackground1);
+ free(sliderBackground2);
if (contadorpc > 7)
showError(274);
diff --git a/engines/tot/routines2.h b/engines/tot/routines2.h
index dc760207f14..7ba596f63ce 100644
--- a/engines/tot/routines2.h
+++ b/engines/tot/routines2.h
@@ -86,9 +86,9 @@ void assembleScreen(bool scroll = false);
void disableSecondAnimation();
void setRoomTrajectories(int alto, int ancho, TRAJECTORIES_OP op, bool fixGrids = true);
void loadAnimationForDirection(Common::SeekableReadStream *stream, int direction);
+void clearGame();
// Debug methods
-
void drawMouseGrid(RoomFileRegister *screen);
void drawScreenGrid(RoomFileRegister *screen);
void drawCharacterPosition();
diff --git a/engines/tot/sound.cpp b/engines/tot/sound.cpp
index 852a21d13b5..d018d8a1dde 100644
--- a/engines/tot/sound.cpp
+++ b/engines/tot/sound.cpp
@@ -111,5 +111,4 @@ void initSound() {
playMidiFile("Silent", false);
setSfxVolume(6, 6);
}
-
} // End of namespace Tot
diff --git a/engines/tot/sound.h b/engines/tot/sound.h
index af801a04f1f..98831182129 100644
--- a/engines/tot/sound.h
+++ b/engines/tot/sound.h
@@ -39,7 +39,6 @@ void stopVoc();
void playMidiFile(Common::String nomfich, bool loop);
void pitamidmem();
void loopactivo(bool mid_loop);
-
} // End of namespace Tot
#endif
diff --git a/engines/tot/soundman.cpp b/engines/tot/soundman.cpp
index d5232a35a4d..eb5a2b3d3ab 100644
--- a/engines/tot/soundman.cpp
+++ b/engines/tot/soundman.cpp
@@ -156,6 +156,7 @@ MusicPlayer::MusicPlayer() {
MusicPlayer::~MusicPlayer() {
killMidi();
+ free(_data);
}
void MusicPlayer::sndMidiStart(bool loop) {
diff --git a/engines/tot/tot.cpp b/engines/tot/tot.cpp
index 896c97bd03a..164b65de7d4 100644
--- a/engines/tot/tot.cpp
+++ b/engines/tot/tot.cpp
@@ -35,6 +35,7 @@
#include "tot/font/bgifont.h"
#include "tot/graphman.h"
#include "tot/mouse.h"
+#include "tot/playanim.h"
#include "tot/routines.h"
#include "tot/routines2.h"
#include "tot/soundman.h"
@@ -50,6 +51,7 @@ TotEngine::TotEngine(OSystem *syst, const ADGameDescription *gameDesc) : Engine(
}
TotEngine::~TotEngine() {
+ clearGame();
delete _screen;
delete _graphics;
delete _sound;
Commit: f9e7bd9dc0de54e1d627904982e86689cb2f1514
https://github.com/scummvm/scummvm/commit/f9e7bd9dc0de54e1d627904982e86689cb2f1514
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:48+02:00
Commit Message:
TOT: Restricts savegames in cutscenes
Changed paths:
engines/tot/game.cpp
engines/tot/playanim.cpp
engines/tot/playanim.h
engines/tot/routines2.cpp
engines/tot/saveload.cpp
diff --git a/engines/tot/game.cpp b/engines/tot/game.cpp
index 75d5455c906..be25840346d 100644
--- a/engines/tot/game.cpp
+++ b/engines/tot/game.cpp
@@ -42,6 +42,7 @@ void loadTemporaryGame() {
int startGame();
void newGame() {
+ saveAllowed = true;
g_engine->_mouseManager->hide();
obtainName(nombrepersonaje);
diff --git a/engines/tot/playanim.cpp b/engines/tot/playanim.cpp
index cdd511f4b7d..c81098556fa 100644
--- a/engines/tot/playanim.cpp
+++ b/engines/tot/playanim.cpp
@@ -227,6 +227,8 @@ uint currentRoomNumber;
bool isLoadingFromLauncher;
+bool saveAllowed = true;
+
void clearObj() {
byte indpasolimpiador1, indpasolimpiador2;
diff --git a/engines/tot/playanim.h b/engines/tot/playanim.h
index 679bbbe6fdb..f8b35dcf041 100644
--- a/engines/tot/playanim.h
+++ b/engines/tot/playanim.h
@@ -638,6 +638,8 @@ extern uint currentRoomNumber;
extern bool isLoadingFromLauncher;
+extern bool saveAllowed = false;
+
void initializeScreenFile();
void clearObj();
void clearScreenData();
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
index 0448dd5edab..a5f1f4f27d0 100644
--- a/engines/tot/routines2.cpp
+++ b/engines/tot/routines2.cpp
@@ -1671,6 +1671,7 @@ inline bool keyPressed() {
}
void credits() {
+ saveAllowed = true;
debug("Credits");
// byte ii;
palette pal2;
@@ -1765,6 +1766,7 @@ Lsalida:
}
void introduction() {
+ saveAllowed = false;
g_engine->_mouseManager->hide();
bool pulsada_salida;
uint contadorvueltas;
@@ -2354,6 +2356,7 @@ void soundControls() {
}
void sacrificeScene() {
+ saveAllowed = false;
palette palaux;
stopVoc();
@@ -2668,9 +2671,11 @@ void sacrificeScene() {
delay(2000);
totalFadeOut(0);
currentRoomData->paletteAnimationFlag = pulsada_salida;
+ saveAllowed = true;
}
void ending() {
+ saveAllowed = false;
bool pulsada_salida;
outtextxy(10, 41, fullScreenMessages_ES[43], 249);
@@ -2708,6 +2713,7 @@ void ending() {
delay(1000);
playVoc("NOOO", 0, 0);
delay(3000);
+ saveAllowed = true;
}
void loadBat() {
diff --git a/engines/tot/saveload.cpp b/engines/tot/saveload.cpp
index e14cffdfae4..262728b2087 100644
--- a/engines/tot/saveload.cpp
+++ b/engines/tot/saveload.cpp
@@ -302,7 +302,7 @@ bool TotEngine::canLoadGameStateCurrently(Common::U32String *msg) {
return true;
}
bool TotEngine::canSaveGameStateCurrently(Common::U32String *msg) {
- return inGame;
+ return inGame && saveAllowed;
}
} // End of namespace Tot
Commit: 0f008a393f43ce880b719f4fb4c0f039bc306f75
https://github.com/scummvm/scummvm/commit/0f008a393f43ce880b719f4fb4c0f039bc306f75
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:48+02:00
Commit Message:
TOT: Adds preliminary support for English
Changed paths:
A engines/tot/offsets.h
engines/tot/anims.cpp
engines/tot/dialog.cpp
engines/tot/font/bgifont.cpp
engines/tot/graphman.cpp
engines/tot/graphman.h
engines/tot/playanim.cpp
engines/tot/playanim.h
engines/tot/routines.cpp
engines/tot/routines2.cpp
engines/tot/saveload.cpp
engines/tot/texts.h
engines/tot/tot.cpp
engines/tot/tot.h
engines/tot/util.h
diff --git a/engines/tot/anims.cpp b/engines/tot/anims.cpp
index aa56ba37d23..f1179b91c1d 100644
--- a/engines/tot/anims.cpp
+++ b/engines/tot/anims.cpp
@@ -93,6 +93,9 @@ void removeText(uint xfrase1, uint yfrase1, uint xfrase2, uint yfrase2, byte col
}
void handleFlcEvent(byte numero_del_evento) {
+
+ const char *const *messages = g_engine->_lang == Common::ES_ESP ? animMessages[0] : animMessages[1];
+
switch (numero_del_evento) {
case 0:
if (contadorpc > 103)
@@ -104,11 +107,11 @@ void handleFlcEvent(byte numero_del_evento) {
switch (numerovuelta) {
case 2:
drawText(80, 0,
- animMessages_ES[0],
- animMessages_ES[1],
- animMessages_ES[2],
- animMessages_ES[3],
- animMessages_ES[4],
+ messages[0],
+ messages[1],
+ messages[2],
+ messages[3],
+ messages[4],
253, 0);
break;
case 13:
@@ -116,11 +119,11 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 14:
drawText(80, 0,
- animMessages_ES[5],
- animMessages_ES[6],
- animMessages_ES[7],
- animMessages_ES[8],
- animMessages_ES[9],
+ messages[5],
+ messages[6],
+ messages[7],
+ messages[8],
+ messages[9],
253, 0);
break;
case 25:
@@ -128,11 +131,11 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 26:
drawText(80, 0,
- animMessages_ES[10],
- animMessages_ES[11],
- animMessages_ES[12],
- animMessages_ES[13],
- animMessages_ES[14],
+ messages[10],
+ messages[11],
+ messages[12],
+ messages[13],
+ messages[14],
253, 0);
break;
case 35:
@@ -140,11 +143,11 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 36:
drawText(2, 100,
- animMessages_ES[15],
- animMessages_ES[16],
- animMessages_ES[17],
- animMessages_ES[18],
- animMessages_ES[19],
+ messages[15],
+ messages[16],
+ messages[17],
+ messages[18],
+ messages[19],
255, 0);
break;
case 47:
@@ -152,11 +155,11 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 48:
drawText(2, 100,
- animMessages_ES[20],
- animMessages_ES[21],
- animMessages_ES[22],
- animMessages_ES[23],
- animMessages_ES[24],
+ messages[20],
+ messages[21],
+ messages[22],
+ messages[23],
+ messages[24],
255, 0);
break;
case 59:
@@ -164,20 +167,20 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 60:
drawText(80, 0,
- animMessages_ES[25],
- animMessages_ES[26],
- animMessages_ES[27],
- animMessages_ES[28],
- animMessages_ES[29],
+ messages[25],
+ messages[26],
+ messages[27],
+ messages[28],
+ messages[29],
253, 0);
break;
case 63:
drawText(2, 100,
- animMessages_ES[30],
- animMessages_ES[31],
- animMessages_ES[32],
- animMessages_ES[33],
- animMessages_ES[34],
+ messages[30],
+ messages[31],
+ messages[32],
+ messages[33],
+ messages[34],
255, 0);
break;
case 75:
@@ -188,11 +191,11 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 77:
drawText(2, 100,
- animMessages_ES[35],
- animMessages_ES[36],
- animMessages_ES[37],
- animMessages_ES[38],
- animMessages_ES[39],
+ messages[35],
+ messages[36],
+ messages[37],
+ messages[38],
+ messages[39],
255, 0);
break;
case 89:
@@ -200,11 +203,11 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 90:
drawText(2, 100,
- animMessages_ES[40],
- animMessages_ES[41],
- animMessages_ES[42],
- animMessages_ES[43],
- animMessages_ES[44],
+ messages[40],
+ messages[41],
+ messages[42],
+ messages[43],
+ messages[44],
255, 0);
break;
case 102:
@@ -212,11 +215,11 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 103:
drawText(80, 0,
- animMessages_ES[45],
- animMessages_ES[46],
- animMessages_ES[47],
- animMessages_ES[48],
- animMessages_ES[49],
+ messages[45],
+ messages[46],
+ messages[47],
+ messages[48],
+ messages[49],
253, 0);
break;
case 120:
@@ -224,20 +227,20 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 121:
drawText(80, 0,
- animMessages_ES[50],
- animMessages_ES[51],
- animMessages_ES[52],
- animMessages_ES[53],
- animMessages_ES[54],
+ messages[50],
+ messages[51],
+ messages[52],
+ messages[53],
+ messages[54],
253, 0);
break;
case 125:
drawText(2, 100,
- animMessages_ES[55],
- animMessages_ES[56],
- animMessages_ES[57],
- animMessages_ES[58],
- animMessages_ES[59],
+ messages[55],
+ messages[56],
+ messages[57],
+ messages[58],
+ messages[59],
255, 0);
break;
case 135: {
@@ -257,77 +260,77 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 20:
drawText(2, 100,
- animMessages_ES[60],
- animMessages_ES[61],
- animMessages_ES[62],
- animMessages_ES[63],
- animMessages_ES[64],
+ messages[60],
+ messages[61],
+ messages[62],
+ messages[63],
+ messages[64],
255, 0);
break;
case 58: {
removeText(2, 100, 135, 199, 0);
drawText(2, 100,
- animMessages_ES[65],
- animMessages_ES[66],
- animMessages_ES[67],
- animMessages_ES[68],
- animMessages_ES[69],
+ messages[65],
+ messages[66],
+ messages[67],
+ messages[68],
+ messages[69],
255, 0);
} break;
case 74: {
delay(1500);
removeText(2, 100, 135, 199, 0);
drawText(2, 100,
- animMessages_ES[70],
- animMessages_ES[71],
- animMessages_ES[72],
- animMessages_ES[73],
- animMessages_ES[74],
+ messages[70],
+ messages[71],
+ messages[72],
+ messages[73],
+ messages[74],
255, 0);
delay(4000);
removeText(2, 100, 135, 199, 0);
drawText(80, 0,
- animMessages_ES[75],
- animMessages_ES[76],
- animMessages_ES[77],
- animMessages_ES[78],
- animMessages_ES[79],
+ messages[75],
+ messages[76],
+ messages[77],
+ messages[78],
+ messages[79],
253, 0);
delay(7000);
removeText(80, 0, 319, 53, 0);
drawText(80, 0,
- animMessages_ES[80],
- animMessages_ES[81],
- animMessages_ES[82],
- animMessages_ES[83],
- animMessages_ES[84],
+ messages[80],
+ messages[81],
+ messages[82],
+ messages[83],
+ messages[84],
253, 0);
delay(7000);
removeText(80, 0, 319, 53, 0);
drawText(80, 0,
- animMessages_ES[85],
- animMessages_ES[86],
- animMessages_ES[87],
- animMessages_ES[88],
- animMessages_ES[89],
+ messages[85],
+ messages[86],
+ messages[87],
+ messages[88],
+ messages[89],
253, 0);
delay(7000);
removeText(80, 0, 319, 53, 0);
drawText(2, 100,
- animMessages_ES[90],
- animMessages_ES[91],
- animMessages_ES[92],
- animMessages_ES[93],
- animMessages_ES[94],
+ messages[90],
+ messages[91],
+ messages[92],
+ messages[93],
+ messages[94],
255, 0);
delay(6000);
removeText(2, 100, 135, 199, 0);
drawText(2, 100,
- animMessages_ES[95],
- animMessages_ES[96],
- animMessages_ES[97],
- animMessages_ES[98],
- animMessages_ES[99],
+ messages[95],
+ messages[96],
+ messages[97],
+ messages[98],
+ messages[99],
255, 0);
delay(6000);
} break;
@@ -358,20 +361,20 @@ void handleFlcEvent(byte numero_del_evento) {
delay(2000);
drawText(5, 1,
- animMessages_ES[100],
- animMessages_ES[101],
- animMessages_ES[102],
- animMessages_ES[103],
- animMessages_ES[104],
+ messages[100],
+ messages[101],
+ messages[102],
+ messages[103],
+ messages[104],
255, 249);
delay(3500);
putImg(0, 0, punterofondofrase);
drawText(5, 1,
- animMessages_ES[105],
- animMessages_ES[106],
- animMessages_ES[107],
- animMessages_ES[108],
- animMessages_ES[109],
+ messages[105],
+ messages[106],
+ messages[107],
+ messages[108],
+ messages[109],
255, 0);
}
break;
@@ -379,11 +382,11 @@ void handleFlcEvent(byte numero_del_evento) {
if ((numerovuelta == 1) && (framecontador == 3)) {
putImg(0, 0, punterofondofrase);
drawText(5, 1,
- animMessages_ES[110],
- animMessages_ES[111],
- animMessages_ES[112],
- animMessages_ES[113],
- animMessages_ES[114],
+ messages[110],
+ messages[111],
+ messages[112],
+ messages[113],
+ messages[114],
255, 249);
}
break;
@@ -391,11 +394,11 @@ void handleFlcEvent(byte numero_del_evento) {
if ((numerovuelta == 1) && (framecontador == 3)) {
putImg(0, 0, punterofondofrase);
drawText(5, 1,
- animMessages_ES[115],
- animMessages_ES[116],
- animMessages_ES[117],
- animMessages_ES[118],
- animMessages_ES[119],
+ messages[115],
+ messages[116],
+ messages[117],
+ messages[118],
+ messages[119],
255, 0);
}
break;
@@ -403,11 +406,11 @@ void handleFlcEvent(byte numero_del_evento) {
if ((numerovuelta == 1) && (framecontador == 3)) {
putImg(0, 0, punterofondofrase);
drawText(5, 1,
- animMessages_ES[120],
- animMessages_ES[121],
- animMessages_ES[122],
- animMessages_ES[123],
- animMessages_ES[124],
+ messages[120],
+ messages[121],
+ messages[122],
+ messages[123],
+ messages[124],
255, 249);
}
break;
@@ -415,11 +418,11 @@ void handleFlcEvent(byte numero_del_evento) {
if ((numerovuelta == 1) && (framecontador == 3)) {
putImg(0, 0, punterofondofrase);
drawText(5, 1,
- animMessages_ES[125],
- animMessages_ES[126],
- animMessages_ES[127],
- animMessages_ES[128],
- animMessages_ES[129],
+ messages[125],
+ messages[126],
+ messages[127],
+ messages[128],
+ messages[129],
255, 0);
}
break;
@@ -427,11 +430,11 @@ void handleFlcEvent(byte numero_del_evento) {
if ((numerovuelta == 1) && (framecontador == 3)) {
putImg(0, 0, punterofondofrase);
drawText(5, 1,
- animMessages_ES[130],
- animMessages_ES[131],
- animMessages_ES[132],
- animMessages_ES[133],
- animMessages_ES[134],
+ messages[130],
+ messages[131],
+ messages[132],
+ messages[133],
+ messages[134],
255, 249);
}
break;
@@ -439,11 +442,11 @@ void handleFlcEvent(byte numero_del_evento) {
if ((numerovuelta == 1) && (framecontador == 3)) {
putImg(0, 0, punterofondofrase);
drawText(5, 1,
- animMessages_ES[135],
- animMessages_ES[136],
- animMessages_ES[137],
- animMessages_ES[138],
- animMessages_ES[139],
+ messages[135],
+ messages[136],
+ messages[137],
+ messages[138],
+ messages[139],
255, 0);
}
break;
@@ -451,11 +454,11 @@ void handleFlcEvent(byte numero_del_evento) {
if ((numerovuelta == 1) && (framecontador == 3)) {
putImg(0, 0, punterofondofrase);
drawText(5, 1,
- animMessages_ES[140],
- animMessages_ES[141],
- animMessages_ES[142],
- animMessages_ES[143],
- animMessages_ES[144],
+ messages[140],
+ messages[141],
+ messages[142],
+ messages[143],
+ messages[144],
255, 249);
}
break;
@@ -463,11 +466,11 @@ void handleFlcEvent(byte numero_del_evento) {
if ((numerovuelta == 1) && (framecontador == 3)) {
putImg(0, 0, punterofondofrase);
drawText(5, 1,
- animMessages_ES[145],
- animMessages_ES[146],
- animMessages_ES[147],
- animMessages_ES[148],
- animMessages_ES[149],
+ messages[145],
+ messages[146],
+ messages[147],
+ messages[148],
+ messages[149],
255, 0);
}
break;
@@ -475,11 +478,11 @@ void handleFlcEvent(byte numero_del_evento) {
if ((numerovuelta == 1) && (framecontador == 3)) {
putImg(0, 0, punterofondofrase);
drawText(5, 1,
- animMessages_ES[150],
- animMessages_ES[151],
- animMessages_ES[152],
- animMessages_ES[153],
- animMessages_ES[154],
+ messages[150],
+ messages[151],
+ messages[152],
+ messages[153],
+ messages[154],
255, 249);
}
break;
@@ -487,11 +490,11 @@ void handleFlcEvent(byte numero_del_evento) {
if ((numerovuelta == 1) && (framecontador == 3)) {
putImg(0, 0, punterofondofrase);
drawText(5, 1,
- animMessages_ES[155],
- animMessages_ES[156],
- animMessages_ES[157],
- animMessages_ES[158],
- animMessages_ES[159],
+ messages[155],
+ messages[156],
+ messages[157],
+ messages[158],
+ messages[159],
255, 0);
}
break;
@@ -499,11 +502,11 @@ void handleFlcEvent(byte numero_del_evento) {
if ((numerovuelta == 1) && (framecontador == 3)) {
putImg(0, 0, punterofondofrase);
drawText(5, 1,
- animMessages_ES[160],
- animMessages_ES[161],
- animMessages_ES[162],
- animMessages_ES[163],
- animMessages_ES[164],
+ messages[160],
+ messages[161],
+ messages[162],
+ messages[163],
+ messages[164],
255, 249);
}
break;
@@ -524,22 +527,22 @@ void handleFlcEvent(byte numero_del_evento) {
if ((numerovuelta == 1) && (framecontador == 3)) {
putImg(0, 0, punterofondofrase);
drawText(5, 1,
- animMessages_ES[165],
- animMessages_ES[166],
- animMessages_ES[167],
- animMessages_ES[168],
- animMessages_ES[169],
+ messages[165],
+ messages[166],
+ messages[167],
+ messages[168],
+ messages[169],
255, 0);
}
break;
case 19:
if (framecontador == 1)
drawText(5, 121,
- animMessages_ES[170],
- animMessages_ES[171],
- animMessages_ES[172],
- animMessages_ES[173],
- animMessages_ES[174],
+ messages[170],
+ messages[171],
+ messages[172],
+ messages[173],
+ messages[174],
253, 249);
break;
case 20:
@@ -551,11 +554,11 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 3:
drawText(15, 1,
- animMessages_ES[175],
- animMessages_ES[176],
- animMessages_ES[177],
- animMessages_ES[178],
- animMessages_ES[179],
+ messages[175],
+ messages[176],
+ messages[177],
+ messages[178],
+ messages[179],
255, 0);
break;
}
@@ -567,11 +570,11 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 3:
drawText(15, 1,
- animMessages_ES[180],
- animMessages_ES[181],
- animMessages_ES[182],
- animMessages_ES[183],
- animMessages_ES[184],
+ messages[180],
+ messages[181],
+ messages[182],
+ messages[183],
+ messages[184],
230, 249);
break;
}
@@ -583,11 +586,11 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 3:
drawText(15, 1,
- animMessages_ES[185],
- animMessages_ES[186],
- animMessages_ES[187],
- animMessages_ES[188],
- animMessages_ES[189],
+ messages[185],
+ messages[186],
+ messages[187],
+ messages[188],
+ messages[189],
230, 249);
break;
}
@@ -599,11 +602,11 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 3:
drawText(15, 1,
- animMessages_ES[190],
- animMessages_ES[191],
- animMessages_ES[192],
- animMessages_ES[193],
- animMessages_ES[194],
+ messages[190],
+ messages[191],
+ messages[192],
+ messages[193],
+ messages[194],
230, 249);
break;
}
@@ -615,11 +618,11 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 3:
drawText(15, 1,
- animMessages_ES[195],
- animMessages_ES[196],
- animMessages_ES[197],
- animMessages_ES[198],
- animMessages_ES[199],
+ messages[195],
+ messages[196],
+ messages[197],
+ messages[198],
+ messages[199],
230, 249);
break;
}
@@ -631,11 +634,11 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 3:
drawText(15, 1,
- animMessages_ES[200],
- animMessages_ES[201],
- animMessages_ES[202],
- animMessages_ES[203],
- animMessages_ES[204],
+ messages[200],
+ messages[201],
+ messages[202],
+ messages[203],
+ messages[204],
230, 249);
break;
}
@@ -647,11 +650,11 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 3:
drawText(15, 1,
- animMessages_ES[205],
- animMessages_ES[206],
- animMessages_ES[207],
- animMessages_ES[208],
- animMessages_ES[209],
+ messages[205],
+ messages[206],
+ messages[207],
+ messages[208],
+ messages[209],
230, 249);
break;
}
@@ -663,11 +666,11 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 3:
drawText(15, 1,
- animMessages_ES[210],
- animMessages_ES[211],
- animMessages_ES[212],
- animMessages_ES[213],
- animMessages_ES[214],
+ messages[210],
+ messages[211],
+ messages[212],
+ messages[213],
+ messages[214],
230, 249);
break;
}
@@ -679,11 +682,11 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 3:
drawText(15, 1,
- animMessages_ES[215],
- animMessages_ES[216],
- animMessages_ES[217],
- animMessages_ES[218],
- animMessages_ES[219],
+ messages[215],
+ messages[216],
+ messages[217],
+ messages[218],
+ messages[219],
230, 249);
break;
}
@@ -695,11 +698,11 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 3:
drawText(15, 1,
- animMessages_ES[220],
- animMessages_ES[221],
- animMessages_ES[222],
- animMessages_ES[223],
- animMessages_ES[224],
+ messages[220],
+ messages[221],
+ messages[222],
+ messages[223],
+ messages[224],
230, 249);
break;
}
@@ -711,11 +714,11 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 3:
drawText(15, 1,
- animMessages_ES[225],
- animMessages_ES[226],
- animMessages_ES[227],
- animMessages_ES[228],
- animMessages_ES[229],
+ messages[225],
+ messages[226],
+ messages[227],
+ messages[228],
+ messages[229],
230, 249);
break;
}
@@ -767,11 +770,11 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 3:
drawText(65, 1,
- animMessages_ES[230],
- animMessages_ES[231],
- animMessages_ES[232],
- animMessages_ES[233],
- animMessages_ES[234],
+ messages[230],
+ messages[231],
+ messages[232],
+ messages[233],
+ messages[234],
253, 249);
break;
}
@@ -783,11 +786,11 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 2:
drawText(65, 1,
- animMessages_ES[235],
- animMessages_ES[236],
- animMessages_ES[237],
- animMessages_ES[238],
- animMessages_ES[239],
+ messages[235],
+ messages[236],
+ messages[237],
+ messages[238],
+ messages[239],
253, 249);
break;
}
@@ -799,11 +802,11 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 2:
drawText(65, 1,
- animMessages_ES[240],
- animMessages_ES[241],
- animMessages_ES[242],
- animMessages_ES[243],
- animMessages_ES[244],
+ messages[240],
+ messages[241],
+ messages[242],
+ messages[243],
+ messages[244],
253, 249);
break;
}
@@ -815,11 +818,11 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 2:
drawText(65, 1,
- animMessages_ES[245],
- animMessages_ES[246],
- animMessages_ES[247],
- animMessages_ES[248],
- animMessages_ES[249],
+ messages[245],
+ messages[246],
+ messages[247],
+ messages[248],
+ messages[249],
253, 249);
break;
}
diff --git a/engines/tot/dialog.cpp b/engines/tot/dialog.cpp
index b731cd7d1d0..953c9c00c4a 100644
--- a/engines/tot/dialog.cpp
+++ b/engines/tot/dialog.cpp
@@ -268,8 +268,7 @@ void findDialogLine(byte persona) {
auxTree = parent(auxTree);
else
break;
- } while (!((auxTree->element.dicho == '1') &&
- (rightSibling(auxTree) != NULL)));
+ } while (!((auxTree->element.dicho == '1') && (rightSibling(auxTree) != NULL)));
if (rightSibling(auxTree) != NULL)
auxTree = rightSibling(auxTree);
else
diff --git a/engines/tot/font/bgifont.cpp b/engines/tot/font/bgifont.cpp
index cb88f9c3bc3..47fbb142005 100644
--- a/engines/tot/font/bgifont.cpp
+++ b/engines/tot/font/bgifont.cpp
@@ -144,7 +144,7 @@ BgiFont::CachedFont *BgiFont::drawCachedFont(int size) {
for (int j = 0; j < _glyphs[i].insts.size(); j++) {
int opCode = _glyphs[i].insts[j]->opCode;
- // Need to normalize Y coord because the stroke instructions start at origin and extend upwards up ti originAscender, downwards to originToDescender
+ // Need to normalize Y coord because the stroke instructions start at origin and extend upwards up to originAscender, downwards to originToDescender
int adjustedY = _originToAscender - _glyphs[i].insts[j]->yCoord;
switch (opCode) {
diff --git a/engines/tot/graphman.cpp b/engines/tot/graphman.cpp
index 23709b00e62..1634367e733 100644
--- a/engines/tot/graphman.cpp
+++ b/engines/tot/graphman.cpp
@@ -25,6 +25,7 @@
#include "tot/font/biosfont.h"
#include "tot/graphman.h"
+#include "tot/offsets.h"
#include "tot/tot.h"
namespace Tot {
@@ -38,11 +39,18 @@ GraphicsManager::GraphicsManager() {
if (!exeFile.open(Common::Path("TOT.EXE"))) {
error("Could not open executable file!");
}
- exeFile.seek(FONT_LITT_OFFSET_ES);
- // exeFile.seek(FONT_LITT_OFFSET_EN);
+
+ if (g_engine->_lang == Common::ES_ESP) {
+ exeFile.seek(FONT_LITT_OFFSET_ES);
+ } else {
+ exeFile.seek(FONT_LITT_OFFSET_EN);
+ }
_litt.loadChr(exeFile);
- exeFile.seek(FONT_EURO_OFFSET_ES);
- // exeFile.seek(FONT_EURO_OFFSET_EN);
+ if (g_engine->_lang == Common::ES_ESP) {
+ exeFile.seek(FONT_EURO_OFFSET_ES);
+ } else {
+ exeFile.seek(FONT_EURO_OFFSET_EN);
+ }
_euro.loadChr(exeFile);
exeFile.close();
_bios = new BiosFont();
diff --git a/engines/tot/graphman.h b/engines/tot/graphman.h
index 849e706a8a5..6e839f4d0dc 100644
--- a/engines/tot/graphman.h
+++ b/engines/tot/graphman.h
@@ -56,11 +56,6 @@ public:
private:
signed char datosfundido[256][256];
-
- const int FONT_LITT_OFFSET_ES = 153584;
- const int FONT_EURO_OFFSET_ES = 159681;
- const int FONT_LITT_OFFSET_EN = 153010;
- const int FONT_EURO_OFFSET_EN = 159107;
};
} // End of namespace Tot
diff --git a/engines/tot/offsets.h b/engines/tot/offsets.h
new file mode 100644
index 00000000000..164b0f8b09f
--- /dev/null
+++ b/engines/tot/offsets.h
@@ -0,0 +1,53 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+#include "common/scummsys.h"
+
+
+namespace Tot {
+
+ const int FONT_LITT_OFFSET_ES = 153584;
+ const int FONT_EURO_OFFSET_ES = 159681;
+ const int FONT_LITT_OFFSET_EN = 153010;
+ const int FONT_EURO_OFFSET_EN = 159107;
+
+ static const long menuOffsets_ES[8][2] = {
+ {0, 16004},
+ {16004, 24535},
+ {40539, 24535},
+ {65074, 26745},
+ {91819, 16004},
+ {107823, 24535},
+ {132358, 14969},
+ {147327, 7148},
+ };
+
+ static const long menuOffsets_EN[8][2] = {
+ {0, 16004},
+ {16004, 24535},
+ {40539, 24535},
+ {65074, 26745},
+ {91819, 16004},
+ {107823, 24535},
+ {132358, 14417},
+ {146775, 7148},
+ };
+
+} // End of namespace Tot
diff --git a/engines/tot/playanim.cpp b/engines/tot/playanim.cpp
index c81098556fa..077bf51f1f8 100644
--- a/engines/tot/playanim.cpp
+++ b/engines/tot/playanim.cpp
@@ -725,9 +725,6 @@ void initPlayAnim() {
}
void clearVars() {
- if(pasoanimado != NULL) {
- free(pasoanimado);
- }
if(background != NULL) {
free(background);
}
diff --git a/engines/tot/playanim.h b/engines/tot/playanim.h
index f8b35dcf041..3cd720113f8 100644
--- a/engines/tot/playanim.h
+++ b/engines/tot/playanim.h
@@ -638,7 +638,7 @@ extern uint currentRoomNumber;
extern bool isLoadingFromLauncher;
-extern bool saveAllowed = false;
+extern bool saveAllowed;
void initializeScreenFile();
void clearObj();
diff --git a/engines/tot/routines.cpp b/engines/tot/routines.cpp
index cd09ee7dcfc..a84fce129af 100644
--- a/engines/tot/routines.cpp
+++ b/engines/tot/routines.cpp
@@ -3659,26 +3659,26 @@ void action() {
Common::String actionLine;
switch (numeroaccion) {
case 0:
- actionLine = actionLine_ES[0];
+ actionLine = getActionLineText(0);
break;
case 1:
- actionLine = actionLine_ES[1];
+ actionLine = getActionLineText(1);
break;
case 2:
- actionLine = actionLine_ES[2];
+ actionLine = getActionLineText(2);
break;
case 3:
- actionLine = actionLine_ES[3];
+ actionLine = getActionLineText(3);
break;
case 4: {
- actionLine = actionLine_ES[4];
+ actionLine = getActionLineText(4);
objetomochila = "";
} break;
case 5:
- actionLine = actionLine_ES[5];
+ actionLine = getActionLineText(5);
break;
case 6:
- actionLine = actionLine_ES[6];
+ actionLine = getActionLineText(6);
break;
}
actionLineText(actionLine);
@@ -3690,7 +3690,7 @@ void handleAction(byte posinv) {
switch (numeroaccion) {
case 1: {
g_engine->_mouseManager->hide();
- actionLineText(actionLine_ES[1] + mobj[posinv].objectName);
+ actionLineText(getActionLineText(1) + mobj[posinv].objectName);
g_engine->_mouseManager->show();
drawText((Random(10) + 1039));
numeroaccion = 0;
@@ -3702,7 +3702,7 @@ void handleAction(byte posinv) {
} break;
case 2: {
g_engine->_mouseManager->hide();
- actionLineText(actionLine_ES[2] + mobj[posinv].objectName);
+ actionLineText(getActionLineText(2) + mobj[posinv].objectName);
if (contadorpc2 > 13)
showError(274);
g_engine->_mouseManager->show();
@@ -3714,7 +3714,7 @@ void handleAction(byte posinv) {
} break;
case 3: {
g_engine->_mouseManager->hide();
- actionLineText(actionLine_ES[3] + mobj[posinv].objectName);
+ actionLineText(getActionLineText(3) + mobj[posinv].objectName);
g_engine->_mouseManager->show();
numeroaccion = 0;
lookInventoryObject(posinv);
@@ -3725,7 +3725,7 @@ void handleAction(byte posinv) {
case 4:
if (objetomochila == "") {
g_engine->_mouseManager->hide();
- actionLineText(actionLine_ES[4] + mobj[posinv].objectName + actionLine_ES[7]);
+ actionLineText(getActionLineText(4) + mobj[posinv].objectName + getActionLineText(7));
g_engine->_mouseManager->show();
objetomochila = mobj[posinv].objectName;
codigoobjmochila = mobj[posinv].code;
@@ -3742,7 +3742,7 @@ void handleAction(byte posinv) {
break;
case 5: {
g_engine->_mouseManager->hide();
- actionLineText(actionLine_ES[5] + mobj[posinv].objectName);
+ actionLineText(getActionLineText(5) + mobj[posinv].objectName);
g_engine->_mouseManager->show();
drawText(Random(9) + 1059);
numeroaccion = 0;
@@ -3752,7 +3752,7 @@ void handleAction(byte posinv) {
} break;
case 6: {
g_engine->_mouseManager->hide();
- actionLineText(actionLine_ES[6] + mobj[posinv].objectName);
+ actionLineText(getActionLineText(6) + mobj[posinv].objectName);
g_engine->_mouseManager->show();
drawText(Random(10) + 1068);
numeroaccion = 0;
@@ -4882,25 +4882,27 @@ void wcScene() {
partialFadeOut(234);
- outtextxy(10, 20, fullScreenMessages_ES[45], 253);
+ const char *const *messages = (g_engine->_lang == Common::ES_ESP) ? fullScreenMessages[0] : fullScreenMessages[1];
+
+ outtextxy(10, 20, messages[45], 253);
delay(1000);
bar(10, 20, 150, 30, 0);
delay(2000);
- outtextxy(100, 50, fullScreenMessages_ES[46], 255);
+ outtextxy(100, 50, messages[46], 255);
delay(1000);
bar(100, 50, 250, 60, 0);
delay(2000);
- outtextxy(30, 110, fullScreenMessages_ES[47], 253);
+ outtextxy(30, 110, messages[47], 253);
delay(1000);
bar(30, 110, 210, 120, 0);
delay(3000);
- outtextxy(50, 90, fullScreenMessages_ES[48], 248);
+ outtextxy(50, 90, messages[48], 248);
delay(1000);
playVoc("WATER", 272050, 47062);
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
index a5f1f4f27d0..a058250e3ea 100644
--- a/engines/tot/routines2.cpp
+++ b/engines/tot/routines2.cpp
@@ -27,6 +27,7 @@
#include "graphics/paletteman.h"
#include "graphics/surface.h"
+#include "tot/offsets.h"
#include "tot/routines.h"
#include "tot/routines2.h"
#include "tot/texts.h"
@@ -353,6 +354,7 @@ void freeAnimation() {
if (animacion2) {
animacion2 = false;
free(pasoanimado);
+ pasoanimado = NULL;
}
}
@@ -489,7 +491,7 @@ void readItemRegister(uint itemPosition) {
void drawLookAtItem(RoomObjectListEntry obj) {
g_engine->_mouseManager->hide();
bar(0, 140, 319, 149, 0);
- actionLineText(Common::String("MIRAR ") + obj.objectName);
+ actionLineText(getActionLineText(3) + obj.objectName);
g_engine->_mouseManager->show();
}
@@ -592,56 +594,43 @@ void drawMenu(byte nummenu) {
showError(258);
}
+ posicionmenu = g_engine->_lang == Common::ES_ESP ? menuOffsets_ES[nummenu - 1][0] : menuOffsets_EN[nummenu - 1][0];
+ tampunteromenu = g_engine->_lang == Common::ES_ESP ? menuOffsets_ES[nummenu - 1][1] : menuOffsets_EN[nummenu - 1][1];
+
switch (nummenu) {
case 1: {
- tampunteromenu = 16004;
- posicionmenu = 0;
xmenu = 0;
ymenu = 150;
} break;
case 2: {
- tampunteromenu = 24535;
- posicionmenu = 16004;
xmenu = 50;
ymenu = 10;
} break;
case 3: {
- tampunteromenu = 24535;
- posicionmenu = 40539;
xmenu = 50;
ymenu = 10;
} break;
case 4: {
if (contadorpc2 > 20)
showError(274);
- tampunteromenu = 26745;
- posicionmenu = 65074;
xmenu = 50;
ymenu = 10;
} break;
case 5: {
if (contadorpc > 23)
showError(274);
- tampunteromenu = 16004;
- posicionmenu = 91819;
xmenu = 0;
ymenu = 150;
} break;
case 6: {
- tampunteromenu = 24535;
- posicionmenu = 107823;
xmenu = 50;
ymenu = 10;
} break;
case 7: {
- tampunteromenu = 14969;
- posicionmenu = 132358;
xmenu = 58;
ymenu = 48;
} break;
case 8: {
- tampunteromenu = 7148;
- posicionmenu = 147327;
xmenu = 84;
ymenu = 34;
} break;
@@ -710,25 +699,26 @@ static void loadDiploma(Common::String &nombrefoto, Common::String &clave) {
clave.append(passArray, passArray + 10);
- outtextxyBios(91, 16, fullScreenMessages_ES[49] + clave, 255);
- outtextxyBios(90, 15, fullScreenMessages_ES[49] + clave, 13);
+ const char *const *messages = (g_engine->_lang == Common::ES_ESP) ? fullScreenMessages[0] : fullScreenMessages[1];
+ outtextxyBios(91, 16, messages[49] + clave, 255);
+ outtextxyBios(90, 15, messages[49] + clave, 13);
- outtextxyBios(81, 61, fullScreenMessages_ES[50], 0);
- outtextxyBios(61, 81, fullScreenMessages_ES[51], 0);
- outtextxyBios(31, 101, fullScreenMessages_ES[52] + nombrepersonaje, 0);
- outtextxyBios(31, 121, fullScreenMessages_ES[53], 0);
- outtextxyBios(31, 141, fullScreenMessages_ES[54], 0);
- outtextxyBios(31, 161, fullScreenMessages_ES[55], 0);
+ outtextxyBios(81, 61, messages[50], 0);
+ outtextxyBios(61, 81, messages[51], 0);
+ outtextxyBios(31, 101, messages[52] + nombrepersonaje, 0);
+ outtextxyBios(31, 121, messages[53], 0);
+ outtextxyBios(31, 141, messages[54], 0);
+ outtextxyBios(31, 161, messages[55], 0);
- outtextxyBios(80, 60, fullScreenMessages_ES[50], 15);
- outtextxyBios(60, 80, fullScreenMessages_ES[51], 15);
- outtextxyBios(30, 100, fullScreenMessages_ES[52], 15);
+ outtextxyBios(80, 60, messages[50], 15);
+ outtextxyBios(60, 80, messages[51], 15);
+ outtextxyBios(30, 100, messages[52], 15);
outtextxyBios(150, 100, nombrepersonaje, 13);
- outtextxyBios(30, 120, fullScreenMessages_ES[53], 15);
- outtextxyBios(30, 140, fullScreenMessages_ES[54], 15);
- outtextxyBios(30, 160, fullScreenMessages_ES[55], 15);
+ outtextxyBios(30, 120, messages[53], 15);
+ outtextxyBios(30, 140, messages[54], 15);
+ outtextxyBios(30, 160, messages[55], 15);
delay(1500);
playVoc("PORTAZO", 434988, 932);
// putShape(270, 161, (byte *)sello);
@@ -807,31 +797,31 @@ void checkMouseGrid() {
Common::String actionLine;
switch (numeroaccion) {
case 0:
- actionLine = actionLine_ES[0] + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
+ actionLine = getActionLineText(0) + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
break;
case 1:
- actionLine = actionLine_ES[1] + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
+ actionLine = getActionLineText(1) + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
break;
case 2:
- actionLine = actionLine_ES[2] + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
+ actionLine = getActionLineText(2) + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
break;
case 3:
- actionLine = actionLine_ES[3] + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
+ actionLine = getActionLineText(3) + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
break;
case 4:
if (objetomochila != "")
- actionLine = actionLine_ES[4] + objetomochila + actionLine_ES[7] + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
+ actionLine = getActionLineText(4) + objetomochila + getActionLineText(7) + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
else
- actionLine = actionLine_ES[4] + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
+ actionLine = getActionLineText(4) + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
break;
case 5:
- actionLine = actionLine_ES[5] + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
+ actionLine = getActionLineText(5) + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
break;
case 6:
- actionLine = actionLine_ES[6] + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
+ actionLine = getActionLineText(6) + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
break;
default:
- actionLine = actionLine_ES[0] + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
+ actionLine = getActionLineText(0) + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
}
actionLineText(actionLine);
g_engine->_mouseManager->show();
@@ -846,28 +836,28 @@ void checkMouseGrid() {
Common::String actionLine;
switch (numeroaccion) {
case 0:
- actionLine = actionLine_ES[0];
+ actionLine = getActionLineText(0);
break;
case 1:
- actionLine = actionLine_ES[1];
+ actionLine = getActionLineText(1);
break;
case 2:
- actionLine = actionLine_ES[2];
+ actionLine = getActionLineText(2);
break;
case 3:
- actionLine = actionLine_ES[3];
+ actionLine = getActionLineText(3);
break;
case 4:
if (objetomochila != "")
- actionLine = actionLine_ES[4] + objetomochila + actionLine_ES[7];
+ actionLine = getActionLineText(4) + objetomochila + getActionLineText(7);
else
- actionLine = actionLine_ES[4];
+ actionLine = getActionLineText(4);
break;
case 5:
- actionLine = actionLine_ES[5];
+ actionLine = getActionLineText(5);
break;
case 6:
- actionLine = actionLine_ES[6];
+ actionLine = getActionLineText(6);
break;
}
actionLineText(actionLine);
@@ -899,25 +889,25 @@ void checkMouseGrid() {
Common::String actionLine;
switch (numeroaccion) {
case 1:
- actionLine = actionLine_ES[1] + objmochila;
+ actionLine = getActionLineText(1) + objmochila;
break;
case 2:
- actionLine = actionLine_ES[2] + objmochila;
+ actionLine = getActionLineText(2) + objmochila;
break;
case 3:
- actionLine = actionLine_ES[3] + objmochila;
+ actionLine = getActionLineText(3) + objmochila;
break;
case 4:
if (objetomochila == "")
- actionLine = actionLine_ES[4] + objmochila;
+ actionLine = getActionLineText(4) + objmochila;
else
- actionLine = actionLine_ES[4] + objetomochila + actionLine_ES[7] + objmochila;
+ actionLine = getActionLineText(4) + objetomochila + getActionLineText(7) + objmochila;
break;
case 5:
- actionLine = actionLine_ES[5] + objmochila;
+ actionLine = getActionLineText(5) + objmochila;
break;
case 6:
- actionLine = actionLine_ES[6] + objmochila;
+ actionLine = getActionLineText(6) + objmochila;
break;
default:
outtextxy(160, 144, objmochila, 255, true, Graphics::kTextAlignCenter);
@@ -1770,6 +1760,7 @@ void introduction() {
g_engine->_mouseManager->hide();
bool pulsada_salida;
uint contadorvueltas;
+ const char *const *messages = (g_engine->_lang == Common::ES_ESP) ? fullScreenMessages[0] : fullScreenMessages[1];
pulsada_salida = false;
totalFadeOut(0);
@@ -1789,15 +1780,15 @@ void introduction() {
totalFadeOut(0);
cleardevice();
- outtextxy(25, 20, fullScreenMessages_ES[0], 253);
- outtextxy(25, 35, fullScreenMessages_ES[1], 253);
- outtextxy(25, 50, fullScreenMessages_ES[2], 253);
- outtextxy(25, 65, fullScreenMessages_ES[3], 253);
- outtextxy(25, 80, fullScreenMessages_ES[4], 253);
- outtextxy(25, 95, fullScreenMessages_ES[5], 253);
- outtextxy(25, 120, fullScreenMessages_ES[6], 253);
- outtextxy(25, 140, fullScreenMessages_ES[7], 253);
- outtextxy(25, 155, fullScreenMessages_ES[8], 253);
+ outtextxy(25, 20, messages[0], 253);
+ outtextxy(25, 35, messages[1], 253);
+ outtextxy(25, 50, messages[2], 253);
+ outtextxy(25, 65, messages[3], 253);
+ outtextxy(25, 80, messages[4], 253);
+ outtextxy(25, 95, messages[5], 253);
+ outtextxy(25, 120, messages[6], 253);
+ outtextxy(25, 140, messages[7], 253);
+ outtextxy(25, 155, messages[8], 253);
totalFadeIn(0, "DEFAULT");
g_engine->_screen->markAllDirty();
g_engine->_screen->update();
@@ -2359,6 +2350,8 @@ void sacrificeScene() {
saveAllowed = false;
palette palaux;
+ const char *const *messages = (g_engine->_lang == Common::ES_ESP) ? fullScreenMessages[0] : fullScreenMessages[1];
+
stopVoc();
bool pulsada_salida = currentRoomData->paletteAnimationFlag;
currentRoomData->paletteAnimationFlag = false;
@@ -2366,11 +2359,11 @@ void sacrificeScene() {
bar(0, 139, 319, 149, 0);
bar(10, 10, 300, 120, 0);
- outtextxy(10, 10, fullScreenMessages_ES[9], 200);
- outtextxy(10, 30, fullScreenMessages_ES[10], 200);
- outtextxy(10, 50, fullScreenMessages_ES[11], 200);
- outtextxy(10, 70, fullScreenMessages_ES[12], 200);
- outtextxy(10, 90, fullScreenMessages_ES[13], 200);
+ outtextxy(10, 10, messages[9], 200);
+ outtextxy(10, 30, messages[10], 200);
+ outtextxy(10, 50, messages[11], 200);
+ outtextxy(10, 70, messages[12], 200);
+ outtextxy(10, 90, messages[13], 200);
for (int i = 0; i <= 28; i++)
setRGBPalette(200, i * 2, i * 2, i * 2);
@@ -2383,11 +2376,11 @@ void sacrificeScene() {
setRGBPalette(200, i * 2, i * 2, i * 2);
bar(10, 10, 300, 120, 0);
- outtextxy(10, 10, fullScreenMessages_ES[14], 200);
- outtextxy(10, 30, fullScreenMessages_ES[15], 200);
- outtextxy(10, 50, fullScreenMessages_ES[16], 200);
- outtextxy(10, 70, fullScreenMessages_ES[17], 200);
- outtextxy(10, 90, fullScreenMessages_ES[18], 200);
+ outtextxy(10, 10, messages[14], 200);
+ outtextxy(10, 30, messages[15], 200);
+ outtextxy(10, 50, messages[16], 200);
+ outtextxy(10, 70, messages[17], 200);
+ outtextxy(10, 90, messages[18], 200);
for (int i = 0; i <= 28; i++)
setRGBPalette(200, i * 2, i * 2, i * 2);
@@ -2399,10 +2392,10 @@ void sacrificeScene() {
setRGBPalette(200, i * 2, i * 2, i * 2);
bar(10, 10, 300, 120, 0);
- outtextxy(10, 10, fullScreenMessages_ES[19], 200);
- outtextxy(10, 50, fullScreenMessages_ES[20] , 200);
- outtextxy(10, 70, fullScreenMessages_ES[21] , 200);
- outtextxy(10, 90, fullScreenMessages_ES[22], 200);
+ outtextxy(10, 10, messages[19], 200);
+ outtextxy(10, 50, messages[20] , 200);
+ outtextxy(10, 70, messages[21] , 200);
+ outtextxy(10, 90, messages[22], 200);
for (int i = 0; i <= 28; i++)
setRGBPalette(200, i * 2, i * 2, i * 2);
@@ -2451,24 +2444,24 @@ void sacrificeScene() {
restoreMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
clear();
- outtextxy(10, 31, fullScreenMessages_ES[23], 254);
- outtextxy(10, 29, fullScreenMessages_ES[23], 254);
- outtextxy(11, 30, fullScreenMessages_ES[23], 254);
- outtextxy(9, 30, fullScreenMessages_ES[23], 254);
+ outtextxy(10, 31, messages[23], 254);
+ outtextxy(10, 29, messages[23], 254);
+ outtextxy(11, 30, messages[23], 254);
+ outtextxy(9, 30, messages[23], 254);
- outtextxy(10, 51, fullScreenMessages_ES[24], 254);
- outtextxy(10, 49, fullScreenMessages_ES[24], 254);
- outtextxy(11, 50, fullScreenMessages_ES[24], 254);
- outtextxy(9, 50, fullScreenMessages_ES[24], 254);
+ outtextxy(10, 51, messages[24], 254);
+ outtextxy(10, 49, messages[24], 254);
+ outtextxy(11, 50, messages[24], 254);
+ outtextxy(9, 50, messages[24], 254);
- outtextxy(10, 71, fullScreenMessages_ES[25], 254);
- outtextxy(10, 69, fullScreenMessages_ES[25], 254);
- outtextxy(11, 70, fullScreenMessages_ES[25], 254);
- outtextxy(9, 70, fullScreenMessages_ES[25], 254);
+ outtextxy(10, 71, messages[25], 254);
+ outtextxy(10, 69, messages[25], 254);
+ outtextxy(11, 70, messages[25], 254);
+ outtextxy(9, 70, messages[25], 254);
- outtextxy(10, 30, fullScreenMessages_ES[23], 255);
- outtextxy(10, 50, fullScreenMessages_ES[24], 255);
- outtextxy(10, 70, fullScreenMessages_ES[25], 255);
+ outtextxy(10, 30, messages[23], 255);
+ outtextxy(10, 50, messages[24], 255);
+ outtextxy(10, 70, messages[25], 255);
for (int i = 0; i < 32; i++) {
setRGBPalette(255, 32 + i, i * 2, i * 2);
@@ -2520,48 +2513,48 @@ void sacrificeScene() {
stopVoc();
clear();
- outtextxy(10, 21, fullScreenMessages_ES[26], 254);
- outtextxy(10, 19, fullScreenMessages_ES[26], 254);
- outtextxy(11, 20, fullScreenMessages_ES[26], 254);
- outtextxy(9, 20, fullScreenMessages_ES[26], 254);
-
- outtextxy(10, 41, fullScreenMessages_ES[27], 254);
- outtextxy(10, 39, fullScreenMessages_ES[27], 254);
- outtextxy(11, 40, fullScreenMessages_ES[27], 254);
- outtextxy(9, 40, fullScreenMessages_ES[27], 254);
-
- outtextxy(10, 61, fullScreenMessages_ES[28], 254);
- outtextxy(10, 59, fullScreenMessages_ES[28], 254);
- outtextxy(11, 60, fullScreenMessages_ES[28], 254);
- outtextxy(9, 60, fullScreenMessages_ES[28], 254);
-
- outtextxy(10, 81, fullScreenMessages_ES[29], 254);
- outtextxy(10, 79, fullScreenMessages_ES[29], 254);
- outtextxy(11, 80, fullScreenMessages_ES[29], 254);
- outtextxy(9, 80, fullScreenMessages_ES[29], 254);
-
- outtextxy(10, 101, fullScreenMessages_ES[30], 254);
- outtextxy(10, 99, fullScreenMessages_ES[30], 254);
- outtextxy(11, 100, fullScreenMessages_ES[30], 254);
- outtextxy(9, 100, fullScreenMessages_ES[30], 254);
-
- outtextxy(10, 121, fullScreenMessages_ES[31], 254);
- outtextxy(10, 119, fullScreenMessages_ES[31], 254);
- outtextxy(11, 120, fullScreenMessages_ES[31], 254);
- outtextxy(9, 120, fullScreenMessages_ES[31], 254);
-
- outtextxy(10, 141, fullScreenMessages_ES[32], 254);
- outtextxy(10, 139, fullScreenMessages_ES[32], 254);
- outtextxy(11, 140, fullScreenMessages_ES[32], 254);
- outtextxy(9, 140, fullScreenMessages_ES[32], 254);
-
- outtextxy(10, 20, fullScreenMessages_ES[26], 255);
- outtextxy(10, 40, fullScreenMessages_ES[27], 255);
- outtextxy(10, 60, fullScreenMessages_ES[28], 255);
- outtextxy(10, 80, fullScreenMessages_ES[29], 255);
- outtextxy(10, 100, fullScreenMessages_ES[30], 255);
- outtextxy(10, 120, fullScreenMessages_ES[31], 255);
- outtextxy(10, 140, fullScreenMessages_ES[32], 255);
+ outtextxy(10, 21, messages[26], 254);
+ outtextxy(10, 19, messages[26], 254);
+ outtextxy(11, 20, messages[26], 254);
+ outtextxy(9, 20, messages[26], 254);
+
+ outtextxy(10, 41, messages[27], 254);
+ outtextxy(10, 39, messages[27], 254);
+ outtextxy(11, 40, messages[27], 254);
+ outtextxy(9, 40, messages[27], 254);
+
+ outtextxy(10, 61, messages[28], 254);
+ outtextxy(10, 59, messages[28], 254);
+ outtextxy(11, 60, messages[28], 254);
+ outtextxy(9, 60, messages[28], 254);
+
+ outtextxy(10, 81, messages[29], 254);
+ outtextxy(10, 79, messages[29], 254);
+ outtextxy(11, 80, messages[29], 254);
+ outtextxy(9, 80, messages[29], 254);
+
+ outtextxy(10, 101, messages[30], 254);
+ outtextxy(10, 99, messages[30], 254);
+ outtextxy(11, 100, messages[30], 254);
+ outtextxy(9, 100, messages[30], 254);
+
+ outtextxy(10, 121, messages[31], 254);
+ outtextxy(10, 119, messages[31], 254);
+ outtextxy(11, 120, messages[31], 254);
+ outtextxy(9, 120, messages[31], 254);
+
+ outtextxy(10, 141, messages[32], 254);
+ outtextxy(10, 139, messages[32], 254);
+ outtextxy(11, 140, messages[32], 254);
+ outtextxy(9, 140, messages[32], 254);
+
+ outtextxy(10, 20, messages[26], 255);
+ outtextxy(10, 40, messages[27], 255);
+ outtextxy(10, 60, messages[28], 255);
+ outtextxy(10, 80, messages[29], 255);
+ outtextxy(10, 100, messages[30], 255);
+ outtextxy(10, 120, messages[31], 255);
+ outtextxy(10, 140, messages[32], 255);
for (int i = 0; i <= 31; i++) {
setRGBPalette(255, 32 + i, i * 2, i * 2);
setRGBPalette(254, 32 - i, 0, 0);
@@ -2579,48 +2572,48 @@ void sacrificeScene() {
return;
clear();
- outtextxy(10, 21, fullScreenMessages_ES[33], 254);
- outtextxy(10, 19, fullScreenMessages_ES[33], 254);
- outtextxy(11, 20, fullScreenMessages_ES[33], 254);
- outtextxy(9, 20, fullScreenMessages_ES[33], 254);
-
- outtextxy(10, 41, fullScreenMessages_ES[34], 254);
- outtextxy(10, 39, fullScreenMessages_ES[34], 254);
- outtextxy(11, 40, fullScreenMessages_ES[34], 254);
- outtextxy(9, 40, fullScreenMessages_ES[34], 254);
-
- outtextxy(10, 61, fullScreenMessages_ES[35], 254);
- outtextxy(10, 59, fullScreenMessages_ES[35], 254);
- outtextxy(11, 60, fullScreenMessages_ES[35], 254);
- outtextxy(9, 60, fullScreenMessages_ES[35], 254);
-
- outtextxy(10, 81, fullScreenMessages_ES[36], 254);
- outtextxy(10, 79, fullScreenMessages_ES[36], 254);
- outtextxy(11, 80, fullScreenMessages_ES[36], 254);
- outtextxy(9, 80, fullScreenMessages_ES[36], 254);
-
- outtextxy(10, 101, fullScreenMessages_ES[37], 254);
- outtextxy(10, 99, fullScreenMessages_ES[37], 254);
- outtextxy(11, 100, fullScreenMessages_ES[37], 254);
- outtextxy(9, 100, fullScreenMessages_ES[37], 254);
-
- outtextxy(10, 121, fullScreenMessages_ES[38], 254);
- outtextxy(10, 119, fullScreenMessages_ES[38], 254);
- outtextxy(11, 120, fullScreenMessages_ES[38], 254);
- outtextxy(9, 120, fullScreenMessages_ES[38], 254);
-
- outtextxy(10, 141, fullScreenMessages_ES[39], 254);
- outtextxy(10, 139, fullScreenMessages_ES[39], 254);
- outtextxy(11, 140, fullScreenMessages_ES[39], 254);
- outtextxy(9, 140, fullScreenMessages_ES[39], 254);
-
- outtextxy(10, 20, fullScreenMessages_ES[33], 255);
- outtextxy(10, 40, fullScreenMessages_ES[34], 255);
- outtextxy(10, 60, fullScreenMessages_ES[35], 255);
- outtextxy(10, 80, fullScreenMessages_ES[36], 255);
- outtextxy(10, 100, fullScreenMessages_ES[37], 255);
- outtextxy(10, 120, fullScreenMessages_ES[38], 255);
- outtextxy(10, 140, fullScreenMessages_ES[39], 255);
+ outtextxy(10, 21, messages[33], 254);
+ outtextxy(10, 19, messages[33], 254);
+ outtextxy(11, 20, messages[33], 254);
+ outtextxy(9, 20, messages[33], 254);
+
+ outtextxy(10, 41, messages[34], 254);
+ outtextxy(10, 39, messages[34], 254);
+ outtextxy(11, 40, messages[34], 254);
+ outtextxy(9, 40, messages[34], 254);
+
+ outtextxy(10, 61, messages[35], 254);
+ outtextxy(10, 59, messages[35], 254);
+ outtextxy(11, 60, messages[35], 254);
+ outtextxy(9, 60, messages[35], 254);
+
+ outtextxy(10, 81, messages[36], 254);
+ outtextxy(10, 79, messages[36], 254);
+ outtextxy(11, 80, messages[36], 254);
+ outtextxy(9, 80, messages[36], 254);
+
+ outtextxy(10, 101, messages[37], 254);
+ outtextxy(10, 99, messages[37], 254);
+ outtextxy(11, 100, messages[37], 254);
+ outtextxy(9, 100, messages[37], 254);
+
+ outtextxy(10, 121, messages[38], 254);
+ outtextxy(10, 119, messages[38], 254);
+ outtextxy(11, 120, messages[38], 254);
+ outtextxy(9, 120, messages[38], 254);
+
+ outtextxy(10, 141, messages[39], 254);
+ outtextxy(10, 139, messages[39], 254);
+ outtextxy(11, 140, messages[39], 254);
+ outtextxy(9, 140, messages[39], 254);
+
+ outtextxy(10, 20, messages[33], 255);
+ outtextxy(10, 40, messages[34], 255);
+ outtextxy(10, 60, messages[35], 255);
+ outtextxy(10, 80, messages[36], 255);
+ outtextxy(10, 100, messages[37], 255);
+ outtextxy(10, 120, messages[38], 255);
+ outtextxy(10, 140, messages[39], 255);
for (int i = 0; i < 32; i++) {
setRGBPalette(255, 32 + i, i * 2, i * 2);
@@ -2638,24 +2631,24 @@ void sacrificeScene() {
if (g_engine->shouldQuit())
return;
clear();
- outtextxy(10, 61, fullScreenMessages_ES[40], 254);
- outtextxy(10, 59, fullScreenMessages_ES[40], 254);
- outtextxy(11, 60, fullScreenMessages_ES[40], 254);
- outtextxy(9, 60, fullScreenMessages_ES[40], 254);
+ outtextxy(10, 61, messages[40], 254);
+ outtextxy(10, 59, messages[40], 254);
+ outtextxy(11, 60, messages[40], 254);
+ outtextxy(9, 60, messages[40], 254);
- outtextxy(10, 81, fullScreenMessages_ES[41], 254);
- outtextxy(10, 79, fullScreenMessages_ES[41], 254);
- outtextxy(11, 80, fullScreenMessages_ES[41], 254);
- outtextxy(9, 80, fullScreenMessages_ES[41], 254);
+ outtextxy(10, 81, messages[41], 254);
+ outtextxy(10, 79, messages[41], 254);
+ outtextxy(11, 80, messages[41], 254);
+ outtextxy(9, 80, messages[41], 254);
- outtextxy(10, 101, fullScreenMessages_ES[42], 254);
- outtextxy(10, 99, fullScreenMessages_ES[42], 254);
- outtextxy(11, 100, fullScreenMessages_ES[42], 254);
- outtextxy(9, 100, fullScreenMessages_ES[42], 254);
+ outtextxy(10, 101, messages[42], 254);
+ outtextxy(10, 99, messages[42], 254);
+ outtextxy(11, 100, messages[42], 254);
+ outtextxy(9, 100, messages[42], 254);
- outtextxy(10, 60, fullScreenMessages_ES[40], 255);
- outtextxy(10, 80, fullScreenMessages_ES[41], 255);
- outtextxy(10, 100, fullScreenMessages_ES[42], 255);
+ outtextxy(10, 60, messages[40], 255);
+ outtextxy(10, 80, messages[41], 255);
+ outtextxy(10, 100, messages[42], 255);
for (int i = 0; i < 32; i++) {
setRGBPalette(255, 32 + i, i * 2, i * 2);
@@ -2678,18 +2671,20 @@ void ending() {
saveAllowed = false;
bool pulsada_salida;
- outtextxy(10, 41, fullScreenMessages_ES[43], 249);
- outtextxy(10, 39, fullScreenMessages_ES[43], 249);
- outtextxy(11, 40, fullScreenMessages_ES[43], 249);
- outtextxy(9, 40, fullScreenMessages_ES[43], 249);
+ const char *const *messages = (g_engine->_lang == Common::ES_ESP) ? fullScreenMessages[0] : fullScreenMessages[1];
+
+ outtextxy(10, 41, messages[43], 249);
+ outtextxy(10, 39, messages[43], 249);
+ outtextxy(11, 40, messages[43], 249);
+ outtextxy(9, 40, messages[43], 249);
- outtextxy(10, 61, fullScreenMessages_ES[44], 249);
- outtextxy(10, 59, fullScreenMessages_ES[44], 249);
- outtextxy(11, 60, fullScreenMessages_ES[44], 249);
- outtextxy(9, 60, fullScreenMessages_ES[44], 249);
+ outtextxy(10, 61, messages[44], 249);
+ outtextxy(10, 59, messages[44], 249);
+ outtextxy(11, 60, messages[44], 249);
+ outtextxy(9, 60, messages[44], 249);
- outtextxy(10, 40, fullScreenMessages_ES[43], 253);
- outtextxy(10, 60, fullScreenMessages_ES[44], 253);
+ outtextxy(10, 40, messages[43], 253);
+ outtextxy(10, 60, messages[44], 253);
if(g_engine->shouldQuit()) {
return;
}
diff --git a/engines/tot/saveload.cpp b/engines/tot/saveload.cpp
index 262728b2087..7a6a2586399 100644
--- a/engines/tot/saveload.cpp
+++ b/engines/tot/saveload.cpp
@@ -4,24 +4,20 @@
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
- * Additional copyright for this file:
- * Copyright (C) 1995 Presto Studios, Inc.
- *
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-
#include "gui/saveload.h"
#include "common/error.h"
#include "common/savefile.h"
diff --git a/engines/tot/texts.h b/engines/tot/texts.h
index 45aa23927dd..80a6c0678a0 100644
--- a/engines/tot/texts.h
+++ b/engines/tot/texts.h
@@ -18,12 +18,18 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-namespace Tot {
-#include "common/str.h"
+#ifndef TOT_TEXTS_H
+#define TOT_TEXTS_H
+ #include "common/str.h"
#include "common/keyboard.h"
-static const char *const animMessages_ES[] = {
+namespace Tot {
+
+
+static const char *const animMessages[2][250] = {
+//Spanish
+{
"Las \xA3ltimas encuestas realizadas",
"acerca de la siniestralidad en ",
"los transportes arrojan resultados",
@@ -299,14 +305,365 @@ static const char *const animMessages_ES[] = {
"",
"",
""
+},
+//English
+{
+ "Las \xA3ltimas encuestas realizadas",
+ "acerca de la siniestralidad en ",
+ "los transportes arrojan resultados",
+ "alentadores...",
+ "",
+ // 5
+ "El cien por cien de los encuestados",
+ "declararon no haber sufrido nunca un",
+ "accidente mortal...",
+ "",
+ "",
+ // 10
+ "Es una noticia que nos anima a salir",
+ "de viaje con m\xA0s seguridad.",
+ "",
+ "",
+ "",
+ // 15
+ "\xAD\xADPor un tornillo!!...",
+ "Por un m\xA1sero y simple",
+ "tornillo del tr\xA1"
+ "fugo",
+ "del trapecio...",
+ "",
+ // 20
+ "Si lo hubiese apretado",
+ "bien, no estar\xA1"
+ "a ahora",
+ "sin trabajo...",
+ "",
+ "",
+ // 25
+ "\xAD\xADNoticia de \xA3ltima hora!!",
+ "",
+ "",
+ "",
+ "",
+ // 30
+ "Llevo sin dormir toda",
+ "la noche, pensando qu\x82",
+ "voy a hacer.",
+ "",
+ "",
+ // 35
+ "Seguramente no podr\x82",
+ "encontrar trabajo en",
+ "mucho tiempo...",
+ "Aunque ponga mucha f\x82",
+ "la oficina de empleo.",
+ // 40
+ "Y para animarme m\xA0s",
+ "todav\xAD""a, ma\xA4""ana noche",
+ "es HALLOWEEN...",
+ "",
+ "Es que tengo la negra.",
+ // 45
+ "Grave accidente en TWELVE MOTORS...",
+ "un empleado olvid\xA2 apretar un tornillo",
+ "y media cadena de montaje ha quedado",
+ "para chatarra...",
+ "las p\x82rdidas se estiman cuantiosas...",
+ // 50
+ "No se descartan las acciones legales",
+ "contra ese inconsciente...",
+ "",
+ "",
+ "",
+ // 55
+ "\xAD""Dios mio!... hasta en",
+ "la televisi\xA2n...",
+ "Seguro que hasta mi",
+ "perro encuentra curro",
+ "antes que yo...",
+ // 60
+ "\xADHORROR!...una factura",
+ "",
+ "",
+ "",
+ "",
+ // 65
+ "\xA8"
+ "Oficina de empleo?...",
+ "\xA8"
+ "y para m\xA1?...",
+ "",
+ "\xADSe habr\xA0n equivocado!", "",
+ // 70
+ "\xA8Tan pronto lograron",
+ "encontrarme trabajo?",
+ "",
+ "Claro... antes de ver",
+ "las noticias...",
+ // 75
+ "Estimado se\xA4or: Nos dirigimos a",
+ "usted para comunicarle que su",
+ "solicitud n\xA7:93435 fu\x82 aceptada",
+ "y le hemos encontrado un puesto",
+ "de acuerdo con sus aptitudes...",
+ // 80
+ "Deber\xA0 presentarse ma\xA4""ana, dia",
+ "31 de Octubre en la direcci\xA2n",
+ "abajo indicada, para ocupar el",
+ "puesto de ENCARGADO GENERAL.",
+ "",
+ //85
+ "Le adjuntamos las credenciales",
+ "de presentaci\xA2n.",
+ "Deseando no verle por aqu\xA1 en",
+ "mucho tiempo se despide:",
+ " Leonor Scott.",
+ // 90
+ "\xAD\xADQue ilu!! encargado",
+ "general... si ya me",
+ "lo decia mi madre...",
+ "<<nene tienes cara de",
+ "encargado general>>",
+ // 95
+ "Tendr\x82 que conseguir",
+ "ropa m\xA0s de acuerdo",
+ "con mi nuevo cargo.",
+ "",
+ "Manos a la obra...",
+ // 100
+ "\xADV\xA0yase!... no queremos vendedores...",
+ "y menos de planes de jubilaci\xA2n.",
+ "",
+ "",
+ "",
+ // 105
+ "No soy ning\xA3n vendedor... me envia la oficina",
+ "de empleo... tenga mis credenciales.",
+ "",
+ "",
+ "",
+ // 110
+ "\xADVaya! eres t\xA3...llegas con retraso. Los ancianos est\xA0n",
+ "esper\xA0ndote en el sal\xA2n. Debes cuidarlos muy bien.",
+ "",
+ "",
+ "",
+ // 115
+ "Lo siento, no sab\xA1""a a que hora deb\xA1""a presentarme, en",
+ "la oficina de empleo no me lo dijeron.",
+ "",
+ "",
+ "",
+ // 120
+ "Bueno... no importa... ya est\xA0s aqu\xA1.",
+ "Ese coche es tuyo \xA8no?...",
+ "",
+ "",
+ "",
+ // 125
+ "Si... es precioso \xA8verdad?...",
+ "",
+ "",
+ "",
+ "",
+ // 130
+ "Vaya... 200 caballos... elevalunas el\x82""ctricos... ",
+ "inyecci\xA2n electr\xA2nica, llantas de aleaci\xA2n...",
+ "",
+ "",
+ "",
+ // 135
+ "Pues si...",
+ "",
+ "",
+ "",
+ "",
+ // 140
+ "Airbag... asientos envolventes... aire acondicionado",
+ "",
+ "",
+ "",
+ "",
+ // 145
+ "Es el m\xA0s alto de la gama...",
+ "",
+ "",
+ "",
+ "",
+ // 150
+ "ABS, equipo de m\xA3sica con CD, estructura reforzada",
+ "indeformable, detector de radar...",
+ "",
+ "",
+ "",
+ // 155
+ "Parece que te gusta, \xA8no?", "", "", "", "",
+ // 160
+ "Bueno, no est\xA0 mal... pero... gracias de todos modos.", "", "", "", "",
+ // 165
+ "\xA8Gracias?... \xA8qu\x82?... \xAD"
+ "espera!... ese es mi coche...",
+ "",
+ "",
+ "",
+ "",
+ // 170
+ "Toma una copita, te la has ganado...", "", "", "", "",
+ // 175
+ "\xA8""Donde estoy? ... \xA8Qu\x82 me ha pasado?", "", "", "", "",
+ // 180
+ "Tranquilizate, no est\xA0s muerto...",
+ "Est\xA0s tras la puerta de acero...",
+ "",
+ "",
+ "",
+ // 185
+ "Te necesitamos para encontrar a Jacob,",
+ "nuestro Gran Maestre.",
+ "",
+ "",
+ "",
+ // 190
+ "Hace unos dias se puso a estudiar el libro",
+ "que me diste y desapareci\xA2...",
+ "",
+ "",
+ "",
+ // 195
+ "Creemos que realiz\xA2 un conjuro sin darse cuenta...",
+ "",
+ "",
+ "",
+ "",
+ // 200
+ "Por fortuna, pudimos ponernos en contacto",
+ "con \x82l, y nos dijo que est\xA0 en problemas...",
+ "",
+ "",
+ "",
+ // 205
+ "Nos pidi\xA2 que envi\xA0semos a alguien en su ayuda,",
+ "y TU eres el elegido...",
+ "",
+ "",
+ "",
+ // 210
+ "Para ir a las CAVERNAS ETERNAS debes morir...",
+ "Ning\xA3n cuerpo con alma puede estar all\xA1...",
+ "",
+ "",
+ "",
+ // 215
+ "Haremos un ritual para crear un v\xA1nculo entre tu",
+ "cuerpo y tu alma, s\xA2lo as\xA1 podr\xA0s volver a la vida...",
+ "",
+ "",
+ "",
+ // 220
+ "Si rescatas a Jacob, el v\xA1nculo te traer\xA0 de regreso...", "", "", "", "",
+ // 225
+ "Ahora... \xADPrep\xA0rate!... Ha llegado tu hora...", "", "", "", "",
+ // 230
+ "\xADGracias ILUSO!...", "", "", "", "",
+ // 235
+ "Ahora tendr\x82 un cuerpo nuevo y podr\x82",
+ "volver a la vida...",
+ "",
+ "",
+ "",
+ // 240
+ "Tu mientras tanto, puedes seguir en",
+ "las CAVERNAS ETERNAS...",
+ "",
+ "",
+ "",
+ // 245
+ "No te preocupes, seguro que nos mandan",
+ "otro encargado... JA,JA,JA...",
+ "",
+ "",
+ ""
+}
};
-static const char *const animMessages_EN[] = {
-
-};
+static const char *const fullScreenMessages[2][56] = {
+ // Spanish
+ {
+ // intro
+ " ... Despu\x82s de estar durante ocho horas",
+ "conduciendo, haberte perdido tres veces",
+ "y haber hecho doscientos kil\xA2metros de m\xA0s",
+ "llegas a una casa que se encuentra en un",
+ "paraje muy tranquilo y apartado del mundanal",
+ "ruido. (\xAD\xADY TAN APARTADO!!) ...",
+ "Pero esto no tiene importancia ... ",
+ "Hay que encarar el trabajo con una actitud",
+ "optimista y positiva...",
+ // sacrifice scene
+ // 9
+ " A pesar de todo, no lo has hecho tan mal.",
+ " Has conseguido todo lo que te pidieron, y",
+ " van a poder celebrar su fiesta de Halloween.",
+ " Es todo un detalle que t\xA3 seas el invitado",
+ " de honor...",
+ // 14
+ " Como recompensa a tus esfuerzos te mandan a",
+ " darte una vuelta por ah\xA1 mientras ellos se",
+ " encargan de los preparativos de la fiesta.",
+ " T\xA3, obviamente, aceptas de inmediato y te",
+ " vas a tomar el fresco un rato...",
+ //19
+ " Horas m\xA0s tarde... ",
+ " La fiesta ya est\xA0 preparada, regresas al",
+ " sal\xA2n a recibir tus merecidos honores, tras",
+ " un completo dia de trabajo... ",
+ // 23
+ " Despu\x82s de todo lo que hice por ellos...",
+ " Todos mis esfuerzos y desvelos para esto...",
+ " Morir envenenado, ese era mi destino...",
+ // 26
+ " Presta atenci\xA2n, pues esta puede ser la \xA3ltima",
+ " vez que hablemos contigo. Definitivamente est\xA0s",
+ " muerto, pero a\xA3n es posible reunir tu alma con",
+ " tu cuerpo, para ello debes buscar a Jacob y",
+ " liberarlo de aquello que lo retenga. Cuando lo",
+ " consigas podremos traeros a ambos de vuelta al",
+ " mundo de los vivos.",
+ // 33
+ " Pero debes darte prisa pues el v\xA1nculo con tu",
+ " cuerpo se debilita y tu alma podr\xA1""a quedar",
+ " atrapada para siempre en las Cavernas Eternas.",
+ " Si necesitaras m\xA0s energ\xA1""a de la que tienes, ",
+ " recuerda que all\xA0 donde vas un cuerpo contiene",
+ " m\xA0s energ\xA1""a que un alma al contrario que en el",
+ " mundo f\xA1sico.",
+ // 40
+ " No te demores y recuerda...",
+ " Si triunfas, el premio es la vida, si no...",
+ " LA MUERTE ETERNA.",
+ // 43
+ " Al fin lo has conseguido....",
+ " \xAD\xAD\xADSoy LIBREEEEE!!!",
+ // WC
+ // 45
+ "... MMPFFFF!! ...",
+ "... PPTRRFF!! ...",
+ "... GGNNNNN!! ...",
+ "... AAAHHHHH!! ...",
+ // Diploma
+ // 49
+ "CERTIFICADO N\xA7:",
+ "Yo, Jacob, el Gran Maestre ",
+ "de la Hermandad de Sek Umh Nejl",
+ "certifico que: ",
+ "me ha liberado de las Cavernas",
+ "Eternas, por lo cual le estar\x82 ",
+ "por siempre agradecido."
+ },
-static const char *const fullScreenMessages_ES[] = {
- // intro
+ // English
+ {
+ // intro
" ... Despu\x82s de estar durante ocho horas",
"conduciendo, haberte perdido tres veces",
"y haber hecho doscientos kil\xA2metros de m\xA0s",
@@ -376,10 +733,9 @@ static const char *const fullScreenMessages_ES[] = {
"me ha liberado de las Cavernas",
"Eternas, por lo cual le estar\x82 ",
"por siempre agradecido."
+ },
};
-static const char *const fullScreenMessages_EN[] = {
-};
static const char *const actionLine_ES[] = {
"IR A ",
@@ -403,6 +759,7 @@ static const char *const actionLine_EN[] = {
" WITH ",
};
+
static const char *const hardcodedObjects_ES[] = {
"LISTA ", // 0
"LISTA", // 1
@@ -431,43 +788,54 @@ static const char *const hardcodedObjects_EN[] = {
"FREE"
};
-inline Common::String getObjectName(int idx) {
- return hardcodedObjects_ES[idx];
-}
-
enum HOTKEYS {
- TALK,
- PICKUP,
- LOOKAT,
- USE,
- OPEN,
- CLOSE,
- YES,
- NO
+ TALK = 0,
+ PICKUP = 1,
+ LOOKAT = 2,
+ USE = 3,
+ OPEN = 4,
+ CLOSE = 5,
+ YES = 6,
+ NO = 7
};
-inline Common::KeyCode hotKeyFor(HOTKEYS hotkey) {
- switch (hotkey)
- {
- case TALK:
- return Common::KEYCODE_h;
- case PICKUP:
- return Common::KEYCODE_c;
- case LOOKAT:
- return Common::KEYCODE_m;
- case USE:
- return Common::KEYCODE_u;
- case OPEN:
- return Common::KEYCODE_a;
- case CLOSE:
- return Common::KEYCODE_e;
- case YES:
- return Common::KEYCODE_s;
- case NO:
- return Common::KEYCODE_n;
- default:
- break;
- }
-};
+static const Common::KeyCode hotkeys[2][8]{
+ // Spanish
+ {// TALK
+ Common::KEYCODE_h,
+ // PICKUP
+ Common::KEYCODE_c,
+ // LOOKAT
+ Common::KEYCODE_m,
+ // USE
+ Common::KEYCODE_u,
+ // OPEN
+ Common::KEYCODE_a,
+ // CLOSE
+ Common::KEYCODE_e,
+ // YES
+ Common::KEYCODE_s,
+ // NO
+ Common::KEYCODE_n},
+
+ // English
+ {// TALK
+ Common::KEYCODE_t,
+ // PICKUP
+ Common::KEYCODE_a,
+ // LOOKAT
+ Common::KEYCODE_l,
+ // USE
+ Common::KEYCODE_u,
+ // OPEN
+ Common::KEYCODE_o,
+ // CLOSE
+ Common::KEYCODE_c,
+ // YES
+ Common::KEYCODE_y,
+ // NO
+ Common::KEYCODE_n}
+ };
} // End of namespace Tot
+#endif
diff --git a/engines/tot/tot.cpp b/engines/tot/tot.cpp
index 164b65de7d4..82358ec84cc 100644
--- a/engines/tot/tot.cpp
+++ b/engines/tot/tot.cpp
@@ -48,6 +48,8 @@ TotEngine *g_engine;
TotEngine::TotEngine(OSystem *syst, const ADGameDescription *gameDesc) : Engine(syst),
_gameDescription(gameDesc), _randomSource("Tot") {
g_engine = this;
+
+ _lang = _gameDescription->language;
}
TotEngine::~TotEngine() {
diff --git a/engines/tot/tot.h b/engines/tot/tot.h
index 23e71342831..26e60bbac3c 100644
--- a/engines/tot/tot.h
+++ b/engines/tot/tot.h
@@ -74,6 +74,8 @@ public:
bool _showGameGrid = false;
bool _drawObjectAreas = false;
+ Common::Language _lang = Common::ES_ESP;
+
public:
TotEngine(OSystem *syst, const ADGameDescription *gameDesc);
~TotEngine() override;
diff --git a/engines/tot/util.h b/engines/tot/util.h
index 6fffe9e76af..a90c3e78e26 100644
--- a/engines/tot/util.h
+++ b/engines/tot/util.h
@@ -3,9 +3,12 @@
#include "common/endian.h"
#include "common/events.h"
+#include "common/language.h"
#include "common/scummsys.h"
#include "graphics/font.h"
+#include "engines/tot/texts.h"
+#include "engines/tot/tot.h"
namespace Tot {
@@ -55,6 +58,19 @@ inline bool odd(long i) { return i % 2 != 0; }
unsigned Random(unsigned range);
int Random(int range);
+inline Common::String getObjectName(int idx) {
+ return g_engine->_lang == Common::ES_ESP ? hardcodedObjects_ES[idx] : hardcodedObjects_EN[idx];
+}
+
+inline Common::String getActionLineText(int idx) {
+ return g_engine->_lang == Common::ES_ESP ? actionLine_ES[idx] : actionLine_EN[idx];
+}
+inline Common::KeyCode hotKeyFor(HOTKEYS hotkey) {
+ const Common::KeyCode *selectedHotkeys = (g_engine->_lang == Common::ES_ESP)? hotkeys[0]: hotkeys[1];
+ return selectedHotkeys[hotkey];
+};
+
+
} // End of namespace Tot
#endif
Commit: 4afd17a6212e58637c969ef04777a177bf6a0f10
https://github.com/scummvm/scummvm/commit/4afd17a6212e58637c969ef04777a177bf6a0f10
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:48+02:00
Commit Message:
TOT: Adds offsets for English version FLCs
Changed paths:
engines/tot/game.cpp
engines/tot/offsets.h
engines/tot/routines.cpp
engines/tot/routines2.cpp
diff --git a/engines/tot/game.cpp b/engines/tot/game.cpp
index be25840346d..52c8d7cbeba 100644
--- a/engines/tot/game.cpp
+++ b/engines/tot/game.cpp
@@ -97,7 +97,7 @@ int engine_start() {
loadPalette("DEFAULT");
loadScreenMemory();
- // initialLogo();
+ initialLogo();
playMidiFile("INTRODUC", true);
setMidiVolume(3, 3);
diff --git a/engines/tot/offsets.h b/engines/tot/offsets.h
index 164b0f8b09f..0949aa9e010 100644
--- a/engines/tot/offsets.h
+++ b/engines/tot/offsets.h
@@ -50,4 +50,84 @@ namespace Tot {
{146775, 7148},
};
+ static const long flcOffsets[2][32] = {
+ {
+ 0, //Logo
+ 837602, // Menu reveal
+ // 2 - Intro vids
+ 888366, // Tv speaks
+ 908896,
+ 972458, // opens car and gets to door
+ 1269108, // knocks on door
+ 1284784, // talks to door
+ 1299404, // doorman opens door
+ 1321354, // doorman speaks,
+ 1334608, // talks to doorman at door
+ 1349402, // doorman walks to car
+ 1463880, // doorman talks next to car
+
+ 1471630, // talks to doorman next to car
+ 1480982, // doorman opens car
+ 1500902, // doorman talks with car open
+ 1508036, // doorman leaves with car
+ 1701780, // main char speaks alone
+ // 17 Sacrifice
+ 1712400, // character drinks from cup,
+ 1783054, // prayers
+ 1806212, // sacrifice
+ // 20 Others
+ 2124896, // Use sharp scythe with statue,
+ 2216848, // change feather for scythe
+ 2209158, // Use ring with pedestal,
+ 2076280, // Use urn with altar
+ 2441804, // Sharpen scythe
+ 2361800, // Use rope with precipice
+ 2382552, // Trident with dent
+ 2464240, // Rock with mural
+ 2296092, // Press button of oven with the jar
+ 2231140, // Press button of oven with no jar
+ // 30 Ending
+ 2481274, // Part 1
+ 2554766 // Part 2
+ },
+ {
+ 0, //Logo
+ 837602, // Menu reveal
+ //Intro vids
+ 894900, // tv speaks
+ 915430,
+ 978992, // opens car and gets to door
+ 1275642, // knocks door
+ 1291318, // talks to door
+ 1305938, // doorman opens door
+ 1327888, // doorman speaks
+ 1341142, // talks to doorman at door,
+ 1355936, // doorman walks to car
+ 1470414, // doorman talks next to car
+ 1478164, // talks to doorman next to car
+ 1487516, // doorman opens car
+ 1507436, // doorman talks with car open
+ 1514570, // doorman leaves with car
+ 1708314, // main char speaks alone
+ // 17 Sacrifice
+ 1718934, // character drinks from cup
+ 1789588, // prayers
+ 1812746, // sacrifice
+ // 20 others
+ 2399068, // Use sharp scythe with statue
+ 2491020, // change feather for scythe
+ 2483330, // Use ring with pedestal
+ 2350452, // Use urn with altar
+ 2715976, // Sharpen scythe
+ 2635972, // Use rope with precipice
+ 2656724, // Trident with dent
+ 2738412, // Rock with mural
+ 2570264, // Press button of oven with the jar
+ 2505312, // Press button of oven with no jar,
+ // 30 Ending
+ 2082814, // Part 1
+ 2156306 // Part 2
+ }
+ };
+
} // End of namespace Tot
diff --git a/engines/tot/routines.cpp b/engines/tot/routines.cpp
index a84fce129af..1376beb7ace 100644
--- a/engines/tot/routines.cpp
+++ b/engines/tot/routines.cpp
@@ -22,9 +22,10 @@
#include "common/debug.h"
#include "common/endian.h"
-#include "tot/routines.h"
-#include "tot/texts.h"
-#include "tot/tot.h"
+#include "engines/tot/offsets.h"
+#include "engines/tot/routines.h"
+#include "engines/tot/texts.h"
+#include "engines/tot/tot.h"
namespace Tot {
@@ -2928,9 +2929,12 @@ void useScreenObject() {
}
} break;
case 583: {
+
+ long offset = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0][20] : flcOffsets[1][20];
+
drawText(regobj.useTextRef);
g_engine->_mouseManager->hide();
- drawFlc(140, 34, 2124896, 0, 9, 24, false, false, true, basurillalog);
+ drawFlc(140, 34, offset, 0, 9, 24, false, false, true, basurillalog);
g_engine->_mouseManager->show();
updateItem(regobj.code);
currentRoomData->indexadoobjetos[7]->indicefichero = 716;
@@ -3008,6 +3012,7 @@ void useScreenObject() {
g_engine->_mouseManager->show();
} break;
case 632: {
+ long offset = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0][21] : flcOffsets[1][21];
drawText(regobj.useTextRef);
g_engine->_mouseManager->hide();
animateGive(direccionmovimiento, 1);
@@ -3026,7 +3031,7 @@ void useScreenObject() {
playVoc("PUFF", 191183, 18001);
// Animate to scythe
debug("Start anim!");
- drawFlc(180, 60, 2216848, 0, 9, 0, false, false, true, basurillalog);
+ drawFlc(180, 60, offset, 0, 9, 0, false, false, true, basurillalog);
debug("End Anim!");
// load Scythe
currentRoomData->bitmapasociados[2].puntbitmap = 1545820;
@@ -3072,6 +3077,8 @@ void useScreenObject() {
cavernas[3] = true;
} break;
case 633: { //Use ring!
+ long offset = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0][22] : flcOffsets[1][22];
+
drawText(regobj.useTextRef);
g_engine->_mouseManager->hide();
debug("-------------------------------------");
@@ -3087,7 +3094,7 @@ void useScreenObject() {
goToObject(currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], 10);
g_engine->_mouseManager->hide();
playVoc("PUFF", 191183, 18001);
- drawFlc(0, 47, 2209158, 0, 9, 0, false, false, true, basurillalog);
+ drawFlc(0, 47, offset, 0, 9, 0, false, false, true, basurillalog);
currentRoomData->bitmapasociados[3].puntbitmap = 1591272;
currentRoomData->bitmapasociados[3].tambitmap = 92;
@@ -3131,6 +3138,8 @@ void useScreenObject() {
cavernas[3] = true;
} break;
case 643: { // Urn with altar
+ long offset = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0][23] : flcOffsets[1][23];
+
if (currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory] != 5)
drawText(regobj.useTextRef);
pulsax = 149 - 7;
@@ -3139,7 +3148,7 @@ void useScreenObject() {
g_engine->_mouseManager->hide();
updateInventory(indicemochila);
drawBackpack();
- drawFlc(133, 0, 2076280, 0, 9, 22, false, false, true, basurillalog);
+ drawFlc(133, 0, offset, 0, 9, 22, false, false, true, basurillalog);
{
RoomBitmapRegister &with = currentRoomData->bitmapasociados[2];
@@ -3161,13 +3170,15 @@ void useScreenObject() {
g_engine->_mouseManager->show();
} break;
case 657: { // sharpen scythe
+ long offset = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0][24] : flcOffsets[1][24];
+
drawText(regobj.useTextRef);
pulsax = 178 - 7;
pulsay = 71 - 7;
goToObject(currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], 3);
g_engine->_mouseManager->hide();
playVoc("AFILAR", 0, 6433);
- drawFlc(160, 15, 2441804, 0, 9, 23, false, false, true, basurillalog);
+ drawFlc(160, 15, offset, 0, 9, 23, false, false, true, basurillalog);
replaceBackpack(indicemochila, 715);
drawBackpack();
g_engine->_mouseManager->show();
@@ -3191,12 +3202,14 @@ void useScreenObject() {
g_engine->_mouseManager->show();
} break;
case 689: { // rope
+ long offset = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0][25] : flcOffsets[1][25];
+
drawText(regobj.useTextRef);
pulsax = 124 - 7;
pulsay = 133 - 7;
goToObject(currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], 9);
g_engine->_mouseManager->hide();
- drawFlc(110, 79, 2361800, 0, 9, 0, false, false, true, basurillalog);
+ drawFlc(110, 79, offset, 0, 9, 0, false, false, true, basurillalog);
replaceBackpack(indicemochila, 701);
drawBackpack();
handPantallaToBackground();
@@ -3209,12 +3222,13 @@ void useScreenObject() {
currentRoomData->mouseGrid[indlista][27] = 10;
} break;
case 700: { // Trident
+ long offset = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0][26] : flcOffsets[1][26];
drawText(regobj.useTextRef);
pulsax = 224 - 7;
pulsay = 91 - 7;
goToObject(currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], 7);
g_engine->_mouseManager->hide();
- drawFlc(208, 0, 2382552, 0, 9, 21, false, false, true, basurillalog);
+ drawFlc(208, 0, offset, 0, 9, 21, false, false, true, basurillalog);
currentRoomData->bitmapasociados[0].puntbitmap = 0;
currentRoomData->bitmapasociados[0].tambitmap = 0;
currentRoomData->bitmapasociados[0].coordx = 0;
@@ -3252,6 +3266,8 @@ void useScreenObject() {
updateItem(regobj.code);
} break;
case 709: { // rock with mural
+ long offset = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0][27] : flcOffsets[1][27];
+
if (sello_quitado) {
drawText(regobj.useTextRef);
g_engine->_mouseManager->hide();
@@ -3274,7 +3290,7 @@ void useScreenObject() {
g_engine->_sound->waitForSoundEnd();
playVoc("PUFF", 191183, 18001);
animateOpen2(0, 1);
- drawFlc(180, 50, 2464240, 0, 9, 22, false, false, true, basurillalog);
+ drawFlc(180, 50, offset, 0, 9, 22, false, false, true, basurillalog);
salirdeljuego = true;
} else
drawText(Random(11) + 1022);
@@ -3388,6 +3404,9 @@ void useScreenObject() {
autoPlayVoc("CALDERA", 6433, 15386);
} break;
case 682: {
+ long offsetWithJar = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0][28] : flcOffsets[1][28];
+ long offsetNoJar = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0][29] : flcOffsets[1][29];
+
g_engine->_mouseManager->hide();
playVoc("CLICK", 27742, 2458);
animatePickup1(0, 1);
@@ -3396,7 +3415,7 @@ void useScreenObject() {
animateOpen2(0, 1);
playVoc("FUEGO", 72598, 9789);
if (vasijapuesta) {
- drawFlc(108, 0, 2296092, 0, 9, 0, false, false, true, basurillalog);
+ drawFlc(108, 0, offsetWithJar, 0, 9, 0, false, false, true, basurillalog);
{
RoomBitmapRegister &with = currentRoomData->bitmapasociados[0];
@@ -3410,7 +3429,7 @@ void useScreenObject() {
for (indmoch = 10; indmoch <= 13; indmoch++)
currentRoomData->mouseGrid[indlista][indmoch] = 12;
} else
- drawFlc(108, 0, 2231140, 0, 9, 0, false, false, true, basurillalog);
+ drawFlc(108, 0, offsetNoJar, 0, 9, 0, false, false, true, basurillalog);
g_engine->_mouseManager->show();
} break;
}
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
index a058250e3ea..bb2a3e92c03 100644
--- a/engines/tot/routines2.cpp
+++ b/engines/tot/routines2.cpp
@@ -1761,20 +1761,17 @@ void introduction() {
bool pulsada_salida;
uint contadorvueltas;
const char *const *messages = (g_engine->_lang == Common::ES_ESP) ? fullScreenMessages[0] : fullScreenMessages[1];
-
+ const long *offsets = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0] : flcOffsets[1];
pulsada_salida = false;
totalFadeOut(0);
if (contadorpc > 6)
showError(270);
cleardevice();
- drawFlc(136, 53, 888366, 136, 9, 1, true, true, false, pulsada_salida);
- if (pulsada_salida)
- goto Lsalirpres;
- drawFlc(136, 53, 888366, 1, 9, 1, true, true, false, pulsada_salida);
+ drawFlc(136, 53, offsets[2], 136, 9, 1, true, true, false, pulsada_salida);
if (pulsada_salida)
goto Lsalirpres;
- drawFlc(135, 54, 908896, 0, 9, 2, true, true, false, pulsada_salida);
+ drawFlc(135, 54, offsets[3], 0, 9, 2, true, true, false, pulsada_salida);
if (pulsada_salida)
goto Lsalirpres;
totalFadeOut(0);
@@ -1810,61 +1807,61 @@ void introduction() {
totalFadeOut(0);
cleardevice();
- drawFlc(0, 0, 972458, 0, 9, 3, true, true, false, pulsada_salida);
+ drawFlc(0, 0, offsets[4], 0, 9, 3, true, true, false, pulsada_salida);
if (pulsada_salida)
goto Lsalirpres;
- drawFlc(110, 30, 1269108, 2, 9, 4, false, true, false, pulsada_salida);
+ drawFlc(110, 30, offsets[5], 2, 9, 4, false, true, false, pulsada_salida);
if (pulsada_salida)
goto Lsalirpres;
- drawFlc(110, 30, 1284784, 3, 9, 5, false, true, false, pulsada_salida);
+ drawFlc(110, 30, offsets[6], 3, 9, 5, false, true, false, pulsada_salida);
if (pulsada_salida)
goto Lsalirpres;
- drawFlc(110, 30, 1299404, 0, 9, 0, false, true, false, pulsada_salida);
+ drawFlc(110, 30, offsets[7], 0, 9, 0, false, true, false, pulsada_salida);
if (pulsada_salida)
goto Lsalirpres;
- drawFlc(110, 30, 1321354, 4, 9, 6, false, true, false, pulsada_salida);
+ drawFlc(110, 30, offsets[8], 4, 9, 6, false, true, false, pulsada_salida);
if (pulsada_salida)
goto Lsalirpres;
- drawFlc(110, 30, 1334608, 3, 9, 7, false, true, false, pulsada_salida);
+ drawFlc(110, 30, offsets[9], 3, 9, 7, false, true, false, pulsada_salida);
if (pulsada_salida)
goto Lsalirpres;
- drawFlc(110, 30, 1321354, 3, 9, 8, false, true, false, pulsada_salida);
+ drawFlc(110, 30, offsets[8], 3, 9, 8, false, true, false, pulsada_salida);
if (pulsada_salida)
goto Lsalirpres;
- drawFlc(110, 30, 1334608, 2, 9, 9, false, true, false, pulsada_salida);
+ drawFlc(110, 30, offsets[9], 2, 9, 9, false, true, false, pulsada_salida);
if (pulsada_salida)
goto Lsalirpres;
- drawFlc(0, 0, 1349402, 0, 9, 0, false, true, false, pulsada_salida);
+ drawFlc(0, 0, offsets[10], 0, 9, 0, false, true, false, pulsada_salida);
if (pulsada_salida)
goto Lsalirpres;
- drawFlc(235, 100, 1463880, 3, 9, 10, false, true, false, pulsada_salida);
+ drawFlc(235, 100, offsets[11], 3, 9, 10, false, true, false, pulsada_salida);
if (pulsada_salida)
goto Lsalirpres;
- drawFlc(150, 40, 1471630, 0, 9, 11, false, true, false, pulsada_salida);
+ drawFlc(150, 40, offsets[12], 0, 9, 11, false, true, false, pulsada_salida);
if (pulsada_salida)
goto Lsalirpres;
- drawFlc(235, 100, 1463880, 3, 9, 12, false, true, false, pulsada_salida);
+ drawFlc(235, 100, offsets[11], 3, 9, 12, false, true, false, pulsada_salida);
if (pulsada_salida)
goto Lsalirpres;
- drawFlc(150, 40, 1471630, 0, 9, 13, false, true, false, pulsada_salida);
+ drawFlc(150, 40, offsets[12], 0, 9, 13, false, true, false, pulsada_salida);
if (pulsada_salida)
goto Lsalirpres;
- drawFlc(235, 100, 1463880, 3, 9, 14, false, true, false, pulsada_salida);
+ drawFlc(235, 100, offsets[11], 3, 9, 14, false, true, false, pulsada_salida);
if (pulsada_salida)
goto Lsalirpres;
- drawFlc(150, 40, 1471630, 0, 9, 15, false, true, false, pulsada_salida);
+ drawFlc(150, 40, offsets[12], 0, 9, 15, false, true, false, pulsada_salida);
if (pulsada_salida)
goto Lsalirpres;
- drawFlc(173, 98, 1480982, 0, 9, 0, false, true, false, pulsada_salida);
+ drawFlc(173, 98, offsets[13], 0, 9, 0, false, true, false, pulsada_salida);
if (pulsada_salida)
goto Lsalirpres;
- drawFlc(224, 100, 1500902, 2, 9, 16, false, true, false, pulsada_salida);
+ drawFlc(224, 100, offsets[14], 2, 9, 16, false, true, false, pulsada_salida);
if (pulsada_salida)
goto Lsalirpres;
- drawFlc(0, 0, 1508036, 0, 18, 17, false, true, false, pulsada_salida);
+ drawFlc(0, 0, offsets[15], 0, 18, 17, false, true, false, pulsada_salida);
if (pulsada_salida)
goto Lsalirpres;
- drawFlc(150, 40, 1701780, 0, 9, 18, false, true, false, pulsada_salida);
+ drawFlc(150, 40, offsets[16], 0, 9, 18, false, true, false, pulsada_salida);
if (pulsada_salida)
goto Lsalirpres;
delay(1000);
@@ -1893,7 +1890,8 @@ void firstIntroduction() {
void initialLogo() {
bool basurillalogica = false;
- drawFlc(0, 0, 0, 0, 18, 25, false, false, false, basurillalogica);
+ long offset = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0][0] : flcOffsets[1][0];
+ drawFlc(0, 0, offset, 0, 18, 25, false, false, false, basurillalogica);
delay(1000);
}
@@ -1902,10 +1900,12 @@ void initialMenu(bool fundido) {
bool opcionvalida = false;
stopVoc();
+ long offset = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0][1] : flcOffsets[1][1];
+
if (fundido)
- drawFlc(0, 0, 837602, 0, 9, 0, true, false, false, kklogica);
+ drawFlc(0, 0, offset, 0, 9, 0, true, false, false, kklogica);
else
- drawFlc(0, 0, 837602, 0, 9, 0, false, false, false, kklogica);
+ drawFlc(0, 0, offset, 0, 9, 0, false, false, false, kklogica);
if (contadorpc2 > 10)
showError(274);
xraton = 160;
@@ -1935,14 +1935,14 @@ void initialMenu(bool fundido) {
opcionvalida = true;
} else if (x > 173 && x < 267) {
credits();
- drawFlc(0, 0, 837602, 0, 9, 0, true, false, false, kklogica);
+ drawFlc(0, 0, offset, 0, 9, 0, true, false, false, kklogica);
}
} else if (y > 140 && y < 155) {
if (x > 173 && x < 292) {
totalFadeOut(0);
cleardevice();
introduction();
- drawFlc(0, 0, 837602, 0, 9, 0, true, false, false, kklogica);
+ drawFlc(0, 0, offset, 0, 9, 0, true, false, false, kklogica);
} else if (x >= 18 && x <= 145) {
debug("Load");
partidanueva = false;
@@ -2352,6 +2352,8 @@ void sacrificeScene() {
const char *const *messages = (g_engine->_lang == Common::ES_ESP) ? fullScreenMessages[0] : fullScreenMessages[1];
+ const long *offsets = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0] : flcOffsets[1];
+
stopVoc();
bool pulsada_salida = currentRoomData->paletteAnimationFlag;
currentRoomData->paletteAnimationFlag = false;
@@ -2432,7 +2434,7 @@ void sacrificeScene() {
if (g_engine->shouldQuit())
return;
- drawFlc(0, 0, 1712400, 0, 9, 19, false, false, true, pulsada_salida);
+ drawFlc(0, 0, offsets[17], 0, 9, 19, false, false, true, pulsada_salida);
totalFadeOut(128);
stopVoc();
delay(1000);
@@ -2499,12 +2501,12 @@ void sacrificeScene() {
redFadeIn(palaux);
- drawFlc(112, 57, 1783054, 33, 9, 20, true, false, true, pulsada_salida);
+ drawFlc(112, 57, offsets[18], 33, 9, 20, true, false, true, pulsada_salida);
autoPlayVoc("REZOS", 0, 0);
if (g_engine->shouldQuit())
return;
- drawFlc(42, 30, 1806212, 0, 9, 27, false, false, false, pulsada_salida);
+ drawFlc(42, 30, offsets[19], 0, 9, 27, false, false, false, pulsada_salida);
if (g_engine->shouldQuit())
return;
@@ -2672,6 +2674,7 @@ void ending() {
bool pulsada_salida;
const char *const *messages = (g_engine->_lang == Common::ES_ESP) ? fullScreenMessages[0] : fullScreenMessages[1];
+ const long *offsets = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0] : flcOffsets[1];
outtextxy(10, 41, messages[43], 249);
outtextxy(10, 39, messages[43], 249);
@@ -2697,11 +2700,11 @@ void ending() {
lowerMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
playMidiFile("SACRIFIC", true);
restoreMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
- drawFlc(0, 0, 2481274, 12, 9, 26, true, false, false, pulsada_salida);
+ drawFlc(0, 0, offsets[30], 12, 9, 26, true, false, false, pulsada_salida);
if(pulsada_salida){
return;
}
- drawFlc(0, 0, 2554766, 0, 9, 0, false, false, false, pulsada_salida);
+ drawFlc(0, 0, offsets[31], 0, 9, 0, false, false, false, pulsada_salida);
if(pulsada_salida){
return;
}
Commit: d5a5d52419d2f334a74d81c03b209964be58a6dd
https://github.com/scummvm/scummvm/commit/d5a5d52419d2f334a74d81c03b209964be58a6dd
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:49+02:00
Commit Message:
TOT: Fixes conversations breaking in English version
Changed paths:
engines/tot/routines.cpp
engines/tot/texts.h
diff --git a/engines/tot/routines.cpp b/engines/tot/routines.cpp
index 1376beb7ace..2e942aeb55d 100644
--- a/engines/tot/routines.cpp
+++ b/engines/tot/routines.cpp
@@ -4633,8 +4633,12 @@ regismht readVerbRegister(uint numRegister) {
regismht readVerbRegister() {
regismht regmht;
+ // Since the text is encrypted it's safer to save the size as reported by
+ // the pascal string.
+ byte size = verb.readByte();
+ verb.seek(-1, SEEK_CUR);
regmht.cadenatext = verb.readPascalString(false);
- verb.skip(255 - regmht.cadenatext.size());
+ verb.skip(255 - size);
regmht.encadenado = verb.readByte();
regmht.respuesta = verb.readUint16LE();
regmht.punteronil = verb.readSint32LE();
diff --git a/engines/tot/texts.h b/engines/tot/texts.h
index 80a6c0678a0..0922c39b5be 100644
--- a/engines/tot/texts.h
+++ b/engines/tot/texts.h
@@ -308,36 +308,36 @@ static const char *const animMessages[2][250] = {
},
//English
{
- "Las \xA3ltimas encuestas realizadas",
- "acerca de la siniestralidad en ",
- "los transportes arrojan resultados",
- "alentadores...",
+ "The latest nationwide car safety",
+ "surveys have shown very positive",
+ "results regarding accidental",
+ "accidents...",
"",
// 5
- "El cien por cien de los encuestados",
- "declararon no haber sufrido nunca un",
- "accidente mortal...",
- "",
+ "100% of the people interviewed",
+ "reported that never in their lives",
+ "had they ever suffered a fatal",
+ "accident...",
"",
// 10
- "Es una noticia que nos anima a salir",
- "de viaje con m\xA0s seguridad.",
+ "This being very reassuring news",
+ "indeed for today''s motorist...",
"",
"",
"",
// 15
- "\xAD\xADPor un tornillo!!...",
- "Por un m\xA1sero y simple",
- "tornillo del tr\xA1"
- "fugo",
- "del trapecio...",
+ "I don''t believe it!",
+ "Sacked again! And",
+ "for what? One little"
+ "screw on the boss''s",
+ "wife''s car!",
"",
// 20
- "Si lo hubiese apretado",
- "bien, no estar\xA1"
- "a ahora",
- "sin trabajo...",
- "",
+ "I knew I shouldn''t of",
+ "listened to her. \"Oh,"
+ "it''ll only take you a",
+ "minute. I Know it''s",
+ "supposed to be Henry''s",
"",
// 25
"\xAD\xADNoticia de \xA3ltima hora!!",
@@ -703,21 +703,23 @@ static const char *const fullScreenMessages[2][56] = {
" liberarlo de aquello que lo retenga. Cuando lo",
" consigas podremos traeros a ambos de vuelta al",
" mundo de los vivos.",
+
// 33
- " Pero debes darte prisa pues el v\xA1nculo con tu",
- " cuerpo se debilita y tu alma podr\xA1""a quedar",
- " atrapada para siempre en las Cavernas Eternas.",
+ " However you must hurry, for the link between ",
+ " your body and soul will deminish and your soul ",
+ " will be trapped in the Eternal Caverns... FOREVER!",
+ //FIXME! dont show these in the english version!
" Si necesitaras m\xA0s energ\xA1""a de la que tienes, ",
" recuerda que all\xA0 donde vas un cuerpo contiene",
" m\xA0s energ\xA1""a que un alma al contrario que en el",
" mundo f\xA1sico.",
// 40
- " No te demores y recuerda...",
- " Si triunfas, el premio es la vida, si no...",
- " LA MUERTE ETERNA.",
+ " Remember.",
+ " If you succed, the prize will be life!",
+ " If you fail... ETERNAL DEATH!!!",
// 43
- " Al fin lo has conseguido....",
- " \xAD\xAD\xADSoy LIBREEEEE!!!",
+ " You did it!",
+ " I''M FREEEEEEEEEEE!!!",
// WC
// 45
"... MMPFFFF!! ...",
Commit: ab3d9e28417e3a98c91af14680481fba5f38b2be
https://github.com/scummvm/scummvm/commit/ab3d9e28417e3a98c91af14680481fba5f38b2be
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:49+02:00
Commit Message:
TOT: Play intro automatically on the first run
Changed paths:
engines/tot/game.cpp
engines/tot/routines2.cpp
engines/tot/tot.cpp
diff --git a/engines/tot/game.cpp b/engines/tot/game.cpp
index 52c8d7cbeba..cd2e943982c 100644
--- a/engines/tot/game.cpp
+++ b/engines/tot/game.cpp
@@ -101,7 +101,7 @@ int engine_start() {
playMidiFile("INTRODUC", true);
setMidiVolume(3, 3);
- // firstIntroduction();
+ firstIntroduction();
setMousePos(1, xraton, yraton);
initialMenu(hechaprimeravez);
if (partidanueva && !g_engine->shouldQuit()) {
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
index bb2a3e92c03..631360049ca 100644
--- a/engines/tot/routines2.cpp
+++ b/engines/tot/routines2.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "common/config-manager.h"
#include "common/debug.h"
#include "common/file.h"
#include "common/system.h"
@@ -1873,19 +1874,12 @@ Lsalirpres:
}
void firstIntroduction() {
- // untyped_file fichbanderapresentacion;
- // byte basurilla;
-
- // hechaprimeravez = false;
- // assign(fichbanderapresentacion, "HECHO.DAT");
- // /*$I-*/ reset(fichbanderapresentacion, 1); /*$I+*/
- // if (ioresult != 0) {
- // rewrite(fichbanderapresentacion, 1);
- // blockwrite(fichbanderapresentacion, basurilla, 1);
- introduction();
- // hechaprimeravez = true;
- // }
- // close(fichbanderapresentacion);
+ if (!hechaprimeravez) {
+ introduction();
+ hechaprimeravez = true;
+ ConfMan.setBool("introSeen", true);
+ ConfMan.flushToDisk();
+ }
}
void initialLogo() {
diff --git a/engines/tot/tot.cpp b/engines/tot/tot.cpp
index 82358ec84cc..6f8fabb9419 100644
--- a/engines/tot/tot.cpp
+++ b/engines/tot/tot.cpp
@@ -72,6 +72,7 @@ Common::Error TotEngine::run() {
// Initialize 320x200 paletted graphics mode
initGraphics(320, 200);
+ ConfMan.registerDefault("introSeen", false);
//Static initializations
_screen = new Graphics::Screen();
@@ -85,6 +86,7 @@ Common::Error TotEngine::run() {
initGraph();
initPlayAnim();
+ hechaprimeravez = ConfMan.getBool("introSeen");
// _inventoryManager = new InventoryManager();
// _totGame = new TotGame();
// Set the engine's debugger console
Commit: 58e7cc19625345a156811af01caa491e7c52753a
https://github.com/scummvm/scummvm/commit/58e7cc19625345a156811af01caa491e7c52753a
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:49+02:00
Commit Message:
TOT: Implements English intro
Changed paths:
engines/tot/anims.cpp
engines/tot/chrono.h
engines/tot/routines2.cpp
engines/tot/texts.h
diff --git a/engines/tot/anims.cpp b/engines/tot/anims.cpp
index f1179b91c1d..1e30941d583 100644
--- a/engines/tot/anims.cpp
+++ b/engines/tot/anims.cpp
@@ -92,10 +92,26 @@ void removeText(uint xfrase1, uint yfrase1, uint xfrase2, uint yfrase2, byte col
g_engine->_screen->addDirtyRect(Common::Rect(xfrase1, yfrase1, xfrase2, yfrase2));
}
+void drawTvText(Common::String str1, Common::String str2, Common::String str3, Common::String str4, Common::String str5) {
+ drawText(80, 0, str1, str2, str3, str4, str5, 253, 0);
+}
+
+void clearTvText() {
+ removeText(80, 0, 319, 53, 0);
+}
+
+void drawCharacterText(Common::String str1, Common::String str2, Common::String str3, Common::String str4, Common::String str5) {
+ drawText(2, 100,str1, str2, str3, str4, str5, 255, 0);
+}
+void clearCharacterText() {
+ removeText(2, 100, 134, 199, 0);
+}
+
void handleFlcEvent(byte numero_del_evento) {
const char *const *messages = g_engine->_lang == Common::ES_ESP ? animMessages[0] : animMessages[1];
-
+ bool isSpanish = g_engine->_lang == Common::ES_ESP;
+ bool isEnglish = !isSpanish;
switch (numero_del_evento) {
case 0:
if (contadorpc > 103)
@@ -106,232 +122,200 @@ void handleFlcEvent(byte numero_del_evento) {
switch (numerovuelta) {
case 2:
- drawText(80, 0,
- messages[0],
- messages[1],
- messages[2],
- messages[3],
- messages[4],
- 253, 0);
+ drawTvText(messages[0], messages[1], messages[2], messages[3], messages[4]);
break;
case 13:
- removeText(80, 0, 319, 53, 0);
+ clearTvText();
break;
case 14:
- drawText(80, 0,
- messages[5],
- messages[6],
- messages[7],
- messages[8],
- messages[9],
- 253, 0);
+ drawTvText(messages[5], messages[6], messages[7], messages[8], messages[9]);
break;
case 25:
- removeText(80, 0, 319, 53, 0);
+ clearTvText();
break;
case 26:
- drawText(80, 0,
- messages[10],
- messages[11],
- messages[12],
- messages[13],
- messages[14],
- 253, 0);
+ drawTvText(messages[10], messages[11], messages[12], messages[13], messages[14]);
break;
case 35:
- removeText(80, 0, 319, 53, 0);
+ clearTvText();
break;
case 36:
- drawText(2, 100,
- messages[15],
- messages[16],
- messages[17],
- messages[18],
- messages[19],
- 255, 0);
+ drawCharacterText(messages[15], messages[16], messages[17], messages[18], messages[19]);
+ break;
+ // English only
+ case 40:
+ if(isEnglish){
+ clearCharacterText();
+ }
+ break;
+ case 41:
+ if(isEnglish) {
+ drawCharacterText(messages[250], messages[251], messages[252], messages[253], messages[254]);
+ }
break;
case 47:
- removeText(2, 100, 134, 199, 0);
+ clearCharacterText();
break;
case 48:
- drawText(2, 100,
- messages[20],
- messages[21],
- messages[22],
- messages[23],
- messages[24],
- 255, 0);
+ drawCharacterText(messages[20], messages[21], messages[22], messages[23], messages[24]);
break;
case 59:
- removeText(2, 100, 134, 199, 0);
+ clearCharacterText();
break;
case 60:
- drawText(80, 0,
- messages[25],
- messages[26],
- messages[27],
- messages[28],
- messages[29],
- 253, 0);
+ drawTvText(messages[25], messages[26], messages[27], messages[28], messages[29]);
break;
case 63:
- drawText(2, 100,
- messages[30],
- messages[31],
- messages[32],
- messages[33],
- messages[34],
- 255, 0);
+ drawCharacterText(messages[30], messages[31], messages[32], messages[33], messages[34]);
+ break;
+ case 70:
+ if(isEnglish) {
+ clearTvText();
+ }
break;
+ case 71:
+ if(isEnglish) {
+ drawTvText(messages[255], messages[256], messages[257], messages[258], messages[259]);
+ }
+ break;
+ case 73:
+ if(isEnglish) {
+ clearCharacterText();
+ }
+ case 74:
+ if(isEnglish) {
+ drawCharacterText(
+ messages[35],
+ messages[36],
+ messages[37],
+ messages[38],
+ messages[39]
+ );
+ }
case 75:
- removeText(2, 100, 135, 199, 0);
+ if(isSpanish) {
+ clearCharacterText();
+ }
break;
case 76:
- removeText(80, 0, 319, 53, 0);
+ if(isSpanish) {
+ clearTvText();
+ }
break;
case 77:
- drawText(2, 100,
- messages[35],
- messages[36],
- messages[37],
- messages[38],
- messages[39],
- 255, 0);
+ if(isSpanish) {
+ drawCharacterText(messages[35], messages[36], messages[37], messages[38], messages[39]);
+ }
+ break;
+
+ case 80:
+ if(isEnglish) {
+ clearTvText();
+ }
+ break;
+ case 82:
+ if(isEnglish) {
+ clearCharacterText();
+ }
+ break;
+ case 83:
+ if(isEnglish) {
+ drawCharacterText(messages[260], messages[261], messages[262], messages[263], messages[264]);
+ }
break;
case 89:
- removeText(2, 100, 135, 199, 0);
+ if(isSpanish) {
+ clearCharacterText();
+ }
break;
case 90:
- drawText(2, 100,
- messages[40],
- messages[41],
- messages[42],
- messages[43],
- messages[44],
- 255, 0);
+ if(isSpanish) {
+ drawCharacterText(messages[40], messages[41], messages[42], messages[43], messages[44]);
+ }
+ else {
+ clearCharacterText();
+ }
break;
+ case 91:
+ if(isEnglish) {
+ drawCharacterText(messages[40], messages[41], messages[42], messages[43], messages[44]);
+ }
+ break;
+
case 102:
- removeText(2, 100, 135, 199, 0);
+ clearCharacterText();
break;
case 103:
- drawText(80, 0,
- messages[45],
- messages[46],
- messages[47],
- messages[48],
- messages[49],
- 253, 0);
+ drawTvText(messages[45], messages[46], messages[47], messages[48], messages[49]);
break;
case 120:
- removeText(80, 0, 319, 53, 0);
+ clearTvText();
break;
case 121:
- drawText(80, 0,
- messages[50],
- messages[51],
- messages[52],
- messages[53],
- messages[54],
- 253, 0);
+ drawTvText(messages[50], messages[51], messages[52], messages[53], messages[54]);
break;
case 125:
- drawText(2, 100,
- messages[55],
- messages[56],
- messages[57],
- messages[58],
- messages[59],
- 255, 0);
+ drawCharacterText(messages[55], messages[56], messages[57], messages[58], messages[59]);
break;
case 135: {
- removeText(80, 0, 319, 53, 0);
- removeText(2, 100, 135, 199, 0);
+ clearTvText();
+ clearCharacterText();
} break;
}
break;
case 2:
switch (framecontador) {
case 1: {
- removeText(2, 100, 135, 199, 0);
- removeText(80, 0, 319, 53, 0);
+ clearCharacterText();
+ clearTvText();
} break;
case 7:
playVoc("MANDO", 142001, 11469);
break;
case 20:
- drawText(2, 100,
- messages[60],
- messages[61],
- messages[62],
- messages[63],
- messages[64],
- 255, 0);
+ drawCharacterText(messages[60], messages[61], messages[62], messages[63], messages[64]);
break;
case 58: {
- removeText(2, 100, 135, 199, 0);
- drawText(2, 100,
- messages[65],
- messages[66],
- messages[67],
- messages[68],
- messages[69],
- 255, 0);
+ clearCharacterText();
+ drawCharacterText(messages[65], messages[66], messages[67], messages[68], messages[69]);
} break;
case 74: {
delay(1500);
- removeText(2, 100, 135, 199, 0);
- drawText(2, 100,
- messages[70],
- messages[71],
- messages[72],
- messages[73],
- messages[74],
- 255, 0);
+ clearCharacterText();
+ drawCharacterText(messages[70], messages[71], messages[72], messages[73], messages[74]);
+
delay(4000);
- removeText(2, 100, 135, 199, 0);
- drawText(80, 0,
- messages[75],
- messages[76],
- messages[77],
- messages[78],
- messages[79],
- 253, 0);
+ clearCharacterText();
+ drawTvText(messages[75], messages[76], messages[77], messages[78], messages[79]);
+
delay(7000);
- removeText(80, 0, 319, 53, 0);
- drawText(80, 0,
- messages[80],
- messages[81],
- messages[82],
- messages[83],
- messages[84],
- 253, 0);
+ clearTvText();
+ drawTvText(messages[80], messages[81], messages[82], messages[83], messages[84]);
+
+ if(isEnglish) {
+ delay(5000);
+ clearTvText();
+ drawTvText(messages[265], messages[266], messages[267], messages[268], messages[269]);
+ }
+
delay(7000);
- removeText(80, 0, 319, 53, 0);
- drawText(80, 0,
- messages[85],
- messages[86],
- messages[87],
- messages[88],
- messages[89],
- 253, 0);
+ clearTvText();
+ drawTvText(messages[85], messages[86], messages[87], messages[88], messages[89]);
+
delay(7000);
- removeText(80, 0, 319, 53, 0);
- drawText(2, 100,
- messages[90],
- messages[91],
- messages[92],
- messages[93],
- messages[94],
- 255, 0);
+ clearTvText();
+ drawCharacterText(messages[90], messages[91], messages[92], messages[93], messages[94]);
+
delay(6000);
- removeText(2, 100, 135, 199, 0);
- drawText(2, 100,
- messages[95],
- messages[96],
- messages[97],
- messages[98],
- messages[99],
- 255, 0);
+ clearCharacterText();
+ drawCharacterText(messages[95], messages[96], messages[97], messages[98], messages[99]);
+
+ if(isEnglish) {
+ delay(6000);
+ clearCharacterText();
+ drawCharacterText(messages[95], messages[96], messages[97], messages[98], messages[99]);
+ }
+
delay(6000);
} break;
}
@@ -389,6 +373,16 @@ void handleFlcEvent(byte numero_del_evento) {
messages[114],
255, 249);
}
+ else if ((numerovuelta == 5) && (framecontador == 3)) {
+ putImg(0, 0, punterofondofrase);
+ drawText(5, 1,
+ messages[275],
+ messages[276],
+ messages[277],
+ messages[278],
+ messages[279],
+ 255, 249);
+ }
break;
case 7:
if ((numerovuelta == 1) && (framecontador == 3)) {
@@ -413,6 +407,16 @@ void handleFlcEvent(byte numero_del_evento) {
messages[124],
255, 249);
}
+ else if ((numerovuelta == 5) && (framecontador == 3)) {
+ putImg(0, 0, punterofondofrase);
+ drawText(5, 1,
+ messages[280],
+ messages[281],
+ messages[282],
+ messages[283],
+ messages[284],
+ 255, 249);
+ }
break;
case 9:
if ((numerovuelta == 1) && (framecontador == 3)) {
@@ -485,6 +489,16 @@ void handleFlcEvent(byte numero_del_evento) {
messages[154],
255, 249);
}
+ else if ((numerovuelta == 5) && (framecontador == 3)) {
+ putImg(0, 0, punterofondofrase);
+ drawText(5, 1,
+ messages[285],
+ messages[286],
+ messages[287],
+ messages[288],
+ messages[289],
+ 255, 249);
+ }
break;
case 15:
if ((numerovuelta == 1) && (framecontador == 3)) {
diff --git a/engines/tot/chrono.h b/engines/tot/chrono.h
index 55270b30489..7aab235a52c 100644
--- a/engines/tot/chrono.h
+++ b/engines/tot/chrono.h
@@ -31,7 +31,7 @@ namespace Tot {
extern bool tocapintar, tocapintar2, tocapintareffect;
// Set to 30 for ease of dev
-const int kFrameMs = 30;
+const int kFrameMs = 20;
// const int kFrameMs = 50;
const int kDoubleFrameMultiplier = 3;
const int kFrameEffectMs = 10;
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
index 631360049ca..041e7200a53 100644
--- a/engines/tot/routines2.cpp
+++ b/engines/tot/routines2.cpp
@@ -1761,32 +1761,45 @@ void introduction() {
g_engine->_mouseManager->hide();
bool pulsada_salida;
uint contadorvueltas;
- const char *const *messages = (g_engine->_lang == Common::ES_ESP) ? fullScreenMessages[0] : fullScreenMessages[1];
+ bool isSpanish = g_engine->_lang == Common::ES_ESP;
+ const char *const *messages = (isSpanish) ? fullScreenMessages[0] : fullScreenMessages[1];
const long *offsets = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0] : flcOffsets[1];
pulsada_salida = false;
totalFadeOut(0);
- if (contadorpc > 6)
- showError(270);
- cleardevice();
- drawFlc(136, 53, offsets[2], 136, 9, 1, true, true, false, pulsada_salida);
- if (pulsada_salida)
- goto Lsalirpres;
- drawFlc(135, 54, offsets[3], 0, 9, 2, true, true, false, pulsada_salida);
- if (pulsada_salida)
- goto Lsalirpres;
+ // if (contadorpc > 6)
+ // showError(270);
+ // cleardevice();
+ // drawFlc(136, 53, offsets[2], 136, 9, 1, true, true, false, pulsada_salida);
+ // if (pulsada_salida)
+ // goto Lsalirpres;
+ // drawFlc(135, 54, offsets[3], 0, 9, 2, true, true, false, pulsada_salida);
+ // if (pulsada_salida)
+ // goto Lsalirpres;
totalFadeOut(0);
cleardevice();
-
- outtextxy(25, 20, messages[0], 253);
- outtextxy(25, 35, messages[1], 253);
- outtextxy(25, 50, messages[2], 253);
- outtextxy(25, 65, messages[3], 253);
- outtextxy(25, 80, messages[4], 253);
- outtextxy(25, 95, messages[5], 253);
- outtextxy(25, 120, messages[6], 253);
- outtextxy(25, 140, messages[7], 253);
- outtextxy(25, 155, messages[8], 253);
+ if(isSpanish) {
+ outtextxy(25, 20, messages[0], 253);
+ outtextxy(25, 35, messages[1], 253);
+ outtextxy(25, 50, messages[2], 253);
+ outtextxy(25, 65, messages[3], 253);
+ outtextxy(25, 80, messages[4], 253);
+ outtextxy(25, 95, messages[5], 253);
+ outtextxy(25, 120, messages[6], 253);
+ outtextxy(25, 140, messages[7], 253);
+ outtextxy(25, 155, messages[8], 253);
+ }
+ else {
+ outtextxy(25, 35, messages[0], 253);
+ outtextxy(25, 55, messages[1], 253);
+ outtextxy(25, 75, messages[2], 253);
+ outtextxy(25, 95, messages[3], 253);
+ outtextxy(25, 115, messages[4], 253);
+ outtextxy(25, 135, messages[5], 253);
+ }
+ if(g_engine->shouldQuit()){
+ return;
+ }
totalFadeIn(0, "DEFAULT");
g_engine->_screen->markAllDirty();
g_engine->_screen->update();
@@ -1820,13 +1833,13 @@ void introduction() {
drawFlc(110, 30, offsets[7], 0, 9, 0, false, true, false, pulsada_salida);
if (pulsada_salida)
goto Lsalirpres;
- drawFlc(110, 30, offsets[8], 4, 9, 6, false, true, false, pulsada_salida);
+ drawFlc(110, 30, offsets[8], isSpanish? 4:8, 9, 6, false, true, false, pulsada_salida);
if (pulsada_salida)
goto Lsalirpres;
drawFlc(110, 30, offsets[9], 3, 9, 7, false, true, false, pulsada_salida);
if (pulsada_salida)
goto Lsalirpres;
- drawFlc(110, 30, offsets[8], 3, 9, 8, false, true, false, pulsada_salida);
+ drawFlc(110, 30, offsets[8], isSpanish? 3:8, 9, 8, false, true, false, pulsada_salida);
if (pulsada_salida)
goto Lsalirpres;
drawFlc(110, 30, offsets[9], 2, 9, 9, false, true, false, pulsada_salida);
@@ -1844,10 +1857,10 @@ void introduction() {
drawFlc(235, 100, offsets[11], 3, 9, 12, false, true, false, pulsada_salida);
if (pulsada_salida)
goto Lsalirpres;
- drawFlc(150, 40, offsets[12], 0, 9, 13, false, true, false, pulsada_salida);
+ drawFlc(150, 40, offsets[12], isSpanish? 0:2, 9, 13, false, true, false, pulsada_salida);
if (pulsada_salida)
goto Lsalirpres;
- drawFlc(235, 100, offsets[11], 3, 9, 14, false, true, false, pulsada_salida);
+ drawFlc(235, 100, offsets[11], isSpanish? 3:8, 9, 14, false, true, false, pulsada_salida);
if (pulsada_salida)
goto Lsalirpres;
drawFlc(150, 40, offsets[12], 0, 9, 15, false, true, false, pulsada_salida);
diff --git a/engines/tot/texts.h b/engines/tot/texts.h
index 0922c39b5be..b005420337b 100644
--- a/engines/tot/texts.h
+++ b/engines/tot/texts.h
@@ -27,7 +27,7 @@
namespace Tot {
-static const char *const animMessages[2][250] = {
+static const char *const animMessages[2][290] = {
//Spanish
{
"Las \xA3ltimas encuestas realizadas",
@@ -50,14 +50,12 @@ static const char *const animMessages[2][250] = {
// 15
"\xAD\xADPor un tornillo!!...",
"Por un m\xA1sero y simple",
- "tornillo del tr\xA1"
- "fugo",
+ "tornillo del tr\xA1""fugo",
"del trapecio...",
"",
// 20
"Si lo hubiese apretado",
- "bien, no estar\xA1"
- "a ahora",
+ "bien, no estar\xA1""a ahora",
"sin trabajo...",
"",
"",
@@ -304,6 +302,24 @@ static const char *const animMessages[2][250] = {
"otro encargado... JA,JA,JA...",
"",
"",
+ "",
+ // 250
+ "I knew I shouldn't of",
+ "listened to her. \"Oh,",
+ "it'll only take you a",
+ "minute. I Know it's",
+ "supposed to be Henry's",
+ // 255
+ "by saying that he would have more",
+ "to say on that subject in a week",
+ "or two!",
+ "",
+ "",
+ // 260
+ "be his own reputation",
+ "that he's thinking of.",
+ "",
+ "",
""
},
//English
@@ -321,188 +337,184 @@ static const char *const animMessages[2][250] = {
"",
// 10
"This being very reassuring news",
- "indeed for today''s motorist...",
+ "indeed for today's motorist...",
"",
"",
"",
// 15
- "I don''t believe it!",
+ "I don't believe it!",
"Sacked again! And",
- "for what? One little"
- "screw on the boss''s",
- "wife''s car!",
- "",
+ "for what? One little",
+ "screw on the boss's",
+ "wife's car!",
// 20
- "I knew I shouldn''t of",
- "listened to her. \"Oh,"
- "it''ll only take you a",
- "minute. I Know it''s",
- "supposed to be Henry''s",
- "",
+ "responsability but",
+ "who'll ever know?\"",
+ "How could I have been",
+ "so stupid?",
+ "supposed to be Henry's",
// 25
- "\xAD\xADNoticia de \xA3ltima hora!!",
- "",
- "",
- "",
- "",
+ "In other news. The Prime Minister",
+ "was questioned today in the Commons",
+ "today about his being a constant",
+ "procrastinator. He infatically",
+ "denied the alegations and responded",
// 30
- "Llevo sin dormir toda",
- "la noche, pensando qu\x82",
- "voy a hacer.",
- "",
- "",
+ "I knew I should have",
+ "let Holmes do it. He",
+ "was always better",
+ "than me and his tools",
+ "were far superior!",
// 35
- "Seguramente no podr\x82",
- "encontrar trabajo en",
- "mucho tiempo...",
- "Aunque ponga mucha f\x82",
- "la oficina de empleo.",
+ "I probably won't work",
+ "in this area ever",
+ "again. Henry Fjord",
+ "has a lot of say in",
+ "this town and it'll",
// 40
- "Y para animarme m\xA0s",
- "todav\xAD""a, ma\xA4""ana noche",
- "es HALLOWEEN...",
- "",
- "Es que tengo la negra.",
+ "Trust this to happen",
+ "to me just before",
+ "Halloween. This is",
+ "definately not my",
+ "week!",
// 45
- "Grave accidente en TWELVE MOTORS...",
- "un empleado olvid\xA2 apretar un tornillo",
- "y media cadena de montaje ha quedado",
- "para chatarra...",
- "las p\x82rdidas se estiman cuantiosas...",
- // 50
- "No se descartan las acciones legales",
- "contra ese inconsciente...",
+ "This just in. A major incident has been",
+ "reported within the Fjord Motor Group.",
"",
"",
"",
- // 55
- "\xAD""Dios mio!... hasta en",
- "la televisi\xA2n...",
- "Seguro que hasta mi",
- "perro encuentra curro",
- "antes que yo...",
- // 60
- "\xADHORROR!...una factura",
+ // 50
+ "Legal action is being considered...",
+ "",
"",
"",
"",
+ // 55
+ "Oh bugger! It's on",
+ "T.V. Legal action?!",
+ "How the hell can",
+ "I afford that?",
"",
+ // 60
+ "Hello? What's this?","","","","",
// 65
- "\xA8"
- "Oficina de empleo?...",
- "\xA8"
- "y para m\xA1?...",
+ "Employment Services?!",
+ "For me?! This must be",
+ "a mistake. How could",
+ "they know already?",
"",
- "\xADSe habr\xA0n equivocado!", "",
// 70
- "\xA8Tan pronto lograron",
- "encontrarme trabajo?",
- "",
- "Claro... antes de ver",
- "las noticias...",
+ "More to the point,",
+ "how could they have",
+ "found me a job?!",
+ "Let's see what this",
+ "says...",
// 75
- "Estimado se\xA4or: Nos dirigimos a",
- "usted para comunicarle que su",
- "solicitud n\xA7:93435 fu\x82 aceptada",
- "y le hemos encontrado un puesto",
- "de acuerdo con sus aptitudes...",
+ "\"Dear Sir. We would like to inform",
+ "you that your application form",
+ "no:666 has been processed. We are",
+ "also pleased to tell you that we",
+ "",
// 80
- "Deber\xA0 presentarse ma\xA4""ana, dia",
- "31 de Octubre en la direcci\xA2n",
- "abajo indicada, para ocupar el",
- "puesto de ENCARGADO GENERAL.",
+ "have found you a job best suited",
+ "to your abilities\"",
+ "",
+ "",
"",
//85
- "Le adjuntamos las credenciales",
- "de presentaci\xA2n.",
- "Deseando no verle por aqu\xA1 en",
- "mucho tiempo se despide:",
- " Leonor Scott.",
+ "We enclose the necessary documents",
+ "for you records. We wish you every",
+ "success and sincerly hope never to",
+ "see you again. Signed: R. Sole.\"",
+ "",
// 90
- "\xAD\xADQue ilu!! encargado",
- "general... si ya me",
- "lo decia mi madre...",
- "<<nene tienes cara de",
- "encargado general>>",
- // 95
- "Tendr\x82 que conseguir",
- "ropa m\xA0s de acuerdo",
- "con mi nuevo cargo.",
+ "Care Assistant!?!",
+ "Someone's obviously",
+ "taking the...",
"",
- "Manos a la obra...",
+ "",
+ // 95
+ "Fjord! I bet he's been",
+ "on the phone to the",
+ "Unemployment Office and",
+ "told them to give me",
+ "something naff!... ",
// 100
- "\xADV\xA0yase!... no queremos vendedores...",
- "y menos de planes de jubilaci\xA2n.",
+ "Sod off!... We don't wan't any more salesmen!",
+ "",
"",
"",
"",
// 105
- "No soy ning\xA3n vendedor... me envia la oficina",
- "de empleo... tenga mis credenciales.",
+ "I'm not a salesman, I work here!",
+ "",
"",
"",
"",
// 110
- "\xADVaya! eres t\xA3...llegas con retraso. Los ancianos est\xA0n",
- "esper\xA0ndote en el sal\xA2n. Debes cuidarlos muy bien.",
+ "So you're the new Care Assistant I requested!...",
+ "Well I must say that I'm very pleased to meet you.",
"",
"",
"",
// 115
- "Lo siento, no sab\xA1""a a que hora deb\xA1""a presentarme, en",
- "la oficina de empleo no me lo dijeron.",
+ "Hey wait a minute! What am I supposed",
+ "to do around here?",
"",
"",
"",
// 120
- "Bueno... no importa... ya est\xA0s aqu\xA1.",
- "Ese coche es tuyo \xA8no?...",
+ "The geriatrics will tell you all that",
+ "you need to know. I'm out of here! ...",
"",
"",
"",
// 125
- "Si... es precioso \xA8verdad?...",
+ "Eh! Er, yes it is. Beware what exactly!",
"",
"",
"",
"",
// 130
- "Vaya... 200 caballos... elevalunas el\x82""ctricos... ",
- "inyecci\xA2n electr\xA2nica, llantas de aleaci\xA2n...",
+ "Wow!... 200Bhp... Electric everything...",
+ "Fuel injection... Alloy wheels...",
"",
"",
"",
// 135
- "Pues si...",
+ "Er, excuse me! Beware what?",
"",
"",
"",
"",
// 140
- "Airbag... asientos envolventes... aire acondicionado",
- "",
+ "Twin overhead cams... Dual airbags...",
+ "Bucket seats... Air conditioning...",
"",
"",
"",
// 145
- "Es el m\xA0s alto de la gama...",
- "",
+ "Hey man, I hate to break you away from your",
+ "car review...",
"",
"",
"",
// 150
- "ABS, equipo de m\xA3sica con CD, estructura reforzada",
- "indeformable, detector de radar...",
+ "A.B.S... C.D. system... Side impact protection",
+ "system... Wow! A radar detector ...",
"",
"",
"",
// 155
- "Parece que te gusta, \xA8no?", "", "", "", "",
+ "Have I?",
+ "",
+ "",
+ "",
+ "",
// 160
- "Bueno, no est\xA0 mal... pero... gracias de todos modos.", "", "", "", "",
+ "Ooohhh yes!","","","","",
// 165
- "\xA8Gracias?... \xA8qu\x82?... \xAD"
- "espera!... ese es mi coche...",
+ "Hey wait! That's my car! Come back!",
"",
"",
"",
@@ -582,6 +594,54 @@ static const char *const animMessages[2][250] = {
"otro encargado... JA,JA,JA...",
"",
"",
+ "",
+ // 250
+ "I knew I shouldn't of",
+ "listened to her. \"Oh,",
+ "it'll only take you a",
+ "minute. I Know it's",
+ "supposed to be Henry's",
+ // 255
+ "by saying that he would have more",
+ "to say on that subject in a week",
+ "or two!",
+ "",
+ "",
+ // 260
+ "be his own reputation",
+ "that he's thinking of.",
+ "",
+ "",
+ "",
+ // 265
+ "\"As from October 31st you will begin",
+ "you new job at the care home for the",
+ "elderly at Devillsville as:",
+ " CARE ASSISTANT.",
+ "",
+ // 270
+ "Well stuff you Henry,",
+ "I'm taking the job",
+ "anyway! Besides I",
+ "need the money!",
+ "",
+ // 275
+ "You can find the geriatrics in the livingroom.",
+ "... Good luck!",
+ "",
+ "",
+ "",
+ // 280
+ "Oh!, one more thing though... Beware the...",
+ "... Hey is that your car?",
+ "",
+ "",
+ "",
+ // 285
+ "... And look at this! ...",
+ "You've even left the keys in it!",
+ "",
+ "",
""
}
};
@@ -664,15 +724,15 @@ static const char *const fullScreenMessages[2][56] = {
// English
{
// intro
- " ... Despu\x82s de estar durante ocho horas",
- "conduciendo, haberte perdido tres veces",
- "y haber hecho doscientos kil\xA2metros de m\xA0s",
- "llegas a una casa que se encuentra en un",
- "paraje muy tranquilo y apartado del mundanal",
- "ruido. (\xAD\xADY TAN APARTADO!!) ...",
- "Pero esto no tiene importancia ... ",
- "Hay que encarar el trabajo con una actitud",
- "optimista y positiva...",
+ "... After driving around in circles for what ",
+ "seemed like hours, you arrive at your new place ",
+ "of employment. It's a grim looking place and ",
+ "not a terrific job at best, but it's the most ",
+ "that you could hope for right now. With that in ",
+ "mind you pull up and decide to give it your all...",
+ "",
+ "",
+ "",
// sacrifice scene
// 9
" A pesar de todo, no lo has hecho tan mal.",
@@ -719,7 +779,7 @@ static const char *const fullScreenMessages[2][56] = {
" If you fail... ETERNAL DEATH!!!",
// 43
" You did it!",
- " I''M FREEEEEEEEEEE!!!",
+ " I""M FREEEEEEEEEEE!!!",
// WC
// 45
"... MMPFFFF!! ...",
@@ -783,10 +843,10 @@ static const char *const hardcodedObjects_EN[] = {
"LIGHT BULB",
"NICHE",
"DIVINE STATUE",
- "POTTER''S HANDBOOK",
+ "POTTER""S HANDBOOK",
"GROTESQUE STATUE",
"WALL",
- "POTTER''S WHEEL",
+ "POTTER""S WHEEL",
"FREE"
};
Commit: 6662321cb1d9848e0d211ea208be3d97d75729b5
https://github.com/scummvm/scummvm/commit/6662321cb1d9848e0d211ea208be3d97d75729b5
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:49+02:00
Commit Message:
TOT: Implements English interlude and ending
Changed paths:
engines/tot/anims.cpp
engines/tot/game.cpp
engines/tot/routines2.cpp
engines/tot/texts.h
diff --git a/engines/tot/anims.cpp b/engines/tot/anims.cpp
index 1e30941d583..3e10ac42592 100644
--- a/engines/tot/anims.cpp
+++ b/engines/tot/anims.cpp
@@ -36,7 +36,7 @@
namespace Tot {
-const int sizefrase = 320 * 30 + 4;
+const int sizefrase = 320 * 70 + 4;
int32 posflicfile;
uint numerovuelta, posrelfli;
@@ -564,7 +564,7 @@ void handleFlcEvent(byte numero_del_evento) {
case 1:
switch (framecontador) {
case 1:
- getImg(0, 0, 319, 29, punterofondofrase);
+ getImg(0, 0, 319, 69, punterofondofrase);
break;
case 3:
drawText(15, 1,
@@ -780,7 +780,7 @@ void handleFlcEvent(byte numero_del_evento) {
case 1:
switch (framecontador) {
case 2:
- getImg(0, 0, 319, 29, punterofondofrase);
+ getImg(0, 0, 319, 69, punterofondofrase);
break;
case 3:
drawText(65, 1,
diff --git a/engines/tot/game.cpp b/engines/tot/game.cpp
index cd2e943982c..57b89ce9cba 100644
--- a/engines/tot/game.cpp
+++ b/engines/tot/game.cpp
@@ -483,7 +483,7 @@ int startGame() {
restoreMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
if (contadorpc2 > 43)
showError(274);
- // sacrificeScene();
+ sacrificeScene();
clear();
loadObjects();
loadPalette("SEGUNDA");
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
index 041e7200a53..cfb4b29c470 100644
--- a/engines/tot/routines2.cpp
+++ b/engines/tot/routines2.cpp
@@ -1767,15 +1767,15 @@ void introduction() {
pulsada_salida = false;
totalFadeOut(0);
- // if (contadorpc > 6)
- // showError(270);
- // cleardevice();
- // drawFlc(136, 53, offsets[2], 136, 9, 1, true, true, false, pulsada_salida);
- // if (pulsada_salida)
- // goto Lsalirpres;
- // drawFlc(135, 54, offsets[3], 0, 9, 2, true, true, false, pulsada_salida);
- // if (pulsada_salida)
- // goto Lsalirpres;
+ if (contadorpc > 6)
+ showError(270);
+ cleardevice();
+ drawFlc(136, 53, offsets[2], 136, 9, 1, true, true, false, pulsada_salida);
+ if (pulsada_salida)
+ goto Lsalirpres;
+ drawFlc(135, 54, offsets[3], 0, 9, 2, true, true, false, pulsada_salida);
+ if (pulsada_salida)
+ goto Lsalirpres;
totalFadeOut(0);
cleardevice();
if(isSpanish) {
@@ -2357,22 +2357,31 @@ void sacrificeScene() {
saveAllowed = false;
palette palaux;
- const char *const *messages = (g_engine->_lang == Common::ES_ESP) ? fullScreenMessages[0] : fullScreenMessages[1];
+ Common::File fich;
+ bool isSpanish = (g_engine->_lang == Common::ES_ESP);
+ const char *const *messages = (isSpanish) ? fullScreenMessages[0] : fullScreenMessages[1];
- const long *offsets = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0] : flcOffsets[1];
+ const long *offsets = (isSpanish) ? flcOffsets[0] : flcOffsets[1];
stopVoc();
bool pulsada_salida = currentRoomData->paletteAnimationFlag;
currentRoomData->paletteAnimationFlag = false;
bar(0, 139, 319, 149, 0);
- bar(10, 10, 300, 120, 0);
-
- outtextxy(10, 10, messages[9], 200);
- outtextxy(10, 30, messages[10], 200);
- outtextxy(10, 50, messages[11], 200);
- outtextxy(10, 70, messages[12], 200);
- outtextxy(10, 90, messages[13], 200);
+ bar(10, 10, 310, 120, 0);
+ if (isSpanish) {
+ outtextxy(10, 10, messages[9], 200);
+ outtextxy(10, 30, messages[10], 200);
+ outtextxy(10, 50, messages[11], 200);
+ outtextxy(10, 70, messages[12], 200);
+ outtextxy(10, 90, messages[13], 200);
+ } else {
+ outtextxy(10, 20, messages[9], 200);
+ outtextxy(10, 40, messages[10], 200);
+ outtextxy(10, 60, messages[11], 200);
+ outtextxy(10, 80, messages[12], 200);
+ outtextxy(10, 100, messages[13], 200);
+ }
for (int i = 0; i <= 28; i++)
setRGBPalette(200, i * 2, i * 2, i * 2);
@@ -2384,12 +2393,19 @@ void sacrificeScene() {
for (int i = 28; i >= 0; i--)
setRGBPalette(200, i * 2, i * 2, i * 2);
- bar(10, 10, 300, 120, 0);
- outtextxy(10, 10, messages[14], 200);
- outtextxy(10, 30, messages[15], 200);
- outtextxy(10, 50, messages[16], 200);
- outtextxy(10, 70, messages[17], 200);
- outtextxy(10, 90, messages[18], 200);
+ bar(10, 10, 310, 120, 0);
+ if (isSpanish) {
+ outtextxy(10, 10, messages[14], 200);
+ outtextxy(10, 30, messages[15], 200);
+ outtextxy(10, 50, messages[16], 200);
+ outtextxy(10, 70, messages[17], 200);
+ outtextxy(10, 90, messages[18], 200);
+ } else {
+ outtextxy(10, 20, messages[14], 200);
+ outtextxy(10, 40, messages[15], 200);
+ outtextxy(10, 60, messages[16], 200);
+ outtextxy(10, 80, messages[17], 200);
+ }
for (int i = 0; i <= 28; i++)
setRGBPalette(200, i * 2, i * 2, i * 2);
@@ -2400,11 +2416,17 @@ void sacrificeScene() {
for (int i = 28; i >= 0; i--)
setRGBPalette(200, i * 2, i * 2, i * 2);
- bar(10, 10, 300, 120, 0);
- outtextxy(10, 10, messages[19], 200);
- outtextxy(10, 50, messages[20] , 200);
- outtextxy(10, 70, messages[21] , 200);
- outtextxy(10, 90, messages[22], 200);
+ bar(10, 10, 310, 120, 0);
+ if (isSpanish) {
+ outtextxy(10, 10, messages[19], 200);
+ outtextxy(10, 50, messages[20], 200);
+ outtextxy(10, 70, messages[21], 200);
+ outtextxy(10, 90, messages[22], 200);
+ } else {
+ outtextxy(10, 30, messages[19], 200);
+ outtextxy(10, 60, messages[20], 200);
+ outtextxy(10, 80, messages[21], 200);
+ }
for (int i = 0; i <= 28; i++)
setRGBPalette(200, i * 2, i * 2, i * 2);
@@ -2414,9 +2436,8 @@ void sacrificeScene() {
for (int i = 28; i >= 0; i--)
setRGBPalette(200, i * 2, i * 2, i * 2);
- bar(10, 10, 300, 120, 0);
+ bar(10, 10, 310, 120, 0);
- Common::File fich;
if (!fich.open("SALONREC.PAN")) {
showError(318);
}
@@ -2456,17 +2477,17 @@ void sacrificeScene() {
outtextxy(10, 31, messages[23], 254);
outtextxy(10, 29, messages[23], 254);
outtextxy(11, 30, messages[23], 254);
- outtextxy(9, 30, messages[23], 254);
+ outtextxy(9, 30, messages[23], 254);
outtextxy(10, 51, messages[24], 254);
outtextxy(10, 49, messages[24], 254);
outtextxy(11, 50, messages[24], 254);
- outtextxy(9, 50, messages[24], 254);
+ outtextxy(9, 50, messages[24], 254);
outtextxy(10, 71, messages[25], 254);
outtextxy(10, 69, messages[25], 254);
outtextxy(11, 70, messages[25], 254);
- outtextxy(9, 70, messages[25], 254);
+ outtextxy(9, 70, messages[25], 254);
outtextxy(10, 30, messages[23], 255);
outtextxy(10, 50, messages[24], 255);
@@ -2557,13 +2578,31 @@ void sacrificeScene() {
outtextxy(11, 140, messages[32], 254);
outtextxy(9, 140, messages[32], 254);
- outtextxy(10, 20, messages[26], 255);
- outtextxy(10, 40, messages[27], 255);
- outtextxy(10, 60, messages[28], 255);
- outtextxy(10, 80, messages[29], 255);
+ if (!isSpanish) {
+ outtextxy(10, 161, messages[56], 254);
+ outtextxy(10, 159, messages[56], 254);
+ outtextxy(11, 160, messages[56], 254);
+ outtextxy(9, 160, messages[56], 254);
+
+ outtextxy(10, 181, messages[57], 254);
+ outtextxy(10, 179, messages[57], 254);
+ outtextxy(11, 180, messages[57], 254);
+ outtextxy(9, 180, messages[57], 254);
+ }
+
+ outtextxy(10, 20, messages[26], 255);
+ outtextxy(10, 40, messages[27], 255);
+ outtextxy(10, 60, messages[28], 255);
+ outtextxy(10, 80, messages[29], 255);
outtextxy(10, 100, messages[30], 255);
outtextxy(10, 120, messages[31], 255);
outtextxy(10, 140, messages[32], 255);
+
+ if (!isSpanish) {
+ outtextxy(10, 160, messages[56], 255);
+ outtextxy(10, 180, messages[57], 255);
+ }
+
for (int i = 0; i <= 31; i++) {
setRGBPalette(255, 32 + i, i * 2, i * 2);
setRGBPalette(254, 32 - i, 0, 0);
@@ -2581,48 +2620,52 @@ void sacrificeScene() {
return;
clear();
- outtextxy(10, 21, messages[33], 254);
- outtextxy(10, 19, messages[33], 254);
- outtextxy(11, 20, messages[33], 254);
- outtextxy(9, 20, messages[33], 254);
-
- outtextxy(10, 41, messages[34], 254);
- outtextxy(10, 39, messages[34], 254);
- outtextxy(11, 40, messages[34], 254);
- outtextxy(9, 40, messages[34], 254);
-
- outtextxy(10, 61, messages[35], 254);
- outtextxy(10, 59, messages[35], 254);
- outtextxy(11, 60, messages[35], 254);
- outtextxy(9, 60, messages[35], 254);
-
- outtextxy(10, 81, messages[36], 254);
- outtextxy(10, 79, messages[36], 254);
- outtextxy(11, 80, messages[36], 254);
- outtextxy(9, 80, messages[36], 254);
-
- outtextxy(10, 101, messages[37], 254);
- outtextxy(10, 99, messages[37], 254);
- outtextxy(11, 100, messages[37], 254);
- outtextxy(9, 100, messages[37], 254);
-
- outtextxy(10, 121, messages[38], 254);
- outtextxy(10, 119, messages[38], 254);
- outtextxy(11, 120, messages[38], 254);
- outtextxy(9, 120, messages[38], 254);
-
- outtextxy(10, 141, messages[39], 254);
- outtextxy(10, 139, messages[39], 254);
- outtextxy(11, 140, messages[39], 254);
- outtextxy(9, 140, messages[39], 254);
-
- outtextxy(10, 20, messages[33], 255);
- outtextxy(10, 40, messages[34], 255);
- outtextxy(10, 60, messages[35], 255);
- outtextxy(10, 80, messages[36], 255);
- outtextxy(10, 100, messages[37], 255);
- outtextxy(10, 120, messages[38], 255);
- outtextxy(10, 140, messages[39], 255);
+
+ outtextxy(10, 21, messages[33], 254);
+ outtextxy(10, 19, messages[33], 254);
+ outtextxy(11, 20, messages[33], 254);
+ outtextxy(9, 20, messages[33], 254);
+
+ outtextxy(10, 41, messages[34], 254);
+ outtextxy(10, 39, messages[34], 254);
+ outtextxy(11, 40, messages[34], 254);
+ outtextxy(9, 40, messages[34], 254);
+
+ outtextxy(10, 61, messages[35], 254);
+ outtextxy(10, 59, messages[35], 254);
+ outtextxy(11, 60, messages[35], 254);
+ outtextxy(9, 60, messages[35], 254);
+ if (isSpanish) {
+ outtextxy(10, 81, messages[36], 254);
+ outtextxy(10, 79, messages[36], 254);
+ outtextxy(11, 80, messages[36], 254);
+ outtextxy(9, 80, messages[36], 254);
+
+ outtextxy(10, 101, messages[37], 254);
+ outtextxy(10, 99, messages[37], 254);
+ outtextxy(11, 100, messages[37], 254);
+ outtextxy(9, 100, messages[37], 254);
+
+ outtextxy(10, 121, messages[38], 254);
+ outtextxy(10, 119, messages[38], 254);
+ outtextxy(11, 120, messages[38], 254);
+ outtextxy(9, 120, messages[38], 254);
+
+ outtextxy(10, 141, messages[39], 254);
+ outtextxy(10, 139, messages[39], 254);
+ outtextxy(11, 140, messages[39], 254);
+ outtextxy(9, 140, messages[39], 254);
+ }
+
+ outtextxy(10, 20, messages[33], 255);
+ outtextxy(10, 40, messages[34], 255);
+ outtextxy(10, 60, messages[35], 255);
+ if (isSpanish) {
+ outtextxy(10, 80, messages[36], 255);
+ outtextxy(10, 100, messages[37], 255);
+ outtextxy(10, 120, messages[38], 255);
+ outtextxy(10, 140, messages[39], 255);
+ }
for (int i = 0; i < 32; i++) {
setRGBPalette(255, 32 + i, i * 2, i * 2);
@@ -2640,23 +2683,24 @@ void sacrificeScene() {
if (g_engine->shouldQuit())
return;
clear();
- outtextxy(10, 61, messages[40], 254);
- outtextxy(10, 59, messages[40], 254);
- outtextxy(11, 60, messages[40], 254);
- outtextxy(9, 60, messages[40], 254);
- outtextxy(10, 81, messages[41], 254);
- outtextxy(10, 79, messages[41], 254);
- outtextxy(11, 80, messages[41], 254);
- outtextxy(9, 80, messages[41], 254);
+ outtextxy(10, 61, messages[40], 254);
+ outtextxy(10, 59, messages[40], 254);
+ outtextxy(11, 60, messages[40], 254);
+ outtextxy(9, 60, messages[40], 254);
+
+ outtextxy(10, 81, messages[41], 254);
+ outtextxy(10, 79, messages[41], 254);
+ outtextxy(11, 80, messages[41], 254);
+ outtextxy(9, 80, messages[41], 254);
outtextxy(10, 101, messages[42], 254);
- outtextxy(10, 99, messages[42], 254);
+ outtextxy(10, 99, messages[42], 254);
outtextxy(11, 100, messages[42], 254);
- outtextxy(9, 100, messages[42], 254);
+ outtextxy(9, 100, messages[42], 254);
- outtextxy(10, 60, messages[40], 255);
- outtextxy(10, 80, messages[41], 255);
+ outtextxy(10, 60, messages[40], 255);
+ outtextxy(10, 80, messages[41], 255);
outtextxy(10, 100, messages[42], 255);
for (int i = 0; i < 32; i++) {
diff --git a/engines/tot/texts.h b/engines/tot/texts.h
index b005420337b..d70312f3487 100644
--- a/engines/tot/texts.h
+++ b/engines/tot/texts.h
@@ -520,81 +520,86 @@ static const char *const animMessages[2][290] = {
"",
"",
// 170
- "Toma una copita, te la has ganado...", "", "", "", "",
+ "Here, have a drink. You've earned it!", "", "", "", "",
// 175
- "\xA8""Donde estoy? ... \xA8Qu\x82 me ha pasado?", "", "", "", "",
- // 180
- "Tranquilizate, no est\xA0s muerto...",
- "Est\xA0s tras la puerta de acero...",
+ "What happened? Where am I? Why am I strapped",
+ "down like this? Is this some kinda pervy",
+ "thing or something?",
"",
"",
+ // 180
+ "SILENCE! We drugged you! You are behind the",
+ "\"Steel Door.\" And no it isn't!",
"",
- // 185
- "Te necesitamos para encontrar a Jacob,",
- "nuestro Gran Maestre.",
"",
"",
+ // 185
+ "We need you to venture into the unknown to",
+ "find Jacob! The master! Some days ago he",
+ "began to study the book that you found for",
+ "me. However shortly afterward he disappeared!",
"",
// 190
- "Hace unos dias se puso a estudiar el libro",
- "que me diste y desapareci\xA2...",
- "",
+ "We think he passed over to the... OTHER SIDE!",
"",
"",
- // 195
- "Creemos que realiz\xA2 un conjuro sin darse cuenta...",
"",
"",
+ // 195
+ "Fortunately I had read some of the sacred",
+ "pages of the book for myself and I believe",
+ "that we can retrieve him!",
"",
"",
// 200
- "Por fortuna, pudimos ponernos en contacto",
- "con \x82l, y nos dijo que est\xA0 en problemas...",
- "",
+ "It is therefore my belief that if another",
+ "soul is sent to search for his, he can be",
+ "brought back to us. That soul is YOURS!!",
"",
"",
// 205
- "Nos pidi\xA2 que envi\xA0semos a alguien en su ayuda,",
- "y TU eres el elegido...",
- "",
+ "However in order to enter the Eternal Caverns,",
+ "you must DIE!!! No material substance may dwell",
+ "there.",
"",
"",
// 210
- "Para ir a las CAVERNAS ETERNAS debes morir...",
- "Ning\xA3n cuerpo con alma puede estar all\xA1...",
- "",
- "",
+ "So we will perform an ancient ritual in which",
+ "a beast is slaughtered to summon the link",
+ "between this world and the next, and YOU will",
+ "be sacrificed to carry out the task!",
"",
// 215
- "Haremos un ritual para crear un v\xA1nculo entre tu",
- "cuerpo y tu alma, s\xA2lo as\xA1 podr\xA0s volver a la vida...",
+ "If you rescue Jacob, your body will be brought",
+ "back to life.",
"",
"",
"",
// 220
- "Si rescatas a Jacob, el v\xA1nculo te traer\xA0 de regreso...", "", "", "", "",
+ "Enough of this! Your time has come!",
+ "Prepare to die!...", "", "", "",
// 225
- "Ahora... \xADPrep\xA0rate!... Ha llegado tu hora...", "", "", "", "",
+ "Horribly!!!", "", "", "", "",
// 230
- "\xADGracias ILUSO!...", "", "", "", "",
+ "Thank you my nieve young friend...", "", "", "", "",
// 235
- "Ahora tendr\x82 un cuerpo nuevo y podr\x82",
- "volver a la vida...",
- "",
+ "Now I have a new young body to return",
+ "to the material world with. I'll live",
+ "once more!",
"",
"",
// 240
- "Tu mientras tanto, puedes seguir en",
- "las CAVERNAS ETERNAS...",
- "",
+ "However I'm afraid you'll have to",
+ "remain here for a while; probably",
+ "only for eternity!",
"",
"",
// 245
- "No te preocupes, seguro que nos mandan",
- "otro encargado... JA,JA,JA...",
- "",
- "",
- "",
+ "But don't worry, I'm sure we'll find a new",
+ "Care Assistant to take care of the house.",
+ "Oh, by the way. If it's any consolation,",
+ "I'm ETERNALLY grateful!",
+ " HA, HA, HA, HA, HAAAAAAAAAA......",
// 250
"I knew I shouldn't of",
"listened to her. \"Oh,",
@@ -646,7 +651,7 @@ static const char *const animMessages[2][290] = {
}
};
-static const char *const fullScreenMessages[2][56] = {
+static const char *const fullScreenMessages[2][58] = {
// Spanish
{
// intro
@@ -719,6 +724,9 @@ static const char *const fullScreenMessages[2][56] = {
"me ha liberado de las Cavernas",
"Eternas, por lo cual le estar\x82 ",
"por siempre agradecido."
+ // 57
+ "him back! If you achieve this your body will",
+ " live once more."
},
// English
@@ -735,40 +743,40 @@ static const char *const fullScreenMessages[2][56] = {
"",
// sacrifice scene
// 9
- " A pesar de todo, no lo has hecho tan mal.",
- " Has conseguido todo lo que te pidieron, y",
- " van a poder celebrar su fiesta de Halloween.",
- " Es todo un detalle que t\xA3 seas el invitado",
- " de honor...",
+ " You didn't do too bad after all! You got them ",
+ " everything that they asked for. Now they can ",
+ " have their fun and celebrate Halloween the way ",
+ " they want to. Although you begin to wonder why ",
+ " you are to be their... \"special guest.\"",
// 14
- " Como recompensa a tus esfuerzos te mandan a",
- " darte una vuelta por ah\xA1 mientras ellos se",
- " encargan de los preparativos de la fiesta.",
- " T\xA3, obviamente, aceptas de inmediato y te",
- " vas a tomar el fresco un rato...",
+ " As a reward, they let you go on a break for half",
+ " an hour while they prepare the party.",
+ " Obviously you jump at the chance and step out",
+ " for a breath of fresh air...",
+ "",
//19
- " Horas m\xA0s tarde... ",
- " La fiesta ya est\xA0 preparada, regresas al",
- " sal\xA2n a recibir tus merecidos honores, tras",
- " un completo dia de trabajo... ",
+ " A while later the party is set...",
+ "You return to find them in the living room, looking",
+ "a bit suspicious...",
+ "",
// 23
- " Despu\x82s de todo lo que hice por ellos...",
- " Todos mis esfuerzos y desvelos para esto...",
- " Morir envenenado, ese era mi destino...",
+ " Those bloody, old, ba^%$?ds!",
+ " They've poisoned me! After all the kindness",
+ " and affection that I've shown them! Oh, Bugger!",
// 26
- " Presta atenci\xA2n, pues esta puede ser la \xA3ltima",
- " vez que hablemos contigo. Definitivamente est\xA0s",
- " muerto, pero a\xA3n es posible reunir tu alma con",
- " tu cuerpo, para ello debes buscar a Jacob y",
- " liberarlo de aquello que lo retenga. Cuando lo",
- " consigas podremos traeros a ambos de vuelta al",
- " mundo de los vivos.",
+ " As the knife plunges deep into your chest, you ",
+ " feel all of your life being drained from you. ",
+ " But through it all you hear a voice. \"Listen ",
+ " carfully, for this might be the last time you ",
+ " hear us. You're dead! But it still is possible ",
+ " for your body to return. You must find Jacob,",
+ " and free him from whoever or whatever is holding ",
// 33
" However you must hurry, for the link between ",
" your body and soul will deminish and your soul ",
" will be trapped in the Eternal Caverns... FOREVER!",
- //FIXME! dont show these in the english version!
+ // 36
" Si necesitaras m\xA0s energ\xA1""a de la que tienes, ",
" recuerda que all\xA0 donde vas un cuerpo contiene",
" m\xA0s energ\xA1""a que un alma al contrario que en el",
@@ -788,13 +796,16 @@ static const char *const fullScreenMessages[2][56] = {
"... AAAHHHHH!! ...",
// Diploma
// 49
- "CERTIFICADO N\xA7:",
- "Yo, Jacob, el Gran Maestre ",
- "de la Hermandad de Sek Umh Nejl",
- "certifico que: ",
- "me ha liberado de las Cavernas",
- "Eternas, por lo cual le estar\x82 ",
- "por siempre agradecido."
+ "CERTIFICATE No:",
+ "I, Jacob, the Great Master",
+ "of the Sek Umh Fraternity",
+ "certify that: ",
+ "has liberated me from the",
+ "Eternal Caverns, and I shall be",
+ "greatful to him forever.",
+ // 56
+ " him back! If you achieve this your body will",
+ " live once more."
},
};
Commit: f8334ed516c8bb42e457acb6898739b8a1620fce
https://github.com/scummvm/scummvm/commit/f8334ed516c8bb42e457acb6898739b8a1620fce
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:49+02:00
Commit Message:
TOT: Fixes odd delay on menu animation
Changed paths:
engines/tot/anims.cpp
engines/tot/game.cpp
engines/tot/playanim.cpp
engines/tot/playanim.h
engines/tot/routines2.cpp
engines/tot/tot.cpp
diff --git a/engines/tot/anims.cpp b/engines/tot/anims.cpp
index 3e10ac42592..16052e5f842 100644
--- a/engines/tot/anims.cpp
+++ b/engines/tot/anims.cpp
@@ -947,7 +947,7 @@ static void loadFlc(
flic.start();
do {
- g_engine->_chrono->updateChrono();
+ exitProcedure(salidaflis, permitesalida);
numerovuelta++;
do {
g_engine->_chrono->updateChrono();
@@ -1011,7 +1011,6 @@ static void loadFlc(
framecontador = 0;
primeravuelta = false;
}
- g_system->delayMillis(10);
} while (numerovuelta <= loop && !g_engine->shouldQuit());
flic.stop();
Lsalir_proc:
diff --git a/engines/tot/game.cpp b/engines/tot/game.cpp
index 57b89ce9cba..1201309ccbe 100644
--- a/engines/tot/game.cpp
+++ b/engines/tot/game.cpp
@@ -96,7 +96,6 @@ int engine_start() {
loadPalette("DEFAULT");
loadScreenMemory();
-
initialLogo();
playMidiFile("INTRODUC", true);
setMidiVolume(3, 3);
diff --git a/engines/tot/playanim.cpp b/engines/tot/playanim.cpp
index 077bf51f1f8..5828c9ad42b 100644
--- a/engines/tot/playanim.cpp
+++ b/engines/tot/playanim.cpp
@@ -67,6 +67,8 @@ bool inGame;
bool hechaprimeravez;
+bool introSeen;
+
bool salirdeljuego;
bool partidanueva;
@@ -721,6 +723,7 @@ void initPlayAnim() {
contadorpc2 = 0;
continuarpartida = true;
hechaprimeravez = false;
+ introSeen = false;
inGame = false;
}
diff --git a/engines/tot/playanim.h b/engines/tot/playanim.h
index 3cd720113f8..0c7ba301e4c 100644
--- a/engines/tot/playanim.h
+++ b/engines/tot/playanim.h
@@ -343,6 +343,10 @@ extern bool inGame;
* Flag for first time run of the game.
*/
extern bool hechaprimeravez;
+
+
+extern bool introSeen;
+
/**
* Flag to exit program.
*/
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
index cfb4b29c470..2929c89a032 100644
--- a/engines/tot/routines2.cpp
+++ b/engines/tot/routines2.cpp
@@ -1887,7 +1887,7 @@ Lsalirpres:
}
void firstIntroduction() {
- if (!hechaprimeravez) {
+ if (!hechaprimeravez && !introSeen) {
introduction();
hechaprimeravez = true;
ConfMan.setBool("introSeen", true);
diff --git a/engines/tot/tot.cpp b/engines/tot/tot.cpp
index 6f8fabb9419..f45c75f6016 100644
--- a/engines/tot/tot.cpp
+++ b/engines/tot/tot.cpp
@@ -86,7 +86,7 @@ Common::Error TotEngine::run() {
initGraph();
initPlayAnim();
- hechaprimeravez = ConfMan.getBool("introSeen");
+ introSeen = ConfMan.getBool("introSeen");
// _inventoryManager = new InventoryManager();
// _totGame = new TotGame();
// Set the engine's debugger console
Commit: 958cec573253c9e5cde41cb1c830373f3c1584f3
https://github.com/scummvm/scummvm/commit/958cec573253c9e5cde41cb1c830373f3c1584f3
Author: gsanmartin (gabriel.sanmartin at dna.inc)
Date: 2025-09-08T16:49:49+02:00
Commit Message:
TOT: Fixes code with latest PCSpeaker changes
Changed paths:
engines/tot/soundman.cpp
diff --git a/engines/tot/soundman.cpp b/engines/tot/soundman.cpp
index eb5a2b3d3ab..805c7f4cf2f 100644
--- a/engines/tot/soundman.cpp
+++ b/engines/tot/soundman.cpp
@@ -107,7 +107,7 @@ void SoundManager::toggleMusic() {
}
void SoundManager::beep(int32 frequency, int32 ms) {
- Audio::PCSpeaker *speaker = new Audio::PCSpeaker(_mixer->getOutputRate());
+ Audio::PCSpeakerStream *speaker = new Audio::PCSpeakerStream(_mixer->getOutputRate());
speaker->setVolume(255);
speaker->play(Audio::PCSpeaker::kWaveFormSine, frequency, ms);
_mixer->playStream(Audio::Mixer::kSFXSoundType, &_speakerHandle,
Commit: b450f816eab9447b5f624b482f6251103b42ed8e
https://github.com/scummvm/scummvm/commit/b450f816eab9447b5f624b482f6251103b42ed8e
Author: gsanmartin (gabriel.sanmartin at dna.inc)
Date: 2025-09-08T16:49:49+02:00
Commit Message:
TOT: Uses custom FM patches
Changed paths:
A engines/tot/midi.cpp
A engines/tot/midi.h
engines/tot/game.cpp
engines/tot/module.mk
engines/tot/playanim.h
engines/tot/soundman.cpp
engines/tot/soundman.h
diff --git a/engines/tot/game.cpp b/engines/tot/game.cpp
index 1201309ccbe..e445cd88fe6 100644
--- a/engines/tot/game.cpp
+++ b/engines/tot/game.cpp
@@ -99,7 +99,6 @@ int engine_start() {
initialLogo();
playMidiFile("INTRODUC", true);
setMidiVolume(3, 3);
-
firstIntroduction();
setMousePos(1, xraton, yraton);
initialMenu(hechaprimeravez);
@@ -153,6 +152,7 @@ int startGame() {
changeGameSpeed(e);
switch (e.kbd.keycode) {
+
case Common::KEYCODE_ESCAPE:
escapePressed = true;
break;
@@ -164,43 +164,37 @@ int startGame() {
// saveLoad();
break;
default:
- if(e.kbd.keycode == hotKeyOpen) {
+ if (e.kbd.keycode == hotKeyOpen) {
numeroaccion = 5;
action();
oldxrejilla = 0;
oldyrejilla = 0;
- }
- else if (e.kbd.keycode == hotKeyClose) {
+ } else if (e.kbd.keycode == hotKeyClose) {
numeroaccion = 6;
action();
oldxrejilla = 0;
oldyrejilla = 0;
- }
- else if (e.kbd.keycode == hotKeyPickup) {
+ } else if (e.kbd.keycode == hotKeyPickup) {
numeroaccion = 2;
action();
oldxrejilla = 0;
oldyrejilla = 0;
- }
- else if (e.kbd.keycode == hotKeyTalk) {
+ } else if (e.kbd.keycode == hotKeyTalk) {
numeroaccion = 1;
action();
oldxrejilla = 0;
oldyrejilla = 0;
- }
- else if (e.kbd.keycode == hotKeyLook) {
+ } else if (e.kbd.keycode == hotKeyLook) {
numeroaccion = 3;
action();
oldxrejilla = 0;
oldyrejilla = 0;
- }
- else if (e.kbd.keycode == hotKeyUse) {
+ } else if (e.kbd.keycode == hotKeyUse) {
numeroaccion = 4;
action();
oldxrejilla = 0;
oldyrejilla = 0;
- }
- else {
+ } else {
numeroaccion = 0; // go to
}
}
diff --git a/engines/tot/midi.cpp b/engines/tot/midi.cpp
new file mode 100644
index 00000000000..b572cd5bba3
--- /dev/null
+++ b/engines/tot/midi.cpp
@@ -0,0 +1,1907 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "audio/adlib_ms.h"
+#include "audio/midiparser.h"
+#include "common/debug.h"
+#include "common/file.h"
+
+#include "tot/midi.h"
+
+namespace Tot {
+
+uint8 rawInstrumentBank[128][11] = {
+ {0x00, 0x00, 0x4F, 0x00, 0xF1, 0xD2, 0x51, 0x43, 0x00, 0x00, 0x06},
+ {0x02, 0x12, 0x4F, 0x00, 0xF1, 0xD2, 0x51, 0x43, 0x00, 0x00, 0x02},
+ {0x00, 0x11, 0x4A, 0x00, 0xF1, 0xD2, 0x53, 0x74, 0x00, 0x00, 0x06},
+ {0x03, 0x11, 0x4F, 0x00, 0xF1, 0xD2, 0x53, 0x74, 0x01, 0x01, 0x06},
+ {0x01, 0x11, 0x66, 0x00, 0xF1, 0xD2, 0x51, 0xC3, 0x00, 0x00, 0x06},
+ {0xC0, 0xD2, 0x52, 0x00, 0xF1, 0xD2, 0x53, 0x94, 0x00, 0x00, 0x06},
+ {0x12, 0x18, 0x86, 0x00, 0xF3, 0xFC, 0x00, 0x33, 0x00, 0x00, 0x08},
+ {0xD0, 0x12, 0x4E, 0x00, 0xA8, 0x92, 0x32, 0xA7, 0x03, 0x02, 0x00},
+ {0xC8, 0xD1, 0x4F, 0x00, 0xF2, 0xF3, 0x64, 0x77, 0x00, 0x00, 0x08},
+ {0x33, 0x34, 0x0E, 0x00, 0x01, 0x7D, 0x11, 0x34, 0x00, 0x00, 0x08},
+ {0x17, 0x16, 0x50, 0x00, 0xD1, 0xD3, 0x52, 0x92, 0x00, 0x01, 0x04},
+ {0xE7, 0xE1, 0x21, 0x00, 0xF5, 0xF6, 0x77, 0x14, 0x00, 0x00, 0x08},
+ {0x95, 0x81, 0x4E, 0x00, 0xDA, 0xF9, 0x25, 0x15, 0x00, 0x00, 0x0A},
+ {0x27, 0x21, 0x1F, 0x00, 0xF5, 0xF5, 0x96, 0x57, 0x00, 0x00, 0x08},
+ {0x87, 0xF1, 0x4E, 0x80, 0xB1, 0xE6, 0x33, 0x42, 0x00, 0x00, 0x00},
+ {0x31, 0x11, 0x87, 0x80, 0xA1, 0x7D, 0x11, 0x43, 0x00, 0x00, 0x08},
+ {0x32, 0xB1, 0x8C, 0x00, 0x91, 0xA1, 0x07, 0x19, 0x02, 0x00, 0x05},
+ {0x31, 0xB4, 0x54, 0x80, 0xF1, 0xF5, 0x07, 0x19, 0x00, 0x00, 0x07},
+ {0x24, 0x21, 0x40, 0x49, 0xFF, 0xFF, 0x0F, 0x0F, 0x00, 0x00, 0x01},
+ {0xD2, 0xF1, 0x44, 0x80, 0x91, 0xA1, 0x57, 0x09, 0x01, 0x01, 0x03},
+ {0x01, 0x02, 0x52, 0x80, 0xF0, 0xF0, 0x1F, 0x1F, 0x01, 0x00, 0x0A},
+ {0x21, 0x32, 0x4F, 0x01, 0xF2, 0x52, 0x0B, 0x0B, 0x00, 0x01, 0x0A},
+ {0xF0, 0xF2, 0x93, 0x00, 0xD8, 0xB3, 0x0B, 0x0B, 0x02, 0x01, 0x0A},
+ {0x20, 0x31, 0x5D, 0x00, 0xF2, 0x52, 0x0B, 0x0B, 0x03, 0x02, 0x00},
+ {0x01, 0x01, 0x1B, 0x00, 0xF4, 0xF3, 0x25, 0x46, 0x02, 0x00, 0x00},
+ {0x11, 0x01, 0x0F, 0x00, 0xF4, 0xF3, 0x25, 0x46, 0x01, 0x00, 0x00},
+ {0x01, 0x01, 0x27, 0x00, 0xF1, 0xF4, 0x1F, 0x88, 0x02, 0x00, 0x0A},
+ {0x12, 0x13, 0x44, 0x00, 0xEA, 0xD2, 0x32, 0xE7, 0x01, 0x01, 0x00},
+ {0x30, 0x31, 0x45, 0x00, 0xA4, 0xF5, 0x32, 0xE7, 0x03, 0x00, 0x00},
+ {0x21, 0x21, 0x0F, 0x00, 0xF5, 0xF1, 0x17, 0x78, 0x02, 0x01, 0x04},
+ {0x01, 0x20, 0x41, 0x00, 0xD1, 0xC1, 0x34, 0xA5, 0x03, 0x03, 0x04},
+ {0x10, 0x12, 0x43, 0x00, 0xA7, 0xE3, 0x97, 0xE7, 0x03, 0x02, 0x00},
+ {0x20, 0x21, 0x28, 0x00, 0xC5, 0xD2, 0x15, 0xA4, 0x00, 0x00, 0x0C},
+ {0x30, 0x21, 0x16, 0x00, 0xF2, 0xF3, 0x9F, 0x78, 0x00, 0x00, 0x0C},
+ {0x30, 0x21, 0x11, 0x00, 0x82, 0xF3, 0x9F, 0x78, 0x00, 0x00, 0x0A},
+ {0x21, 0x21, 0x23, 0x00, 0x73, 0x93, 0x1A, 0x87, 0x00, 0x00, 0x0C},
+ {0x30, 0x21, 0x0E, 0x00, 0x62, 0xF3, 0x55, 0x68, 0x02, 0x00, 0x0A},
+ {0x30, 0x22, 0x0C, 0x00, 0x62, 0xD5, 0xB5, 0x98, 0x01, 0x00, 0x08},
+ {0x70, 0x72, 0x93, 0x40, 0x64, 0xA1, 0x43, 0x43, 0x00, 0x00, 0x0A},
+ {0x30, 0x32, 0x8D, 0x80, 0x44, 0x92, 0x43, 0x43, 0x02, 0x00, 0x0A},
+ {0xE1, 0xE2, 0x4E, 0x00, 0x65, 0x61, 0x43, 0x44, 0x02, 0x02, 0x00},
+ {0xA1, 0xA2, 0x8E, 0x00, 0x65, 0x63, 0x43, 0x45, 0x02, 0x02, 0x00},
+ {0xB0, 0x61, 0x87, 0x40, 0xD1, 0x62, 0x11, 0x15, 0x02, 0x01, 0x06},
+ {0xF0, 0x20, 0x8A, 0x80, 0xB1, 0xA0, 0x11, 0x15, 0x02, 0x01, 0x06},
+ {0xF1, 0xE2, 0x89, 0x40, 0x73, 0x43, 0x01, 0x05, 0x02, 0x00, 0x06},
+ {0x31, 0x21, 0x57, 0x80, 0xF8, 0xF7, 0xF9, 0xE6, 0x03, 0x02, 0x0E},
+ {0x32, 0x01, 0x24, 0x80, 0xF1, 0xF5, 0x35, 0x35, 0x00, 0x00, 0x00},
+ {0x00, 0x00, 0x04, 0x00, 0xAA, 0xD2, 0xC8, 0xB3, 0x00, 0x00, 0x0A},
+ {0xE0, 0xF1, 0x4F, 0x00, 0xD4, 0x55, 0x0B, 0x0B, 0x02, 0x02, 0x0A},
+ {0xE0, 0xF0, 0x52, 0x00, 0x96, 0x35, 0x05, 0x01, 0x02, 0x02, 0x0A},
+ {0xE1, 0xF1, 0x4F, 0x00, 0x36, 0x45, 0x05, 0x02, 0x02, 0x02, 0x0A},
+ {0xE2, 0xE1, 0x48, 0x80, 0x21, 0x41, 0x43, 0x45, 0x02, 0x01, 0x00},
+ {0xE0, 0xF1, 0x16, 0x00, 0x41, 0x20, 0x52, 0x72, 0x02, 0x02, 0x00},
+ {0xE0, 0xF1, 0x11, 0x00, 0x01, 0xD0, 0x52, 0x72, 0x02, 0x02, 0x00},
+ {0xE0, 0xF1, 0x1A, 0x00, 0x61, 0x30, 0x52, 0x73, 0x00, 0x02, 0x00},
+ {0x50, 0x50, 0x0B, 0x00, 0x84, 0xA4, 0x4B, 0x99, 0x00, 0x00, 0x0A},
+ {0x31, 0x61, 0x1C, 0x80, 0x41, 0x92, 0x0B, 0x3B, 0x00, 0x00, 0x0E},
+ {0xB1, 0x61, 0x1C, 0x00, 0x41, 0x92, 0x1F, 0x3B, 0x00, 0x00, 0x0E},
+ {0x20, 0x21, 0x18, 0x00, 0x52, 0xA2, 0x15, 0x24, 0x00, 0x00, 0x0C},
+ {0xC1, 0xC1, 0x94, 0x80, 0x74, 0xA3, 0xEA, 0xF5, 0x02, 0x01, 0x0E},
+ {0x21, 0x21, 0x28, 0x00, 0x41, 0x81, 0xB4, 0x98, 0x00, 0x00, 0x0E},
+ {0x21, 0x21, 0x1D, 0x00, 0x51, 0xE1, 0xAE, 0x3E, 0x02, 0x01, 0x0E},
+ {0xE0, 0xE0, 0x93, 0x80, 0x51, 0x81, 0xA6, 0x97, 0x02, 0x01, 0x0E},
+ {0xE0, 0xE1, 0x93, 0x80, 0x51, 0xE1, 0xA6, 0x97, 0x02, 0x01, 0x0E},
+ {0xE0, 0xF2, 0x4B, 0x01, 0xD8, 0xB3, 0x0B, 0x0B, 0x02, 0x01, 0x08},
+ {0xE0, 0xF1, 0x49, 0x01, 0xB8, 0xB3, 0x0B, 0x0B, 0x02, 0x01, 0x08},
+ {0xE0, 0xF0, 0x4E, 0x01, 0x98, 0xC3, 0x0B, 0x0B, 0x01, 0x02, 0x08},
+ {0xE0, 0xF1, 0x4C, 0x01, 0x88, 0xD3, 0x0B, 0x0B, 0x01, 0x01, 0x08},
+ {0xF1, 0xE4, 0xC5, 0x00, 0x7E, 0x8C, 0x17, 0x0E, 0x00, 0x00, 0x08},
+ {0x60, 0x72, 0x4F, 0x00, 0xD8, 0xB3, 0x0B, 0x0B, 0x00, 0x01, 0x0A},
+ {0x31, 0x72, 0xD1, 0x80, 0xD5, 0x91, 0x19, 0x1B, 0x00, 0x00, 0x0C},
+ {0x32, 0x71, 0xC8, 0x80, 0xD5, 0x73, 0x19, 0x1B, 0x00, 0x00, 0x0C},
+ {0xE2, 0x62, 0x6A, 0x00, 0x9E, 0x55, 0x8F, 0x2A, 0x00, 0x00, 0x0E},
+ {0xE0, 0x61, 0xEC, 0x00, 0x7E, 0x65, 0x8F, 0x2A, 0x00, 0x00, 0x0E},
+ {0x62, 0xA2, 0x88, 0x83, 0x84, 0x75, 0x27, 0x17, 0x00, 0x00, 0x09},
+ {0x62, 0xA2, 0x84, 0x83, 0x84, 0x75, 0x27, 0x17, 0x00, 0x00, 0x09},
+ {0xE3, 0x62, 0x6D, 0x00, 0x57, 0x57, 0x04, 0x77, 0x00, 0x00, 0x0E},
+ {0xF1, 0xE1, 0x28, 0x00, 0x57, 0x67, 0x34, 0x5D, 0x03, 0x00, 0x0E},
+ {0xD1, 0x72, 0xC7, 0x00, 0x31, 0x42, 0x0F, 0x09, 0x00, 0x00, 0x0B},
+ {0xF2, 0x72, 0xC7, 0x00, 0x51, 0x42, 0x05, 0x69, 0x00, 0x00, 0x0B},
+ {0x23, 0x31, 0x4F, 0x00, 0x51, 0x60, 0x5B, 0x25, 0x01, 0x01, 0x00},
+ {0x22, 0x31, 0x48, 0x00, 0x31, 0xC0, 0x9B, 0x65, 0x02, 0x01, 0x00},
+ {0xF1, 0xE1, 0x28, 0x00, 0x57, 0x67, 0x34, 0x0D, 0x03, 0x00, 0x0E},
+ {0xE1, 0xE1, 0x23, 0x00, 0x57, 0x67, 0x04, 0x4D, 0x03, 0x00, 0x0E},
+ {0xE2, 0x31, 0x42, 0x08, 0x78, 0xF3, 0x0B, 0x0B, 0x01, 0x01, 0x08},
+ {0xE2, 0xE2, 0x21, 0x00, 0x11, 0x40, 0x52, 0x73, 0x01, 0x01, 0x08},
+ {0x23, 0xA4, 0xC0, 0x00, 0x51, 0x35, 0x07, 0x79, 0x01, 0x02, 0x0D},
+ {0x24, 0xA0, 0xC0, 0x00, 0x51, 0x75, 0x07, 0x09, 0x01, 0x02, 0x09},
+ {0xE0, 0xF0, 0x16, 0x00, 0xB1, 0xE0, 0x51, 0x75, 0x02, 0x02, 0x00},
+ {0x03, 0xA4, 0xC0, 0x00, 0x52, 0xF4, 0x03, 0x55, 0x00, 0x00, 0x09},
+ {0xE1, 0xE1, 0x93, 0x80, 0x31, 0xA1, 0xA6, 0x97, 0x01, 0x01, 0x0A},
+ {0xF0, 0x71, 0xC4, 0x80, 0x10, 0x11, 0x01, 0xC1, 0x02, 0x02, 0x01},
+ {0xC1, 0xE0, 0x4F, 0x00, 0xB1, 0x12, 0x53, 0x74, 0x02, 0x02, 0x06},
+ {0xC0, 0x41, 0x6D, 0x00, 0xF9, 0xF2, 0x21, 0xB3, 0x01, 0x00, 0x0E},
+ {0xE3, 0xE2, 0x4C, 0x00, 0x21, 0xA1, 0x43, 0x45, 0x01, 0x01, 0x00},
+ {0xE3, 0xE2, 0x0C, 0x00, 0x11, 0x80, 0x52, 0x73, 0x01, 0x01, 0x08},
+ {0x26, 0x88, 0xC0, 0x00, 0x55, 0xF8, 0x47, 0x19, 0x00, 0x00, 0x0B},
+ {0x23, 0xE4, 0xD4, 0x00, 0xE5, 0x35, 0x03, 0x65, 0x00, 0x00, 0x07},
+ {0x27, 0x32, 0xC0, 0x00, 0x32, 0xA4, 0x62, 0x33, 0x00, 0x00, 0x00},
+ {0xD0, 0x31, 0x4E, 0x00, 0x98, 0xA2, 0x32, 0x47, 0x01, 0x02, 0x00},
+ {0xF0, 0x71, 0xC0, 0x00, 0x93, 0x43, 0x03, 0x02, 0x01, 0x00, 0x0F},
+ {0xE0, 0xF1, 0x1A, 0x80, 0x13, 0x33, 0x52, 0x13, 0x01, 0x02, 0x00},
+ {0xE0, 0xF1, 0x1A, 0x00, 0x45, 0x32, 0xBA, 0x91, 0x00, 0x02, 0x00},
+ {0x11, 0x15, 0x18, 0x03, 0x58, 0xA2, 0x02, 0x72, 0x01, 0x00, 0x0A},
+ {0x10, 0x18, 0x80, 0x40, 0xF1, 0xF1, 0x53, 0x53, 0x00, 0x00, 0x00},
+ {0x31, 0x17, 0x86, 0x80, 0xA1, 0x7D, 0x11, 0x23, 0x00, 0x00, 0x08},
+ {0x10, 0x18, 0x80, 0x40, 0xF1, 0xF6, 0x53, 0x54, 0x00, 0x00, 0x00},
+ {0x31, 0x34, 0x21, 0x00, 0xF5, 0x93, 0x56, 0xE8, 0x01, 0x00, 0x08},
+ {0x03, 0x15, 0x4F, 0x00, 0xF1, 0xD6, 0x39, 0x74, 0x03, 0x00, 0x06},
+ {0x31, 0x22, 0x43, 0x00, 0x6E, 0x8B, 0x17, 0x0C, 0x01, 0x02, 0x02},
+ {0x31, 0x22, 0x1C, 0x80, 0x61, 0x52, 0x03, 0x67, 0x00, 0x00, 0x0E},
+ {0x60, 0xF0, 0x0C, 0x80, 0x81, 0x61, 0x03, 0x0C, 0x00, 0x01, 0x08},
+ {0x27, 0x05, 0x55, 0x00, 0x31, 0xA7, 0x62, 0x75, 0x00, 0x00, 0x00},
+ {0x95, 0x16, 0x81, 0x00, 0xE7, 0x96, 0x01, 0x67, 0x00, 0x00, 0x04},
+ {0x0C, 0x01, 0x87, 0x80, 0xF0, 0xF2, 0x05, 0x05, 0x01, 0x01, 0x04},
+ {0x35, 0x11, 0x44, 0x00, 0xF8, 0xF5, 0xFF, 0x75, 0x00, 0x00, 0x0E},
+ {0x10, 0x10, 0x0B, 0x00, 0xA7, 0xD5, 0xEC, 0xF5, 0x00, 0x00, 0x00},
+ {0x20, 0x01, 0x0B, 0x00, 0xA8, 0xD6, 0xC8, 0xB7, 0x00, 0x00, 0x00},
+ {0x00, 0x01, 0x0B, 0x00, 0x88, 0xD5, 0xC4, 0xB7, 0x00, 0x00, 0x00},
+ {0x0C, 0x10, 0x8F, 0x80, 0x41, 0x33, 0x31, 0x2B, 0x00, 0x03, 0x08},
+ {0x17, 0xF7, 0x00, 0x00, 0x3B, 0xEA, 0xDF, 0x97, 0x03, 0x00, 0x0B},
+ {0x12, 0x18, 0x06, 0x00, 0x73, 0x3C, 0x02, 0x74, 0x00, 0x00, 0x0E},
+ {0x02, 0x08, 0x00, 0x00, 0x3E, 0x14, 0x01, 0xF3, 0x02, 0x02, 0x0E},
+ {0xF5, 0xF6, 0xD4, 0x00, 0xEB, 0x45, 0x03, 0x68, 0x00, 0x00, 0x07},
+ {0xF0, 0xCA, 0x00, 0xC0, 0xDA, 0xB0, 0x71, 0x17, 0x01, 0x01, 0x08},
+ {0xF0, 0xE2, 0x00, 0xC0, 0x1E, 0x11, 0x11, 0x11, 0x01, 0x01, 0x08},
+ {0xE7, 0xE8, 0x00, 0x04, 0x34, 0x10, 0x00, 0xB2, 0x02, 0x02, 0x0E},
+ {0x0C, 0x04, 0x00, 0x00, 0xF0, 0xF6, 0xF0, 0xE6, 0x02, 0x00, 0x0E}};
+
+uint8_t instData[128][11] = {
+ {0x01, 0x11, 0x4F, 0x00, 0xF1, 0xD2, 0x51, 0x43, 0x00, 0x00, 0x06},
+ {0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x12, 0x4F, 0x06, 0xF1, 0xD2},
+ {0x51, 0x43, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
+ {0x11, 0x4A, 0x04, 0xF1, 0xD2, 0x53, 0x74, 0x00, 0x00, 0x06, 0x00},
+ {0x00, 0x00, 0x00, 0x00, 0x03, 0x11, 0x4F, 0x04, 0xF1, 0xD2, 0x53},
+ {0x74, 0x01, 0x01, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x11},
+ {0x66, 0x00, 0xF1, 0xD2, 0x51, 0xC3, 0x00, 0x00, 0x06, 0x00, 0x00},
+ {0x00, 0x00, 0x00, 0xC0, 0xD2, 0x52, 0x05, 0xF1, 0xD2, 0x53, 0x94},
+ {0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x18, 0x86},
+ {0x00, 0xF3, 0xFC, 0x00, 0x33, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00},
+ {0x00, 0x00, 0xD0, 0x12, 0x4E, 0x03, 0xA8, 0x92, 0x32, 0xA7, 0x03},
+ {0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC8, 0xD1, 0x4F, 0x08},
+ {0xF2, 0xF3, 0x64, 0x77, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00},
+ {0x00, 0x33, 0x34, 0x0E, 0x00, 0x01, 0x7D, 0x11, 0x34, 0x00, 0x00},
+ {0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x16, 0x50, 0x00, 0xD1},
+ {0xD3, 0x52, 0x92, 0x00, 0x01, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00},
+ {0xE7, 0xE1, 0x21, 0x06, 0xF5, 0xF6, 0x77, 0x14, 0x00, 0x00, 0x08},
+ {0x00, 0x00, 0x00, 0x00, 0x00, 0x95, 0x81, 0x4E, 0x00, 0xDA, 0xF9},
+ {0x25, 0x15, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x27},
+ {0x21, 0x1F, 0x03, 0xF5, 0xF5, 0x96, 0x57, 0x00, 0x00, 0x08, 0x00},
+ {0x00, 0x00, 0x00, 0x00, 0x87, 0xF1, 0x4E, 0x80, 0xB1, 0xE6, 0x33},
+ {0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0x11},
+ {0x87, 0x80, 0xA1, 0x7D, 0x11, 0x43, 0x00, 0x00, 0x08, 0x00, 0x00},
+ {0x00, 0x00, 0x00, 0x32, 0xB1, 0x8C, 0x03, 0x91, 0xA1, 0x07, 0x19},
+ {0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0xB4, 0x54},
+ {0x83, 0xF1, 0xF5, 0x07, 0x19, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00},
+ {0x00, 0x00, 0x24, 0x21, 0x40, 0x53, 0xFF, 0xFF, 0x0F, 0x0F, 0x00},
+ {0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD2, 0xF1, 0x44, 0x80},
+ {0x91, 0xA1, 0x57, 0x09, 0x01, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00},
+ {0x00, 0x01, 0x02, 0x52, 0x88, 0xF0, 0xF0, 0x1F, 0x1F, 0x01, 0x00},
+ {0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x32, 0x4F, 0x0B, 0xF2},
+ {0x52, 0x0B, 0x0B, 0x00, 0x01, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00},
+ {0xF0, 0xF2, 0x93, 0x07, 0xD8, 0xB3, 0x0B, 0x0B, 0x02, 0x01, 0x0A},
+ {0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x31, 0x5D, 0x07, 0xF2, 0x52},
+ {0x0B, 0x0B, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01},
+ {0x01, 0x1B, 0x04, 0xF4, 0xF3, 0x25, 0x46, 0x02, 0x00, 0x00, 0x00},
+ {0x00, 0x00, 0x00, 0x00, 0x11, 0x01, 0x0F, 0x07, 0xF4, 0xF3, 0x25},
+ {0x46, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01},
+ {0x27, 0x00, 0xF1, 0xF4, 0x1F, 0x88, 0x02, 0x00, 0x0A, 0x00, 0x00},
+ {0x00, 0x00, 0x00, 0x12, 0x13, 0x44, 0x03, 0xEA, 0xD2, 0x32, 0xE7},
+ {0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x31, 0x45},
+ {0x00, 0xA4, 0xF5, 0x32, 0xE7, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00},
+ {0x00, 0x00, 0x21, 0x21, 0x0F, 0x03, 0xF5, 0xF1, 0x17, 0x78, 0x02},
+ {0x01, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x20, 0x41, 0x07},
+ {0xD1, 0xC1, 0x34, 0xA5, 0x03, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00},
+ {0x00, 0x10, 0x12, 0x43, 0x02, 0xA7, 0xE3, 0x97, 0xE7, 0x03, 0x02},
+ {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x21, 0x28, 0x01, 0xC5},
+ {0xD2, 0x15, 0xA4, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00},
+ {0x30, 0x21, 0x16, 0x05, 0xF2, 0xF3, 0x9F, 0x78, 0x00, 0x00, 0x0C},
+ {0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x21, 0x11, 0x05, 0x82, 0xF3},
+ {0x9F, 0x78, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21},
+ {0x21, 0x23, 0x00, 0x73, 0x93, 0x1A, 0x87, 0x00, 0x00, 0x0C, 0x00},
+ {0x00, 0x00, 0x00, 0x00, 0x30, 0x21, 0x0E, 0x09, 0x62, 0xF3, 0x55},
+ {0x68, 0x02, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x22},
+ {0x0C, 0x00, 0x62, 0xD5, 0xB5, 0x98, 0x01, 0x00, 0x08, 0x00, 0x00},
+ {0x00, 0x00, 0x00, 0x70, 0x72, 0x93, 0x43, 0x64, 0xA1, 0x43, 0x43},
+ {0x00, 0x00, 0x0A, 0x06, 0x00, 0x00, 0x00, 0x00, 0x30, 0x32, 0x8D},
+ {0x85, 0x44, 0x92, 0x43, 0x43, 0x02, 0x00, 0x0A, 0x06, 0x00, 0x00},
+ {0x00, 0x00, 0xE1, 0xE2, 0x4E, 0x00, 0x65, 0x61, 0x43, 0x44, 0x02},
+ {0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA1, 0xA2, 0x8E, 0x05},
+ {0x65, 0x63, 0x43, 0x45, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00},
+ {0x00, 0xB0, 0x61, 0x87, 0x40, 0xD1, 0x62, 0x11, 0x15, 0x02, 0x01},
+ {0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x20, 0x8A, 0x80, 0xB1},
+ {0xA0, 0x11, 0x15, 0x02, 0x01, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00},
+ {0xF1, 0xE2, 0x89, 0x43, 0x73, 0x43, 0x01, 0x05, 0x02, 0x00, 0x06},
+ {0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0x21, 0x57, 0x80, 0xF8, 0xF7},
+ {0xF9, 0xE6, 0x03, 0x02, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32},
+ {0x01, 0x24, 0x82, 0xF1, 0xF5, 0x35, 0x35, 0x00, 0x00, 0x00, 0x00},
+ {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0xAA, 0xD2, 0xC8},
+ {0xB3, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xF1},
+ {0x4F, 0x03, 0xD4, 0x55, 0x0B, 0x0B, 0x02, 0x02, 0x0A, 0x00, 0x00},
+ {0x00, 0x00, 0x00, 0xE0, 0xF0, 0x52, 0x00, 0x96, 0x35, 0x05, 0x01},
+ {0x02, 0x02, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE1, 0xF1, 0x4F},
+ {0x00, 0x36, 0x45, 0x05, 0x02, 0x02, 0x02, 0x0A, 0x00, 0x00, 0x00},
+ {0x00, 0x00, 0xE2, 0xE1, 0x48, 0x81, 0x21, 0x41, 0x43, 0x45, 0x02},
+ {0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xF1, 0x16, 0x00},
+ {0x41, 0x20, 0x52, 0x72, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00},
+ {0x00, 0xE0, 0xF1, 0x11, 0x00, 0x01, 0xD0, 0x52, 0x72, 0x02, 0x02},
+ {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xF1, 0x1A, 0x00, 0x61},
+ {0x30, 0x52, 0x73, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
+ {0x50, 0x50, 0x0B, 0x07, 0x84, 0xA4, 0x4B, 0x99, 0x00, 0x00, 0x0A},
+ {0x06, 0x00, 0x00, 0x00, 0x00, 0x31, 0x61, 0x1C, 0x84, 0x41, 0x92},
+ {0x0B, 0x3B, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB1},
+ {0x61, 0x1C, 0x05, 0x41, 0x92, 0x1F, 0x3B, 0x00, 0x00, 0x0E, 0x00},
+ {0x00, 0x00, 0x00, 0x00, 0x20, 0x21, 0x18, 0x00, 0x52, 0xA2, 0x15},
+ {0x24, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC1, 0xC1},
+ {0x94, 0x84, 0x74, 0xA3, 0xEA, 0xF5, 0x02, 0x01, 0x0E, 0x00, 0x00},
+ {0x00, 0x00, 0x00, 0x21, 0x21, 0x28, 0x00, 0x41, 0x81, 0xB4, 0x98},
+ {0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x21, 0x1D},
+ {0x01, 0x51, 0xE1, 0xAE, 0x3E, 0x02, 0x01, 0x0E, 0x00, 0x00, 0x00},
+ {0x00, 0x00, 0xE0, 0xE0, 0x93, 0x82, 0x51, 0x81, 0xA6, 0x97, 0x02},
+ {0x01, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xE1, 0x93, 0x83},
+ {0x51, 0xE1, 0xA6, 0x97, 0x02, 0x01, 0x0E, 0x00, 0x00, 0x00, 0x00},
+ {0x00, 0xE0, 0xF2, 0x4B, 0x0B, 0xD8, 0xB3, 0x0B, 0x0B, 0x02, 0x01},
+ {0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xF1, 0x49, 0x0B, 0xB8},
+ {0xB3, 0x0B, 0x0B, 0x02, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00},
+ {0xE0, 0xF0, 0x4E, 0x0B, 0x98, 0xC3, 0x0B, 0x0B, 0x01, 0x02, 0x08},
+ {0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xF1, 0x4C, 0x0B, 0x88, 0xD3},
+ {0x0B, 0x0B, 0x01, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF1},
+ {0xE4, 0xC5, 0x08, 0x7E, 0x8C, 0x17, 0x0E, 0x00, 0x00, 0x08, 0x00},
+ {0x00, 0x00, 0x00, 0x00, 0x60, 0x72, 0x4F, 0x0A, 0xD8, 0xB3, 0x0B},
+ {0x0B, 0x00, 0x01, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0x72},
+ {0xD1, 0x80, 0xD5, 0x91, 0x19, 0x1B, 0x00, 0x00, 0x0C, 0x00, 0x00},
+ {0x00, 0x00, 0x00, 0x32, 0x71, 0xC8, 0x80, 0xD5, 0x73, 0x19, 0x1B},
+ {0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE2, 0x62, 0x6A},
+ {0x00, 0x9E, 0x55, 0x8F, 0x2A, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00},
+ {0x00, 0x00, 0xE0, 0x61, 0xEC, 0x00, 0x7E, 0x65, 0x8F, 0x2A, 0x00},
+ {0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0xA2, 0x88, 0x8D},
+ {0x84, 0x75, 0x27, 0x17, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00},
+ {0x00, 0x62, 0xA2, 0x84, 0x8D, 0x84, 0x75, 0x27, 0x17, 0x00, 0x00},
+ {0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE3, 0x62, 0x6D, 0x00, 0x57},
+ {0x57, 0x04, 0x77, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00},
+ {0xF1, 0xE1, 0x28, 0x00, 0x57, 0x67, 0x34, 0x5D, 0x03, 0x00, 0x0E},
+ {0x00, 0x00, 0x00, 0x00, 0x00, 0xD1, 0x72, 0xC7, 0x03, 0x31, 0x42},
+ {0x0F, 0x09, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF2},
+ {0x72, 0xC7, 0x05, 0x51, 0x42, 0x05, 0x69, 0x00, 0x00, 0x0B, 0x00},
+ {0x00, 0x00, 0x00, 0x00, 0x23, 0x31, 0x4F, 0x06, 0x51, 0x60, 0x5B},
+ {0x25, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x31},
+ {0x48, 0x06, 0x31, 0xC0, 0x9B, 0x65, 0x02, 0x01, 0x00, 0x00, 0x00},
+ {0x00, 0x00, 0x00, 0xF1, 0xE1, 0x28, 0x04, 0x57, 0x67, 0x34, 0x0D},
+ {0x03, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE1, 0xE1, 0x23},
+ {0x00, 0x57, 0x67, 0x04, 0x4D, 0x03, 0x00, 0x0E, 0x00, 0x00, 0x00},
+ {0x00, 0x00, 0xE2, 0x31, 0x42, 0x12, 0x78, 0xF3, 0x0B, 0x0B, 0x01},
+ {0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE2, 0xE2, 0x21, 0x07},
+ {0x11, 0x40, 0x52, 0x73, 0x01, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00},
+ {0x00, 0x23, 0xA4, 0xC0, 0x00, 0x51, 0x35, 0x07, 0x79, 0x01, 0x02},
+ {0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0xA0, 0xC0, 0x01, 0x51},
+ {0x75, 0x07, 0x09, 0x01, 0x02, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00}};
+
+const uint8_t data[1408] = {
+ 0xF1,
+ 0xD2,
+ 0x53,
+ 0x74,
+ 0x00,
+ 0x00,
+ 0x06,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x03,
+ 0x11,
+ 0x4F,
+ 0x04,
+ 0xF1,
+ 0xD2,
+ 0x53,
+ 0x74,
+ 0x01,
+ 0x01,
+ 0x06,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x01,
+ 0x11,
+ 0x66,
+ 0x00,
+ 0xF1,
+ 0xD2,
+ 0x51,
+ 0xC3,
+ 0x00,
+ 0x00,
+ 0x06,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0xC0,
+ 0xD2,
+ 0x52,
+ 0x05,
+ 0xF1,
+ 0xD2,
+ 0x53,
+ 0x94,
+ 0x00,
+ 0x00,
+ 0x06,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x12,
+ 0x18,
+ 0x86,
+ 0x00,
+ 0xF3,
+ 0xFC,
+ 0x00,
+ 0x33,
+ 0x00,
+ 0x00,
+ 0x08,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0xD0,
+ 0x12,
+ 0x4E,
+ 0x03,
+ 0xA8,
+ 0x92,
+ 0x32,
+ 0xA7,
+ 0x03,
+ 0x02,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0xC8,
+ 0xD1,
+ 0x4F,
+ 0x08,
+ 0xF2,
+ 0xF3,
+ 0x64,
+ 0x77,
+ 0x00,
+ 0x00,
+ 0x08,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x33,
+ 0x34,
+ 0x0E,
+ 0x00,
+ 0x01,
+ 0x7D,
+ 0x11,
+ 0x34,
+ 0x00,
+ 0x00,
+ 0x08,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x17,
+ 0x16,
+ 0x50,
+ 0x00,
+ 0xD1,
+ 0xD3,
+ 0x52,
+ 0x92,
+ 0x00,
+ 0x01,
+ 0x04,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0xE7,
+ 0xE1,
+ 0x21,
+ 0x06,
+ 0xF5,
+ 0xF6,
+ 0x77,
+ 0x14,
+ 0x00,
+ 0x00,
+ 0x08,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x95,
+ 0x81,
+ 0x4E,
+ 0x00,
+ 0xDA,
+ 0xF9,
+ 0x25,
+ 0x15,
+ 0x00,
+ 0x00,
+ 0x0A,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x27,
+ 0x21,
+ 0x1F,
+ 0x03,
+ 0xF5,
+ 0xF5,
+ 0x96,
+ 0x57,
+ 0x00,
+ 0x00,
+ 0x08,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x87,
+ 0xF1,
+ 0x4E,
+ 0x80,
+ 0xB1,
+ 0xE6,
+ 0x33,
+ 0x42,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x31,
+ 0x11,
+ 0x87,
+ 0x80,
+ 0xA1,
+ 0x7D,
+ 0x11,
+ 0x43,
+ 0x00,
+ 0x00,
+ 0x08,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x32,
+ 0xB1,
+ 0x8C,
+ 0x03,
+ 0x91,
+ 0xA1,
+ 0x07,
+ 0x19,
+ 0x02,
+ 0x00,
+ 0x05,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x31,
+ 0xB4,
+ 0x54,
+ 0x83,
+ 0xF1,
+ 0xF5,
+ 0x07,
+ 0x19,
+ 0x00,
+ 0x00,
+ 0x07,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x24,
+ 0x21,
+ 0x40,
+ 0x53,
+ 0xFF,
+ 0xFF,
+ 0x0F,
+ 0x0F,
+ 0x00,
+ 0x00,
+ 0x01,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0xD2,
+ 0xF1,
+ 0x44,
+ 0x80,
+ 0x91,
+ 0xA1,
+ 0x57,
+ 0x09,
+ 0x01,
+ 0x01,
+ 0x03,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x01,
+ 0x02,
+ 0x52,
+ 0x88,
+ 0xF0,
+ 0xF0,
+ 0x1F,
+ 0x1F,
+ 0x01,
+ 0x00,
+ 0x0A,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x21,
+ 0x32,
+ 0x4F,
+ 0x0B,
+ 0xF2,
+ 0x52,
+ 0x0B,
+ 0x0B,
+ 0x00,
+ 0x01,
+ 0x0A,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0xF0,
+ 0xF2,
+ 0x93,
+ 0x07,
+ 0xD8,
+ 0xB3,
+ 0x0B,
+ 0x0B,
+ 0x02,
+ 0x01,
+ 0x0A,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x20,
+ 0x31,
+ 0x5D,
+ 0x07,
+ 0xF2,
+ 0x52,
+ 0x0B,
+ 0x0B,
+ 0x03,
+ 0x02,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x01,
+ 0x01,
+ 0x1B,
+ 0x04,
+ 0xF4,
+ 0xF3,
+ 0x25,
+ 0x46,
+ 0x02,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x11,
+ 0x01,
+ 0x0F,
+ 0x07,
+ 0xF4,
+ 0xF3,
+ 0x25,
+ 0x46,
+ 0x01,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x01,
+ 0x01,
+ 0x27,
+ 0x00,
+ 0xF1,
+ 0xF4,
+ 0x1F,
+ 0x88,
+ 0x02,
+ 0x00,
+ 0x0A,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x12,
+ 0x13,
+ 0x44,
+ 0x03,
+ 0xEA,
+ 0xD2,
+ 0x32,
+ 0xE7,
+ 0x01,
+ 0x01,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x30,
+ 0x31,
+ 0x45,
+ 0x00,
+ 0xA4,
+ 0xF5,
+ 0x32,
+ 0xE7,
+ 0x03,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x21,
+ 0x21,
+ 0x0F,
+ 0x03,
+ 0xF5,
+ 0xF1,
+ 0x17,
+ 0x78,
+ 0x02,
+ 0x01,
+ 0x04,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x01,
+ 0x20,
+ 0x41,
+ 0x07,
+ 0xD1,
+ 0xC1,
+ 0x34,
+ 0xA5,
+ 0x03,
+ 0x03,
+ 0x04,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x10,
+ 0x12,
+ 0x43,
+ 0x02,
+ 0xA7,
+ 0xE3,
+ 0x97,
+ 0xE7,
+ 0x03,
+ 0x02,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x20,
+ 0x21,
+ 0x28,
+ 0x01,
+ 0xC5,
+ 0xD2,
+ 0x15,
+ 0xA4,
+ 0x00,
+ 0x00,
+ 0x0C,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x30,
+ 0x21,
+ 0x16,
+ 0x05,
+ 0xF2,
+ 0xF3,
+ 0x9F,
+ 0x78,
+ 0x00,
+ 0x00,
+ 0x0C,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x30,
+ 0x21,
+ 0x11,
+ 0x05,
+ 0x82,
+ 0xF3,
+ 0x9F,
+ 0x78,
+ 0x00,
+ 0x00,
+ 0x0A,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x21,
+ 0x21,
+ 0x23,
+ 0x00,
+ 0x73,
+ 0x93,
+ 0x1A,
+ 0x87,
+ 0x00,
+ 0x00,
+ 0x0C,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x30,
+ 0x21,
+ 0x0E,
+ 0x09,
+ 0x62,
+ 0xF3,
+ 0x55,
+ 0x68,
+ 0x02,
+ 0x00,
+ 0x0A,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x30,
+ 0x22,
+ 0x0C,
+ 0x00,
+ 0x62,
+ 0xD5,
+ 0xB5,
+ 0x98,
+ 0x01,
+ 0x00,
+ 0x08,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x70,
+ 0x72,
+ 0x93,
+ 0x43,
+ 0x64,
+ 0xA1,
+ 0x43,
+ 0x43,
+ 0x00,
+ 0x00,
+ 0x0A,
+ 0x06,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x30,
+ 0x32,
+ 0x8D,
+ 0x85,
+ 0x44,
+ 0x92,
+ 0x43,
+ 0x43,
+ 0x02,
+ 0x00,
+ 0x0A,
+ 0x06,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0xE1,
+ 0xE2,
+ 0x4E,
+ 0x00,
+ 0x65,
+ 0x61,
+ 0x43,
+ 0x44,
+ 0x02,
+ 0x02,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0xA1,
+ 0xA2,
+ 0x8E,
+ 0x05,
+ 0x65,
+ 0x63,
+ 0x43,
+ 0x45,
+ 0x02,
+ 0x02,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0xB0,
+ 0x61,
+ 0x87,
+ 0x40,
+ 0xD1,
+ 0x62,
+ 0x11,
+ 0x15,
+ 0x02,
+ 0x01,
+ 0x06,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0xF0,
+ 0x20,
+ 0x8A,
+ 0x80,
+ 0xB1,
+ 0xA0,
+ 0x11,
+ 0x15,
+ 0x02,
+ 0x01,
+ 0x06,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0xF1,
+ 0xE2,
+ 0x89,
+ 0x43,
+ 0x73,
+ 0x43,
+ 0x01,
+ 0x05,
+ 0x02,
+ 0x00,
+ 0x06,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x31,
+ 0x21,
+ 0x57,
+ 0x80,
+ 0xF8,
+ 0xF7,
+ 0xF9,
+ 0xE6,
+ 0x03,
+ 0x02,
+ 0x0E,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x32,
+ 0x01,
+ 0x24,
+ 0x82,
+ 0xF1,
+ 0xF5,
+ 0x35,
+ 0x35,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x04,
+ 0x00,
+ 0xAA,
+ 0xD2,
+ 0xC8,
+ 0xB3,
+ 0x00,
+ 0x00,
+ 0x0A,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0xE0,
+ 0xF1,
+ 0x4F,
+ 0x03,
+ 0xD4,
+ 0x55,
+ 0x0B,
+ 0x0B,
+ 0x02,
+ 0x02,
+ 0x0A,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0xE0,
+ 0xF0,
+ 0x52,
+ 0x00,
+ 0x96,
+ 0x35,
+ 0x05,
+ 0x01,
+ 0x02,
+ 0x02,
+ 0x0A,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0xE1,
+ 0xF1,
+ 0x4F,
+ 0x00,
+ 0x36,
+ 0x45,
+ 0x05,
+ 0x02,
+ 0x02,
+ 0x02,
+ 0x0A,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0xE2,
+ 0xE1,
+ 0x48,
+ 0x81,
+ 0x21,
+ 0x41,
+ 0x43,
+ 0x45,
+ 0x02,
+ 0x01,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0xE0,
+ 0xF1,
+ 0x16,
+ 0x00,
+ 0x41,
+ 0x20,
+ 0x52,
+ 0x72,
+ 0x02,
+ 0x02,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0xE0,
+ 0xF1,
+ 0x11,
+ 0x00,
+ 0x01,
+ 0xD0,
+ 0x52,
+ 0x72,
+ 0x02,
+ 0x02,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0xE0,
+ 0xF1,
+ 0x1A,
+ 0x00,
+ 0x61,
+ 0x30,
+ 0x52,
+ 0x73,
+ 0x00,
+ 0x02,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x50,
+ 0x50,
+ 0x0B,
+ 0x07,
+ 0x84,
+ 0xA4,
+ 0x4B,
+ 0x99,
+ 0x00,
+ 0x00,
+ 0x0A,
+ 0x06,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x31,
+ 0x61,
+ 0x1C,
+ 0x84,
+ 0x41,
+ 0x92,
+ 0x0B,
+ 0x3B,
+ 0x00,
+ 0x00,
+ 0x0E,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0xB1,
+ 0x61,
+ 0x1C,
+ 0x05,
+ 0x41,
+ 0x92,
+ 0x1F,
+ 0x3B,
+ 0x00,
+ 0x00,
+ 0x0E,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x20,
+ 0x21,
+ 0x18,
+ 0x00,
+ 0x52,
+ 0xA2,
+ 0x15,
+ 0x24,
+ 0x00,
+ 0x00,
+ 0x0C,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0xC1,
+ 0xC1,
+ 0x94,
+ 0x84,
+ 0x74,
+ 0xA3,
+ 0xEA,
+ 0xF5,
+ 0x02,
+ 0x01,
+ 0x0E,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x21,
+ 0x21,
+ 0x28,
+ 0x00,
+ 0x41,
+ 0x81,
+ 0xB4,
+ 0x98,
+ 0x00,
+ 0x00,
+ 0x0E,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x21,
+ 0x21,
+ 0x1D,
+ 0x01,
+ 0x51,
+ 0xE1,
+ 0xAE,
+ 0x3E,
+ 0x02,
+ 0x01,
+ 0x0E,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0xE0,
+ 0xE0,
+ 0x93,
+ 0x82,
+ 0x51,
+ 0x81,
+ 0xA6,
+ 0x97,
+ 0x02,
+ 0x01,
+ 0x0E,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0xE0,
+ 0xE1,
+ 0x93,
+ 0x83,
+ 0x51,
+ 0xE1,
+ 0xA6,
+ 0x97,
+ 0x02,
+ 0x01,
+ 0x0E,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0xE0,
+ 0xF2,
+ 0x4B,
+ 0x0B,
+ 0xD8,
+ 0xB3,
+ 0x0B,
+ 0x0B,
+ 0x02,
+ 0x01,
+ 0x08,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0xE0,
+ 0xF1,
+ 0x49,
+ 0x0B,
+ 0xB8,
+ 0xB3,
+ 0x0B,
+ 0x0B,
+ 0x02,
+ 0x01,
+ 0x08,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0xE0,
+ 0xF0,
+ 0x4E,
+ 0x0B,
+ 0x98,
+ 0xC3,
+ 0x0B,
+ 0x0B,
+ 0x01,
+ 0x02,
+ 0x08,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0xE0,
+ 0xF1,
+ 0x4C,
+ 0x0B,
+ 0x88,
+ 0xD3,
+ 0x0B,
+ 0x0B,
+ 0x01,
+ 0x01,
+ 0x08,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0xF1,
+ 0xE4,
+ 0xC5,
+ 0x08,
+ 0x7E,
+ 0x8C,
+ 0x17,
+ 0x0E,
+ 0x00,
+ 0x00,
+ 0x08,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x60,
+ 0x72,
+ 0x4F,
+ 0x0A,
+ 0xD8,
+ 0xB3,
+ 0x0B,
+ 0x0B,
+ 0x00,
+ 0x01,
+ 0x0A,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x31,
+ 0x72,
+ 0xD1,
+ 0x80,
+ 0xD5,
+ 0x91,
+ 0x19,
+ 0x1B,
+ 0x00,
+ 0x00,
+ 0x0C,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x32,
+ 0x71,
+ 0xC8,
+ 0x80,
+ 0xD5,
+ 0x73,
+ 0x19,
+ 0x1B,
+ 0x00,
+ 0x00,
+ 0x0C,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0xE2,
+ 0x62,
+ 0x6A,
+ 0x00,
+ 0x9E,
+ 0x55,
+ 0x8F,
+ 0x2A,
+ 0x00,
+ 0x00,
+ 0x0E,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0xE0,
+ 0x61,
+ 0xEC,
+ 0x00,
+ 0x7E,
+ 0x65,
+ 0x8F,
+ 0x2A,
+ 0x00,
+ 0x00,
+ 0x0E,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x62,
+ 0xA2,
+ 0x88,
+ 0x8D,
+ 0x84,
+ 0x75,
+ 0x27,
+ 0x17,
+ 0x00,
+ 0x00,
+ 0x09,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x62,
+ 0xA2,
+ 0x84,
+ 0x8D,
+ 0x84,
+ 0x75,
+ 0x27,
+ 0x17,
+ 0x00,
+ 0x00,
+ 0x09,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0xE3,
+ 0x62,
+ 0x6D,
+ 0x00,
+ 0x57,
+ 0x57,
+ 0x04,
+ 0x77,
+ 0x00,
+ 0x00,
+ 0x0E,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0xF1,
+ 0xE1,
+ 0x28,
+ 0x00,
+ 0x57,
+ 0x67,
+ 0x34,
+ 0x5D,
+ 0x03,
+ 0x00,
+ 0x0E,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0xD1,
+ 0x72,
+ 0xC7,
+ 0x03,
+ 0x31,
+ 0x42,
+ 0x0F,
+ 0x09,
+ 0x00,
+ 0x00,
+ 0x0B,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0xF2,
+ 0x72,
+ 0xC7,
+ 0x05,
+ 0x51,
+ 0x42,
+ 0x05,
+ 0x69,
+ 0x00,
+ 0x00,
+ 0x0B,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x23,
+ 0x31,
+ 0x4F,
+ 0x06,
+ 0x51,
+ 0x60,
+ 0x5B,
+ 0x25,
+ 0x01,
+ 0x01,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x22,
+ 0x31,
+ 0x48,
+ 0x06,
+ 0x31,
+ 0xC0,
+ 0x9B,
+ 0x65,
+ 0x02,
+ 0x01,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0xF1,
+ 0xE1,
+ 0x28,
+ 0x04,
+ 0x57,
+ 0x67,
+ 0x34,
+ 0x0D,
+ 0x03,
+ 0x00,
+ 0x0E,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0xE1,
+ 0xE1,
+ 0x23,
+ 0x00,
+ 0x57,
+ 0x67,
+ 0x04,
+ 0x4D,
+ 0x03,
+ 0x00,
+ 0x0E,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0xE2,
+ 0x31,
+ 0x42,
+ 0x12,
+ 0x78,
+ 0xF3,
+ 0x0B,
+ 0x0B,
+ 0x01,
+ 0x01,
+ 0x08,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0xE2,
+ 0xE2,
+ 0x21,
+ 0x07,
+ 0x11,
+ 0x40,
+ 0x52,
+ 0x73,
+ 0x01,
+ 0x01,
+ 0x08,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x23,
+ 0xA4,
+ 0xC0,
+ 0x00,
+ 0x51,
+ 0x35,
+ 0x07,
+ 0x79,
+ 0x01,
+ 0x02,
+ 0x0D,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x24,
+ 0xA0,
+ 0xC0,
+ 0x01,
+ 0x51,
+ 0x75,
+ 0x07,
+ 0x09,
+ 0x01,
+ 0x02,
+ 0x09,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0xE0,
+ 0xF0,
+ 0x16,
+ 0x03,
+ 0xB1,
+ 0xE0,
+ 0x51,
+ 0x75,
+ 0x02,
+ 0x02,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x03,
+ 0xA4,
+ 0xC0,
+ 0x04,
+ 0x52,
+ 0xF4,
+ 0x03,
+ 0x55,
+ 0x00,
+ 0x00,
+ 0x09,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0xE1,
+ 0xE1,
+ 0x93,
+ 0x81,
+};
+
+MidiPlayer::MidiPlayer() {
+ _driver = nullptr;
+ _driverMsMusic = nullptr;
+
+ _paused = false;
+ _musicData = nullptr;
+ _parserMusic = nullptr;
+}
+
+MidiPlayer::~MidiPlayer() {
+ stop();
+
+ if (_driverMsMusic) {
+ _driverMsMusic->setTimerCallback(nullptr, nullptr);
+ _driverMsMusic->close();
+ } else if (_driver) {
+ _driver->setTimerCallback(nullptr, nullptr);
+ _driver->close();
+ }
+ if (_parserMusic)
+ delete _parserMusic;
+ if (_driverMsMusic) {
+ delete _driverMsMusic;
+ _driverMsMusic = nullptr;
+ } else if (_driver) {
+ delete _driver;
+ _driver = nullptr;
+ }
+}
+int MidiPlayer::open() {
+
+ // Don't call open() twice!
+ assert(!_driver);
+ int devFlags = MDT_MIDI | MDT_ADLIB;
+
+ OPL::Config::OplType oplType =
+ MidiDriver_ADLIB_Multisource::detectOplType(OPL::Config::kOpl3) ? OPL::Config::kOpl3 : OPL::Config::kOpl2;
+
+ _driverMsMusic = new MidiDriver_AdLib(OPL::Config::kOpl3);
+
+ _parserMusic = MidiParser::createParser_SMF();
+ _driver = _driverMsMusic;
+
+ if (_driverMsMusic)
+ _driverMsMusic->property(MidiDriver::PROP_USER_VOLUME_SCALING, true);
+ int returnCode = _driver->open();
+ if (returnCode != 0)
+ error("MidiPlayer::open - Failed to open MIDI music driver - error code %d.", returnCode);
+
+ syncSoundSettings();
+ // Connect the driver(s) and the parser(s).
+ _parserMusic->setMidiDriver(_driver);
+ _parserMusic->setTimerRate(_driver->getBaseTempo());
+ _driver->setTimerCallback(this, &onTimer);
+ debug("Successfully opened driver");
+ return 0;
+}
+
+void MidiPlayer::onTimer(void *data) {
+ MidiPlayer *p = (MidiPlayer *)data;
+ if (p->_parserMusic) {
+ p->_parserMusic->onTimer();
+ }
+}
+
+bool MidiPlayer::isPlaying() {
+ return _parserMusic->isPlaying();
+}
+
+void MidiPlayer::stop() {
+ if (_parserMusic) {
+ _parserMusic->stopPlaying();
+ if (_driverMsMusic)
+ _driverMsMusic->deinitSource(0);
+ }
+}
+
+void MidiPlayer::pause(bool b) {
+ if (_paused == b || !_driver)
+ return;
+
+ _paused = b;
+ if (_paused) {
+ if (_parserMusic)
+ _parserMusic->pausePlaying();
+ } else {
+ if (_parserMusic)
+ _parserMusic->resumePlaying();
+ }
+}
+
+void MidiPlayer::syncSoundSettings() {
+ if (_driverMsMusic)
+ _driverMsMusic->syncSoundSettings();
+}
+void MidiPlayer::setLoop(bool loop) {
+ if (_parserMusic)
+ _parserMusic->property(MidiParser::mpAutoLoop, loop);
+}
+void MidiPlayer::load(Common::SeekableReadStream *in, int32 size) {
+
+ MidiParser *parser = _parserMusic;
+ if (!parser)
+ return;
+
+ if (size < 0) {
+ // Use the parser to determine the size of the MIDI data.
+ int64 startPos = in->pos();
+ size = parser->determineDataSize(in);
+ if (size < 0) {
+ warning("MidiPlayer::load - Could not determine size of music data");
+ return;
+ }
+ // determineDataSize might move the stream position, so return it to
+ // the original position.
+ in->seek(startPos);
+ }
+
+ parser->unloadMusic();
+
+ byte **dataPtr = &_musicData;
+ if (*dataPtr) {
+ delete[] *dataPtr;
+ }
+
+ *dataPtr = new byte[size];
+ in->read(*dataPtr, size);
+
+ parser->loadMusic(*dataPtr, size);
+ debug("Successfully loaded Music");
+}
+
+void MidiPlayer::play(int track) {
+ MidiParser *parser = _parserMusic;
+ if (!parser)
+ return;
+ if (parser->setTrack(track)) {
+ if (_driverMsMusic)
+ // Reset the volume to neutral (in case the previous track was
+ // faded out).
+ _driverMsMusic->resetSourceVolume(0);
+ parser->startPlaying();
+ } else {
+ parser->stopPlaying();
+ warning("MidiPlayer::play - Could not play %s track %i", "music", track);
+ }
+}
+
+MidiDriver_AdLib::MidiDriver_AdLib(OPL::Config::OplType oplType, int timerFrequency) : MidiDriver_ADLIB_Multisource::MidiDriver_ADLIB_Multisource(oplType, timerFrequency) {
+ _dsfInstrumentBank = new OplInstrumentDefinition[128];
+ loadInstrumentBankFromDriver(11048);
+}
+
+MidiDriver_AdLib::~MidiDriver_AdLib() {
+ delete[] _dsfInstrumentBank;
+}
+
+void MidiDriver_AdLib::loadInstrumentBankFromDriver(long offset) {
+ Common::File driverFile;
+ if (!driverFile.open("CTMIDI.DRV")) {
+ error("Couldnt find midi file!");
+ }
+ debug("Loading bank from offset: %d", offset);
+ driverFile.seek(offset, SEEK_SET);
+ uint8 *data = (uint8 *)malloc(128 * (11 + 21));
+ driverFile.read(data, 128 * (11 + 21));
+ loadInstrumentBank(data);
+ driverFile.close();
+
+ _instrumentBank = _dsfInstrumentBank;
+ _rhythmBank = _dsfInstrumentBank;
+}
+
+void MidiDriver_AdLib::loadInstrumentBank(uint8 *instrumentBankData) {
+ debug("Load instrument bank!");
+ for (int i = 0; i < 128; i++) {
+ AdLibIbkInstrumentDefinition instrument;
+
+ instrument.o0FreqMultMisc = *instrumentBankData++;
+ instrument.o1FreqMultMisc = *instrumentBankData++;
+
+ instrument.o0Level = *instrumentBankData++;
+ instrument.o1Level = *instrumentBankData++;
+
+ instrument.o0DecayAttack = *instrumentBankData++;
+ instrument.o1DecayAttack = *instrumentBankData++;
+
+ instrument.o0ReleaseSustain = *instrumentBankData++;
+ instrument.o1ReleaseSustain = *instrumentBankData++;
+
+ instrument.o0WaveformSelect = *instrumentBankData++;
+ instrument.o1WaveformSelect = *instrumentBankData++;
+
+ instrument.connectionFeedback = *instrumentBankData++;
+
+ instrument.rhythmType = *instrumentBankData++;
+ instrument.transpose = *instrumentBankData++;
+ instrument.rhythmNote = *instrumentBankData++;
+ instrument.padding1 = *instrumentBankData++;
+ instrument.padding2 = *instrumentBankData++;
+ instrument.toOplInstrumentDefinition(_dsfInstrumentBank[i]);
+ }
+ debug("Loaded instrument bank!");
+}
+
+} // End of namespace Tot
diff --git a/engines/tot/midi.h b/engines/tot/midi.h
new file mode 100644
index 00000000000..f8ee7b303db
--- /dev/null
+++ b/engines/tot/midi.h
@@ -0,0 +1,90 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef TOT_MIDI_H
+#define TOT_MIDI_H
+
+#include "audio/adlib_ms.h"
+#include "audio/mididrv.h"
+#include "audio/mididrv_ms.h"
+#include "audio/midiparser.h"
+
+namespace Tot {
+
+class MidiDriver_AdLib : public MidiDriver_ADLIB_Multisource {
+public:
+ MidiDriver_AdLib(OPL::Config::OplType oplType, int timerFrequency = OPL::OPL::kDefaultCallbackFrequency);
+ ~MidiDriver_AdLib();
+
+ void loadInstrumentBank(uint8 *instrumentBankData);
+ void loadInstrumentBankFromDriver(long offset);
+
+protected:
+ OplInstrumentDefinition *_dsfInstrumentBank;
+ OplInstrumentDefinition *_rhythmBank;
+};
+
+class MidiPlayer {
+protected:
+ // Driver used for music. This points to the same object as _driverMsMusic,
+ // except if a PC-98 driver is used (these do not implement the Multisource
+ // interface).
+ MidiDriver *_driver;
+ // Multisource driver used for music. Provides access to multisource
+ // methods without casting. If this is not nullptr, it points to the same
+ // object as _driver.
+ MidiDriver_AdLib *_driverMsMusic;
+ // MIDI parser and data used for music.
+ MidiParser *_parserMusic;
+ byte *_musicData;
+
+ bool _paused;
+
+protected:
+ static void onTimer(void *data);
+
+public:
+ MidiPlayer();
+ ~MidiPlayer();
+
+ // Creates and opens the relevant parsers and drivers for the game version
+ // and selected sound device.
+ int open();
+ // Loads music or SFX data supported by the MidiParser or SfxParser used
+ // for the detected version of the game. Specify sfx to indicate that this
+ // is a synthesized sound effect.
+ void load(Common::SeekableReadStream *in, int32 size = -1);
+
+ void play(int track);
+
+ void setLoop(bool loop);
+
+ bool isPlaying();
+ void stop();
+ void pause(bool b);
+ void syncSoundSettings();
+
+private:
+};
+
+} // End of namespace Tot
+
+#endif
diff --git a/engines/tot/module.mk b/engines/tot/module.mk
index c8e102b59b5..22f2b736b40 100644
--- a/engines/tot/module.mk
+++ b/engines/tot/module.mk
@@ -22,7 +22,8 @@ MODULE_OBJS = \
graphman.o \
mouseman.o \
chrono.o \
- saveload.o
+ saveload.o \
+ midi.o
# This module can be built as a plugin
ifeq ($(ENABLE_TOT), DYNAMIC_PLUGIN)
diff --git a/engines/tot/playanim.h b/engines/tot/playanim.h
index 0c7ba301e4c..38d9fcf1ff7 100644
--- a/engines/tot/playanim.h
+++ b/engines/tot/playanim.h
@@ -95,6 +95,7 @@ const int tamcarahablando = 7206;
* Number of points in a
*/
const int routePointCount = 7;
+
/**
* Trajectory changes
*/
diff --git a/engines/tot/soundman.cpp b/engines/tot/soundman.cpp
index 805c7f4cf2f..4398d338ed9 100644
--- a/engines/tot/soundman.cpp
+++ b/engines/tot/soundman.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "audio/adlib_ms.h"
#include "audio/audiostream.h"
#include "audio/decoders/voc.h"
#include "audio/midiparser.h"
@@ -27,6 +28,7 @@
#include "audio/softsynth/pcspk.h"
#include "common/config-manager.h"
#include "common/substream.h"
+#include "common/memstream.h"
#include "soundman.h"
#include "tot/soundman.h"
@@ -37,16 +39,20 @@ namespace Tot {
SoundManager::SoundManager(Audio::Mixer *mixer) : _mixer(mixer) {
- _musicPlayer = new MusicPlayer();
- g_engine->syncSoundSettings();
+ _midiPlayer = new MidiPlayer();
+ _midiPlayer->open();
+ g_engine->syncSoundSettings();
+ _midiPlayer->syncSoundSettings();
_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, 100);
_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, 100);
_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, 100);
}
SoundManager::~SoundManager() {
- delete _musicPlayer;
+ // delete _musicPlayer;
+ if(_midiPlayer)
+ delete _midiPlayer;
free(_lastSrcStream);
free(_audioStream);
}
@@ -96,11 +102,24 @@ bool SoundManager::isVocPlaying() {
}
void SoundManager::playMidi(const char *fileName, bool loop) {
- _musicPlayer->playMidi(fileName, loop);
+ Common::File musicFile;
+ debug("Opening music file %s", fileName);
+ musicFile.open(fileName);
+ if (!musicFile.isOpen()) {
+ showError(267);
+ return;
+ }
+ _midiPlayer->load(&musicFile, musicFile.size());
+ _midiPlayer->setLoop(loop);
+ _midiPlayer->play(0);
+
}
void SoundManager::playMidi(byte *data, int size, bool loop) {
- _musicPlayer->playMidi(data, size, loop);
+ Common::MemoryReadStream stream = Common::MemoryReadStream(data, size);
+ _midiPlayer->load(&stream, size);
+ _midiPlayer->setLoop(loop);
+ _midiPlayer->play(0);
}
void SoundManager::toggleMusic() {
@@ -129,7 +148,6 @@ void SoundManager::setSfxVolume(int volume) {
void SoundManager::setSfxBalance(bool left, bool right) {
int balance = left ? -127 : 127;
_mixer->setChannelBalance(_soundHandle, balance);
- // _mixer->setChannelBalance();
}
void SoundManager::setMusicVolume(int volume) {
@@ -138,70 +156,7 @@ void SoundManager::setMusicVolume(int volume) {
_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, volume);
ConfMan.setInt("music_volume", volume);
ConfMan.flushToDisk();
-
- _musicPlayer->syncVolume();
-}
-
-MusicPlayer::MusicPlayer() {
- _data = nullptr;
-
- MidiPlayer::createDriver(MDT_MIDI | MDT_ADLIB);
-
- int ret = _driver->open();
- if (ret == 0) {
- _driver->setTimerCallback(this, &timerCallback);
- }
- _dataSize = -1;
-}
-
-MusicPlayer::~MusicPlayer() {
- killMidi();
- free(_data);
-}
-
-void MusicPlayer::sndMidiStart(bool loop) {
-
- MidiParser *parser = MidiParser::createParser_SMF();
- if (parser->loadMusic(_data, _dataSize)) {
- parser->setTrack(0);
- parser->setMidiDriver(this);
- parser->setTimerRate(_driver->getBaseTempo());
-
- _parser = parser;
-
- syncVolume();
-
- // Al the tracks are supposed to loop
- _isLooping = loop;
- _isPlaying = true;
- }
-}
-void MusicPlayer::playMidi(const char *fileName, bool loop) {
- Common::File musicFile;
- debug("Opening music file %s", fileName);
- musicFile.open(fileName);
- if (!musicFile.isOpen()) {
- showError(267);
- return;
- }
- byte *data = (byte *)malloc(musicFile.size());
- musicFile.read(data, musicFile.size());
- musicFile.close();
- playMidi(data, musicFile.size(), loop);
-}
-
-void MusicPlayer::playMidi(byte *data, int size, bool loop) {
- _dataSize = size;
- _data = data;
- // Start playing the music
- sndMidiStart(loop);
-}
-
-void MusicPlayer::killMidi() {
- Audio::MidiPlayer::stop();
-
- free(_data);
- _data = nullptr;
+ _midiPlayer->syncSoundSettings();
}
} // End of namespace Tot
diff --git a/engines/tot/soundman.h b/engines/tot/soundman.h
index 9c8a6500210..7280f7df8d7 100644
--- a/engines/tot/soundman.h
+++ b/engines/tot/soundman.h
@@ -29,28 +29,10 @@
#include "audio/mixer.h"
#include "common/file.h"
+#include "engines/tot/midi.h"
+
namespace Tot {
const int kSfxId = 1;
-class MusicPlayer : public Audio::MidiPlayer {
-
-private:
- byte *_data;
- int _dataSize;
-
- // Start MIDI File
- void sndMidiStart(bool loop);
-
- // Stop MIDI File
- void sndMidiStop();
-
-public:
- MusicPlayer();
- ~MusicPlayer() override;
-
- void playMidi(const char *fileName, bool loop);
- void playMidi(byte *data, int size, bool loop);
- void killMidi();
-};
class SoundManager {
public:
@@ -74,7 +56,8 @@ private:
Audio::SoundHandle _soundHandle;
Audio::SoundHandle _speakerHandle;
Audio::Mixer *_mixer;
- MusicPlayer *_musicPlayer;
+ MidiPlayer *_midiPlayer;
+
Common::SeekableReadStream *_lastSrcStream = nullptr;
Audio::SeekableAudioStream *_audioStream = nullptr;
};
Commit: 5f0369d014cb8f8f4b543cd386b69cf8a95e0ea4
https://github.com/scummvm/scummvm/commit/5f0369d014cb8f8f4b543cd386b69cf8a95e0ea4
Author: gsanmartin (gabriel.sanmartin at dna.inc)
Date: 2025-09-08T16:49:49+02:00
Commit Message:
TOT: Sound and graphics cleanup
Changed paths:
engines/tot/game.cpp
engines/tot/graphics.cpp
engines/tot/graphics.h
engines/tot/graphman.cpp
engines/tot/graphman.h
engines/tot/midi.cpp
engines/tot/playanim.cpp
engines/tot/playanim.h
engines/tot/routines.cpp
engines/tot/routines2.cpp
engines/tot/sound.cpp
engines/tot/sound.h
diff --git a/engines/tot/game.cpp b/engines/tot/game.cpp
index e445cd88fe6..9aa711cad9f 100644
--- a/engines/tot/game.cpp
+++ b/engines/tot/game.cpp
@@ -64,7 +64,7 @@ void newGame() {
initializeObjectFile();
loadPalette("DEFAULT");
loadScreenData(1);
- effect(13, false, background);
+ screenTransition(13, false, background);
mask();
posicioninv = 0;
drawBackpack();
@@ -116,7 +116,7 @@ int engine_start() {
}
int startGame() {
- lowerMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
+ fadeOutMusic(volumenmelodiaizquierdo, volumenmelodiaderecho);
switch (gamePart) {
case 1:
playMidiFile("PRIMERA", true);
@@ -126,7 +126,7 @@ int startGame() {
break;
}
contadorpc2 = contadorpc;
- restoreMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
+ fadeInMusic(volumenmelodiaizquierdo, volumenmelodiaderecho);
inGame = true;
Common::Event e;
@@ -153,6 +153,21 @@ int startGame() {
switch (e.kbd.keycode) {
+ case Common::KEYCODE_UP:
+ playMidiFile("INTRODUC", true);
+ break;
+ case Common::KEYCODE_DOWN:
+ playMidiFile("PRIMERA", true);
+ break;
+ case Common::KEYCODE_LEFT:
+ playMidiFile("SEGUNDA", true);
+ // saveLoad();
+ break;
+ case Common::KEYCODE_RIGHT:
+ playMidiFile("CREDITOS", true);
+ // saveLoad();
+ break;
+
case Common::KEYCODE_ESCAPE:
escapePressed = true;
break;
@@ -429,10 +444,10 @@ int startGame() {
continuarpartida = false;
g_engine->saveAutosaveIfEnabled();
totalFadeOut(0);
- lowerMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
+ fadeOutMusic(volumenmelodiaizquierdo, volumenmelodiaderecho);
clear();
playMidiFile("INTRODUC", true);
- restoreMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
+ fadeInMusic(volumenmelodiaizquierdo, volumenmelodiaderecho);
initialMenu(true);
verifyCopyProtection2();
@@ -446,7 +461,7 @@ int startGame() {
contadorpc = contadorpc2;
desactivagrabar = false;
}
- lowerMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
+ fadeOutMusic(volumenmelodiaizquierdo, volumenmelodiaderecho);
switch (gamePart) {
case 1:
playMidiFile("PRIMERA", true);
@@ -455,7 +470,7 @@ int startGame() {
playMidiFile("SEGUNDA", true);
break;
}
- restoreMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
+ fadeInMusic(volumenmelodiaizquierdo, volumenmelodiaderecho);
}
switch (gamePart) {
@@ -471,9 +486,9 @@ int startGame() {
freeScreenObjects();
g_engine->_mouseManager->hide();
partialFadeOut(234);
- lowerMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
+ fadeOutMusic(volumenmelodiaizquierdo, volumenmelodiaderecho);
playMidiFile("CREDITOS", true);
- restoreMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
+ fadeInMusic(volumenmelodiaizquierdo, volumenmelodiaderecho);
if (contadorpc2 > 43)
showError(274);
sacrificeScene();
@@ -486,10 +501,10 @@ int startGame() {
trayec[indicetray].x = characterPosX;
trayec[indicetray].y = characterPosY;
loadScreenData(20);
- lowerMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
+ fadeOutMusic(volumenmelodiaizquierdo, volumenmelodiaderecho);
playMidiFile("SEGUNDA", true);
- restoreMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
- effect(1, false, background);
+ fadeInMusic(volumenmelodiaizquierdo, volumenmelodiaderecho);
+ screenTransition(1, false, background);
mask();
posicioninv = 0;
drawBackpack();
@@ -577,7 +592,7 @@ void sceneChange() {
freeScreenObjects();
g_engine->_mouseManager->hide();
- effect(tipoefectofundido, true, NULL);
+ screenTransition(tipoefectofundido, true, NULL);
stopVoc();
loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
if (contadorpc > 89)
@@ -587,7 +602,7 @@ void sceneChange() {
autoPlayVoc("PARASITO", 355778, 20129);
else
cargatele();
- effect(tipoefectofundido, false, background);
+ screenTransition(tipoefectofundido, false, background);
contadorpc = contadorpc2;
g_engine->_mouseManager->show();
oldxrejilla = 0;
@@ -605,12 +620,12 @@ void sceneChange() {
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- effect(tipoefectofundido, true, NULL);
+ screenTransition(tipoefectofundido, true, NULL);
loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
stopVoc();
autoPlayVoc("CALDERA", 6433, 15386);
setSfxVolume(volumenfxizquierdo, 0);
- effect(tipoefectofundido, false, background);
+ screenTransition(tipoefectofundido, false, background);
g_engine->_mouseManager->show();
oldxrejilla = 0;
oldyrejilla = 0;
@@ -650,7 +665,7 @@ void sceneChange() {
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- effect(tipoefectofundido, true, NULL);
+ screenTransition(tipoefectofundido, true, NULL);
iframe = 0;
indicetray = 0;
characterPosX = currentRoomData->doors[indicepuertas].posxsalida - rectificacionx;
@@ -658,7 +673,7 @@ void sceneChange() {
trayec[indicetray].x = characterPosX;
trayec[indicetray].y = characterPosY;
loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
- effect(tipoefectofundido, false, background);
+ screenTransition(tipoefectofundido, false, background);
g_engine->_mouseManager->show();
oldxrejilla = 0;
@@ -677,9 +692,9 @@ void sceneChange() {
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- effect(tipoefectofundido, true, NULL);
+ screenTransition(tipoefectofundido, true, NULL);
loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
- effect(tipoefectofundido, false, background);
+ screenTransition(tipoefectofundido, false, background);
g_engine->_mouseManager->show();
oldxrejilla = 0;
oldyrejilla = 0;
@@ -738,9 +753,9 @@ void sceneChange() {
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- effect(tipoefectofundido, true, NULL);
+ screenTransition(tipoefectofundido, true, NULL);
loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
- effect(tipoefectofundido, false, background);
+ screenTransition(tipoefectofundido, false, background);
g_engine->_mouseManager->show();
oldxrejilla = 0;
oldyrejilla = 0;
@@ -770,7 +785,7 @@ void sceneChange() {
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- effect(tipoefectofundido, true, NULL);
+ screenTransition(tipoefectofundido, true, NULL);
stopVoc();
loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
if (libro[0] == true && currentRoomData->animationFlag == true)
@@ -778,7 +793,7 @@ void sceneChange() {
if (contadorpc > 89)
showError(274);
setSfxVolume(volumenfxizquierdo, volumenfxderecho);
- effect(tipoefectofundido, false, background);
+ screenTransition(tipoefectofundido, false, background);
contadorpc = contadorpc2;
g_engine->_mouseManager->show();
oldxrejilla = 0;
@@ -797,9 +812,9 @@ void sceneChange() {
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- effect(tipoefectofundido, true, NULL);
+ screenTransition(tipoefectofundido, true, NULL);
loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
- effect(tipoefectofundido, false, background);
+ screenTransition(tipoefectofundido, false, background);
g_engine->_mouseManager->show();
oldxrejilla = 0;
oldyrejilla = 0;
@@ -830,9 +845,9 @@ void sceneChange() {
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- effect(tipoefectofundido, true, NULL);
+ screenTransition(tipoefectofundido, true, NULL);
loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
- effect(tipoefectofundido, false, background);
+ screenTransition(tipoefectofundido, false, background);
g_engine->_mouseManager->show();
oldxrejilla = 0;
oldyrejilla = 0;
@@ -862,7 +877,7 @@ void sceneChange() {
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- effect(tipoefectofundido, true, NULL);
+ screenTransition(tipoefectofundido, true, NULL);
stopVoc();
loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
switch (hornacina[0][hornacina[0][3]]) {
@@ -884,7 +899,7 @@ void sceneChange() {
setSfxVolume(volumenfxizquierdo, volumenfxderecho);
if (currentRoomData->codigo == 4)
loadVoc("GOTA", 140972, 1029);
- effect(tipoefectofundido, false, background);
+ screenTransition(tipoefectofundido, false, background);
contadorpc = contadorpc2;
g_engine->_mouseManager->show();
oldxrejilla = 0;
@@ -902,7 +917,7 @@ void sceneChange() {
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- effect(tipoefectofundido, true, NULL);
+ screenTransition(tipoefectofundido, true, NULL);
stopVoc();
loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
switch (hornacina[1][hornacina[1][3]]) {
@@ -947,7 +962,7 @@ void sceneChange() {
}
assembleScreen();
}
- effect(tipoefectofundido, false, background);
+ screenTransition(tipoefectofundido, false, background);
if ((rojo_capturado == false) && (trampa_puesta == false))
runaroundRed();
contadorpc = contadorpc2;
@@ -970,7 +985,7 @@ void sceneChange() {
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- effect(tipoefectofundido, true, NULL);
+ screenTransition(tipoefectofundido, true, NULL);
stopVoc();
loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
if (contadorpc > 89)
@@ -984,7 +999,7 @@ void sceneChange() {
autoPlayVoc("FUENTE", 0, 0);
break;
}
- effect(tipoefectofundido, false, background);
+ screenTransition(tipoefectofundido, false, background);
contadorpc = contadorpc2;
g_engine->_mouseManager->show();
oldxrejilla = 0;
diff --git a/engines/tot/graphics.cpp b/engines/tot/graphics.cpp
index 43b84ab761c..a2af6f68663 100644
--- a/engines/tot/graphics.cpp
+++ b/engines/tot/graphics.cpp
@@ -32,7 +32,7 @@
namespace Tot {
-signed char datosfundido[256][256];
+signed char fadeData[256][256];
int ipal, jpal;
void rectangle(int x1, int y1, int x2, int y2, byte color) {
@@ -55,10 +55,10 @@ void rectangle(uint x1, uint y1, uint x2, uint y2, byte color) {
void getVirtualImg(
uint getcoordx1, // xframe
uint getcoordy1, // yframe
- uint getcoordx2, // xframe + pasoFrameW
- uint getcoordy2, // yframe + pasoFrameH
- byte *backgroundScreen, // fondo
- byte *image // fondsprite
+ uint getcoordx2, // xframe + framewidth
+ uint getcoordy2, // yframe + frameheight
+ byte *backgroundScreen,
+ byte *image
) {
uint16 w = getcoordx2 - getcoordx1;
uint16 h = getcoordy2 - getcoordy1;
@@ -186,7 +186,7 @@ void updateSceneAreaIfNeeded(int speed = 1) {
g_engine->_screen->update();
}
}
-void effect(byte numeroefecto, bool pasaranegro, byte *pantalla2) {
+void screenTransition(byte effectNumber, bool fadeToBlack, byte *scene) {
int i1, i2, i3, j1, j2, j3;
bool enabled = false;
@@ -195,17 +195,17 @@ void effect(byte numeroefecto, bool pasaranegro, byte *pantalla2) {
byte *screenBuf = (byte *)g_engine->_screen->getPixels();
// Disable effects for now
if (!enabled) {
- debug("Effects disabled! requested effect is %d, with fadeToBlack =%d", numeroefecto, pasaranegro);
- if (!pasaranegro) {
- drawScreen(pantalla2);
+ debug("Effects disabled! requested effect is %d, with fadeToBlack =%d", effectNumber, fadeToBlack);
+ if (!fadeToBlack) {
+ drawScreen(scene);
}
} else {
contadorpc2 = contadorpc;
if (contadorpc > 145)
showError(274);
- debug("Effect %d, pasaraanegro=%d", numeroefecto, pasaranegro);
- if (pasaranegro)
- switch (numeroefecto) {
+ debug("Effect %d, pasaraanegro=%d", effectNumber, fadeToBlack);
+ if (fadeToBlack)
+ switch (effectNumber) {
case 1: {
for (i1 = 0; i1 <= 69; i1++) {
line(0, (i1 * 2), 319, (i1 * 2), 0);
@@ -390,17 +390,17 @@ void effect(byte numeroefecto, bool pasaranegro, byte *pantalla2) {
} break;
}
else
- switch (numeroefecto) {
+ switch (effectNumber) {
case 1: {
for (i1 = 0; i1 <= 69; i1++) {
- byte *src = pantalla2 + (i1 * 640) + 4;
+ byte *src = scene + (i1 * 640) + 4;
Common::copy(src, src + 320, screenBuf + (i1 * 640));
updateSceneAreaIfNeeded();
delay(5);
}
for (i1 = 70; i1 >= 1; i1--) {
- byte *src = pantalla2 + (i1 * 640) - 320 + 4;
+ byte *src = scene + (i1 * 640) - 320 + 4;
Common::copy(src, src + 320, screenBuf + (i1 * 640) - 320);
updateSceneAreaIfNeeded();
delay(5);
@@ -411,13 +411,13 @@ void effect(byte numeroefecto, bool pasaranegro, byte *pantalla2) {
case 8:
case 9: {
for (i1 = 70; i1 >= 1; i1--) {
- byte *src = pantalla2 + ((i1 * 640) - 320) + 4;
+ byte *src = scene + ((i1 * 640) - 320) + 4;
Common::copy(src, src + 320, screenBuf + (i1 * 640) - 320);
updateSceneAreaIfNeeded();
delay(5);
}
for (i1 = 0; i1 <= 69; i1++) {
- byte *src = pantalla2 + (i1 * 640) + 4;
+ byte *src = scene + (i1 * 640) + 4;
Common::copy(src, src + 320, screenBuf + (i1 * 640));
updateSceneAreaIfNeeded();
delay(5);
@@ -431,7 +431,7 @@ void effect(byte numeroefecto, bool pasaranegro, byte *pantalla2) {
j1 = 10;
do {
for (i3 = (j1 - i2); i3 <= (j1 + i2); i3++) {
- byte *src = pantalla2 + +4 + (i3 * 320) + +(i1 - i2);
+ byte *src = scene + +4 + (i3 * 320) + +(i1 - i2);
Common::copy(src, src + (i2 * 2), screenBuf + (i3 * 320) + (i1 - i2));
}
j1 += 20;
@@ -440,7 +440,7 @@ void effect(byte numeroefecto, bool pasaranegro, byte *pantalla2) {
i1 += 20;
} while (i1 != 330);
}
- drawScreen(pantalla2);
+ drawScreen(scene);
} break;
case 4: {
for (i2 = 1; i2 <= 22; i2++) {
@@ -448,7 +448,7 @@ void effect(byte numeroefecto, bool pasaranegro, byte *pantalla2) {
for (j1 = 1; j1 <= 7; j1++) {
if ((i1 + j1) == (i2 + 1)) {
for (i3 = ((j1 - 1) * 20); i3 <= ((j1 - 1) * 20 + 19); i3++) {
- byte *src = pantalla2 + +4 + (i3 * 320) + ((i1 - 1) * 20);
+ byte *src = scene + +4 + (i3 * 320) + ((i1 - 1) * 20);
Common::copy(src, src + 20, screenBuf + (i3 * 320) + ((i1 - 1) * 20));
updateSceneAreaIfNeeded();
}
@@ -460,7 +460,7 @@ void effect(byte numeroefecto, bool pasaranegro, byte *pantalla2) {
case 6: {
for (i1 = 70; i1 >= 0; i1--) {
for (j1 = i1; j1 <= (139 - i1); j1++) {
- byte *src = pantalla2 + 4 + (j1 * 320) + i1;
+ byte *src = scene + 4 + (j1 * 320) + i1;
Common::copy(src, src + 319 - (i1 * 2), screenBuf + (j1 * 320) + i1);
}
updateSceneAreaIfNeeded();
@@ -471,7 +471,7 @@ void effect(byte numeroefecto, bool pasaranegro, byte *pantalla2) {
if ((j1 % 2) == 0)
for (i1 = 1; i1 <= 16; i1++) {
for (j3 = ((j1 - 1) * 20); j3 <= ((j1 - 1) * 20 + 19); j3++) {
- byte *src = pantalla2 + 4 + (j3 * 320) + ((i1 - 1) * 20);
+ byte *src = scene + 4 + (j3 * 320) + ((i1 - 1) * 20);
Common::copy(src, src + 20, screenBuf + (j3 * 320) + ((i1 - 1) * 20));
}
@@ -481,7 +481,7 @@ void effect(byte numeroefecto, bool pasaranegro, byte *pantalla2) {
else
for (i1 = 16; i1 >= 1; i1--) {
for (j3 = ((j1 - 1) * 20); j3 <= ((j1 - 1) * 20 + 19); j3++) {
- byte *src = pantalla2 + 4 + (j3 * 320) + ((i1 - 1) * 20);
+ byte *src = scene + 4 + (j3 * 320) + ((i1 - 1) * 20);
Common::copy(src, src + 20, screenBuf + (j3 * 320) + ((i1 - 1) * 20));
}
updateSceneAreaIfNeeded();
@@ -494,7 +494,7 @@ void effect(byte numeroefecto, bool pasaranegro, byte *pantalla2) {
j1 = 1 + i2;
for (i1 = (1 + i2); i1 <= (16 - i2); i1++) {
for (j3 = ((j1 - 1) * 20); j3 <= ((j1 - 1) * 20 + 19); j3++) {
- byte *buf = pantalla2 + 4 + (j3 * 320) + ((i1 - 1) * 20);
+ byte *buf = scene + 4 + (j3 * 320) + ((i1 - 1) * 20);
Common::copy(buf, buf + 20, screenBuf + ((j3 * 320) + ((i1 - 1) * 20)));
}
updateSceneAreaIfNeeded();
@@ -503,7 +503,7 @@ void effect(byte numeroefecto, bool pasaranegro, byte *pantalla2) {
i1--;
for (j1 = (2 + i2); j1 <= (7 - i2); j1++) {
for (j3 = ((j1 - 1) * 20); j3 <= ((j1 - 1) * 20 + 19); j3++) {
- byte *buf = pantalla2 + 4 + (j3 * 320) + ((i1 - 1) * 20);
+ byte *buf = scene + 4 + (j3 * 320) + ((i1 - 1) * 20);
Common::copy(buf, buf + 20, screenBuf + ((j3 * 320) + ((i1 - 1) * 20)));
}
updateSceneAreaIfNeeded();
@@ -512,7 +512,7 @@ void effect(byte numeroefecto, bool pasaranegro, byte *pantalla2) {
j1--;
for (i1 = (16 - i2); i1 >= (1 + i2); i1--) {
for (j3 = ((j1 - 1) * 20); j3 <= ((j1 - 1) * 20 + 19); j3++) {
- byte *buf = pantalla2 + 4 + (j3 * 320) + ((i1 - 1) * 20);
+ byte *buf = scene + 4 + (j3 * 320) + ((i1 - 1) * 20);
Common::copy(buf, buf + 20, screenBuf + ((j3 * 320) + ((i1 - 1) * 20)));
}
updateSceneAreaIfNeeded();
@@ -521,7 +521,7 @@ void effect(byte numeroefecto, bool pasaranegro, byte *pantalla2) {
i1++;
for (j1 = (6 - i2); j1 >= (2 + i2); j1--) {
for (j3 = ((j1 - 1) * 20); j3 <= ((j1 - 1) * 20 + 19); j3++) {
- byte *buf = pantalla2 + 4 + (j3 * 320) + ((i1 - 1) * 20);
+ byte *buf = scene + 4 + (j3 * 320) + ((i1 - 1) * 20);
Common::copy(buf, buf + 20, screenBuf + ((j3 * 320) + ((i1 - 1) * 20)));
}
updateSceneAreaIfNeeded();
@@ -534,8 +534,8 @@ void effect(byte numeroefecto, bool pasaranegro, byte *pantalla2) {
i2 = Random(318);
j2 = Random(138);
- byte *src1 = pantalla2 + 4 + (j2 * 320) + i2;
- byte *src2 = pantalla2 + 4 + ((j2 + 1) * 320) + i2;
+ byte *src1 = scene + 4 + (j2 * 320) + i2;
+ byte *src2 = scene + 4 + ((j2 + 1) * 320) + i2;
Common::copy(src1, src1 + 2, screenBuf + j2 * 320 + i2);
// move(ptr(seg(pantalla2), (ofs(pantalla2) + 4 + (j2 * 320) + i2)), ptr(0xa000, ((j2 * 320) + i2)), 2);
@@ -544,19 +544,19 @@ void effect(byte numeroefecto, bool pasaranegro, byte *pantalla2) {
i2 = Random(320);
j2 = Random(140);
- byte *src3 = pantalla2 + 4 + (j2 * 320) + i2;
+ byte *src3 = scene + 4 + (j2 * 320) + i2;
Common::copy(src3, src3 + 1, screenBuf + (j2 * 320) + i2);
updateSceneAreaIfNeeded();
// move(ptr(seg(pantalla2), (ofs(pantalla2) + 4 + (j2 * 320) + i2)), ptr(0xa000, ((j2 * 320) + i2)), 1);
}
- drawScreen(pantalla2);
+ drawScreen(scene);
} break;
case 13: {
debug("case 13!");
for (i1 = 0; i1 <= 319; i1++) {
for (j1 = 0; j1 <= 139; j1++) {
- int color = pantalla2[4 + (j1 * 320) + i1];
+ int color = scene[4 + (j1 * 320) + i1];
*((byte *)g_engine->_screen->getBasePtr(i1, j1)) = color;
}
delay(2);
@@ -566,7 +566,7 @@ void effect(byte numeroefecto, bool pasaranegro, byte *pantalla2) {
case 14: {
for (i1 = 320; i1 > 0; i1--) {
for (j1 = 0; j1 < 140; j1++) {
- int color = pantalla2[4 + (j1 * 320) + i1];
+ int color = scene[4 + (j1 * 320) + i1];
*((byte *)g_engine->_screen->getBasePtr(i1, j1)) = color;
}
updateSceneAreaIfNeeded();
@@ -579,8 +579,8 @@ void effect(byte numeroefecto, bool pasaranegro, byte *pantalla2) {
}
delay(5);
for (j1 = 70; j1 > 0; j1--) {
- byte *src1 = pantalla2 + 4 + j1 * 320;
- byte *src2 = pantalla2 + 4 + (139 - j1) * 320;
+ byte *src1 = scene + 4 + j1 * 320;
+ byte *src2 = scene + 4 + (139 - j1) * 320;
Common::copy(src1, src1 + 320, screenBuf + j1 * 320);
Common::copy(src2, src2 + 320, screenBuf + (139 - j1) * 320);
@@ -595,32 +595,32 @@ void changeRGBBlock(byte initialColor, uint numColors, byte *rgb) {
g_system->getPaletteManager()->setPalette(rgb, initialColor, numColors);
}
-void changePalette(palette depaleta, palette apaleta) {
- palette palpaso;
- int auxpaso;
+void changePalette(palette from, palette to) {
+ palette intermediate;
+ int aux;
- copyPalette(depaleta, palpaso);
+ copyPalette(from, intermediate);
for (jpal = 32; jpal >= 0; jpal--) {
for (ipal = 0; ipal < 256; ipal++) {
- auxpaso = apaleta[3 * ipal + 0] - palpaso[3 * ipal + 0];
- if (auxpaso > 0)
- palpaso[3 * ipal + 0] = palpaso[3 * ipal + 0] + datosfundido[auxpaso][jpal];
+ aux = to[3 * ipal + 0] - intermediate[3 * ipal + 0];
+ if (aux > 0)
+ intermediate[3 * ipal + 0] = intermediate[3 * ipal + 0] + fadeData[aux][jpal];
else
- palpaso[3 * ipal + 0] = palpaso[3 * ipal + 0] - datosfundido[-auxpaso][jpal];
+ intermediate[3 * ipal + 0] = intermediate[3 * ipal + 0] - fadeData[-aux][jpal];
- auxpaso = apaleta[3 * ipal + 1] - palpaso[3 * ipal + 1];
- if (auxpaso > 0)
- palpaso[3 * ipal + 1] = palpaso[3 * ipal + 1] + datosfundido[auxpaso][jpal];
+ aux = to[3 * ipal + 1] - intermediate[3 * ipal + 1];
+ if (aux > 0)
+ intermediate[3 * ipal + 1] = intermediate[3 * ipal + 1] + fadeData[aux][jpal];
else
- palpaso[3 * ipal + 1] = palpaso[3 * ipal + 1] - datosfundido[-auxpaso][jpal];
+ intermediate[3 * ipal + 1] = intermediate[3 * ipal + 1] - fadeData[-aux][jpal];
- auxpaso = apaleta[3 * ipal + 2] - palpaso[3 * ipal + 2];
- if (auxpaso > 0)
- palpaso[3 * ipal + 2] = palpaso[3 * ipal + 2] + datosfundido[auxpaso][jpal];
+ aux = to[3 * ipal + 2] - intermediate[3 * ipal + 2];
+ if (aux > 0)
+ intermediate[3 * ipal + 2] = intermediate[3 * ipal + 2] + fadeData[aux][jpal];
else
- palpaso[3 * ipal + 2] = palpaso[3 * ipal + 2] - datosfundido[-auxpaso][jpal];
+ intermediate[3 * ipal + 2] = intermediate[3 * ipal + 2] - fadeData[-aux][jpal];
}
- changeRGBBlock(0, 256, palpaso);
+ changeRGBBlock(0, 256, intermediate);
g_engine->_screen->markAllDirty();
g_engine->_screen->update();
}
@@ -628,132 +628,132 @@ void changePalette(palette depaleta, palette apaleta) {
void turnLightOn() {
Common::File paletteFile;
- palette palpaso;
+ palette intermediate;
if (!paletteFile.open("PALETAS.DAT")) {
showError(311);
}
paletteFile.seek(1536);
- paletteFile.read(palpaso, 768);
+ paletteFile.read(intermediate, 768);
paletteFile.close();
for (int i = 0; i < 256; i++) {
if (i >= 201) {
- palpaso[3 * i + 0] = pal[3 * i + 0];
- palpaso[3 * i + 1] = pal[3 * i + 1];
- palpaso[3 * i + 2] = pal[3 * i + 2];
+ intermediate[3 * i + 0] = pal[3 * i + 0];
+ intermediate[3 * i + 1] = pal[3 * i + 1];
+ intermediate[3 * i + 2] = pal[3 * i + 2];
// }
} else {
- palpaso[3 * i + 0] = palpaso[3 * i + 0] << 2;
- palpaso[3 * i + 1] = palpaso[3 * i + 1] << 2;
- palpaso[3 * i + 2] = palpaso[3 * i + 2] << 2;
+ intermediate[3 * i + 0] = intermediate[3 * i + 0] << 2;
+ intermediate[3 * i + 1] = intermediate[3 * i + 1] << 2;
+ intermediate[3 * i + 2] = intermediate[3 * i + 2] << 2;
}
}
- changePalette(pal, palpaso);
- copyPalette(palpaso, pal);
+ changePalette(pal, intermediate);
+ copyPalette(intermediate, pal);
}
-void totalFadeOut(byte rojo) {
- palette palpaso;
+void totalFadeOut(byte redComponent) {
+ palette intermediate;
for (ipal = 0; ipal <= 255; ipal++) {
- palpaso[3 * ipal + 0] = rojo;
- palpaso[3 * ipal + 1] = 0;
- palpaso[3 * ipal + 2] = 0;
+ intermediate[3 * ipal + 0] = redComponent;
+ intermediate[3 * ipal + 1] = 0;
+ intermediate[3 * ipal + 2] = 0;
}
- changePalette(pal, palpaso);
- copyPalette(palpaso, pal);
+ changePalette(pal, intermediate);
+ copyPalette(intermediate, pal);
}
void partialFadeOut(byte numcol) {
- palette palpaso;
+ palette intermediate;
for (ipal = 0; ipal <= numcol; ipal++) {
- palpaso[3 * ipal + 0] = 0;
- palpaso[3 * ipal + 1] = 0;
- palpaso[3 * ipal + 2] = 0;
+ intermediate[3 * ipal + 0] = 0;
+ intermediate[3 * ipal + 1] = 0;
+ intermediate[3 * ipal + 2] = 0;
}
for (ipal = (numcol + 1); ipal <= 255; ipal++) {
- palpaso[3 * ipal + 0] = pal[3 * ipal + 0];
- palpaso[3 * ipal + 1] = pal[3 * ipal + 1];
- palpaso[3 * ipal + 2] = pal[3 * ipal + 2];
+ intermediate[3 * ipal + 0] = pal[3 * ipal + 0];
+ intermediate[3 * ipal + 1] = pal[3 * ipal + 1];
+ intermediate[3 * ipal + 2] = pal[3 * ipal + 2];
}
- changePalette(pal, palpaso);
- copyPalette(palpaso, pal);
+ changePalette(pal, intermediate);
+ copyPalette(intermediate, pal);
}
void partialFadeIn(byte numcol) {
- palette palnegro;
+ palette darkPalette;
for (ipal = 0; ipal <= numcol; ipal++) {
- palnegro[3 * ipal + 0] = 0;
- palnegro[3 * ipal + 1] = 0;
- palnegro[3 * ipal + 2] = 0;
+ darkPalette[3 * ipal + 0] = 0;
+ darkPalette[3 * ipal + 1] = 0;
+ darkPalette[3 * ipal + 2] = 0;
}
for (ipal = (numcol + 1); ipal <= 255; ipal++) {
- palnegro[3 * ipal + 0] = pal[3 * ipal + 0];
- palnegro[3 * ipal + 1] = pal[3 * ipal + 1];
- palnegro[3 * ipal + 2] = pal[3 * ipal + 2];
+ darkPalette[3 * ipal + 0] = pal[3 * ipal + 0];
+ darkPalette[3 * ipal + 1] = pal[3 * ipal + 1];
+ darkPalette[3 * ipal + 2] = pal[3 * ipal + 2];
}
- changePalette(palnegro, pal);
+ changePalette(darkPalette, pal);
}
-void totalFadeIn(uint numeropaleta, Common::String nombrepaleta) {
- palette palpaso, palnegro;
- Common::File fichpaleta;
- if (numeropaleta > 0) {
- if (!fichpaleta.open("PALETAS.DAT"))
+void totalFadeIn(uint paletteNumber, Common::String paletteName) {
+ palette intermediate, darkPalette;
+ Common::File paletteFile;
+ if (paletteNumber > 0) {
+ if (!paletteFile.open("PALETAS.DAT"))
showError(311);
- fichpaleta.seek(numeropaleta);
- fichpaleta.read(palpaso, 768);
- fichpaleta.close();
+ paletteFile.seek(paletteNumber);
+ paletteFile.read(intermediate, 768);
+ paletteFile.close();
} else {
- if (!fichpaleta.open(Common::Path(Common::String(nombrepaleta + ".PAL")))) {
+ if (!paletteFile.open(Common::Path(Common::String(paletteName + ".PAL")))) {
showError(311);
}
- fichpaleta.read(palpaso, 768);
- fichpaleta.close();
+ paletteFile.read(intermediate, 768);
+ paletteFile.close();
}
for (ipal = 0; ipal <= 255; ipal++) {
- palnegro[3 * ipal + 0] = 0;
- palnegro[3 * ipal + 1] = 0;
- palnegro[3 * ipal + 2] = 0;
+ darkPalette[3 * ipal + 0] = 0;
+ darkPalette[3 * ipal + 1] = 0;
+ darkPalette[3 * ipal + 2] = 0;
// 6-bit color correction
- palpaso[3 * ipal + 0] = palpaso[3 * ipal + 0] << 2;
- palpaso[3 * ipal + 1] = palpaso[3 * ipal + 1] << 2;
- palpaso[3 * ipal + 2] = palpaso[3 * ipal + 2] << 2;
+ intermediate[3 * ipal + 0] = intermediate[3 * ipal + 0] << 2;
+ intermediate[3 * ipal + 1] = intermediate[3 * ipal + 1] << 2;
+ intermediate[3 * ipal + 2] = intermediate[3 * ipal + 2] << 2;
}
- changePalette(palnegro, palpaso);
- copyPalette(palpaso, pal);
+ changePalette(darkPalette, intermediate);
+ copyPalette(intermediate, pal);
}
-void redFadeIn(palette palpaso) {
- palette palnegro;
+void redFadeIn(palette intermediatePalette) {
+ palette dark;
for (ipal = 0; ipal < 256; ipal++) {
- palnegro[3 * ipal + 0] = 0;
- palnegro[3 * ipal + 1] = 0;
- palnegro[3 * ipal + 2] = 0;
+ dark[3 * ipal + 0] = 0;
+ dark[3 * ipal + 1] = 0;
+ dark[3 * ipal + 2] = 0;
}
- changePalette(pal, palnegro);
- changePalette(palnegro, palpaso);
- copyPalette(palpaso, pal);
+ changePalette(pal, dark);
+ changePalette(dark, intermediatePalette);
+ copyPalette(intermediatePalette, pal);
}
-void updatePalette(byte indicepaleta) {
+void updatePalette(byte paletteIndex) {
int ip;
switch (gamePart) {
case 1: {
for (ipal = 0; ipal <= 5; ipal++) {
- pal[(ipal + 195) * 3 + 0] = movimientopal[(indicepaleta * 6 + ipal) * 3 + 0];
- pal[(ipal + 195) * 3 + 1] = movimientopal[(indicepaleta * 6 + ipal) * 3 + 1];
- pal[(ipal + 195) * 3 + 2] = movimientopal[(indicepaleta * 6 + ipal) * 3 + 2];
+ pal[(ipal + 195) * 3 + 0] = movimientopal[(paletteIndex * 6 + ipal) * 3 + 0];
+ pal[(ipal + 195) * 3 + 1] = movimientopal[(paletteIndex * 6 + ipal) * 3 + 1];
+ pal[(ipal + 195) * 3 + 2] = movimientopal[(paletteIndex * 6 + ipal) * 3 + 2];
}
changeRGBBlock(195, 6, &pal[195 * 3 + 0]);
} break;
case 2: {
- switch (indicepaleta) {
+ switch (paletteIndex) {
case 0:
ip = 0;
break;
@@ -779,12 +779,6 @@ void updatePalette(byte indicepaleta) {
ip = -4;
break;
}
- // debug("-----------BEFORE--------------- (adding %d)", ip);
- // debug("Color 131: %d,%d,%d", pal[131 * 3 + 0], pal[131 * 3 + 1], pal[131 * 3 + 2]);
- // debug("Color 134: %d,%d,%d", pal[134 * 3 + 0], pal[134 * 3 + 1], pal[134 * 3 + 2]);
- // debug("Color 143: %d,%d,%d", pal[143 * 3 + 0], pal[143 * 3 + 1], pal[143 * 3 + 2]);
- // debug("Color 187: %d,%d,%d", pal[187 * 3 + 0], pal[187 * 3 + 1], pal[187 * 3 + 2]);
-
for (int i = 0; i < 3; i++) {
pal[131 * 3 + i] = pal[131 * 3 + i] - ip;
@@ -794,11 +788,6 @@ void updatePalette(byte indicepaleta) {
}
g_engine->_graphics->setPalette(pal);
- // debug("-----------AFTER--------------- (adding %d)", ip);
- // debug("Color 131: %d,%d,%d", pal[131 * 3 + 0], pal[131 * 3 + 1], pal[131 * 3 + 2]);
- // debug("Color 134: %d,%d,%d", pal[134 * 3 + 0], pal[134 * 3 + 1], pal[134 * 3 + 2]);
- // debug("Color 143: %d,%d,%d", pal[143 * 3 + 0], pal[143 * 3 + 1], pal[143 * 3 + 2]);
- // debug("Color 187: %d,%d,%d", pal[187 * 3 + 0], pal[187 * 3 + 1], pal[187 * 3 + 2]);
} break;
}
}
@@ -828,11 +817,11 @@ void processingActive() {
void initGraph() {
for (int i = 0; i < 256; i++)
for (int j = 0; j < 256; j++)
- datosfundido[i][j] = i / (j + 1);
+ fadeData[i][j] = i / (j + 1);
}
-void handPantallaToBackground() {
- Common::copy(handpantalla + 4, handpantalla + sizepantalla, background + 4);
+void screenHandleToBackground() {
+ Common::copy(screenHandle + 4, screenHandle + screenSize, background + 4);
}
void copyPalette(palette from, palette to) {
diff --git a/engines/tot/graphics.h b/engines/tot/graphics.h
index e04259358e4..4f698f08c8a 100644
--- a/engines/tot/graphics.h
+++ b/engines/tot/graphics.h
@@ -37,7 +37,7 @@ void putImg(uint coordx, uint coordy, byte *image, bool transparency = false);
void putShape(uint coordx, uint coordy, byte *image);
void getImg(uint coordx1, uint coordy1, uint coordx2, uint coordy2, byte *image);
void loadPalette(Common::String image);
-void effect(byte effectNumber, bool fadeToBlack, byte *screen);
+void screenTransition(byte effectNumber, bool fadeToBlack, byte *screen);
void turnLightOn();
void totalFadeOut(byte red);
void partialFadeOut(byte numCol);
@@ -50,9 +50,9 @@ void changeRGBBlock(byte initialColor, uint numColors, byte *rgb);
void processingActive();
void rectangle(int x1, int y1, int x2, int y2, byte color);
void rectangle(uint x1, uint y1, uint x2, uint y2, byte color);
-void handPantallaToBackground();
+void screenHandleToBackground();
void copyPalette(palette from, palette to);
-void loadAnimationIntoBuffer(Common::SeekableReadStream *stream, byte *&buf, int sizeanimado);
+void loadAnimationIntoBuffer(Common::SeekableReadStream *stream, byte *&buf, int animSize);
} // End of namespace Tot
#endif
diff --git a/engines/tot/graphman.cpp b/engines/tot/graphman.cpp
index 1634367e733..1462f602539 100644
--- a/engines/tot/graphman.cpp
+++ b/engines/tot/graphman.cpp
@@ -33,7 +33,7 @@ namespace Tot {
GraphicsManager::GraphicsManager() {
for (int i = 0; i < 256; i++)
for (int j = 0; j < 256; j++)
- datosfundido[i][j] = i / (j + 1);
+ fadeData[i][j] = i / (j + 1);
Common::File exeFile;
if (!exeFile.open(Common::Path("TOT.EXE"))) {
diff --git a/engines/tot/graphman.h b/engines/tot/graphman.h
index 6e839f4d0dc..0565c3e8adb 100644
--- a/engines/tot/graphman.h
+++ b/engines/tot/graphman.h
@@ -55,7 +55,7 @@ public:
Graphics::Font *_bios;
private:
- signed char datosfundido[256][256];
+ signed char fadeData[256][256];
};
} // End of namespace Tot
diff --git a/engines/tot/midi.cpp b/engines/tot/midi.cpp
index b572cd5bba3..c7dc9c494b6 100644
--- a/engines/tot/midi.cpp
+++ b/engines/tot/midi.cpp
@@ -28,1677 +28,6 @@
namespace Tot {
-uint8 rawInstrumentBank[128][11] = {
- {0x00, 0x00, 0x4F, 0x00, 0xF1, 0xD2, 0x51, 0x43, 0x00, 0x00, 0x06},
- {0x02, 0x12, 0x4F, 0x00, 0xF1, 0xD2, 0x51, 0x43, 0x00, 0x00, 0x02},
- {0x00, 0x11, 0x4A, 0x00, 0xF1, 0xD2, 0x53, 0x74, 0x00, 0x00, 0x06},
- {0x03, 0x11, 0x4F, 0x00, 0xF1, 0xD2, 0x53, 0x74, 0x01, 0x01, 0x06},
- {0x01, 0x11, 0x66, 0x00, 0xF1, 0xD2, 0x51, 0xC3, 0x00, 0x00, 0x06},
- {0xC0, 0xD2, 0x52, 0x00, 0xF1, 0xD2, 0x53, 0x94, 0x00, 0x00, 0x06},
- {0x12, 0x18, 0x86, 0x00, 0xF3, 0xFC, 0x00, 0x33, 0x00, 0x00, 0x08},
- {0xD0, 0x12, 0x4E, 0x00, 0xA8, 0x92, 0x32, 0xA7, 0x03, 0x02, 0x00},
- {0xC8, 0xD1, 0x4F, 0x00, 0xF2, 0xF3, 0x64, 0x77, 0x00, 0x00, 0x08},
- {0x33, 0x34, 0x0E, 0x00, 0x01, 0x7D, 0x11, 0x34, 0x00, 0x00, 0x08},
- {0x17, 0x16, 0x50, 0x00, 0xD1, 0xD3, 0x52, 0x92, 0x00, 0x01, 0x04},
- {0xE7, 0xE1, 0x21, 0x00, 0xF5, 0xF6, 0x77, 0x14, 0x00, 0x00, 0x08},
- {0x95, 0x81, 0x4E, 0x00, 0xDA, 0xF9, 0x25, 0x15, 0x00, 0x00, 0x0A},
- {0x27, 0x21, 0x1F, 0x00, 0xF5, 0xF5, 0x96, 0x57, 0x00, 0x00, 0x08},
- {0x87, 0xF1, 0x4E, 0x80, 0xB1, 0xE6, 0x33, 0x42, 0x00, 0x00, 0x00},
- {0x31, 0x11, 0x87, 0x80, 0xA1, 0x7D, 0x11, 0x43, 0x00, 0x00, 0x08},
- {0x32, 0xB1, 0x8C, 0x00, 0x91, 0xA1, 0x07, 0x19, 0x02, 0x00, 0x05},
- {0x31, 0xB4, 0x54, 0x80, 0xF1, 0xF5, 0x07, 0x19, 0x00, 0x00, 0x07},
- {0x24, 0x21, 0x40, 0x49, 0xFF, 0xFF, 0x0F, 0x0F, 0x00, 0x00, 0x01},
- {0xD2, 0xF1, 0x44, 0x80, 0x91, 0xA1, 0x57, 0x09, 0x01, 0x01, 0x03},
- {0x01, 0x02, 0x52, 0x80, 0xF0, 0xF0, 0x1F, 0x1F, 0x01, 0x00, 0x0A},
- {0x21, 0x32, 0x4F, 0x01, 0xF2, 0x52, 0x0B, 0x0B, 0x00, 0x01, 0x0A},
- {0xF0, 0xF2, 0x93, 0x00, 0xD8, 0xB3, 0x0B, 0x0B, 0x02, 0x01, 0x0A},
- {0x20, 0x31, 0x5D, 0x00, 0xF2, 0x52, 0x0B, 0x0B, 0x03, 0x02, 0x00},
- {0x01, 0x01, 0x1B, 0x00, 0xF4, 0xF3, 0x25, 0x46, 0x02, 0x00, 0x00},
- {0x11, 0x01, 0x0F, 0x00, 0xF4, 0xF3, 0x25, 0x46, 0x01, 0x00, 0x00},
- {0x01, 0x01, 0x27, 0x00, 0xF1, 0xF4, 0x1F, 0x88, 0x02, 0x00, 0x0A},
- {0x12, 0x13, 0x44, 0x00, 0xEA, 0xD2, 0x32, 0xE7, 0x01, 0x01, 0x00},
- {0x30, 0x31, 0x45, 0x00, 0xA4, 0xF5, 0x32, 0xE7, 0x03, 0x00, 0x00},
- {0x21, 0x21, 0x0F, 0x00, 0xF5, 0xF1, 0x17, 0x78, 0x02, 0x01, 0x04},
- {0x01, 0x20, 0x41, 0x00, 0xD1, 0xC1, 0x34, 0xA5, 0x03, 0x03, 0x04},
- {0x10, 0x12, 0x43, 0x00, 0xA7, 0xE3, 0x97, 0xE7, 0x03, 0x02, 0x00},
- {0x20, 0x21, 0x28, 0x00, 0xC5, 0xD2, 0x15, 0xA4, 0x00, 0x00, 0x0C},
- {0x30, 0x21, 0x16, 0x00, 0xF2, 0xF3, 0x9F, 0x78, 0x00, 0x00, 0x0C},
- {0x30, 0x21, 0x11, 0x00, 0x82, 0xF3, 0x9F, 0x78, 0x00, 0x00, 0x0A},
- {0x21, 0x21, 0x23, 0x00, 0x73, 0x93, 0x1A, 0x87, 0x00, 0x00, 0x0C},
- {0x30, 0x21, 0x0E, 0x00, 0x62, 0xF3, 0x55, 0x68, 0x02, 0x00, 0x0A},
- {0x30, 0x22, 0x0C, 0x00, 0x62, 0xD5, 0xB5, 0x98, 0x01, 0x00, 0x08},
- {0x70, 0x72, 0x93, 0x40, 0x64, 0xA1, 0x43, 0x43, 0x00, 0x00, 0x0A},
- {0x30, 0x32, 0x8D, 0x80, 0x44, 0x92, 0x43, 0x43, 0x02, 0x00, 0x0A},
- {0xE1, 0xE2, 0x4E, 0x00, 0x65, 0x61, 0x43, 0x44, 0x02, 0x02, 0x00},
- {0xA1, 0xA2, 0x8E, 0x00, 0x65, 0x63, 0x43, 0x45, 0x02, 0x02, 0x00},
- {0xB0, 0x61, 0x87, 0x40, 0xD1, 0x62, 0x11, 0x15, 0x02, 0x01, 0x06},
- {0xF0, 0x20, 0x8A, 0x80, 0xB1, 0xA0, 0x11, 0x15, 0x02, 0x01, 0x06},
- {0xF1, 0xE2, 0x89, 0x40, 0x73, 0x43, 0x01, 0x05, 0x02, 0x00, 0x06},
- {0x31, 0x21, 0x57, 0x80, 0xF8, 0xF7, 0xF9, 0xE6, 0x03, 0x02, 0x0E},
- {0x32, 0x01, 0x24, 0x80, 0xF1, 0xF5, 0x35, 0x35, 0x00, 0x00, 0x00},
- {0x00, 0x00, 0x04, 0x00, 0xAA, 0xD2, 0xC8, 0xB3, 0x00, 0x00, 0x0A},
- {0xE0, 0xF1, 0x4F, 0x00, 0xD4, 0x55, 0x0B, 0x0B, 0x02, 0x02, 0x0A},
- {0xE0, 0xF0, 0x52, 0x00, 0x96, 0x35, 0x05, 0x01, 0x02, 0x02, 0x0A},
- {0xE1, 0xF1, 0x4F, 0x00, 0x36, 0x45, 0x05, 0x02, 0x02, 0x02, 0x0A},
- {0xE2, 0xE1, 0x48, 0x80, 0x21, 0x41, 0x43, 0x45, 0x02, 0x01, 0x00},
- {0xE0, 0xF1, 0x16, 0x00, 0x41, 0x20, 0x52, 0x72, 0x02, 0x02, 0x00},
- {0xE0, 0xF1, 0x11, 0x00, 0x01, 0xD0, 0x52, 0x72, 0x02, 0x02, 0x00},
- {0xE0, 0xF1, 0x1A, 0x00, 0x61, 0x30, 0x52, 0x73, 0x00, 0x02, 0x00},
- {0x50, 0x50, 0x0B, 0x00, 0x84, 0xA4, 0x4B, 0x99, 0x00, 0x00, 0x0A},
- {0x31, 0x61, 0x1C, 0x80, 0x41, 0x92, 0x0B, 0x3B, 0x00, 0x00, 0x0E},
- {0xB1, 0x61, 0x1C, 0x00, 0x41, 0x92, 0x1F, 0x3B, 0x00, 0x00, 0x0E},
- {0x20, 0x21, 0x18, 0x00, 0x52, 0xA2, 0x15, 0x24, 0x00, 0x00, 0x0C},
- {0xC1, 0xC1, 0x94, 0x80, 0x74, 0xA3, 0xEA, 0xF5, 0x02, 0x01, 0x0E},
- {0x21, 0x21, 0x28, 0x00, 0x41, 0x81, 0xB4, 0x98, 0x00, 0x00, 0x0E},
- {0x21, 0x21, 0x1D, 0x00, 0x51, 0xE1, 0xAE, 0x3E, 0x02, 0x01, 0x0E},
- {0xE0, 0xE0, 0x93, 0x80, 0x51, 0x81, 0xA6, 0x97, 0x02, 0x01, 0x0E},
- {0xE0, 0xE1, 0x93, 0x80, 0x51, 0xE1, 0xA6, 0x97, 0x02, 0x01, 0x0E},
- {0xE0, 0xF2, 0x4B, 0x01, 0xD8, 0xB3, 0x0B, 0x0B, 0x02, 0x01, 0x08},
- {0xE0, 0xF1, 0x49, 0x01, 0xB8, 0xB3, 0x0B, 0x0B, 0x02, 0x01, 0x08},
- {0xE0, 0xF0, 0x4E, 0x01, 0x98, 0xC3, 0x0B, 0x0B, 0x01, 0x02, 0x08},
- {0xE0, 0xF1, 0x4C, 0x01, 0x88, 0xD3, 0x0B, 0x0B, 0x01, 0x01, 0x08},
- {0xF1, 0xE4, 0xC5, 0x00, 0x7E, 0x8C, 0x17, 0x0E, 0x00, 0x00, 0x08},
- {0x60, 0x72, 0x4F, 0x00, 0xD8, 0xB3, 0x0B, 0x0B, 0x00, 0x01, 0x0A},
- {0x31, 0x72, 0xD1, 0x80, 0xD5, 0x91, 0x19, 0x1B, 0x00, 0x00, 0x0C},
- {0x32, 0x71, 0xC8, 0x80, 0xD5, 0x73, 0x19, 0x1B, 0x00, 0x00, 0x0C},
- {0xE2, 0x62, 0x6A, 0x00, 0x9E, 0x55, 0x8F, 0x2A, 0x00, 0x00, 0x0E},
- {0xE0, 0x61, 0xEC, 0x00, 0x7E, 0x65, 0x8F, 0x2A, 0x00, 0x00, 0x0E},
- {0x62, 0xA2, 0x88, 0x83, 0x84, 0x75, 0x27, 0x17, 0x00, 0x00, 0x09},
- {0x62, 0xA2, 0x84, 0x83, 0x84, 0x75, 0x27, 0x17, 0x00, 0x00, 0x09},
- {0xE3, 0x62, 0x6D, 0x00, 0x57, 0x57, 0x04, 0x77, 0x00, 0x00, 0x0E},
- {0xF1, 0xE1, 0x28, 0x00, 0x57, 0x67, 0x34, 0x5D, 0x03, 0x00, 0x0E},
- {0xD1, 0x72, 0xC7, 0x00, 0x31, 0x42, 0x0F, 0x09, 0x00, 0x00, 0x0B},
- {0xF2, 0x72, 0xC7, 0x00, 0x51, 0x42, 0x05, 0x69, 0x00, 0x00, 0x0B},
- {0x23, 0x31, 0x4F, 0x00, 0x51, 0x60, 0x5B, 0x25, 0x01, 0x01, 0x00},
- {0x22, 0x31, 0x48, 0x00, 0x31, 0xC0, 0x9B, 0x65, 0x02, 0x01, 0x00},
- {0xF1, 0xE1, 0x28, 0x00, 0x57, 0x67, 0x34, 0x0D, 0x03, 0x00, 0x0E},
- {0xE1, 0xE1, 0x23, 0x00, 0x57, 0x67, 0x04, 0x4D, 0x03, 0x00, 0x0E},
- {0xE2, 0x31, 0x42, 0x08, 0x78, 0xF3, 0x0B, 0x0B, 0x01, 0x01, 0x08},
- {0xE2, 0xE2, 0x21, 0x00, 0x11, 0x40, 0x52, 0x73, 0x01, 0x01, 0x08},
- {0x23, 0xA4, 0xC0, 0x00, 0x51, 0x35, 0x07, 0x79, 0x01, 0x02, 0x0D},
- {0x24, 0xA0, 0xC0, 0x00, 0x51, 0x75, 0x07, 0x09, 0x01, 0x02, 0x09},
- {0xE0, 0xF0, 0x16, 0x00, 0xB1, 0xE0, 0x51, 0x75, 0x02, 0x02, 0x00},
- {0x03, 0xA4, 0xC0, 0x00, 0x52, 0xF4, 0x03, 0x55, 0x00, 0x00, 0x09},
- {0xE1, 0xE1, 0x93, 0x80, 0x31, 0xA1, 0xA6, 0x97, 0x01, 0x01, 0x0A},
- {0xF0, 0x71, 0xC4, 0x80, 0x10, 0x11, 0x01, 0xC1, 0x02, 0x02, 0x01},
- {0xC1, 0xE0, 0x4F, 0x00, 0xB1, 0x12, 0x53, 0x74, 0x02, 0x02, 0x06},
- {0xC0, 0x41, 0x6D, 0x00, 0xF9, 0xF2, 0x21, 0xB3, 0x01, 0x00, 0x0E},
- {0xE3, 0xE2, 0x4C, 0x00, 0x21, 0xA1, 0x43, 0x45, 0x01, 0x01, 0x00},
- {0xE3, 0xE2, 0x0C, 0x00, 0x11, 0x80, 0x52, 0x73, 0x01, 0x01, 0x08},
- {0x26, 0x88, 0xC0, 0x00, 0x55, 0xF8, 0x47, 0x19, 0x00, 0x00, 0x0B},
- {0x23, 0xE4, 0xD4, 0x00, 0xE5, 0x35, 0x03, 0x65, 0x00, 0x00, 0x07},
- {0x27, 0x32, 0xC0, 0x00, 0x32, 0xA4, 0x62, 0x33, 0x00, 0x00, 0x00},
- {0xD0, 0x31, 0x4E, 0x00, 0x98, 0xA2, 0x32, 0x47, 0x01, 0x02, 0x00},
- {0xF0, 0x71, 0xC0, 0x00, 0x93, 0x43, 0x03, 0x02, 0x01, 0x00, 0x0F},
- {0xE0, 0xF1, 0x1A, 0x80, 0x13, 0x33, 0x52, 0x13, 0x01, 0x02, 0x00},
- {0xE0, 0xF1, 0x1A, 0x00, 0x45, 0x32, 0xBA, 0x91, 0x00, 0x02, 0x00},
- {0x11, 0x15, 0x18, 0x03, 0x58, 0xA2, 0x02, 0x72, 0x01, 0x00, 0x0A},
- {0x10, 0x18, 0x80, 0x40, 0xF1, 0xF1, 0x53, 0x53, 0x00, 0x00, 0x00},
- {0x31, 0x17, 0x86, 0x80, 0xA1, 0x7D, 0x11, 0x23, 0x00, 0x00, 0x08},
- {0x10, 0x18, 0x80, 0x40, 0xF1, 0xF6, 0x53, 0x54, 0x00, 0x00, 0x00},
- {0x31, 0x34, 0x21, 0x00, 0xF5, 0x93, 0x56, 0xE8, 0x01, 0x00, 0x08},
- {0x03, 0x15, 0x4F, 0x00, 0xF1, 0xD6, 0x39, 0x74, 0x03, 0x00, 0x06},
- {0x31, 0x22, 0x43, 0x00, 0x6E, 0x8B, 0x17, 0x0C, 0x01, 0x02, 0x02},
- {0x31, 0x22, 0x1C, 0x80, 0x61, 0x52, 0x03, 0x67, 0x00, 0x00, 0x0E},
- {0x60, 0xF0, 0x0C, 0x80, 0x81, 0x61, 0x03, 0x0C, 0x00, 0x01, 0x08},
- {0x27, 0x05, 0x55, 0x00, 0x31, 0xA7, 0x62, 0x75, 0x00, 0x00, 0x00},
- {0x95, 0x16, 0x81, 0x00, 0xE7, 0x96, 0x01, 0x67, 0x00, 0x00, 0x04},
- {0x0C, 0x01, 0x87, 0x80, 0xF0, 0xF2, 0x05, 0x05, 0x01, 0x01, 0x04},
- {0x35, 0x11, 0x44, 0x00, 0xF8, 0xF5, 0xFF, 0x75, 0x00, 0x00, 0x0E},
- {0x10, 0x10, 0x0B, 0x00, 0xA7, 0xD5, 0xEC, 0xF5, 0x00, 0x00, 0x00},
- {0x20, 0x01, 0x0B, 0x00, 0xA8, 0xD6, 0xC8, 0xB7, 0x00, 0x00, 0x00},
- {0x00, 0x01, 0x0B, 0x00, 0x88, 0xD5, 0xC4, 0xB7, 0x00, 0x00, 0x00},
- {0x0C, 0x10, 0x8F, 0x80, 0x41, 0x33, 0x31, 0x2B, 0x00, 0x03, 0x08},
- {0x17, 0xF7, 0x00, 0x00, 0x3B, 0xEA, 0xDF, 0x97, 0x03, 0x00, 0x0B},
- {0x12, 0x18, 0x06, 0x00, 0x73, 0x3C, 0x02, 0x74, 0x00, 0x00, 0x0E},
- {0x02, 0x08, 0x00, 0x00, 0x3E, 0x14, 0x01, 0xF3, 0x02, 0x02, 0x0E},
- {0xF5, 0xF6, 0xD4, 0x00, 0xEB, 0x45, 0x03, 0x68, 0x00, 0x00, 0x07},
- {0xF0, 0xCA, 0x00, 0xC0, 0xDA, 0xB0, 0x71, 0x17, 0x01, 0x01, 0x08},
- {0xF0, 0xE2, 0x00, 0xC0, 0x1E, 0x11, 0x11, 0x11, 0x01, 0x01, 0x08},
- {0xE7, 0xE8, 0x00, 0x04, 0x34, 0x10, 0x00, 0xB2, 0x02, 0x02, 0x0E},
- {0x0C, 0x04, 0x00, 0x00, 0xF0, 0xF6, 0xF0, 0xE6, 0x02, 0x00, 0x0E}};
-
-uint8_t instData[128][11] = {
- {0x01, 0x11, 0x4F, 0x00, 0xF1, 0xD2, 0x51, 0x43, 0x00, 0x00, 0x06},
- {0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x12, 0x4F, 0x06, 0xF1, 0xD2},
- {0x51, 0x43, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
- {0x11, 0x4A, 0x04, 0xF1, 0xD2, 0x53, 0x74, 0x00, 0x00, 0x06, 0x00},
- {0x00, 0x00, 0x00, 0x00, 0x03, 0x11, 0x4F, 0x04, 0xF1, 0xD2, 0x53},
- {0x74, 0x01, 0x01, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x11},
- {0x66, 0x00, 0xF1, 0xD2, 0x51, 0xC3, 0x00, 0x00, 0x06, 0x00, 0x00},
- {0x00, 0x00, 0x00, 0xC0, 0xD2, 0x52, 0x05, 0xF1, 0xD2, 0x53, 0x94},
- {0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x18, 0x86},
- {0x00, 0xF3, 0xFC, 0x00, 0x33, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00},
- {0x00, 0x00, 0xD0, 0x12, 0x4E, 0x03, 0xA8, 0x92, 0x32, 0xA7, 0x03},
- {0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC8, 0xD1, 0x4F, 0x08},
- {0xF2, 0xF3, 0x64, 0x77, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00},
- {0x00, 0x33, 0x34, 0x0E, 0x00, 0x01, 0x7D, 0x11, 0x34, 0x00, 0x00},
- {0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x16, 0x50, 0x00, 0xD1},
- {0xD3, 0x52, 0x92, 0x00, 0x01, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00},
- {0xE7, 0xE1, 0x21, 0x06, 0xF5, 0xF6, 0x77, 0x14, 0x00, 0x00, 0x08},
- {0x00, 0x00, 0x00, 0x00, 0x00, 0x95, 0x81, 0x4E, 0x00, 0xDA, 0xF9},
- {0x25, 0x15, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x27},
- {0x21, 0x1F, 0x03, 0xF5, 0xF5, 0x96, 0x57, 0x00, 0x00, 0x08, 0x00},
- {0x00, 0x00, 0x00, 0x00, 0x87, 0xF1, 0x4E, 0x80, 0xB1, 0xE6, 0x33},
- {0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0x11},
- {0x87, 0x80, 0xA1, 0x7D, 0x11, 0x43, 0x00, 0x00, 0x08, 0x00, 0x00},
- {0x00, 0x00, 0x00, 0x32, 0xB1, 0x8C, 0x03, 0x91, 0xA1, 0x07, 0x19},
- {0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0xB4, 0x54},
- {0x83, 0xF1, 0xF5, 0x07, 0x19, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00},
- {0x00, 0x00, 0x24, 0x21, 0x40, 0x53, 0xFF, 0xFF, 0x0F, 0x0F, 0x00},
- {0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD2, 0xF1, 0x44, 0x80},
- {0x91, 0xA1, 0x57, 0x09, 0x01, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00},
- {0x00, 0x01, 0x02, 0x52, 0x88, 0xF0, 0xF0, 0x1F, 0x1F, 0x01, 0x00},
- {0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x32, 0x4F, 0x0B, 0xF2},
- {0x52, 0x0B, 0x0B, 0x00, 0x01, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00},
- {0xF0, 0xF2, 0x93, 0x07, 0xD8, 0xB3, 0x0B, 0x0B, 0x02, 0x01, 0x0A},
- {0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x31, 0x5D, 0x07, 0xF2, 0x52},
- {0x0B, 0x0B, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01},
- {0x01, 0x1B, 0x04, 0xF4, 0xF3, 0x25, 0x46, 0x02, 0x00, 0x00, 0x00},
- {0x00, 0x00, 0x00, 0x00, 0x11, 0x01, 0x0F, 0x07, 0xF4, 0xF3, 0x25},
- {0x46, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01},
- {0x27, 0x00, 0xF1, 0xF4, 0x1F, 0x88, 0x02, 0x00, 0x0A, 0x00, 0x00},
- {0x00, 0x00, 0x00, 0x12, 0x13, 0x44, 0x03, 0xEA, 0xD2, 0x32, 0xE7},
- {0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x31, 0x45},
- {0x00, 0xA4, 0xF5, 0x32, 0xE7, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00},
- {0x00, 0x00, 0x21, 0x21, 0x0F, 0x03, 0xF5, 0xF1, 0x17, 0x78, 0x02},
- {0x01, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x20, 0x41, 0x07},
- {0xD1, 0xC1, 0x34, 0xA5, 0x03, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00},
- {0x00, 0x10, 0x12, 0x43, 0x02, 0xA7, 0xE3, 0x97, 0xE7, 0x03, 0x02},
- {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x21, 0x28, 0x01, 0xC5},
- {0xD2, 0x15, 0xA4, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00},
- {0x30, 0x21, 0x16, 0x05, 0xF2, 0xF3, 0x9F, 0x78, 0x00, 0x00, 0x0C},
- {0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x21, 0x11, 0x05, 0x82, 0xF3},
- {0x9F, 0x78, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21},
- {0x21, 0x23, 0x00, 0x73, 0x93, 0x1A, 0x87, 0x00, 0x00, 0x0C, 0x00},
- {0x00, 0x00, 0x00, 0x00, 0x30, 0x21, 0x0E, 0x09, 0x62, 0xF3, 0x55},
- {0x68, 0x02, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x22},
- {0x0C, 0x00, 0x62, 0xD5, 0xB5, 0x98, 0x01, 0x00, 0x08, 0x00, 0x00},
- {0x00, 0x00, 0x00, 0x70, 0x72, 0x93, 0x43, 0x64, 0xA1, 0x43, 0x43},
- {0x00, 0x00, 0x0A, 0x06, 0x00, 0x00, 0x00, 0x00, 0x30, 0x32, 0x8D},
- {0x85, 0x44, 0x92, 0x43, 0x43, 0x02, 0x00, 0x0A, 0x06, 0x00, 0x00},
- {0x00, 0x00, 0xE1, 0xE2, 0x4E, 0x00, 0x65, 0x61, 0x43, 0x44, 0x02},
- {0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA1, 0xA2, 0x8E, 0x05},
- {0x65, 0x63, 0x43, 0x45, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00},
- {0x00, 0xB0, 0x61, 0x87, 0x40, 0xD1, 0x62, 0x11, 0x15, 0x02, 0x01},
- {0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x20, 0x8A, 0x80, 0xB1},
- {0xA0, 0x11, 0x15, 0x02, 0x01, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00},
- {0xF1, 0xE2, 0x89, 0x43, 0x73, 0x43, 0x01, 0x05, 0x02, 0x00, 0x06},
- {0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0x21, 0x57, 0x80, 0xF8, 0xF7},
- {0xF9, 0xE6, 0x03, 0x02, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32},
- {0x01, 0x24, 0x82, 0xF1, 0xF5, 0x35, 0x35, 0x00, 0x00, 0x00, 0x00},
- {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0xAA, 0xD2, 0xC8},
- {0xB3, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xF1},
- {0x4F, 0x03, 0xD4, 0x55, 0x0B, 0x0B, 0x02, 0x02, 0x0A, 0x00, 0x00},
- {0x00, 0x00, 0x00, 0xE0, 0xF0, 0x52, 0x00, 0x96, 0x35, 0x05, 0x01},
- {0x02, 0x02, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE1, 0xF1, 0x4F},
- {0x00, 0x36, 0x45, 0x05, 0x02, 0x02, 0x02, 0x0A, 0x00, 0x00, 0x00},
- {0x00, 0x00, 0xE2, 0xE1, 0x48, 0x81, 0x21, 0x41, 0x43, 0x45, 0x02},
- {0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xF1, 0x16, 0x00},
- {0x41, 0x20, 0x52, 0x72, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00},
- {0x00, 0xE0, 0xF1, 0x11, 0x00, 0x01, 0xD0, 0x52, 0x72, 0x02, 0x02},
- {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xF1, 0x1A, 0x00, 0x61},
- {0x30, 0x52, 0x73, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
- {0x50, 0x50, 0x0B, 0x07, 0x84, 0xA4, 0x4B, 0x99, 0x00, 0x00, 0x0A},
- {0x06, 0x00, 0x00, 0x00, 0x00, 0x31, 0x61, 0x1C, 0x84, 0x41, 0x92},
- {0x0B, 0x3B, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB1},
- {0x61, 0x1C, 0x05, 0x41, 0x92, 0x1F, 0x3B, 0x00, 0x00, 0x0E, 0x00},
- {0x00, 0x00, 0x00, 0x00, 0x20, 0x21, 0x18, 0x00, 0x52, 0xA2, 0x15},
- {0x24, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC1, 0xC1},
- {0x94, 0x84, 0x74, 0xA3, 0xEA, 0xF5, 0x02, 0x01, 0x0E, 0x00, 0x00},
- {0x00, 0x00, 0x00, 0x21, 0x21, 0x28, 0x00, 0x41, 0x81, 0xB4, 0x98},
- {0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x21, 0x1D},
- {0x01, 0x51, 0xE1, 0xAE, 0x3E, 0x02, 0x01, 0x0E, 0x00, 0x00, 0x00},
- {0x00, 0x00, 0xE0, 0xE0, 0x93, 0x82, 0x51, 0x81, 0xA6, 0x97, 0x02},
- {0x01, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xE1, 0x93, 0x83},
- {0x51, 0xE1, 0xA6, 0x97, 0x02, 0x01, 0x0E, 0x00, 0x00, 0x00, 0x00},
- {0x00, 0xE0, 0xF2, 0x4B, 0x0B, 0xD8, 0xB3, 0x0B, 0x0B, 0x02, 0x01},
- {0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xF1, 0x49, 0x0B, 0xB8},
- {0xB3, 0x0B, 0x0B, 0x02, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00},
- {0xE0, 0xF0, 0x4E, 0x0B, 0x98, 0xC3, 0x0B, 0x0B, 0x01, 0x02, 0x08},
- {0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xF1, 0x4C, 0x0B, 0x88, 0xD3},
- {0x0B, 0x0B, 0x01, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF1},
- {0xE4, 0xC5, 0x08, 0x7E, 0x8C, 0x17, 0x0E, 0x00, 0x00, 0x08, 0x00},
- {0x00, 0x00, 0x00, 0x00, 0x60, 0x72, 0x4F, 0x0A, 0xD8, 0xB3, 0x0B},
- {0x0B, 0x00, 0x01, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0x72},
- {0xD1, 0x80, 0xD5, 0x91, 0x19, 0x1B, 0x00, 0x00, 0x0C, 0x00, 0x00},
- {0x00, 0x00, 0x00, 0x32, 0x71, 0xC8, 0x80, 0xD5, 0x73, 0x19, 0x1B},
- {0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE2, 0x62, 0x6A},
- {0x00, 0x9E, 0x55, 0x8F, 0x2A, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00},
- {0x00, 0x00, 0xE0, 0x61, 0xEC, 0x00, 0x7E, 0x65, 0x8F, 0x2A, 0x00},
- {0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0xA2, 0x88, 0x8D},
- {0x84, 0x75, 0x27, 0x17, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00},
- {0x00, 0x62, 0xA2, 0x84, 0x8D, 0x84, 0x75, 0x27, 0x17, 0x00, 0x00},
- {0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE3, 0x62, 0x6D, 0x00, 0x57},
- {0x57, 0x04, 0x77, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00},
- {0xF1, 0xE1, 0x28, 0x00, 0x57, 0x67, 0x34, 0x5D, 0x03, 0x00, 0x0E},
- {0x00, 0x00, 0x00, 0x00, 0x00, 0xD1, 0x72, 0xC7, 0x03, 0x31, 0x42},
- {0x0F, 0x09, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF2},
- {0x72, 0xC7, 0x05, 0x51, 0x42, 0x05, 0x69, 0x00, 0x00, 0x0B, 0x00},
- {0x00, 0x00, 0x00, 0x00, 0x23, 0x31, 0x4F, 0x06, 0x51, 0x60, 0x5B},
- {0x25, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x31},
- {0x48, 0x06, 0x31, 0xC0, 0x9B, 0x65, 0x02, 0x01, 0x00, 0x00, 0x00},
- {0x00, 0x00, 0x00, 0xF1, 0xE1, 0x28, 0x04, 0x57, 0x67, 0x34, 0x0D},
- {0x03, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE1, 0xE1, 0x23},
- {0x00, 0x57, 0x67, 0x04, 0x4D, 0x03, 0x00, 0x0E, 0x00, 0x00, 0x00},
- {0x00, 0x00, 0xE2, 0x31, 0x42, 0x12, 0x78, 0xF3, 0x0B, 0x0B, 0x01},
- {0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE2, 0xE2, 0x21, 0x07},
- {0x11, 0x40, 0x52, 0x73, 0x01, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00},
- {0x00, 0x23, 0xA4, 0xC0, 0x00, 0x51, 0x35, 0x07, 0x79, 0x01, 0x02},
- {0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0xA0, 0xC0, 0x01, 0x51},
- {0x75, 0x07, 0x09, 0x01, 0x02, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00}};
-
-const uint8_t data[1408] = {
- 0xF1,
- 0xD2,
- 0x53,
- 0x74,
- 0x00,
- 0x00,
- 0x06,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x03,
- 0x11,
- 0x4F,
- 0x04,
- 0xF1,
- 0xD2,
- 0x53,
- 0x74,
- 0x01,
- 0x01,
- 0x06,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x01,
- 0x11,
- 0x66,
- 0x00,
- 0xF1,
- 0xD2,
- 0x51,
- 0xC3,
- 0x00,
- 0x00,
- 0x06,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0xC0,
- 0xD2,
- 0x52,
- 0x05,
- 0xF1,
- 0xD2,
- 0x53,
- 0x94,
- 0x00,
- 0x00,
- 0x06,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x12,
- 0x18,
- 0x86,
- 0x00,
- 0xF3,
- 0xFC,
- 0x00,
- 0x33,
- 0x00,
- 0x00,
- 0x08,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0xD0,
- 0x12,
- 0x4E,
- 0x03,
- 0xA8,
- 0x92,
- 0x32,
- 0xA7,
- 0x03,
- 0x02,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0xC8,
- 0xD1,
- 0x4F,
- 0x08,
- 0xF2,
- 0xF3,
- 0x64,
- 0x77,
- 0x00,
- 0x00,
- 0x08,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x33,
- 0x34,
- 0x0E,
- 0x00,
- 0x01,
- 0x7D,
- 0x11,
- 0x34,
- 0x00,
- 0x00,
- 0x08,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x17,
- 0x16,
- 0x50,
- 0x00,
- 0xD1,
- 0xD3,
- 0x52,
- 0x92,
- 0x00,
- 0x01,
- 0x04,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0xE7,
- 0xE1,
- 0x21,
- 0x06,
- 0xF5,
- 0xF6,
- 0x77,
- 0x14,
- 0x00,
- 0x00,
- 0x08,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x95,
- 0x81,
- 0x4E,
- 0x00,
- 0xDA,
- 0xF9,
- 0x25,
- 0x15,
- 0x00,
- 0x00,
- 0x0A,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x27,
- 0x21,
- 0x1F,
- 0x03,
- 0xF5,
- 0xF5,
- 0x96,
- 0x57,
- 0x00,
- 0x00,
- 0x08,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x87,
- 0xF1,
- 0x4E,
- 0x80,
- 0xB1,
- 0xE6,
- 0x33,
- 0x42,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x31,
- 0x11,
- 0x87,
- 0x80,
- 0xA1,
- 0x7D,
- 0x11,
- 0x43,
- 0x00,
- 0x00,
- 0x08,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x32,
- 0xB1,
- 0x8C,
- 0x03,
- 0x91,
- 0xA1,
- 0x07,
- 0x19,
- 0x02,
- 0x00,
- 0x05,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x31,
- 0xB4,
- 0x54,
- 0x83,
- 0xF1,
- 0xF5,
- 0x07,
- 0x19,
- 0x00,
- 0x00,
- 0x07,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x24,
- 0x21,
- 0x40,
- 0x53,
- 0xFF,
- 0xFF,
- 0x0F,
- 0x0F,
- 0x00,
- 0x00,
- 0x01,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0xD2,
- 0xF1,
- 0x44,
- 0x80,
- 0x91,
- 0xA1,
- 0x57,
- 0x09,
- 0x01,
- 0x01,
- 0x03,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x01,
- 0x02,
- 0x52,
- 0x88,
- 0xF0,
- 0xF0,
- 0x1F,
- 0x1F,
- 0x01,
- 0x00,
- 0x0A,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x21,
- 0x32,
- 0x4F,
- 0x0B,
- 0xF2,
- 0x52,
- 0x0B,
- 0x0B,
- 0x00,
- 0x01,
- 0x0A,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0xF0,
- 0xF2,
- 0x93,
- 0x07,
- 0xD8,
- 0xB3,
- 0x0B,
- 0x0B,
- 0x02,
- 0x01,
- 0x0A,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x20,
- 0x31,
- 0x5D,
- 0x07,
- 0xF2,
- 0x52,
- 0x0B,
- 0x0B,
- 0x03,
- 0x02,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x01,
- 0x01,
- 0x1B,
- 0x04,
- 0xF4,
- 0xF3,
- 0x25,
- 0x46,
- 0x02,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x11,
- 0x01,
- 0x0F,
- 0x07,
- 0xF4,
- 0xF3,
- 0x25,
- 0x46,
- 0x01,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x01,
- 0x01,
- 0x27,
- 0x00,
- 0xF1,
- 0xF4,
- 0x1F,
- 0x88,
- 0x02,
- 0x00,
- 0x0A,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x12,
- 0x13,
- 0x44,
- 0x03,
- 0xEA,
- 0xD2,
- 0x32,
- 0xE7,
- 0x01,
- 0x01,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x30,
- 0x31,
- 0x45,
- 0x00,
- 0xA4,
- 0xF5,
- 0x32,
- 0xE7,
- 0x03,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x21,
- 0x21,
- 0x0F,
- 0x03,
- 0xF5,
- 0xF1,
- 0x17,
- 0x78,
- 0x02,
- 0x01,
- 0x04,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x01,
- 0x20,
- 0x41,
- 0x07,
- 0xD1,
- 0xC1,
- 0x34,
- 0xA5,
- 0x03,
- 0x03,
- 0x04,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x10,
- 0x12,
- 0x43,
- 0x02,
- 0xA7,
- 0xE3,
- 0x97,
- 0xE7,
- 0x03,
- 0x02,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x20,
- 0x21,
- 0x28,
- 0x01,
- 0xC5,
- 0xD2,
- 0x15,
- 0xA4,
- 0x00,
- 0x00,
- 0x0C,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x30,
- 0x21,
- 0x16,
- 0x05,
- 0xF2,
- 0xF3,
- 0x9F,
- 0x78,
- 0x00,
- 0x00,
- 0x0C,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x30,
- 0x21,
- 0x11,
- 0x05,
- 0x82,
- 0xF3,
- 0x9F,
- 0x78,
- 0x00,
- 0x00,
- 0x0A,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x21,
- 0x21,
- 0x23,
- 0x00,
- 0x73,
- 0x93,
- 0x1A,
- 0x87,
- 0x00,
- 0x00,
- 0x0C,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x30,
- 0x21,
- 0x0E,
- 0x09,
- 0x62,
- 0xF3,
- 0x55,
- 0x68,
- 0x02,
- 0x00,
- 0x0A,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x30,
- 0x22,
- 0x0C,
- 0x00,
- 0x62,
- 0xD5,
- 0xB5,
- 0x98,
- 0x01,
- 0x00,
- 0x08,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x70,
- 0x72,
- 0x93,
- 0x43,
- 0x64,
- 0xA1,
- 0x43,
- 0x43,
- 0x00,
- 0x00,
- 0x0A,
- 0x06,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x30,
- 0x32,
- 0x8D,
- 0x85,
- 0x44,
- 0x92,
- 0x43,
- 0x43,
- 0x02,
- 0x00,
- 0x0A,
- 0x06,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0xE1,
- 0xE2,
- 0x4E,
- 0x00,
- 0x65,
- 0x61,
- 0x43,
- 0x44,
- 0x02,
- 0x02,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0xA1,
- 0xA2,
- 0x8E,
- 0x05,
- 0x65,
- 0x63,
- 0x43,
- 0x45,
- 0x02,
- 0x02,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0xB0,
- 0x61,
- 0x87,
- 0x40,
- 0xD1,
- 0x62,
- 0x11,
- 0x15,
- 0x02,
- 0x01,
- 0x06,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0xF0,
- 0x20,
- 0x8A,
- 0x80,
- 0xB1,
- 0xA0,
- 0x11,
- 0x15,
- 0x02,
- 0x01,
- 0x06,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0xF1,
- 0xE2,
- 0x89,
- 0x43,
- 0x73,
- 0x43,
- 0x01,
- 0x05,
- 0x02,
- 0x00,
- 0x06,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x31,
- 0x21,
- 0x57,
- 0x80,
- 0xF8,
- 0xF7,
- 0xF9,
- 0xE6,
- 0x03,
- 0x02,
- 0x0E,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x32,
- 0x01,
- 0x24,
- 0x82,
- 0xF1,
- 0xF5,
- 0x35,
- 0x35,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x04,
- 0x00,
- 0xAA,
- 0xD2,
- 0xC8,
- 0xB3,
- 0x00,
- 0x00,
- 0x0A,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0xE0,
- 0xF1,
- 0x4F,
- 0x03,
- 0xD4,
- 0x55,
- 0x0B,
- 0x0B,
- 0x02,
- 0x02,
- 0x0A,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0xE0,
- 0xF0,
- 0x52,
- 0x00,
- 0x96,
- 0x35,
- 0x05,
- 0x01,
- 0x02,
- 0x02,
- 0x0A,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0xE1,
- 0xF1,
- 0x4F,
- 0x00,
- 0x36,
- 0x45,
- 0x05,
- 0x02,
- 0x02,
- 0x02,
- 0x0A,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0xE2,
- 0xE1,
- 0x48,
- 0x81,
- 0x21,
- 0x41,
- 0x43,
- 0x45,
- 0x02,
- 0x01,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0xE0,
- 0xF1,
- 0x16,
- 0x00,
- 0x41,
- 0x20,
- 0x52,
- 0x72,
- 0x02,
- 0x02,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0xE0,
- 0xF1,
- 0x11,
- 0x00,
- 0x01,
- 0xD0,
- 0x52,
- 0x72,
- 0x02,
- 0x02,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0xE0,
- 0xF1,
- 0x1A,
- 0x00,
- 0x61,
- 0x30,
- 0x52,
- 0x73,
- 0x00,
- 0x02,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x50,
- 0x50,
- 0x0B,
- 0x07,
- 0x84,
- 0xA4,
- 0x4B,
- 0x99,
- 0x00,
- 0x00,
- 0x0A,
- 0x06,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x31,
- 0x61,
- 0x1C,
- 0x84,
- 0x41,
- 0x92,
- 0x0B,
- 0x3B,
- 0x00,
- 0x00,
- 0x0E,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0xB1,
- 0x61,
- 0x1C,
- 0x05,
- 0x41,
- 0x92,
- 0x1F,
- 0x3B,
- 0x00,
- 0x00,
- 0x0E,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x20,
- 0x21,
- 0x18,
- 0x00,
- 0x52,
- 0xA2,
- 0x15,
- 0x24,
- 0x00,
- 0x00,
- 0x0C,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0xC1,
- 0xC1,
- 0x94,
- 0x84,
- 0x74,
- 0xA3,
- 0xEA,
- 0xF5,
- 0x02,
- 0x01,
- 0x0E,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x21,
- 0x21,
- 0x28,
- 0x00,
- 0x41,
- 0x81,
- 0xB4,
- 0x98,
- 0x00,
- 0x00,
- 0x0E,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x21,
- 0x21,
- 0x1D,
- 0x01,
- 0x51,
- 0xE1,
- 0xAE,
- 0x3E,
- 0x02,
- 0x01,
- 0x0E,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0xE0,
- 0xE0,
- 0x93,
- 0x82,
- 0x51,
- 0x81,
- 0xA6,
- 0x97,
- 0x02,
- 0x01,
- 0x0E,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0xE0,
- 0xE1,
- 0x93,
- 0x83,
- 0x51,
- 0xE1,
- 0xA6,
- 0x97,
- 0x02,
- 0x01,
- 0x0E,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0xE0,
- 0xF2,
- 0x4B,
- 0x0B,
- 0xD8,
- 0xB3,
- 0x0B,
- 0x0B,
- 0x02,
- 0x01,
- 0x08,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0xE0,
- 0xF1,
- 0x49,
- 0x0B,
- 0xB8,
- 0xB3,
- 0x0B,
- 0x0B,
- 0x02,
- 0x01,
- 0x08,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0xE0,
- 0xF0,
- 0x4E,
- 0x0B,
- 0x98,
- 0xC3,
- 0x0B,
- 0x0B,
- 0x01,
- 0x02,
- 0x08,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0xE0,
- 0xF1,
- 0x4C,
- 0x0B,
- 0x88,
- 0xD3,
- 0x0B,
- 0x0B,
- 0x01,
- 0x01,
- 0x08,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0xF1,
- 0xE4,
- 0xC5,
- 0x08,
- 0x7E,
- 0x8C,
- 0x17,
- 0x0E,
- 0x00,
- 0x00,
- 0x08,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x60,
- 0x72,
- 0x4F,
- 0x0A,
- 0xD8,
- 0xB3,
- 0x0B,
- 0x0B,
- 0x00,
- 0x01,
- 0x0A,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x31,
- 0x72,
- 0xD1,
- 0x80,
- 0xD5,
- 0x91,
- 0x19,
- 0x1B,
- 0x00,
- 0x00,
- 0x0C,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x32,
- 0x71,
- 0xC8,
- 0x80,
- 0xD5,
- 0x73,
- 0x19,
- 0x1B,
- 0x00,
- 0x00,
- 0x0C,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0xE2,
- 0x62,
- 0x6A,
- 0x00,
- 0x9E,
- 0x55,
- 0x8F,
- 0x2A,
- 0x00,
- 0x00,
- 0x0E,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0xE0,
- 0x61,
- 0xEC,
- 0x00,
- 0x7E,
- 0x65,
- 0x8F,
- 0x2A,
- 0x00,
- 0x00,
- 0x0E,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x62,
- 0xA2,
- 0x88,
- 0x8D,
- 0x84,
- 0x75,
- 0x27,
- 0x17,
- 0x00,
- 0x00,
- 0x09,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x62,
- 0xA2,
- 0x84,
- 0x8D,
- 0x84,
- 0x75,
- 0x27,
- 0x17,
- 0x00,
- 0x00,
- 0x09,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0xE3,
- 0x62,
- 0x6D,
- 0x00,
- 0x57,
- 0x57,
- 0x04,
- 0x77,
- 0x00,
- 0x00,
- 0x0E,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0xF1,
- 0xE1,
- 0x28,
- 0x00,
- 0x57,
- 0x67,
- 0x34,
- 0x5D,
- 0x03,
- 0x00,
- 0x0E,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0xD1,
- 0x72,
- 0xC7,
- 0x03,
- 0x31,
- 0x42,
- 0x0F,
- 0x09,
- 0x00,
- 0x00,
- 0x0B,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0xF2,
- 0x72,
- 0xC7,
- 0x05,
- 0x51,
- 0x42,
- 0x05,
- 0x69,
- 0x00,
- 0x00,
- 0x0B,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x23,
- 0x31,
- 0x4F,
- 0x06,
- 0x51,
- 0x60,
- 0x5B,
- 0x25,
- 0x01,
- 0x01,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x22,
- 0x31,
- 0x48,
- 0x06,
- 0x31,
- 0xC0,
- 0x9B,
- 0x65,
- 0x02,
- 0x01,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0xF1,
- 0xE1,
- 0x28,
- 0x04,
- 0x57,
- 0x67,
- 0x34,
- 0x0D,
- 0x03,
- 0x00,
- 0x0E,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0xE1,
- 0xE1,
- 0x23,
- 0x00,
- 0x57,
- 0x67,
- 0x04,
- 0x4D,
- 0x03,
- 0x00,
- 0x0E,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0xE2,
- 0x31,
- 0x42,
- 0x12,
- 0x78,
- 0xF3,
- 0x0B,
- 0x0B,
- 0x01,
- 0x01,
- 0x08,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0xE2,
- 0xE2,
- 0x21,
- 0x07,
- 0x11,
- 0x40,
- 0x52,
- 0x73,
- 0x01,
- 0x01,
- 0x08,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x23,
- 0xA4,
- 0xC0,
- 0x00,
- 0x51,
- 0x35,
- 0x07,
- 0x79,
- 0x01,
- 0x02,
- 0x0D,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x24,
- 0xA0,
- 0xC0,
- 0x01,
- 0x51,
- 0x75,
- 0x07,
- 0x09,
- 0x01,
- 0x02,
- 0x09,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0xE0,
- 0xF0,
- 0x16,
- 0x03,
- 0xB1,
- 0xE0,
- 0x51,
- 0x75,
- 0x02,
- 0x02,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x03,
- 0xA4,
- 0xC0,
- 0x04,
- 0x52,
- 0xF4,
- 0x03,
- 0x55,
- 0x00,
- 0x00,
- 0x09,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0xE1,
- 0xE1,
- 0x93,
- 0x81,
-};
-
MidiPlayer::MidiPlayer() {
_driver = nullptr;
_driverMsMusic = nullptr;
diff --git a/engines/tot/playanim.cpp b/engines/tot/playanim.cpp
index 5828c9ad42b..dc24a746cbc 100644
--- a/engines/tot/playanim.cpp
+++ b/engines/tot/playanim.cpp
@@ -209,7 +209,7 @@ byte tipoefectofundido;
byte iframe, iframe2;
-long sizepantalla;
+long screenSize;
datosobj depthMap[numobjetosconv];
@@ -223,7 +223,7 @@ byte *background;
byte *characterDirtyRect;
-byte *handpantalla;
+byte *screenHandle;
uint currentRoomNumber;
@@ -731,8 +731,8 @@ void clearVars() {
if(background != NULL) {
free(background);
}
- if(handpantalla != NULL) {
- free(handpantalla);
+ if(screenHandle != NULL) {
+ free(screenHandle);
}
if(conversationData != NULL) {
free(conversationData);
diff --git a/engines/tot/playanim.h b/engines/tot/playanim.h
index 38d9fcf1ff7..96830faa96c 100644
--- a/engines/tot/playanim.h
+++ b/engines/tot/playanim.h
@@ -606,7 +606,7 @@ extern byte tipoefectofundido;
*/
extern byte iframe, iframe2;
-extern long sizepantalla;
+extern long screenSize;
/**
* Depth of screenobjects
@@ -637,7 +637,7 @@ extern byte *characterDirtyRect;
/**
* Stores a copy of the background bitmap
*/
-extern byte *handpantalla;
+extern byte *screenHandle;
extern uint currentRoomNumber;
diff --git a/engines/tot/routines.cpp b/engines/tot/routines.cpp
index 2e942aeb55d..48ab3fbb39e 100644
--- a/engines/tot/routines.cpp
+++ b/engines/tot/routines.cpp
@@ -101,7 +101,7 @@ void runaroundRed() {
}
} while (!exitLoop && !g_engine->shouldQuit());
freeAnimation();
- handPantallaToBackground();
+ screenHandleToBackground();
assembleScreen();
drawScreen(background);
}
@@ -157,7 +157,7 @@ static void assembleBackground() {
// XMStoPointer(ptr(segfondo, (offfondo + 4)), handpantalla, 4, (sizepantalla - longint(4)));
// copies the entire clean background in handpantalla back into fondo
- handPantallaToBackground();
+ screenHandleToBackground();
posabs = 4 + posfondoy * 320 + posfondox;
// debug("posabs = %d, posfondox = %d, posfondoy=%d", posabs, posfondox, posfondoy);
@@ -246,7 +246,7 @@ void drawMainCharacter() {
bool debug = false;
if (debug) {
- effect(13, false, background);
+ screenTransition(13, false, background);
}
uint16 tempW;
@@ -621,7 +621,7 @@ void animatedSequence(uint numSequence) {
putShape(animx, animy, animptr);
}
screenObjects[regobj.profundidad - 1] = NULL;
- handPantallaToBackground();
+ screenHandleToBackground();
indiceani = secuencia.profundidad;
secuencia.profundidad = 30;
screenObjects[13] = animptr;
@@ -730,7 +730,7 @@ void animatedSequence(uint numSequence) {
animationFile.read(screenObjects[6], tamsecani);
Common::copy(screenObjects[6], screenObjects[6] + tamsecani, background + 44900);
// blockread(ficherosecuenciaanimada, objetos[7], tamsecani);
- handPantallaToBackground();
+ screenHandleToBackground();
assembleScreen();
drawScreen(background);
indiceani += 1;
@@ -991,7 +991,7 @@ void lookInventoryObject(byte numeroobjeto) {
drawFlc(125, 70, regobj.punteroframesgiro, 60000, 9, 0, false, true, true, kkaux);
- effect(3, true, NULL);
+ screenTransition(3, true, NULL);
partialFadeOut(234);
assembleScreen();
drawScreen(background);
@@ -1522,14 +1522,14 @@ void animateBat() {
animado.profundidad = profseg;
animado.dir = dirseg;
}
- handPantallaToBackground();
+ screenHandleToBackground();
assembleScreen();
drawScreen(background);
}
void updateVideo() {
readBitmap(regobj.puntparche, screenObjects[regobj.profundidad - 1], regobj.tamparche, 319);
- handPantallaToBackground();
+ screenHandleToBackground();
assembleScreen();
drawScreen(background);
}
@@ -1575,7 +1575,7 @@ void nicheAnimation(byte direccionhn, int32 bitmap) {
// Set the height to double to animate 2 images of the same height moving up/down
*(background + 44900 + 2) = (alcoveHeight * 2) + 1;
- handPantallaToBackground();
+ screenHandleToBackground();
for (indicehn = 1; indicehn <= alcoveHeight; indicehn++) {
@@ -1587,7 +1587,7 @@ void nicheAnimation(byte direccionhn, int32 bitmap) {
}
readBitmap(bitmap, screenObjects[0], 892, 319);
- handPantallaToBackground();
+ screenHandleToBackground();
assembleScreen();
drawScreen(background);
@@ -1648,7 +1648,7 @@ void pickupScreenObject() {
default: {
animatePickup1(direccionmovimiento, 0);
screenObjects[regobj.profundidad - 1] = NULL;
- handPantallaToBackground();
+ screenHandleToBackground();
assembleScreen();
drawScreen(background);
animatePickup2(direccionmovimiento, 0);
@@ -1707,7 +1707,7 @@ void pickupScreenObject() {
loadItem(with.coordx, with.coordy, with.tambitmap, with.puntbitmap, with.profund);
}
screenObjects[regobj.profundidad - 1] = NULL;
- handPantallaToBackground();
+ screenHandleToBackground();
assembleScreen();
drawScreen(background);
@@ -1729,7 +1729,7 @@ void pickupScreenObject() {
currentRoomData->bitmapasociados[1].coordx = 66;
currentRoomData->bitmapasociados[1].coordy = 35;
currentRoomData->bitmapasociados[1].profund = 1;
- handPantallaToBackground();
+ screenHandleToBackground();
assembleScreen();
drawScreen(background);
animatePickup2(3, 1);
@@ -1742,7 +1742,7 @@ void pickupScreenObject() {
animatePickup1(3, 1);
readBitmap(1190768, screenObjects[regobj.profundidad - 1],
892, 319);
- handPantallaToBackground();
+ screenHandleToBackground();
assembleScreen();
drawScreen(background);
animatePickup2(3, 1);
@@ -1796,7 +1796,7 @@ void pickupScreenObject() {
currentRoomData->bitmapasociados[0].coordx = 217;
currentRoomData->bitmapasociados[0].coordy = 48;
currentRoomData->bitmapasociados[0].profund = 1;
- handPantallaToBackground();
+ screenHandleToBackground();
assembleScreen();
drawScreen(background);
animatePickup2(0, 1);
@@ -1808,7 +1808,7 @@ void pickupScreenObject() {
currentRoomData->indexadoobjetos[8]->objectName = " ";
animatePickup1(0, 1);
readBitmap(1399610, screenObjects[0], 892, 319);
- handPantallaToBackground();
+ screenHandleToBackground();
assembleScreen();
drawScreen(background);
animatePickup2(0, 1);
@@ -1876,7 +1876,7 @@ void pickupScreenObject() {
default: {
animatePickup1(direccionmovimiento, 1);
screenObjects[regobj.profundidad - 1] = NULL;
- handPantallaToBackground();
+ screenHandleToBackground();
assembleScreen();
drawScreen(background);
animatePickup2(direccionmovimiento, 1);
@@ -1932,7 +1932,7 @@ void pickupScreenObject() {
with.profund = 3;
loadItem(with.coordx, with.coordy, with.tambitmap, with.puntbitmap, with.profund);
}
- handPantallaToBackground();
+ screenHandleToBackground();
assembleScreen();
drawScreen(background);
animatePickup2(3, 2);
@@ -2761,7 +2761,7 @@ void useScreenObject() {
currentRoomData->bitmapasociados[1].coordx = 66;
currentRoomData->bitmapasociados[1].coordy = 35;
currentRoomData->bitmapasociados[1].profund = 1;
- handPantallaToBackground();
+ screenHandleToBackground();
// XMStoPointer(ptr(segfondo, (offfondo + 4)), _handpantalla, 4, (sizepantalla - int32(4)));
assembleScreen();
drawScreen(background);
@@ -2785,7 +2785,7 @@ void useScreenObject() {
readBitmap(1181760, screenObjects[0], 892, 319);
break;
}
- handPantallaToBackground();
+ screenHandleToBackground();
assembleScreen();
drawScreen(background);
animateOpen2(3, 1);
@@ -2852,7 +2852,7 @@ void useScreenObject() {
currentRoomData->bitmapasociados[0].coordx = 217;
currentRoomData->bitmapasociados[0].coordy = 48;
currentRoomData->bitmapasociados[0].profund = 1;
- handPantallaToBackground();
+ screenHandleToBackground();
// XMStoPointer(ptr(segfondo, (offfondo + 4)), _handpantalla, 4, (sizepantalla - int32(4)));
assembleScreen();
drawScreen(background);
@@ -2879,7 +2879,7 @@ void useScreenObject() {
892, 319);
break;
}
- handPantallaToBackground();
+ screenHandleToBackground();
// XMStoPointer(ptr(segfondo, (offfondo + 4)), _handpantalla, 4, (sizepantalla - int32(4)));
assembleScreen();
drawScreen(background);
@@ -2973,7 +2973,7 @@ void useScreenObject() {
loadItem(with.coordx, with.coordy, with.tambitmap, with.puntbitmap, with.profund);
}
readBitmap(1243652, screenObjects[5], 2718, 319);
- handPantallaToBackground();
+ screenHandleToBackground();
assembleScreen();
drawScreen(background);
} break;
@@ -3002,7 +3002,7 @@ void useScreenObject() {
with.profund = 4;
loadItem(with.coordx, with.coordy, with.tambitmap, with.puntbitmap, with.profund);
}
- handPantallaToBackground();
+ screenHandleToBackground();
// XMStoPointer(ptr(segfondo, (offfondo + 4)), _handpantalla, 4,(sizepantalla - int32(4)));
assembleScreen();
drawScreen(background);
@@ -3019,7 +3019,7 @@ void useScreenObject() {
// Show feather on pedestal
loadItem(187, 70, 104, 1545820, 8);
- handPantallaToBackground();
+ screenHandleToBackground();
assembleScreen();
drawScreen(background);
g_engine->_screen->update();
@@ -3049,7 +3049,7 @@ void useScreenObject() {
currentRoomData->bitmapasociados[4].profund = 8;
loadItem(186, 63, 464, 1447508, 8);
- handPantallaToBackground();
+ screenHandleToBackground();
assembleScreen();
drawScreen(background);
g_engine->_mouseManager->show();
@@ -3063,7 +3063,7 @@ void useScreenObject() {
currentRoomData->bitmapasociados[4].coordy = 0;
currentRoomData->bitmapasociados[4].profund = 0;
screenObjects[7] = NULL;
- handPantallaToBackground();
+ screenHandleToBackground();
assembleScreen();
drawScreen(background);
animatePickup2(1, 1);
@@ -3086,7 +3086,7 @@ void useScreenObject() {
debug("-------------------------------------");
animateGive(3, 1);
loadItem(86, 55, 92, 1591272, 8);
- handPantallaToBackground();
+ screenHandleToBackground();
assembleScreen();
drawScreen(background);
animateOpen2(3, 1);
@@ -3124,7 +3124,7 @@ void useScreenObject() {
currentRoomData->bitmapasociados[4].coordy = 0;
currentRoomData->bitmapasociados[4].profund = 0;
screenObjects[7] = NULL;
- handPantallaToBackground();
+ screenHandleToBackground();
assembleScreen();
drawScreen(background);
animatePickup2(3, 1);
@@ -3191,7 +3191,7 @@ void useScreenObject() {
animateGive(1, 1);
updateInventory(indicemochila);
dropObjectInScreen(regobj);
- handPantallaToBackground();
+ screenHandleToBackground();
assembleScreen();
drawScreen(background);
drawBackpack();
@@ -3212,7 +3212,7 @@ void useScreenObject() {
drawFlc(110, 79, offset, 0, 9, 0, false, false, true, basurillalog);
replaceBackpack(indicemochila, 701);
drawBackpack();
- handPantallaToBackground();
+ screenHandleToBackground();
assembleScreen();
drawScreen(background);
g_engine->_mouseManager->show();
@@ -3283,7 +3283,7 @@ void useScreenObject() {
with.profund = 1;
loadItem(with.coordx, with.coordy, with.tambitmap, with.puntbitmap, with.profund);
}
- handPantallaToBackground();
+ screenHandleToBackground();
assembleScreen();
drawScreen(background);
@@ -3494,7 +3494,7 @@ void openScreenObject() {
currentRoomData->bitmapasociados[indicey].coordy = 0;
currentRoomData->bitmapasociados[indicey].profund = 0;
currentRoomData->doors[2].abiertacerrada = 1;
- handPantallaToBackground();
+ screenHandleToBackground();
assembleScreen();
drawScreen(background);
animateOpen2(0, 1);
@@ -3529,7 +3529,7 @@ void openScreenObject() {
currentRoomData->bitmapasociados[indicey].coordy = 0;
currentRoomData->bitmapasociados[indicey].profund = 0;
currentRoomData->doors[0].abiertacerrada = 1;
- handPantallaToBackground();
+ screenHandleToBackground();
assembleScreen();
drawScreen(background);
animateOpen2(1, 1);
@@ -3876,7 +3876,7 @@ static void scrollRight(uint &horizontalPos) {
horizontalPos += 4;
for (int k = 0; k < 140; k++) {
for (int j = 0; j < 4; j++) {
- background[320 + k * 320 + j] = handpantalla[horizontalPos + k * 320 + j];
+ background[320 + k * 320 + j] = screenHandle[horizontalPos + k * 320 + j];
}
}
if (characterPos > 0) {
@@ -3930,7 +3930,7 @@ static void scrollLeft(uint &poshor) {
poshor -= 4;
for (int k = 0; k < 140; k++) {
for (int j = 0; j < 4; j++) {
- background[4 + k * 320 + j] = handpantalla[4 + poshor + k * 320 + j];
+ background[4 + k * 320 + j] = screenHandle[4 + poshor + k * 320 + j];
}
}
@@ -3971,7 +3971,7 @@ static void scrollLeft(uint &poshor) {
void loadScrollData(uint numpantalla, bool scrollder, uint poshor, int correccionscroll) {
uint indicecarga;
- handPantallaToBackground();
+ screenHandleToBackground();
// Fondo now contains background A, handpantalla contains background A
uint pasoframeW = READ_LE_UINT16(pasoframe);
@@ -4001,7 +4001,7 @@ void loadScrollData(uint numpantalla, bool scrollder, uint poshor, int correccio
// Fondo contains background B + objects, handpantalla contains plain background B
// Copies the contents of fondo into handpantalla
- Common::copy(background, background + 44804, handpantalla);
+ Common::copy(background, background + 44804, screenHandle);
// Fondo contains background B + objects, handpantalla contains background B + objects
movidapaleta = 0;
@@ -4015,7 +4015,7 @@ void loadScrollData(uint numpantalla, bool scrollder, uint poshor, int correccio
scrollLeft(poshor);
// After scroll is done, handpantalla will now contain the resulting fondo (background B + objects)
- Common::copy(handpantalla, handpantalla + 44804, background);
+ Common::copy(screenHandle, screenHandle + 44804, background);
characterPosX += correccionscroll;
@@ -4312,7 +4312,7 @@ void loadGame(regispartida game) {
drawBackpack();
if (rojo_capturado == false && currentRoomData->codigo == 24 && trampa_puesta == false)
runaroundRed();
- effect(tipoefectofundido, false, background);
+ screenTransition(tipoefectofundido, false, background);
}
struct indicepart {
@@ -4935,7 +4935,7 @@ void wcScene() {
characterPosX = 76 - rectificacionx;
characterPosY = 78 - rectificaciony;
copyPalette(palwater, pal);
- handPantallaToBackground();
+ screenHandleToBackground();
assembleScreen();
drawScreen(background);
partialFadeIn(234);
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
index 2929c89a032..a8db20673d8 100644
--- a/engines/tot/routines2.cpp
+++ b/engines/tot/routines2.cpp
@@ -38,9 +38,9 @@
namespace Tot {
void loadScreenMemory() {
- sizepantalla = 65520;
- background = (byte *)malloc(sizepantalla);
- handpantalla = (byte *)malloc(sizepantalla);
+ screenSize = 65520;
+ background = (byte *)malloc(screenSize);
+ screenHandle = (byte *)malloc(screenSize);
}
void loadAnimationForDirection(Common::SeekableReadStream *stream, int direction) {
@@ -279,9 +279,9 @@ void loadScreen() {
Common::File fichcp;
palette palcp;
- sizepantalla = currentRoomData->tamimagenpantalla;
- readBitmap(currentRoomData->puntimagenpantalla, background, sizepantalla, 316);
- Common::copy(background, background + sizepantalla, handpantalla);
+ screenSize = currentRoomData->tamimagenpantalla;
+ readBitmap(currentRoomData->puntimagenpantalla, background, screenSize, 316);
+ Common::copy(background, background + screenSize, screenHandle);
switch (gamePart) {
case 1: {
if (!fichcp.open("PALETAS.DAT")) {
@@ -1673,10 +1673,10 @@ void credits() {
g_engine->_mouseManager->hide();
totalFadeOut(0);
- lowerMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
+ fadeOutMusic(volumenmelodiaizquierdo, volumenmelodiaderecho);
cleardevice();
playMidiFile("CREDITOS", true);
- restoreMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
+ fadeInMusic(volumenmelodiaizquierdo, volumenmelodiaderecho);
drawCreditsScreen(fondopp, sizefondo2, fondo2);
salirpitando = false;
@@ -1747,10 +1747,10 @@ void credits() {
Lsalida:
delay(1000);
totalFadeOut(0);
- lowerMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
+ fadeOutMusic(volumenmelodiaizquierdo, volumenmelodiaderecho);
cleardevice();
playMidiFile("INTRODUC", true);
- restoreMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
+ fadeInMusic(volumenmelodiaizquierdo, volumenmelodiaderecho);
g_engine->_mouseManager->show();
free(fondopp);
free(fondo2);
@@ -2469,9 +2469,9 @@ void sacrificeScene() {
if (g_engine->shouldQuit())
return;
- lowerMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
+ fadeOutMusic(volumenmelodiaizquierdo, volumenmelodiaderecho);
playMidiFile("SACRIFIC", true);
- restoreMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
+ fadeInMusic(volumenmelodiaizquierdo, volumenmelodiaderecho);
clear();
outtextxy(10, 31, messages[23], 254);
@@ -2748,9 +2748,9 @@ void ending() {
if(g_engine->shouldQuit()) {
return;
}
- lowerMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
+ fadeOutMusic(volumenmelodiaizquierdo, volumenmelodiaderecho);
playMidiFile("SACRIFIC", true);
- restoreMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
+ fadeInMusic(volumenmelodiaizquierdo, volumenmelodiaderecho);
drawFlc(0, 0, offsets[30], 12, 9, 26, true, false, false, pulsada_salida);
if(pulsada_salida){
return;
@@ -2844,7 +2844,7 @@ void disableSecondAnimation() {
setRoomTrajectories(altoanimado, anchoanimado, RESTORE);
currentRoomData->animationFlag = false;
freeAnimation();
- handPantallaToBackground();
+ screenHandleToBackground();
assembleScreen();
}
diff --git a/engines/tot/sound.cpp b/engines/tot/sound.cpp
index d018d8a1dde..abe7f4c1a70 100644
--- a/engines/tot/sound.cpp
+++ b/engines/tot/sound.cpp
@@ -27,7 +27,7 @@
namespace Tot {
-byte *midmusica;
+byte *currentMidi;
void stopVoc() {
g_engine->_sound->stopVoc();
@@ -53,8 +53,7 @@ void setMidiVolume(byte voll, byte volr) {
g_engine->_sound->setMusicVolume(volume);
}
-void lowerMidiVolume(byte voll, byte volr) {
-
+void fadeOutMusic(byte voll, byte volr) {
byte volpaso = (voll + volr) / 2;
for (int ivol = volpaso; ivol >= 0; ivol--) {
setMidiVolume(ivol, ivol);
@@ -62,7 +61,7 @@ void lowerMidiVolume(byte voll, byte volr) {
}
}
-void restoreMidiVolume(byte voll, byte volr) {
+void fadeInMusic(byte voll, byte volr) {
byte ivol, volpaso;
volpaso = (voll + volr) / 2;
@@ -75,12 +74,12 @@ void restoreMidiVolume(byte voll, byte volr) {
void setMasterVolume(byte voll, byte volr) {
}
-void loadVoc(Common::String vocfile, int32 posinicio, uint tamvocleer) {
- g_engine->_sound->loadVoc(vocfile, posinicio, tamvocleer);
+void loadVoc(Common::String vocFile, int32 startPos, uint vocSize) {
+ g_engine->_sound->loadVoc(vocFile, startPos, vocSize);
}
-void autoPlayVoc(Common::String vocfile, int32 posinicio, uint tamvocleer) {
- g_engine->_sound->loadVoc(vocfile, posinicio, tamvocleer);
+void autoPlayVoc(Common::String vocFile, int32 startPos, uint vocSize) {
+ g_engine->_sound->loadVoc(vocFile, startPos, vocSize);
g_engine->_sound->autoPlayVoc();
}
@@ -88,22 +87,22 @@ void pitavocmem() {
g_engine->_sound->playVoc();
}
-void playVoc(Common::String vocfile, int32 posinicio, uint tamvocleer) {
- loadVoc(vocfile, posinicio, tamvocleer);
+void playVoc(Common::String vocFile, int32 startPos, uint vocSize) {
+ loadVoc(vocFile, startPos, vocSize);
pitavocmem();
}
void playMidiFile(Common::String nomfich, bool loop) {
- Common::File ficheromus;
- if (!ficheromus.open(Common::Path(nomfich + ".MUS"))) {
+ Common::File musicFile;
+ if (!musicFile.open(Common::Path(nomfich + ".MUS"))) {
showError(267);
}
- midmusica = (byte *)malloc(ficheromus.size());
- ficheromus.read(midmusica, ficheromus.size());
+ currentMidi = (byte *)malloc(musicFile.size());
+ musicFile.read(currentMidi, musicFile.size());
- g_engine->_sound->playMidi(midmusica, ficheromus.size(), true);
- ficheromus.close();
+ g_engine->_sound->playMidi(currentMidi, musicFile.size(), true);
+ musicFile.close();
}
void initSound() {
diff --git a/engines/tot/sound.h b/engines/tot/sound.h
index 98831182129..7de6df4b2e7 100644
--- a/engines/tot/sound.h
+++ b/engines/tot/sound.h
@@ -28,8 +28,8 @@ namespace Tot {
void initSound();
void setSfxVolume(byte voll, byte volr);
void setMidiVolume(byte voll, byte volr);
-void lowerMidiVolume(byte voll, byte volr);
-void restoreMidiVolume(byte voll, byte volr);
+void fadeOutMusic(byte voll, byte volr);
+void fadeInMusic(byte voll, byte volr);
void setMasterVolume(byte voll, byte volr);
void loadVoc(Common::String vocFile, int32 startPos, uint vocSize);
void autoPlayVoc(Common::String vocFile, int32 startPos, uint vocSize);
Commit: 3fee3e19a6cb2d00ad2ac566d083e7a338f3ca87
https://github.com/scummvm/scummvm/commit/3fee3e19a6cb2d00ad2ac566d083e7a338f3ca87
Author: gsanmartin (gabriel.sanmartin at dna.inc)
Date: 2025-09-08T16:49:49+02:00
Commit Message:
TOT: Mouse cleanup
Changed paths:
R engines/tot/mouse.cpp
R engines/tot/mouse.h
engines/tot/game.cpp
engines/tot/module.mk
engines/tot/mouseman.cpp
engines/tot/mouseman.h
engines/tot/routines.cpp
engines/tot/routines.h
engines/tot/routines2.cpp
engines/tot/routines2.h
engines/tot/tot.cpp
diff --git a/engines/tot/game.cpp b/engines/tot/game.cpp
index 9aa711cad9f..1459d4c10bf 100644
--- a/engines/tot/game.cpp
+++ b/engines/tot/game.cpp
@@ -24,7 +24,6 @@
#include "tot/dialog.h"
#include "tot/graphics.h"
-#include "tot/mouse.h"
#include "tot/playanim.h"
#include "tot/routines.h"
#include "tot/routines2.h"
@@ -88,7 +87,7 @@ int engine_start() {
setMidiVolume(0, 0);
playMidiFile("SILENT", false);
- setMouseArea(0, 0, 305, 185);
+ g_engine->_mouseManager->setMouseArea(Common::Rect(0, 0, 305, 185));
playMidiFile("SILENT", true);
totalFadeOut(0);
@@ -100,7 +99,7 @@ int engine_start() {
playMidiFile("INTRODUC", true);
setMidiVolume(3, 3);
firstIntroduction();
- setMousePos(1, xraton, yraton);
+ g_engine->_mouseManager->setMousePos(1, xraton, yraton);
initialMenu(hechaprimeravez);
if (partidanueva && !g_engine->shouldQuit()) {
newGame();
diff --git a/engines/tot/module.mk b/engines/tot/module.mk
index 22f2b736b40..e7eb9c86adb 100644
--- a/engines/tot/module.mk
+++ b/engines/tot/module.mk
@@ -8,7 +8,6 @@ MODULE_OBJS = \
util.o \
playanim.o \
graphics.o \
- mouse.o \
sound.o \
anims.o \
routines2.o \
diff --git a/engines/tot/mouse.cpp b/engines/tot/mouse.cpp
deleted file mode 100644
index 1704c6d460b..00000000000
--- a/engines/tot/mouse.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "common/textconsole.h"
-
-#include "tot/mouse.h"
-#include "tot/tot.h"
-
-namespace Tot {
-
-void setMousePos(byte nummascara, uint posx, uint posy) {
- g_engine->_mouseManager->warpMouse(nummascara, posx, posy);
-}
-
-void setMouseArea(uint mih, uint miv, uint mah, uint mav) {
- debug("Defining mouse area to %d ,%d ,%d ,%d ", mih, miv, mah, mav);
- g_engine->_mouseManager->setMouseArea(Common::Rect(mih, miv, mah, mav));
-}
-} // End of namespace Tot
diff --git a/engines/tot/mouse.h b/engines/tot/mouse.h
deleted file mode 100644
index bc168f5f6df..00000000000
--- a/engines/tot/mouse.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-#ifndef TOT_MOUSE_H
-#define TOT_MOUSE_H
-
-#include "common/scummsys.h"
-
-#include "tot/graphics.h"
-#include "tot/util.h"
-
-namespace Tot {
-void setMousePos(byte maskNumber, uint posx, uint posy);
-void setMouseArea(uint mih, uint miv, uint mah, uint mav);
-
-} // End of namespace Tot
-
-#endif
diff --git a/engines/tot/mouseman.cpp b/engines/tot/mouseman.cpp
index d3ba201317b..636e38f8943 100644
--- a/engines/tot/mouseman.cpp
+++ b/engines/tot/mouseman.cpp
@@ -78,7 +78,7 @@ void MouseManager::printPos(int x, int y, int screenPosX, int screenPosY) {
g_engine->_graphics->euroText(Common::String::format("MousePos: %d, %d", x + 7, y + 7), screenPosX, screenPosY, Graphics::kTextAlignLeft);
}
-void MouseManager::warpMouse(int mask, int x, int y) {
+void MouseManager::setMousePos(int mask, int x, int y) {
setMouseMask(_currentMouseMask);
g_system->warpMouse(x, y);
}
diff --git a/engines/tot/mouseman.h b/engines/tot/mouseman.h
index f3e47a109c7..a7a4069d5e4 100644
--- a/engines/tot/mouseman.h
+++ b/engines/tot/mouseman.h
@@ -38,7 +38,7 @@ public:
MouseManager();
~MouseManager();
void drawMask(int idx);
- void warpMouse(int mask, int x, int y);
+ void setMousePos(int mask, int x, int y);
void setMask(int maskNum);
void animateMouseIfNeeded();
void hide();
diff --git a/engines/tot/routines.cpp b/engines/tot/routines.cpp
index 48ab3fbb39e..17b2a8b63e0 100644
--- a/engines/tot/routines.cpp
+++ b/engines/tot/routines.cpp
@@ -4389,8 +4389,8 @@ void saveLoad() {
partidaselecc = 0;
modificada = false;
nombrepartida = "";
- setMouseArea(55, 13, 250, 105);
- setMousePos(1, xraton, yraton);
+ g_engine->_mouseManager->setMouseArea(Common::Rect(55, 13, 250, 105));
+ g_engine->_mouseManager->setMousePos(1, xraton, yraton);
do {
Common::Event e;
bool mouseClicked = false;
@@ -4448,7 +4448,7 @@ void saveLoad() {
yraton = oldyraton;
g_engine->_mouseManager->show();
- setMouseArea(0, 0, 305, 185);
+ g_engine->_mouseManager->setMouseArea(Common::Rect(0, 0, 305, 185));
salirmenufunciones = true;
partidaselecc = 0;
return;
@@ -4529,9 +4529,9 @@ void saveLoad() {
} while (!salirmenufunciones && !g_engine->shouldQuit());
xraton = oldxraton;
yraton = oldyraton;
- setMousePos(iraton, xraton, yraton);
+ g_engine->_mouseManager->setMousePos(iraton, xraton, yraton);
free(puntfondmenu);
- setMouseArea(0, 0, 305, 185);
+ g_engine->_mouseManager->setMouseArea(Common::Rect(0, 0, 305, 185));
}
/**
diff --git a/engines/tot/routines.h b/engines/tot/routines.h
index ec51752f850..4914076de71 100644
--- a/engines/tot/routines.h
+++ b/engines/tot/routines.h
@@ -25,7 +25,6 @@
#include "tot/anims.h"
#include "tot/graphics.h"
-#include "tot/mouse.h"
#include "tot/playanim.h"
#include "tot/routines2.h"
#include "tot/sound.h"
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
index a8db20673d8..3d382d960d7 100644
--- a/engines/tot/routines2.cpp
+++ b/engines/tot/routines2.cpp
@@ -1918,7 +1918,7 @@ void initialMenu(bool fundido) {
xraton = 160;
yraton = 95;
iraton = 1;
- setMousePos(iraton, xraton, yraton);
+ g_engine->_mouseManager->setMousePos(iraton, xraton, yraton);
Common::Event e;
do {
g_engine->_chrono->updateChrono();
@@ -2132,8 +2132,8 @@ void exitToDOS() {
yraton = 90;
iraton = 1;
- setMouseArea(115, 80, 190, 100);
- setMousePos(iraton, xraton, yraton);
+ g_engine->_mouseManager->setMouseArea(Common::Rect(115, 80, 190, 100));
+ g_engine->_mouseManager->setMousePos(iraton, xraton, yraton);
Common::Event e;
const char hotKeyYes = hotKeyFor(YES);
const char hotKeyNo = hotKeyFor(NO);
@@ -2178,7 +2178,7 @@ void exitToDOS() {
iraton = oldiraton;
g_engine->_mouseManager->show();
free(puntfondcontroles);
- setMouseArea(0, 0, 305, 185);
+ g_engine->_mouseManager->setMouseArea(Common::Rect(0, 0, 305, 185));
}
void soundControls() {
@@ -2209,7 +2209,7 @@ void soundControls() {
yraton = 60;
iraton = 1;
- setMouseArea(55, 13, 250, 105);
+ g_engine->_mouseManager->setMouseArea(Common::Rect(55, 13, 250, 105));
for (ytext = 1; ytext <= 6; ytext++)
buttonBorder(120 - (ytext * 10), 80 - (ytext * 10), 200 + (ytext * 10), 60 + (ytext * 10), 251, 251, 251, 251, 0, 0, "");
@@ -2235,7 +2235,7 @@ void soundControls() {
putImg(volumenfx + 86, 31, slider);
putImg(volumenmelodia + 86, 76, slider);
- setMousePos(1, xraton, yraton);
+ g_engine->_mouseManager->setMousePos(1, xraton, yraton);
bool keyPressed = false;
bool mouseClicked = false;
Common::Event e;
@@ -2341,7 +2341,7 @@ void soundControls() {
xraton = oldxraton;
yraton = oldyraton;
iraton = oldiraton;
- setMousePos(iraton, xraton, yraton);
+ g_engine->_mouseManager->setMousePos(iraton, xraton, yraton);
free(puntfondcontroles);
free(slider);
free(sliderBackground1);
@@ -2350,7 +2350,7 @@ void soundControls() {
if (contadorpc > 7)
showError(274);
- setMouseArea(0, 0, 305, 185);
+ g_engine->_mouseManager->setMouseArea(Common::Rect(0, 0, 305, 185));
}
void sacrificeScene() {
diff --git a/engines/tot/routines2.h b/engines/tot/routines2.h
index 7ba596f63ce..dc9adf2fcd4 100644
--- a/engines/tot/routines2.h
+++ b/engines/tot/routines2.h
@@ -23,7 +23,6 @@
#include "tot/anims.h"
#include "tot/graphics.h"
-#include "tot/mouse.h"
#include "tot/playanim.h"
#include "tot/sound.h"
#include "tot/util.h"
diff --git a/engines/tot/tot.cpp b/engines/tot/tot.cpp
index f45c75f6016..e91179bbb62 100644
--- a/engines/tot/tot.cpp
+++ b/engines/tot/tot.cpp
@@ -34,7 +34,6 @@
#include "tot/detection.h"
#include "tot/font/bgifont.h"
#include "tot/graphman.h"
-#include "tot/mouse.h"
#include "tot/playanim.h"
#include "tot/routines.h"
#include "tot/routines2.h"
Commit: ae919ffc07b71c5d7d7a83ef30bbfbe87e6f5c9b
https://github.com/scummvm/scummvm/commit/ae919ffc07b71c5d7d7a83ef30bbfbe87e6f5c9b
Author: gsanmartin (gabriel.sanmartin at dna.inc)
Date: 2025-09-08T16:49:49+02:00
Commit Message:
TOT: Cleanup sound manager
Changed paths:
R engines/tot/sound.cpp
R engines/tot/sound.h
engines/tot/anims.cpp
engines/tot/anims.h
engines/tot/console.cpp
engines/tot/game.cpp
engines/tot/module.mk
engines/tot/playanim.cpp
engines/tot/playanim.h
engines/tot/routines.cpp
engines/tot/routines.h
engines/tot/routines2.cpp
engines/tot/routines2.h
engines/tot/soundman.cpp
engines/tot/soundman.h
engines/tot/tot.cpp
diff --git a/engines/tot/anims.cpp b/engines/tot/anims.cpp
index 16052e5f842..70761a244c0 100644
--- a/engines/tot/anims.cpp
+++ b/engines/tot/anims.cpp
@@ -270,7 +270,7 @@ void handleFlcEvent(byte numero_del_evento) {
clearTvText();
} break;
case 7:
- playVoc("MANDO", 142001, 11469);
+ g_engine->_sound->playVoc("MANDO", 142001, 11469);
break;
case 20:
drawCharacterText(messages[60], messages[61], messages[62], messages[63], messages[64]);
@@ -323,13 +323,13 @@ void handleFlcEvent(byte numero_del_evento) {
case 3:
switch (framecontador) {
case 15:
- playVoc("FRENAZO", 165322, 15073);
+ g_engine->_sound->playVoc("FRENAZO", 165322, 15073);
break;
case 26:
delay(1000);
break;
case 43:
- playVoc("PORTAZO", 434988, 932);
+ g_engine->_sound->playVoc("PORTAZO", 434988, 932);
break;
case 60:
getImg(0, 0, 319, 29, punterofondofrase);
@@ -338,7 +338,7 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 4:
if (framecontador == 3)
- playVoc("TIMBRAZO", 423775, 11213);
+ g_engine->_sound->playVoc("TIMBRAZO", 423775, 11213);
break;
case 5:
if ((numerovuelta == 1) && (framecontador == 2)) {
@@ -533,7 +533,7 @@ void handleFlcEvent(byte numero_del_evento) {
delay(500);
break;
case 18:
- playVoc("ACELERON", 30200, 42398);
+ g_engine->_sound->playVoc("ACELERON", 30200, 42398);
break;
}
break;
@@ -746,34 +746,34 @@ void handleFlcEvent(byte numero_del_evento) {
case 21:
switch (framecontador) {
case 1:
- playVoc("TRIDEN", 409405, 14370);
+ g_engine->_sound->playVoc("TRIDEN", 409405, 14370);
break;
case 5:
- playVoc("PUFF", 191183, 18001);
+ g_engine->_sound->playVoc("PUFF", 191183, 18001);
break;
}
break;
case 22:
if (framecontador == 24)
- playVoc("PUFF", 191183, 18001);
+ g_engine->_sound->playVoc("PUFF", 191183, 18001);
break;
case 23:
switch (framecontador) {
case 8:
- playVoc("AFILAR", 0, 6433);
+ g_engine->_sound->playVoc("AFILAR", 0, 6433);
break;
case 18:
- pitavocmem();
+ g_engine->_sound->playVoc();
break;
}
break;
case 24:
if (framecontador == 8)
- playVoc("DECAPITA", 354269, 1509);
+ g_engine->_sound->playVoc("DECAPITA", 354269, 1509);
break;
case 25:
if (framecontador == 97)
- playVoc("PUFF2", 209184, 14514);
+ g_engine->_sound->playVoc("PUFF2", 209184, 14514);
break;
case 26:
switch (numerovuelta) {
@@ -845,7 +845,7 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 27:
if (framecontador == 148)
- playVoc("DECAPITA", 354269, 1509);
+ g_engine->_sound->playVoc("DECAPITA", 354269, 1509);
break;
}
}
diff --git a/engines/tot/anims.h b/engines/tot/anims.h
index b024eec0aff..1902e34542d 100644
--- a/engines/tot/anims.h
+++ b/engines/tot/anims.h
@@ -23,8 +23,6 @@
#include "common/scummsys.h"
-#include "tot/sound.h"
-
namespace Tot {
void drawFlc(uint flicx, uint flicy, int32 posicionfli, uint loop,
diff --git a/engines/tot/console.cpp b/engines/tot/console.cpp
index ed720fbe2e8..f592b586cdc 100644
--- a/engines/tot/console.cpp
+++ b/engines/tot/console.cpp
@@ -93,8 +93,8 @@ bool TotConsole::cmdLoadRoom(int argc, const char **argv) {
bool TotConsole::cmdJumpToPart2(int argc, const char **argv) {
- completadalista1 = true;
- completadalista2 = true;
+ list1Complete = true;
+ list2Complete = true;
debugPrintf("Moving on to part 2 of the game");
return true;
}
diff --git a/engines/tot/game.cpp b/engines/tot/game.cpp
index 1459d4c10bf..6377bcd14de 100644
--- a/engines/tot/game.cpp
+++ b/engines/tot/game.cpp
@@ -27,7 +27,6 @@
#include "tot/playanim.h"
#include "tot/routines.h"
#include "tot/routines2.h"
-#include "tot/sound.h"
#include "tot/texts.h"
#include "tot/tot.h"
#include "tot/util.h"
@@ -84,11 +83,11 @@ int engine_start() {
loadCharAnimation();
loadObjects();
- setMidiVolume(0, 0);
- playMidiFile("SILENT", false);
+ g_engine->_sound->setMidiVolume(0, 0);
+ g_engine->_sound->playMidi("SILENT", false);
g_engine->_mouseManager->setMouseArea(Common::Rect(0, 0, 305, 185));
- playMidiFile("SILENT", true);
+ g_engine->_sound->playMidi("SILENT", true);
totalFadeOut(0);
clear();
@@ -96,8 +95,8 @@ int engine_start() {
loadPalette("DEFAULT");
loadScreenMemory();
initialLogo();
- playMidiFile("INTRODUC", true);
- setMidiVolume(3, 3);
+ g_engine->_sound->playMidi("INTRODUC", true);
+ g_engine->_sound->setMidiVolume(3, 3);
firstIntroduction();
g_engine->_mouseManager->setMousePos(1, xraton, yraton);
initialMenu(hechaprimeravez);
@@ -115,17 +114,17 @@ int engine_start() {
}
int startGame() {
- fadeOutMusic(volumenmelodiaizquierdo, volumenmelodiaderecho);
+ g_engine->_sound->fadeOutMusic(musicVolLeft, musicVolRight);
switch (gamePart) {
case 1:
- playMidiFile("PRIMERA", true);
+ g_engine->_sound->playMidi("PRIMERA", true);
break;
case 2:
- playMidiFile("SEGUNDA", true);
+ g_engine->_sound->playMidi("SEGUNDA", true);
break;
}
contadorpc2 = contadorpc;
- fadeInMusic(volumenmelodiaizquierdo, volumenmelodiaderecho);
+ g_engine->_sound->fadeInMusic(musicVolLeft, musicVolRight);
inGame = true;
Common::Event e;
@@ -152,21 +151,6 @@ int startGame() {
switch (e.kbd.keycode) {
- case Common::KEYCODE_UP:
- playMidiFile("INTRODUC", true);
- break;
- case Common::KEYCODE_DOWN:
- playMidiFile("PRIMERA", true);
- break;
- case Common::KEYCODE_LEFT:
- playMidiFile("SEGUNDA", true);
- // saveLoad();
- break;
- case Common::KEYCODE_RIGHT:
- playMidiFile("CREDITOS", true);
- // saveLoad();
- break;
-
case Common::KEYCODE_ESCAPE:
escapePressed = true;
break;
@@ -443,10 +427,10 @@ int startGame() {
continuarpartida = false;
g_engine->saveAutosaveIfEnabled();
totalFadeOut(0);
- fadeOutMusic(volumenmelodiaizquierdo, volumenmelodiaderecho);
+ g_engine->_sound->fadeOutMusic(musicVolLeft, musicVolRight);
clear();
- playMidiFile("INTRODUC", true);
- fadeInMusic(volumenmelodiaizquierdo, volumenmelodiaderecho);
+ g_engine->_sound->playMidi("INTRODUC", true);
+ g_engine->_sound->fadeInMusic(musicVolLeft, musicVolRight);
initialMenu(true);
verifyCopyProtection2();
@@ -460,23 +444,23 @@ int startGame() {
contadorpc = contadorpc2;
desactivagrabar = false;
}
- fadeOutMusic(volumenmelodiaizquierdo, volumenmelodiaderecho);
+ g_engine->_sound->fadeOutMusic(musicVolLeft, musicVolRight);
switch (gamePart) {
case 1:
- playMidiFile("PRIMERA", true);
+ g_engine->_sound->playMidi("PRIMERA", true);
break;
case 2:
- playMidiFile("SEGUNDA", true);
+ g_engine->_sound->playMidi("SEGUNDA", true);
break;
}
- fadeInMusic(volumenmelodiaizquierdo, volumenmelodiaderecho);
+ g_engine->_sound->fadeInMusic(musicVolLeft, musicVolRight);
}
switch (gamePart) {
case 1:
- if (completadalista1 && completadalista2) {
- completadalista1 = false;
- completadalista2 = false;
+ if (list1Complete && list2Complete) {
+ list1Complete = false;
+ list2Complete = false;
contadorpc = contadorpc2;
gamePart = 2;
iframe = 0;
@@ -485,9 +469,9 @@ int startGame() {
freeScreenObjects();
g_engine->_mouseManager->hide();
partialFadeOut(234);
- fadeOutMusic(volumenmelodiaizquierdo, volumenmelodiaderecho);
- playMidiFile("CREDITOS", true);
- fadeInMusic(volumenmelodiaizquierdo, volumenmelodiaderecho);
+ g_engine->_sound->fadeOutMusic(musicVolLeft, musicVolRight);
+ g_engine->_sound->playMidi("CREDITOS", true);
+ g_engine->_sound->fadeInMusic(musicVolLeft, musicVolRight);
if (contadorpc2 > 43)
showError(274);
sacrificeScene();
@@ -500,9 +484,9 @@ int startGame() {
trayec[indicetray].x = characterPosX;
trayec[indicetray].y = characterPosY;
loadScreenData(20);
- fadeOutMusic(volumenmelodiaizquierdo, volumenmelodiaderecho);
- playMidiFile("SEGUNDA", true);
- fadeInMusic(volumenmelodiaizquierdo, volumenmelodiaderecho);
+ g_engine->_sound->fadeOutMusic(musicVolLeft, musicVolRight);
+ g_engine->_sound->playMidi("SEGUNDA", true);
+ g_engine->_sound->fadeInMusic(musicVolLeft, musicVolRight);
screenTransition(1, false, background);
mask();
posicioninv = 0;
@@ -576,7 +560,7 @@ void sceneChange() {
setRoomTrajectories(altoanimado, anchoanimado, RESTORE);
saveRoomData(currentRoomData, rooms);
// verifyCopyProtection();
- // setSfxVolume(volumenfxizquierdo, volumenfxderecho);
+ g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
switch (currentRoomData->doors[indicepuertas].pantallaquecarga) {
case 2: {
@@ -592,13 +576,13 @@ void sceneChange() {
g_engine->_mouseManager->hide();
screenTransition(tipoefectofundido, true, NULL);
- stopVoc();
+ g_engine->_sound->stopVoc();
loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
if (contadorpc > 89)
showError(274);
- setSfxVolume(volumenfxizquierdo, volumenfxderecho);
+ g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
if (teleencendida)
- autoPlayVoc("PARASITO", 355778, 20129);
+ g_engine->_sound->autoPlayVoc("PARASITO", 355778, 20129);
else
cargatele();
screenTransition(tipoefectofundido, false, background);
@@ -621,9 +605,9 @@ void sceneChange() {
g_engine->_mouseManager->hide();
screenTransition(tipoefectofundido, true, NULL);
loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
- stopVoc();
- autoPlayVoc("CALDERA", 6433, 15386);
- setSfxVolume(volumenfxizquierdo, 0);
+ g_engine->_sound->stopVoc();
+ g_engine->_sound->autoPlayVoc("CALDERA", 6433, 15386);
+ g_engine->_sound->setSfxVolume(leftSfxVol, 0);
screenTransition(tipoefectofundido, false, background);
g_engine->_mouseManager->show();
oldxrejilla = 0;
@@ -631,13 +615,13 @@ void sceneChange() {
checkMouseGrid();
} else {
- zonaactual = currentRoomData->rejapantalla[((characterPosX + rectificacionx) / factorx)][((characterPosY + rectificaciony) / factory)];
+ zonaactual = currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory];
zonadestino = 21;
goToObject(zonaactual, zonadestino);
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- setSfxVolume(volumenfxizquierdo, 0);
+ g_engine->_sound->setSfxVolume(leftSfxVol, 0);
loadScrollData(currentRoomData->doors[indicepuertas].pantallaquecarga, true, 22, -2);
g_engine->_mouseManager->show();
oldxrejilla = 0;
@@ -652,7 +636,7 @@ void sceneChange() {
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- setSfxVolume(volumenfxizquierdo, volumenfxderecho);
+ g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
loadScrollData(currentRoomData->doors[indicepuertas].pantallaquecarga, false, 22, 2);
g_engine->_mouseManager->show();
oldxrejilla = 0;
@@ -785,13 +769,13 @@ void sceneChange() {
freeScreenObjects();
g_engine->_mouseManager->hide();
screenTransition(tipoefectofundido, true, NULL);
- stopVoc();
+ g_engine->_sound->stopVoc();
loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
if (libro[0] == true && currentRoomData->animationFlag == true)
disableSecondAnimation();
if (contadorpc > 89)
showError(274);
- setSfxVolume(volumenfxizquierdo, volumenfxderecho);
+ g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
screenTransition(tipoefectofundido, false, background);
contadorpc = contadorpc2;
g_engine->_mouseManager->show();
@@ -877,7 +861,7 @@ void sceneChange() {
freeScreenObjects();
g_engine->_mouseManager->hide();
screenTransition(tipoefectofundido, true, NULL);
- stopVoc();
+ g_engine->_sound->stopVoc();
loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
switch (hornacina[0][hornacina[0][3]]) {
case 0:
@@ -895,9 +879,9 @@ void sceneChange() {
}
if (contadorpc > 89)
showError(274);
- setSfxVolume(volumenfxizquierdo, volumenfxderecho);
+ g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
if (currentRoomData->codigo == 4)
- loadVoc("GOTA", 140972, 1029);
+ g_engine->_sound->loadVoc("GOTA", 140972, 1029);
screenTransition(tipoefectofundido, false, background);
contadorpc = contadorpc2;
g_engine->_mouseManager->show();
@@ -917,7 +901,7 @@ void sceneChange() {
freeScreenObjects();
g_engine->_mouseManager->hide();
screenTransition(tipoefectofundido, true, NULL);
- stopVoc();
+ g_engine->_sound->stopVoc();
loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
switch (hornacina[1][hornacina[1][3]]) {
case 0:
@@ -938,7 +922,7 @@ void sceneChange() {
}
if (contadorpc > 89)
showError(274);
- setSfxVolume(volumenfxizquierdo, volumenfxderecho);
+ g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
if (trampa_puesta) {
currentRoomData->animationFlag = true;
loadAnimation(currentRoomData->nombremovto);
@@ -985,17 +969,17 @@ void sceneChange() {
freeScreenObjects();
g_engine->_mouseManager->hide();
screenTransition(tipoefectofundido, true, NULL);
- stopVoc();
+ g_engine->_sound->stopVoc();
loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
if (contadorpc > 89)
showError(274);
- setSfxVolume(volumenfxizquierdo, volumenfxderecho);
+ g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
switch (currentRoomData->codigo) {
case 4:
- loadVoc("GOTA", 140972, 1029);
+ g_engine->_sound->loadVoc("GOTA", 140972, 1029);
break;
case 23:
- autoPlayVoc("FUENTE", 0, 0);
+ g_engine->_sound->autoPlayVoc("FUENTE", 0, 0);
break;
}
screenTransition(tipoefectofundido, false, background);
diff --git a/engines/tot/module.mk b/engines/tot/module.mk
index e7eb9c86adb..22176c90f8e 100644
--- a/engines/tot/module.mk
+++ b/engines/tot/module.mk
@@ -8,7 +8,6 @@ MODULE_OBJS = \
util.o \
playanim.o \
graphics.o \
- sound.o \
anims.o \
routines2.o \
routines.o \
diff --git a/engines/tot/playanim.cpp b/engines/tot/playanim.cpp
index dc24a746cbc..894057385ce 100644
--- a/engines/tot/playanim.cpp
+++ b/engines/tot/playanim.cpp
@@ -129,10 +129,10 @@ uint codigoobjmochila;
uint kaka;
uint oldposx, oldposy;
-uint volumenfxderecho, volumenfxizquierdo;
+uint rightSfxVol, leftSfxVol;
uint segpasoicono;
uint ofspasoicono;
-uint volumenmelodiaderecho, volumenmelodiaizquierdo;
+uint musicVolRight, musicVolLeft;
int elemento1, elemento2;
@@ -179,7 +179,7 @@ byte rejamascaramovto[10][10];
byte rejamascararaton[10][10];
-bool completadalista1, completadalista2,
+bool list1Complete, list2Complete,
lista1, lista2;
bool primera[maxpersonajes],
@@ -383,10 +383,10 @@ void resetGameState() {
animacion2 = false;
secuencia.profundidad = 0;
- volumenfxderecho = 6;
- volumenfxizquierdo = 6;
- volumenmelodiaderecho = 3;
- volumenmelodiaizquierdo = 3;
+ rightSfxVol = 6;
+ leftSfxVol = 6;
+ musicVolRight = 3;
+ musicVolLeft = 3;
pintaractivo = true;
desactivagrabar = false;
@@ -395,8 +395,8 @@ void resetGameState() {
lista1 = false;
lista2 = false;
- completadalista1 = false;
- completadalista2 = false;
+ list1Complete = false;
+ list2Complete = false;
movidapaleta = 0;
gamePart = 1;
diff --git a/engines/tot/playanim.h b/engines/tot/playanim.h
index 96830faa96c..0eff2edd56f 100644
--- a/engines/tot/playanim.h
+++ b/engines/tot/playanim.h
@@ -476,10 +476,10 @@ extern uint kaka;
* Auxiliary vars for grid update
*/
extern uint oldposx, oldposy;
-extern uint volumenfxderecho, volumenfxizquierdo;
+extern uint rightSfxVol, leftSfxVol;
extern uint segpasoicono;
extern uint ofspasoicono;
-extern uint volumenmelodiaderecho, volumenmelodiaizquierdo;
+extern uint musicVolRight, musicVolLeft;
/**
* Amplitude of movement
@@ -563,8 +563,8 @@ extern byte rejamascaramovto[10][10];
*/
extern byte rejamascararaton[10][10];
-extern bool completadalista1,
- completadalista2,
+extern bool list1Complete,
+ list2Complete,
lista1, // whether we've been given list 1
lista2; // whether we've been given list 2
diff --git a/engines/tot/routines.cpp b/engines/tot/routines.cpp
index 17b2a8b63e0..c9ab3a3b3e2 100644
--- a/engines/tot/routines.cpp
+++ b/engines/tot/routines.cpp
@@ -474,7 +474,7 @@ void animatedSequence(uint numSequence) {
animationFile.readByte();
animptr = (byte *)malloc(tamsecani);
for (indicerep = 1; indicerep <= 3; indicerep++) {
- playVoc("POZO", 180395, 6034);
+ g_engine->_sound->playVoc("POZO", 180395, 6034);
indiceani = 0;
do {
emptyLoop();
@@ -517,7 +517,7 @@ void animatedSequence(uint numSequence) {
animationFile.readByte();
animptr = (byte *)malloc(tamsecani);
for (indicerep = 1; indicerep <= 3; indicerep++) {
- playVoc("POZO", 180395, 6034);
+ g_engine->_sound->playVoc("POZO", 180395, 6034);
indiceani = 0;
do {
emptyLoop();
@@ -543,7 +543,7 @@ void animatedSequence(uint numSequence) {
animationFile.seek(4);
// seek(ficherosecuenciaanimada, 4);
}
- stopVoc();
+ g_engine->_sound->stopVoc();
free(animptr);
animationFile.close();
characterPosX = guadaxframe;
@@ -735,11 +735,11 @@ void animatedSequence(uint numSequence) {
drawScreen(background);
indiceani += 1;
if (indiceani == 8)
- playVoc("PUFF", 191183, 18001);
+ g_engine->_sound->playVoc("PUFF", 191183, 18001);
}
} while (indiceani != numframessec && !g_engine->shouldQuit());
animationFile.close();
- stopVoc();
+ g_engine->_sound->stopVoc();
screenObjects[6] = NULL;
currentRoomData->animationFlag = true;
} break;
@@ -1222,7 +1222,7 @@ void advanceAnimations(bool zonavedada, bool animateMouse) {
if (currentRoomData->animationFlag && tocapintar2) {
if (peteractivo && (Random(100) == 1) && !g_engine->_sound->isVocPlaying() && caramelos[0] == false) {
debug("Playing tos");
- playVoc("TOS", 258006, 14044);
+ g_engine->_sound->playVoc("TOS", 258006, 14044);
}
if (indicetray2 >= currentRoomData->longtray2)
indicetray2 = 1;
@@ -1330,7 +1330,7 @@ void advanceAnimations(bool zonavedada, bool animateMouse) {
else
movidapaleta += 1;
if (currentRoomData->codigo == 4 && movidapaleta == 4)
- pitavocmem();
+ g_engine->_sound->playVoc();
updatePalette(movidapaleta);
} else {
saltospal += 1;
@@ -1470,9 +1470,8 @@ void animateBat() {
freeAnimation();
}
loadBat();
- stopVoc();
- loadVoc("MURCIEL", 160848, 4474);
- pitavocmem();
+ g_engine->_sound->stopVoc();
+ g_engine->_sound->playVoc("MURCIEL", 160848, 4474);
itrayseg = 0;
longtrayseg = 87;
iframe2 = 0;
@@ -1494,7 +1493,7 @@ void animateBat() {
sprites(true);
tocapintar = false;
if (itrayseg % 24 == 0)
- pitavocmem();
+ g_engine->_sound->playVoc();
if (saltospal >= 4) {
saltospal = 0;
if (movidapaleta > 6)
@@ -1509,7 +1508,7 @@ void animateBat() {
g_system->delayMillis(10);
} while (!salir_del_bucle && !g_engine->shouldQuit());
- stopVoc();
+ g_engine->_sound->stopVoc();
freeAnimation();
if (currentRoomData->animationFlag) {
anchoanimado = anchoaniseg;
@@ -1746,7 +1745,7 @@ void pickupScreenObject() {
assembleScreen();
drawScreen(background);
animatePickup2(3, 1);
- playVoc("PLATAF", 375907, 14724);
+ g_engine->_sound->playVoc("PLATAF", 375907, 14724);
currentRoomData->bitmapasociados[1].tambitmap = 892;
currentRoomData->bitmapasociados[1].coordx = 66;
currentRoomData->bitmapasociados[1].coordy = 35;
@@ -1812,7 +1811,7 @@ void pickupScreenObject() {
assembleScreen();
drawScreen(background);
animatePickup2(0, 1);
- playVoc("PLATAF", 375907, 14724);
+ g_engine->_sound->playVoc("PLATAF", 375907, 14724);
currentRoomData->bitmapasociados[0].tambitmap = 892;
currentRoomData->bitmapasociados[0].coordx = 217;
currentRoomData->bitmapasociados[0].coordy = 48;
@@ -2175,7 +2174,7 @@ void useScreenObject() {
case 153: { // oil with well
drawText(regobj.useTextRef);
g_engine->_mouseManager->hide();
- playVoc("BLUP", 330921, 3858);
+ g_engine->_sound->playVoc("BLUP", 330921, 3858);
animateGive(3, 1);
animatePickup2(3, 1);
g_engine->_mouseManager->show();
@@ -2202,7 +2201,7 @@ void useScreenObject() {
}
if (aciertoslista == 5) {
lista1 = false;
- completadalista1 = true;
+ list1Complete = true;
assignText();
hypertext(1018, 255, 0, kaka, false);
hypertext(kaka, 253, 249, kaka, true);
@@ -2254,7 +2253,7 @@ void useScreenObject() {
}
if (aciertoslista == 5) {
lista2 = false;
- completadalista2 = true;
+ list2Complete = true;
assignText();
hypertext(1020, 255, 0, kaka, false);
hypertext(kaka, 253, 249, kaka, true);
@@ -2573,7 +2572,7 @@ void useScreenObject() {
} break;
case 201: {
drawText(regobj.useTextRef);
- playVoc("GALLO", 94965, 46007);
+ g_engine->_sound->playVoc("GALLO", 94965, 46007);
g_engine->_mouseManager->hide();
animatedSequence(5);
replaceBackpack(indicemochila, 423);
@@ -2587,7 +2586,7 @@ void useScreenObject() {
case 219: {
drawText(regobj.useTextRef);
g_engine->_mouseManager->hide();
- playVoc("TAZA", 223698, 29066);
+ g_engine->_sound->playVoc("TAZA", 223698, 29066);
animateGive(3, 2);
do {
g_engine->_chrono->updateChrono();
@@ -2662,7 +2661,7 @@ void useScreenObject() {
g_engine->_mouseManager->hide();
animatePickup1(2, 0);
- playVoc("TIJERAS", 252764, 5242);
+ g_engine->_sound->playVoc("TIJERAS", 252764, 5242);
g_engine->_sound->waitForSoundEnd();
animatePickup2(2, 0);
drawBackpack();
@@ -2671,7 +2670,7 @@ void useScreenObject() {
case 227: {
drawText(regobj.useTextRef);
g_engine->_mouseManager->hide();
- playVoc("ALACENA", 319112, 11809);
+ g_engine->_sound->playVoc("ALACENA", 319112, 11809);
animatePickup1(0, 2);
g_engine->_sound->waitForSoundEnd();
animateOpen2(0, 2);
@@ -2684,7 +2683,7 @@ void useScreenObject() {
case 274: {
drawText(regobj.useTextRef);
g_engine->_mouseManager->hide();
- playVoc("CINCEL", 334779, 19490);
+ g_engine->_sound->playVoc("CINCEL", 334779, 19490);
animatePickup1(direccionmovimiento, 2);
g_engine->_sound->waitForSoundEnd();
animateOpen2(direccionmovimiento, 2);
@@ -2695,10 +2694,10 @@ void useScreenObject() {
case 416: {
updateItem(regobj.code);
g_engine->_mouseManager->hide();
- playVoc("PUERTA", 186429, 4754);
+ g_engine->_sound->playVoc("PUERTA", 186429, 4754);
animatePickup1(0, 1);
animateOpen2(0, 1);
- loadVoc("GOTA", 140972, 1029);
+ g_engine->_sound->loadVoc("GOTA", 140972, 1029);
g_engine->_mouseManager->show();
drawText(regobj.useTextRef);
currentRoomData->doors[2].abiertacerrada = 0;
@@ -2706,7 +2705,7 @@ void useScreenObject() {
case 446: {
drawText(regobj.useTextRef);
g_engine->_mouseManager->hide();
- playVoc("TAZA", 223698, 29066);
+ g_engine->_sound->playVoc("TAZA", 223698, 29066);
animateGive(0, 2);
g_engine->_sound->waitForSoundEnd();
animatePickup2(0, 2);
@@ -2717,7 +2716,7 @@ void useScreenObject() {
case 507: {
g_engine->_mouseManager->hide();
animatePickup1(0, 1);
- playVoc("MAQUINA", 153470, 7378);
+ g_engine->_sound->playVoc("MAQUINA", 153470, 7378);
animateOpen2(0, 1);
updateInventory(indicemochila);
drawBackpack();
@@ -2727,7 +2726,7 @@ void useScreenObject() {
case 549: {
updateItem(regobj.code);
g_engine->_mouseManager->hide();
- playVoc("PUERTA", 186429, 4754);
+ g_engine->_sound->playVoc("PUERTA", 186429, 4754);
animatePickup1(1, 1);
animateOpen2(1, 1);
g_engine->_mouseManager->show();
@@ -2792,7 +2791,7 @@ void useScreenObject() {
updateInventory(indicemochila);
drawBackpack();
currentRoomData->indexadoobjetos[9]->objectName = " ";
- playVoc("PLATAF", 375907, 14724);
+ g_engine->_sound->playVoc("PLATAF", 375907, 14724);
switch (hornacina[0][hornacina[0][3]]) {
case 0: {
currentRoomData->indexadoobjetos[9]->objectName = getObjectName(4);
@@ -2887,7 +2886,7 @@ void useScreenObject() {
updateInventory(indicemochila);
drawBackpack();
currentRoomData->indexadoobjetos[8]->objectName = " ";
- playVoc("PLATAF", 375907, 14724);
+ g_engine->_sound->playVoc("PLATAF", 375907, 14724);
switch (hornacina[1][hornacina[1][3]]) {
case 0: {
currentRoomData->indexadoobjetos[8]->objectName = getObjectName(4);
@@ -3028,7 +3027,7 @@ void useScreenObject() {
g_engine->_mouseManager->show();
goToObject(currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], 14);
g_engine->_mouseManager->hide();
- playVoc("PUFF", 191183, 18001);
+ g_engine->_sound->playVoc("PUFF", 191183, 18001);
// Animate to scythe
debug("Start anim!");
drawFlc(180, 60, offset, 0, 9, 0, false, false, true, basurillalog);
@@ -3081,9 +3080,6 @@ void useScreenObject() {
drawText(regobj.useTextRef);
g_engine->_mouseManager->hide();
- debug("-------------------------------------");
- debug("USING RING WITH PEDESTAL");
- debug("-------------------------------------");
animateGive(3, 1);
loadItem(86, 55, 92, 1591272, 8);
screenHandleToBackground();
@@ -3093,7 +3089,7 @@ void useScreenObject() {
g_engine->_mouseManager->show();
goToObject(currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], 10);
g_engine->_mouseManager->hide();
- playVoc("PUFF", 191183, 18001);
+ g_engine->_sound->playVoc("PUFF", 191183, 18001);
drawFlc(0, 47, offset, 0, 9, 0, false, false, true, basurillalog);
currentRoomData->bitmapasociados[3].puntbitmap = 1591272;
@@ -3177,7 +3173,7 @@ void useScreenObject() {
pulsay = 71 - 7;
goToObject(currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], 3);
g_engine->_mouseManager->hide();
- playVoc("AFILAR", 0, 6433);
+ g_engine->_sound->playVoc("AFILAR", 0, 6433);
drawFlc(160, 15, offset, 0, 9, 23, false, false, true, basurillalog);
replaceBackpack(indicemochila, 715);
drawBackpack();
@@ -3272,7 +3268,7 @@ void useScreenObject() {
drawText(regobj.useTextRef);
g_engine->_mouseManager->hide();
animatePickup1(0, 1);
- playVoc("TIZA", 390631, 18774);
+ g_engine->_sound->playVoc("TIZA", 390631, 18774);
{
RoomBitmapRegister &with = currentRoomData->bitmapasociados[1];
@@ -3288,7 +3284,7 @@ void useScreenObject() {
drawScreen(background);
g_engine->_sound->waitForSoundEnd();
- playVoc("PUFF", 191183, 18001);
+ g_engine->_sound->playVoc("PUFF", 191183, 18001);
animateOpen2(0, 1);
drawFlc(180, 50, offset, 0, 9, 22, false, false, true, basurillalog);
salirdeljuego = true;
@@ -3353,13 +3349,13 @@ void useScreenObject() {
animateOpen2(0, 1);
teleencendida = !(teleencendida);
if (teleencendida) {
- playVoc("CLICK", 27742, 2458);
+ g_engine->_sound->playVoc("CLICK", 27742, 2458);
g_engine->_sound->waitForSoundEnd();
currentRoomData->paletteAnimationFlag = true;
- autoPlayVoc("PARASITO", 355778, 20129);
+ g_engine->_sound->autoPlayVoc("PARASITO", 355778, 20129);
} else {
- stopVoc();
- playVoc("CLICK", 27742, 2458);
+ g_engine->_sound->stopVoc();
+ g_engine->_sound->playVoc("CLICK", 27742, 2458);
currentRoomData->paletteAnimationFlag = false;
for (indicex = 195; indicex <= 200; indicex++) {
pal[indicex * 3 + 0] = 2 << 2;
@@ -3372,14 +3368,14 @@ void useScreenObject() {
} break;
case 347: {
drawText(regobj.useTextRef);
- stopVoc();
- playVoc("CLICK", 27742, 2458);
+ g_engine->_sound->stopVoc();
+ g_engine->_sound->playVoc("CLICK", 27742, 2458);
g_engine->_mouseManager->hide();
animatePickup1(0, 0);
delay(100);
animateOpen2(0, 0);
- stopVoc();
- autoPlayVoc("CALDERA", 6433, 15386);
+ g_engine->_sound->stopVoc();
+ g_engine->_sound->autoPlayVoc("CALDERA", 6433, 15386);
turnLightOn();
g_engine->_mouseManager->show();
currentRoomData->puntpaleta = 1536;
@@ -3388,8 +3384,8 @@ void useScreenObject() {
} break;
case 359: {
drawText(regobj.useTextRef);
- stopVoc();
- playVoc("CARBON", 21819, 5923);
+ g_engine->_sound->stopVoc();
+ g_engine->_sound->playVoc("CARBON", 21819, 5923);
g_engine->_mouseManager->hide();
animatePickup1(0, 0);
delay(100);
@@ -3400,20 +3396,20 @@ void useScreenObject() {
currentRoomData->indexadoobjetos[16]->objectName = getObjectName(2);
currentRoomData->indexadoobjetos[1]->indicefichero = 347;
currentRoomData->indexadoobjetos[1]->objectName = getObjectName(3);
- stopVoc();
- autoPlayVoc("CALDERA", 6433, 15386);
+ g_engine->_sound->stopVoc();
+ g_engine->_sound->autoPlayVoc("CALDERA", 6433, 15386);
} break;
case 682: {
long offsetWithJar = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0][28] : flcOffsets[1][28];
long offsetNoJar = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0][29] : flcOffsets[1][29];
g_engine->_mouseManager->hide();
- playVoc("CLICK", 27742, 2458);
+ g_engine->_sound->playVoc("CLICK", 27742, 2458);
animatePickup1(0, 1);
g_engine->_sound->waitForSoundEnd();
animateOpen2(0, 1);
- playVoc("FUEGO", 72598, 9789);
+ g_engine->_sound->playVoc("FUEGO", 72598, 9789);
if (vasijapuesta) {
drawFlc(108, 0, offsetWithJar, 0, 9, 0, false, false, true, basurillalog);
{
@@ -4033,10 +4029,10 @@ void saveGameToRegister() {
regpartida.longtray = longtray;
regpartida.indicetray = indicetray;
regpartida.codigoobjmochila = codigoobjmochila;
- regpartida.volumenfxderecho = volumenfxderecho;
- regpartida.volumenfxizquierdo = volumenfxizquierdo;
- regpartida.volumenmelodiaderecho = volumenmelodiaderecho;
- regpartida.volumenmelodiaizquierdo = volumenmelodiaizquierdo;
+ regpartida.volumenfxderecho = rightSfxVol;
+ regpartida.volumenfxizquierdo = leftSfxVol;
+ regpartida.volumenmelodiaderecho = musicVolRight;
+ regpartida.volumenmelodiaizquierdo = musicVolLeft;
regpartida.oldxrejilla = oldxrejilla;
regpartida.oldyrejilla = oldyrejilla;
regpartida.animadoprofundidad = animado.profundidad;
@@ -4060,8 +4056,8 @@ void saveGameToRegister() {
regpartida.sello_quitado = sello_quitado;
regpartida.lista1 = lista1;
regpartida.lista2 = lista2;
- regpartida.completadalista1 = completadalista1;
- regpartida.completadalista2 = completadalista2;
+ regpartida.completadalista1 = list1Complete;
+ regpartida.completadalista2 = list2Complete;
regpartida.vasijapuesta = vasijapuesta;
regpartida.guadagna = guadagna;
regpartida.tridente = tridente;
@@ -4130,10 +4126,10 @@ void loadGame(regispartida game) {
longtray = game.longtray;
indicetray = game.indicetray;
codigoobjmochila = game.codigoobjmochila;
- volumenfxderecho = game.volumenfxderecho;
- volumenfxizquierdo = game.volumenfxizquierdo;
- volumenmelodiaderecho = game.volumenmelodiaderecho;
- volumenmelodiaizquierdo = game.volumenmelodiaizquierdo;
+ rightSfxVol = game.volumenfxderecho;
+ leftSfxVol = game.volumenfxizquierdo;
+ musicVolRight = game.volumenmelodiaderecho;
+ musicVolLeft = game.volumenmelodiaizquierdo;
oldxrejilla = game.oldxrejilla;
oldyrejilla = game.oldyrejilla;
animado.profundidad = game.animadoprofundidad;
@@ -4161,8 +4157,8 @@ void loadGame(regispartida game) {
sello_quitado = game.sello_quitado;
lista1 = game.lista1;
lista2 = game.lista2;
- completadalista1 = game.completadalista1;
- completadalista2 = game.completadalista2;
+ list1Complete = game.completadalista1;
+ list2Complete = game.completadalista2;
vasijapuesta = game.vasijapuesta;
guadagna = game.guadagna;
if (contadorpc > 24)
@@ -4224,22 +4220,22 @@ void loadGame(regispartida game) {
switch (currentRoomData->codigo) {
case 2: {
if (teleencendida)
- autoPlayVoc("PARASITO", 355778, 20129);
+ g_engine->_sound->autoPlayVoc("PARASITO", 355778, 20129);
else
cargatele();
- setSfxVolume(volumenfxizquierdo, volumenfxderecho);
+ g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
} break;
case 4: {
- loadVoc("GOTA", 140972, 1029);
- setSfxVolume(volumenfxizquierdo, volumenfxderecho);
+ g_engine->_sound->loadVoc("GOTA", 140972, 1029);
+ g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
} break;
case 5: {
- setSfxVolume(volumenfxizquierdo, 0);
- autoPlayVoc("CALDERA", 6433, 15386);
+ g_engine->_sound->setSfxVolume(leftSfxVol, 0);
+ g_engine->_sound->autoPlayVoc("CALDERA", 6433, 15386);
} break;
case 6: {
- setSfxVolume(volumenfxizquierdo, volumenfxderecho);
- autoPlayVoc("CALDERA", 6433, 15386);
+ g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
+ g_engine->_sound->autoPlayVoc("CALDERA", 6433, 15386);
} break;
case 17: {
if (libro[0] == true && currentRoomData->animationFlag)
@@ -4262,8 +4258,8 @@ void loadGame(regispartida game) {
}
} break;
case 23: {
- autoPlayVoc("Fuente", 0, 0);
- setSfxVolume(volumenfxizquierdo, volumenfxderecho);
+ g_engine->_sound->autoPlayVoc("Fuente", 0, 0);
+ g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
} break;
case 24: {
switch (hornacina[1][hornacina[1][3]]) {
@@ -4877,7 +4873,7 @@ void hypertext(
else
movidapaleta += 1;
if (currentRoomData->codigo == 4 && movidapaleta == 4)
- pitavocmem();
+ g_engine->_sound->playVoc();
updatePalette(movidapaleta);
} else
saltospal += 1;
@@ -4928,7 +4924,7 @@ void wcScene() {
outtextxy(50, 90, messages[48], 248);
delay(1000);
- playVoc("WATER", 272050, 47062);
+ g_engine->_sound->playVoc("WATER", 272050, 47062);
bar(50, 90, 200, 100, 0);
delay(4000);
diff --git a/engines/tot/routines.h b/engines/tot/routines.h
index 4914076de71..58b46b277cf 100644
--- a/engines/tot/routines.h
+++ b/engines/tot/routines.h
@@ -27,7 +27,6 @@
#include "tot/graphics.h"
#include "tot/playanim.h"
#include "tot/routines2.h"
-#include "tot/sound.h"
#include "tot/util.h"
namespace Tot {
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
index 3d382d960d7..ba70b6b338c 100644
--- a/engines/tot/routines2.cpp
+++ b/engines/tot/routines2.cpp
@@ -354,7 +354,8 @@ void freeScreenObjects() {
void freeAnimation() {
if (animacion2) {
animacion2 = false;
- free(pasoanimado);
+ if(pasoanimado)
+ free(pasoanimado);
pasoanimado = NULL;
}
}
@@ -721,7 +722,7 @@ static void loadDiploma(Common::String &nombrefoto, Common::String &clave) {
outtextxyBios(30, 140, messages[54], 15);
outtextxyBios(30, 160, messages[55], 15);
delay(1500);
- playVoc("PORTAZO", 434988, 932);
+ g_engine->_sound->playVoc("PORTAZO", 434988, 932);
// putShape(270, 161, (byte *)sello);
putShape(270, 159, sello);
free(sello);
@@ -1673,10 +1674,10 @@ void credits() {
g_engine->_mouseManager->hide();
totalFadeOut(0);
- fadeOutMusic(volumenmelodiaizquierdo, volumenmelodiaderecho);
+ g_engine->_sound->fadeOutMusic(musicVolLeft, musicVolRight);
cleardevice();
- playMidiFile("CREDITOS", true);
- fadeInMusic(volumenmelodiaizquierdo, volumenmelodiaderecho);
+ g_engine->_sound->playMidi("CREDITOS", true);
+ g_engine->_sound->fadeInMusic(musicVolLeft, musicVolRight);
drawCreditsScreen(fondopp, sizefondo2, fondo2);
salirpitando = false;
@@ -1747,10 +1748,10 @@ void credits() {
Lsalida:
delay(1000);
totalFadeOut(0);
- fadeOutMusic(volumenmelodiaizquierdo, volumenmelodiaderecho);
+ g_engine->_sound->fadeOutMusic(musicVolLeft, musicVolRight);
cleardevice();
- playMidiFile("INTRODUC", true);
- fadeInMusic(volumenmelodiaizquierdo, volumenmelodiaderecho);
+ g_engine->_sound->playMidi("INTRODUC", true);
+ g_engine->_sound->fadeInMusic(musicVolLeft, musicVolRight);
g_engine->_mouseManager->show();
free(fondopp);
free(fondo2);
@@ -1905,7 +1906,7 @@ void initialLogo() {
void initialMenu(bool fundido) {
bool kklogica = false;
bool opcionvalida = false;
- stopVoc();
+ g_engine->_sound->stopVoc();
long offset = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0][1] : flcOffsets[1][1];
@@ -2230,8 +2231,8 @@ void soundControls() {
getImg(86, 31, 234, 44, sliderBackground1);
getImg(86, 76, 234, 89, sliderBackground2);
- volumenfx = round(((volumenfxderecho + volumenfxizquierdo) / 2) * 20);
- volumenmelodia = round(((volumenmelodiaderecho + volumenmelodiaizquierdo) / 2) * 20);
+ volumenfx = round(((rightSfxVol + leftSfxVol) / 2) * 20);
+ volumenmelodia = round(((musicVolRight + musicVolLeft) / 2) * 20);
putImg(volumenfx + 86, 31, slider);
putImg(volumenmelodia + 86, 76, slider);
@@ -2290,9 +2291,9 @@ void soundControls() {
volumenfx = xfade - 86;
debug("volumefx=%d", volumenfx);
- volumenfxderecho = round((float)volumenfx / 20);
- volumenfxizquierdo = round((float)volumenfx / 20);
- setSfxVolume(volumenfxizquierdo, volumenfxderecho);
+ rightSfxVol = round((float)volumenfx / 20);
+ leftSfxVol = round((float)volumenfx / 20);
+ g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
}
g_engine->_screen->update();
} while (!mouseReleased);
@@ -2320,9 +2321,9 @@ void soundControls() {
putImg(86, 76, sliderBackground2);
putImg(xfade, 76, slider);
volumenmelodia = xfade - 86;
- volumenmelodiaderecho = round((float)(volumenmelodia) / 20);
- volumenmelodiaizquierdo = round((float)(volumenmelodia) / 20);
- setMidiVolume(volumenmelodiaizquierdo, volumenmelodiaderecho);
+ musicVolRight = round((float)(volumenmelodia) / 20);
+ musicVolLeft = round((float)(volumenmelodia) / 20);
+ g_engine->_sound->setMidiVolume(musicVolLeft, musicVolRight);
}
g_engine->_screen->update();
} while (!mouseReleased);
@@ -2363,7 +2364,7 @@ void sacrificeScene() {
const long *offsets = (isSpanish) ? flcOffsets[0] : flcOffsets[1];
- stopVoc();
+ g_engine->_sound->stopVoc();
bool pulsada_salida = currentRoomData->paletteAnimationFlag;
currentRoomData->paletteAnimationFlag = false;
@@ -2457,21 +2458,21 @@ void sacrificeScene() {
// We dont have the width and height here in the byte buffer
drawScreen(background, false);
partialFadeIn(234);
- stopVoc();
+ g_engine->_sound->stopVoc();
if (g_engine->shouldQuit())
return;
drawFlc(0, 0, offsets[17], 0, 9, 19, false, false, true, pulsada_salida);
totalFadeOut(128);
- stopVoc();
+ g_engine->_sound->stopVoc();
delay(1000);
if (g_engine->shouldQuit())
return;
- fadeOutMusic(volumenmelodiaizquierdo, volumenmelodiaderecho);
- playMidiFile("SACRIFIC", true);
- fadeInMusic(volumenmelodiaizquierdo, volumenmelodiaderecho);
+ g_engine->_sound->fadeOutMusic(musicVolLeft, musicVolRight);
+ g_engine->_sound->playMidi("SACRIFIC", true);
+ g_engine->_sound->fadeInMusic(musicVolLeft, musicVolRight);
clear();
outtextxy(10, 31, messages[23], 254);
@@ -2530,7 +2531,7 @@ void sacrificeScene() {
redFadeIn(palaux);
drawFlc(112, 57, offsets[18], 33, 9, 20, true, false, true, pulsada_salida);
- autoPlayVoc("REZOS", 0, 0);
+ g_engine->_sound->autoPlayVoc("REZOS", 0, 0);
if (g_engine->shouldQuit())
return;
@@ -2540,7 +2541,7 @@ void sacrificeScene() {
return;
totalFadeOut(128);
- stopVoc();
+ g_engine->_sound->stopVoc();
clear();
outtextxy(10, 21, messages[26], 254);
@@ -2722,7 +2723,7 @@ void sacrificeScene() {
void ending() {
saveAllowed = false;
- bool pulsada_salida;
+ bool exitRequested;
const char *const *messages = (g_engine->_lang == Common::ES_ESP) ? fullScreenMessages[0] : fullScreenMessages[1];
const long *offsets = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0] : flcOffsets[1];
@@ -2748,19 +2749,19 @@ void ending() {
if(g_engine->shouldQuit()) {
return;
}
- fadeOutMusic(volumenmelodiaizquierdo, volumenmelodiaderecho);
- playMidiFile("SACRIFIC", true);
- fadeInMusic(volumenmelodiaizquierdo, volumenmelodiaderecho);
- drawFlc(0, 0, offsets[30], 12, 9, 26, true, false, false, pulsada_salida);
- if(pulsada_salida){
+ g_engine->_sound->fadeOutMusic(musicVolLeft, musicVolRight);
+ g_engine->_sound->playMidi("SACRIFIC", true);
+ g_engine->_sound->fadeInMusic(musicVolLeft, musicVolRight);
+ drawFlc(0, 0, offsets[30], 12, 9, 26, true, false, false, exitRequested);
+ if(exitRequested){
return;
}
- drawFlc(0, 0, offsets[31], 0, 9, 0, false, false, false, pulsada_salida);
- if(pulsada_salida){
+ drawFlc(0, 0, offsets[31], 0, 9, 0, false, false, false, exitRequested);
+ if(exitRequested){
return;
}
delay(1000);
- playVoc("NOOO", 0, 0);
+ g_engine->_sound->playVoc("NOOO", 0, 0);
delay(3000);
saveAllowed = true;
}
diff --git a/engines/tot/routines2.h b/engines/tot/routines2.h
index dc9adf2fcd4..757cfc71e08 100644
--- a/engines/tot/routines2.h
+++ b/engines/tot/routines2.h
@@ -24,7 +24,6 @@
#include "tot/anims.h"
#include "tot/graphics.h"
#include "tot/playanim.h"
-#include "tot/sound.h"
#include "tot/util.h"
namespace Tot {
diff --git a/engines/tot/sound.cpp b/engines/tot/sound.cpp
deleted file mode 100644
index abe7f4c1a70..00000000000
--- a/engines/tot/sound.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "common/file.h"
-#include "common/textconsole.h"
-
-#include "tot/sound.h"
-#include "tot/tot.h"
-
-namespace Tot {
-
-byte *currentMidi;
-
-void stopVoc() {
- g_engine->_sound->stopVoc();
-}
-
-void setSfxVolume(byte voll, byte volr) {
-
- if (voll == volr) {
- int volume = (voll) / (float)7 * 255;
- g_engine->_sound->setSfxVolume(volume);
- g_engine->_sound->setSfxBalance(true, true);
- } else {
- if (voll == 0) {
- g_engine->_sound->setSfxBalance(false, true);
- } else {
- g_engine->_sound->setSfxBalance(true, false);
- }
- }
-}
-
-void setMidiVolume(byte voll, byte volr) {
- int volume = (voll) / (float)7 * 255;
- g_engine->_sound->setMusicVolume(volume);
-}
-
-void fadeOutMusic(byte voll, byte volr) {
- byte volpaso = (voll + volr) / 2;
- for (int ivol = volpaso; ivol >= 0; ivol--) {
- setMidiVolume(ivol, ivol);
- delay(10);
- }
-}
-
-void fadeInMusic(byte voll, byte volr) {
- byte ivol, volpaso;
-
- volpaso = (voll + volr) / 2;
- for (ivol = 0; ivol <= volpaso; ivol++) {
- setMidiVolume(ivol, ivol);
- delay(10);
- }
-}
-
-void setMasterVolume(byte voll, byte volr) {
-}
-
-void loadVoc(Common::String vocFile, int32 startPos, uint vocSize) {
- g_engine->_sound->loadVoc(vocFile, startPos, vocSize);
-}
-
-void autoPlayVoc(Common::String vocFile, int32 startPos, uint vocSize) {
- g_engine->_sound->loadVoc(vocFile, startPos, vocSize);
- g_engine->_sound->autoPlayVoc();
-}
-
-void pitavocmem() {
- g_engine->_sound->playVoc();
-}
-
-void playVoc(Common::String vocFile, int32 startPos, uint vocSize) {
- loadVoc(vocFile, startPos, vocSize);
- pitavocmem();
-}
-
-void playMidiFile(Common::String nomfich, bool loop) {
-
- Common::File musicFile;
- if (!musicFile.open(Common::Path(nomfich + ".MUS"))) {
- showError(267);
- }
- currentMidi = (byte *)malloc(musicFile.size());
- musicFile.read(currentMidi, musicFile.size());
-
- g_engine->_sound->playMidi(currentMidi, musicFile.size(), true);
- musicFile.close();
-}
-
-void initSound() {
- setMidiVolume(3, 3);
- playMidiFile("Silent", false);
- setSfxVolume(6, 6);
-}
-} // End of namespace Tot
diff --git a/engines/tot/sound.h b/engines/tot/sound.h
deleted file mode 100644
index 7de6df4b2e7..00000000000
--- a/engines/tot/sound.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-#ifndef TOT__SOUND_H__
-#define TOT__SOUND_H__
-
-#include "util.h"
-
-namespace Tot {
-
-void initSound();
-void setSfxVolume(byte voll, byte volr);
-void setMidiVolume(byte voll, byte volr);
-void fadeOutMusic(byte voll, byte volr);
-void fadeInMusic(byte voll, byte volr);
-void setMasterVolume(byte voll, byte volr);
-void loadVoc(Common::String vocFile, int32 startPos, uint vocSize);
-void autoPlayVoc(Common::String vocFile, int32 startPos, uint vocSize);
-void pitavocmem();
-void playVoc(Common::String vocFile, int32 startPos, uint vocSize);
-void stopVoc();
-void playMidiFile(Common::String nomfich, bool loop);
-void pitamidmem();
-void loopactivo(bool mid_loop);
-} // End of namespace Tot
-
-#endif
diff --git a/engines/tot/soundman.cpp b/engines/tot/soundman.cpp
index 4398d338ed9..c72620d2883 100644
--- a/engines/tot/soundman.cpp
+++ b/engines/tot/soundman.cpp
@@ -27,10 +27,9 @@
#include "audio/mixer.h"
#include "audio/softsynth/pcspk.h"
#include "common/config-manager.h"
-#include "common/substream.h"
#include "common/memstream.h"
+#include "common/substream.h"
-#include "soundman.h"
#include "tot/soundman.h"
#include "tot/tot.h"
#include "tot/util.h"
@@ -39,7 +38,6 @@ namespace Tot {
SoundManager::SoundManager(Audio::Mixer *mixer) : _mixer(mixer) {
-
_midiPlayer = new MidiPlayer();
_midiPlayer->open();
@@ -50,18 +48,23 @@ SoundManager::SoundManager(Audio::Mixer *mixer) : _mixer(mixer) {
_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, 100);
}
SoundManager::~SoundManager() {
- // delete _musicPlayer;
- if(_midiPlayer)
+ if (_midiPlayer)
delete _midiPlayer;
free(_lastSrcStream);
free(_audioStream);
}
-void SoundManager::loadVoc(Common::String fileName, long offset, int16 size) {
+void SoundManager::init() {
+ setMidiVolume(3, 3);
+ playMidi("SILENT", false);
+ setSfxVolume(6, 6);
+}
+
+void SoundManager::loadVoc(Common::String vocFile, long startPos, int16 size) {
Common::File vocResource;
if (size == 0) {
- if (!vocResource.open(Common::Path(fileName + ".VOC"))) {
+ if (!vocResource.open(Common::Path(vocFile + ".VOC"))) {
showError(266);
}
@@ -71,12 +74,14 @@ void SoundManager::loadVoc(Common::String fileName, long offset, int16 size) {
if (!vocResource.open("EFECTOS.DAT")) {
showError(266);
}
- vocResource.seek(offset);
+ vocResource.seek(startPos);
_lastSrcStream = vocResource.readStream((uint32)size);
}
_audioStream = Audio::makeVOCStream(_lastSrcStream, Audio::FLAG_UNSIGNED, DisposeAfterUse::NO);
}
-void SoundManager::autoPlayVoc() {
+
+void SoundManager::autoPlayVoc(Common::String vocFile, int32 startPos, int16 vocSize) {
+ loadVoc(vocFile, startPos, vocSize);
_mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundHandle, Audio::makeLoopingAudioStream(_audioStream, 0), kSfxId, 255U, 0, DisposeAfterUse::NO);
}
@@ -86,6 +91,11 @@ void SoundManager::playVoc() {
_audioStream->rewind();
}
+void SoundManager::playVoc(Common::String vocFile, int32 startPos, uint vocSize) {
+ loadVoc(vocFile, startPos, vocSize);
+ playVoc();
+}
+
void SoundManager::stopVoc() {
_mixer->stopHandle(_soundHandle);
}
@@ -101,18 +111,19 @@ bool SoundManager::isVocPlaying() {
return _mixer->isSoundIDActive(kSfxId);
}
-void SoundManager::playMidi(const char *fileName, bool loop) {
+void SoundManager::playMidi(Common::String fileName, bool loop) {
Common::File musicFile;
- debug("Opening music file %s", fileName);
- musicFile.open(fileName);
+ debug("Opening music file %s", fileName.c_str());
+ musicFile.open(Common::Path(fileName + ".MUS"));
if (!musicFile.isOpen()) {
showError(267);
return;
}
- _midiPlayer->load(&musicFile, musicFile.size());
- _midiPlayer->setLoop(loop);
- _midiPlayer->play(0);
-
+ byte *curMidi = (byte *)malloc(musicFile.size());
+ musicFile.read(curMidi, musicFile.size());
+ playMidi(curMidi, musicFile.size(), loop);
+ musicFile.close();
+ free(curMidi);
}
void SoundManager::playMidi(byte *data, int size, bool loop) {
@@ -138,8 +149,48 @@ void SoundManager::beep(int32 frequency, int32 ms) {
true);
}
-void SoundManager::setSfxVolume(int volume) {
- debug("Setting sfx volume to =%d", volume);
+void SoundManager::setSfxVolume(byte voll, byte volr) {
+
+ if (voll == volr) {
+ int volume = (voll) / (float)7 * 255;
+ setSfxVolume(volume);
+ setSfxBalance(true, true);
+ } else {
+ if (voll == 0) {
+ setSfxBalance(false, true);
+ } else {
+ setSfxBalance(true, false);
+ }
+ }
+}
+
+void SoundManager::setMidiVolume(byte voll, byte volr) {
+ int volume = (voll) / (float)7 * 255;
+ setMusicVolume(volume);
+}
+
+void SoundManager::fadeOutMusic(byte voll, byte volr) {
+ byte stepVol = (voll + volr) / 2;
+ for (int ivol = stepVol; ivol >= 0; ivol--) {
+ setMidiVolume(ivol, ivol);
+ delay(10);
+ }
+}
+
+void SoundManager::fadeInMusic(byte voll, byte volr) {
+ byte ivol, stepVol;
+
+ stepVol = (voll + volr) / 2;
+ for (ivol = 0; ivol <= stepVol; ivol++) {
+ setMidiVolume(ivol, ivol);
+ delay(10);
+ }
+}
+
+void SoundManager::setMasterVolume(byte voll, byte volr) {
+}
+
+void SoundManager::setSfxVolume(byte volume) {
_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, volume);
ConfMan.setInt("sfx_volume", volume);
ConfMan.flushToDisk();
@@ -150,9 +201,7 @@ void SoundManager::setSfxBalance(bool left, bool right) {
_mixer->setChannelBalance(_soundHandle, balance);
}
-void SoundManager::setMusicVolume(int volume) {
-
- // debug("Setting music volume to =%d", volume);
+void SoundManager::setMusicVolume(byte volume) {
_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, volume);
ConfMan.setInt("music_volume", volume);
ConfMan.flushToDisk();
diff --git a/engines/tot/soundman.h b/engines/tot/soundman.h
index 7280f7df8d7..c04d6ddde03 100644
--- a/engines/tot/soundman.h
+++ b/engines/tot/soundman.h
@@ -38,21 +38,30 @@ class SoundManager {
public:
SoundManager(Audio::Mixer *mixer);
~SoundManager();
- void loadVoc(Common::String fileName, long posinicio, int16 tamvocleer);
- void autoPlayVoc();
+
+ void init();
+ void loadVoc(Common::String vocFile, long startPos, int16 vocSize);
+ void autoPlayVoc(Common::String vocFile, int32 startPos, int16 vocSize);
+ void playVoc(Common::String vocFile, int32 startPos, uint vocSize);
void playVoc();
void stopVoc();
bool isVocPlaying();
- void playMidi(const char *fileName, bool loop);
+ void playMidi(Common::String fileName, bool loop);
void playMidi(byte *data, int size, bool loop);
void toggleMusic();
void beep(int32 frequency, int32 ms);
void waitForSoundEnd();
- void setSfxVolume(int volume);
- void setMusicVolume(int volume);
+ void setSfxVolume(byte leftVol, byte rightVol);
+ void setMidiVolume(byte leftVol, byte rightVol);
+ void fadeOutMusic(byte leftVol, byte rightVol);
+ void fadeInMusic(byte leftVol, byte rightVol);
+ void setMasterVolume(byte leftVol, byte rightVol);
void setSfxBalance(bool left, bool right);
private:
+ void setSfxVolume(byte volume);
+ void setMusicVolume(byte volume);
+
Audio::SoundHandle _soundHandle;
Audio::SoundHandle _speakerHandle;
Audio::Mixer *_mixer;
diff --git a/engines/tot/tot.cpp b/engines/tot/tot.cpp
index e91179bbb62..b055baef08c 100644
--- a/engines/tot/tot.cpp
+++ b/engines/tot/tot.cpp
@@ -81,7 +81,7 @@ Common::Error TotEngine::run() {
// _room = new RoomManager();
_mouseManager = new MouseManager();
- initSound();
+ _sound->init();
initGraph();
initPlayAnim();
Commit: a69d30964c0a7c78fe350b3191a6223ce8a3322a
https://github.com/scummvm/scummvm/commit/a69d30964c0a7c78fe350b3191a6223ce8a3322a
Author: gsanmartin (gabriel.sanmartin at dna.inc)
Date: 2025-09-08T16:49:49+02:00
Commit Message:
TOT: Cleanup of graphics
Changed paths:
engines/tot/anims.cpp
engines/tot/console.cpp
engines/tot/dialog.cpp
engines/tot/game.cpp
engines/tot/graphics.cpp
engines/tot/graphics.h
engines/tot/graphman.cpp
engines/tot/graphman.h
engines/tot/mouseman.cpp
engines/tot/playanim.cpp
engines/tot/playanim.h
engines/tot/routines.cpp
engines/tot/routines.h
engines/tot/routines2.cpp
engines/tot/routines2.h
engines/tot/saveload.cpp
engines/tot/texts.h
engines/tot/util.cpp
engines/tot/util.h
diff --git a/engines/tot/anims.cpp b/engines/tot/anims.cpp
index 70761a244c0..11242e0ca09 100644
--- a/engines/tot/anims.cpp
+++ b/engines/tot/anims.cpp
@@ -46,39 +46,39 @@ bool primeravuelta;
void drawText(uint xfrase, uint yfrase, Common::String str1, Common::String str2, Common::String str3, Common::String str4, Common::String str5, byte colorfrase, byte colorborde) {
- outtextxy(xfrase, (yfrase + 3), str1, colorborde);
- outtextxy(xfrase, (yfrase + 13), str2, colorborde);
- outtextxy(xfrase, (yfrase + 23), str3, colorborde);
- outtextxy(xfrase, (yfrase + 33), str4, colorborde);
- outtextxy(xfrase, (yfrase + 43), str5, colorborde);
+ littText(xfrase, (yfrase + 3), str1, colorborde);
+ littText(xfrase, (yfrase + 13), str2, colorborde);
+ littText(xfrase, (yfrase + 23), str3, colorborde);
+ littText(xfrase, (yfrase + 33), str4, colorborde);
+ littText(xfrase, (yfrase + 43), str5, colorborde);
g_engine->_screen->update();
delay(enforcedTextAnimDelay);
- outtextxy(xfrase, (yfrase + 1), str1, colorborde);
- outtextxy(xfrase, (yfrase + 11), str2, colorborde);
- outtextxy(xfrase, (yfrase + 21), str3, colorborde);
- outtextxy(xfrase, (yfrase + 31), str4, colorborde);
- outtextxy(xfrase, (yfrase + 41), str5, colorborde);
+ littText(xfrase, (yfrase + 1), str1, colorborde);
+ littText(xfrase, (yfrase + 11), str2, colorborde);
+ littText(xfrase, (yfrase + 21), str3, colorborde);
+ littText(xfrase, (yfrase + 31), str4, colorborde);
+ littText(xfrase, (yfrase + 41), str5, colorborde);
g_engine->_screen->update();
delay(enforcedTextAnimDelay);
- outtextxy(xfrase + 1, (yfrase + 2), str1, colorborde);
- outtextxy(xfrase + 1, (yfrase + 12), str2, colorborde);
- outtextxy(xfrase + 1, (yfrase + 22), str3, colorborde);
- outtextxy(xfrase + 1, (yfrase + 32), str4, colorborde);
- outtextxy(xfrase + 1, (yfrase + 42), str5, colorborde);
+ littText(xfrase + 1, (yfrase + 2), str1, colorborde);
+ littText(xfrase + 1, (yfrase + 12), str2, colorborde);
+ littText(xfrase + 1, (yfrase + 22), str3, colorborde);
+ littText(xfrase + 1, (yfrase + 32), str4, colorborde);
+ littText(xfrase + 1, (yfrase + 42), str5, colorborde);
g_engine->_screen->update();
delay(enforcedTextAnimDelay);
- outtextxy(xfrase - 1, (yfrase + 2), str1, colorborde);
- outtextxy(xfrase - 1, (yfrase + 12), str2, colorborde);
- outtextxy(xfrase - 1, (yfrase + 22), str3, colorborde);
- outtextxy(xfrase - 1, (yfrase + 32), str4, colorborde);
- outtextxy(xfrase - 1, (yfrase + 42), str5, colorborde);
+ littText(xfrase - 1, (yfrase + 2), str1, colorborde);
+ littText(xfrase - 1, (yfrase + 12), str2, colorborde);
+ littText(xfrase - 1, (yfrase + 22), str3, colorborde);
+ littText(xfrase - 1, (yfrase + 32), str4, colorborde);
+ littText(xfrase - 1, (yfrase + 42), str5, colorborde);
g_engine->_screen->update();
delay(enforcedTextAnimDelay);
- outtextxy(xfrase, (yfrase + 2), str1, colorfrase);
- outtextxy(xfrase, (yfrase + 12), str2, colorfrase);
- outtextxy(xfrase, (yfrase + 22), str3, colorfrase);
- outtextxy(xfrase, (yfrase + 32), str4, colorfrase);
- outtextxy(xfrase, (yfrase + 42), str5, colorfrase);
+ littText(xfrase, (yfrase + 2), str1, colorfrase);
+ littText(xfrase, (yfrase + 12), str2, colorfrase);
+ littText(xfrase, (yfrase + 22), str3, colorfrase);
+ littText(xfrase, (yfrase + 32), str4, colorfrase);
+ littText(xfrase, (yfrase + 42), str5, colorfrase);
g_engine->_screen->update();
}
@@ -332,7 +332,7 @@ void handleFlcEvent(byte numero_del_evento) {
g_engine->_sound->playVoc("PORTAZO", 434988, 932);
break;
case 60:
- getImg(0, 0, 319, 29, punterofondofrase);
+ g_engine->_graphics->getImg(0, 0, 319, 29, punterofondofrase);
break;
}
break;
@@ -352,7 +352,7 @@ void handleFlcEvent(byte numero_del_evento) {
messages[104],
255, 249);
delay(3500);
- putImg(0, 0, punterofondofrase);
+ g_engine->_graphics->putImg(0, 0, punterofondofrase);
drawText(5, 1,
messages[105],
messages[106],
@@ -364,7 +364,7 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 6:
if ((numerovuelta == 1) && (framecontador == 3)) {
- putImg(0, 0, punterofondofrase);
+ g_engine->_graphics->putImg(0, 0, punterofondofrase);
drawText(5, 1,
messages[110],
messages[111],
@@ -374,7 +374,7 @@ void handleFlcEvent(byte numero_del_evento) {
255, 249);
}
else if ((numerovuelta == 5) && (framecontador == 3)) {
- putImg(0, 0, punterofondofrase);
+ g_engine->_graphics->putImg(0, 0, punterofondofrase);
drawText(5, 1,
messages[275],
messages[276],
@@ -386,7 +386,7 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 7:
if ((numerovuelta == 1) && (framecontador == 3)) {
- putImg(0, 0, punterofondofrase);
+ g_engine->_graphics->putImg(0, 0, punterofondofrase);
drawText(5, 1,
messages[115],
messages[116],
@@ -398,7 +398,7 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 8:
if ((numerovuelta == 1) && (framecontador == 3)) {
- putImg(0, 0, punterofondofrase);
+ g_engine->_graphics->putImg(0, 0, punterofondofrase);
drawText(5, 1,
messages[120],
messages[121],
@@ -408,7 +408,7 @@ void handleFlcEvent(byte numero_del_evento) {
255, 249);
}
else if ((numerovuelta == 5) && (framecontador == 3)) {
- putImg(0, 0, punterofondofrase);
+ g_engine->_graphics->putImg(0, 0, punterofondofrase);
drawText(5, 1,
messages[280],
messages[281],
@@ -420,7 +420,7 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 9:
if ((numerovuelta == 1) && (framecontador == 3)) {
- putImg(0, 0, punterofondofrase);
+ g_engine->_graphics->putImg(0, 0, punterofondofrase);
drawText(5, 1,
messages[125],
messages[126],
@@ -432,7 +432,7 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 10:
if ((numerovuelta == 1) && (framecontador == 3)) {
- putImg(0, 0, punterofondofrase);
+ g_engine->_graphics->putImg(0, 0, punterofondofrase);
drawText(5, 1,
messages[130],
messages[131],
@@ -444,7 +444,7 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 11:
if ((numerovuelta == 1) && (framecontador == 3)) {
- putImg(0, 0, punterofondofrase);
+ g_engine->_graphics->putImg(0, 0, punterofondofrase);
drawText(5, 1,
messages[135],
messages[136],
@@ -456,7 +456,7 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 12:
if ((numerovuelta == 1) && (framecontador == 3)) {
- putImg(0, 0, punterofondofrase);
+ g_engine->_graphics->putImg(0, 0, punterofondofrase);
drawText(5, 1,
messages[140],
messages[141],
@@ -468,7 +468,7 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 13:
if ((numerovuelta == 1) && (framecontador == 3)) {
- putImg(0, 0, punterofondofrase);
+ g_engine->_graphics->putImg(0, 0, punterofondofrase);
drawText(5, 1,
messages[145],
messages[146],
@@ -480,7 +480,7 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 14:
if ((numerovuelta == 1) && (framecontador == 3)) {
- putImg(0, 0, punterofondofrase);
+ g_engine->_graphics->putImg(0, 0, punterofondofrase);
drawText(5, 1,
messages[150],
messages[151],
@@ -490,7 +490,7 @@ void handleFlcEvent(byte numero_del_evento) {
255, 249);
}
else if ((numerovuelta == 5) && (framecontador == 3)) {
- putImg(0, 0, punterofondofrase);
+ g_engine->_graphics->putImg(0, 0, punterofondofrase);
drawText(5, 1,
messages[285],
messages[286],
@@ -502,7 +502,7 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 15:
if ((numerovuelta == 1) && (framecontador == 3)) {
- putImg(0, 0, punterofondofrase);
+ g_engine->_graphics->putImg(0, 0, punterofondofrase);
drawText(5, 1,
messages[155],
messages[156],
@@ -514,7 +514,7 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 16:
if ((numerovuelta == 1) && (framecontador == 3)) {
- putImg(0, 0, punterofondofrase);
+ g_engine->_graphics->putImg(0, 0, punterofondofrase);
drawText(5, 1,
messages[160],
messages[161],
@@ -527,7 +527,7 @@ void handleFlcEvent(byte numero_del_evento) {
case 17:
switch (framecontador) {
case 1:
- putImg(0, 0, punterofondofrase);
+ g_engine->_graphics->putImg(0, 0, punterofondofrase);
break;
case 17:
delay(500);
@@ -539,7 +539,7 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 18:
if ((numerovuelta == 1) && (framecontador == 3)) {
- putImg(0, 0, punterofondofrase);
+ g_engine->_graphics->putImg(0, 0, punterofondofrase);
drawText(5, 1,
messages[165],
messages[166],
@@ -564,7 +564,7 @@ void handleFlcEvent(byte numero_del_evento) {
case 1:
switch (framecontador) {
case 1:
- getImg(0, 0, 319, 69, punterofondofrase);
+ g_engine->_graphics->getImg(0, 0, 319, 69, punterofondofrase);
break;
case 3:
drawText(15, 1,
@@ -580,7 +580,7 @@ void handleFlcEvent(byte numero_del_evento) {
case 3:
switch (framecontador) {
case 1:
- putImg(0, 0, punterofondofrase);
+ g_engine->_graphics->putImg(0, 0, punterofondofrase);
break;
case 3:
drawText(15, 1,
@@ -596,7 +596,7 @@ void handleFlcEvent(byte numero_del_evento) {
case 6:
switch (framecontador) {
case 1:
- putImg(0, 0, punterofondofrase);
+ g_engine->_graphics->putImg(0, 0, punterofondofrase);
break;
case 3:
drawText(15, 1,
@@ -612,7 +612,7 @@ void handleFlcEvent(byte numero_del_evento) {
case 9:
switch (framecontador) {
case 1:
- putImg(0, 0, punterofondofrase);
+ g_engine->_graphics->putImg(0, 0, punterofondofrase);
break;
case 3:
drawText(15, 1,
@@ -628,7 +628,7 @@ void handleFlcEvent(byte numero_del_evento) {
case 12:
switch (framecontador) {
case 1:
- putImg(0, 0, punterofondofrase);
+ g_engine->_graphics->putImg(0, 0, punterofondofrase);
break;
case 3:
drawText(15, 1,
@@ -644,7 +644,7 @@ void handleFlcEvent(byte numero_del_evento) {
case 15:
switch (framecontador) {
case 1:
- putImg(0, 0, punterofondofrase);
+ g_engine->_graphics->putImg(0, 0, punterofondofrase);
break;
case 3:
drawText(15, 1,
@@ -660,7 +660,7 @@ void handleFlcEvent(byte numero_del_evento) {
case 18:
switch (framecontador) {
case 1:
- putImg(0, 0, punterofondofrase);
+ g_engine->_graphics->putImg(0, 0, punterofondofrase);
break;
case 3:
drawText(15, 1,
@@ -676,7 +676,7 @@ void handleFlcEvent(byte numero_del_evento) {
case 21:
switch (framecontador) {
case 1:
- putImg(0, 0, punterofondofrase);
+ g_engine->_graphics->putImg(0, 0, punterofondofrase);
break;
case 3:
drawText(15, 1,
@@ -692,7 +692,7 @@ void handleFlcEvent(byte numero_del_evento) {
case 24:
switch (framecontador) {
case 1:
- putImg(0, 0, punterofondofrase);
+ g_engine->_graphics->putImg(0, 0, punterofondofrase);
break;
case 3:
drawText(15, 1,
@@ -708,7 +708,7 @@ void handleFlcEvent(byte numero_del_evento) {
case 27:
switch (framecontador) {
case 1:
- putImg(0, 0, punterofondofrase);
+ g_engine->_graphics->putImg(0, 0, punterofondofrase);
break;
case 3:
drawText(15, 1,
@@ -724,7 +724,7 @@ void handleFlcEvent(byte numero_del_evento) {
case 30:
switch (framecontador) {
case 1:
- putImg(0, 0, punterofondofrase);
+ g_engine->_graphics->putImg(0, 0, punterofondofrase);
break;
case 3:
drawText(15, 1,
@@ -739,7 +739,7 @@ void handleFlcEvent(byte numero_del_evento) {
break;
case 33:
if (framecontador == 17)
- putImg(0, 0, punterofondofrase);
+ g_engine->_graphics->putImg(0, 0, punterofondofrase);
break;
}
break;
@@ -780,7 +780,7 @@ void handleFlcEvent(byte numero_del_evento) {
case 1:
switch (framecontador) {
case 2:
- getImg(0, 0, 319, 69, punterofondofrase);
+ g_engine->_graphics->getImg(0, 0, 319, 69, punterofondofrase);
break;
case 3:
drawText(65, 1,
@@ -796,7 +796,7 @@ void handleFlcEvent(byte numero_del_evento) {
case 2:
switch (framecontador) {
case 1:
- putImg(0, 0, punterofondofrase);
+ g_engine->_graphics->putImg(0, 0, punterofondofrase);
break;
case 2:
drawText(65, 1,
@@ -812,7 +812,7 @@ void handleFlcEvent(byte numero_del_evento) {
case 5:
switch (framecontador) {
case 1:
- putImg(0, 0, punterofondofrase);
+ g_engine->_graphics->putImg(0, 0, punterofondofrase);
break;
case 2:
drawText(65, 1,
@@ -828,7 +828,7 @@ void handleFlcEvent(byte numero_del_evento) {
case 8:
switch (framecontador) {
case 1:
- putImg(0, 0, punterofondofrase);
+ g_engine->_graphics->putImg(0, 0, punterofondofrase);
break;
case 2:
drawText(65, 1,
diff --git a/engines/tot/console.cpp b/engines/tot/console.cpp
index f592b586cdc..4396dcb91dc 100644
--- a/engines/tot/console.cpp
+++ b/engines/tot/console.cpp
@@ -69,7 +69,7 @@ bool TotConsole::cmdClearLayers(int argc, const char **argv) {
_engine->_showScreenGrid = false;
_engine->_showGameGrid = false;
_engine->_showMouseGrid = false;
- drawScreen(background);
+ drawScreen(sceneBackground);
debugPrintf("Cleared all debug layers");
return true;
}
@@ -86,7 +86,7 @@ bool TotConsole::cmdLoadRoom(int argc, const char **argv) {
freeScreenObjects();
clearScreenData();
loadScreenData(roomID);
- drawScreen(background);
+ drawScreen(sceneBackground);
debugPrintf("Loaded screen %d", roomID);
return true;
}
diff --git a/engines/tot/dialog.cpp b/engines/tot/dialog.cpp
index 953c9c00c4a..640b4a095e5 100644
--- a/engines/tot/dialog.cpp
+++ b/engines/tot/dialog.cpp
@@ -356,10 +356,10 @@ void showDialogLine(Common::String matrizconversa[16], uint &charlaelegida) {
g_engine->_mouseManager->hide();
drawMenu(5);
- outtextxy(6, 151, matrizconversa[1], 255, true);
- outtextxy(6, 162, matrizconversa[2], 255, true);
- outtextxy(6, 173, matrizconversa[3], 255, true);
- outtextxy(6, 184, matrizconversa[4], 255, true);
+ euroText(6, 151, matrizconversa[1], 255);
+ euroText(6, 162, matrizconversa[2], 255);
+ euroText(6, 173, matrizconversa[3], 255);
+ euroText(6, 184, matrizconversa[4], 255);
g_engine->_mouseManager->show();
Common::Event e;
do {
@@ -372,12 +372,12 @@ void showDialogLine(Common::String matrizconversa[16], uint &charlaelegida) {
while (g_system->getEventManager()->pollEvent(e)) {
if (e.type == Common::EVENT_LBUTTONUP) {
lMouseClicked = true;
- pulsax = e.mouse.x;
- pulsay = e.mouse.y;
+ mouseClickX = e.mouse.x;
+ mouseClickY = e.mouse.y;
} else if (e.type == Common::EVENT_RBUTTONUP) {
rMouseClicked = true;
- pulsax = e.mouse.x;
- pulsay = e.mouse.y;
+ mouseClickX = e.mouse.x;
+ mouseClickY = e.mouse.y;
}
}
@@ -397,42 +397,42 @@ void showDialogLine(Common::String matrizconversa[16], uint &charlaelegida) {
} while (!lMouseClicked && !rMouseClicked && !g_engine->shouldQuit());
if (lMouseClicked) {
- if (pulsay < 143)
+ if (mouseClickY < 143)
convselec = 0;
else {
- if (pulsax >= 0 && pulsax <= 280) {
- if (pulsay >= 143 && pulsay <= 155) {
+ if (mouseClickX >= 0 && mouseClickX <= 280) {
+ if (mouseClickY >= 143 && mouseClickY <= 155) {
convselec = primeraconv;
- } else if (pulsay >= 156 && pulsay <= 166) {
+ } else if (mouseClickY >= 156 && mouseClickY <= 166) {
convselec = primeraconv + 1;
- } else if (pulsay >= 167 && pulsay <= 177) {
+ } else if (mouseClickY >= 167 && mouseClickY <= 177) {
convselec = primeraconv + 2;
- } else if (pulsay >= 178 && pulsay <= 186) {
+ } else if (mouseClickY >= 178 && mouseClickY <= 186) {
convselec = primeraconv + 3;
}
- } else if (pulsax >= 281 && pulsax <= 319) {
- if (pulsay >= 143 && pulsay <= 165) {
+ } else if (mouseClickX >= 281 && mouseClickX <= 319) {
+ if (mouseClickY >= 143 && mouseClickY <= 165) {
if (primeraconv > 1) {
convselec = 0;
primeraconv -= 1;
g_engine->_mouseManager->hide();
drawMenu(5);
- outtextxy(6, 151, matrizconversa[primeraconv], 255, true);
- outtextxy(6, 162, matrizconversa[primeraconv + 1], 255, true);
- outtextxy(6, 173, matrizconversa[primeraconv + 2], 255, true);
- outtextxy(6, 184, matrizconversa[primeraconv + 3], 255, true);
+ euroText(6, 151, matrizconversa[primeraconv], 255);
+ euroText(6, 162, matrizconversa[primeraconv + 1], 255);
+ euroText(6, 173, matrizconversa[primeraconv + 2], 255);
+ euroText(6, 184, matrizconversa[primeraconv + 3], 255);
g_engine->_mouseManager->show();
}
- } else if (pulsay >= 167 && pulsay <= 186) {
+ } else if (mouseClickY >= 167 && mouseClickY <= 186) {
if (primeraconv < 12) {
convselec = 0;
primeraconv += 1;
g_engine->_mouseManager->hide();
drawMenu(5);
- outtextxy(6, 151, matrizconversa[primeraconv], 255, true);
- outtextxy(6, 162, matrizconversa[primeraconv + 1], 255, true);
- outtextxy(6, 173, matrizconversa[primeraconv + 2], 255, true);
- outtextxy(6, 184, matrizconversa[primeraconv + 3], 255, true);
+ euroText(6, 151, matrizconversa[primeraconv], 255);
+ euroText(6, 162, matrizconversa[primeraconv + 1], 255);
+ euroText(6, 173, matrizconversa[primeraconv + 2], 255);
+ euroText(6, 184, matrizconversa[primeraconv + 3], 255);
g_engine->_mouseManager->show();
}
}
@@ -478,7 +478,7 @@ void talk(byte person) {
conversationIndex += 1;
pasoh = readVerbRegister();
insertarnombre = 0;
- matrizconversa[conversationIndex] = decrypt(pasoh.cadenatext);
+ matrizconversa[conversationIndex] = decrypt(pasoh.text);
for (int i = 0; i < matrizconversa[conversationIndex].size(); i++) {
if (matrizconversa[conversationIndex][i] == '@')
@@ -486,7 +486,7 @@ void talk(byte person) {
}
if (insertarnombre > 0) {
matrizconversa[conversationIndex].deleteChar(insertarnombre);
- matrizconversa[conversationIndex].insertString(nombrepersonaje, insertarnombre);
+ matrizconversa[conversationIndex].insertString(characterName, insertarnombre);
}
if (matrizconversa[conversationIndex].size() > 45) {
auxilcadena = 45;
@@ -519,8 +519,8 @@ void talk(byte person) {
while (mobj[indicemochila].code != 0) {
indicemochila += 1;
}
- mobj[indicemochila].bitmapIndex = indicelista1;
- mobj[indicemochila].code = codigolista1;
+ mobj[indicemochila].bitmapIndex = list1Index;
+ mobj[indicemochila].code = list1code;
mobj[indicemochila].objectName = getObjectName(0);
} break;
case 25: {
@@ -529,8 +529,8 @@ void talk(byte person) {
while (mobj[indicemochila].code != 0) {
indicemochila += 1;
}
- mobj[indicemochila].bitmapIndex = indicelista2;
- mobj[indicemochila].code = codigolista2;
+ mobj[indicemochila].bitmapIndex = list2Index;
+ mobj[indicemochila].code = list2code;
mobj[indicemochila].objectName = getObjectName(1);
} break;
}
@@ -570,16 +570,16 @@ void talk(byte person) {
}
void talkScreenObject() {
- int x_del_raton = (pulsax + 7) / factorx;
- int y_del_raton = (pulsay + 7) / factory;
- uint objeto_de_la_pantalla = currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[x_del_raton][y_del_raton]]->indicefichero;
+ int x_del_raton = (mouseClickX + 7) / xGridCount;
+ int y_del_raton = (mouseClickY + 7) / yGridCount;
+ uint objeto_de_la_pantalla = currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[x_del_raton][y_del_raton]]->fileIndex;
if (objeto_de_la_pantalla == 0)
return;
// verifyCopyProtection2();
readItemRegister(objeto_de_la_pantalla);
- goToObject(currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory],
- currentRoomData->rejapantalla[x_del_raton][y_del_raton]);
+ goToObject(currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount],
+ currentRoomData->walkAreasGrid[x_del_raton][y_del_raton]);
if (regobj.habla > 0) {
talk(regobj.habla);
diff --git a/engines/tot/game.cpp b/engines/tot/game.cpp
index 6377bcd14de..d977253b002 100644
--- a/engines/tot/game.cpp
+++ b/engines/tot/game.cpp
@@ -42,11 +42,11 @@ int startGame();
void newGame() {
saveAllowed = true;
g_engine->_mouseManager->hide();
- obtainName(nombrepersonaje);
+ obtainName(characterName);
if (!g_engine->shouldQuit()) {
totalFadeOut(0);
- clear();
+ g_engine->_graphics->clear();
processingActive();
freeInventory();
loadObjects();
@@ -62,7 +62,7 @@ void newGame() {
initializeObjectFile();
loadPalette("DEFAULT");
loadScreenData(1);
- screenTransition(13, false, background);
+ screenTransition(13, false, sceneBackground);
mask();
posicioninv = 0;
drawBackpack();
@@ -77,7 +77,7 @@ int engine_start() {
if (ConfMan.hasKey("save_slot")) {
return startGame();
}
- clear();
+ g_engine->_graphics->clear();
processingActive();
loadCharAnimation();
@@ -90,7 +90,7 @@ int engine_start() {
g_engine->_sound->playMidi("SILENT", true);
totalFadeOut(0);
- clear();
+ g_engine->_graphics->clear();
loadPalette("DEFAULT");
loadScreenMemory();
@@ -98,7 +98,7 @@ int engine_start() {
g_engine->_sound->playMidi("INTRODUC", true);
g_engine->_sound->setMidiVolume(3, 3);
firstIntroduction();
- g_engine->_mouseManager->setMousePos(1, xraton, yraton);
+ g_engine->_mouseManager->setMousePos(1, mouseX, mouseY);
initialMenu(hechaprimeravez);
if (partidanueva && !g_engine->shouldQuit()) {
newGame();
@@ -143,8 +143,8 @@ int startGame() {
while (g_system->getEventManager()->pollEvent(e)) {
if (isMouseEvent(e)) {
g_engine->_mouseManager->setMousePos(e.mouse);
- xraton = e.mouse.x;
- yraton = e.mouse.y;
+ mouseX = e.mouse.x;
+ mouseY = e.mouse.y;
}
if (e.type == Common::EVENT_KEYUP) {
changeGameSpeed(e);
@@ -197,31 +197,31 @@ int startGame() {
}
}
} else if (e.type == Common::EVENT_LBUTTONUP) {
- pulsax = e.mouse.x;
- pulsay = e.mouse.y;
- if (pulsay > 0 && pulsay < 131) {
+ mouseClickX = e.mouse.x;
+ mouseClickY = e.mouse.y;
+ if (mouseClickY > 0 && mouseClickY < 131) {
switch (numeroaccion) {
case 0: // go to
contadorpc2 = contadorpc;
// gets the area where the character is now standing. Area is calculated using xframe,yframe plus some adjustments to get the center of the feet
- zonaactual = currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory];
+ zonaactual = currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount];
if (zonaactual < 10) {
- xframe2 = pulsax + 7;
- yframe2 = pulsay + 7;
+ xframe2 = mouseClickX + 7;
+ yframe2 = mouseClickY + 7;
// obtains the target area from the clicked coordinates
- zonadestino = currentRoomData->rejapantalla[xframe2 / factorx][yframe2 / factory];
- if (currentRoomData->codigo == 21 && currentRoomData->animationFlag) {
+ zonadestino = currentRoomData->walkAreasGrid[xframe2 / xGridCount][yframe2 / yGridCount];
+ if (currentRoomData->code == 21 && currentRoomData->animationFlag) {
if ((zonadestino >= 1 && zonadestino <= 5) ||
(zonadestino >= 9 && zonadestino <= 13) ||
(zonadestino >= 18 && zonadestino <= 21) ||
zonadestino == 24 || zonadestino == 25) {
zonadestino = 7;
- pulsax = 232;
- pulsay = 75;
+ mouseClickX = 232;
+ mouseClickY = 75;
- xframe2 = pulsax + 7;
- yframe2 = pulsay + 7;
+ xframe2 = mouseClickX + 7;
+ yframe2 = mouseClickY + 7;
}
}
@@ -234,12 +234,12 @@ int startGame() {
cambiopantalla = false;
for (indicepuertas = 0; indicepuertas < 5; indicepuertas++) {
- if (currentRoomData->doors[indicepuertas].codigopuerta == zonadestino) {
+ if (currentRoomData->doors[indicepuertas].doorcode == zonadestino) {
- if (currentRoomData->doors[indicepuertas].abiertacerrada == 1) {
+ if (currentRoomData->doors[indicepuertas].openclosed == 1) {
cambiopantalla = true;
break;
- } else if ((currentRoomData->codigo == 5 && zonadestino == 27) || (currentRoomData->codigo == 6 && zonadestino == 21)) {
+ } else if ((currentRoomData->code == 5 && zonadestino == 27) || (currentRoomData->code == 6 && zonadestino == 21)) {
;
} else {
pasos -= 1;
@@ -266,15 +266,15 @@ int startGame() {
break;
case 3: // look at
cambiopantalla = false;
- destinox_paso = (pulsax + 7) / factorx;
- destinoy_paso = (pulsay + 7) / factory;
- if (currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[destinox_paso][destinoy_paso]]->indicefichero > 0) {
+ destinox_paso = (mouseClickX + 7) / xGridCount;
+ destinoy_paso = (mouseClickY + 7) / yGridCount;
+ if (currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[destinox_paso][destinoy_paso]]->fileIndex > 0) {
goToObject(
- currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory],
- currentRoomData->rejapantalla[destinox_paso][destinoy_paso]);
- if (currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[destinox_paso][destinoy_paso]]->indicefichero == 562)
+ currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount],
+ currentRoomData->walkAreasGrid[destinox_paso][destinoy_paso]);
+ if (currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[destinox_paso][destinoy_paso]]->fileIndex == 562)
- switch (currentRoomData->codigo) {
+ switch (currentRoomData->code) {
case 20:
if (hornacina[0][hornacina[0][3]] > 0)
readItemRegister(hornacina[0][hornacina[0][3]]);
@@ -289,7 +289,7 @@ int startGame() {
break;
}
else
- readItemRegister(currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[destinox_paso][destinoy_paso]]->indicefichero);
+ readItemRegister(currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[destinox_paso][destinoy_paso]]->fileIndex);
if (regobj.lookAtTextRef > 0)
drawText(regobj.lookAtTextRef);
numeroaccion = 0;
@@ -313,28 +313,28 @@ int startGame() {
contadorpc = contadorpc2;
} break;
}
- } else if (pulsay > 148 && pulsay < 158) {
- if (pulsax >= 3 && pulsax <= 53) {
+ } else if (mouseClickY > 148 && mouseClickY < 158) {
+ if (mouseClickX >= 3 && mouseClickX <= 53) {
numeroaccion = 1;
action();
break;
- } else if (pulsax >= 58 && pulsax <= 103) {
+ } else if (mouseClickX >= 58 && mouseClickX <= 103) {
numeroaccion = 2;
action();
break;
- } else if (pulsax >= 108 && pulsax <= 153) {
+ } else if (mouseClickX >= 108 && mouseClickX <= 153) {
numeroaccion = 3;
action();
break;
- } else if (pulsax >= 158 && pulsax <= 198) {
+ } else if (mouseClickX >= 158 && mouseClickX <= 198) {
numeroaccion = 4;
action();
break;
- } else if (pulsax >= 203 && pulsax <= 248) {
+ } else if (mouseClickX >= 203 && mouseClickX <= 248) {
numeroaccion = 5;
action();
break;
- } else if (pulsax >= 253 && pulsax <= 311) {
+ } else if (mouseClickX >= 253 && mouseClickX <= 311) {
numeroaccion = 6;
action();
break;
@@ -343,29 +343,29 @@ int startGame() {
action();
contadorpc2 = contadorpc;
}
- } else if (pulsay > 166 && pulsay < 199) {
- if (pulsax >= 3 && pulsax <= 19) {
+ } else if (mouseClickY > 166 && mouseClickY < 199) {
+ if (mouseClickX >= 3 && mouseClickX <= 19) {
inventory(0, 33);
break;
- } else if (pulsax >= 26 && pulsax <= 65) {
+ } else if (mouseClickX >= 26 && mouseClickX <= 65) {
handleAction(posicioninv);
break;
- } else if (pulsax >= 70 && pulsax <= 108) {
+ } else if (mouseClickX >= 70 && mouseClickX <= 108) {
handleAction(posicioninv + 1);
break;
- } else if (pulsax >= 113 && pulsax <= 151) {
+ } else if (mouseClickX >= 113 && mouseClickX <= 151) {
handleAction(posicioninv + 2);
break;
- } else if (pulsax >= 156 && pulsax <= 194) {
+ } else if (mouseClickX >= 156 && mouseClickX <= 194) {
handleAction(posicioninv + 3);
break;
- } else if (pulsax >= 199 && pulsax <= 237) {
+ } else if (mouseClickX >= 199 && mouseClickX <= 237) {
handleAction(posicioninv + 4);
break;
- } else if (pulsax >= 242 && pulsax <= 280) {
+ } else if (mouseClickX >= 242 && mouseClickX <= 280) {
handleAction(posicioninv + 5);
break;
- } else if (pulsax >= 290 && pulsax <= 311) {
+ } else if (mouseClickX >= 290 && mouseClickX <= 311) {
inventory(1, 33);
break;
} else {
@@ -374,20 +374,20 @@ int startGame() {
}
}
} else if (e.type == Common::EVENT_RBUTTONUP) {
- pulsax = e.mouse.x;
- pulsay = e.mouse.y;
- destinox_paso = (pulsax + 7) / factorx;
- destinoy_paso = (pulsay + 7) / factory;
+ mouseClickX = e.mouse.x;
+ mouseClickY = e.mouse.y;
+ destinox_paso = (mouseClickX + 7) / xGridCount;
+ destinoy_paso = (mouseClickY + 7) / yGridCount;
contadorpc2 = contadorpc;
if (destinoy_paso < 28) {
- RoomObjectListEntry obj = *currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[destinox_paso][destinoy_paso]];
- if (obj.indicefichero > 0) {
+ RoomObjectListEntry obj = *currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[destinox_paso][destinoy_paso]];
+ if (obj.fileIndex > 0) {
drawLookAtItem(obj);
- goToObject(currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], currentRoomData->rejapantalla[destinox_paso][destinoy_paso]);
- if (obj.indicefichero == 562)
+ goToObject(currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount], currentRoomData->walkAreasGrid[destinox_paso][destinoy_paso]);
+ if (obj.fileIndex == 562)
- switch (currentRoomData->codigo) {
+ switch (currentRoomData->code) {
case 20:
if (hornacina[0][hornacina[0][3]] > 0)
readItemRegister(hornacina[0][hornacina[0][3]]);
@@ -402,7 +402,7 @@ int startGame() {
break;
}
else
- readItemRegister(obj.indicefichero);
+ readItemRegister(obj.fileIndex);
if (regobj.lookAtTextRef > 0)
drawText(regobj.lookAtTextRef);
numeroaccion = 0;
@@ -428,7 +428,7 @@ int startGame() {
g_engine->saveAutosaveIfEnabled();
totalFadeOut(0);
g_engine->_sound->fadeOutMusic(musicVolLeft, musicVolRight);
- clear();
+ g_engine->_graphics->clear();
g_engine->_sound->playMidi("INTRODUC", true);
g_engine->_sound->fadeInMusic(musicVolLeft, musicVolRight);
initialMenu(true);
@@ -475,7 +475,7 @@ int startGame() {
if (contadorpc2 > 43)
showError(274);
sacrificeScene();
- clear();
+ g_engine->_graphics->clear();
loadObjects();
loadPalette("SEGUNDA");
indicetray = 0;
@@ -487,7 +487,7 @@ int startGame() {
g_engine->_sound->fadeOutMusic(musicVolLeft, musicVolRight);
g_engine->_sound->playMidi("SEGUNDA", true);
g_engine->_sound->fadeInMusic(musicVolLeft, musicVolRight);
- screenTransition(1, false, background);
+ screenTransition(1, false, sceneBackground);
mask();
posicioninv = 0;
drawBackpack();
@@ -517,7 +517,7 @@ int startGame() {
}
if (g_engine->_drawObjectAreas) {
- for (int indice = 0; indice < nivelesdeprof; indice++) {
+ for (int indice = 0; indice < depthLevelCount; indice++) {
if (screenObjects[indice] != NULL) {
if (true) {
// debug
@@ -526,7 +526,7 @@ int startGame() {
Common::Rect r = Common::Rect(depthMap[indice].posx, depthMap[indice].posy, depthMap[indice].posx + w, depthMap[indice].posy + h);
drawRect(180, depthMap[indice].posx, depthMap[indice].posy, depthMap[indice].posx + w, depthMap[indice].posy + h);
- outtextxy(r.left, r.top, Common::String().format("%d", indice), 0);
+ littText(r.left, r.top, Common::String().format("%d", indice), 0);
}
}
}
@@ -562,22 +562,22 @@ void sceneChange() {
// verifyCopyProtection();
g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
- switch (currentRoomData->doors[indicepuertas].pantallaquecarga) {
+ switch (currentRoomData->doors[indicepuertas].nextScene) {
case 2: {
- tipoefectofundido = Random(15) + 1;
+ transitionEffect = Random(15) + 1;
iframe = 0;
indicetray = 0;
- characterPosX = currentRoomData->doors[indicepuertas].posxsalida - rectificacionx;
- characterPosY = currentRoomData->doors[indicepuertas].posysalida - rectificaciony;
+ characterPosX = currentRoomData->doors[indicepuertas].exitPosX - characterCorrectionX;
+ characterPosY = currentRoomData->doors[indicepuertas].exitPosY - characerCorrectionY;
trayec[indicetray].x = characterPosX;
trayec[indicetray].y = characterPosY;
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- screenTransition(tipoefectofundido, true, NULL);
+ screenTransition(transitionEffect, true, NULL);
g_engine->_sound->stopVoc();
- loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
+ loadScreenData(currentRoomData->doors[indicepuertas].nextScene);
if (contadorpc > 89)
showError(274);
g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
@@ -585,44 +585,44 @@ void sceneChange() {
g_engine->_sound->autoPlayVoc("PARASITO", 355778, 20129);
else
cargatele();
- screenTransition(tipoefectofundido, false, background);
+ screenTransition(transitionEffect, false, sceneBackground);
contadorpc = contadorpc2;
g_engine->_mouseManager->show();
oldxrejilla = 0;
oldyrejilla = 0;
} break;
case 5: {
- if (currentRoomData->codigo != 6) {
- tipoefectofundido = Random(15) + 1;
+ if (currentRoomData->code != 6) {
+ transitionEffect = Random(15) + 1;
iframe = 0;
indicetray = 0;
- characterPosX = currentRoomData->doors[indicepuertas].posxsalida - rectificacionx;
- characterPosY = currentRoomData->doors[indicepuertas].posysalida - rectificaciony + 15;
+ characterPosX = currentRoomData->doors[indicepuertas].exitPosX - characterCorrectionX;
+ characterPosY = currentRoomData->doors[indicepuertas].exitPosY - characerCorrectionY + 15;
trayec[indicetray].x = characterPosX;
trayec[indicetray].y = characterPosY;
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- screenTransition(tipoefectofundido, true, NULL);
- loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
+ screenTransition(transitionEffect, true, NULL);
+ loadScreenData(currentRoomData->doors[indicepuertas].nextScene);
g_engine->_sound->stopVoc();
g_engine->_sound->autoPlayVoc("CALDERA", 6433, 15386);
g_engine->_sound->setSfxVolume(leftSfxVol, 0);
- screenTransition(tipoefectofundido, false, background);
+ screenTransition(transitionEffect, false, sceneBackground);
g_engine->_mouseManager->show();
oldxrejilla = 0;
oldyrejilla = 0;
checkMouseGrid();
} else {
- zonaactual = currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory];
+ zonaactual = currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount];
zonadestino = 21;
goToObject(zonaactual, zonadestino);
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
g_engine->_sound->setSfxVolume(leftSfxVol, 0);
- loadScrollData(currentRoomData->doors[indicepuertas].pantallaquecarga, true, 22, -2);
+ loadScrollData(currentRoomData->doors[indicepuertas].nextScene, true, 22, -2);
g_engine->_mouseManager->show();
oldxrejilla = 0;
oldyrejilla = 0;
@@ -630,33 +630,33 @@ void sceneChange() {
}
} break;
case 6: {
- zonaactual = currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory];
+ zonaactual = currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount];
zonadestino = 27;
goToObject(zonaactual, zonadestino);
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
- loadScrollData(currentRoomData->doors[indicepuertas].pantallaquecarga, false, 22, 2);
+ loadScrollData(currentRoomData->doors[indicepuertas].nextScene, false, 22, 2);
g_engine->_mouseManager->show();
oldxrejilla = 0;
oldyrejilla = 0;
checkMouseGrid();
} break;
case 9: {
- tipoefectofundido = Random(15) + 1;
+ transitionEffect = Random(15) + 1;
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- screenTransition(tipoefectofundido, true, NULL);
+ screenTransition(transitionEffect, true, NULL);
iframe = 0;
indicetray = 0;
- characterPosX = currentRoomData->doors[indicepuertas].posxsalida - rectificacionx;
- characterPosY = currentRoomData->doors[indicepuertas].posysalida - rectificaciony;
+ characterPosX = currentRoomData->doors[indicepuertas].exitPosX - characterCorrectionX;
+ characterPosY = currentRoomData->doors[indicepuertas].exitPosY - characerCorrectionY;
trayec[indicetray].x = characterPosX;
trayec[indicetray].y = characterPosY;
- loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
- screenTransition(tipoefectofundido, false, background);
+ loadScreenData(currentRoomData->doors[indicepuertas].nextScene);
+ screenTransition(transitionEffect, false, sceneBackground);
g_engine->_mouseManager->show();
oldxrejilla = 0;
@@ -664,32 +664,32 @@ void sceneChange() {
checkMouseGrid();
} break;
case 12: {
- if (currentRoomData->codigo != 13) {
- tipoefectofundido = Random(15) + 1;
+ if (currentRoomData->code != 13) {
+ transitionEffect = Random(15) + 1;
iframe = 0;
indicetray = 0;
- characterPosX = currentRoomData->doors[indicepuertas].posxsalida - rectificacionx;
- characterPosY = currentRoomData->doors[indicepuertas].posysalida - rectificaciony;
+ characterPosX = currentRoomData->doors[indicepuertas].exitPosX - characterCorrectionX;
+ characterPosY = currentRoomData->doors[indicepuertas].exitPosY - characerCorrectionY;
trayec[indicetray].x = characterPosX;
trayec[indicetray].y = characterPosY;
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- screenTransition(tipoefectofundido, true, NULL);
- loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
- screenTransition(tipoefectofundido, false, background);
+ screenTransition(transitionEffect, true, NULL);
+ loadScreenData(currentRoomData->doors[indicepuertas].nextScene);
+ screenTransition(transitionEffect, false, sceneBackground);
g_engine->_mouseManager->show();
oldxrejilla = 0;
oldyrejilla = 0;
g_engine->_mouseManager->show();
} else {
- zonaactual = currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory];
+ zonaactual = currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount];
goToObject(zonaactual, zonadestino);
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- loadScrollData(currentRoomData->doors[indicepuertas].pantallaquecarga, false, 64, 0);
+ loadScrollData(currentRoomData->doors[indicepuertas].nextScene, false, 64, 0);
g_engine->_mouseManager->show();
oldxrejilla = 0;
oldyrejilla = 0;
@@ -697,26 +697,26 @@ void sceneChange() {
}
} break;
case 13: {
- switch (currentRoomData->codigo) {
+ switch (currentRoomData->code) {
case 12: {
- zonaactual = currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory];
+ zonaactual = currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount];
goToObject(zonaactual, zonadestino);
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- loadScrollData(currentRoomData->doors[indicepuertas].pantallaquecarga, true, 64, 0);
+ loadScrollData(currentRoomData->doors[indicepuertas].nextScene, true, 64, 0);
g_engine->_mouseManager->show();
oldxrejilla = 0;
oldyrejilla = 0;
checkMouseGrid();
} break;
case 14: {
- zonaactual = currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory];
+ zonaactual = currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount];
goToObject(zonaactual, zonadestino);
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- loadScrollData(currentRoomData->doors[indicepuertas].pantallaquecarga, false, 56, 0);
+ loadScrollData(currentRoomData->doors[indicepuertas].nextScene, false, 56, 0);
g_engine->_mouseManager->show();
oldxrejilla = 0;
oldyrejilla = 0;
@@ -725,32 +725,32 @@ void sceneChange() {
}
} break;
case 14: {
- if (currentRoomData->codigo != 13) {
- tipoefectofundido = Random(15) + 1;
+ if (currentRoomData->code != 13) {
+ transitionEffect = Random(15) + 1;
iframe = 0;
indicetray = 0;
- characterPosX = currentRoomData->doors[indicepuertas].posxsalida - rectificacionx;
- characterPosY = currentRoomData->doors[indicepuertas].posysalida - rectificaciony;
+ characterPosX = currentRoomData->doors[indicepuertas].exitPosX - characterCorrectionX;
+ characterPosY = currentRoomData->doors[indicepuertas].exitPosY - characerCorrectionY;
trayec[indicetray].x = characterPosX;
trayec[indicetray].y = characterPosY;
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- screenTransition(tipoefectofundido, true, NULL);
- loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
- screenTransition(tipoefectofundido, false, background);
+ screenTransition(transitionEffect, true, NULL);
+ loadScreenData(currentRoomData->doors[indicepuertas].nextScene);
+ screenTransition(transitionEffect, false, sceneBackground);
g_engine->_mouseManager->show();
oldxrejilla = 0;
oldyrejilla = 0;
checkMouseGrid();
} else {
- zonaactual = currentRoomData->rejapantalla[((characterPosX + rectificacionx) / factorx)][((characterPosY + rectificaciony) / factory)];
+ zonaactual = currentRoomData->walkAreasGrid[((characterPosX + characterCorrectionX) / xGridCount)][((characterPosY + characerCorrectionY) / yGridCount)];
goToObject(zonaactual, zonadestino);
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- loadScrollData(currentRoomData->doors[indicepuertas].pantallaquecarga, true, 56, 0);
+ loadScrollData(currentRoomData->doors[indicepuertas].nextScene, true, 56, 0);
g_engine->_mouseManager->show();
oldxrejilla = 0;
oldyrejilla = 0;
@@ -758,25 +758,25 @@ void sceneChange() {
}
} break;
case 17: {
- tipoefectofundido = Random(15) + 1;
+ transitionEffect = Random(15) + 1;
iframe = 0;
indicetray = 0;
- characterPosX = currentRoomData->doors[indicepuertas].posxsalida - rectificacionx;
- characterPosY = currentRoomData->doors[indicepuertas].posysalida - rectificaciony;
+ characterPosX = currentRoomData->doors[indicepuertas].exitPosX - characterCorrectionX;
+ characterPosY = currentRoomData->doors[indicepuertas].exitPosY - characerCorrectionY;
trayec[indicetray].x = characterPosX;
trayec[indicetray].y = characterPosY;
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- screenTransition(tipoefectofundido, true, NULL);
+ screenTransition(transitionEffect, true, NULL);
g_engine->_sound->stopVoc();
- loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
+ loadScreenData(currentRoomData->doors[indicepuertas].nextScene);
if (libro[0] == true && currentRoomData->animationFlag == true)
disableSecondAnimation();
if (contadorpc > 89)
showError(274);
g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
- screenTransition(tipoefectofundido, false, background);
+ screenTransition(transitionEffect, false, sceneBackground);
contadorpc = contadorpc2;
g_engine->_mouseManager->show();
oldxrejilla = 0;
@@ -784,32 +784,32 @@ void sceneChange() {
checkMouseGrid();
} break;
case 18: {
- if (currentRoomData->codigo != 19) {
- tipoefectofundido = Random(15) + 1;
+ if (currentRoomData->code != 19) {
+ transitionEffect = Random(15) + 1;
iframe = 0;
indicetray = 0;
- characterPosX = currentRoomData->doors[indicepuertas].posxsalida - rectificacionx;
- characterPosY = currentRoomData->doors[indicepuertas].posysalida - rectificaciony;
+ characterPosX = currentRoomData->doors[indicepuertas].exitPosX - characterCorrectionX;
+ characterPosY = currentRoomData->doors[indicepuertas].exitPosY - characerCorrectionY;
trayec[indicetray].x = characterPosX;
trayec[indicetray].y = characterPosY;
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- screenTransition(tipoefectofundido, true, NULL);
- loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
- screenTransition(tipoefectofundido, false, background);
+ screenTransition(transitionEffect, true, NULL);
+ loadScreenData(currentRoomData->doors[indicepuertas].nextScene);
+ screenTransition(transitionEffect, false, sceneBackground);
g_engine->_mouseManager->show();
oldxrejilla = 0;
oldyrejilla = 0;
checkMouseGrid();
} else {
- zonaactual = currentRoomData->rejapantalla[((characterPosX + rectificacionx) / factorx)][((characterPosY + rectificaciony) / factory)];
+ zonaactual = currentRoomData->walkAreasGrid[((characterPosX + characterCorrectionX) / xGridCount)][((characterPosY + characerCorrectionY) / yGridCount)];
goToObject(zonaactual, zonadestino);
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- loadScrollData(currentRoomData->doors[indicepuertas].pantallaquecarga, true, 131, -1);
+ loadScrollData(currentRoomData->doors[indicepuertas].nextScene, true, 131, -1);
g_engine->_mouseManager->show();
oldxrejilla = 0;
oldyrejilla = 0;
@@ -817,32 +817,32 @@ void sceneChange() {
}
} break;
case 19: {
- if (currentRoomData->codigo != 18) {
- tipoefectofundido = Random(15) + 1;
+ if (currentRoomData->code != 18) {
+ transitionEffect = Random(15) + 1;
iframe = 0;
indicetray = 0;
- characterPosX = currentRoomData->doors[indicepuertas].posxsalida - rectificacionx;
- characterPosY = currentRoomData->doors[indicepuertas].posysalida - rectificaciony;
+ characterPosX = currentRoomData->doors[indicepuertas].exitPosX - characterCorrectionX;
+ characterPosY = currentRoomData->doors[indicepuertas].exitPosY - characerCorrectionY;
trayec[indicetray].x = characterPosX;
trayec[indicetray].y = characterPosY;
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- screenTransition(tipoefectofundido, true, NULL);
- loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
- screenTransition(tipoefectofundido, false, background);
+ screenTransition(transitionEffect, true, NULL);
+ loadScreenData(currentRoomData->doors[indicepuertas].nextScene);
+ screenTransition(transitionEffect, false, sceneBackground);
g_engine->_mouseManager->show();
oldxrejilla = 0;
oldyrejilla = 0;
checkMouseGrid();
} else {
- zonaactual = currentRoomData->rejapantalla[((characterPosX + rectificacionx) / factorx)][((characterPosY + rectificaciony) / factory)];
+ zonaactual = currentRoomData->walkAreasGrid[((characterPosX + characterCorrectionX) / xGridCount)][((characterPosY + characerCorrectionY) / yGridCount)];
goToObject(zonaactual, zonadestino);
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- loadScrollData(currentRoomData->doors[indicepuertas].pantallaquecarga, false, 131, 1);
+ loadScrollData(currentRoomData->doors[indicepuertas].nextScene, false, 131, 1);
g_engine->_mouseManager->show();
oldxrejilla = 0;
oldyrejilla = 0;
@@ -850,39 +850,39 @@ void sceneChange() {
}
} break;
case 20: {
- tipoefectofundido = Random(15) + 1;
+ transitionEffect = Random(15) + 1;
iframe = 0;
indicetray = 0;
- characterPosX = currentRoomData->doors[indicepuertas].posxsalida - rectificacionx;
- characterPosY = currentRoomData->doors[indicepuertas].posysalida - rectificaciony;
+ characterPosX = currentRoomData->doors[indicepuertas].exitPosX - characterCorrectionX;
+ characterPosY = currentRoomData->doors[indicepuertas].exitPosY - characerCorrectionY;
trayec[indicetray].x = characterPosX;
trayec[indicetray].y = characterPosY;
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- screenTransition(tipoefectofundido, true, NULL);
+ screenTransition(transitionEffect, true, NULL);
g_engine->_sound->stopVoc();
- loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
+ loadScreenData(currentRoomData->doors[indicepuertas].nextScene);
switch (hornacina[0][hornacina[0][3]]) {
case 0:
- currentRoomData->indexadoobjetos[9]->objectName = getObjectName(4);
+ currentRoomData->screenObjectIndex[9]->objectName = getObjectName(4);
break;
case 561:
- currentRoomData->indexadoobjetos[9]->objectName = getObjectName(5);
+ currentRoomData->screenObjectIndex[9]->objectName = getObjectName(5);
break;
case 563:
- currentRoomData->indexadoobjetos[9]->objectName = getObjectName(6);
+ currentRoomData->screenObjectIndex[9]->objectName = getObjectName(6);
break;
case 615:
- currentRoomData->indexadoobjetos[9]->objectName = getObjectName(7);
+ currentRoomData->screenObjectIndex[9]->objectName = getObjectName(7);
break;
}
if (contadorpc > 89)
showError(274);
g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
- if (currentRoomData->codigo == 4)
+ if (currentRoomData->code == 4)
g_engine->_sound->loadVoc("GOTA", 140972, 1029);
- screenTransition(tipoefectofundido, false, background);
+ screenTransition(transitionEffect, false, sceneBackground);
contadorpc = contadorpc2;
g_engine->_mouseManager->show();
oldxrejilla = 0;
@@ -890,34 +890,34 @@ void sceneChange() {
checkMouseGrid();
} break;
case 24: {
- tipoefectofundido = Random(15) + 1;
+ transitionEffect = Random(15) + 1;
iframe = 0;
indicetray = 0;
- characterPosX = currentRoomData->doors[indicepuertas].posxsalida - rectificacionx;
- characterPosY = currentRoomData->doors[indicepuertas].posysalida - rectificaciony;
+ characterPosX = currentRoomData->doors[indicepuertas].exitPosX - characterCorrectionX;
+ characterPosY = currentRoomData->doors[indicepuertas].exitPosY - characerCorrectionY;
trayec[indicetray].x = characterPosX;
trayec[indicetray].y = characterPosY;
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- screenTransition(tipoefectofundido, true, NULL);
+ screenTransition(transitionEffect, true, NULL);
g_engine->_sound->stopVoc();
- loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
+ loadScreenData(currentRoomData->doors[indicepuertas].nextScene);
switch (hornacina[1][hornacina[1][3]]) {
case 0:
- currentRoomData->indexadoobjetos[8]->objectName = getObjectName(4);
+ currentRoomData->screenObjectIndex[8]->objectName = getObjectName(4);
break;
case 561:
- currentRoomData->indexadoobjetos[8]->objectName = getObjectName(5);
+ currentRoomData->screenObjectIndex[8]->objectName = getObjectName(5);
break;
case 615:
- currentRoomData->indexadoobjetos[8]->objectName = getObjectName(7);
+ currentRoomData->screenObjectIndex[8]->objectName = getObjectName(7);
break;
case 622:
- currentRoomData->indexadoobjetos[8]->objectName = getObjectName(8);
+ currentRoomData->screenObjectIndex[8]->objectName = getObjectName(8);
break;
case 623:
- currentRoomData->indexadoobjetos[8]->objectName = getObjectName(9);
+ currentRoomData->screenObjectIndex[8]->objectName = getObjectName(9);
break;
}
if (contadorpc > 89)
@@ -925,27 +925,27 @@ void sceneChange() {
g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
if (trampa_puesta) {
currentRoomData->animationFlag = true;
- loadAnimation(currentRoomData->nombremovto);
+ loadAnimation(currentRoomData->animationName);
iframe2 = 0;
indicetray2 = 1;
- currentRoomData->tray2[indicetray2 - 1].x = 214 - 15;
- currentRoomData->tray2[indicetray2 - 1].y = 115 - 42;
- animado.dir = currentRoomData->dir2[indicetray2 - 1];
- animado.posx = currentRoomData->tray2[indicetray2 - 1].x;
- animado.posy = currentRoomData->tray2[indicetray2 - 1].y;
- animado.profundidad = 14;
+ currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].x = 214 - 15;
+ currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].y = 115 - 42;
+ animado.dir = currentRoomData->secondaryAnimDirections[indicetray2 - 1];
+ animado.posx = currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].x;
+ animado.posy = currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].y;
+ animado.depth = 14;
for (int i = 0; i < maxrejax; i++)
for (int j = 0; j < maxrejay; j++) {
if (rejamascaramovto[i][j] > 0) {
- currentRoomData->rejapantalla[oldposx + i][oldposy + j] = rejamascaramovto[i][j];
+ currentRoomData->walkAreasGrid[oldposx + i][oldposy + j] = rejamascaramovto[i][j];
}
if (rejamascararaton[i][j] > 0)
currentRoomData->mouseGrid[oldposx + i][oldposy + j] = rejamascararaton[i][j];
}
assembleScreen();
}
- screenTransition(tipoefectofundido, false, background);
+ screenTransition(transitionEffect, false, sceneBackground);
if ((rojo_capturado == false) && (trampa_puesta == false))
runaroundRed();
contadorpc = contadorpc2;
@@ -958,23 +958,23 @@ void sceneChange() {
wcScene();
break;
default: {
- tipoefectofundido = Random(15) + 1;
+ transitionEffect = Random(15) + 1;
iframe = 0;
indicetray = 0;
- characterPosX = currentRoomData->doors[indicepuertas].posxsalida - rectificacionx;
- characterPosY = currentRoomData->doors[indicepuertas].posysalida - rectificaciony;
+ characterPosX = currentRoomData->doors[indicepuertas].exitPosX - characterCorrectionX;
+ characterPosY = currentRoomData->doors[indicepuertas].exitPosY - characerCorrectionY;
trayec[indicetray].x = characterPosX;
trayec[indicetray].y = characterPosY;
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- screenTransition(tipoefectofundido, true, NULL);
+ screenTransition(transitionEffect, true, NULL);
g_engine->_sound->stopVoc();
- loadScreenData(currentRoomData->doors[indicepuertas].pantallaquecarga);
+ loadScreenData(currentRoomData->doors[indicepuertas].nextScene);
if (contadorpc > 89)
showError(274);
g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
- switch (currentRoomData->codigo) {
+ switch (currentRoomData->code) {
case 4:
g_engine->_sound->loadVoc("GOTA", 140972, 1029);
break;
@@ -982,7 +982,7 @@ void sceneChange() {
g_engine->_sound->autoPlayVoc("FUENTE", 0, 0);
break;
}
- screenTransition(tipoefectofundido, false, background);
+ screenTransition(transitionEffect, false, sceneBackground);
contadorpc = contadorpc2;
g_engine->_mouseManager->show();
oldxrejilla = 0;
diff --git a/engines/tot/graphics.cpp b/engines/tot/graphics.cpp
index a2af6f68663..ed7581a33e3 100644
--- a/engines/tot/graphics.cpp
+++ b/engines/tot/graphics.cpp
@@ -35,96 +35,6 @@ namespace Tot {
signed char fadeData[256][256];
int ipal, jpal;
-void rectangle(int x1, int y1, int x2, int y2, byte color) {
- g_engine->_screen->drawLine(x1, y1, x2, y1, color);
- g_engine->_screen->drawLine(x2, y1, x2, y2, color);
- g_engine->_screen->drawLine(x1, y2, x2, y2, color);
- g_engine->_screen->drawLine(x1, y1, x1, y2, color);
- g_engine->_screen->addDirtyRect(Common::Rect(x1, y1, x2, y2));
-}
-
-void rectangle(uint x1, uint y1, uint x2, uint y2, byte color) {
- g_engine->_screen->drawLine(x1, y1, x2, y1, color);
- g_engine->_screen->drawLine(x2, y1, x2, y2, color);
- g_engine->_screen->drawLine(x1, y2, x2, y2, color);
- g_engine->_screen->drawLine(x1, y1, x1, y2, color);
- g_engine->_screen->addDirtyRect(Common::Rect(x1, y1, x2, y2));
-}
-
-// Copies the rectangle delimited by getCoord** from backgroundScreen into image
-void getVirtualImg(
- uint getcoordx1, // xframe
- uint getcoordy1, // yframe
- uint getcoordx2, // xframe + framewidth
- uint getcoordy2, // yframe + frameheight
- byte *backgroundScreen,
- byte *image
-) {
- uint16 w = getcoordx2 - getcoordx1;
- uint16 h = getcoordy2 - getcoordy1;
-
- WRITE_UINT16(image, w);
- WRITE_UINT16(image + 2, h);
- w++;
- h++;
- int posAbs = 4 + getcoordx1 + (getcoordy1 * 320);
-
- int sourcePtr = 0;
- byte *destPtr = 4 + image; // Start writing after width and height
-
- for (int i = 0; i < h; i++) {
- for (int j = 0; j < w; j++) {
- *destPtr++ = backgroundScreen[posAbs + sourcePtr++];
- }
- sourcePtr += (320 - w); // Move to the beginning of the next row in PantFondo
- }
-}
-// puts an image into a buffer in the given position, asuming 320 width
-void putVirtualImg(uint putcoordx, uint putcoordy, byte *backgroundScreen, byte *image) {
- uint16 w, h;
-
- w = READ_LE_UINT16(image);
- h = READ_LE_UINT16(image + 2);
-
- w++;
- h++;
- int posAbs = 4 + putcoordx + (putcoordy * 320);
-
- int sourcePtr = 0;
- byte *destPtr = 4 + image; // Start writing after width and height
-
- for (int i = 0; i < h; i++) {
- for (int j = 0; j < w; j++) {
- // if(destPtr > 0)
- backgroundScreen[posAbs + sourcePtr++] = *destPtr++;
- }
- sourcePtr += (320 - w); // Move to the beginning of the next row in PantFondo
- }
-}
-
-void getImg(uint coordx1, uint coordy1, uint coordx2, uint coordy2, byte *image) {
-
- uint16 width = coordx2 - coordx1;
- uint16 height = coordy2 - coordy1;
-
- WRITE_LE_UINT16(image, width);
- WRITE_LE_UINT16(image + 2, height);
-
- width++;
- height++;
-
- for (int j = 0; j < width; j++) {
- for (int i = 0; i < height; i++) {
- int idx = 4 + i * width + j;
- *(image + idx) = *(byte *)g_engine->_screen->getBasePtr(coordx1 + j, coordy1 + i);
- }
- }
-}
-
-void putShape(uint coordx, uint coordy, byte *image) {
- putImg(coordx, coordy, image, true);
-}
-
void drawFullScreen(byte *screen) {
Common::copy(screen, screen + 64000, (byte *)g_engine->_screen->getPixels());
}
@@ -144,29 +54,6 @@ void drawScreen(byte *screen, bool offsetSize) {
g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
}
-void putImg(uint coordx, uint coordy, byte *image, bool transparency) {
- uint16 w, h;
-
- w = READ_LE_UINT16(image);
- h = READ_LE_UINT16(image + 2);
-
- w++;
- h++;
- for (int i = 0; i < w; i++) {
- for (int j = 0; j < h; j++) {
- int index = 4 + (j * w + i);
- if (!transparency || image[index] != 0) {
- *(byte *)g_engine->_screen->getBasePtr(coordx + i, coordy + j) = image[index];
- }
- }
- }
- g_engine->_screen->addDirtyRect(Common::Rect(coordx, coordy, coordx + w, coordy + h));
-}
-
-void clear() {
- g_engine->_screen->clear();
-}
-
void loadPalette(Common::String paletteName) {
Common::File fichero;
@@ -186,6 +73,7 @@ void updateSceneAreaIfNeeded(int speed = 1) {
g_engine->_screen->update();
}
}
+
void screenTransition(byte effectNumber, bool fadeToBlack, byte *scene) {
int i1, i2, i3, j1, j2, j3;
@@ -746,9 +634,9 @@ void updatePalette(byte paletteIndex) {
switch (gamePart) {
case 1: {
for (ipal = 0; ipal <= 5; ipal++) {
- pal[(ipal + 195) * 3 + 0] = movimientopal[(paletteIndex * 6 + ipal) * 3 + 0];
- pal[(ipal + 195) * 3 + 1] = movimientopal[(paletteIndex * 6 + ipal) * 3 + 1];
- pal[(ipal + 195) * 3 + 2] = movimientopal[(paletteIndex * 6 + ipal) * 3 + 2];
+ pal[(ipal + 195) * 3 + 0] = palAnimSlice[(paletteIndex * 6 + ipal) * 3 + 0];
+ pal[(ipal + 195) * 3 + 1] = palAnimSlice[(paletteIndex * 6 + ipal) * 3 + 1];
+ pal[(ipal + 195) * 3 + 2] = palAnimSlice[(paletteIndex * 6 + ipal) * 3 + 2];
}
changeRGBBlock(195, 6, &pal[195 * 3 + 0]);
} break;
@@ -792,36 +680,14 @@ void updatePalette(byte paletteIndex) {
}
}
-void processingActive() {
-
- setRGBPalette(255, 63, 63, 63);
- outtextxy(121, 72, "PROCESANDO......", 0);
- g_engine->_screen->update();
- delay(enforcedTextAnimDelay);
- outtextxy(120, 71, "PROCESANDO......", 0);
- g_engine->_screen->update();
- delay(enforcedTextAnimDelay);
- outtextxy(119, 72, "PROCESANDO......", 0);
- g_engine->_screen->update();
- delay(enforcedTextAnimDelay);
- outtextxy(120, 73, "PROCESANDO......", 0);
- g_engine->_screen->update();
- delay(enforcedTextAnimDelay);
- outtextxy(120, 72, "PROCESANDO......", 255);
- g_engine->_screen->update();
-
- // enforce a delay for now so it's visible
- g_system->delayMillis(200);
-}
-
void initGraph() {
for (int i = 0; i < 256; i++)
for (int j = 0; j < 256; j++)
fadeData[i][j] = i / (j + 1);
}
-void screenHandleToBackground() {
- Common::copy(screenHandle + 4, screenHandle + screenSize, background + 4);
+void restoreBackground() {
+ Common::copy(backgroundCopy + 4, backgroundCopy + screenSize, sceneBackground + 4);
}
void copyPalette(palette from, palette to) {
@@ -831,7 +697,7 @@ void copyPalette(palette from, palette to) {
void loadAnimationIntoBuffer(Common::SeekableReadStream *stream, byte *&buf, int animSize) {
buf = (byte *)malloc(animSize);
stream->read(buf, animSize);
- Common::copy(buf, buf + animSize, pasoanimado);
+ Common::copy(buf, buf + animSize, curSecondaryAnimationFrame);
}
} // End of namespace Tot
diff --git a/engines/tot/graphics.h b/engines/tot/graphics.h
index 4f698f08c8a..11111b1dbf1 100644
--- a/engines/tot/graphics.h
+++ b/engines/tot/graphics.h
@@ -27,15 +27,10 @@
namespace Tot {
void initGraph();
-void getVirtualImg(uint getcoordx1, uint getcoordy1, uint getcoordx2, uint getcoordy2, byte *backgroundScreen, byte *image);
-void putVirtualImg(uint putcoordx, uint putcoordy, byte *backgroundScreen, byte *image);
-void clear();
void drawFullScreen(byte *screen);
void copyFromScreen(byte *&screen);
void drawScreen(byte *screen, bool offsetSize = true);
-void putImg(uint coordx, uint coordy, byte *image, bool transparency = false);
-void putShape(uint coordx, uint coordy, byte *image);
-void getImg(uint coordx1, uint coordy1, uint coordx2, uint coordy2, byte *image);
+
void loadPalette(Common::String image);
void screenTransition(byte effectNumber, bool fadeToBlack, byte *screen);
void turnLightOn();
@@ -47,10 +42,7 @@ void partialFadeIn(byte numCol);
void updatePalette(byte paletteIndex);
void changePalette(palette fromPalette, palette toPalette);
void changeRGBBlock(byte initialColor, uint numColors, byte *rgb);
-void processingActive();
-void rectangle(int x1, int y1, int x2, int y2, byte color);
-void rectangle(uint x1, uint y1, uint x2, uint y2, byte color);
-void screenHandleToBackground();
+void restoreBackground();
void copyPalette(palette from, palette to);
void loadAnimationIntoBuffer(Common::SeekableReadStream *stream, byte *&buf, int animSize);
} // End of namespace Tot
diff --git a/engines/tot/graphman.cpp b/engines/tot/graphman.cpp
index 1462f602539..c47f23051b3 100644
--- a/engines/tot/graphman.cpp
+++ b/engines/tot/graphman.cpp
@@ -35,6 +35,7 @@ GraphicsManager::GraphicsManager() {
for (int j = 0; j < 256; j++)
fadeData[i][j] = i / (j + 1);
+ // loads fonts
Common::File exeFile;
if (!exeFile.open(Common::Path("TOT.EXE"))) {
error("Could not open executable file!");
@@ -60,7 +61,7 @@ GraphicsManager::~GraphicsManager() {
delete(_bios);
}
-void GraphicsManager::restoreBackground(uint x, uint y, uint x2, uint y2) {
+void GraphicsManager::restoreBackgroundArea(uint x, uint y, uint x2, uint y2) {
for (int j = y; j < y2; j++) {
for (int i = x; i < x2; i++) {
*((byte *)g_engine->_screen->getBasePtr(i, j)) = 0;
@@ -76,7 +77,7 @@ void GraphicsManager::clear() {
}
void GraphicsManager::clearActionLine() {
- restoreBackground(0, 140, 319, 149);
+ restoreBackgroundArea(0, 140, 319, 149);
}
void GraphicsManager::writeActionLine(const Common::String &str) {
@@ -93,15 +94,108 @@ void GraphicsManager::fixPalette(byte *palette, uint num) {
}
}
-void GraphicsManager::getPalette(byte *palette) {
- g_system->getPaletteManager()->grabPalette(palette, 0, 256);
+
+void GraphicsManager::getImg(uint coordx1, uint coordy1, uint coordx2, uint coordy2, byte *image) {
+
+ uint16 width = coordx2 - coordx1;
+ uint16 height = coordy2 - coordy1;
+
+ WRITE_LE_UINT16(image, width);
+ WRITE_LE_UINT16(image + 2, height);
+
+ width++;
+ height++;
+
+ for (int j = 0; j < width; j++) {
+ for (int i = 0; i < height; i++) {
+ int idx = 4 + i * width + j;
+ *(image + idx) = *(byte *)g_engine->_screen->getBasePtr(coordx1 + j, coordy1 + i);
+ }
+ }
+}
+
+void GraphicsManager::putShape(uint coordx, uint coordy, byte *image) {
+ putImg(coordx, coordy, image, true);
+}
+
+void GraphicsManager::putImg(uint coordx, uint coordy, byte *image, bool transparency) {
+ uint16 w, h;
+
+ w = READ_LE_UINT16(image);
+ h = READ_LE_UINT16(image + 2);
+
+ w++;
+ h++;
+ for (int i = 0; i < w; i++) {
+ for (int j = 0; j < h; j++) {
+ int index = 4 + (j * w + i);
+ if (!transparency || image[index] != 0) {
+ *(byte *)g_engine->_screen->getBasePtr(coordx + i, coordy + j) = image[index];
+ }
+ }
+ }
+ g_engine->_screen->addDirtyRect(Common::Rect(coordx, coordy, coordx + w, coordy + h));
}
+
byte *GraphicsManager::getPalette() {
byte *palette = (byte *)malloc(768);
- getPalette(palette);
+ g_system->getPaletteManager()->grabPalette(palette, 0, 256);
return palette;
}
+
+// Copies the rectangle delimited by getCoord** from backgroundScreen into image
+void GraphicsManager::getImageArea(
+ uint getcoordx1, // xframe
+ uint getcoordy1, // yframe
+ uint getcoordx2, // xframe + framewidth
+ uint getcoordy2, // yframe + frameheight
+ byte *backgroundScreen,
+ byte *image
+) {
+ uint16 w = getcoordx2 - getcoordx1;
+ uint16 h = getcoordy2 - getcoordy1;
+
+ WRITE_UINT16(image, w);
+ WRITE_UINT16(image + 2, h);
+ w++;
+ h++;
+ int posAbs = 4 + getcoordx1 + (getcoordy1 * 320);
+
+ int sourcePtr = 0;
+ byte *destPtr = 4 + image; // Start writing after width and height
+
+ for (int i = 0; i < h; i++) {
+ for (int j = 0; j < w; j++) {
+ *destPtr++ = backgroundScreen[posAbs + sourcePtr++];
+ }
+ sourcePtr += (320 - w); // Move to the beginning of the next row in backgroundScreen
+ }
+}
+
+// puts an image into a buffer in the given position, asuming 320 width
+void GraphicsManager::putImageArea(uint putcoordx, uint putcoordy, byte *backgroundScreen, byte *image) {
+ uint16 w, h;
+
+ w = READ_LE_UINT16(image);
+ h = READ_LE_UINT16(image + 2);
+
+ w++;
+ h++;
+ int posAbs = 4 + putcoordx + (putcoordy * 320);
+
+ int sourcePtr = 0;
+ byte *destPtr = 4 + image; // Start writing after width and height
+
+ for (int i = 0; i < h; i++) {
+ for (int j = 0; j < w; j++) {
+ // if(destPtr > 0)
+ backgroundScreen[posAbs + sourcePtr++] = *destPtr++;
+ }
+ sourcePtr += (320 - w); // Move to the beginning of the next row in PantFondo
+ }
+}
+
// Debug function just to print a palette on the screen
void GraphicsManager::printPalette() {
diff --git a/engines/tot/graphman.h b/engines/tot/graphman.h
index 0565c3e8adb..2dd445819b5 100644
--- a/engines/tot/graphman.h
+++ b/engines/tot/graphman.h
@@ -36,19 +36,29 @@ public:
~GraphicsManager();
void printPalette();
-
void fixPalette(byte *palette, uint num = 768);
- void getPalette(byte *palette);
byte *getPalette();
void setPalette(byte palette[768], uint num = 256);
- void restoreBackground(uint x, uint y, uint x2, uint y2);
+ void restoreBackgroundArea(uint x, uint y, uint x2, uint y2);
+
+
+ void putImg(uint coordx, uint coordy, byte *image, bool transparency = false);
+ void getImg(uint coordx1, uint coordy1, uint coordx2, uint coordy2, byte *image);
+ void putShape(uint coordx, uint coordy, byte *image);
+ void putImageArea(uint putcoordx, uint putcoordy, byte *backgroundScreen, byte *image);
+ void getImageArea(uint getcoordx1, uint getcoordy1, uint getcoordx2, uint getcoordy2, byte *backgroundScreen, byte *image);
+
+
void littText(const Common::String &str, int x, int y, uint32 color, Graphics::TextAlign align = Graphics::kTextAlignLeft, bool alignCenterY = false);
void euroText(const Common::String &str, int x, int y, uint32 color, Graphics::TextAlign align = Graphics::kTextAlignLeft, bool alignCenterY = false);
void biosText(const Common::String &str, int x, int y, uint32 color);
+
void clear();
+
void clearActionLine();
void writeActionLine(const Common::String &str);
+
void printColor(int x, int y, int color);
Graphics::BgiFont _litt;
Graphics::BgiFont _euro;
diff --git a/engines/tot/mouseman.cpp b/engines/tot/mouseman.cpp
index 636e38f8943..43d663dc4fa 100644
--- a/engines/tot/mouseman.cpp
+++ b/engines/tot/mouseman.cpp
@@ -74,7 +74,7 @@ void MouseManager::setMousePos(Common::Point p) {
}
void MouseManager::printPos(int x, int y, int screenPosX, int screenPosY) {
- g_engine->_graphics->restoreBackground(screenPosX, screenPosY, screenPosX + 100, screenPosY + 10);
+ g_engine->_graphics->restoreBackgroundArea(screenPosX, screenPosY, screenPosX + 100, screenPosY + 10);
g_engine->_graphics->euroText(Common::String::format("MousePos: %d, %d", x + 7, y + 7), screenPosX, screenPosY, Graphics::kTextAlignLeft);
}
diff --git a/engines/tot/playanim.cpp b/engines/tot/playanim.cpp
index 894057385ce..7044f3b5792 100644
--- a/engines/tot/playanim.cpp
+++ b/engines/tot/playanim.cpp
@@ -34,17 +34,17 @@ Common::MemorySeekableReadWriteStream *conversationData;
Common::MemorySeekableReadWriteStream *rooms;
Common::MemorySeekableReadWriteStream *invItemData;
-byte iraton;
+byte mouseMaskIndex;
-uint xraton, yraton;
+uint mouseX, mouseY;
-uint pulsax, pulsay;
+uint mouseClickX, mouseClickY;
uint npraton2, npraton;
uint oldxrejilla, oldyrejilla;
-regispartida regpartida;
+SavedGame regpartida;
bool sello_quitado;
@@ -81,7 +81,7 @@ bool pintaractivo;
bool animacion2;
-palette movimientopal;
+palette palAnimSlice;
palette pal;
@@ -146,7 +146,7 @@ Common::String oldobjmochila, objetomochila;
Common::String nombreficherofoto;
-Common::String nombrepersonaje;
+Common::String characterName;
// Text decryption key
Common::String decryptionKey;
@@ -155,7 +155,7 @@ uint hornacina[2][4];
RoomFileRegister *currentRoomData;
-InvItemRegister regobj;
+ScreenObject regobj;
route mainRoute;
@@ -182,18 +182,18 @@ byte rejamascararaton[10][10];
bool list1Complete, list2Complete,
lista1, lista2;
-bool primera[maxpersonajes],
- lprimera[maxpersonajes],
- cprimera[maxpersonajes],
- libro[maxpersonajes],
- caramelos[maxpersonajes];
+bool primera[characterCount],
+ lprimera[characterCount],
+ cprimera[characterCount],
+ libro[characterCount],
+ caramelos[characterCount];
bool cavernas[5];
uint16 firstList[5], secondList[5];
-regsecuencia secuencia;
-reganimado animado;
+CharacterAnim secuencia;
+SecondaryAnim animado;
uint sizeframe,
segpasoframe,
ofspasoframe,
@@ -203,27 +203,27 @@ uint sizeframe,
segfondo,
offfondo;
-byte fotogramamax2;
+byte maxSecondaryAnimationFrames;
-byte tipoefectofundido;
+byte transitionEffect;
byte iframe, iframe2;
long screenSize;
-datosobj depthMap[numobjetosconv];
+ObjectInfo depthMap[numScreenOverlays];
-byte *screenObjects[numobjetosconv];
+byte *screenObjects[numScreenOverlays];
-byte *pasoframe;
+byte *curCharacterAnimationFrame;
-byte *pasoanimado;
+byte *curSecondaryAnimationFrame;
-byte *background;
+byte *sceneBackground;
byte *characterDirtyRect;
-byte *screenHandle;
+byte *backgroundCopy;
uint currentRoomNumber;
@@ -235,7 +235,7 @@ void clearObj() {
byte indpasolimpiador1, indpasolimpiador2;
regobj.code = 0;
- regobj.altura = 0;
+ regobj.height = 0;
regobj.name = "";
regobj.lookAtTextRef = 0;
regobj.beforeUseTextRef = 0;
@@ -243,22 +243,22 @@ void clearObj() {
regobj.pickTextRef = 0;
regobj.useTextRef = 0;
regobj.habla = 0;
- regobj.abrir = false;
- regobj.cerrar = false;
+ regobj.openable = false;
+ regobj.closeable = false;
for (indpasolimpiador1 = 0; indpasolimpiador1 <= 7; indpasolimpiador1++)
- regobj.usar[indpasolimpiador1] = 0;
- regobj.coger = false;
- regobj.usarcon = 0;
- regobj.reemplazarpor = 0;
- regobj.profundidad = 0;
- regobj.punterobitmap = 0;
- regobj.tambitmap = 0;
- regobj.punteroframesgiro = 0;
- regobj.punteropaletagiro = 0;
- regobj.xparche = 0;
- regobj.yparche = 0;
- regobj.puntparche = 0;
- regobj.tamparche = 0;
+ regobj.used[indpasolimpiador1] = 0;
+ regobj.pickupable = false;
+ regobj.useWith = 0;
+ regobj.replaceWith = 0;
+ regobj.depth = 0;
+ regobj.bitmapPointer = 0;
+ regobj.bitmapSize = 0;
+ regobj.rotatingObjectAnimation = 0;
+ regobj.rotatingObjectPalette = 0;
+ regobj.dropOverlayX = 0;
+ regobj.dropOverlayY = 0;
+ regobj.dropOverlay = 0;
+ regobj.dropOverlaySize = 0;
regobj.objectIconBitmap = 0;
regobj.xrej1 = 0;
regobj.yrej1 = 0;
@@ -266,8 +266,8 @@ void clearObj() {
regobj.yrej2 = 0;
for (indpasolimpiador1 = 0; indpasolimpiador1 < 10; indpasolimpiador1++) {
for (indpasolimpiador2 = 0; indpasolimpiador2 < 10; indpasolimpiador2++) {
- regobj.parcherejapantalla[indpasolimpiador1][indpasolimpiador2] = 0;
- regobj.parcherejaraton[indpasolimpiador1][indpasolimpiador2] = 0;
+ regobj.walkAreasPatch[indpasolimpiador1][indpasolimpiador2] = 0;
+ regobj.mouseGridPatch[indpasolimpiador1][indpasolimpiador2] = 0;
}
}
contadorpc2 = contadorpc;
@@ -382,7 +382,7 @@ void resetGameState() {
cavernas[4] = false;
animacion2 = false;
- secuencia.profundidad = 0;
+ secuencia.depth = 0;
rightSfxVol = 6;
leftSfxVol = 6;
musicVolRight = 3;
@@ -698,14 +698,14 @@ void initPlayAnim() {
// encriptado[252] = encripcod1;
// encriptado[253] = '\63';
tocapintar = false;
- for (int i = 0; i < numobjetosconv; i++) {
+ for (int i = 0; i < numScreenOverlays; i++) {
screenObjects[i] = NULL;
}
- xraton = 160;
- yraton = 100;
- pulsax = xraton;
- pulsay = yraton;
- iraton = 1;
+ mouseX = 160;
+ mouseY = 100;
+ mouseClickX = mouseX;
+ mouseClickY = mouseY;
+ mouseMaskIndex = 1;
resetGameState();
firstList[0] = 222;
@@ -728,11 +728,11 @@ void initPlayAnim() {
}
void clearVars() {
- if(background != NULL) {
- free(background);
+ if(sceneBackground != NULL) {
+ free(sceneBackground);
}
- if(screenHandle != NULL) {
- free(screenHandle);
+ if(backgroundCopy != NULL) {
+ free(backgroundCopy);
}
if(conversationData != NULL) {
free(conversationData);
@@ -743,7 +743,7 @@ void clearVars() {
if(invItemData != NULL) {
free(invItemData);
}
- for(int i = 0; i < numobjetosconv; i++) {
+ for(int i = 0; i < numScreenOverlays; i++) {
if(screenObjects[i] != NULL) {
free(screenObjects[i]);
}
@@ -763,8 +763,8 @@ void clearVars() {
for (int i = 0; i < 4; i++) {
for (int j = 0; j < secAnimationFrameCount; j++) {
- if(animado.dib[i][j] != NULL){
- free(animado.dib[i][j]);
+ if(animado.bitmap[i][j] != NULL){
+ free(animado.bitmap[i][j]);
}
}
}
diff --git a/engines/tot/playanim.h b/engines/tot/playanim.h
index 0eff2edd56f..907b931803f 100644
--- a/engines/tot/playanim.h
+++ b/engines/tot/playanim.h
@@ -33,23 +33,19 @@ const int verbRegSize = 263;
const int roomRegSize = 10856;
const int itemRegSize = 279;
-// Enforces a small delay when text reveal is supposed to happen
-const int enforcedTextAnimDelay = 0;
-
-const int indicelista1 = 19;
-const int indicelista2 = 20;
-const int codigolista1 = 149;
-const int codigolista2 = 150;
-const int memoriaminima = 130000;
+const int list1Index = 19;
+const int list2Index = 20;
+const int list1code = 149;
+const int list2code = 150;
/**
* Num of icons in the inventory
*/
const int inventoryIconCount = 34;
-const int numobjetosconv = 15;
+const int numScreenOverlays = 15;
/**
* Num of depth levels
*/
-const int nivelesdeprof = 15;
+const int depthLevelCount = 15;
/**
* Num of frames of the main character in a single direction
*/
@@ -58,39 +54,30 @@ const int walkFrameCount = 16;
* Num of frames in the secondary animation
*/
const int secAnimationFrameCount = 50;
-/**
- * Screen size
- */
-const int tampan = 320 * 140;
/**
* X factor of the screen grid
* This results in 320/8 = 40 quadrants.
*/
-const int factorx = 8;
+const int xGridCount = 8;
/**
* Y factor of the screen grid
* This results in 140/5 = 28 quadrants.
*/
-const int factory = 5;
+const int yGridCount = 5;
/**
- * Adjustment of feet on frame 49
+ * Y offset of feet within character sprite (for adjustment of path finding)
*/
-const int rectificaciony = 49;
+const int characerCorrectionY = 49;
/**
- * Adjustment of feet on frame 28
+ * X offset of feet within character sprite (for adjustment of path finding)
*/
-const int rectificacionx = 14;
-const int longitudnombreobjeto = 20;
-const int maxpersonajes = 9;
-/**
- * Num of reserved colors at the end of the game's palette
- */
-const int coloresreservados = 28;
+const int characterCorrectionX = 14;
+const int objectNameLength = 20;
+const int characterCount = 9;
/**
* Size of an inventory icon (39x26)
*/
-const int sizeicono = 1018;
-const int tamcarahablando = 7206;
+const int inventoryIconSize = 1018;
/**
* Number of points in a
*/
@@ -101,18 +88,18 @@ const int routePointCount = 7;
*/
typedef Common::Point route[routePointCount];
-struct datosobj {
- uint16 codigo, posx, posy, posx2, posy2;
+struct ObjectInfo {
+ uint16 code, posx, posy, posx2, posy2;
};
-struct regsecuencia {
- uint16 profundidad;
+struct CharacterAnim {
+ uint16 depth;
byte *bitmap[4][walkFrameCount + 30]; // 30 = 3 actions * 10 frames each
};
-struct reganimado {
- uint16 profundidad, dir, posx, posy;
- byte *dib[4][secAnimationFrameCount];
+struct SecondaryAnim {
+ uint16 depth, dir, posx, posy;
+ byte *bitmap[4][secAnimationFrameCount];
};
struct reginventario {
@@ -125,73 +112,71 @@ struct reginventario {
* Hypertext struct
*/
struct regismht {
- Common::String cadenatext; // string
- bool encadenado; // true if the next entry is a continuation of this one
- uint16 respuesta; // entry number of reply
- int32 punteronil;
+ Common::String text; // string
+ bool continued; // true if the next entry is a continuation of this one
+ uint16 response; // entry number of reply
+ int32 pointer;
};
-struct InvItemRegister {
+struct ScreenObject {
/**
* registry number
*/
uint16 code;
- byte altura; /* 0 top 1 middle 2 bottom*/
- Common::String name; /*name for mouseover*/
- uint16 lookAtTextRef; /* Registro al mirar el objeto en pantalla */
- uint16 beforeUseTextRef; /* Registro antes de usar el objeto en mochila */
- uint16 afterUseTextRef; /* Registro despues de usar el objeto en mochila */
- uint16 pickTextRef; /* Registro al coger el objeto */
- uint16 useTextRef; /* Registro al usar el objeto */
- byte habla; /* number of character to respond */
- bool abrir; /* true if it can be opened */
- bool cerrar; /* true if it can be closed*/
- byte usar[8];
- bool coger;
- uint16 usarcon,
- reemplazarpor; /*Numero del objeto por el que se reemplaza en el
- caso de que se utilize con un objeto de la mochila
- y haya que cambiarlo por otro.*/
- byte profundidad;
- uint32 punterobitmap; /*Puntero al fichero de bitmap para el
- objeto que se suelta en la pantalla*/
- uint16 tambitmap;
- uint32 punteroframesgiro; /*Puntero al fichero de
- bitmap para el objeto girando*/
- uint16 punteropaletagiro, /*Puntero al fichero de paletas para
- la imagen girando*/
- xparche, yparche;
- uint32 puntparche;
- uint16 tamparche, objectIconBitmap;
- byte xrej1, yrej1, xrej2, yrej2;
-
- byte parcherejapantalla[10][10];
- byte parcherejaraton[10][10];
+ byte height; /* 0 top 1 middle 2 bottom, determines character anim on use/pick*/
+ Common::String name; /* name for mouseover*/
+ uint16 lookAtTextRef; /* Text reference when looking at object */
+ uint16 beforeUseTextRef; /* Text reference before using object */
+ uint16 afterUseTextRef; /* Text reference after using object */
+ uint16 pickTextRef; /* Text reference when picking up object */
+ uint16 useTextRef; /* Text reference when using object */
+ byte habla; /* whether the object talks or not */
+ bool openable; /* true if it can be opened */
+ bool closeable; /* true if it can be closed*/
+ byte used[8]; /* flags (one per original savegame) on whether the object has been used */
+ bool pickupable;
+ uint16 useWith,
+ replaceWith; /* Code of the object it should be replaced with in case a replacement is due.*/
+ byte depth;
+ uint32 bitmapPointer; /* reference to the objects bitmap in the bitmap resource file */
+ uint16 bitmapSize;
+ uint32 rotatingObjectAnimation; /* Pointer to the FLC animation of the rotatin object */
+ uint16 rotatingObjectPalette; /* Pointer to the palette of the above FLC animation*/
+ uint16 dropOverlayX, dropOverlayY; /* coords when the object requires placing an overlay on the screen */
+ uint32 dropOverlay; /* pointer to such overlay */
+ uint16 dropOverlaySize;
+ uint16 objectIconBitmap; /* Icon on the inventory */
+
+ byte xrej1, yrej1, xrej2, yrej2; /* position of patches below*/
+
+ byte walkAreasPatch[10][10]; /* patch on the scene's walking area (e.g. object prevents character from walking */
+ byte mouseGridPatch[10][10]; /* patch on the mouse grid area (i.e. selectable area of the object */
};
struct DoorRegistry {
- uint16 pantallaquecarga,
- posxsalida, posysalida; /*Coordenadas x e y de salida del
- personaje en la siguiente pantalla*/
- byte abiertacerrada, codigopuerta;
+ uint16 nextScene,
+ exitPosX,
+ exitPosY;
+ byte openclosed,
+ doorcode;
};
struct RoomObjectListEntry {
- uint16 indicefichero;
+ uint16 fileIndex;
Common::String objectName;
};
struct RoomBitmapRegister {
- int32 puntbitmap;
- uint16 tambitmap;
- uint16 coordx, coordy, profund;
+ int32 bitmapPointer;
+ uint16 bitmapSize;
+ uint16 coordx, coordy, depth;
};
struct RoomFileRegister {
- uint16 codigo;
- int32 puntimagenpantalla;
- uint16 tamimagenpantalla;
- byte rejapantalla[40][28]; /* movement grid */
+ uint16 code;
+ int32 roomImagePointer;
+ uint16 roomImageSize;
+ byte walkAreasGrid[40][28]; /* movement grid */
byte mouseGrid[40][28]; /* mousegrid with index to indexadoObjetos */
/**
* This is a preset matrix of trajectories from different areas of the game.action
@@ -209,18 +194,18 @@ struct RoomFileRegister {
*/
Common::Point trajectories[9][30][5];
DoorRegistry doors[5]; /* doors in the room */
- RoomBitmapRegister bitmapasociados[15];
- RoomObjectListEntry *indexadoobjetos[51] = {NULL}; /* includes name of objects for mouseover + index to object file*/
- bool animationFlag; /* true if there is a secondary animation */
- Common::String nombremovto; /* name of the secondary animation, 8 chars*/
- bool paletteAnimationFlag; /* true if there exist palette animation */
- uint16 puntpaleta; /* points to the screen palette */
- Common::Point tray2[300]; /* trajectory of the secondary animation */
- uint16 dir2[300]; /* directions of the secondary trajectory. Pos 300 reflects object code. */
- uint16 longtray2; /* longitude of the trajectory of the secondary animation */
+ RoomBitmapRegister screenLayers[15];
+ RoomObjectListEntry *screenObjectIndex[51] = {NULL}; /* includes name of objects for mouseover + index to object file*/
+ bool animationFlag; /* true if there is a secondary animation */
+ Common::String animationName; /* name of the secondary animation, 8 chars*/
+ bool paletteAnimationFlag; /* true if there exist palette animation */
+ uint16 palettePointer; /* points to the screen palette */
+ Common::Point secondaryAnimTrajectory[300]; /* trajectory of the secondary animation */
+ uint16 secondaryAnimDirections[300]; /* directions of the secondary trajectory. Pos 300 reflects object code. */
+ uint16 secondaryTrajectoryLength; /* length of the trajectory of the secondary animation */
};
-struct regispartida {
+struct SavedGame {
uint numeropantalla,
longtray,
indicetray,
@@ -277,11 +262,11 @@ struct regispartida {
route mainRoute;
uint16 firstList[5], secondList[5];
Common::Point trayec[300];
- bool primera[maxpersonajes],
- lprimera[maxpersonajes],
- cprimera[maxpersonajes],
- libro[maxpersonajes],
- caramelos[maxpersonajes];
+ bool primera[characterCount],
+ lprimera[characterCount],
+ cprimera[characterCount],
+ libro[characterCount],
+ caramelos[characterCount];
bool cavernas[5];
uint hornacina[2][4];
@@ -295,15 +280,15 @@ extern Common::MemorySeekableReadWriteStream *invItemData;
/**
* Frame index of the mouse mask
*/
-extern byte iraton;
+extern byte mouseMaskIndex;
/**
* Coords of the mouse sprite
*/
-extern uint xraton, yraton;
+extern uint mouseX, mouseY;
/**
* Coords of mouse clicks
*/
-extern uint pulsax, pulsay;
+extern uint mouseClickX, mouseClickY;
/**
* Mouse clicks for both buttons
*/
@@ -314,7 +299,7 @@ extern uint npraton2, npraton;
*/
extern uint oldxrejilla, oldyrejilla;
-extern regispartida regpartida;
+extern SavedGame regpartida;
extern bool sello_quitado;
@@ -375,7 +360,7 @@ extern bool animacion2;
/**
* 54 color palette slice.
*/
-extern palette movimientopal;
+extern palette palAnimSlice;
/**
* General palette
*/
@@ -506,7 +491,7 @@ extern Common::String nombreficherofoto;
/**
* Name of player
*/
-extern Common::String nombrepersonaje;
+extern Common::String characterName;
extern Common::String decryptionKey;
@@ -514,7 +499,7 @@ extern uint hornacina[2][4];
extern RoomFileRegister *currentRoomData;
-extern InvItemRegister regobj;
+extern ScreenObject regobj;
/**
* New movement to execute.
*/
@@ -568,11 +553,11 @@ extern bool list1Complete,
lista1, // whether we've been given list 1
lista2; // whether we've been given list 2
-extern bool primera[maxpersonajes],
- lprimera[maxpersonajes],
- cprimera[maxpersonajes],
- libro[maxpersonajes],
- caramelos[maxpersonajes];
+extern bool primera[characterCount],
+ lprimera[characterCount],
+ cprimera[characterCount],
+ libro[characterCount],
+ caramelos[characterCount];
extern bool cavernas[5];
/**
@@ -583,24 +568,17 @@ extern uint16 firstList[5],
/**
* Animation sequence
*/
-extern regsecuencia secuencia;
-extern reganimado animado;
-extern uint sizeframe,
- segpasoframe,
- ofspasoframe,
- sizeanimado,
- segpasoanimado,
- ofspasoanimado,
- segfondo,
- offfondo;
+extern CharacterAnim secuencia;
+extern SecondaryAnim animado;
+extern uint sizeframe, sizeanimado;
/**
* Max num of loaded frames for secondary animation
*/
-extern byte fotogramamax2;
+extern byte maxSecondaryAnimationFrames;
/**
* Index of fade effect for room change
*/
-extern byte tipoefectofundido;
+extern byte transitionEffect;
/**
* Frame number for the animations
*/
@@ -611,24 +589,24 @@ extern long screenSize;
/**
* Depth of screenobjects
*/
-extern datosobj depthMap[numobjetosconv];
+extern ObjectInfo depthMap[numScreenOverlays];
/**
* Bitmaps of screenobjects
*/
-extern byte *screenObjects[numobjetosconv];
+extern byte *screenObjects[numScreenOverlays];
/**
* Current frame of main character
*/
-extern byte *pasoframe;
+extern byte *curCharacterAnimationFrame;
/**
* Current frame of secondary animation
*/
-extern byte *pasoanimado;
+extern byte *curSecondaryAnimationFrame;
/**
* Pointer storing the screen as it displays on the game
*/
-extern byte *background;
+extern byte *sceneBackground;
/**
* Dirty patch of screen to repaint on every frame
@@ -637,7 +615,7 @@ extern byte *characterDirtyRect;
/**
* Stores a copy of the background bitmap
*/
-extern byte *screenHandle;
+extern byte *backgroundCopy;
extern uint currentRoomNumber;
diff --git a/engines/tot/routines.cpp b/engines/tot/routines.cpp
index c9ab3a3b3e2..17446599315 100644
--- a/engines/tot/routines.cpp
+++ b/engines/tot/routines.cpp
@@ -35,6 +35,31 @@ void drawText(uint numero) {
verb.close();
}
+
+void processingActive() {
+ const char *msg = (g_engine->_lang == Common::ES_ESP) ? fullScreenMessages[0][58] : fullScreenMessages[0][58];
+
+ setRGBPalette(255, 63, 63, 63);
+ littText(121, 72, msg, 0);
+ g_engine->_screen->update();
+ delay(enforcedTextAnimDelay);
+ littText(120, 71, msg, 0);
+ g_engine->_screen->update();
+ delay(enforcedTextAnimDelay);
+ littText(119, 72, msg, 0);
+ g_engine->_screen->update();
+ delay(enforcedTextAnimDelay);
+ littText(120, 73, msg, 0);
+ g_engine->_screen->update();
+ delay(enforcedTextAnimDelay);
+ littText(120, 72, msg, 255);
+ g_engine->_screen->update();
+
+ // enforce a delay for now so it's visible
+ g_system->delayMillis(200);
+}
+
+
void runaroundRed() {
const uint trayseg[91][2] = {
{204, 47}, {204, 49}, {203, 51}, {203, 53}, {201, 55}, {199, 57}, {197, 59}, {195, 61},
@@ -73,16 +98,16 @@ void runaroundRed() {
animado.posy = trayseg[itrayseg][1] - 42;
if (itrayseg >= 0 && itrayseg <= 8) {
animado.dir = 2;
- animado.profundidad = 1;
+ animado.depth = 1;
} else if (itrayseg >= 9 && itrayseg <= 33) {
animado.dir = 2;
- animado.profundidad = 14;
+ animado.depth = 14;
} else if (itrayseg >= 34 && itrayseg <= 63) {
animado.dir = 1;
- animado.profundidad = 14;
+ animado.depth = 14;
} else {
animado.dir = 0;
- animado.profundidad = 3;
+ animado.depth = 3;
}
tocapintar2 = true;
@@ -101,30 +126,30 @@ void runaroundRed() {
}
} while (!exitLoop && !g_engine->shouldQuit());
freeAnimation();
- screenHandleToBackground();
+ restoreBackground();
assembleScreen();
- drawScreen(background);
+ drawScreen(sceneBackground);
}
void updateMovementCells() {
uint j1arm, j2arm;
byte i1arm, i2arm;
- j1arm = (currentRoomData->tray2[indicetray2 - 1].x / factorx) + 1;
- j2arm = (currentRoomData->tray2[indicetray2 - 1].y / factory) + 1;
+ j1arm = (currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].x / xGridCount) + 1;
+ j2arm = (currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].y / yGridCount) + 1;
if ((oldposx != j1arm) || (oldposy != j2arm)) {
for (i1arm = 0; i1arm < maxrejax; i1arm++)
for (i2arm = 0; i2arm < maxrejay; i2arm++) {
- currentRoomData->rejapantalla[oldposx + i1arm][oldposy + i2arm] = rejafondomovto[i1arm][i2arm];
+ currentRoomData->walkAreasGrid[oldposx + i1arm][oldposy + i2arm] = rejafondomovto[i1arm][i2arm];
currentRoomData->mouseGrid[oldposx + i1arm][oldposy + i2arm] = rejafondoraton[i1arm][i2arm];
}
for (i1arm = 0; i1arm < maxrejax; i1arm++)
for (i2arm = 0; i2arm < maxrejay; i2arm++) {
- rejafondomovto[i1arm][i2arm] = currentRoomData->rejapantalla[j1arm + i1arm][j2arm + i2arm];
+ rejafondomovto[i1arm][i2arm] = currentRoomData->walkAreasGrid[j1arm + i1arm][j2arm + i2arm];
if (rejamascaramovto[i1arm][i2arm] > 0)
- currentRoomData->rejapantalla[j1arm + i1arm][j2arm + i2arm] = rejamascaramovto[i1arm][i2arm];
+ currentRoomData->walkAreasGrid[j1arm + i1arm][j2arm + i2arm] = rejamascaramovto[i1arm][i2arm];
rejafondoraton[i1arm][i2arm] = currentRoomData->mouseGrid[j1arm + i1arm][j2arm + i2arm];
if (rejamascararaton[i1arm][i2arm] > 0)
@@ -157,7 +182,7 @@ static void assembleBackground() {
// XMStoPointer(ptr(segfondo, (offfondo + 4)), handpantalla, 4, (sizepantalla - longint(4)));
// copies the entire clean background in handpantalla back into fondo
- screenHandleToBackground();
+ restoreBackground();
posabs = 4 + posfondoy * 320 + posfondox;
// debug("posabs = %d, posfondox = %d, posfondoy=%d", posabs, posfondox, posfondoy);
@@ -174,7 +199,7 @@ static void assembleBackground() {
for (int i = 0; i < w; i++) {
int pos = posabs + j * 320 + i;
int destPos = 4 + (j * w + i);
- characterDirtyRect[destPos] = background[pos];
+ characterDirtyRect[destPos] = sceneBackground[pos];
}
}
}
@@ -246,13 +271,13 @@ void drawMainCharacter() {
bool debug = false;
if (debug) {
- screenTransition(13, false, background);
+ screenTransition(13, false, sceneBackground);
}
uint16 tempW;
uint16 tempH;
- tempW = READ_LE_UINT16(pasoframe);
- tempH = READ_LE_UINT16(pasoframe + 2);
+ tempW = READ_LE_UINT16(curCharacterAnimationFrame);
+ tempH = READ_LE_UINT16(curCharacterAnimationFrame + 2);
tempW += 6;
tempH += 6;
@@ -263,15 +288,15 @@ void drawMainCharacter() {
assembleBackground();
indice = 0;
- while (indice != nivelesdeprof) {
+ while (indice != depthLevelCount) {
overlayObject();
- if (secuencia.profundidad == indice)
- assembleImage(pasoframe, characterPosX, characterPosY);
+ if (secuencia.depth == indice)
+ assembleImage(curCharacterAnimationFrame, characterPosX, characterPosY);
indice += 1;
}
- putImg(posfondox, posfondoy, characterDirtyRect);
+ g_engine->_graphics->putImg(posfondox, posfondoy, characterDirtyRect);
if (debug) {
// draw background dirty area
@@ -291,25 +316,25 @@ void drawMainCharacter() {
void sprites(bool pintapersonaje) {
// grabs the current frame from the walk cycle
- pasoframe = secuencia.bitmap[direccionmovimiento][iframe];
+ curCharacterAnimationFrame = secuencia.bitmap[direccionmovimiento][iframe];
posfondox = characterPosX - 3;
posfondoy = characterPosY - 3;
if (animacion2) {
- if (currentRoomData->longtray2 > 1) {
+ if (currentRoomData->secondaryTrajectoryLength > 1) {
updateMovementCells();
}
if (tocapintar2) {
if (peteractivo && !g_engine->_sound->isVocPlaying()) {
iframe2 = 0;
}
- pasoanimado = animado.dib[animado.dir][iframe2];
+ curSecondaryAnimationFrame = animado.bitmap[animado.dir][iframe2];
}
- uint16 pasoframeW = READ_LE_UINT16(pasoframe);
- uint16 pasoframeH = READ_LE_UINT16(pasoframe + 2);
+ uint16 pasoframeW = READ_LE_UINT16(curCharacterAnimationFrame);
+ uint16 pasoframeH = READ_LE_UINT16(curCharacterAnimationFrame + 2);
- uint16 pasoanimadoW = READ_LE_UINT16(pasoanimado);
- uint16 pasoanimadoH = READ_LE_UINT16(pasoanimado + 2);
+ uint16 pasoanimadoW = READ_LE_UINT16(curSecondaryAnimationFrame);
+ uint16 pasoanimadoH = READ_LE_UINT16(curSecondaryAnimationFrame + 2);
if (
((animado.posx < (characterPosX + pasoframeW) + 4) &&
@@ -348,15 +373,15 @@ void sprites(bool pintapersonaje) {
assembleBackground(); // {Montar el Sprite Total}
indice = 0;
- while (indice != nivelesdeprof) {
+ while (indice != depthLevelCount) {
overlayObject();
- if (animado.profundidad == indice)
- assembleImage(pasoanimado, animado.posx, animado.posy);
- if (secuencia.profundidad == indice)
- assembleImage(pasoframe, characterPosX, characterPosY);
+ if (animado.depth == indice)
+ assembleImage(curSecondaryAnimationFrame, animado.posx, animado.posy);
+ if (secuencia.depth == indice)
+ assembleImage(curCharacterAnimationFrame, characterPosX, characterPosY);
indice += 1;
}
- putImg(posfondox, posfondoy, characterDirtyRect);
+ g_engine->_graphics->putImg(posfondox, posfondoy, characterDirtyRect);
} else { // character and animation are in different parts of the screen
if (pintapersonaje) {
@@ -366,8 +391,8 @@ void sprites(bool pintapersonaje) {
posfondox = animado.posx - 3;
posfondoy = animado.posy - 3;
- pasoanimadoW = READ_LE_UINT16(pasoanimado) + 6;
- pasoanimadoH = READ_LE_UINT16(pasoanimado + 2) + 6;
+ pasoanimadoW = READ_LE_UINT16(curSecondaryAnimationFrame) + 6;
+ pasoanimadoH = READ_LE_UINT16(curSecondaryAnimationFrame + 2) + 6;
if (posfondoy + pasoanimadoH > 140) {
pasoanimadoH -= (posfondoy + pasoanimadoH) - 140 + 1;
@@ -383,13 +408,13 @@ void sprites(bool pintapersonaje) {
assembleBackground();
indice = 0;
- while (indice != nivelesdeprof) {
+ while (indice != depthLevelCount) {
overlayObject();
- if (animado.profundidad == indice)
- assembleImage(pasoanimado, animado.posx, animado.posy);
+ if (animado.depth == indice)
+ assembleImage(curSecondaryAnimationFrame, animado.posx, animado.posy);
indice += 1;
}
- putImg(posfondox, posfondoy, characterDirtyRect);
+ g_engine->_graphics->putImg(posfondox, posfondoy, characterDirtyRect);
}
} else if (pintapersonaje) {
drawMainCharacter();
@@ -480,20 +505,20 @@ void animatedSequence(uint numSequence) {
emptyLoop();
tocapintar = false;
if (tocapintar2) {
- if (indicetray2 >= currentRoomData->longtray2)
+ if (indicetray2 >= currentRoomData->secondaryTrajectoryLength)
indicetray2 = 1;
else
indicetray2 += 1;
- animado.posx = currentRoomData->tray2[indicetray2 - 1].x;
- animado.posy = currentRoomData->tray2[indicetray2 - 1].y;
- animado.dir = currentRoomData->dir2[indicetray2 - 1];
+ animado.posx = currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].x;
+ animado.posy = currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].y;
+ animado.dir = currentRoomData->secondaryAnimDirections[indicetray2 - 1];
if (iframe2 >= secondaryAnimationFrameCount - 1)
iframe2 = 0;
else
iframe2++;
sprites(false);
animationFile.read(animptr, tamsecani);
- putImg(animx, animy, animptr);
+ g_engine->_graphics->putImg(animx, animy, animptr);
indiceani += 1;
}
} while (indiceani != numframessec && !g_engine->shouldQuit());
@@ -523,20 +548,20 @@ void animatedSequence(uint numSequence) {
emptyLoop();
tocapintar = false;
if (tocapintar2) {
- if (indicetray2 >= currentRoomData->longtray2)
+ if (indicetray2 >= currentRoomData->secondaryTrajectoryLength)
indicetray2 = 1;
else
indicetray2 += 1;
- animado.posx = currentRoomData->tray2[indicetray2 - 1].x;
- animado.posy = currentRoomData->tray2[indicetray2 - 1].y;
- animado.dir = currentRoomData->dir2[indicetray2 - 1];
+ animado.posx = currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].x;
+ animado.posy = currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].y;
+ animado.dir = currentRoomData->secondaryAnimDirections[indicetray2 - 1];
if (iframe2 >= secondaryAnimationFrameCount - 1)
iframe2 = 0;
else
iframe2++;
sprites(false);
animationFile.read(animptr, tamsecani);
- putImg(animx, animy, animptr);
+ g_engine->_graphics->putImg(animx, animy, animptr);
indiceani += 1;
}
} while (indiceani != numframessec && !g_engine->shouldQuit());
@@ -566,20 +591,20 @@ void animatedSequence(uint numSequence) {
emptyLoop();
tocapintar = false;
if (tocapintar2) {
- if (indicetray2 >= currentRoomData->longtray2)
+ if (indicetray2 >= currentRoomData->secondaryTrajectoryLength)
indicetray2 = 1;
else
indicetray2 += 1;
- animado.posx = currentRoomData->tray2[indicetray2 - 1].x;
- animado.posy = currentRoomData->tray2[indicetray2 - 1].y;
- animado.dir = currentRoomData->dir2[indicetray2 - 1];
+ animado.posx = currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].x;
+ animado.posy = currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].y;
+ animado.dir = currentRoomData->secondaryAnimDirections[indicetray2 - 1];
if (iframe2 >= secondaryAnimationFrameCount - 1)
iframe2 = 0;
else
iframe2++;
sprites(false);
animationFile.read(animptr, tamsecani);
- putImg(animx, animy, animptr);
+ g_engine->_graphics->putImg(animx, animy, animptr);
indiceani += 1;
}
} while (indiceani != numframessec && !g_engine->shouldQuit());
@@ -618,19 +643,19 @@ void animatedSequence(uint numSequence) {
updatePalette(movidapaleta);
} else
saltospal += 1;
- putShape(animx, animy, animptr);
+ g_engine->_graphics->putShape(animx, animy, animptr);
}
- screenObjects[regobj.profundidad - 1] = NULL;
- screenHandleToBackground();
- indiceani = secuencia.profundidad;
- secuencia.profundidad = 30;
+ screenObjects[regobj.depth - 1] = NULL;
+ restoreBackground();
+ indiceani = secuencia.depth;
+ secuencia.depth = 30;
screenObjects[13] = animptr;
depthMap[13].posx = animx;
depthMap[13].posy = animy;
assembleScreen();
- drawScreen(background);
+ drawScreen(sceneBackground);
screenObjects[13] = NULL;
- secuencia.profundidad = indiceani;
+ secuencia.depth = indiceani;
drawBackpack();
for (indiceani = 32; indiceani <= numframessec; indiceani++) {
animationFile.read(animptr, tamsecani);
@@ -645,7 +670,7 @@ void animatedSequence(uint numSequence) {
updatePalette(movidapaleta);
} else
saltospal += 1;
- putImg(animx, animy, animptr);
+ g_engine->_graphics->putImg(animx, animy, animptr);
if (g_engine->shouldQuit()) {
break;
}
@@ -668,27 +693,27 @@ void animatedSequence(uint numSequence) {
animationFile.read(animptr, tamsecani);
emptyLoop();
tocapintar = false;
- putShape(animx, animy, animptr);
+ g_engine->_graphics->putShape(animx, animy, animptr);
if (g_engine->shouldQuit()) {
break;
}
}
- indiceani = secuencia.profundidad;
- secuencia.profundidad = 30;
+ indiceani = secuencia.depth;
+ secuencia.depth = 30;
screenObjects[12] = animptr;
depthMap[12].posx = animx;
depthMap[12].posy = animy;
disableSecondAnimation();
screenObjects[12] = NULL;
- secuencia.profundidad = indiceani;
- drawScreen(background);
+ secuencia.depth = indiceani;
+ drawScreen(sceneBackground);
for (indiceani = 9; indiceani <= numframessec; indiceani++) {
animationFile.read(animptr, tamsecani);
emptyLoop();
tocapintar = false;
emptyLoop();
tocapintar = false;
- putShape(animx, animy, animptr);
+ g_engine->_graphics->putShape(animx, animy, animptr);
if (g_engine->shouldQuit()) {
break;
}
@@ -728,11 +753,11 @@ void animatedSequence(uint numSequence) {
saltospal += 1;
if (tocapintar2) {
animationFile.read(screenObjects[6], tamsecani);
- Common::copy(screenObjects[6], screenObjects[6] + tamsecani, background + 44900);
+ Common::copy(screenObjects[6], screenObjects[6] + tamsecani, sceneBackground + 44900);
// blockread(ficherosecuenciaanimada, objetos[7], tamsecani);
- screenHandleToBackground();
+ restoreBackground();
assembleScreen();
- drawScreen(background);
+ drawScreen(sceneBackground);
indiceani += 1;
if (indiceani == 8)
g_engine->_sound->playVoc("PUFF", 191183, 18001);
@@ -748,11 +773,11 @@ void animatedSequence(uint numSequence) {
DoorRegistry readRegPuertas(Common::SeekableReadStream *screenDataFile) {
DoorRegistry doorMetadata;
- doorMetadata.pantallaquecarga = screenDataFile->readUint16LE();
- doorMetadata.posxsalida = screenDataFile->readUint16LE();
- doorMetadata.posysalida = screenDataFile->readUint16LE();
- doorMetadata.abiertacerrada = screenDataFile->readByte();
- doorMetadata.codigopuerta = screenDataFile->readByte();
+ doorMetadata.nextScene = screenDataFile->readUint16LE();
+ doorMetadata.exitPosX = screenDataFile->readUint16LE();
+ doorMetadata.exitPosY = screenDataFile->readUint16LE();
+ doorMetadata.openclosed = screenDataFile->readByte();
+ doorMetadata.doorcode = screenDataFile->readByte();
return doorMetadata;
}
@@ -766,17 +791,17 @@ Common::Point readPunto(Common::SeekableReadStream *screenDataFile) {
RoomBitmapRegister readBitmapAux(Common::SeekableReadStream *screenDataFile) {
RoomBitmapRegister bitmapMetadata = RoomBitmapRegister();
- bitmapMetadata.puntbitmap = screenDataFile->readSint32LE();
- bitmapMetadata.tambitmap = screenDataFile->readUint16LE();
+ bitmapMetadata.bitmapPointer = screenDataFile->readSint32LE();
+ bitmapMetadata.bitmapSize = screenDataFile->readUint16LE();
bitmapMetadata.coordx = screenDataFile->readUint16LE();
bitmapMetadata.coordy = screenDataFile->readUint16LE();
- bitmapMetadata.profund = screenDataFile->readUint16LE();
+ bitmapMetadata.depth = screenDataFile->readUint16LE();
return bitmapMetadata;
}
RoomObjectListEntry *readRegIndexadoObjetos(Common::SeekableReadStream *screenDataFile) {
RoomObjectListEntry *objectMetadata = new RoomObjectListEntry();
- objectMetadata->indicefichero = screenDataFile->readUint16LE();
+ objectMetadata->fileIndex = screenDataFile->readUint16LE();
objectMetadata->objectName = screenDataFile->readPascalString();
screenDataFile->skip(20 - objectMetadata->objectName.size());
@@ -786,10 +811,10 @@ RoomObjectListEntry *readRegIndexadoObjetos(Common::SeekableReadStream *screenDa
RoomFileRegister *readScreenDataFile(Common::SeekableReadStream *screenDataFile) {
RoomFileRegister *screenData = new RoomFileRegister();
- screenData->codigo = screenDataFile->readUint16LE();
- screenData->puntimagenpantalla = screenDataFile->readUint32LE();
- screenData->tamimagenpantalla = screenDataFile->readUint16LE();
- screenDataFile->read(screenData->rejapantalla, 40 * 28);
+ screenData->code = screenDataFile->readUint16LE();
+ screenData->roomImagePointer = screenDataFile->readUint32LE();
+ screenData->roomImageSize = screenDataFile->readUint16LE();
+ screenDataFile->read(screenData->walkAreasGrid, 40 * 28);
screenDataFile->read(screenData->mouseGrid, 40 * 28);
// read puntos
for (int i = 0; i < 9; i++) {
@@ -804,22 +829,22 @@ RoomFileRegister *readScreenDataFile(Common::SeekableReadStream *screenDataFile)
screenData->doors[i] = readRegPuertas(screenDataFile);
}
for (int i = 0; i < 15; i++) {
- screenData->bitmapasociados[i] = readBitmapAux(screenDataFile);
+ screenData->screenLayers[i] = readBitmapAux(screenDataFile);
}
for (int i = 0; i < 51; i++) {
- screenData->indexadoobjetos[i] = readRegIndexadoObjetos(screenDataFile);
+ screenData->screenObjectIndex[i] = readRegIndexadoObjetos(screenDataFile);
}
screenData->animationFlag = screenDataFile->readByte();
- screenData->nombremovto = screenDataFile->readPascalString();
- screenDataFile->skip(8 - screenData->nombremovto.size());
+ screenData->animationName = screenDataFile->readPascalString();
+ screenDataFile->skip(8 - screenData->animationName.size());
screenData->paletteAnimationFlag = screenDataFile->readByte();
- screenData->puntpaleta = screenDataFile->readUint16LE();
+ screenData->palettePointer = screenDataFile->readUint16LE();
for (int i = 0; i < 300; i++) {
- screenData->tray2[i] = readPunto(screenDataFile);
+ screenData->secondaryAnimTrajectory[i] = readPunto(screenDataFile);
}
- screenDataFile->read(screenData->dir2, 600);
- screenData->longtray2 = screenDataFile->readUint16LE();
+ screenDataFile->read(screenData->secondaryAnimDirections, 600);
+ screenData->secondaryTrajectoryLength = screenDataFile->readUint16LE();
return screenData;
}
@@ -832,27 +857,27 @@ void loadScreenData(uint screenNumber) {
currentRoomData = readScreenDataFile(rooms);
loadScreen();
for (int i = 0; i < 15; i++) {
- RoomBitmapRegister &bitmap = currentRoomData->bitmapasociados[i];
- if (bitmap.tambitmap > 0) {
- loadItem(bitmap.coordx, bitmap.coordy, bitmap.tambitmap, bitmap.puntbitmap, bitmap.profund);
+ RoomBitmapRegister &bitmap = currentRoomData->screenLayers[i];
+ if (bitmap.bitmapSize > 0) {
+ loadItem(bitmap.coordx, bitmap.coordy, bitmap.bitmapSize, bitmap.bitmapPointer, bitmap.depth);
}
}
- if (currentRoomData->animationFlag && currentRoomData->codigo != 24) {
- loadAnimation(currentRoomData->nombremovto);
+ if (currentRoomData->animationFlag && currentRoomData->code != 24) {
+ loadAnimation(currentRoomData->animationName);
iframe2 = 0;
indicetray2 = 1;
- animado.dir = currentRoomData->dir2[indicetray2 - 1];
- animado.posx = currentRoomData->tray2[indicetray2 - 1].x;
- animado.posy = currentRoomData->tray2[indicetray2 - 1].y;
- if (currentRoomData->nombremovto == "FUENTE01")
- animado.profundidad = 0;
+ animado.dir = currentRoomData->secondaryAnimDirections[indicetray2 - 1];
+ animado.posx = currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].x;
+ animado.posy = currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].y;
+ if (currentRoomData->animationName == "FUENTE01")
+ animado.depth = 0;
else {
updateSecondaryAnimationDepth();
}
for (int i = 0; i < maxrejax; i++)
for (int j = 0; j < maxrejay; j++) {
if (rejamascaramovto[i][j] > 0)
- currentRoomData->rejapantalla[oldposx + i][oldposy + j] = rejamascaramovto[i][j];
+ currentRoomData->walkAreasGrid[oldposx + i][oldposy + j] = rejamascaramovto[i][j];
if (rejamascararaton[i][j] > 0)
currentRoomData->mouseGrid[oldposx + i][oldposy + j] = rejamascararaton[i][j];
}
@@ -940,7 +965,7 @@ void lookInventoryObject(byte numeroobjeto) {
g_engine->_mouseManager->hide();
copyPalette(pal, paletaseg);
readItemRegister(mobj[numeroobjeto].code);
- getImg(0, 0, 319, 139, background);
+ g_engine->_graphics->getImg(0, 0, 319, 139, sceneBackground);
partialFadeOut(234);
bar(0, 0, 319, 139, 0);
for (yaux = 1; yaux <= 12; yaux++)
@@ -960,13 +985,13 @@ void lookInventoryObject(byte numeroobjeto) {
drawMenu(4);
- if (regobj.usar[0] != 9) {
+ if (regobj.used[0] != 9) {
if (regobj.beforeUseTextRef != 0) {
assignText();
reghpt = readVerbRegister(regobj.beforeUseTextRef);
- cadenadescripcion = reghpt.cadenatext;
- for (yaux = 0; yaux < reghpt.cadenatext.size(); yaux++)
- cadenadescripcion.setChar(decryptionKey[yaux] ^ reghpt.cadenatext[yaux], yaux);
+ cadenadescripcion = reghpt.text;
+ for (yaux = 0; yaux < reghpt.text.size(); yaux++)
+ cadenadescripcion.setChar(decryptionKey[yaux] ^ reghpt.text[yaux], yaux);
hipercadena(cadenadescripcion, 60, 15, 33, 255, 0);
verb.close();
} else {
@@ -978,9 +1003,9 @@ void lookInventoryObject(byte numeroobjeto) {
if (regobj.afterUseTextRef != 0) {
assignText();
reghpt = readVerbRegister(regobj.afterUseTextRef);
- cadenadescripcion = reghpt.cadenatext;
- for (yaux = 0; yaux < reghpt.cadenatext.size(); yaux++)
- cadenadescripcion.setChar(decryptionKey[yaux] ^ reghpt.cadenatext[yaux], yaux);
+ cadenadescripcion = reghpt.text;
+ for (yaux = 0; yaux < reghpt.text.size(); yaux++)
+ cadenadescripcion.setChar(decryptionKey[yaux] ^ reghpt.text[yaux], yaux);
hipercadena(cadenadescripcion, 60, 15, 33, 255, 0);
verb.close();
} else {
@@ -989,12 +1014,12 @@ void lookInventoryObject(byte numeroobjeto) {
}
}
- drawFlc(125, 70, regobj.punteroframesgiro, 60000, 9, 0, false, true, true, kkaux);
+ drawFlc(125, 70, regobj.rotatingObjectAnimation, 60000, 9, 0, false, true, true, kkaux);
screenTransition(3, true, NULL);
partialFadeOut(234);
assembleScreen();
- drawScreen(background);
+ drawScreen(sceneBackground);
copyPalette(paletaseg, pal);
partialFadeIn(234);
g_engine->_mouseManager->show();
@@ -1006,7 +1031,7 @@ void useInventoryObjectWithInventoryObject(uint numobj1, uint numobj2) {
debug("Reading item register %d", numobj1);
readItemRegister(invItemData, numobj1, regobj);
// verifyCopyProtection2();
- if (regobj.usar[0] != 1 || regobj.usarcon != numobj2) {
+ if (regobj.used[0] != 1 || regobj.useWith != numobj2) {
drawText(Random(11) + 1022);
return;
}
@@ -1025,17 +1050,17 @@ void useInventoryObjectWithInventoryObject(uint numobj1, uint numobj2) {
indobj2 = indicemochila;
kaka = regobj.useTextRef;
- if (regobj.reemplazarpor == 0) {
+ if (regobj.replaceWith == 0) {
readItemRegister(invItemData, numobj1, regobj);
- regobj.usar[0] = 9;
+ regobj.used[0] = 9;
saveItemRegister(regobj, invItemData);
readItemRegister(invItemData, numobj2, regobj);
- regobj.usar[0] = 9;
+ regobj.used[0] = 9;
saveItemRegister(regobj, invItemData);
} else {
- readItemRegister(invItemData, regobj.reemplazarpor, regobj);
+ readItemRegister(invItemData, regobj.replaceWith, regobj);
mobj[indobj1].bitmapIndex = regobj.objectIconBitmap;
mobj[indobj1].code = regobj.code;
mobj[indobj1].objectName = regobj.name;
@@ -1068,32 +1093,32 @@ void calculateRoute(byte zona1, byte zona2, bool extraCorrection, bool zonavedad
pasos += 1;
point = currentRoomData->trajectories[zona1 - 1][zona2 - 1][pasos - 1];
- if (point.x < (rectificacionx + 3))
+ if (point.x < (characterCorrectionX + 3))
mainRoute[pasos].x = 3;
else
- mainRoute[pasos].x = point.x - rectificacionx;
- if (point.y < (rectificaciony + 3))
+ mainRoute[pasos].x = point.x - characterCorrectionX;
+ if (point.y < (characerCorrectionY + 3))
mainRoute[pasos].y = 3;
else
- mainRoute[pasos].y = point.y - rectificaciony;
+ mainRoute[pasos].y = point.y - characerCorrectionY;
} while (point.y != 9999 && pasos != 5);
if (zona2 < 10) {
if (point.y == 9999) {
- mainRoute[pasos].x = xframe2 - rectificacionx;
- mainRoute[pasos].y = yframe2 - rectificaciony;
+ mainRoute[pasos].x = xframe2 - characterCorrectionX;
+ mainRoute[pasos].y = yframe2 - characerCorrectionY;
} else {
- mainRoute[6].x = xframe2 - rectificacionx;
- mainRoute[6].y = yframe2 - rectificaciony;
+ mainRoute[6].x = xframe2 - characterCorrectionX;
+ mainRoute[6].y = yframe2 - characerCorrectionY;
pasos = 6;
}
} else {
- if ((mainRoute[pasos].y + rectificaciony) == 9999) {
+ if ((mainRoute[pasos].y + characerCorrectionY) == 9999) {
pasos -= 1;
}
if (extraCorrection) {
- switch (currentRoomData->codigo) {
+ switch (currentRoomData->code) {
case 5:
if (zona2 == 27)
pasos += 1;
@@ -1123,21 +1148,21 @@ void goToObject(byte zona1, byte zona2) {
contadorpc2 = contadorpc;
for (int indicepaso = 0; indicepaso < 5; indicepaso++) {
- if (currentRoomData->doors[indicepaso].codigopuerta == zona2) {
+ if (currentRoomData->doors[indicepaso].doorcode == zona2) {
zonavedada = true;
break;
}
}
- if (currentRoomData->codigo == 21 && currentRoomData->animationFlag) {
+ if (currentRoomData->code == 21 && currentRoomData->animationFlag) {
if ((zona2 >= 1 && zona2 <= 5) ||
(zona2 >= 9 && zona2 <= 13) ||
(zona2 >= 18 && zona2 <= 21) ||
zona2 == 24 || zona2 == 25) {
zonadestino = 7;
- pulsax = 232;
- pulsay = 75;
+ mouseClickX = 232;
+ mouseClickY = 75;
zona2 = 7;
}
if (zona2 == 24) {
@@ -1145,8 +1170,8 @@ void goToObject(byte zona1, byte zona2) {
}
}
if (zona1 < 10) {
- xframe2 = pulsax + 7;
- yframe2 = pulsay + 7;
+ xframe2 = mouseClickX + 7;
+ yframe2 = mouseClickY + 7;
g_engine->_mouseManager->hide();
calculateRoute(zona1, zona2, true, zonavedada);
@@ -1170,49 +1195,49 @@ void goToObject(byte zona1, byte zona2) {
void updateSecondaryAnimationDepth() {
uint animadoposition = animado.posy + altoanimado - 1;
if (animadoposition >= 0 && animadoposition <= 56) {
- animado.profundidad = 0;
+ animado.depth = 0;
} else if (animadoposition >= 57 && animadoposition <= 66) {
- animado.profundidad = 1;
+ animado.depth = 1;
} else if (animadoposition >= 65 && animadoposition <= 74) {
- animado.profundidad = 2;
+ animado.depth = 2;
} else if (animadoposition >= 73 && animadoposition <= 82) {
- animado.profundidad = 3;
+ animado.depth = 3;
} else if (animadoposition >= 81 && animadoposition <= 90) {
- animado.profundidad = 4;
+ animado.depth = 4;
} else if (animadoposition >= 89 && animadoposition <= 98) {
- animado.profundidad = 5;
+ animado.depth = 5;
} else if (animadoposition >= 97 && animadoposition <= 106) {
- animado.profundidad = 6;
+ animado.depth = 6;
} else if (animadoposition >= 105 && animadoposition <= 114) {
- animado.profundidad = 7;
+ animado.depth = 7;
} else if (animadoposition >= 113 && animadoposition <= 122) {
- animado.profundidad = 8;
+ animado.depth = 8;
} else if (animadoposition >= 121 && animadoposition <= 140) {
- animado.profundidad = 9;
+ animado.depth = 9;
}
}
void updateMainCharacterDepth() {
if (characterPosY >= 0 && characterPosY <= 7) {
- secuencia.profundidad = 0;
+ secuencia.depth = 0;
} else if (characterPosY >= 8 && characterPosY <= 17) {
- secuencia.profundidad = 1;
+ secuencia.depth = 1;
} else if (characterPosY >= 18 && characterPosY <= 25) {
- secuencia.profundidad = 2;
+ secuencia.depth = 2;
} else if (characterPosY >= 26 && characterPosY <= 33) {
- secuencia.profundidad = 3;
+ secuencia.depth = 3;
} else if (characterPosY >= 34 && characterPosY <= 41) {
- secuencia.profundidad = 4;
+ secuencia.depth = 4;
} else if (characterPosY >= 42 && characterPosY <= 49) {
- secuencia.profundidad = 5;
+ secuencia.depth = 5;
} else if (characterPosY >= 50 && characterPosY <= 57) {
- secuencia.profundidad = 6;
+ secuencia.depth = 6;
} else if (characterPosY >= 58 && characterPosY <= 65) {
- secuencia.profundidad = 7;
+ secuencia.depth = 7;
} else if (characterPosY >= 66 && characterPosY <= 73) {
- secuencia.profundidad = 8;
+ secuencia.depth = 8;
} else if (characterPosY >= 74 && characterPosY <= 139) {
- secuencia.profundidad = 9;
+ secuencia.depth = 9;
}
}
@@ -1224,7 +1249,7 @@ void advanceAnimations(bool zonavedada, bool animateMouse) {
debug("Playing tos");
g_engine->_sound->playVoc("TOS", 258006, 14044);
}
- if (indicetray2 >= currentRoomData->longtray2)
+ if (indicetray2 >= currentRoomData->secondaryTrajectoryLength)
indicetray2 = 1;
else
indicetray2 += 1;
@@ -1232,15 +1257,15 @@ void advanceAnimations(bool zonavedada, bool animateMouse) {
iframe2 = 0;
else
iframe2++;
- animado.posx = currentRoomData->tray2[indicetray2 - 1].x;
- animado.posy = currentRoomData->tray2[indicetray2 - 1].y;
- animado.dir = currentRoomData->dir2[indicetray2 - 1];
- switch (currentRoomData->codigo) {
+ animado.posx = currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].x;
+ animado.posy = currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].y;
+ animado.dir = currentRoomData->secondaryAnimDirections[indicetray2 - 1];
+ switch (currentRoomData->code) {
case 23:
- animado.profundidad = 0;
+ animado.depth = 0;
break;
case 24:
- animado.profundidad = 14;
+ animado.depth = 14;
break;
default:
updateSecondaryAnimationDepth();
@@ -1278,8 +1303,8 @@ void advanceAnimations(bool zonavedada, bool animateMouse) {
} else if (indicetray >= longtray) {
xframe2 = 0;
if (!cambiopantalla) {
- elemento1 = (xraton + 7) - (characterPosX + rectificacionx);
- elemento2 = (yraton + 7) - (characterPosY + rectificaciony);
+ elemento1 = (mouseX + 7) - (characterPosX + characterCorrectionX);
+ elemento2 = (mouseY + 7) - (characterPosY + characerCorrectionY);
if (abs(elemento2) > (abs(elemento1) + 20)) {
if (elemento2 < 0)
direccionmovimiento = 0;
@@ -1299,8 +1324,8 @@ void advanceAnimations(bool zonavedada, bool animateMouse) {
} else {
iframe = 0;
if (zonavedada == false && !cambiopantalla) {
- elemento1 = (xraton + 7) - (characterPosX + rectificacionx);
- elemento2 = (yraton + 7) - (characterPosY + rectificaciony);
+ elemento1 = (mouseX + 7) - (characterPosX + characterCorrectionX);
+ elemento2 = (mouseY + 7) - (characterPosY + characerCorrectionY);
if (abs(elemento2) > (abs(elemento1) + 20)) {
if (elemento2 < 0)
direccionmovimiento = 0;
@@ -1329,7 +1354,7 @@ void advanceAnimations(bool zonavedada, bool animateMouse) {
movidapaleta = 0;
else
movidapaleta += 1;
- if (currentRoomData->codigo == 4 && movidapaleta == 4)
+ if (currentRoomData->code == 4 && movidapaleta == 4)
g_engine->_sound->playVoc();
updatePalette(movidapaleta);
} else {
@@ -1339,7 +1364,7 @@ void advanceAnimations(bool zonavedada, bool animateMouse) {
}
void actionLineText(Common::String actionLine) {
- outtextxy(160, 144, actionLine, 255, true, Graphics::kTextAlignCenter);
+ euroText(160, 144, actionLine, 255, Graphics::kTextAlignCenter);
}
void animateGive(uint cogedir, uint cogealt) {
@@ -1465,7 +1490,7 @@ void animateBat() {
yseg = animado.posy;
anchoaniseg = anchoanimado;
altoaniseg = altoanimado;
- profseg = animado.profundidad;
+ profseg = animado.depth;
dirseg = animado.dir;
freeAnimation();
}
@@ -1475,7 +1500,7 @@ void animateBat() {
itrayseg = 0;
longtrayseg = 87;
iframe2 = 0;
- animado.profundidad = 14;
+ animado.depth = 14;
do {
g_engine->_chrono->updateChrono();
if (tocapintar) {
@@ -1514,23 +1539,23 @@ void animateBat() {
anchoanimado = anchoaniseg;
altoanimado = altoaniseg;
setRoomTrajectories(altoanimado, anchoanimado, RESTORE, false);
- loadAnimation(currentRoomData->nombremovto);
+ loadAnimation(currentRoomData->animationName);
iframe2 = iframe2seg;
animado.posx = xseg;
animado.posy = yseg;
- animado.profundidad = profseg;
+ animado.depth = profseg;
animado.dir = dirseg;
}
- screenHandleToBackground();
+ restoreBackground();
assembleScreen();
- drawScreen(background);
+ drawScreen(sceneBackground);
}
void updateVideo() {
- readBitmap(regobj.puntparche, screenObjects[regobj.profundidad - 1], regobj.tamparche, 319);
- screenHandleToBackground();
+ readBitmap(regobj.dropOverlay, screenObjects[regobj.depth - 1], regobj.dropOverlaySize, 319);
+ restoreBackground();
assembleScreen();
- drawScreen(background);
+ drawScreen(sceneBackground);
}
void nicheAnimation(byte direccionhn, int32 bitmap) {
@@ -1538,7 +1563,7 @@ void nicheAnimation(byte direccionhn, int32 bitmap) {
int incrementohn;
// Room with Red
- if (currentRoomData->codigo == 24) {
+ if (currentRoomData->code == 24) {
screenObjects[1] = (byte *)malloc(3660);
readBitmap(1382874, screenObjects[1], 3652, 319);
uint16 object1Width = READ_LE_UINT16(screenObjects[1]);
@@ -1553,17 +1578,17 @@ void nicheAnimation(byte direccionhn, int32 bitmap) {
case 0: {
posdibhn = 44904;
incrementohn = 1;
- Common::copy(screenObjects[0], screenObjects[0] + 892, background + 44900);
+ Common::copy(screenObjects[0], screenObjects[0] + 892, sceneBackground + 44900);
readBitmap(bitmap, screenObjects[0], 892, 319);
- Common::copy(screenObjects[0] + 4, screenObjects[0] + 4 + 888, background + 44900 + 892);
+ Common::copy(screenObjects[0] + 4, screenObjects[0] + 4 + 888, sceneBackground + 44900 + 892);
} break;
case 1: { // object slides to reveal empty stand
posdibhn = 892 + 44900;
incrementohn = -1;
// Reads the empty alcove into a non-visible part of fondo
- readBitmap(bitmap, background + 44900, 892, 319);
+ readBitmap(bitmap, sceneBackground + 44900, 892, 319);
// Copies whatever is currently on the alcove in a non-visible part of fondo contiguous with the above
- Common::copy(screenObjects[0] + 4, screenObjects[0] + 4 + 888, background + 44900 + 892);
+ Common::copy(screenObjects[0] + 4, screenObjects[0] + 4 + 888, sceneBackground + 44900 + 892);
// We now have in consecutive pixels the empty stand and the object
} break;
@@ -1572,25 +1597,25 @@ void nicheAnimation(byte direccionhn, int32 bitmap) {
uint16 alcoveHeight = READ_LE_UINT16(screenObjects[0] + 2);
// Set the height to double to animate 2 images of the same height moving up/down
- *(background + 44900 + 2) = (alcoveHeight * 2) + 1;
+ *(sceneBackground + 44900 + 2) = (alcoveHeight * 2) + 1;
- screenHandleToBackground();
+ restoreBackground();
for (indicehn = 1; indicehn <= alcoveHeight; indicehn++) {
posdibhn = posdibhn + (incrementohn * (alcoveWidth + 1));
- Common::copy(background + posdibhn, background + posdibhn + 888, screenObjects[0] + 4);
+ Common::copy(sceneBackground + posdibhn, sceneBackground + posdibhn + 888, screenObjects[0] + 4);
assembleScreen();
- drawScreen(background);
+ drawScreen(sceneBackground);
g_engine->_screen->update();
}
readBitmap(bitmap, screenObjects[0], 892, 319);
- screenHandleToBackground();
+ restoreBackground();
assembleScreen();
- drawScreen(background);
+ drawScreen(sceneBackground);
- if (currentRoomData->codigo == 24) {
+ if (currentRoomData->code == 24) {
free(screenObjects[1]);
screenObjects[1] = NULL;
}
@@ -1600,17 +1625,17 @@ void pickupScreenObject() {
byte indicemochila, indicex, indicey;
uint screenObject;
- uint mouseX = (pulsax + 7) / factorx;
- uint mouseY = (pulsay + 7) / factory;
- screenObject = currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[mouseX][mouseY]]->indicefichero;
+ uint mouseX = (mouseClickX + 7) / xGridCount;
+ uint mouseY = (mouseClickY + 7) / yGridCount;
+ screenObject = currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[mouseX][mouseY]]->fileIndex;
if (screenObject == 0)
return;
readItemRegister(screenObject);
goToObject(
- currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory],
- currentRoomData->rejapantalla[mouseX][mouseY]);
+ currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount],
+ currentRoomData->walkAreasGrid[mouseX][mouseY]);
verifyCopyProtection();
- if (regobj.coger) {
+ if (regobj.pickupable) {
g_engine->_mouseManager->hide();
switch (regobj.code) {
case 521: { // Corridor lamp
@@ -1637,7 +1662,7 @@ void pickupScreenObject() {
vasijapuesta = false;
} break;
}
- switch (regobj.altura) {
+ switch (regobj.height) {
case 0: { // Pick up above
switch (regobj.code) {
case 590: { // Ectoplasm
@@ -1646,10 +1671,10 @@ void pickupScreenObject() {
} break;
default: {
animatePickup1(direccionmovimiento, 0);
- screenObjects[regobj.profundidad - 1] = NULL;
- screenHandleToBackground();
+ screenObjects[regobj.depth - 1] = NULL;
+ restoreBackground();
assembleScreen();
- drawScreen(background);
+ drawScreen(sceneBackground);
animatePickup2(direccionmovimiento, 0);
}
}
@@ -1662,7 +1687,7 @@ void pickupScreenObject() {
} break;
case 223: { // table cloths
animatePickup1(0, 1);
- currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[mouseX][mouseY]]->indicefichero = regobj.reemplazarpor;
+ currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[mouseX][mouseY]]->fileIndex = regobj.replaceWith;
updateVideo();
animatePickup2(0, 1);
} break;
@@ -1686,90 +1711,90 @@ void pickupScreenObject() {
case 521: { // Puts plaster and key on the floor
animatePickup1(0, 1);
{
- RoomBitmapRegister &with = currentRoomData->bitmapasociados[1];
+ RoomBitmapRegister &with = currentRoomData->screenLayers[1];
- with.puntbitmap = 775611;
- with.tambitmap = 36;
+ with.bitmapPointer = 775611;
+ with.bitmapSize = 36;
with.coordx = 80;
with.coordy = 56;
- with.profund = 2;
- loadItem(with.coordx, with.coordy, with.tambitmap, with.puntbitmap, with.profund);
+ with.depth = 2;
+ loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
{
- RoomBitmapRegister &with = currentRoomData->bitmapasociados[2];
+ RoomBitmapRegister &with = currentRoomData->screenLayers[2];
- with.puntbitmap = 730743;
- with.tambitmap = 64;
+ with.bitmapPointer = 730743;
+ with.bitmapSize = 64;
with.coordx = 76;
with.coordy = 62;
- with.profund = 1;
- loadItem(with.coordx, with.coordy, with.tambitmap, with.puntbitmap, with.profund);
+ with.depth = 1;
+ loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
- screenObjects[regobj.profundidad - 1] = NULL;
- screenHandleToBackground();
+ screenObjects[regobj.depth - 1] = NULL;
+ restoreBackground();
assembleScreen();
- drawScreen(background);
+ drawScreen(sceneBackground);
animatePickup2(0, 1);
} break;
case 562: { // alcove
- switch (currentRoomData->codigo) {
+ switch (currentRoomData->code) {
case 20: { // First scene with alcove
if (hornacina[0][hornacina[0][3]] > 0) {
// Possibly
if (hornacina[0][3] == 2 || hornacina[0][hornacina[0][3]] == 563) {
readItemRegister(hornacina[0][hornacina[0][3]]);
hornacina[0][hornacina[0][3]] = 0;
- currentRoomData->indexadoobjetos[9]->objectName = getObjectName(4);
+ currentRoomData->screenObjectIndex[9]->objectName = getObjectName(4);
animatePickup1(3, 1);
- readBitmap(1190768, screenObjects[regobj.profundidad - 1], 892, 319);
- currentRoomData->bitmapasociados[1].puntbitmap = 1190768;
- currentRoomData->bitmapasociados[1].tambitmap = 892;
- currentRoomData->bitmapasociados[1].coordx = 66;
- currentRoomData->bitmapasociados[1].coordy = 35;
- currentRoomData->bitmapasociados[1].profund = 1;
- screenHandleToBackground();
+ readBitmap(1190768, screenObjects[regobj.depth - 1], 892, 319);
+ currentRoomData->screenLayers[1].bitmapPointer = 1190768;
+ currentRoomData->screenLayers[1].bitmapSize = 892;
+ currentRoomData->screenLayers[1].coordx = 66;
+ currentRoomData->screenLayers[1].coordy = 35;
+ currentRoomData->screenLayers[1].depth = 1;
+ restoreBackground();
assembleScreen();
- drawScreen(background);
+ drawScreen(sceneBackground);
animatePickup2(3, 1);
} else {
readItemRegister(hornacina[0][hornacina[0][3]]);
hornacina[0][hornacina[0][3]] = 0;
hornacina[0][3] += 1;
hornacina[1][3] -= 1;
- currentRoomData->indexadoobjetos[9]->objectName = " ";
+ currentRoomData->screenObjectIndex[9]->objectName = " ";
animatePickup1(3, 1);
- readBitmap(1190768, screenObjects[regobj.profundidad - 1],
+ readBitmap(1190768, screenObjects[regobj.depth - 1],
892, 319);
- screenHandleToBackground();
+ restoreBackground();
assembleScreen();
- drawScreen(background);
+ drawScreen(sceneBackground);
animatePickup2(3, 1);
g_engine->_sound->playVoc("PLATAF", 375907, 14724);
- currentRoomData->bitmapasociados[1].tambitmap = 892;
- currentRoomData->bitmapasociados[1].coordx = 66;
- currentRoomData->bitmapasociados[1].coordy = 35;
- currentRoomData->bitmapasociados[1].profund = 1;
+ currentRoomData->screenLayers[1].bitmapSize = 892;
+ currentRoomData->screenLayers[1].coordx = 66;
+ currentRoomData->screenLayers[1].coordy = 35;
+ currentRoomData->screenLayers[1].depth = 1;
switch (hornacina[0][hornacina[0][3]]) {
case 0: {
- currentRoomData->indexadoobjetos[9]->objectName = getObjectName(4);
+ currentRoomData->screenObjectIndex[9]->objectName = getObjectName(4);
nicheAnimation(0, 1190768);
- currentRoomData->bitmapasociados[1].puntbitmap = 1190768;
+ currentRoomData->screenLayers[1].bitmapPointer = 1190768;
} break;
case 561: {
- currentRoomData->indexadoobjetos[9]->objectName = getObjectName(5);
+ currentRoomData->screenObjectIndex[9]->objectName = getObjectName(5);
nicheAnimation(0, 1182652);
- currentRoomData->bitmapasociados[1].puntbitmap = 1182652;
+ currentRoomData->screenLayers[1].bitmapPointer = 1182652;
} break;
case 563: {
- currentRoomData->indexadoobjetos[9]->objectName = getObjectName(6);
+ currentRoomData->screenObjectIndex[9]->objectName = getObjectName(6);
nicheAnimation(0, 1186044);
- currentRoomData->bitmapasociados[1].puntbitmap = 1186044;
+ currentRoomData->screenLayers[1].bitmapPointer = 1186044;
} break;
case 615: {
- currentRoomData->indexadoobjetos[9]->objectName = getObjectName(7);
+ currentRoomData->screenObjectIndex[9]->objectName = getObjectName(7);
nicheAnimation(0, 1181760);
- currentRoomData->bitmapasociados[1].puntbitmap = 1181760;
+ currentRoomData->screenLayers[1].bitmapPointer = 1181760;
} break;
}
updateAltScreen(24);
@@ -1787,60 +1812,60 @@ void pickupScreenObject() {
if (hornacina[1][3] == 2) {
readItemRegister(hornacina[1][2]);
hornacina[1][2] = 0;
- currentRoomData->indexadoobjetos[8]->objectName = getObjectName(4);
+ currentRoomData->screenObjectIndex[8]->objectName = getObjectName(4);
animatePickup1(0, 1);
- readBitmap(1399610, screenObjects[regobj.profundidad - 1], 892, 319);
- currentRoomData->bitmapasociados[0].puntbitmap = 1399610;
- currentRoomData->bitmapasociados[0].tambitmap = 892;
- currentRoomData->bitmapasociados[0].coordx = 217;
- currentRoomData->bitmapasociados[0].coordy = 48;
- currentRoomData->bitmapasociados[0].profund = 1;
- screenHandleToBackground();
+ readBitmap(1399610, screenObjects[regobj.depth - 1], 892, 319);
+ currentRoomData->screenLayers[0].bitmapPointer = 1399610;
+ currentRoomData->screenLayers[0].bitmapSize = 892;
+ currentRoomData->screenLayers[0].coordx = 217;
+ currentRoomData->screenLayers[0].coordy = 48;
+ currentRoomData->screenLayers[0].depth = 1;
+ restoreBackground();
assembleScreen();
- drawScreen(background);
+ drawScreen(sceneBackground);
animatePickup2(0, 1);
} else {
readItemRegister(hornacina[1][hornacina[1][3]]);
hornacina[1][hornacina[1][3]] = 622;
hornacina[1][3] += 1;
hornacina[0][3] -= 1;
- currentRoomData->indexadoobjetos[8]->objectName = " ";
+ currentRoomData->screenObjectIndex[8]->objectName = " ";
animatePickup1(0, 1);
readBitmap(1399610, screenObjects[0], 892, 319);
- screenHandleToBackground();
+ restoreBackground();
assembleScreen();
- drawScreen(background);
+ drawScreen(sceneBackground);
animatePickup2(0, 1);
g_engine->_sound->playVoc("PLATAF", 375907, 14724);
- currentRoomData->bitmapasociados[0].tambitmap = 892;
- currentRoomData->bitmapasociados[0].coordx = 217;
- currentRoomData->bitmapasociados[0].coordy = 48;
- currentRoomData->bitmapasociados[0].profund = 1;
+ currentRoomData->screenLayers[0].bitmapSize = 892;
+ currentRoomData->screenLayers[0].coordx = 217;
+ currentRoomData->screenLayers[0].coordy = 48;
+ currentRoomData->screenLayers[0].depth = 1;
switch (hornacina[1][hornacina[1][3]]) {
case 0: {
- currentRoomData->indexadoobjetos[8]->objectName = getObjectName(4);
+ currentRoomData->screenObjectIndex[8]->objectName = getObjectName(4);
nicheAnimation(0, 1399610);
- currentRoomData->bitmapasociados[0].puntbitmap = 1399610;
+ currentRoomData->screenLayers[0].bitmapPointer = 1399610;
} break;
case 561: {
- currentRoomData->indexadoobjetos[8]->objectName = getObjectName(5);
+ currentRoomData->screenObjectIndex[8]->objectName = getObjectName(5);
nicheAnimation(0, 1381982);
- currentRoomData->bitmapasociados[0].puntbitmap = 1381982;
+ currentRoomData->screenLayers[0].bitmapPointer = 1381982;
} break;
case 615: {
- currentRoomData->indexadoobjetos[8]->objectName = getObjectName(7);
+ currentRoomData->screenObjectIndex[8]->objectName = getObjectName(7);
nicheAnimation(0, 1381090);
- currentRoomData->bitmapasociados[0].puntbitmap = 1381090;
+ currentRoomData->screenLayers[0].bitmapPointer = 1381090;
} break;
case 622: {
- currentRoomData->indexadoobjetos[8]->objectName = getObjectName(8);
+ currentRoomData->screenObjectIndex[8]->objectName = getObjectName(8);
nicheAnimation(0, 1400502);
- currentRoomData->bitmapasociados[0].puntbitmap = 1400502;
+ currentRoomData->screenLayers[0].bitmapPointer = 1400502;
} break;
case 623: {
- currentRoomData->indexadoobjetos[8]->objectName = getObjectName(9);
+ currentRoomData->screenObjectIndex[8]->objectName = getObjectName(9);
nicheAnimation(0, 1398718);
- currentRoomData->bitmapasociados[0].puntbitmap = 1398718;
+ currentRoomData->screenLayers[0].bitmapPointer = 1398718;
} break;
}
updateAltScreen(20);
@@ -1857,27 +1882,27 @@ void pickupScreenObject() {
case 624: { // red devil
animatePickup1(2, 1);
{
- RoomBitmapRegister &with = currentRoomData->bitmapasociados[3];
+ RoomBitmapRegister &with = currentRoomData->screenLayers[3];
- with.puntbitmap = 0;
- with.tambitmap = 0;
+ with.bitmapPointer = 0;
+ with.bitmapSize = 0;
with.coordx = 0;
with.coordy = 0;
- with.profund = 0;
+ with.depth = 0;
}
screenObjects[3] = NULL;
disableSecondAnimation();
- drawScreen(background);
+ drawScreen(sceneBackground);
animatePickup2(2, 1);
rojo_capturado = true;
trampa_puesta = false;
} break;
default: {
animatePickup1(direccionmovimiento, 1);
- screenObjects[regobj.profundidad - 1] = NULL;
- screenHandleToBackground();
+ screenObjects[regobj.depth - 1] = NULL;
+ restoreBackground();
assembleScreen();
- drawScreen(background);
+ drawScreen(sceneBackground);
animatePickup2(direccionmovimiento, 1);
}
}
@@ -1886,17 +1911,17 @@ void pickupScreenObject() {
switch (regobj.code) {
case 216: { // chisel
animatePickup1(0, 2);
- currentRoomData->indexadoobjetos[currentRoomData->mouseGrid
+ currentRoomData->screenObjectIndex[currentRoomData->mouseGrid
[mouseX][mouseY]]
- ->indicefichero = regobj.reemplazarpor;
+ ->fileIndex = regobj.replaceWith;
updateVideo();
animatePickup2(0, 2);
} break;
case 295: { // candles
animatePickup1(3, 2);
- currentRoomData->indexadoobjetos[currentRoomData->mouseGrid
+ currentRoomData->screenObjectIndex[currentRoomData->mouseGrid
[mouseX][mouseY]]
- ->indicefichero = regobj.reemplazarpor;
+ ->fileIndex = regobj.replaceWith;
updateVideo();
animatePickup2(3, 2);
} break;
@@ -1910,37 +1935,37 @@ void pickupScreenObject() {
} break;
case 659: { // spider web, puts bird and ring on the floor
animatePickup1(3, 2);
- screenObjects[regobj.profundidad - 1] = NULL;
+ screenObjects[regobj.depth - 1] = NULL;
{ // bird
- RoomBitmapRegister &with = currentRoomData->bitmapasociados[2];
+ RoomBitmapRegister &with = currentRoomData->screenLayers[2];
- with.puntbitmap = 1545924;
- with.tambitmap = 172;
+ with.bitmapPointer = 1545924;
+ with.bitmapSize = 172;
with.coordx = 38;
with.coordy = 58;
- with.profund = 1;
- loadItem(with.coordx, with.coordy, with.tambitmap, with.puntbitmap, with.profund);
+ with.depth = 1;
+ loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
{ // ring
- RoomBitmapRegister &with = currentRoomData->bitmapasociados[1];
+ RoomBitmapRegister &with = currentRoomData->screenLayers[1];
- with.puntbitmap = 1591272;
- with.tambitmap = 92;
+ with.bitmapPointer = 1591272;
+ with.bitmapSize = 92;
with.coordx = 50;
with.coordy = 58;
- with.profund = 3;
- loadItem(with.coordx, with.coordy, with.tambitmap, with.puntbitmap, with.profund);
+ with.depth = 3;
+ loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
- screenHandleToBackground();
+ restoreBackground();
assembleScreen();
- drawScreen(background);
+ drawScreen(sceneBackground);
animatePickup2(3, 2);
} break;
default: {
animatePickup1(direccionmovimiento, 2);
- screenObjects[regobj.profundidad - 1] = NULL;
+ screenObjects[regobj.depth - 1] = NULL;
assembleScreen();
- drawScreen(background);
+ drawScreen(sceneBackground);
animatePickup2(direccionmovimiento, 2);
}
}
@@ -1966,43 +1991,43 @@ void pickupScreenObject() {
if (regobj.code != 624)
for (indicey = regobj.yrej1; indicey <= regobj.yrej2; indicey++)
for (indicex = regobj.xrej1; indicex <= regobj.xrej2; indicex++) {
- currentRoomData->rejapantalla[indicex][indicey] = regobj.parcherejapantalla[indicex - regobj.xrej1][indicey - regobj.yrej1];
- currentRoomData->mouseGrid[indicex][indicey] = regobj.parcherejaraton[indicex - regobj.xrej1][indicey - regobj.yrej1];
+ currentRoomData->walkAreasGrid[indicex][indicey] = regobj.walkAreasPatch[indicex - regobj.xrej1][indicey - regobj.yrej1];
+ currentRoomData->mouseGrid[indicex][indicey] = regobj.mouseGridPatch[indicex - regobj.xrej1][indicey - regobj.yrej1];
}
switch (regobj.code) {
case 216: { // chisel
- currentRoomData->bitmapasociados[5].puntbitmap = 517485;
- currentRoomData->bitmapasociados[5].tambitmap = 964;
- currentRoomData->bitmapasociados[5].coordx = 223;
- currentRoomData->bitmapasociados[5].coordy = 34;
- currentRoomData->bitmapasociados[5].profund = 1;
+ currentRoomData->screenLayers[5].bitmapPointer = 517485;
+ currentRoomData->screenLayers[5].bitmapSize = 964;
+ currentRoomData->screenLayers[5].coordx = 223;
+ currentRoomData->screenLayers[5].coordy = 34;
+ currentRoomData->screenLayers[5].depth = 1;
} break;
case 218:; // necronomicon
break;
case 223: { // table cloth
- currentRoomData->bitmapasociados[6].puntbitmap = 436752;
- currentRoomData->bitmapasociados[6].tambitmap = 1372;
- currentRoomData->bitmapasociados[6].coordx = 174;
- currentRoomData->bitmapasociados[6].coordy = 32;
- currentRoomData->bitmapasociados[6].profund = 1;
+ currentRoomData->screenLayers[6].bitmapPointer = 436752;
+ currentRoomData->screenLayers[6].bitmapSize = 1372;
+ currentRoomData->screenLayers[6].coordx = 174;
+ currentRoomData->screenLayers[6].coordy = 32;
+ currentRoomData->screenLayers[6].depth = 1;
} break;
case 295: { // candles
- currentRoomData->bitmapasociados[3].puntbitmap = 1130756;
- currentRoomData->bitmapasociados[3].tambitmap = 1764;
- currentRoomData->bitmapasociados[3].coordx = 100;
- currentRoomData->bitmapasociados[3].coordy = 28;
- currentRoomData->bitmapasociados[3].profund = 1;
+ currentRoomData->screenLayers[3].bitmapPointer = 1130756;
+ currentRoomData->screenLayers[3].bitmapSize = 1764;
+ currentRoomData->screenLayers[3].coordx = 100;
+ currentRoomData->screenLayers[3].coordy = 28;
+ currentRoomData->screenLayers[3].depth = 1;
} break;
case 308:; // mistletoe
break;
case 362:; // charcoal
break;
case 402: {
- currentRoomData->bitmapasociados[5].puntbitmap = 68130;
- currentRoomData->bitmapasociados[5].tambitmap = 2564;
- currentRoomData->bitmapasociados[5].coordx = 148;
- currentRoomData->bitmapasociados[5].coordy = 49;
- currentRoomData->bitmapasociados[5].profund = 7;
+ currentRoomData->screenLayers[5].bitmapPointer = 68130;
+ currentRoomData->screenLayers[5].bitmapSize = 2564;
+ currentRoomData->screenLayers[5].coordx = 148;
+ currentRoomData->screenLayers[5].coordy = 49;
+ currentRoomData->screenLayers[5].depth = 7;
} break;
case 479:; // scissors
break;
@@ -2016,13 +2041,13 @@ void pickupScreenObject() {
break;
default: {
for (indicex = 0; indicex < 15; indicex++)
- if (currentRoomData->bitmapasociados[indicex].puntbitmap ==
- regobj.punterobitmap) {
- currentRoomData->bitmapasociados[indicex].puntbitmap = 0;
- currentRoomData->bitmapasociados[indicex].tambitmap = 0;
- currentRoomData->bitmapasociados[indicex].coordx = 0;
- currentRoomData->bitmapasociados[indicex].coordy = 0;
- currentRoomData->bitmapasociados[indicex].profund = 0;
+ if (currentRoomData->screenLayers[indicex].bitmapPointer ==
+ regobj.bitmapPointer) {
+ currentRoomData->screenLayers[indicex].bitmapPointer = 0;
+ currentRoomData->screenLayers[indicex].bitmapSize = 0;
+ currentRoomData->screenLayers[indicex].coordx = 0;
+ currentRoomData->screenLayers[indicex].coordy = 0;
+ currentRoomData->screenLayers[indicex].depth = 0;
}
}
}
@@ -2063,29 +2088,29 @@ void replaceBackpack(byte indicador1, uint indicador2) {
contadorpc = contadorpc2;
}
-void dropObjectInScreen(InvItemRegister regobjsustituto) {
+void dropObjectInScreen(ScreenObject replacementObject) {
byte indicepaso, indicex, indicey;
- if (regobjsustituto.tambitmap > 0) {
+ if (replacementObject.bitmapSize > 0) {
indicepaso = 0;
- while (!(currentRoomData->bitmapasociados[indicepaso].tambitmap == 0) || indicepaso == 15) {
+ while (!(currentRoomData->screenLayers[indicepaso].bitmapSize == 0) || indicepaso == 15) {
indicepaso++;
}
- if (currentRoomData->bitmapasociados[indicepaso].tambitmap == 0) {
+ if (currentRoomData->screenLayers[indicepaso].bitmapSize == 0) {
{
- RoomBitmapRegister &with = currentRoomData->bitmapasociados[indicepaso];
-
- with.puntbitmap = regobjsustituto.punterobitmap;
- with.tambitmap = regobjsustituto.tambitmap;
- with.coordx = regobjsustituto.xparche;
- with.coordy = regobjsustituto.yparche;
- with.profund = regobjsustituto.profundidad;
- loadItem(with.coordx, with.coordy, with.tambitmap, with.puntbitmap, with.profund);
+ RoomBitmapRegister &with = currentRoomData->screenLayers[indicepaso];
+
+ with.bitmapPointer = replacementObject.bitmapPointer;
+ with.bitmapSize = replacementObject.bitmapSize;
+ with.coordx = replacementObject.dropOverlayX;
+ with.coordy = replacementObject.dropOverlayY;
+ with.depth = replacementObject.depth;
+ loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
- for (indicey = regobjsustituto.yrej1; indicey <= regobjsustituto.yrej2; indicey++)
- for (indicex = regobjsustituto.xrej1; indicex <= regobjsustituto.xrej2; indicex++) {
- currentRoomData->rejapantalla[indicex][indicey] = regobjsustituto.parcherejapantalla[indicex - regobjsustituto.xrej1][indicey - regobjsustituto.yrej1];
- currentRoomData->mouseGrid[indicex][indicey] = regobjsustituto.parcherejaraton[indicex - regobjsustituto.xrej1][indicey - regobjsustituto.yrej1];
+ for (indicey = replacementObject.yrej1; indicey <= replacementObject.yrej2; indicey++)
+ for (indicex = replacementObject.xrej1; indicex <= replacementObject.xrej2; indicex++) {
+ currentRoomData->walkAreasGrid[indicex][indicey] = replacementObject.walkAreasPatch[indicex - replacementObject.xrej1][indicey - replacementObject.yrej1];
+ currentRoomData->mouseGrid[indicex][indicey] = replacementObject.mouseGridPatch[indicex - replacementObject.xrej1][indicey - replacementObject.yrej1];
}
} else
showError(264);
@@ -2097,9 +2122,9 @@ void useScreenObject() {
indicex, indicey;
bool controlarlista, basurillalog;
- uint mouseX = (pulsax + 7) / factorx;
- uint mouseY = (pulsay + 7) / factory;
- uint screenObject = currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[mouseX][mouseY]]->indicefichero;
+ uint mouseX = (mouseClickX + 7) / xGridCount;
+ uint mouseY = (mouseClickY + 7) / yGridCount;
+ uint screenObject = currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[mouseX][mouseY]]->fileIndex;
if (objetomochila != "") {
indicemochila = 0;
@@ -2110,11 +2135,11 @@ void useScreenObject() {
readItemRegister(mobj[indicemochila].code);
goToObject(
- currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory],
- currentRoomData->rejapantalla[mouseX][mouseY]);
+ currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount],
+ currentRoomData->walkAreasGrid[mouseX][mouseY]);
- if (regobj.usarcon == screenObject && screenObject > 0 && regobj.usar[0] == 5) {
- switch (regobj.usarcon) {
+ if (regobj.useWith == screenObject && screenObject > 0 && regobj.used[0] == 5) {
+ switch (regobj.useWith) {
case 30: { // corn with rooster
drawText(regobj.useTextRef);
g_engine->_mouseManager->hide();
@@ -2123,20 +2148,20 @@ void useScreenObject() {
animatePickup2(1, 2);
updateItem(regobj.code);
- currentRoomData->indexadoobjetos[27]->indicefichero = 201;
+ currentRoomData->screenObjectIndex[27]->fileIndex = 201;
do {
g_engine->_chrono->updateChrono();
if (iframe2 >= secondaryAnimationFrameCount - 1)
iframe2 = 0;
else
iframe2++;
- if (indicetray2 >= currentRoomData->longtray2)
+ if (indicetray2 >= currentRoomData->secondaryTrajectoryLength)
indicetray2 = 1;
else
indicetray2 += 1;
- animado.dir = currentRoomData->dir2[indicetray2 - 1];
- animado.posx = currentRoomData->tray2[indicetray2 - 1].x;
- animado.posy = currentRoomData->tray2[indicetray2 - 1].y;
+ animado.dir = currentRoomData->secondaryAnimDirections[indicetray2 - 1];
+ animado.posx = currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].x;
+ animado.posy = currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].y;
emptyLoop();
tocapintar = false;
emptyLoop2();
@@ -2146,26 +2171,26 @@ void useScreenObject() {
for (indlista = 0; indlista < maxrejax; indlista++)
for (indmoch = 0; indmoch < maxrejay; indmoch++) {
- currentRoomData->rejapantalla[oldposx + indlista][oldposy + indmoch] = rejafondomovto[indlista][indmoch];
+ currentRoomData->walkAreasGrid[oldposx + indlista][oldposy + indmoch] = rejafondomovto[indlista][indmoch];
currentRoomData->mouseGrid[oldposx + indlista][oldposy + indmoch] = rejafondoraton[indlista][indmoch];
}
freeAnimation();
- animado.posx = currentRoomData->tray2[indicetray2 - 1].x + 8;
- animado.posy = currentRoomData->tray2[indicetray2 - 1].y;
- currentRoomData->nombremovto = "GALLOPIC";
- currentRoomData->dir2[299] = 201;
+ animado.posx = currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].x + 8;
+ animado.posy = currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].y;
+ currentRoomData->animationName = "GALLOPIC";
+ currentRoomData->secondaryAnimDirections[299] = 201;
loadAnimation("GALLOPIC");
- currentRoomData->dir2[0] = 0;
- currentRoomData->tray2[0].x = animado.posx;
- currentRoomData->tray2[0].y = animado.posy;
+ currentRoomData->secondaryAnimDirections[0] = 0;
+ currentRoomData->secondaryAnimTrajectory[0].x = animado.posx;
+ currentRoomData->secondaryAnimTrajectory[0].y = animado.posy;
indicetray2 = 1;
- currentRoomData->longtray2 = 1;
+ currentRoomData->secondaryTrajectoryLength = 1;
for (indlista = 0; indlista < maxrejax; indlista++)
for (indmoch = 0; indmoch < maxrejay; indmoch++) {
if (rejamascaramovto[indlista][indmoch] > 0)
- currentRoomData->rejapantalla[oldposx + indlista][oldposy + indmoch] = rejamascaramovto[indlista][indmoch];
+ currentRoomData->walkAreasGrid[oldposx + indlista][oldposy + indmoch] = rejamascaramovto[indlista][indmoch];
if (rejamascararaton[indlista][indmoch] > 0)
currentRoomData->mouseGrid[oldposx + indlista][oldposy + indmoch] = rejamascararaton[indlista][indmoch];
}
@@ -2179,7 +2204,7 @@ void useScreenObject() {
animatePickup2(3, 1);
g_engine->_mouseManager->show();
updateItem(regobj.code);
- currentRoomData->indexadoobjetos[21]->indicefichero = 154;
+ currentRoomData->screenObjectIndex[21]->fileIndex = 154;
} break;
case 157: { // giving something to john
controlarlista = false;
@@ -2313,7 +2338,7 @@ void useScreenObject() {
updateInventory(indicemochila);
drawBackpack();
g_engine->_mouseManager->show();
- for (kaka = 0; kaka < maxpersonajes; kaka++)
+ for (kaka = 0; kaka < characterCount; kaka++)
libro[kaka] = true;
lprimera[0] = true;
} break;
@@ -2332,7 +2357,7 @@ void useScreenObject() {
updateInventory(indicemochila);
drawBackpack();
g_engine->_mouseManager->show();
- for (kaka = 0; kaka < maxpersonajes; kaka++) {
+ for (kaka = 0; kaka < characterCount; kaka++) {
caramelos[kaka] = true;
cprimera[kaka] = true;
}
@@ -2357,14 +2382,14 @@ void useScreenObject() {
drawBackpack();
disableSecondAnimation();
{
- RoomBitmapRegister &with = currentRoomData->bitmapasociados[0];
+ RoomBitmapRegister &with = currentRoomData->screenLayers[0];
- with.puntbitmap = 1545820;
- with.tambitmap = 104;
+ with.bitmapPointer = 1545820;
+ with.bitmapSize = 104;
with.coordx = 120;
with.coordy = 55;
- with.profund = 1;
- loadItem(with.coordx, with.coordy, with.tambitmap, with.puntbitmap, with.profund);
+ with.depth = 1;
+ loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
currentRoomData->mouseGrid[15][12] = 7;
g_engine->_mouseManager->show();
@@ -2402,14 +2427,14 @@ void useScreenObject() {
drawBackpack();
disableSecondAnimation();
{
- RoomBitmapRegister &with = currentRoomData->bitmapasociados[0];
+ RoomBitmapRegister &with = currentRoomData->screenLayers[0];
- with.puntbitmap = 1545820;
- with.tambitmap = 104;
+ with.bitmapPointer = 1545820;
+ with.bitmapSize = 104;
with.coordx = 120;
with.coordy = 55;
- with.profund = 1;
- loadItem(with.coordx, with.coordy, with.tambitmap, with.puntbitmap, with.profund);
+ with.depth = 1;
+ loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
currentRoomData->mouseGrid[15][12] = 7;
g_engine->_mouseManager->show();
@@ -2447,14 +2472,14 @@ void useScreenObject() {
drawBackpack();
disableSecondAnimation();
{
- RoomBitmapRegister &with = currentRoomData->bitmapasociados[0];
+ RoomBitmapRegister &with = currentRoomData->screenLayers[0];
- with.puntbitmap = 1545820;
- with.tambitmap = 104;
+ with.bitmapPointer = 1545820;
+ with.bitmapSize = 104;
with.coordx = 120;
with.coordy = 55;
- with.profund = 1;
- loadItem(with.coordx, with.coordy, with.tambitmap, with.puntbitmap, with.profund);
+ with.depth = 1;
+ loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
currentRoomData->mouseGrid[15][12] = 7;
g_engine->_mouseManager->show();
@@ -2492,14 +2517,14 @@ void useScreenObject() {
drawBackpack();
disableSecondAnimation();
{
- RoomBitmapRegister &with = currentRoomData->bitmapasociados[0];
+ RoomBitmapRegister &with = currentRoomData->screenLayers[0];
- with.puntbitmap = 1545820;
- with.tambitmap = 104;
+ with.bitmapPointer = 1545820;
+ with.bitmapSize = 104;
with.coordx = 120;
with.coordy = 55;
- with.profund = 1;
- loadItem(with.coordx, with.coordy, with.tambitmap, with.puntbitmap, with.profund);
+ with.depth = 1;
+ loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
currentRoomData->mouseGrid[15][12] = 7;
g_engine->_mouseManager->show();
@@ -2529,18 +2554,18 @@ void useScreenObject() {
iframe2 = 0;
else
iframe2++;
- if (indicetray2 >= currentRoomData->longtray2)
+ if (indicetray2 >= currentRoomData->secondaryTrajectoryLength)
indicetray2 = 1;
else
indicetray2 += 1;
- animado.dir = currentRoomData->dir2[indicetray2 - 1];
- animado.posx = currentRoomData->tray2[indicetray2 - 1].x;
- animado.posy = currentRoomData->tray2[indicetray2 - 1].y;
+ animado.dir = currentRoomData->secondaryAnimDirections[indicetray2 - 1];
+ animado.posx = currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].x;
+ animado.posy = currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].y;
emptyLoop();
tocapintar = false;
emptyLoop2();
sprites(true);
- } while (!(indicetray2 == (currentRoomData->longtray2 / 2)));
+ } while (!(indicetray2 == (currentRoomData->secondaryTrajectoryLength / 2)));
animateGive(3, 2);
updateInventory(indicemochila);
@@ -2553,21 +2578,21 @@ void useScreenObject() {
iframe2 = 0;
else
iframe2++;
- if (indicetray2 >= currentRoomData->longtray2)
+ if (indicetray2 >= currentRoomData->secondaryTrajectoryLength)
indicetray2 = 1;
else
indicetray2 += 1;
- animado.dir = currentRoomData->dir2[indicetray2 - 1];
- animado.posx = currentRoomData->tray2[indicetray2 - 1].x;
- animado.posy = currentRoomData->tray2[indicetray2 - 1].y;
+ animado.dir = currentRoomData->secondaryAnimDirections[indicetray2 - 1];
+ animado.posx = currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].x;
+ animado.posy = currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].y;
emptyLoop();
tocapintar = false;
emptyLoop2();
sprites(true);
- } while (indicetray2 != currentRoomData->longtray2);
+ } while (indicetray2 != currentRoomData->secondaryTrajectoryLength);
disableSecondAnimation();
- drawScreen(background);
+ drawScreen(sceneBackground);
g_engine->_mouseManager->show();
} break;
case 201: {
@@ -2608,7 +2633,7 @@ void useScreenObject() {
animateOpen2(3, 2);
updateItem(regobj.code);
disableSecondAnimation();
- drawScreen(background);
+ drawScreen(sceneBackground);
g_engine->_mouseManager->show();
drawText(2652);
g_engine->_mouseManager->hide();
@@ -2621,13 +2646,13 @@ void useScreenObject() {
currentRoomData->mouseGrid[9][10] = 1;
currentRoomData->mouseGrid[10][10] = 1;
for (indicex = 0; indicex < 15; indicex++)
- if (currentRoomData->bitmapasociados[indicex].puntbitmap ==
- regobj.punterobitmap) {
- currentRoomData->bitmapasociados[indicex].puntbitmap = 0;
- currentRoomData->bitmapasociados[indicex].tambitmap = 0;
- currentRoomData->bitmapasociados[indicex].coordx = 0;
- currentRoomData->bitmapasociados[indicex].coordy = 0;
- currentRoomData->bitmapasociados[indicex].profund = 0;
+ if (currentRoomData->screenLayers[indicex].bitmapPointer ==
+ regobj.bitmapPointer) {
+ currentRoomData->screenLayers[indicex].bitmapPointer = 0;
+ currentRoomData->screenLayers[indicex].bitmapSize = 0;
+ currentRoomData->screenLayers[indicex].coordx = 0;
+ currentRoomData->screenLayers[indicex].coordy = 0;
+ currentRoomData->screenLayers[indicex].depth = 0;
}
indicemochila = 0;
while (mobj[indicemochila].code != 0) {
@@ -2645,7 +2670,7 @@ void useScreenObject() {
} break;
case 221: {
drawText(regobj.useTextRef);
- regobj.usar[0] = 9;
+ regobj.used[0] = 9;
indicemochila = 0;
while (mobj[indicemochila].code != 0) {
indicemochila += 1;
@@ -2700,7 +2725,7 @@ void useScreenObject() {
g_engine->_sound->loadVoc("GOTA", 140972, 1029);
g_engine->_mouseManager->show();
drawText(regobj.useTextRef);
- currentRoomData->doors[2].abiertacerrada = 0;
+ currentRoomData->doors[2].openclosed = 0;
} break;
case 446: {
drawText(regobj.useTextRef);
@@ -2731,10 +2756,10 @@ void useScreenObject() {
animateOpen2(1, 1);
g_engine->_mouseManager->show();
drawText(regobj.useTextRef);
- currentRoomData->doors[0].abiertacerrada = 0;
+ currentRoomData->doors[0].openclosed = 0;
} break;
case 562: { // put any object in the alcoves
- switch (currentRoomData->codigo) {
+ switch (currentRoomData->code) {
case 20: {
if (hornacina[0][hornacina[0][3]] == 0) {
@@ -2742,28 +2767,28 @@ void useScreenObject() {
hornacina[0][0] = regobj.code;
drawText(regobj.useTextRef);
g_engine->_mouseManager->hide();
- currentRoomData->indexadoobjetos[9]->objectName = " ";
+ currentRoomData->screenObjectIndex[9]->objectName = " ";
animateGive(3, 1);
switch (hornacina[0][0]) {
case 561: {
- currentRoomData->indexadoobjetos[9]->objectName = getObjectName(5);
+ currentRoomData->screenObjectIndex[9]->objectName = getObjectName(5);
readBitmap(1182652, screenObjects[0], 892, 319);
- currentRoomData->bitmapasociados[1].puntbitmap = 1182652;
+ currentRoomData->screenLayers[1].bitmapPointer = 1182652;
} break;
case 615: {
- currentRoomData->indexadoobjetos[9]->objectName = getObjectName(7);
+ currentRoomData->screenObjectIndex[9]->objectName = getObjectName(7);
readBitmap(1181760, screenObjects[0], 892, 319);
- currentRoomData->bitmapasociados[1].puntbitmap = 1181760;
+ currentRoomData->screenLayers[1].bitmapPointer = 1181760;
} break;
}
- currentRoomData->bitmapasociados[1].tambitmap = 892;
- currentRoomData->bitmapasociados[1].coordx = 66;
- currentRoomData->bitmapasociados[1].coordy = 35;
- currentRoomData->bitmapasociados[1].profund = 1;
- screenHandleToBackground();
+ currentRoomData->screenLayers[1].bitmapSize = 892;
+ currentRoomData->screenLayers[1].coordx = 66;
+ currentRoomData->screenLayers[1].coordy = 35;
+ currentRoomData->screenLayers[1].depth = 1;
+ restoreBackground();
// XMStoPointer(ptr(segfondo, (offfondo + 4)), _handpantalla, 4, (sizepantalla - int32(4)));
assembleScreen();
- drawScreen(background);
+ drawScreen(sceneBackground);
animateOpen2(3, 1);
updateInventory(indicemochila);
drawBackpack();
@@ -2784,40 +2809,40 @@ void useScreenObject() {
readBitmap(1181760, screenObjects[0], 892, 319);
break;
}
- screenHandleToBackground();
+ restoreBackground();
assembleScreen();
- drawScreen(background);
+ drawScreen(sceneBackground);
animateOpen2(3, 1);
updateInventory(indicemochila);
drawBackpack();
- currentRoomData->indexadoobjetos[9]->objectName = " ";
+ currentRoomData->screenObjectIndex[9]->objectName = " ";
g_engine->_sound->playVoc("PLATAF", 375907, 14724);
switch (hornacina[0][hornacina[0][3]]) {
case 0: {
- currentRoomData->indexadoobjetos[9]->objectName = getObjectName(4);
+ currentRoomData->screenObjectIndex[9]->objectName = getObjectName(4);
nicheAnimation(1, 1190768);
- currentRoomData->bitmapasociados[1].puntbitmap = 1190768;
+ currentRoomData->screenLayers[1].bitmapPointer = 1190768;
} break;
case 561: {
- currentRoomData->indexadoobjetos[9]->objectName = getObjectName(5);
+ currentRoomData->screenObjectIndex[9]->objectName = getObjectName(5);
nicheAnimation(1, 1182652);
- currentRoomData->bitmapasociados[1].puntbitmap = 1182652;
+ currentRoomData->screenLayers[1].bitmapPointer = 1182652;
} break;
case 563: {
- currentRoomData->indexadoobjetos[9]->objectName = getObjectName(6);
+ currentRoomData->screenObjectIndex[9]->objectName = getObjectName(6);
nicheAnimation(1, 1186044);
- currentRoomData->bitmapasociados[1].puntbitmap = 1186044;
+ currentRoomData->screenLayers[1].bitmapPointer = 1186044;
} break;
case 615: {
- currentRoomData->indexadoobjetos[9]->objectName = getObjectName(7);
+ currentRoomData->screenObjectIndex[9]->objectName = getObjectName(7);
nicheAnimation(1, 1181760);
- currentRoomData->bitmapasociados[1].puntbitmap = 1181760;
+ currentRoomData->screenLayers[1].bitmapPointer = 1181760;
} break;
}
- currentRoomData->bitmapasociados[1].tambitmap = 892;
- currentRoomData->bitmapasociados[1].coordx = 66;
- currentRoomData->bitmapasociados[1].coordy = 35;
- currentRoomData->bitmapasociados[1].profund = 1;
+ currentRoomData->screenLayers[1].bitmapSize = 892;
+ currentRoomData->screenLayers[1].coordx = 66;
+ currentRoomData->screenLayers[1].coordy = 35;
+ currentRoomData->screenLayers[1].depth = 1;
g_engine->_mouseManager->show();
updateAltScreen(24);
}
@@ -2833,28 +2858,28 @@ void useScreenObject() {
hornacina[1][0] = regobj.code;
drawText(regobj.useTextRef);
g_engine->_mouseManager->hide();
- currentRoomData->indexadoobjetos[8]->objectName = " ";
+ currentRoomData->screenObjectIndex[8]->objectName = " ";
animateGive(0, 1);
switch (hornacina[1][0]) {
case 561: {
- currentRoomData->indexadoobjetos[8]->objectName = getObjectName(5);
+ currentRoomData->screenObjectIndex[8]->objectName = getObjectName(5);
readBitmap(1381982, screenObjects[0], 892, 319);
- currentRoomData->bitmapasociados[0].puntbitmap = 1381982;
+ currentRoomData->screenLayers[0].bitmapPointer = 1381982;
} break;
case 615: {
- currentRoomData->indexadoobjetos[8]->objectName = getObjectName(7);
+ currentRoomData->screenObjectIndex[8]->objectName = getObjectName(7);
readBitmap(1381090, screenObjects[0], 892, 319);
- currentRoomData->bitmapasociados[0].puntbitmap = 1381090;
+ currentRoomData->screenLayers[0].bitmapPointer = 1381090;
} break;
}
- currentRoomData->bitmapasociados[0].tambitmap = 892;
- currentRoomData->bitmapasociados[0].coordx = 217;
- currentRoomData->bitmapasociados[0].coordy = 48;
- currentRoomData->bitmapasociados[0].profund = 1;
- screenHandleToBackground();
+ currentRoomData->screenLayers[0].bitmapSize = 892;
+ currentRoomData->screenLayers[0].coordx = 217;
+ currentRoomData->screenLayers[0].coordy = 48;
+ currentRoomData->screenLayers[0].depth = 1;
+ restoreBackground();
// XMStoPointer(ptr(segfondo, (offfondo + 4)), _handpantalla, 4, (sizepantalla - int32(4)));
assembleScreen();
- drawScreen(background);
+ drawScreen(sceneBackground);
animateOpen2(0, 1);
updateInventory(indicemochila);
drawBackpack();
@@ -2870,54 +2895,54 @@ void useScreenObject() {
switch (regobj.code) {
case 561:
- readBitmap(1381982, screenObjects[regobj.profundidad - 1],
+ readBitmap(1381982, screenObjects[regobj.depth - 1],
892, 319);
break;
case 615:
- readBitmap(1381090, screenObjects[regobj.profundidad - 1],
+ readBitmap(1381090, screenObjects[regobj.depth - 1],
892, 319);
break;
}
- screenHandleToBackground();
+ restoreBackground();
// XMStoPointer(ptr(segfondo, (offfondo + 4)), _handpantalla, 4, (sizepantalla - int32(4)));
assembleScreen();
- drawScreen(background);
+ drawScreen(sceneBackground);
animateOpen2(0, 1);
updateInventory(indicemochila);
drawBackpack();
- currentRoomData->indexadoobjetos[8]->objectName = " ";
+ currentRoomData->screenObjectIndex[8]->objectName = " ";
g_engine->_sound->playVoc("PLATAF", 375907, 14724);
switch (hornacina[1][hornacina[1][3]]) {
case 0: {
- currentRoomData->indexadoobjetos[8]->objectName = getObjectName(4);
+ currentRoomData->screenObjectIndex[8]->objectName = getObjectName(4);
nicheAnimation(1, 1399610);
- currentRoomData->bitmapasociados[0].puntbitmap = 1399610;
+ currentRoomData->screenLayers[0].bitmapPointer = 1399610;
} break;
case 561: {
- currentRoomData->indexadoobjetos[8]->objectName = getObjectName(5);
+ currentRoomData->screenObjectIndex[8]->objectName = getObjectName(5);
nicheAnimation(1, 1381982);
- currentRoomData->bitmapasociados[0].puntbitmap = 1381982;
+ currentRoomData->screenLayers[0].bitmapPointer = 1381982;
} break;
case 615: {
- currentRoomData->indexadoobjetos[8]->objectName = getObjectName(7);
+ currentRoomData->screenObjectIndex[8]->objectName = getObjectName(7);
nicheAnimation(1, 1381090);
- currentRoomData->bitmapasociados[0].puntbitmap = 1381090;
+ currentRoomData->screenLayers[0].bitmapPointer = 1381090;
} break;
case 622: {
- currentRoomData->indexadoobjetos[8]->objectName = getObjectName(8);
+ currentRoomData->screenObjectIndex[8]->objectName = getObjectName(8);
nicheAnimation(1, 1400502);
- currentRoomData->bitmapasociados[0].puntbitmap = 1400502;
+ currentRoomData->screenLayers[0].bitmapPointer = 1400502;
} break;
case 623: {
- currentRoomData->indexadoobjetos[8]->objectName = getObjectName(9);
+ currentRoomData->screenObjectIndex[8]->objectName = getObjectName(9);
nicheAnimation(1, 1398718);
- currentRoomData->bitmapasociados[0].puntbitmap = 1398718;
+ currentRoomData->screenLayers[0].bitmapPointer = 1398718;
} break;
}
- currentRoomData->bitmapasociados[0].tambitmap = 892;
- currentRoomData->bitmapasociados[0].coordx = 217;
- currentRoomData->bitmapasociados[0].coordy = 48;
- currentRoomData->bitmapasociados[0].profund = 1;
+ currentRoomData->screenLayers[0].bitmapSize = 892;
+ currentRoomData->screenLayers[0].coordx = 217;
+ currentRoomData->screenLayers[0].coordy = 48;
+ currentRoomData->screenLayers[0].depth = 1;
g_engine->_mouseManager->show();
updateAltScreen(20);
}
@@ -2936,45 +2961,45 @@ void useScreenObject() {
drawFlc(140, 34, offset, 0, 9, 24, false, false, true, basurillalog);
g_engine->_mouseManager->show();
updateItem(regobj.code);
- currentRoomData->indexadoobjetos[7]->indicefichero = 716;
+ currentRoomData->screenObjectIndex[7]->fileIndex = 716;
currentRoomData->mouseGrid[19][9] = 14;
currentRoomData->mouseGrid[22][16] = 15;
for (indlista = 21; indlista <= 22; indlista++)
for (indmoch = 17; indmoch <= 20; indmoch++)
currentRoomData->mouseGrid[indlista][indmoch] = 17;
{
- RoomBitmapRegister &with = currentRoomData->bitmapasociados[0];
+ RoomBitmapRegister &with = currentRoomData->screenLayers[0];
- with.puntbitmap = 1243652;
- with.tambitmap = 2718;
+ with.bitmapPointer = 1243652;
+ with.bitmapSize = 2718;
with.coordx = 127;
with.coordy = 36;
- with.profund = 6;
+ with.depth = 6;
}
{
- RoomBitmapRegister &with = currentRoomData->bitmapasociados[1];
+ RoomBitmapRegister &with = currentRoomData->screenLayers[1];
- with.puntbitmap = 1240474;
- with.tambitmap = 344;
+ with.bitmapPointer = 1240474;
+ with.bitmapSize = 344;
with.coordx = 168;
with.coordy = 83;
- with.profund = 12;
- loadItem(with.coordx, with.coordy, with.tambitmap, with.puntbitmap, with.profund);
+ with.depth = 12;
+ loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
{
- RoomBitmapRegister &with = currentRoomData->bitmapasociados[2];
+ RoomBitmapRegister &with = currentRoomData->screenLayers[2];
- with.puntbitmap = 1240818;
- with.tambitmap = 116;
+ with.bitmapPointer = 1240818;
+ with.bitmapSize = 116;
with.coordx = 177;
with.coordy = 82;
- with.profund = 1;
- loadItem(with.coordx, with.coordy, with.tambitmap, with.puntbitmap, with.profund);
+ with.depth = 1;
+ loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
readBitmap(1243652, screenObjects[5], 2718, 319);
- screenHandleToBackground();
+ restoreBackground();
assembleScreen();
- drawScreen(background);
+ drawScreen(sceneBackground);
} break;
case 594: {
drawText(regobj.useTextRef);
@@ -2987,24 +3012,24 @@ void useScreenObject() {
} break;
case 608: {
drawText(regobj.useTextRef);
- goToObject(currentRoomData->rejapantalla[mouseX][mouseY], 26);
+ goToObject(currentRoomData->walkAreasGrid[mouseX][mouseY], 26);
g_engine->_mouseManager->hide();
animateGive(2, 2);
animateOpen2(2, 2);
{
- RoomBitmapRegister &with = currentRoomData->bitmapasociados[3];
+ RoomBitmapRegister &with = currentRoomData->screenLayers[3];
- with.puntbitmap = 1546096;
- with.tambitmap = 372;
+ with.bitmapPointer = 1546096;
+ with.bitmapSize = 372;
with.coordx = 208;
with.coordy = 105;
- with.profund = 4;
- loadItem(with.coordx, with.coordy, with.tambitmap, with.puntbitmap, with.profund);
+ with.depth = 4;
+ loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
- screenHandleToBackground();
+ restoreBackground();
// XMStoPointer(ptr(segfondo, (offfondo + 4)), _handpantalla, 4,(sizepantalla - int32(4)));
assembleScreen();
- drawScreen(background);
+ drawScreen(sceneBackground);
updateInventory(indicemochila);
drawBackpack();
trampa_puesta = true;
@@ -3018,14 +3043,14 @@ void useScreenObject() {
// Show feather on pedestal
loadItem(187, 70, 104, 1545820, 8);
- screenHandleToBackground();
+ restoreBackground();
assembleScreen();
- drawScreen(background);
+ drawScreen(sceneBackground);
g_engine->_screen->update();
animateOpen2(direccionmovimiento, 1);
g_engine->_mouseManager->show();
- goToObject(currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], 14);
+ goToObject(currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount], 14);
g_engine->_mouseManager->hide();
g_engine->_sound->playVoc("PUFF", 191183, 18001);
// Animate to scythe
@@ -3033,38 +3058,38 @@ void useScreenObject() {
drawFlc(180, 60, offset, 0, 9, 0, false, false, true, basurillalog);
debug("End Anim!");
// load Scythe
- currentRoomData->bitmapasociados[2].puntbitmap = 1545820;
- currentRoomData->bitmapasociados[2].tambitmap = 104;
- currentRoomData->bitmapasociados[2].coordx = 277;
- currentRoomData->bitmapasociados[2].coordy = 104;
- currentRoomData->bitmapasociados[2].profund = 1;
+ currentRoomData->screenLayers[2].bitmapPointer = 1545820;
+ currentRoomData->screenLayers[2].bitmapSize = 104;
+ currentRoomData->screenLayers[2].coordx = 277;
+ currentRoomData->screenLayers[2].coordy = 104;
+ currentRoomData->screenLayers[2].depth = 1;
depthMap[0].posy = 104;
readBitmap(1545820, screenObjects[0], 104, 319);
- currentRoomData->bitmapasociados[4].puntbitmap = 1447508;
- currentRoomData->bitmapasociados[4].tambitmap = 464;
- currentRoomData->bitmapasociados[4].coordx = 186;
- currentRoomData->bitmapasociados[4].coordy = 64;
- currentRoomData->bitmapasociados[4].profund = 8;
+ currentRoomData->screenLayers[4].bitmapPointer = 1447508;
+ currentRoomData->screenLayers[4].bitmapSize = 464;
+ currentRoomData->screenLayers[4].coordx = 186;
+ currentRoomData->screenLayers[4].coordy = 64;
+ currentRoomData->screenLayers[4].depth = 8;
loadItem(186, 63, 464, 1447508, 8);
- screenHandleToBackground();
+ restoreBackground();
assembleScreen();
- drawScreen(background);
+ drawScreen(sceneBackground);
g_engine->_mouseManager->show();
- goToObject(currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], 18);
+ goToObject(currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount], 18);
g_engine->_mouseManager->hide();
animatePickup1(1, 1);
replaceBackpack(indicemochila, 638);
- currentRoomData->bitmapasociados[4].puntbitmap = 0;
- currentRoomData->bitmapasociados[4].tambitmap = 0;
- currentRoomData->bitmapasociados[4].coordx = 0;
- currentRoomData->bitmapasociados[4].coordy = 0;
- currentRoomData->bitmapasociados[4].profund = 0;
+ currentRoomData->screenLayers[4].bitmapPointer = 0;
+ currentRoomData->screenLayers[4].bitmapSize = 0;
+ currentRoomData->screenLayers[4].coordx = 0;
+ currentRoomData->screenLayers[4].coordy = 0;
+ currentRoomData->screenLayers[4].depth = 0;
screenObjects[7] = NULL;
- screenHandleToBackground();
+ restoreBackground();
assembleScreen();
- drawScreen(background);
+ drawScreen(sceneBackground);
animatePickup2(1, 1);
drawBackpack();
g_engine->_mouseManager->show();
@@ -3082,47 +3107,47 @@ void useScreenObject() {
g_engine->_mouseManager->hide();
animateGive(3, 1);
loadItem(86, 55, 92, 1591272, 8);
- screenHandleToBackground();
+ restoreBackground();
assembleScreen();
- drawScreen(background);
+ drawScreen(sceneBackground);
animateOpen2(3, 1);
g_engine->_mouseManager->show();
- goToObject(currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], 10);
+ goToObject(currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount], 10);
g_engine->_mouseManager->hide();
g_engine->_sound->playVoc("PUFF", 191183, 18001);
drawFlc(0, 47, offset, 0, 9, 0, false, false, true, basurillalog);
- currentRoomData->bitmapasociados[3].puntbitmap = 1591272;
- currentRoomData->bitmapasociados[3].tambitmap = 92;
- currentRoomData->bitmapasociados[3].coordx = 18;
- currentRoomData->bitmapasociados[3].coordy = 60;
- currentRoomData->bitmapasociados[3].profund = 3;
+ currentRoomData->screenLayers[3].bitmapPointer = 1591272;
+ currentRoomData->screenLayers[3].bitmapSize = 92;
+ currentRoomData->screenLayers[3].coordx = 18;
+ currentRoomData->screenLayers[3].coordy = 60;
+ currentRoomData->screenLayers[3].depth = 3;
depthMap[2].posx = 18;
depthMap[2].posy = 60;
readBitmap(1591272, screenObjects[2], 92, 319);
- currentRoomData->bitmapasociados[4].puntbitmap = 1746554;
- currentRoomData->bitmapasociados[4].tambitmap = 384;
- currentRoomData->bitmapasociados[4].coordx = 82;
- currentRoomData->bitmapasociados[4].coordy = 53;
- currentRoomData->bitmapasociados[4].profund = 8;
+ currentRoomData->screenLayers[4].bitmapPointer = 1746554;
+ currentRoomData->screenLayers[4].bitmapSize = 384;
+ currentRoomData->screenLayers[4].coordx = 82;
+ currentRoomData->screenLayers[4].coordy = 53;
+ currentRoomData->screenLayers[4].depth = 8;
loadItem(82, 53, 384, 1746554, 8);
assembleScreen();
- drawScreen(background);
+ drawScreen(sceneBackground);
g_engine->_mouseManager->show();
- goToObject(currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], 15);
+ goToObject(currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount], 15);
g_engine->_mouseManager->hide();
animatePickup1(3, 1);
replaceBackpack(indicemochila, 637);
- currentRoomData->bitmapasociados[4].puntbitmap = 0;
- currentRoomData->bitmapasociados[4].tambitmap = 0;
- currentRoomData->bitmapasociados[4].coordx = 0;
- currentRoomData->bitmapasociados[4].coordy = 0;
- currentRoomData->bitmapasociados[4].profund = 0;
+ currentRoomData->screenLayers[4].bitmapPointer = 0;
+ currentRoomData->screenLayers[4].bitmapSize = 0;
+ currentRoomData->screenLayers[4].coordx = 0;
+ currentRoomData->screenLayers[4].coordy = 0;
+ currentRoomData->screenLayers[4].depth = 0;
screenObjects[7] = NULL;
- screenHandleToBackground();
+ restoreBackground();
assembleScreen();
- drawScreen(background);
+ drawScreen(sceneBackground);
animatePickup2(3, 1);
drawBackpack();
g_engine->_mouseManager->show();
@@ -3136,24 +3161,24 @@ void useScreenObject() {
case 643: { // Urn with altar
long offset = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0][23] : flcOffsets[1][23];
- if (currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory] != 5)
+ if (currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount] != 5)
drawText(regobj.useTextRef);
- pulsax = 149 - 7;
- pulsay = 126 - 7;
- goToObject(currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], 5);
+ mouseClickX = 149 - 7;
+ mouseClickY = 126 - 7;
+ goToObject(currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount], 5);
g_engine->_mouseManager->hide();
updateInventory(indicemochila);
drawBackpack();
drawFlc(133, 0, offset, 0, 9, 22, false, false, true, basurillalog);
{
- RoomBitmapRegister &with = currentRoomData->bitmapasociados[2];
+ RoomBitmapRegister &with = currentRoomData->screenLayers[2];
- with.puntbitmap = 1744230;
- with.tambitmap = 824;
+ with.bitmapPointer = 1744230;
+ with.bitmapSize = 824;
with.coordx = 147;
with.coordy = 38;
- with.profund = 9;
- loadItem(with.coordx, with.coordy, with.tambitmap, with.puntbitmap, with.profund);
+ with.depth = 9;
+ loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
updateAltScreen(31);
for (indlista = 18; indlista <= 20; indlista++)
@@ -3169,9 +3194,9 @@ void useScreenObject() {
long offset = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0][24] : flcOffsets[1][24];
drawText(regobj.useTextRef);
- pulsax = 178 - 7;
- pulsay = 71 - 7;
- goToObject(currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], 3);
+ mouseClickX = 178 - 7;
+ mouseClickY = 71 - 7;
+ goToObject(currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount], 3);
g_engine->_mouseManager->hide();
g_engine->_sound->playVoc("AFILAR", 0, 6433);
drawFlc(160, 15, offset, 0, 9, 23, false, false, true, basurillalog);
@@ -3187,9 +3212,9 @@ void useScreenObject() {
animateGive(1, 1);
updateInventory(indicemochila);
dropObjectInScreen(regobj);
- screenHandleToBackground();
+ restoreBackground();
assembleScreen();
- drawScreen(background);
+ drawScreen(sceneBackground);
drawBackpack();
animateOpen2(1, 1);
for (indlista = 19; indlista <= 21; indlista++)
@@ -3201,16 +3226,16 @@ void useScreenObject() {
long offset = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0][25] : flcOffsets[1][25];
drawText(regobj.useTextRef);
- pulsax = 124 - 7;
- pulsay = 133 - 7;
- goToObject(currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], 9);
+ mouseClickX = 124 - 7;
+ mouseClickY = 133 - 7;
+ goToObject(currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount], 9);
g_engine->_mouseManager->hide();
drawFlc(110, 79, offset, 0, 9, 0, false, false, true, basurillalog);
replaceBackpack(indicemochila, 701);
drawBackpack();
- screenHandleToBackground();
+ restoreBackground();
assembleScreen();
- drawScreen(background);
+ drawScreen(sceneBackground);
g_engine->_mouseManager->show();
for (indlista = 18; indlista <= 20; indlista++)
currentRoomData->mouseGrid[indlista][26] = 10;
@@ -3220,16 +3245,16 @@ void useScreenObject() {
case 700: { // Trident
long offset = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0][26] : flcOffsets[1][26];
drawText(regobj.useTextRef);
- pulsax = 224 - 7;
- pulsay = 91 - 7;
- goToObject(currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], 7);
+ mouseClickX = 224 - 7;
+ mouseClickY = 91 - 7;
+ goToObject(currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount], 7);
g_engine->_mouseManager->hide();
drawFlc(208, 0, offset, 0, 9, 21, false, false, true, basurillalog);
- currentRoomData->bitmapasociados[0].puntbitmap = 0;
- currentRoomData->bitmapasociados[0].tambitmap = 0;
- currentRoomData->bitmapasociados[0].coordx = 0;
- currentRoomData->bitmapasociados[0].coordy = 0;
- currentRoomData->bitmapasociados[0].profund = 0;
+ currentRoomData->screenLayers[0].bitmapPointer = 0;
+ currentRoomData->screenLayers[0].bitmapSize = 0;
+ currentRoomData->screenLayers[0].coordx = 0;
+ currentRoomData->screenLayers[0].coordy = 0;
+ currentRoomData->screenLayers[0].depth = 0;
screenObjects[2] = NULL;
for (indmoch = 6; indmoch <= 9; indmoch++)
currentRoomData->mouseGrid[26][indmoch] = 3;
@@ -3257,7 +3282,7 @@ void useScreenObject() {
currentRoomData->mouseGrid[35][indmoch] = 4;
for (indmoch = 9; indmoch <= 11; indmoch++)
currentRoomData->mouseGrid[35][indmoch] = 7;
- currentRoomData->doors[1].abiertacerrada = 1;
+ currentRoomData->doors[1].openclosed = 1;
g_engine->_mouseManager->show();
updateItem(regobj.code);
} break;
@@ -3270,18 +3295,18 @@ void useScreenObject() {
animatePickup1(0, 1);
g_engine->_sound->playVoc("TIZA", 390631, 18774);
{
- RoomBitmapRegister &with = currentRoomData->bitmapasociados[1];
+ RoomBitmapRegister &with = currentRoomData->screenLayers[1];
- with.puntbitmap = 1745054;
- with.tambitmap = 1500;
+ with.bitmapPointer = 1745054;
+ with.bitmapSize = 1500;
with.coordx = 39;
with.coordy = 16;
- with.profund = 1;
- loadItem(with.coordx, with.coordy, with.tambitmap, with.puntbitmap, with.profund);
+ with.depth = 1;
+ loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
- screenHandleToBackground();
+ restoreBackground();
assembleScreen();
- drawScreen(background);
+ drawScreen(sceneBackground);
g_engine->_sound->waitForSoundEnd();
g_engine->_sound->playVoc("PUFF", 191183, 18001);
@@ -3293,7 +3318,7 @@ void useScreenObject() {
} break;
}
} else {
- goToObject(currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], currentRoomData->rejapantalla[mouseX][mouseY]);
+ goToObject(currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount], currentRoomData->walkAreasGrid[mouseX][mouseY]);
if (regobj.code == 536 || regobj.code == 220)
drawText(Random(6) + 1033);
else
@@ -3302,8 +3327,8 @@ void useScreenObject() {
} else {
if (screenObject > 0) {
readItemRegister(screenObject);
- goToObject(currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory], currentRoomData->rejapantalla[mouseX][mouseY]);
- switch (regobj.usar[0]) {
+ goToObject(currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount], currentRoomData->walkAreasGrid[mouseX][mouseY]);
+ switch (regobj.used[0]) {
case 0: {
if (regobj.useTextRef > 0)
drawText(regobj.useTextRef);
@@ -3320,7 +3345,7 @@ void useScreenObject() {
g_engine->_mouseManager->show();
} break;
case 154: {
- regobj.usar[0] = 9;
+ regobj.used[0] = 9;
if (regobj.beforeUseTextRef > 0)
drawText(regobj.beforeUseTextRef);
g_engine->_mouseManager->hide();
@@ -3378,9 +3403,9 @@ void useScreenObject() {
g_engine->_sound->autoPlayVoc("CALDERA", 6433, 15386);
turnLightOn();
g_engine->_mouseManager->show();
- currentRoomData->puntpaleta = 1536;
- currentRoomData->indexadoobjetos[1]->indicefichero = 424;
- currentRoomData->doors[1].abiertacerrada = 1;
+ currentRoomData->palettePointer = 1536;
+ currentRoomData->screenObjectIndex[1]->fileIndex = 424;
+ currentRoomData->doors[1].openclosed = 1;
} break;
case 359: {
drawText(regobj.useTextRef);
@@ -3392,10 +3417,10 @@ void useScreenObject() {
animateOpen2(0, 0);
g_engine->_mouseManager->show();
updateItem(regobj.code);
- currentRoomData->indexadoobjetos[16]->indicefichero = 362;
- currentRoomData->indexadoobjetos[16]->objectName = getObjectName(2);
- currentRoomData->indexadoobjetos[1]->indicefichero = 347;
- currentRoomData->indexadoobjetos[1]->objectName = getObjectName(3);
+ currentRoomData->screenObjectIndex[16]->fileIndex = 362;
+ currentRoomData->screenObjectIndex[16]->objectName = getObjectName(2);
+ currentRoomData->screenObjectIndex[1]->fileIndex = 347;
+ currentRoomData->screenObjectIndex[1]->objectName = getObjectName(3);
g_engine->_sound->stopVoc();
g_engine->_sound->autoPlayVoc("CALDERA", 6433, 15386);
} break;
@@ -3413,13 +3438,13 @@ void useScreenObject() {
if (vasijapuesta) {
drawFlc(108, 0, offsetWithJar, 0, 9, 0, false, false, true, basurillalog);
{
- RoomBitmapRegister &with = currentRoomData->bitmapasociados[0];
+ RoomBitmapRegister &with = currentRoomData->screenLayers[0];
- with.puntbitmap = 1636796;
- with.tambitmap = 628;
+ with.bitmapPointer = 1636796;
+ with.bitmapSize = 628;
with.coordx = 153;
with.coordy = 48;
- with.profund = 1;
+ with.depth = 1;
}
for (indlista = 19; indlista <= 21; indlista++)
for (indmoch = 10; indmoch <= 13; indmoch++)
@@ -3447,18 +3472,18 @@ void openScreenObject() {
byte indicex, indicey;
bool sueltapegote;
- uint mouseX = (pulsax + 7) / factorx;
- uint mouseY = (pulsay + 7) / factory;
- uint screenObject = currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[mouseX][mouseY]]->indicefichero;
+ uint mouseX = (mouseClickX + 7) / xGridCount;
+ uint mouseY = (mouseClickY + 7) / yGridCount;
+ uint screenObject = currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[mouseX][mouseY]]->fileIndex;
if (screenObject == 0)
return;
readItemRegister(screenObject);
- debug("Read screen object = %s, with code = %d, depth=%d", regobj.name.c_str(), regobj.code, regobj.profundidad);
- goToObject(currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory],
- currentRoomData->rejapantalla[mouseX][mouseY]);
+ debug("Read screen object = %s, with code = %d, depth=%d", regobj.name.c_str(), regobj.code, regobj.depth);
+ goToObject(currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount],
+ currentRoomData->walkAreasGrid[mouseX][mouseY]);
- if (regobj.abrir == false) {
+ if (regobj.openable == false) {
drawText(Random(9) + 1059);
return;
} else {
@@ -3473,26 +3498,26 @@ void openScreenObject() {
sueltapegote = true;
break;
case 415:
- if (currentRoomData->doors[2].abiertacerrada == 2)
+ if (currentRoomData->doors[2].openclosed == 2)
sueltapegote = true;
else {
g_engine->_mouseManager->hide();
animatePickup1(0, 1);
- screenObjects[regobj.profundidad - 1] = NULL;
+ screenObjects[regobj.depth - 1] = NULL;
indicey = 0;
- while (currentRoomData->bitmapasociados[indicey].profund != regobj.profundidad && indicey != 15) {
+ while (currentRoomData->screenLayers[indicey].depth != regobj.depth && indicey != 15) {
indicey++;
}
- debug("changing bitmap at %d, with depth = %d", indicey, currentRoomData->bitmapasociados[indicey].profund);
- currentRoomData->bitmapasociados[indicey].puntbitmap = 0;
- currentRoomData->bitmapasociados[indicey].tambitmap = 0;
- currentRoomData->bitmapasociados[indicey].coordx = 0;
- currentRoomData->bitmapasociados[indicey].coordy = 0;
- currentRoomData->bitmapasociados[indicey].profund = 0;
- currentRoomData->doors[2].abiertacerrada = 1;
- screenHandleToBackground();
+ debug("changing bitmap at %d, with depth = %d", indicey, currentRoomData->screenLayers[indicey].depth);
+ currentRoomData->screenLayers[indicey].bitmapPointer = 0;
+ currentRoomData->screenLayers[indicey].bitmapSize = 0;
+ currentRoomData->screenLayers[indicey].coordx = 0;
+ currentRoomData->screenLayers[indicey].coordy = 0;
+ currentRoomData->screenLayers[indicey].depth = 0;
+ currentRoomData->doors[2].openclosed = 1;
+ restoreBackground();
assembleScreen();
- drawScreen(background);
+ drawScreen(sceneBackground);
animateOpen2(0, 1);
g_engine->_mouseManager->show();
for (indicey = 0; indicey <= 12; indicey++)
@@ -3509,25 +3534,25 @@ void openScreenObject() {
}
break;
case 548:
- if (currentRoomData->doors[0].abiertacerrada == 2)
+ if (currentRoomData->doors[0].openclosed == 2)
sueltapegote = true;
else {
g_engine->_mouseManager->hide();
animatePickup1(1, 1);
- screenObjects[regobj.profundidad - 1] = NULL;
+ screenObjects[regobj.depth - 1] = NULL;
indicey = 0;
- while (currentRoomData->bitmapasociados[indicey].profund != regobj.profundidad && indicey != 14) {
+ while (currentRoomData->screenLayers[indicey].depth != regobj.depth && indicey != 14) {
indicey++;
}
- currentRoomData->bitmapasociados[indicey].puntbitmap = 0;
- currentRoomData->bitmapasociados[indicey].tambitmap = 0;
- currentRoomData->bitmapasociados[indicey].coordx = 0;
- currentRoomData->bitmapasociados[indicey].coordy = 0;
- currentRoomData->bitmapasociados[indicey].profund = 0;
- currentRoomData->doors[0].abiertacerrada = 1;
- screenHandleToBackground();
+ currentRoomData->screenLayers[indicey].bitmapPointer = 0;
+ currentRoomData->screenLayers[indicey].bitmapSize = 0;
+ currentRoomData->screenLayers[indicey].coordx = 0;
+ currentRoomData->screenLayers[indicey].coordy = 0;
+ currentRoomData->screenLayers[indicey].depth = 0;
+ currentRoomData->doors[0].openclosed = 1;
+ restoreBackground();
assembleScreen();
- drawScreen(background);
+ drawScreen(sceneBackground);
animateOpen2(1, 1);
g_engine->_mouseManager->show();
indicex = 30;
@@ -3560,9 +3585,9 @@ void openScreenObject() {
drawText(Random(9) + 1059);
return;
}
- currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[mouseX][mouseY]]->indicefichero = regobj.reemplazarpor;
+ currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[mouseX][mouseY]]->fileIndex = regobj.replaceWith;
g_engine->_mouseManager->hide();
- switch (regobj.altura) {
+ switch (regobj.height) {
case 0: {
animatePickup1(direccionmovimiento, 0);
updateVideo();
@@ -3582,13 +3607,13 @@ void openScreenObject() {
g_engine->_mouseManager->show();
for (indicey = regobj.yrej1; indicey <= regobj.yrej2; indicey++)
for (indicex = regobj.xrej1; indicex <= regobj.xrej2; indicex++) {
- currentRoomData->rejapantalla[indicex][indicey] = regobj.parcherejapantalla[indicex - regobj.xrej1][indicey - regobj.yrej1];
- currentRoomData->mouseGrid[indicex][indicey] = regobj.parcherejaraton[indicex - regobj.xrej1][indicey - regobj.yrej1];
+ currentRoomData->walkAreasGrid[indicex][indicey] = regobj.walkAreasPatch[indicex - regobj.xrej1][indicey - regobj.yrej1];
+ currentRoomData->mouseGrid[indicex][indicey] = regobj.mouseGridPatch[indicex - regobj.xrej1][indicey - regobj.yrej1];
}
for (indicex = 0; indicex < 15; indicex++)
- if (currentRoomData->bitmapasociados[indicex].puntbitmap == regobj.punterobitmap) {
- currentRoomData->bitmapasociados[indicex].puntbitmap = regobj.puntparche;
- currentRoomData->bitmapasociados[indicex].tambitmap = regobj.tamparche;
+ if (currentRoomData->screenLayers[indicex].bitmapPointer == regobj.bitmapPointer) {
+ currentRoomData->screenLayers[indicex].bitmapPointer = regobj.dropOverlay;
+ currentRoomData->screenLayers[indicex].bitmapSize = regobj.dropOverlaySize;
}
numeroaccion = 0;
}
@@ -3602,16 +3627,16 @@ void closeScreenObject() {
bool sueltapegote;
uint objeto_de_la_pantalla;
- x_del_raton = ((pulsax + 7) / factorx);
- y_del_raton = ((pulsay + 7) / factory);
- objeto_de_la_pantalla = currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[x_del_raton][y_del_raton]]->indicefichero;
+ x_del_raton = ((mouseClickX + 7) / xGridCount);
+ y_del_raton = ((mouseClickY + 7) / yGridCount);
+ objeto_de_la_pantalla = currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[x_del_raton][y_del_raton]]->fileIndex;
if (objeto_de_la_pantalla == 0)
return;
// verifyCopyProtection2();
readItemRegister(objeto_de_la_pantalla);
- goToObject(currentRoomData->rejapantalla[((characterPosX + rectificacionx) / factorx)][((characterPosY + rectificaciony) / factory)],
- currentRoomData->rejapantalla[x_del_raton][y_del_raton]);
- if (regobj.cerrar == false) {
+ goToObject(currentRoomData->walkAreasGrid[((characterPosX + characterCorrectionX) / xGridCount)][((characterPosY + characerCorrectionY) / yGridCount)],
+ currentRoomData->walkAreasGrid[x_del_raton][y_del_raton]);
+ if (regobj.closeable == false) {
drawText((Random(10) + 1068));
return;
} else {
@@ -3632,9 +3657,9 @@ void closeScreenObject() {
drawText(Random(10) + 1068);
return;
}
- currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[x_del_raton][y_del_raton]]->indicefichero = regobj.reemplazarpor;
+ currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[x_del_raton][y_del_raton]]->fileIndex = regobj.replaceWith;
g_engine->_mouseManager->hide();
- switch (regobj.altura) {
+ switch (regobj.height) {
case 0: {
animatePickup1(direccionmovimiento, 0);
updateVideo();
@@ -3654,13 +3679,13 @@ void closeScreenObject() {
g_engine->_mouseManager->show();
for (indicey = regobj.yrej1; indicey <= regobj.yrej2; indicey++)
for (indicex = regobj.xrej1; indicex <= regobj.xrej2; indicex++) {
- currentRoomData->rejapantalla[indicex][indicey] = regobj.parcherejapantalla[indicex - regobj.xrej1][indicey - regobj.yrej1];
- currentRoomData->mouseGrid[indicex][indicey] = regobj.parcherejaraton[indicex - regobj.xrej1][indicey - regobj.yrej1];
+ currentRoomData->walkAreasGrid[indicex][indicey] = regobj.walkAreasPatch[indicex - regobj.xrej1][indicey - regobj.yrej1];
+ currentRoomData->mouseGrid[indicex][indicey] = regobj.mouseGridPatch[indicex - regobj.xrej1][indicey - regobj.yrej1];
}
for (indicex = 0; indicex < 15; indicex++)
- if (currentRoomData->bitmapasociados[indicex].puntbitmap == regobj.punterobitmap) {
- currentRoomData->bitmapasociados[indicex].puntbitmap = regobj.puntparche;
- currentRoomData->bitmapasociados[indicex].tambitmap = regobj.tamparche;
+ if (currentRoomData->screenLayers[indicex].bitmapPointer == regobj.bitmapPointer) {
+ currentRoomData->screenLayers[indicex].bitmapPointer = regobj.dropOverlay;
+ currentRoomData->screenLayers[indicex].bitmapSize = regobj.dropOverlaySize;
}
numeroaccion = 0;
}
@@ -3795,8 +3820,8 @@ void loadObjects() {
if (!ficheroobj.isOpen())
showError(312);
for (int i = 0; i < inventoryIconCount; i++) {
- mochilaxms[i] = (byte *)malloc(sizeicono);
- ficheroobj.read(mochilaxms[i], sizeicono);
+ mochilaxms[i] = (byte *)malloc(inventoryIconSize);
+ ficheroobj.read(mochilaxms[i], inventoryIconSize);
}
if (contadorpc > 65)
showError(274);
@@ -3816,13 +3841,13 @@ void obtainName(Common::String &nombrejugador) {
tamfondonom = imagesize(84, 34, 235, 80);
puntfondonom = (byte *)malloc(tamfondonom);
- getImg(84, 34, 235, 80, puntfondonom);
+ g_engine->_graphics->getImg(84, 34, 235, 80, puntfondonom);
drawMenu(8);
g_engine->_screen->update();
Common::String paso;
readAlphaGraph(paso, 8, 125, 62, 252);
nombrejugador = paso.c_str();
- putImg(84, 34, puntfondonom);
+ g_engine->_graphics->putImg(84, 34, puntfondonom);
g_engine->_screen->update();
free(puntfondonom);
}
@@ -3830,18 +3855,18 @@ void obtainName(Common::String &nombrejugador) {
void loadScrollData(uint numpantalla, bool scrollder,
uint poshor, int correccionscroll);
-static byte *fondsprite;
+static byte *spriteBackground;
/**
- * Blits image1 over image2 on the 0 pixels of image2
+ * Blits srcImage over dstImage on the zeroed pixels of dstImage
*/
-static void montaimagenvir(byte *image1, byte *image2) { // Near;
- uint16 w = READ_LE_UINT16(image2) + 1;
- uint16 h = READ_LE_UINT16(image2 + 2) + 1;
+static void blit(byte *srcImage, byte *dstImage) { // Near;
+ uint16 w = READ_LE_UINT16(dstImage) + 1;
+ uint16 h = READ_LE_UINT16(dstImage + 2) + 1;
uint size = w * h;
- byte *dst = image2 + 4;
- byte *src = image1 + 4;
+ byte *dst = dstImage + 4;
+ byte *src = srcImage + 4;
for (int i = 0; i < size; i++) {
if (dst[i] == 0) {
dst[i] = src[i];
@@ -3859,7 +3884,7 @@ static void getScreen(byte *bg) {
static void scrollRight(uint &horizontalPos) {
- int characterPos = 25 + (320 - (characterPosX + rectificacionx * 2));
+ int characterPos = 25 + (320 - (characterPosX + characterCorrectionX * 2));
// We scroll 4 by 4 pixels so we divide by 4 to find out the number of necessary steps
uint stepCount = (320 - horizontalPos) >> 2;
byte *assembledCharacterFrame = (byte *)malloc(sizeframe);
@@ -3867,12 +3892,12 @@ static void scrollRight(uint &horizontalPos) {
size_t numBytes = 44796;
for (int i = 0; i < stepCount; i++) {
// move everything to the left
- memmove(background + 4, background + 8, numBytes);
+ memmove(sceneBackground + 4, sceneBackground + 8, numBytes);
horizontalPos += 4;
for (int k = 0; k < 140; k++) {
for (int j = 0; j < 4; j++) {
- background[320 + k * 320 + j] = screenHandle[horizontalPos + k * 320 + j];
+ sceneBackground[320 + k * 320 + j] = backgroundCopy[horizontalPos + k * 320 + j];
}
}
if (characterPos > 0) {
@@ -3884,26 +3909,26 @@ static void scrollRight(uint &horizontalPos) {
characterPosX -= 2;
- pasoframe = secuencia.bitmap[1][iframe];
+ curCharacterAnimationFrame = secuencia.bitmap[1][iframe];
// We need to copy the original frame as to not replace its black background for after
// the scroll ends. Original code would copy from XMS memory.
- Common::copy(pasoframe, pasoframe + sizeframe, assembledCharacterFrame);
+ Common::copy(curCharacterAnimationFrame, curCharacterAnimationFrame + sizeframe, assembledCharacterFrame);
// puts the original captured background back in the background for next iteration
- putVirtualImg(characterPosX - 2, characterPosY, background, fondsprite);
+ g_engine->_graphics->putImageArea(characterPosX - 2, characterPosY, sceneBackground, spriteBackground);
uint16 pasoframeW = READ_LE_UINT16(assembledCharacterFrame);
uint16 pasoframeH = READ_LE_UINT16(assembledCharacterFrame + 2);
// Grabs current area surrounding character (which might contain parts of A and B)
- getVirtualImg(characterPosX, characterPosY, characterPosX + pasoframeW, characterPosY + pasoframeH, background, fondsprite);
+ g_engine->_graphics->getImageArea(characterPosX, characterPosY, characterPosX + pasoframeW, characterPosY + pasoframeH, sceneBackground, spriteBackground);
// blits over the character sprite, only on black pixels
- montaimagenvir(fondsprite, assembledCharacterFrame);
+ blit(spriteBackground, assembledCharacterFrame);
// puts it back in the background (character + piece of background)
- putVirtualImg(characterPosX, characterPosY, background, assembledCharacterFrame);
+ g_engine->_graphics->putImageArea(characterPosX, characterPosY, sceneBackground, assembledCharacterFrame);
} else
characterPosX -= 4;
g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
g_engine->_screen->update();
- drawScreen(background);
+ drawScreen(sceneBackground);
}
free(assembledCharacterFrame);
}
@@ -3920,13 +3945,13 @@ static void scrollLeft(uint &poshor) {
for (int i = numpasos; i >= 1; i--) {
for (int j = numBytes; j > 0; j--) {
// move the previous background to the right
- background[j + 4] = background[j];
+ sceneBackground[j + 4] = sceneBackground[j];
}
poshor -= 4;
for (int k = 0; k < 140; k++) {
for (int j = 0; j < 4; j++) {
- background[4 + k * 320 + j] = screenHandle[4 + poshor + k * 320 + j];
+ sceneBackground[4 + k * 320 + j] = backgroundCopy[4 + poshor + k * 320 + j];
}
}
@@ -3939,23 +3964,23 @@ static void scrollLeft(uint &poshor) {
characterPosX += 2;
- pasoframe = secuencia.bitmap[3][iframe];
- Common::copy(pasoframe, pasoframe + sizeframe, assembledCharacterFrame);
+ curCharacterAnimationFrame = secuencia.bitmap[3][iframe];
+ Common::copy(curCharacterAnimationFrame, curCharacterAnimationFrame + sizeframe, assembledCharacterFrame);
- putVirtualImg(characterPosX + 2, characterPosY, background, fondsprite);
+ g_engine->_graphics->putImageArea(characterPosX + 2, characterPosY, sceneBackground, spriteBackground);
uint16 pasoframeW = READ_LE_UINT16(assembledCharacterFrame);
uint16 pasoframeH = READ_LE_UINT16(assembledCharacterFrame + 2);
- getVirtualImg(characterPosX, characterPosY, characterPosX + pasoframeW, characterPosY + pasoframeH, background, fondsprite);
- montaimagenvir(fondsprite, assembledCharacterFrame);
- putVirtualImg(characterPosX, characterPosY, background, assembledCharacterFrame);
+ g_engine->_graphics->getImageArea(characterPosX, characterPosY, characterPosX + pasoframeW, characterPosY + pasoframeH, sceneBackground, spriteBackground);
+ blit(spriteBackground, assembledCharacterFrame);
+ g_engine->_graphics->putImageArea(characterPosX, characterPosY, sceneBackground, assembledCharacterFrame);
} else
characterPosX += 4;
g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
g_engine->_screen->update();
- drawScreen(background);
+ drawScreen(sceneBackground);
}
free(assembledCharacterFrame);
}
@@ -3967,15 +3992,15 @@ static void scrollLeft(uint &poshor) {
void loadScrollData(uint numpantalla, bool scrollder, uint poshor, int correccionscroll) {
uint indicecarga;
- screenHandleToBackground();
+ restoreBackground();
// Fondo now contains background A, handpantalla contains background A
- uint pasoframeW = READ_LE_UINT16(pasoframe);
- uint pasoframeH = READ_LE_UINT16(pasoframe + 2);
+ uint pasoframeW = READ_LE_UINT16(curCharacterAnimationFrame);
+ uint pasoframeH = READ_LE_UINT16(curCharacterAnimationFrame + 2);
debug("characterPos=%d,%d, size=%d,%d", characterPosX, characterPosY, pasoframeW, pasoframeH);
/* Copy the area with the player from previous scren*/
- fondsprite = (byte *)malloc(4 + (pasoframeW + 8) * (pasoframeH + 8));
- getVirtualImg(characterPosX, characterPosY, characterPosX + pasoframeW, characterPosY + pasoframeH, background, fondsprite);
+ spriteBackground = (byte *)malloc(4 + (pasoframeW + 8) * (pasoframeH + 8));
+ g_engine->_graphics->getImageArea(characterPosX, characterPosY, characterPosX + pasoframeW, characterPosY + pasoframeH, sceneBackground, spriteBackground);
// Start screen 2
Common::File fichpanta;
@@ -3987,9 +4012,9 @@ void loadScrollData(uint numpantalla, bool scrollder, uint poshor, int correccio
// Fondo now contains background B, handpantalla contains background B
for (indicecarga = 0; indicecarga < 15; indicecarga++) {
{
- RoomBitmapRegister &with = currentRoomData->bitmapasociados[indicecarga];
- if (with.tambitmap > 0)
- loadItem(with.coordx, with.coordy, with.tambitmap, with.puntbitmap, with.profund);
+ RoomBitmapRegister &with = currentRoomData->screenLayers[indicecarga];
+ if (with.bitmapSize > 0)
+ loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
}
// assembles the screen objects into fondo
@@ -3997,27 +4022,27 @@ void loadScrollData(uint numpantalla, bool scrollder, uint poshor, int correccio
// Fondo contains background B + objects, handpantalla contains plain background B
// Copies the contents of fondo into handpantalla
- Common::copy(background, background + 44804, screenHandle);
+ Common::copy(sceneBackground, sceneBackground + 44804, backgroundCopy);
// Fondo contains background B + objects, handpantalla contains background B + objects
movidapaleta = 0;
- getScreen(background);
+ getScreen(sceneBackground);
// Fondo now contains full background A again, handpantalla contains background B + objects
- drawScreen(background);
+ drawScreen(sceneBackground);
if (scrollder)
scrollRight(poshor);
else
scrollLeft(poshor);
// After scroll is done, handpantalla will now contain the resulting fondo (background B + objects)
- Common::copy(screenHandle, screenHandle + 44804, background);
+ Common::copy(backgroundCopy, backgroundCopy + 44804, sceneBackground);
characterPosX += correccionscroll;
assembleScreen();
- drawScreen(background);
- free(fondsprite);
+ drawScreen(sceneBackground);
+ free(spriteBackground);
loadScreen();
trayec[indicetray].x = characterPosX;
trayec[indicetray].y = characterPosY;
@@ -4025,7 +4050,7 @@ void loadScrollData(uint numpantalla, bool scrollder, uint poshor, int correccio
void saveGameToRegister() {
uint indiaux;
- regpartida.numeropantalla = currentRoomData->codigo;
+ regpartida.numeropantalla = currentRoomData->code;
regpartida.longtray = longtray;
regpartida.indicetray = indicetray;
regpartida.codigoobjmochila = codigoobjmochila;
@@ -4035,7 +4060,7 @@ void saveGameToRegister() {
regpartida.volumenmelodiaizquierdo = musicVolLeft;
regpartida.oldxrejilla = oldxrejilla;
regpartida.oldyrejilla = oldyrejilla;
- regpartida.animadoprofundidad = animado.profundidad;
+ regpartida.animadoprofundidad = animado.depth;
regpartida.animadodir = animado.dir;
regpartida.animadoposx = animado.posx;
regpartida.animadoposy = animado.posy;
@@ -4086,7 +4111,7 @@ void saveGameToRegister() {
regpartida.oldobjmochila = oldobjmochila;
regpartida.objetomochila = objetomochila;
- regpartida.nombrepersonaje = nombrepersonaje;
+ regpartida.nombrepersonaje = characterName;
for (int i = 0; i < routePointCount; i++) {
regpartida.mainRoute[i].x = mainRoute[i].x;
@@ -4098,7 +4123,7 @@ void saveGameToRegister() {
regpartida.trayec[indiaux].y = trayec[indiaux].y;
}
- for (indiaux = 0; indiaux < maxpersonajes; indiaux++) {
+ for (indiaux = 0; indiaux < characterCount; indiaux++) {
regpartida.primera[indiaux] = primera[indiaux];
regpartida.lprimera[indiaux] = lprimera[indiaux];
regpartida.cprimera[indiaux] = cprimera[indiaux];
@@ -4116,12 +4141,12 @@ void saveGameToRegister() {
}
}
-void loadGame(regispartida game) {
+void loadGame(SavedGame game) {
freeAnimation();
freeScreenObjects();
uint indiaux, indiaux2;
- tipoefectofundido = Random(15) + 1;
+ transitionEffect = Random(15) + 1;
longtray = game.longtray;
indicetray = game.indicetray;
@@ -4132,7 +4157,7 @@ void loadGame(regispartida game) {
musicVolLeft = game.volumenmelodiaizquierdo;
oldxrejilla = game.oldxrejilla;
oldyrejilla = game.oldyrejilla;
- animado.profundidad = game.animadoprofundidad;
+ animado.depth = game.animadoprofundidad;
animado.dir = game.animadodir;
animado.posx = game.animadoposx;
animado.posy = game.animadoposy;
@@ -4186,7 +4211,7 @@ void loadGame(regispartida game) {
yframe2 = game.yframe2;
oldobjmochila = game.oldobjmochila;
objetomochila = game.objetomochila;
- nombrepersonaje = game.nombrepersonaje;
+ characterName = game.nombrepersonaje;
for (int i = 0; i < routePointCount; i++) {
mainRoute[i].x = game.mainRoute[i].x;
mainRoute[i].y = game.mainRoute[i].y;
@@ -4195,7 +4220,7 @@ void loadGame(regispartida game) {
trayec[indiaux].x = game.trayec[indiaux].x;
trayec[indiaux].y = game.trayec[indiaux].y;
}
- for (indiaux = 0; indiaux < maxpersonajes; indiaux++) {
+ for (indiaux = 0; indiaux < characterCount; indiaux++) {
primera[indiaux] = game.primera[indiaux];
lprimera[indiaux] = game.lprimera[indiaux];
cprimera[indiaux] = game.cprimera[indiaux];
@@ -4213,11 +4238,11 @@ void loadGame(regispartida game) {
}
totalFadeOut(0);
- cleardevice();
+ g_engine->_screen->clear();
loadPalette("DEFAULT");
loadScreenData(game.numeropantalla);
- switch (currentRoomData->codigo) {
+ switch (currentRoomData->code) {
case 2: {
if (teleencendida)
g_engine->_sound->autoPlayVoc("PARASITO", 355778, 20129);
@@ -4244,16 +4269,16 @@ void loadGame(regispartida game) {
case 20: {
switch (hornacina[0][hornacina[0][3]]) {
case 0:
- currentRoomData->indexadoobjetos[9]->objectName = getObjectName(4);
+ currentRoomData->screenObjectIndex[9]->objectName = getObjectName(4);
break;
case 561:
- currentRoomData->indexadoobjetos[9]->objectName = getObjectName(5);
+ currentRoomData->screenObjectIndex[9]->objectName = getObjectName(5);
break;
case 563:
- currentRoomData->indexadoobjetos[9]->objectName = getObjectName(6);
+ currentRoomData->screenObjectIndex[9]->objectName = getObjectName(6);
break;
case 615:
- currentRoomData->indexadoobjetos[9]->objectName = getObjectName(7);
+ currentRoomData->screenObjectIndex[9]->objectName = getObjectName(7);
break;
}
} break;
@@ -4264,37 +4289,37 @@ void loadGame(regispartida game) {
case 24: {
switch (hornacina[1][hornacina[1][3]]) {
case 0:
- currentRoomData->indexadoobjetos[8]->objectName = getObjectName(4);
+ currentRoomData->screenObjectIndex[8]->objectName = getObjectName(4);
break;
case 561:
- currentRoomData->indexadoobjetos[8]->objectName = getObjectName(5);
+ currentRoomData->screenObjectIndex[8]->objectName = getObjectName(5);
break;
case 615:
- currentRoomData->indexadoobjetos[8]->objectName = getObjectName(7);
+ currentRoomData->screenObjectIndex[8]->objectName = getObjectName(7);
break;
case 622:
- currentRoomData->indexadoobjetos[8]->objectName = getObjectName(8);
+ currentRoomData->screenObjectIndex[8]->objectName = getObjectName(8);
break;
case 623:
- currentRoomData->indexadoobjetos[8]->objectName = getObjectName(9);
+ currentRoomData->screenObjectIndex[8]->objectName = getObjectName(9);
break;
}
if (trampa_puesta) {
currentRoomData->animationFlag = true;
- loadAnimation(currentRoomData->nombremovto);
+ loadAnimation(currentRoomData->animationName);
iframe2 = 0;
indicetray2 = 1;
- currentRoomData->tray2[indicetray2 - 1].x = 214 - 15;
- currentRoomData->tray2[indicetray2 - 1].y = 115 - 42;
- animado.dir = currentRoomData->dir2[indicetray2 - 1];
- animado.posx = currentRoomData->tray2[indicetray2 - 1].x;
- animado.posy = currentRoomData->tray2[indicetray2 - 1].y;
- animado.profundidad = 14;
+ currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].x = 214 - 15;
+ currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].y = 115 - 42;
+ animado.dir = currentRoomData->secondaryAnimDirections[indicetray2 - 1];
+ animado.posx = currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].x;
+ animado.posy = currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].y;
+ animado.depth = 14;
for (indiaux = 0; indiaux < maxrejax; indiaux++)
for (indiaux2 = 0; indiaux2 < maxrejay; indiaux2++) {
if (rejamascaramovto[indiaux][indiaux2] > 0)
- currentRoomData->rejapantalla[oldposx + indiaux][oldposy + indiaux2] = rejamascaramovto[indiaux][indiaux2];
+ currentRoomData->walkAreasGrid[oldposx + indiaux][oldposy + indiaux2] = rejamascaramovto[indiaux][indiaux2];
if (rejamascararaton[indiaux][indiaux2] > 0)
currentRoomData->mouseGrid[oldposx + indiaux][oldposy + indiaux2] = rejamascararaton[indiaux][indiaux2];
}
@@ -4306,9 +4331,9 @@ void loadGame(regispartida game) {
mask();
posicioninv = 0;
drawBackpack();
- if (rojo_capturado == false && currentRoomData->codigo == 24 && trampa_puesta == false)
+ if (rojo_capturado == false && currentRoomData->code == 24 && trampa_puesta == false)
runaroundRed();
- screenTransition(tipoefectofundido, false, background);
+ screenTransition(transitionEffect, false, sceneBackground);
}
struct indicepart {
@@ -4320,7 +4345,7 @@ void seleccionaPartida(indicepart regindfich, int numSeleccion) {
g_engine->_mouseManager->hide();
for (int i = 0; i < 6; i++) {
int color = i == numSeleccion ? 255 : 253;
- outtextxy(65, 29, regindfich.listapartidas[i], color);
+ littText(65, 29, regindfich.listapartidas[i], color);
}
g_engine->_mouseManager->show();
}
@@ -4353,13 +4378,13 @@ void saveLoad() {
}
}
salirmenufunciones = false;
- oldxraton = xraton;
- oldyraton = yraton;
+ oldxraton = mouseX;
+ oldyraton = mouseY;
g_engine->_mouseManager->hide();
tamfondmenu = imagesize(50, 10, 270, 120);
puntfondmenu = (byte *)malloc(tamfondmenu);
- getImg(50, 10, 270, 120, puntfondmenu);
+ g_engine->_graphics->getImg(50, 10, 270, 120, puntfondmenu);
for (int i = 0; i < 6; i++) {
uint textY = i + 1;
@@ -4370,23 +4395,22 @@ void saveLoad() {
bar(61, 15, 122, 23, 253);
bar(201, 15, 259, 23, 253);
}
- // setcolor(253);
- outtextxy(65, 29, regindfich.listapartidas[0], 253);
- outtextxy(65, 44, regindfich.listapartidas[1], 253);
- outtextxy(65, 59, regindfich.listapartidas[2], 253);
- outtextxy(65, 74, regindfich.listapartidas[3], 253);
- outtextxy(65, 89, regindfich.listapartidas[4], 253);
- outtextxy(65, 104, regindfich.listapartidas[5], 253);
+ littText(65, 29, regindfich.listapartidas[0], 253);
+ littText(65, 44, regindfich.listapartidas[1], 253);
+ littText(65, 59, regindfich.listapartidas[2], 253);
+ littText(65, 74, regindfich.listapartidas[3], 253);
+ littText(65, 89, regindfich.listapartidas[4], 253);
+ littText(65, 104, regindfich.listapartidas[5], 253);
if (contadorpc2 > 17)
showError(274);
- xraton = 150;
- yraton = 60;
+ mouseX = 150;
+ mouseY = 60;
// iraton = 1;
partidaselecc = 0;
modificada = false;
nombrepartida = "";
g_engine->_mouseManager->setMouseArea(Common::Rect(55, 13, 250, 105));
- g_engine->_mouseManager->setMousePos(1, xraton, yraton);
+ g_engine->_mouseManager->setMousePos(1, mouseX, mouseY);
do {
Common::Event e;
bool mouseClicked = false;
@@ -4399,14 +4423,14 @@ void saveLoad() {
while (g_system->getEventManager()->pollEvent(e)) {
if (isMouseEvent(e)) {
g_engine->_mouseManager->setMousePos(e.mouse);
- xraton = e.mouse.x;
- yraton = e.mouse.y;
+ mouseX = e.mouse.x;
+ mouseY = e.mouse.y;
}
if (e.type == Common::EVENT_LBUTTONUP || e.type == Common::EVENT_RBUTTONUP) {
mouseClicked = true;
- pulsax = e.mouse.x;
- pulsay = e.mouse.y;
+ mouseClickX = e.mouse.x;
+ mouseClickY = e.mouse.y;
} else if (e.type == Common::EVENT_KEYUP) {
keyPressed = true;
}
@@ -4417,31 +4441,31 @@ void saveLoad() {
} while (!keyPressed && !mouseClicked && !g_engine->shouldQuit());
if (mouseClicked) {
- if (pulsay >= 13 && pulsay <= 16) {
- if (pulsax >= 54 && pulsax <= 124) {
+ if (mouseClickY >= 13 && mouseClickY <= 16) {
+ if (mouseClickX >= 54 && mouseClickX <= 124) {
if (partidaselecc > 0 && !desactivagrabar && (nombrepartida != Common::String("DISPONIBLE ") + (char)(partidaselecc + 48)) && (nombrepartida != "")) {
// saveGame(partidaselecc);
fichindice.close();
- putImg(50, 10, puntfondmenu);
+ g_engine->_graphics->putImg(50, 10, puntfondmenu);
salirmenufunciones = true;
partidaselecc = 0;
} else {
- sound(100, 300);
+ g_engine->_sound->beep(100, 300);
}
- } else if (pulsax >= 130 && pulsax <= 194) {
+ } else if (mouseClickX >= 130 && mouseClickX <= 194) {
if ((partidaselecc > 0) && !((modificada))) {
if (regindfich.listapartidas[partidaselecc] != (Common::String("DISPONIBLE ") + (char)(partidaselecc + 48))) {
g_engine->_mouseManager->hide();
- putImg(50, 10, puntfondmenu);
+ g_engine->_graphics->putImg(50, 10, puntfondmenu);
free(puntfondmenu);
if (!desactivagrabar) {
freeAnimation();
freeScreenObjects();
}
// loadGame(partidaselecc);
- xraton = oldxraton;
- yraton = oldyraton;
+ mouseX = oldxraton;
+ mouseY = oldyraton;
g_engine->_mouseManager->show();
g_engine->_mouseManager->setMouseArea(Common::Rect(0, 0, 305, 185));
@@ -4449,65 +4473,65 @@ void saveLoad() {
partidaselecc = 0;
return;
} else {
- sound(100, 300);
+ g_engine->_sound->beep(100, 300);
}
} else {
- sound(100, 300);
+ g_engine->_sound->beep(100, 300);
g_engine->_mouseManager->hide();
bar(61, 31, 259, 39, 251);
- outtextxy(65, 29, regindfich.listapartidas[1], 253);
+ littText(65, 29, regindfich.listapartidas[1], 253);
bar(61, 46, 259, 54, 251);
- outtextxy(65, 44, regindfich.listapartidas[2], 253);
+ littText(65, 44, regindfich.listapartidas[2], 253);
bar(61, 61, 259, 69, 251);
- outtextxy(65, 59, regindfich.listapartidas[3], 253);
+ littText(65, 59, regindfich.listapartidas[3], 253);
bar(61, 76, 259, 84, 251);
- outtextxy(65, 74, regindfich.listapartidas[4], 253);
+ littText(65, 74, regindfich.listapartidas[4], 253);
bar(61, 91, 259, 99, 251);
- outtextxy(65, 89, regindfich.listapartidas[5], 253);
+ littText(65, 89, regindfich.listapartidas[5], 253);
bar(61, 106, 259, 114, 251);
- outtextxy(65, 104, regindfich.listapartidas[6], 253);
+ littText(65, 104, regindfich.listapartidas[6], 253);
g_engine->_mouseManager->show();
}
- } else if (pulsax >= 200 && pulsax <= 250) {
+ } else if (mouseClickX >= 200 && mouseClickX <= 250) {
if (inGame && !desactivagrabar) {
- putImg(50, 10, puntfondmenu);
+ g_engine->_graphics->putImg(50, 10, puntfondmenu);
salirmenufunciones = true;
partidaselecc = 0;
} else {
- sound(100, 300);
+ g_engine->_sound->beep(100, 300);
}
}
- } else if (pulsay >= 24 && pulsay <= 32) {
+ } else if (mouseClickY >= 24 && mouseClickY <= 32) {
partidaselecc = 0;
modificada = false;
ytext = 29;
seleccionaPartida(regindfich, 0);
nombrepartida = regindfich.listapartidas[0];
- } else if (pulsay >= 39 && pulsay <= 47) {
+ } else if (mouseClickY >= 39 && mouseClickY <= 47) {
partidaselecc = 1;
modificada = false;
ytext = 44;
seleccionaPartida(regindfich, 1);
nombrepartida = regindfich.listapartidas[1];
- } else if (pulsay >= 54 && pulsay <= 62) {
+ } else if (mouseClickY >= 54 && mouseClickY <= 62) {
partidaselecc = 2;
modificada = false;
ytext = 59;
seleccionaPartida(regindfich, 2);
nombrepartida = regindfich.listapartidas[2];
- } else if (pulsay >= 69 && pulsay <= 77) {
+ } else if (mouseClickY >= 69 && mouseClickY <= 77) {
partidaselecc = 3;
modificada = false;
ytext = 74;
seleccionaPartida(regindfich, 3);
nombrepartida = regindfich.listapartidas[3];
- } else if (pulsay >= 84 && pulsay <= 92) {
+ } else if (mouseClickY >= 84 && mouseClickY <= 92) {
partidaselecc = 4;
modificada = false;
ytext = 89;
seleccionaPartida(regindfich, 4);
nombrepartida = regindfich.listapartidas[4];
- } else if (pulsay >= 99 && pulsay <= 107) {
+ } else if (mouseClickY >= 99 && mouseClickY <= 107) {
partidaselecc = 5;
modificada = false;
ytext = 0;
@@ -4516,16 +4540,16 @@ void saveLoad() {
}
}
- if (partidaselecc > 0 && keypressed()) {
+ if (partidaselecc > 0 /*&& keypressed()*/) {
g_engine->_mouseManager->hide();
readAlphaGraphSmall(nombrepartida, 30, 65, ytext, 251, 254);
modificada = true;
g_engine->_mouseManager->show();
}
} while (!salirmenufunciones && !g_engine->shouldQuit());
- xraton = oldxraton;
- yraton = oldyraton;
- g_engine->_mouseManager->setMousePos(iraton, xraton, yraton);
+ mouseX = oldxraton;
+ mouseY = oldyraton;
+ g_engine->_mouseManager->setMousePos(mouseMaskIndex, mouseX, mouseY);
free(puntfondmenu);
g_engine->_mouseManager->setMouseArea(Common::Rect(0, 0, 305, 185));
}
@@ -4553,9 +4577,9 @@ void loadTalkAnimations() {
}
fichcani.close();
- if ((currentRoomData->nombremovto != "PETER") && (currentRoomData->nombremovto != "ARZCAEL")) {
+ if ((currentRoomData->animationName != "PETER") && (currentRoomData->animationName != "ARZCAEL")) {
iframe2 = 0;
- free(pasoanimado);
+ free(curSecondaryAnimationFrame);
bool result;
switch (regobj.habla) {
case 1:
@@ -4565,7 +4589,7 @@ void loadTalkAnimations() {
result = fichcani.open("ALFRED.SEC");
break;
default:
- result = fichcani.open(Common::Path(currentRoomData->nombremovto + Common::String(".SEC")));
+ result = fichcani.open(Common::Path(currentRoomData->animationName + Common::String(".SEC")));
}
if (!result)
@@ -4574,7 +4598,7 @@ void loadTalkAnimations() {
secondaryAnimationFrameCount = fichcani.readByte();
numerodir = fichcani.readByte();
- pasoanimado = (byte *)malloc(sizeanimado);
+ curSecondaryAnimationFrame = (byte *)malloc(sizeanimado);
if (numerodir != 0) {
secondaryAnimationFrameCount = secondaryAnimationFrameCount / 4;
for (int i = 0; i <= 3; i++) {
@@ -4601,14 +4625,14 @@ void unloadTalkAnimations() {
}
fichcani.close();
- if ((currentRoomData->nombremovto != "PETER") && (currentRoomData->nombremovto != "ARZCAEL")) {
- if (!fichcani.open(Common::Path(currentRoomData->nombremovto + ".DAT"))) {
+ if ((currentRoomData->animationName != "PETER") && (currentRoomData->animationName != "ARZCAEL")) {
+ if (!fichcani.open(Common::Path(currentRoomData->animationName + ".DAT"))) {
showError(265);
}
sizeanimado = fichcani.readUint16LE();
secondaryAnimationFrameCount = fichcani.readByte();
numerodir = fichcani.readByte();
- pasoanimado = (byte *)malloc(sizeanimado);
+ curSecondaryAnimationFrame = (byte *)malloc(sizeanimado);
if (numerodir != 0) {
secondaryAnimationFrameCount = secondaryAnimationFrameCount / 4;
@@ -4633,11 +4657,11 @@ regismht readVerbRegister() {
// the pascal string.
byte size = verb.readByte();
verb.seek(-1, SEEK_CUR);
- regmht.cadenatext = verb.readPascalString(false);
+ regmht.text = verb.readPascalString(false);
verb.skip(255 - size);
- regmht.encadenado = verb.readByte();
- regmht.respuesta = verb.readUint16LE();
- regmht.punteronil = verb.readSint32LE();
+ regmht.continued = verb.readByte();
+ regmht.response = verb.readUint16LE();
+ regmht.pointer = verb.readSint32LE();
return regmht;
}
@@ -4658,7 +4682,7 @@ void hypertext(
byte *fondotextht;
byte matrizsaltosht[15];
g_engine->_mouseManager->hide();
- switch (currentRoomData->codigo) {
+ switch (currentRoomData->code) {
case 2: { // Leisure room
xht = 10;
yht = 2;
@@ -4734,37 +4758,37 @@ void hypertext(
insertarnombre = 0;
- for (int i = 0; i < regmht.cadenatext.size(); i++) {
- regmht.cadenatext.setChar(decryptionKey[i] ^ regmht.cadenatext[i], i);
- if (regmht.cadenatext[i] == '@')
+ for (int i = 0; i < regmht.text.size(); i++) {
+ regmht.text.setChar(decryptionKey[i] ^ regmht.text[i], i);
+ if (regmht.text[i] == '@')
insertarnombre = i;
}
if (insertarnombre > 0) {
- regmht.cadenatext.deleteChar(insertarnombre);
- regmht.cadenatext.insertString(nombrepersonaje, insertarnombre);
+ regmht.text.deleteChar(insertarnombre);
+ regmht.text.insertString(characterName, insertarnombre);
}
- if (regmht.cadenatext.size() < anchoht) {
- tamfondoht = imagesize(xht - 1, yht - 1, xht + (regmht.cadenatext.size() * 8) + 2, yht + 13);
+ if (regmht.text.size() < anchoht) {
+ tamfondoht = imagesize(xht - 1, yht - 1, xht + (regmht.text.size() * 8) + 2, yht + 13);
fondotextht = (byte *)malloc(tamfondoht);
- getImg(xht - 1, yht - 1, xht + (regmht.cadenatext.size() * 8) + 2, yht + 13, fondotextht);
+ g_engine->_graphics->getImg(xht - 1, yht - 1, xht + (regmht.text.size() * 8) + 2, yht + 13, fondotextht);
- outtextxy(xht - 1, yht, regmht.cadenatext, colorsombraht);
+ littText(xht - 1, yht, regmht.text, colorsombraht);
g_engine->_screen->update();
delay(enforcedTextAnimDelay);
- outtextxy(xht + 1, yht, regmht.cadenatext, colorsombraht);
+ littText(xht + 1, yht, regmht.text, colorsombraht);
g_engine->_screen->update();
delay(enforcedTextAnimDelay);
- outtextxy(xht, yht - 1, regmht.cadenatext, colorsombraht);
+ littText(xht, yht - 1, regmht.text, colorsombraht);
g_engine->_screen->update();
delay(enforcedTextAnimDelay);
- outtextxy(xht, yht + 1, regmht.cadenatext, colorsombraht);
+ littText(xht, yht + 1, regmht.text, colorsombraht);
g_engine->_screen->update();
delay(enforcedTextAnimDelay);
- outtextxy(xht, yht, regmht.cadenatext, colortextoht);
+ littText(xht, yht, regmht.text, colortextoht);
g_engine->_screen->update();
delay(enforcedTextAnimDelay);
} else {
@@ -4779,35 +4803,35 @@ void hypertext(
iteracionesht += 1;
do {
iht -= 1;
- } while (regmht.cadenatext[iht] != ' ');
+ } while (regmht.text[iht] != ' ');
matrizsaltosht[iteracionesht] = iht + 1;
- } while (iht + 1 <= regmht.cadenatext.size() - anchoht);
+ } while (iht + 1 <= regmht.text.size() - anchoht);
iteracionesht += 1;
- matrizsaltosht[iteracionesht] = regmht.cadenatext.size();
+ matrizsaltosht[iteracionesht] = regmht.text.size();
// Grab patch of background behind where the text will be, to paste it back later
tamfondoht = imagesize(xht - 1, yht - 1, xht + (anchoht * 8) + 2, yht + iteracionesht * 13);
fondotextht = (byte *)malloc(tamfondoht);
- getImg(xht - 1, yht - 1, xht + (anchoht * 8) + 2, yht + iteracionesht * 13, fondotextht);
+ g_engine->_graphics->getImg(xht - 1, yht - 1, xht + (anchoht * 8) + 2, yht + iteracionesht * 13, fondotextht);
for (lineaht = 1; lineaht <= iteracionesht; lineaht++) {
- Common::String lineString = Common::String(regmht.cadenatext.c_str() + matrizsaltosht[lineaht - 1], regmht.cadenatext.c_str() + matrizsaltosht[lineaht]);
+ Common::String lineString = Common::String(regmht.text.c_str() + matrizsaltosht[lineaht - 1], regmht.text.c_str() + matrizsaltosht[lineaht]);
- outtextxy(xht + 1, yht + ((lineaht - 1) * 11), lineString, colorsombraht);
+ littText(xht + 1, yht + ((lineaht - 1) * 11), lineString, colorsombraht);
g_engine->_screen->update();
delay(enforcedTextAnimDelay);
- outtextxy(xht - 1, yht + ((lineaht - 1) * 11), lineString, colorsombraht);
+ littText(xht - 1, yht + ((lineaht - 1) * 11), lineString, colorsombraht);
g_engine->_screen->update();
delay(enforcedTextAnimDelay);
- outtextxy(xht, yht + ((lineaht - 1) * 11) + 1, lineString, colorsombraht);
+ littText(xht, yht + ((lineaht - 1) * 11) + 1, lineString, colorsombraht);
g_engine->_screen->update();
delay(enforcedTextAnimDelay);
- outtextxy(xht, yht + ((lineaht - 1) * 11) - 1, lineString, colorsombraht);
+ littText(xht, yht + ((lineaht - 1) * 11) - 1, lineString, colorsombraht);
g_engine->_screen->update();
delay(enforcedTextAnimDelay);
- outtextxy(xht, yht + ((lineaht - 1) * 11), lineString, colortextoht);
+ littText(xht, yht + ((lineaht - 1) * 11), lineString, colortextoht);
g_engine->_screen->update();
delay(enforcedTextAnimDelay);
}
@@ -4852,13 +4876,13 @@ void hypertext(
sprites(true);
direccionmovimiento = direccionmovimientopaso;
} else {
- if (indicetray2 >= currentRoomData->longtray2)
+ if (indicetray2 >= currentRoomData->secondaryTrajectoryLength)
indicetray2 = 1;
else
indicetray2 += 1;
- animado.posx = currentRoomData->tray2[indicetray2 - 1].x;
- animado.posy = currentRoomData->tray2[indicetray2 - 1].y;
- animado.dir = currentRoomData->dir2[indicetray2 - 1];
+ animado.posx = currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].x;
+ animado.posy = currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].y;
+ animado.dir = currentRoomData->secondaryAnimDirections[indicetray2 - 1];
if (iframe2 >= secondaryAnimationFrameCount - 1)
iframe2 = 0;
else
@@ -4872,7 +4896,7 @@ void hypertext(
movidapaleta = 0;
else
movidapaleta += 1;
- if (currentRoomData->codigo == 4 && movidapaleta == 4)
+ if (currentRoomData->code == 4 && movidapaleta == 4)
g_engine->_sound->playVoc();
updatePalette(movidapaleta);
} else
@@ -4880,20 +4904,20 @@ void hypertext(
}
g_engine->_screen->update();
g_system->delayMillis(10);
- } while (indiceaniconversa <= (regmht.cadenatext.size() * 4) && !mouseClicked && !g_engine->shouldQuit());
+ } while (indiceaniconversa <= (regmht.text.size() * 4) && !mouseClicked && !g_engine->shouldQuit());
- putImg(xht - 1, yht - 1, fondotextht);
+ g_engine->_graphics->putImg(xht - 1, yht - 1, fondotextht);
free(fondotextht);
g_system->delayMillis(10);
- } while (regmht.encadenado && !g_engine->shouldQuit());
- numresp = regmht.respuesta;
+ } while (regmht.continued && !g_engine->shouldQuit());
+ numresp = regmht.response;
g_engine->_mouseManager->show();
}
void wcScene() {
palette palwater;
- zonaactual = currentRoomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory];
+ zonaactual = currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount];
goToObject(zonaactual, zonadestino);
copyPalette(pal, palwater);
@@ -4903,37 +4927,37 @@ void wcScene() {
const char *const *messages = (g_engine->_lang == Common::ES_ESP) ? fullScreenMessages[0] : fullScreenMessages[1];
- outtextxy(10, 20, messages[45], 253);
+ littText(10, 20, messages[45], 253);
delay(1000);
bar(10, 20, 150, 30, 0);
delay(2000);
- outtextxy(100, 50, messages[46], 255);
+ littText(100, 50, messages[46], 255);
delay(1000);
bar(100, 50, 250, 60, 0);
delay(2000);
- outtextxy(30, 110, messages[47], 253);
+ littText(30, 110, messages[47], 253);
delay(1000);
bar(30, 110, 210, 120, 0);
delay(3000);
- outtextxy(50, 90, messages[48], 248);
+ littText(50, 90, messages[48], 248);
delay(1000);
g_engine->_sound->playVoc("WATER", 272050, 47062);
bar(50, 90, 200, 100, 0);
delay(4000);
- characterPosX = 76 - rectificacionx;
- characterPosY = 78 - rectificaciony;
+ characterPosX = 76 - characterCorrectionX;
+ characterPosY = 78 - characerCorrectionY;
copyPalette(palwater, pal);
- screenHandleToBackground();
+ restoreBackground();
assembleScreen();
- drawScreen(background);
+ drawScreen(sceneBackground);
partialFadeIn(234);
xframe2 = 0;
indicetray = 0;
@@ -4962,11 +4986,11 @@ void readConversationFile(Common::String f) {
}
void saveDoorMetadata(DoorRegistry doors, Common::SeekableWriteStream *screenDataStream) {
- screenDataStream->writeUint16LE(doors.pantallaquecarga);
- screenDataStream->writeUint16LE(doors.posxsalida);
- screenDataStream->writeUint16LE(doors.posysalida);
- screenDataStream->writeByte(doors.abiertacerrada);
- screenDataStream->writeByte(doors.codigopuerta);
+ screenDataStream->writeUint16LE(doors.nextScene);
+ screenDataStream->writeUint16LE(doors.exitPosX);
+ screenDataStream->writeUint16LE(doors.exitPosY);
+ screenDataStream->writeByte(doors.openclosed);
+ screenDataStream->writeByte(doors.doorcode);
}
void savePoint(Common::Point point, Common::SeekableWriteStream *screenDataStream) {
@@ -4975,16 +4999,16 @@ void savePoint(Common::Point point, Common::SeekableWriteStream *screenDataStrea
}
void saveBitmapRegister(RoomBitmapRegister bitmap, Common::SeekableWriteStream *screenDataStream) {
- screenDataStream->writeSint32LE(bitmap.puntbitmap);
- screenDataStream->writeUint16LE(bitmap.tambitmap);
+ screenDataStream->writeSint32LE(bitmap.bitmapPointer);
+ screenDataStream->writeUint16LE(bitmap.bitmapSize);
screenDataStream->writeUint16LE(bitmap.coordx);
screenDataStream->writeUint16LE(bitmap.coordy);
- screenDataStream->writeUint16LE(bitmap.profund);
+ screenDataStream->writeUint16LE(bitmap.depth);
}
void saveRoomObjectList(RoomObjectListEntry objectList, Common::SeekableWriteStream *screenDataStream) {
- screenDataStream->writeUint16LE(objectList.indicefichero);
+ screenDataStream->writeUint16LE(objectList.fileIndex);
screenDataStream->writeByte(objectList.objectName.size());
int paddingSize = 20 - objectList.objectName.size();
if (paddingSize < 20) {
@@ -5003,10 +5027,10 @@ void saveRoomObjectList(RoomObjectListEntry objectList, Common::SeekableWriteStr
}
void saveRoom(RoomFileRegister *room, Common::SeekableWriteStream *screenDataStream) {
- screenDataStream->writeUint16LE(room->codigo);
- screenDataStream->writeUint32LE(room->puntimagenpantalla);
- screenDataStream->writeUint16LE(room->tamimagenpantalla);
- screenDataStream->write(room->rejapantalla, 40 * 28);
+ screenDataStream->writeUint16LE(room->code);
+ screenDataStream->writeUint32LE(room->roomImagePointer);
+ screenDataStream->writeUint16LE(room->roomImageSize);
+ screenDataStream->write(room->walkAreasGrid, 40 * 28);
screenDataStream->write(room->mouseGrid, 40 * 28);
// read puntos
@@ -5022,16 +5046,16 @@ void saveRoom(RoomFileRegister *room, Common::SeekableWriteStream *screenDataStr
saveDoorMetadata(room->doors[i], screenDataStream);
}
for (int i = 0; i < 15; i++) {
- saveBitmapRegister(room->bitmapasociados[i], screenDataStream);
+ saveBitmapRegister(room->screenLayers[i], screenDataStream);
}
for (int i = 0; i < 51; i++) {
- saveRoomObjectList(*room->indexadoobjetos[i], screenDataStream);
+ saveRoomObjectList(*room->screenObjectIndex[i], screenDataStream);
}
screenDataStream->writeByte(room->animationFlag);
- screenDataStream->writeByte(room->nombremovto.size());
- screenDataStream->writeString(room->nombremovto);
- int paddingSize = 8 - room->nombremovto.size();
+ screenDataStream->writeByte(room->animationName.size());
+ screenDataStream->writeString(room->animationName);
+ int paddingSize = 8 - room->animationName.size();
if (paddingSize > 0) {
char *padding = (char *)malloc(paddingSize);
for (int i = 0; i < paddingSize; i++) {
@@ -5043,16 +5067,16 @@ void saveRoom(RoomFileRegister *room, Common::SeekableWriteStream *screenDataStr
free(padding);
}
screenDataStream->writeByte(room->paletteAnimationFlag);
- screenDataStream->writeUint16LE(room->puntpaleta);
+ screenDataStream->writeUint16LE(room->palettePointer);
for (int i = 0; i < 300; i++) {
- savePoint(room->tray2[i], screenDataStream);
+ savePoint(room->secondaryAnimTrajectory[i], screenDataStream);
}
- screenDataStream->write(room->dir2, 600);
- screenDataStream->writeUint16LE(room->longtray2);
+ screenDataStream->write(room->secondaryAnimDirections, 600);
+ screenDataStream->writeUint16LE(room->secondaryTrajectoryLength);
}
void saveRoomData(RoomFileRegister *room, Common::SeekableWriteStream *stream) {
- rooms->seek(room->codigo * roomRegSize, SEEK_SET);
+ rooms->seek(room->code * roomRegSize, SEEK_SET);
saveRoom(room, stream);
}
@@ -5071,13 +5095,13 @@ void initializeObjectFile() {
objFile.close();
}
-void saveItem(InvItemRegister object, Common::SeekableWriteStream *objectDataStream) {
+void saveItem(ScreenObject object, Common::SeekableWriteStream *objectDataStream) {
objectDataStream->writeUint16LE(object.code);
- objectDataStream->writeByte(object.altura);
+ objectDataStream->writeByte(object.height);
objectDataStream->writeByte(object.name.size());
objectDataStream->writeString(object.name);
- int paddingSize = longitudnombreobjeto - object.name.size();
+ int paddingSize = objectNameLength - object.name.size();
if (paddingSize > 0) {
char *padding = (char *)malloc(paddingSize);
for (int i = 0; i < paddingSize; i++) {
@@ -5095,24 +5119,24 @@ void saveItem(InvItemRegister object, Common::SeekableWriteStream *objectDataStr
objectDataStream->writeUint16LE(object.useTextRef);
objectDataStream->writeByte(object.habla);
- objectDataStream->writeByte(object.abrir);
- objectDataStream->writeByte(object.cerrar);
-
- objectDataStream->write(object.usar, 8);
-
- objectDataStream->writeByte(object.coger);
-
- objectDataStream->writeUint16LE(object.usarcon);
- objectDataStream->writeUint16LE(object.reemplazarpor);
- objectDataStream->writeByte(object.profundidad);
- objectDataStream->writeUint32LE(object.punterobitmap);
- objectDataStream->writeUint16LE(object.tambitmap);
- objectDataStream->writeUint16LE(object.punteroframesgiro);
- objectDataStream->writeUint16LE(object.punteropaletagiro);
- objectDataStream->writeUint16LE(object.xparche);
- objectDataStream->writeUint16LE(object.yparche);
- objectDataStream->writeUint32LE(object.puntparche);
- objectDataStream->writeUint16LE(object.tamparche);
+ objectDataStream->writeByte(object.openable);
+ objectDataStream->writeByte(object.closeable);
+
+ objectDataStream->write(object.used, 8);
+
+ objectDataStream->writeByte(object.pickupable);
+
+ objectDataStream->writeUint16LE(object.useWith);
+ objectDataStream->writeUint16LE(object.replaceWith);
+ objectDataStream->writeByte(object.depth);
+ objectDataStream->writeUint32LE(object.bitmapPointer);
+ objectDataStream->writeUint16LE(object.bitmapSize);
+ objectDataStream->writeUint16LE(object.rotatingObjectAnimation);
+ objectDataStream->writeUint16LE(object.rotatingObjectPalette);
+ objectDataStream->writeUint16LE(object.dropOverlayX);
+ objectDataStream->writeUint16LE(object.dropOverlayY);
+ objectDataStream->writeUint32LE(object.dropOverlay);
+ objectDataStream->writeUint16LE(object.dropOverlaySize);
objectDataStream->writeUint16LE(object.objectIconBitmap);
objectDataStream->writeByte(object.xrej1);
@@ -5120,11 +5144,11 @@ void saveItem(InvItemRegister object, Common::SeekableWriteStream *objectDataStr
objectDataStream->writeByte(object.xrej2);
objectDataStream->writeByte(object.yrej2);
- objectDataStream->write(object.parcherejapantalla, 100);
- objectDataStream->write(object.parcherejaraton, 100);
+ objectDataStream->write(object.walkAreasPatch, 100);
+ objectDataStream->write(object.mouseGridPatch, 100);
}
-void saveItemRegister(InvItemRegister object, Common::SeekableWriteStream *stream) {
+void saveItemRegister(ScreenObject object, Common::SeekableWriteStream *stream) {
invItemData->seek(object.code * itemRegSize, SEEK_SET);
saveItem(object, stream);
}
diff --git a/engines/tot/routines.h b/engines/tot/routines.h
index 58b46b277cf..6dc831dabb4 100644
--- a/engines/tot/routines.h
+++ b/engines/tot/routines.h
@@ -32,6 +32,7 @@
namespace Tot {
void drawText(uint number);
+void processingActive();
void runaroundRed();
void sprites(bool drawCharacter);
void loadScreenData(uint screenNumber);
@@ -49,7 +50,7 @@ void handleAction(byte posinv);
void loadObjects();
void obtainName(Common::String &playerName);
void loadScrollData(uint screenNumber, bool scrollder, uint poshor, int correction);
-void loadGame(regispartida game);
+void loadGame(SavedGame game);
void saveGameToRegister();
void saveLoad();
void calculateRoute(byte zona1, byte zona2, bool extraCorrection = false, bool zonavedada = false);
@@ -63,7 +64,7 @@ void updateSecondaryAnimationDepth();
void updateMainCharacterDepth();
void actionLineText(Common::String actionLine);
void initializeObjectFile();
-void saveItem(InvItemRegister object, Common::SeekableWriteStream *objectDataStream);
+void saveItem(ScreenObject object, Common::SeekableWriteStream *objectDataStream);
regismht readVerbRegister(uint numRegister);
regismht readVerbRegister();
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
index ba70b6b338c..bd5bd515b22 100644
--- a/engines/tot/routines2.cpp
+++ b/engines/tot/routines2.cpp
@@ -39,13 +39,13 @@ namespace Tot {
void loadScreenMemory() {
screenSize = 65520;
- background = (byte *)malloc(screenSize);
- screenHandle = (byte *)malloc(screenSize);
+ sceneBackground = (byte *)malloc(screenSize);
+ backgroundCopy = (byte *)malloc(screenSize);
}
void loadAnimationForDirection(Common::SeekableReadStream *stream, int direction) {
for (int j = 0; j < secondaryAnimationFrameCount; j++) {
- loadAnimationIntoBuffer(stream, animado.dib[direction][j], sizeanimado);
+ loadAnimationIntoBuffer(stream, animado.bitmap[direction][j], sizeanimado);
}
}
@@ -66,7 +66,7 @@ void loadAnimation(Common::String animacion) {
sizeanimado = fichcani.readUint16LE();
secondaryAnimationFrameCount = fichcani.readByte();
numerodir = fichcani.readByte();
- pasoanimado = (byte *)malloc(sizeanimado);
+ curSecondaryAnimationFrame = (byte *)malloc(sizeanimado);
if (numerodir != 0) {
secondaryAnimationFrameCount = secondaryAnimationFrameCount / 4;
@@ -78,13 +78,13 @@ void loadAnimation(Common::String animacion) {
}
fichcani.close();
- debug("Read all frames! longtray2=%d", currentRoomData->longtray2);
- anchoanimado = READ_LE_UINT16(animado.dib[0][1]) + 1;
- altoanimado = READ_LE_UINT16(animado.dib[0][1] + 2) + 1;
+ debug("Read all frames! longtray2=%d", currentRoomData->secondaryTrajectoryLength);
+ anchoanimado = READ_LE_UINT16(animado.bitmap[0][1]) + 1;
+ altoanimado = READ_LE_UINT16(animado.bitmap[0][1] + 2) + 1;
setRoomTrajectories(altoanimado, anchoanimado, SET_WITH_ANIM, false);
- readItemRegister(currentRoomData->dir2[299]);
+ readItemRegister(currentRoomData->secondaryAnimDirections[299]);
maxrejax = (regobj.xrej2 - regobj.xrej1 + 1);
maxrejay = (regobj.yrej2 - regobj.yrej1 + 1);
oldposx = regobj.xrej1 + 1;
@@ -100,9 +100,9 @@ void loadAnimation(Common::String animacion) {
for (int i = 0; i < maxrejax; i++)
for (int j = 0; j < maxrejay; j++) {
- rejamascaramovto[i][j] = regobj.parcherejapantalla[i][j];
- rejamascararaton[i][j] = regobj.parcherejaraton[i][j];
- rejafondomovto[i][j] = currentRoomData->rejapantalla[oldposx + i][oldposy + j];
+ rejamascaramovto[i][j] = regobj.walkAreasPatch[i][j];
+ rejamascararaton[i][j] = regobj.mouseGridPatch[i][j];
+ rejafondomovto[i][j] = currentRoomData->walkAreasGrid[oldposx + i][oldposy + j];
rejafondoraton[i][j] = currentRoomData->mouseGrid[oldposx + i][oldposy + j];
}
iframe2 = 0;
@@ -119,7 +119,7 @@ void updateAltScreen(byte otherScreenNumber) {
uint i22;
uint i11;
- byte currentScreen = currentRoomData->codigo;
+ byte currentScreen = currentRoomData->code;
setRoomTrajectories(altoanimado, anchoanimado, RESTORE);
@@ -134,54 +134,54 @@ void updateAltScreen(byte otherScreenNumber) {
case 20: {
switch (hornacina[0][hornacina[0][3]]) {
case 0: {
- currentRoomData->indexadoobjetos[9]->objectName = getObjectName(4);
- currentRoomData->bitmapasociados[1].puntbitmap = 1190768;
+ currentRoomData->screenObjectIndex[9]->objectName = getObjectName(4);
+ currentRoomData->screenLayers[1].bitmapPointer = 1190768;
} break;
case 561: {
- currentRoomData->indexadoobjetos[9]->objectName = getObjectName(5);
- currentRoomData->bitmapasociados[1].puntbitmap = 1182652;
+ currentRoomData->screenObjectIndex[9]->objectName = getObjectName(5);
+ currentRoomData->screenLayers[1].bitmapPointer = 1182652;
} break;
case 563: {
- currentRoomData->indexadoobjetos[9]->objectName = getObjectName(6);
- currentRoomData->bitmapasociados[1].puntbitmap = 1186044;
+ currentRoomData->screenObjectIndex[9]->objectName = getObjectName(6);
+ currentRoomData->screenLayers[1].bitmapPointer = 1186044;
} break;
case 615: {
- currentRoomData->indexadoobjetos[9]->objectName = getObjectName(7);
- currentRoomData->bitmapasociados[1].puntbitmap = 1181760;
+ currentRoomData->screenObjectIndex[9]->objectName = getObjectName(7);
+ currentRoomData->screenLayers[1].bitmapPointer = 1181760;
} break;
}
- currentRoomData->bitmapasociados[1].tambitmap = 892;
- currentRoomData->bitmapasociados[1].coordx = 66;
- currentRoomData->bitmapasociados[1].coordy = 35;
- currentRoomData->bitmapasociados[1].profund = 1;
+ currentRoomData->screenLayers[1].bitmapSize = 892;
+ currentRoomData->screenLayers[1].coordx = 66;
+ currentRoomData->screenLayers[1].coordy = 35;
+ currentRoomData->screenLayers[1].depth = 1;
} break;
case 24: {
switch (hornacina[1][hornacina[1][3]]) {
case 0: {
- currentRoomData->indexadoobjetos[8]->objectName = getObjectName(4);
- currentRoomData->bitmapasociados[0].puntbitmap = 1399610;
+ currentRoomData->screenObjectIndex[8]->objectName = getObjectName(4);
+ currentRoomData->screenLayers[0].bitmapPointer = 1399610;
} break;
case 561: {
- currentRoomData->indexadoobjetos[8]->objectName = getObjectName(5);
- currentRoomData->bitmapasociados[0].puntbitmap = 1381982;
+ currentRoomData->screenObjectIndex[8]->objectName = getObjectName(5);
+ currentRoomData->screenLayers[0].bitmapPointer = 1381982;
} break;
case 615: {
- currentRoomData->indexadoobjetos[8]->objectName = getObjectName(7);
- currentRoomData->bitmapasociados[0].puntbitmap = 1381090;
+ currentRoomData->screenObjectIndex[8]->objectName = getObjectName(7);
+ currentRoomData->screenLayers[0].bitmapPointer = 1381090;
} break;
case 622: {
- currentRoomData->indexadoobjetos[8]->objectName = getObjectName(8);
- currentRoomData->bitmapasociados[0].puntbitmap = 1400502;
+ currentRoomData->screenObjectIndex[8]->objectName = getObjectName(8);
+ currentRoomData->screenLayers[0].bitmapPointer = 1400502;
} break;
case 623: {
- currentRoomData->indexadoobjetos[8]->objectName = getObjectName(9);
- currentRoomData->bitmapasociados[0].puntbitmap = 1398718;
+ currentRoomData->screenObjectIndex[8]->objectName = getObjectName(9);
+ currentRoomData->screenLayers[0].bitmapPointer = 1398718;
} break;
}
- currentRoomData->bitmapasociados[0].tambitmap = 892;
- currentRoomData->bitmapasociados[0].coordx = 217;
- currentRoomData->bitmapasociados[0].coordy = 48;
- currentRoomData->bitmapasociados[0].profund = 1;
+ currentRoomData->screenLayers[0].bitmapSize = 892;
+ currentRoomData->screenLayers[0].coordx = 217;
+ currentRoomData->screenLayers[0].coordy = 48;
+ currentRoomData->screenLayers[0].depth = 1;
} break;
case 31: {
for (i11 = 23; i11 <= 25; i11++)
@@ -191,11 +191,11 @@ void updateAltScreen(byte otherScreenNumber) {
for (i22 = 10; i22 <= 11; i22++)
currentRoomData->mouseGrid[i11][i22] = 3;
- currentRoomData->bitmapasociados[0].tambitmap = 0;
- currentRoomData->bitmapasociados[0].puntbitmap = 0;
- currentRoomData->bitmapasociados[0].coordx = 0;
- currentRoomData->bitmapasociados[0].coordy = 0;
- currentRoomData->bitmapasociados[0].profund = 0;
+ currentRoomData->screenLayers[0].bitmapSize = 0;
+ currentRoomData->screenLayers[0].bitmapPointer = 0;
+ currentRoomData->screenLayers[0].coordx = 0;
+ currentRoomData->screenLayers[0].coordy = 0;
+ currentRoomData->screenLayers[0].depth = 0;
} break;
}
@@ -258,12 +258,12 @@ void cargatele() {
if (!fichct.open("PALETAS.DAT")) {
showError(310);
}
- fichct.seek(currentRoomData->puntpaleta + 603);
- fichct.read(movimientopal, 144);
+ fichct.seek(currentRoomData->palettePointer + 603);
+ fichct.read(palAnimSlice, 144);
for (int i = 0; i <= 48; i++) {
- movimientopal[i * 3 + 0] = movimientopal[i * 3 + 0] << 2;
- movimientopal[i * 3 + 1] = movimientopal[i * 3 + 1] << 2;
- movimientopal[i * 3 + 2] = movimientopal[i * 3 + 2] << 2;
+ palAnimSlice[i * 3 + 0] = palAnimSlice[i * 3 + 0] << 2;
+ palAnimSlice[i * 3 + 1] = palAnimSlice[i * 3 + 1] << 2;
+ palAnimSlice[i * 3 + 2] = palAnimSlice[i * 3 + 2] << 2;
}
fichct.close();
@@ -279,22 +279,22 @@ void loadScreen() {
Common::File fichcp;
palette palcp;
- screenSize = currentRoomData->tamimagenpantalla;
- readBitmap(currentRoomData->puntimagenpantalla, background, screenSize, 316);
- Common::copy(background, background + screenSize, screenHandle);
+ screenSize = currentRoomData->roomImageSize;
+ readBitmap(currentRoomData->roomImagePointer, sceneBackground, screenSize, 316);
+ Common::copy(sceneBackground, sceneBackground + screenSize, backgroundCopy);
switch (gamePart) {
case 1: {
if (!fichcp.open("PALETAS.DAT")) {
showError(310);
}
- fichcp.seek(currentRoomData->puntpaleta);
+ fichcp.seek(currentRoomData->palettePointer);
fichcp.read(palcp, 603);
if (currentRoomData->paletteAnimationFlag) {
- fichcp.read(movimientopal, 144);
+ fichcp.read(palAnimSlice, 144);
for (int i = 0; i <= 48; i++) {
- movimientopal[i * 3 + 0] = movimientopal[i * 3 + 0] << 2;
- movimientopal[i * 3 + 1] = movimientopal[i * 3 + 1] << 2;
- movimientopal[i * 3 + 2] = movimientopal[i * 3 + 2] << 2;
+ palAnimSlice[i * 3 + 0] = palAnimSlice[i * 3 + 0] << 2;
+ palAnimSlice[i * 3 + 1] = palAnimSlice[i * 3 + 1] << 2;
+ palAnimSlice[i * 3 + 2] = palAnimSlice[i * 3 + 2] << 2;
}
}
fichcp.close();
@@ -338,7 +338,7 @@ void loadCharAnimation() {
void freeScreenObjects() {
uint indicecarga;
- for (indicecarga = 0; indicecarga < numobjetosconv; indicecarga++) {
+ for (indicecarga = 0; indicecarga < numScreenOverlays; indicecarga++) {
if (screenObjects[indicecarga] != NULL)
free(screenObjects[indicecarga]);
screenObjects[indicecarga] = NULL;
@@ -354,9 +354,9 @@ void freeScreenObjects() {
void freeAnimation() {
if (animacion2) {
animacion2 = false;
- if(pasoanimado)
- free(pasoanimado);
- pasoanimado = NULL;
+ if(curSecondaryAnimationFrame)
+ free(curSecondaryAnimationFrame);
+ curSecondaryAnimationFrame = NULL;
}
}
@@ -439,20 +439,20 @@ void readBitmap(int32 posbm, byte *puntbm, uint tambm, uint errorbm) {
}
void updateItem(uint itemPosition) {
- regobj.usar[0] = 9;
+ regobj.used[0] = 9;
invItemData->seek(itemPosition);
saveItemRegister(regobj, invItemData);
}
-void readItemRegister(Common::SeekableReadStream *stream, uint itemPos, InvItemRegister &thisRegObj) {
+void readItemRegister(Common::SeekableReadStream *stream, uint itemPos, ScreenObject &thisRegObj) {
stream->seek(itemPos * itemRegSize);
clearObj();
thisRegObj.code = stream->readUint16LE();
- thisRegObj.altura = stream->readByte();
+ thisRegObj.height = stream->readByte();
thisRegObj.name = stream->readPascalString();
- stream->skip(longitudnombreobjeto - thisRegObj.name.size());
+ stream->skip(objectNameLength - thisRegObj.name.size());
thisRegObj.lookAtTextRef = stream->readUint16LE();
thisRegObj.beforeUseTextRef = stream->readUint16LE();
@@ -460,30 +460,30 @@ void readItemRegister(Common::SeekableReadStream *stream, uint itemPos, InvItemR
thisRegObj.pickTextRef = stream->readUint16LE();
thisRegObj.useTextRef = stream->readUint16LE();
thisRegObj.habla = stream->readByte();
- thisRegObj.abrir = stream->readByte();
- thisRegObj.cerrar = stream->readByte();
-
- stream->read(thisRegObj.usar, 8);
-
- thisRegObj.coger = stream->readByte();
- thisRegObj.usarcon = stream->readUint16LE();
- thisRegObj.reemplazarpor = stream->readUint16LE();
- thisRegObj.profundidad = stream->readByte();
- thisRegObj.punterobitmap = stream->readUint32LE();
- thisRegObj.tambitmap = stream->readUint16LE();
- thisRegObj.punteroframesgiro = stream->readUint32LE();
- thisRegObj.punteropaletagiro = stream->readUint16LE();
- thisRegObj.xparche = stream->readUint16LE();
- thisRegObj.yparche = stream->readUint16LE();
- thisRegObj.puntparche = stream->readUint32LE();
- thisRegObj.tamparche = stream->readUint16LE();
+ thisRegObj.openable = stream->readByte();
+ thisRegObj.closeable = stream->readByte();
+
+ stream->read(thisRegObj.used, 8);
+
+ thisRegObj.pickupable = stream->readByte();
+ thisRegObj.useWith = stream->readUint16LE();
+ thisRegObj.replaceWith = stream->readUint16LE();
+ thisRegObj.depth = stream->readByte();
+ thisRegObj.bitmapPointer = stream->readUint32LE();
+ thisRegObj.bitmapSize = stream->readUint16LE();
+ thisRegObj.rotatingObjectAnimation = stream->readUint32LE();
+ thisRegObj.rotatingObjectPalette = stream->readUint16LE();
+ thisRegObj.dropOverlayX = stream->readUint16LE();
+ thisRegObj.dropOverlayY = stream->readUint16LE();
+ thisRegObj.dropOverlay = stream->readUint32LE();
+ thisRegObj.dropOverlaySize = stream->readUint16LE();
thisRegObj.objectIconBitmap = stream->readUint16LE();
thisRegObj.xrej1 = stream->readByte();
thisRegObj.yrej1 = stream->readByte();
thisRegObj.xrej2 = stream->readByte();
thisRegObj.yrej2 = stream->readByte();
- stream->read(thisRegObj.parcherejapantalla, 100);
- stream->read(thisRegObj.parcherejaraton, 100);
+ stream->read(thisRegObj.walkAreasPatch, 100);
+ stream->read(thisRegObj.mouseGridPatch, 100);
}
void readItemRegister(uint itemPosition) {
@@ -499,7 +499,7 @@ void drawLookAtItem(RoomObjectListEntry obj) {
void putIcon(uint posiconx, uint posicony, uint numicon) {
// substract 1 to account for 1-based indices
- putImg(posiconx, posicony, mochilaxms[mobj[numicon].bitmapIndex - 1]);
+ g_engine->_graphics->putImg(posiconx, posicony, mochilaxms[mobj[numicon].bitmapIndex - 1]);
}
void drawBackpack() {
@@ -641,7 +641,7 @@ void drawMenu(byte nummenu) {
punteromenu = (byte *)malloc(tampunteromenu);
menuFile.seek(posicionmenu);
menuFile.read(punteromenu, tampunteromenu);
- putImg(xmenu, ymenu, punteromenu);
+ g_engine->_graphics->putImg(xmenu, ymenu, punteromenu);
free(punteromenu);
menuFile.close();
}
@@ -680,7 +680,7 @@ static void loadDiploma(Common::String &nombrefoto, Common::String &clave) {
fich.read(pal, 768);
fich.read(pantalla, size);
fich.close();
- putShape(10, 20, pantalla);
+ g_engine->_graphics->putShape(10, 20, pantalla);
free(pantalla);
}
for (int i = 16; i <= 255; i++) {
@@ -702,29 +702,29 @@ static void loadDiploma(Common::String &nombrefoto, Common::String &clave) {
clave.append(passArray, passArray + 10);
const char *const *messages = (g_engine->_lang == Common::ES_ESP) ? fullScreenMessages[0] : fullScreenMessages[1];
- outtextxyBios(91, 16, messages[49] + clave, 255);
- outtextxyBios(90, 15, messages[49] + clave, 13);
+ biosText(91, 16, messages[49] + clave, 255);
+ biosText(90, 15, messages[49] + clave, 13);
- outtextxyBios(81, 61, messages[50], 0);
- outtextxyBios(61, 81, messages[51], 0);
- outtextxyBios(31, 101, messages[52] + nombrepersonaje, 0);
- outtextxyBios(31, 121, messages[53], 0);
- outtextxyBios(31, 141, messages[54], 0);
- outtextxyBios(31, 161, messages[55], 0);
+ biosText(81, 61, messages[50], 0);
+ biosText(61, 81, messages[51], 0);
+ biosText(31, 101, messages[52] + characterName, 0);
+ biosText(31, 121, messages[53], 0);
+ biosText(31, 141, messages[54], 0);
+ biosText(31, 161, messages[55], 0);
- outtextxyBios(80, 60, messages[50], 15);
- outtextxyBios(60, 80, messages[51], 15);
- outtextxyBios(30, 100, messages[52], 15);
+ biosText(80, 60, messages[50], 15);
+ biosText(60, 80, messages[51], 15);
+ biosText(30, 100, messages[52], 15);
- outtextxyBios(150, 100, nombrepersonaje, 13);
+ biosText(150, 100, characterName, 13);
- outtextxyBios(30, 120, messages[53], 15);
- outtextxyBios(30, 140, messages[54], 15);
- outtextxyBios(30, 160, messages[55], 15);
+ biosText(30, 120, messages[53], 15);
+ biosText(30, 140, messages[54], 15);
+ biosText(30, 160, messages[55], 15);
delay(1500);
g_engine->_sound->playVoc("PORTAZO", 434988, 932);
// putShape(270, 161, (byte *)sello);
- putShape(270, 159, sello);
+ g_engine->_graphics->putShape(270, 159, sello);
free(sello);
}
@@ -791,39 +791,39 @@ void checkMouseGrid() {
Common::String objmochila;
if (contadorpc2 > 120)
showError(274);
- if (yraton >= 0 && yraton <= 131) {
- xrejilla = (xraton + 7) / factorx;
- yrejilla = (yraton + 7) / factory;
+ if (mouseY >= 0 && mouseY <= 131) {
+ xrejilla = (mouseX + 7) / xGridCount;
+ yrejilla = (mouseY + 7) / yGridCount;
if (currentRoomData->mouseGrid[xrejilla][yrejilla] != currentRoomData->mouseGrid[oldxrejilla][oldyrejilla] || oldobjmochila != "") {
bar(0, 140, 319, 149, 0);
Common::String actionLine;
switch (numeroaccion) {
case 0:
- actionLine = getActionLineText(0) + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
+ actionLine = getActionLineText(0) + currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
break;
case 1:
- actionLine = getActionLineText(1) + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
+ actionLine = getActionLineText(1) + currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
break;
case 2:
- actionLine = getActionLineText(2) + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
+ actionLine = getActionLineText(2) + currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
break;
case 3:
- actionLine = getActionLineText(3) + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
+ actionLine = getActionLineText(3) + currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
break;
case 4:
if (objetomochila != "")
- actionLine = getActionLineText(4) + objetomochila + getActionLineText(7) + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
+ actionLine = getActionLineText(4) + objetomochila + getActionLineText(7) + currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
else
- actionLine = getActionLineText(4) + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
+ actionLine = getActionLineText(4) + currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
break;
case 5:
- actionLine = getActionLineText(5) + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
+ actionLine = getActionLineText(5) + currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
break;
case 6:
- actionLine = getActionLineText(6) + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
+ actionLine = getActionLineText(6) + currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
break;
default:
- actionLine = getActionLineText(0) + currentRoomData->indexadoobjetos[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
+ actionLine = getActionLineText(0) + currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
}
actionLineText(actionLine);
g_engine->_mouseManager->show();
@@ -832,7 +832,7 @@ void checkMouseGrid() {
}
oldnumeroacc = 253;
oldobjmochila = "";
- } else if (yraton >= 132 && yraton <= 165) {
+ } else if (mouseY >= 132 && mouseY <= 165) {
if (numeroaccion != oldnumeroacc) {
bar(0, 140, 319, 149, 0);
Common::String actionLine;
@@ -869,18 +869,18 @@ void checkMouseGrid() {
oldxrejilla = 0;
oldyrejilla = 0;
}
- } else if (yraton >= 166 && yraton <= 199) {
- if (xraton >= 26 && xraton <= 65) {
+ } else if (mouseY >= 166 && mouseY <= 199) {
+ if (mouseX >= 26 && mouseX <= 65) {
objmochila = mobj[posicioninv].objectName;
- } else if (xraton >= 70 && xraton <= 108) {
+ } else if (mouseX >= 70 && mouseX <= 108) {
objmochila = mobj[posicioninv + 1].objectName;
- } else if (xraton >= 113 && xraton <= 151) {
+ } else if (mouseX >= 113 && mouseX <= 151) {
objmochila = mobj[posicioninv + 2].objectName;
- } else if (xraton >= 156 && xraton <= 194) {
+ } else if (mouseX >= 156 && mouseX <= 194) {
objmochila = mobj[posicioninv + 3].objectName;
- } else if (xraton >= 199 && xraton <= 237) {
+ } else if (mouseX >= 199 && mouseX <= 237) {
objmochila = mobj[posicioninv + 4].objectName;
- } else if (xraton >= 242 && xraton <= 280) {
+ } else if (mouseX >= 242 && mouseX <= 280) {
objmochila = mobj[posicioninv + 5].objectName;
} else {
objmochila = ' ';
@@ -912,7 +912,7 @@ void checkMouseGrid() {
actionLine = getActionLineText(6) + objmochila;
break;
default:
- outtextxy(160, 144, objmochila, 255, true, Graphics::kTextAlignCenter);
+ euroText(160, 144, objmochila, 255, Graphics::kTextAlignCenter);
}
actionLineText(actionLine);
g_engine->_mouseManager->show();
@@ -928,7 +928,7 @@ void readAlphaGraph(Common::String &dato, int long_, int posx, int posy, byte co
int pun = 1;
bar(posx, posy - 2, posx + long_ * 8, posy + 8, colorbarra);
- outtextxyBios(posx, posy, "_", 0);
+ biosText(posx, posy, "_", 0);
Common::Event e;
bool done = false;
@@ -947,26 +947,26 @@ void readAlphaGraph(Common::String &dato, int long_, int posx, int posy, byte co
}
// Max 8 chars
if (pun > long_ && asciiCode != 8) {
- sound(750, 60);
+ g_engine->_sound->beep(750, 60);
bar((posx + (dato.size()) * 8), (posy - 2), (posx + (dato.size() + 1) * 8), (posy + 8), 0);
} else if (asciiCode == 8 && pun > 1) { // delete
dato = dato.substr(0, dato.size() - 1);
bar(posx, (posy - 2), (posx + long_ * 8), (posy + 8), colorbarra);
- outtextxyBios(posx, posy, dato.c_str(), 0);
- outtextxyBios((posx + (dato.size()) * 8), posy, "_", 0);
+ biosText(posx, posy, dato.c_str(), 0);
+ biosText((posx + (dato.size()) * 8), posy, "_", 0);
pun -= 1;
} else if (
(asciiCode < 97 || asciiCode > 122) &&
(asciiCode < 65 || asciiCode > 90) &&
(asciiCode < 32 || asciiCode > 57) &&
(asciiCode < 164 || asciiCode > 165)) {
- sound(1200, 60);
+ g_engine->_sound->beep(1200, 60);
} else {
pun += 1;
dato = dato + (char)e.kbd.ascii;
bar(posx, (posy - 2), (posx + long_ * 8), (posy + 8), colorbarra);
- outtextxyBios(posx, posy, dato.c_str(), 0);
- outtextxyBios((posx + (dato.size()) * 8), posy, "_", 0);
+ biosText(posx, posy, dato.c_str(), 0);
+ biosText((posx + (dato.size()) * 8), posy, "_", 0);
}
}
}
@@ -981,7 +981,7 @@ void readAlphaGraphSmall(Common::String &dato, int long_, int posx, int posy, by
bool borracursor;
bar(posx, posy + 2, posx + long_ * 6, posy + 9, colorbarra);
- outtextxyBios(posx, posy, "-", colortexto);
+ biosText(posx, posy, "-", colortexto);
Common::Event e;
bool done = false;
@@ -999,24 +999,24 @@ void readAlphaGraphSmall(Common::String &dato, int long_, int posx, int posy, by
}
if (pun > long_ && asciiCode != 8) {
- sound(750, 60);
+ g_engine->_sound->beep(750, 60);
bar((posx + (dato.size()) * 6), (posy + 2), (posx + (dato.size() + 1) * 6), (posy + 9), colorbarra);
} else if (asciiCode == 8 && pun > 1) {
dato = dato.substr(0, dato.size() - 1);
bar(posx, (posy + 2), (posx + long_ * 6), (posy + 9), colorbarra);
- outtextxyBios(posx, posy, dato, colortexto);
- outtextxyBios((posx + (dato.size()) * 6), posy, "-", colortexto);
+ biosText(posx, posy, dato, colortexto);
+ biosText((posx + (dato.size()) * 6), posy, "-", colortexto);
pun -= 1;
borracursor = true;
} else if ((asciiCode < '\40') || (asciiCode > '\373')) {
- sound(1200, 60);
+ g_engine->_sound->beep(1200, 60);
borracursor = false;
} else {
pun += 1;
dato = dato + (char)e.kbd.ascii;
bar(posx, (posy + 2), (posx + long_ * 6), (posy + 9), colorbarra);
- outtextxy(posx, posy, dato, colortexto);
- outtextxy((posx + (dato.size()) * 6), posy, "-", colortexto);
+ littText(posx, posy, dato, colortexto);
+ littText((posx + (dato.size()) * 6), posy, "-", colortexto);
borracursor = true;
}
// car = readkey();
@@ -1044,10 +1044,10 @@ void hipercadena(
byte matrizsaltoshc[10];
if (cadenatextnueva.size() < anchohc) {
- outtextxy((xhcnueva + 1), (yhcnueva + 1), cadenatextnueva, colorsombrahc, true);
+ euroText((xhcnueva + 1), (yhcnueva + 1), cadenatextnueva, colorsombrahc);
g_engine->_screen->update();
delay(enforcedTextAnimDelay);
- outtextxy(xhcnueva, yhcnueva, cadenatextnueva, colortextohc, true);
+ euroText(xhcnueva, yhcnueva, cadenatextnueva, colortextohc);
g_engine->_screen->update();
delay(enforcedTextAnimDelay);
} else {
@@ -1068,10 +1068,10 @@ void hipercadena(
for (lineahc = 1; lineahc <= iteracioneshc; lineahc++) {
Common::String lineString = cadenatextnueva.substr(matrizsaltoshc[lineahc - 1], matrizsaltoshc[lineahc] - matrizsaltoshc[lineahc - 1]);
- outtextxy((xhcnueva + 1), (yhcnueva + ((lineahc - 1) * 11) + 1), lineString, colorsombrahc, true);
+ euroText((xhcnueva + 1), (yhcnueva + ((lineahc - 1) * 11) + 1), lineString, colorsombrahc);
g_engine->_screen->update();
delay(enforcedTextAnimDelay);
- outtextxy(xhcnueva, (yhcnueva + ((lineahc - 1) * 11)), lineString, colortextohc, true);
+ euroText(xhcnueva, (yhcnueva + ((lineahc - 1) * 11)), lineString, colortextohc);
g_engine->_screen->update();
delay(enforcedTextAnimDelay);
}
@@ -1445,7 +1445,7 @@ void drawCreditsScreen(byte *&fondopp, uint &sizefondo2, byte *&fondo2) {
// Screen is now fondopp so fondo2 contains a 320x60 crop of fondopp
fondo2 = (byte *)malloc(sizefondo2);
- getImg(0, 0, 319, 59, fondo2);
+ g_engine->_graphics->getImg(0, 0, 319, 59, fondo2);
for (int i = 0; i <= 255; i++) {
palnegro[i * 3 + 0] = 0;
@@ -1563,7 +1563,7 @@ void scrollCredit(
showError(270);
}
fich.seek(posicion);
- fich.read(background, tam);
+ fich.read(sceneBackground, tam);
fich.read(pal2, 768);
fich.close();
@@ -1589,7 +1589,7 @@ void scrollCredit(
keyPressed = true;
}
}
- putCreditsImg(85, i, background, fondopp, !withFade);
+ putCreditsImg(85, i, sceneBackground, fondopp, !withFade);
if (keyPressed) {
salirpitando = true;
break;
@@ -1675,7 +1675,7 @@ void credits() {
g_engine->_mouseManager->hide();
totalFadeOut(0);
g_engine->_sound->fadeOutMusic(musicVolLeft, musicVolRight);
- cleardevice();
+ g_engine->_screen->clear();
g_engine->_sound->playMidi("CREDITOS", true);
g_engine->_sound->fadeInMusic(musicVolLeft, musicVolRight);
drawCreditsScreen(fondopp, sizefondo2, fondo2);
@@ -1708,7 +1708,7 @@ void credits() {
removeTitle(fondo2);
if (keyPressed() || salirpitando)
goto Lsalida;
- putImg(0, 0, fondo2);
+ g_engine->_graphics->putImg(0, 0, fondo2);
if (keyPressed() || salirpitando)
goto Lsalida;
copyFromScreen(fondopp);
@@ -1738,7 +1738,7 @@ void credits() {
removeTitle(fondo2);
if (keyPressed() || salirpitando)
goto Lsalida;
- putImg(0, 0, fondo2);
+ g_engine->_graphics->putImg(0, 0, fondo2);
if (keyPressed() || salirpitando)
goto Lsalida;
copyFromScreen(fondopp);
@@ -1749,7 +1749,7 @@ Lsalida:
delay(1000);
totalFadeOut(0);
g_engine->_sound->fadeOutMusic(musicVolLeft, musicVolRight);
- cleardevice();
+ g_engine->_screen->clear();
g_engine->_sound->playMidi("INTRODUC", true);
g_engine->_sound->fadeInMusic(musicVolLeft, musicVolRight);
g_engine->_mouseManager->show();
@@ -1770,7 +1770,7 @@ void introduction() {
if (contadorpc > 6)
showError(270);
- cleardevice();
+ g_engine->_screen->clear();
drawFlc(136, 53, offsets[2], 136, 9, 1, true, true, false, pulsada_salida);
if (pulsada_salida)
goto Lsalirpres;
@@ -1778,25 +1778,25 @@ void introduction() {
if (pulsada_salida)
goto Lsalirpres;
totalFadeOut(0);
- cleardevice();
+ g_engine->_screen->clear();
if(isSpanish) {
- outtextxy(25, 20, messages[0], 253);
- outtextxy(25, 35, messages[1], 253);
- outtextxy(25, 50, messages[2], 253);
- outtextxy(25, 65, messages[3], 253);
- outtextxy(25, 80, messages[4], 253);
- outtextxy(25, 95, messages[5], 253);
- outtextxy(25, 120, messages[6], 253);
- outtextxy(25, 140, messages[7], 253);
- outtextxy(25, 155, messages[8], 253);
+ littText(25, 20, messages[0], 253);
+ littText(25, 35, messages[1], 253);
+ littText(25, 50, messages[2], 253);
+ littText(25, 65, messages[3], 253);
+ littText(25, 80, messages[4], 253);
+ littText(25, 95, messages[5], 253);
+ littText(25, 120, messages[6], 253);
+ littText(25, 140, messages[7], 253);
+ littText(25, 155, messages[8], 253);
}
else {
- outtextxy(25, 35, messages[0], 253);
- outtextxy(25, 55, messages[1], 253);
- outtextxy(25, 75, messages[2], 253);
- outtextxy(25, 95, messages[3], 253);
- outtextxy(25, 115, messages[4], 253);
- outtextxy(25, 135, messages[5], 253);
+ littText(25, 35, messages[0], 253);
+ littText(25, 55, messages[1], 253);
+ littText(25, 75, messages[2], 253);
+ littText(25, 95, messages[3], 253);
+ littText(25, 115, messages[4], 253);
+ littText(25, 135, messages[5], 253);
}
if(g_engine->shouldQuit()){
return;
@@ -1821,7 +1821,7 @@ void introduction() {
} while (contadorvueltas < 180 && !g_engine->shouldQuit());
totalFadeOut(0);
- cleardevice();
+ g_engine->_screen->clear();
drawFlc(0, 0, offsets[4], 0, 9, 3, true, true, false, pulsada_salida);
if (pulsada_salida)
goto Lsalirpres;
@@ -1883,7 +1883,7 @@ void introduction() {
Lsalirpres:
debug("Exiting intro!");
totalFadeOut(0);
- cleardevice();
+ g_engine->_screen->clear();
g_engine->_mouseManager->show();
}
@@ -1916,10 +1916,10 @@ void initialMenu(bool fundido) {
drawFlc(0, 0, offset, 0, 9, 0, false, false, false, kklogica);
if (contadorpc2 > 10)
showError(274);
- xraton = 160;
- yraton = 95;
- iraton = 1;
- g_engine->_mouseManager->setMousePos(iraton, xraton, yraton);
+ mouseX = 160;
+ mouseY = 95;
+ mouseMaskIndex = 1;
+ g_engine->_mouseManager->setMousePos(mouseMaskIndex, mouseX, mouseY);
Common::Event e;
do {
g_engine->_chrono->updateChrono();
@@ -1948,7 +1948,7 @@ void initialMenu(bool fundido) {
} else if (y > 140 && y < 155) {
if (x > 173 && x < 292) {
totalFadeOut(0);
- cleardevice();
+ g_engine->_screen->clear();
introduction();
drawFlc(0, 0, offset, 0, 9, 0, true, false, false, kklogica);
} else if (x >= 18 && x <= 145) {
@@ -1973,136 +1973,8 @@ void initialMenu(bool fundido) {
} while (!opcionvalida && !g_engine->shouldQuit());
}
-void saveTemporaryGame() {
- // uint indiaux;
- // byte zonasitio, i1, i2;
-
- // assign(partida, "GAME07.SAV");
- // rewrite(partida);
- // regpartida.indicetray = indicetray;
- // zonasitio = roomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory];
- // if (zonasitio > 9) {
- // do {
- // indicetray -= 1;
- // characterPosX = trayec[indicetray].x;
- // characterPosY = trayec[indicetray].y;
- // zonasitio = roomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory];
- // } while (!((indicetray == 1) || (zonasitio < 10)));
- // }
- // if (zonasitio < 10) {
- // regpartida.xframe = characterPosX;
- // regpartida.yframe = characterPosY;
- // } else {
- // indicetray = regpartida.indicetray;
- // do {
- // indicetray += 1;
- // characterPosX = trayec[indicetray].x;
- // characterPosY = trayec[indicetray].y;
- // zonasitio = roomData->rejapantalla[(characterPosX + rectificacionx) / factorx][(characterPosY + rectificaciony) / factory];
- // } while (!((zonasitio < 10) || (indicetray == longtray)));
- // if (zonasitio < 10) {
- // regpartida.xframe = characterPosX;
- // regpartida.yframe = characterPosY;
- // } else
- // error("saveTemporaryGame(): error saving! (275)");
- // }
- // regpartida.numeropantalla = roomData->codigo;
- // regpartida.longtray = longtray;
- // regpartida.indicetray = indicetray;
- // regpartida.codigoobjmochila = codigoobjmochila;
- // regpartida.volumenfxderecho = volumenfxderecho;
- // regpartida.volumenfxizquierdo = volumenfxizquierdo;
- // regpartida.volumenmelodiaderecho = volumenmelodiaderecho;
- // regpartida.volumenmelodiaizquierdo = volumenmelodiaizquierdo;
- // regpartida.oldxrejilla = oldxrejilla;
- // regpartida.oldyrejilla = oldyrejilla;
- // regpartida.animadoprofundidad = animado.profundidad;
- // regpartida.animadodir = animado.dir;
- // regpartida.animadoposx = animado.posx;
- // regpartida.animadoposy = animado.posy;
- // regpartida.animadoiframe2 = iframe2;
- // regpartida.zonaactual = zonaactual;
- // regpartida.zonadestino = zonadestino;
- // regpartida.oldzonadestino = oldzonadestino;
- // regpartida.posicioninv = posicioninv;
- // regpartida.numeroaccion = numeroaccion;
- // regpartida.oldnumeroacc = oldnumeroacc;
- // regpartida.pasos = pasos;
- // regpartida.indicepuertas = indicepuertas;
- // regpartida.direccionmovimiento = direccionmovimiento;
- // regpartida.iframe = iframe;
- // regpartida.parte_del_juego = parte_del_juego;
- // regpartida.manual_torno = manual_torno;
- // regpartida.sello_quitado = sello_quitado;
- // regpartida.lista1 = lista1;
- // regpartida.lista2 = lista2;
- // regpartida.completadalista1 = completadalista1;
- // regpartida.completadalista2 = completadalista2;
- // regpartida.vasijapuesta = vasijapuesta;
- // regpartida.guadagna = guadagna;
- // regpartida.tridente = tridente;
- // regpartida.torno = torno;
- // regpartida.barro = barro;
- // regpartida.diablillo_verde = diablillo_verde;
- // regpartida.rojo_capturado = rojo_capturado;
- // regpartida.alacena_abierta = alacena_abierta;
- // regpartida.baul_abierto = baul_abierto;
- // regpartida.teleencendida = teleencendida;
- // regpartida.trampa_puesta = trampa_puesta;
- // for (indiaux = 0; indiaux < inventoryIconCount; indiaux++) {
- // regpartida.mobj[indiaux].bitmapIndex = mobj[indiaux].bitmapIndex;
- // regpartida.mobj[indiaux].code = mobj[indiaux].code;
- // regpartida.mobj[indiaux].objectName = mobj[indiaux].objectName;
- // }
- // regpartida.elemento1 = elemento1;
- // regpartida.elemento2 = elemento2;
- // regpartida.xframe = characterPosX;
- // regpartida.yframe = characterPosY;
- // regpartida.xframe2 = xframe2;
- // regpartida.yframe2 = yframe2;
- // regpartida.oldobjmochila = oldobjmochila;
- // regpartida.objetomochila = objetomochila;
- // regpartida.nombrepersonaje = nombrepersonaje;
- // for(int i = 0; i < routePointCount; i++) {
- // regpartida.mainRoute[i].x = mainRoute[i].x;
- // regpartida.mainRoute[i].y = mainRoute[i].y;
- // }
- // for (indiaux = 0; indiaux < 300; indiaux++) {
- // regpartida.trayec[indiaux].x = trayec[indiaux].x;
- // regpartida.trayec[indiaux].y = trayec[indiaux].y;
- // }
- // for (indiaux = 0; indiaux < maxpersonajes; indiaux++) {
- // regpartida.primera[indiaux] = primera[indiaux];
- // regpartida.lprimera[indiaux] = lprimera[indiaux];
- // regpartida.cprimera[indiaux] = cprimera[indiaux];
- // regpartida.libro[indiaux] = libro[indiaux];
- // regpartida.caramelos[indiaux] = caramelos[indiaux];
- // }
-
- // for (indiaux = 0; indiaux < 5; indiaux++) {
- // regpartida.cavernas[indiaux] = cavernas[indiaux];
- // regpartida.firstList[indiaux] = firstList[indiaux];
- // regpartida.secondList[indiaux] = secondList[indiaux];
- // }
- // for (indiaux = 0; indiaux < 4; indiaux++) {
- // regpartida.hornacina[0][indiaux] = hornacina[0][indiaux];
- // regpartida.hornacina[1][indiaux] = hornacina[1][indiaux];
- // }
- // partida << regpartida;
- // close(partida);
- // setRoomTrajectories(altoanimado, anchoanimado, true);
-
- // // assign(fichpanta, "PANTALLA.DAT");
- // // /*$I-*/ reset(fichpanta); /*$I+*/
- // // if (ioresult != 0)
- // // error("saveTemporaryGame(): error saving ioresult! (320)");
- // // seek(fichpanta, ((datospantalla.codigo * 8) + 7));
- // // fichpanta << datospantalla;
- // // close(fichpanta);
-}
-
void exitGame() {
- clear();
+ g_engine->_graphics->clear();
g_system->quit();
}
@@ -2120,21 +1992,21 @@ void exitToDOS() {
// textsettingstype oldstyle;
char chpasosalida;
- oldxraton = xraton;
- oldyraton = yraton;
- oldiraton = iraton;
+ oldxraton = mouseX;
+ oldyraton = mouseY;
+ oldiraton = mouseMaskIndex;
g_engine->_mouseManager->hide();
tamfondcontroles = imagesize(58, 48, 262, 120);
byte *puntfondcontroles = (byte *)malloc(tamfondcontroles);
- getImg(58, 48, 262, 120, puntfondcontroles);
+ g_engine->_graphics->getImg(58, 48, 262, 120, puntfondcontroles);
drawMenu(7);
- xraton = 160;
- yraton = 90;
- iraton = 1;
+ mouseX = 160;
+ mouseY = 90;
+ mouseMaskIndex = 1;
g_engine->_mouseManager->setMouseArea(Common::Rect(115, 80, 190, 100));
- g_engine->_mouseManager->setMousePos(iraton, xraton, yraton);
+ g_engine->_mouseManager->setMousePos(mouseMaskIndex, mouseX, mouseY);
Common::Event e;
const char hotKeyYes = hotKeyFor(YES);
const char hotKeyNo = hotKeyFor(NO);
@@ -2173,10 +2045,10 @@ void exitToDOS() {
g_engine->_screen->update();
} while (chpasosalida != '\33' && !g_engine->shouldQuit());
debug("finished exitToDos");
- putImg(58, 48, puntfondcontroles);
- xraton = oldxraton;
- yraton = oldyraton;
- iraton = oldiraton;
+ g_engine->_graphics->putImg(58, 48, puntfondcontroles);
+ mouseX = oldxraton;
+ mouseY = oldyraton;
+ mouseMaskIndex = oldiraton;
g_engine->_mouseManager->show();
free(puntfondcontroles);
g_engine->_mouseManager->setMouseArea(Common::Rect(0, 0, 305, 185));
@@ -2197,18 +2069,18 @@ void soundControls() {
bool salirmenucontroles;
salirmenucontroles = false;
- oldxraton = xraton;
- oldyraton = yraton;
- oldiraton = iraton;
+ oldxraton = mouseX;
+ oldyraton = mouseY;
+ oldiraton = mouseMaskIndex;
g_engine->_mouseManager->hide();
tamfondcontroles = imagesize(50, 10, 270, 120);
byte *puntfondcontroles = (byte *)malloc(tamfondcontroles);
- getImg(50, 10, 270, 120, puntfondcontroles);
+ g_engine->_graphics->getImg(50, 10, 270, 120, puntfondcontroles);
- xraton = 150;
- yraton = 60;
- iraton = 1;
+ mouseX = 150;
+ mouseY = 60;
+ mouseMaskIndex = 1;
g_engine->_mouseManager->setMouseArea(Common::Rect(55, 13, 250, 105));
@@ -2221,22 +2093,22 @@ void soundControls() {
sliderSize = imagesize(86, 31, 94, 44);
byte *slider = (byte *)malloc(sliderSize);
- getImg(86, 31, 94, 44, slider);
+ g_engine->_graphics->getImg(86, 31, 94, 44, slider);
drawMenu(3);
sliderBgSize = imagesize(86, 31, 234, 44);
byte *sliderBackground1 = (byte *)malloc(sliderBgSize);
byte *sliderBackground2 = (byte *)malloc(sliderBgSize);
- getImg(86, 31, 234, 44, sliderBackground1);
- getImg(86, 76, 234, 89, sliderBackground2);
+ g_engine->_graphics->getImg(86, 31, 234, 44, sliderBackground1);
+ g_engine->_graphics->getImg(86, 76, 234, 89, sliderBackground2);
volumenfx = round(((rightSfxVol + leftSfxVol) / 2) * 20);
volumenmelodia = round(((musicVolRight + musicVolLeft) / 2) * 20);
- putImg(volumenfx + 86, 31, slider);
- putImg(volumenmelodia + 86, 76, slider);
+ g_engine->_graphics->putImg(volumenfx + 86, 31, slider);
+ g_engine->_graphics->putImg(volumenmelodia + 86, 76, slider);
- g_engine->_mouseManager->setMousePos(1, xraton, yraton);
+ g_engine->_mouseManager->setMousePos(1, mouseX, mouseY);
bool keyPressed = false;
bool mouseClicked = false;
Common::Event e;
@@ -2251,8 +2123,8 @@ void soundControls() {
}
if (e.type == Common::EVENT_LBUTTONDOWN) {
mouseClicked = true;
- pulsax = e.mouse.x;
- pulsay = e.mouse.y;
+ mouseClickX = e.mouse.x;
+ mouseClickY = e.mouse.y;
}
}
g_engine->_screen->update();
@@ -2264,7 +2136,7 @@ void soundControls() {
salirmenucontroles = true;
}
if (mouseClicked) {
- if (pulsay >= 22 && pulsay <= 37) {
+ if (mouseClickY >= 22 && mouseClickY <= 37) {
g_engine->_mouseManager->hide();
xfade = 86 + volumenfx;
bool mouseReleased = false;
@@ -2285,8 +2157,8 @@ void soundControls() {
}
if (oldxfade != xfade) {
- putImg(86, 31, sliderBackground1);
- putImg(xfade, 31, slider);
+ g_engine->_graphics->putImg(86, 31, sliderBackground1);
+ g_engine->_graphics->putImg(xfade, 31, slider);
// This yields a volume between 0 and 140
volumenfx = xfade - 86;
@@ -2299,7 +2171,7 @@ void soundControls() {
} while (!mouseReleased);
g_engine->_mouseManager->show();
- } else if (pulsay >= 67 && pulsay <= 82) {
+ } else if (mouseClickY >= 67 && mouseClickY <= 82) {
g_engine->_mouseManager->hide();
xfade = 86 + volumenmelodia;
bool mouseReleased = false;
@@ -2318,8 +2190,8 @@ void soundControls() {
}
if (oldxfade != xfade) {
- putImg(86, 76, sliderBackground2);
- putImg(xfade, 76, slider);
+ g_engine->_graphics->putImg(86, 76, sliderBackground2);
+ g_engine->_graphics->putImg(xfade, 76, slider);
volumenmelodia = xfade - 86;
musicVolRight = round((float)(volumenmelodia) / 20);
musicVolLeft = round((float)(volumenmelodia) / 20);
@@ -2329,7 +2201,7 @@ void soundControls() {
} while (!mouseReleased);
g_engine->_mouseManager->show();
- } else if (pulsay >= 97 && pulsay <= 107) {
+ } else if (mouseClickY >= 97 && mouseClickY <= 107) {
salirmenucontroles = true;
}
mouseClicked = false;
@@ -2338,11 +2210,11 @@ void soundControls() {
g_engine->_screen->update();
} while (!salirmenucontroles && !g_engine->shouldQuit());
- putImg(50, 10, puntfondcontroles);
- xraton = oldxraton;
- yraton = oldyraton;
- iraton = oldiraton;
- g_engine->_mouseManager->setMousePos(iraton, xraton, yraton);
+ g_engine->_graphics->putImg(50, 10, puntfondcontroles);
+ mouseX = oldxraton;
+ mouseY = oldyraton;
+ mouseMaskIndex = oldiraton;
+ g_engine->_mouseManager->setMousePos(mouseMaskIndex, mouseX, mouseY);
free(puntfondcontroles);
free(slider);
free(sliderBackground1);
@@ -2371,17 +2243,17 @@ void sacrificeScene() {
bar(0, 139, 319, 149, 0);
bar(10, 10, 310, 120, 0);
if (isSpanish) {
- outtextxy(10, 10, messages[9], 200);
- outtextxy(10, 30, messages[10], 200);
- outtextxy(10, 50, messages[11], 200);
- outtextxy(10, 70, messages[12], 200);
- outtextxy(10, 90, messages[13], 200);
+ littText(10, 10, messages[9], 200);
+ littText(10, 30, messages[10], 200);
+ littText(10, 50, messages[11], 200);
+ littText(10, 70, messages[12], 200);
+ littText(10, 90, messages[13], 200);
} else {
- outtextxy(10, 20, messages[9], 200);
- outtextxy(10, 40, messages[10], 200);
- outtextxy(10, 60, messages[11], 200);
- outtextxy(10, 80, messages[12], 200);
- outtextxy(10, 100, messages[13], 200);
+ littText(10, 20, messages[9], 200);
+ littText(10, 40, messages[10], 200);
+ littText(10, 60, messages[11], 200);
+ littText(10, 80, messages[12], 200);
+ littText(10, 100, messages[13], 200);
}
for (int i = 0; i <= 28; i++)
@@ -2396,16 +2268,16 @@ void sacrificeScene() {
bar(10, 10, 310, 120, 0);
if (isSpanish) {
- outtextxy(10, 10, messages[14], 200);
- outtextxy(10, 30, messages[15], 200);
- outtextxy(10, 50, messages[16], 200);
- outtextxy(10, 70, messages[17], 200);
- outtextxy(10, 90, messages[18], 200);
+ littText(10, 10, messages[14], 200);
+ littText(10, 30, messages[15], 200);
+ littText(10, 50, messages[16], 200);
+ littText(10, 70, messages[17], 200);
+ littText(10, 90, messages[18], 200);
} else {
- outtextxy(10, 20, messages[14], 200);
- outtextxy(10, 40, messages[15], 200);
- outtextxy(10, 60, messages[16], 200);
- outtextxy(10, 80, messages[17], 200);
+ littText(10, 20, messages[14], 200);
+ littText(10, 40, messages[15], 200);
+ littText(10, 60, messages[16], 200);
+ littText(10, 80, messages[17], 200);
}
for (int i = 0; i <= 28; i++)
@@ -2419,14 +2291,14 @@ void sacrificeScene() {
bar(10, 10, 310, 120, 0);
if (isSpanish) {
- outtextxy(10, 10, messages[19], 200);
- outtextxy(10, 50, messages[20], 200);
- outtextxy(10, 70, messages[21], 200);
- outtextxy(10, 90, messages[22], 200);
+ littText(10, 10, messages[19], 200);
+ littText(10, 50, messages[20], 200);
+ littText(10, 70, messages[21], 200);
+ littText(10, 90, messages[22], 200);
} else {
- outtextxy(10, 30, messages[19], 200);
- outtextxy(10, 60, messages[20], 200);
- outtextxy(10, 80, messages[21], 200);
+ littText(10, 30, messages[19], 200);
+ littText(10, 60, messages[20], 200);
+ littText(10, 80, messages[21], 200);
}
for (int i = 0; i <= 28; i++)
@@ -2443,7 +2315,7 @@ void sacrificeScene() {
showError(318);
}
fich.read(palaux, 768);
- fich.read(background, 44800);
+ fich.read(sceneBackground, 44800);
fich.close();
pal[0] = 0;
@@ -2456,7 +2328,7 @@ void sacrificeScene() {
}
// We dont have the width and height here in the byte buffer
- drawScreen(background, false);
+ drawScreen(sceneBackground, false);
partialFadeIn(234);
g_engine->_sound->stopVoc();
@@ -2473,26 +2345,26 @@ void sacrificeScene() {
g_engine->_sound->fadeOutMusic(musicVolLeft, musicVolRight);
g_engine->_sound->playMidi("SACRIFIC", true);
g_engine->_sound->fadeInMusic(musicVolLeft, musicVolRight);
- clear();
+ g_engine->_graphics->clear();
- outtextxy(10, 31, messages[23], 254);
- outtextxy(10, 29, messages[23], 254);
- outtextxy(11, 30, messages[23], 254);
- outtextxy(9, 30, messages[23], 254);
+ littText(10, 31, messages[23], 254);
+ littText(10, 29, messages[23], 254);
+ littText(11, 30, messages[23], 254);
+ littText(9, 30, messages[23], 254);
- outtextxy(10, 51, messages[24], 254);
- outtextxy(10, 49, messages[24], 254);
- outtextxy(11, 50, messages[24], 254);
- outtextxy(9, 50, messages[24], 254);
+ littText(10, 51, messages[24], 254);
+ littText(10, 49, messages[24], 254);
+ littText(11, 50, messages[24], 254);
+ littText(9, 50, messages[24], 254);
- outtextxy(10, 71, messages[25], 254);
- outtextxy(10, 69, messages[25], 254);
- outtextxy(11, 70, messages[25], 254);
- outtextxy(9, 70, messages[25], 254);
+ littText(10, 71, messages[25], 254);
+ littText(10, 69, messages[25], 254);
+ littText(11, 70, messages[25], 254);
+ littText(9, 70, messages[25], 254);
- outtextxy(10, 30, messages[23], 255);
- outtextxy(10, 50, messages[24], 255);
- outtextxy(10, 70, messages[25], 255);
+ littText(10, 30, messages[23], 255);
+ littText(10, 50, messages[24], 255);
+ littText(10, 70, messages[25], 255);
for (int i = 0; i < 32; i++) {
setRGBPalette(255, 32 + i, i * 2, i * 2);
@@ -2520,9 +2392,9 @@ void sacrificeScene() {
palaux[i * 3 + 2] = palaux[i * 3 + 2] << 2;
}
- fich.read(background, 64000);
+ fich.read(sceneBackground, 64000);
fich.close();
- drawFullScreen(background);
+ drawFullScreen(sceneBackground);
palaux[0] = 0;
palaux[1] = 0;
@@ -2542,66 +2414,66 @@ void sacrificeScene() {
totalFadeOut(128);
g_engine->_sound->stopVoc();
- clear();
-
- outtextxy(10, 21, messages[26], 254);
- outtextxy(10, 19, messages[26], 254);
- outtextxy(11, 20, messages[26], 254);
- outtextxy(9, 20, messages[26], 254);
-
- outtextxy(10, 41, messages[27], 254);
- outtextxy(10, 39, messages[27], 254);
- outtextxy(11, 40, messages[27], 254);
- outtextxy(9, 40, messages[27], 254);
-
- outtextxy(10, 61, messages[28], 254);
- outtextxy(10, 59, messages[28], 254);
- outtextxy(11, 60, messages[28], 254);
- outtextxy(9, 60, messages[28], 254);
-
- outtextxy(10, 81, messages[29], 254);
- outtextxy(10, 79, messages[29], 254);
- outtextxy(11, 80, messages[29], 254);
- outtextxy(9, 80, messages[29], 254);
-
- outtextxy(10, 101, messages[30], 254);
- outtextxy(10, 99, messages[30], 254);
- outtextxy(11, 100, messages[30], 254);
- outtextxy(9, 100, messages[30], 254);
-
- outtextxy(10, 121, messages[31], 254);
- outtextxy(10, 119, messages[31], 254);
- outtextxy(11, 120, messages[31], 254);
- outtextxy(9, 120, messages[31], 254);
-
- outtextxy(10, 141, messages[32], 254);
- outtextxy(10, 139, messages[32], 254);
- outtextxy(11, 140, messages[32], 254);
- outtextxy(9, 140, messages[32], 254);
+ g_engine->_graphics->clear();
+
+ littText(10, 21, messages[26], 254);
+ littText(10, 19, messages[26], 254);
+ littText(11, 20, messages[26], 254);
+ littText(9, 20, messages[26], 254);
+
+ littText(10, 41, messages[27], 254);
+ littText(10, 39, messages[27], 254);
+ littText(11, 40, messages[27], 254);
+ littText(9, 40, messages[27], 254);
+
+ littText(10, 61, messages[28], 254);
+ littText(10, 59, messages[28], 254);
+ littText(11, 60, messages[28], 254);
+ littText(9, 60, messages[28], 254);
+
+ littText(10, 81, messages[29], 254);
+ littText(10, 79, messages[29], 254);
+ littText(11, 80, messages[29], 254);
+ littText(9, 80, messages[29], 254);
+
+ littText(10, 101, messages[30], 254);
+ littText(10, 99, messages[30], 254);
+ littText(11, 100, messages[30], 254);
+ littText(9, 100, messages[30], 254);
+
+ littText(10, 121, messages[31], 254);
+ littText(10, 119, messages[31], 254);
+ littText(11, 120, messages[31], 254);
+ littText(9, 120, messages[31], 254);
+
+ littText(10, 141, messages[32], 254);
+ littText(10, 139, messages[32], 254);
+ littText(11, 140, messages[32], 254);
+ littText(9, 140, messages[32], 254);
if (!isSpanish) {
- outtextxy(10, 161, messages[56], 254);
- outtextxy(10, 159, messages[56], 254);
- outtextxy(11, 160, messages[56], 254);
- outtextxy(9, 160, messages[56], 254);
+ littText(10, 161, messages[56], 254);
+ littText(10, 159, messages[56], 254);
+ littText(11, 160, messages[56], 254);
+ littText(9, 160, messages[56], 254);
- outtextxy(10, 181, messages[57], 254);
- outtextxy(10, 179, messages[57], 254);
- outtextxy(11, 180, messages[57], 254);
- outtextxy(9, 180, messages[57], 254);
+ littText(10, 181, messages[57], 254);
+ littText(10, 179, messages[57], 254);
+ littText(11, 180, messages[57], 254);
+ littText(9, 180, messages[57], 254);
}
- outtextxy(10, 20, messages[26], 255);
- outtextxy(10, 40, messages[27], 255);
- outtextxy(10, 60, messages[28], 255);
- outtextxy(10, 80, messages[29], 255);
- outtextxy(10, 100, messages[30], 255);
- outtextxy(10, 120, messages[31], 255);
- outtextxy(10, 140, messages[32], 255);
+ littText(10, 20, messages[26], 255);
+ littText(10, 40, messages[27], 255);
+ littText(10, 60, messages[28], 255);
+ littText(10, 80, messages[29], 255);
+ littText(10, 100, messages[30], 255);
+ littText(10, 120, messages[31], 255);
+ littText(10, 140, messages[32], 255);
if (!isSpanish) {
- outtextxy(10, 160, messages[56], 255);
- outtextxy(10, 180, messages[57], 255);
+ littText(10, 160, messages[56], 255);
+ littText(10, 180, messages[57], 255);
}
for (int i = 0; i <= 31; i++) {
@@ -2620,52 +2492,52 @@ void sacrificeScene() {
if (g_engine->shouldQuit())
return;
- clear();
+ g_engine->_graphics->clear();
- outtextxy(10, 21, messages[33], 254);
- outtextxy(10, 19, messages[33], 254);
- outtextxy(11, 20, messages[33], 254);
- outtextxy(9, 20, messages[33], 254);
+ littText(10, 21, messages[33], 254);
+ littText(10, 19, messages[33], 254);
+ littText(11, 20, messages[33], 254);
+ littText(9, 20, messages[33], 254);
- outtextxy(10, 41, messages[34], 254);
- outtextxy(10, 39, messages[34], 254);
- outtextxy(11, 40, messages[34], 254);
- outtextxy(9, 40, messages[34], 254);
+ littText(10, 41, messages[34], 254);
+ littText(10, 39, messages[34], 254);
+ littText(11, 40, messages[34], 254);
+ littText(9, 40, messages[34], 254);
- outtextxy(10, 61, messages[35], 254);
- outtextxy(10, 59, messages[35], 254);
- outtextxy(11, 60, messages[35], 254);
- outtextxy(9, 60, messages[35], 254);
+ littText(10, 61, messages[35], 254);
+ littText(10, 59, messages[35], 254);
+ littText(11, 60, messages[35], 254);
+ littText(9, 60, messages[35], 254);
if (isSpanish) {
- outtextxy(10, 81, messages[36], 254);
- outtextxy(10, 79, messages[36], 254);
- outtextxy(11, 80, messages[36], 254);
- outtextxy(9, 80, messages[36], 254);
-
- outtextxy(10, 101, messages[37], 254);
- outtextxy(10, 99, messages[37], 254);
- outtextxy(11, 100, messages[37], 254);
- outtextxy(9, 100, messages[37], 254);
-
- outtextxy(10, 121, messages[38], 254);
- outtextxy(10, 119, messages[38], 254);
- outtextxy(11, 120, messages[38], 254);
- outtextxy(9, 120, messages[38], 254);
-
- outtextxy(10, 141, messages[39], 254);
- outtextxy(10, 139, messages[39], 254);
- outtextxy(11, 140, messages[39], 254);
- outtextxy(9, 140, messages[39], 254);
- }
-
- outtextxy(10, 20, messages[33], 255);
- outtextxy(10, 40, messages[34], 255);
- outtextxy(10, 60, messages[35], 255);
+ littText(10, 81, messages[36], 254);
+ littText(10, 79, messages[36], 254);
+ littText(11, 80, messages[36], 254);
+ littText(9, 80, messages[36], 254);
+
+ littText(10, 101, messages[37], 254);
+ littText(10, 99, messages[37], 254);
+ littText(11, 100, messages[37], 254);
+ littText(9, 100, messages[37], 254);
+
+ littText(10, 121, messages[38], 254);
+ littText(10, 119, messages[38], 254);
+ littText(11, 120, messages[38], 254);
+ littText(9, 120, messages[38], 254);
+
+ littText(10, 141, messages[39], 254);
+ littText(10, 139, messages[39], 254);
+ littText(11, 140, messages[39], 254);
+ littText(9, 140, messages[39], 254);
+ }
+
+ littText(10, 20, messages[33], 255);
+ littText(10, 40, messages[34], 255);
+ littText(10, 60, messages[35], 255);
if (isSpanish) {
- outtextxy(10, 80, messages[36], 255);
- outtextxy(10, 100, messages[37], 255);
- outtextxy(10, 120, messages[38], 255);
- outtextxy(10, 140, messages[39], 255);
+ littText(10, 80, messages[36], 255);
+ littText(10, 100, messages[37], 255);
+ littText(10, 120, messages[38], 255);
+ littText(10, 140, messages[39], 255);
}
for (int i = 0; i < 32; i++) {
@@ -2683,26 +2555,26 @@ void sacrificeScene() {
delay(2000);
if (g_engine->shouldQuit())
return;
- clear();
+ g_engine->_graphics->clear();
- outtextxy(10, 61, messages[40], 254);
- outtextxy(10, 59, messages[40], 254);
- outtextxy(11, 60, messages[40], 254);
- outtextxy(9, 60, messages[40], 254);
+ littText(10, 61, messages[40], 254);
+ littText(10, 59, messages[40], 254);
+ littText(11, 60, messages[40], 254);
+ littText(9, 60, messages[40], 254);
- outtextxy(10, 81, messages[41], 254);
- outtextxy(10, 79, messages[41], 254);
- outtextxy(11, 80, messages[41], 254);
- outtextxy(9, 80, messages[41], 254);
+ littText(10, 81, messages[41], 254);
+ littText(10, 79, messages[41], 254);
+ littText(11, 80, messages[41], 254);
+ littText(9, 80, messages[41], 254);
- outtextxy(10, 101, messages[42], 254);
- outtextxy(10, 99, messages[42], 254);
- outtextxy(11, 100, messages[42], 254);
- outtextxy(9, 100, messages[42], 254);
+ littText(10, 101, messages[42], 254);
+ littText(10, 99, messages[42], 254);
+ littText(11, 100, messages[42], 254);
+ littText(9, 100, messages[42], 254);
- outtextxy(10, 60, messages[40], 255);
- outtextxy(10, 80, messages[41], 255);
- outtextxy(10, 100, messages[42], 255);
+ littText(10, 60, messages[40], 255);
+ littText(10, 80, messages[41], 255);
+ littText(10, 100, messages[42], 255);
for (int i = 0; i < 32; i++) {
setRGBPalette(255, 32 + i, i * 2, i * 2);
@@ -2728,24 +2600,24 @@ void ending() {
const char *const *messages = (g_engine->_lang == Common::ES_ESP) ? fullScreenMessages[0] : fullScreenMessages[1];
const long *offsets = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0] : flcOffsets[1];
- outtextxy(10, 41, messages[43], 249);
- outtextxy(10, 39, messages[43], 249);
- outtextxy(11, 40, messages[43], 249);
- outtextxy(9, 40, messages[43], 249);
+ littText(10, 41, messages[43], 249);
+ littText(10, 39, messages[43], 249);
+ littText(11, 40, messages[43], 249);
+ littText(9, 40, messages[43], 249);
- outtextxy(10, 61, messages[44], 249);
- outtextxy(10, 59, messages[44], 249);
- outtextxy(11, 60, messages[44], 249);
- outtextxy(9, 60, messages[44], 249);
+ littText(10, 61, messages[44], 249);
+ littText(10, 59, messages[44], 249);
+ littText(11, 60, messages[44], 249);
+ littText(9, 60, messages[44], 249);
- outtextxy(10, 40, messages[43], 253);
- outtextxy(10, 60, messages[44], 253);
+ littText(10, 40, messages[43], 253);
+ littText(10, 60, messages[44], 253);
if(g_engine->shouldQuit()) {
return;
}
delay(4000);
totalFadeOut(0);
- clear();
+ g_engine->_graphics->clear();
if(g_engine->shouldQuit()) {
return;
}
@@ -2776,7 +2648,7 @@ void loadBat() {
sizeanimado = fichcani.readUint16LE();
secondaryAnimationFrameCount = fichcani.readByte();
numerodir = fichcani.readByte();
- pasoanimado = (byte *)malloc(sizeanimado);
+ curSecondaryAnimationFrame = (byte *)malloc(sizeanimado);
loadAnimationForDirection(&fichcani, 0);
fichcani.close();
}
@@ -2791,7 +2663,7 @@ void loadDevil() {
sizeanimado = fichcani.readUint16LE();
secondaryAnimationFrameCount = fichcani.readByte();
numerodir = fichcani.readByte();
- pasoanimado = (byte *)malloc(sizeanimado);
+ curSecondaryAnimationFrame = (byte *)malloc(sizeanimado);
if (numerodir != 0) {
secondaryAnimationFrameCount = secondaryAnimationFrameCount / 4;
for (int i = 0; i <= 3; i++) {
@@ -2807,7 +2679,7 @@ void assembleCompleteBackground(byte *image, uint coordx, uint coordy) {
w = READ_LE_UINT16(image);
h = READ_LE_UINT16(image + 2);
- wFondo = READ_LE_UINT16(background);
+ wFondo = READ_LE_UINT16(sceneBackground);
wFondo++;
w++;
@@ -2816,7 +2688,7 @@ void assembleCompleteBackground(byte *image, uint coordx, uint coordy) {
for (int j = 0; j < h; j++) {
int color = image[4 + j * w + i];
if (color != 0) {
- background[4 + (coordy + j) * wFondo + (coordx + i)] = color;
+ sceneBackground[4 + (coordy + j) * wFondo + (coordx + i)] = color;
}
}
}
@@ -2828,15 +2700,15 @@ void assembleCompleteBackground(byte *image, uint coordx, uint coordy) {
*/
void assembleScreen(bool scroll) {
- for (int indice = 0; indice < nivelesdeprof; indice++) {
+ for (int indice = 0; indice < depthLevelCount; indice++) {
if (screenObjects[indice] != NULL) {
assembleCompleteBackground(screenObjects[indice], depthMap[indice].posx, depthMap[indice].posy);
}
- if (!scroll && secuencia.profundidad == indice) {
+ if (!scroll && secuencia.depth == indice) {
assembleCompleteBackground(secuencia.bitmap[direccionmovimiento][iframe], characterPosX, characterPosY);
}
- if (!scroll && currentRoomData->animationFlag && animado.profundidad == indice) {
- assembleCompleteBackground(pasoanimado, animado.posx, animado.posy);
+ if (!scroll && currentRoomData->animationFlag && animado.depth == indice) {
+ assembleCompleteBackground(curSecondaryAnimationFrame, animado.posx, animado.posy);
}
}
}
@@ -2845,7 +2717,7 @@ void disableSecondAnimation() {
setRoomTrajectories(altoanimado, anchoanimado, RESTORE);
currentRoomData->animationFlag = false;
freeAnimation();
- screenHandleToBackground();
+ restoreBackground();
assembleScreen();
}
@@ -2855,13 +2727,13 @@ void drawMouseGrid(RoomFileRegister *screen) {
for (int j = 0; j < 27; j++) {
int color = screen->mouseGrid[i][j];
if (color != 0) {
- int startX = i * factorx + 7;
- int startY = j * factory;
- for (int i2 = 0; i2 < factorx; i2 += 2) {
- for (int j2 = 0; j2 < factory; j2++) {
+ int startX = i * xGridCount + 7;
+ int startY = j * yGridCount;
+ for (int i2 = 0; i2 < xGridCount; i2 += 2) {
+ for (int j2 = 0; j2 < yGridCount; j2++) {
int absPixel = startY + j2;
int offsetX = (absPixel % 2 == 0) ? 1 : 0;
- if (offsetX < startX + factorx && color != 0) {
+ if (offsetX < startX + xGridCount && color != 0) {
*(byte *)g_engine->_screen->getBasePtr(startX + i2 + offsetX, startY + j2) = 255 - color;
}
}
@@ -2875,15 +2747,15 @@ void drawMouseGrid(RoomFileRegister *screen) {
void drawScreenGrid(RoomFileRegister *screen) {
for (int i = 0; i < 39; i++) {
for (int j = 0; j < 27; j++) {
- int color = screen->rejapantalla[i][j];
+ int color = screen->walkAreasGrid[i][j];
if (color != 0) {
- int startX = i * factorx + 7;
- int startY = j * factory;
- for (int i2 = 0; i2 < factorx; i2 += 2) {
- for (int j2 = 0; j2 < factory; j2++) {
+ int startX = i * xGridCount + 7;
+ int startY = j * yGridCount;
+ for (int i2 = 0; i2 < xGridCount; i2 += 2) {
+ for (int j2 = 0; j2 < yGridCount; j2++) {
int absPixel = startY + j2;
int offsetX = (absPixel % 2 == 0) ? 1 : 0;
- if (offsetX < startX + factorx && color != 0) {
+ if (offsetX < startX + xGridCount && color != 0) {
*(byte *)g_engine->_screen->getBasePtr(startX + i2 + offsetX, startY + j2) = 255 - color;
}
}
@@ -2921,7 +2793,7 @@ void drawX(int x, int y, byte color) {
void drawCharacterPosition() {
drawX(characterPosX, characterPosY, 210);
- drawX(characterPosX + rectificacionx, characterPosY + rectificaciony, 218);
+ drawX(characterPosX + characterCorrectionX, characterPosY + characerCorrectionY, 218);
}
void drawRect(byte color, int x, int y, int x2, int y2) {
@@ -2929,20 +2801,20 @@ void drawRect(byte color, int x, int y, int x2, int y2) {
}
void printPos(int x, int y, int screenPosX, int screenPosY, const char *label) {
- g_engine->_graphics->restoreBackground(screenPosX, screenPosY, screenPosX + 100, screenPosY + 10);
+ g_engine->_graphics->restoreBackgroundArea(screenPosX, screenPosY, screenPosX + 100, screenPosY + 10);
g_engine->_graphics->euroText(Common::String::format("%s: %d, %d", label, x, y), screenPosX, screenPosY, Graphics::kTextAlignLeft);
}
void drawGrid() {
- int horizontal = 320 / factorx;
- int vertical = 140 / factory;
+ int horizontal = 320 / xGridCount;
+ int vertical = 140 / yGridCount;
for (int i = 0; i < horizontal; i++) {
- int startX = i * factorx;
+ int startX = i * xGridCount;
g_engine->_screen->drawLine(startX, 0, startX, 140, 200);
}
for (int j = 0; j < vertical; j++) {
- int startY = j * factory;
+ int startY = j * yGridCount;
g_engine->_screen->drawLine(0, startY, 320, startY, 200);
}
g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
@@ -2951,25 +2823,25 @@ void drawGrid() {
void setRoomTrajectories(int animationHeight, int animationWidth, TRAJECTORIES_OP op, bool fixGrids) {
// add to restore the room, subtract to adjust before loading the screen
- if (currentRoomData->animationFlag && currentRoomData->nombremovto != "QQQQQQQQ") {
- for (int i = 0; i < currentRoomData->longtray2; i++) {
+ if (currentRoomData->animationFlag && currentRoomData->animationName != "QQQQQQQQ") {
+ for (int i = 0; i < currentRoomData->secondaryTrajectoryLength; i++) {
if (op == RESTORE) {
- currentRoomData->tray2[i].x = currentRoomData->tray2[i].x + (animationWidth >> 1);
- currentRoomData->tray2[i].y = currentRoomData->tray2[i].y + animationHeight;
+ currentRoomData->secondaryAnimTrajectory[i].x = currentRoomData->secondaryAnimTrajectory[i].x + (animationWidth >> 1);
+ currentRoomData->secondaryAnimTrajectory[i].y = currentRoomData->secondaryAnimTrajectory[i].y + animationHeight;
} else {
- currentRoomData->tray2[i].x = currentRoomData->tray2[i].x - (animationWidth >> 1);
- currentRoomData->tray2[i].y = currentRoomData->tray2[i].y - animationHeight;
+ currentRoomData->secondaryAnimTrajectory[i].x = currentRoomData->secondaryAnimTrajectory[i].x - (animationWidth >> 1);
+ currentRoomData->secondaryAnimTrajectory[i].y = currentRoomData->secondaryAnimTrajectory[i].y - animationHeight;
}
}
if (fixGrids) {
for (int i = 0; i < maxrejax; i++) {
for (int j = 0; j < maxrejay; j++) {
if (op == RESTORE) {
- currentRoomData->rejapantalla[oldposx + i][oldposy + j] = rejafondomovto[i][j];
+ currentRoomData->walkAreasGrid[oldposx + i][oldposy + j] = rejafondomovto[i][j];
currentRoomData->mouseGrid[oldposx + i][oldposy + j] = rejafondoraton[i][j];
} else {
if (rejamascaramovto[i][j] > 0)
- currentRoomData->rejapantalla[oldposx + i][oldposy + j] = rejamascaramovto[i][j];
+ currentRoomData->walkAreasGrid[oldposx + i][oldposy + j] = rejamascaramovto[i][j];
if (rejamascararaton[i][j] > 0)
currentRoomData->mouseGrid[oldposx + i][oldposy + j] = rejamascararaton[i][j];
}
diff --git a/engines/tot/routines2.h b/engines/tot/routines2.h
index 757cfc71e08..9c3fd3f2995 100644
--- a/engines/tot/routines2.h
+++ b/engines/tot/routines2.h
@@ -51,9 +51,9 @@ void loadItem(uint coordx, uint coordy, uint picSize, int32 pic, uint prof);
void updateInventory(byte index);
void readBitmap(int32 posbm, byte *puntbm, uint tambm, uint errorbm);
void updateItem(uint filePos);
-void readItemRegister(Common::SeekableReadStream *stream, uint objPos, InvItemRegister &thisRegObj);
+void readItemRegister(Common::SeekableReadStream *stream, uint objPos, ScreenObject &thisRegObj);
void readItemRegister(uint objPos);
-void saveItemRegister(InvItemRegister object, Common::SeekableWriteStream *stream);
+void saveItemRegister(ScreenObject object, Common::SeekableWriteStream *stream);
void saveTemporaryGame();
void drawLookAtItem(RoomObjectListEntry obj);
void putIcon(uint posX, uint posY, uint iconNumber);
diff --git a/engines/tot/saveload.cpp b/engines/tot/saveload.cpp
index 7a6a2586399..b59f3e1d5e6 100644
--- a/engines/tot/saveload.cpp
+++ b/engines/tot/saveload.cpp
@@ -34,7 +34,7 @@ namespace Tot {
#define SAVEGAME_CURRENT_VERSION 1
-bool syncGeneralData(Common::Serializer &s, regispartida &game) {
+bool syncGeneralData(Common::Serializer &s, SavedGame &game) {
uint32 startBytes = s.bytesSynced();
// Uint16
s.syncAsUint16LE(game.numeropantalla);
@@ -113,7 +113,7 @@ bool syncGeneralData(Common::Serializer &s, regispartida &game) {
s.syncAsSint16LE(game.trayec[i].y);
}
- for (int indiaux = 0; indiaux < maxpersonajes; indiaux++) {
+ for (int indiaux = 0; indiaux < characterCount; indiaux++) {
// interleave them just to avoid creating many loops
s.syncAsByte(game.primera[indiaux]);
s.syncAsByte(game.lprimera[indiaux]);
@@ -219,7 +219,7 @@ bool syncItemData(Common::Serializer &s, Common::MemorySeekableReadWriteStream *
return true;
}
-Common::Error syncSaveData(Common::Serializer &ser, regispartida &game) {
+Common::Error syncSaveData(Common::Serializer &ser, SavedGame &game) {
if (!syncGeneralData(ser, game)) {
warning("Error while synchronizing general data");
return Common::kUnknownError;
@@ -244,10 +244,10 @@ Common::Error TotEngine::syncGame(Common::Serializer &s) {
if (s.isLoading()) {
debug("Loading game!!");
- regispartida loadedGame;
+ SavedGame loadedGame;
// Means we are loading from before the game has started
// if(rooms == nullptr) {
- clear();
+ g_engine->_graphics->clear();
processingActive();
loadCharAnimation();
@@ -257,7 +257,7 @@ Common::Error TotEngine::syncGame(Common::Serializer &s) {
loadScreenMemory();
totalFadeOut(0);
- clear();
+ g_engine->_graphics->clear();
processingActive();
initializeScreenFile();
initializeObjectFile();
diff --git a/engines/tot/texts.h b/engines/tot/texts.h
index d70312f3487..c290323be7f 100644
--- a/engines/tot/texts.h
+++ b/engines/tot/texts.h
@@ -651,7 +651,7 @@ static const char *const animMessages[2][290] = {
}
};
-static const char *const fullScreenMessages[2][58] = {
+static const char *const fullScreenMessages[2][59] = {
// Spanish
{
// intro
@@ -717,16 +717,17 @@ static const char *const fullScreenMessages[2][58] = {
"... AAAHHHHH!! ...",
// Diploma
// 49
- "CERTIFICADO N\xA7:",
- "Yo, Jacob, el Gran Maestre ",
- "de la Hermandad de Sek Umh Nejl",
- "certifico que: ",
- "me ha liberado de las Cavernas",
- "Eternas, por lo cual le estar\x82 ",
- "por siempre agradecido."
- // 57
- "him back! If you achieve this your body will",
- " live once more."
+ "CERTIFICATE No:",
+ "I, Jacob, the Great Master",
+ "of the Sek Umh Fraternity",
+ "certify that: ",
+ "has liberated me from the",
+ "Eternal Caverns, and I shall be",
+ "greatful to him forever.",
+ // 56
+ " him back! If you achieve this your body will",
+ " live once more.",
+ "PROCESANDO......"
},
// English
@@ -805,7 +806,8 @@ static const char *const fullScreenMessages[2][58] = {
"greatful to him forever.",
// 56
" him back! If you achieve this your body will",
- " live once more."
+ " live once more.",
+ "PROCESSING......"
},
};
diff --git a/engines/tot/util.cpp b/engines/tot/util.cpp
index f895e467341..97ab56331c9 100644
--- a/engines/tot/util.cpp
+++ b/engines/tot/util.cpp
@@ -7,6 +7,9 @@
namespace Tot {
+// Enforces a small delay when text reveal is supposed to happen
+const int enforcedTextAnimDelay = 0;
+
void showError(int code) {
switch (code) {
case 1:
@@ -368,10 +371,6 @@ void delay(uint16 ms) {
g_engine->_chrono->delay(ms);
}
-void sound(uint16 frequency, int ms) {
- g_engine->_sound->beep(frequency, ms);
-}
-
/*
Allows you to modify palette entries for the IBM
8514 and the VGA drivers.
@@ -388,8 +387,36 @@ void setRGBPalette(int color, int r, int g, int b) {
g_system->getPaletteManager()->setPalette(palbuf, 0, 256);
}
+void littText(int x, int y, Common::String text, byte color, Graphics::TextAlign align) {
+ littText(x, y, text.c_str(), color, align);
+}
+
+void littText(int x, int y, char const *text, byte color, Graphics::TextAlign align) {
+ bool yAligned = (align == Graphics::kTextAlignCenter) ? true : false;
+ x = (align == Graphics::kTextAlignCenter) ? 0 : x;
+ // TODO: Investigate why this is needed
+ y = y + 2;
+ g_engine->_graphics->littText(text, x, y, color, align, yAligned);
+}
+
+void euroText(int x, int y, Common::String text, byte color, Graphics::TextAlign align) {
+ euroText(x, y, text.c_str(), color, align);
+}
+
+void euroText(int x, int y, char const *text, byte color, Graphics::TextAlign align) {
+ bool yAligned = (align == Graphics::kTextAlignCenter) ? true : false;
+ x = (align == Graphics::kTextAlignCenter) ? 0 : x;
+ // TODO: Investigate why this is needed
+ y = y + 2;
+ g_engine->_graphics->euroText(text, x, y, color, align, yAligned);
+}
+
void outtextxy(int x, int y, Common::String text, byte color, bool euro, Graphics::TextAlign align) {
- outtextxy(x, y, text.c_str(), color, euro, align);
+ if (euro) {
+ euroText(x, y, text.c_str(), color, align);
+ } else {
+ littText(x, y, text.c_str(), color, align);
+ }
}
void outtextxy(int x, int y, char const *text, byte color, bool euro, Graphics::TextAlign align) {
@@ -404,21 +431,24 @@ void outtextxy(int x, int y, char const *text, byte color, bool euro, Graphics::
}
}
-void outtextxyBios(int x, int y, Common::String text, byte color) {
+void biosText(int x, int y, Common::String text, byte color) {
g_engine->_graphics->biosText(text, x, y, color);
}
-void cleardevice(void) {
- g_engine->_screen->clear();
- g_engine->_screen->update();
-}
-
unsigned int imagesize(int x, int y, int x2, int y2) {
int w = x2 - x + 1;
int h = y2 - y + 1;
return 4 + (w * h);
}
+void rectangle(int x1, int y1, int x2, int y2, byte color) {
+ g_engine->_screen->drawLine(x1, y1, x2, y1, color);
+ g_engine->_screen->drawLine(x2, y1, x2, y2, color);
+ g_engine->_screen->drawLine(x1, y2, x2, y2, color);
+ g_engine->_screen->drawLine(x1, y1, x1, y2, color);
+ g_engine->_screen->addDirtyRect(Common::Rect(x1, y1, x2, y2));
+}
+
void bar(int x1, int y1, int x2, int y2, byte color) {
x2 = x2 + 1;
y2 = y2 + 1;
diff --git a/engines/tot/util.h b/engines/tot/util.h
index a90c3e78e26..0fc747f780a 100644
--- a/engines/tot/util.h
+++ b/engines/tot/util.h
@@ -12,28 +12,29 @@
namespace Tot {
+extern const int enforcedTextAnimDelay;
+
void showError(int code);
// Delays a specified number of milliseconds.
void delay(uint16 ms);
-// Starts the internal speaker with given frequency. The speaker continues until explicitly turned off by a call to NoSound.
-void sound(uint16 frequency, int length);
-
int engine_start();
void setRGBPalette(int color, int r, int g, int b);
-void outtextxy(int x, int y, char const *text, byte color, bool euro = false, Graphics::TextAlign align = Graphics::kTextAlignStart);
-
-void outtextxy(int x, int y, Common::String text, byte color, bool euro = false, Graphics::TextAlign align = Graphics::kTextAlignStart);
+void littText(int x, int y, Common::String text, byte color, Graphics::TextAlign align = Graphics::kTextAlignStart);
+void littText(int x, int y, char const *text, byte color, Graphics::TextAlign align = Graphics::kTextAlignStart);
-void outtextxyBios(int x, int y, Common::String text, byte color);
+void euroText(int x, int y, Common::String text, byte color, Graphics::TextAlign align = Graphics::kTextAlignStart);
+void euroText(int x, int y, char const *text, byte color, Graphics::TextAlign align = Graphics::kTextAlignStart);
-void cleardevice(void);
+void biosText(int x, int y, Common::String text, byte color);
unsigned int imagesize(int x, int y, int x2, int y2);
+void rectangle(int x1, int y1, int x2, int y2, byte color);
+
void line(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2, byte color);
void bar(int x1, int y1, int x2, int y2, byte color);
@@ -48,11 +49,6 @@ void waitForKey();
void changeGameSpeed(Common::Event e);
-inline int keypressed() {
- warning("Stub keypressed!");
- return 0;
-}
-
inline bool odd(long i) { return i % 2 != 0; }
unsigned Random(unsigned range);
Commit: 2b4a9489efeb38a25f20e6c2a70e10dff0920770
https://github.com/scummvm/scummvm/commit/2b4a9489efeb38a25f20e6c2a70e10dff0920770
Author: gsanmartin (gabriel.sanmartin at dna.inc)
Date: 2025-09-08T16:49:50+02:00
Commit Message:
TOT: Cleanup of global vars
Changed paths:
engines/tot/anims.cpp
engines/tot/dialog.cpp
engines/tot/game.cpp
engines/tot/playanim.cpp
engines/tot/playanim.h
engines/tot/routines.cpp
engines/tot/routines.h
engines/tot/routines2.cpp
engines/tot/saveload.cpp
engines/tot/tot.cpp
diff --git a/engines/tot/anims.cpp b/engines/tot/anims.cpp
index 11242e0ca09..43d560de109 100644
--- a/engines/tot/anims.cpp
+++ b/engines/tot/anims.cpp
@@ -974,7 +974,7 @@ static void loadFlc(
} else if (doscientos) {
g_engine->_graphics->setPalette(palette, 200);
for (int i = 0; i <= 200; i++) {
- if(gamePart == 2 && !salirdeljuego && (i == 131 || i == 134 || i == 143 || i == 187)) {
+ if(gamePart == 2 && !shouldQuitGame && (i == 131 || i == 134 || i == 143 || i == 187)) {
continue;
}
pal[i * 3 + 0] = palette[i * 3 + 0];
@@ -988,12 +988,12 @@ static void loadFlc(
}
}
// Make sure we also update the palette animations! Esp. for part 2
- if (currentRoomData != NULL && (currentRoomData->paletteAnimationFlag) && (saltospal >= 4) && !salirdeljuego) {
+ if (currentRoomData != NULL && (currentRoomData->paletteAnimationFlag) && (saltospal >= 4) && !shouldQuitGame) {
saltospal = 0;
- if (movidapaleta > 6)
- movidapaleta = 0;
- else movidapaleta += 1;
- updatePalette(movidapaleta);
+ if (isPaletteAnimEnabled > 6)
+ isPaletteAnimEnabled = 0;
+ else isPaletteAnimEnabled += 1;
+ updatePalette(isPaletteAnimEnabled);
} else saltospal += 1;
tocapintar = false;
diff --git a/engines/tot/dialog.cpp b/engines/tot/dialog.cpp
index 640b4a095e5..bf7d8bbb615 100644
--- a/engines/tot/dialog.cpp
+++ b/engines/tot/dialog.cpp
@@ -90,21 +90,21 @@ void findDialogLine(byte persona) {
step = NULL;
} break;
case '3':
- if (libro[0] && (persona == 3)) {
+ if (bookTopic[0] && (persona == 3)) {
decir = false;
subida = true;
} else
decir = true;
break;
case '4':
- if (primera[persona - 1]) {
+ if (firstTimeTopicA[persona - 1]) {
decir = false;
subida = true;
} else
decir = true;
break;
case '5':
- if (libro[persona - 1] && lprimera[persona - 1])
+ if (bookTopic[persona - 1] && firstTimeTopicB[persona - 1])
decir = true;
else {
decir = false;
@@ -112,7 +112,7 @@ void findDialogLine(byte persona) {
}
break;
case '6':
- if (libro[persona - 1] && !lprimera[persona - 1])
+ if (bookTopic[persona - 1] && !firstTimeTopicB[persona - 1])
decir = true;
else {
decir = false;
@@ -120,10 +120,10 @@ void findDialogLine(byte persona) {
}
break;
case '7':
- if (libro[persona - 1]) {
+ if (bookTopic[persona - 1]) {
decir = false;
subida = true;
- } else if (!primera[persona - 1])
+ } else if (!firstTimeTopicA[persona - 1])
decir = true;
else {
decir = false;
@@ -131,7 +131,7 @@ void findDialogLine(byte persona) {
}
break;
case '8':
- if (caramelos[persona - 1] && cprimera[persona - 1])
+ if (mintTopic[persona - 1] && firstTimeTopicC[persona - 1])
decir = true;
else {
decir = false;
@@ -139,7 +139,7 @@ void findDialogLine(byte persona) {
}
break;
case '9':
- if (caramelos[persona - 1] && !cprimera[persona - 1])
+ if (mintTopic[persona - 1] && !firstTimeTopicC[persona - 1])
decir = true;
else {
decir = false;
@@ -147,7 +147,7 @@ void findDialogLine(byte persona) {
}
break;
case 'A':
- if (!caramelos[persona - 1] && !primera[persona - 1])
+ if (!mintTopic[persona - 1] && !firstTimeTopicA[persona - 1])
decir = true;
else {
decir = false;
@@ -155,43 +155,43 @@ void findDialogLine(byte persona) {
}
break;
case 'B':
- if (cavernas[0] && !primera[8])
+ if (caves[0] && !firstTimeTopicA[8])
decir = true;
else
decir = false;
break;
case 'C':
- if (cavernas[1] && !primera[8])
+ if (caves[1] && !firstTimeTopicA[8])
decir = true;
else
decir = false;
break;
case 'D':
- if ((cavernas[0] && cavernas[1]) && !primera[8])
+ if ((caves[0] && caves[1]) && !firstTimeTopicA[8])
decir = true;
else
decir = false;
break;
case 'E':
- if ((cavernas[0] && !cavernas[2]) && !primera[8])
+ if ((caves[0] && !caves[2]) && !firstTimeTopicA[8])
decir = true;
else
decir = false;
break;
case 'F':
- if (!cavernas[3])
+ if (!caves[3])
decir = true;
else
decir = false;
break;
case 'G':
- if (!cavernas[4])
+ if (!caves[4])
decir = true;
else
decir = false;
break;
case 'I':
- if (!sello_quitado)
+ if (!isSealRemoved)
decir = true;
else
decir = false;
@@ -206,10 +206,10 @@ void findDialogLine(byte persona) {
borde = true;
switch (persona) {
case 1:
- if (primera[persona - 1]) {
+ if (firstTimeTopicA[persona - 1]) {
l1->elemento = 12;
adelanta = true;
- } else if (libro[persona - 1]) {
+ } else if (bookTopic[persona - 1]) {
adelanta = true;
l1->elemento = 33;
} else {
@@ -218,7 +218,7 @@ void findDialogLine(byte persona) {
}
break;
case 3:
- if (primera[persona - 1]) {
+ if (firstTimeTopicA[persona - 1]) {
l1->elemento = 103;
adelanta = true;
} else {
@@ -384,11 +384,11 @@ void showDialogLine(Common::String matrizconversa[16], uint &charlaelegida) {
if (tocapintar) {
if (currentRoomData->paletteAnimationFlag && saltospal >= 4) {
saltospal = 0;
- if (movidapaleta > 6)
- movidapaleta = 0;
+ if (isPaletteAnimEnabled > 6)
+ isPaletteAnimEnabled = 0;
else
- movidapaleta += 1;
- updatePalette(movidapaleta);
+ isPaletteAnimEnabled += 1;
+ updatePalette(isPaletteAnimEnabled);
} else
saltospal += 1;
}
@@ -452,7 +452,7 @@ void showDialogLine(Common::String matrizconversa[16], uint &charlaelegida) {
void talk(byte person) {
debug("Talking to persona: %d", person);
uint pasorespuesta, nuevonodo;
- regismht pasoh;
+ TextEntry pasoh;
byte auxilcadena, insertarnombre, indicemochila;
Common::String matrizconversa[16];
@@ -514,7 +514,7 @@ void talk(byte person) {
hypertext(nuevonodo, 255, 0, pasorespuesta, true);
switch (nuevonodo) {
case 9: {
- lista1 = true;
+ obtainedList1 = true;
indicemochila = 0;
while (mobj[indicemochila].code != 0) {
indicemochila += 1;
@@ -524,7 +524,7 @@ void talk(byte person) {
mobj[indicemochila].objectName = getObjectName(0);
} break;
case 25: {
- lista2 = true;
+ obtainedList2 = true;
indicemochila = 0;
while (mobj[indicemochila].code != 0) {
indicemochila += 1;
@@ -559,14 +559,14 @@ void talk(byte person) {
// release(marca);
if (person < 5) {
- if (primera[person - 1])
- primera[person - 1] = false;
- if (lprimera[person - 1])
- lprimera[person - 1] = false;
- if (cprimera[person - 1])
- cprimera[person - 1] = false;
+ if (firstTimeTopicA[person - 1])
+ firstTimeTopicA[person - 1] = false;
+ if (firstTimeTopicB[person - 1])
+ firstTimeTopicB[person - 1] = false;
+ if (firstTimeTopicC[person - 1])
+ firstTimeTopicC[person - 1] = false;
} else if (person == 8)
- primera[8] = false;
+ firstTimeTopicA[8] = false;
}
void talkScreenObject() {
@@ -585,7 +585,7 @@ void talkScreenObject() {
talk(regobj.habla);
} else {
assignText();
- hypertext((Random(10) + 1039), 255, 0, kaka, false);
+ hypertext((Random(10) + 1039), 255, 0, foo, false);
verb.close();
if (contadorpc > 198)
showError(274);
diff --git a/engines/tot/game.cpp b/engines/tot/game.cpp
index d977253b002..79d9ab956a3 100644
--- a/engines/tot/game.cpp
+++ b/engines/tot/game.cpp
@@ -64,7 +64,7 @@ void newGame() {
loadScreenData(1);
screenTransition(13, false, sceneBackground);
mask();
- posicioninv = 0;
+ inventoryPosition = 0;
drawBackpack();
iframe = 0;
g_engine->_mouseManager->show();
@@ -99,15 +99,15 @@ int engine_start() {
g_engine->_sound->setMidiVolume(3, 3);
firstIntroduction();
g_engine->_mouseManager->setMousePos(1, mouseX, mouseY);
- initialMenu(hechaprimeravez);
- if (partidanueva && !g_engine->shouldQuit()) {
+ initialMenu(firstTimeDone);
+ if (startNewGame && !g_engine->shouldQuit()) {
newGame();
- } else if (continuarpartida && !g_engine->shouldQuit()) {
+ } else if (continueGame && !g_engine->shouldQuit()) {
loadTemporaryGame();
} else {
- desactivagrabar = true;
+ isSavingDisabled = true;
g_engine->openMainMenuDialog();
- desactivagrabar = false;
+ isSavingDisabled = false;
}
return startGame();
@@ -135,7 +135,7 @@ int startGame() {
const char hotKeyLook = hotKeyFor(LOOKAT);
const char hotKeyUse = hotKeyFor(USE);
- while (!salirdeljuego && !g_engine->shouldQuit()) {
+ while (!shouldQuitGame && !g_engine->shouldQuit()) {
bool escapePressed = false;
g_engine->_chrono->updateChrono();
g_engine->_mouseManager->animateMouseIfNeeded();
@@ -163,60 +163,60 @@ int startGame() {
break;
default:
if (e.kbd.keycode == hotKeyOpen) {
- numeroaccion = 5;
+ actionCode = 5;
action();
- oldxrejilla = 0;
- oldyrejilla = 0;
+ oldGridX = 0;
+ oldGridY = 0;
} else if (e.kbd.keycode == hotKeyClose) {
- numeroaccion = 6;
+ actionCode = 6;
action();
- oldxrejilla = 0;
- oldyrejilla = 0;
+ oldGridX = 0;
+ oldGridY = 0;
} else if (e.kbd.keycode == hotKeyPickup) {
- numeroaccion = 2;
+ actionCode = 2;
action();
- oldxrejilla = 0;
- oldyrejilla = 0;
+ oldGridX = 0;
+ oldGridY = 0;
} else if (e.kbd.keycode == hotKeyTalk) {
- numeroaccion = 1;
+ actionCode = 1;
action();
- oldxrejilla = 0;
- oldyrejilla = 0;
+ oldGridX = 0;
+ oldGridY = 0;
} else if (e.kbd.keycode == hotKeyLook) {
- numeroaccion = 3;
+ actionCode = 3;
action();
- oldxrejilla = 0;
- oldyrejilla = 0;
+ oldGridX = 0;
+ oldGridY = 0;
} else if (e.kbd.keycode == hotKeyUse) {
- numeroaccion = 4;
+ actionCode = 4;
action();
- oldxrejilla = 0;
- oldyrejilla = 0;
+ oldGridX = 0;
+ oldGridY = 0;
} else {
- numeroaccion = 0; // go to
+ actionCode = 0; // go to
}
}
} else if (e.type == Common::EVENT_LBUTTONUP) {
mouseClickX = e.mouse.x;
mouseClickY = e.mouse.y;
if (mouseClickY > 0 && mouseClickY < 131) {
- switch (numeroaccion) {
+ switch (actionCode) {
case 0: // go to
contadorpc2 = contadorpc;
- // gets the area where the character is now standing. Area is calculated using xframe,yframe plus some adjustments to get the center of the feet
- zonaactual = currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount];
- if (zonaactual < 10) {
+ // gets the zone where the character is now standing. Zone is calculated using xframe,yframe plus some adjustments to get the center of the feet
+ currentZone = currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount];
+ if (currentZone < 10) {
xframe2 = mouseClickX + 7;
yframe2 = mouseClickY + 7;
- // obtains the target area from the clicked coordinates
- zonadestino = currentRoomData->walkAreasGrid[xframe2 / xGridCount][yframe2 / yGridCount];
+ // obtains the target zone from the clicked coordinates
+ targetZone = currentRoomData->walkAreasGrid[xframe2 / xGridCount][yframe2 / yGridCount];
if (currentRoomData->code == 21 && currentRoomData->animationFlag) {
- if ((zonadestino >= 1 && zonadestino <= 5) ||
- (zonadestino >= 9 && zonadestino <= 13) ||
- (zonadestino >= 18 && zonadestino <= 21) ||
- zonadestino == 24 || zonadestino == 25) {
+ if ((targetZone >= 1 && targetZone <= 5) ||
+ (targetZone >= 9 && targetZone <= 13) ||
+ (targetZone >= 18 && targetZone <= 21) ||
+ targetZone == 24 || targetZone == 25) {
- zonadestino = 7;
+ targetZone = 7;
mouseClickX = 232;
mouseClickY = 75;
@@ -225,121 +225,121 @@ int startGame() {
}
}
- if (oldzonadestino != zonadestino || zonadestino < 10) {
- oldzonadestino = zonadestino;
+ if (oldTargetZone != targetZone || targetZone < 10) {
+ oldTargetZone = targetZone;
// Resets the entire route
- calculateRoute(zonaactual, zonadestino);
+ calculateRoute(currentZone, targetZone);
- indicepuertas = 0;
- cambiopantalla = false;
+ doorIndex = 0;
+ roomChange = false;
- for (indicepuertas = 0; indicepuertas < 5; indicepuertas++) {
- if (currentRoomData->doors[indicepuertas].doorcode == zonadestino) {
+ for (doorIndex = 0; doorIndex < 5; doorIndex++) {
+ if (currentRoomData->doors[doorIndex].doorcode == targetZone) {
- if (currentRoomData->doors[indicepuertas].openclosed == 1) {
- cambiopantalla = true;
+ if (currentRoomData->doors[doorIndex].openclosed == 1) {
+ roomChange = true;
break;
- } else if ((currentRoomData->code == 5 && zonadestino == 27) || (currentRoomData->code == 6 && zonadestino == 21)) {
+ } else if ((currentRoomData->code == 5 && targetZone == 27) || (currentRoomData->code == 6 && targetZone == 21)) {
;
} else {
- pasos -= 1;
+ steps -= 1;
}
}
}
// Sets xframe2 again due to the substraction when closed doors
- xframe2 = pasos;
+ xframe2 = steps;
} else
xframe2 = 0;
}
break;
case 1: // talk
- cambiopantalla = false;
- numeroaccion = 0;
+ roomChange = false;
+ actionCode = 0;
talkScreenObject();
contadorpc2 = contadorpc;
break;
case 2: // pick up
- cambiopantalla = false;
- numeroaccion = 0;
+ roomChange = false;
+ actionCode = 0;
pickupScreenObject();
contadorpc = contadorpc2;
break;
case 3: // look at
- cambiopantalla = false;
- destinox_paso = (mouseClickX + 7) / xGridCount;
- destinoy_paso = (mouseClickY + 7) / yGridCount;
- if (currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[destinox_paso][destinoy_paso]]->fileIndex > 0) {
+ roomChange = false;
+ destinationStepX = (mouseClickX + 7) / xGridCount;
+ destinationStepY = (mouseClickY + 7) / yGridCount;
+ if (currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[destinationStepX][destinationStepY]]->fileIndex > 0) {
goToObject(
currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount],
- currentRoomData->walkAreasGrid[destinox_paso][destinoy_paso]);
- if (currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[destinox_paso][destinoy_paso]]->fileIndex == 562)
+ currentRoomData->walkAreasGrid[destinationStepX][destinationStepY]);
+ if (currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[destinationStepX][destinationStepY]]->fileIndex == 562)
switch (currentRoomData->code) {
case 20:
- if (hornacina[0][hornacina[0][3]] > 0)
- readItemRegister(hornacina[0][hornacina[0][3]]);
+ if (niche[0][niche[0][3]] > 0)
+ readItemRegister(niche[0][niche[0][3]]);
else
readItemRegister(562);
break;
case 24:
- if (hornacina[1][hornacina[1][3]] > 0)
- readItemRegister(hornacina[1][hornacina[1][3]]);
+ if (niche[1][niche[1][3]] > 0)
+ readItemRegister(niche[1][niche[1][3]]);
else
readItemRegister(562);
break;
}
else
- readItemRegister(currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[destinox_paso][destinoy_paso]]->fileIndex);
+ readItemRegister(currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[destinationStepX][destinationStepY]]->fileIndex);
if (regobj.lookAtTextRef > 0)
drawText(regobj.lookAtTextRef);
- numeroaccion = 0;
+ actionCode = 0;
}
break;
case 4: // use
- cambiopantalla = false;
- numeroaccion = 0;
+ roomChange = false;
+ actionCode = 0;
useScreenObject();
contadorpc = contadorpc2;
break;
case 5: // open
- cambiopantalla = false;
- numeroaccion = 0;
+ roomChange = false;
+ actionCode = 0;
openScreenObject();
break;
case 6: { // close
- cambiopantalla = false;
- numeroaccion = 0;
+ roomChange = false;
+ actionCode = 0;
closeScreenObject();
contadorpc = contadorpc2;
} break;
}
} else if (mouseClickY > 148 && mouseClickY < 158) {
if (mouseClickX >= 3 && mouseClickX <= 53) {
- numeroaccion = 1;
+ actionCode = 1;
action();
break;
} else if (mouseClickX >= 58 && mouseClickX <= 103) {
- numeroaccion = 2;
+ actionCode = 2;
action();
break;
} else if (mouseClickX >= 108 && mouseClickX <= 153) {
- numeroaccion = 3;
+ actionCode = 3;
action();
break;
} else if (mouseClickX >= 158 && mouseClickX <= 198) {
- numeroaccion = 4;
+ actionCode = 4;
action();
break;
} else if (mouseClickX >= 203 && mouseClickX <= 248) {
- numeroaccion = 5;
+ actionCode = 5;
action();
break;
} else if (mouseClickX >= 253 && mouseClickX <= 311) {
- numeroaccion = 6;
+ actionCode = 6;
action();
break;
} else {
- numeroaccion = 0;
+ actionCode = 0;
action();
contadorpc2 = contadorpc;
}
@@ -348,55 +348,55 @@ int startGame() {
inventory(0, 33);
break;
} else if (mouseClickX >= 26 && mouseClickX <= 65) {
- handleAction(posicioninv);
+ handleAction(inventoryPosition);
break;
} else if (mouseClickX >= 70 && mouseClickX <= 108) {
- handleAction(posicioninv + 1);
+ handleAction(inventoryPosition + 1);
break;
} else if (mouseClickX >= 113 && mouseClickX <= 151) {
- handleAction(posicioninv + 2);
+ handleAction(inventoryPosition + 2);
break;
} else if (mouseClickX >= 156 && mouseClickX <= 194) {
- handleAction(posicioninv + 3);
+ handleAction(inventoryPosition + 3);
break;
} else if (mouseClickX >= 199 && mouseClickX <= 237) {
- handleAction(posicioninv + 4);
+ handleAction(inventoryPosition + 4);
break;
} else if (mouseClickX >= 242 && mouseClickX <= 280) {
- handleAction(posicioninv + 5);
+ handleAction(inventoryPosition + 5);
break;
} else if (mouseClickX >= 290 && mouseClickX <= 311) {
inventory(1, 33);
break;
} else {
- numeroaccion = 0;
+ actionCode = 0;
action();
}
}
} else if (e.type == Common::EVENT_RBUTTONUP) {
mouseClickX = e.mouse.x;
mouseClickY = e.mouse.y;
- destinox_paso = (mouseClickX + 7) / xGridCount;
- destinoy_paso = (mouseClickY + 7) / yGridCount;
+ destinationStepX = (mouseClickX + 7) / xGridCount;
+ destinationStepY = (mouseClickY + 7) / yGridCount;
contadorpc2 = contadorpc;
- if (destinoy_paso < 28) {
- RoomObjectListEntry obj = *currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[destinox_paso][destinoy_paso]];
+ if (destinationStepY < 28) {
+ RoomObjectListEntry obj = *currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[destinationStepX][destinationStepY]];
if (obj.fileIndex > 0) {
drawLookAtItem(obj);
- goToObject(currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount], currentRoomData->walkAreasGrid[destinox_paso][destinoy_paso]);
+ goToObject(currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount], currentRoomData->walkAreasGrid[destinationStepX][destinationStepY]);
if (obj.fileIndex == 562)
switch (currentRoomData->code) {
case 20:
- if (hornacina[0][hornacina[0][3]] > 0)
- readItemRegister(hornacina[0][hornacina[0][3]]);
+ if (niche[0][niche[0][3]] > 0)
+ readItemRegister(niche[0][niche[0][3]]);
else
readItemRegister(562);
break;
case 24:
- if (hornacina[1][hornacina[1][3]] > 0)
- readItemRegister(hornacina[1][hornacina[1][3]]);
+ if (niche[1][niche[1][3]] > 0)
+ readItemRegister(niche[1][niche[1][3]]);
else
readItemRegister(562);
break;
@@ -405,7 +405,7 @@ int startGame() {
readItemRegister(obj.fileIndex);
if (regobj.lookAtTextRef > 0)
drawText(regobj.lookAtTextRef);
- numeroaccion = 0;
+ actionCode = 0;
}
}
}
@@ -415,7 +415,7 @@ int startGame() {
advanceAnimations(false, true);
// Scene changes
- if (xframe2 == 0 && cambiopantalla) {
+ if (xframe2 == 0 && roomChange) {
sceneChange();
}
@@ -423,8 +423,8 @@ int startGame() {
freeAnimation();
freeScreenObjects();
contadorpc2 = contadorpc;
- partidanueva = false;
- continuarpartida = false;
+ startNewGame = false;
+ continueGame = false;
g_engine->saveAutosaveIfEnabled();
totalFadeOut(0);
g_engine->_sound->fadeOutMusic(musicVolLeft, musicVolRight);
@@ -434,15 +434,15 @@ int startGame() {
initialMenu(true);
verifyCopyProtection2();
- if (partidanueva && !g_engine->shouldQuit()) {
+ if (startNewGame && !g_engine->shouldQuit()) {
newGame();
- } else if (continuarpartida && !g_engine->shouldQuit())
+ } else if (continueGame && !g_engine->shouldQuit())
loadTemporaryGame();
else {
- desactivagrabar = true;
+ isSavingDisabled = true;
g_engine->openMainMenuDialog();
contadorpc = contadorpc2;
- desactivagrabar = false;
+ isSavingDisabled = false;
}
g_engine->_sound->fadeOutMusic(musicVolLeft, musicVolRight);
switch (gamePart) {
@@ -478,24 +478,24 @@ int startGame() {
g_engine->_graphics->clear();
loadObjects();
loadPalette("SEGUNDA");
- indicetray = 0;
+ currentTrajectoryIndex = 0;
characterPosX = 160;
characterPosY = 60;
- trayec[indicetray].x = characterPosX;
- trayec[indicetray].y = characterPosY;
+ trajectory[currentTrajectoryIndex].x = characterPosX;
+ trajectory[currentTrajectoryIndex].y = characterPosY;
loadScreenData(20);
g_engine->_sound->fadeOutMusic(musicVolLeft, musicVolRight);
g_engine->_sound->playMidi("SEGUNDA", true);
g_engine->_sound->fadeInMusic(musicVolLeft, musicVolRight);
screenTransition(1, false, sceneBackground);
mask();
- posicioninv = 0;
+ inventoryPosition = 0;
drawBackpack();
g_engine->_mouseManager->show();
- primera[8] = true;
- oldxrejilla = 0;
- oldyrejilla = 0;
+ firstTimeTopicA[8] = true;
+ oldGridX = 0;
+ oldGridY = 0;
checkMouseGrid();
}
break;
@@ -517,16 +517,16 @@ int startGame() {
}
if (g_engine->_drawObjectAreas) {
- for (int indice = 0; indice < depthLevelCount; indice++) {
- if (screenObjects[indice] != NULL) {
+ for (int i = 0; i < depthLevelCount; i++) {
+ if (screenObjects[i] != NULL) {
if (true) {
// debug
- uint16 w = READ_LE_UINT16(screenObjects[indice]);
- uint16 h = READ_LE_UINT16(screenObjects[indice] + 2);
- Common::Rect r = Common::Rect(depthMap[indice].posx, depthMap[indice].posy, depthMap[indice].posx + w, depthMap[indice].posy + h);
- drawRect(180, depthMap[indice].posx, depthMap[indice].posy, depthMap[indice].posx + w, depthMap[indice].posy + h);
+ uint16 w = READ_LE_UINT16(screenObjects[i]);
+ uint16 h = READ_LE_UINT16(screenObjects[i] + 2);
+ Common::Rect r = Common::Rect(depthMap[i].posx, depthMap[i].posy, depthMap[i].posx + w, depthMap[i].posy + h);
+ drawRect(180, depthMap[i].posx, depthMap[i].posy, depthMap[i].posx + w, depthMap[i].posy + h);
- littText(r.left, r.top, Common::String().format("%d", indice), 0);
+ littText(r.left, r.top, Common::String().format("%d", i), 0);
}
}
}
@@ -543,10 +543,10 @@ int startGame() {
ending();
}
if (!g_engine->shouldQuit()) {
- obtainName(nombreficherofoto);
+ obtainName(photoFileName);
}
if (!g_engine->shouldQuit()) {
- generateDiploma(nombreficherofoto);
+ generateDiploma(photoFileName);
}
if (!g_engine->shouldQuit()) {
credits();
@@ -555,92 +555,92 @@ int startGame() {
}
void sceneChange() {
- cambiopantalla = false;
+ roomChange = false;
contadorpc = contadorpc2;
- setRoomTrajectories(altoanimado, anchoanimado, RESTORE);
+ setRoomTrajectories(secondaryAnimHeight, secondaryAnimWidth, RESTORE);
saveRoomData(currentRoomData, rooms);
// verifyCopyProtection();
g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
- switch (currentRoomData->doors[indicepuertas].nextScene) {
+ switch (currentRoomData->doors[doorIndex].nextScene) {
case 2: {
transitionEffect = Random(15) + 1;
iframe = 0;
- indicetray = 0;
- characterPosX = currentRoomData->doors[indicepuertas].exitPosX - characterCorrectionX;
- characterPosY = currentRoomData->doors[indicepuertas].exitPosY - characerCorrectionY;
- trayec[indicetray].x = characterPosX;
- trayec[indicetray].y = characterPosY;
+ currentTrajectoryIndex = 0;
+ characterPosX = currentRoomData->doors[doorIndex].exitPosX - characterCorrectionX;
+ characterPosY = currentRoomData->doors[doorIndex].exitPosY - characerCorrectionY;
+ trajectory[currentTrajectoryIndex].x = characterPosX;
+ trajectory[currentTrajectoryIndex].y = characterPosY;
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
screenTransition(transitionEffect, true, NULL);
g_engine->_sound->stopVoc();
- loadScreenData(currentRoomData->doors[indicepuertas].nextScene);
+ loadScreenData(currentRoomData->doors[doorIndex].nextScene);
if (contadorpc > 89)
showError(274);
g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
- if (teleencendida)
+ if (isTVOn)
g_engine->_sound->autoPlayVoc("PARASITO", 355778, 20129);
else
cargatele();
screenTransition(transitionEffect, false, sceneBackground);
contadorpc = contadorpc2;
g_engine->_mouseManager->show();
- oldxrejilla = 0;
- oldyrejilla = 0;
+ oldGridX = 0;
+ oldGridY = 0;
} break;
case 5: {
if (currentRoomData->code != 6) {
transitionEffect = Random(15) + 1;
iframe = 0;
- indicetray = 0;
- characterPosX = currentRoomData->doors[indicepuertas].exitPosX - characterCorrectionX;
- characterPosY = currentRoomData->doors[indicepuertas].exitPosY - characerCorrectionY + 15;
- trayec[indicetray].x = characterPosX;
- trayec[indicetray].y = characterPosY;
+ currentTrajectoryIndex = 0;
+ characterPosX = currentRoomData->doors[doorIndex].exitPosX - characterCorrectionX;
+ characterPosY = currentRoomData->doors[doorIndex].exitPosY - characerCorrectionY + 15;
+ trajectory[currentTrajectoryIndex].x = characterPosX;
+ trajectory[currentTrajectoryIndex].y = characterPosY;
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
screenTransition(transitionEffect, true, NULL);
- loadScreenData(currentRoomData->doors[indicepuertas].nextScene);
+ loadScreenData(currentRoomData->doors[doorIndex].nextScene);
g_engine->_sound->stopVoc();
g_engine->_sound->autoPlayVoc("CALDERA", 6433, 15386);
g_engine->_sound->setSfxVolume(leftSfxVol, 0);
screenTransition(transitionEffect, false, sceneBackground);
g_engine->_mouseManager->show();
- oldxrejilla = 0;
- oldyrejilla = 0;
+ oldGridX = 0;
+ oldGridY = 0;
checkMouseGrid();
} else {
- zonaactual = currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount];
- zonadestino = 21;
- goToObject(zonaactual, zonadestino);
+ currentZone = currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount];
+ targetZone = 21;
+ goToObject(currentZone, targetZone);
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
g_engine->_sound->setSfxVolume(leftSfxVol, 0);
- loadScrollData(currentRoomData->doors[indicepuertas].nextScene, true, 22, -2);
+ loadScrollData(currentRoomData->doors[doorIndex].nextScene, true, 22, -2);
g_engine->_mouseManager->show();
- oldxrejilla = 0;
- oldyrejilla = 0;
+ oldGridX = 0;
+ oldGridY = 0;
checkMouseGrid();
}
} break;
case 6: {
- zonaactual = currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount];
- zonadestino = 27;
- goToObject(zonaactual, zonadestino);
+ currentZone = currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount];
+ targetZone = 27;
+ goToObject(currentZone, targetZone);
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
- loadScrollData(currentRoomData->doors[indicepuertas].nextScene, false, 22, 2);
+ loadScrollData(currentRoomData->doors[doorIndex].nextScene, false, 22, 2);
g_engine->_mouseManager->show();
- oldxrejilla = 0;
- oldyrejilla = 0;
+ oldGridX = 0;
+ oldGridY = 0;
checkMouseGrid();
} break;
case 9: {
@@ -650,76 +650,76 @@ void sceneChange() {
g_engine->_mouseManager->hide();
screenTransition(transitionEffect, true, NULL);
iframe = 0;
- indicetray = 0;
- characterPosX = currentRoomData->doors[indicepuertas].exitPosX - characterCorrectionX;
- characterPosY = currentRoomData->doors[indicepuertas].exitPosY - characerCorrectionY;
- trayec[indicetray].x = characterPosX;
- trayec[indicetray].y = characterPosY;
- loadScreenData(currentRoomData->doors[indicepuertas].nextScene);
+ currentTrajectoryIndex = 0;
+ characterPosX = currentRoomData->doors[doorIndex].exitPosX - characterCorrectionX;
+ characterPosY = currentRoomData->doors[doorIndex].exitPosY - characerCorrectionY;
+ trajectory[currentTrajectoryIndex].x = characterPosX;
+ trajectory[currentTrajectoryIndex].y = characterPosY;
+ loadScreenData(currentRoomData->doors[doorIndex].nextScene);
screenTransition(transitionEffect, false, sceneBackground);
g_engine->_mouseManager->show();
- oldxrejilla = 0;
- oldyrejilla = 0;
+ oldGridX = 0;
+ oldGridY = 0;
checkMouseGrid();
} break;
case 12: {
if (currentRoomData->code != 13) {
transitionEffect = Random(15) + 1;
iframe = 0;
- indicetray = 0;
- characterPosX = currentRoomData->doors[indicepuertas].exitPosX - characterCorrectionX;
- characterPosY = currentRoomData->doors[indicepuertas].exitPosY - characerCorrectionY;
- trayec[indicetray].x = characterPosX;
- trayec[indicetray].y = characterPosY;
+ currentTrajectoryIndex = 0;
+ characterPosX = currentRoomData->doors[doorIndex].exitPosX - characterCorrectionX;
+ characterPosY = currentRoomData->doors[doorIndex].exitPosY - characerCorrectionY;
+ trajectory[currentTrajectoryIndex].x = characterPosX;
+ trajectory[currentTrajectoryIndex].y = characterPosY;
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
screenTransition(transitionEffect, true, NULL);
- loadScreenData(currentRoomData->doors[indicepuertas].nextScene);
+ loadScreenData(currentRoomData->doors[doorIndex].nextScene);
screenTransition(transitionEffect, false, sceneBackground);
g_engine->_mouseManager->show();
- oldxrejilla = 0;
- oldyrejilla = 0;
+ oldGridX = 0;
+ oldGridY = 0;
g_engine->_mouseManager->show();
} else {
- zonaactual = currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount];
- goToObject(zonaactual, zonadestino);
+ currentZone = currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount];
+ goToObject(currentZone, targetZone);
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- loadScrollData(currentRoomData->doors[indicepuertas].nextScene, false, 64, 0);
+ loadScrollData(currentRoomData->doors[doorIndex].nextScene, false, 64, 0);
g_engine->_mouseManager->show();
- oldxrejilla = 0;
- oldyrejilla = 0;
+ oldGridX = 0;
+ oldGridY = 0;
checkMouseGrid();
}
} break;
case 13: {
switch (currentRoomData->code) {
case 12: {
- zonaactual = currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount];
- goToObject(zonaactual, zonadestino);
+ currentZone = currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount];
+ goToObject(currentZone, targetZone);
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- loadScrollData(currentRoomData->doors[indicepuertas].nextScene, true, 64, 0);
+ loadScrollData(currentRoomData->doors[doorIndex].nextScene, true, 64, 0);
g_engine->_mouseManager->show();
- oldxrejilla = 0;
- oldyrejilla = 0;
+ oldGridX = 0;
+ oldGridY = 0;
checkMouseGrid();
} break;
case 14: {
- zonaactual = currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount];
- goToObject(zonaactual, zonadestino);
+ currentZone = currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount];
+ goToObject(currentZone, targetZone);
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- loadScrollData(currentRoomData->doors[indicepuertas].nextScene, false, 56, 0);
+ loadScrollData(currentRoomData->doors[doorIndex].nextScene, false, 56, 0);
g_engine->_mouseManager->show();
- oldxrejilla = 0;
- oldyrejilla = 0;
+ oldGridX = 0;
+ oldGridY = 0;
checkMouseGrid();
} break;
}
@@ -728,50 +728,50 @@ void sceneChange() {
if (currentRoomData->code != 13) {
transitionEffect = Random(15) + 1;
iframe = 0;
- indicetray = 0;
- characterPosX = currentRoomData->doors[indicepuertas].exitPosX - characterCorrectionX;
- characterPosY = currentRoomData->doors[indicepuertas].exitPosY - characerCorrectionY;
- trayec[indicetray].x = characterPosX;
- trayec[indicetray].y = characterPosY;
+ currentTrajectoryIndex = 0;
+ characterPosX = currentRoomData->doors[doorIndex].exitPosX - characterCorrectionX;
+ characterPosY = currentRoomData->doors[doorIndex].exitPosY - characerCorrectionY;
+ trajectory[currentTrajectoryIndex].x = characterPosX;
+ trajectory[currentTrajectoryIndex].y = characterPosY;
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
screenTransition(transitionEffect, true, NULL);
- loadScreenData(currentRoomData->doors[indicepuertas].nextScene);
+ loadScreenData(currentRoomData->doors[doorIndex].nextScene);
screenTransition(transitionEffect, false, sceneBackground);
g_engine->_mouseManager->show();
- oldxrejilla = 0;
- oldyrejilla = 0;
+ oldGridX = 0;
+ oldGridY = 0;
checkMouseGrid();
} else {
- zonaactual = currentRoomData->walkAreasGrid[((characterPosX + characterCorrectionX) / xGridCount)][((characterPosY + characerCorrectionY) / yGridCount)];
- goToObject(zonaactual, zonadestino);
+ currentZone = currentRoomData->walkAreasGrid[((characterPosX + characterCorrectionX) / xGridCount)][((characterPosY + characerCorrectionY) / yGridCount)];
+ goToObject(currentZone, targetZone);
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- loadScrollData(currentRoomData->doors[indicepuertas].nextScene, true, 56, 0);
+ loadScrollData(currentRoomData->doors[doorIndex].nextScene, true, 56, 0);
g_engine->_mouseManager->show();
- oldxrejilla = 0;
- oldyrejilla = 0;
+ oldGridX = 0;
+ oldGridY = 0;
checkMouseGrid();
}
} break;
case 17: {
transitionEffect = Random(15) + 1;
iframe = 0;
- indicetray = 0;
- characterPosX = currentRoomData->doors[indicepuertas].exitPosX - characterCorrectionX;
- characterPosY = currentRoomData->doors[indicepuertas].exitPosY - characerCorrectionY;
- trayec[indicetray].x = characterPosX;
- trayec[indicetray].y = characterPosY;
+ currentTrajectoryIndex = 0;
+ characterPosX = currentRoomData->doors[doorIndex].exitPosX - characterCorrectionX;
+ characterPosY = currentRoomData->doors[doorIndex].exitPosY - characerCorrectionY;
+ trajectory[currentTrajectoryIndex].x = characterPosX;
+ trajectory[currentTrajectoryIndex].y = characterPosY;
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
screenTransition(transitionEffect, true, NULL);
g_engine->_sound->stopVoc();
- loadScreenData(currentRoomData->doors[indicepuertas].nextScene);
- if (libro[0] == true && currentRoomData->animationFlag == true)
+ loadScreenData(currentRoomData->doors[doorIndex].nextScene);
+ if (bookTopic[0] == true && currentRoomData->animationFlag == true)
disableSecondAnimation();
if (contadorpc > 89)
showError(274);
@@ -779,40 +779,40 @@ void sceneChange() {
screenTransition(transitionEffect, false, sceneBackground);
contadorpc = contadorpc2;
g_engine->_mouseManager->show();
- oldxrejilla = 0;
- oldyrejilla = 0;
+ oldGridX = 0;
+ oldGridY = 0;
checkMouseGrid();
} break;
case 18: {
if (currentRoomData->code != 19) {
transitionEffect = Random(15) + 1;
iframe = 0;
- indicetray = 0;
- characterPosX = currentRoomData->doors[indicepuertas].exitPosX - characterCorrectionX;
- characterPosY = currentRoomData->doors[indicepuertas].exitPosY - characerCorrectionY;
- trayec[indicetray].x = characterPosX;
- trayec[indicetray].y = characterPosY;
+ currentTrajectoryIndex = 0;
+ characterPosX = currentRoomData->doors[doorIndex].exitPosX - characterCorrectionX;
+ characterPosY = currentRoomData->doors[doorIndex].exitPosY - characerCorrectionY;
+ trajectory[currentTrajectoryIndex].x = characterPosX;
+ trajectory[currentTrajectoryIndex].y = characterPosY;
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
screenTransition(transitionEffect, true, NULL);
- loadScreenData(currentRoomData->doors[indicepuertas].nextScene);
+ loadScreenData(currentRoomData->doors[doorIndex].nextScene);
screenTransition(transitionEffect, false, sceneBackground);
g_engine->_mouseManager->show();
- oldxrejilla = 0;
- oldyrejilla = 0;
+ oldGridX = 0;
+ oldGridY = 0;
checkMouseGrid();
} else {
- zonaactual = currentRoomData->walkAreasGrid[((characterPosX + characterCorrectionX) / xGridCount)][((characterPosY + characerCorrectionY) / yGridCount)];
- goToObject(zonaactual, zonadestino);
+ currentZone = currentRoomData->walkAreasGrid[((characterPosX + characterCorrectionX) / xGridCount)][((characterPosY + characerCorrectionY) / yGridCount)];
+ goToObject(currentZone, targetZone);
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- loadScrollData(currentRoomData->doors[indicepuertas].nextScene, true, 131, -1);
+ loadScrollData(currentRoomData->doors[doorIndex].nextScene, true, 131, -1);
g_engine->_mouseManager->show();
- oldxrejilla = 0;
- oldyrejilla = 0;
+ oldGridX = 0;
+ oldGridY = 0;
checkMouseGrid();
}
} break;
@@ -820,50 +820,50 @@ void sceneChange() {
if (currentRoomData->code != 18) {
transitionEffect = Random(15) + 1;
iframe = 0;
- indicetray = 0;
- characterPosX = currentRoomData->doors[indicepuertas].exitPosX - characterCorrectionX;
- characterPosY = currentRoomData->doors[indicepuertas].exitPosY - characerCorrectionY;
- trayec[indicetray].x = characterPosX;
- trayec[indicetray].y = characterPosY;
+ currentTrajectoryIndex = 0;
+ characterPosX = currentRoomData->doors[doorIndex].exitPosX - characterCorrectionX;
+ characterPosY = currentRoomData->doors[doorIndex].exitPosY - characerCorrectionY;
+ trajectory[currentTrajectoryIndex].x = characterPosX;
+ trajectory[currentTrajectoryIndex].y = characterPosY;
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
screenTransition(transitionEffect, true, NULL);
- loadScreenData(currentRoomData->doors[indicepuertas].nextScene);
+ loadScreenData(currentRoomData->doors[doorIndex].nextScene);
screenTransition(transitionEffect, false, sceneBackground);
g_engine->_mouseManager->show();
- oldxrejilla = 0;
- oldyrejilla = 0;
+ oldGridX = 0;
+ oldGridY = 0;
checkMouseGrid();
} else {
- zonaactual = currentRoomData->walkAreasGrid[((characterPosX + characterCorrectionX) / xGridCount)][((characterPosY + characerCorrectionY) / yGridCount)];
- goToObject(zonaactual, zonadestino);
+ currentZone = currentRoomData->walkAreasGrid[((characterPosX + characterCorrectionX) / xGridCount)][((characterPosY + characerCorrectionY) / yGridCount)];
+ goToObject(currentZone, targetZone);
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- loadScrollData(currentRoomData->doors[indicepuertas].nextScene, false, 131, 1);
+ loadScrollData(currentRoomData->doors[doorIndex].nextScene, false, 131, 1);
g_engine->_mouseManager->show();
- oldxrejilla = 0;
- oldyrejilla = 0;
+ oldGridX = 0;
+ oldGridY = 0;
checkMouseGrid();
}
} break;
case 20: {
transitionEffect = Random(15) + 1;
iframe = 0;
- indicetray = 0;
- characterPosX = currentRoomData->doors[indicepuertas].exitPosX - characterCorrectionX;
- characterPosY = currentRoomData->doors[indicepuertas].exitPosY - characerCorrectionY;
- trayec[indicetray].x = characterPosX;
- trayec[indicetray].y = characterPosY;
+ currentTrajectoryIndex = 0;
+ characterPosX = currentRoomData->doors[doorIndex].exitPosX - characterCorrectionX;
+ characterPosY = currentRoomData->doors[doorIndex].exitPosY - characerCorrectionY;
+ trajectory[currentTrajectoryIndex].x = characterPosX;
+ trajectory[currentTrajectoryIndex].y = characterPosY;
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
screenTransition(transitionEffect, true, NULL);
g_engine->_sound->stopVoc();
- loadScreenData(currentRoomData->doors[indicepuertas].nextScene);
- switch (hornacina[0][hornacina[0][3]]) {
+ loadScreenData(currentRoomData->doors[doorIndex].nextScene);
+ switch (niche[0][niche[0][3]]) {
case 0:
currentRoomData->screenObjectIndex[9]->objectName = getObjectName(4);
break;
@@ -885,25 +885,25 @@ void sceneChange() {
screenTransition(transitionEffect, false, sceneBackground);
contadorpc = contadorpc2;
g_engine->_mouseManager->show();
- oldxrejilla = 0;
- oldyrejilla = 0;
+ oldGridX = 0;
+ oldGridY = 0;
checkMouseGrid();
} break;
case 24: {
transitionEffect = Random(15) + 1;
iframe = 0;
- indicetray = 0;
- characterPosX = currentRoomData->doors[indicepuertas].exitPosX - characterCorrectionX;
- characterPosY = currentRoomData->doors[indicepuertas].exitPosY - characerCorrectionY;
- trayec[indicetray].x = characterPosX;
- trayec[indicetray].y = characterPosY;
+ currentTrajectoryIndex = 0;
+ characterPosX = currentRoomData->doors[doorIndex].exitPosX - characterCorrectionX;
+ characterPosY = currentRoomData->doors[doorIndex].exitPosY - characerCorrectionY;
+ trajectory[currentTrajectoryIndex].x = characterPosX;
+ trajectory[currentTrajectoryIndex].y = characterPosY;
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
screenTransition(transitionEffect, true, NULL);
g_engine->_sound->stopVoc();
- loadScreenData(currentRoomData->doors[indicepuertas].nextScene);
- switch (hornacina[1][hornacina[1][3]]) {
+ loadScreenData(currentRoomData->doors[doorIndex].nextScene);
+ switch (niche[1][niche[1][3]]) {
case 0:
currentRoomData->screenObjectIndex[8]->objectName = getObjectName(4);
break;
@@ -923,35 +923,35 @@ void sceneChange() {
if (contadorpc > 89)
showError(274);
g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
- if (trampa_puesta) {
+ if (isTrapSet) {
currentRoomData->animationFlag = true;
loadAnimation(currentRoomData->animationName);
iframe2 = 0;
- indicetray2 = 1;
- currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].x = 214 - 15;
- currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].y = 115 - 42;
- animado.dir = currentRoomData->secondaryAnimDirections[indicetray2 - 1];
- animado.posx = currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].x;
- animado.posy = currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].y;
- animado.depth = 14;
-
- for (int i = 0; i < maxrejax; i++)
- for (int j = 0; j < maxrejay; j++) {
- if (rejamascaramovto[i][j] > 0) {
- currentRoomData->walkAreasGrid[oldposx + i][oldposy + j] = rejamascaramovto[i][j];
+ currentSecondaryTrajectoryIndex = 1;
+ currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].x = 214 - 15;
+ currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].y = 115 - 42;
+ secondaryAnimation.dir = currentRoomData->secondaryAnimDirections[currentSecondaryTrajectoryIndex - 1];
+ secondaryAnimation.posx = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].x;
+ secondaryAnimation.posy = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].y;
+ secondaryAnimation.depth = 14;
+
+ for (int i = 0; i < maxXGrid; i++)
+ for (int j = 0; j < maxYGrid; j++) {
+ if (maskGridSecondaryAnim[i][j] > 0) {
+ currentRoomData->walkAreasGrid[oldposx + i][oldposy + j] = maskGridSecondaryAnim[i][j];
}
- if (rejamascararaton[i][j] > 0)
- currentRoomData->mouseGrid[oldposx + i][oldposy + j] = rejamascararaton[i][j];
+ if (maskMouseSecondaryAnim[i][j] > 0)
+ currentRoomData->mouseGrid[oldposx + i][oldposy + j] = maskMouseSecondaryAnim[i][j];
}
assembleScreen();
}
screenTransition(transitionEffect, false, sceneBackground);
- if ((rojo_capturado == false) && (trampa_puesta == false))
+ if ((isRedDevilCaptured == false) && (isTrapSet == false))
runaroundRed();
contadorpc = contadorpc2;
g_engine->_mouseManager->show();
- oldxrejilla = 0;
- oldyrejilla = 0;
+ oldGridX = 0;
+ oldGridY = 0;
checkMouseGrid();
} break;
case 255:
@@ -960,17 +960,17 @@ void sceneChange() {
default: {
transitionEffect = Random(15) + 1;
iframe = 0;
- indicetray = 0;
- characterPosX = currentRoomData->doors[indicepuertas].exitPosX - characterCorrectionX;
- characterPosY = currentRoomData->doors[indicepuertas].exitPosY - characerCorrectionY;
- trayec[indicetray].x = characterPosX;
- trayec[indicetray].y = characterPosY;
+ currentTrajectoryIndex = 0;
+ characterPosX = currentRoomData->doors[doorIndex].exitPosX - characterCorrectionX;
+ characterPosY = currentRoomData->doors[doorIndex].exitPosY - characerCorrectionY;
+ trajectory[currentTrajectoryIndex].x = characterPosX;
+ trajectory[currentTrajectoryIndex].y = characterPosY;
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
screenTransition(transitionEffect, true, NULL);
g_engine->_sound->stopVoc();
- loadScreenData(currentRoomData->doors[indicepuertas].nextScene);
+ loadScreenData(currentRoomData->doors[doorIndex].nextScene);
if (contadorpc > 89)
showError(274);
g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
@@ -985,11 +985,11 @@ void sceneChange() {
screenTransition(transitionEffect, false, sceneBackground);
contadorpc = contadorpc2;
g_engine->_mouseManager->show();
- oldxrejilla = 0;
- oldyrejilla = 0;
+ oldGridX = 0;
+ oldGridY = 0;
checkMouseGrid();
}
}
- oldzonadestino = 0;
+ oldTargetZone = 0;
}
} // end of namespace Tot
diff --git a/engines/tot/playanim.cpp b/engines/tot/playanim.cpp
index 7044f3b5792..dd3abe61c63 100644
--- a/engines/tot/playanim.cpp
+++ b/engines/tot/playanim.cpp
@@ -42,99 +42,91 @@ uint mouseClickX, mouseClickY;
uint npraton2, npraton;
-uint oldxrejilla, oldyrejilla;
-
-SavedGame regpartida;
-
-bool sello_quitado;
-
-bool cambiopantalla;
-bool teleencendida,
- vasijapuesta,
- guadagna,
- tridente,
- torno,
- barro,
- diablillo_verde,
- rojo_capturado,
- manual_torno,
- alacena_abierta,
- baul_abierto,
- trampa_puesta,
- peteractivo;
+uint oldGridX, oldGridY;
+
+SavedGame savedGame;
+
+bool isSealRemoved;
+
+bool roomChange;
+bool isTVOn,
+ isVasePlaced,
+ isScytheTaken,
+ isTridentTaken,
+ isPottersWheelDelivered,
+ isMudDelivered,
+ isGreenDevilDelivered,
+ isRedDevilCaptured,
+ isPottersManualDelivered,
+ isCupboardOpen,
+ isChestOpen,
+ isTrapSet,
+ isPeterCoughing;
bool inGame;
-bool hechaprimeravez;
+bool firstTimeDone;
-bool introSeen;
+bool isIntroSeen;
-bool salirdeljuego;
+bool shouldQuitGame;
-bool partidanueva;
+bool startNewGame;
-bool continuarpartida;
+bool continueGame;
-bool desactivagrabar;
+bool isSavingDisabled;
-bool pintaractivo;
+bool isDrawingEnabled;
-bool animacion2;
+bool isSecondaryAnimationEnabled;
palette palAnimSlice;
palette pal;
-reginventario mobj[inventoryIconCount];
+InventoryEntry mobj[inventoryIconCount];
byte *mochilaxms[inventoryIconCount];
byte saltospal;
-byte posicioninv;
+byte inventoryPosition;
-byte numeroaccion;
+byte actionCode;
-byte oldnumeroacc;
+byte oldActionCode;
-byte pasos;
+byte steps;
-byte indicepuertas;
+byte doorIndex;
-byte movidapaleta;
-
-byte rejillaquetoca;
+byte isPaletteAnimEnabled;
byte gamePart;
-byte encripcod1;
byte secondaryAnimationFrameCount;
-byte numerodir;
+byte secondaryAnimDirCount;
byte contadorpc, contadorpc2;
-byte indaux1, indaux2;
-
-byte destinox_paso, destinoy_paso;
+byte destinationStepX, destinationStepY;
-byte direccionmovimiento;
+byte characterFacingDir;
-uint anchoanimado, altoanimado;
+uint secondaryAnimWidth, secondaryAnimHeight;
-uint tiempo;
+uint backpackObjectCode;
-uint codigoobjmochila;
-
-uint kaka;
+uint foo;
uint oldposx, oldposy;
uint rightSfxVol, leftSfxVol;
-uint segpasoicono;
-uint ofspasoicono;
+
uint musicVolRight, musicVolLeft;
-int elemento1, elemento2;
+int element1, element2;
int characterPosX, characterPosY;
@@ -142,16 +134,16 @@ int xframe2, yframe2;
Common::File verb;
-Common::String oldobjmochila, objetomochila;
+Common::String oldInventoryObjectName, inventoryObjectName;
-Common::String nombreficherofoto;
+Common::String photoFileName;
Common::String characterName;
// Text decryption key
Common::String decryptionKey;
-uint hornacina[2][4];
+uint niche[2][4];
RoomFileRegister *currentRoomData;
@@ -159,49 +151,43 @@ ScreenObject regobj;
route mainRoute;
-Common::Point trayec[300];
+Common::Point trajectory[300];
-uint longtray;
+uint trajectoryLength;
-uint indicetray;
+uint currentTrajectoryIndex;
-uint indicetray2;
+uint currentSecondaryTrajectoryIndex;
-byte zonaactual, zonadestino, oldzonadestino;
+byte currentZone, targetZone, oldTargetZone;
-byte maxrejax, maxrejay;
+byte maxXGrid, maxYGrid;
-byte rejafondomovto[10][10];
+byte movementGridForSecondaryAnim[10][10];
-byte rejafondoraton[10][10];
+byte mouseGridForSecondaryAnim[10][10];
-byte rejamascaramovto[10][10];
+byte maskGridSecondaryAnim[10][10];
-byte rejamascararaton[10][10];
+byte maskMouseSecondaryAnim[10][10];
bool list1Complete, list2Complete,
- lista1, lista2;
+ obtainedList1, obtainedList2;
-bool primera[characterCount],
- lprimera[characterCount],
- cprimera[characterCount],
- libro[characterCount],
- caramelos[characterCount];
+bool firstTimeTopicA[characterCount],
+ firstTimeTopicB[characterCount],
+ firstTimeTopicC[characterCount],
+ bookTopic[characterCount],
+ mintTopic[characterCount];
-bool cavernas[5];
+bool caves[5];
uint16 firstList[5], secondList[5];
-CharacterAnim secuencia;
-SecondaryAnim animado;
-uint sizeframe,
- segpasoframe,
- ofspasoframe,
- sizeanimado,
- segpasoanimado,
- ofspasoanimado,
- segfondo,
- offfondo;
+CharacterAnim mainCharAnimation;
+SecondaryAnim secondaryAnimation;
+uint mainCharFrameSize,
+ secondaryAnimFrameSize;
byte maxSecondaryAnimationFrames;
@@ -232,7 +218,6 @@ bool isLoadingFromLauncher;
bool saveAllowed = true;
void clearObj() {
- byte indpasolimpiador1, indpasolimpiador2;
regobj.code = 0;
regobj.height = 0;
@@ -245,8 +230,8 @@ void clearObj() {
regobj.habla = 0;
regobj.openable = false;
regobj.closeable = false;
- for (indpasolimpiador1 = 0; indpasolimpiador1 <= 7; indpasolimpiador1++)
- regobj.used[indpasolimpiador1] = 0;
+ for (int i = 0; i <= 7; i++)
+ regobj.used[i] = 0;
regobj.pickupable = false;
regobj.useWith = 0;
regobj.replaceWith = 0;
@@ -264,10 +249,10 @@ void clearObj() {
regobj.yrej1 = 0;
regobj.xrej2 = 0;
regobj.yrej2 = 0;
- for (indpasolimpiador1 = 0; indpasolimpiador1 < 10; indpasolimpiador1++) {
- for (indpasolimpiador2 = 0; indpasolimpiador2 < 10; indpasolimpiador2++) {
- regobj.walkAreasPatch[indpasolimpiador1][indpasolimpiador2] = 0;
- regobj.mouseGridPatch[indpasolimpiador1][indpasolimpiador2] = 0;
+ for (int i = 0; i < 10; i++) {
+ for (int j = 0; j < 10; j++) {
+ regobj.walkAreasPatch[i][j] = 0;
+ regobj.mouseGridPatch[i][j] = 0;
}
}
contadorpc2 = contadorpc;
@@ -318,117 +303,117 @@ void resetGameState() {
characterPosX = 160;
characterPosY = 80;
iframe = 0;
- trayec[0].x = characterPosX;
- trayec[0].y = characterPosY;
+ trajectory[0].x = characterPosX;
+ trajectory[0].y = characterPosY;
xframe2 = 0;
yframe2 = 1;
- zonaactual = 1;
- zonadestino = 1;
- oldzonadestino = 0;
- direccionmovimiento = 1;
- primera[0] = true;
- primera[1] = true;
- primera[2] = true;
- primera[3] = true;
- primera[4] = true;
- primera[5] = true;
- primera[6] = true;
- primera[7] = true;
- primera[8] = true;
- lprimera[0] = false;
- lprimera[1] = false;
- lprimera[2] = false;
- lprimera[3] = false;
- lprimera[4] = false;
- lprimera[5] = false;
- lprimera[6] = false;
- lprimera[7] = false;
- lprimera[8] = false;
-
- cprimera[0] = false;
- cprimera[1] = false;
- cprimera[2] = false;
- cprimera[3] = false;
- cprimera[4] = false;
- cprimera[5] = false;
- cprimera[6] = false;
- cprimera[7] = false;
- cprimera[8] = false;
-
- libro[0] = false;
- libro[1] = false;
- libro[2] = false;
- libro[3] = false;
- libro[4] = false;
- libro[5] = false;
- libro[6] = false;
- libro[7] = false;
- libro[8] = false;
-
- caramelos[0] = false;
- caramelos[1] = false;
- caramelos[2] = false;
- caramelos[3] = false;
- caramelos[4] = false;
- caramelos[5] = false;
- caramelos[6] = false;
- caramelos[7] = false;
- caramelos[8] = false;
-
- cavernas[0] = false;
- cavernas[1] = false;
- cavernas[2] = false;
- cavernas[3] = false;
- cavernas[4] = false;
-
- animacion2 = false;
- secuencia.depth = 0;
+ currentZone = 1;
+ targetZone = 1;
+ oldTargetZone = 0;
+ characterFacingDir = 1;
+ firstTimeTopicA[0] = true;
+ firstTimeTopicA[1] = true;
+ firstTimeTopicA[2] = true;
+ firstTimeTopicA[3] = true;
+ firstTimeTopicA[4] = true;
+ firstTimeTopicA[5] = true;
+ firstTimeTopicA[6] = true;
+ firstTimeTopicA[7] = true;
+ firstTimeTopicA[8] = true;
+ firstTimeTopicB[0] = false;
+ firstTimeTopicB[1] = false;
+ firstTimeTopicB[2] = false;
+ firstTimeTopicB[3] = false;
+ firstTimeTopicB[4] = false;
+ firstTimeTopicB[5] = false;
+ firstTimeTopicB[6] = false;
+ firstTimeTopicB[7] = false;
+ firstTimeTopicB[8] = false;
+
+ firstTimeTopicC[0] = false;
+ firstTimeTopicC[1] = false;
+ firstTimeTopicC[2] = false;
+ firstTimeTopicC[3] = false;
+ firstTimeTopicC[4] = false;
+ firstTimeTopicC[5] = false;
+ firstTimeTopicC[6] = false;
+ firstTimeTopicC[7] = false;
+ firstTimeTopicC[8] = false;
+
+ bookTopic[0] = false;
+ bookTopic[1] = false;
+ bookTopic[2] = false;
+ bookTopic[3] = false;
+ bookTopic[4] = false;
+ bookTopic[5] = false;
+ bookTopic[6] = false;
+ bookTopic[7] = false;
+ bookTopic[8] = false;
+
+ mintTopic[0] = false;
+ mintTopic[1] = false;
+ mintTopic[2] = false;
+ mintTopic[3] = false;
+ mintTopic[4] = false;
+ mintTopic[5] = false;
+ mintTopic[6] = false;
+ mintTopic[7] = false;
+ mintTopic[8] = false;
+
+ caves[0] = false;
+ caves[1] = false;
+ caves[2] = false;
+ caves[3] = false;
+ caves[4] = false;
+
+ isSecondaryAnimationEnabled = false;
+ mainCharAnimation.depth = 0;
rightSfxVol = 6;
leftSfxVol = 6;
musicVolRight = 3;
musicVolLeft = 3;
- pintaractivo = true;
- desactivagrabar = false;
- partidanueva = false;
- salirdeljuego = false;
- lista1 = false;
- lista2 = false;
+ isDrawingEnabled = true;
+ isSavingDisabled = false;
+ startNewGame = false;
+ shouldQuitGame = false;
+ obtainedList1 = false;
+ obtainedList2 = false;
list1Complete = false;
list2Complete = false;
- movidapaleta = 0;
+ isPaletteAnimEnabled = 0;
gamePart = 1;
- vasijapuesta = false;
- guadagna = false;
- tridente = false;
- torno = false;
- barro = false;
- sello_quitado = false;
+ isVasePlaced = false;
+ isScytheTaken = false;
+ isTridentTaken = false;
+ isPottersWheelDelivered = false;
+ isMudDelivered = false;
+ isSealRemoved = false;
- diablillo_verde = false;
- rojo_capturado = false;
- alacena_abierta = false;
- baul_abierto = false;
+ isGreenDevilDelivered = false;
+ isRedDevilCaptured = false;
+ isCupboardOpen = false;
+ isChestOpen = false;
- teleencendida = false;
- trampa_puesta = false;
+ isTVOn = false;
+ isTrapSet = false;
saltospal = 0;
- hornacina[0][0] = 563;
- hornacina[0][1] = 561;
- hornacina[0][2] = 0;
- hornacina[0][3] = 2;
+ niche[0][0] = 563;
+ niche[0][1] = 561;
+ niche[0][2] = 0;
+ niche[0][3] = 2;
- hornacina[1][0] = 615;
- hornacina[1][1] = 622;
- hornacina[1][2] = 623;
- hornacina[1][3] = 0;
+ niche[1][0] = 615;
+ niche[1][1] = 622;
+ niche[1][2] = 623;
+ niche[1][3] = 0;
- indicetray = 0;
- posicioninv = 0;
+ currentTrajectoryIndex = 0;
+ inventoryPosition = 0;
}
void initPlayAnim() {
@@ -721,9 +706,9 @@ void initPlayAnim() {
secondList[4] = 537;
contadorpc = 0;
contadorpc2 = 0;
- continuarpartida = true;
- hechaprimeravez = false;
- introSeen = false;
+ continueGame = true;
+ firstTimeDone = false;
+ isIntroSeen = false;
inGame = false;
}
@@ -755,16 +740,16 @@ void clearVars() {
}
for(int i = 0; i < 4; i++) {
for(int j = 0; j < walkFrameCount + 30; j++) {
- if(secuencia.bitmap[i][j] != NULL) {
- free(secuencia.bitmap[i][j]);
+ if(mainCharAnimation.bitmap[i][j] != NULL) {
+ free(mainCharAnimation.bitmap[i][j]);
}
}
}
for (int i = 0; i < 4; i++) {
for (int j = 0; j < secAnimationFrameCount; j++) {
- if(animado.bitmap[i][j] != NULL){
- free(animado.bitmap[i][j]);
+ if(secondaryAnimation.bitmap[i][j] != NULL){
+ free(secondaryAnimation.bitmap[i][j]);
}
}
}
diff --git a/engines/tot/playanim.h b/engines/tot/playanim.h
index 907b931803f..bd612f64be1 100644
--- a/engines/tot/playanim.h
+++ b/engines/tot/playanim.h
@@ -102,7 +102,7 @@ struct SecondaryAnim {
byte *bitmap[4][secAnimationFrameCount];
};
-struct reginventario {
+struct InventoryEntry {
uint16 bitmapIndex;
uint16 code;
Common::String objectName;
@@ -111,7 +111,7 @@ struct reginventario {
/**
* Hypertext struct
*/
-struct regismht {
+struct TextEntry {
Common::String text; // string
bool continued; // true if the next entry is a continuation of this one
uint16 response; // entry number of reply
@@ -206,70 +206,71 @@ struct RoomFileRegister {
};
struct SavedGame {
- uint numeropantalla,
- longtray,
- indicetray,
- codigoobjmochila,
- volumenfxderecho,
- volumenfxizquierdo,
- volumenmelodiaderecho,
- volumenmelodiaizquierdo,
- oldxrejilla,
- oldyrejilla,
- animadoprofundidad,
- animadodir,
- animadoposx,
- animadoposy,
- animadoiframe2;
- byte zonaactual,
- zonadestino,
- oldzonadestino,
- posicioninv,
- numeroaccion,
- oldnumeroacc,
- pasos,
- indicepuertas,
- direccionmovimiento,
+ uint roomCode,
+ trajectoryLength,
+ currentTrajectoryIndex,
+ backpackObjectCode,
+ rightSfxVol,
+ leftSfxVol,
+ musicVolRight,
+ musicVolLeft,
+ oldGridX,
+ oldGridY,
+ secAnimDepth,
+ secAnimDir,
+ secAnimX,
+ secAnimY,
+ secAnimIFrame;
+ byte currentZone,
+ targetZone,
+ oldTargetZone,
+ inventoryPosition,
+ actionCode,
+ oldActionCode,
+ steps,
+ doorIndex,
+ characterFacingDir,
iframe,
- parte_del_juego;
- bool sello_quitado,
- manual_torno,
- lista1,
- lista2,
- completadalista1,
- completadalista2,
- vasijapuesta,
- guadagna,
- tridente,
- torno,
- barro,
- diablillo_verde,
- alacena_abierta,
- baul_abierto,
- teleencendida,
- trampa_puesta,
- rojo_capturado;
- reginventario mobj[inventoryIconCount];
- int elemento1,
- elemento2,
- xframe,
- yframe,
+ gamePart;
+ bool isSealRemoved,
+ isPottersManualDelivered,
+ obtainedList1,
+ obtainedList2,
+ list1Complete,
+ list2Complete,
+ isVasePlaced,
+ isScytheTaken,
+ isTridentTaken,
+ isPottersWheelDelivered,
+ isMudDelivered,
+ isGreenDevilDelivered,
+ isCupboardOpen,
+ isChestOpen,
+ isTVOn,
+ isTrapSet,
+ isRedDevilCaptured;
+ InventoryEntry mobj[inventoryIconCount];
+ int element1,
+ element2,
+ characterPosX,
+ characterPosY,
xframe2,
yframe2;
- Common::String oldobjmochila,
- objetomochila;
- Common::String nombrepersonaje;
+ Common::String oldInventoryObjectName,
+ objetomoinventoryObjectNamehila;
+ Common::String characterName;
route mainRoute;
uint16 firstList[5], secondList[5];
- Common::Point trayec[300];
- bool primera[characterCount],
- lprimera[characterCount],
- cprimera[characterCount],
- libro[characterCount],
- caramelos[characterCount];
-
- bool cavernas[5];
- uint hornacina[2][4];
+ Common::Point trajectory[300];
+ // Conversation topic unlocks
+ bool firstTimeTopicA[characterCount],
+ firstTimeTopicB[characterCount],
+ firstTimeTopicC[characterCount],
+ bookTopic[characterCount],
+ mintTopic[characterCount];
+
+ bool caves[5];
+ uint niche[2][4];
};
typedef byte palette[768];
@@ -297,29 +298,29 @@ extern uint npraton2, npraton;
/**
* Previous positions of the mouse within the screen grid
*/
-extern uint oldxrejilla, oldyrejilla;
+extern uint oldGridX, oldGridY;
-extern SavedGame regpartida;
+extern SavedGame savedGame;
-extern bool sello_quitado;
+extern bool isSealRemoved;
/**
* Flag to enable screen/room change
*/
-extern bool cambiopantalla;
-extern bool teleencendida,
- vasijapuesta,
- guadagna,
- tridente,
- torno,
- barro,
- diablillo_verde,
- rojo_capturado,
- manual_torno,
- alacena_abierta,
- baul_abierto,
- trampa_puesta,
- peteractivo;
+extern bool roomChange;
+extern bool isTVOn,
+ isVasePlaced,
+ isScytheTaken,
+ isTridentTaken,
+ isPottersWheelDelivered,
+ isMudDelivered,
+ isGreenDevilDelivered,
+ isRedDevilCaptured,
+ isPottersManualDelivered,
+ isCupboardOpen,
+ isChestOpen,
+ isTrapSet,
+ isPeterCoughing;
/**
* Flag for temporary savegame
@@ -328,35 +329,35 @@ extern bool inGame;
/**
* Flag for first time run of the game.
*/
-extern bool hechaprimeravez;
+extern bool firstTimeDone;
-extern bool introSeen;
+extern bool isIntroSeen;
/**
* Flag to exit program.
*/
-extern bool salirdeljuego;
+extern bool shouldQuitGame;
/**
* Flag to initialize game
*/
-extern bool partidanueva;
+extern bool startNewGame;
/**
* Flag to resume game
*/
-extern bool continuarpartida;
+extern bool continueGame;
/**
* Flag to load a game upon start.
*/
-extern bool desactivagrabar;
+extern bool isSavingDisabled;
/**
* true if sprites should be drawn
*/
-extern bool pintaractivo;
+extern bool isDrawingEnabled;
/**
* Flag for secondary animation
*/
-extern bool animacion2;
+extern bool isSecondaryAnimationEnabled;
/**
* 54 color palette slice.
*/
@@ -369,7 +370,7 @@ extern palette pal;
/**
* These are the icons currnetly in the inventory
*/
-extern reginventario mobj[inventoryIconCount];
+extern InventoryEntry mobj[inventoryIconCount];
/**
* Keeps an array of all inventory icon bitmaps
*/
@@ -382,36 +383,31 @@ extern byte saltospal;
/**
* Position within inventory
*/
-extern byte posicioninv;
+extern byte inventoryPosition;
/**
* Currently selected action.
*/
-extern byte numeroaccion;
+extern byte actionCode;
/**
* Previously selected action.
*/
-extern byte oldnumeroacc;
+extern byte oldActionCode;
/**
* Number of trajectory changes
*/
-extern byte pasos;
+extern byte steps;
/**
* index of currently selected door.
*/
-extern byte indicepuertas;
+extern byte doorIndex;
/**
* Aux for palette animation
*/
-extern byte movidapaleta;
-/**
- * Index of patch for grid within XMS
- */
-extern byte rejillaquetoca;
+extern byte isPaletteAnimEnabled;
/**
* 1 first part, 2 second part
*/
extern byte gamePart;
-extern byte encripcod1;
/**
* Number of frames of secondary animation
*/
@@ -419,19 +415,15 @@ extern byte secondaryAnimationFrameCount;
/**
* Number of directions of the secondary animation
*/
-extern byte numerodir;
+extern byte secondaryAnimDirCount;
/**
* Data protection control
*/
extern byte contadorpc, contadorpc2;
-/**
- * Auxiliary indices
- */
-extern byte indaux1, indaux2;
/**
* Coordinates of target step
*/
-extern byte destinox_paso, destinoy_paso;
+extern byte destinationStepX, destinationStepY;
/**
* Current character facing direction
* 0: upwards
@@ -439,37 +431,31 @@ extern byte destinox_paso, destinoy_paso;
* 2: downwards
* 3: left
*/
-extern byte direccionmovimiento;
+extern byte characterFacingDir;
/**
* Width and height of secondary animation
*/
-extern uint anchoanimado, altoanimado;
-/**
- * Time window between candle decrease
- */
-extern uint tiempo;
+extern uint secondaryAnimWidth, secondaryAnimHeight;
/**
* Code of selected object in the backpack
*/
-extern uint codigoobjmochila;
+extern uint backpackObjectCode;
/**
* Foo
*/
-extern uint kaka;
+extern uint foo;
/**
* Auxiliary vars for grid update
*/
extern uint oldposx, oldposy;
extern uint rightSfxVol, leftSfxVol;
-extern uint segpasoicono;
-extern uint ofspasoicono;
extern uint musicVolRight, musicVolLeft;
/**
* Amplitude of movement
*/
-extern int elemento1, elemento2;
+extern int element1, element2;
/**
* Current position of the main character
*/
@@ -485,9 +471,9 @@ extern Common::File verb;
/**
* Auxiliary vars with current inventory object name.
*/
-extern Common::String oldobjmochila, objetomochila;
+extern Common::String oldInventoryObjectName, inventoryObjectName;
-extern Common::String nombreficherofoto;
+extern Common::String photoFileName;
/**
* Name of player
*/
@@ -495,7 +481,7 @@ extern Common::String characterName;
extern Common::String decryptionKey;
-extern uint hornacina[2][4];
+extern uint niche[2][4];
extern RoomFileRegister *currentRoomData;
@@ -507,59 +493,59 @@ extern route mainRoute;
/**
* Matrix of positions for a trajectory between two points
*/
-extern Common::Point trayec[300];
+extern Common::Point trajectory[300];
/**
* Longitude of the trajectory matrix.
*/
-extern uint longtray;
+extern uint trajectoryLength;
/**
* Position within the trajectory matrix
*/
-extern uint indicetray;
+extern uint currentTrajectoryIndex;
/**
* Position within the trajectory matrix for secondary animation
*/
-extern uint indicetray2;
+extern uint currentSecondaryTrajectoryIndex;
/**
* Screen areas
*/
-extern byte zonaactual, zonadestino, oldzonadestino;
+extern byte currentZone, targetZone, oldTargetZone;
/**
* Amplitude of grid slices
*/
-extern byte maxrejax, maxrejay;
+extern byte maxXGrid, maxYGrid;
/**
* capture of movement grid of secondary animation
*/
-extern byte rejafondomovto[10][10];
+extern byte movementGridForSecondaryAnim[10][10];
/**
* capture of mouse grid of secondary animation
*/
-extern byte rejafondoraton[10][10];
+extern byte mouseGridForSecondaryAnim[10][10];
/**
* movement mask for grid of secondary animation
*/
-extern byte rejamascaramovto[10][10];
+extern byte maskGridSecondaryAnim[10][10];
/**
* mouse mask for grid of secondary animation
*/
-extern byte rejamascararaton[10][10];
+extern byte maskMouseSecondaryAnim[10][10];
extern bool list1Complete,
list2Complete,
- lista1, // whether we've been given list 1
- lista2; // whether we've been given list 2
+ obtainedList1, // whether we've been given list 1
+ obtainedList2; // whether we've been given list 2
-extern bool primera[characterCount],
- lprimera[characterCount],
- cprimera[characterCount],
- libro[characterCount],
- caramelos[characterCount];
+extern bool firstTimeTopicA[characterCount],
+ firstTimeTopicB[characterCount],
+ firstTimeTopicC[characterCount],
+ bookTopic[characterCount],
+ mintTopic[characterCount];
-extern bool cavernas[5];
+extern bool caves[5];
/**
* First and second lists of objects to retrieve in the game
*/
@@ -568,9 +554,10 @@ extern uint16 firstList[5],
/**
* Animation sequence
*/
-extern CharacterAnim secuencia;
-extern SecondaryAnim animado;
-extern uint sizeframe, sizeanimado;
+extern CharacterAnim mainCharAnimation;
+extern uint mainCharFrameSize;
+extern SecondaryAnim secondaryAnimation;
+extern uint secondaryAnimFrameSize;
/**
* Max num of loaded frames for secondary animation
*/
diff --git a/engines/tot/routines.cpp b/engines/tot/routines.cpp
index 17446599315..469e073dfd8 100644
--- a/engines/tot/routines.cpp
+++ b/engines/tot/routines.cpp
@@ -31,7 +31,7 @@ namespace Tot {
void drawText(uint numero) {
assignText();
- hypertext(numero, 255, 0, kaka, false);
+ hypertext(numero, 255, 0, foo, false);
verb.close();
}
@@ -83,7 +83,7 @@ void runaroundRed() {
itrayseg = 0;
longtrayseg = 82;
iframe2 = 0;
- animacion2 = true;
+ isSecondaryAnimationEnabled = true;
do {
g_engine->_chrono->updateChrono();
if (tocapintar) {
@@ -94,20 +94,20 @@ void runaroundRed() {
iframe2 = 0;
else
iframe2++;
- animado.posx = trayseg[itrayseg][0] - 15;
- animado.posy = trayseg[itrayseg][1] - 42;
+ secondaryAnimation.posx = trayseg[itrayseg][0] - 15;
+ secondaryAnimation.posy = trayseg[itrayseg][1] - 42;
if (itrayseg >= 0 && itrayseg <= 8) {
- animado.dir = 2;
- animado.depth = 1;
+ secondaryAnimation.dir = 2;
+ secondaryAnimation.depth = 1;
} else if (itrayseg >= 9 && itrayseg <= 33) {
- animado.dir = 2;
- animado.depth = 14;
+ secondaryAnimation.dir = 2;
+ secondaryAnimation.depth = 14;
} else if (itrayseg >= 34 && itrayseg <= 63) {
- animado.dir = 1;
- animado.depth = 14;
+ secondaryAnimation.dir = 1;
+ secondaryAnimation.depth = 14;
} else {
- animado.dir = 0;
- animado.depth = 3;
+ secondaryAnimation.dir = 0;
+ secondaryAnimation.depth = 3;
}
tocapintar2 = true;
@@ -115,11 +115,11 @@ void runaroundRed() {
tocapintar = false;
if (saltospal >= 4) {
saltospal = 0;
- if (movidapaleta > 6)
- movidapaleta = 0;
+ if (isPaletteAnimEnabled > 6)
+ isPaletteAnimEnabled = 0;
else
- movidapaleta += 1;
- updatePalette(movidapaleta);
+ isPaletteAnimEnabled += 1;
+ updatePalette(isPaletteAnimEnabled);
} else
saltospal += 1;
g_engine->_screen->update();
@@ -135,31 +135,31 @@ void updateMovementCells() {
uint j1arm, j2arm;
byte i1arm, i2arm;
- j1arm = (currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].x / xGridCount) + 1;
- j2arm = (currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].y / yGridCount) + 1;
+ j1arm = (currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].x / xGridCount) + 1;
+ j2arm = (currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].y / yGridCount) + 1;
if ((oldposx != j1arm) || (oldposy != j2arm)) {
- for (i1arm = 0; i1arm < maxrejax; i1arm++)
- for (i2arm = 0; i2arm < maxrejay; i2arm++) {
- currentRoomData->walkAreasGrid[oldposx + i1arm][oldposy + i2arm] = rejafondomovto[i1arm][i2arm];
- currentRoomData->mouseGrid[oldposx + i1arm][oldposy + i2arm] = rejafondoraton[i1arm][i2arm];
+ for (i1arm = 0; i1arm < maxXGrid; i1arm++)
+ for (i2arm = 0; i2arm < maxYGrid; i2arm++) {
+ currentRoomData->walkAreasGrid[oldposx + i1arm][oldposy + i2arm] = movementGridForSecondaryAnim[i1arm][i2arm];
+ currentRoomData->mouseGrid[oldposx + i1arm][oldposy + i2arm] = mouseGridForSecondaryAnim[i1arm][i2arm];
}
- for (i1arm = 0; i1arm < maxrejax; i1arm++)
- for (i2arm = 0; i2arm < maxrejay; i2arm++) {
- rejafondomovto[i1arm][i2arm] = currentRoomData->walkAreasGrid[j1arm + i1arm][j2arm + i2arm];
- if (rejamascaramovto[i1arm][i2arm] > 0)
- currentRoomData->walkAreasGrid[j1arm + i1arm][j2arm + i2arm] = rejamascaramovto[i1arm][i2arm];
+ for (i1arm = 0; i1arm < maxXGrid; i1arm++)
+ for (i2arm = 0; i2arm < maxYGrid; i2arm++) {
+ movementGridForSecondaryAnim[i1arm][i2arm] = currentRoomData->walkAreasGrid[j1arm + i1arm][j2arm + i2arm];
+ if (maskGridSecondaryAnim[i1arm][i2arm] > 0)
+ currentRoomData->walkAreasGrid[j1arm + i1arm][j2arm + i2arm] = maskGridSecondaryAnim[i1arm][i2arm];
- rejafondoraton[i1arm][i2arm] = currentRoomData->mouseGrid[j1arm + i1arm][j2arm + i2arm];
- if (rejamascararaton[i1arm][i2arm] > 0)
- currentRoomData->mouseGrid[j1arm + i1arm][j2arm + i2arm] = rejamascararaton[i1arm][i2arm];
+ mouseGridForSecondaryAnim[i1arm][i2arm] = currentRoomData->mouseGrid[j1arm + i1arm][j2arm + i2arm];
+ if (maskMouseSecondaryAnim[i1arm][i2arm] > 0)
+ currentRoomData->mouseGrid[j1arm + i1arm][j2arm + i2arm] = maskMouseSecondaryAnim[i1arm][i2arm];
}
oldposx = j1arm;
oldposy = j2arm;
- oldxrejilla = 0;
- oldyrejilla = 0;
+ oldGridX = 0;
+ oldGridY = 0;
}
}
@@ -291,7 +291,7 @@ void drawMainCharacter() {
while (indice != depthLevelCount) {
overlayObject();
- if (secuencia.depth == indice)
+ if (mainCharAnimation.depth == indice)
assembleImage(curCharacterAnimationFrame, characterPosX, characterPosY);
indice += 1;
}
@@ -316,19 +316,19 @@ void drawMainCharacter() {
void sprites(bool pintapersonaje) {
// grabs the current frame from the walk cycle
- curCharacterAnimationFrame = secuencia.bitmap[direccionmovimiento][iframe];
+ curCharacterAnimationFrame = mainCharAnimation.bitmap[characterFacingDir][iframe];
posfondox = characterPosX - 3;
posfondoy = characterPosY - 3;
- if (animacion2) {
+ if (isSecondaryAnimationEnabled) {
if (currentRoomData->secondaryTrajectoryLength > 1) {
updateMovementCells();
}
if (tocapintar2) {
- if (peteractivo && !g_engine->_sound->isVocPlaying()) {
+ if (isPeterCoughing && !g_engine->_sound->isVocPlaying()) {
iframe2 = 0;
}
- curSecondaryAnimationFrame = animado.bitmap[animado.dir][iframe2];
+ curSecondaryAnimationFrame = secondaryAnimation.bitmap[secondaryAnimation.dir][iframe2];
}
uint16 pasoframeW = READ_LE_UINT16(curCharacterAnimationFrame);
uint16 pasoframeH = READ_LE_UINT16(curCharacterAnimationFrame + 2);
@@ -337,25 +337,25 @@ void sprites(bool pintapersonaje) {
uint16 pasoanimadoH = READ_LE_UINT16(curSecondaryAnimationFrame + 2);
if (
- ((animado.posx < (characterPosX + pasoframeW) + 4) &&
- ((animado.posx + pasoanimadoW + 1) > posfondox) &&
- (animado.posy < (characterPosY + pasoframeH + 4))) &&
- ((animado.posy + pasoanimadoH + 1) > posfondoy)) { // Character is in the area of the animation
+ ((secondaryAnimation.posx < (characterPosX + pasoframeW) + 4) &&
+ ((secondaryAnimation.posx + pasoanimadoW + 1) > posfondox) &&
+ (secondaryAnimation.posy < (characterPosY + pasoframeH + 4))) &&
+ ((secondaryAnimation.posy + pasoanimadoH + 1) > posfondoy)) { // Character is in the area of the animation
- if (animado.posx < characterPosX) {
- posfondox = animado.posx - 3;
+ if (secondaryAnimation.posx < characterPosX) {
+ posfondox = secondaryAnimation.posx - 3;
}
- if (animado.posy < characterPosY) {
- posfondoy = animado.posy - 3;
+ if (secondaryAnimation.posy < characterPosY) {
+ posfondoy = secondaryAnimation.posy - 3;
}
uint16 patchW = pasoanimadoW + pasoframeW + 6;
uint16 patchH;
- if ((pasoframeH + characterPosY) > (animado.posy + pasoanimadoH)) {
- patchH = pasoframeH + 6 + abs(characterPosY - animado.posy);
+ if ((pasoframeH + characterPosY) > (secondaryAnimation.posy + pasoanimadoH)) {
+ patchH = pasoframeH + 6 + abs(characterPosY - secondaryAnimation.posy);
} else {
- patchH = pasoanimadoH + 6 + abs(characterPosY - animado.posy);
+ patchH = pasoanimadoH + 6 + abs(characterPosY - secondaryAnimation.posy);
}
if (posfondoy + patchH > 140) {
@@ -375,9 +375,9 @@ void sprites(bool pintapersonaje) {
indice = 0;
while (indice != depthLevelCount) {
overlayObject();
- if (animado.depth == indice)
- assembleImage(curSecondaryAnimationFrame, animado.posx, animado.posy);
- if (secuencia.depth == indice)
+ if (secondaryAnimation.depth == indice)
+ assembleImage(curSecondaryAnimationFrame, secondaryAnimation.posx, secondaryAnimation.posy);
+ if (mainCharAnimation.depth == indice)
assembleImage(curCharacterAnimationFrame, characterPosX, characterPosY);
indice += 1;
}
@@ -388,8 +388,8 @@ void sprites(bool pintapersonaje) {
drawMainCharacter();
}
- posfondox = animado.posx - 3;
- posfondoy = animado.posy - 3;
+ posfondox = secondaryAnimation.posx - 3;
+ posfondoy = secondaryAnimation.posy - 3;
pasoanimadoW = READ_LE_UINT16(curSecondaryAnimationFrame) + 6;
pasoanimadoH = READ_LE_UINT16(curSecondaryAnimationFrame + 2) + 6;
@@ -410,8 +410,8 @@ void sprites(bool pintapersonaje) {
indice = 0;
while (indice != depthLevelCount) {
overlayObject();
- if (animado.depth == indice)
- assembleImage(curSecondaryAnimationFrame, animado.posx, animado.posy);
+ if (secondaryAnimation.depth == indice)
+ assembleImage(curSecondaryAnimationFrame, secondaryAnimation.posx, secondaryAnimation.posy);
indice += 1;
}
g_engine->_graphics->putImg(posfondox, posfondoy, characterDirtyRect);
@@ -424,26 +424,26 @@ void sprites(bool pintapersonaje) {
void adjustKey() {
iframe = 0;
calculateTrajectory(129, 13);
- direccionmovimiento = 0;
+ characterFacingDir = 0;
do {
- characterPosX = trayec[indicetray].x;
- characterPosY = trayec[indicetray].y;
+ characterPosX = trajectory[currentTrajectoryIndex].x;
+ characterPosY = trajectory[currentTrajectoryIndex].y;
iframe++;
- indicetray += 1;
+ currentTrajectoryIndex += 1;
emptyLoop();
tocapintar = false;
if (saltospal >= 4) {
saltospal = 0;
- if (movidapaleta > 6)
- movidapaleta = 0;
+ if (isPaletteAnimEnabled > 6)
+ isPaletteAnimEnabled = 0;
else
- movidapaleta += 1;
- updatePalette(movidapaleta);
+ isPaletteAnimEnabled += 1;
+ updatePalette(isPaletteAnimEnabled);
} else
saltospal += 1;
sprites(true);
- } while (indicetray != longtray);
- direccionmovimiento = 3;
+ } while (currentTrajectoryIndex != trajectoryLength);
+ characterFacingDir = 3;
emptyLoop();
tocapintar = false;
sprites(true);
@@ -451,26 +451,26 @@ void adjustKey() {
void adjustKey2() {
iframe = 0;
- direccionmovimiento = 2;
- longtray = 1;
+ characterFacingDir = 2;
+ trajectoryLength = 1;
do {
- characterPosX = trayec[indicetray].x;
- characterPosY = trayec[indicetray].y;
+ characterPosX = trajectory[currentTrajectoryIndex].x;
+ characterPosY = trajectory[currentTrajectoryIndex].y;
iframe++;
- indicetray -= 1;
+ currentTrajectoryIndex -= 1;
emptyLoop();
tocapintar = false;
if (saltospal >= 4) {
saltospal = 0;
- if (movidapaleta > 6)
- movidapaleta = 0;
+ if (isPaletteAnimEnabled > 6)
+ isPaletteAnimEnabled = 0;
else
- movidapaleta += 1;
- updatePalette(movidapaleta);
+ isPaletteAnimEnabled += 1;
+ updatePalette(isPaletteAnimEnabled);
} else
saltospal += 1;
sprites(true);
- } while (indicetray != 0);
+ } while (currentTrajectoryIndex != 0);
emptyLoop();
tocapintar = false;
sprites(true);
@@ -505,13 +505,13 @@ void animatedSequence(uint numSequence) {
emptyLoop();
tocapintar = false;
if (tocapintar2) {
- if (indicetray2 >= currentRoomData->secondaryTrajectoryLength)
- indicetray2 = 1;
+ if (currentSecondaryTrajectoryIndex >= currentRoomData->secondaryTrajectoryLength)
+ currentSecondaryTrajectoryIndex = 1;
else
- indicetray2 += 1;
- animado.posx = currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].x;
- animado.posy = currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].y;
- animado.dir = currentRoomData->secondaryAnimDirections[indicetray2 - 1];
+ currentSecondaryTrajectoryIndex += 1;
+ secondaryAnimation.posx = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].x;
+ secondaryAnimation.posy = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].y;
+ secondaryAnimation.dir = currentRoomData->secondaryAnimDirections[currentSecondaryTrajectoryIndex - 1];
if (iframe2 >= secondaryAnimationFrameCount - 1)
iframe2 = 0;
else
@@ -548,13 +548,13 @@ void animatedSequence(uint numSequence) {
emptyLoop();
tocapintar = false;
if (tocapintar2) {
- if (indicetray2 >= currentRoomData->secondaryTrajectoryLength)
- indicetray2 = 1;
+ if (currentSecondaryTrajectoryIndex >= currentRoomData->secondaryTrajectoryLength)
+ currentSecondaryTrajectoryIndex = 1;
else
- indicetray2 += 1;
- animado.posx = currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].x;
- animado.posy = currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].y;
- animado.dir = currentRoomData->secondaryAnimDirections[indicetray2 - 1];
+ currentSecondaryTrajectoryIndex += 1;
+ secondaryAnimation.posx = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].x;
+ secondaryAnimation.posy = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].y;
+ secondaryAnimation.dir = currentRoomData->secondaryAnimDirections[currentSecondaryTrajectoryIndex - 1];
if (iframe2 >= secondaryAnimationFrameCount - 1)
iframe2 = 0;
else
@@ -591,13 +591,13 @@ void animatedSequence(uint numSequence) {
emptyLoop();
tocapintar = false;
if (tocapintar2) {
- if (indicetray2 >= currentRoomData->secondaryTrajectoryLength)
- indicetray2 = 1;
+ if (currentSecondaryTrajectoryIndex >= currentRoomData->secondaryTrajectoryLength)
+ currentSecondaryTrajectoryIndex = 1;
else
- indicetray2 += 1;
- animado.posx = currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].x;
- animado.posy = currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].y;
- animado.dir = currentRoomData->secondaryAnimDirections[indicetray2 - 1];
+ currentSecondaryTrajectoryIndex += 1;
+ secondaryAnimation.posx = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].x;
+ secondaryAnimation.posy = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].y;
+ secondaryAnimation.dir = currentRoomData->secondaryAnimDirections[currentSecondaryTrajectoryIndex - 1];
if (iframe2 >= secondaryAnimationFrameCount - 1)
iframe2 = 0;
else
@@ -611,7 +611,7 @@ void animatedSequence(uint numSequence) {
free(animptr);
animationFile.close();
iframe = 0;
- direccionmovimiento = 2;
+ characterFacingDir = 2;
emptyLoop();
tocapintar = false;
characterPosX = guadaxframe;
@@ -636,26 +636,26 @@ void animatedSequence(uint numSequence) {
tocapintar = false;
if (saltospal >= 4) {
saltospal = 0;
- if (movidapaleta > 6)
- movidapaleta = 0;
+ if (isPaletteAnimEnabled > 6)
+ isPaletteAnimEnabled = 0;
else
- movidapaleta += 1;
- updatePalette(movidapaleta);
+ isPaletteAnimEnabled += 1;
+ updatePalette(isPaletteAnimEnabled);
} else
saltospal += 1;
g_engine->_graphics->putShape(animx, animy, animptr);
}
screenObjects[regobj.depth - 1] = NULL;
restoreBackground();
- indiceani = secuencia.depth;
- secuencia.depth = 30;
+ indiceani = mainCharAnimation.depth;
+ mainCharAnimation.depth = 30;
screenObjects[13] = animptr;
depthMap[13].posx = animx;
depthMap[13].posy = animy;
assembleScreen();
drawScreen(sceneBackground);
screenObjects[13] = NULL;
- secuencia.depth = indiceani;
+ mainCharAnimation.depth = indiceani;
drawBackpack();
for (indiceani = 32; indiceani <= numframessec; indiceani++) {
animationFile.read(animptr, tamsecani);
@@ -663,11 +663,11 @@ void animatedSequence(uint numSequence) {
tocapintar = false;
if (saltospal >= 4) {
saltospal = 0;
- if (movidapaleta > 6)
- movidapaleta = 0;
+ if (isPaletteAnimEnabled > 6)
+ isPaletteAnimEnabled = 0;
else
- movidapaleta += 1;
- updatePalette(movidapaleta);
+ isPaletteAnimEnabled += 1;
+ updatePalette(isPaletteAnimEnabled);
} else
saltospal += 1;
g_engine->_graphics->putImg(animx, animy, animptr);
@@ -698,14 +698,14 @@ void animatedSequence(uint numSequence) {
break;
}
}
- indiceani = secuencia.depth;
- secuencia.depth = 30;
+ indiceani = mainCharAnimation.depth;
+ mainCharAnimation.depth = 30;
screenObjects[12] = animptr;
depthMap[12].posx = animx;
depthMap[12].posy = animy;
disableSecondAnimation();
screenObjects[12] = NULL;
- secuencia.depth = indiceani;
+ mainCharAnimation.depth = indiceani;
drawScreen(sceneBackground);
for (indiceani = 9; indiceani <= numframessec; indiceani++) {
animationFile.read(animptr, tamsecani);
@@ -721,7 +721,7 @@ void animatedSequence(uint numSequence) {
free(animptr);
animationFile.close();
iframe = 0;
- direccionmovimiento = 2;
+ characterFacingDir = 2;
emptyLoop();
tocapintar = false;
sprites(true);
@@ -736,19 +736,19 @@ void animatedSequence(uint numSequence) {
animationFile.readByte();
screenObjects[6] = (byte *)malloc(tamsecani);
// objetos[7] = ptr(segfondo, (offfondo + 44900));
- depthMap[6].posx = animado.posx + 5;
- depthMap[6].posy = animado.posy - 6;
+ depthMap[6].posx = secondaryAnimation.posx + 5;
+ depthMap[6].posy = secondaryAnimation.posy - 6;
indiceani = 0;
do {
emptyLoop();
tocapintar = false;
if (saltospal >= 4) {
saltospal = 0;
- if (movidapaleta > 6)
- movidapaleta = 0;
+ if (isPaletteAnimEnabled > 6)
+ isPaletteAnimEnabled = 0;
else
- movidapaleta += 1;
- updatePalette(movidapaleta);
+ isPaletteAnimEnabled += 1;
+ updatePalette(isPaletteAnimEnabled);
} else
saltospal += 1;
if (tocapintar2) {
@@ -865,28 +865,28 @@ void loadScreenData(uint screenNumber) {
if (currentRoomData->animationFlag && currentRoomData->code != 24) {
loadAnimation(currentRoomData->animationName);
iframe2 = 0;
- indicetray2 = 1;
- animado.dir = currentRoomData->secondaryAnimDirections[indicetray2 - 1];
- animado.posx = currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].x;
- animado.posy = currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].y;
+ currentSecondaryTrajectoryIndex = 1;
+ secondaryAnimation.dir = currentRoomData->secondaryAnimDirections[currentSecondaryTrajectoryIndex - 1];
+ secondaryAnimation.posx = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].x;
+ secondaryAnimation.posy = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].y;
if (currentRoomData->animationName == "FUENTE01")
- animado.depth = 0;
+ secondaryAnimation.depth = 0;
else {
updateSecondaryAnimationDepth();
}
- for (int i = 0; i < maxrejax; i++)
- for (int j = 0; j < maxrejay; j++) {
- if (rejamascaramovto[i][j] > 0)
- currentRoomData->walkAreasGrid[oldposx + i][oldposy + j] = rejamascaramovto[i][j];
- if (rejamascararaton[i][j] > 0)
- currentRoomData->mouseGrid[oldposx + i][oldposy + j] = rejamascararaton[i][j];
+ for (int i = 0; i < maxXGrid; i++)
+ for (int j = 0; j < maxYGrid; j++) {
+ if (maskGridSecondaryAnim[i][j] > 0)
+ currentRoomData->walkAreasGrid[oldposx + i][oldposy + j] = maskGridSecondaryAnim[i][j];
+ if (maskMouseSecondaryAnim[i][j] > 0)
+ currentRoomData->mouseGrid[oldposx + i][oldposy + j] = maskMouseSecondaryAnim[i][j];
}
} else
currentRoomData->animationFlag = false;
updateMainCharacterDepth();
assembleScreen();
- movidapaleta = 0;
+ isPaletteAnimEnabled = 0;
}
/**
@@ -923,11 +923,11 @@ void calculateTrajectory(uint finalx, uint finaly) {
uint x = characterPosX, y = characterPosY;
int steps = deltaX + 1; // number of steps
- indicetray = 0;
- longtray = 0;
- trayec[longtray].x = x;
- trayec[longtray].y = y;
- longtray++;
+ currentTrajectoryIndex = 0;
+ trajectoryLength = 0;
+ trajectory[trajectoryLength].x = x;
+ trajectory[trajectoryLength].y = y;
+ trajectoryLength++;
while (--steps) {
if (BX >= 0) {
x += incrXDiag;
@@ -938,16 +938,16 @@ void calculateTrajectory(uint finalx, uint finaly) {
y += incrYRecto;
BX += contRecto;
}
- trayec[longtray].x = x;
- trayec[longtray].y = y;
- longtray++;
+ trajectory[trajectoryLength].x = x;
+ trajectory[trajectoryLength].y = y;
+ trajectoryLength++;
}
// Ensure last value is also final position to account for overflow of the route
- trayec[longtray].x = finalx;
- trayec[longtray].y = finaly;
- trayec[longtray + 1].x = finalx;
- trayec[longtray + 1].y = finaly;
+ trajectory[trajectoryLength].x = finalx;
+ trajectory[trajectoryLength].y = finaly;
+ trajectory[trajectoryLength + 1].x = finalx;
+ trajectory[trajectoryLength + 1].y = finaly;
// longtray--; // decrement because of 1-starting arrays
}
@@ -957,7 +957,7 @@ void lookInventoryObject(byte numeroobjeto) {
Common::String cadenadescripcion;
bool kkaux;
- regismht reghpt;
+ TextEntry reghpt;
palette paletaseg;
kkaux = false;
@@ -1048,7 +1048,7 @@ void useInventoryObjectWithInventoryObject(uint numobj1, uint numobj2) {
}
indobj2 = indicemochila;
- kaka = regobj.useTextRef;
+ foo = regobj.useTextRef;
if (regobj.replaceWith == 0) {
readItemRegister(invItemData, numobj1, regobj);
@@ -1073,73 +1073,73 @@ void useInventoryObjectWithInventoryObject(uint numobj1, uint numobj2) {
drawBackpack();
g_engine->_mouseManager->show();
}
- if (kaka > 0)
- drawText(kaka);
+ if (foo > 0)
+ drawText(foo);
}
void calculateRoute(byte zona1, byte zona2, bool extraCorrection, bool zonavedada) {
// Resets the entire route
- for (pasos = 0; pasos < 7; pasos++) {
- mainRoute[pasos].x = 0;
- mainRoute[pasos].y = 0;
+ for (steps = 0; steps < 7; steps++) {
+ mainRoute[steps].x = 0;
+ mainRoute[steps].y = 0;
}
- pasos = 0;
+ steps = 0;
// Starts first element of route with current position
mainRoute[0].x = characterPosX;
mainRoute[0].y = characterPosY;
Common::Point point;
do {
- pasos += 1;
- point = currentRoomData->trajectories[zona1 - 1][zona2 - 1][pasos - 1];
+ steps += 1;
+ point = currentRoomData->trajectories[zona1 - 1][zona2 - 1][steps - 1];
if (point.x < (characterCorrectionX + 3))
- mainRoute[pasos].x = 3;
+ mainRoute[steps].x = 3;
else
- mainRoute[pasos].x = point.x - characterCorrectionX;
+ mainRoute[steps].x = point.x - characterCorrectionX;
if (point.y < (characerCorrectionY + 3))
- mainRoute[pasos].y = 3;
+ mainRoute[steps].y = 3;
else
- mainRoute[pasos].y = point.y - characerCorrectionY;
+ mainRoute[steps].y = point.y - characerCorrectionY;
- } while (point.y != 9999 && pasos != 5);
+ } while (point.y != 9999 && steps != 5);
if (zona2 < 10) {
if (point.y == 9999) {
- mainRoute[pasos].x = xframe2 - characterCorrectionX;
- mainRoute[pasos].y = yframe2 - characerCorrectionY;
+ mainRoute[steps].x = xframe2 - characterCorrectionX;
+ mainRoute[steps].y = yframe2 - characerCorrectionY;
} else {
mainRoute[6].x = xframe2 - characterCorrectionX;
mainRoute[6].y = yframe2 - characerCorrectionY;
- pasos = 6;
+ steps = 6;
}
} else {
- if ((mainRoute[pasos].y + characerCorrectionY) == 9999) {
- pasos -= 1;
+ if ((mainRoute[steps].y + characerCorrectionY) == 9999) {
+ steps -= 1;
}
if (extraCorrection) {
switch (currentRoomData->code) {
case 5:
if (zona2 == 27)
- pasos += 1;
+ steps += 1;
break;
case 6:
if (zona2 == 21)
- pasos += 1;
+ steps += 1;
break;
}
}
}
if (extraCorrection && zonavedada) {
- pasos -= 1;
+ steps -= 1;
}
// Sets xframe2 now to be the number of steps in the route
- xframe2 = pasos;
+ xframe2 = steps;
// Sets yframe2 to now be current step
yframe2 = 1;
- longtray = 10;
- indicetray = 30;
+ trajectoryLength = 10;
+ currentTrajectoryIndex = 30;
}
void goToObject(byte zona1, byte zona2) {
@@ -1160,7 +1160,7 @@ void goToObject(byte zona1, byte zona2) {
(zona2 >= 18 && zona2 <= 21) ||
zona2 == 24 || zona2 == 25) {
- zonadestino = 7;
+ targetZone = 7;
mouseClickX = 232;
mouseClickY = 75;
zona2 = 7;
@@ -1193,51 +1193,51 @@ void goToObject(byte zona1, byte zona2) {
}
void updateSecondaryAnimationDepth() {
- uint animadoposition = animado.posy + altoanimado - 1;
+ uint animadoposition = secondaryAnimation.posy + secondaryAnimHeight - 1;
if (animadoposition >= 0 && animadoposition <= 56) {
- animado.depth = 0;
+ secondaryAnimation.depth = 0;
} else if (animadoposition >= 57 && animadoposition <= 66) {
- animado.depth = 1;
+ secondaryAnimation.depth = 1;
} else if (animadoposition >= 65 && animadoposition <= 74) {
- animado.depth = 2;
+ secondaryAnimation.depth = 2;
} else if (animadoposition >= 73 && animadoposition <= 82) {
- animado.depth = 3;
+ secondaryAnimation.depth = 3;
} else if (animadoposition >= 81 && animadoposition <= 90) {
- animado.depth = 4;
+ secondaryAnimation.depth = 4;
} else if (animadoposition >= 89 && animadoposition <= 98) {
- animado.depth = 5;
+ secondaryAnimation.depth = 5;
} else if (animadoposition >= 97 && animadoposition <= 106) {
- animado.depth = 6;
+ secondaryAnimation.depth = 6;
} else if (animadoposition >= 105 && animadoposition <= 114) {
- animado.depth = 7;
+ secondaryAnimation.depth = 7;
} else if (animadoposition >= 113 && animadoposition <= 122) {
- animado.depth = 8;
+ secondaryAnimation.depth = 8;
} else if (animadoposition >= 121 && animadoposition <= 140) {
- animado.depth = 9;
+ secondaryAnimation.depth = 9;
}
}
void updateMainCharacterDepth() {
if (characterPosY >= 0 && characterPosY <= 7) {
- secuencia.depth = 0;
+ mainCharAnimation.depth = 0;
} else if (characterPosY >= 8 && characterPosY <= 17) {
- secuencia.depth = 1;
+ mainCharAnimation.depth = 1;
} else if (characterPosY >= 18 && characterPosY <= 25) {
- secuencia.depth = 2;
+ mainCharAnimation.depth = 2;
} else if (characterPosY >= 26 && characterPosY <= 33) {
- secuencia.depth = 3;
+ mainCharAnimation.depth = 3;
} else if (characterPosY >= 34 && characterPosY <= 41) {
- secuencia.depth = 4;
+ mainCharAnimation.depth = 4;
} else if (characterPosY >= 42 && characterPosY <= 49) {
- secuencia.depth = 5;
+ mainCharAnimation.depth = 5;
} else if (characterPosY >= 50 && characterPosY <= 57) {
- secuencia.depth = 6;
+ mainCharAnimation.depth = 6;
} else if (characterPosY >= 58 && characterPosY <= 65) {
- secuencia.depth = 7;
+ mainCharAnimation.depth = 7;
} else if (characterPosY >= 66 && characterPosY <= 73) {
- secuencia.depth = 8;
+ mainCharAnimation.depth = 8;
} else if (characterPosY >= 74 && characterPosY <= 139) {
- secuencia.depth = 9;
+ mainCharAnimation.depth = 9;
}
}
@@ -1245,27 +1245,27 @@ void advanceAnimations(bool zonavedada, bool animateMouse) {
if (tocapintar) {
if (currentRoomData->animationFlag && tocapintar2) {
- if (peteractivo && (Random(100) == 1) && !g_engine->_sound->isVocPlaying() && caramelos[0] == false) {
+ if (isPeterCoughing && (Random(100) == 1) && !g_engine->_sound->isVocPlaying() && mintTopic[0] == false) {
debug("Playing tos");
g_engine->_sound->playVoc("TOS", 258006, 14044);
}
- if (indicetray2 >= currentRoomData->secondaryTrajectoryLength)
- indicetray2 = 1;
+ if (currentSecondaryTrajectoryIndex >= currentRoomData->secondaryTrajectoryLength)
+ currentSecondaryTrajectoryIndex = 1;
else
- indicetray2 += 1;
+ currentSecondaryTrajectoryIndex += 1;
if (iframe2 >= secondaryAnimationFrameCount - 1)
iframe2 = 0;
else
iframe2++;
- animado.posx = currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].x;
- animado.posy = currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].y;
- animado.dir = currentRoomData->secondaryAnimDirections[indicetray2 - 1];
+ secondaryAnimation.posx = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].x;
+ secondaryAnimation.posy = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].y;
+ secondaryAnimation.dir = currentRoomData->secondaryAnimDirections[currentSecondaryTrajectoryIndex - 1];
switch (currentRoomData->code) {
case 23:
- animado.depth = 0;
+ secondaryAnimation.depth = 0;
break;
case 24:
- animado.depth = 14;
+ secondaryAnimation.depth = 14;
break;
default:
updateSecondaryAnimationDepth();
@@ -1274,47 +1274,47 @@ void advanceAnimations(bool zonavedada, bool animateMouse) {
// This means character needs to walk
if (xframe2 > 0) {
- if (direccionmovimiento == 1 || direccionmovimiento == 3) {
- indicetray += 1;
+ if (characterFacingDir == 1 || characterFacingDir == 3) {
+ currentTrajectoryIndex += 1;
}
- indicetray += 1;
+ currentTrajectoryIndex += 1;
// yframe2, xframe2 now represent max steps and current step
if (yframe2 <= xframe2) {
- if (indicetray > longtray) {
- elemento1 = mainRoute[yframe2].x - mainRoute[yframe2 - 1].x;
- elemento2 = mainRoute[yframe2].y - mainRoute[yframe2 - 1].y;
-
- if ((abs(elemento1) > 2) || (abs(elemento2) > 2)) {
- if (abs(elemento2) > (abs(elemento1) + 5)) {
- if (elemento2 < 0)
- direccionmovimiento = 0;
+ if (currentTrajectoryIndex > trajectoryLength) {
+ element1 = mainRoute[yframe2].x - mainRoute[yframe2 - 1].x;
+ element2 = mainRoute[yframe2].y - mainRoute[yframe2 - 1].y;
+
+ if ((abs(element1) > 2) || (abs(element2) > 2)) {
+ if (abs(element2) > (abs(element1) + 5)) {
+ if (element2 < 0)
+ characterFacingDir = 0;
else
- direccionmovimiento = 2;
+ characterFacingDir = 2;
} else {
- if (elemento1 > 0)
- direccionmovimiento = 1;
+ if (element1 > 0)
+ characterFacingDir = 1;
else
- direccionmovimiento = 3;
+ characterFacingDir = 3;
}
}
yframe2 += 1;
calculateTrajectory(mainRoute[yframe2 - 1].x, mainRoute[yframe2 - 1].y);
}
- } else if (indicetray >= longtray) {
+ } else if (currentTrajectoryIndex >= trajectoryLength) {
xframe2 = 0;
- if (!cambiopantalla) {
- elemento1 = (mouseX + 7) - (characterPosX + characterCorrectionX);
- elemento2 = (mouseY + 7) - (characterPosY + characerCorrectionY);
- if (abs(elemento2) > (abs(elemento1) + 20)) {
- if (elemento2 < 0)
- direccionmovimiento = 0;
+ if (!roomChange) {
+ element1 = (mouseX + 7) - (characterPosX + characterCorrectionX);
+ element2 = (mouseY + 7) - (characterPosY + characerCorrectionY);
+ if (abs(element2) > (abs(element1) + 20)) {
+ if (element2 < 0)
+ characterFacingDir = 0;
else
- direccionmovimiento = 2;
+ characterFacingDir = 2;
} else {
- if (elemento1 > 0)
- direccionmovimiento = 1;
+ if (element1 > 0)
+ characterFacingDir = 1;
else
- direccionmovimiento = 3;
+ characterFacingDir = 3;
}
}
}
@@ -1323,40 +1323,40 @@ void advanceAnimations(bool zonavedada, bool animateMouse) {
iframe = 0;
} else {
iframe = 0;
- if (zonavedada == false && !cambiopantalla) {
- elemento1 = (mouseX + 7) - (characterPosX + characterCorrectionX);
- elemento2 = (mouseY + 7) - (characterPosY + characerCorrectionY);
- if (abs(elemento2) > (abs(elemento1) + 20)) {
- if (elemento2 < 0)
- direccionmovimiento = 0;
+ if (zonavedada == false && !roomChange) {
+ element1 = (mouseX + 7) - (characterPosX + characterCorrectionX);
+ element2 = (mouseY + 7) - (characterPosY + characerCorrectionY);
+ if (abs(element2) > (abs(element1) + 20)) {
+ if (element2 < 0)
+ characterFacingDir = 0;
else
- direccionmovimiento = 2;
+ characterFacingDir = 2;
} else {
- if (elemento1 > 0)
- direccionmovimiento = 1;
+ if (element1 > 0)
+ characterFacingDir = 1;
else
- direccionmovimiento = 3;
+ characterFacingDir = 3;
}
}
}
- characterPosX = trayec[indicetray].x;
- characterPosY = trayec[indicetray].y;
+ characterPosX = trajectory[currentTrajectoryIndex].x;
+ characterPosY = trajectory[currentTrajectoryIndex].y;
updateMainCharacterDepth();
- if (pintaractivo) {
+ if (isDrawingEnabled) {
sprites(true);
}
tocapintar = false;
if (currentRoomData->paletteAnimationFlag && saltospal >= 4) {
saltospal = 0;
- if (movidapaleta > 6)
- movidapaleta = 0;
+ if (isPaletteAnimEnabled > 6)
+ isPaletteAnimEnabled = 0;
else
- movidapaleta += 1;
- if (currentRoomData->code == 4 && movidapaleta == 4)
+ isPaletteAnimEnabled += 1;
+ if (currentRoomData->code == 4 && isPaletteAnimEnabled == 4)
g_engine->_sound->playVoc();
- updatePalette(movidapaleta);
+ updatePalette(isPaletteAnimEnabled);
} else {
saltospal += 1;
}
@@ -1368,7 +1368,7 @@ void actionLineText(Common::String actionLine) {
}
void animateGive(uint cogedir, uint cogealt) {
- direccionmovimiento = cogedir;
+ characterFacingDir = cogedir;
for (uint i = 0; i < 5; i++) {
emptyLoop();
tocapintar = false;
@@ -1377,11 +1377,11 @@ void animateGive(uint cogedir, uint cogealt) {
if (currentRoomData->paletteAnimationFlag && saltospal >= 4) {
saltospal = 0;
- if (movidapaleta > 6)
- movidapaleta = 0;
+ if (isPaletteAnimEnabled > 6)
+ isPaletteAnimEnabled = 0;
else
- movidapaleta += 1;
- updatePalette(movidapaleta);
+ isPaletteAnimEnabled += 1;
+ updatePalette(isPaletteAnimEnabled);
} else
saltospal += 1;
sprites(true);
@@ -1391,7 +1391,7 @@ void animateGive(uint cogedir, uint cogealt) {
// Lean over to pick
void animatePickup1(uint cogedir, uint cogealt) {
- direccionmovimiento = cogedir;
+ characterFacingDir = cogedir;
for (uint i = 0; i < 5; i++) {
emptyLoop();
tocapintar = false;
@@ -1399,11 +1399,11 @@ void animatePickup1(uint cogedir, uint cogealt) {
if (currentRoomData->paletteAnimationFlag && saltospal >= 4) {
saltospal = 0;
- if (movidapaleta > 6)
- movidapaleta = 0;
+ if (isPaletteAnimEnabled > 6)
+ isPaletteAnimEnabled = 0;
else
- movidapaleta += 1;
- updatePalette(movidapaleta);
+ isPaletteAnimEnabled += 1;
+ updatePalette(isPaletteAnimEnabled);
} else
saltospal += 1;
sprites(true);
@@ -1413,7 +1413,7 @@ void animatePickup1(uint cogedir, uint cogealt) {
// Lean back after pick
void animatePickup2(uint cogedir, uint cogealt) {
- direccionmovimiento = cogedir;
+ characterFacingDir = cogedir;
for (uint i = 0; i < 5; i++) {
emptyLoop();
@@ -1423,11 +1423,11 @@ void animatePickup2(uint cogedir, uint cogealt) {
if (currentRoomData->paletteAnimationFlag && saltospal >= 4) {
saltospal = 0;
- if (movidapaleta > 6)
- movidapaleta = 0;
+ if (isPaletteAnimEnabled > 6)
+ isPaletteAnimEnabled = 0;
else
- movidapaleta += 1;
- updatePalette(movidapaleta);
+ isPaletteAnimEnabled += 1;
+ updatePalette(isPaletteAnimEnabled);
} else
saltospal += 1;
sprites(true);
@@ -1440,7 +1440,7 @@ void animatePickup2(uint cogedir, uint cogealt) {
}
void animateOpen2(uint cogedir, uint cogealt) {
- direccionmovimiento = cogedir;
+ characterFacingDir = cogedir;
contadorpc = contadorpc2;
for (uint i = 0; i < 5; i++) {
emptyLoop();
@@ -1449,11 +1449,11 @@ void animateOpen2(uint cogedir, uint cogealt) {
if (currentRoomData->paletteAnimationFlag && saltospal >= 4) {
saltospal = 0;
- if (movidapaleta > 6)
- movidapaleta = 0;
+ if (isPaletteAnimEnabled > 6)
+ isPaletteAnimEnabled = 0;
else
- movidapaleta += 1;
- updatePalette(movidapaleta);
+ isPaletteAnimEnabled += 1;
+ updatePalette(isPaletteAnimEnabled);
} else
saltospal += 1;
sprites(true);
@@ -1486,12 +1486,12 @@ void animateBat() {
bool salir_del_bucle = false;
if (currentRoomData->animationFlag) {
iframe2seg = iframe2;
- xseg = animado.posx;
- yseg = animado.posy;
- anchoaniseg = anchoanimado;
- altoaniseg = altoanimado;
- profseg = animado.depth;
- dirseg = animado.dir;
+ xseg = secondaryAnimation.posx;
+ yseg = secondaryAnimation.posy;
+ anchoaniseg = secondaryAnimWidth;
+ altoaniseg = secondaryAnimHeight;
+ profseg = secondaryAnimation.depth;
+ dirseg = secondaryAnimation.dir;
freeAnimation();
}
loadBat();
@@ -1500,7 +1500,7 @@ void animateBat() {
itrayseg = 0;
longtrayseg = 87;
iframe2 = 0;
- animado.depth = 14;
+ secondaryAnimation.depth = 14;
do {
g_engine->_chrono->updateChrono();
if (tocapintar) {
@@ -1512,20 +1512,20 @@ void animateBat() {
else
iframe2++;
- animado.posx = trayseg[itrayseg][0] - 20;
- animado.posy = trayseg[itrayseg][1];
- animado.dir = 0;
+ secondaryAnimation.posx = trayseg[itrayseg][0] - 20;
+ secondaryAnimation.posy = trayseg[itrayseg][1];
+ secondaryAnimation.dir = 0;
sprites(true);
tocapintar = false;
if (itrayseg % 24 == 0)
g_engine->_sound->playVoc();
if (saltospal >= 4) {
saltospal = 0;
- if (movidapaleta > 6)
- movidapaleta = 0;
+ if (isPaletteAnimEnabled > 6)
+ isPaletteAnimEnabled = 0;
else
- movidapaleta += 1;
- updatePalette(movidapaleta);
+ isPaletteAnimEnabled += 1;
+ updatePalette(isPaletteAnimEnabled);
} else
saltospal += 1;
}
@@ -1536,15 +1536,15 @@ void animateBat() {
g_engine->_sound->stopVoc();
freeAnimation();
if (currentRoomData->animationFlag) {
- anchoanimado = anchoaniseg;
- altoanimado = altoaniseg;
- setRoomTrajectories(altoanimado, anchoanimado, RESTORE, false);
+ secondaryAnimWidth = anchoaniseg;
+ secondaryAnimHeight = altoaniseg;
+ setRoomTrajectories(secondaryAnimHeight, secondaryAnimWidth, RESTORE, false);
loadAnimation(currentRoomData->animationName);
iframe2 = iframe2seg;
- animado.posx = xseg;
- animado.posy = yseg;
- animado.depth = profseg;
- animado.dir = dirseg;
+ secondaryAnimation.posx = xseg;
+ secondaryAnimation.posy = yseg;
+ secondaryAnimation.depth = profseg;
+ secondaryAnimation.dir = dirseg;
}
restoreBackground();
assembleScreen();
@@ -1651,15 +1651,15 @@ void pickupScreenObject() {
}
} break;
case 590: // Ectoplasm
- cavernas[1] = true;
+ caves[1] = true;
break;
case 665: // Bird
- cavernas[0] = true;
+ caves[0] = true;
break;
case 676:
case 688: {
- cavernas[4] = true;
- vasijapuesta = false;
+ caves[4] = true;
+ isVasePlaced = false;
} break;
}
switch (regobj.height) {
@@ -1670,12 +1670,12 @@ void pickupScreenObject() {
animatePickup2(3, 0);
} break;
default: {
- animatePickup1(direccionmovimiento, 0);
+ animatePickup1(characterFacingDir, 0);
screenObjects[regobj.depth - 1] = NULL;
restoreBackground();
assembleScreen();
drawScreen(sceneBackground);
- animatePickup2(direccionmovimiento, 0);
+ animatePickup2(characterFacingDir, 0);
}
}
} break;
@@ -1740,11 +1740,11 @@ void pickupScreenObject() {
case 562: { // alcove
switch (currentRoomData->code) {
case 20: { // First scene with alcove
- if (hornacina[0][hornacina[0][3]] > 0) {
+ if (niche[0][niche[0][3]] > 0) {
// Possibly
- if (hornacina[0][3] == 2 || hornacina[0][hornacina[0][3]] == 563) {
- readItemRegister(hornacina[0][hornacina[0][3]]);
- hornacina[0][hornacina[0][3]] = 0;
+ if (niche[0][3] == 2 || niche[0][niche[0][3]] == 563) {
+ readItemRegister(niche[0][niche[0][3]]);
+ niche[0][niche[0][3]] = 0;
currentRoomData->screenObjectIndex[9]->objectName = getObjectName(4);
animatePickup1(3, 1);
readBitmap(1190768, screenObjects[regobj.depth - 1], 892, 319);
@@ -1758,10 +1758,10 @@ void pickupScreenObject() {
drawScreen(sceneBackground);
animatePickup2(3, 1);
} else {
- readItemRegister(hornacina[0][hornacina[0][3]]);
- hornacina[0][hornacina[0][3]] = 0;
- hornacina[0][3] += 1;
- hornacina[1][3] -= 1;
+ readItemRegister(niche[0][niche[0][3]]);
+ niche[0][niche[0][3]] = 0;
+ niche[0][3] += 1;
+ niche[1][3] -= 1;
currentRoomData->screenObjectIndex[9]->objectName = " ";
animatePickup1(3, 1);
readBitmap(1190768, screenObjects[regobj.depth - 1],
@@ -1775,7 +1775,7 @@ void pickupScreenObject() {
currentRoomData->screenLayers[1].coordx = 66;
currentRoomData->screenLayers[1].coordy = 35;
currentRoomData->screenLayers[1].depth = 1;
- switch (hornacina[0][hornacina[0][3]]) {
+ switch (niche[0][niche[0][3]]) {
case 0: {
currentRoomData->screenObjectIndex[9]->objectName = getObjectName(4);
nicheAnimation(0, 1190768);
@@ -1808,10 +1808,10 @@ void pickupScreenObject() {
}
} break;
case 24: { // Second scene with alcove
- if (hornacina[1][hornacina[1][3]] > 0 && hornacina[1][3] != 1) {
- if (hornacina[1][3] == 2) {
- readItemRegister(hornacina[1][2]);
- hornacina[1][2] = 0;
+ if (niche[1][niche[1][3]] > 0 && niche[1][3] != 1) {
+ if (niche[1][3] == 2) {
+ readItemRegister(niche[1][2]);
+ niche[1][2] = 0;
currentRoomData->screenObjectIndex[8]->objectName = getObjectName(4);
animatePickup1(0, 1);
readBitmap(1399610, screenObjects[regobj.depth - 1], 892, 319);
@@ -1825,10 +1825,10 @@ void pickupScreenObject() {
drawScreen(sceneBackground);
animatePickup2(0, 1);
} else {
- readItemRegister(hornacina[1][hornacina[1][3]]);
- hornacina[1][hornacina[1][3]] = 622;
- hornacina[1][3] += 1;
- hornacina[0][3] -= 1;
+ readItemRegister(niche[1][niche[1][3]]);
+ niche[1][niche[1][3]] = 622;
+ niche[1][3] += 1;
+ niche[0][3] -= 1;
currentRoomData->screenObjectIndex[8]->objectName = " ";
animatePickup1(0, 1);
readBitmap(1399610, screenObjects[0], 892, 319);
@@ -1841,7 +1841,7 @@ void pickupScreenObject() {
currentRoomData->screenLayers[0].coordx = 217;
currentRoomData->screenLayers[0].coordy = 48;
currentRoomData->screenLayers[0].depth = 1;
- switch (hornacina[1][hornacina[1][3]]) {
+ switch (niche[1][niche[1][3]]) {
case 0: {
currentRoomData->screenObjectIndex[8]->objectName = getObjectName(4);
nicheAnimation(0, 1399610);
@@ -1894,16 +1894,16 @@ void pickupScreenObject() {
disableSecondAnimation();
drawScreen(sceneBackground);
animatePickup2(2, 1);
- rojo_capturado = true;
- trampa_puesta = false;
+ isRedDevilCaptured = true;
+ isTrapSet = false;
} break;
default: {
- animatePickup1(direccionmovimiento, 1);
+ animatePickup1(characterFacingDir, 1);
screenObjects[regobj.depth - 1] = NULL;
restoreBackground();
assembleScreen();
drawScreen(sceneBackground);
- animatePickup2(direccionmovimiento, 1);
+ animatePickup2(characterFacingDir, 1);
}
}
} break;
@@ -1962,26 +1962,26 @@ void pickupScreenObject() {
animatePickup2(3, 2);
} break;
default: {
- animatePickup1(direccionmovimiento, 2);
+ animatePickup1(characterFacingDir, 2);
screenObjects[regobj.depth - 1] = NULL;
assembleScreen();
drawScreen(sceneBackground);
- animatePickup2(direccionmovimiento, 2);
+ animatePickup2(characterFacingDir, 2);
}
}
} break;
case 9: { // bat
- kaka = regobj.pickTextRef;
+ foo = regobj.pickTextRef;
readItemRegister(204);
animatePickup1(0, 1);
animateOpen2(0, 1);
animateBat();
g_engine->_mouseManager->show();
- drawText(kaka);
+ drawText(foo);
currentRoomData->mouseGrid[34][8] = 24;
- numeroaccion = 0;
- oldxrejilla = 0;
- oldyrejilla = 0;
+ actionCode = 0;
+ oldGridX = 0;
+ oldGridY = 0;
checkMouseGrid();
return;
} break;
@@ -2054,9 +2054,9 @@ void pickupScreenObject() {
} else {
if (regobj.pickTextRef > 0)
drawText(regobj.pickTextRef);
- numeroaccion = 0;
- oldxrejilla = 0;
- oldyrejilla = 0;
+ actionCode = 0;
+ oldGridX = 0;
+ oldGridY = 0;
checkMouseGrid();
return;
}
@@ -2074,9 +2074,9 @@ void pickupScreenObject() {
g_engine->_mouseManager->show();
if (regobj.pickTextRef > 0)
drawText(regobj.pickTextRef);
- numeroaccion = 0;
- oldxrejilla = 0;
- oldyrejilla = 0;
+ actionCode = 0;
+ oldGridX = 0;
+ oldGridY = 0;
checkMouseGrid();
}
@@ -2126,9 +2126,9 @@ void useScreenObject() {
uint mouseY = (mouseClickY + 7) / yGridCount;
uint screenObject = currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[mouseX][mouseY]]->fileIndex;
- if (objetomochila != "") {
+ if (inventoryObjectName != "") {
indicemochila = 0;
- while (mobj[indicemochila].objectName != objetomochila) {
+ while (mobj[indicemochila].objectName != inventoryObjectName) {
indicemochila += 1;
}
@@ -2155,44 +2155,44 @@ void useScreenObject() {
iframe2 = 0;
else
iframe2++;
- if (indicetray2 >= currentRoomData->secondaryTrajectoryLength)
- indicetray2 = 1;
+ if (currentSecondaryTrajectoryIndex >= currentRoomData->secondaryTrajectoryLength)
+ currentSecondaryTrajectoryIndex = 1;
else
- indicetray2 += 1;
- animado.dir = currentRoomData->secondaryAnimDirections[indicetray2 - 1];
- animado.posx = currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].x;
- animado.posy = currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].y;
+ currentSecondaryTrajectoryIndex += 1;
+ secondaryAnimation.dir = currentRoomData->secondaryAnimDirections[currentSecondaryTrajectoryIndex - 1];
+ secondaryAnimation.posx = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].x;
+ secondaryAnimation.posy = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].y;
emptyLoop();
tocapintar = false;
emptyLoop2();
sprites(true);
g_engine->_screen->update();
- } while (indicetray2 != 4);
+ } while (currentSecondaryTrajectoryIndex != 4);
- for (indlista = 0; indlista < maxrejax; indlista++)
- for (indmoch = 0; indmoch < maxrejay; indmoch++) {
- currentRoomData->walkAreasGrid[oldposx + indlista][oldposy + indmoch] = rejafondomovto[indlista][indmoch];
- currentRoomData->mouseGrid[oldposx + indlista][oldposy + indmoch] = rejafondoraton[indlista][indmoch];
+ for (indlista = 0; indlista < maxXGrid; indlista++)
+ for (indmoch = 0; indmoch < maxYGrid; indmoch++) {
+ currentRoomData->walkAreasGrid[oldposx + indlista][oldposy + indmoch] = movementGridForSecondaryAnim[indlista][indmoch];
+ currentRoomData->mouseGrid[oldposx + indlista][oldposy + indmoch] = mouseGridForSecondaryAnim[indlista][indmoch];
}
freeAnimation();
- animado.posx = currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].x + 8;
- animado.posy = currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].y;
+ secondaryAnimation.posx = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].x + 8;
+ secondaryAnimation.posy = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].y;
currentRoomData->animationName = "GALLOPIC";
currentRoomData->secondaryAnimDirections[299] = 201;
loadAnimation("GALLOPIC");
currentRoomData->secondaryAnimDirections[0] = 0;
- currentRoomData->secondaryAnimTrajectory[0].x = animado.posx;
- currentRoomData->secondaryAnimTrajectory[0].y = animado.posy;
- indicetray2 = 1;
+ currentRoomData->secondaryAnimTrajectory[0].x = secondaryAnimation.posx;
+ currentRoomData->secondaryAnimTrajectory[0].y = secondaryAnimation.posy;
+ currentSecondaryTrajectoryIndex = 1;
currentRoomData->secondaryTrajectoryLength = 1;
- for (indlista = 0; indlista < maxrejax; indlista++)
- for (indmoch = 0; indmoch < maxrejay; indmoch++) {
- if (rejamascaramovto[indlista][indmoch] > 0)
- currentRoomData->walkAreasGrid[oldposx + indlista][oldposy + indmoch] = rejamascaramovto[indlista][indmoch];
- if (rejamascararaton[indlista][indmoch] > 0)
- currentRoomData->mouseGrid[oldposx + indlista][oldposy + indmoch] = rejamascararaton[indlista][indmoch];
+ for (indlista = 0; indlista < maxXGrid; indlista++)
+ for (indmoch = 0; indmoch < maxYGrid; indmoch++) {
+ if (maskGridSecondaryAnim[indlista][indmoch] > 0)
+ currentRoomData->walkAreasGrid[oldposx + indlista][oldposy + indmoch] = maskGridSecondaryAnim[indlista][indmoch];
+ if (maskMouseSecondaryAnim[indlista][indmoch] > 0)
+ currentRoomData->mouseGrid[oldposx + indlista][oldposy + indmoch] = maskMouseSecondaryAnim[indlista][indmoch];
}
g_engine->_mouseManager->show();
} break;
@@ -2209,7 +2209,7 @@ void useScreenObject() {
case 157: { // giving something to john
controlarlista = false;
debug("used object = %d", mobj[indicemochila].code);
- if (lista1) {
+ if (obtainedList1) {
for (indlista = 0; indlista < 5; indlista++) {
if (mobj[indicemochila].code == firstList[indlista])
controlarlista = true;
@@ -2225,16 +2225,16 @@ void useScreenObject() {
}
}
if (aciertoslista == 5) {
- lista1 = false;
+ obtainedList1 = false;
list1Complete = true;
assignText();
- hypertext(1018, 255, 0, kaka, false);
- hypertext(kaka, 253, 249, kaka, true);
+ hypertext(1018, 255, 0, foo, false);
+ hypertext(foo, 253, 249, foo, true);
verb.close();
g_engine->_mouseManager->hide();
- animateGive(direccionmovimiento, 1);
- animateOpen2(direccionmovimiento, 1);
+ animateGive(characterFacingDir, 1);
+ animateOpen2(characterFacingDir, 1);
for (indlista = 0; indlista < 5; indlista++) {
indmoch = 0;
while (mobj[indmoch].code != firstList[indlista]) {
@@ -2251,18 +2251,18 @@ void useScreenObject() {
g_engine->_mouseManager->show();
} else {
assignText();
- hypertext(regobj.useTextRef, 255, 0, kaka, false);
+ hypertext(regobj.useTextRef, 255, 0, foo, false);
g_engine->_mouseManager->hide();
- animateGive(direccionmovimiento, 1);
- animateOpen2(direccionmovimiento, 1);
+ animateGive(characterFacingDir, 1);
+ animateOpen2(characterFacingDir, 1);
g_engine->_mouseManager->show();
- hypertext(kaka, 253, 249, kaka, true);
+ hypertext(foo, 253, 249, foo, true);
verb.close();
}
}
}
controlarlista = false;
- if (lista2) {
+ if (obtainedList2) {
for (indlista = 0; indlista < 5; indlista++)
if (mobj[indicemochila].code == secondList[indlista])
controlarlista = true;
@@ -2277,15 +2277,15 @@ void useScreenObject() {
}
}
if (aciertoslista == 5) {
- lista2 = false;
+ obtainedList2 = false;
list2Complete = true;
assignText();
- hypertext(1020, 255, 0, kaka, false);
- hypertext(kaka, 253, 249, kaka, true);
+ hypertext(1020, 255, 0, foo, false);
+ hypertext(foo, 253, 249, foo, true);
verb.close();
g_engine->_mouseManager->hide();
- animateGive(direccionmovimiento, 1);
- animateOpen2(direccionmovimiento, 1);
+ animateGive(characterFacingDir, 1);
+ animateOpen2(characterFacingDir, 1);
for (indlista = 0; indlista < 5; indlista++) {
indmoch = 0;
while (mobj[indmoch].code != secondList[indlista]) {
@@ -2302,12 +2302,12 @@ void useScreenObject() {
g_engine->_mouseManager->show();
} else {
assignText();
- hypertext(regobj.useTextRef, 255, 0, kaka, false);
+ hypertext(regobj.useTextRef, 255, 0, foo, false);
g_engine->_mouseManager->hide();
- animateGive(direccionmovimiento, 1);
- animateOpen2(direccionmovimiento, 1);
+ animateGive(characterFacingDir, 1);
+ animateOpen2(characterFacingDir, 1);
g_engine->_mouseManager->show();
- hypertext(kaka, 253, 249, kaka, true);
+ hypertext(foo, 253, 249, foo, true);
verb.close();
}
}
@@ -2317,65 +2317,65 @@ void useScreenObject() {
switch (regobj.code) {
case 173: {
assignText();
- hypertext(1118, 255, 0, kaka, false);
+ hypertext(1118, 255, 0, foo, false);
g_engine->_mouseManager->hide();
- animateGive(direccionmovimiento, 1);
- animateOpen2(direccionmovimiento, 1);
+ animateGive(characterFacingDir, 1);
+ animateOpen2(characterFacingDir, 1);
g_engine->_mouseManager->show();
- hypertext(kaka, 253, 249, kaka, true);
+ hypertext(foo, 253, 249, foo, true);
verb.close();
} break;
case 218: {
assignText();
- hypertext(687, 255, 0, kaka, false);
+ hypertext(687, 255, 0, foo, false);
g_engine->_mouseManager->hide();
- animateGive(direccionmovimiento, 1);
- animateOpen2(direccionmovimiento, 1);
+ animateGive(characterFacingDir, 1);
+ animateOpen2(characterFacingDir, 1);
g_engine->_mouseManager->show();
- hypertext(kaka, 253, 249, kaka, true);
+ hypertext(foo, 253, 249, foo, true);
verb.close();
g_engine->_mouseManager->hide();
updateInventory(indicemochila);
drawBackpack();
g_engine->_mouseManager->show();
- for (kaka = 0; kaka < characterCount; kaka++)
- libro[kaka] = true;
- lprimera[0] = true;
+ for (foo = 0; foo < characterCount; foo++)
+ bookTopic[foo] = true;
+ firstTimeTopicB[0] = true;
} break;
}
} break;
case 160: {
assignText();
- hypertext(2466, 255, 0, kaka, false);
+ hypertext(2466, 255, 0, foo, false);
g_engine->_mouseManager->hide();
- animateGive(direccionmovimiento, 1);
- animateOpen2(direccionmovimiento, 1);
+ animateGive(characterFacingDir, 1);
+ animateOpen2(characterFacingDir, 1);
g_engine->_mouseManager->show();
- hypertext(kaka, 253, 249, kaka, true);
+ hypertext(foo, 253, 249, foo, true);
verb.close();
g_engine->_mouseManager->hide();
updateInventory(indicemochila);
drawBackpack();
g_engine->_mouseManager->show();
- for (kaka = 0; kaka < characterCount; kaka++) {
- caramelos[kaka] = true;
- cprimera[kaka] = true;
+ for (foo = 0; foo < characterCount; foo++) {
+ mintTopic[foo] = true;
+ firstTimeTopicC[foo] = true;
}
} break;
case 164: {
switch (regobj.code) {
case 563: {
- manual_torno = true;
- if (torno && diablillo_verde && barro) {
+ isPottersManualDelivered = true;
+ if (isPottersWheelDelivered && isGreenDevilDelivered && isMudDelivered) {
assignText();
- hypertext(2696, 255, 0, kaka, false);
+ hypertext(2696, 255, 0, foo, false);
g_engine->_mouseManager->hide();
animateGive(0, 1);
animateOpen2(0, 1);
g_engine->_mouseManager->show();
- hypertext(kaka, 253, 249, kaka, true);
- cavernas[4] = true;
- hypertext(3247, 253, 249, kaka, true);
+ hypertext(foo, 253, 249, foo, true);
+ caves[4] = true;
+ hypertext(3247, 253, 249, foo, true);
verb.close();
g_engine->_mouseManager->hide();
replaceBackpack(indicemochila, 676);
@@ -2395,13 +2395,13 @@ void useScreenObject() {
g_engine->_mouseManager->show();
} else {
assignText();
- hypertext(2696, 255, 0, kaka, false);
+ hypertext(2696, 255, 0, foo, false);
g_engine->_mouseManager->hide();
animateGive(0, 1);
animateOpen2(0, 1);
g_engine->_mouseManager->show();
- hypertext(kaka, 253, 249, kaka, true);
- hypertext(3246, 253, 249, kaka, true);
+ hypertext(foo, 253, 249, foo, true);
+ hypertext(3246, 253, 249, foo, true);
verb.close();
g_engine->_mouseManager->hide();
updateInventory(indicemochila);
@@ -2410,17 +2410,17 @@ void useScreenObject() {
}
} break;
case 598: {
- barro = true;
- if (torno && diablillo_verde && manual_torno) {
+ isMudDelivered = true;
+ if (isPottersWheelDelivered && isGreenDevilDelivered && isPottersManualDelivered) {
assignText();
- hypertext(2821, 255, 0, kaka, false);
+ hypertext(2821, 255, 0, foo, false);
g_engine->_mouseManager->hide();
animateGive(0, 1);
animatePickup2(0, 1);
g_engine->_mouseManager->show();
- hypertext(kaka, 253, 249, kaka, true);
- cavernas[4] = true;
- hypertext(3247, 253, 249, kaka, true);
+ hypertext(foo, 253, 249, foo, true);
+ caves[4] = true;
+ hypertext(3247, 253, 249, foo, true);
verb.close();
g_engine->_mouseManager->hide();
replaceBackpack(indicemochila, 676);
@@ -2440,13 +2440,13 @@ void useScreenObject() {
g_engine->_mouseManager->show();
} else {
assignText();
- hypertext(2821, 255, 0, kaka, false);
+ hypertext(2821, 255, 0, foo, false);
g_engine->_mouseManager->hide();
animateGive(0, 1);
animateOpen2(0, 1);
g_engine->_mouseManager->show();
- hypertext(kaka, 253, 249, kaka, true);
- hypertext(3246, 253, 249, kaka, true);
+ hypertext(foo, 253, 249, foo, true);
+ hypertext(3246, 253, 249, foo, true);
verb.close();
g_engine->_mouseManager->hide();
updateInventory(indicemochila);
@@ -2455,17 +2455,17 @@ void useScreenObject() {
}
} break;
case 623: {
- torno = true;
- if (barro && diablillo_verde && manual_torno) {
+ isPottersWheelDelivered = true;
+ if (isMudDelivered && isGreenDevilDelivered && isPottersManualDelivered) {
assignText();
- hypertext(2906, 255, 0, kaka, false);
+ hypertext(2906, 255, 0, foo, false);
g_engine->_mouseManager->hide();
animateGive(0, 1);
animatePickup2(0, 1);
g_engine->_mouseManager->show();
- hypertext(kaka, 253, 249, kaka, true);
- cavernas[4] = true;
- hypertext(3247, 253, 249, kaka, true);
+ hypertext(foo, 253, 249, foo, true);
+ caves[4] = true;
+ hypertext(3247, 253, 249, foo, true);
verb.close();
g_engine->_mouseManager->hide();
replaceBackpack(indicemochila, 676);
@@ -2485,13 +2485,13 @@ void useScreenObject() {
g_engine->_mouseManager->show();
} else {
assignText();
- hypertext(2906, 255, 0, kaka, false);
+ hypertext(2906, 255, 0, foo, false);
g_engine->_mouseManager->hide();
animateGive(0, 1);
animateOpen2(0, 1);
g_engine->_mouseManager->show();
- hypertext(kaka, 253, 249, kaka, true);
- hypertext(3246, 253, 249, kaka, true);
+ hypertext(foo, 253, 249, foo, true);
+ hypertext(3246, 253, 249, foo, true);
verb.close();
g_engine->_mouseManager->hide();
updateInventory(indicemochila);
@@ -2500,17 +2500,17 @@ void useScreenObject() {
}
} break;
case 701: {
- diablillo_verde = true;
- if (barro && torno && manual_torno) {
+ isGreenDevilDelivered = true;
+ if (isMudDelivered && isPottersWheelDelivered && isPottersManualDelivered) {
assignText();
- hypertext(3188, 255, 0, kaka, false);
+ hypertext(3188, 255, 0, foo, false);
g_engine->_mouseManager->hide();
animateGive(0, 1);
animatePickup2(0, 1);
g_engine->_mouseManager->show();
- hypertext(kaka, 253, 249, kaka, true);
- cavernas[4] = true;
- hypertext(3247, 253, 249, kaka, true);
+ hypertext(foo, 253, 249, foo, true);
+ caves[4] = true;
+ hypertext(3247, 253, 249, foo, true);
verb.close();
g_engine->_mouseManager->hide();
replaceBackpack(indicemochila, 676);
@@ -2530,13 +2530,13 @@ void useScreenObject() {
g_engine->_mouseManager->show();
} else {
assignText();
- hypertext(3188, 255, 0, kaka, false);
+ hypertext(3188, 255, 0, foo, false);
g_engine->_mouseManager->hide();
animateGive(0, 1);
animateOpen2(0, 1);
g_engine->_mouseManager->show();
- hypertext(kaka, 253, 249, kaka, true);
- hypertext(3246, 253, 249, kaka, true);
+ hypertext(foo, 253, 249, foo, true);
+ hypertext(3246, 253, 249, foo, true);
verb.close();
g_engine->_mouseManager->hide();
updateInventory(indicemochila);
@@ -2554,18 +2554,18 @@ void useScreenObject() {
iframe2 = 0;
else
iframe2++;
- if (indicetray2 >= currentRoomData->secondaryTrajectoryLength)
- indicetray2 = 1;
+ if (currentSecondaryTrajectoryIndex >= currentRoomData->secondaryTrajectoryLength)
+ currentSecondaryTrajectoryIndex = 1;
else
- indicetray2 += 1;
- animado.dir = currentRoomData->secondaryAnimDirections[indicetray2 - 1];
- animado.posx = currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].x;
- animado.posy = currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].y;
+ currentSecondaryTrajectoryIndex += 1;
+ secondaryAnimation.dir = currentRoomData->secondaryAnimDirections[currentSecondaryTrajectoryIndex - 1];
+ secondaryAnimation.posx = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].x;
+ secondaryAnimation.posy = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].y;
emptyLoop();
tocapintar = false;
emptyLoop2();
sprites(true);
- } while (!(indicetray2 == (currentRoomData->secondaryTrajectoryLength / 2)));
+ } while (!(currentSecondaryTrajectoryIndex == (currentRoomData->secondaryTrajectoryLength / 2)));
animateGive(3, 2);
updateInventory(indicemochila);
@@ -2578,19 +2578,19 @@ void useScreenObject() {
iframe2 = 0;
else
iframe2++;
- if (indicetray2 >= currentRoomData->secondaryTrajectoryLength)
- indicetray2 = 1;
+ if (currentSecondaryTrajectoryIndex >= currentRoomData->secondaryTrajectoryLength)
+ currentSecondaryTrajectoryIndex = 1;
else
- indicetray2 += 1;
- animado.dir = currentRoomData->secondaryAnimDirections[indicetray2 - 1];
- animado.posx = currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].x;
- animado.posy = currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].y;
+ currentSecondaryTrajectoryIndex += 1;
+ secondaryAnimation.dir = currentRoomData->secondaryAnimDirections[currentSecondaryTrajectoryIndex - 1];
+ secondaryAnimation.posx = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].x;
+ secondaryAnimation.posy = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].y;
emptyLoop();
tocapintar = false;
emptyLoop2();
sprites(true);
- } while (indicetray2 != currentRoomData->secondaryTrajectoryLength);
+ } while (currentSecondaryTrajectoryIndex != currentRoomData->secondaryTrajectoryLength);
disableSecondAnimation();
drawScreen(sceneBackground);
g_engine->_mouseManager->show();
@@ -2603,9 +2603,9 @@ void useScreenObject() {
replaceBackpack(indicemochila, 423);
drawBackpack();
g_engine->_mouseManager->show();
- numeroaccion = 0;
- oldxrejilla = 0;
- oldyrejilla = 0;
+ actionCode = 0;
+ oldGridX = 0;
+ oldGridY = 0;
checkMouseGrid();
} break;
case 219: {
@@ -2618,11 +2618,11 @@ void useScreenObject() {
if (tocapintar) {
if (saltospal >= 4) {
saltospal = 0;
- if (movidapaleta > 6)
- movidapaleta = 0;
+ if (isPaletteAnimEnabled > 6)
+ isPaletteAnimEnabled = 0;
else
- movidapaleta += 1;
- updatePalette(movidapaleta);
+ isPaletteAnimEnabled += 1;
+ updatePalette(isPaletteAnimEnabled);
} else
saltospal += 1;
tocapintar = false;
@@ -2663,9 +2663,9 @@ void useScreenObject() {
mobj[indicemochila].objectName = regobj.name;
animatedSequence(4);
g_engine->_mouseManager->show();
- numeroaccion = 0;
- oldxrejilla = 0;
- oldyrejilla = 0;
+ actionCode = 0;
+ oldGridX = 0;
+ oldGridY = 0;
checkMouseGrid();
} break;
case 221: {
@@ -2703,18 +2703,18 @@ void useScreenObject() {
drawBackpack();
g_engine->_mouseManager->show();
updateItem(mobj[indicemochila].code);
- alacena_abierta = true;
+ isCupboardOpen = true;
} break;
case 274: {
drawText(regobj.useTextRef);
g_engine->_mouseManager->hide();
g_engine->_sound->playVoc("CINCEL", 334779, 19490);
- animatePickup1(direccionmovimiento, 2);
+ animatePickup1(characterFacingDir, 2);
g_engine->_sound->waitForSoundEnd();
- animateOpen2(direccionmovimiento, 2);
+ animateOpen2(characterFacingDir, 2);
g_engine->_mouseManager->show();
updateItem(regobj.code);
- baul_abierto = true;
+ isChestOpen = true;
} break;
case 416: {
updateItem(regobj.code);
@@ -2761,15 +2761,15 @@ void useScreenObject() {
case 562: { // put any object in the alcoves
switch (currentRoomData->code) {
case 20: {
- if (hornacina[0][hornacina[0][3]] == 0) {
+ if (niche[0][niche[0][3]] == 0) {
- if (hornacina[0][3] == 0) {
- hornacina[0][0] = regobj.code;
+ if (niche[0][3] == 0) {
+ niche[0][0] = regobj.code;
drawText(regobj.useTextRef);
g_engine->_mouseManager->hide();
currentRoomData->screenObjectIndex[9]->objectName = " ";
animateGive(3, 1);
- switch (hornacina[0][0]) {
+ switch (niche[0][0]) {
case 561: {
currentRoomData->screenObjectIndex[9]->objectName = getObjectName(5);
readBitmap(1182652, screenObjects[0], 892, 319);
@@ -2795,9 +2795,9 @@ void useScreenObject() {
g_engine->_mouseManager->show();
} else {
- hornacina[0][hornacina[0][3]] = regobj.code;
- hornacina[1][3] += 1;
- hornacina[0][3] -= 1;
+ niche[0][niche[0][3]] = regobj.code;
+ niche[1][3] += 1;
+ niche[0][3] -= 1;
drawText(regobj.useTextRef);
g_engine->_mouseManager->hide();
animateGive(3, 1);
@@ -2817,7 +2817,7 @@ void useScreenObject() {
drawBackpack();
currentRoomData->screenObjectIndex[9]->objectName = " ";
g_engine->_sound->playVoc("PLATAF", 375907, 14724);
- switch (hornacina[0][hornacina[0][3]]) {
+ switch (niche[0][niche[0][3]]) {
case 0: {
currentRoomData->screenObjectIndex[9]->objectName = getObjectName(4);
nicheAnimation(1, 1190768);
@@ -2851,16 +2851,16 @@ void useScreenObject() {
}
} break;
case 24: {
- if (hornacina[1][hornacina[1][3]] == 0) {
+ if (niche[1][niche[1][3]] == 0) {
- if (hornacina[1][3] == 0) {
+ if (niche[1][3] == 0) {
- hornacina[1][0] = regobj.code;
+ niche[1][0] = regobj.code;
drawText(regobj.useTextRef);
g_engine->_mouseManager->hide();
currentRoomData->screenObjectIndex[8]->objectName = " ";
animateGive(0, 1);
- switch (hornacina[1][0]) {
+ switch (niche[1][0]) {
case 561: {
currentRoomData->screenObjectIndex[8]->objectName = getObjectName(5);
readBitmap(1381982, screenObjects[0], 892, 319);
@@ -2886,9 +2886,9 @@ void useScreenObject() {
g_engine->_mouseManager->show();
} else {
- hornacina[1][hornacina[1][3]] = regobj.code;
- hornacina[0][3] += 1;
- hornacina[1][3] -= 1;
+ niche[1][niche[1][3]] = regobj.code;
+ niche[0][3] += 1;
+ niche[1][3] -= 1;
drawText(regobj.useTextRef);
g_engine->_mouseManager->hide();
animateGive(0, 1);
@@ -2912,7 +2912,7 @@ void useScreenObject() {
drawBackpack();
currentRoomData->screenObjectIndex[8]->objectName = " ";
g_engine->_sound->playVoc("PLATAF", 375907, 14724);
- switch (hornacina[1][hornacina[1][3]]) {
+ switch (niche[1][niche[1][3]]) {
case 0: {
currentRoomData->screenObjectIndex[8]->objectName = getObjectName(4);
nicheAnimation(1, 1399610);
@@ -3032,14 +3032,14 @@ void useScreenObject() {
drawScreen(sceneBackground);
updateInventory(indicemochila);
drawBackpack();
- trampa_puesta = true;
+ isTrapSet = true;
g_engine->_mouseManager->show();
} break;
case 632: {
long offset = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0][21] : flcOffsets[1][21];
drawText(regobj.useTextRef);
g_engine->_mouseManager->hide();
- animateGive(direccionmovimiento, 1);
+ animateGive(characterFacingDir, 1);
// Show feather on pedestal
loadItem(187, 70, 104, 1545820, 8);
@@ -3048,7 +3048,7 @@ void useScreenObject() {
drawScreen(sceneBackground);
g_engine->_screen->update();
- animateOpen2(direccionmovimiento, 1);
+ animateOpen2(characterFacingDir, 1);
g_engine->_mouseManager->show();
goToObject(currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount], 14);
g_engine->_mouseManager->hide();
@@ -3096,9 +3096,9 @@ void useScreenObject() {
for (indlista = 35; indlista <= 37; indlista++)
for (indmoch = 21; indmoch <= 25; indmoch++)
currentRoomData->mouseGrid[indlista][indmoch] = 11;
- guadagna = true;
- if (tridente)
- cavernas[3] = true;
+ isScytheTaken = true;
+ if (isTridentTaken)
+ caves[3] = true;
} break;
case 633: { //Use ring!
long offset = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0][22] : flcOffsets[1][22];
@@ -3154,9 +3154,9 @@ void useScreenObject() {
for (indlista = 0; indlista <= 2; indlista++)
for (indmoch = 10; indmoch <= 12; indmoch++)
currentRoomData->mouseGrid[indlista][indmoch] = 10;
- tridente = true;
- if (guadagna)
- cavernas[3] = true;
+ isTridentTaken = true;
+ if (isScytheTaken)
+ caves[3] = true;
} break;
case 643: { // Urn with altar
long offset = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0][23] : flcOffsets[1][23];
@@ -3184,10 +3184,10 @@ void useScreenObject() {
for (indlista = 18; indlista <= 20; indlista++)
for (indmoch = 8; indmoch <= 14; indmoch++)
currentRoomData->mouseGrid[indlista][indmoch] = 12;
- sello_quitado = true;
- cavernas[1] = false;
- cavernas[0] = false;
- cavernas[4] = false;
+ isSealRemoved = true;
+ caves[1] = false;
+ caves[0] = false;
+ caves[4] = false;
g_engine->_mouseManager->show();
} break;
case 657: { // sharpen scythe
@@ -3206,8 +3206,8 @@ void useScreenObject() {
} break;
case 686: {
drawText(regobj.useTextRef);
- vasijapuesta = true;
- cavernas[4] = false;
+ isVasePlaced = true;
+ caves[4] = false;
g_engine->_mouseManager->hide();
animateGive(1, 1);
updateInventory(indicemochila);
@@ -3289,7 +3289,7 @@ void useScreenObject() {
case 709: { // rock with mural
long offset = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0][27] : flcOffsets[1][27];
- if (sello_quitado) {
+ if (isSealRemoved) {
drawText(regobj.useTextRef);
g_engine->_mouseManager->hide();
animatePickup1(0, 1);
@@ -3312,7 +3312,7 @@ void useScreenObject() {
g_engine->_sound->playVoc("PUFF", 191183, 18001);
animateOpen2(0, 1);
drawFlc(180, 50, offset, 0, 9, 22, false, false, true, basurillalog);
- salirdeljuego = true;
+ shouldQuitGame = true;
} else
drawText(Random(11) + 1022);
} break;
@@ -3372,8 +3372,8 @@ void useScreenObject() {
g_engine->_mouseManager->hide();
animatePickup1(0, 1);
animateOpen2(0, 1);
- teleencendida = !(teleencendida);
- if (teleencendida) {
+ isTVOn = !(isTVOn);
+ if (isTVOn) {
g_engine->_sound->playVoc("CLICK", 27742, 2458);
g_engine->_sound->waitForSoundEnd();
currentRoomData->paletteAnimationFlag = true;
@@ -3435,7 +3435,7 @@ void useScreenObject() {
g_engine->_sound->waitForSoundEnd();
animateOpen2(0, 1);
g_engine->_sound->playVoc("FUEGO", 72598, 9789);
- if (vasijapuesta) {
+ if (isVasePlaced) {
drawFlc(108, 0, offsetWithJar, 0, 9, 0, false, false, true, basurillalog);
{
RoomBitmapRegister &with = currentRoomData->screenLayers[0];
@@ -3462,9 +3462,9 @@ void useScreenObject() {
}
}
}
- oldxrejilla = 0;
- oldyrejilla = 0;
- numeroaccion = 0;
+ oldGridX = 0;
+ oldGridY = 0;
+ actionCode = 0;
checkMouseGrid();
}
@@ -3490,11 +3490,11 @@ void openScreenObject() {
sueltapegote = false;
switch (regobj.code) {
case 227:
- if (alacena_abierta == false)
+ if (isCupboardOpen == false)
sueltapegote = true;
break;
case 274:
- if (baul_abierto == false)
+ if (isChestOpen == false)
sueltapegote = true;
break;
case 415:
@@ -3525,10 +3525,10 @@ void openScreenObject() {
currentRoomData->mouseGrid[indicex][indicey] = 43;
for (indicex = 33; indicex <= 35; indicex++)
currentRoomData->mouseGrid[indicex][13] = 43;
- numeroaccion = 0;
- oldxrejilla = 0;
- oldyrejilla = 0;
- oldzonadestino = 0;
+ actionCode = 0;
+ oldGridX = 0;
+ oldGridY = 0;
+ oldTargetZone = 0;
checkMouseGrid();
return;
}
@@ -3573,9 +3573,9 @@ void openScreenObject() {
for (indicex = 35; indicex <= 39; indicex++)
for (indicey = 0; indicey <= 10; indicey++)
currentRoomData->mouseGrid[indicex][indicey] = 8;
- numeroaccion = 0;
- oldxrejilla = 0;
- oldyrejilla = 0;
+ actionCode = 0;
+ oldGridX = 0;
+ oldGridY = 0;
checkMouseGrid();
return;
}
@@ -3589,19 +3589,19 @@ void openScreenObject() {
g_engine->_mouseManager->hide();
switch (regobj.height) {
case 0: {
- animatePickup1(direccionmovimiento, 0);
+ animatePickup1(characterFacingDir, 0);
updateVideo();
- animateOpen2(direccionmovimiento, 0);
+ animateOpen2(characterFacingDir, 0);
} break;
case 1: {
- animatePickup1(direccionmovimiento, 1);
+ animatePickup1(characterFacingDir, 1);
updateVideo();
- animateOpen2(direccionmovimiento, 1);
+ animateOpen2(characterFacingDir, 1);
} break;
case 2: {
- animatePickup1(direccionmovimiento, 2);
+ animatePickup1(characterFacingDir, 2);
updateVideo();
- animateOpen2(direccionmovimiento, 2);
+ animateOpen2(characterFacingDir, 2);
} break;
}
g_engine->_mouseManager->show();
@@ -3615,10 +3615,10 @@ void openScreenObject() {
currentRoomData->screenLayers[indicex].bitmapPointer = regobj.dropOverlay;
currentRoomData->screenLayers[indicex].bitmapSize = regobj.dropOverlaySize;
}
- numeroaccion = 0;
+ actionCode = 0;
}
- oldxrejilla = 0;
- oldyrejilla = 0;
+ oldGridX = 0;
+ oldGridY = 0;
checkMouseGrid();
}
@@ -3644,12 +3644,12 @@ void closeScreenObject() {
switch (regobj.code) {
case 224:
case 226:
- if (alacena_abierta == false)
+ if (isCupboardOpen == false)
sueltapegote = true;
break;
case 275:
case 277:
- if (baul_abierto == false)
+ if (isChestOpen == false)
sueltapegote = true;
break;
}
@@ -3661,19 +3661,19 @@ void closeScreenObject() {
g_engine->_mouseManager->hide();
switch (regobj.height) {
case 0: {
- animatePickup1(direccionmovimiento, 0);
+ animatePickup1(characterFacingDir, 0);
updateVideo();
- animateOpen2(direccionmovimiento, 0);
+ animateOpen2(characterFacingDir, 0);
} break;
case 1: {
- animatePickup1(direccionmovimiento, 1);
+ animatePickup1(characterFacingDir, 1);
updateVideo();
- animateOpen2(direccionmovimiento, 1);
+ animateOpen2(characterFacingDir, 1);
} break;
case 2: {
- animatePickup1(direccionmovimiento, 2);
+ animatePickup1(characterFacingDir, 2);
updateVideo();
- animateOpen2(direccionmovimiento, 2);
+ animateOpen2(characterFacingDir, 2);
} break;
}
g_engine->_mouseManager->show();
@@ -3687,17 +3687,17 @@ void closeScreenObject() {
currentRoomData->screenLayers[indicex].bitmapPointer = regobj.dropOverlay;
currentRoomData->screenLayers[indicex].bitmapSize = regobj.dropOverlaySize;
}
- numeroaccion = 0;
+ actionCode = 0;
}
- oldxrejilla = 0;
- oldyrejilla = 0;
+ oldGridX = 0;
+ oldGridY = 0;
checkMouseGrid();
}
void action() {
bar(0, 140, 319, 149, 0);
Common::String actionLine;
- switch (numeroaccion) {
+ switch (actionCode) {
case 0:
actionLine = getActionLineText(0);
break;
@@ -3712,7 +3712,7 @@ void action() {
break;
case 4: {
actionLine = getActionLineText(4);
- objetomochila = "";
+ inventoryObjectName = "";
} break;
case 5:
actionLine = getActionLineText(5);
@@ -3727,17 +3727,17 @@ void action() {
void handleAction(byte posinv) {
bar(0, 140, 319, 149, 0);
- switch (numeroaccion) {
+ switch (actionCode) {
case 1: {
g_engine->_mouseManager->hide();
actionLineText(getActionLineText(1) + mobj[posinv].objectName);
g_engine->_mouseManager->show();
drawText((Random(10) + 1039));
- numeroaccion = 0;
+ actionCode = 0;
if (contadorpc > 130)
showError(274);
- oldxrejilla = 0;
- oldyrejilla = 0;
+ oldGridX = 0;
+ oldGridY = 0;
checkMouseGrid();
} break;
case 2: {
@@ -3747,36 +3747,36 @@ void handleAction(byte posinv) {
showError(274);
g_engine->_mouseManager->show();
drawText((Random(10) + 1049));
- numeroaccion = 0;
- oldxrejilla = 0;
- oldyrejilla = 0;
+ actionCode = 0;
+ oldGridX = 0;
+ oldGridY = 0;
checkMouseGrid();
} break;
case 3: {
g_engine->_mouseManager->hide();
actionLineText(getActionLineText(3) + mobj[posinv].objectName);
g_engine->_mouseManager->show();
- numeroaccion = 0;
+ actionCode = 0;
lookInventoryObject(posinv);
- oldxrejilla = 0;
- oldyrejilla = 0;
+ oldGridX = 0;
+ oldGridY = 0;
checkMouseGrid();
} break;
case 4:
- if (objetomochila == "") {
+ if (inventoryObjectName == "") {
g_engine->_mouseManager->hide();
actionLineText(getActionLineText(4) + mobj[posinv].objectName + getActionLineText(7));
g_engine->_mouseManager->show();
- objetomochila = mobj[posinv].objectName;
- codigoobjmochila = mobj[posinv].code;
+ inventoryObjectName = mobj[posinv].objectName;
+ backpackObjectCode = mobj[posinv].code;
} else {
- numeroaccion = 0;
+ actionCode = 0;
if (contadorpc > 25)
showError(274);
- useInventoryObjectWithInventoryObject(codigoobjmochila, mobj[posinv].code);
- oldxrejilla = 0;
- oldyrejilla = 0;
+ useInventoryObjectWithInventoryObject(backpackObjectCode, mobj[posinv].code);
+ oldGridX = 0;
+ oldGridY = 0;
checkMouseGrid();
}
break;
@@ -3785,9 +3785,9 @@ void handleAction(byte posinv) {
actionLineText(getActionLineText(5) + mobj[posinv].objectName);
g_engine->_mouseManager->show();
drawText(Random(9) + 1059);
- numeroaccion = 0;
- oldxrejilla = 0;
- oldyrejilla = 0;
+ actionCode = 0;
+ oldGridX = 0;
+ oldGridY = 0;
checkMouseGrid();
} break;
case 6: {
@@ -3795,11 +3795,11 @@ void handleAction(byte posinv) {
actionLineText(getActionLineText(6) + mobj[posinv].objectName);
g_engine->_mouseManager->show();
drawText(Random(10) + 1068);
- numeroaccion = 0;
+ actionCode = 0;
if (contadorpc2 > 35)
showError(274);
- oldxrejilla = 0;
- oldyrejilla = 0;
+ oldGridX = 0;
+ oldGridY = 0;
checkMouseGrid();
} break;
}
@@ -3887,7 +3887,7 @@ static void scrollRight(uint &horizontalPos) {
int characterPos = 25 + (320 - (characterPosX + characterCorrectionX * 2));
// We scroll 4 by 4 pixels so we divide by 4 to find out the number of necessary steps
uint stepCount = (320 - horizontalPos) >> 2;
- byte *assembledCharacterFrame = (byte *)malloc(sizeframe);
+ byte *assembledCharacterFrame = (byte *)malloc(mainCharFrameSize);
// Number of bytes to move
size_t numBytes = 44796;
for (int i = 0; i < stepCount; i++) {
@@ -3909,10 +3909,10 @@ static void scrollRight(uint &horizontalPos) {
characterPosX -= 2;
- curCharacterAnimationFrame = secuencia.bitmap[1][iframe];
+ curCharacterAnimationFrame = mainCharAnimation.bitmap[1][iframe];
// We need to copy the original frame as to not replace its black background for after
// the scroll ends. Original code would copy from XMS memory.
- Common::copy(curCharacterAnimationFrame, curCharacterAnimationFrame + sizeframe, assembledCharacterFrame);
+ Common::copy(curCharacterAnimationFrame, curCharacterAnimationFrame + mainCharFrameSize, assembledCharacterFrame);
// puts the original captured background back in the background for next iteration
g_engine->_graphics->putImageArea(characterPosX - 2, characterPosY, sceneBackground, spriteBackground);
@@ -3940,7 +3940,7 @@ static void scrollLeft(uint &poshor) {
// We scroll 4 by 4 pixels so we divide by 4 to find out the number of necessary steps
uint numpasos = poshor >> 2;
- byte *assembledCharacterFrame = (byte *)malloc(sizeframe);
+ byte *assembledCharacterFrame = (byte *)malloc(mainCharFrameSize);
size_t numBytes = 44796;
for (int i = numpasos; i >= 1; i--) {
for (int j = numBytes; j > 0; j--) {
@@ -3964,8 +3964,8 @@ static void scrollLeft(uint &poshor) {
characterPosX += 2;
- curCharacterAnimationFrame = secuencia.bitmap[3][iframe];
- Common::copy(curCharacterAnimationFrame, curCharacterAnimationFrame + sizeframe, assembledCharacterFrame);
+ curCharacterAnimationFrame = mainCharAnimation.bitmap[3][iframe];
+ Common::copy(curCharacterAnimationFrame, curCharacterAnimationFrame + mainCharFrameSize, assembledCharacterFrame);
g_engine->_graphics->putImageArea(characterPosX + 2, characterPosY, sceneBackground, spriteBackground);
@@ -4025,7 +4025,7 @@ void loadScrollData(uint numpantalla, bool scrollder, uint poshor, int correccio
Common::copy(sceneBackground, sceneBackground + 44804, backgroundCopy);
// Fondo contains background B + objects, handpantalla contains background B + objects
- movidapaleta = 0;
+ isPaletteAnimEnabled = 0;
getScreen(sceneBackground);
// Fondo now contains full background A again, handpantalla contains background B + objects
@@ -4044,100 +4044,100 @@ void loadScrollData(uint numpantalla, bool scrollder, uint poshor, int correccio
drawScreen(sceneBackground);
free(spriteBackground);
loadScreen();
- trayec[indicetray].x = characterPosX;
- trayec[indicetray].y = characterPosY;
+ trajectory[currentTrajectoryIndex].x = characterPosX;
+ trajectory[currentTrajectoryIndex].y = characterPosY;
}
void saveGameToRegister() {
uint indiaux;
- regpartida.numeropantalla = currentRoomData->code;
- regpartida.longtray = longtray;
- regpartida.indicetray = indicetray;
- regpartida.codigoobjmochila = codigoobjmochila;
- regpartida.volumenfxderecho = rightSfxVol;
- regpartida.volumenfxizquierdo = leftSfxVol;
- regpartida.volumenmelodiaderecho = musicVolRight;
- regpartida.volumenmelodiaizquierdo = musicVolLeft;
- regpartida.oldxrejilla = oldxrejilla;
- regpartida.oldyrejilla = oldyrejilla;
- regpartida.animadoprofundidad = animado.depth;
- regpartida.animadodir = animado.dir;
- regpartida.animadoposx = animado.posx;
- regpartida.animadoposy = animado.posy;
- regpartida.animadoiframe2 = iframe2;
-
- regpartida.zonaactual = zonaactual;
- regpartida.zonadestino = zonadestino;
- regpartida.oldzonadestino = oldzonadestino;
- regpartida.posicioninv = posicioninv;
- regpartida.numeroaccion = numeroaccion;
- regpartida.oldnumeroacc = oldnumeroacc;
- regpartida.pasos = pasos;
- regpartida.indicepuertas = indicepuertas;
- regpartida.direccionmovimiento = direccionmovimiento;
- regpartida.iframe = iframe;
- regpartida.parte_del_juego = gamePart;
-
- regpartida.sello_quitado = sello_quitado;
- regpartida.lista1 = lista1;
- regpartida.lista2 = lista2;
- regpartida.completadalista1 = list1Complete;
- regpartida.completadalista2 = list2Complete;
- regpartida.vasijapuesta = vasijapuesta;
- regpartida.guadagna = guadagna;
- regpartida.tridente = tridente;
- regpartida.torno = torno;
- regpartida.barro = barro;
- regpartida.diablillo_verde = diablillo_verde;
- regpartida.rojo_capturado = rojo_capturado;
- regpartida.manual_torno = manual_torno;
- regpartida.alacena_abierta = alacena_abierta;
- regpartida.baul_abierto = baul_abierto;
- regpartida.teleencendida = teleencendida;
- regpartida.trampa_puesta = trampa_puesta;
+ savedGame.roomCode = currentRoomData->code;
+ savedGame.trajectoryLength = trajectoryLength;
+ savedGame.currentTrajectoryIndex = currentTrajectoryIndex;
+ savedGame.backpackObjectCode = backpackObjectCode;
+ savedGame.rightSfxVol = rightSfxVol;
+ savedGame.leftSfxVol = leftSfxVol;
+ savedGame.musicVolRight = musicVolRight;
+ savedGame.musicVolLeft = musicVolLeft;
+ savedGame.oldGridX = oldGridX;
+ savedGame.oldGridY = oldGridY;
+ savedGame.secAnimDepth = secondaryAnimation.depth;
+ savedGame.secAnimDir = secondaryAnimation.dir;
+ savedGame.secAnimX = secondaryAnimation.posx;
+ savedGame.secAnimY = secondaryAnimation.posy;
+ savedGame.secAnimIFrame = iframe2;
+
+ savedGame.currentZone = currentZone;
+ savedGame.targetZone = targetZone;
+ savedGame.oldTargetZone = oldTargetZone;
+ savedGame.inventoryPosition = inventoryPosition;
+ savedGame.actionCode = actionCode;
+ savedGame.oldActionCode = oldActionCode;
+ savedGame.steps = steps;
+ savedGame.doorIndex = doorIndex;
+ savedGame.characterFacingDir = characterFacingDir;
+ savedGame.iframe = iframe;
+ savedGame.gamePart = gamePart;
+
+ savedGame.isSealRemoved = isSealRemoved;
+ savedGame.obtainedList1 = obtainedList1;
+ savedGame.obtainedList2 = obtainedList2;
+ savedGame.list1Complete = list1Complete;
+ savedGame.list2Complete = list2Complete;
+ savedGame.isVasePlaced = isVasePlaced;
+ savedGame.isScytheTaken = isScytheTaken;
+ savedGame.isTridentTaken = isTridentTaken;
+ savedGame.isPottersWheelDelivered = isPottersWheelDelivered;
+ savedGame.isMudDelivered = isMudDelivered;
+ savedGame.isGreenDevilDelivered = isGreenDevilDelivered;
+ savedGame.isRedDevilCaptured = isRedDevilCaptured;
+ savedGame.isPottersManualDelivered = isPottersManualDelivered;
+ savedGame.isCupboardOpen = isCupboardOpen;
+ savedGame.isChestOpen = isChestOpen;
+ savedGame.isTVOn = isTVOn;
+ savedGame.isTrapSet = isTrapSet;
for (indiaux = 0; indiaux < inventoryIconCount; indiaux++) {
- regpartida.mobj[indiaux].bitmapIndex = mobj[indiaux].bitmapIndex;
- regpartida.mobj[indiaux].code = mobj[indiaux].code;
- regpartida.mobj[indiaux].objectName = mobj[indiaux].objectName;
+ savedGame.mobj[indiaux].bitmapIndex = mobj[indiaux].bitmapIndex;
+ savedGame.mobj[indiaux].code = mobj[indiaux].code;
+ savedGame.mobj[indiaux].objectName = mobj[indiaux].objectName;
}
- regpartida.elemento1 = elemento1;
- regpartida.elemento2 = elemento2;
- regpartida.xframe = characterPosX;
- regpartida.yframe = characterPosY;
- regpartida.xframe2 = xframe2;
- regpartida.yframe2 = yframe2;
+ savedGame.element1 = element1;
+ savedGame.element2 = element2;
+ savedGame.characterPosX = characterPosX;
+ savedGame.characterPosY = characterPosY;
+ savedGame.xframe2 = xframe2;
+ savedGame.yframe2 = yframe2;
- regpartida.oldobjmochila = oldobjmochila;
- regpartida.objetomochila = objetomochila;
- regpartida.nombrepersonaje = characterName;
+ savedGame.oldInventoryObjectName = oldInventoryObjectName;
+ savedGame.objetomoinventoryObjectNamehila = inventoryObjectName;
+ savedGame.characterName = characterName;
for (int i = 0; i < routePointCount; i++) {
- regpartida.mainRoute[i].x = mainRoute[i].x;
- regpartida.mainRoute[i].y = mainRoute[i].y;
+ savedGame.mainRoute[i].x = mainRoute[i].x;
+ savedGame.mainRoute[i].y = mainRoute[i].y;
}
for (indiaux = 0; indiaux < 300; indiaux++) {
- regpartida.trayec[indiaux].x = trayec[indiaux].x;
- regpartida.trayec[indiaux].y = trayec[indiaux].y;
+ savedGame.trajectory[indiaux].x = trajectory[indiaux].x;
+ savedGame.trajectory[indiaux].y = trajectory[indiaux].y;
}
for (indiaux = 0; indiaux < characterCount; indiaux++) {
- regpartida.primera[indiaux] = primera[indiaux];
- regpartida.lprimera[indiaux] = lprimera[indiaux];
- regpartida.cprimera[indiaux] = cprimera[indiaux];
- regpartida.libro[indiaux] = libro[indiaux];
- regpartida.caramelos[indiaux] = caramelos[indiaux];
+ savedGame.firstTimeTopicA[indiaux] = firstTimeTopicA[indiaux];
+ savedGame.firstTimeTopicB[indiaux] = firstTimeTopicB[indiaux];
+ savedGame.firstTimeTopicC[indiaux] = firstTimeTopicC[indiaux];
+ savedGame.bookTopic[indiaux] = bookTopic[indiaux];
+ savedGame.mintTopic[indiaux] = mintTopic[indiaux];
}
for (indiaux = 0; indiaux < 5; indiaux++) {
- regpartida.cavernas[indiaux] = cavernas[indiaux];
- regpartida.firstList[indiaux] = firstList[indiaux];
- regpartida.secondList[indiaux] = secondList[indiaux];
+ savedGame.caves[indiaux] = caves[indiaux];
+ savedGame.firstList[indiaux] = firstList[indiaux];
+ savedGame.secondList[indiaux] = secondList[indiaux];
}
for (indiaux = 0; indiaux < 4; indiaux++) {
- regpartida.hornacina[0][indiaux] = hornacina[0][indiaux];
- regpartida.hornacina[1][indiaux] = hornacina[1][indiaux];
+ savedGame.niche[0][indiaux] = niche[0][indiaux];
+ savedGame.niche[1][indiaux] = niche[1][indiaux];
}
}
@@ -4148,103 +4148,103 @@ void loadGame(SavedGame game) {
uint indiaux, indiaux2;
transitionEffect = Random(15) + 1;
- longtray = game.longtray;
- indicetray = game.indicetray;
- codigoobjmochila = game.codigoobjmochila;
- rightSfxVol = game.volumenfxderecho;
- leftSfxVol = game.volumenfxizquierdo;
- musicVolRight = game.volumenmelodiaderecho;
- musicVolLeft = game.volumenmelodiaizquierdo;
- oldxrejilla = game.oldxrejilla;
- oldyrejilla = game.oldyrejilla;
- animado.depth = game.animadoprofundidad;
- animado.dir = game.animadodir;
- animado.posx = game.animadoposx;
- animado.posy = game.animadoposy;
- iframe2 = game.animadoiframe2;
- zonaactual = game.zonaactual;
- zonadestino = game.zonadestino;
- oldzonadestino = game.oldzonadestino;
- posicioninv = game.posicioninv;
- numeroaccion = game.numeroaccion;
- oldnumeroacc = game.oldnumeroacc;
- pasos = game.pasos;
- indicepuertas = game.indicepuertas;
- direccionmovimiento = game.direccionmovimiento;
+ trajectoryLength = game.trajectoryLength;
+ currentTrajectoryIndex = game.currentTrajectoryIndex;
+ backpackObjectCode = game.backpackObjectCode;
+ rightSfxVol = game.rightSfxVol;
+ leftSfxVol = game.leftSfxVol;
+ musicVolRight = game.musicVolRight;
+ musicVolLeft = game.musicVolLeft;
+ oldGridX = game.oldGridX;
+ oldGridY = game.oldGridY;
+ secondaryAnimation.depth = game.secAnimDepth;
+ secondaryAnimation.dir = game.secAnimDir;
+ secondaryAnimation.posx = game.secAnimX;
+ secondaryAnimation.posy = game.secAnimY;
+ iframe2 = game.secAnimIFrame;
+ currentZone = game.currentZone;
+ targetZone = game.targetZone;
+ oldTargetZone = game.oldTargetZone;
+ inventoryPosition = game.inventoryPosition;
+ actionCode = game.actionCode;
+ oldActionCode = game.oldActionCode;
+ steps = game.steps;
+ doorIndex = game.doorIndex;
+ characterFacingDir = game.characterFacingDir;
iframe = game.iframe;
- if (game.parte_del_juego != gamePart) {
- gamePart = game.parte_del_juego;
+ if (game.gamePart != gamePart) {
+ gamePart = game.gamePart;
for (int i = 0; i < inventoryIconCount; i++) {
free(mochilaxms[i]);
}
loadObjects();
}
- sello_quitado = game.sello_quitado;
- lista1 = game.lista1;
- lista2 = game.lista2;
- list1Complete = game.completadalista1;
- list2Complete = game.completadalista2;
- vasijapuesta = game.vasijapuesta;
- guadagna = game.guadagna;
+ isSealRemoved = game.isSealRemoved;
+ obtainedList1 = game.obtainedList1;
+ obtainedList2 = game.obtainedList2;
+ list1Complete = game.list1Complete;
+ list2Complete = game.list2Complete;
+ isVasePlaced = game.isVasePlaced;
+ isScytheTaken = game.isScytheTaken;
if (contadorpc > 24)
showError(274);
- tridente = game.tridente;
- torno = game.torno;
- barro = game.barro;
- diablillo_verde = game.diablillo_verde;
- rojo_capturado = game.rojo_capturado;
- manual_torno = game.manual_torno;
- alacena_abierta = game.alacena_abierta;
- baul_abierto = game.baul_abierto;
- teleencendida = game.teleencendida;
- trampa_puesta = game.trampa_puesta;
+ isTridentTaken = game.isTridentTaken;
+ isPottersWheelDelivered = game.isPottersWheelDelivered;
+ isMudDelivered = game.isMudDelivered;
+ isGreenDevilDelivered = game.isGreenDevilDelivered;
+ isRedDevilCaptured = game.isRedDevilCaptured;
+ isPottersManualDelivered = game.isPottersManualDelivered;
+ isCupboardOpen = game.isCupboardOpen;
+ isChestOpen = game.isChestOpen;
+ isTVOn = game.isTVOn;
+ isTrapSet = game.isTrapSet;
for (indiaux = 0; indiaux < inventoryIconCount; indiaux++) {
mobj[indiaux].bitmapIndex = game.mobj[indiaux].bitmapIndex;
mobj[indiaux].code = game.mobj[indiaux].code;
mobj[indiaux].objectName = game.mobj[indiaux].objectName;
}
- elemento1 = game.elemento1;
- elemento2 = game.elemento2;
- characterPosX = game.xframe;
- characterPosY = game.yframe;
+ element1 = game.element1;
+ element2 = game.element2;
+ characterPosX = game.characterPosX;
+ characterPosY = game.characterPosY;
xframe2 = game.xframe2;
yframe2 = game.yframe2;
- oldobjmochila = game.oldobjmochila;
- objetomochila = game.objetomochila;
- characterName = game.nombrepersonaje;
+ oldInventoryObjectName = game.oldInventoryObjectName;
+ inventoryObjectName = game.objetomoinventoryObjectNamehila;
+ characterName = game.characterName;
for (int i = 0; i < routePointCount; i++) {
mainRoute[i].x = game.mainRoute[i].x;
mainRoute[i].y = game.mainRoute[i].y;
}
for (indiaux = 0; indiaux < 300; indiaux++) {
- trayec[indiaux].x = game.trayec[indiaux].x;
- trayec[indiaux].y = game.trayec[indiaux].y;
+ trajectory[indiaux].x = game.trajectory[indiaux].x;
+ trajectory[indiaux].y = game.trajectory[indiaux].y;
}
for (indiaux = 0; indiaux < characterCount; indiaux++) {
- primera[indiaux] = game.primera[indiaux];
- lprimera[indiaux] = game.lprimera[indiaux];
- cprimera[indiaux] = game.cprimera[indiaux];
- libro[indiaux] = game.libro[indiaux];
- caramelos[indiaux] = game.caramelos[indiaux];
+ firstTimeTopicA[indiaux] = game.firstTimeTopicA[indiaux];
+ firstTimeTopicB[indiaux] = game.firstTimeTopicB[indiaux];
+ firstTimeTopicC[indiaux] = game.firstTimeTopicC[indiaux];
+ bookTopic[indiaux] = game.bookTopic[indiaux];
+ mintTopic[indiaux] = game.mintTopic[indiaux];
}
for (indiaux = 0; indiaux < 5; indiaux++) {
- cavernas[indiaux] = game.cavernas[indiaux];
+ caves[indiaux] = game.caves[indiaux];
firstList[indiaux] = game.firstList[indiaux];
secondList[indiaux] = game.secondList[indiaux];
}
for (indiaux = 0; indiaux < 4; indiaux++) {
- hornacina[0][indiaux] = game.hornacina[0][indiaux];
- hornacina[1][indiaux] = game.hornacina[1][indiaux];
+ niche[0][indiaux] = game.niche[0][indiaux];
+ niche[1][indiaux] = game.niche[1][indiaux];
}
totalFadeOut(0);
g_engine->_screen->clear();
loadPalette("DEFAULT");
- loadScreenData(game.numeropantalla);
+ loadScreenData(game.roomCode);
switch (currentRoomData->code) {
case 2: {
- if (teleencendida)
+ if (isTVOn)
g_engine->_sound->autoPlayVoc("PARASITO", 355778, 20129);
else
cargatele();
@@ -4263,11 +4263,11 @@ void loadGame(SavedGame game) {
g_engine->_sound->autoPlayVoc("CALDERA", 6433, 15386);
} break;
case 17: {
- if (libro[0] == true && currentRoomData->animationFlag)
+ if (bookTopic[0] == true && currentRoomData->animationFlag)
disableSecondAnimation();
} break;
case 20: {
- switch (hornacina[0][hornacina[0][3]]) {
+ switch (niche[0][niche[0][3]]) {
case 0:
currentRoomData->screenObjectIndex[9]->objectName = getObjectName(4);
break;
@@ -4287,7 +4287,7 @@ void loadGame(SavedGame game) {
g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
} break;
case 24: {
- switch (hornacina[1][hornacina[1][3]]) {
+ switch (niche[1][niche[1][3]]) {
case 0:
currentRoomData->screenObjectIndex[8]->objectName = getObjectName(4);
break;
@@ -4304,24 +4304,24 @@ void loadGame(SavedGame game) {
currentRoomData->screenObjectIndex[8]->objectName = getObjectName(9);
break;
}
- if (trampa_puesta) {
+ if (isTrapSet) {
currentRoomData->animationFlag = true;
loadAnimation(currentRoomData->animationName);
iframe2 = 0;
- indicetray2 = 1;
- currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].x = 214 - 15;
- currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].y = 115 - 42;
- animado.dir = currentRoomData->secondaryAnimDirections[indicetray2 - 1];
- animado.posx = currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].x;
- animado.posy = currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].y;
- animado.depth = 14;
-
- for (indiaux = 0; indiaux < maxrejax; indiaux++)
- for (indiaux2 = 0; indiaux2 < maxrejay; indiaux2++) {
- if (rejamascaramovto[indiaux][indiaux2] > 0)
- currentRoomData->walkAreasGrid[oldposx + indiaux][oldposy + indiaux2] = rejamascaramovto[indiaux][indiaux2];
- if (rejamascararaton[indiaux][indiaux2] > 0)
- currentRoomData->mouseGrid[oldposx + indiaux][oldposy + indiaux2] = rejamascararaton[indiaux][indiaux2];
+ currentSecondaryTrajectoryIndex = 1;
+ currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].x = 214 - 15;
+ currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].y = 115 - 42;
+ secondaryAnimation.dir = currentRoomData->secondaryAnimDirections[currentSecondaryTrajectoryIndex - 1];
+ secondaryAnimation.posx = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].x;
+ secondaryAnimation.posy = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].y;
+ secondaryAnimation.depth = 14;
+
+ for (indiaux = 0; indiaux < maxXGrid; indiaux++)
+ for (indiaux2 = 0; indiaux2 < maxYGrid; indiaux2++) {
+ if (maskGridSecondaryAnim[indiaux][indiaux2] > 0)
+ currentRoomData->walkAreasGrid[oldposx + indiaux][oldposy + indiaux2] = maskGridSecondaryAnim[indiaux][indiaux2];
+ if (maskMouseSecondaryAnim[indiaux][indiaux2] > 0)
+ currentRoomData->mouseGrid[oldposx + indiaux][oldposy + indiaux2] = maskMouseSecondaryAnim[indiaux][indiaux2];
}
}
assembleScreen();
@@ -4329,9 +4329,9 @@ void loadGame(SavedGame game) {
}
mask();
- posicioninv = 0;
+ inventoryPosition = 0;
drawBackpack();
- if (rojo_capturado == false && currentRoomData->code == 24 && trampa_puesta == false)
+ if (isRedDevilCaptured == false && currentRoomData->code == 24 && isTrapSet == false)
runaroundRed();
screenTransition(transitionEffect, false, sceneBackground);
}
@@ -4391,7 +4391,7 @@ void saveLoad() {
buttonBorder((120 - (textY * 10)), (80 - (textY * 10)), (200 + (textY * 10)), (60 + (textY * 10)), 251, 251, 251, 251, 0, 0, "");
}
drawMenu(2);
- if (desactivagrabar) {
+ if (isSavingDisabled) {
bar(61, 15, 122, 23, 253);
bar(201, 15, 259, 23, 253);
}
@@ -4443,7 +4443,7 @@ void saveLoad() {
if (mouseClicked) {
if (mouseClickY >= 13 && mouseClickY <= 16) {
if (mouseClickX >= 54 && mouseClickX <= 124) {
- if (partidaselecc > 0 && !desactivagrabar && (nombrepartida != Common::String("DISPONIBLE ") + (char)(partidaselecc + 48)) && (nombrepartida != "")) {
+ if (partidaselecc > 0 && !isSavingDisabled && (nombrepartida != Common::String("DISPONIBLE ") + (char)(partidaselecc + 48)) && (nombrepartida != "")) {
// saveGame(partidaselecc);
fichindice.close();
g_engine->_graphics->putImg(50, 10, puntfondmenu);
@@ -4459,7 +4459,7 @@ void saveLoad() {
g_engine->_mouseManager->hide();
g_engine->_graphics->putImg(50, 10, puntfondmenu);
free(puntfondmenu);
- if (!desactivagrabar) {
+ if (!isSavingDisabled) {
freeAnimation();
freeScreenObjects();
}
@@ -4493,7 +4493,7 @@ void saveLoad() {
g_engine->_mouseManager->show();
}
} else if (mouseClickX >= 200 && mouseClickX <= 250) {
- if (inGame && !desactivagrabar) {
+ if (inGame && !isSavingDisabled) {
g_engine->_graphics->putImg(50, 10, puntfondmenu);
salirmenufunciones = true;
partidaselecc = 0;
@@ -4565,15 +4565,15 @@ void loadTalkAnimations() {
}
int32 posfilehabla;
- sizeframe = fichcani.readUint16LE();
+ mainCharFrameSize = fichcani.readUint16LE();
- posfilehabla = sizeframe * 16;
- posfilehabla = (posfilehabla * direccionmovimiento) + 2;
+ posfilehabla = mainCharFrameSize * 16;
+ posfilehabla = (posfilehabla * characterFacingDir) + 2;
fichcani.seek(posfilehabla);
- debug("LoadTalk direccionmovimiento=%d", direccionmovimiento);
+ debug("LoadTalk direccionmovimiento=%d", characterFacingDir);
for (int i = 0; i < 16; i++) {
- secuencia.bitmap[0][i] = (byte *)malloc(sizeframe);
- fichcani.read(secuencia.bitmap[0][i], sizeframe);
+ mainCharAnimation.bitmap[0][i] = (byte *)malloc(mainCharFrameSize);
+ fichcani.read(mainCharAnimation.bitmap[0][i], mainCharFrameSize);
}
fichcani.close();
@@ -4594,12 +4594,12 @@ void loadTalkAnimations() {
if (!result)
showError(265);
- sizeanimado = fichcani.readUint16LE();
+ secondaryAnimFrameSize = fichcani.readUint16LE();
secondaryAnimationFrameCount = fichcani.readByte();
- numerodir = fichcani.readByte();
+ secondaryAnimDirCount = fichcani.readByte();
- curSecondaryAnimationFrame = (byte *)malloc(sizeanimado);
- if (numerodir != 0) {
+ curSecondaryAnimationFrame = (byte *)malloc(secondaryAnimFrameSize);
+ if (secondaryAnimDirCount != 0) {
secondaryAnimationFrameCount = secondaryAnimationFrameCount / 4;
for (int i = 0; i <= 3; i++) {
loadAnimationForDirection(&fichcani, i);
@@ -4617,11 +4617,11 @@ void unloadTalkAnimations() {
if (!fichcani.open("PERSONAJ.SPT")) {
showError(265);
}
- sizeframe = fichcani.readUint16LE();
+ mainCharFrameSize = fichcani.readUint16LE();
for (int i = 0; i < walkFrameCount; i++) {
- secuencia.bitmap[0][i] = (byte *)malloc(sizeframe);
- fichcani.read(secuencia.bitmap[0][i], sizeframe);
+ mainCharAnimation.bitmap[0][i] = (byte *)malloc(mainCharFrameSize);
+ fichcani.read(mainCharAnimation.bitmap[0][i], mainCharFrameSize);
}
fichcani.close();
@@ -4629,11 +4629,11 @@ void unloadTalkAnimations() {
if (!fichcani.open(Common::Path(currentRoomData->animationName + ".DAT"))) {
showError(265);
}
- sizeanimado = fichcani.readUint16LE();
+ secondaryAnimFrameSize = fichcani.readUint16LE();
secondaryAnimationFrameCount = fichcani.readByte();
- numerodir = fichcani.readByte();
- curSecondaryAnimationFrame = (byte *)malloc(sizeanimado);
- if (numerodir != 0) {
+ secondaryAnimDirCount = fichcani.readByte();
+ curSecondaryAnimationFrame = (byte *)malloc(secondaryAnimFrameSize);
+ if (secondaryAnimDirCount != 0) {
secondaryAnimationFrameCount = secondaryAnimationFrameCount / 4;
for (int i = 0; i <= 3; i++) {
@@ -4646,13 +4646,13 @@ void unloadTalkAnimations() {
}
}
-regismht readVerbRegister(uint numRegister) {
+TextEntry readVerbRegister(uint numRegister) {
verb.seek(numRegister * verbRegSize);
return readVerbRegister();
}
-regismht readVerbRegister() {
- regismht regmht;
+TextEntry readVerbRegister() {
+ TextEntry regmht;
// Since the text is encrypted it's safer to save the size as reported by
// the pascal string.
byte size = verb.readByte();
@@ -4672,7 +4672,7 @@ void hypertext(
uint &numresp,
/** Whether the text being said is part of a conversation or just descriptions */
bool banderaconversa) {
- regismht regmht;
+ TextEntry regmht;
byte insertarnombre, iht, iteracionesht, lineaht, anchoht;
byte direccionmovimientopaso;
@@ -4871,18 +4871,18 @@ void hypertext(
iframe2++;
}
// Talk sprites are always put in facing direction 0
- direccionmovimientopaso = direccionmovimiento;
- direccionmovimiento = 0;
+ direccionmovimientopaso = characterFacingDir;
+ characterFacingDir = 0;
sprites(true);
- direccionmovimiento = direccionmovimientopaso;
+ characterFacingDir = direccionmovimientopaso;
} else {
- if (indicetray2 >= currentRoomData->secondaryTrajectoryLength)
- indicetray2 = 1;
+ if (currentSecondaryTrajectoryIndex >= currentRoomData->secondaryTrajectoryLength)
+ currentSecondaryTrajectoryIndex = 1;
else
- indicetray2 += 1;
- animado.posx = currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].x;
- animado.posy = currentRoomData->secondaryAnimTrajectory[indicetray2 - 1].y;
- animado.dir = currentRoomData->secondaryAnimDirections[indicetray2 - 1];
+ currentSecondaryTrajectoryIndex += 1;
+ secondaryAnimation.posx = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].x;
+ secondaryAnimation.posy = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].y;
+ secondaryAnimation.dir = currentRoomData->secondaryAnimDirections[currentSecondaryTrajectoryIndex - 1];
if (iframe2 >= secondaryAnimationFrameCount - 1)
iframe2 = 0;
else
@@ -4892,13 +4892,13 @@ void hypertext(
}
if (currentRoomData->paletteAnimationFlag && saltospal >= 4) {
saltospal = 0;
- if (movidapaleta > 6)
- movidapaleta = 0;
+ if (isPaletteAnimEnabled > 6)
+ isPaletteAnimEnabled = 0;
else
- movidapaleta += 1;
- if (currentRoomData->code == 4 && movidapaleta == 4)
+ isPaletteAnimEnabled += 1;
+ if (currentRoomData->code == 4 && isPaletteAnimEnabled == 4)
g_engine->_sound->playVoc();
- updatePalette(movidapaleta);
+ updatePalette(isPaletteAnimEnabled);
} else
saltospal += 1;
}
@@ -4917,8 +4917,8 @@ void hypertext(
void wcScene() {
palette palwater;
- zonaactual = currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount];
- goToObject(zonaactual, zonadestino);
+ currentZone = currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount];
+ goToObject(currentZone, targetZone);
copyPalette(pal, palwater);
g_engine->_mouseManager->hide();
@@ -4960,12 +4960,12 @@ void wcScene() {
drawScreen(sceneBackground);
partialFadeIn(234);
xframe2 = 0;
- indicetray = 0;
- longtray = 1;
- zonaactual = 8;
- zonadestino = 8;
- trayec[0].x = characterPosX;
- trayec[0].y = characterPosY;
+ currentTrajectoryIndex = 0;
+ trajectoryLength = 1;
+ currentZone = 8;
+ targetZone = 8;
+ trajectory[0].x = characterPosX;
+ trajectory[0].y = characterPosY;
g_engine->_mouseManager->show();
}
@@ -5155,10 +5155,10 @@ void saveItemRegister(ScreenObject object, Common::SeekableWriteStream *stream)
void printHornacinas() {
debug("| | %03d | %03d | %03d | %03d |", 0, 1, 2, 3);
- debug("| 0 | %03d | %03d | %03d | %03d |", hornacina[0][0], hornacina[0][1], hornacina[0][2], hornacina[0][3]);
- debug("| 1 | %03d | %03d | %03d | %03d |", hornacina[1][0], hornacina[1][1], hornacina[1][2], hornacina[1][3]);
- debug("hornacina[0][hornacina[0][3]] = %d", hornacina[0][hornacina[0][3]]);
- debug("hornacina[1][hornacina[1][3]] = %d", hornacina[1][hornacina[1][3]]);
+ debug("| 0 | %03d | %03d | %03d | %03d |", niche[0][0], niche[0][1], niche[0][2], niche[0][3]);
+ debug("| 1 | %03d | %03d | %03d | %03d |", niche[1][0], niche[1][1], niche[1][2], niche[1][3]);
+ debug("hornacina[0][hornacina[0][3]] = %d", niche[0][niche[0][3]]);
+ debug("hornacina[1][hornacina[1][3]] = %d", niche[1][niche[1][3]]);
}
} // End of namespace Tot
diff --git a/engines/tot/routines.h b/engines/tot/routines.h
index 6dc831dabb4..e74e8abdd45 100644
--- a/engines/tot/routines.h
+++ b/engines/tot/routines.h
@@ -66,8 +66,8 @@ void actionLineText(Common::String actionLine);
void initializeObjectFile();
void saveItem(ScreenObject object, Common::SeekableWriteStream *objectDataStream);
-regismht readVerbRegister(uint numRegister);
-regismht readVerbRegister();
+TextEntry readVerbRegister(uint numRegister);
+TextEntry readVerbRegister();
void readConversationFile(Common::String f);
void printHornacinas();
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
index bd5bd515b22..29173d61ef6 100644
--- a/engines/tot/routines2.cpp
+++ b/engines/tot/routines2.cpp
@@ -45,7 +45,7 @@ void loadScreenMemory() {
void loadAnimationForDirection(Common::SeekableReadStream *stream, int direction) {
for (int j = 0; j < secondaryAnimationFrameCount; j++) {
- loadAnimationIntoBuffer(stream, animado.bitmap[direction][j], sizeanimado);
+ loadAnimationIntoBuffer(stream, secondaryAnimation.bitmap[direction][j], secondaryAnimFrameSize);
}
}
@@ -54,20 +54,20 @@ void loadAnimation(Common::String animacion) {
Common::File fichcani;
if (animacion == "PETER")
- peteractivo = true;
+ isPeterCoughing = true;
else
- peteractivo = false;
+ isPeterCoughing = false;
- animacion2 = true;
+ isSecondaryAnimationEnabled = true;
if (!fichcani.open(Common::Path(animacion + ".DAT"))) {
showError(265);
}
- sizeanimado = fichcani.readUint16LE();
+ secondaryAnimFrameSize = fichcani.readUint16LE();
secondaryAnimationFrameCount = fichcani.readByte();
- numerodir = fichcani.readByte();
- curSecondaryAnimationFrame = (byte *)malloc(sizeanimado);
- if (numerodir != 0) {
+ secondaryAnimDirCount = fichcani.readByte();
+ curSecondaryAnimationFrame = (byte *)malloc(secondaryAnimFrameSize);
+ if (secondaryAnimDirCount != 0) {
secondaryAnimationFrameCount = secondaryAnimationFrameCount / 4;
for (int i = 0; i <= 3; i++) {
@@ -79,31 +79,31 @@ void loadAnimation(Common::String animacion) {
fichcani.close();
debug("Read all frames! longtray2=%d", currentRoomData->secondaryTrajectoryLength);
- anchoanimado = READ_LE_UINT16(animado.bitmap[0][1]) + 1;
- altoanimado = READ_LE_UINT16(animado.bitmap[0][1] + 2) + 1;
+ secondaryAnimWidth = READ_LE_UINT16(secondaryAnimation.bitmap[0][1]) + 1;
+ secondaryAnimHeight = READ_LE_UINT16(secondaryAnimation.bitmap[0][1] + 2) + 1;
- setRoomTrajectories(altoanimado, anchoanimado, SET_WITH_ANIM, false);
+ setRoomTrajectories(secondaryAnimHeight, secondaryAnimWidth, SET_WITH_ANIM, false);
readItemRegister(currentRoomData->secondaryAnimDirections[299]);
- maxrejax = (regobj.xrej2 - regobj.xrej1 + 1);
- maxrejay = (regobj.yrej2 - regobj.yrej1 + 1);
+ maxXGrid = (regobj.xrej2 - regobj.xrej1 + 1);
+ maxYGrid = (regobj.yrej2 - regobj.yrej1 + 1);
oldposx = regobj.xrej1 + 1;
oldposy = regobj.yrej1 + 1;
for (int i = 0; i < 10; i++)
for (int j = 0; j < 10; j++) {
- rejamascaramovto[i][j] = 0;
- rejamascararaton[i][j] = 0;
- rejafondomovto[i][j] = 0;
- rejafondoraton[i][j] = 0;
+ maskGridSecondaryAnim[i][j] = 0;
+ maskMouseSecondaryAnim[i][j] = 0;
+ movementGridForSecondaryAnim[i][j] = 0;
+ mouseGridForSecondaryAnim[i][j] = 0;
}
- for (int i = 0; i < maxrejax; i++)
- for (int j = 0; j < maxrejay; j++) {
- rejamascaramovto[i][j] = regobj.walkAreasPatch[i][j];
- rejamascararaton[i][j] = regobj.mouseGridPatch[i][j];
- rejafondomovto[i][j] = currentRoomData->walkAreasGrid[oldposx + i][oldposy + j];
- rejafondoraton[i][j] = currentRoomData->mouseGrid[oldposx + i][oldposy + j];
+ for (int i = 0; i < maxXGrid; i++)
+ for (int j = 0; j < maxYGrid; j++) {
+ maskGridSecondaryAnim[i][j] = regobj.walkAreasPatch[i][j];
+ maskMouseSecondaryAnim[i][j] = regobj.mouseGridPatch[i][j];
+ movementGridForSecondaryAnim[i][j] = currentRoomData->walkAreasGrid[oldposx + i][oldposy + j];
+ mouseGridForSecondaryAnim[i][j] = currentRoomData->mouseGrid[oldposx + i][oldposy + j];
}
iframe2 = 0;
debug("Finished loading animation!");
@@ -121,7 +121,7 @@ void updateAltScreen(byte otherScreenNumber) {
byte currentScreen = currentRoomData->code;
- setRoomTrajectories(altoanimado, anchoanimado, RESTORE);
+ setRoomTrajectories(secondaryAnimHeight, secondaryAnimWidth, RESTORE);
// Save current room
saveRoomData(currentRoomData, rooms);
@@ -132,7 +132,7 @@ void updateAltScreen(byte otherScreenNumber) {
switch (otherScreenNumber) {
case 20: {
- switch (hornacina[0][hornacina[0][3]]) {
+ switch (niche[0][niche[0][3]]) {
case 0: {
currentRoomData->screenObjectIndex[9]->objectName = getObjectName(4);
currentRoomData->screenLayers[1].bitmapPointer = 1190768;
@@ -156,7 +156,7 @@ void updateAltScreen(byte otherScreenNumber) {
currentRoomData->screenLayers[1].depth = 1;
} break;
case 24: {
- switch (hornacina[1][hornacina[1][3]]) {
+ switch (niche[1][niche[1][3]]) {
case 0: {
currentRoomData->screenObjectIndex[8]->objectName = getObjectName(4);
currentRoomData->screenLayers[0].bitmapPointer = 1399610;
@@ -206,7 +206,7 @@ void updateAltScreen(byte otherScreenNumber) {
rooms->seek(currentScreen * roomRegSize, SEEK_SET);
currentRoomData = readScreenDataFile(rooms);
- setRoomTrajectories(altoanimado, anchoanimado, SET_WITH_ANIM);
+ setRoomTrajectories(secondaryAnimHeight, secondaryAnimWidth, SET_WITH_ANIM);
}
struct regzxc {
@@ -318,19 +318,19 @@ void loadCharAnimation() {
if (!characterFile.open("PERSONAJ.SPT"))
showError(265);
- sizeframe = characterFile.readUint16LE();
+ mainCharFrameSize = characterFile.readUint16LE();
verifyCopyProtection();
for (int i = 0; i <= 3; i++)
for (int j = 0; j < walkFrameCount; j++) {
- secuencia.bitmap[i][j] = (byte *)malloc(sizeframe);
- characterFile.read(secuencia.bitmap[i][j], sizeframe);
+ mainCharAnimation.bitmap[i][j] = (byte *)malloc(mainCharFrameSize);
+ characterFile.read(mainCharAnimation.bitmap[i][j], mainCharFrameSize);
}
for (int i = 0; i < 4; i++)
for (int j = walkFrameCount; j < (walkFrameCount + 10 * 3); j++) {
- secuencia.bitmap[i][j] = (byte *)malloc(sizeframe);
- characterFile.read(secuencia.bitmap[i][j], sizeframe);
+ mainCharAnimation.bitmap[i][j] = (byte *)malloc(mainCharFrameSize);
+ characterFile.read(mainCharAnimation.bitmap[i][j], mainCharFrameSize);
}
characterFile.close();
}
@@ -352,8 +352,8 @@ void freeScreenObjects() {
}
void freeAnimation() {
- if (animacion2) {
- animacion2 = false;
+ if (isSecondaryAnimationEnabled) {
+ isSecondaryAnimationEnabled = false;
if(curSecondaryAnimationFrame)
free(curSecondaryAnimationFrame);
curSecondaryAnimationFrame = NULL;
@@ -503,12 +503,12 @@ void putIcon(uint posiconx, uint posicony, uint numicon) {
}
void drawBackpack() {
- putIcon(34, 169, posicioninv);
- putIcon(77, 169, posicioninv + 1);
- putIcon(120, 169, posicioninv + 2);
- putIcon(163, 169, posicioninv + 3);
- putIcon(206, 169, posicioninv + 4);
- putIcon(249, 169, posicioninv + 5);
+ putIcon(34, 169, inventoryPosition);
+ putIcon(77, 169, inventoryPosition + 1);
+ putIcon(120, 169, inventoryPosition + 2);
+ putIcon(163, 169, inventoryPosition + 3);
+ putIcon(206, 169, inventoryPosition + 4);
+ putIcon(249, 169, inventoryPosition + 5);
}
void lightUpLeft() {
@@ -542,24 +542,24 @@ void turnOffRight() {
void inventory(byte direccion, byte tope) {
switch (direccion) {
case 0:
- if (posicioninv > 0) {
- posicioninv -= 1;
+ if (inventoryPosition > 0) {
+ inventoryPosition -= 1;
drawBackpack();
}
break;
case 1:
- if (posicioninv < (tope - 6)) {
- posicioninv += 1;
+ if (inventoryPosition < (tope - 6)) {
+ inventoryPosition += 1;
drawBackpack();
}
break;
}
g_engine->_mouseManager->hide();
- if (posicioninv > 0)
+ if (inventoryPosition > 0)
lightUpLeft();
else
turnOffLeft();
- if (mobj[posicioninv + 6].code > 0)
+ if (mobj[inventoryPosition + 6].code > 0)
lightUpRight();
else
turnOffRight();
@@ -575,11 +575,11 @@ void mask() {
buttonBorder(0, (175 - ytextaux), 319, (174 + ytextaux), 251, 251, 251, 251, 0, 0, "");
drawMenu(1);
// verifyCopyProtection();
- if (posicioninv > 1)
+ if (inventoryPosition > 1)
lightUpLeft();
else
turnOffLeft();
- if (mobj[posicioninv + 6].code > 0)
+ if (mobj[inventoryPosition + 6].code > 0)
lightUpRight();
else
turnOffRight();
@@ -794,10 +794,10 @@ void checkMouseGrid() {
if (mouseY >= 0 && mouseY <= 131) {
xrejilla = (mouseX + 7) / xGridCount;
yrejilla = (mouseY + 7) / yGridCount;
- if (currentRoomData->mouseGrid[xrejilla][yrejilla] != currentRoomData->mouseGrid[oldxrejilla][oldyrejilla] || oldobjmochila != "") {
+ if (currentRoomData->mouseGrid[xrejilla][yrejilla] != currentRoomData->mouseGrid[oldGridX][oldGridY] || oldInventoryObjectName != "") {
bar(0, 140, 319, 149, 0);
Common::String actionLine;
- switch (numeroaccion) {
+ switch (actionCode) {
case 0:
actionLine = getActionLineText(0) + currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
break;
@@ -811,8 +811,8 @@ void checkMouseGrid() {
actionLine = getActionLineText(3) + currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
break;
case 4:
- if (objetomochila != "")
- actionLine = getActionLineText(4) + objetomochila + getActionLineText(7) + currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
+ if (inventoryObjectName != "")
+ actionLine = getActionLineText(4) + inventoryObjectName + getActionLineText(7) + currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
else
actionLine = getActionLineText(4) + currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
break;
@@ -827,16 +827,16 @@ void checkMouseGrid() {
}
actionLineText(actionLine);
g_engine->_mouseManager->show();
- oldxrejilla = xrejilla;
- oldyrejilla = yrejilla;
+ oldGridX = xrejilla;
+ oldGridY = yrejilla;
}
- oldnumeroacc = 253;
- oldobjmochila = "";
+ oldActionCode = 253;
+ oldInventoryObjectName = "";
} else if (mouseY >= 132 && mouseY <= 165) {
- if (numeroaccion != oldnumeroacc) {
+ if (actionCode != oldActionCode) {
bar(0, 140, 319, 149, 0);
Common::String actionLine;
- switch (numeroaccion) {
+ switch (actionCode) {
case 0:
actionLine = getActionLineText(0);
break;
@@ -850,8 +850,8 @@ void checkMouseGrid() {
actionLine = getActionLineText(3);
break;
case 4:
- if (objetomochila != "")
- actionLine = getActionLineText(4) + objetomochila + getActionLineText(7);
+ if (inventoryObjectName != "")
+ actionLine = getActionLineText(4) + inventoryObjectName + getActionLineText(7);
else
actionLine = getActionLineText(4);
break;
@@ -864,32 +864,32 @@ void checkMouseGrid() {
}
actionLineText(actionLine);
g_engine->_mouseManager->show();
- oldnumeroacc = numeroaccion;
- oldobjmochila = "";
- oldxrejilla = 0;
- oldyrejilla = 0;
+ oldActionCode = actionCode;
+ oldInventoryObjectName = "";
+ oldGridX = 0;
+ oldGridY = 0;
}
} else if (mouseY >= 166 && mouseY <= 199) {
if (mouseX >= 26 && mouseX <= 65) {
- objmochila = mobj[posicioninv].objectName;
+ objmochila = mobj[inventoryPosition].objectName;
} else if (mouseX >= 70 && mouseX <= 108) {
- objmochila = mobj[posicioninv + 1].objectName;
+ objmochila = mobj[inventoryPosition + 1].objectName;
} else if (mouseX >= 113 && mouseX <= 151) {
- objmochila = mobj[posicioninv + 2].objectName;
+ objmochila = mobj[inventoryPosition + 2].objectName;
} else if (mouseX >= 156 && mouseX <= 194) {
- objmochila = mobj[posicioninv + 3].objectName;
+ objmochila = mobj[inventoryPosition + 3].objectName;
} else if (mouseX >= 199 && mouseX <= 237) {
- objmochila = mobj[posicioninv + 4].objectName;
+ objmochila = mobj[inventoryPosition + 4].objectName;
} else if (mouseX >= 242 && mouseX <= 280) {
- objmochila = mobj[posicioninv + 5].objectName;
+ objmochila = mobj[inventoryPosition + 5].objectName;
} else {
objmochila = ' ';
}
- if (objmochila != oldobjmochila || oldxrejilla != 0) {
+ if (objmochila != oldInventoryObjectName || oldGridX != 0) {
bar(0, 140, 319, 149, 0);
Common::String actionLine;
- switch (numeroaccion) {
+ switch (actionCode) {
case 1:
actionLine = getActionLineText(1) + objmochila;
break;
@@ -900,10 +900,10 @@ void checkMouseGrid() {
actionLine = getActionLineText(3) + objmochila;
break;
case 4:
- if (objetomochila == "")
+ if (inventoryObjectName == "")
actionLine = getActionLineText(4) + objmochila;
else
- actionLine = getActionLineText(4) + objetomochila + getActionLineText(7) + objmochila;
+ actionLine = getActionLineText(4) + inventoryObjectName + getActionLineText(7) + objmochila;
break;
case 5:
actionLine = getActionLineText(5) + objmochila;
@@ -916,11 +916,11 @@ void checkMouseGrid() {
}
actionLineText(actionLine);
g_engine->_mouseManager->show();
- oldobjmochila = objmochila;
+ oldInventoryObjectName = objmochila;
}
- oldnumeroacc = 255;
- oldxrejilla = 0;
- oldyrejilla = 0;
+ oldActionCode = 255;
+ oldGridX = 0;
+ oldGridY = 0;
}
}
@@ -1476,10 +1476,10 @@ void putCreditsImg(uint x, uint y, byte *imagen1, byte *imagen2, bool direct) {
paso = (byte *)malloc((wImagen1 + 1) * (hImagen1 + 1) + 4);
auxhor = wImagen1 + 1;
- kaka = hImagen1 + y;
+ foo = hImagen1 + y;
// makes sure that if the image is at the bottom of the screen we chop the bottom part
- for (int i = kaka; i >= 200; i--)
+ for (int i = foo; i >= 200; i--)
hImagen1 -= 1;
hImagen1++;
@@ -1493,13 +1493,13 @@ void putCreditsImg(uint x, uint y, byte *imagen1, byte *imagen2, bool direct) {
for (int kk = 0; kk < hImagen1; kk++) {
incremento2 = (kk * wImagen1) + 4;
- kaka = kk + y;
+ foo = kk + y;
for (int jj = 0; jj <= wImagen1; jj++) {
incremento = incremento2 + jj;
- if ((direct && imagen1[incremento] > 0) || (imagen1[incremento] > 16 && kaka >= 66 && kaka <= 192)) {
+ if ((direct && imagen1[incremento] > 0) || (imagen1[incremento] > 16 && foo >= 66 && foo <= 192)) {
paso[incremento] = imagen1[incremento];
} else if (imagen1[incremento] > 16) {
- switch (kaka) {
+ switch (foo) {
case 59:
case 199:
paso[incremento] = imagen1[incremento] + 210;
@@ -1888,9 +1888,9 @@ Lsalirpres:
}
void firstIntroduction() {
- if (!hechaprimeravez && !introSeen) {
+ if (!firstTimeDone && !isIntroSeen) {
introduction();
- hechaprimeravez = true;
+ firstTimeDone = true;
ConfMan.setBool("introSeen", true);
ConfMan.flushToDisk();
}
@@ -1938,8 +1938,8 @@ void initialMenu(bool fundido) {
uint y = e.mouse.y + 7;
if (y > 105 && y < 120) {
if (x > 46 && x < 145) {
- partidanueva = true;
- continuarpartida = false;
+ startNewGame = true;
+ continueGame = false;
opcionvalida = true;
} else if (x > 173 && x < 267) {
credits();
@@ -1953,15 +1953,15 @@ void initialMenu(bool fundido) {
drawFlc(0, 0, offset, 0, 9, 0, true, false, false, kklogica);
} else if (x >= 18 && x <= 145) {
debug("Load");
- partidanueva = false;
- continuarpartida = false;
+ startNewGame = false;
+ continueGame = false;
opcionvalida = true;
}
} else if (y > 174 && y < 190) {
if (x > 20 && x < 145) {
- partidanueva = false;
+ startNewGame = false;
opcionvalida = true;
- continuarpartida = true;
+ continueGame = true;
} else if (x > 173 && y < 288) {
exitToDOS();
}
@@ -2641,14 +2641,14 @@ void ending() {
void loadBat() {
Common::File fichcani;
- animacion2 = true;
+ isSecondaryAnimationEnabled = true;
if (!fichcani.open("MURCIE.DAT")) {
showError(265);
}
- sizeanimado = fichcani.readUint16LE();
+ secondaryAnimFrameSize = fichcani.readUint16LE();
secondaryAnimationFrameCount = fichcani.readByte();
- numerodir = fichcani.readByte();
- curSecondaryAnimationFrame = (byte *)malloc(sizeanimado);
+ secondaryAnimDirCount = fichcani.readByte();
+ curSecondaryAnimationFrame = (byte *)malloc(secondaryAnimFrameSize);
loadAnimationForDirection(&fichcani, 0);
fichcani.close();
}
@@ -2656,15 +2656,15 @@ void loadBat() {
void loadDevil() {
Common::File fichcani;
- animacion2 = true;
+ isSecondaryAnimationEnabled = true;
if (!fichcani.open("ROJOMOV.DAT")) {
showError(265);
}
- sizeanimado = fichcani.readUint16LE();
+ secondaryAnimFrameSize = fichcani.readUint16LE();
secondaryAnimationFrameCount = fichcani.readByte();
- numerodir = fichcani.readByte();
- curSecondaryAnimationFrame = (byte *)malloc(sizeanimado);
- if (numerodir != 0) {
+ secondaryAnimDirCount = fichcani.readByte();
+ curSecondaryAnimationFrame = (byte *)malloc(secondaryAnimFrameSize);
+ if (secondaryAnimDirCount != 0) {
secondaryAnimationFrameCount = secondaryAnimationFrameCount / 4;
for (int i = 0; i <= 3; i++) {
loadAnimationForDirection(&fichcani, i);
@@ -2704,17 +2704,17 @@ void assembleScreen(bool scroll) {
if (screenObjects[indice] != NULL) {
assembleCompleteBackground(screenObjects[indice], depthMap[indice].posx, depthMap[indice].posy);
}
- if (!scroll && secuencia.depth == indice) {
- assembleCompleteBackground(secuencia.bitmap[direccionmovimiento][iframe], characterPosX, characterPosY);
+ if (!scroll && mainCharAnimation.depth == indice) {
+ assembleCompleteBackground(mainCharAnimation.bitmap[characterFacingDir][iframe], characterPosX, characterPosY);
}
- if (!scroll && currentRoomData->animationFlag && animado.depth == indice) {
- assembleCompleteBackground(curSecondaryAnimationFrame, animado.posx, animado.posy);
+ if (!scroll && currentRoomData->animationFlag && secondaryAnimation.depth == indice) {
+ assembleCompleteBackground(curSecondaryAnimationFrame, secondaryAnimation.posx, secondaryAnimation.posy);
}
}
}
void disableSecondAnimation() {
- setRoomTrajectories(altoanimado, anchoanimado, RESTORE);
+ setRoomTrajectories(secondaryAnimHeight, secondaryAnimWidth, RESTORE);
currentRoomData->animationFlag = false;
freeAnimation();
restoreBackground();
@@ -2834,16 +2834,16 @@ void setRoomTrajectories(int animationHeight, int animationWidth, TRAJECTORIES_O
}
}
if (fixGrids) {
- for (int i = 0; i < maxrejax; i++) {
- for (int j = 0; j < maxrejay; j++) {
+ for (int i = 0; i < maxXGrid; i++) {
+ for (int j = 0; j < maxYGrid; j++) {
if (op == RESTORE) {
- currentRoomData->walkAreasGrid[oldposx + i][oldposy + j] = rejafondomovto[i][j];
- currentRoomData->mouseGrid[oldposx + i][oldposy + j] = rejafondoraton[i][j];
+ currentRoomData->walkAreasGrid[oldposx + i][oldposy + j] = movementGridForSecondaryAnim[i][j];
+ currentRoomData->mouseGrid[oldposx + i][oldposy + j] = mouseGridForSecondaryAnim[i][j];
} else {
- if (rejamascaramovto[i][j] > 0)
- currentRoomData->walkAreasGrid[oldposx + i][oldposy + j] = rejamascaramovto[i][j];
- if (rejamascararaton[i][j] > 0)
- currentRoomData->mouseGrid[oldposx + i][oldposy + j] = rejamascararaton[i][j];
+ if (maskGridSecondaryAnim[i][j] > 0)
+ currentRoomData->walkAreasGrid[oldposx + i][oldposy + j] = maskGridSecondaryAnim[i][j];
+ if (maskMouseSecondaryAnim[i][j] > 0)
+ currentRoomData->mouseGrid[oldposx + i][oldposy + j] = maskMouseSecondaryAnim[i][j];
}
}
}
diff --git a/engines/tot/saveload.cpp b/engines/tot/saveload.cpp
index b59f3e1d5e6..d81ed306b41 100644
--- a/engines/tot/saveload.cpp
+++ b/engines/tot/saveload.cpp
@@ -37,52 +37,52 @@ namespace Tot {
bool syncGeneralData(Common::Serializer &s, SavedGame &game) {
uint32 startBytes = s.bytesSynced();
// Uint16
- s.syncAsUint16LE(game.numeropantalla);
- s.syncAsUint16LE(game.longtray);
- s.syncAsUint16LE(game.indicetray);
- s.syncAsUint16LE(game.codigoobjmochila);
- s.syncAsUint16LE(game.volumenfxderecho);
- s.syncAsUint16LE(game.volumenfxizquierdo);
- s.syncAsUint16LE(game.volumenmelodiaderecho);
- s.syncAsUint16LE(game.volumenmelodiaizquierdo);
- s.syncAsUint16LE(game.oldxrejilla);
- s.syncAsUint16LE(game.oldyrejilla);
- s.syncAsUint16LE(game.animadoprofundidad);
- s.syncAsUint16LE(game.animadodir);
- s.syncAsUint16LE(game.animadoposx);
- s.syncAsUint16LE(game.animadoposy);
- s.syncAsUint16LE(game.animadoiframe2);
+ s.syncAsUint16LE(game.roomCode);
+ s.syncAsUint16LE(game.trajectoryLength);
+ s.syncAsUint16LE(game.currentTrajectoryIndex);
+ s.syncAsUint16LE(game.backpackObjectCode);
+ s.syncAsUint16LE(game.rightSfxVol);
+ s.syncAsUint16LE(game.leftSfxVol);
+ s.syncAsUint16LE(game.musicVolRight);
+ s.syncAsUint16LE(game.musicVolLeft);
+ s.syncAsUint16LE(game.oldGridX);
+ s.syncAsUint16LE(game.oldGridY);
+ s.syncAsUint16LE(game.secAnimDepth);
+ s.syncAsUint16LE(game.secAnimDir);
+ s.syncAsUint16LE(game.secAnimX);
+ s.syncAsUint16LE(game.secAnimY);
+ s.syncAsUint16LE(game.secAnimIFrame);
// Bytes
- s.syncAsByte(game.zonaactual);
- s.syncAsByte(game.zonadestino);
- s.syncAsByte(game.oldzonadestino);
- s.syncAsByte(game.posicioninv);
- s.syncAsByte(game.numeroaccion);
- s.syncAsByte(game.oldnumeroacc);
- s.syncAsByte(game.pasos);
- s.syncAsByte(game.indicepuertas);
- s.syncAsByte(game.direccionmovimiento);
+ s.syncAsByte(game.currentZone);
+ s.syncAsByte(game.targetZone);
+ s.syncAsByte(game.oldTargetZone);
+ s.syncAsByte(game.inventoryPosition);
+ s.syncAsByte(game.actionCode);
+ s.syncAsByte(game.oldActionCode);
+ s.syncAsByte(game.steps);
+ s.syncAsByte(game.doorIndex);
+ s.syncAsByte(game.characterFacingDir);
s.syncAsByte(game.iframe);
- s.syncAsByte(game.parte_del_juego);
+ s.syncAsByte(game.gamePart);
// Booleans
- s.syncAsByte(game.sello_quitado);
- s.syncAsByte(game.lista1);
- s.syncAsByte(game.lista2);
- s.syncAsByte(game.completadalista1);
- s.syncAsByte(game.completadalista2);
- s.syncAsByte(game.vasijapuesta);
- s.syncAsByte(game.guadagna);
- s.syncAsByte(game.tridente);
- s.syncAsByte(game.torno);
- s.syncAsByte(game.barro);
- s.syncAsByte(game.diablillo_verde);
- s.syncAsByte(game.rojo_capturado);
- s.syncAsByte(game.manual_torno);
- s.syncAsByte(game.alacena_abierta);
- s.syncAsByte(game.baul_abierto);
- s.syncAsByte(game.teleencendida);
- s.syncAsByte(game.trampa_puesta);
+ s.syncAsByte(game.isSealRemoved);
+ s.syncAsByte(game.obtainedList1);
+ s.syncAsByte(game.obtainedList2);
+ s.syncAsByte(game.list1Complete);
+ s.syncAsByte(game.list2Complete);
+ s.syncAsByte(game.isVasePlaced);
+ s.syncAsByte(game.isScytheTaken);
+ s.syncAsByte(game.isTridentTaken);
+ s.syncAsByte(game.isPottersWheelDelivered);
+ s.syncAsByte(game.isMudDelivered);
+ s.syncAsByte(game.isGreenDevilDelivered);
+ s.syncAsByte(game.isRedDevilCaptured);
+ s.syncAsByte(game.isPottersManualDelivered);
+ s.syncAsByte(game.isCupboardOpen);
+ s.syncAsByte(game.isChestOpen);
+ s.syncAsByte(game.isTVOn);
+ s.syncAsByte(game.isTrapSet);
for (int i = 0; i < inventoryIconCount; i++) {
s.syncAsUint16LE(game.mobj[i].bitmapIndex);
@@ -91,17 +91,17 @@ bool syncGeneralData(Common::Serializer &s, SavedGame &game) {
}
// integers
- s.syncAsSint32LE(game.elemento1);
- s.syncAsSint32LE(game.elemento2);
- s.syncAsSint32LE(game.xframe);
- s.syncAsSint32LE(game.yframe);
+ s.syncAsSint32LE(game.element1);
+ s.syncAsSint32LE(game.element2);
+ s.syncAsSint32LE(game.characterPosX);
+ s.syncAsSint32LE(game.characterPosY);
s.syncAsSint32LE(game.xframe2);
s.syncAsSint32LE(game.yframe2);
// Strings
- s.syncString(game.oldobjmochila);
- s.syncString(game.objetomochila);
- s.syncString(game.nombrepersonaje);
+ s.syncString(game.oldInventoryObjectName);
+ s.syncString(game.objetomoinventoryObjectNamehila);
+ s.syncString(game.characterName);
for (int i = 0; i < routePointCount; i++) {
s.syncAsSint16LE(game.mainRoute[i].x);
@@ -109,28 +109,28 @@ bool syncGeneralData(Common::Serializer &s, SavedGame &game) {
}
for (int i = 0; i < 300; i++) {
- s.syncAsSint16LE(game.trayec[i].x);
- s.syncAsSint16LE(game.trayec[i].y);
+ s.syncAsSint16LE(game.trajectory[i].x);
+ s.syncAsSint16LE(game.trajectory[i].y);
}
for (int indiaux = 0; indiaux < characterCount; indiaux++) {
// interleave them just to avoid creating many loops
- s.syncAsByte(game.primera[indiaux]);
- s.syncAsByte(game.lprimera[indiaux]);
- s.syncAsByte(game.cprimera[indiaux]);
- s.syncAsByte(game.libro[indiaux]);
- s.syncAsByte(game.caramelos[indiaux]);
+ s.syncAsByte(game.firstTimeTopicA[indiaux]);
+ s.syncAsByte(game.firstTimeTopicB[indiaux]);
+ s.syncAsByte(game.firstTimeTopicC[indiaux]);
+ s.syncAsByte(game.bookTopic[indiaux]);
+ s.syncAsByte(game.mintTopic[indiaux]);
}
for (int indiaux = 0; indiaux < 5; indiaux++) {
- s.syncAsByte(game.cavernas[indiaux]);
+ s.syncAsByte(game.caves[indiaux]);
s.syncAsUint16LE(game.firstList[indiaux]);
s.syncAsUint16LE(game.secondList[indiaux]);
}
for (int indiaux = 0; indiaux < 4; indiaux++) {
- s.syncAsUint16LE(game.hornacina[0][indiaux]);
- s.syncAsUint16LE(game.hornacina[1][indiaux]);
+ s.syncAsUint16LE(game.niche[0][indiaux]);
+ s.syncAsUint16LE(game.niche[1][indiaux]);
}
uint32 newBytes = s.bytesSynced();
@@ -143,12 +143,12 @@ bool syncRoomData(Common::Serializer &s, Common::MemorySeekableReadWriteStream *
if (s.isSaving()) {
// Restore trajectory
- setRoomTrajectories(altoanimado, anchoanimado, RESTORE);
+ setRoomTrajectories(secondaryAnimHeight, secondaryAnimWidth, RESTORE);
// Make sure to save any unsaved changes in the room
saveRoomData(currentRoomData, rooms);
// Do not fix screen grids, they will be fixed differently below
- setRoomTrajectories(altoanimado, anchoanimado, SET_WITH_ANIM);
+ setRoomTrajectories(secondaryAnimHeight, secondaryAnimWidth, SET_WITH_ANIM);
int size = roomStream->size();
byte *roomBuf = (byte *)malloc(size);
@@ -267,7 +267,7 @@ Common::Error TotEngine::syncGame(Common::Serializer &s) {
loadGame(loadedGame);
} else {
saveGameToRegister();
- result = syncSaveData(s, regpartida);
+ result = syncSaveData(s, savedGame);
}
return result;
}
diff --git a/engines/tot/tot.cpp b/engines/tot/tot.cpp
index b055baef08c..97c0ee97b74 100644
--- a/engines/tot/tot.cpp
+++ b/engines/tot/tot.cpp
@@ -85,7 +85,7 @@ Common::Error TotEngine::run() {
initGraph();
initPlayAnim();
- introSeen = ConfMan.getBool("introSeen");
+ isIntroSeen = ConfMan.getBool("introSeen");
// _inventoryManager = new InventoryManager();
// _totGame = new TotGame();
// Set the engine's debugger console
Commit: 17dd611f4dc4e4a0b6fbfc849caa0ee8db0dbd4d
https://github.com/scummvm/scummvm/commit/17dd611f4dc4e4a0b6fbfc849caa0ee8db0dbd4d
Author: gsanmartin (gabriel.sanmartin at dna.inc)
Date: 2025-09-08T16:49:50+02:00
Commit Message:
TOT: Extra cleanup of global variables
Changed paths:
A engines/tot/mouse.cpp
A engines/tot/mouse.h
A engines/tot/sound.cpp
A engines/tot/sound.h
A engines/tot/vars.cpp
A engines/tot/vars.h
R engines/tot/mouseman.cpp
R engines/tot/mouseman.h
R engines/tot/playanim.cpp
R engines/tot/playanim.h
R engines/tot/soundman.cpp
R engines/tot/soundman.h
engines/tot/anims.cpp
engines/tot/anims.h
engines/tot/chrono.cpp
engines/tot/chrono.h
engines/tot/console.cpp
engines/tot/dialog.cpp
engines/tot/dialog.h
engines/tot/forest.cpp
engines/tot/forest.h
engines/tot/game.cpp
engines/tot/graphics.cpp
engines/tot/graphics.h
engines/tot/module.mk
engines/tot/routines.cpp
engines/tot/routines.h
engines/tot/routines2.cpp
engines/tot/routines2.h
engines/tot/saveload.cpp
engines/tot/tot.cpp
engines/tot/tot.h
engines/tot/util.cpp
engines/tot/util.h
diff --git a/engines/tot/anims.cpp b/engines/tot/anims.cpp
index 43d560de109..815b7b290fc 100644
--- a/engines/tot/anims.cpp
+++ b/engines/tot/anims.cpp
@@ -30,66 +30,66 @@
#include "tot/anims.h"
#include "tot/decoder/TotFlicDecoder.h"
#include "tot/graphics.h"
-#include "tot/playanim.h"
+#include "tot/vars.h"
#include "tot/texts.h"
#include "tot/tot.h"
namespace Tot {
-const int sizefrase = 320 * 70 + 4;
+const int textAreaSize = 320 * 70 + 4;
-int32 posflicfile;
-uint numerovuelta, posrelfli;
-byte *punterofondofrase = (byte *)malloc(sizefrase);
-byte framecontador;
-bool primeravuelta;
+int32 flicFilePos;
+uint loopNumber, flicRelativePos;
+byte *textAreaBackground = (byte *)malloc(textAreaSize);
+byte frameCount;
+bool firstLoop;
-void drawText(uint xfrase, uint yfrase, Common::String str1, Common::String str2, Common::String str3, Common::String str4, Common::String str5, byte colorfrase, byte colorborde) {
+void drawText(uint x, uint y, Common::String str1, Common::String str2, Common::String str3, Common::String str4, Common::String str5, byte textColor, byte borderColor) {
- littText(xfrase, (yfrase + 3), str1, colorborde);
- littText(xfrase, (yfrase + 13), str2, colorborde);
- littText(xfrase, (yfrase + 23), str3, colorborde);
- littText(xfrase, (yfrase + 33), str4, colorborde);
- littText(xfrase, (yfrase + 43), str5, colorborde);
+ littText(x, (y + 3), str1, borderColor);
+ littText(x, (y + 13), str2, borderColor);
+ littText(x, (y + 23), str3, borderColor);
+ littText(x, (y + 33), str4, borderColor);
+ littText(x, (y + 43), str5, borderColor);
g_engine->_screen->update();
delay(enforcedTextAnimDelay);
- littText(xfrase, (yfrase + 1), str1, colorborde);
- littText(xfrase, (yfrase + 11), str2, colorborde);
- littText(xfrase, (yfrase + 21), str3, colorborde);
- littText(xfrase, (yfrase + 31), str4, colorborde);
- littText(xfrase, (yfrase + 41), str5, colorborde);
+ littText(x, (y + 1), str1, borderColor);
+ littText(x, (y + 11), str2, borderColor);
+ littText(x, (y + 21), str3, borderColor);
+ littText(x, (y + 31), str4, borderColor);
+ littText(x, (y + 41), str5, borderColor);
g_engine->_screen->update();
delay(enforcedTextAnimDelay);
- littText(xfrase + 1, (yfrase + 2), str1, colorborde);
- littText(xfrase + 1, (yfrase + 12), str2, colorborde);
- littText(xfrase + 1, (yfrase + 22), str3, colorborde);
- littText(xfrase + 1, (yfrase + 32), str4, colorborde);
- littText(xfrase + 1, (yfrase + 42), str5, colorborde);
+ littText(x + 1, (y + 2), str1, borderColor);
+ littText(x + 1, (y + 12), str2, borderColor);
+ littText(x + 1, (y + 22), str3, borderColor);
+ littText(x + 1, (y + 32), str4, borderColor);
+ littText(x + 1, (y + 42), str5, borderColor);
g_engine->_screen->update();
delay(enforcedTextAnimDelay);
- littText(xfrase - 1, (yfrase + 2), str1, colorborde);
- littText(xfrase - 1, (yfrase + 12), str2, colorborde);
- littText(xfrase - 1, (yfrase + 22), str3, colorborde);
- littText(xfrase - 1, (yfrase + 32), str4, colorborde);
- littText(xfrase - 1, (yfrase + 42), str5, colorborde);
+ littText(x - 1, (y + 2), str1, borderColor);
+ littText(x - 1, (y + 12), str2, borderColor);
+ littText(x - 1, (y + 22), str3, borderColor);
+ littText(x - 1, (y + 32), str4, borderColor);
+ littText(x - 1, (y + 42), str5, borderColor);
g_engine->_screen->update();
delay(enforcedTextAnimDelay);
- littText(xfrase, (yfrase + 2), str1, colorfrase);
- littText(xfrase, (yfrase + 12), str2, colorfrase);
- littText(xfrase, (yfrase + 22), str3, colorfrase);
- littText(xfrase, (yfrase + 32), str4, colorfrase);
- littText(xfrase, (yfrase + 42), str5, colorfrase);
+ littText(x, (y + 2), str1, textColor);
+ littText(x, (y + 12), str2, textColor);
+ littText(x, (y + 22), str3, textColor);
+ littText(x, (y + 32), str4, textColor);
+ littText(x, (y + 42), str5, textColor);
g_engine->_screen->update();
}
-void removeText(uint xfrase1, uint yfrase1, uint xfrase2, uint yfrase2, byte colorrelleno) {
+void removeText(uint xTextLine1, uint yTextLine1, uint xTextLine2, uint yTextLine2, byte fillColor) {
- for (int j = yfrase1; j < yfrase2 + 1; j++) {
- for (int i = xfrase1; i < xfrase2 + 1; i++) {
+ for (int j = yTextLine1; j < yTextLine2 + 1; j++) {
+ for (int i = xTextLine1; i < xTextLine2 + 1; i++) {
*((byte *)g_engine->_screen->getBasePtr(i, j)) = 0;
}
}
- g_engine->_screen->addDirtyRect(Common::Rect(xfrase1, yfrase1, xfrase2, yfrase2));
+ g_engine->_screen->addDirtyRect(Common::Rect(xTextLine1, yTextLine1, xTextLine2, yTextLine2));
}
void drawTvText(Common::String str1, Common::String str2, Common::String str3, Common::String str4, Common::String str5) {
@@ -107,20 +107,20 @@ void clearCharacterText() {
removeText(2, 100, 134, 199, 0);
}
-void handleFlcEvent(byte numero_del_evento) {
+void handleFlcEvent(byte eventNumber) {
const char *const *messages = g_engine->_lang == Common::ES_ESP ? animMessages[0] : animMessages[1];
bool isSpanish = g_engine->_lang == Common::ES_ESP;
bool isEnglish = !isSpanish;
- switch (numero_del_evento) {
+ switch (eventNumber) {
case 0:
- if (contadorpc > 103)
+ if (cpCounter > 103)
showError(274);
break;
case 1:
- if (framecontador == 3)
+ if (frameCount == 3)
- switch (numerovuelta) {
+ switch (loopNumber) {
case 2:
drawTvText(messages[0], messages[1], messages[2], messages[3], messages[4]);
break;
@@ -264,7 +264,7 @@ void handleFlcEvent(byte numero_del_evento) {
}
break;
case 2:
- switch (framecontador) {
+ switch (frameCount) {
case 1: {
clearCharacterText();
clearTvText();
@@ -321,7 +321,7 @@ void handleFlcEvent(byte numero_del_evento) {
}
break;
case 3:
- switch (framecontador) {
+ switch (frameCount) {
case 15:
g_engine->_sound->playVoc("FRENAZO", 165322, 15073);
break;
@@ -332,16 +332,16 @@ void handleFlcEvent(byte numero_del_evento) {
g_engine->_sound->playVoc("PORTAZO", 434988, 932);
break;
case 60:
- g_engine->_graphics->getImg(0, 0, 319, 29, punterofondofrase);
+ g_engine->_graphics->getImg(0, 0, 319, 29, textAreaBackground);
break;
}
break;
case 4:
- if (framecontador == 3)
+ if (frameCount == 3)
g_engine->_sound->playVoc("TIMBRAZO", 423775, 11213);
break;
case 5:
- if ((numerovuelta == 1) && (framecontador == 2)) {
+ if ((loopNumber == 1) && (frameCount == 2)) {
delay(2000);
drawText(5, 1,
@@ -352,7 +352,7 @@ void handleFlcEvent(byte numero_del_evento) {
messages[104],
255, 249);
delay(3500);
- g_engine->_graphics->putImg(0, 0, punterofondofrase);
+ g_engine->_graphics->putImg(0, 0, textAreaBackground);
drawText(5, 1,
messages[105],
messages[106],
@@ -363,8 +363,8 @@ void handleFlcEvent(byte numero_del_evento) {
}
break;
case 6:
- if ((numerovuelta == 1) && (framecontador == 3)) {
- g_engine->_graphics->putImg(0, 0, punterofondofrase);
+ if ((loopNumber == 1) && (frameCount == 3)) {
+ g_engine->_graphics->putImg(0, 0, textAreaBackground);
drawText(5, 1,
messages[110],
messages[111],
@@ -373,8 +373,8 @@ void handleFlcEvent(byte numero_del_evento) {
messages[114],
255, 249);
}
- else if ((numerovuelta == 5) && (framecontador == 3)) {
- g_engine->_graphics->putImg(0, 0, punterofondofrase);
+ else if ((loopNumber == 5) && (frameCount == 3)) {
+ g_engine->_graphics->putImg(0, 0, textAreaBackground);
drawText(5, 1,
messages[275],
messages[276],
@@ -385,8 +385,8 @@ void handleFlcEvent(byte numero_del_evento) {
}
break;
case 7:
- if ((numerovuelta == 1) && (framecontador == 3)) {
- g_engine->_graphics->putImg(0, 0, punterofondofrase);
+ if ((loopNumber == 1) && (frameCount == 3)) {
+ g_engine->_graphics->putImg(0, 0, textAreaBackground);
drawText(5, 1,
messages[115],
messages[116],
@@ -397,8 +397,8 @@ void handleFlcEvent(byte numero_del_evento) {
}
break;
case 8:
- if ((numerovuelta == 1) && (framecontador == 3)) {
- g_engine->_graphics->putImg(0, 0, punterofondofrase);
+ if ((loopNumber == 1) && (frameCount == 3)) {
+ g_engine->_graphics->putImg(0, 0, textAreaBackground);
drawText(5, 1,
messages[120],
messages[121],
@@ -407,8 +407,8 @@ void handleFlcEvent(byte numero_del_evento) {
messages[124],
255, 249);
}
- else if ((numerovuelta == 5) && (framecontador == 3)) {
- g_engine->_graphics->putImg(0, 0, punterofondofrase);
+ else if ((loopNumber == 5) && (frameCount == 3)) {
+ g_engine->_graphics->putImg(0, 0, textAreaBackground);
drawText(5, 1,
messages[280],
messages[281],
@@ -419,8 +419,8 @@ void handleFlcEvent(byte numero_del_evento) {
}
break;
case 9:
- if ((numerovuelta == 1) && (framecontador == 3)) {
- g_engine->_graphics->putImg(0, 0, punterofondofrase);
+ if ((loopNumber == 1) && (frameCount == 3)) {
+ g_engine->_graphics->putImg(0, 0, textAreaBackground);
drawText(5, 1,
messages[125],
messages[126],
@@ -431,8 +431,8 @@ void handleFlcEvent(byte numero_del_evento) {
}
break;
case 10:
- if ((numerovuelta == 1) && (framecontador == 3)) {
- g_engine->_graphics->putImg(0, 0, punterofondofrase);
+ if ((loopNumber == 1) && (frameCount == 3)) {
+ g_engine->_graphics->putImg(0, 0, textAreaBackground);
drawText(5, 1,
messages[130],
messages[131],
@@ -443,8 +443,8 @@ void handleFlcEvent(byte numero_del_evento) {
}
break;
case 11:
- if ((numerovuelta == 1) && (framecontador == 3)) {
- g_engine->_graphics->putImg(0, 0, punterofondofrase);
+ if ((loopNumber == 1) && (frameCount == 3)) {
+ g_engine->_graphics->putImg(0, 0, textAreaBackground);
drawText(5, 1,
messages[135],
messages[136],
@@ -455,8 +455,8 @@ void handleFlcEvent(byte numero_del_evento) {
}
break;
case 12:
- if ((numerovuelta == 1) && (framecontador == 3)) {
- g_engine->_graphics->putImg(0, 0, punterofondofrase);
+ if ((loopNumber == 1) && (frameCount == 3)) {
+ g_engine->_graphics->putImg(0, 0, textAreaBackground);
drawText(5, 1,
messages[140],
messages[141],
@@ -467,8 +467,8 @@ void handleFlcEvent(byte numero_del_evento) {
}
break;
case 13:
- if ((numerovuelta == 1) && (framecontador == 3)) {
- g_engine->_graphics->putImg(0, 0, punterofondofrase);
+ if ((loopNumber == 1) && (frameCount == 3)) {
+ g_engine->_graphics->putImg(0, 0, textAreaBackground);
drawText(5, 1,
messages[145],
messages[146],
@@ -479,8 +479,8 @@ void handleFlcEvent(byte numero_del_evento) {
}
break;
case 14:
- if ((numerovuelta == 1) && (framecontador == 3)) {
- g_engine->_graphics->putImg(0, 0, punterofondofrase);
+ if ((loopNumber == 1) && (frameCount == 3)) {
+ g_engine->_graphics->putImg(0, 0, textAreaBackground);
drawText(5, 1,
messages[150],
messages[151],
@@ -489,8 +489,8 @@ void handleFlcEvent(byte numero_del_evento) {
messages[154],
255, 249);
}
- else if ((numerovuelta == 5) && (framecontador == 3)) {
- g_engine->_graphics->putImg(0, 0, punterofondofrase);
+ else if ((loopNumber == 5) && (frameCount == 3)) {
+ g_engine->_graphics->putImg(0, 0, textAreaBackground);
drawText(5, 1,
messages[285],
messages[286],
@@ -501,8 +501,8 @@ void handleFlcEvent(byte numero_del_evento) {
}
break;
case 15:
- if ((numerovuelta == 1) && (framecontador == 3)) {
- g_engine->_graphics->putImg(0, 0, punterofondofrase);
+ if ((loopNumber == 1) && (frameCount == 3)) {
+ g_engine->_graphics->putImg(0, 0, textAreaBackground);
drawText(5, 1,
messages[155],
messages[156],
@@ -513,8 +513,8 @@ void handleFlcEvent(byte numero_del_evento) {
}
break;
case 16:
- if ((numerovuelta == 1) && (framecontador == 3)) {
- g_engine->_graphics->putImg(0, 0, punterofondofrase);
+ if ((loopNumber == 1) && (frameCount == 3)) {
+ g_engine->_graphics->putImg(0, 0, textAreaBackground);
drawText(5, 1,
messages[160],
messages[161],
@@ -525,9 +525,9 @@ void handleFlcEvent(byte numero_del_evento) {
}
break;
case 17:
- switch (framecontador) {
+ switch (frameCount) {
case 1:
- g_engine->_graphics->putImg(0, 0, punterofondofrase);
+ g_engine->_graphics->putImg(0, 0, textAreaBackground);
break;
case 17:
delay(500);
@@ -538,8 +538,8 @@ void handleFlcEvent(byte numero_del_evento) {
}
break;
case 18:
- if ((numerovuelta == 1) && (framecontador == 3)) {
- g_engine->_graphics->putImg(0, 0, punterofondofrase);
+ if ((loopNumber == 1) && (frameCount == 3)) {
+ g_engine->_graphics->putImg(0, 0, textAreaBackground);
drawText(5, 1,
messages[165],
messages[166],
@@ -550,7 +550,7 @@ void handleFlcEvent(byte numero_del_evento) {
}
break;
case 19:
- if (framecontador == 1)
+ if (frameCount == 1)
drawText(5, 121,
messages[170],
messages[171],
@@ -560,11 +560,11 @@ void handleFlcEvent(byte numero_del_evento) {
253, 249);
break;
case 20:
- switch (numerovuelta) {
+ switch (loopNumber) {
case 1:
- switch (framecontador) {
+ switch (frameCount) {
case 1:
- g_engine->_graphics->getImg(0, 0, 319, 69, punterofondofrase);
+ g_engine->_graphics->getImg(0, 0, 319, 69, textAreaBackground);
break;
case 3:
drawText(15, 1,
@@ -578,9 +578,9 @@ void handleFlcEvent(byte numero_del_evento) {
}
break;
case 3:
- switch (framecontador) {
+ switch (frameCount) {
case 1:
- g_engine->_graphics->putImg(0, 0, punterofondofrase);
+ g_engine->_graphics->putImg(0, 0, textAreaBackground);
break;
case 3:
drawText(15, 1,
@@ -594,9 +594,9 @@ void handleFlcEvent(byte numero_del_evento) {
}
break;
case 6:
- switch (framecontador) {
+ switch (frameCount) {
case 1:
- g_engine->_graphics->putImg(0, 0, punterofondofrase);
+ g_engine->_graphics->putImg(0, 0, textAreaBackground);
break;
case 3:
drawText(15, 1,
@@ -610,9 +610,9 @@ void handleFlcEvent(byte numero_del_evento) {
}
break;
case 9:
- switch (framecontador) {
+ switch (frameCount) {
case 1:
- g_engine->_graphics->putImg(0, 0, punterofondofrase);
+ g_engine->_graphics->putImg(0, 0, textAreaBackground);
break;
case 3:
drawText(15, 1,
@@ -626,9 +626,9 @@ void handleFlcEvent(byte numero_del_evento) {
}
break;
case 12:
- switch (framecontador) {
+ switch (frameCount) {
case 1:
- g_engine->_graphics->putImg(0, 0, punterofondofrase);
+ g_engine->_graphics->putImg(0, 0, textAreaBackground);
break;
case 3:
drawText(15, 1,
@@ -642,9 +642,9 @@ void handleFlcEvent(byte numero_del_evento) {
}
break;
case 15:
- switch (framecontador) {
+ switch (frameCount) {
case 1:
- g_engine->_graphics->putImg(0, 0, punterofondofrase);
+ g_engine->_graphics->putImg(0, 0, textAreaBackground);
break;
case 3:
drawText(15, 1,
@@ -658,9 +658,9 @@ void handleFlcEvent(byte numero_del_evento) {
}
break;
case 18:
- switch (framecontador) {
+ switch (frameCount) {
case 1:
- g_engine->_graphics->putImg(0, 0, punterofondofrase);
+ g_engine->_graphics->putImg(0, 0, textAreaBackground);
break;
case 3:
drawText(15, 1,
@@ -674,9 +674,9 @@ void handleFlcEvent(byte numero_del_evento) {
}
break;
case 21:
- switch (framecontador) {
+ switch (frameCount) {
case 1:
- g_engine->_graphics->putImg(0, 0, punterofondofrase);
+ g_engine->_graphics->putImg(0, 0, textAreaBackground);
break;
case 3:
drawText(15, 1,
@@ -690,9 +690,9 @@ void handleFlcEvent(byte numero_del_evento) {
}
break;
case 24:
- switch (framecontador) {
+ switch (frameCount) {
case 1:
- g_engine->_graphics->putImg(0, 0, punterofondofrase);
+ g_engine->_graphics->putImg(0, 0, textAreaBackground);
break;
case 3:
drawText(15, 1,
@@ -706,9 +706,9 @@ void handleFlcEvent(byte numero_del_evento) {
}
break;
case 27:
- switch (framecontador) {
+ switch (frameCount) {
case 1:
- g_engine->_graphics->putImg(0, 0, punterofondofrase);
+ g_engine->_graphics->putImg(0, 0, textAreaBackground);
break;
case 3:
drawText(15, 1,
@@ -722,9 +722,9 @@ void handleFlcEvent(byte numero_del_evento) {
}
break;
case 30:
- switch (framecontador) {
+ switch (frameCount) {
case 1:
- g_engine->_graphics->putImg(0, 0, punterofondofrase);
+ g_engine->_graphics->putImg(0, 0, textAreaBackground);
break;
case 3:
drawText(15, 1,
@@ -738,13 +738,13 @@ void handleFlcEvent(byte numero_del_evento) {
}
break;
case 33:
- if (framecontador == 17)
- g_engine->_graphics->putImg(0, 0, punterofondofrase);
+ if (frameCount == 17)
+ g_engine->_graphics->putImg(0, 0, textAreaBackground);
break;
}
break;
case 21:
- switch (framecontador) {
+ switch (frameCount) {
case 1:
g_engine->_sound->playVoc("TRIDEN", 409405, 14370);
break;
@@ -754,11 +754,11 @@ void handleFlcEvent(byte numero_del_evento) {
}
break;
case 22:
- if (framecontador == 24)
+ if (frameCount == 24)
g_engine->_sound->playVoc("PUFF", 191183, 18001);
break;
case 23:
- switch (framecontador) {
+ switch (frameCount) {
case 8:
g_engine->_sound->playVoc("AFILAR", 0, 6433);
break;
@@ -768,19 +768,19 @@ void handleFlcEvent(byte numero_del_evento) {
}
break;
case 24:
- if (framecontador == 8)
+ if (frameCount == 8)
g_engine->_sound->playVoc("DECAPITA", 354269, 1509);
break;
case 25:
- if (framecontador == 97)
+ if (frameCount == 97)
g_engine->_sound->playVoc("PUFF2", 209184, 14514);
break;
case 26:
- switch (numerovuelta) {
+ switch (loopNumber) {
case 1:
- switch (framecontador) {
+ switch (frameCount) {
case 2:
- g_engine->_graphics->getImg(0, 0, 319, 69, punterofondofrase);
+ g_engine->_graphics->getImg(0, 0, 319, 69, textAreaBackground);
break;
case 3:
drawText(65, 1,
@@ -794,9 +794,9 @@ void handleFlcEvent(byte numero_del_evento) {
}
break;
case 2:
- switch (framecontador) {
+ switch (frameCount) {
case 1:
- g_engine->_graphics->putImg(0, 0, punterofondofrase);
+ g_engine->_graphics->putImg(0, 0, textAreaBackground);
break;
case 2:
drawText(65, 1,
@@ -810,9 +810,9 @@ void handleFlcEvent(byte numero_del_evento) {
}
break;
case 5:
- switch (framecontador) {
+ switch (frameCount) {
case 1:
- g_engine->_graphics->putImg(0, 0, punterofondofrase);
+ g_engine->_graphics->putImg(0, 0, textAreaBackground);
break;
case 2:
drawText(65, 1,
@@ -826,9 +826,9 @@ void handleFlcEvent(byte numero_del_evento) {
}
break;
case 8:
- switch (framecontador) {
+ switch (frameCount) {
case 1:
- g_engine->_graphics->putImg(0, 0, punterofondofrase);
+ g_engine->_graphics->putImg(0, 0, textAreaBackground);
break;
case 2:
drawText(65, 1,
@@ -844,32 +844,31 @@ void handleFlcEvent(byte numero_del_evento) {
}
break;
case 27:
- if (framecontador == 148)
+ if (frameCount == 148)
g_engine->_sound->playVoc("DECAPITA", 354269, 1509);
break;
}
}
-void drawFlc(uint flicx, uint flicy, int32 posicionfli, uint loop,
- byte veloc, byte numevento, bool palcompleta, bool permitesalida,
+void drawFlc(uint x, uint y, int32 fliOffset, uint loop,
+ byte speed, byte eventNumber, bool fullPalette, bool isSkipAllowed,
bool doscientos, bool &salidaflis);
-static void exitProcedure(bool &salir_bucle, bool &permitesalida) {
+static void exitProcedure(bool &exitLoop, bool &isSkipAllowed) {
- salir_bucle = false;
- if (permitesalida) {
+ exitLoop = false;
+ if (isSkipAllowed) {
Common::Event e;
while (g_system->getEventManager()->pollEvent(e)) {
if (e.type == Common::EVENT_KEYDOWN || (e.type == Common::EVENT_LBUTTONUP)) {
- salir_bucle = true;
- debug("Exiting from exitProcedure!");
+ exitLoop = true;
}
}
}
}
-static fliheader readHeader(Common::File *file) {
- fliheader headerfile;
+static FliHeader readHeader(Common::File *file) {
+ FliHeader headerfile;
headerfile.size = file->readSint32LE();
headerfile.magic = file->readSint16LE();
@@ -886,11 +885,9 @@ static fliheader readHeader(Common::File *file) {
file->read(headerfile.updator, 4);
headerfile.aspectx = file->readSint16LE();
headerfile.aspecty = file->readSint16LE();
- // Note: probably shouldnt just harcode 2 here
file->read(headerfile.reserved2, 19 * 2);
headerfile.ofsframe1 = file->readSint32LE();
headerfile.ofsframe2 = file->readSint32LE();
- // Note: probably shouldnt just harcode 2 here
file->read(headerfile.reserved2, 20 * 2);
return headerfile;
}
@@ -911,17 +908,17 @@ void blit(const Graphics::Surface *src, Common::Rect bounds) {
static void loadFlc(
uint &loop,
- bool &permitesalida,
- bool &salidaflis,
- byte &numevento,
- bool &palcompleta,
- bool &doscientos,
- byte &veloc,
- uint &flicx,
- uint &flicy) {
+ bool &isSkipAllowed,
+ bool &exitAnim,
+ byte &eventNumber,
+ bool &fullPalette,
+ bool &limitPaletteTo200,
+ byte &speed,
+ uint &x,
+ uint &y) {
- framecontador = 0;
- numerovuelta = 0;
+ frameCount = 0;
+ loopNumber = 0;
Common::File animationsFile;
Common::String fileName;
@@ -933,13 +930,13 @@ static void loadFlc(
if (!animationsFile.open(Common::Path(fileName))) {
showError(272);
}
- animationsFile.seek(posflicfile, SEEK_SET);
+ animationsFile.seek(flicFilePos, SEEK_SET);
// Need to read header to get the total size of the FLIC file.
- fliheader header = readHeader(&animationsFile);
+ FliHeader header = readHeader(&animationsFile);
Common::SeekableSubReadStream *thisFlic = new Common::SeekableSubReadStream(
&animationsFile,
- posflicfile,
- posflicfile + header.size);
+ flicFilePos,
+ flicFilePos + header.size);
TotFlicDecoder flic = TotFlicDecoder();
@@ -947,20 +944,20 @@ static void loadFlc(
flic.start();
do {
- exitProcedure(salidaflis, permitesalida);
- numerovuelta++;
+ exitProcedure(exitAnim, isSkipAllowed);
+ loopNumber++;
do {
g_engine->_chrono->updateChrono();
- exitProcedure(salidaflis, permitesalida);
- if (salidaflis) {
- goto Lsalir_proc;
+ exitProcedure(exitAnim, isSkipAllowed);
+ if (exitAnim) {
+ goto Lexit_proc;
}
- if (tocapintar) {
- framecontador++;
- handleFlcEvent(numevento);
+ if (timeToDraw) {
+ frameCount++;
+ handleFlcEvent(eventNumber);
const Graphics::Surface *frame = flic.decodeNextFrame();
if (frame) {
- Common::Rect boundingBox = Common::Rect(flicx, flicy, flicx + flic.getWidth() + 1, flicy + flic.getHeight() + 1);
+ Common::Rect boundingBox = Common::Rect(x, y, x + flic.getWidth() + 1, y + flic.getHeight() + 1);
blit(frame, boundingBox);
if (flic.hasDirtyPalette()) {
byte *palette = (byte *)flic.getPalette();
@@ -968,10 +965,10 @@ static void loadFlc(
palette[0] = 0;
palette[1] = 0;
palette[2] = 0;
- if (palcompleta) {
+ if (fullPalette) {
changePalette(g_engine->_graphics->getPalette(), palette);
copyPalette(palette, pal);
- } else if (doscientos) {
+ } else if (limitPaletteTo200) {
g_engine->_graphics->setPalette(palette, 200);
for (int i = 0; i <= 200; i++) {
if(gamePart == 2 && !shouldQuitGame && (i == 131 || i == 134 || i == 143 || i == 187)) {
@@ -988,15 +985,15 @@ static void loadFlc(
}
}
// Make sure we also update the palette animations! Esp. for part 2
- if (currentRoomData != NULL && (currentRoomData->paletteAnimationFlag) && (saltospal >= 4) && !shouldQuitGame) {
- saltospal = 0;
+ if (currentRoomData != NULL && (currentRoomData->paletteAnimationFlag) && (palAnimStep >= 4) && !shouldQuitGame) {
+ palAnimStep = 0;
if (isPaletteAnimEnabled > 6)
isPaletteAnimEnabled = 0;
else isPaletteAnimEnabled += 1;
updatePalette(isPaletteAnimEnabled);
- } else saltospal += 1;
+ } else palAnimStep += 1;
- tocapintar = false;
+ timeToDraw = false;
} else {
break;
}
@@ -1008,35 +1005,35 @@ static void loadFlc(
if (flic.isRewindable()) {
flic.rewind();
}
- framecontador = 0;
- primeravuelta = false;
+ frameCount = 0;
+ firstLoop = false;
}
- } while (numerovuelta <= loop && !g_engine->shouldQuit());
+ } while (loopNumber <= loop && !g_engine->shouldQuit());
flic.stop();
-Lsalir_proc:
+Lexit_proc:
animationsFile.close();
}
void drawFlc(
- uint flicx,
- uint flicy,
- int32 posicionfli,
+ uint x,
+ uint y,
+ int32 offset,
uint loop,
- byte veloc,
- byte numevento,
- bool palcompleta,
- bool permitesalida,
- bool doscientos,
- bool &salidaflis) {
+ byte speed,
+ byte numEvent,
+ bool fullPalette,
+ bool skipAllowed,
+ bool limitPaletteTo200,
+ bool &exitAnim) {
- primeravuelta = true;
- posflicfile = posicionfli;
- posrelfli = flicx + flicy * 320;
- loadFlc(loop, permitesalida, salidaflis, numevento, palcompleta, doscientos, veloc, flicx, flicy);
- debug("Salida flis: %d", salidaflis);
+ firstLoop = true;
+ flicFilePos = offset;
+ flicRelativePos = x + y * 320;
+ loadFlc(loop, skipAllowed, exitAnim, numEvent, fullPalette, limitPaletteTo200, speed, x, y);
+ debug("Salida flis: %d", exitAnim);
}
void clearAnims() {
- free(punterofondofrase);
+ free(textAreaBackground);
}
} // End of namespace Tot
diff --git a/engines/tot/anims.h b/engines/tot/anims.h
index 1902e34542d..96f26e9a229 100644
--- a/engines/tot/anims.h
+++ b/engines/tot/anims.h
@@ -33,7 +33,7 @@ void clearAnims();
/**
* Header of an Autodesk Animator FLIC file.
*/
-struct fliheader {
+struct FliHeader {
int32 size; // file size
uint magic, // format id
frames, // number of animation frames
diff --git a/engines/tot/chrono.cpp b/engines/tot/chrono.cpp
index f467f39d86c..7b581d836e9 100644
--- a/engines/tot/chrono.cpp
+++ b/engines/tot/chrono.cpp
@@ -26,9 +26,9 @@
namespace Tot {
-bool tocapintar = false;
-bool tocapintar2 = false;
-bool tocapintareffect = false;
+bool timeToDraw = false;
+bool timeToDraw2 = false;
+bool timeToDrawEffect = false;
ChronoManager::ChronoManager(/* args */) : _lastTick(0), _lastDoubleTick(0) {
}
@@ -40,17 +40,17 @@ void ChronoManager::updateChrono() {
uint32 currentTime = g_system->getMillis();
if ((currentTime - _lastTick) >= kFrameMs / _speedMultiplier) {
- tocapintar = true;
+ timeToDraw = true;
tocapintarTick++;
if (tocapintarTick == kDoubleFrameMultiplier) {
tocapintarTick = 0;
- tocapintar2 = true;
+ timeToDraw2 = true;
} else {
- tocapintar2 = false;
+ timeToDraw2 = false;
}
_lastTick = currentTime;
} else {
- tocapintar = false;
+ timeToDraw = false;
}
}
diff --git a/engines/tot/chrono.h b/engines/tot/chrono.h
index 7aab235a52c..9fd7b2f0f58 100644
--- a/engines/tot/chrono.h
+++ b/engines/tot/chrono.h
@@ -28,7 +28,7 @@ namespace Tot {
/**
* Flags for animations
*/
-extern bool tocapintar, tocapintar2, tocapintareffect;
+extern bool timeToDraw, timeToDraw2, timeToDrawEffect;
// Set to 30 for ease of dev
const int kFrameMs = 20;
diff --git a/engines/tot/console.cpp b/engines/tot/console.cpp
index 4396dcb91dc..e34b92851d1 100644
--- a/engines/tot/console.cpp
+++ b/engines/tot/console.cpp
@@ -20,7 +20,7 @@
*/
#include "tot/console.h"
-#include "tot/playanim.h"
+#include "tot/vars.h"
#include "tot/routines.h"
namespace Tot {
diff --git a/engines/tot/dialog.cpp b/engines/tot/dialog.cpp
index bf7d8bbb615..4de677ea871 100644
--- a/engines/tot/dialog.cpp
+++ b/engines/tot/dialog.cpp
@@ -26,7 +26,7 @@
#include "tot/chrono.h"
#include "tot/dialog.h"
-#include "tot/playanim.h"
+#include "tot/mouse.h"
#include "tot/routines.h"
#include "tot/routines2.h"
#include "tot/texts.h"
@@ -36,243 +36,243 @@ namespace Tot {
byte conversationIndex;
-plista l1, l;
+listP l1, l;
Tree ar, auxTree, step;
bool endOfConversation;
-Common::String decrypt(Common::String tEncriptado) {
- for (int i = 0; i < tEncriptado.size(); i++) {
- tEncriptado.setChar(decryptionKey[i] ^ (char)tEncriptado[i], i);
+Common::String decrypt(Common::String encryptedText) {
+ for (int i = 0; i < encryptedText.size(); i++) {
+ encryptedText.setChar(decryptionKey[i] ^ (char)encryptedText[i], i);
}
- return tEncriptado;
+ return encryptedText;
}
-void findDialogLine(byte persona);
+void findDialogLine(byte characterIndex);
-static void findDownwards(Tree paso, bool &desciende) {
- if (paso != NULL) {
- if (paso->element.dicho != '1') {
- desciende = true;
+static void findDownwards(Tree curTree, bool &descend) {
+ if (curTree != NULL) {
+ if (curTree->element.spoken != '1') {
+ descend = true;
return;
} else {
- findDownwards(leftChild(paso), desciende);
- findDownwards(rightSibling(paso), desciende);
+ findDownwards(leftChild(curTree), descend);
+ findDownwards(rightSibling(curTree), descend);
}
}
}
-void findDialogLine(byte persona) {
- bool hecho, decir, subida, desciende, borde, adelanta;
+void findDialogLine(byte characterIndex) {
+ bool speak, ascend, descend, border, forward;
auxTree = ar;
auxTree = auxTree->child;
- hecho = false;
- l = new lista;
- l->siguiente = NULL;
+ bool done = false;
+ l = new list;
+ l->next = NULL;
l1 = l;
- borde = false;
- subida = false;
+ border = false;
+ ascend = false;
do {
- switch (auxTree->element.dicho) {
+ switch (auxTree->element.spoken) {
case '0':
case '2':
case 'H':
- decir = true;
+ speak = true;
break;
case '1': {
- decir = false;
+ speak = false;
step = auxTree->child;
- desciende = false;
- findDownwards(step, desciende);
- if (!(desciende))
- subida = true;
+ descend = false;
+ findDownwards(step, descend);
+ if (!(descend))
+ ascend = true;
step = NULL;
} break;
case '3':
- if (bookTopic[0] && (persona == 3)) {
- decir = false;
- subida = true;
+ if (bookTopic[0] && (characterIndex == 3)) {
+ speak = false;
+ ascend = true;
} else
- decir = true;
+ speak = true;
break;
case '4':
- if (firstTimeTopicA[persona - 1]) {
- decir = false;
- subida = true;
+ if (firstTimeTopicA[characterIndex - 1]) {
+ speak = false;
+ ascend = true;
} else
- decir = true;
+ speak = true;
break;
case '5':
- if (bookTopic[persona - 1] && firstTimeTopicB[persona - 1])
- decir = true;
+ if (bookTopic[characterIndex - 1] && firstTimeTopicB[characterIndex - 1])
+ speak = true;
else {
- decir = false;
- subida = true;
+ speak = false;
+ ascend = true;
}
break;
case '6':
- if (bookTopic[persona - 1] && !firstTimeTopicB[persona - 1])
- decir = true;
+ if (bookTopic[characterIndex - 1] && !firstTimeTopicB[characterIndex - 1])
+ speak = true;
else {
- decir = false;
- subida = true;
+ speak = false;
+ ascend = true;
}
break;
case '7':
- if (bookTopic[persona - 1]) {
- decir = false;
- subida = true;
- } else if (!firstTimeTopicA[persona - 1])
- decir = true;
+ if (bookTopic[characterIndex - 1]) {
+ speak = false;
+ ascend = true;
+ } else if (!firstTimeTopicA[characterIndex - 1])
+ speak = true;
else {
- decir = false;
- subida = true;
+ speak = false;
+ ascend = true;
}
break;
case '8':
- if (mintTopic[persona - 1] && firstTimeTopicC[persona - 1])
- decir = true;
+ if (mintTopic[characterIndex - 1] && firstTimeTopicC[characterIndex - 1])
+ speak = true;
else {
- decir = false;
- subida = true;
+ speak = false;
+ ascend = true;
}
break;
case '9':
- if (mintTopic[persona - 1] && !firstTimeTopicC[persona - 1])
- decir = true;
+ if (mintTopic[characterIndex - 1] && !firstTimeTopicC[characterIndex - 1])
+ speak = true;
else {
- decir = false;
- subida = true;
+ speak = false;
+ ascend = true;
}
break;
case 'A':
- if (!mintTopic[persona - 1] && !firstTimeTopicA[persona - 1])
- decir = true;
+ if (!mintTopic[characterIndex - 1] && !firstTimeTopicA[characterIndex - 1])
+ speak = true;
else {
- decir = false;
- subida = true;
+ speak = false;
+ ascend = true;
}
break;
case 'B':
if (caves[0] && !firstTimeTopicA[8])
- decir = true;
+ speak = true;
else
- decir = false;
+ speak = false;
break;
case 'C':
if (caves[1] && !firstTimeTopicA[8])
- decir = true;
+ speak = true;
else
- decir = false;
+ speak = false;
break;
case 'D':
if ((caves[0] && caves[1]) && !firstTimeTopicA[8])
- decir = true;
+ speak = true;
else
- decir = false;
+ speak = false;
break;
case 'E':
if ((caves[0] && !caves[2]) && !firstTimeTopicA[8])
- decir = true;
+ speak = true;
else
- decir = false;
+ speak = false;
break;
case 'F':
if (!caves[3])
- decir = true;
+ speak = true;
else
- decir = false;
+ speak = false;
break;
case 'G':
if (!caves[4])
- decir = true;
+ speak = true;
else
- decir = false;
+ speak = false;
break;
case 'I':
if (!isSealRemoved)
- decir = true;
+ speak = true;
else
- decir = false;
+ speak = false;
break;
case 'Z':
- decir = false;
+ speak = false;
break;
}
- if (decir) {
- if (auxTree->element.dicho == '2')
- if (!borde) {
- borde = true;
- switch (persona) {
+ if (speak) {
+ if (auxTree->element.spoken == '2')
+ if (!border) {
+ border = true;
+ switch (characterIndex) {
case 1:
- if (firstTimeTopicA[persona - 1]) {
- l1->elemento = 12;
- adelanta = true;
- } else if (bookTopic[persona - 1]) {
- adelanta = true;
- l1->elemento = 33;
+ if (firstTimeTopicA[characterIndex - 1]) {
+ l1->item = 12;
+ forward = true;
+ } else if (bookTopic[characterIndex - 1]) {
+ forward = true;
+ l1->item = 33;
} else {
- l1->elemento = 21;
- adelanta = true;
+ l1->item = 21;
+ forward = true;
}
break;
case 3:
- if (firstTimeTopicA[persona - 1]) {
- l1->elemento = 103;
- adelanta = true;
+ if (firstTimeTopicA[characterIndex - 1]) {
+ l1->item = 103;
+ forward = true;
} else {
- l1->elemento = 112;
- adelanta = true;
+ l1->item = 112;
+ forward = true;
}
break;
default: {
- l1->elemento = auxTree->element.index;
- adelanta = true;
+ l1->item = auxTree->element.index;
+ forward = true;
}
}
} else {
;
}
else {
- l1->elemento = auxTree->element.index;
- adelanta = true;
+ l1->item = auxTree->element.index;
+ forward = true;
}
- if (adelanta) {
- adelanta = false;
- l1->siguiente = new lista;
- l1 = l1->siguiente;
- l1->siguiente = NULL;
+ if (forward) {
+ forward = false;
+ l1->next = new list;
+ l1 = l1->next;
+ l1->next = NULL;
}
if (rightSibling(auxTree) != NULL)
auxTree = rightSibling(auxTree);
else {
do {
- if (!root(parent(auxTree)))
+ if (!isRoot(parent(auxTree)))
auxTree = parent(auxTree);
else
break;
- } while (!(auxTree->element.dicho == '1' && rightSibling(auxTree) != NULL));
+ } while (!(auxTree->element.spoken == '1' && rightSibling(auxTree) != NULL));
if (rightSibling(auxTree) != NULL)
auxTree = rightSibling(auxTree);
else
- hecho = true;
+ done = true;
}
- } else if (subida) {
- subida = false;
+ } else if (ascend) {
+ ascend = false;
if (rightSibling(auxTree) != NULL)
auxTree = rightSibling(auxTree);
else {
do {
- if (!root(parent(auxTree)))
+ if (!isRoot(parent(auxTree)))
auxTree = parent(auxTree);
else
break;
- } while (!((auxTree->element.dicho == '1') && (rightSibling(auxTree) != NULL)));
+ } while (!((auxTree->element.spoken == '1') && (rightSibling(auxTree) != NULL)));
if (rightSibling(auxTree) != NULL)
auxTree = rightSibling(auxTree);
else
- hecho = true;
+ done = true;
}
} else if (leftChild(auxTree) != NULL)
auxTree = leftChild(auxTree);
@@ -285,32 +285,31 @@ void findDialogLine(byte persona) {
else {
do {
auxTree = parent(auxTree);
- } while (!(root(auxTree) || rightSibling(auxTree) != NULL));
- if (root(auxTree))
- hecho = true;
+ } while (!(isRoot(auxTree) || rightSibling(auxTree) != NULL));
+ if (isRoot(auxTree))
+ done = true;
else
auxTree = rightSibling(auxTree);
}
}
- } while (!hecho);
+ } while (!done);
auxTree = NULL;
step = NULL;
l1 = NULL;
}
-void modifyTree(uint nodonew) {
- bool encontrado;
+void modifyTree(uint node) {
- encontrado = false;
+ bool found = false;
auxTree = ar->child;
do {
- if (auxTree->element.index == nodonew) {
+ if (auxTree->element.index == node) {
- if ((auxTree->element.dicho != '2') && (auxTree->element.dicho != 'H'))
- auxTree->element.dicho = '1';
- else if (auxTree->element.dicho != 'H')
- auxTree->element.dicho = 'Z';
- encontrado = true;
+ if ((auxTree->element.spoken != '2') && (auxTree->element.spoken != 'H'))
+ auxTree->element.spoken = '1';
+ else if (auxTree->element.spoken != 'H')
+ auxTree->element.spoken = 'Z';
+ found = true;
} else {
if (leftChild(auxTree) != NULL)
auxTree = leftChild(auxTree);
@@ -323,43 +322,43 @@ void modifyTree(uint nodonew) {
auxTree = rightSibling(auxTree);
}
}
- } while (!encontrado);
+ } while (!found);
}
void drawTalkMenu() {
- byte ytextaux;
+ byte auxTextY;
g_engine->_mouseManager->hide();
- for (ytextaux = 25; ytextaux >= 1; ytextaux--)
- rectangle(0, 175 - ytextaux, 319, 174 + ytextaux, 0);
- for (ytextaux = 1; ytextaux <= 25; ytextaux++)
- buttonBorder(0, 175 - ytextaux, 319, 174 + ytextaux, 253, 253, 253, 253, 0, 0, "");
+ for (auxTextY = 25; auxTextY >= 1; auxTextY--)
+ rectangle(0, 175 - auxTextY, 319, 174 + auxTextY, 0);
+ for (auxTextY = 1; auxTextY <= 25; auxTextY++)
+ buttonBorder(0, 175 - auxTextY, 319, 174 + auxTextY, 253, 253, 253, 253, 0);
drawMenu(5);
g_engine->_mouseManager->show();
}
-void fixTree(Tree paso) {
- if (paso != NULL) {
- if (paso->element.dicho == 'Z')
- paso->element.dicho = '2';
+void fixTree(Tree tree) {
+ if (tree != NULL) {
+ if (tree->element.spoken == 'Z')
+ tree->element.spoken = '2';
else {
- fixTree(leftChild(paso));
- fixTree(rightSibling(paso));
+ fixTree(leftChild(tree));
+ fixTree(rightSibling(tree));
}
}
}
-void showDialogLine(Common::String matrizconversa[16], uint &charlaelegida) {
- byte primeraconv, buscanodo, convselec;
+void showDialogLine(Common::String conversationMatrix[16], uint &choosenTopic) {
+ byte firstChat, convselec;
- primeraconv = 1;
+ firstChat = 1;
convselec = 0;
g_engine->_mouseManager->hide();
drawMenu(5);
- euroText(6, 151, matrizconversa[1], 255);
- euroText(6, 162, matrizconversa[2], 255);
- euroText(6, 173, matrizconversa[3], 255);
- euroText(6, 184, matrizconversa[4], 255);
+ euroText(6, 151, conversationMatrix[1], 255);
+ euroText(6, 162, conversationMatrix[2], 255);
+ euroText(6, 173, conversationMatrix[3], 255);
+ euroText(6, 184, conversationMatrix[4], 255);
g_engine->_mouseManager->show();
Common::Event e;
do {
@@ -381,16 +380,16 @@ void showDialogLine(Common::String matrizconversa[16], uint &charlaelegida) {
}
}
- if (tocapintar) {
- if (currentRoomData->paletteAnimationFlag && saltospal >= 4) {
- saltospal = 0;
+ if (timeToDraw) {
+ if (currentRoomData->paletteAnimationFlag && palAnimStep >= 4) {
+ palAnimStep = 0;
if (isPaletteAnimEnabled > 6)
isPaletteAnimEnabled = 0;
else
isPaletteAnimEnabled += 1;
updatePalette(isPaletteAnimEnabled);
} else
- saltospal += 1;
+ palAnimStep += 1;
}
g_system->delayMillis(10);
g_engine->_screen->update();
@@ -402,37 +401,37 @@ void showDialogLine(Common::String matrizconversa[16], uint &charlaelegida) {
else {
if (mouseClickX >= 0 && mouseClickX <= 280) {
if (mouseClickY >= 143 && mouseClickY <= 155) {
- convselec = primeraconv;
+ convselec = firstChat;
} else if (mouseClickY >= 156 && mouseClickY <= 166) {
- convselec = primeraconv + 1;
+ convselec = firstChat + 1;
} else if (mouseClickY >= 167 && mouseClickY <= 177) {
- convselec = primeraconv + 2;
+ convselec = firstChat + 2;
} else if (mouseClickY >= 178 && mouseClickY <= 186) {
- convselec = primeraconv + 3;
+ convselec = firstChat + 3;
}
} else if (mouseClickX >= 281 && mouseClickX <= 319) {
if (mouseClickY >= 143 && mouseClickY <= 165) {
- if (primeraconv > 1) {
+ if (firstChat > 1) {
convselec = 0;
- primeraconv -= 1;
+ firstChat -= 1;
g_engine->_mouseManager->hide();
drawMenu(5);
- euroText(6, 151, matrizconversa[primeraconv], 255);
- euroText(6, 162, matrizconversa[primeraconv + 1], 255);
- euroText(6, 173, matrizconversa[primeraconv + 2], 255);
- euroText(6, 184, matrizconversa[primeraconv + 3], 255);
+ euroText(6, 151, conversationMatrix[firstChat], 255);
+ euroText(6, 162, conversationMatrix[firstChat + 1], 255);
+ euroText(6, 173, conversationMatrix[firstChat + 2], 255);
+ euroText(6, 184, conversationMatrix[firstChat + 3], 255);
g_engine->_mouseManager->show();
}
} else if (mouseClickY >= 167 && mouseClickY <= 186) {
- if (primeraconv < 12) {
+ if (firstChat < 12) {
convselec = 0;
- primeraconv += 1;
+ firstChat += 1;
g_engine->_mouseManager->hide();
drawMenu(5);
- euroText(6, 151, matrizconversa[primeraconv], 255);
- euroText(6, 162, matrizconversa[primeraconv + 1], 255);
- euroText(6, 173, matrizconversa[primeraconv + 2], 255);
- euroText(6, 184, matrizconversa[primeraconv + 3], 255);
+ euroText(6, 151, conversationMatrix[firstChat], 255);
+ euroText(6, 162, conversationMatrix[firstChat + 1], 255);
+ euroText(6, 173, conversationMatrix[firstChat + 2], 255);
+ euroText(6, 184, conversationMatrix[firstChat + 3], 255);
g_engine->_mouseManager->show();
}
}
@@ -444,94 +443,94 @@ void showDialogLine(Common::String matrizconversa[16], uint &charlaelegida) {
if (convselec == conversationIndex)
endOfConversation = true;
- for (buscanodo = 1; buscanodo <= (convselec - 1); buscanodo++)
- l1 = l1->siguiente;
- charlaelegida = l1->elemento;
+ for (int i = 1; i <= (convselec - 1); i++)
+ l1 = l1->next;
+ choosenTopic = l1->item;
}
-void talk(byte person) {
- debug("Talking to persona: %d", person);
- uint pasorespuesta, nuevonodo;
- TextEntry pasoh;
- byte auxilcadena, insertarnombre, indicemochila;
+void talk(byte characterIndex) {
+ debug("Talking to person: %d", characterIndex);
+ uint response, newNode;
+ TextEntry text;
+ byte stringAux, insertName, invIndex;
- Common::String matrizconversa[16];
+ Common::String conversationMatrix[16];
drawTalkMenu();
endOfConversation = false;
assignText();
// The original game makes a copy of the file upon starting a new game. .007 is the current game (the game
// that resumes when clicking "continue game" in the main menu. Part of the savegame data is this 007
// conversation file which marks conversatino topics as already gone through or not.
- readTree(*conversationData, ar, person - 1);
+ readTree(*conversationData, ar, characterIndex - 1);
loadTalkAnimations();
do {
for (int i = 0; i < 16; i++) {
- matrizconversa[i] = "";
+ conversationMatrix[i] = "";
}
- findDialogLine(person);
+ findDialogLine(characterIndex);
conversationIndex = 0;
l1 = l;
do {
- verb.seek(verbRegSize * l1->elemento);
+ verb.seek(verbRegSize * l1->item);
conversationIndex += 1;
- pasoh = readVerbRegister();
- insertarnombre = 0;
- matrizconversa[conversationIndex] = decrypt(pasoh.text);
+ text = readVerbRegister();
+ insertName = 0;
+ conversationMatrix[conversationIndex] = decrypt(text.text);
- for (int i = 0; i < matrizconversa[conversationIndex].size(); i++) {
- if (matrizconversa[conversationIndex][i] == '@')
- insertarnombre = i;
+ for (int i = 0; i < conversationMatrix[conversationIndex].size(); i++) {
+ if (conversationMatrix[conversationIndex][i] == '@')
+ insertName = i;
}
- if (insertarnombre > 0) {
- matrizconversa[conversationIndex].deleteChar(insertarnombre);
- matrizconversa[conversationIndex].insertString(characterName, insertarnombre);
+ if (insertName > 0) {
+ conversationMatrix[conversationIndex].deleteChar(insertName);
+ conversationMatrix[conversationIndex].insertString(characterName, insertName);
}
- if (matrizconversa[conversationIndex].size() > 45) {
- auxilcadena = 45;
+ if (conversationMatrix[conversationIndex].size() > 45) {
+ stringAux = 45;
do {
- auxilcadena -= 1;
- } while (matrizconversa[conversationIndex][auxilcadena] != ' ');
- matrizconversa[conversationIndex] = matrizconversa[conversationIndex].substr(0, auxilcadena);
- matrizconversa[conversationIndex].insertString(" ...", auxilcadena);
+ stringAux -= 1;
+ } while (conversationMatrix[conversationIndex][stringAux] != ' ');
+ conversationMatrix[conversationIndex] = conversationMatrix[conversationIndex].substr(0, stringAux);
+ conversationMatrix[conversationIndex].insertString(" ...", stringAux);
}
- l1 = l1->siguiente;
- } while ((l1->siguiente != NULL) && (l1 != NULL) && !g_engine->shouldQuit());
+ l1 = l1->next;
+ } while ((l1->next != NULL) && (l1 != NULL) && !g_engine->shouldQuit());
l1 = l;
- showDialogLine(matrizconversa, nuevonodo);
+ showDialogLine(conversationMatrix, newNode);
delete l;
- hypertext(nuevonodo, 255, 0, pasorespuesta, true);
- auxilcadena = 0;
- modifyTree(nuevonodo);
+ hypertext(newNode, 255, 0, response, true);
+ stringAux = 0;
+ modifyTree(newNode);
// verifyCopyProtection();
- while (pasorespuesta > 0 && !g_engine->shouldQuit()) {
- nuevonodo = pasorespuesta;
- auxilcadena += 1;
- if (odd(auxilcadena))
- hypertext(nuevonodo, 253, 249, pasorespuesta, true);
+ while (response > 0 && !g_engine->shouldQuit()) {
+ newNode = response;
+ stringAux += 1;
+ if (odd(stringAux))
+ hypertext(newNode, 253, 249, response, true);
else
- hypertext(nuevonodo, 255, 0, pasorespuesta, true);
- switch (nuevonodo) {
+ hypertext(newNode, 255, 0, response, true);
+ switch (newNode) {
case 9: {
obtainedList1 = true;
- indicemochila = 0;
- while (mobj[indicemochila].code != 0) {
- indicemochila += 1;
+ invIndex = 0;
+ while (mobj[invIndex].code != 0) {
+ invIndex += 1;
}
- mobj[indicemochila].bitmapIndex = list1Index;
- mobj[indicemochila].code = list1code;
- mobj[indicemochila].objectName = getObjectName(0);
+ mobj[invIndex].bitmapIndex = list1Index;
+ mobj[invIndex].code = list1code;
+ mobj[invIndex].objectName = getObjectName(0);
} break;
case 25: {
obtainedList2 = true;
- indicemochila = 0;
- while (mobj[indicemochila].code != 0) {
- indicemochila += 1;
+ invIndex = 0;
+ while (mobj[invIndex].code != 0) {
+ invIndex += 1;
}
- mobj[indicemochila].bitmapIndex = list2Index;
- mobj[indicemochila].code = list2code;
- mobj[indicemochila].objectName = getObjectName(1);
+ mobj[invIndex].bitmapIndex = list2Index;
+ mobj[invIndex].code = list2code;
+ mobj[invIndex].objectName = getObjectName(1);
} break;
}
}
@@ -541,7 +540,7 @@ void talk(byte person) {
unloadTalkAnimations();
step = ar;
fixTree(step);
- saveConversations(conversationData, ar, person - 1);
+ saveConversations(conversationData, ar, characterIndex - 1);
verb.close();
if (g_engine->shouldQuit()) {
@@ -557,37 +556,36 @@ void talk(byte person) {
drawBackpack();
g_engine->_mouseManager->show();
- // release(marca);
- if (person < 5) {
- if (firstTimeTopicA[person - 1])
- firstTimeTopicA[person - 1] = false;
- if (firstTimeTopicB[person - 1])
- firstTimeTopicB[person - 1] = false;
- if (firstTimeTopicC[person - 1])
- firstTimeTopicC[person - 1] = false;
- } else if (person == 8)
+ if (characterIndex < 5) {
+ if (firstTimeTopicA[characterIndex - 1])
+ firstTimeTopicA[characterIndex - 1] = false;
+ if (firstTimeTopicB[characterIndex - 1])
+ firstTimeTopicB[characterIndex - 1] = false;
+ if (firstTimeTopicC[characterIndex - 1])
+ firstTimeTopicC[characterIndex - 1] = false;
+ } else if (characterIndex == 8)
firstTimeTopicA[8] = false;
}
-void talkScreenObject() {
- int x_del_raton = (mouseClickX + 7) / xGridCount;
- int y_del_raton = (mouseClickY + 7) / yGridCount;
- uint objeto_de_la_pantalla = currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[x_del_raton][y_del_raton]]->fileIndex;
- if (objeto_de_la_pantalla == 0)
+void talkToSceneObject() {
+ int mouseX = (mouseClickX + 7) / xGridCount;
+ int mouseY = (mouseClickY + 7) / yGridCount;
+ uint sceneObject = currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[mouseX][mouseY]]->fileIndex;
+ if (sceneObject == 0)
return;
// verifyCopyProtection2();
- readItemRegister(objeto_de_la_pantalla);
+ readItemRegister(sceneObject);
goToObject(currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount],
- currentRoomData->walkAreasGrid[x_del_raton][y_del_raton]);
+ currentRoomData->walkAreasGrid[mouseX][mouseY]);
- if (regobj.habla > 0) {
- talk(regobj.habla);
+ if (regobj.speaking > 0) {
+ talk(regobj.speaking);
} else {
assignText();
hypertext((Random(10) + 1039), 255, 0, foo, false);
verb.close();
- if (contadorpc > 198)
+ if (cpCounter > 198)
showError(274);
}
}
diff --git a/engines/tot/dialog.h b/engines/tot/dialog.h
index a7bc24a389d..9101bee074c 100644
--- a/engines/tot/dialog.h
+++ b/engines/tot/dialog.h
@@ -28,19 +28,19 @@
namespace Tot {
-typedef struct lista *plista;
+typedef struct list *listP;
-struct lista {
- uint elemento;
- plista siguiente;
+struct list {
+ uint item;
+ listP next;
};
extern byte conversationIndex;
-extern plista l1, l;
+extern listP l1, l;
extern Tree ar, auxTree, step;
extern bool endOfConversation;
-void talkScreenObject();
+void talkToSceneObject();
} // End of namespace Tot
diff --git a/engines/tot/forest.cpp b/engines/tot/forest.cpp
index f78ee2583af..61652b0f3c9 100644
--- a/engines/tot/forest.cpp
+++ b/engines/tot/forest.cpp
@@ -26,88 +26,82 @@
namespace Tot {
-void initTree(Tree &a, nodeElement dato) {
+void initTree(Tree &a, nodeElement data) {
a = new treeDef;
- a->element = dato;
+ a->element = data;
a->parent = NULL;
a->sibling = NULL;
a->child = NULL;
}
-bool root(Tree nodo) {
- bool raiz_result;
- if (nodo->parent == NULL)
- raiz_result = true;
+bool isRoot(Tree node) {
+ bool root;
+ if (node->parent == NULL)
+ root = true;
else
- raiz_result = false;
- return raiz_result;
+ root = false;
+ return root;
}
-Tree rightSibling(Tree nodo) {
- Tree hermanoder_result;
- hermanoder_result = nodo->sibling;
- return hermanoder_result;
+Tree rightSibling(Tree node) {
+ Tree rightSibling;
+ rightSibling = node->sibling;
+ return rightSibling;
}
-Tree parent(Tree nodo) {
- Tree padre_result;
- padre_result = nodo->parent;
- return padre_result;
+Tree parent(Tree node) {
+ Tree parent;
+ parent = node->parent;
+ return parent;
}
-Tree leftChild(Tree nodo) {
- Tree hijoizq_result;
- hijoizq_result = nodo->child;
- return hijoizq_result;
+Tree leftChild(Tree node) {
+ Tree leftChild;
+ leftChild = node->child;
+ return leftChild;
}
-int depth(Tree nodo) {
- Tree auxiliar;
- int contador;
-
- int profundidad_result;
- contador = 0;
- auxiliar = nodo;
- while (auxiliar->parent != NULL) {
- contador += 1;
- auxiliar = parent(auxiliar);
+int depth(Tree node) {
+ Tree aux;
+ int depthCount = 0;
+ aux = node;
+ while (aux->parent != NULL) {
+ depthCount += 1;
+ aux = parent(aux);
}
- profundidad_result = contador;
- return profundidad_result;
+ return depthCount;
}
-void expandNode(Tree &nodo, nodeElement dato) {
- Tree auxiliar;
-
- auxiliar = nodo;
- if (auxiliar->child != NULL) {
+void expandNode(Tree &node, nodeElement data) {
+ Tree aux = node;
+ if (aux->child != NULL) {
- auxiliar = leftChild(auxiliar);
- while (auxiliar->sibling != NULL)
- auxiliar = rightSibling(auxiliar);
+ aux = leftChild(aux);
+ while (aux->sibling != NULL)
+ aux = rightSibling(aux);
;
- auxiliar->sibling = new treeDef;
- auxiliar = auxiliar->sibling;
- auxiliar->element = dato;
- auxiliar->sibling = NULL;
- auxiliar->child = NULL;
- auxiliar->parent = nodo;
+ aux->sibling = new treeDef;
+ aux = aux->sibling;
+ aux->element = data;
+ aux->sibling = NULL;
+ aux->child = NULL;
+ aux->parent = node;
} else {
- auxiliar->child = new treeDef;
- auxiliar = auxiliar->child;
- auxiliar->element = dato;
- auxiliar->sibling = NULL;
- auxiliar->child = NULL;
- auxiliar->parent = nodo;
+ aux->child = new treeDef;
+ aux = aux->child;
+ aux->element = data;
+ aux->sibling = NULL;
+ aux->child = NULL;
+ aux->parent = node;
}
}
-void preOrder(Tree a, Common::String &cadena) {
+void preOrder(Tree a, Common::String &encodedString) {
if (a != NULL) {
- cadena = Common::String::format("%s%d%cN%d@", cadena.c_str(), a->element.index, a->element.dicho, depth(a));
- preOrder(leftChild(a), cadena);
- preOrder(rightSibling(a), cadena);
+ encodedString = Common::String::format("%s%d%cN%d@", encodedString.c_str(), a->element.index, a->element.spoken, depth(a));
+ preOrder(leftChild(a), encodedString);
+ preOrder(rightSibling(a), encodedString);
}
}
@@ -129,89 +123,78 @@ void saveExpression(Common::SeekableWriteStream *s, Common::String expression) {
const int chatRegSize = 256;
-void saveConversations(Common::SeekableWriteStream *s, Tree a, uint sitio) {
-
+void saveConversations(Common::SeekableWriteStream *s, Tree a, uint offset) {
Common::String expression = "";
preOrder(a, expression);
- debug("Pos-Expression=%s", expression.c_str());
- debug("saving in position = %d", sitio);
- s->seek(sitio * chatRegSize, SEEK_SET);
+ s->seek(offset * chatRegSize, SEEK_SET);
saveExpression(s, expression);
}
-void readTree(Common::SeekableReadStream &stream, Tree &a, uint lugar) {
-
- const nodeElement vacio = {'0', 0};
- nodeElement dato;
-
- Common::String strInd, exppaso;
- Tree arbolaux;
- byte posicion,
-
- nivel,
- nivelact;
+void readTree(Common::SeekableReadStream &stream, Tree &a, uint position) {
- Common::String nivelstr;
+ const nodeElement empty = {'0', 0};
+ nodeElement data;
- stream.seek(chatRegSize * lugar);
+ Common::String strInd, tmpExpression;
+ byte level;
+ Common::String levelAsString;
- Common::String expresion;
- expresion = stream.readPascalString();
- debug("Pre-Expression=%s", expresion.c_str());
+ stream.seek(chatRegSize * position);
- initTree(a, vacio);
- arbolaux = a;
- posicion = 0;
- nivelact = 0;
+ Common::String expresion = stream.readPascalString();
+ initTree(a, empty);
+ Tree aux = a;
+ byte pos = 0;
+ byte currentLevel = 0;
do {
- exppaso = "";
+ tmpExpression = "";
do {
- exppaso = exppaso + expresion[posicion];
- } while (expresion[posicion++] != '@');
- dato.dicho = '0';
- dato.index = 0;
-
- int nIndex = exppaso.find('N');
- strInd = exppaso.substr(0, nIndex - 1);
-
- dato.dicho = exppaso[nIndex - 1];
- dato.index = atoi(strInd.c_str());
-
- nivelstr = "";
- nivelstr = exppaso.substr(nIndex + 1, exppaso.size() - nIndex - 2);
- nivel = atoi(nivelstr.c_str());
-
- if (nivel == 0)
- arbolaux->element = dato;
- else if (nivel == (nivelact + 1))
- expandNode(arbolaux, dato);
- else if (nivel > (nivelact + 1)) {
- arbolaux = leftChild(arbolaux);
- nivelact += 1;
- while (rightSibling(arbolaux) != NULL)
- arbolaux = rightSibling(arbolaux);
- expandNode(arbolaux, dato);
+ tmpExpression = tmpExpression + expresion[pos];
+ } while (expresion[pos++] != '@');
+ data.spoken = '0';
+ data.index = 0;
+
+ int nIndex = tmpExpression.find('N');
+ strInd = tmpExpression.substr(0, nIndex - 1);
+
+ data.spoken = tmpExpression[nIndex - 1];
+ data.index = atoi(strInd.c_str());
+
+ levelAsString = "";
+ levelAsString = tmpExpression.substr(nIndex + 1, tmpExpression.size() - nIndex - 2);
+ level = atoi(levelAsString.c_str());
+
+ if (level == 0)
+ aux->element = data;
+ else if (level == (currentLevel + 1))
+ expandNode(aux, data);
+ else if (level > (currentLevel + 1)) {
+ aux = leftChild(aux);
+ currentLevel += 1;
+ while (rightSibling(aux) != NULL)
+ aux = rightSibling(aux);
+ expandNode(aux, data);
} else {
do {
- nivelact -= 1;
- arbolaux = parent(arbolaux);
- } while (!(nivelact < nivel));
- expandNode(arbolaux, dato);
+ currentLevel -= 1;
+ aux = parent(aux);
+ } while (!(currentLevel < level));
+ expandNode(aux, data);
}
- } while (posicion != expresion.size());
+ } while (pos != expresion.size());
}
-void readTree(Common::String f, Tree &a, uint lugar) {
+void readTree(Common::String f, Tree &a, uint offset) {
- Common::File fichero;
+ Common::File treeFile;
debug("Filename = %s", f.c_str());
- if (!fichero.open(Common::Path(f))) {
+ if (!treeFile.open(Common::Path(f))) {
showError(314);
}
- readTree(fichero, a, lugar);
- fichero.close();
+ readTree(treeFile, a, offset);
+ treeFile.close();
}
} // End of namespace Tot
diff --git a/engines/tot/forest.h b/engines/tot/forest.h
index 91b652e9614..63cabff92fe 100644
--- a/engines/tot/forest.h
+++ b/engines/tot/forest.h
@@ -30,7 +30,7 @@
namespace Tot {
struct nodeElement {
- char dicho;
+ char spoken;
uint index;
};
@@ -43,7 +43,7 @@ struct treeDef {
void initTree(Tree& a, nodeElement data);
-bool root(Tree node);
+bool isRoot(Tree node);
Tree rightSibling(Tree node);
diff --git a/engines/tot/game.cpp b/engines/tot/game.cpp
index 79d9ab956a3..12a5141ab3e 100644
--- a/engines/tot/game.cpp
+++ b/engines/tot/game.cpp
@@ -24,7 +24,7 @@
#include "tot/dialog.h"
#include "tot/graphics.h"
-#include "tot/playanim.h"
+#include "tot/mouse.h"
#include "tot/routines.h"
#include "tot/routines2.h"
#include "tot/texts.h"
@@ -47,7 +47,7 @@ void newGame() {
if (!g_engine->shouldQuit()) {
totalFadeOut(0);
g_engine->_graphics->clear();
- processingActive();
+ displayLoading();
freeInventory();
loadObjects();
resetGameState();
@@ -78,7 +78,7 @@ int engine_start() {
return startGame();
}
g_engine->_graphics->clear();
- processingActive();
+ displayLoading();
loadCharAnimation();
loadObjects();
@@ -123,7 +123,7 @@ int startGame() {
g_engine->_sound->playMidi("SEGUNDA", true);
break;
}
- contadorpc2 = contadorpc;
+ cpCounter2 = cpCounter;
g_engine->_sound->fadeInMusic(musicVolLeft, musicVolRight);
inGame = true;
@@ -202,7 +202,7 @@ int startGame() {
if (mouseClickY > 0 && mouseClickY < 131) {
switch (actionCode) {
case 0: // go to
- contadorpc2 = contadorpc;
+ cpCounter2 = cpCounter;
// gets the zone where the character is now standing. Zone is calculated using xframe,yframe plus some adjustments to get the center of the feet
currentZone = currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount];
if (currentZone < 10) {
@@ -255,14 +255,14 @@ int startGame() {
case 1: // talk
roomChange = false;
actionCode = 0;
- talkScreenObject();
- contadorpc2 = contadorpc;
+ talkToSceneObject();
+ cpCounter2 = cpCounter;
break;
case 2: // pick up
roomChange = false;
actionCode = 0;
pickupScreenObject();
- contadorpc = contadorpc2;
+ cpCounter = cpCounter2;
break;
case 3: // look at
roomChange = false;
@@ -299,7 +299,7 @@ int startGame() {
roomChange = false;
actionCode = 0;
useScreenObject();
- contadorpc = contadorpc2;
+ cpCounter = cpCounter2;
break;
case 5: // open
roomChange = false;
@@ -310,7 +310,7 @@ int startGame() {
roomChange = false;
actionCode = 0;
closeScreenObject();
- contadorpc = contadorpc2;
+ cpCounter = cpCounter2;
} break;
}
} else if (mouseClickY > 148 && mouseClickY < 158) {
@@ -341,7 +341,7 @@ int startGame() {
} else {
actionCode = 0;
action();
- contadorpc2 = contadorpc;
+ cpCounter2 = cpCounter;
}
} else if (mouseClickY > 166 && mouseClickY < 199) {
if (mouseClickX >= 3 && mouseClickX <= 19) {
@@ -378,7 +378,7 @@ int startGame() {
mouseClickY = e.mouse.y;
destinationStepX = (mouseClickX + 7) / xGridCount;
destinationStepY = (mouseClickY + 7) / yGridCount;
- contadorpc2 = contadorpc;
+ cpCounter2 = cpCounter;
if (destinationStepY < 28) {
RoomObjectListEntry obj = *currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[destinationStepX][destinationStepY]];
if (obj.fileIndex > 0) {
@@ -422,7 +422,7 @@ int startGame() {
if (escapePressed && xframe2 == 0) {
freeAnimation();
freeScreenObjects();
- contadorpc2 = contadorpc;
+ cpCounter2 = cpCounter;
startNewGame = false;
continueGame = false;
g_engine->saveAutosaveIfEnabled();
@@ -441,7 +441,7 @@ int startGame() {
else {
isSavingDisabled = true;
g_engine->openMainMenuDialog();
- contadorpc = contadorpc2;
+ cpCounter = cpCounter2;
isSavingDisabled = false;
}
g_engine->_sound->fadeOutMusic(musicVolLeft, musicVolRight);
@@ -461,7 +461,7 @@ int startGame() {
if (list1Complete && list2Complete) {
list1Complete = false;
list2Complete = false;
- contadorpc = contadorpc2;
+ cpCounter = cpCounter2;
gamePart = 2;
iframe = 0;
freeInventory();
@@ -472,7 +472,7 @@ int startGame() {
g_engine->_sound->fadeOutMusic(musicVolLeft, musicVolRight);
g_engine->_sound->playMidi("CREDITOS", true);
g_engine->_sound->fadeInMusic(musicVolLeft, musicVolRight);
- if (contadorpc2 > 43)
+ if (cpCounter2 > 43)
showError(274);
sacrificeScene();
g_engine->_graphics->clear();
@@ -518,11 +518,11 @@ int startGame() {
if (g_engine->_drawObjectAreas) {
for (int i = 0; i < depthLevelCount; i++) {
- if (screenObjects[i] != NULL) {
+ if (screenLayers[i] != NULL) {
if (true) {
// debug
- uint16 w = READ_LE_UINT16(screenObjects[i]);
- uint16 h = READ_LE_UINT16(screenObjects[i] + 2);
+ uint16 w = READ_LE_UINT16(screenLayers[i]);
+ uint16 h = READ_LE_UINT16(screenLayers[i] + 2);
Common::Rect r = Common::Rect(depthMap[i].posx, depthMap[i].posy, depthMap[i].posx + w, depthMap[i].posy + h);
drawRect(180, depthMap[i].posx, depthMap[i].posy, depthMap[i].posx + w, depthMap[i].posy + h);
@@ -556,7 +556,7 @@ int startGame() {
void sceneChange() {
roomChange = false;
- contadorpc = contadorpc2;
+ cpCounter = cpCounter2;
setRoomTrajectories(secondaryAnimHeight, secondaryAnimWidth, RESTORE);
saveRoomData(currentRoomData, rooms);
// verifyCopyProtection();
@@ -578,15 +578,15 @@ void sceneChange() {
screenTransition(transitionEffect, true, NULL);
g_engine->_sound->stopVoc();
loadScreenData(currentRoomData->doors[doorIndex].nextScene);
- if (contadorpc > 89)
+ if (cpCounter > 89)
showError(274);
g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
if (isTVOn)
g_engine->_sound->autoPlayVoc("PARASITO", 355778, 20129);
else
- cargatele();
+ loadTV();
screenTransition(transitionEffect, false, sceneBackground);
- contadorpc = contadorpc2;
+ cpCounter = cpCounter2;
g_engine->_mouseManager->show();
oldGridX = 0;
oldGridY = 0;
@@ -773,11 +773,11 @@ void sceneChange() {
loadScreenData(currentRoomData->doors[doorIndex].nextScene);
if (bookTopic[0] == true && currentRoomData->animationFlag == true)
disableSecondAnimation();
- if (contadorpc > 89)
+ if (cpCounter > 89)
showError(274);
g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
screenTransition(transitionEffect, false, sceneBackground);
- contadorpc = contadorpc2;
+ cpCounter = cpCounter2;
g_engine->_mouseManager->show();
oldGridX = 0;
oldGridY = 0;
@@ -877,13 +877,13 @@ void sceneChange() {
currentRoomData->screenObjectIndex[9]->objectName = getObjectName(7);
break;
}
- if (contadorpc > 89)
+ if (cpCounter > 89)
showError(274);
g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
if (currentRoomData->code == 4)
g_engine->_sound->loadVoc("GOTA", 140972, 1029);
screenTransition(transitionEffect, false, sceneBackground);
- contadorpc = contadorpc2;
+ cpCounter = cpCounter2;
g_engine->_mouseManager->show();
oldGridX = 0;
oldGridY = 0;
@@ -920,7 +920,7 @@ void sceneChange() {
currentRoomData->screenObjectIndex[8]->objectName = getObjectName(9);
break;
}
- if (contadorpc > 89)
+ if (cpCounter > 89)
showError(274);
g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
if (isTrapSet) {
@@ -948,7 +948,7 @@ void sceneChange() {
screenTransition(transitionEffect, false, sceneBackground);
if ((isRedDevilCaptured == false) && (isTrapSet == false))
runaroundRed();
- contadorpc = contadorpc2;
+ cpCounter = cpCounter2;
g_engine->_mouseManager->show();
oldGridX = 0;
oldGridY = 0;
@@ -971,7 +971,7 @@ void sceneChange() {
screenTransition(transitionEffect, true, NULL);
g_engine->_sound->stopVoc();
loadScreenData(currentRoomData->doors[doorIndex].nextScene);
- if (contadorpc > 89)
+ if (cpCounter > 89)
showError(274);
g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
switch (currentRoomData->code) {
@@ -983,7 +983,7 @@ void sceneChange() {
break;
}
screenTransition(transitionEffect, false, sceneBackground);
- contadorpc = contadorpc2;
+ cpCounter = cpCounter2;
g_engine->_mouseManager->show();
oldGridX = 0;
oldGridY = 0;
diff --git a/engines/tot/graphics.cpp b/engines/tot/graphics.cpp
index ed7581a33e3..f8f6b740df2 100644
--- a/engines/tot/graphics.cpp
+++ b/engines/tot/graphics.cpp
@@ -88,8 +88,8 @@ void screenTransition(byte effectNumber, bool fadeToBlack, byte *scene) {
drawScreen(scene);
}
} else {
- contadorpc2 = contadorpc;
- if (contadorpc > 145)
+ cpCounter2 = cpCounter;
+ if (cpCounter > 145)
showError(274);
debug("Effect %d, pasaraanegro=%d", effectNumber, fadeToBlack);
if (fadeToBlack)
diff --git a/engines/tot/graphics.h b/engines/tot/graphics.h
index 11111b1dbf1..ee825122d55 100644
--- a/engines/tot/graphics.h
+++ b/engines/tot/graphics.h
@@ -21,8 +21,8 @@
#ifndef TOT_GRAPHICS_H
#define TOT_GRAPHICS_H
-#include "playanim.h"
-#include "util.h"
+#include "engines/tot/vars.h"
+#include "engines/tot/util.h"
namespace Tot {
diff --git a/engines/tot/module.mk b/engines/tot/module.mk
index 22176c90f8e..ba837d31769 100644
--- a/engines/tot/module.mk
+++ b/engines/tot/module.mk
@@ -6,7 +6,7 @@ MODULE_OBJS = \
metaengine.o \
forest.o \
util.o \
- playanim.o \
+ vars.o \
graphics.o \
anims.o \
routines2.o \
@@ -16,9 +16,9 @@ MODULE_OBJS = \
font/bgifont.o \
font/biosfont.o \
decoder/TotFlicDecoder.o \
- soundman.o \
+ sound.o \
graphman.o \
- mouseman.o \
+ mouse.o \
chrono.o \
saveload.o \
midi.o
diff --git a/engines/tot/mouseman.cpp b/engines/tot/mouse.cpp
similarity index 97%
rename from engines/tot/mouseman.cpp
rename to engines/tot/mouse.cpp
index 43d663dc4fa..bb10fc72610 100644
--- a/engines/tot/mouseman.cpp
+++ b/engines/tot/mouse.cpp
@@ -1,4 +1,3 @@
-#include "mouseman.h"
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
@@ -24,7 +23,7 @@
#include "common/system.h"
#include "graphics/cursorman.h"
-#include "tot/mouseman.h"
+#include "tot/mouse.h"
#include "tot/tot.h"
#include "tot/util.h"
@@ -43,7 +42,7 @@ void MouseManager::drawMask(int idx) {
}
void MouseManager::animateMouseIfNeeded() {
- if (tocapintar) {
+ if (timeToDraw) {
setMouseMask(_currentMouseMask);
if (_currentMouseMask < 7) {
// sync this with frame time
diff --git a/engines/tot/mouseman.h b/engines/tot/mouse.h
similarity index 97%
rename from engines/tot/mouseman.h
rename to engines/tot/mouse.h
index a7a4069d5e4..73fcf348c52 100644
--- a/engines/tot/mouseman.h
+++ b/engines/tot/mouse.h
@@ -18,8 +18,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-#ifndef TOT_MOUSEMAN_H
-#define TOT_MOUSEMAN_H
+#ifndef TOT_MOUSE_H
+#define TOT_MOUSE_H
#include "common/rect.h"
#include "common/scummsys.h"
diff --git a/engines/tot/routines.cpp b/engines/tot/routines.cpp
index 469e073dfd8..fd313602587 100644
--- a/engines/tot/routines.cpp
+++ b/engines/tot/routines.cpp
@@ -22,22 +22,21 @@
#include "common/debug.h"
#include "common/endian.h"
-#include "engines/tot/offsets.h"
-#include "engines/tot/routines.h"
-#include "engines/tot/texts.h"
-#include "engines/tot/tot.h"
+#include "tot/offsets.h"
+#include "tot/routines.h"
+#include "tot/texts.h"
+#include "tot/tot.h"
namespace Tot {
-void drawText(uint numero) {
+void drawText(uint number) {
assignText();
- hypertext(numero, 255, 0, foo, false);
+ hypertext(number, 255, 0, foo, false);
verb.close();
}
-
-void processingActive() {
- const char *msg = (g_engine->_lang == Common::ES_ESP) ? fullScreenMessages[0][58] : fullScreenMessages[0][58];
+void displayLoading() {
+ const char *msg = (g_engine->_lang == Common::ES_ESP) ? fullScreenMessages[0][58] : fullScreenMessages[1][58];
setRGBPalette(255, 63, 63, 63);
littText(121, 72, msg, 0);
@@ -61,7 +60,7 @@ void processingActive() {
void runaroundRed() {
- const uint trayseg[91][2] = {
+ const uint trajectory[91][2] = {
{204, 47}, {204, 49}, {203, 51}, {203, 53}, {201, 55}, {199, 57}, {197, 59}, {195, 61},
{193, 63}, {192, 65}, {192, 67}, {192, 69}, {192, 71}, {192, 73}, {191, 75}, {191, 77},
{191, 79}, {191, 81}, {191, 83}, {191, 85}, {191, 87}, {192, 89}, {192, 91}, {192, 93},
@@ -76,33 +75,32 @@ void runaroundRed() {
{282, 52}, {282, 52}, {282, 52}
};
- uint itrayseg, longtrayseg;
bool exitLoop = false;
loadDevil();
- itrayseg = 0;
- longtrayseg = 82;
+ uint secTrajIndex = 0;
+ uint secTrajLength = 82;
iframe2 = 0;
isSecondaryAnimationEnabled = true;
do {
g_engine->_chrono->updateChrono();
- if (tocapintar) {
- if (itrayseg == longtrayseg)
+ if (timeToDraw) {
+ if (secTrajIndex == secTrajLength)
exitLoop = true;
- itrayseg += 1;
+ secTrajIndex += 1;
if (iframe2 >= secondaryAnimationFrameCount - 1)
iframe2 = 0;
else
iframe2++;
- secondaryAnimation.posx = trayseg[itrayseg][0] - 15;
- secondaryAnimation.posy = trayseg[itrayseg][1] - 42;
- if (itrayseg >= 0 && itrayseg <= 8) {
+ secondaryAnimation.posx = trajectory[secTrajIndex][0] - 15;
+ secondaryAnimation.posy = trajectory[secTrajIndex][1] - 42;
+ if (secTrajIndex >= 0 && secTrajIndex <= 8) {
secondaryAnimation.dir = 2;
secondaryAnimation.depth = 1;
- } else if (itrayseg >= 9 && itrayseg <= 33) {
+ } else if (secTrajIndex >= 9 && secTrajIndex <= 33) {
secondaryAnimation.dir = 2;
secondaryAnimation.depth = 14;
- } else if (itrayseg >= 34 && itrayseg <= 63) {
+ } else if (secTrajIndex >= 34 && secTrajIndex <= 63) {
secondaryAnimation.dir = 1;
secondaryAnimation.depth = 14;
} else {
@@ -110,18 +108,18 @@ void runaroundRed() {
secondaryAnimation.depth = 3;
}
- tocapintar2 = true;
+ timeToDraw2 = true;
sprites(false);
- tocapintar = false;
- if (saltospal >= 4) {
- saltospal = 0;
+ timeToDraw = false;
+ if (palAnimStep >= 4) {
+ palAnimStep = 0;
if (isPaletteAnimEnabled > 6)
isPaletteAnimEnabled = 0;
else
isPaletteAnimEnabled += 1;
updatePalette(isPaletteAnimEnabled);
} else
- saltospal += 1;
+ palAnimStep += 1;
g_engine->_screen->update();
}
} while (!exitLoop && !g_engine->shouldQuit());
@@ -131,7 +129,7 @@ void runaroundRed() {
drawScreen(sceneBackground);
}
-void updateMovementCells() {
+void updateMovementGrids() {
uint j1arm, j2arm;
byte i1arm, i2arm;
@@ -163,37 +161,36 @@ void updateMovementCells() {
}
}
-void sprites(bool pintapersonaje);
+void sprites(bool drawCharacter);
-static uint indice;
+static uint curDepth;
/**
- * Calculated using the position of the character
+ * Point of origin of the area surrounding the main character.
+ * Calculated using the position of the character.
*/
-static uint posfondox,
- posfondoy;
+static uint dirtyMainSpriteX, dirtyMainSpriteY;
/**
+ * End point of origin of the area surrounding the main character.
* Calculated using the position of the character + dimension
*/
-static uint posfondox2, posfondoy2;
+static uint dirtyMainSpriteX2, dirtyMainSpriteY2;
static void assembleBackground() {
uint posabs;
- // XMStoPointer(ptr(segfondo, (offfondo + 4)), handpantalla, 4, (sizepantalla - longint(4)));
- // copies the entire clean background in handpantalla back into fondo
+ // copies the entire clean background in backgroundCopy back into background
restoreBackground();
- posabs = 4 + posfondoy * 320 + posfondox;
- // debug("posabs = %d, posfondox = %d, posfondoy=%d", posabs, posfondox, posfondoy);
+ posabs = 4 + dirtyMainSpriteY * 320 + dirtyMainSpriteX;
uint16 w, h;
w = READ_LE_UINT16(characterDirtyRect);
h = READ_LE_UINT16(characterDirtyRect + 2);
w++;
h++;
- posfondox2 = posfondox + w;
- posfondoy2 = posfondoy + h;
+ dirtyMainSpriteX2 = dirtyMainSpriteX + w;
+ dirtyMainSpriteY2 = dirtyMainSpriteY + h;
for (int j = 0; j < h; j++) {
for (int i = 0; i < w; i++) {
@@ -208,61 +205,61 @@ static void assembleBackground() {
* calculates the overlapping area between the source image and the background,
* then "blits" (copies) the pixels from the image to the overlapping area of the background, respecting transparency.
*/
-static void assembleImage(byte *imagen, uint posimagenx, uint posimageny) { // Near;
+static void assembleImage(byte *img, uint imgPosX, uint imgPosY) {
uint x, // starting point of the overlap
y;
uint incx, // width and height of the overlapping area
incy;
- uint16 wImg = READ_LE_UINT16(imagen) + 1;
- uint16 hImg = READ_LE_UINT16(imagen + 2) + 1;
+ uint16 wImg = READ_LE_UINT16(img) + 1;
+ uint16 hImg = READ_LE_UINT16(img + 2) + 1;
- uint16 wFondo = READ_LE_UINT16(characterDirtyRect) + 1;
- uint16 hFondo = READ_LE_UINT16(characterDirtyRect + 2) + 1;
+ uint16 wBg = READ_LE_UINT16(characterDirtyRect) + 1;
+ uint16 hBg = READ_LE_UINT16(characterDirtyRect + 2) + 1;
// This region calculates the overlapping area of (x, incx, y, incy)
{
- if (posimagenx < posfondox)
- x = posfondox;
+ if (imgPosX < dirtyMainSpriteX)
+ x = dirtyMainSpriteX;
else
- x = posimagenx;
+ x = imgPosX;
- if (posimagenx + wImg < posfondox + wFondo)
- incx = posimagenx + wImg - x;
+ if (imgPosX + wImg < dirtyMainSpriteX + wBg)
+ incx = imgPosX + wImg - x;
else
- incx = posfondox + wFondo - x;
+ incx = dirtyMainSpriteX + wBg - x;
- if (posimageny < posfondoy)
- y = posfondoy;
+ if (imgPosY < dirtyMainSpriteY)
+ y = dirtyMainSpriteY;
else
- y = posimageny;
+ y = imgPosY;
- if (posimageny + hImg < posfondoy + hFondo)
- incy = posimageny + hImg - y;
+ if (imgPosY + hImg < dirtyMainSpriteY + hBg)
+ incy = imgPosY + hImg - y;
else
- incy = posfondoy + hFondo - y;
+ incy = dirtyMainSpriteY + hBg - y;
} // end of region calculating overlapping area
for (int j = 0; j < incy; j++) {
for (int i = 0; i < incx; i++) {
- int orfondo = 4 + ((y - posfondoy) + j) * wFondo + i + (x - posfondox);
- int orimg = 4 + (y - posimageny + j) * wImg + i + (x - posimagenx);
- if (imagen[orimg] != 0) {
- characterDirtyRect[orfondo] = imagen[orimg];
+ int bgOffset = 4 + ((y - dirtyMainSpriteY) + j) * wBg + i + (x - dirtyMainSpriteX);
+ int imgOffset = 4 + (y - imgPosY + j) * wImg + i + (x - imgPosX);
+ if (img[imgOffset] != 0) {
+ characterDirtyRect[bgOffset] = img[imgOffset];
}
}
}
}
-static void overlayObject() {
- if (screenObjects[indice] != NULL) {
+static void overlayLayers() {
+ if (screenLayers[curDepth] != NULL) {
if (
- (depthMap[indice].posx <= posfondox2) &&
- (depthMap[indice].posx2 > posfondox) &&
- (depthMap[indice].posy < posfondoy2) &&
- (depthMap[indice].posy2 > posfondoy)) {
- assembleImage(screenObjects[indice], depthMap[indice].posx, depthMap[indice].posy);
+ (depthMap[curDepth].posx <= dirtyMainSpriteX2) &&
+ (depthMap[curDepth].posx2 > dirtyMainSpriteX) &&
+ (depthMap[curDepth].posy < dirtyMainSpriteY2) &&
+ (depthMap[curDepth].posy2 > dirtyMainSpriteY)) {
+ assembleImage(screenLayers[curDepth], depthMap[curDepth].posx, depthMap[curDepth].posy);
}
}
}
@@ -287,83 +284,74 @@ void drawMainCharacter() {
WRITE_LE_UINT16(characterDirtyRect + 2, tempH);
assembleBackground();
- indice = 0;
- while (indice != depthLevelCount) {
-
- overlayObject();
- if (mainCharAnimation.depth == indice)
+ curDepth = 0;
+ while (curDepth != depthLevelCount) {
+ overlayLayers();
+ if (mainCharAnimation.depth == curDepth)
assembleImage(curCharacterAnimationFrame, characterPosX, characterPosY);
- indice += 1;
+ curDepth += 1;
}
- g_engine->_graphics->putImg(posfondox, posfondoy, characterDirtyRect);
+ g_engine->_graphics->putImg(dirtyMainSpriteX, dirtyMainSpriteY, characterDirtyRect);
if (debug) {
// draw background dirty area
- drawRect(2, posfondox, posfondoy, posfondox + tempW, posfondoy + tempH);
-
- // drawRect(225, posfondox, posfondoy, posfondox2, posfondoy2);
-
- // uint16 wImg = READ_LE_UINT16(pasoframe);
- // uint16 hImg = READ_LE_UINT16(pasoframe + 2);
-
+ drawRect(2, dirtyMainSpriteX, dirtyMainSpriteY, dirtyMainSpriteX + tempW, dirtyMainSpriteY + tempH);
drawPos(xframe2, yframe2, 218);
- // draw patch of characters sprite
- // drawRect(223, xframe, yframe, xframe + wImg, yframe + hImg);
}
free(characterDirtyRect);
}
-void sprites(bool pintapersonaje) {
+void sprites(bool drawMainCharachter) {
// grabs the current frame from the walk cycle
- curCharacterAnimationFrame = mainCharAnimation.bitmap[characterFacingDir][iframe];
+ curCharacterAnimationFrame = mainCharAnimation.bitmap[charFacingDirection][iframe];
- posfondox = characterPosX - 3;
- posfondoy = characterPosY - 3;
+ dirtyMainSpriteX = characterPosX - 3;
+ dirtyMainSpriteY = characterPosY - 3;
if (isSecondaryAnimationEnabled) {
if (currentRoomData->secondaryTrajectoryLength > 1) {
- updateMovementCells();
+ updateMovementGrids();
}
- if (tocapintar2) {
+ if (timeToDraw2) {
if (isPeterCoughing && !g_engine->_sound->isVocPlaying()) {
iframe2 = 0;
}
curSecondaryAnimationFrame = secondaryAnimation.bitmap[secondaryAnimation.dir][iframe2];
}
- uint16 pasoframeW = READ_LE_UINT16(curCharacterAnimationFrame);
- uint16 pasoframeH = READ_LE_UINT16(curCharacterAnimationFrame + 2);
+ uint16 curCharFrameW = READ_LE_UINT16(curCharacterAnimationFrame);
+ uint16 curCharFrameH = READ_LE_UINT16(curCharacterAnimationFrame + 2);
- uint16 pasoanimadoW = READ_LE_UINT16(curSecondaryAnimationFrame);
- uint16 pasoanimadoH = READ_LE_UINT16(curSecondaryAnimationFrame + 2);
+ uint16 secAnimW = READ_LE_UINT16(curSecondaryAnimationFrame);
+ uint16 secAnimH = READ_LE_UINT16(curSecondaryAnimationFrame + 2);
if (
- ((secondaryAnimation.posx < (characterPosX + pasoframeW) + 4) &&
- ((secondaryAnimation.posx + pasoanimadoW + 1) > posfondox) &&
- (secondaryAnimation.posy < (characterPosY + pasoframeH + 4))) &&
- ((secondaryAnimation.posy + pasoanimadoH + 1) > posfondoy)) { // Character is in the area of the animation
+ ((secondaryAnimation.posx < (characterPosX + curCharFrameW) + 4) &&
+ ((secondaryAnimation.posx + secAnimW + 1) > dirtyMainSpriteX) &&
+ (secondaryAnimation.posy < (characterPosY + curCharFrameH + 4))) &&
+ ((secondaryAnimation.posy + secAnimH + 1) > dirtyMainSpriteY)) { // Character is in the area of the animation
if (secondaryAnimation.posx < characterPosX) {
- posfondox = secondaryAnimation.posx - 3;
+ dirtyMainSpriteX = secondaryAnimation.posx - 3;
}
if (secondaryAnimation.posy < characterPosY) {
- posfondoy = secondaryAnimation.posy - 3;
+ dirtyMainSpriteY = secondaryAnimation.posy - 3;
}
- uint16 patchW = pasoanimadoW + pasoframeW + 6;
+ uint16 patchW = secAnimW + curCharFrameW + 6;
uint16 patchH;
- if ((pasoframeH + characterPosY) > (secondaryAnimation.posy + pasoanimadoH)) {
- patchH = pasoframeH + 6 + abs(characterPosY - secondaryAnimation.posy);
+ if ((curCharFrameH + characterPosY) > (secondaryAnimation.posy + secAnimH)) {
+ patchH = curCharFrameH + 6 + abs(characterPosY - secondaryAnimation.posy);
} else {
- patchH = pasoanimadoH + 6 + abs(characterPosY - secondaryAnimation.posy);
+ patchH = secAnimH + 6 + abs(characterPosY - secondaryAnimation.posy);
}
- if (posfondoy + patchH > 140) {
- patchH -= (posfondoy + patchH) - 140 + 1;
+ if (dirtyMainSpriteY + patchH > 140) {
+ patchH -= (dirtyMainSpriteY + patchH) - 140 + 1;
}
- if (posfondox + patchW > 320) {
- patchW -= (posfondox + patchW) - 320 + 1;
+ if (dirtyMainSpriteX + patchW > 320) {
+ patchW -= (dirtyMainSpriteX + patchW) - 320 + 1;
}
characterDirtyRect = (byte *)malloc((patchW + 1) * (patchH + 1) + 4);
@@ -372,51 +360,51 @@ void sprites(bool pintapersonaje) {
WRITE_LE_UINT16(characterDirtyRect + 2, patchH);
assembleBackground(); // {Montar el Sprite Total}
- indice = 0;
- while (indice != depthLevelCount) {
- overlayObject();
- if (secondaryAnimation.depth == indice)
+ curDepth = 0;
+ while (curDepth != depthLevelCount) {
+ overlayLayers();
+ if (secondaryAnimation.depth == curDepth)
assembleImage(curSecondaryAnimationFrame, secondaryAnimation.posx, secondaryAnimation.posy);
- if (mainCharAnimation.depth == indice)
+ if (mainCharAnimation.depth == curDepth)
assembleImage(curCharacterAnimationFrame, characterPosX, characterPosY);
- indice += 1;
+ curDepth += 1;
}
- g_engine->_graphics->putImg(posfondox, posfondoy, characterDirtyRect);
+ g_engine->_graphics->putImg(dirtyMainSpriteX, dirtyMainSpriteY, characterDirtyRect);
} else { // character and animation are in different parts of the screen
- if (pintapersonaje) {
+ if (drawMainCharachter) {
drawMainCharacter();
}
- posfondox = secondaryAnimation.posx - 3;
- posfondoy = secondaryAnimation.posy - 3;
+ dirtyMainSpriteX = secondaryAnimation.posx - 3;
+ dirtyMainSpriteY = secondaryAnimation.posy - 3;
- pasoanimadoW = READ_LE_UINT16(curSecondaryAnimationFrame) + 6;
- pasoanimadoH = READ_LE_UINT16(curSecondaryAnimationFrame + 2) + 6;
+ secAnimW = READ_LE_UINT16(curSecondaryAnimationFrame) + 6;
+ secAnimH = READ_LE_UINT16(curSecondaryAnimationFrame + 2) + 6;
- if (posfondoy + pasoanimadoH > 140) {
- pasoanimadoH -= (posfondoy + pasoanimadoH) - 140 + 1;
+ if (dirtyMainSpriteY + secAnimH > 140) {
+ secAnimH -= (dirtyMainSpriteY + secAnimH) - 140 + 1;
}
- if (posfondox + pasoanimadoW > 320) {
- pasoanimadoW -= (posfondox + pasoanimadoW) - 320 + 1;
+ if (dirtyMainSpriteX + secAnimW > 320) {
+ secAnimW -= (dirtyMainSpriteX + secAnimW) - 320 + 1;
}
- characterDirtyRect = (byte *)malloc((pasoanimadoW + 1) * (pasoanimadoH + 1) + 4);
- WRITE_LE_UINT16(characterDirtyRect, pasoanimadoW);
- WRITE_LE_UINT16(characterDirtyRect + 2, pasoanimadoH);
+ characterDirtyRect = (byte *)malloc((secAnimW + 1) * (secAnimH + 1) + 4);
+ WRITE_LE_UINT16(characterDirtyRect, secAnimW);
+ WRITE_LE_UINT16(characterDirtyRect + 2, secAnimH);
assembleBackground();
- indice = 0;
- while (indice != depthLevelCount) {
- overlayObject();
- if (secondaryAnimation.depth == indice)
+ curDepth = 0;
+ while (curDepth != depthLevelCount) {
+ overlayLayers();
+ if (secondaryAnimation.depth == curDepth)
assembleImage(curSecondaryAnimationFrame, secondaryAnimation.posx, secondaryAnimation.posy);
- indice += 1;
+ curDepth += 1;
}
- g_engine->_graphics->putImg(posfondox, posfondoy, characterDirtyRect);
+ g_engine->_graphics->putImg(dirtyMainSpriteX, dirtyMainSpriteY, characterDirtyRect);
}
- } else if (pintapersonaje) {
+ } else if (drawMainCharachter) {
drawMainCharacter();
}
}
@@ -424,34 +412,34 @@ void sprites(bool pintapersonaje) {
void adjustKey() {
iframe = 0;
calculateTrajectory(129, 13);
- characterFacingDir = 0;
+ charFacingDirection = 0;
do {
characterPosX = trajectory[currentTrajectoryIndex].x;
characterPosY = trajectory[currentTrajectoryIndex].y;
iframe++;
currentTrajectoryIndex += 1;
emptyLoop();
- tocapintar = false;
- if (saltospal >= 4) {
- saltospal = 0;
+ timeToDraw = false;
+ if (palAnimStep >= 4) {
+ palAnimStep = 0;
if (isPaletteAnimEnabled > 6)
isPaletteAnimEnabled = 0;
else
isPaletteAnimEnabled += 1;
updatePalette(isPaletteAnimEnabled);
} else
- saltospal += 1;
+ palAnimStep += 1;
sprites(true);
} while (currentTrajectoryIndex != trajectoryLength);
- characterFacingDir = 3;
+ charFacingDirection = 3;
emptyLoop();
- tocapintar = false;
+ timeToDraw = false;
sprites(true);
}
void adjustKey2() {
iframe = 0;
- characterFacingDir = 2;
+ charFacingDirection = 2;
trajectoryLength = 1;
do {
characterPosX = trajectory[currentTrajectoryIndex].x;
@@ -459,52 +447,52 @@ void adjustKey2() {
iframe++;
currentTrajectoryIndex -= 1;
emptyLoop();
- tocapintar = false;
- if (saltospal >= 4) {
- saltospal = 0;
+ timeToDraw = false;
+ if (palAnimStep >= 4) {
+ palAnimStep = 0;
if (isPaletteAnimEnabled > 6)
isPaletteAnimEnabled = 0;
else
isPaletteAnimEnabled += 1;
updatePalette(isPaletteAnimEnabled);
} else
- saltospal += 1;
+ palAnimStep += 1;
sprites(true);
} while (currentTrajectoryIndex != 0);
emptyLoop();
- tocapintar = false;
+ timeToDraw = false;
sprites(true);
}
void animatedSequence(uint numSequence) {
Common::File animationFile;
- uint indicerep, indiceani;
- uint16 tamsecani;
- uint animx, animy;
- int guadaxframe;
- byte numframessec;
+ uint repIndex, animIndex;
+ uint16 animFrameSize;
+ uint animX, animY;
+ int tmpCharacterPosX;
+ byte secFrameCount;
byte *animptr;
switch (numSequence) {
case 1: {
- guadaxframe = characterPosX;
+ tmpCharacterPosX = characterPosX;
characterPosX = 3;
if (!animationFile.open("POZO01.DAT")) {
showError(277);
}
- animx = 127;
- animy = 70;
- tamsecani = animationFile.readUint16LE();
- numframessec = animationFile.readByte();
+ animX = 127;
+ animY = 70;
+ animFrameSize = animationFile.readUint16LE();
+ secFrameCount = animationFile.readByte();
animationFile.readByte();
- animptr = (byte *)malloc(tamsecani);
- for (indicerep = 1; indicerep <= 3; indicerep++) {
+ animptr = (byte *)malloc(animFrameSize);
+ for (uint loopIdx = 1; loopIdx <= 3; repIndex++) {
g_engine->_sound->playVoc("POZO", 180395, 6034);
- indiceani = 0;
+ animIndex = 0;
do {
emptyLoop();
- tocapintar = false;
- if (tocapintar2) {
+ timeToDraw = false;
+ if (timeToDraw2) {
if (currentSecondaryTrajectoryIndex >= currentRoomData->secondaryTrajectoryLength)
currentSecondaryTrajectoryIndex = 1;
else
@@ -517,37 +505,37 @@ void animatedSequence(uint numSequence) {
else
iframe2++;
sprites(false);
- animationFile.read(animptr, tamsecani);
- g_engine->_graphics->putImg(animx, animy, animptr);
- indiceani += 1;
+ animationFile.read(animptr, animFrameSize);
+ g_engine->_graphics->putImg(animX, animY, animptr);
+ animIndex += 1;
}
- } while (indiceani != numframessec && !g_engine->shouldQuit());
+ } while (animIndex != secFrameCount && !g_engine->shouldQuit());
animationFile.seek(4);
}
free(animptr);
animationFile.close();
- characterPosX = guadaxframe;
+ characterPosX = tmpCharacterPosX;
} break;
case 2: {
if (!animationFile.open("POZOATR.DAT")) {
showError(277);
}
- animx = 127;
- guadaxframe = characterPosX;
+ animX = 127;
+ tmpCharacterPosX = characterPosX;
characterPosX = 3;
- animy = 70;
+ animY = 70;
- tamsecani = animationFile.readUint16LE();
- numframessec = animationFile.readByte();
+ animFrameSize = animationFile.readUint16LE();
+ secFrameCount = animationFile.readByte();
animationFile.readByte();
- animptr = (byte *)malloc(tamsecani);
- for (indicerep = 1; indicerep <= 3; indicerep++) {
+ animptr = (byte *)malloc(animFrameSize);
+ for (repIndex = 1; repIndex <= 3; repIndex++) {
g_engine->_sound->playVoc("POZO", 180395, 6034);
- indiceani = 0;
+ animIndex = 0;
do {
emptyLoop();
- tocapintar = false;
- if (tocapintar2) {
+ timeToDraw = false;
+ if (timeToDraw2) {
if (currentSecondaryTrajectoryIndex >= currentRoomData->secondaryTrajectoryLength)
currentSecondaryTrajectoryIndex = 1;
else
@@ -560,37 +548,36 @@ void animatedSequence(uint numSequence) {
else
iframe2++;
sprites(false);
- animationFile.read(animptr, tamsecani);
- g_engine->_graphics->putImg(animx, animy, animptr);
- indiceani += 1;
+ animationFile.read(animptr, animFrameSize);
+ g_engine->_graphics->putImg(animX, animY, animptr);
+ animIndex += 1;
}
- } while (indiceani != numframessec && !g_engine->shouldQuit());
+ } while (animIndex != secFrameCount && !g_engine->shouldQuit());
animationFile.seek(4);
- // seek(ficherosecuenciaanimada, 4);
}
g_engine->_sound->stopVoc();
free(animptr);
animationFile.close();
- characterPosX = guadaxframe;
+ characterPosX = tmpCharacterPosX;
} break;
case 3: {
- guadaxframe = characterPosX;
+ tmpCharacterPosX = characterPosX;
characterPosX = 3;
if (!animationFile.open("POZO02.DAT")) {
showError(277);
}
- animx = 127;
- animy = 70;
+ animX = 127;
+ animY = 70;
- tamsecani = animationFile.readUint16LE();
- numframessec = animationFile.readByte();
+ animFrameSize = animationFile.readUint16LE();
+ secFrameCount = animationFile.readByte();
animationFile.readByte();
- animptr = (byte *)malloc(tamsecani);
- indiceani = 0;
+ animptr = (byte *)malloc(animFrameSize);
+ animIndex = 0;
do {
emptyLoop();
- tocapintar = false;
- if (tocapintar2) {
+ timeToDraw = false;
+ if (timeToDraw2) {
if (currentSecondaryTrajectoryIndex >= currentRoomData->secondaryTrajectoryLength)
currentSecondaryTrajectoryIndex = 1;
else
@@ -603,18 +590,18 @@ void animatedSequence(uint numSequence) {
else
iframe2++;
sprites(false);
- animationFile.read(animptr, tamsecani);
- g_engine->_graphics->putImg(animx, animy, animptr);
- indiceani += 1;
+ animationFile.read(animptr, animFrameSize);
+ g_engine->_graphics->putImg(animX, animY, animptr);
+ animIndex += 1;
}
- } while (indiceani != numframessec && !g_engine->shouldQuit());
+ } while (animIndex != secFrameCount && !g_engine->shouldQuit());
free(animptr);
animationFile.close();
iframe = 0;
- characterFacingDir = 2;
+ charFacingDirection = 2;
emptyLoop();
- tocapintar = false;
- characterPosX = guadaxframe;
+ timeToDraw = false;
+ characterPosX = tmpCharacterPosX;
sprites(true);
} break;
case 4: {
@@ -622,55 +609,55 @@ void animatedSequence(uint numSequence) {
if (!animationFile.open("TIOLLAVE.DAT")) {
showError(277);
}
- animx = 85;
- animy = 15;
+ animX = 85;
+ animY = 15;
- tamsecani = animationFile.readUint16LE();
- numframessec = animationFile.readByte();
+ animFrameSize = animationFile.readUint16LE();
+ secFrameCount = animationFile.readByte();
animationFile.readByte();
- animptr = (byte *)malloc(tamsecani);
+ animptr = (byte *)malloc(animFrameSize);
- for (indiceani = 1; indiceani <= 31; indiceani++) {
- animationFile.read(animptr, tamsecani);
+ for (animIndex = 1; animIndex <= 31; animIndex++) {
+ animationFile.read(animptr, animFrameSize);
emptyLoop();
- tocapintar = false;
- if (saltospal >= 4) {
- saltospal = 0;
+ timeToDraw = false;
+ if (palAnimStep >= 4) {
+ palAnimStep = 0;
if (isPaletteAnimEnabled > 6)
isPaletteAnimEnabled = 0;
else
isPaletteAnimEnabled += 1;
updatePalette(isPaletteAnimEnabled);
} else
- saltospal += 1;
- g_engine->_graphics->putShape(animx, animy, animptr);
+ palAnimStep += 1;
+ g_engine->_graphics->putShape(animX, animY, animptr);
}
- screenObjects[regobj.depth - 1] = NULL;
+ screenLayers[regobj.depth - 1] = NULL;
restoreBackground();
- indiceani = mainCharAnimation.depth;
+ animIndex = mainCharAnimation.depth;
mainCharAnimation.depth = 30;
- screenObjects[13] = animptr;
- depthMap[13].posx = animx;
- depthMap[13].posy = animy;
+ screenLayers[13] = animptr;
+ depthMap[13].posx = animX;
+ depthMap[13].posy = animY;
assembleScreen();
drawScreen(sceneBackground);
- screenObjects[13] = NULL;
- mainCharAnimation.depth = indiceani;
+ screenLayers[13] = NULL;
+ mainCharAnimation.depth = animIndex;
drawBackpack();
- for (indiceani = 32; indiceani <= numframessec; indiceani++) {
- animationFile.read(animptr, tamsecani);
+ for (animIndex = 32; animIndex <= secFrameCount; animIndex++) {
+ animationFile.read(animptr, animFrameSize);
emptyLoop();
- tocapintar = false;
- if (saltospal >= 4) {
- saltospal = 0;
+ timeToDraw = false;
+ if (palAnimStep >= 4) {
+ palAnimStep = 0;
if (isPaletteAnimEnabled > 6)
isPaletteAnimEnabled = 0;
else
isPaletteAnimEnabled += 1;
updatePalette(isPaletteAnimEnabled);
} else
- saltospal += 1;
- g_engine->_graphics->putImg(animx, animy, animptr);
+ palAnimStep += 1;
+ g_engine->_graphics->putImg(animX, animY, animptr);
if (g_engine->shouldQuit()) {
break;
}
@@ -683,37 +670,37 @@ void animatedSequence(uint numSequence) {
if (!animationFile.open("TIOSACO.DAT")) {
showError(277);
}
- animx = 204;
- animy = 44;
- tamsecani = animationFile.readUint16LE();
- numframessec = animationFile.readByte();
+ animX = 204;
+ animY = 44;
+ animFrameSize = animationFile.readUint16LE();
+ secFrameCount = animationFile.readByte();
animationFile.readByte();
- animptr = (byte *)malloc(tamsecani);
- for (indiceani = 1; indiceani <= 8; indiceani++) {
- animationFile.read(animptr, tamsecani);
+ animptr = (byte *)malloc(animFrameSize);
+ for (animIndex = 1; animIndex <= 8; animIndex++) {
+ animationFile.read(animptr, animFrameSize);
emptyLoop();
- tocapintar = false;
- g_engine->_graphics->putShape(animx, animy, animptr);
+ timeToDraw = false;
+ g_engine->_graphics->putShape(animX, animY, animptr);
if (g_engine->shouldQuit()) {
break;
}
}
- indiceani = mainCharAnimation.depth;
+ animIndex = mainCharAnimation.depth;
mainCharAnimation.depth = 30;
- screenObjects[12] = animptr;
- depthMap[12].posx = animx;
- depthMap[12].posy = animy;
+ screenLayers[12] = animptr;
+ depthMap[12].posx = animX;
+ depthMap[12].posy = animY;
disableSecondAnimation();
- screenObjects[12] = NULL;
- mainCharAnimation.depth = indiceani;
+ screenLayers[12] = NULL;
+ mainCharAnimation.depth = animIndex;
drawScreen(sceneBackground);
- for (indiceani = 9; indiceani <= numframessec; indiceani++) {
- animationFile.read(animptr, tamsecani);
+ for (animIndex = 9; animIndex <= secFrameCount; animIndex++) {
+ animationFile.read(animptr, animFrameSize);
emptyLoop();
- tocapintar = false;
+ timeToDraw = false;
emptyLoop();
- tocapintar = false;
- g_engine->_graphics->putShape(animx, animy, animptr);
+ timeToDraw = false;
+ g_engine->_graphics->putShape(animX, animY, animptr);
if (g_engine->shouldQuit()) {
break;
}
@@ -721,9 +708,9 @@ void animatedSequence(uint numSequence) {
free(animptr);
animationFile.close();
iframe = 0;
- characterFacingDir = 2;
+ charFacingDirection = 2;
emptyLoop();
- tocapintar = false;
+ timeToDraw = false;
sprites(true);
} break;
case 6: {
@@ -731,47 +718,45 @@ void animatedSequence(uint numSequence) {
if (!animationFile.open("AZCCOG.DAT")) {
showError(277);
}
- tamsecani = animationFile.readUint16LE();
- numframessec = animationFile.readByte();
+ animFrameSize = animationFile.readUint16LE();
+ secFrameCount = animationFile.readByte();
animationFile.readByte();
- screenObjects[6] = (byte *)malloc(tamsecani);
- // objetos[7] = ptr(segfondo, (offfondo + 44900));
+ screenLayers[6] = (byte *)malloc(animFrameSize);
depthMap[6].posx = secondaryAnimation.posx + 5;
depthMap[6].posy = secondaryAnimation.posy - 6;
- indiceani = 0;
+ animIndex = 0;
do {
emptyLoop();
- tocapintar = false;
- if (saltospal >= 4) {
- saltospal = 0;
+ timeToDraw = false;
+ if (palAnimStep >= 4) {
+ palAnimStep = 0;
if (isPaletteAnimEnabled > 6)
isPaletteAnimEnabled = 0;
else
isPaletteAnimEnabled += 1;
updatePalette(isPaletteAnimEnabled);
} else
- saltospal += 1;
- if (tocapintar2) {
- animationFile.read(screenObjects[6], tamsecani);
- Common::copy(screenObjects[6], screenObjects[6] + tamsecani, sceneBackground + 44900);
- // blockread(ficherosecuenciaanimada, objetos[7], tamsecani);
+ palAnimStep += 1;
+ if (timeToDraw2) {
+ animationFile.read(screenLayers[6], animFrameSize);
+ Common::copy(screenLayers[6], screenLayers[6] + animFrameSize, sceneBackground + 44900);
restoreBackground();
assembleScreen();
drawScreen(sceneBackground);
- indiceani += 1;
- if (indiceani == 8)
+ animIndex += 1;
+ if (animIndex == 8)
g_engine->_sound->playVoc("PUFF", 191183, 18001);
}
- } while (indiceani != numframessec && !g_engine->shouldQuit());
+ } while (animIndex != secFrameCount && !g_engine->shouldQuit());
animationFile.close();
g_engine->_sound->stopVoc();
- screenObjects[6] = NULL;
+ screenLayers[6] = NULL;
currentRoomData->animationFlag = true;
} break;
}
}
-DoorRegistry readRegPuertas(Common::SeekableReadStream *screenDataFile) {
+DoorRegistry readDoorMetadata(Common::SeekableReadStream *screenDataFile) {
DoorRegistry doorMetadata;
doorMetadata.nextScene = screenDataFile->readUint16LE();
doorMetadata.exitPosX = screenDataFile->readUint16LE();
@@ -782,14 +767,14 @@ DoorRegistry readRegPuertas(Common::SeekableReadStream *screenDataFile) {
return doorMetadata;
}
-Common::Point readPunto(Common::SeekableReadStream *screenDataFile) {
+Common::Point readPoint(Common::SeekableReadStream *screenDataFile) {
Common::Point point;
point.x = screenDataFile->readUint16LE();
point.y = screenDataFile->readUint16LE();
return point;
}
-RoomBitmapRegister readBitmapAux(Common::SeekableReadStream *screenDataFile) {
+RoomBitmapRegister readAuxBitmaps(Common::SeekableReadStream *screenDataFile) {
RoomBitmapRegister bitmapMetadata = RoomBitmapRegister();
bitmapMetadata.bitmapPointer = screenDataFile->readSint32LE();
bitmapMetadata.bitmapSize = screenDataFile->readUint16LE();
@@ -799,7 +784,7 @@ RoomBitmapRegister readBitmapAux(Common::SeekableReadStream *screenDataFile) {
return bitmapMetadata;
}
-RoomObjectListEntry *readRegIndexadoObjetos(Common::SeekableReadStream *screenDataFile) {
+RoomObjectListEntry *readRoomObjects(Common::SeekableReadStream *screenDataFile) {
RoomObjectListEntry *objectMetadata = new RoomObjectListEntry();
objectMetadata->fileIndex = screenDataFile->readUint16LE();
objectMetadata->objectName = screenDataFile->readPascalString();
@@ -820,19 +805,19 @@ RoomFileRegister *readScreenDataFile(Common::SeekableReadStream *screenDataFile)
for (int i = 0; i < 9; i++) {
for (int j = 0; j < 30; j++) {
for (int k = 0; k < 5; k++) {
- screenData->trajectories[i][j][k] = readPunto(screenDataFile);
+ screenData->trajectories[i][j][k] = readPoint(screenDataFile);
}
}
}
for (int i = 0; i < 5; i++) {
- screenData->doors[i] = readRegPuertas(screenDataFile);
+ screenData->doors[i] = readDoorMetadata(screenDataFile);
}
for (int i = 0; i < 15; i++) {
- screenData->screenLayers[i] = readBitmapAux(screenDataFile);
+ screenData->screenLayers[i] = readAuxBitmaps(screenDataFile);
}
for (int i = 0; i < 51; i++) {
- screenData->screenObjectIndex[i] = readRegIndexadoObjetos(screenDataFile);
+ screenData->screenObjectIndex[i] = readRoomObjects(screenDataFile);
}
screenData->animationFlag = screenDataFile->readByte();
@@ -841,7 +826,7 @@ RoomFileRegister *readScreenDataFile(Common::SeekableReadStream *screenDataFile)
screenData->paletteAnimationFlag = screenDataFile->readByte();
screenData->palettePointer = screenDataFile->readUint16LE();
for (int i = 0; i < 300; i++) {
- screenData->secondaryAnimTrajectory[i] = readPunto(screenDataFile);
+ screenData->secondaryAnimTrajectory[i] = readPoint(screenDataFile);
}
screenDataFile->read(screenData->secondaryAnimDirections, 600);
screenData->secondaryTrajectoryLength = screenDataFile->readUint16LE();
@@ -893,10 +878,10 @@ void loadScreenData(uint screenNumber) {
* Calculates a trajectory between the current position (xframe, yframe)
* and the target position (finalx, finaly) using bresenham's algorithm
*/
-void calculateTrajectory(uint finalx, uint finaly) {
+void calculateTrajectory(uint finalX, uint finalY) {
- int deltaX = finalx - characterPosX;
- int deltaY = finaly - characterPosY;
+ int deltaX = finalX - characterPosX;
+ int deltaY = finalY - characterPosY;
int incrXDiag = (deltaX >= 0) ? 1 : -1;
int incrYDiag = (deltaY >= 0) ? 1 : -1;
@@ -912,12 +897,12 @@ void calculateTrajectory(uint finalx, uint finaly) {
}
// step increments for straight moves
- int incrXRecto = horizontalDominant ? incrXDiag : 0;
- int incrYRecto = horizontalDominant ? 0 : incrYDiag;
+ int straightXIncrease = horizontalDominant ? incrXDiag : 0;
+ int straightYIncrease = horizontalDominant ? 0 : incrYDiag;
- int contRecto = 2 * deltaY;
- int contDiag = contRecto - (2 * deltaX);
- int BX = contRecto - deltaX; // decision variable
+ int straightAmount = 2 * deltaY;
+ int slope = straightAmount - (2 * deltaX);
+ int dec = straightAmount - deltaX; // decision variable
// start at initial position
uint x = characterPosX, y = characterPosY;
@@ -929,14 +914,14 @@ void calculateTrajectory(uint finalx, uint finaly) {
trajectory[trajectoryLength].y = y;
trajectoryLength++;
while (--steps) {
- if (BX >= 0) {
+ if (dec >= 0) {
x += incrXDiag;
y += incrYDiag;
- BX += contDiag;
+ dec += slope;
} else {
- x += incrXRecto;
- y += incrYRecto;
- BX += contRecto;
+ x += straightXIncrease;
+ y += straightYIncrease;
+ dec += straightAmount;
}
trajectory[trajectoryLength].x = x;
trajectory[trajectoryLength].y = y;
@@ -944,27 +929,26 @@ void calculateTrajectory(uint finalx, uint finaly) {
}
// Ensure last value is also final position to account for overflow of the route
- trajectory[trajectoryLength].x = finalx;
- trajectory[trajectoryLength].y = finaly;
- trajectory[trajectoryLength + 1].x = finalx;
- trajectory[trajectoryLength + 1].y = finaly;
+ trajectory[trajectoryLength].x = finalX;
+ trajectory[trajectoryLength].y = finalY;
+ trajectory[trajectoryLength + 1].x = finalX;
+ trajectory[trajectoryLength + 1].y = finalY;
// longtray--; // decrement because of 1-starting arrays
}
-void lookInventoryObject(byte numeroobjeto) {
+void lookAtObject(byte objectCode) {
byte yaux;
- Common::String cadenadescripcion;
- bool kkaux;
- TextEntry reghpt;
- palette paletaseg;
+ Common::String description;
+ bool foobar = false;
+ TextEntry textRef;
+ palette secPalette;
- kkaux = false;
- contadorpc2 = contadorpc;
+ cpCounter2 = cpCounter;
g_engine->_mouseManager->hide();
- copyPalette(pal, paletaseg);
- readItemRegister(mobj[numeroobjeto].code);
+ copyPalette(pal, secPalette);
+ readItemRegister(mobj[objectCode].code);
g_engine->_graphics->getImg(0, 0, 319, 139, sceneBackground);
partialFadeOut(234);
bar(0, 0, 319, 139, 0);
@@ -978,9 +962,7 @@ void lookInventoryObject(byte numeroobjeto) {
251, // color2
251, // color3
251, // color4
- 0, // color5
- 0, // xtext
- "" // text
+ 0 // color5
);
drawMenu(4);
@@ -988,74 +970,74 @@ void lookInventoryObject(byte numeroobjeto) {
if (regobj.used[0] != 9) {
if (regobj.beforeUseTextRef != 0) {
assignText();
- reghpt = readVerbRegister(regobj.beforeUseTextRef);
- cadenadescripcion = reghpt.text;
- for (yaux = 0; yaux < reghpt.text.size(); yaux++)
- cadenadescripcion.setChar(decryptionKey[yaux] ^ reghpt.text[yaux], yaux);
- hipercadena(cadenadescripcion, 60, 15, 33, 255, 0);
+ textRef = readVerbRegister(regobj.beforeUseTextRef);
+ description = textRef.text;
+ for (yaux = 0; yaux < textRef.text.size(); yaux++)
+ description.setChar(decryptionKey[yaux] ^ textRef.text[yaux], yaux);
+ hyperText(description, 60, 15, 33, 255, 0);
verb.close();
} else {
- cadenadescripcion = mobj[numeroobjeto].objectName;
- hipercadena(cadenadescripcion, 60, 15, 33, 255, 0);
+ description = mobj[objectCode].objectName;
+ hyperText(description, 60, 15, 33, 255, 0);
}
} else {
if (regobj.afterUseTextRef != 0) {
assignText();
- reghpt = readVerbRegister(regobj.afterUseTextRef);
- cadenadescripcion = reghpt.text;
- for (yaux = 0; yaux < reghpt.text.size(); yaux++)
- cadenadescripcion.setChar(decryptionKey[yaux] ^ reghpt.text[yaux], yaux);
- hipercadena(cadenadescripcion, 60, 15, 33, 255, 0);
+ textRef = readVerbRegister(regobj.afterUseTextRef);
+ description = textRef.text;
+ for (yaux = 0; yaux < textRef.text.size(); yaux++)
+ description.setChar(decryptionKey[yaux] ^ textRef.text[yaux], yaux);
+ hyperText(description, 60, 15, 33, 255, 0);
verb.close();
} else {
- cadenadescripcion = mobj[numeroobjeto].objectName;
- hipercadena(cadenadescripcion, 60, 15, 33, 255, 0);
+ description = mobj[objectCode].objectName;
+ hyperText(description, 60, 15, 33, 255, 0);
}
}
- drawFlc(125, 70, regobj.rotatingObjectAnimation, 60000, 9, 0, false, true, true, kkaux);
+ drawFlc(125, 70, regobj.rotatingObjectAnimation, 60000, 9, 0, false, true, true, foobar);
screenTransition(3, true, NULL);
partialFadeOut(234);
assembleScreen();
drawScreen(sceneBackground);
- copyPalette(paletaseg, pal);
+ copyPalette(secPalette, pal);
partialFadeIn(234);
g_engine->_mouseManager->show();
}
-void useInventoryObjectWithInventoryObject(uint numobj1, uint numobj2) {
- byte indicemochila, indobj1, indobj2;
+void useInventoryObjectWithInventoryObject(uint objectCode1, uint objectCode2) {
+ byte invIndex, indobj1, indobj2;
- debug("Reading item register %d", numobj1);
- readItemRegister(invItemData, numobj1, regobj);
+ debug("Reading item register %d", objectCode1);
+ readItemRegister(invItemData, objectCode1, regobj);
// verifyCopyProtection2();
- if (regobj.used[0] != 1 || regobj.useWith != numobj2) {
+ if (regobj.used[0] != 1 || regobj.useWith != objectCode2) {
drawText(Random(11) + 1022);
return;
}
- indicemochila = 0;
- while (mobj[indicemochila].code != numobj1) {
- indicemochila += 1;
+ invIndex = 0;
+ while (mobj[invIndex].code != objectCode1) {
+ invIndex += 1;
}
- indobj1 = indicemochila;
+ indobj1 = invIndex;
- indicemochila = 0;
- while (mobj[indicemochila].code != numobj2) {
- indicemochila += 1;
+ invIndex = 0;
+ while (mobj[invIndex].code != objectCode2) {
+ invIndex += 1;
}
- indobj2 = indicemochila;
+ indobj2 = invIndex;
foo = regobj.useTextRef;
if (regobj.replaceWith == 0) {
- readItemRegister(invItemData, numobj1, regobj);
+ readItemRegister(invItemData, objectCode1, regobj);
regobj.used[0] = 9;
saveItemRegister(regobj, invItemData);
- readItemRegister(invItemData, numobj2, regobj);
+ readItemRegister(invItemData, objectCode2, regobj);
regobj.used[0] = 9;
saveItemRegister(regobj, invItemData);
@@ -1077,7 +1059,7 @@ void useInventoryObjectWithInventoryObject(uint numobj1, uint numobj2) {
drawText(foo);
}
-void calculateRoute(byte zona1, byte zona2, bool extraCorrection, bool zonavedada) {
+void calculateRoute(byte zone1, byte zone2, bool extraCorrection, bool barredZone) {
// Resets the entire route
for (steps = 0; steps < 7; steps++) {
mainRoute[steps].x = 0;
@@ -1091,7 +1073,7 @@ void calculateRoute(byte zona1, byte zona2, bool extraCorrection, bool zonavedad
Common::Point point;
do {
steps += 1;
- point = currentRoomData->trajectories[zona1 - 1][zona2 - 1][steps - 1];
+ point = currentRoomData->trajectories[zone1 - 1][zone2 - 1][steps - 1];
if (point.x < (characterCorrectionX + 3))
mainRoute[steps].x = 3;
@@ -1104,7 +1086,7 @@ void calculateRoute(byte zona1, byte zona2, bool extraCorrection, bool zonavedad
} while (point.y != 9999 && steps != 5);
- if (zona2 < 10) {
+ if (zone2 < 10) {
if (point.y == 9999) {
mainRoute[steps].x = xframe2 - characterCorrectionX;
mainRoute[steps].y = yframe2 - characerCorrectionY;
@@ -1120,17 +1102,17 @@ void calculateRoute(byte zona1, byte zona2, bool extraCorrection, bool zonavedad
if (extraCorrection) {
switch (currentRoomData->code) {
case 5:
- if (zona2 == 27)
+ if (zone2 == 27)
steps += 1;
break;
case 6:
- if (zona2 == 21)
+ if (zone2 == 21)
steps += 1;
break;
}
}
}
- if (extraCorrection && zonavedada) {
+ if (extraCorrection && barredZone) {
steps -= 1;
}
@@ -1142,46 +1124,46 @@ void calculateRoute(byte zona1, byte zona2, bool extraCorrection, bool zonavedad
currentTrajectoryIndex = 30;
}
-void goToObject(byte zona1, byte zona2) {
- bool zonavedada = false;
+void goToObject(byte zone1, byte zone2) {
+ bool barredZone = false;
- contadorpc2 = contadorpc;
+ cpCounter2 = cpCounter;
- for (int indicepaso = 0; indicepaso < 5; indicepaso++) {
- if (currentRoomData->doors[indicepaso].doorcode == zona2) {
- zonavedada = true;
+ for (int i = 0; i < 5; i++) {
+ if (currentRoomData->doors[i].doorcode == zone2) {
+ barredZone = true;
break;
}
}
if (currentRoomData->code == 21 && currentRoomData->animationFlag) {
- if ((zona2 >= 1 && zona2 <= 5) ||
- (zona2 >= 9 && zona2 <= 13) ||
- (zona2 >= 18 && zona2 <= 21) ||
- zona2 == 24 || zona2 == 25) {
+ if ((zone2 >= 1 && zone2 <= 5) ||
+ (zone2 >= 9 && zone2 <= 13) ||
+ (zone2 >= 18 && zone2 <= 21) ||
+ zone2 == 24 || zone2 == 25) {
targetZone = 7;
mouseClickX = 232;
mouseClickY = 75;
- zona2 = 7;
+ zone2 = 7;
}
- if (zona2 == 24) {
- zonavedada = false;
+ if (zone2 == 24) {
+ barredZone = false;
}
}
- if (zona1 < 10) {
+ if (zone1 < 10) {
xframe2 = mouseClickX + 7;
yframe2 = mouseClickY + 7;
g_engine->_mouseManager->hide();
- calculateRoute(zona1, zona2, true, zonavedada);
+ calculateRoute(zone1, zone2, true, barredZone);
Common::Event e;
do {
g_engine->_chrono->updateChrono();
while (g_system->getEventManager()->pollEvent(e)) {
changeGameSpeed(e);
}
- advanceAnimations(zonavedada, false);
+ advanceAnimations(barredZone, false);
g_engine->_screen->update();
g_system->delayMillis(10);
} while (xframe2 != 0);
@@ -1193,26 +1175,26 @@ void goToObject(byte zona1, byte zona2) {
}
void updateSecondaryAnimationDepth() {
- uint animadoposition = secondaryAnimation.posy + secondaryAnimHeight - 1;
- if (animadoposition >= 0 && animadoposition <= 56) {
+ uint animationPos = secondaryAnimation.posy + secondaryAnimHeight - 1;
+ if (animationPos >= 0 && animationPos <= 56) {
secondaryAnimation.depth = 0;
- } else if (animadoposition >= 57 && animadoposition <= 66) {
+ } else if (animationPos >= 57 && animationPos <= 66) {
secondaryAnimation.depth = 1;
- } else if (animadoposition >= 65 && animadoposition <= 74) {
+ } else if (animationPos >= 65 && animationPos <= 74) {
secondaryAnimation.depth = 2;
- } else if (animadoposition >= 73 && animadoposition <= 82) {
+ } else if (animationPos >= 73 && animationPos <= 82) {
secondaryAnimation.depth = 3;
- } else if (animadoposition >= 81 && animadoposition <= 90) {
+ } else if (animationPos >= 81 && animationPos <= 90) {
secondaryAnimation.depth = 4;
- } else if (animadoposition >= 89 && animadoposition <= 98) {
+ } else if (animationPos >= 89 && animationPos <= 98) {
secondaryAnimation.depth = 5;
- } else if (animadoposition >= 97 && animadoposition <= 106) {
+ } else if (animationPos >= 97 && animationPos <= 106) {
secondaryAnimation.depth = 6;
- } else if (animadoposition >= 105 && animadoposition <= 114) {
+ } else if (animationPos >= 105 && animationPos <= 114) {
secondaryAnimation.depth = 7;
- } else if (animadoposition >= 113 && animadoposition <= 122) {
+ } else if (animationPos >= 113 && animationPos <= 122) {
secondaryAnimation.depth = 8;
- } else if (animadoposition >= 121 && animadoposition <= 140) {
+ } else if (animationPos >= 121 && animationPos <= 140) {
secondaryAnimation.depth = 9;
}
}
@@ -1241,10 +1223,10 @@ void updateMainCharacterDepth() {
}
}
-void advanceAnimations(bool zonavedada, bool animateMouse) {
- if (tocapintar) {
+void advanceAnimations(bool barredZone, bool animateMouse) {
+ if (timeToDraw) {
- if (currentRoomData->animationFlag && tocapintar2) {
+ if (currentRoomData->animationFlag && timeToDraw2) {
if (isPeterCoughing && (Random(100) == 1) && !g_engine->_sound->isVocPlaying() && mintTopic[0] == false) {
debug("Playing tos");
g_engine->_sound->playVoc("TOS", 258006, 14044);
@@ -1274,7 +1256,7 @@ void advanceAnimations(bool zonavedada, bool animateMouse) {
// This means character needs to walk
if (xframe2 > 0) {
- if (characterFacingDir == 1 || characterFacingDir == 3) {
+ if (charFacingDirection == 1 || charFacingDirection == 3) {
currentTrajectoryIndex += 1;
}
currentTrajectoryIndex += 1;
@@ -1287,14 +1269,14 @@ void advanceAnimations(bool zonavedada, bool animateMouse) {
if ((abs(element1) > 2) || (abs(element2) > 2)) {
if (abs(element2) > (abs(element1) + 5)) {
if (element2 < 0)
- characterFacingDir = 0;
+ charFacingDirection = 0;
else
- characterFacingDir = 2;
+ charFacingDirection = 2;
} else {
if (element1 > 0)
- characterFacingDir = 1;
+ charFacingDirection = 1;
else
- characterFacingDir = 3;
+ charFacingDirection = 3;
}
}
yframe2 += 1;
@@ -1307,14 +1289,14 @@ void advanceAnimations(bool zonavedada, bool animateMouse) {
element2 = (mouseY + 7) - (characterPosY + characerCorrectionY);
if (abs(element2) > (abs(element1) + 20)) {
if (element2 < 0)
- characterFacingDir = 0;
+ charFacingDirection = 0;
else
- characterFacingDir = 2;
+ charFacingDirection = 2;
} else {
if (element1 > 0)
- characterFacingDir = 1;
+ charFacingDirection = 1;
else
- characterFacingDir = 3;
+ charFacingDirection = 3;
}
}
}
@@ -1323,19 +1305,19 @@ void advanceAnimations(bool zonavedada, bool animateMouse) {
iframe = 0;
} else {
iframe = 0;
- if (zonavedada == false && !roomChange) {
+ if (barredZone == false && !roomChange) {
element1 = (mouseX + 7) - (characterPosX + characterCorrectionX);
element2 = (mouseY + 7) - (characterPosY + characerCorrectionY);
if (abs(element2) > (abs(element1) + 20)) {
if (element2 < 0)
- characterFacingDir = 0;
+ charFacingDirection = 0;
else
- characterFacingDir = 2;
+ charFacingDirection = 2;
} else {
if (element1 > 0)
- characterFacingDir = 1;
+ charFacingDirection = 1;
else
- characterFacingDir = 3;
+ charFacingDirection = 3;
}
}
}
@@ -1347,9 +1329,9 @@ void advanceAnimations(bool zonavedada, bool animateMouse) {
if (isDrawingEnabled) {
sprites(true);
}
- tocapintar = false;
- if (currentRoomData->paletteAnimationFlag && saltospal >= 4) {
- saltospal = 0;
+ timeToDraw = false;
+ if (currentRoomData->paletteAnimationFlag && palAnimStep >= 4) {
+ palAnimStep = 0;
if (isPaletteAnimEnabled > 6)
isPaletteAnimEnabled = 0;
else
@@ -1358,7 +1340,7 @@ void advanceAnimations(bool zonavedada, bool animateMouse) {
g_engine->_sound->playVoc();
updatePalette(isPaletteAnimEnabled);
} else {
- saltospal += 1;
+ palAnimStep += 1;
}
}
}
@@ -1367,105 +1349,105 @@ void actionLineText(Common::String actionLine) {
euroText(160, 144, actionLine, 255, Graphics::kTextAlignCenter);
}
-void animateGive(uint cogedir, uint cogealt) {
- characterFacingDir = cogedir;
+void animateGive(uint dir, uint height) {
+ charFacingDirection = dir;
for (uint i = 0; i < 5; i++) {
emptyLoop();
- tocapintar = false;
+ timeToDraw = false;
// Must add 1 to i because the original game uses 1-based indices
- iframe = 15 + 6 + 5 + cogealt * 10 - (i + 1);
+ iframe = 15 + 6 + 5 + height * 10 - (i + 1);
- if (currentRoomData->paletteAnimationFlag && saltospal >= 4) {
- saltospal = 0;
+ if (currentRoomData->paletteAnimationFlag && palAnimStep >= 4) {
+ palAnimStep = 0;
if (isPaletteAnimEnabled > 6)
isPaletteAnimEnabled = 0;
else
isPaletteAnimEnabled += 1;
updatePalette(isPaletteAnimEnabled);
} else
- saltospal += 1;
+ palAnimStep += 1;
sprites(true);
}
iframe = 0;
}
// Lean over to pick
-void animatePickup1(uint cogedir, uint cogealt) {
- characterFacingDir = cogedir;
+void animatePickup1(uint dir, uint height) {
+ charFacingDirection = dir;
for (uint i = 0; i < 5; i++) {
emptyLoop();
- tocapintar = false;
- iframe = 15 + cogealt * 10 + (i + 1);
+ timeToDraw = false;
+ iframe = 15 + height * 10 + (i + 1);
- if (currentRoomData->paletteAnimationFlag && saltospal >= 4) {
- saltospal = 0;
+ if (currentRoomData->paletteAnimationFlag && palAnimStep >= 4) {
+ palAnimStep = 0;
if (isPaletteAnimEnabled > 6)
isPaletteAnimEnabled = 0;
else
isPaletteAnimEnabled += 1;
updatePalette(isPaletteAnimEnabled);
} else
- saltospal += 1;
+ palAnimStep += 1;
sprites(true);
g_engine->_screen->update();
}
}
// Lean back after pick
-void animatePickup2(uint cogedir, uint cogealt) {
- characterFacingDir = cogedir;
+void animatePickup2(uint dir, uint height) {
+ charFacingDirection = dir;
for (uint i = 0; i < 5; i++) {
emptyLoop();
- tocapintar = false;
+ timeToDraw = false;
- iframe = 15 + 5 + cogealt * 10 + (i + 1);
+ iframe = 15 + 5 + height * 10 + (i + 1);
- if (currentRoomData->paletteAnimationFlag && saltospal >= 4) {
- saltospal = 0;
+ if (currentRoomData->paletteAnimationFlag && palAnimStep >= 4) {
+ palAnimStep = 0;
if (isPaletteAnimEnabled > 6)
isPaletteAnimEnabled = 0;
else
isPaletteAnimEnabled += 1;
updatePalette(isPaletteAnimEnabled);
} else
- saltospal += 1;
+ palAnimStep += 1;
sprites(true);
g_engine->_screen->update();
}
emptyLoop();
- tocapintar = false;
+ timeToDraw = false;
sprites(true);
iframe = 0;
}
-void animateOpen2(uint cogedir, uint cogealt) {
- characterFacingDir = cogedir;
- contadorpc = contadorpc2;
+void animateOpen2(uint dir, uint height) {
+ charFacingDirection = dir;
+ cpCounter = cpCounter2;
for (uint i = 0; i < 5; i++) {
emptyLoop();
- tocapintar = false;
- iframe = 15 + 6 + cogealt * 10 - (i + 1);
+ timeToDraw = false;
+ iframe = 15 + 6 + height * 10 - (i + 1);
- if (currentRoomData->paletteAnimationFlag && saltospal >= 4) {
- saltospal = 0;
+ if (currentRoomData->paletteAnimationFlag && palAnimStep >= 4) {
+ palAnimStep = 0;
if (isPaletteAnimEnabled > 6)
isPaletteAnimEnabled = 0;
else
isPaletteAnimEnabled += 1;
updatePalette(isPaletteAnimEnabled);
} else
- saltospal += 1;
+ palAnimStep += 1;
sprites(true);
}
emptyLoop();
- tocapintar = false;
+ timeToDraw = false;
sprites(true);
iframe = 0;
}
void animateBat() {
- const uint trayseg[91][2] = {
+ const uint trajectory[91][2] = {
{288, 40}, {289, 38}, {289, 36}, {289, 34}, {290, 32}, {290, 30}, {289, 31}, {288, 32},
{288, 34}, {286, 36}, {284, 38}, {282, 40}, {280, 42}, {278, 44}, {276, 46}, {274, 48},
{272, 50}, {270, 48}, {268, 46}, {266, 48}, {265, 50}, {264, 52}, {263, 54}, {263, 56},
@@ -1479,72 +1461,72 @@ void animateBat() {
{290, 110}, {290, 112}, {290, 114}, {289, 116}, {289, 118}, {289, 120}, {289, 122}, {289, 124},
{290, 122}, {290, 120}, {290, 118}
};
- byte iframe2seg;
- uint anchoaniseg, altoaniseg,
- itrayseg, longtrayseg, xseg, yseg, profseg, dirseg;
+ byte curAnimIFrame;
+ uint currAnimWidth, curAnimHeight,
+ curAnimIdx, curAnimLength, curAnimX, curAnimY, curAnimDepth, curAnimDir;
- bool salir_del_bucle = false;
+ bool loopBreak = false;
if (currentRoomData->animationFlag) {
- iframe2seg = iframe2;
- xseg = secondaryAnimation.posx;
- yseg = secondaryAnimation.posy;
- anchoaniseg = secondaryAnimWidth;
- altoaniseg = secondaryAnimHeight;
- profseg = secondaryAnimation.depth;
- dirseg = secondaryAnimation.dir;
+ curAnimIFrame = iframe2;
+ curAnimX = secondaryAnimation.posx;
+ curAnimY = secondaryAnimation.posy;
+ currAnimWidth = secondaryAnimWidth;
+ curAnimHeight = secondaryAnimHeight;
+ curAnimDepth = secondaryAnimation.depth;
+ curAnimDir = secondaryAnimation.dir;
freeAnimation();
}
loadBat();
g_engine->_sound->stopVoc();
g_engine->_sound->playVoc("MURCIEL", 160848, 4474);
- itrayseg = 0;
- longtrayseg = 87;
+ curAnimIdx = 0;
+ curAnimLength = 87;
iframe2 = 0;
secondaryAnimation.depth = 14;
do {
g_engine->_chrono->updateChrono();
- if (tocapintar) {
- if (itrayseg == longtrayseg)
- salir_del_bucle = true;
- itrayseg += 1;
+ if (timeToDraw) {
+ if (curAnimIdx == curAnimLength)
+ loopBreak = true;
+ curAnimIdx += 1;
if (iframe2 >= secondaryAnimationFrameCount - 1)
iframe2 = 0;
else
iframe2++;
- secondaryAnimation.posx = trayseg[itrayseg][0] - 20;
- secondaryAnimation.posy = trayseg[itrayseg][1];
+ secondaryAnimation.posx = trajectory[curAnimIdx][0] - 20;
+ secondaryAnimation.posy = trajectory[curAnimIdx][1];
secondaryAnimation.dir = 0;
sprites(true);
- tocapintar = false;
- if (itrayseg % 24 == 0)
+ timeToDraw = false;
+ if (curAnimIdx % 24 == 0)
g_engine->_sound->playVoc();
- if (saltospal >= 4) {
- saltospal = 0;
+ if (palAnimStep >= 4) {
+ palAnimStep = 0;
if (isPaletteAnimEnabled > 6)
isPaletteAnimEnabled = 0;
else
isPaletteAnimEnabled += 1;
updatePalette(isPaletteAnimEnabled);
} else
- saltospal += 1;
+ palAnimStep += 1;
}
g_engine->_screen->update();
g_system->delayMillis(10);
- } while (!salir_del_bucle && !g_engine->shouldQuit());
+ } while (!loopBreak && !g_engine->shouldQuit());
g_engine->_sound->stopVoc();
freeAnimation();
if (currentRoomData->animationFlag) {
- secondaryAnimWidth = anchoaniseg;
- secondaryAnimHeight = altoaniseg;
+ secondaryAnimWidth = currAnimWidth;
+ secondaryAnimHeight = curAnimHeight;
setRoomTrajectories(secondaryAnimHeight, secondaryAnimWidth, RESTORE, false);
loadAnimation(currentRoomData->animationName);
- iframe2 = iframe2seg;
- secondaryAnimation.posx = xseg;
- secondaryAnimation.posy = yseg;
- secondaryAnimation.depth = profseg;
- secondaryAnimation.dir = dirseg;
+ iframe2 = curAnimIFrame;
+ secondaryAnimation.posx = curAnimX;
+ secondaryAnimation.posy = curAnimY;
+ secondaryAnimation.depth = curAnimDepth;
+ secondaryAnimation.dir = curAnimDir;
}
restoreBackground();
assembleScreen();
@@ -1552,77 +1534,77 @@ void animateBat() {
}
void updateVideo() {
- readBitmap(regobj.dropOverlay, screenObjects[regobj.depth - 1], regobj.dropOverlaySize, 319);
+ readBitmap(regobj.dropOverlay, screenLayers[regobj.depth - 1], regobj.dropOverlaySize, 319);
restoreBackground();
assembleScreen();
drawScreen(sceneBackground);
}
-void nicheAnimation(byte direccionhn, int32 bitmap) {
- uint posdibhn, indicehn;
- int incrementohn;
+void nicheAnimation(byte nicheDir, int32 bitmap) {
+ uint bitmapOffset;
+ int increment;
// Room with Red
if (currentRoomData->code == 24) {
- screenObjects[1] = (byte *)malloc(3660);
- readBitmap(1382874, screenObjects[1], 3652, 319);
- uint16 object1Width = READ_LE_UINT16(screenObjects[1]);
- uint16 object1Height = READ_LE_UINT16(screenObjects[1] + 2);
+ screenLayers[1] = (byte *)malloc(3660);
+ readBitmap(1382874, screenLayers[1], 3652, 319);
+ uint16 object1Width = READ_LE_UINT16(screenLayers[1]);
+ uint16 object1Height = READ_LE_UINT16(screenLayers[1] + 2);
depthMap[1].posx = 211;
depthMap[1].posy = 16;
depthMap[1].posx2 = 211 + object1Width + 1;
depthMap[1].posy2 = 16 + object1Height + 1;
}
- switch (direccionhn) {
+ switch (nicheDir) {
case 0: {
- posdibhn = 44904;
- incrementohn = 1;
- Common::copy(screenObjects[0], screenObjects[0] + 892, sceneBackground + 44900);
- readBitmap(bitmap, screenObjects[0], 892, 319);
- Common::copy(screenObjects[0] + 4, screenObjects[0] + 4 + 888, sceneBackground + 44900 + 892);
+ bitmapOffset = 44904;
+ increment = 1;
+ Common::copy(screenLayers[0], screenLayers[0] + 892, sceneBackground + 44900);
+ readBitmap(bitmap, screenLayers[0], 892, 319);
+ Common::copy(screenLayers[0] + 4, screenLayers[0] + 4 + 888, sceneBackground + 44900 + 892);
} break;
case 1: { // object slides to reveal empty stand
- posdibhn = 892 + 44900;
- incrementohn = -1;
- // Reads the empty alcove into a non-visible part of fondo
+ bitmapOffset = 892 + 44900;
+ increment = -1;
+ // Reads the empty niche into a non-visible part of background
readBitmap(bitmap, sceneBackground + 44900, 892, 319);
- // Copies whatever is currently on the alcove in a non-visible part of fondo contiguous with the above
- Common::copy(screenObjects[0] + 4, screenObjects[0] + 4 + 888, sceneBackground + 44900 + 892);
+ // Copies whatever is currently on the niche in a non-visible part of background contiguous with the above
+ Common::copy(screenLayers[0] + 4, screenLayers[0] + 4 + 888, sceneBackground + 44900 + 892);
// We now have in consecutive pixels the empty stand and the object
} break;
}
- uint16 alcoveWidth = READ_LE_UINT16(screenObjects[0]);
- uint16 alcoveHeight = READ_LE_UINT16(screenObjects[0] + 2);
+ uint16 nicheWidth = READ_LE_UINT16(screenLayers[0]);
+ uint16 nicheHeight = READ_LE_UINT16(screenLayers[0] + 2);
// Set the height to double to animate 2 images of the same height moving up/down
- *(sceneBackground + 44900 + 2) = (alcoveHeight * 2) + 1;
+ *(sceneBackground + 44900 + 2) = (nicheHeight * 2) + 1;
restoreBackground();
- for (indicehn = 1; indicehn <= alcoveHeight; indicehn++) {
+ for (uint i = 1; i <= nicheHeight; i++) {
- posdibhn = posdibhn + (incrementohn * (alcoveWidth + 1));
- Common::copy(sceneBackground + posdibhn, sceneBackground + posdibhn + 888, screenObjects[0] + 4);
+ bitmapOffset = bitmapOffset + (increment * (nicheWidth + 1));
+ Common::copy(sceneBackground + bitmapOffset, sceneBackground + bitmapOffset + 888, screenLayers[0] + 4);
assembleScreen();
drawScreen(sceneBackground);
g_engine->_screen->update();
}
- readBitmap(bitmap, screenObjects[0], 892, 319);
+ readBitmap(bitmap, screenLayers[0], 892, 319);
restoreBackground();
assembleScreen();
drawScreen(sceneBackground);
if (currentRoomData->code == 24) {
- free(screenObjects[1]);
- screenObjects[1] = NULL;
+ free(screenLayers[1]);
+ screenLayers[1] = NULL;
}
}
void pickupScreenObject() {
- byte indicemochila, indicex, indicey;
+ byte inventoryIndex;
uint screenObject;
uint mouseX = (mouseClickX + 7) / xGridCount;
@@ -1670,12 +1652,12 @@ void pickupScreenObject() {
animatePickup2(3, 0);
} break;
default: {
- animatePickup1(characterFacingDir, 0);
- screenObjects[regobj.depth - 1] = NULL;
+ animatePickup1(charFacingDirection, 0);
+ screenLayers[regobj.depth - 1] = NULL;
restoreBackground();
assembleScreen();
drawScreen(sceneBackground);
- animatePickup2(characterFacingDir, 0);
+ animatePickup2(charFacingDirection, 0);
}
}
} break;
@@ -1730,16 +1712,16 @@ void pickupScreenObject() {
with.depth = 1;
loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
- screenObjects[regobj.depth - 1] = NULL;
+ screenLayers[regobj.depth - 1] = NULL;
restoreBackground();
assembleScreen();
drawScreen(sceneBackground);
animatePickup2(0, 1);
} break;
- case 562: { // alcove
+ case 562: { // niche
switch (currentRoomData->code) {
- case 20: { // First scene with alcove
+ case 20: { // First scene with niche
if (niche[0][niche[0][3]] > 0) {
// Possibly
if (niche[0][3] == 2 || niche[0][niche[0][3]] == 563) {
@@ -1747,7 +1729,7 @@ void pickupScreenObject() {
niche[0][niche[0][3]] = 0;
currentRoomData->screenObjectIndex[9]->objectName = getObjectName(4);
animatePickup1(3, 1);
- readBitmap(1190768, screenObjects[regobj.depth - 1], 892, 319);
+ readBitmap(1190768, screenLayers[regobj.depth - 1], 892, 319);
currentRoomData->screenLayers[1].bitmapPointer = 1190768;
currentRoomData->screenLayers[1].bitmapSize = 892;
currentRoomData->screenLayers[1].coordx = 66;
@@ -1764,7 +1746,7 @@ void pickupScreenObject() {
niche[1][3] -= 1;
currentRoomData->screenObjectIndex[9]->objectName = " ";
animatePickup1(3, 1);
- readBitmap(1190768, screenObjects[regobj.depth - 1],
+ readBitmap(1190768, screenLayers[regobj.depth - 1],
892, 319);
restoreBackground();
assembleScreen();
@@ -1807,14 +1789,14 @@ void pickupScreenObject() {
return;
}
} break;
- case 24: { // Second scene with alcove
+ case 24: { // Second scene with niche
if (niche[1][niche[1][3]] > 0 && niche[1][3] != 1) {
if (niche[1][3] == 2) {
readItemRegister(niche[1][2]);
niche[1][2] = 0;
currentRoomData->screenObjectIndex[8]->objectName = getObjectName(4);
animatePickup1(0, 1);
- readBitmap(1399610, screenObjects[regobj.depth - 1], 892, 319);
+ readBitmap(1399610, screenLayers[regobj.depth - 1], 892, 319);
currentRoomData->screenLayers[0].bitmapPointer = 1399610;
currentRoomData->screenLayers[0].bitmapSize = 892;
currentRoomData->screenLayers[0].coordx = 217;
@@ -1831,7 +1813,7 @@ void pickupScreenObject() {
niche[0][3] -= 1;
currentRoomData->screenObjectIndex[8]->objectName = " ";
animatePickup1(0, 1);
- readBitmap(1399610, screenObjects[0], 892, 319);
+ readBitmap(1399610, screenLayers[0], 892, 319);
restoreBackground();
assembleScreen();
drawScreen(sceneBackground);
@@ -1890,7 +1872,7 @@ void pickupScreenObject() {
with.coordy = 0;
with.depth = 0;
}
- screenObjects[3] = NULL;
+ screenLayers[3] = NULL;
disableSecondAnimation();
drawScreen(sceneBackground);
animatePickup2(2, 1);
@@ -1898,12 +1880,12 @@ void pickupScreenObject() {
isTrapSet = false;
} break;
default: {
- animatePickup1(characterFacingDir, 1);
- screenObjects[regobj.depth - 1] = NULL;
+ animatePickup1(charFacingDirection, 1);
+ screenLayers[regobj.depth - 1] = NULL;
restoreBackground();
assembleScreen();
drawScreen(sceneBackground);
- animatePickup2(characterFacingDir, 1);
+ animatePickup2(charFacingDirection, 1);
}
}
} break;
@@ -1911,17 +1893,13 @@ void pickupScreenObject() {
switch (regobj.code) {
case 216: { // chisel
animatePickup1(0, 2);
- currentRoomData->screenObjectIndex[currentRoomData->mouseGrid
- [mouseX][mouseY]]
- ->fileIndex = regobj.replaceWith;
+ currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[mouseX][mouseY]]->fileIndex = regobj.replaceWith;
updateVideo();
animatePickup2(0, 2);
} break;
case 295: { // candles
animatePickup1(3, 2);
- currentRoomData->screenObjectIndex[currentRoomData->mouseGrid
- [mouseX][mouseY]]
- ->fileIndex = regobj.replaceWith;
+ currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[mouseX][mouseY]]->fileIndex = regobj.replaceWith;
updateVideo();
animatePickup2(3, 2);
} break;
@@ -1935,7 +1913,7 @@ void pickupScreenObject() {
} break;
case 659: { // spider web, puts bird and ring on the floor
animatePickup1(3, 2);
- screenObjects[regobj.depth - 1] = NULL;
+ screenLayers[regobj.depth - 1] = NULL;
{ // bird
RoomBitmapRegister &with = currentRoomData->screenLayers[2];
@@ -1962,11 +1940,11 @@ void pickupScreenObject() {
animatePickup2(3, 2);
} break;
default: {
- animatePickup1(characterFacingDir, 2);
- screenObjects[regobj.depth - 1] = NULL;
+ animatePickup1(charFacingDirection, 2);
+ screenLayers[regobj.depth - 1] = NULL;
assembleScreen();
drawScreen(sceneBackground);
- animatePickup2(characterFacingDir, 2);
+ animatePickup2(charFacingDirection, 2);
}
}
} break;
@@ -1989,10 +1967,10 @@ void pickupScreenObject() {
g_engine->_mouseManager->show();
if (regobj.code != 624)
- for (indicey = regobj.yrej1; indicey <= regobj.yrej2; indicey++)
- for (indicex = regobj.xrej1; indicex <= regobj.xrej2; indicex++) {
- currentRoomData->walkAreasGrid[indicex][indicey] = regobj.walkAreasPatch[indicex - regobj.xrej1][indicey - regobj.yrej1];
- currentRoomData->mouseGrid[indicex][indicey] = regobj.mouseGridPatch[indicex - regobj.xrej1][indicey - regobj.yrej1];
+ for (int j = regobj.yrej1; j <= regobj.yrej2; j++)
+ for (int i = regobj.xrej1; i <= regobj.xrej2; i++) {
+ currentRoomData->walkAreasGrid[i][j] = regobj.walkAreasPatch[i - regobj.xrej1][j - regobj.yrej1];
+ currentRoomData->mouseGrid[i][j] = regobj.mouseGridPatch[i - regobj.xrej1][j - regobj.yrej1];
}
switch (regobj.code) {
case 216: { // chisel
@@ -2040,14 +2018,14 @@ void pickupScreenObject() {
case 624:; // red devil
break;
default: {
- for (indicex = 0; indicex < 15; indicex++)
- if (currentRoomData->screenLayers[indicex].bitmapPointer ==
+ for (int i = 0; i < 15; i++)
+ if (currentRoomData->screenLayers[i].bitmapPointer ==
regobj.bitmapPointer) {
- currentRoomData->screenLayers[indicex].bitmapPointer = 0;
- currentRoomData->screenLayers[indicex].bitmapSize = 0;
- currentRoomData->screenLayers[indicex].coordx = 0;
- currentRoomData->screenLayers[indicex].coordy = 0;
- currentRoomData->screenLayers[indicex].depth = 0;
+ currentRoomData->screenLayers[i].bitmapPointer = 0;
+ currentRoomData->screenLayers[i].bitmapSize = 0;
+ currentRoomData->screenLayers[i].coordx = 0;
+ currentRoomData->screenLayers[i].coordy = 0;
+ currentRoomData->screenLayers[i].depth = 0;
}
}
}
@@ -2060,15 +2038,15 @@ void pickupScreenObject() {
checkMouseGrid();
return;
}
- indicemochila = 0;
+ inventoryIndex = 0;
- while (mobj[indicemochila].code != 0) {
- indicemochila += 1;
+ while (mobj[inventoryIndex].code != 0) {
+ inventoryIndex += 1;
}
- mobj[indicemochila].bitmapIndex = regobj.objectIconBitmap;
- mobj[indicemochila].code = regobj.code;
- mobj[indicemochila].objectName = regobj.name;
+ mobj[inventoryIndex].bitmapIndex = regobj.objectIconBitmap;
+ mobj[inventoryIndex].code = regobj.code;
+ mobj[inventoryIndex].objectName = regobj.name;
g_engine->_mouseManager->hide();
drawBackpack();
g_engine->_mouseManager->show();
@@ -2080,25 +2058,25 @@ void pickupScreenObject() {
checkMouseGrid();
}
-void replaceBackpack(byte indicador1, uint indicador2) {
- readItemRegister(indicador2);
- mobj[indicador1].bitmapIndex = regobj.objectIconBitmap;
- mobj[indicador1].code = indicador2;
- mobj[indicador1].objectName = regobj.name;
- contadorpc = contadorpc2;
+void replaceBackpack(byte obj1, uint obj2) {
+ readItemRegister(obj2);
+ mobj[obj1].bitmapIndex = regobj.objectIconBitmap;
+ mobj[obj1].code = obj2;
+ mobj[obj1].objectName = regobj.name;
+ cpCounter = cpCounter2;
}
void dropObjectInScreen(ScreenObject replacementObject) {
- byte indicepaso, indicex, indicey;
+ byte objIndex;
if (replacementObject.bitmapSize > 0) {
- indicepaso = 0;
- while (!(currentRoomData->screenLayers[indicepaso].bitmapSize == 0) || indicepaso == 15) {
- indicepaso++;
+ objIndex = 0;
+ while (!(currentRoomData->screenLayers[objIndex].bitmapSize == 0) || objIndex == 15) {
+ objIndex++;
}
- if (currentRoomData->screenLayers[indicepaso].bitmapSize == 0) {
+ if (currentRoomData->screenLayers[objIndex].bitmapSize == 0) {
{
- RoomBitmapRegister &with = currentRoomData->screenLayers[indicepaso];
+ RoomBitmapRegister &with = currentRoomData->screenLayers[objIndex];
with.bitmapPointer = replacementObject.bitmapPointer;
with.bitmapSize = replacementObject.bitmapSize;
@@ -2107,10 +2085,10 @@ void dropObjectInScreen(ScreenObject replacementObject) {
with.depth = replacementObject.depth;
loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
- for (indicey = replacementObject.yrej1; indicey <= replacementObject.yrej2; indicey++)
- for (indicex = replacementObject.xrej1; indicex <= replacementObject.xrej2; indicex++) {
- currentRoomData->walkAreasGrid[indicex][indicey] = replacementObject.walkAreasPatch[indicex - replacementObject.xrej1][indicey - replacementObject.yrej1];
- currentRoomData->mouseGrid[indicex][indicey] = replacementObject.mouseGridPatch[indicex - replacementObject.xrej1][indicey - replacementObject.yrej1];
+ for (int j = replacementObject.yrej1; j <= replacementObject.yrej2; j++)
+ for (int i = replacementObject.xrej1; i <= replacementObject.xrej2; i++) {
+ currentRoomData->walkAreasGrid[i][j] = replacementObject.walkAreasPatch[i - replacementObject.xrej1][j - replacementObject.yrej1];
+ currentRoomData->mouseGrid[i][j] = replacementObject.mouseGridPatch[i - replacementObject.xrej1][j - replacementObject.yrej1];
}
} else
showError(264);
@@ -2118,27 +2096,27 @@ void dropObjectInScreen(ScreenObject replacementObject) {
}
void useScreenObject() {
- byte indicemochila, indlista, aciertoslista, indmoch,
- indicex, indicey;
- bool controlarlista, basurillalog;
+ byte usedObjectIndex,
+ listIndex, invIndex;
+ bool verifyList, foobar;
uint mouseX = (mouseClickX + 7) / xGridCount;
uint mouseY = (mouseClickY + 7) / yGridCount;
- uint screenObject = currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[mouseX][mouseY]]->fileIndex;
+ uint sceneObject = currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[mouseX][mouseY]]->fileIndex;
- if (inventoryObjectName != "") {
- indicemochila = 0;
- while (mobj[indicemochila].objectName != inventoryObjectName) {
- indicemochila += 1;
+ if (inventoryObjectName != "") { //Use inv object with something on the scene
+ usedObjectIndex = 0;
+ while (mobj[usedObjectIndex].objectName != inventoryObjectName) {
+ usedObjectIndex += 1;
}
- readItemRegister(mobj[indicemochila].code);
+ readItemRegister(mobj[usedObjectIndex].code);
goToObject(
currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount],
currentRoomData->walkAreasGrid[mouseX][mouseY]);
- if (regobj.useWith == screenObject && screenObject > 0 && regobj.used[0] == 5) {
+ if (regobj.useWith == sceneObject && sceneObject > 0 && regobj.used[0] == 5) {
switch (regobj.useWith) {
case 30: { // corn with rooster
drawText(regobj.useTextRef);
@@ -2163,16 +2141,16 @@ void useScreenObject() {
secondaryAnimation.posx = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].x;
secondaryAnimation.posy = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].y;
emptyLoop();
- tocapintar = false;
+ timeToDraw = false;
emptyLoop2();
sprites(true);
g_engine->_screen->update();
} while (currentSecondaryTrajectoryIndex != 4);
- for (indlista = 0; indlista < maxXGrid; indlista++)
- for (indmoch = 0; indmoch < maxYGrid; indmoch++) {
- currentRoomData->walkAreasGrid[oldposx + indlista][oldposy + indmoch] = movementGridForSecondaryAnim[indlista][indmoch];
- currentRoomData->mouseGrid[oldposx + indlista][oldposy + indmoch] = mouseGridForSecondaryAnim[indlista][indmoch];
+ for (listIndex = 0; listIndex < maxXGrid; listIndex++)
+ for (invIndex = 0; invIndex < maxYGrid; invIndex++) {
+ currentRoomData->walkAreasGrid[oldposx + listIndex][oldposy + invIndex] = movementGridForSecondaryAnim[listIndex][invIndex];
+ currentRoomData->mouseGrid[oldposx + listIndex][oldposy + invIndex] = mouseGridForSecondaryAnim[listIndex][invIndex];
}
freeAnimation();
@@ -2187,12 +2165,12 @@ void useScreenObject() {
currentSecondaryTrajectoryIndex = 1;
currentRoomData->secondaryTrajectoryLength = 1;
- for (indlista = 0; indlista < maxXGrid; indlista++)
- for (indmoch = 0; indmoch < maxYGrid; indmoch++) {
- if (maskGridSecondaryAnim[indlista][indmoch] > 0)
- currentRoomData->walkAreasGrid[oldposx + indlista][oldposy + indmoch] = maskGridSecondaryAnim[indlista][indmoch];
- if (maskMouseSecondaryAnim[indlista][indmoch] > 0)
- currentRoomData->mouseGrid[oldposx + indlista][oldposy + indmoch] = maskMouseSecondaryAnim[indlista][indmoch];
+ for (listIndex = 0; listIndex < maxXGrid; listIndex++)
+ for (invIndex = 0; invIndex < maxYGrid; invIndex++) {
+ if (maskGridSecondaryAnim[listIndex][invIndex] > 0)
+ currentRoomData->walkAreasGrid[oldposx + listIndex][oldposy + invIndex] = maskGridSecondaryAnim[listIndex][invIndex];
+ if (maskMouseSecondaryAnim[listIndex][invIndex] > 0)
+ currentRoomData->mouseGrid[oldposx + listIndex][oldposy + invIndex] = maskMouseSecondaryAnim[listIndex][invIndex];
}
g_engine->_mouseManager->show();
} break;
@@ -2207,24 +2185,25 @@ void useScreenObject() {
currentRoomData->screenObjectIndex[21]->fileIndex = 154;
} break;
case 157: { // giving something to john
- controlarlista = false;
- debug("used object = %d", mobj[indicemochila].code);
+ verifyList = false;
+ debug("used object = %d", mobj[usedObjectIndex].code);
if (obtainedList1) {
- for (indlista = 0; indlista < 5; indlista++) {
- if (mobj[indicemochila].code == firstList[indlista])
- controlarlista = true;
+ for (listIndex = 0; listIndex < 5; listIndex++) {
+ if (mobj[usedObjectIndex].code == firstList[listIndex])
+ verifyList = true;
}
- if (controlarlista) {
- aciertoslista = 0;
- for (indlista = 0; indlista < 5; indlista++) {
- for (indmoch = 0; indmoch < inventoryIconCount; indmoch++) {
- if (mobj[indmoch].code == firstList[indlista]) {
- aciertoslista += 1;
+
+ if (verifyList) {
+ int completedListItems = 0;
+ for (listIndex = 0; listIndex < 5; listIndex++) {
+ for (invIndex = 0; invIndex < inventoryIconCount; invIndex++) {
+ if (mobj[invIndex].code == firstList[listIndex]) {
+ completedListItems += 1;
break;
}
}
}
- if (aciertoslista == 5) {
+ if (completedListItems == 5) {
obtainedList1 = false;
list1Complete = true;
assignText();
@@ -2233,50 +2212,50 @@ void useScreenObject() {
verb.close();
g_engine->_mouseManager->hide();
- animateGive(characterFacingDir, 1);
- animateOpen2(characterFacingDir, 1);
- for (indlista = 0; indlista < 5; indlista++) {
- indmoch = 0;
- while (mobj[indmoch].code != firstList[indlista]) {
- indmoch += 1;
+ animateGive(charFacingDirection, 1);
+ animateOpen2(charFacingDirection, 1);
+ for (listIndex = 0; listIndex < 5; listIndex++) {
+ invIndex = 0;
+ while (mobj[invIndex].code != firstList[listIndex]) {
+ invIndex += 1;
}
- updateInventory(indmoch);
+ updateInventory(invIndex);
}
- indlista = 0;
- while (mobj[indlista].code != 149) {
- indlista += 1;
+ listIndex = 0;
+ while (mobj[listIndex].code != 149) {
+ listIndex += 1;
}
- updateInventory(indlista);
+ updateInventory(listIndex);
drawBackpack();
g_engine->_mouseManager->show();
} else {
assignText();
hypertext(regobj.useTextRef, 255, 0, foo, false);
g_engine->_mouseManager->hide();
- animateGive(characterFacingDir, 1);
- animateOpen2(characterFacingDir, 1);
+ animateGive(charFacingDirection, 1);
+ animateOpen2(charFacingDirection, 1);
g_engine->_mouseManager->show();
hypertext(foo, 253, 249, foo, true);
verb.close();
}
}
}
- controlarlista = false;
+ verifyList = false;
if (obtainedList2) {
- for (indlista = 0; indlista < 5; indlista++)
- if (mobj[indicemochila].code == secondList[indlista])
- controlarlista = true;
- if (controlarlista) {
- aciertoslista = 0;
- for (indlista = 0; indlista < 5; indlista++) {
- for (indmoch = 0; indmoch <= inventoryIconCount; indmoch++) {
- if (mobj[indmoch].code == secondList[indlista]) {
- aciertoslista += 1;
+ for (listIndex = 0; listIndex < 5; listIndex++)
+ if (mobj[usedObjectIndex].code == secondList[listIndex])
+ verifyList = true;
+ if (verifyList) {
+ int completedListItems = 0;
+ for (listIndex = 0; listIndex < 5; listIndex++) {
+ for (invIndex = 0; invIndex <= inventoryIconCount; invIndex++) {
+ if (mobj[invIndex].code == secondList[listIndex]) {
+ completedListItems += 1;
break;
}
}
}
- if (aciertoslista == 5) {
+ if (completedListItems == 5) {
obtainedList2 = false;
list2Complete = true;
assignText();
@@ -2284,28 +2263,28 @@ void useScreenObject() {
hypertext(foo, 253, 249, foo, true);
verb.close();
g_engine->_mouseManager->hide();
- animateGive(characterFacingDir, 1);
- animateOpen2(characterFacingDir, 1);
- for (indlista = 0; indlista < 5; indlista++) {
- indmoch = 0;
- while (mobj[indmoch].code != secondList[indlista]) {
- indmoch += 1;
+ animateGive(charFacingDirection, 1);
+ animateOpen2(charFacingDirection, 1);
+ for (listIndex = 0; listIndex < 5; listIndex++) {
+ invIndex = 0;
+ while (mobj[invIndex].code != secondList[listIndex]) {
+ invIndex += 1;
}
- updateInventory(indmoch);
+ updateInventory(invIndex);
}
- indlista = 0;
- while (mobj[indlista].code != 150) {
- indlista += 1;
+ listIndex = 0;
+ while (mobj[listIndex].code != 150) {
+ listIndex += 1;
}
- updateInventory(indlista);
+ updateInventory(listIndex);
drawBackpack();
g_engine->_mouseManager->show();
} else {
assignText();
hypertext(regobj.useTextRef, 255, 0, foo, false);
g_engine->_mouseManager->hide();
- animateGive(characterFacingDir, 1);
- animateOpen2(characterFacingDir, 1);
+ animateGive(charFacingDirection, 1);
+ animateOpen2(charFacingDirection, 1);
g_engine->_mouseManager->show();
hypertext(foo, 253, 249, foo, true);
verb.close();
@@ -2319,8 +2298,8 @@ void useScreenObject() {
assignText();
hypertext(1118, 255, 0, foo, false);
g_engine->_mouseManager->hide();
- animateGive(characterFacingDir, 1);
- animateOpen2(characterFacingDir, 1);
+ animateGive(charFacingDirection, 1);
+ animateOpen2(charFacingDirection, 1);
g_engine->_mouseManager->show();
hypertext(foo, 253, 249, foo, true);
verb.close();
@@ -2329,13 +2308,13 @@ void useScreenObject() {
assignText();
hypertext(687, 255, 0, foo, false);
g_engine->_mouseManager->hide();
- animateGive(characterFacingDir, 1);
- animateOpen2(characterFacingDir, 1);
+ animateGive(charFacingDirection, 1);
+ animateOpen2(charFacingDirection, 1);
g_engine->_mouseManager->show();
hypertext(foo, 253, 249, foo, true);
verb.close();
g_engine->_mouseManager->hide();
- updateInventory(indicemochila);
+ updateInventory(usedObjectIndex);
drawBackpack();
g_engine->_mouseManager->show();
for (foo = 0; foo < characterCount; foo++)
@@ -2348,13 +2327,13 @@ void useScreenObject() {
assignText();
hypertext(2466, 255, 0, foo, false);
g_engine->_mouseManager->hide();
- animateGive(characterFacingDir, 1);
- animateOpen2(characterFacingDir, 1);
+ animateGive(charFacingDirection, 1);
+ animateOpen2(charFacingDirection, 1);
g_engine->_mouseManager->show();
hypertext(foo, 253, 249, foo, true);
verb.close();
g_engine->_mouseManager->hide();
- updateInventory(indicemochila);
+ updateInventory(usedObjectIndex);
drawBackpack();
g_engine->_mouseManager->show();
for (foo = 0; foo < characterCount; foo++) {
@@ -2378,7 +2357,7 @@ void useScreenObject() {
hypertext(3247, 253, 249, foo, true);
verb.close();
g_engine->_mouseManager->hide();
- replaceBackpack(indicemochila, 676);
+ replaceBackpack(usedObjectIndex, 676);
drawBackpack();
disableSecondAnimation();
{
@@ -2404,7 +2383,7 @@ void useScreenObject() {
hypertext(3246, 253, 249, foo, true);
verb.close();
g_engine->_mouseManager->hide();
- updateInventory(indicemochila);
+ updateInventory(usedObjectIndex);
drawBackpack();
g_engine->_mouseManager->show();
}
@@ -2423,7 +2402,7 @@ void useScreenObject() {
hypertext(3247, 253, 249, foo, true);
verb.close();
g_engine->_mouseManager->hide();
- replaceBackpack(indicemochila, 676);
+ replaceBackpack(usedObjectIndex, 676);
drawBackpack();
disableSecondAnimation();
{
@@ -2449,7 +2428,7 @@ void useScreenObject() {
hypertext(3246, 253, 249, foo, true);
verb.close();
g_engine->_mouseManager->hide();
- updateInventory(indicemochila);
+ updateInventory(usedObjectIndex);
drawBackpack();
g_engine->_mouseManager->show();
}
@@ -2468,7 +2447,7 @@ void useScreenObject() {
hypertext(3247, 253, 249, foo, true);
verb.close();
g_engine->_mouseManager->hide();
- replaceBackpack(indicemochila, 676);
+ replaceBackpack(usedObjectIndex, 676);
drawBackpack();
disableSecondAnimation();
{
@@ -2494,7 +2473,7 @@ void useScreenObject() {
hypertext(3246, 253, 249, foo, true);
verb.close();
g_engine->_mouseManager->hide();
- updateInventory(indicemochila);
+ updateInventory(usedObjectIndex);
drawBackpack();
g_engine->_mouseManager->show();
}
@@ -2513,7 +2492,7 @@ void useScreenObject() {
hypertext(3247, 253, 249, foo, true);
verb.close();
g_engine->_mouseManager->hide();
- replaceBackpack(indicemochila, 676);
+ replaceBackpack(usedObjectIndex, 676);
drawBackpack();
disableSecondAnimation();
{
@@ -2539,7 +2518,7 @@ void useScreenObject() {
hypertext(3246, 253, 249, foo, true);
verb.close();
g_engine->_mouseManager->hide();
- updateInventory(indicemochila);
+ updateInventory(usedObjectIndex);
drawBackpack();
g_engine->_mouseManager->show();
}
@@ -2562,13 +2541,13 @@ void useScreenObject() {
secondaryAnimation.posx = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].x;
secondaryAnimation.posy = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].y;
emptyLoop();
- tocapintar = false;
+ timeToDraw = false;
emptyLoop2();
sprites(true);
} while (!(currentSecondaryTrajectoryIndex == (currentRoomData->secondaryTrajectoryLength / 2)));
animateGive(3, 2);
- updateInventory(indicemochila);
+ updateInventory(usedObjectIndex);
drawBackpack();
animateOpen2(3, 2);
animatedSequence(6);
@@ -2586,7 +2565,7 @@ void useScreenObject() {
secondaryAnimation.posx = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].x;
secondaryAnimation.posy = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].y;
emptyLoop();
- tocapintar = false;
+ timeToDraw = false;
emptyLoop2();
sprites(true);
@@ -2600,7 +2579,7 @@ void useScreenObject() {
g_engine->_sound->playVoc("GALLO", 94965, 46007);
g_engine->_mouseManager->hide();
animatedSequence(5);
- replaceBackpack(indicemochila, 423);
+ replaceBackpack(usedObjectIndex, 423);
drawBackpack();
g_engine->_mouseManager->show();
actionCode = 0;
@@ -2615,17 +2594,17 @@ void useScreenObject() {
animateGive(3, 2);
do {
g_engine->_chrono->updateChrono();
- if (tocapintar) {
- if (saltospal >= 4) {
- saltospal = 0;
+ if (timeToDraw) {
+ if (palAnimStep >= 4) {
+ palAnimStep = 0;
if (isPaletteAnimEnabled > 6)
isPaletteAnimEnabled = 0;
else
isPaletteAnimEnabled += 1;
updatePalette(isPaletteAnimEnabled);
} else
- saltospal += 1;
- tocapintar = false;
+ palAnimStep += 1;
+ timeToDraw = false;
}
g_engine->_screen->update();
g_system->delayMillis(10);
@@ -2638,29 +2617,29 @@ void useScreenObject() {
drawText(2652);
g_engine->_mouseManager->hide();
readItemRegister(536);
- for (indicex = 12; indicex <= 13; indicex++)
- for (indicey = 7; indicey <= 14; indicey++)
- currentRoomData->mouseGrid[indicex][indicey] = 14;
- for (indicey = 8; indicey <= 12; indicey++)
- currentRoomData->mouseGrid[14][indicey] = 14;
+ for (int i = 12; i <= 13; i++)
+ for (int j = 7; j <= 14; j++)
+ currentRoomData->mouseGrid[i][j] = 14;
+ for (int i = 8; i <= 12; i++)
+ currentRoomData->mouseGrid[14][i] = 14;
currentRoomData->mouseGrid[9][10] = 1;
currentRoomData->mouseGrid[10][10] = 1;
- for (indicex = 0; indicex < 15; indicex++)
- if (currentRoomData->screenLayers[indicex].bitmapPointer ==
+ for (int i = 0; i < 15; i++)
+ if (currentRoomData->screenLayers[i].bitmapPointer ==
regobj.bitmapPointer) {
- currentRoomData->screenLayers[indicex].bitmapPointer = 0;
- currentRoomData->screenLayers[indicex].bitmapSize = 0;
- currentRoomData->screenLayers[indicex].coordx = 0;
- currentRoomData->screenLayers[indicex].coordy = 0;
- currentRoomData->screenLayers[indicex].depth = 0;
+ currentRoomData->screenLayers[i].bitmapPointer = 0;
+ currentRoomData->screenLayers[i].bitmapSize = 0;
+ currentRoomData->screenLayers[i].coordx = 0;
+ currentRoomData->screenLayers[i].coordy = 0;
+ currentRoomData->screenLayers[i].depth = 0;
}
- indicemochila = 0;
- while (mobj[indicemochila].code != 0) {
- indicemochila += 1;
+ usedObjectIndex = 0;
+ while (mobj[usedObjectIndex].code != 0) {
+ usedObjectIndex += 1;
}
- mobj[indicemochila].bitmapIndex = regobj.objectIconBitmap;
- mobj[indicemochila].code = regobj.code;
- mobj[indicemochila].objectName = regobj.name;
+ mobj[usedObjectIndex].bitmapIndex = regobj.objectIconBitmap;
+ mobj[usedObjectIndex].code = regobj.code;
+ mobj[usedObjectIndex].objectName = regobj.name;
animatedSequence(4);
g_engine->_mouseManager->show();
actionCode = 0;
@@ -2671,18 +2650,18 @@ void useScreenObject() {
case 221: {
drawText(regobj.useTextRef);
regobj.used[0] = 9;
- indicemochila = 0;
- while (mobj[indicemochila].code != 0) {
- indicemochila += 1;
+ usedObjectIndex = 0;
+ while (mobj[usedObjectIndex].code != 0) {
+ usedObjectIndex += 1;
}
invItemData->seek(regobj.code);
saveItem(regobj, invItemData);
readItemRegister(invItemData, 221, regobj);
- mobj[indicemochila].bitmapIndex = regobj.objectIconBitmap;
- mobj[indicemochila].code = regobj.code;
- mobj[indicemochila].objectName = regobj.name;
+ mobj[usedObjectIndex].bitmapIndex = regobj.objectIconBitmap;
+ mobj[usedObjectIndex].code = regobj.code;
+ mobj[usedObjectIndex].objectName = regobj.name;
g_engine->_mouseManager->hide();
animatePickup1(2, 0);
@@ -2699,19 +2678,19 @@ void useScreenObject() {
animatePickup1(0, 2);
g_engine->_sound->waitForSoundEnd();
animateOpen2(0, 2);
- replaceBackpack(indicemochila, 453);
+ replaceBackpack(usedObjectIndex, 453);
drawBackpack();
g_engine->_mouseManager->show();
- updateItem(mobj[indicemochila].code);
+ updateItem(mobj[usedObjectIndex].code);
isCupboardOpen = true;
} break;
case 274: {
drawText(regobj.useTextRef);
g_engine->_mouseManager->hide();
g_engine->_sound->playVoc("CINCEL", 334779, 19490);
- animatePickup1(characterFacingDir, 2);
+ animatePickup1(charFacingDirection, 2);
g_engine->_sound->waitForSoundEnd();
- animateOpen2(characterFacingDir, 2);
+ animateOpen2(charFacingDirection, 2);
g_engine->_mouseManager->show();
updateItem(regobj.code);
isChestOpen = true;
@@ -2734,7 +2713,7 @@ void useScreenObject() {
animateGive(0, 2);
g_engine->_sound->waitForSoundEnd();
animatePickup2(0, 2);
- replaceBackpack(indicemochila, 204);
+ replaceBackpack(usedObjectIndex, 204);
drawBackpack();
g_engine->_mouseManager->show();
} break;
@@ -2743,7 +2722,7 @@ void useScreenObject() {
animatePickup1(0, 1);
g_engine->_sound->playVoc("MAQUINA", 153470, 7378);
animateOpen2(0, 1);
- updateInventory(indicemochila);
+ updateInventory(usedObjectIndex);
drawBackpack();
g_engine->_mouseManager->show();
currentRoomData->mouseGrid[27][8] = 22;
@@ -2758,7 +2737,7 @@ void useScreenObject() {
drawText(regobj.useTextRef);
currentRoomData->doors[0].openclosed = 0;
} break;
- case 562: { // put any object in the alcoves
+ case 562: { // put any object in the niches
switch (currentRoomData->code) {
case 20: {
if (niche[0][niche[0][3]] == 0) {
@@ -2772,12 +2751,12 @@ void useScreenObject() {
switch (niche[0][0]) {
case 561: {
currentRoomData->screenObjectIndex[9]->objectName = getObjectName(5);
- readBitmap(1182652, screenObjects[0], 892, 319);
+ readBitmap(1182652, screenLayers[0], 892, 319);
currentRoomData->screenLayers[1].bitmapPointer = 1182652;
} break;
case 615: {
currentRoomData->screenObjectIndex[9]->objectName = getObjectName(7);
- readBitmap(1181760, screenObjects[0], 892, 319);
+ readBitmap(1181760, screenLayers[0], 892, 319);
currentRoomData->screenLayers[1].bitmapPointer = 1181760;
} break;
}
@@ -2786,11 +2765,10 @@ void useScreenObject() {
currentRoomData->screenLayers[1].coordy = 35;
currentRoomData->screenLayers[1].depth = 1;
restoreBackground();
- // XMStoPointer(ptr(segfondo, (offfondo + 4)), _handpantalla, 4, (sizepantalla - int32(4)));
assembleScreen();
drawScreen(sceneBackground);
animateOpen2(3, 1);
- updateInventory(indicemochila);
+ updateInventory(usedObjectIndex);
drawBackpack();
g_engine->_mouseManager->show();
} else {
@@ -2803,17 +2781,17 @@ void useScreenObject() {
animateGive(3, 1);
switch (regobj.code) {
case 561:
- readBitmap(1182652, screenObjects[0], 892, 319);
+ readBitmap(1182652, screenLayers[0], 892, 319);
break;
case 615:
- readBitmap(1181760, screenObjects[0], 892, 319);
+ readBitmap(1181760, screenLayers[0], 892, 319);
break;
}
restoreBackground();
assembleScreen();
drawScreen(sceneBackground);
animateOpen2(3, 1);
- updateInventory(indicemochila);
+ updateInventory(usedObjectIndex);
drawBackpack();
currentRoomData->screenObjectIndex[9]->objectName = " ";
g_engine->_sound->playVoc("PLATAF", 375907, 14724);
@@ -2863,12 +2841,12 @@ void useScreenObject() {
switch (niche[1][0]) {
case 561: {
currentRoomData->screenObjectIndex[8]->objectName = getObjectName(5);
- readBitmap(1381982, screenObjects[0], 892, 319);
+ readBitmap(1381982, screenLayers[0], 892, 319);
currentRoomData->screenLayers[0].bitmapPointer = 1381982;
} break;
case 615: {
currentRoomData->screenObjectIndex[8]->objectName = getObjectName(7);
- readBitmap(1381090, screenObjects[0], 892, 319);
+ readBitmap(1381090, screenLayers[0], 892, 319);
currentRoomData->screenLayers[0].bitmapPointer = 1381090;
} break;
}
@@ -2877,11 +2855,10 @@ void useScreenObject() {
currentRoomData->screenLayers[0].coordy = 48;
currentRoomData->screenLayers[0].depth = 1;
restoreBackground();
- // XMStoPointer(ptr(segfondo, (offfondo + 4)), _handpantalla, 4, (sizepantalla - int32(4)));
assembleScreen();
drawScreen(sceneBackground);
animateOpen2(0, 1);
- updateInventory(indicemochila);
+ updateInventory(usedObjectIndex);
drawBackpack();
g_engine->_mouseManager->show();
} else {
@@ -2895,20 +2872,19 @@ void useScreenObject() {
switch (regobj.code) {
case 561:
- readBitmap(1381982, screenObjects[regobj.depth - 1],
+ readBitmap(1381982, screenLayers[regobj.depth - 1],
892, 319);
break;
case 615:
- readBitmap(1381090, screenObjects[regobj.depth - 1],
+ readBitmap(1381090, screenLayers[regobj.depth - 1],
892, 319);
break;
}
restoreBackground();
- // XMStoPointer(ptr(segfondo, (offfondo + 4)), _handpantalla, 4, (sizepantalla - int32(4)));
assembleScreen();
drawScreen(sceneBackground);
animateOpen2(0, 1);
- updateInventory(indicemochila);
+ updateInventory(usedObjectIndex);
drawBackpack();
currentRoomData->screenObjectIndex[8]->objectName = " ";
g_engine->_sound->playVoc("PLATAF", 375907, 14724);
@@ -2958,15 +2934,15 @@ void useScreenObject() {
drawText(regobj.useTextRef);
g_engine->_mouseManager->hide();
- drawFlc(140, 34, offset, 0, 9, 24, false, false, true, basurillalog);
+ drawFlc(140, 34, offset, 0, 9, 24, false, false, true, foobar);
g_engine->_mouseManager->show();
updateItem(regobj.code);
currentRoomData->screenObjectIndex[7]->fileIndex = 716;
currentRoomData->mouseGrid[19][9] = 14;
currentRoomData->mouseGrid[22][16] = 15;
- for (indlista = 21; indlista <= 22; indlista++)
- for (indmoch = 17; indmoch <= 20; indmoch++)
- currentRoomData->mouseGrid[indlista][indmoch] = 17;
+ for (listIndex = 21; listIndex <= 22; listIndex++)
+ for (invIndex = 17; invIndex <= 20; invIndex++)
+ currentRoomData->mouseGrid[listIndex][invIndex] = 17;
{
RoomBitmapRegister &with = currentRoomData->screenLayers[0];
@@ -2996,7 +2972,7 @@ void useScreenObject() {
with.depth = 1;
loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
- readBitmap(1243652, screenObjects[5], 2718, 319);
+ readBitmap(1243652, screenLayers[5], 2718, 319);
restoreBackground();
assembleScreen();
drawScreen(sceneBackground);
@@ -3006,7 +2982,7 @@ void useScreenObject() {
g_engine->_mouseManager->hide();
animateGive(3, 2);
animatePickup2(3, 2);
- replaceBackpack(indicemochila, 607);
+ replaceBackpack(usedObjectIndex, 607);
drawBackpack();
g_engine->_mouseManager->show();
} break;
@@ -3027,10 +3003,9 @@ void useScreenObject() {
loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
restoreBackground();
- // XMStoPointer(ptr(segfondo, (offfondo + 4)), _handpantalla, 4,(sizepantalla - int32(4)));
assembleScreen();
drawScreen(sceneBackground);
- updateInventory(indicemochila);
+ updateInventory(usedObjectIndex);
drawBackpack();
isTrapSet = true;
g_engine->_mouseManager->show();
@@ -3039,7 +3014,7 @@ void useScreenObject() {
long offset = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0][21] : flcOffsets[1][21];
drawText(regobj.useTextRef);
g_engine->_mouseManager->hide();
- animateGive(characterFacingDir, 1);
+ animateGive(charFacingDirection, 1);
// Show feather on pedestal
loadItem(187, 70, 104, 1545820, 8);
@@ -3048,14 +3023,14 @@ void useScreenObject() {
drawScreen(sceneBackground);
g_engine->_screen->update();
- animateOpen2(characterFacingDir, 1);
+ animateOpen2(charFacingDirection, 1);
g_engine->_mouseManager->show();
goToObject(currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount], 14);
g_engine->_mouseManager->hide();
g_engine->_sound->playVoc("PUFF", 191183, 18001);
// Animate to scythe
debug("Start anim!");
- drawFlc(180, 60, offset, 0, 9, 0, false, false, true, basurillalog);
+ drawFlc(180, 60, offset, 0, 9, 0, false, false, true, foobar);
debug("End Anim!");
// load Scythe
currentRoomData->screenLayers[2].bitmapPointer = 1545820;
@@ -3064,7 +3039,7 @@ void useScreenObject() {
currentRoomData->screenLayers[2].coordy = 104;
currentRoomData->screenLayers[2].depth = 1;
depthMap[0].posy = 104;
- readBitmap(1545820, screenObjects[0], 104, 319);
+ readBitmap(1545820, screenLayers[0], 104, 319);
currentRoomData->screenLayers[4].bitmapPointer = 1447508;
currentRoomData->screenLayers[4].bitmapSize = 464;
@@ -3080,22 +3055,22 @@ void useScreenObject() {
goToObject(currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount], 18);
g_engine->_mouseManager->hide();
animatePickup1(1, 1);
- replaceBackpack(indicemochila, 638);
+ replaceBackpack(usedObjectIndex, 638);
currentRoomData->screenLayers[4].bitmapPointer = 0;
currentRoomData->screenLayers[4].bitmapSize = 0;
currentRoomData->screenLayers[4].coordx = 0;
currentRoomData->screenLayers[4].coordy = 0;
currentRoomData->screenLayers[4].depth = 0;
- screenObjects[7] = NULL;
+ screenLayers[7] = NULL;
restoreBackground();
assembleScreen();
drawScreen(sceneBackground);
animatePickup2(1, 1);
drawBackpack();
g_engine->_mouseManager->show();
- for (indlista = 35; indlista <= 37; indlista++)
- for (indmoch = 21; indmoch <= 25; indmoch++)
- currentRoomData->mouseGrid[indlista][indmoch] = 11;
+ for (listIndex = 35; listIndex <= 37; listIndex++)
+ for (invIndex = 21; invIndex <= 25; invIndex++)
+ currentRoomData->mouseGrid[listIndex][invIndex] = 11;
isScytheTaken = true;
if (isTridentTaken)
caves[3] = true;
@@ -3115,7 +3090,7 @@ void useScreenObject() {
goToObject(currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount], 10);
g_engine->_mouseManager->hide();
g_engine->_sound->playVoc("PUFF", 191183, 18001);
- drawFlc(0, 47, offset, 0, 9, 0, false, false, true, basurillalog);
+ drawFlc(0, 47, offset, 0, 9, 0, false, false, true, foobar);
currentRoomData->screenLayers[3].bitmapPointer = 1591272;
currentRoomData->screenLayers[3].bitmapSize = 92;
@@ -3124,7 +3099,7 @@ void useScreenObject() {
currentRoomData->screenLayers[3].depth = 3;
depthMap[2].posx = 18;
depthMap[2].posy = 60;
- readBitmap(1591272, screenObjects[2], 92, 319);
+ readBitmap(1591272, screenLayers[2], 92, 319);
currentRoomData->screenLayers[4].bitmapPointer = 1746554;
currentRoomData->screenLayers[4].bitmapSize = 384;
@@ -3138,22 +3113,22 @@ void useScreenObject() {
goToObject(currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount], 15);
g_engine->_mouseManager->hide();
animatePickup1(3, 1);
- replaceBackpack(indicemochila, 637);
+ replaceBackpack(usedObjectIndex, 637);
currentRoomData->screenLayers[4].bitmapPointer = 0;
currentRoomData->screenLayers[4].bitmapSize = 0;
currentRoomData->screenLayers[4].coordx = 0;
currentRoomData->screenLayers[4].coordy = 0;
currentRoomData->screenLayers[4].depth = 0;
- screenObjects[7] = NULL;
+ screenLayers[7] = NULL;
restoreBackground();
assembleScreen();
drawScreen(sceneBackground);
animatePickup2(3, 1);
drawBackpack();
g_engine->_mouseManager->show();
- for (indlista = 0; indlista <= 2; indlista++)
- for (indmoch = 10; indmoch <= 12; indmoch++)
- currentRoomData->mouseGrid[indlista][indmoch] = 10;
+ for (listIndex = 0; listIndex <= 2; listIndex++)
+ for (invIndex = 10; invIndex <= 12; invIndex++)
+ currentRoomData->mouseGrid[listIndex][invIndex] = 10;
isTridentTaken = true;
if (isScytheTaken)
caves[3] = true;
@@ -3167,9 +3142,9 @@ void useScreenObject() {
mouseClickY = 126 - 7;
goToObject(currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount], 5);
g_engine->_mouseManager->hide();
- updateInventory(indicemochila);
+ updateInventory(usedObjectIndex);
drawBackpack();
- drawFlc(133, 0, offset, 0, 9, 22, false, false, true, basurillalog);
+ drawFlc(133, 0, offset, 0, 9, 22, false, false, true, foobar);
{
RoomBitmapRegister &with = currentRoomData->screenLayers[2];
@@ -3181,9 +3156,9 @@ void useScreenObject() {
loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
updateAltScreen(31);
- for (indlista = 18; indlista <= 20; indlista++)
- for (indmoch = 8; indmoch <= 14; indmoch++)
- currentRoomData->mouseGrid[indlista][indmoch] = 12;
+ for (listIndex = 18; listIndex <= 20; listIndex++)
+ for (invIndex = 8; invIndex <= 14; invIndex++)
+ currentRoomData->mouseGrid[listIndex][invIndex] = 12;
isSealRemoved = true;
caves[1] = false;
caves[0] = false;
@@ -3199,8 +3174,8 @@ void useScreenObject() {
goToObject(currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount], 3);
g_engine->_mouseManager->hide();
g_engine->_sound->playVoc("AFILAR", 0, 6433);
- drawFlc(160, 15, offset, 0, 9, 23, false, false, true, basurillalog);
- replaceBackpack(indicemochila, 715);
+ drawFlc(160, 15, offset, 0, 9, 23, false, false, true, foobar);
+ replaceBackpack(usedObjectIndex, 715);
drawBackpack();
g_engine->_mouseManager->show();
} break;
@@ -3210,16 +3185,16 @@ void useScreenObject() {
caves[4] = false;
g_engine->_mouseManager->hide();
animateGive(1, 1);
- updateInventory(indicemochila);
+ updateInventory(usedObjectIndex);
dropObjectInScreen(regobj);
restoreBackground();
assembleScreen();
drawScreen(sceneBackground);
drawBackpack();
animateOpen2(1, 1);
- for (indlista = 19; indlista <= 21; indlista++)
- for (indmoch = 10; indmoch <= 13; indmoch++)
- currentRoomData->mouseGrid[indlista][indmoch] = 13;
+ for (listIndex = 19; listIndex <= 21; listIndex++)
+ for (invIndex = 10; invIndex <= 13; invIndex++)
+ currentRoomData->mouseGrid[listIndex][invIndex] = 13;
g_engine->_mouseManager->show();
} break;
case 689: { // rope
@@ -3230,17 +3205,17 @@ void useScreenObject() {
mouseClickY = 133 - 7;
goToObject(currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount], 9);
g_engine->_mouseManager->hide();
- drawFlc(110, 79, offset, 0, 9, 0, false, false, true, basurillalog);
- replaceBackpack(indicemochila, 701);
+ drawFlc(110, 79, offset, 0, 9, 0, false, false, true, foobar);
+ replaceBackpack(usedObjectIndex, 701);
drawBackpack();
restoreBackground();
assembleScreen();
drawScreen(sceneBackground);
g_engine->_mouseManager->show();
- for (indlista = 18; indlista <= 20; indlista++)
- currentRoomData->mouseGrid[indlista][26] = 10;
- for (indlista = 17; indlista <= 21; indlista++)
- currentRoomData->mouseGrid[indlista][27] = 10;
+ for (listIndex = 18; listIndex <= 20; listIndex++)
+ currentRoomData->mouseGrid[listIndex][26] = 10;
+ for (listIndex = 17; listIndex <= 21; listIndex++)
+ currentRoomData->mouseGrid[listIndex][27] = 10;
} break;
case 700: { // Trident
long offset = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0][26] : flcOffsets[1][26];
@@ -3249,39 +3224,39 @@ void useScreenObject() {
mouseClickY = 91 - 7;
goToObject(currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount], 7);
g_engine->_mouseManager->hide();
- drawFlc(208, 0, offset, 0, 9, 21, false, false, true, basurillalog);
+ drawFlc(208, 0, offset, 0, 9, 21, false, false, true, foobar);
currentRoomData->screenLayers[0].bitmapPointer = 0;
currentRoomData->screenLayers[0].bitmapSize = 0;
currentRoomData->screenLayers[0].coordx = 0;
currentRoomData->screenLayers[0].coordy = 0;
currentRoomData->screenLayers[0].depth = 0;
- screenObjects[2] = NULL;
- for (indmoch = 6; indmoch <= 9; indmoch++)
- currentRoomData->mouseGrid[26][indmoch] = 3;
- for (indmoch = 3; indmoch <= 5; indmoch++)
- currentRoomData->mouseGrid[27][indmoch] = 3;
- for (indmoch = 6; indmoch <= 10; indmoch++)
- currentRoomData->mouseGrid[27][indmoch] = 4;
- for (indmoch = 11; indmoch <= 12; indmoch++)
- currentRoomData->mouseGrid[27][indmoch] = 7;
- for (indmoch = 2; indmoch <= 10; indmoch++)
- currentRoomData->mouseGrid[28][indmoch] = 4;
- for (indmoch = 11; indmoch <= 12; indmoch++)
- currentRoomData->mouseGrid[28][indmoch] = 7;
+ screenLayers[2] = NULL;
+ for (invIndex = 6; invIndex <= 9; invIndex++)
+ currentRoomData->mouseGrid[26][invIndex] = 3;
+ for (invIndex = 3; invIndex <= 5; invIndex++)
+ currentRoomData->mouseGrid[27][invIndex] = 3;
+ for (invIndex = 6; invIndex <= 10; invIndex++)
+ currentRoomData->mouseGrid[27][invIndex] = 4;
+ for (invIndex = 11; invIndex <= 12; invIndex++)
+ currentRoomData->mouseGrid[27][invIndex] = 7;
+ for (invIndex = 2; invIndex <= 10; invIndex++)
+ currentRoomData->mouseGrid[28][invIndex] = 4;
+ for (invIndex = 11; invIndex <= 12; invIndex++)
+ currentRoomData->mouseGrid[28][invIndex] = 7;
currentRoomData->mouseGrid[28][13] = 4;
- for (indmoch = 1; indmoch <= 14; indmoch++)
- currentRoomData->mouseGrid[29][indmoch] = 4;
- for (indlista = 30; indlista <= 32; indlista++)
- for (indmoch = 0; indmoch <= 15; indmoch++)
- currentRoomData->mouseGrid[indlista][indmoch] = 4;
- for (indmoch = 1; indmoch <= 14; indmoch++)
- currentRoomData->mouseGrid[33][indmoch] = 4;
- for (indmoch = 2; indmoch <= 14; indmoch++)
- currentRoomData->mouseGrid[34][indmoch] = 4;
- for (indmoch = 3; indmoch <= 8; indmoch++)
- currentRoomData->mouseGrid[35][indmoch] = 4;
- for (indmoch = 9; indmoch <= 11; indmoch++)
- currentRoomData->mouseGrid[35][indmoch] = 7;
+ for (invIndex = 1; invIndex <= 14; invIndex++)
+ currentRoomData->mouseGrid[29][invIndex] = 4;
+ for (listIndex = 30; listIndex <= 32; listIndex++)
+ for (invIndex = 0; invIndex <= 15; invIndex++)
+ currentRoomData->mouseGrid[listIndex][invIndex] = 4;
+ for (invIndex = 1; invIndex <= 14; invIndex++)
+ currentRoomData->mouseGrid[33][invIndex] = 4;
+ for (invIndex = 2; invIndex <= 14; invIndex++)
+ currentRoomData->mouseGrid[34][invIndex] = 4;
+ for (invIndex = 3; invIndex <= 8; invIndex++)
+ currentRoomData->mouseGrid[35][invIndex] = 4;
+ for (invIndex = 9; invIndex <= 11; invIndex++)
+ currentRoomData->mouseGrid[35][invIndex] = 7;
currentRoomData->doors[1].openclosed = 1;
g_engine->_mouseManager->show();
updateItem(regobj.code);
@@ -3311,7 +3286,7 @@ void useScreenObject() {
g_engine->_sound->waitForSoundEnd();
g_engine->_sound->playVoc("PUFF", 191183, 18001);
animateOpen2(0, 1);
- drawFlc(180, 50, offset, 0, 9, 22, false, false, true, basurillalog);
+ drawFlc(180, 50, offset, 0, 9, 22, false, false, true, foobar);
shouldQuitGame = true;
} else
drawText(Random(11) + 1022);
@@ -3324,9 +3299,9 @@ void useScreenObject() {
else
drawText(Random(11) + 1022);
}
- } else {
- if (screenObject > 0) {
- readItemRegister(screenObject);
+ } else { //use object with something on the scene
+ if (sceneObject > 0) {
+ readItemRegister(sceneObject);
goToObject(currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount], currentRoomData->walkAreasGrid[mouseX][mouseY]);
switch (regobj.used[0]) {
case 0: {
@@ -3357,13 +3332,13 @@ void useScreenObject() {
g_engine->_mouseManager->show();
updateItem(regobj.code);
readItemRegister(152);
- indicemochila = 0;
- while (mobj[indicemochila].code != 0) {
- indicemochila += 1;
+ usedObjectIndex = 0;
+ while (mobj[usedObjectIndex].code != 0) {
+ usedObjectIndex += 1;
}
- mobj[indicemochila].bitmapIndex = regobj.objectIconBitmap;
- mobj[indicemochila].code = regobj.code;
- mobj[indicemochila].objectName = regobj.name;
+ mobj[usedObjectIndex].bitmapIndex = regobj.objectIconBitmap;
+ mobj[usedObjectIndex].code = regobj.code;
+ mobj[usedObjectIndex].objectName = regobj.name;
g_engine->_mouseManager->hide();
drawBackpack();
g_engine->_mouseManager->show();
@@ -3382,11 +3357,11 @@ void useScreenObject() {
g_engine->_sound->stopVoc();
g_engine->_sound->playVoc("CLICK", 27742, 2458);
currentRoomData->paletteAnimationFlag = false;
- for (indicex = 195; indicex <= 200; indicex++) {
- pal[indicex * 3 + 0] = 2 << 2;
- pal[indicex * 3 + 1] = 2 << 2;
- pal[indicex * 3 + 2] = 2 << 2;
- setRGBPalette(indicex, 2, 2, 2);
+ for (int i = 195; i <= 200; i++) {
+ pal[i * 3 + 0] = 2 << 2;
+ pal[i * 3 + 1] = 2 << 2;
+ pal[i * 3 + 2] = 2 << 2;
+ setRGBPalette(i, 2, 2, 2);
}
}
g_engine->_mouseManager->show();
@@ -3436,7 +3411,7 @@ void useScreenObject() {
animateOpen2(0, 1);
g_engine->_sound->playVoc("FUEGO", 72598, 9789);
if (isVasePlaced) {
- drawFlc(108, 0, offsetWithJar, 0, 9, 0, false, false, true, basurillalog);
+ drawFlc(108, 0, offsetWithJar, 0, 9, 0, false, false, true, foobar);
{
RoomBitmapRegister &with = currentRoomData->screenLayers[0];
@@ -3446,11 +3421,11 @@ void useScreenObject() {
with.coordy = 48;
with.depth = 1;
}
- for (indlista = 19; indlista <= 21; indlista++)
- for (indmoch = 10; indmoch <= 13; indmoch++)
- currentRoomData->mouseGrid[indlista][indmoch] = 12;
+ for (listIndex = 19; listIndex <= 21; listIndex++)
+ for (invIndex = 10; invIndex <= 13; invIndex++)
+ currentRoomData->mouseGrid[listIndex][invIndex] = 12;
} else
- drawFlc(108, 0, offsetNoJar, 0, 9, 0, false, false, true, basurillalog);
+ drawFlc(108, 0, offsetNoJar, 0, 9, 0, false, false, true, foobar);
g_engine->_mouseManager->show();
} break;
}
@@ -3469,8 +3444,8 @@ void useScreenObject() {
}
void openScreenObject() {
- byte indicex, indicey;
- bool sueltapegote;
+ byte xIndex, yIndex;
+ bool shouldSpeak; //Whether the character should speak to reject the action or not
uint mouseX = (mouseClickX + 7) / xGridCount;
uint mouseY = (mouseClickY + 7) / yGridCount;
@@ -3487,44 +3462,44 @@ void openScreenObject() {
drawText(Random(9) + 1059);
return;
} else {
- sueltapegote = false;
+ shouldSpeak = false;
switch (regobj.code) {
case 227:
if (isCupboardOpen == false)
- sueltapegote = true;
+ shouldSpeak = true;
break;
case 274:
if (isChestOpen == false)
- sueltapegote = true;
+ shouldSpeak = true;
break;
case 415:
if (currentRoomData->doors[2].openclosed == 2)
- sueltapegote = true;
+ shouldSpeak = true;
else {
g_engine->_mouseManager->hide();
animatePickup1(0, 1);
- screenObjects[regobj.depth - 1] = NULL;
- indicey = 0;
- while (currentRoomData->screenLayers[indicey].depth != regobj.depth && indicey != 15) {
- indicey++;
+ screenLayers[regobj.depth - 1] = NULL;
+ yIndex = 0;
+ while (currentRoomData->screenLayers[yIndex].depth != regobj.depth && yIndex != 15) {
+ yIndex++;
}
- debug("changing bitmap at %d, with depth = %d", indicey, currentRoomData->screenLayers[indicey].depth);
- currentRoomData->screenLayers[indicey].bitmapPointer = 0;
- currentRoomData->screenLayers[indicey].bitmapSize = 0;
- currentRoomData->screenLayers[indicey].coordx = 0;
- currentRoomData->screenLayers[indicey].coordy = 0;
- currentRoomData->screenLayers[indicey].depth = 0;
+ debug("changing bitmap at %d, with depth = %d", yIndex, currentRoomData->screenLayers[yIndex].depth);
+ currentRoomData->screenLayers[yIndex].bitmapPointer = 0;
+ currentRoomData->screenLayers[yIndex].bitmapSize = 0;
+ currentRoomData->screenLayers[yIndex].coordx = 0;
+ currentRoomData->screenLayers[yIndex].coordy = 0;
+ currentRoomData->screenLayers[yIndex].depth = 0;
currentRoomData->doors[2].openclosed = 1;
restoreBackground();
assembleScreen();
drawScreen(sceneBackground);
animateOpen2(0, 1);
g_engine->_mouseManager->show();
- for (indicey = 0; indicey <= 12; indicey++)
- for (indicex = 33; indicex <= 36; indicex++)
- currentRoomData->mouseGrid[indicex][indicey] = 43;
- for (indicex = 33; indicex <= 35; indicex++)
- currentRoomData->mouseGrid[indicex][13] = 43;
+ for (yIndex = 0; yIndex <= 12; yIndex++)
+ for (xIndex = 33; xIndex <= 36; xIndex++)
+ currentRoomData->mouseGrid[xIndex][yIndex] = 43;
+ for (xIndex = 33; xIndex <= 35; xIndex++)
+ currentRoomData->mouseGrid[xIndex][13] = 43;
actionCode = 0;
oldGridX = 0;
oldGridY = 0;
@@ -3535,44 +3510,44 @@ void openScreenObject() {
break;
case 548:
if (currentRoomData->doors[0].openclosed == 2)
- sueltapegote = true;
+ shouldSpeak = true;
else {
g_engine->_mouseManager->hide();
animatePickup1(1, 1);
- screenObjects[regobj.depth - 1] = NULL;
- indicey = 0;
- while (currentRoomData->screenLayers[indicey].depth != regobj.depth && indicey != 14) {
- indicey++;
+ screenLayers[regobj.depth - 1] = NULL;
+ yIndex = 0;
+ while (currentRoomData->screenLayers[yIndex].depth != regobj.depth && yIndex != 14) {
+ yIndex++;
}
- currentRoomData->screenLayers[indicey].bitmapPointer = 0;
- currentRoomData->screenLayers[indicey].bitmapSize = 0;
- currentRoomData->screenLayers[indicey].coordx = 0;
- currentRoomData->screenLayers[indicey].coordy = 0;
- currentRoomData->screenLayers[indicey].depth = 0;
+ currentRoomData->screenLayers[yIndex].bitmapPointer = 0;
+ currentRoomData->screenLayers[yIndex].bitmapSize = 0;
+ currentRoomData->screenLayers[yIndex].coordx = 0;
+ currentRoomData->screenLayers[yIndex].coordy = 0;
+ currentRoomData->screenLayers[yIndex].depth = 0;
currentRoomData->doors[0].openclosed = 1;
restoreBackground();
assembleScreen();
drawScreen(sceneBackground);
animateOpen2(1, 1);
g_engine->_mouseManager->show();
- indicex = 30;
- for (indicey = 17; indicey <= 18; indicey++)
- currentRoomData->mouseGrid[indicex][indicey] = 8;
- indicex += 1;
- for (indicey = 4; indicey <= 20; indicey++)
- currentRoomData->mouseGrid[indicex][indicey] = 8;
- indicex += 1;
- for (indicey = 0; indicey <= 20; indicey++)
- currentRoomData->mouseGrid[indicex][indicey] = 8;
- indicex += 1;
- for (indicey = 0; indicey <= 17; indicey++)
- currentRoomData->mouseGrid[indicex][indicey] = 8;
- indicex += 1;
- for (indicey = 0; indicey <= 12; indicey++)
- currentRoomData->mouseGrid[indicex][indicey] = 8;
- for (indicex = 35; indicex <= 39; indicex++)
- for (indicey = 0; indicey <= 10; indicey++)
- currentRoomData->mouseGrid[indicex][indicey] = 8;
+ xIndex = 30;
+ for (yIndex = 17; yIndex <= 18; yIndex++)
+ currentRoomData->mouseGrid[xIndex][yIndex] = 8;
+ xIndex += 1;
+ for (yIndex = 4; yIndex <= 20; yIndex++)
+ currentRoomData->mouseGrid[xIndex][yIndex] = 8;
+ xIndex += 1;
+ for (yIndex = 0; yIndex <= 20; yIndex++)
+ currentRoomData->mouseGrid[xIndex][yIndex] = 8;
+ xIndex += 1;
+ for (yIndex = 0; yIndex <= 17; yIndex++)
+ currentRoomData->mouseGrid[xIndex][yIndex] = 8;
+ xIndex += 1;
+ for (yIndex = 0; yIndex <= 12; yIndex++)
+ currentRoomData->mouseGrid[xIndex][yIndex] = 8;
+ for (xIndex = 35; xIndex <= 39; xIndex++)
+ for (yIndex = 0; yIndex <= 10; yIndex++)
+ currentRoomData->mouseGrid[xIndex][yIndex] = 8;
actionCode = 0;
oldGridX = 0;
oldGridY = 0;
@@ -3581,7 +3556,7 @@ void openScreenObject() {
}
break;
}
- if (sueltapegote) {
+ if (shouldSpeak) {
drawText(Random(9) + 1059);
return;
}
@@ -3589,31 +3564,31 @@ void openScreenObject() {
g_engine->_mouseManager->hide();
switch (regobj.height) {
case 0: {
- animatePickup1(characterFacingDir, 0);
+ animatePickup1(charFacingDirection, 0);
updateVideo();
- animateOpen2(characterFacingDir, 0);
+ animateOpen2(charFacingDirection, 0);
} break;
case 1: {
- animatePickup1(characterFacingDir, 1);
+ animatePickup1(charFacingDirection, 1);
updateVideo();
- animateOpen2(characterFacingDir, 1);
+ animateOpen2(charFacingDirection, 1);
} break;
case 2: {
- animatePickup1(characterFacingDir, 2);
+ animatePickup1(charFacingDirection, 2);
updateVideo();
- animateOpen2(characterFacingDir, 2);
+ animateOpen2(charFacingDirection, 2);
} break;
}
g_engine->_mouseManager->show();
- for (indicey = regobj.yrej1; indicey <= regobj.yrej2; indicey++)
- for (indicex = regobj.xrej1; indicex <= regobj.xrej2; indicex++) {
- currentRoomData->walkAreasGrid[indicex][indicey] = regobj.walkAreasPatch[indicex - regobj.xrej1][indicey - regobj.yrej1];
- currentRoomData->mouseGrid[indicex][indicey] = regobj.mouseGridPatch[indicex - regobj.xrej1][indicey - regobj.yrej1];
+ for (yIndex = regobj.yrej1; yIndex <= regobj.yrej2; yIndex++)
+ for (xIndex = regobj.xrej1; xIndex <= regobj.xrej2; xIndex++) {
+ currentRoomData->walkAreasGrid[xIndex][yIndex] = regobj.walkAreasPatch[xIndex - regobj.xrej1][yIndex - regobj.yrej1];
+ currentRoomData->mouseGrid[xIndex][yIndex] = regobj.mouseGridPatch[xIndex - regobj.xrej1][yIndex - regobj.yrej1];
}
- for (indicex = 0; indicex < 15; indicex++)
- if (currentRoomData->screenLayers[indicex].bitmapPointer == regobj.bitmapPointer) {
- currentRoomData->screenLayers[indicex].bitmapPointer = regobj.dropOverlay;
- currentRoomData->screenLayers[indicex].bitmapSize = regobj.dropOverlaySize;
+ for (xIndex = 0; xIndex < 15; xIndex++)
+ if (currentRoomData->screenLayers[xIndex].bitmapPointer == regobj.bitmapPointer) {
+ currentRoomData->screenLayers[xIndex].bitmapPointer = regobj.dropOverlay;
+ currentRoomData->screenLayers[xIndex].bitmapSize = regobj.dropOverlaySize;
}
actionCode = 0;
}
@@ -3623,69 +3598,69 @@ void openScreenObject() {
}
void closeScreenObject() {
- byte indicex, indicey, x_del_raton, y_del_raton;
- bool sueltapegote;
- uint objeto_de_la_pantalla;
-
- x_del_raton = ((mouseClickX + 7) / xGridCount);
- y_del_raton = ((mouseClickY + 7) / yGridCount);
- objeto_de_la_pantalla = currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[x_del_raton][y_del_raton]]->fileIndex;
- if (objeto_de_la_pantalla == 0)
+ byte xIndex, yIndex;
+ bool shouldSpeak;
+ uint sceneObject;
+
+ byte mouseX = (mouseClickX + 7) / xGridCount;
+ byte mouseY = (mouseClickY + 7) / yGridCount;
+ sceneObject = currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[mouseX][mouseY]]->fileIndex;
+ if (sceneObject == 0)
return;
// verifyCopyProtection2();
- readItemRegister(objeto_de_la_pantalla);
+ readItemRegister(sceneObject);
goToObject(currentRoomData->walkAreasGrid[((characterPosX + characterCorrectionX) / xGridCount)][((characterPosY + characerCorrectionY) / yGridCount)],
- currentRoomData->walkAreasGrid[x_del_raton][y_del_raton]);
+ currentRoomData->walkAreasGrid[mouseX][mouseY]);
if (regobj.closeable == false) {
drawText((Random(10) + 1068));
return;
} else {
- sueltapegote = false;
+ shouldSpeak = false;
switch (regobj.code) {
case 224:
case 226:
if (isCupboardOpen == false)
- sueltapegote = true;
+ shouldSpeak = true;
break;
case 275:
case 277:
if (isChestOpen == false)
- sueltapegote = true;
+ shouldSpeak = true;
break;
}
- if (sueltapegote) {
+ if (shouldSpeak) {
drawText(Random(10) + 1068);
return;
}
- currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[x_del_raton][y_del_raton]]->fileIndex = regobj.replaceWith;
+ currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[mouseX][mouseY]]->fileIndex = regobj.replaceWith;
g_engine->_mouseManager->hide();
switch (regobj.height) {
case 0: {
- animatePickup1(characterFacingDir, 0);
+ animatePickup1(charFacingDirection, 0);
updateVideo();
- animateOpen2(characterFacingDir, 0);
+ animateOpen2(charFacingDirection, 0);
} break;
case 1: {
- animatePickup1(characterFacingDir, 1);
+ animatePickup1(charFacingDirection, 1);
updateVideo();
- animateOpen2(characterFacingDir, 1);
+ animateOpen2(charFacingDirection, 1);
} break;
case 2: {
- animatePickup1(characterFacingDir, 2);
+ animatePickup1(charFacingDirection, 2);
updateVideo();
- animateOpen2(characterFacingDir, 2);
+ animateOpen2(charFacingDirection, 2);
} break;
}
g_engine->_mouseManager->show();
- for (indicey = regobj.yrej1; indicey <= regobj.yrej2; indicey++)
- for (indicex = regobj.xrej1; indicex <= regobj.xrej2; indicex++) {
- currentRoomData->walkAreasGrid[indicex][indicey] = regobj.walkAreasPatch[indicex - regobj.xrej1][indicey - regobj.yrej1];
- currentRoomData->mouseGrid[indicex][indicey] = regobj.mouseGridPatch[indicex - regobj.xrej1][indicey - regobj.yrej1];
+ for (yIndex = regobj.yrej1; yIndex <= regobj.yrej2; yIndex++)
+ for (xIndex = regobj.xrej1; xIndex <= regobj.xrej2; xIndex++) {
+ currentRoomData->walkAreasGrid[xIndex][yIndex] = regobj.walkAreasPatch[xIndex - regobj.xrej1][yIndex - regobj.yrej1];
+ currentRoomData->mouseGrid[xIndex][yIndex] = regobj.mouseGridPatch[xIndex - regobj.xrej1][yIndex - regobj.yrej1];
}
- for (indicex = 0; indicex < 15; indicex++)
- if (currentRoomData->screenLayers[indicex].bitmapPointer == regobj.bitmapPointer) {
- currentRoomData->screenLayers[indicex].bitmapPointer = regobj.dropOverlay;
- currentRoomData->screenLayers[indicex].bitmapSize = regobj.dropOverlaySize;
+ for (xIndex = 0; xIndex < 15; xIndex++)
+ if (currentRoomData->screenLayers[xIndex].bitmapPointer == regobj.bitmapPointer) {
+ currentRoomData->screenLayers[xIndex].bitmapPointer = regobj.dropOverlay;
+ currentRoomData->screenLayers[xIndex].bitmapSize = regobj.dropOverlaySize;
}
actionCode = 0;
}
@@ -3734,7 +3709,7 @@ void handleAction(byte posinv) {
g_engine->_mouseManager->show();
drawText((Random(10) + 1039));
actionCode = 0;
- if (contadorpc > 130)
+ if (cpCounter > 130)
showError(274);
oldGridX = 0;
oldGridY = 0;
@@ -3743,7 +3718,7 @@ void handleAction(byte posinv) {
case 2: {
g_engine->_mouseManager->hide();
actionLineText(getActionLineText(2) + mobj[posinv].objectName);
- if (contadorpc2 > 13)
+ if (cpCounter2 > 13)
showError(274);
g_engine->_mouseManager->show();
drawText((Random(10) + 1049));
@@ -3757,7 +3732,7 @@ void handleAction(byte posinv) {
actionLineText(getActionLineText(3) + mobj[posinv].objectName);
g_engine->_mouseManager->show();
actionCode = 0;
- lookInventoryObject(posinv);
+ lookAtObject(posinv);
oldGridX = 0;
oldGridY = 0;
checkMouseGrid();
@@ -3772,7 +3747,7 @@ void handleAction(byte posinv) {
} else {
actionCode = 0;
- if (contadorpc > 25)
+ if (cpCounter > 25)
showError(274);
useInventoryObjectWithInventoryObject(backpackObjectCode, mobj[posinv].code);
oldGridX = 0;
@@ -3796,7 +3771,7 @@ void handleAction(byte posinv) {
g_engine->_mouseManager->show();
drawText(Random(10) + 1068);
actionCode = 0;
- if (contadorpc2 > 35)
+ if (cpCounter2 > 35)
showError(274);
oldGridX = 0;
oldGridY = 0;
@@ -3807,53 +3782,54 @@ void handleAction(byte posinv) {
void loadObjects() {
- Common::File ficheroobj;
+ Common::File objectFile;
switch (gamePart) {
case 1:
- ficheroobj.open("OBJMOCH.DAT");
+ objectFile.open("OBJMOCH.DAT");
break;
case 2:
- ficheroobj.open("OBJMOCH.TWO");
+ objectFile.open("OBJMOCH.TWO");
break;
}
- if (!ficheroobj.isOpen())
+ if (!objectFile.isOpen())
showError(312);
for (int i = 0; i < inventoryIconCount; i++) {
- mochilaxms[i] = (byte *)malloc(inventoryIconSize);
- ficheroobj.read(mochilaxms[i], inventoryIconSize);
+ inventoryIconBitmaps[i] = (byte *)malloc(inventoryIconSize);
+ objectFile.read(inventoryIconBitmaps[i], inventoryIconSize);
}
- if (contadorpc > 65)
+ if (cpCounter > 65)
showError(274);
+ const char *emptyName = (g_engine->_lang == Common::ES_ESP) ? hardcodedObjects_ES[10] : hardcodedObjects_EN[10];
for (int i = 0; i < inventoryIconCount; i++) {
mobj[i].bitmapIndex = 34;
mobj[i].code = 0;
- mobj[i].objectName = "VACIO";
+ mobj[i].objectName = emptyName;
}
- ficheroobj.close();
+ objectFile.close();
debug("Successfully read objects!");
}
-void obtainName(Common::String &nombrejugador) {
- uint16 tamfondonom;
- byte *puntfondonom;
+void obtainName(Common::String &playerName) {
+ uint16 namePromptBGSize;
+ byte *namePromptBG;
- tamfondonom = imagesize(84, 34, 235, 80);
- puntfondonom = (byte *)malloc(tamfondonom);
- g_engine->_graphics->getImg(84, 34, 235, 80, puntfondonom);
+ namePromptBGSize = imagesize(84, 34, 235, 80);
+ namePromptBG = (byte *)malloc(namePromptBGSize);
+ g_engine->_graphics->getImg(84, 34, 235, 80, namePromptBG);
drawMenu(8);
g_engine->_screen->update();
- Common::String paso;
- readAlphaGraph(paso, 8, 125, 62, 252);
- nombrejugador = paso.c_str();
- g_engine->_graphics->putImg(84, 34, puntfondonom);
+ Common::String prompt;
+ readAlphaGraph(prompt, 8, 125, 62, 252);
+ playerName = prompt.c_str();
+ g_engine->_graphics->putImg(84, 34, namePromptBG);
g_engine->_screen->update();
- free(puntfondonom);
+ free(namePromptBG);
}
-void loadScrollData(uint numpantalla, bool scrollder,
- uint poshor, int correccionscroll);
+void loadScrollData(uint roomCode, bool rightScroll,
+ uint horizontalPos, int scrollCorrection);
static byte *spriteBackground;
@@ -3933,25 +3909,25 @@ static void scrollRight(uint &horizontalPos) {
free(assembledCharacterFrame);
}
-static void scrollLeft(uint &poshor) {
+static void scrollLeft(uint &horizontalPos) {
int characterPos = 25 + characterPosX;
- poshor = 320 - poshor;
+ horizontalPos = 320 - horizontalPos;
// We scroll 4 by 4 pixels so we divide by 4 to find out the number of necessary steps
- uint numpasos = poshor >> 2;
+ uint stepCount = horizontalPos >> 2;
byte *assembledCharacterFrame = (byte *)malloc(mainCharFrameSize);
size_t numBytes = 44796;
- for (int i = numpasos; i >= 1; i--) {
+ for (int i = stepCount; i >= 1; i--) {
for (int j = numBytes; j > 0; j--) {
// move the previous background to the right
sceneBackground[j + 4] = sceneBackground[j];
}
- poshor -= 4;
+ horizontalPos -= 4;
for (int k = 0; k < 140; k++) {
for (int j = 0; j < 4; j++) {
- sceneBackground[4 + k * 320 + j] = backgroundCopy[4 + poshor + k * 320 + j];
+ sceneBackground[4 + k * 320 + j] = backgroundCopy[4 + horizontalPos + k * 320 + j];
}
}
@@ -3989,56 +3965,54 @@ static void scrollLeft(uint &poshor) {
* Scrolling happens between two screens. We grab the area surroudning the player from screen A,
* then transition to screen B.
*/
-void loadScrollData(uint numpantalla, bool scrollder, uint poshor, int correccionscroll) {
- uint indicecarga;
+void loadScrollData(uint roomCode, bool rightScroll, uint horizontalPos, int scrollCorrection) {
restoreBackground();
- // Fondo now contains background A, handpantalla contains background A
- uint pasoframeW = READ_LE_UINT16(curCharacterAnimationFrame);
- uint pasoframeH = READ_LE_UINT16(curCharacterAnimationFrame + 2);
- debug("characterPos=%d,%d, size=%d,%d", characterPosX, characterPosY, pasoframeW, pasoframeH);
+ // background now contains background A, backgroundCopy contains background A
+ uint characterFrameW = READ_LE_UINT16(curCharacterAnimationFrame);
+ uint characterFrameH = READ_LE_UINT16(curCharacterAnimationFrame + 2);
+ debug("characterPos=%d,%d, size=%d,%d", characterPosX, characterPosY, characterFrameW, characterFrameH);
/* Copy the area with the player from previous scren*/
- spriteBackground = (byte *)malloc(4 + (pasoframeW + 8) * (pasoframeH + 8));
- g_engine->_graphics->getImageArea(characterPosX, characterPosY, characterPosX + pasoframeW, characterPosY + pasoframeH, sceneBackground, spriteBackground);
+ spriteBackground = (byte *)malloc(4 + (characterFrameW + 8) * (characterFrameH + 8));
+ g_engine->_graphics->getImageArea(characterPosX, characterPosY, characterPosX + characterFrameW, characterPosY + characterFrameH, sceneBackground, spriteBackground);
// Start screen 2
- Common::File fichpanta;
- rooms->seek(numpantalla * roomRegSize, SEEK_SET);
+ rooms->seek(roomCode * roomRegSize, SEEK_SET);
currentRoomData = readScreenDataFile(rooms);
loadScreen();
- // Fondo now contains background B, handpantalla contains background B
- for (indicecarga = 0; indicecarga < 15; indicecarga++) {
+ // Background now contains background B, backgroundCopy contains background B
+ for (int i = 0; i < 15; i++) {
{
- RoomBitmapRegister &with = currentRoomData->screenLayers[indicecarga];
+ RoomBitmapRegister &with = currentRoomData->screenLayers[i];
if (with.bitmapSize > 0)
loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
}
- // assembles the screen objects into fondo
+ // assembles the screen objects into background
assembleScreen(true);
- // Fondo contains background B + objects, handpantalla contains plain background B
+ // background contains background B + objects, backgroundCopy contains plain background B
- // Copies the contents of fondo into handpantalla
+ // Copies the contents of background into backgroundCopy
Common::copy(sceneBackground, sceneBackground + 44804, backgroundCopy);
- // Fondo contains background B + objects, handpantalla contains background B + objects
+ // background contains background B + objects, backgroundCopy contains background B + objects
isPaletteAnimEnabled = 0;
getScreen(sceneBackground);
- // Fondo now contains full background A again, handpantalla contains background B + objects
+ // background now contains full background A again, backgroundCopy contains background B + objects
drawScreen(sceneBackground);
- if (scrollder)
- scrollRight(poshor);
+ if (rightScroll)
+ scrollRight(horizontalPos);
else
- scrollLeft(poshor);
+ scrollLeft(horizontalPos);
- // After scroll is done, handpantalla will now contain the resulting fondo (background B + objects)
+ // After scroll is done, backgroundCopy will now contain the resulting background (background B + objects)
Common::copy(backgroundCopy, backgroundCopy + 44804, sceneBackground);
- characterPosX += correccionscroll;
+ characterPosX += scrollCorrection;
assembleScreen();
drawScreen(sceneBackground);
@@ -4049,7 +4023,6 @@ void loadScrollData(uint numpantalla, bool scrollder, uint poshor, int correccio
}
void saveGameToRegister() {
- uint indiaux;
savedGame.roomCode = currentRoomData->code;
savedGame.trajectoryLength = trajectoryLength;
savedGame.currentTrajectoryIndex = currentTrajectoryIndex;
@@ -4074,7 +4047,7 @@ void saveGameToRegister() {
savedGame.oldActionCode = oldActionCode;
savedGame.steps = steps;
savedGame.doorIndex = doorIndex;
- savedGame.characterFacingDir = characterFacingDir;
+ savedGame.characterFacingDir = charFacingDirection;
savedGame.iframe = iframe;
savedGame.gamePart = gamePart;
@@ -4096,10 +4069,10 @@ void saveGameToRegister() {
savedGame.isTVOn = isTVOn;
savedGame.isTrapSet = isTrapSet;
- for (indiaux = 0; indiaux < inventoryIconCount; indiaux++) {
- savedGame.mobj[indiaux].bitmapIndex = mobj[indiaux].bitmapIndex;
- savedGame.mobj[indiaux].code = mobj[indiaux].code;
- savedGame.mobj[indiaux].objectName = mobj[indiaux].objectName;
+ for (int i = 0; i < inventoryIconCount; i++) {
+ savedGame.mobj[i].bitmapIndex = mobj[i].bitmapIndex;
+ savedGame.mobj[i].code = mobj[i].code;
+ savedGame.mobj[i].objectName = mobj[i].objectName;
}
savedGame.element1 = element1;
@@ -4118,34 +4091,32 @@ void saveGameToRegister() {
savedGame.mainRoute[i].y = mainRoute[i].y;
}
- for (indiaux = 0; indiaux < 300; indiaux++) {
- savedGame.trajectory[indiaux].x = trajectory[indiaux].x;
- savedGame.trajectory[indiaux].y = trajectory[indiaux].y;
+ for (int i = 0; i < 300; i++) {
+ savedGame.trajectory[i].x = trajectory[i].x;
+ savedGame.trajectory[i].y = trajectory[i].y;
}
- for (indiaux = 0; indiaux < characterCount; indiaux++) {
- savedGame.firstTimeTopicA[indiaux] = firstTimeTopicA[indiaux];
- savedGame.firstTimeTopicB[indiaux] = firstTimeTopicB[indiaux];
- savedGame.firstTimeTopicC[indiaux] = firstTimeTopicC[indiaux];
- savedGame.bookTopic[indiaux] = bookTopic[indiaux];
- savedGame.mintTopic[indiaux] = mintTopic[indiaux];
+ for (int i = 0; i < characterCount; i++) {
+ savedGame.firstTimeTopicA[i] = firstTimeTopicA[i];
+ savedGame.firstTimeTopicB[i] = firstTimeTopicB[i];
+ savedGame.firstTimeTopicC[i] = firstTimeTopicC[i];
+ savedGame.bookTopic[i] = bookTopic[i];
+ savedGame.mintTopic[i] = mintTopic[i];
}
- for (indiaux = 0; indiaux < 5; indiaux++) {
- savedGame.caves[indiaux] = caves[indiaux];
- savedGame.firstList[indiaux] = firstList[indiaux];
- savedGame.secondList[indiaux] = secondList[indiaux];
+ for (int i = 0; i < 5; i++) {
+ savedGame.caves[i] = caves[i];
+ savedGame.firstList[i] = firstList[i];
+ savedGame.secondList[i] = secondList[i];
}
- for (indiaux = 0; indiaux < 4; indiaux++) {
- savedGame.niche[0][indiaux] = niche[0][indiaux];
- savedGame.niche[1][indiaux] = niche[1][indiaux];
+ for (int i = 0; i < 4; i++) {
+ savedGame.niche[0][i] = niche[0][i];
+ savedGame.niche[1][i] = niche[1][i];
}
}
void loadGame(SavedGame game) {
freeAnimation();
freeScreenObjects();
-
- uint indiaux, indiaux2;
transitionEffect = Random(15) + 1;
trajectoryLength = game.trajectoryLength;
@@ -4170,12 +4141,12 @@ void loadGame(SavedGame game) {
oldActionCode = game.oldActionCode;
steps = game.steps;
doorIndex = game.doorIndex;
- characterFacingDir = game.characterFacingDir;
+ charFacingDirection = game.characterFacingDir;
iframe = game.iframe;
if (game.gamePart != gamePart) {
gamePart = game.gamePart;
for (int i = 0; i < inventoryIconCount; i++) {
- free(mochilaxms[i]);
+ free(inventoryIconBitmaps[i]);
}
loadObjects();
}
@@ -4186,7 +4157,7 @@ void loadGame(SavedGame game) {
list2Complete = game.list2Complete;
isVasePlaced = game.isVasePlaced;
isScytheTaken = game.isScytheTaken;
- if (contadorpc > 24)
+ if (cpCounter > 24)
showError(274);
isTridentTaken = game.isTridentTaken;
isPottersWheelDelivered = game.isPottersWheelDelivered;
@@ -4198,10 +4169,10 @@ void loadGame(SavedGame game) {
isChestOpen = game.isChestOpen;
isTVOn = game.isTVOn;
isTrapSet = game.isTrapSet;
- for (indiaux = 0; indiaux < inventoryIconCount; indiaux++) {
- mobj[indiaux].bitmapIndex = game.mobj[indiaux].bitmapIndex;
- mobj[indiaux].code = game.mobj[indiaux].code;
- mobj[indiaux].objectName = game.mobj[indiaux].objectName;
+ for (int i = 0; i < inventoryIconCount; i++) {
+ mobj[i].bitmapIndex = game.mobj[i].bitmapIndex;
+ mobj[i].code = game.mobj[i].code;
+ mobj[i].objectName = game.mobj[i].objectName;
}
element1 = game.element1;
element2 = game.element2;
@@ -4216,25 +4187,25 @@ void loadGame(SavedGame game) {
mainRoute[i].x = game.mainRoute[i].x;
mainRoute[i].y = game.mainRoute[i].y;
}
- for (indiaux = 0; indiaux < 300; indiaux++) {
+ for (int indiaux = 0; indiaux < 300; indiaux++) {
trajectory[indiaux].x = game.trajectory[indiaux].x;
trajectory[indiaux].y = game.trajectory[indiaux].y;
}
- for (indiaux = 0; indiaux < characterCount; indiaux++) {
- firstTimeTopicA[indiaux] = game.firstTimeTopicA[indiaux];
- firstTimeTopicB[indiaux] = game.firstTimeTopicB[indiaux];
- firstTimeTopicC[indiaux] = game.firstTimeTopicC[indiaux];
- bookTopic[indiaux] = game.bookTopic[indiaux];
- mintTopic[indiaux] = game.mintTopic[indiaux];
+ for (int i = 0; i < characterCount; i++) {
+ firstTimeTopicA[i] = game.firstTimeTopicA[i];
+ firstTimeTopicB[i] = game.firstTimeTopicB[i];
+ firstTimeTopicC[i] = game.firstTimeTopicC[i];
+ bookTopic[i] = game.bookTopic[i];
+ mintTopic[i] = game.mintTopic[i];
}
- for (indiaux = 0; indiaux < 5; indiaux++) {
- caves[indiaux] = game.caves[indiaux];
- firstList[indiaux] = game.firstList[indiaux];
- secondList[indiaux] = game.secondList[indiaux];
+ for (int i = 0; i < 5; i++) {
+ caves[i] = game.caves[i];
+ firstList[i] = game.firstList[i];
+ secondList[i] = game.secondList[i];
}
- for (indiaux = 0; indiaux < 4; indiaux++) {
- niche[0][indiaux] = game.niche[0][indiaux];
- niche[1][indiaux] = game.niche[1][indiaux];
+ for (int i = 0; i < 4; i++) {
+ niche[0][i] = game.niche[0][i];
+ niche[1][i] = game.niche[1][i];
}
totalFadeOut(0);
@@ -4247,7 +4218,7 @@ void loadGame(SavedGame game) {
if (isTVOn)
g_engine->_sound->autoPlayVoc("PARASITO", 355778, 20129);
else
- cargatele();
+ loadTV();
g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
} break;
case 4: {
@@ -4316,12 +4287,12 @@ void loadGame(SavedGame game) {
secondaryAnimation.posy = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].y;
secondaryAnimation.depth = 14;
- for (indiaux = 0; indiaux < maxXGrid; indiaux++)
- for (indiaux2 = 0; indiaux2 < maxYGrid; indiaux2++) {
- if (maskGridSecondaryAnim[indiaux][indiaux2] > 0)
- currentRoomData->walkAreasGrid[oldposx + indiaux][oldposy + indiaux2] = maskGridSecondaryAnim[indiaux][indiaux2];
- if (maskMouseSecondaryAnim[indiaux][indiaux2] > 0)
- currentRoomData->mouseGrid[oldposx + indiaux][oldposy + indiaux2] = maskMouseSecondaryAnim[indiaux][indiaux2];
+ for (int i = 0; i < maxXGrid; i++)
+ for (int j = 0; j < maxYGrid; j++) {
+ if (maskGridSecondaryAnim[i][j] > 0)
+ currentRoomData->walkAreasGrid[oldposx + i][oldposy + j] = maskGridSecondaryAnim[i][j];
+ if (maskMouseSecondaryAnim[i][j] > 0)
+ currentRoomData->mouseGrid[oldposx + i][oldposy + j] = maskMouseSecondaryAnim[i][j];
}
}
assembleScreen();
@@ -4336,313 +4307,94 @@ void loadGame(SavedGame game) {
screenTransition(transitionEffect, false, sceneBackground);
}
-struct indicepart {
- byte ultimapartida;
- Common::String listapartidas[6];
-};
-
-void seleccionaPartida(indicepart regindfich, int numSeleccion) {
- g_engine->_mouseManager->hide();
- for (int i = 0; i < 6; i++) {
- int color = i == numSeleccion ? 255 : 253;
- littText(65, 29, regindfich.listapartidas[i], color);
- }
- g_engine->_mouseManager->show();
-}
-
-void saveLoad() {
- uint tamfondmenu;
- uint oldxraton, oldyraton;
- byte *puntfondmenu;
- byte ytext;
- byte partidaselecc;
- bool modificada;
- bool salirmenufunciones;
- Common::String nombrepartida;
- indicepart regindfich;
-
- Common::File fichindice;
- if (fichindice.open("PARTIDAS.INX")) {
- regindfich.ultimapartida = fichindice.readByte();
- for (int i = 0; i < 6; i++) {
- int nameSize = fichindice.readByte();
- char *name = (char *)malloc(nameSize);
- fichindice.read(name, nameSize);
- fichindice.skip(255 - nameSize);
- regindfich.listapartidas[i] = Common::String(name, name + nameSize);
- }
- } else {
- regindfich.ultimapartida = 1;
- for (int i = 0; i < 6; i++) {
- regindfich.listapartidas[i] = Common::String().format("DISPONIBLE %d", i);
- }
- }
- salirmenufunciones = false;
- oldxraton = mouseX;
- oldyraton = mouseY;
- g_engine->_mouseManager->hide();
-
- tamfondmenu = imagesize(50, 10, 270, 120);
- puntfondmenu = (byte *)malloc(tamfondmenu);
- g_engine->_graphics->getImg(50, 10, 270, 120, puntfondmenu);
-
- for (int i = 0; i < 6; i++) {
- uint textY = i + 1;
- buttonBorder((120 - (textY * 10)), (80 - (textY * 10)), (200 + (textY * 10)), (60 + (textY * 10)), 251, 251, 251, 251, 0, 0, "");
- }
- drawMenu(2);
- if (isSavingDisabled) {
- bar(61, 15, 122, 23, 253);
- bar(201, 15, 259, 23, 253);
- }
- littText(65, 29, regindfich.listapartidas[0], 253);
- littText(65, 44, regindfich.listapartidas[1], 253);
- littText(65, 59, regindfich.listapartidas[2], 253);
- littText(65, 74, regindfich.listapartidas[3], 253);
- littText(65, 89, regindfich.listapartidas[4], 253);
- littText(65, 104, regindfich.listapartidas[5], 253);
- if (contadorpc2 > 17)
- showError(274);
- mouseX = 150;
- mouseY = 60;
- // iraton = 1;
- partidaselecc = 0;
- modificada = false;
- nombrepartida = "";
- g_engine->_mouseManager->setMouseArea(Common::Rect(55, 13, 250, 105));
- g_engine->_mouseManager->setMousePos(1, mouseX, mouseY);
- do {
- Common::Event e;
- bool mouseClicked = false;
- bool keyPressed = false;
- do {
- if (tocapintar) {
- g_engine->_chrono->updateChrono();
- g_engine->_mouseManager->animateMouseIfNeeded();
- }
- while (g_system->getEventManager()->pollEvent(e)) {
- if (isMouseEvent(e)) {
- g_engine->_mouseManager->setMousePos(e.mouse);
- mouseX = e.mouse.x;
- mouseY = e.mouse.y;
- }
-
- if (e.type == Common::EVENT_LBUTTONUP || e.type == Common::EVENT_RBUTTONUP) {
- mouseClicked = true;
- mouseClickX = e.mouse.x;
- mouseClickY = e.mouse.y;
- } else if (e.type == Common::EVENT_KEYUP) {
- keyPressed = true;
- }
- }
-
- g_engine->_screen->update();
- g_system->delayMillis(10);
- } while (!keyPressed && !mouseClicked && !g_engine->shouldQuit());
-
- if (mouseClicked) {
- if (mouseClickY >= 13 && mouseClickY <= 16) {
- if (mouseClickX >= 54 && mouseClickX <= 124) {
- if (partidaselecc > 0 && !isSavingDisabled && (nombrepartida != Common::String("DISPONIBLE ") + (char)(partidaselecc + 48)) && (nombrepartida != "")) {
- // saveGame(partidaselecc);
- fichindice.close();
- g_engine->_graphics->putImg(50, 10, puntfondmenu);
- salirmenufunciones = true;
- partidaselecc = 0;
- } else {
- g_engine->_sound->beep(100, 300);
- }
- } else if (mouseClickX >= 130 && mouseClickX <= 194) {
- if ((partidaselecc > 0) && !((modificada))) {
-
- if (regindfich.listapartidas[partidaselecc] != (Common::String("DISPONIBLE ") + (char)(partidaselecc + 48))) {
- g_engine->_mouseManager->hide();
- g_engine->_graphics->putImg(50, 10, puntfondmenu);
- free(puntfondmenu);
- if (!isSavingDisabled) {
- freeAnimation();
- freeScreenObjects();
- }
- // loadGame(partidaselecc);
- mouseX = oldxraton;
- mouseY = oldyraton;
-
- g_engine->_mouseManager->show();
- g_engine->_mouseManager->setMouseArea(Common::Rect(0, 0, 305, 185));
- salirmenufunciones = true;
- partidaselecc = 0;
- return;
- } else {
- g_engine->_sound->beep(100, 300);
- }
- } else {
- g_engine->_sound->beep(100, 300);
- g_engine->_mouseManager->hide();
- bar(61, 31, 259, 39, 251);
- littText(65, 29, regindfich.listapartidas[1], 253);
- bar(61, 46, 259, 54, 251);
- littText(65, 44, regindfich.listapartidas[2], 253);
- bar(61, 61, 259, 69, 251);
- littText(65, 59, regindfich.listapartidas[3], 253);
- bar(61, 76, 259, 84, 251);
- littText(65, 74, regindfich.listapartidas[4], 253);
- bar(61, 91, 259, 99, 251);
- littText(65, 89, regindfich.listapartidas[5], 253);
- bar(61, 106, 259, 114, 251);
- littText(65, 104, regindfich.listapartidas[6], 253);
- g_engine->_mouseManager->show();
- }
- } else if (mouseClickX >= 200 && mouseClickX <= 250) {
- if (inGame && !isSavingDisabled) {
- g_engine->_graphics->putImg(50, 10, puntfondmenu);
- salirmenufunciones = true;
- partidaselecc = 0;
- } else {
- g_engine->_sound->beep(100, 300);
- }
- }
- } else if (mouseClickY >= 24 && mouseClickY <= 32) {
- partidaselecc = 0;
- modificada = false;
- ytext = 29;
- seleccionaPartida(regindfich, 0);
- nombrepartida = regindfich.listapartidas[0];
- } else if (mouseClickY >= 39 && mouseClickY <= 47) {
- partidaselecc = 1;
- modificada = false;
- ytext = 44;
- seleccionaPartida(regindfich, 1);
- nombrepartida = regindfich.listapartidas[1];
- } else if (mouseClickY >= 54 && mouseClickY <= 62) {
- partidaselecc = 2;
- modificada = false;
- ytext = 59;
- seleccionaPartida(regindfich, 2);
- nombrepartida = regindfich.listapartidas[2];
- } else if (mouseClickY >= 69 && mouseClickY <= 77) {
- partidaselecc = 3;
- modificada = false;
- ytext = 74;
- seleccionaPartida(regindfich, 3);
- nombrepartida = regindfich.listapartidas[3];
- } else if (mouseClickY >= 84 && mouseClickY <= 92) {
- partidaselecc = 4;
- modificada = false;
- ytext = 89;
- seleccionaPartida(regindfich, 4);
- nombrepartida = regindfich.listapartidas[4];
- } else if (mouseClickY >= 99 && mouseClickY <= 107) {
- partidaselecc = 5;
- modificada = false;
- ytext = 0;
- seleccionaPartida(regindfich, 5);
- nombrepartida = regindfich.listapartidas[5];
- }
- }
-
- if (partidaselecc > 0 /*&& keypressed()*/) {
- g_engine->_mouseManager->hide();
- readAlphaGraphSmall(nombrepartida, 30, 65, ytext, 251, 254);
- modificada = true;
- g_engine->_mouseManager->show();
- }
- } while (!salirmenufunciones && !g_engine->shouldQuit());
- mouseX = oldxraton;
- mouseY = oldyraton;
- g_engine->_mouseManager->setMousePos(mouseMaskIndex, mouseX, mouseY);
- free(puntfondmenu);
- g_engine->_mouseManager->setMouseArea(Common::Rect(0, 0, 305, 185));
-}
-
/**
* Loads talking animation of main adn secondary character
*/
void loadTalkAnimations() {
- Common::File fichcani;
+ Common::File animFile;
- if (!fichcani.open("TIOHABLA.SEC")) {
+ if (!animFile.open("TIOHABLA.SEC")) {
showError(265);
}
- int32 posfilehabla;
+ mainCharFrameSize = animFile.readUint16LE();
- mainCharFrameSize = fichcani.readUint16LE();
-
- posfilehabla = mainCharFrameSize * 16;
- posfilehabla = (posfilehabla * characterFacingDir) + 2;
- fichcani.seek(posfilehabla);
- debug("LoadTalk direccionmovimiento=%d", characterFacingDir);
+ int32 offset = mainCharFrameSize * 16;
+ offset = (offset * charFacingDirection) + 2;
+ animFile.seek(offset);
+ debug("LoadTalk charFacingDirection=%d", charFacingDirection);
+ //Will load talking anim always in the upwards direction of the walk cycle array
for (int i = 0; i < 16; i++) {
mainCharAnimation.bitmap[0][i] = (byte *)malloc(mainCharFrameSize);
- fichcani.read(mainCharAnimation.bitmap[0][i], mainCharFrameSize);
+ animFile.read(mainCharAnimation.bitmap[0][i], mainCharFrameSize);
}
- fichcani.close();
+ animFile.close();
if ((currentRoomData->animationName != "PETER") && (currentRoomData->animationName != "ARZCAEL")) {
iframe2 = 0;
free(curSecondaryAnimationFrame);
bool result;
- switch (regobj.habla) {
+ switch (regobj.speaking) {
case 1:
- result = fichcani.open("JOHN.SEC");
+ result = animFile.open("JOHN.SEC");
break;
case 5:
- result = fichcani.open("ALFRED.SEC");
+ result = animFile.open("ALFRED.SEC");
break;
default:
- result = fichcani.open(Common::Path(currentRoomData->animationName + Common::String(".SEC")));
+ result = animFile.open(Common::Path(currentRoomData->animationName + Common::String(".SEC")));
}
if (!result)
showError(265);
- secondaryAnimFrameSize = fichcani.readUint16LE();
- secondaryAnimationFrameCount = fichcani.readByte();
- secondaryAnimDirCount = fichcani.readByte();
+ secondaryAnimFrameSize = animFile.readUint16LE();
+ secondaryAnimationFrameCount = animFile.readByte();
+ secondaryAnimDirCount = animFile.readByte();
curSecondaryAnimationFrame = (byte *)malloc(secondaryAnimFrameSize);
if (secondaryAnimDirCount != 0) {
secondaryAnimationFrameCount = secondaryAnimationFrameCount / 4;
for (int i = 0; i <= 3; i++) {
- loadAnimationForDirection(&fichcani, i);
+ loadAnimationForDirection(&animFile, i);
}
} else {
- loadAnimationForDirection(&fichcani, 0);
+ loadAnimationForDirection(&animFile, 0);
}
- fichcani.close();
+ animFile.close();
}
}
void unloadTalkAnimations() {
- Common::File fichcani;
- if (!fichcani.open("PERSONAJ.SPT")) {
+ Common::File animFile;
+ if (!animFile.open("PERSONAJ.SPT")) {
showError(265);
}
- mainCharFrameSize = fichcani.readUint16LE();
+ mainCharFrameSize = animFile.readUint16LE();
for (int i = 0; i < walkFrameCount; i++) {
mainCharAnimation.bitmap[0][i] = (byte *)malloc(mainCharFrameSize);
- fichcani.read(mainCharAnimation.bitmap[0][i], mainCharFrameSize);
+ animFile.read(mainCharAnimation.bitmap[0][i], mainCharFrameSize);
}
- fichcani.close();
+ animFile.close();
if ((currentRoomData->animationName != "PETER") && (currentRoomData->animationName != "ARZCAEL")) {
- if (!fichcani.open(Common::Path(currentRoomData->animationName + ".DAT"))) {
+ if (!animFile.open(Common::Path(currentRoomData->animationName + ".DAT"))) {
showError(265);
}
- secondaryAnimFrameSize = fichcani.readUint16LE();
- secondaryAnimationFrameCount = fichcani.readByte();
- secondaryAnimDirCount = fichcani.readByte();
+ secondaryAnimFrameSize = animFile.readUint16LE();
+ secondaryAnimationFrameCount = animFile.readByte();
+ secondaryAnimDirCount = animFile.readByte();
curSecondaryAnimationFrame = (byte *)malloc(secondaryAnimFrameSize);
if (secondaryAnimDirCount != 0) {
secondaryAnimationFrameCount = secondaryAnimationFrameCount / 4;
for (int i = 0; i <= 3; i++) {
- loadAnimationForDirection(&fichcani, i);
+ loadAnimationForDirection(&animFile, i);
}
} else {
- loadAnimationForDirection(&fichcani, 0);
+ loadAnimationForDirection(&animFile, 0);
}
- fichcani.close();
+ animFile.close();
}
}
@@ -4666,20 +4418,20 @@ TextEntry readVerbRegister() {
}
void hypertext(
- uint numreght,
- byte colortextoht,
- byte colorsombraht,
- uint &numresp,
+ uint textRef,
+ byte textColor,
+ byte shadowColor,
+ uint &responseNumber,
/** Whether the text being said is part of a conversation or just descriptions */
- bool banderaconversa) {
- TextEntry regmht;
+ bool isWithinConversation) {
+ TextEntry text;
- byte insertarnombre, iht, iteracionesht, lineaht, anchoht;
+ byte insertName, iht, iteracionesht, lineaht, anchoht;
byte direccionmovimientopaso;
- uint indiceaniconversa, tamfondoht, xht, yht;
+ uint indiceaniconversa, tambackgroundht, xht, yht;
- byte *fondotextht;
+ byte *backgroundtextht;
byte matrizsaltosht[15];
g_engine->_mouseManager->hide();
switch (currentRoomData->code) {
@@ -4750,45 +4502,45 @@ void hypertext(
}
}
- verb.seek(numreght * verbRegSize);
+ verb.seek(textRef * verbRegSize);
do {
- regmht = readVerbRegister();
+ text = readVerbRegister();
- insertarnombre = 0;
+ insertName = 0;
- for (int i = 0; i < regmht.text.size(); i++) {
- regmht.text.setChar(decryptionKey[i] ^ regmht.text[i], i);
- if (regmht.text[i] == '@')
- insertarnombre = i;
+ for (int i = 0; i < text.text.size(); i++) {
+ text.text.setChar(decryptionKey[i] ^ text.text[i], i);
+ if (text.text[i] == '@')
+ insertName = i;
}
- if (insertarnombre > 0) {
- regmht.text.deleteChar(insertarnombre);
- regmht.text.insertString(characterName, insertarnombre);
+ if (insertName > 0) {
+ text.text.deleteChar(insertName);
+ text.text.insertString(characterName, insertName);
}
- if (regmht.text.size() < anchoht) {
- tamfondoht = imagesize(xht - 1, yht - 1, xht + (regmht.text.size() * 8) + 2, yht + 13);
- fondotextht = (byte *)malloc(tamfondoht);
+ if (text.text.size() < anchoht) {
+ tambackgroundht = imagesize(xht - 1, yht - 1, xht + (text.text.size() * 8) + 2, yht + 13);
+ backgroundtextht = (byte *)malloc(tambackgroundht);
- g_engine->_graphics->getImg(xht - 1, yht - 1, xht + (regmht.text.size() * 8) + 2, yht + 13, fondotextht);
+ g_engine->_graphics->getImg(xht - 1, yht - 1, xht + (text.text.size() * 8) + 2, yht + 13, backgroundtextht);
- littText(xht - 1, yht, regmht.text, colorsombraht);
+ littText(xht - 1, yht, text.text, shadowColor);
g_engine->_screen->update();
delay(enforcedTextAnimDelay);
- littText(xht + 1, yht, regmht.text, colorsombraht);
+ littText(xht + 1, yht, text.text, shadowColor);
g_engine->_screen->update();
delay(enforcedTextAnimDelay);
- littText(xht, yht - 1, regmht.text, colorsombraht);
+ littText(xht, yht - 1, text.text, shadowColor);
g_engine->_screen->update();
delay(enforcedTextAnimDelay);
- littText(xht, yht + 1, regmht.text, colorsombraht);
+ littText(xht, yht + 1, text.text, shadowColor);
g_engine->_screen->update();
delay(enforcedTextAnimDelay);
- littText(xht, yht, regmht.text, colortextoht);
+ littText(xht, yht, text.text, textColor);
g_engine->_screen->update();
delay(enforcedTextAnimDelay);
} else {
@@ -4803,35 +4555,35 @@ void hypertext(
iteracionesht += 1;
do {
iht -= 1;
- } while (regmht.text[iht] != ' ');
+ } while (text.text[iht] != ' ');
matrizsaltosht[iteracionesht] = iht + 1;
- } while (iht + 1 <= regmht.text.size() - anchoht);
+ } while (iht + 1 <= text.text.size() - anchoht);
iteracionesht += 1;
- matrizsaltosht[iteracionesht] = regmht.text.size();
+ matrizsaltosht[iteracionesht] = text.text.size();
// Grab patch of background behind where the text will be, to paste it back later
- tamfondoht = imagesize(xht - 1, yht - 1, xht + (anchoht * 8) + 2, yht + iteracionesht * 13);
- fondotextht = (byte *)malloc(tamfondoht);
- g_engine->_graphics->getImg(xht - 1, yht - 1, xht + (anchoht * 8) + 2, yht + iteracionesht * 13, fondotextht);
+ tambackgroundht = imagesize(xht - 1, yht - 1, xht + (anchoht * 8) + 2, yht + iteracionesht * 13);
+ backgroundtextht = (byte *)malloc(tambackgroundht);
+ g_engine->_graphics->getImg(xht - 1, yht - 1, xht + (anchoht * 8) + 2, yht + iteracionesht * 13, backgroundtextht);
for (lineaht = 1; lineaht <= iteracionesht; lineaht++) {
- Common::String lineString = Common::String(regmht.text.c_str() + matrizsaltosht[lineaht - 1], regmht.text.c_str() + matrizsaltosht[lineaht]);
+ Common::String lineString = Common::String(text.text.c_str() + matrizsaltosht[lineaht - 1], text.text.c_str() + matrizsaltosht[lineaht]);
- littText(xht + 1, yht + ((lineaht - 1) * 11), lineString, colorsombraht);
+ littText(xht + 1, yht + ((lineaht - 1) * 11), lineString, shadowColor);
g_engine->_screen->update();
delay(enforcedTextAnimDelay);
- littText(xht - 1, yht + ((lineaht - 1) * 11), lineString, colorsombraht);
+ littText(xht - 1, yht + ((lineaht - 1) * 11), lineString, shadowColor);
g_engine->_screen->update();
delay(enforcedTextAnimDelay);
- littText(xht, yht + ((lineaht - 1) * 11) + 1, lineString, colorsombraht);
+ littText(xht, yht + ((lineaht - 1) * 11) + 1, lineString, shadowColor);
g_engine->_screen->update();
delay(enforcedTextAnimDelay);
- littText(xht, yht + ((lineaht - 1) * 11) - 1, lineString, colorsombraht);
+ littText(xht, yht + ((lineaht - 1) * 11) - 1, lineString, shadowColor);
g_engine->_screen->update();
delay(enforcedTextAnimDelay);
- littText(xht, yht + ((lineaht - 1) * 11), lineString, colortextoht);
+ littText(xht, yht + ((lineaht - 1) * 11), lineString, textColor);
g_engine->_screen->update();
delay(enforcedTextAnimDelay);
}
@@ -4851,12 +4603,12 @@ void hypertext(
}
changeGameSpeed(e);
}
- if (tocapintar) {
- tocapintar = false;
- if (tocapintar2) {
- if (banderaconversa) {
+ if (timeToDraw) {
+ timeToDraw = false;
+ if (timeToDraw2) {
+ if (isWithinConversation) {
indiceaniconversa += 1;
- if (colortextoht == 255) {
+ if (textColor == 255) {
iframe2 = 0;
if (iframe >= 15)
iframe = 0;
@@ -4871,10 +4623,10 @@ void hypertext(
iframe2++;
}
// Talk sprites are always put in facing direction 0
- direccionmovimientopaso = characterFacingDir;
- characterFacingDir = 0;
+ direccionmovimientopaso = charFacingDirection;
+ charFacingDirection = 0;
sprites(true);
- characterFacingDir = direccionmovimientopaso;
+ charFacingDirection = direccionmovimientopaso;
} else {
if (currentSecondaryTrajectoryIndex >= currentRoomData->secondaryTrajectoryLength)
currentSecondaryTrajectoryIndex = 1;
@@ -4890,8 +4642,8 @@ void hypertext(
sprites(false);
}
}
- if (currentRoomData->paletteAnimationFlag && saltospal >= 4) {
- saltospal = 0;
+ if (currentRoomData->paletteAnimationFlag && palAnimStep >= 4) {
+ palAnimStep = 0;
if (isPaletteAnimEnabled > 6)
isPaletteAnimEnabled = 0;
else
@@ -4900,27 +4652,27 @@ void hypertext(
g_engine->_sound->playVoc();
updatePalette(isPaletteAnimEnabled);
} else
- saltospal += 1;
+ palAnimStep += 1;
}
g_engine->_screen->update();
g_system->delayMillis(10);
- } while (indiceaniconversa <= (regmht.text.size() * 4) && !mouseClicked && !g_engine->shouldQuit());
+ } while (indiceaniconversa <= (text.text.size() * 4) && !mouseClicked && !g_engine->shouldQuit());
- g_engine->_graphics->putImg(xht - 1, yht - 1, fondotextht);
- free(fondotextht);
+ g_engine->_graphics->putImg(xht - 1, yht - 1, backgroundtextht);
+ free(backgroundtextht);
g_system->delayMillis(10);
- } while (regmht.continued && !g_engine->shouldQuit());
- numresp = regmht.response;
+ } while (text.continued && !g_engine->shouldQuit());
+ responseNumber = text.response;
g_engine->_mouseManager->show();
}
void wcScene() {
- palette palwater;
+ palette wcPalette;
currentZone = currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount];
goToObject(currentZone, targetZone);
- copyPalette(pal, palwater);
+ copyPalette(pal, wcPalette);
g_engine->_mouseManager->hide();
partialFadeOut(234);
@@ -4954,7 +4706,7 @@ void wcScene() {
characterPosX = 76 - characterCorrectionX;
characterPosY = 78 - characerCorrectionY;
- copyPalette(palwater, pal);
+ copyPalette(wcPalette, pal);
restoreBackground();
assembleScreen();
drawScreen(sceneBackground);
@@ -4977,7 +4729,6 @@ void readConversationFile(Common::String f) {
showError(314);
}
int64 fileSize = conversationFile.size();
- // TODO: Will this be freed automatically by the `MemorySeekableReadWriteStream`?
byte *buf = (byte *)malloc(fileSize);
conversationFile.read(buf, fileSize);
@@ -5013,7 +4764,6 @@ void saveRoomObjectList(RoomObjectListEntry objectList, Common::SeekableWriteStr
int paddingSize = 20 - objectList.objectName.size();
if (paddingSize < 20) {
screenDataStream->writeString(objectList.objectName);
- // screenDataStream->write(objectList->objectName, objectList.dummy);
}
if (paddingSize > 0) {
char *padding = (char *)malloc(paddingSize);
@@ -5118,7 +4868,7 @@ void saveItem(ScreenObject object, Common::SeekableWriteStream *objectDataStream
objectDataStream->writeUint16LE(object.pickTextRef);
objectDataStream->writeUint16LE(object.useTextRef);
- objectDataStream->writeByte(object.habla);
+ objectDataStream->writeByte(object.speaking);
objectDataStream->writeByte(object.openable);
objectDataStream->writeByte(object.closeable);
@@ -5153,12 +4903,12 @@ void saveItemRegister(ScreenObject object, Common::SeekableWriteStream *stream)
saveItem(object, stream);
}
-void printHornacinas() {
+void printNiches() {
debug("| | %03d | %03d | %03d | %03d |", 0, 1, 2, 3);
debug("| 0 | %03d | %03d | %03d | %03d |", niche[0][0], niche[0][1], niche[0][2], niche[0][3]);
debug("| 1 | %03d | %03d | %03d | %03d |", niche[1][0], niche[1][1], niche[1][2], niche[1][3]);
- debug("hornacina[0][hornacina[0][3]] = %d", niche[0][niche[0][3]]);
- debug("hornacina[1][hornacina[1][3]] = %d", niche[1][niche[1][3]]);
+ debug("niche[0][niche[0][3]] = %d", niche[0][niche[0][3]]);
+ debug("niche[1][niche[1][3]] = %d", niche[1][niche[1][3]]);
}
} // End of namespace Tot
diff --git a/engines/tot/routines.h b/engines/tot/routines.h
index e74e8abdd45..77213cba58e 100644
--- a/engines/tot/routines.h
+++ b/engines/tot/routines.h
@@ -25,21 +25,21 @@
#include "tot/anims.h"
#include "tot/graphics.h"
-#include "tot/playanim.h"
+#include "tot/vars.h"
#include "tot/routines2.h"
#include "tot/util.h"
namespace Tot {
void drawText(uint number);
-void processingActive();
+void displayLoading();
void runaroundRed();
void sprites(bool drawCharacter);
void loadScreenData(uint screenNumber);
RoomFileRegister *readScreenDataFile(Common::SeekableReadStream *screenDataFile);
void saveRoomData(RoomFileRegister *room, Common::SeekableWriteStream *stream);
void calculateTrajectory(uint finalx, uint finaly);
-void lookInventoryObject(byte objectNumber);
+void lookAtObject(byte objectNumber);
void useInventoryObjectWithInventoryObject(uint objectNo1, uint objectNo2);
void pickupScreenObject();
void useScreenObject();
@@ -70,7 +70,7 @@ TextEntry readVerbRegister(uint numRegister);
TextEntry readVerbRegister();
void readConversationFile(Common::String f);
-void printHornacinas();
+void printNiches();
} // End of namespace Tot
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
index 29173d61ef6..bfe03d484cf 100644
--- a/engines/tot/routines2.cpp
+++ b/engines/tot/routines2.cpp
@@ -49,35 +49,35 @@ void loadAnimationForDirection(Common::SeekableReadStream *stream, int direction
}
}
-void loadAnimation(Common::String animacion) {
+void loadAnimation(Common::String animationName) {
debug("Loading animation!");
- Common::File fichcani;
+ Common::File animFile;
- if (animacion == "PETER")
+ if (animationName == "PETER")
isPeterCoughing = true;
else
isPeterCoughing = false;
isSecondaryAnimationEnabled = true;
- if (!fichcani.open(Common::Path(animacion + ".DAT"))) {
+ if (!animFile.open(Common::Path(animationName + ".DAT"))) {
showError(265);
}
- secondaryAnimFrameSize = fichcani.readUint16LE();
- secondaryAnimationFrameCount = fichcani.readByte();
- secondaryAnimDirCount = fichcani.readByte();
+ secondaryAnimFrameSize = animFile.readUint16LE();
+ secondaryAnimationFrameCount = animFile.readByte();
+ secondaryAnimDirCount = animFile.readByte();
curSecondaryAnimationFrame = (byte *)malloc(secondaryAnimFrameSize);
if (secondaryAnimDirCount != 0) {
secondaryAnimationFrameCount = secondaryAnimationFrameCount / 4;
for (int i = 0; i <= 3; i++) {
- loadAnimationForDirection(&fichcani, i);
+ loadAnimationForDirection(&animFile, i);
}
} else {
- loadAnimationForDirection(&fichcani, 0);
+ loadAnimationForDirection(&animFile, 0);
}
- fichcani.close();
+ animFile.close();
debug("Read all frames! longtray2=%d", currentRoomData->secondaryTrajectoryLength);
secondaryAnimWidth = READ_LE_UINT16(secondaryAnimation.bitmap[0][1]) + 1;
secondaryAnimHeight = READ_LE_UINT16(secondaryAnimation.bitmap[0][1] + 2) + 1;
@@ -209,50 +209,11 @@ void updateAltScreen(byte otherScreenNumber) {
setRoomTrajectories(secondaryAnimHeight, secondaryAnimWidth, SET_WITH_ANIM);
}
-struct regzxc {
- byte cabecera[258];
- char cadena[8];
- byte relleno[327];
- byte masrelleno[5268];
-};
-
void verifyCopyProtection() {
- // regzxc regiszxc;
- // varying_string<8> rombioszxc, cadenaauxzxc, cadenarefzxc;
- // byte indicezxc;
-
- // Common::File fichzxc;
- // if(!fichzxc.open("MCGA.TWK")){
- // error("verifyCopyProtection(): ioresult (273)");
- // }
-
- // fichzxc.read(regiszxc.cabecera, 258);
- // fichzxc.read(regiszxc.cadena, 8);
- // fichzxc.read(regiszxc.relleno, 327);
- // fichzxc.read(regiszxc.masrelleno, 5268);
-
- // fichzxc.close();
- // rombioszxc = "";
- // rombioszxc[0] = '\0';
- // cadenaauxzxc[0] = '\0';
- // for (indicezxc = 0; indicezxc <= 7; indicezxc ++)
- // rombioszxc = rombioszxc + chr(mem[0xf000 * 1337 + (0xfff5+indicezxc)]);
- // cadenaauxzxc = regiszxc.cadena;
- // for (indicezxc = 1; indicezxc <= 8; indicezxc ++)
- // cadenaauxzxc[indicezxc] = chr((ord(regiszxc.cadena[indicezxc])
- // ^ ord(rombioszxc[indicezxc])));
- // indicezxc = 17 * 10;
- // cadenarefzxc = string(chr(indicezxc + 10)) + chr(indicezxc + 11) + chr(indicezxc + 12)
- // + chr(indicezxc + 13) + chr(indicezxc + 14) + chr(indicezxc + 15)
- // + chr(indicezxc + 16) + chr(indicezxc + 17);
- // cadenarefzxc[0] = '\10';
- // if (cadenaauxzxc != cadenarefzxc) {
- // contadorpc += 1;
- // contadorpc2 += 1;
- // }
-}
-
-void cargatele() {
+ //TODO: Copy protection
+}
+
+void loadTV() {
Common::File fichct;
if (!fichct.open("PALETAS.DAT")) {
@@ -276,7 +237,7 @@ void cargatele() {
}
void loadScreen() {
- Common::File fichcp;
+ Common::File paletteFile;
palette palcp;
screenSize = currentRoomData->roomImageSize;
@@ -284,20 +245,20 @@ void loadScreen() {
Common::copy(sceneBackground, sceneBackground + screenSize, backgroundCopy);
switch (gamePart) {
case 1: {
- if (!fichcp.open("PALETAS.DAT")) {
+ if (!paletteFile.open("PALETAS.DAT")) {
showError(310);
}
- fichcp.seek(currentRoomData->palettePointer);
- fichcp.read(palcp, 603);
+ paletteFile.seek(currentRoomData->palettePointer);
+ paletteFile.read(palcp, 603);
if (currentRoomData->paletteAnimationFlag) {
- fichcp.read(palAnimSlice, 144);
+ paletteFile.read(palAnimSlice, 144);
for (int i = 0; i <= 48; i++) {
palAnimSlice[i * 3 + 0] = palAnimSlice[i * 3 + 0] << 2;
palAnimSlice[i * 3 + 1] = palAnimSlice[i * 3 + 1] << 2;
palAnimSlice[i * 3 + 2] = palAnimSlice[i * 3 + 2] << 2;
}
}
- fichcp.close();
+ paletteFile.close();
for (int i = 1; i <= 200; i++) {
pal[i * 3 + 0] = palcp[i * 3 + 0] << 2;
pal[i * 3 + 1] = palcp[i * 3 + 1] << 2;
@@ -314,7 +275,7 @@ void loadScreen() {
void loadCharAnimation() {
Common::File characterFile;
- contadorpc = contadorpc2;
+ cpCounter = cpCounter2;
if (!characterFile.open("PERSONAJ.SPT"))
showError(265);
@@ -336,19 +297,11 @@ void loadCharAnimation() {
}
void freeScreenObjects() {
- uint indicecarga;
-
- for (indicecarga = 0; indicecarga < numScreenOverlays; indicecarga++) {
- if (screenObjects[indicecarga] != NULL)
- free(screenObjects[indicecarga]);
- screenObjects[indicecarga] = NULL;
+ for (int i = 0; i < numScreenOverlays; i++) {
+ if (screenLayers[i] != NULL)
+ free(screenLayers[i]);
+ screenLayers[i] = NULL;
}
-
- // if (liberadormem != nil) {
- // release(liberadormem);
- // liberadormem = nil;
- // }
- // verifyCopyProtection2();
}
void freeAnimation() {
@@ -362,80 +315,48 @@ void freeAnimation() {
void freeInventory() {
for (int i = 0; i < inventoryIconCount; i++) {
- free(mochilaxms[i]);
+ free(inventoryIconBitmaps[i]);
}
}
-// struct regas {
-// array<1, 258, byte> cabecera;
-// varying_string<8> cadena;
-// array<1, 327, byte> relleno;
-// array<1, 5268, byte> masrelleno;
-// };
-
void verifyCopyProtection2() {
- // file<regas> fichas;
- // regas regisas;
- // varying_string<8> rombiosas, cadenaauxas, cadenarefas;
- // byte indiceas;
-
- // rombiosas = "";
- // rombiosas[0] = '\0';
- // reset(fichas);
- // if (ioresult != 0)
- // error("verifyCopyProtection2(): ioresult (273)");
- // fichas >> regisas;
- // close(fichas);
- // cadenaauxas[0] = '\0';
- // cadenaauxas = regisas.cadena;
- // for (indiceas = 0; indiceas <= 7; indiceas++)
- // rombiosas = rombiosas + chr(mem[0xf000 * 1337 + (0xfff5 + indiceas)]);
- // for (indiceas = 1; indiceas <= 8; indiceas++)
- // cadenaauxas[indiceas] = chr((ord(regisas.cadena[indiceas]) ^ ord(rombiosas[indiceas])));
- // indiceas = 18 * 10;
- // cadenarefas = string(chr(indiceas)) + chr(indiceas + 1) + chr(indiceas + 2) + chr(indiceas + 3) +
- // chr(indiceas + 4) + chr(indiceas + 5) + chr(indiceas + 6) + chr(indiceas + 7);
- // cadenarefas[0] = '\10';
- // if (cadenaauxas != cadenarefas) {
- // contadorpc2 += 1;
- // contadorpc += 1;
- // }
-}
-void loadItemWithFixedDepth(uint coordx, uint coordy, uint tamdibujo, int32 dibujo, uint prof) {
- screenObjects[prof] = (byte *)malloc(tamdibujo);
- readBitmap(dibujo, screenObjects[prof], tamdibujo, 319);
+ // TODO:
+}
+void loadItemWithFixedDepth(uint coordx, uint coordy, uint bitmapSize, int32 bitmapIndex, uint depth) {
+ screenLayers[depth] = (byte *)malloc(bitmapSize);
+ readBitmap(bitmapIndex, screenLayers[depth], bitmapSize, 319);
uint16 w, h;
- w = READ_LE_UINT16(screenObjects[prof]);
- h = READ_LE_UINT16(screenObjects[prof] + 2);
- depthMap[prof].posx = coordx;
- depthMap[prof].posy = coordy;
- depthMap[prof].posx2 = coordx + w + 1;
- depthMap[prof].posy2 = coordy + h + 1;
+ w = READ_LE_UINT16(screenLayers[depth]);
+ h = READ_LE_UINT16(screenLayers[depth] + 2);
+ depthMap[depth].posx = coordx;
+ depthMap[depth].posy = coordy;
+ depthMap[depth].posx2 = coordx + w + 1;
+ depthMap[depth].posy2 = coordy + h + 1;
}
-void loadItem(uint coordx, uint coordy, uint tamdibujo, int32 dibujo, uint prof) {
- loadItemWithFixedDepth(coordx, coordy, tamdibujo, dibujo, prof - 1);
+void loadItem(uint coordx, uint coordy, uint bitmapSize, int32 bitmapIndex, uint depth) {
+ loadItemWithFixedDepth(coordx, coordy, bitmapSize, bitmapIndex, depth - 1);
}
-void updateInventory(byte indicador) {
- for (int ind_mo = indicador; ind_mo < (inventoryIconCount - 1); ind_mo++) {
- mobj[ind_mo].bitmapIndex = mobj[ind_mo + 1].bitmapIndex;
- mobj[ind_mo].code = mobj[ind_mo + 1].code;
- mobj[ind_mo].objectName = mobj[ind_mo + 1].objectName;
+void updateInventory(byte index) {
+ for (int i = index; i < (inventoryIconCount - 1); i++) {
+ mobj[i].bitmapIndex = mobj[i + 1].bitmapIndex;
+ mobj[i].code = mobj[i + 1].code;
+ mobj[i].objectName = mobj[i + 1].objectName;
}
// verifyCopyProtection();
}
-void readBitmap(int32 posbm, byte *puntbm, uint tambm, uint errorbm) {
- Common::File fichbitmap;
- if (!fichbitmap.open("BITMAPS.DAT")) {
- showError(errorbm);
+void readBitmap(int32 bitmapPosition, byte *buf, uint bitmapSize, uint error) {
+ Common::File bitmapFile;
+ if (!bitmapFile.open("BITMAPS.DAT")) {
+ showError(error);
}
- fichbitmap.seek(posbm);
- fichbitmap.read(puntbm, tambm);
+ bitmapFile.seek(bitmapPosition);
+ bitmapFile.read(buf, bitmapSize);
- fichbitmap.close();
+ bitmapFile.close();
}
void updateItem(uint itemPosition) {
@@ -459,7 +380,7 @@ void readItemRegister(Common::SeekableReadStream *stream, uint itemPos, ScreenOb
thisRegObj.afterUseTextRef = stream->readUint16LE();
thisRegObj.pickTextRef = stream->readUint16LE();
thisRegObj.useTextRef = stream->readUint16LE();
- thisRegObj.habla = stream->readByte();
+ thisRegObj.speaking = stream->readByte();
thisRegObj.openable = stream->readByte();
thisRegObj.closeable = stream->readByte();
@@ -497,9 +418,9 @@ void drawLookAtItem(RoomObjectListEntry obj) {
g_engine->_mouseManager->show();
}
-void putIcon(uint posiconx, uint posicony, uint numicon) {
+void putIcon(uint iconPosX, uint iconPosY, uint iconNum) {
// substract 1 to account for 1-based indices
- g_engine->_graphics->putImg(posiconx, posicony, mochilaxms[mobj[numicon].bitmapIndex - 1]);
+ g_engine->_graphics->putImg(iconPosX, iconPosY, inventoryIconBitmaps[mobj[iconNum].bitmapIndex - 1]);
}
void drawBackpack() {
@@ -539,8 +460,8 @@ void turnOffRight() {
line(311, 190, 292, 190, 255);
}
-void inventory(byte direccion, byte tope) {
- switch (direccion) {
+void inventory(byte dir, byte max) {
+ switch (dir) {
case 0:
if (inventoryPosition > 0) {
inventoryPosition -= 1;
@@ -548,7 +469,7 @@ void inventory(byte direccion, byte tope) {
}
break;
case 1:
- if (inventoryPosition < (tope - 6)) {
+ if (inventoryPosition < (max - 6)) {
inventoryPosition += 1;
drawBackpack();
}
@@ -564,15 +485,15 @@ void inventory(byte direccion, byte tope) {
else
turnOffRight();
g_engine->_mouseManager->show();
- if (contadorpc > 145)
+ if (cpCounter > 145)
showError(274);
}
void mask() {
- byte ytextaux;
- buttonBorder(0, 140, 319, 149, 0, 0, 0, 0, 0, 0, "");
- for (ytextaux = 1; ytextaux <= 25; ytextaux++)
- buttonBorder(0, (175 - ytextaux), 319, (174 + ytextaux), 251, 251, 251, 251, 0, 0, "");
+
+ buttonBorder(0, 140, 319, 149, 0, 0, 0, 0, 0);
+ for (int i = 1; i <= 25; i++)
+ buttonBorder(0, (175 - i), 319, (174 + i), 251, 251, 251, 251, 0);
drawMenu(1);
// verifyCopyProtection();
if (inventoryPosition > 1)
@@ -585,21 +506,21 @@ void mask() {
turnOffRight();
}
-void drawMenu(byte nummenu) {
- byte *punteromenu;
- uint tampunteromenu;
+void drawMenu(byte menuNumber) {
+ byte *bitmap;
+ uint menuSize;
byte xmenu, ymenu;
- long posicionmenu;
+ long menuOffset;
Common::File menuFile;
if (!menuFile.open("MENUS.DAT")) {
showError(258);
}
- posicionmenu = g_engine->_lang == Common::ES_ESP ? menuOffsets_ES[nummenu - 1][0] : menuOffsets_EN[nummenu - 1][0];
- tampunteromenu = g_engine->_lang == Common::ES_ESP ? menuOffsets_ES[nummenu - 1][1] : menuOffsets_EN[nummenu - 1][1];
+ menuOffset = g_engine->_lang == Common::ES_ESP ? menuOffsets_ES[menuNumber - 1][0] : menuOffsets_EN[menuNumber - 1][0];
+ menuSize = g_engine->_lang == Common::ES_ESP ? menuOffsets_ES[menuNumber - 1][1] : menuOffsets_EN[menuNumber - 1][1];
- switch (nummenu) {
+ switch (menuNumber) {
case 1: {
xmenu = 0;
ymenu = 150;
@@ -613,13 +534,13 @@ void drawMenu(byte nummenu) {
ymenu = 10;
} break;
case 4: {
- if (contadorpc2 > 20)
+ if (cpCounter2 > 20)
showError(274);
xmenu = 50;
ymenu = 10;
} break;
case 5: {
- if (contadorpc > 23)
+ if (cpCounter > 23)
showError(274);
xmenu = 0;
ymenu = 150;
@@ -638,58 +559,58 @@ void drawMenu(byte nummenu) {
} break;
}
- punteromenu = (byte *)malloc(tampunteromenu);
- menuFile.seek(posicionmenu);
- menuFile.read(punteromenu, tampunteromenu);
- g_engine->_graphics->putImg(xmenu, ymenu, punteromenu);
- free(punteromenu);
+ bitmap = (byte *)malloc(menuSize);
+ menuFile.seek(menuOffset);
+ menuFile.read(bitmap, menuSize);
+ g_engine->_graphics->putImg(xmenu, ymenu, bitmap);
+ free(bitmap);
menuFile.close();
}
-void generateDiploma(Common::String &nombrefoto);
+void generateDiploma(Common::String &photoName);
-static void loadDiploma(Common::String &nombrefoto, Common::String &clave) {
- palette palauxlocal;
- byte *pantalla;
+static void loadDiploma(Common::String &photoName, Common::String &key) {
+ palette auxPal;
+ byte *screen;
uint size;
- byte *sello;
+ byte *stamp;
- Common::File fich;
- if (!fich.open("DIPLOMA.PAN")) {
+ Common::File dipFile;
+ if (!dipFile.open("DIPLOMA.PAN")) {
showError(318);
}
- fich.read(palauxlocal, 768);
+ dipFile.read(auxPal, 768);
- pantalla = (byte *)malloc(64000);
- fich.read(pantalla, 64000);
- fich.close();
+ screen = (byte *)malloc(64000);
+ dipFile.read(screen, 64000);
+ dipFile.close();
- if (!fich.open(Common::Path("DIPLOMA/SELLO.BMP")))
+ if (!dipFile.open(Common::Path("DIPLOMA/SELLO.BMP")))
showError(271);
- sello = (byte *)malloc(2054);
- fich.read(sello, 2054);
- fich.close();
- drawFullScreen(pantalla);
-
- free(pantalla);
-
- if (fich.open(Common::Path("DIPLOMA/" + nombrefoto + ".FOT"))) {
- size = fich.size() - 768;
- pantalla = (byte *)malloc(size);
- fich.read(pal, 768);
- fich.read(pantalla, size);
- fich.close();
- g_engine->_graphics->putShape(10, 20, pantalla);
- free(pantalla);
+ stamp = (byte *)malloc(2054);
+ dipFile.read(stamp, 2054);
+ dipFile.close();
+ drawFullScreen(screen);
+
+ free(screen);
+
+ if (dipFile.open(Common::Path("DIPLOMA/" + photoName + ".FOT"))) {
+ size = dipFile.size() - 768;
+ screen = (byte *)malloc(size);
+ dipFile.read(pal, 768);
+ dipFile.read(screen, size);
+ dipFile.close();
+ g_engine->_graphics->putShape(10, 20, screen);
+ free(screen);
}
for (int i = 16; i <= 255; i++) {
- palauxlocal[i * 3 + 0] = pal[i * 3 + 0];
- palauxlocal[i * 3 + 1] = pal[i * 3 + 1];
- palauxlocal[i * 3 + 2] = pal[i * 3 + 2];
+ auxPal[i * 3 + 0] = pal[i * 3 + 0];
+ auxPal[i * 3 + 1] = pal[i * 3 + 1];
+ auxPal[i * 3 + 2] = pal[i * 3 + 2];
}
- copyPalette(palauxlocal, pal);
+ copyPalette(auxPal, pal);
g_engine->_graphics->fixPalette(pal, 768);
g_engine->_graphics->setPalette(pal);
g_engine->_screen->markAllDirty();
@@ -699,11 +620,11 @@ static void loadDiploma(Common::String &nombrefoto, Common::String &clave) {
for (int i = 0; i < 10; i++)
passArray[i] = (char)(Random(10) + 48);
- clave.append(passArray, passArray + 10);
+ key.append(passArray, passArray + 10);
const char *const *messages = (g_engine->_lang == Common::ES_ESP) ? fullScreenMessages[0] : fullScreenMessages[1];
- biosText(91, 16, messages[49] + clave, 255);
- biosText(90, 15, messages[49] + clave, 13);
+ biosText(91, 16, messages[49] + key, 255);
+ biosText(90, 15, messages[49] + key, 13);
biosText(81, 61, messages[50], 0);
biosText(61, 81, messages[51], 0);
@@ -724,23 +645,23 @@ static void loadDiploma(Common::String &nombrefoto, Common::String &clave) {
delay(1500);
g_engine->_sound->playVoc("PORTAZO", 434988, 932);
// putShape(270, 161, (byte *)sello);
- g_engine->_graphics->putShape(270, 159, sello);
- free(sello);
+ g_engine->_graphics->putShape(270, 159, stamp);
+ free(stamp);
}
-static void saveDiploma(Common::String &nombrefoto, Common::String &clave) {
- byte *panta;
- Common::DumpFile fich;
+static void saveDiploma(Common::String &photoName, Common::String &key) {
+ byte *screen;
+ Common::DumpFile outDip;
Common::Path path;
- if (nombrefoto != "")
- path = Common::Path("DIPLOMA/" + nombrefoto + ".DIP");
+ if (photoName != "")
+ path = Common::Path("DIPLOMA/" + photoName + ".DIP");
else
path = Common::Path("DIPLOMA/DEFAULT.DIP");
- fich.open(path, true);
+ outDip.open(path, true);
debug("Path: %s", path.toString().c_str());
- if (!fich.isOpen()) {
+ if (!outDip.isOpen()) {
error("Could not open output file!");
}
@@ -750,27 +671,27 @@ static void saveDiploma(Common::String &nombrefoto, Common::String &clave) {
for (int i = 0; i < 768; i++) {
palBuf[i] = palBuf[i] >> 2;
}
- char fixedClave[10];
- fixedClave[0] = 10;
+ char fixedKey[10];
+ fixedKey[0] = 10;
for (int i = 1; i < 10; i++) {
- fixedClave[i] = clave[i - 1];
+ fixedKey[i] = key[i - 1];
}
- fich.write(palBuf, 768);
- fich.write(fixedClave, 10);
- panta = (byte *)malloc(64000);
- copyFromScreen(panta);
- fich.write(panta, 64000);
- fich.finalize();
- fich.close();
- free(panta);
+ outDip.write(palBuf, 768);
+ outDip.write(fixedKey, 10);
+ screen = (byte *)malloc(64000);
+ copyFromScreen(screen);
+ outDip.write(screen, 64000);
+ outDip.finalize();
+ outDip.close();
+ free(screen);
}
-void generateDiploma(Common::String &nombrefoto) {
- Common::String clave;
+void generateDiploma(Common::String &photoName) {
+ Common::String key;
- nombrefoto.toUppercase();
+ photoName.toUppercase();
totalFadeOut(0);
- loadDiploma(nombrefoto, clave);
+ loadDiploma(photoName, key);
Common::Event e;
bool keyPressed = false;
@@ -783,52 +704,52 @@ void generateDiploma(Common::String &nombrefoto) {
}
g_system->delayMillis(10);
} while (!keyPressed && !g_engine->shouldQuit());
- saveDiploma(nombrefoto, clave);
+ saveDiploma(photoName, key);
}
void checkMouseGrid() {
- uint xrejilla, yrejilla;
- Common::String objmochila;
- if (contadorpc2 > 120)
+ uint xGrid, yGrid;
+ Common::String invObject;
+ if (cpCounter2 > 120)
showError(274);
if (mouseY >= 0 && mouseY <= 131) {
- xrejilla = (mouseX + 7) / xGridCount;
- yrejilla = (mouseY + 7) / yGridCount;
- if (currentRoomData->mouseGrid[xrejilla][yrejilla] != currentRoomData->mouseGrid[oldGridX][oldGridY] || oldInventoryObjectName != "") {
+ xGrid = (mouseX + 7) / xGridCount;
+ yGrid = (mouseY + 7) / yGridCount;
+ if (currentRoomData->mouseGrid[xGrid][yGrid] != currentRoomData->mouseGrid[oldGridX][oldGridY] || oldInventoryObjectName != "") {
bar(0, 140, 319, 149, 0);
Common::String actionLine;
switch (actionCode) {
case 0:
- actionLine = getActionLineText(0) + currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
+ actionLine = getActionLineText(0) + currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[xGrid][yGrid]]->objectName;
break;
case 1:
- actionLine = getActionLineText(1) + currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
+ actionLine = getActionLineText(1) + currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[xGrid][yGrid]]->objectName;
break;
case 2:
- actionLine = getActionLineText(2) + currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
+ actionLine = getActionLineText(2) + currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[xGrid][yGrid]]->objectName;
break;
case 3:
- actionLine = getActionLineText(3) + currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
+ actionLine = getActionLineText(3) + currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[xGrid][yGrid]]->objectName;
break;
case 4:
if (inventoryObjectName != "")
- actionLine = getActionLineText(4) + inventoryObjectName + getActionLineText(7) + currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
+ actionLine = getActionLineText(4) + inventoryObjectName + getActionLineText(7) + currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[xGrid][yGrid]]->objectName;
else
- actionLine = getActionLineText(4) + currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
+ actionLine = getActionLineText(4) + currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[xGrid][yGrid]]->objectName;
break;
case 5:
- actionLine = getActionLineText(5) + currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
+ actionLine = getActionLineText(5) + currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[xGrid][yGrid]]->objectName;
break;
case 6:
- actionLine = getActionLineText(6) + currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
+ actionLine = getActionLineText(6) + currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[xGrid][yGrid]]->objectName;
break;
default:
- actionLine = getActionLineText(0) + currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[xrejilla][yrejilla]]->objectName;
+ actionLine = getActionLineText(0) + currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[xGrid][yGrid]]->objectName;
}
actionLineText(actionLine);
g_engine->_mouseManager->show();
- oldGridX = xrejilla;
- oldGridY = yrejilla;
+ oldGridX = xGrid;
+ oldGridY = yGrid;
}
oldActionCode = 253;
oldInventoryObjectName = "";
@@ -871,52 +792,52 @@ void checkMouseGrid() {
}
} else if (mouseY >= 166 && mouseY <= 199) {
if (mouseX >= 26 && mouseX <= 65) {
- objmochila = mobj[inventoryPosition].objectName;
+ invObject = mobj[inventoryPosition].objectName;
} else if (mouseX >= 70 && mouseX <= 108) {
- objmochila = mobj[inventoryPosition + 1].objectName;
+ invObject = mobj[inventoryPosition + 1].objectName;
} else if (mouseX >= 113 && mouseX <= 151) {
- objmochila = mobj[inventoryPosition + 2].objectName;
+ invObject = mobj[inventoryPosition + 2].objectName;
} else if (mouseX >= 156 && mouseX <= 194) {
- objmochila = mobj[inventoryPosition + 3].objectName;
+ invObject = mobj[inventoryPosition + 3].objectName;
} else if (mouseX >= 199 && mouseX <= 237) {
- objmochila = mobj[inventoryPosition + 4].objectName;
+ invObject = mobj[inventoryPosition + 4].objectName;
} else if (mouseX >= 242 && mouseX <= 280) {
- objmochila = mobj[inventoryPosition + 5].objectName;
+ invObject = mobj[inventoryPosition + 5].objectName;
} else {
- objmochila = ' ';
+ invObject = ' ';
}
- if (objmochila != oldInventoryObjectName || oldGridX != 0) {
+ if (invObject != oldInventoryObjectName || oldGridX != 0) {
bar(0, 140, 319, 149, 0);
Common::String actionLine;
switch (actionCode) {
case 1:
- actionLine = getActionLineText(1) + objmochila;
+ actionLine = getActionLineText(1) + invObject;
break;
case 2:
- actionLine = getActionLineText(2) + objmochila;
+ actionLine = getActionLineText(2) + invObject;
break;
case 3:
- actionLine = getActionLineText(3) + objmochila;
+ actionLine = getActionLineText(3) + invObject;
break;
case 4:
if (inventoryObjectName == "")
- actionLine = getActionLineText(4) + objmochila;
+ actionLine = getActionLineText(4) + invObject;
else
- actionLine = getActionLineText(4) + inventoryObjectName + getActionLineText(7) + objmochila;
+ actionLine = getActionLineText(4) + inventoryObjectName + getActionLineText(7) + invObject;
break;
case 5:
- actionLine = getActionLineText(5) + objmochila;
+ actionLine = getActionLineText(5) + invObject;
break;
case 6:
- actionLine = getActionLineText(6) + objmochila;
+ actionLine = getActionLineText(6) + invObject;
break;
default:
- euroText(160, 144, objmochila, 255, Graphics::kTextAlignCenter);
+ euroText(160, 144, invObject, 255, Graphics::kTextAlignCenter);
}
actionLineText(actionLine);
g_engine->_mouseManager->show();
- oldInventoryObjectName = objmochila;
+ oldInventoryObjectName = invObject;
}
oldActionCode = 255;
oldGridX = 0;
@@ -924,9 +845,9 @@ void checkMouseGrid() {
}
}
-void readAlphaGraph(Common::String &dato, int long_, int posx, int posy, byte colorbarra) {
+void readAlphaGraph(Common::String &output, int length, int posx, int posy, byte barColor) {
int pun = 1;
- bar(posx, posy - 2, posx + long_ * 8, posy + 8, colorbarra);
+ bar(posx, posy - 2, posx + length * 8, posy + 8, barColor);
biosText(posx, posy, "_", 0);
@@ -940,20 +861,20 @@ void readAlphaGraph(Common::String &dato, int long_, int posx, int posy, byte co
int asciiCode = e.kbd.ascii;
// ENTER key
if (keycode == Common::KEYCODE_RETURN || keycode == Common::KEYCODE_KP_ENTER) {
- if (dato.size() > 0) {
+ if (output.size() > 0) {
done = true;
continue;
}
}
// Max 8 chars
- if (pun > long_ && asciiCode != 8) {
+ if (pun > length && asciiCode != 8) {
g_engine->_sound->beep(750, 60);
- bar((posx + (dato.size()) * 8), (posy - 2), (posx + (dato.size() + 1) * 8), (posy + 8), 0);
+ bar((posx + (output.size()) * 8), (posy - 2), (posx + (output.size() + 1) * 8), (posy + 8), 0);
} else if (asciiCode == 8 && pun > 1) { // delete
- dato = dato.substr(0, dato.size() - 1);
- bar(posx, (posy - 2), (posx + long_ * 8), (posy + 8), colorbarra);
- biosText(posx, posy, dato.c_str(), 0);
- biosText((posx + (dato.size()) * 8), posy, "_", 0);
+ output = output.substr(0, output.size() - 1);
+ bar(posx, (posy - 2), (posx + length * 8), (posy + 8), barColor);
+ biosText(posx, posy, output.c_str(), 0);
+ biosText((posx + (output.size()) * 8), posy, "_", 0);
pun -= 1;
} else if (
(asciiCode < 97 || asciiCode > 122) &&
@@ -963,10 +884,10 @@ void readAlphaGraph(Common::String &dato, int long_, int posx, int posy, byte co
g_engine->_sound->beep(1200, 60);
} else {
pun += 1;
- dato = dato + (char)e.kbd.ascii;
- bar(posx, (posy - 2), (posx + long_ * 8), (posy + 8), colorbarra);
- biosText(posx, posy, dato.c_str(), 0);
- biosText((posx + (dato.size()) * 8), posy, "_", 0);
+ output = output + (char)e.kbd.ascii;
+ bar(posx, (posy - 2), (posx + length * 8), (posy + 8), barColor);
+ biosText(posx, posy, output.c_str(), 0);
+ biosText((posx + (output.size()) * 8), posy, "_", 0);
}
}
}
@@ -975,13 +896,13 @@ void readAlphaGraph(Common::String &dato, int long_, int posx, int posy, byte co
}
}
-void readAlphaGraphSmall(Common::String &dato, int long_, int posx, int posy, byte colorbarra,
- byte colortexto) {
+void readAlphaGraphSmall(Common::String &output, int length, int posx, int posy, byte barColor,
+ byte textColor) {
int pun = 1;
bool borracursor;
- bar(posx, posy + 2, posx + long_ * 6, posy + 9, colorbarra);
+ bar(posx, posy + 2, posx + length * 6, posy + 9, barColor);
- biosText(posx, posy, "-", colortexto);
+ biosText(posx, posy, "-", textColor);
Common::Event e;
bool done = false;
@@ -992,20 +913,20 @@ void readAlphaGraphSmall(Common::String &dato, int long_, int posx, int posy, by
int asciiCode = e.kbd.ascii;
// ENTER key
if (keycode == Common::KEYCODE_RETURN || keycode == Common::KEYCODE_KP_ENTER) {
- if (dato.size() > 0) {
+ if (output.size() > 0) {
done = true;
continue;
}
}
- if (pun > long_ && asciiCode != 8) {
+ if (pun > length && asciiCode != 8) {
g_engine->_sound->beep(750, 60);
- bar((posx + (dato.size()) * 6), (posy + 2), (posx + (dato.size() + 1) * 6), (posy + 9), colorbarra);
+ bar((posx + (output.size()) * 6), (posy + 2), (posx + (output.size() + 1) * 6), (posy + 9), barColor);
} else if (asciiCode == 8 && pun > 1) {
- dato = dato.substr(0, dato.size() - 1);
- bar(posx, (posy + 2), (posx + long_ * 6), (posy + 9), colorbarra);
- biosText(posx, posy, dato, colortexto);
- biosText((posx + (dato.size()) * 6), posy, "-", colortexto);
+ output = output.substr(0, output.size() - 1);
+ bar(posx, (posy + 2), (posx + length * 6), (posy + 9), barColor);
+ biosText(posx, posy, output, textColor);
+ biosText((posx + (output.size()) * 6), posy, "-", textColor);
pun -= 1;
borracursor = true;
} else if ((asciiCode < '\40') || (asciiCode > '\373')) {
@@ -1013,10 +934,10 @@ void readAlphaGraphSmall(Common::String &dato, int long_, int posx, int posy, by
borracursor = false;
} else {
pun += 1;
- dato = dato + (char)e.kbd.ascii;
- bar(posx, (posy + 2), (posx + long_ * 6), (posy + 9), colorbarra);
- littText(posx, posy, dato, colortexto);
- littText((posx + (dato.size()) * 6), posy, "-", colortexto);
+ output = output + (char)e.kbd.ascii;
+ bar(posx, (posy + 2), (posx + length * 6), (posy + 9), barColor);
+ littText(posx, posy, output, textColor);
+ littText((posx + (output.size()) * 6), posy, "-", textColor);
borracursor = true;
}
// car = readkey();
@@ -1029,49 +950,49 @@ void readAlphaGraphSmall(Common::String &dato, int long_, int posx, int posy, by
}
if (borracursor)
- bar(posx + (dato.size()) * 6, posy + 2, (posx + (dato.size()) * 6) + 6, posy + 9, colorbarra);
-}
-
-void hipercadena(
- Common::String cadenatextnueva,
- uint xhcnueva,
- uint yhcnueva,
- byte anchohc,
- byte colortextohc,
- byte colorsombrahc) {
- Common::String cadenasalhc;
- byte ihc, iteracioneshc, lineahc;
- byte matrizsaltoshc[10];
-
- if (cadenatextnueva.size() < anchohc) {
- euroText((xhcnueva + 1), (yhcnueva + 1), cadenatextnueva, colorsombrahc);
+ bar(posx + (output.size()) * 6, posy + 2, (posx + (output.size()) * 6) + 6, posy + 9, barColor);
+}
+
+void hyperText(
+ Common::String textString,
+ uint xpos,
+ uint ypos,
+ byte maxWidth,
+ byte textColor,
+ byte shadowColor) {
+
+ byte ihc, lineCounter;
+ byte newLineMatrix[10];
+
+ if (textString.size() < maxWidth) {
+ euroText((xpos + 1), (ypos + 1), textString, shadowColor);
g_engine->_screen->update();
delay(enforcedTextAnimDelay);
- euroText(xhcnueva, yhcnueva, cadenatextnueva, colortextohc);
+ euroText(xpos, ypos, textString, textColor);
g_engine->_screen->update();
delay(enforcedTextAnimDelay);
} else {
ihc = 0;
- iteracioneshc = 0;
- matrizsaltoshc[0] = 0;
+ lineCounter = 0;
+ newLineMatrix[0] = 0;
do {
- ihc += anchohc + 1;
- iteracioneshc += 1;
+ ihc += maxWidth + 1;
+ lineCounter += 1;
do {
ihc -= 1;
- } while (cadenatextnueva[ihc] != ' ');
- matrizsaltoshc[iteracioneshc] = ihc + 1;
- } while (ihc + 1 <= cadenatextnueva.size() - anchohc);
+ } while (textString[ihc] != ' ');
+ newLineMatrix[lineCounter] = ihc + 1;
+ } while (ihc + 1 <= textString.size() - maxWidth);
- iteracioneshc += 1;
- matrizsaltoshc[iteracioneshc] = cadenatextnueva.size();
+ lineCounter += 1;
+ newLineMatrix[lineCounter] = textString.size();
- for (lineahc = 1; lineahc <= iteracioneshc; lineahc++) {
- Common::String lineString = cadenatextnueva.substr(matrizsaltoshc[lineahc - 1], matrizsaltoshc[lineahc] - matrizsaltoshc[lineahc - 1]);
- euroText((xhcnueva + 1), (yhcnueva + ((lineahc - 1) * 11) + 1), lineString, colorsombrahc);
+ for (byte line = 1; line <= lineCounter; line++) {
+ Common::String lineString = textString.substr(newLineMatrix[line - 1], newLineMatrix[line] - newLineMatrix[line - 1]);
+ euroText((xpos + 1), (ypos + ((line - 1) * 11) + 1), lineString, shadowColor);
g_engine->_screen->update();
delay(enforcedTextAnimDelay);
- euroText(xhcnueva, (yhcnueva + ((lineahc - 1) * 11)), lineString, colortextohc);
+ euroText(xpos, (ypos + ((line - 1) * 11)), lineString, textColor);
g_engine->_screen->update();
delay(enforcedTextAnimDelay);
}
@@ -1079,8 +1000,7 @@ void hipercadena(
}
void buttonBorder(uint x1, uint y1, uint x2, uint y2,
- byte color1, byte color2, byte color3, byte color4, byte color5, uint xtexto,
- Common::String nombrepartidasalida) {
+ byte color1, byte color2, byte color3, byte color4, byte color5) {
bar(x1, y1, x2, y2, color4);
line(x1, y1, x1, y2, color1);
@@ -1092,441 +1012,118 @@ void buttonBorder(uint x1, uint y1, uint x2, uint y2,
putpixel(x2, y1, color3);
putpixel(x1, y2, color3);
- // outtextxy(xtexto, (y1 - 1), nombrepartidasalida, color5);
g_engine->_screen->addDirtyRect(Common::Rect(
x1, y1, x2, y2));
g_engine->_screen->update();
}
-void copyProtection();
-
-// static void buttonPress(uint xx1, uint yy1, uint xx2, uint yy2, bool bandera) {
-// g_engine->_mouseManager->hide();
-
-// byte color = bandera ? 249 : 255;
-
-// line(xx1, yy1, (xx2 - 1), yy1, color);
-// line(xx1, yy1, xx1, (yy2 - 1), color);
-// color = bandera ? 255 : 249;
-// line((xx1 + 1), yy2, xx2, yy2, color);
-// line(xx2, (yy1 + 1), xx2, yy2, color);
-// g_engine->_mouseManager->show();
-// }
-
void copyProtection() {
- // const int retardopitido = 100;
- // byte *puntfondprotec;
- // uint xfade, oldxfade, ypaso, tamfondprotec, claveaccesointroducida,
- // palabraclaveacceso, oldxraton, oldyraton;
- // byte filanum, columnanum, posicioncursor, intentos, ytext, oldiraton,
- // oldcolorprotec;
- // // textsettingstype oldstyle;
- // bool salirprotec;
- // char chaux;
- // varying_string<5> clavetecleada, filastr, columnastr;
- // int _error;
- // int32 claveaccesoendisco, xorprot1, xorprot2;
- // file<int32> fichclave;
-
- // assign(fichclave, "MCGA.DRV");
- // /*$I-*/ reset(fichclave); /*$I+*/
- // if (ioresult != 0)
- // error("copyProtection(): ioresult (260)");
- // clavetecleada = " ";
- // filanum = Random(95) + 1;
- // columnanum = Random(38) + 1;
- // clavetecleada[0] = '\0';
- // seek(fichclave, 1);
- // xorprot1 = 6543736;
- // fichclave >> xorprot1;
- // xorprot2 = 9873254;
- // seek(fichclave, (((filanum - 1) * 38) + columnanum + 1));
- // fichclave >> xorprot2;
- // claveaccesointroducida = 0;
- // fichclave >> claveaccesoendisco;
- // palabraclaveacceso = (uint)((claveaccesoendisco ^ xorprot1) - xorprot2);
- // salirprotec = false;
- // oldxraton = xraton;
- // close(fichclave);
- // oldyraton = yraton;
- // oldiraton = iraton;
- // drawMouseBackground(xraton, yraton);
- // // oldcolorprotec = getcolor();
- // // gettextsettings(oldstyle);
- // tamfondprotec = imagesize(50, 10, 270, 120);
- // puntfondprotec = (byte *)malloc(tamfondprotec);
- // getImg(50, 10, 270, 120, puntfondprotec);
- // // settextstyle(peque2, horizdir, 4);
- // xraton = 150;
- // yraton = 60;
- // iraton = 1;
- // setMouseArea(55, 13, 250, 105);
- // clearMouseAndKeyboard(npraton, npraton2);
- // if ((npraton > 0) || (npraton2 > 0))
- // error("copyProtection(): npraton (281)");
- // for (ytext = 1; ytext <= 6; ytext++)
- // buttonBorder((120 - (ytext * 10)), (80 - (ytext * 10)), (200 + (ytext * 10)),
- // (60 + (ytext * 10)), 251, 251, 251, 251, 0, 0, "");
- // str(filanum, filastr);
- // str(columnanum, columnastr);
- // drawMenu(6);
- // outtextxy(65, 15, string("Mira en la fila ") + filastr + " y columna " + columnastr, 255);
- // posicioncursor = 0;
- // intentos = 0;
- // setMousePos(1, xraton, yraton);
- // do {
- // do {
- // if (tocapintar) {
- // drawMouseBackground(xraton, yraton);
- // drawMouseMask(iraton, xraton, yraton);
- // if (iraton > 7)
- // iraton = 1;
- // else
- // iraton += 1;
- // tocapintar = false;
- // }
- // getMouseClickCoords(0, npraton, pulsax, pulsay);
- // } while (!(npraton > 0));
- // pulsax += 7;
- // pulsay += 7;
- // if ((pulsax > 59 && pulsax < 180) && (pulsay > 28 && pulsay < 119))
-
- // switch (pulsay) {
- // case 29 ... 58:
- // switch (pulsax) {
- // case 60 ... 89:
- // if (posicioncursor < 50) {
- // sound(200);
- // buttonPress(60, 29, 89, 58, true);
- // delay(retardopitido);
- // outtextxy((205 + posicioncursor), 44, "0", 255);
- // clavetecleada = clavetecleada + '0';
- // buttonPress(60, 29, 89, 58, false);
- // posicioncursor += 10;
- // nosound;
- // } else {
- // sound(70);
- // delay(250);
- // nosound;
- // }
- // break;
- // case 90 ... 119:
- // if (posicioncursor < 50) {
- // sound(250);
- // buttonPress(90, 29, 119, 58, true);
- // delay(retardopitido);
- // outtextxy((205 + posicioncursor), 44, "1", 255);
- // clavetecleada = clavetecleada + '1';
- // buttonPress(90, 29, 119, 58, false);
- // posicioncursor += 10;
- // nosound;
- // } else {
- // sound(70);
- // delay(250);
- // nosound;
- // }
- // break;
- // case 120 ... 149:
- // if (posicioncursor < 50) {
- // sound(300);
- // buttonPress(120, 29, 149, 58, true);
- // delay(retardopitido);
- // outtextxy((205 + posicioncursor), 44, "2", 255);
- // clavetecleada = clavetecleada + '2';
- // buttonPress(120, 29, 149, 58, false);
- // posicioncursor += 10;
- // nosound;
- // } else {
- // sound(70);
- // delay(250);
- // nosound;
- // }
- // break;
- // case 150 ... 179:
- // if (posicioncursor < 50) {
- // sound(350);
- // buttonPress(150, 29, 179, 58, true);
- // delay(retardopitido);
-
- // outtextxy((205 + posicioncursor), 44, "3", 255);
- // clavetecleada = clavetecleada + '3';
- // buttonPress(150, 29, 179, 58, false);
- // posicioncursor += 10;
- // nosound;
- // } else {
- // sound(70);
- // delay(250);
- // nosound;
- // }
- // break;
- // }
- // break;
- // case 59 ... 88:
- // switch (pulsax) {
- // case 60 ... 89:
- // if (posicioncursor < 50) {
- // sound(400);
- // buttonPress(60, 59, 89, 88, true);
- // delay(retardopitido);
- // outtextxy((205 + posicioncursor), 44, "4", 255);
- // clavetecleada = clavetecleada + '4';
- // buttonPress(60, 59, 89, 88, false);
- // posicioncursor += 10;
- // nosound;
- // } else {
- // sound(70);
- // delay(250);
- // nosound;
- // }
- // break;
- // case 90 ... 119:
- // if (posicioncursor < 50) {
- // sound(450);
- // buttonPress(90, 59, 119, 88, true);
- // delay(retardopitido);
- // outtextxy((205 + posicioncursor), 44, "5", 255);
- // clavetecleada = clavetecleada + '5';
- // buttonPress(90, 59, 119, 88, false);
- // posicioncursor += 10;
- // nosound;
- // } else {
- // sound(70);
- // delay(250);
- // nosound;
- // }
- // break;
- // case 120 ... 149:
- // if (posicioncursor < 50) {
- // sound(500);
- // buttonPress(120, 59, 149, 88, true);
- // delay(retardopitido);
- // outtextxy((205 + posicioncursor), 44, "6", 255);
- // clavetecleada = clavetecleada + '6';
- // buttonPress(120, 59, 149, 88, false);
- // posicioncursor += 10;
- // nosound;
- // } else {
- // sound(70);
- // delay(250);
- // nosound;
- // }
- // break;
- // case 150 ... 179:
- // if (posicioncursor < 50) {
- // sound(550);
- // buttonPress(150, 59, 179, 88, true);
- // delay(retardopitido);
- // outtextxy((205 + posicioncursor), 44, "7", 255);
- // clavetecleada = clavetecleada + '7';
- // buttonPress(150, 59, 179, 88, false);
- // posicioncursor += 10;
- // nosound;
- // } else {
- // sound(70);
- // delay(250);
- // nosound;
- // }
- // break;
- // }
- // break;
- // case 89 ... 118:
- // switch (pulsax) {
- // case 60 ... 89:
- // if (posicioncursor < 50) {
- // sound(600);
- // buttonPress(60, 89, 89, 118, true);
- // delay(retardopitido);
- // outtextxy((205 + posicioncursor), 44, "8", 255);
- // clavetecleada = clavetecleada + '8';
- // buttonPress(60, 89, 89, 118, false);
- // posicioncursor += 10;
- // nosound;
- // } else {
- // sound(70);
- // delay(250);
- // nosound;
- // }
- // break;
- // case 90 ... 119:
- // if (posicioncursor < 50) {
- // sound(650);
- // buttonPress(90, 89, 119, 118, true);
- // delay(retardopitido);
- // outtextxy((205 + posicioncursor), 44, "9", 255);
- // clavetecleada = clavetecleada + '9';
- // buttonPress(90, 89, 119, 118, false);
- // posicioncursor += 10;
- // nosound;
- // } else {
- // sound(70);
- // delay(250);
- // nosound;
- // }
- // break;
- // case 120 ... 149:
- // if (posicioncursor > 0) {
- // sound(700);
- // buttonPress(120, 89, 149, 118, true);
- // delay(retardopitido);
- // posicioncursor -= 10;
- // outtextxy((205 + posicioncursor), 44, "�", 250);
- // clavetecleada = copy(clavetecleada, 1,
- // (length(clavetecleada) - 1));
- // buttonPress(120, 89, 149, 118, false);
- // nosound;
- // } else {
- // sound(70);
- // delay(250);
- // nosound;
- // }
- // break;
- // case 150 ... 179:
- // if (posicioncursor > 39) {
- // sound(750);
- // buttonPress(150, 89, 179, 118, true);
- // delay(retardopitido);
- // val(clavetecleada, claveaccesointroducida, _error);
- // buttonPress(150, 89, 179, 118, false);
- // nosound;
- // if ((_error == 0) && (intentos < 3)) {
- // if (claveaccesointroducida == palabraclaveacceso)
- // salirprotec = true;
- // else {
- // intentos += 1;
- // sound(60);
- // delay(700);
- // nosound;
- // }
- // }
- // if (intentos >= 3)
- // error("copyProtection(): too many attempts! (259)");
- // } else {
- // sound(70);
- // delay(250);
- // nosound;
- // }
- // break;
- // }
- // break;
- // }
- // clearMouseAndKeyboard(npraton, npraton2);
- // if ((npraton > 0) || (npraton2 > 0))
- // error("copyProtection(): npraton! (282)");
- // } while (!salirprotec);
- // putImg(50, 10, puntfondprotec);
- // xraton = oldxraton;
- // yraton = oldyraton;
- // iraton = oldiraton;
- // setMousePos(iraton, xraton, yraton);
- // if (contadorpc > 8)
- // error("copyProtection(): contadorpc! (274)");
- // freemem(puntfondprotec, tamfondprotec);
- // setMouseArea(0, 0, 305, 185);
+ //todo
}
void credits();
-void drawCreditsScreen(byte *&fondopp, uint &sizefondo2, byte *&fondo2) {
- palette palpaso, palnegro;
+void drawCreditsScreen(byte *&backgroundPointer, uint &sizeAuxBG, byte *&auxBG) {
+ palette intermediatePalette, darkPalette;
- Common::File fichpp;
+ Common::File ppFile;
- if (!fichpp.open("DIPLOMA.PAN")) {
+ if (!ppFile.open("DIPLOMA.PAN")) {
showError(315);
}
- fondopp = (byte *)malloc(64000);
- fichpp.read(palpaso, 768);
- fichpp.read(fondopp, 64000);
- fichpp.close();
+ backgroundPointer = (byte *)malloc(64000);
+ ppFile.read(intermediatePalette, 768);
+ ppFile.read(backgroundPointer, 64000);
+ ppFile.close();
- drawFullScreen(fondopp);
+ drawFullScreen(backgroundPointer);
- sizefondo2 = imagesize(0, 0, 319, 59);
+ sizeAuxBG = imagesize(0, 0, 319, 59);
- // Screen is now fondopp so fondo2 contains a 320x60 crop of fondopp
- fondo2 = (byte *)malloc(sizefondo2);
- g_engine->_graphics->getImg(0, 0, 319, 59, fondo2);
+ // Screen is now backgroundPointer so auxBG contains a 320x60 crop of backgroundPointer
+ auxBG = (byte *)malloc(sizeAuxBG);
+ g_engine->_graphics->getImg(0, 0, 319, 59, auxBG);
for (int i = 0; i <= 255; i++) {
- palnegro[i * 3 + 0] = 0;
- palnegro[i * 3 + 1] = 0;
- palnegro[i * 3 + 2] = 0;
+ darkPalette[i * 3 + 0] = 0;
+ darkPalette[i * 3 + 1] = 0;
+ darkPalette[i * 3 + 2] = 0;
// Adjust for 6-bit DAC color
- palpaso[i * 3 + 0] = palpaso[i * 3 + 0] << 2;
- palpaso[i * 3 + 1] = palpaso[i * 3 + 1] << 2;
- palpaso[i * 3 + 2] = palpaso[i * 3 + 2] << 2;
+ intermediatePalette[i * 3 + 0] = intermediatePalette[i * 3 + 0] << 2;
+ intermediatePalette[i * 3 + 1] = intermediatePalette[i * 3 + 1] << 2;
+ intermediatePalette[i * 3 + 2] = intermediatePalette[i * 3 + 2] << 2;
}
- changePalette(palnegro, palpaso);
- copyPalette(palpaso, pal);
- if (contadorpc2 > 9)
+ changePalette(darkPalette, intermediatePalette);
+ copyPalette(intermediatePalette, pal);
+ if (cpCounter2 > 9)
showError(274);
}
-void putCreditsImg(uint x, uint y, byte *imagen1, byte *imagen2, bool direct) {
+void putCreditsImg(uint x, uint y, byte *img1, byte *img2, bool direct) {
- uint16 wImagen1, hImagen1;
- uint auxhor;
- uint incremento, incremento2;
- byte *paso;
+ uint16 wImg1, hImg1;
+ uint horizontalAux;
+ uint inc, inc2;
+ byte *step;
- wImagen1 = READ_LE_UINT16(imagen1);
- hImagen1 = READ_LE_UINT16(imagen1 + 2);
+ wImg1 = READ_LE_UINT16(img1);
+ hImg1 = READ_LE_UINT16(img1 + 2);
- paso = (byte *)malloc((wImagen1 + 1) * (hImagen1 + 1) + 4);
+ step = (byte *)malloc((wImg1 + 1) * (hImg1 + 1) + 4);
- auxhor = wImagen1 + 1;
- foo = hImagen1 + y;
+ horizontalAux = wImg1 + 1;
+ foo = hImg1 + y;
// makes sure that if the image is at the bottom of the screen we chop the bottom part
for (int i = foo; i >= 200; i--)
- hImagen1 -= 1;
+ hImg1 -= 1;
- hImagen1++;
+ hImg1++;
- // Copies the crop in the background corresponding to the current credit window in imagen1
- for (int i = 0; i < hImagen1; i++) {
- byte *src = imagen2 + (320 * (y + i)) + x;
- byte *dst = paso + 4 + (auxhor * i);
- Common::copy(src, src + auxhor, dst);
+ // Copies the crop in the background corresponding to the current credit window in img1
+ for (int i = 0; i < hImg1; i++) {
+ byte *src = img2 + (320 * (y + i)) + x;
+ byte *dst = step + 4 + (horizontalAux * i);
+ Common::copy(src, src + horizontalAux, dst);
}
- for (int kk = 0; kk < hImagen1; kk++) {
- incremento2 = (kk * wImagen1) + 4;
+ for (int kk = 0; kk < hImg1; kk++) {
+ inc2 = (kk * wImg1) + 4;
foo = kk + y;
- for (int jj = 0; jj <= wImagen1; jj++) {
- incremento = incremento2 + jj;
- if ((direct && imagen1[incremento] > 0) || (imagen1[incremento] > 16 && foo >= 66 && foo <= 192)) {
- paso[incremento] = imagen1[incremento];
- } else if (imagen1[incremento] > 16) {
+ for (int jj = 0; jj <= wImg1; jj++) {
+ inc = inc2 + jj;
+ if ((direct && img1[inc] > 0) || (img1[inc] > 16 && foo >= 66 && foo <= 192)) {
+ step[inc] = img1[inc];
+ } else if (img1[inc] > 16) {
switch (foo) {
case 59:
case 199:
- paso[incremento] = imagen1[incremento] + 210;
+ step[inc] = img1[inc] + 210;
break;
case 60:
case 198:
- paso[incremento] = imagen1[incremento] + 180;
+ step[inc] = img1[inc] + 180;
break;
case 61:
case 197:
- paso[incremento] = imagen1[incremento] + 150;
+ step[inc] = img1[inc] + 150;
break;
case 62:
case 196:
- paso[incremento] = imagen1[incremento] + 120;
+ step[inc] = img1[inc] + 120;
break;
case 63:
case 195:
- paso[incremento] = imagen1[incremento] + 90;
+ step[inc] = img1[inc] + 90;
break;
case 64:
case 194:
- paso[incremento] = imagen1[incremento] + 60;
+ step[inc] = img1[inc] + 60;
break;
case 65:
case 193:
- paso[incremento] = imagen1[incremento] + 30;
+ step[inc] = img1[inc] + 30;
break;
}
}
@@ -1536,36 +1133,36 @@ void putCreditsImg(uint x, uint y, byte *imagen1, byte *imagen2, bool direct) {
do {
g_engine->_chrono->updateChrono();
g_system->delayMillis(10);
- } while (!tocapintar && !g_engine->shouldQuit());
- tocapintar = false;
+ } while (!timeToDraw && !g_engine->shouldQuit());
+ timeToDraw = false;
// Copies the credit window directly to the screen
- for (int i = 0; i < hImagen1; i++) {
- byte *src = paso + 4 + (auxhor * i);
+ for (int i = 0; i < hImg1; i++) {
+ byte *src = step + 4 + (horizontalAux * i);
byte *dst = ((byte *)g_engine->_screen->getPixels()) + (320 * (y + i)) + x;
- Common::copy(src, src + auxhor, dst);
+ Common::copy(src, src + horizontalAux, dst);
}
- g_engine->_screen->addDirtyRect(Common::Rect(x, y, x + wImagen1 + 1, y + hImagen1 + 1));
- free(paso);
+ g_engine->_screen->addDirtyRect(Common::Rect(x, y, x + wImg1 + 1, y + hImg1 + 1));
+ free(step);
}
void scrollCredit(
- int32 posicion,
- uint tam,
+ int32 position,
+ uint size,
palette &pal2,
- byte *&fondopp,
- bool &salirpitando,
+ byte *&background,
+ bool &exit,
int minHeight,
bool withFade,
bool refresh) {
- Common::File fich;
- if (!fich.open("CREDITOS.DAT")) {
+ Common::File creditFile;
+ if (!creditFile.open("CREDITOS.DAT")) {
showError(270);
}
- fich.seek(posicion);
- fich.read(sceneBackground, tam);
- fich.read(pal2, 768);
- fich.close();
+ creditFile.seek(position);
+ creditFile.read(sceneBackground, size);
+ creditFile.read(pal2, 768);
+ creditFile.close();
for (int i = 16; i <= 255; i++) {
// Adjust for 6-bit DAC
@@ -1589,9 +1186,9 @@ void scrollCredit(
keyPressed = true;
}
}
- putCreditsImg(85, i, sceneBackground, fondopp, !withFade);
+ putCreditsImg(85, i, sceneBackground, background, !withFade);
if (keyPressed) {
- salirpitando = true;
+ exit = true;
break;
}
g_engine->_screen->update();
@@ -1600,28 +1197,28 @@ void scrollCredit(
break;
}
if (refresh) {
- copyFromScreen(fondopp);
+ copyFromScreen(background);
}
}
void scrollSingleCredit(
- int32 posicion,
- uint tam,
+ int32 pos,
+ uint size,
palette &pal2,
- byte *&fondopp,
- bool &salirpitando) {
+ byte *&background,
+ bool &exit) {
scrollCredit(
- posicion,
- tam,
+ pos,
+ size,
pal2,
- fondopp,
- salirpitando,
+ background,
+ exit,
8,
true,
false);
}
-void removeTitle(byte *&fondo2) {
+void removeTitle(byte *&background2) {
uint i2, j2;
Common::Event e;
for (int i1 = 1; i1 <= 15000; i1++) {
@@ -1629,11 +1226,11 @@ void removeTitle(byte *&fondo2) {
}
i2 = Random(318);
j2 = Random(58);
- byte *src = fondo2 + 4 + (j2 * 320) + i2;
+ byte *src = background2 + 4 + (j2 * 320) + i2;
byte *dest = ((byte *)g_engine->_screen->getPixels()) + (j2 * 320) + i2;
Common::copy(src, src + 2, dest);
- byte *src2 = fondo2 + 4 + ((j2 + 1) * 320) + i2;
+ byte *src2 = background2 + 4 + ((j2 + 1) * 320) + i2;
byte *dest2 = ((byte *)g_engine->_screen->getPixels()) + ((j2 + 1) * 320) + i2;
Common::copy(src2, src2 + 2, dest2);
@@ -1641,7 +1238,7 @@ void removeTitle(byte *&fondo2) {
i2 = Random(320);
j2 = Random(60);
- byte *src3 = fondo2 + 4 + (j2 * 320) + i2;
+ byte *src3 = background2 + 4 + (j2 * 320) + i2;
byte *dest3 = ((byte *)g_engine->_screen->getPixels()) + (j2 * 320) + i2;
Common::copy(src3, src3 + 1, dest3);
if (i1 % 200 == 0) {
@@ -1665,12 +1262,11 @@ inline bool keyPressed() {
void credits() {
saveAllowed = true;
debug("Credits");
- // byte ii;
palette pal2;
- byte *fondopp;
- byte *fondo2;
- uint sizefondo2;
- bool salirpitando;
+ byte *background;
+ byte *background2;
+ uint sizeBg2;
+ bool exit;
g_engine->_mouseManager->hide();
totalFadeOut(0);
@@ -1678,73 +1274,73 @@ void credits() {
g_engine->_screen->clear();
g_engine->_sound->playMidi("CREDITOS", true);
g_engine->_sound->fadeInMusic(musicVolLeft, musicVolRight);
- drawCreditsScreen(fondopp, sizefondo2, fondo2);
+ drawCreditsScreen(background, sizeBg2, background2);
- salirpitando = false;
+ exit = false;
- if (keyPressed() || salirpitando)
+ if (keyPressed() || exit)
goto Lsalida;
- scrollCredit(0, 8004, pal2, fondopp, salirpitando, 10, false, true);
- if (keyPressed() || salirpitando)
+ scrollCredit(0, 8004, pal2, background, exit, 10, false, true);
+ if (keyPressed() || exit)
goto Lsalida;
- scrollSingleCredit(8772, 8004, pal2, fondopp, salirpitando);
- if (keyPressed() || salirpitando)
+ scrollSingleCredit(8772, 8004, pal2, background, exit);
+ if (keyPressed() || exit)
goto Lsalida;
- scrollSingleCredit(17544, 8004, pal2, fondopp, salirpitando);
- if (keyPressed() || salirpitando)
+ scrollSingleCredit(17544, 8004, pal2, background, exit);
+ if (keyPressed() || exit)
goto Lsalida;
- scrollSingleCredit(26316, 7504, pal2, fondopp, salirpitando);
- if (keyPressed() || salirpitando)
+ scrollSingleCredit(26316, 7504, pal2, background, exit);
+ if (keyPressed() || exit)
goto Lsalida;
- scrollSingleCredit(34588, 7504, pal2, fondopp, salirpitando);
- if (keyPressed() || salirpitando)
+ scrollSingleCredit(34588, 7504, pal2, background, exit);
+ if (keyPressed() || exit)
goto Lsalida;
- scrollSingleCredit(42860, 8004, pal2, fondopp, salirpitando);
- if (keyPressed() || salirpitando)
+ scrollSingleCredit(42860, 8004, pal2, background, exit);
+ if (keyPressed() || exit)
goto Lsalida;
- scrollSingleCredit(51632, 7504, pal2, fondopp, salirpitando);
- if (keyPressed() || salirpitando)
+ scrollSingleCredit(51632, 7504, pal2, background, exit);
+ if (keyPressed() || exit)
goto Lsalida;
- removeTitle(fondo2);
- if (keyPressed() || salirpitando)
+ removeTitle(background2);
+ if (keyPressed() || exit)
goto Lsalida;
- g_engine->_graphics->putImg(0, 0, fondo2);
- if (keyPressed() || salirpitando)
+ g_engine->_graphics->putImg(0, 0, background2);
+ if (keyPressed() || exit)
goto Lsalida;
- copyFromScreen(fondopp);
- if (keyPressed() || salirpitando)
+ copyFromScreen(background);
+ if (keyPressed() || exit)
goto Lsalida;
- scrollCredit(59904, 8004, pal2, fondopp, salirpitando, 10, false, true);
- if (keyPressed() || salirpitando)
+ scrollCredit(59904, 8004, pal2, background, exit, 10, false, true);
+ if (keyPressed() || exit)
goto Lsalida;
- scrollSingleCredit(68676, 8004, pal2, fondopp, salirpitando);
- if (keyPressed() || salirpitando)
+ scrollSingleCredit(68676, 8004, pal2, background, exit);
+ if (keyPressed() || exit)
goto Lsalida;
- scrollSingleCredit(77448, 8004, pal2, fondopp, salirpitando);
- if (keyPressed() || salirpitando)
+ scrollSingleCredit(77448, 8004, pal2, background, exit);
+ if (keyPressed() || exit)
goto Lsalida;
- scrollSingleCredit(86220, 8004, pal2, fondopp, salirpitando);
- if (keyPressed() || salirpitando)
+ scrollSingleCredit(86220, 8004, pal2, background, exit);
+ if (keyPressed() || exit)
goto Lsalida;
- scrollSingleCredit(94992, 8004, pal2, fondopp, salirpitando);
- if (keyPressed() || salirpitando)
+ scrollSingleCredit(94992, 8004, pal2, background, exit);
+ if (keyPressed() || exit)
goto Lsalida;
- scrollSingleCredit(103764, 8004, pal2, fondopp, salirpitando);
- if (keyPressed() || salirpitando)
+ scrollSingleCredit(103764, 8004, pal2, background, exit);
+ if (keyPressed() || exit)
goto Lsalida;
- scrollSingleCredit(112536, 8004, pal2, fondopp, salirpitando);
- if (keyPressed() || salirpitando)
+ scrollSingleCredit(112536, 8004, pal2, background, exit);
+ if (keyPressed() || exit)
goto Lsalida;
- removeTitle(fondo2);
- if (keyPressed() || salirpitando)
+ removeTitle(background2);
+ if (keyPressed() || exit)
goto Lsalida;
- g_engine->_graphics->putImg(0, 0, fondo2);
- if (keyPressed() || salirpitando)
+ g_engine->_graphics->putImg(0, 0, background2);
+ if (keyPressed() || exit)
goto Lsalida;
- copyFromScreen(fondopp);
- if (keyPressed() || salirpitando)
+ copyFromScreen(background);
+ if (keyPressed() || exit)
goto Lsalida;
- scrollCredit(121308, 8004, pal2, fondopp, salirpitando, 80, false, true);
+ scrollCredit(121308, 8004, pal2, background, exit, 80, false, true);
Lsalida:
delay(1000);
totalFadeOut(0);
@@ -1753,29 +1349,29 @@ Lsalida:
g_engine->_sound->playMidi("INTRODUC", true);
g_engine->_sound->fadeInMusic(musicVolLeft, musicVolRight);
g_engine->_mouseManager->show();
- free(fondopp);
- free(fondo2);
+ free(background);
+ free(background2);
}
void introduction() {
saveAllowed = false;
g_engine->_mouseManager->hide();
- bool pulsada_salida;
- uint contadorvueltas;
+ bool exitPressed;
+ uint loopCount;
bool isSpanish = g_engine->_lang == Common::ES_ESP;
const char *const *messages = (isSpanish) ? fullScreenMessages[0] : fullScreenMessages[1];
const long *offsets = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0] : flcOffsets[1];
- pulsada_salida = false;
+ exitPressed = false;
totalFadeOut(0);
- if (contadorpc > 6)
+ if (cpCounter > 6)
showError(270);
g_engine->_screen->clear();
- drawFlc(136, 53, offsets[2], 136, 9, 1, true, true, false, pulsada_salida);
- if (pulsada_salida)
+ drawFlc(136, 53, offsets[2], 136, 9, 1, true, true, false, exitPressed);
+ if (exitPressed)
goto Lsalirpres;
- drawFlc(135, 54, offsets[3], 0, 9, 2, true, true, false, pulsada_salida);
- if (pulsada_salida)
+ drawFlc(135, 54, offsets[3], 0, 9, 2, true, true, false, exitPressed);
+ if (exitPressed)
goto Lsalirpres;
totalFadeOut(0);
g_engine->_screen->clear();
@@ -1804,7 +1400,7 @@ void introduction() {
totalFadeIn(0, "DEFAULT");
g_engine->_screen->markAllDirty();
g_engine->_screen->update();
- contadorvueltas = 0;
+ loopCount = 0;
do {
g_engine->_chrono->updateChrono();
@@ -1814,70 +1410,70 @@ void introduction() {
goto Lsalirpres;
}
- if (tocapintar) {
- contadorvueltas += 1;
+ if (timeToDraw) {
+ loopCount += 1;
}
g_system->delayMillis(10);
- } while (contadorvueltas < 180 && !g_engine->shouldQuit());
+ } while (loopCount < 180 && !g_engine->shouldQuit());
totalFadeOut(0);
g_engine->_screen->clear();
- drawFlc(0, 0, offsets[4], 0, 9, 3, true, true, false, pulsada_salida);
- if (pulsada_salida)
+ drawFlc(0, 0, offsets[4], 0, 9, 3, true, true, false, exitPressed);
+ if (exitPressed)
goto Lsalirpres;
- drawFlc(110, 30, offsets[5], 2, 9, 4, false, true, false, pulsada_salida);
- if (pulsada_salida)
+ drawFlc(110, 30, offsets[5], 2, 9, 4, false, true, false, exitPressed);
+ if (exitPressed)
goto Lsalirpres;
- drawFlc(110, 30, offsets[6], 3, 9, 5, false, true, false, pulsada_salida);
- if (pulsada_salida)
+ drawFlc(110, 30, offsets[6], 3, 9, 5, false, true, false, exitPressed);
+ if (exitPressed)
goto Lsalirpres;
- drawFlc(110, 30, offsets[7], 0, 9, 0, false, true, false, pulsada_salida);
- if (pulsada_salida)
+ drawFlc(110, 30, offsets[7], 0, 9, 0, false, true, false, exitPressed);
+ if (exitPressed)
goto Lsalirpres;
- drawFlc(110, 30, offsets[8], isSpanish? 4:8, 9, 6, false, true, false, pulsada_salida);
- if (pulsada_salida)
+ drawFlc(110, 30, offsets[8], isSpanish? 4:8, 9, 6, false, true, false, exitPressed);
+ if (exitPressed)
goto Lsalirpres;
- drawFlc(110, 30, offsets[9], 3, 9, 7, false, true, false, pulsada_salida);
- if (pulsada_salida)
+ drawFlc(110, 30, offsets[9], 3, 9, 7, false, true, false, exitPressed);
+ if (exitPressed)
goto Lsalirpres;
- drawFlc(110, 30, offsets[8], isSpanish? 3:8, 9, 8, false, true, false, pulsada_salida);
- if (pulsada_salida)
+ drawFlc(110, 30, offsets[8], isSpanish? 3:8, 9, 8, false, true, false, exitPressed);
+ if (exitPressed)
goto Lsalirpres;
- drawFlc(110, 30, offsets[9], 2, 9, 9, false, true, false, pulsada_salida);
- if (pulsada_salida)
+ drawFlc(110, 30, offsets[9], 2, 9, 9, false, true, false, exitPressed);
+ if (exitPressed)
goto Lsalirpres;
- drawFlc(0, 0, offsets[10], 0, 9, 0, false, true, false, pulsada_salida);
- if (pulsada_salida)
+ drawFlc(0, 0, offsets[10], 0, 9, 0, false, true, false, exitPressed);
+ if (exitPressed)
goto Lsalirpres;
- drawFlc(235, 100, offsets[11], 3, 9, 10, false, true, false, pulsada_salida);
- if (pulsada_salida)
+ drawFlc(235, 100, offsets[11], 3, 9, 10, false, true, false, exitPressed);
+ if (exitPressed)
goto Lsalirpres;
- drawFlc(150, 40, offsets[12], 0, 9, 11, false, true, false, pulsada_salida);
- if (pulsada_salida)
+ drawFlc(150, 40, offsets[12], 0, 9, 11, false, true, false, exitPressed);
+ if (exitPressed)
goto Lsalirpres;
- drawFlc(235, 100, offsets[11], 3, 9, 12, false, true, false, pulsada_salida);
- if (pulsada_salida)
+ drawFlc(235, 100, offsets[11], 3, 9, 12, false, true, false, exitPressed);
+ if (exitPressed)
goto Lsalirpres;
- drawFlc(150, 40, offsets[12], isSpanish? 0:2, 9, 13, false, true, false, pulsada_salida);
- if (pulsada_salida)
+ drawFlc(150, 40, offsets[12], isSpanish? 0:2, 9, 13, false, true, false, exitPressed);
+ if (exitPressed)
goto Lsalirpres;
- drawFlc(235, 100, offsets[11], isSpanish? 3:8, 9, 14, false, true, false, pulsada_salida);
- if (pulsada_salida)
+ drawFlc(235, 100, offsets[11], isSpanish? 3:8, 9, 14, false, true, false, exitPressed);
+ if (exitPressed)
goto Lsalirpres;
- drawFlc(150, 40, offsets[12], 0, 9, 15, false, true, false, pulsada_salida);
- if (pulsada_salida)
+ drawFlc(150, 40, offsets[12], 0, 9, 15, false, true, false, exitPressed);
+ if (exitPressed)
goto Lsalirpres;
- drawFlc(173, 98, offsets[13], 0, 9, 0, false, true, false, pulsada_salida);
- if (pulsada_salida)
+ drawFlc(173, 98, offsets[13], 0, 9, 0, false, true, false, exitPressed);
+ if (exitPressed)
goto Lsalirpres;
- drawFlc(224, 100, offsets[14], 2, 9, 16, false, true, false, pulsada_salida);
- if (pulsada_salida)
+ drawFlc(224, 100, offsets[14], 2, 9, 16, false, true, false, exitPressed);
+ if (exitPressed)
goto Lsalirpres;
- drawFlc(0, 0, offsets[15], 0, 18, 17, false, true, false, pulsada_salida);
- if (pulsada_salida)
+ drawFlc(0, 0, offsets[15], 0, 18, 17, false, true, false, exitPressed);
+ if (exitPressed)
goto Lsalirpres;
- drawFlc(150, 40, offsets[16], 0, 9, 18, false, true, false, pulsada_salida);
- if (pulsada_salida)
+ drawFlc(150, 40, offsets[16], 0, 9, 18, false, true, false, exitPressed);
+ if (exitPressed)
goto Lsalirpres;
delay(1000);
Lsalirpres:
@@ -1897,24 +1493,24 @@ void firstIntroduction() {
}
void initialLogo() {
- bool basurillalogica = false;
+ bool foobar = false;
long offset = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0][0] : flcOffsets[1][0];
- drawFlc(0, 0, offset, 0, 18, 25, false, false, false, basurillalogica);
+ drawFlc(0, 0, offset, 0, 18, 25, false, false, false, foobar);
delay(1000);
}
-void initialMenu(bool fundido) {
- bool kklogica = false;
- bool opcionvalida = false;
+void initialMenu(bool fade) {
+ bool bar = false;
+ bool validOption = false;
g_engine->_sound->stopVoc();
long offset = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0][1] : flcOffsets[1][1];
- if (fundido)
- drawFlc(0, 0, offset, 0, 9, 0, true, false, false, kklogica);
+ if (fade)
+ drawFlc(0, 0, offset, 0, 9, 0, true, false, false, bar);
else
- drawFlc(0, 0, offset, 0, 9, 0, false, false, false, kklogica);
- if (contadorpc2 > 10)
+ drawFlc(0, 0, offset, 0, 9, 0, false, false, false, bar);
+ if (cpCounter2 > 10)
showError(274);
mouseX = 160;
mouseY = 95;
@@ -1940,27 +1536,27 @@ void initialMenu(bool fundido) {
if (x > 46 && x < 145) {
startNewGame = true;
continueGame = false;
- opcionvalida = true;
+ validOption = true;
} else if (x > 173 && x < 267) {
credits();
- drawFlc(0, 0, offset, 0, 9, 0, true, false, false, kklogica);
+ drawFlc(0, 0, offset, 0, 9, 0, true, false, false, bar);
}
} else if (y > 140 && y < 155) {
if (x > 173 && x < 292) {
totalFadeOut(0);
g_engine->_screen->clear();
introduction();
- drawFlc(0, 0, offset, 0, 9, 0, true, false, false, kklogica);
+ drawFlc(0, 0, offset, 0, 9, 0, true, false, false, bar);
} else if (x >= 18 && x <= 145) {
debug("Load");
startNewGame = false;
continueGame = false;
- opcionvalida = true;
+ validOption = true;
}
} else if (y > 174 && y < 190) {
if (x > 20 && x < 145) {
startNewGame = false;
- opcionvalida = true;
+ validOption = true;
continueGame = true;
} else if (x > 173 && y < 288) {
exitToDOS();
@@ -1970,7 +1566,7 @@ void initialMenu(bool fundido) {
}
g_engine->_screen->update();
g_system->delayMillis(10);
- } while (!opcionvalida && !g_engine->shouldQuit());
+ } while (!validOption && !g_engine->shouldQuit());
}
void exitGame() {
@@ -1987,18 +1583,17 @@ void clearGame() {
void exitToDOS() {
debug("Exit to dos!");
- uint oldxraton, oldyraton, tamfondcontroles;
- byte oldiraton;
- // textsettingstype oldstyle;
- char chpasosalida;
-
- oldxraton = mouseX;
- oldyraton = mouseY;
- oldiraton = mouseMaskIndex;
+ uint oldMousePosX, oldMousePosY, dialogSize;
+ byte oldMouseMask;
+ char exitChar;
+
+ oldMousePosX = mouseX;
+ oldMousePosY = mouseY;
+ oldMouseMask = mouseMaskIndex;
g_engine->_mouseManager->hide();
- tamfondcontroles = imagesize(58, 48, 262, 120);
- byte *puntfondcontroles = (byte *)malloc(tamfondcontroles);
- g_engine->_graphics->getImg(58, 48, 262, 120, puntfondcontroles);
+ dialogSize = imagesize(58, 48, 262, 120);
+ byte *dialogBackground = (byte *)malloc(dialogSize);
+ g_engine->_graphics->getImg(58, 48, 262, 120, dialogBackground);
drawMenu(7);
mouseX = 160;
@@ -2010,7 +1605,7 @@ void exitToDOS() {
Common::Event e;
const char hotKeyYes = hotKeyFor(YES);
const char hotKeyNo = hotKeyFor(NO);
- chpasosalida = '@';
+ exitChar = '@';
do {
g_engine->_chrono->updateChrono();
g_engine->_mouseManager->animateMouseIfNeeded();
@@ -2021,62 +1616,60 @@ void exitToDOS() {
}
if (e.type == Common::EVENT_KEYDOWN) {
if (e.kbd.keycode == Common::KEYCODE_ESCAPE) {
- chpasosalida = '\33';
+ exitChar = '\33';
} else if (e.kbd.keycode == hotKeyYes) {
debug("would exit game now");
- free(puntfondcontroles);
- // CLEAR MEMORY!!
+ free(dialogBackground);
exitGame();
- // exit game
} else if (e.kbd.keycode == hotKeyNo) {
- chpasosalida = '\33';
+ exitChar = '\33';
}
} else if (e.type == Common::EVENT_LBUTTONUP) {
uint x = e.mouse.x;
if (x < 145) {
- free(puntfondcontroles);
- // exit game
+ free(dialogBackground);
g_system->quit();
} else if (x > 160) {
- chpasosalida = '\33';
+ exitChar = '\33';
}
}
}
g_engine->_screen->update();
- } while (chpasosalida != '\33' && !g_engine->shouldQuit());
+ } while (exitChar != '\33' && !g_engine->shouldQuit());
debug("finished exitToDos");
- g_engine->_graphics->putImg(58, 48, puntfondcontroles);
- mouseX = oldxraton;
- mouseY = oldyraton;
- mouseMaskIndex = oldiraton;
+ g_engine->_graphics->putImg(58, 48, dialogBackground);
+ mouseX = oldMousePosX;
+ mouseY = oldMousePosY;
+ mouseMaskIndex = oldMouseMask;
g_engine->_mouseManager->show();
- free(puntfondcontroles);
+ free(dialogBackground);
g_engine->_mouseManager->setMouseArea(Common::Rect(0, 0, 305, 185));
}
void soundControls() {
- uint oldxraton,
- oldyraton,
- tamfondcontroles,
+ uint oldMouseX,
+ oldMouseY,
+ soundControlsSize,
sliderSize,
sliderBgSize,
- volumenfx,
- volumenmelodia,
+ sfxVol,
+ musicVol,
xfade,
oldxfade;
- byte ytext, oldiraton;
- bool salirmenucontroles;
+ byte ytext, oldMouseMask;
+ bool exitSoundControls;
- salirmenucontroles = false;
- oldxraton = mouseX;
- oldyraton = mouseY;
- oldiraton = mouseMaskIndex;
+ exitSoundControls = false;
+ oldMouseX = mouseX;
+ oldMouseY = mouseY;
+ oldMouseMask = mouseMaskIndex;
g_engine->_mouseManager->hide();
- tamfondcontroles = imagesize(50, 10, 270, 120);
- byte *puntfondcontroles = (byte *)malloc(tamfondcontroles);
- g_engine->_graphics->getImg(50, 10, 270, 120, puntfondcontroles);
+ soundControlsSize = imagesize(50, 10, 270, 120);
+ //What was on the screen before blitting sound controls
+ byte *soundControlsBackground = (byte *)malloc(soundControlsSize);
+ g_engine->_graphics->getImg(50, 10, 270, 120, soundControlsBackground);
mouseX = 150;
mouseY = 60;
@@ -2085,9 +1678,9 @@ void soundControls() {
g_engine->_mouseManager->setMouseArea(Common::Rect(55, 13, 250, 105));
for (ytext = 1; ytext <= 6; ytext++)
- buttonBorder(120 - (ytext * 10), 80 - (ytext * 10), 200 + (ytext * 10), 60 + (ytext * 10), 251, 251, 251, 251, 0, 0, "");
+ buttonBorder(120 - (ytext * 10), 80 - (ytext * 10), 200 + (ytext * 10), 60 + (ytext * 10), 251, 251, 251, 251, 0);
- buttonBorder(86, 31, 94, 44, 0, 0, 0, 0, 0, 0, "");
+ buttonBorder(86, 31, 94, 44, 0, 0, 0, 0, 0);
line(90, 31, 90, 44, 255);
@@ -2103,10 +1696,10 @@ void soundControls() {
g_engine->_graphics->getImg(86, 31, 234, 44, sliderBackground1);
g_engine->_graphics->getImg(86, 76, 234, 89, sliderBackground2);
- volumenfx = round(((rightSfxVol + leftSfxVol) / 2) * 20);
- volumenmelodia = round(((musicVolRight + musicVolLeft) / 2) * 20);
- g_engine->_graphics->putImg(volumenfx + 86, 31, slider);
- g_engine->_graphics->putImg(volumenmelodia + 86, 76, slider);
+ sfxVol = round(((rightSfxVol + leftSfxVol) / 2) * 20);
+ musicVol = round(((musicVolRight + musicVolLeft) / 2) * 20);
+ g_engine->_graphics->putImg(sfxVol + 86, 31, slider);
+ g_engine->_graphics->putImg(musicVol + 86, 76, slider);
g_engine->_mouseManager->setMousePos(1, mouseX, mouseY);
bool keyPressed = false;
@@ -2133,12 +1726,12 @@ void soundControls() {
g_engine->_chrono->updateChrono();
g_engine->_mouseManager->animateMouseIfNeeded();
if (keyPressed) {
- salirmenucontroles = true;
+ exitSoundControls = true;
}
if (mouseClicked) {
if (mouseClickY >= 22 && mouseClickY <= 37) {
g_engine->_mouseManager->hide();
- xfade = 86 + volumenfx;
+ xfade = 86 + sfxVol;
bool mouseReleased = false;
do {
@@ -2160,11 +1753,11 @@ void soundControls() {
g_engine->_graphics->putImg(86, 31, sliderBackground1);
g_engine->_graphics->putImg(xfade, 31, slider);
// This yields a volume between 0 and 140
- volumenfx = xfade - 86;
+ sfxVol = xfade - 86;
- debug("volumefx=%d", volumenfx);
- rightSfxVol = round((float)volumenfx / 20);
- leftSfxVol = round((float)volumenfx / 20);
+ debug("volumefx=%d", sfxVol);
+ rightSfxVol = round((float)sfxVol / 20);
+ leftSfxVol = round((float)sfxVol / 20);
g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
}
g_engine->_screen->update();
@@ -2173,7 +1766,7 @@ void soundControls() {
g_engine->_mouseManager->show();
} else if (mouseClickY >= 67 && mouseClickY <= 82) {
g_engine->_mouseManager->hide();
- xfade = 86 + volumenmelodia;
+ xfade = 86 + musicVol;
bool mouseReleased = false;
do {
while (g_system->getEventManager()->pollEvent(e)) {
@@ -2192,9 +1785,9 @@ void soundControls() {
if (oldxfade != xfade) {
g_engine->_graphics->putImg(86, 76, sliderBackground2);
g_engine->_graphics->putImg(xfade, 76, slider);
- volumenmelodia = xfade - 86;
- musicVolRight = round((float)(volumenmelodia) / 20);
- musicVolLeft = round((float)(volumenmelodia) / 20);
+ musicVol = xfade - 86;
+ musicVolRight = round((float)(musicVol) / 20);
+ musicVolLeft = round((float)(musicVol) / 20);
g_engine->_sound->setMidiVolume(musicVolLeft, musicVolRight);
}
g_engine->_screen->update();
@@ -2202,25 +1795,25 @@ void soundControls() {
g_engine->_mouseManager->show();
} else if (mouseClickY >= 97 && mouseClickY <= 107) {
- salirmenucontroles = true;
+ exitSoundControls = true;
}
mouseClicked = false;
}
g_system->delayMillis(10);
g_engine->_screen->update();
- } while (!salirmenucontroles && !g_engine->shouldQuit());
+ } while (!exitSoundControls && !g_engine->shouldQuit());
- g_engine->_graphics->putImg(50, 10, puntfondcontroles);
- mouseX = oldxraton;
- mouseY = oldyraton;
- mouseMaskIndex = oldiraton;
+ g_engine->_graphics->putImg(50, 10, soundControlsBackground);
+ mouseX = oldMouseX;
+ mouseY = oldMouseY;
+ mouseMaskIndex = oldMouseMask;
g_engine->_mouseManager->setMousePos(mouseMaskIndex, mouseX, mouseY);
- free(puntfondcontroles);
+ free(soundControlsBackground);
free(slider);
free(sliderBackground1);
free(sliderBackground2);
- if (contadorpc > 7)
+ if (cpCounter > 7)
showError(274);
g_engine->_mouseManager->setMouseArea(Common::Rect(0, 0, 305, 185));
@@ -2230,14 +1823,14 @@ void sacrificeScene() {
saveAllowed = false;
palette palaux;
- Common::File fich;
+ Common::File file;
bool isSpanish = (g_engine->_lang == Common::ES_ESP);
const char *const *messages = (isSpanish) ? fullScreenMessages[0] : fullScreenMessages[1];
const long *offsets = (isSpanish) ? flcOffsets[0] : flcOffsets[1];
g_engine->_sound->stopVoc();
- bool pulsada_salida = currentRoomData->paletteAnimationFlag;
+ bool exitPressed = currentRoomData->paletteAnimationFlag;
currentRoomData->paletteAnimationFlag = false;
bar(0, 139, 319, 149, 0);
@@ -2311,12 +1904,12 @@ void sacrificeScene() {
setRGBPalette(200, i * 2, i * 2, i * 2);
bar(10, 10, 310, 120, 0);
- if (!fich.open("SALONREC.PAN")) {
+ if (!file.open("SALONREC.PAN")) {
showError(318);
}
- fich.read(palaux, 768);
- fich.read(sceneBackground, 44800);
- fich.close();
+ file.read(palaux, 768);
+ file.read(sceneBackground, 44800);
+ file.close();
pal[0] = 0;
pal[1] = 0;
@@ -2335,7 +1928,7 @@ void sacrificeScene() {
if (g_engine->shouldQuit())
return;
- drawFlc(0, 0, offsets[17], 0, 9, 19, false, false, true, pulsada_salida);
+ drawFlc(0, 0, offsets[17], 0, 9, 19, false, false, true, exitPressed);
totalFadeOut(128);
g_engine->_sound->stopVoc();
delay(1000);
@@ -2381,10 +1974,10 @@ void sacrificeScene() {
}
delay(2000);
- if (!fich.open("SACRIFIC.PAN")) {
+ if (!file.open("SACRIFIC.PAN")) {
showError(318);
}
- fich.read(palaux, 768);
+ file.read(palaux, 768);
for (int i = 0; i < 256; i++) {
palaux[i * 3 + 0] = palaux[i * 3 + 0] << 2;
@@ -2392,8 +1985,8 @@ void sacrificeScene() {
palaux[i * 3 + 2] = palaux[i * 3 + 2] << 2;
}
- fich.read(sceneBackground, 64000);
- fich.close();
+ file.read(sceneBackground, 64000);
+ file.close();
drawFullScreen(sceneBackground);
palaux[0] = 0;
@@ -2402,12 +1995,12 @@ void sacrificeScene() {
redFadeIn(palaux);
- drawFlc(112, 57, offsets[18], 33, 9, 20, true, false, true, pulsada_salida);
+ drawFlc(112, 57, offsets[18], 33, 9, 20, true, false, true, exitPressed);
g_engine->_sound->autoPlayVoc("REZOS", 0, 0);
if (g_engine->shouldQuit())
return;
- drawFlc(42, 30, offsets[19], 0, 9, 27, false, false, false, pulsada_salida);
+ drawFlc(42, 30, offsets[19], 0, 9, 27, false, false, false, exitPressed);
if (g_engine->shouldQuit())
return;
@@ -2589,7 +2182,7 @@ void sacrificeScene() {
}
delay(2000);
totalFadeOut(0);
- currentRoomData->paletteAnimationFlag = pulsada_salida;
+ currentRoomData->paletteAnimationFlag = exitPressed;
saveAllowed = true;
}
@@ -2639,38 +2232,38 @@ void ending() {
}
void loadBat() {
- Common::File fichcani;
+ Common::File animFile;
isSecondaryAnimationEnabled = true;
- if (!fichcani.open("MURCIE.DAT")) {
+ if (!animFile.open("MURCIE.DAT")) {
showError(265);
}
- secondaryAnimFrameSize = fichcani.readUint16LE();
- secondaryAnimationFrameCount = fichcani.readByte();
- secondaryAnimDirCount = fichcani.readByte();
+ secondaryAnimFrameSize = animFile.readUint16LE();
+ secondaryAnimationFrameCount = animFile.readByte();
+ secondaryAnimDirCount = animFile.readByte();
curSecondaryAnimationFrame = (byte *)malloc(secondaryAnimFrameSize);
- loadAnimationForDirection(&fichcani, 0);
- fichcani.close();
+ loadAnimationForDirection(&animFile, 0);
+ animFile.close();
}
void loadDevil() {
- Common::File fichcani;
+ Common::File animFile;
isSecondaryAnimationEnabled = true;
- if (!fichcani.open("ROJOMOV.DAT")) {
+ if (!animFile.open("ROJOMOV.DAT")) {
showError(265);
}
- secondaryAnimFrameSize = fichcani.readUint16LE();
- secondaryAnimationFrameCount = fichcani.readByte();
- secondaryAnimDirCount = fichcani.readByte();
+ secondaryAnimFrameSize = animFile.readUint16LE();
+ secondaryAnimationFrameCount = animFile.readByte();
+ secondaryAnimDirCount = animFile.readByte();
curSecondaryAnimationFrame = (byte *)malloc(secondaryAnimFrameSize);
if (secondaryAnimDirCount != 0) {
secondaryAnimationFrameCount = secondaryAnimationFrameCount / 4;
for (int i = 0; i <= 3; i++) {
- loadAnimationForDirection(&fichcani, i);
+ loadAnimationForDirection(&animFile, i);
}
}
- fichcani.close();
+ animFile.close();
}
void assembleCompleteBackground(byte *image, uint coordx, uint coordy) {
@@ -2701,11 +2294,11 @@ void assembleCompleteBackground(byte *image, uint coordx, uint coordy) {
void assembleScreen(bool scroll) {
for (int indice = 0; indice < depthLevelCount; indice++) {
- if (screenObjects[indice] != NULL) {
- assembleCompleteBackground(screenObjects[indice], depthMap[indice].posx, depthMap[indice].posy);
+ if (screenLayers[indice] != NULL) {
+ assembleCompleteBackground(screenLayers[indice], depthMap[indice].posx, depthMap[indice].posy);
}
if (!scroll && mainCharAnimation.depth == indice) {
- assembleCompleteBackground(mainCharAnimation.bitmap[characterFacingDir][iframe], characterPosX, characterPosY);
+ assembleCompleteBackground(mainCharAnimation.bitmap[charFacingDirection][iframe], characterPosX, characterPosY);
}
if (!scroll && currentRoomData->animationFlag && secondaryAnimation.depth == indice) {
assembleCompleteBackground(curSecondaryAnimationFrame, secondaryAnimation.posx, secondaryAnimation.posy);
diff --git a/engines/tot/routines2.h b/engines/tot/routines2.h
index 9c3fd3f2995..e36b0569bed 100644
--- a/engines/tot/routines2.h
+++ b/engines/tot/routines2.h
@@ -23,7 +23,7 @@
#include "tot/anims.h"
#include "tot/graphics.h"
-#include "tot/playanim.h"
+#include "tot/vars.h"
#include "tot/util.h"
namespace Tot {
@@ -41,7 +41,7 @@ void assignText();
void updateAltScreen(byte altScreenNumber);
void verifyCopyProtection();
void verifyCopyProtection2();
-void cargatele();
+void loadTV();
void loadScreen();
void loadCharAnimation();
void freeScreenObjects();
@@ -68,8 +68,8 @@ void introduction();
void firstIntroduction();
void readAlphaGraph(Common::String &dato, int long_, int posx, int posy, byte colorbarra);
void readAlphaGraphSmall(Common::String &data, int long_, int posx, int posy, byte colorbarra, byte textColor);
-void hipercadena(Common::String cadenatextnueva, uint xhcnueva, uint yhcnueva, byte anchohc, byte colortextohc, byte colorsombrahc);
-void buttonBorder(uint x1, uint y1, uint x2, uint y2, byte color1, byte color2, byte color3, byte color4, byte color5, uint xtexto, Common::String outputGameName);
+void hyperText(Common::String cadenatextnueva, uint xhcnueva, uint yhcnueva, byte anchohc, byte colortextohc, byte colorsombrahc);
+void buttonBorder(uint x1, uint y1, uint x2, uint y2, byte color1, byte color2, byte color3, byte color4, byte color5);
void copyProtection();
void initialLogo();
void initialMenu(bool fade);
diff --git a/engines/tot/saveload.cpp b/engines/tot/saveload.cpp
index d81ed306b41..4ee54b80521 100644
--- a/engines/tot/saveload.cpp
+++ b/engines/tot/saveload.cpp
@@ -26,7 +26,7 @@
#include "gui/message.h"
#include "tot/forest.h"
-#include "tot/playanim.h"
+#include "tot/vars.h"
#include "tot/routines.h"
#include "tot/tot.h"
@@ -248,7 +248,7 @@ Common::Error TotEngine::syncGame(Common::Serializer &s) {
// Means we are loading from before the game has started
// if(rooms == nullptr) {
g_engine->_graphics->clear();
- processingActive();
+ displayLoading();
loadCharAnimation();
loadObjects();
@@ -258,7 +258,7 @@ Common::Error TotEngine::syncGame(Common::Serializer &s) {
totalFadeOut(0);
g_engine->_graphics->clear();
- processingActive();
+ displayLoading();
initializeScreenFile();
initializeObjectFile();
readConversationFile(Common::String("CONVERSA.TRE"));
diff --git a/engines/tot/soundman.cpp b/engines/tot/sound.cpp
similarity index 99%
rename from engines/tot/soundman.cpp
rename to engines/tot/sound.cpp
index c72620d2883..ce396e63106 100644
--- a/engines/tot/soundman.cpp
+++ b/engines/tot/sound.cpp
@@ -30,7 +30,7 @@
#include "common/memstream.h"
#include "common/substream.h"
-#include "tot/soundman.h"
+#include "tot/sound.h"
#include "tot/tot.h"
#include "tot/util.h"
diff --git a/engines/tot/soundman.h b/engines/tot/sound.h
similarity index 96%
rename from engines/tot/soundman.h
rename to engines/tot/sound.h
index c04d6ddde03..c9791d8251f 100644
--- a/engines/tot/soundman.h
+++ b/engines/tot/sound.h
@@ -18,8 +18,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-#ifndef TOT_SOUNDMAN_H
-#define TOT_SOUNDMAN_H
+#ifndef TOT_SOUND_H
+#define TOT_SOUND_H
#include "audio/audiostream.h"
#include "audio/decoders/raw.h"
@@ -29,7 +29,7 @@
#include "audio/mixer.h"
#include "common/file.h"
-#include "engines/tot/midi.h"
+#include "tot/midi.h"
namespace Tot {
const int kSfxId = 1;
diff --git a/engines/tot/tot.cpp b/engines/tot/tot.cpp
index 97c0ee97b74..f5b0cb831b0 100644
--- a/engines/tot/tot.cpp
+++ b/engines/tot/tot.cpp
@@ -34,10 +34,10 @@
#include "tot/detection.h"
#include "tot/font/bgifont.h"
#include "tot/graphman.h"
-#include "tot/playanim.h"
+#include "tot/vars.h"
#include "tot/routines.h"
#include "tot/routines2.h"
-#include "tot/soundman.h"
+#include "tot/sound.h"
#include "tot/tot.h"
namespace Tot {
diff --git a/engines/tot/tot.h b/engines/tot/tot.h
index 26e60bbac3c..40bee2c9059 100644
--- a/engines/tot/tot.h
+++ b/engines/tot/tot.h
@@ -38,8 +38,8 @@
#include "tot/chrono.h"
#include "tot/detection.h"
#include "tot/graphman.h"
-#include "tot/mouseman.h"
-#include "tot/soundman.h"
+#include "tot/mouse.h"
+#include "tot/sound.h"
namespace Tot {
diff --git a/engines/tot/util.cpp b/engines/tot/util.cpp
index 97ab56331c9..5ab3f0bb86b 100644
--- a/engines/tot/util.cpp
+++ b/engines/tot/util.cpp
@@ -485,14 +485,14 @@ void emptyLoop() {
do {
g_engine->_chrono->updateChrono();
g_engine->_screen->update();
- } while (!tocapintar && !g_engine->shouldQuit());
+ } while (!timeToDraw && !g_engine->shouldQuit());
}
void emptyLoop2() {
do {
g_engine->_chrono->updateChrono();
g_engine->_screen->update();
- } while (!tocapintar2);
+ } while (!timeToDraw2);
}
void waitForKey() {
diff --git a/engines/tot/util.h b/engines/tot/util.h
index 0fc747f780a..311782e5265 100644
--- a/engines/tot/util.h
+++ b/engines/tot/util.h
@@ -5,10 +5,10 @@
#include "common/events.h"
#include "common/language.h"
#include "common/scummsys.h"
-
#include "graphics/font.h"
-#include "engines/tot/texts.h"
-#include "engines/tot/tot.h"
+
+#include "tot/texts.h"
+#include "tot/tot.h"
namespace Tot {
diff --git a/engines/tot/playanim.cpp b/engines/tot/vars.cpp
similarity index 97%
rename from engines/tot/playanim.cpp
rename to engines/tot/vars.cpp
index dd3abe61c63..ea0e47ca3be 100644
--- a/engines/tot/playanim.cpp
+++ b/engines/tot/vars.cpp
@@ -23,7 +23,7 @@
#include "common/textconsole.h"
#include "tot/chrono.h"
-#include "tot/playanim.h"
+#include "tot/vars.h"
namespace Tot {
@@ -87,9 +87,9 @@ palette pal;
InventoryEntry mobj[inventoryIconCount];
-byte *mochilaxms[inventoryIconCount];
+byte *inventoryIconBitmaps[inventoryIconCount];
-byte saltospal;
+byte palAnimStep;
byte inventoryPosition;
@@ -109,11 +109,11 @@ byte secondaryAnimationFrameCount;
byte secondaryAnimDirCount;
-byte contadorpc, contadorpc2;
+byte cpCounter, cpCounter2;
byte destinationStepX, destinationStepY;
-byte characterFacingDir;
+byte charFacingDirection;
uint secondaryAnimWidth, secondaryAnimHeight;
@@ -199,7 +199,7 @@ long screenSize;
ObjectInfo depthMap[numScreenOverlays];
-byte *screenObjects[numScreenOverlays];
+byte *screenLayers[numScreenOverlays];
byte *curCharacterAnimationFrame;
@@ -227,7 +227,7 @@ void clearObj() {
regobj.afterUseTextRef = 0;
regobj.pickTextRef = 0;
regobj.useTextRef = 0;
- regobj.habla = 0;
+ regobj.speaking = 0;
regobj.openable = false;
regobj.closeable = false;
for (int i = 0; i <= 7; i++)
@@ -255,7 +255,7 @@ void clearObj() {
regobj.mouseGridPatch[i][j] = 0;
}
}
- contadorpc2 = contadorpc;
+ cpCounter2 = cpCounter;
}
void clearScreenData() {
@@ -310,7 +310,7 @@ void resetGameState() {
currentZone = 1;
targetZone = 1;
oldTargetZone = 0;
- characterFacingDir = 1;
+ charFacingDirection = 1;
firstTimeTopicA[0] = true;
firstTimeTopicA[1] = true;
firstTimeTopicA[2] = true;
@@ -400,7 +400,7 @@ void resetGameState() {
isTVOn = false;
isTrapSet = false;
- saltospal = 0;
+ palAnimStep = 0;
niche[0][0] = 563;
niche[0][1] = 561;
@@ -682,9 +682,9 @@ void initPlayAnim() {
// encriptado[251] = encripcod1;
// encriptado[252] = encripcod1;
// encriptado[253] = '\63';
- tocapintar = false;
+ timeToDraw = false;
for (int i = 0; i < numScreenOverlays; i++) {
- screenObjects[i] = NULL;
+ screenLayers[i] = NULL;
}
mouseX = 160;
mouseY = 100;
@@ -704,8 +704,8 @@ void initPlayAnim() {
secondList[2] = 308;
secondList[3] = 362;
secondList[4] = 537;
- contadorpc = 0;
- contadorpc2 = 0;
+ cpCounter = 0;
+ cpCounter2 = 0;
continueGame = true;
firstTimeDone = false;
isIntroSeen = false;
@@ -729,13 +729,13 @@ void clearVars() {
free(invItemData);
}
for(int i = 0; i < numScreenOverlays; i++) {
- if(screenObjects[i] != NULL) {
- free(screenObjects[i]);
+ if(screenLayers[i] != NULL) {
+ free(screenLayers[i]);
}
}
for(int i = 0; i < inventoryIconCount; i++) {
- if(mochilaxms[i] != NULL) {
- free(mochilaxms[i]);
+ if(inventoryIconBitmaps[i] != NULL) {
+ free(inventoryIconBitmaps[i]);
}
}
for(int i = 0; i < 4; i++) {
diff --git a/engines/tot/playanim.h b/engines/tot/vars.h
similarity index 97%
rename from engines/tot/playanim.h
rename to engines/tot/vars.h
index bd612f64be1..f83b6942915 100644
--- a/engines/tot/playanim.h
+++ b/engines/tot/vars.h
@@ -18,8 +18,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-#ifndef TOT_PLAYANIM_H
-#define TOT_PLAYANIM_H
+#ifndef TOT_VARS_H
+#define TOT_VARS_H
#include "common/file.h"
#include "common/memstream.h"
@@ -130,7 +130,7 @@ struct ScreenObject {
uint16 afterUseTextRef; /* Text reference after using object */
uint16 pickTextRef; /* Text reference when picking up object */
uint16 useTextRef; /* Text reference when using object */
- byte habla; /* whether the object talks or not */
+ byte speaking; /* whether the object talks or not */
bool openable; /* true if it can be opened */
bool closeable; /* true if it can be closed*/
byte used[8]; /* flags (one per original savegame) on whether the object has been used */
@@ -374,12 +374,12 @@ extern InventoryEntry mobj[inventoryIconCount];
/**
* Keeps an array of all inventory icon bitmaps
*/
-extern byte *mochilaxms[inventoryIconCount];
+extern byte *inventoryIconBitmaps[inventoryIconCount];
/**
* Delay of palette animation
*/
-extern byte saltospal;
+extern byte palAnimStep;
/**
* Position within inventory
*/
@@ -419,7 +419,7 @@ extern byte secondaryAnimDirCount;
/**
* Data protection control
*/
-extern byte contadorpc, contadorpc2;
+extern byte cpCounter, cpCounter2;
/**
* Coordinates of target step
*/
@@ -431,7 +431,7 @@ extern byte destinationStepX, destinationStepY;
* 2: downwards
* 3: left
*/
-extern byte characterFacingDir;
+extern byte charFacingDirection;
/**
* Width and height of secondary animation
@@ -580,7 +580,7 @@ extern ObjectInfo depthMap[numScreenOverlays];
/**
* Bitmaps of screenobjects
*/
-extern byte *screenObjects[numScreenOverlays];
+extern byte *screenLayers[numScreenOverlays];
/**
* Current frame of main character
*/
Commit: 598883d88cea0ec20134d3c6dba433b9ce885729
https://github.com/scummvm/scummvm/commit/598883d88cea0ec20134d3c6dba433b9ce885729
Author: gsanmartin (gabriel.sanmartin at dna.inc)
Date: 2025-09-08T16:49:50+02:00
Commit Message:
TOT: Merge texts and offsets into statics
Changed paths:
A engines/tot/statics.h
R engines/tot/offsets.h
R engines/tot/texts.h
engines/tot/anims.cpp
engines/tot/dialog.cpp
engines/tot/game.cpp
engines/tot/graphman.cpp
engines/tot/routines.cpp
engines/tot/routines2.cpp
engines/tot/util.h
diff --git a/engines/tot/anims.cpp b/engines/tot/anims.cpp
index 815b7b290fc..43acc8f2daf 100644
--- a/engines/tot/anims.cpp
+++ b/engines/tot/anims.cpp
@@ -31,7 +31,7 @@
#include "tot/decoder/TotFlicDecoder.h"
#include "tot/graphics.h"
#include "tot/vars.h"
-#include "tot/texts.h"
+#include "tot/statics.h"
#include "tot/tot.h"
namespace Tot {
diff --git a/engines/tot/dialog.cpp b/engines/tot/dialog.cpp
index 4de677ea871..a17261e8763 100644
--- a/engines/tot/dialog.cpp
+++ b/engines/tot/dialog.cpp
@@ -29,7 +29,7 @@
#include "tot/mouse.h"
#include "tot/routines.h"
#include "tot/routines2.h"
-#include "tot/texts.h"
+#include "tot/statics.h"
#include "tot/tot.h"
namespace Tot {
diff --git a/engines/tot/game.cpp b/engines/tot/game.cpp
index 12a5141ab3e..3bec2cf4844 100644
--- a/engines/tot/game.cpp
+++ b/engines/tot/game.cpp
@@ -27,7 +27,7 @@
#include "tot/mouse.h"
#include "tot/routines.h"
#include "tot/routines2.h"
-#include "tot/texts.h"
+#include "tot/statics.h"
#include "tot/tot.h"
#include "tot/util.h"
diff --git a/engines/tot/graphman.cpp b/engines/tot/graphman.cpp
index c47f23051b3..e7f8bf97a99 100644
--- a/engines/tot/graphman.cpp
+++ b/engines/tot/graphman.cpp
@@ -25,7 +25,7 @@
#include "tot/font/biosfont.h"
#include "tot/graphman.h"
-#include "tot/offsets.h"
+#include "tot/statics.h"
#include "tot/tot.h"
namespace Tot {
diff --git a/engines/tot/offsets.h b/engines/tot/offsets.h
deleted file mode 100644
index 0949aa9e010..00000000000
--- a/engines/tot/offsets.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-#include "common/scummsys.h"
-
-
-namespace Tot {
-
- const int FONT_LITT_OFFSET_ES = 153584;
- const int FONT_EURO_OFFSET_ES = 159681;
- const int FONT_LITT_OFFSET_EN = 153010;
- const int FONT_EURO_OFFSET_EN = 159107;
-
- static const long menuOffsets_ES[8][2] = {
- {0, 16004},
- {16004, 24535},
- {40539, 24535},
- {65074, 26745},
- {91819, 16004},
- {107823, 24535},
- {132358, 14969},
- {147327, 7148},
- };
-
- static const long menuOffsets_EN[8][2] = {
- {0, 16004},
- {16004, 24535},
- {40539, 24535},
- {65074, 26745},
- {91819, 16004},
- {107823, 24535},
- {132358, 14417},
- {146775, 7148},
- };
-
- static const long flcOffsets[2][32] = {
- {
- 0, //Logo
- 837602, // Menu reveal
- // 2 - Intro vids
- 888366, // Tv speaks
- 908896,
- 972458, // opens car and gets to door
- 1269108, // knocks on door
- 1284784, // talks to door
- 1299404, // doorman opens door
- 1321354, // doorman speaks,
- 1334608, // talks to doorman at door
- 1349402, // doorman walks to car
- 1463880, // doorman talks next to car
-
- 1471630, // talks to doorman next to car
- 1480982, // doorman opens car
- 1500902, // doorman talks with car open
- 1508036, // doorman leaves with car
- 1701780, // main char speaks alone
- // 17 Sacrifice
- 1712400, // character drinks from cup,
- 1783054, // prayers
- 1806212, // sacrifice
- // 20 Others
- 2124896, // Use sharp scythe with statue,
- 2216848, // change feather for scythe
- 2209158, // Use ring with pedestal,
- 2076280, // Use urn with altar
- 2441804, // Sharpen scythe
- 2361800, // Use rope with precipice
- 2382552, // Trident with dent
- 2464240, // Rock with mural
- 2296092, // Press button of oven with the jar
- 2231140, // Press button of oven with no jar
- // 30 Ending
- 2481274, // Part 1
- 2554766 // Part 2
- },
- {
- 0, //Logo
- 837602, // Menu reveal
- //Intro vids
- 894900, // tv speaks
- 915430,
- 978992, // opens car and gets to door
- 1275642, // knocks door
- 1291318, // talks to door
- 1305938, // doorman opens door
- 1327888, // doorman speaks
- 1341142, // talks to doorman at door,
- 1355936, // doorman walks to car
- 1470414, // doorman talks next to car
- 1478164, // talks to doorman next to car
- 1487516, // doorman opens car
- 1507436, // doorman talks with car open
- 1514570, // doorman leaves with car
- 1708314, // main char speaks alone
- // 17 Sacrifice
- 1718934, // character drinks from cup
- 1789588, // prayers
- 1812746, // sacrifice
- // 20 others
- 2399068, // Use sharp scythe with statue
- 2491020, // change feather for scythe
- 2483330, // Use ring with pedestal
- 2350452, // Use urn with altar
- 2715976, // Sharpen scythe
- 2635972, // Use rope with precipice
- 2656724, // Trident with dent
- 2738412, // Rock with mural
- 2570264, // Press button of oven with the jar
- 2505312, // Press button of oven with no jar,
- // 30 Ending
- 2082814, // Part 1
- 2156306 // Part 2
- }
- };
-
-} // End of namespace Tot
diff --git a/engines/tot/routines.cpp b/engines/tot/routines.cpp
index fd313602587..24a137f1572 100644
--- a/engines/tot/routines.cpp
+++ b/engines/tot/routines.cpp
@@ -22,9 +22,8 @@
#include "common/debug.h"
#include "common/endian.h"
-#include "tot/offsets.h"
#include "tot/routines.h"
-#include "tot/texts.h"
+#include "tot/statics.h"
#include "tot/tot.h"
namespace Tot {
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
index bfe03d484cf..52a01b3830c 100644
--- a/engines/tot/routines2.cpp
+++ b/engines/tot/routines2.cpp
@@ -28,10 +28,9 @@
#include "graphics/paletteman.h"
#include "graphics/surface.h"
-#include "tot/offsets.h"
#include "tot/routines.h"
#include "tot/routines2.h"
-#include "tot/texts.h"
+#include "tot/statics.h"
#include "tot/tot.h"
#include "tot/util.h"
diff --git a/engines/tot/texts.h b/engines/tot/statics.h
similarity index 87%
rename from engines/tot/texts.h
rename to engines/tot/statics.h
index c290323be7f..f8f27c291cd 100644
--- a/engines/tot/texts.h
+++ b/engines/tot/statics.h
@@ -19,9 +19,10 @@
*
*/
-#ifndef TOT_TEXTS_H
-#define TOT_TEXTS_H
- #include "common/str.h"
+#ifndef TOT_STATICS_H
+#define TOT_STATICS_H
+
+#include "common/str.h"
#include "common/keyboard.h"
namespace Tot {
@@ -811,7 +812,6 @@ static const char *const fullScreenMessages[2][59] = {
},
};
-
static const char *const actionLine_ES[] = {
"IR A ",
"HABLAR CON ",
@@ -909,8 +909,113 @@ static const Common::KeyCode hotkeys[2][8]{
// YES
Common::KEYCODE_y,
// NO
- Common::KEYCODE_n}
- };
+ Common::KEYCODE_n}};
+
+const int FONT_LITT_OFFSET_ES = 153584;
+const int FONT_EURO_OFFSET_ES = 159681;
+const int FONT_LITT_OFFSET_EN = 153010;
+const int FONT_EURO_OFFSET_EN = 159107;
+
+static const long menuOffsets_ES[8][2] = {
+ {0, 16004},
+ {16004, 24535},
+ {40539, 24535},
+ {65074, 26745},
+ {91819, 16004},
+ {107823, 24535},
+ {132358, 14969},
+ {147327, 7148},
+};
+
+static const long menuOffsets_EN[8][2] = {
+ {0, 16004},
+ {16004, 24535},
+ {40539, 24535},
+ {65074, 26745},
+ {91819, 16004},
+ {107823, 24535},
+ {132358, 14417},
+ {146775, 7148},
+};
+
+static const long flcOffsets[2][32] = {
+ {
+ 0, // Logo
+ 837602, // Menu reveal
+ // 2 - Intro vids
+ 888366, // Tv speaks
+ 908896,
+ 972458, // opens car and gets to door
+ 1269108, // knocks on door
+ 1284784, // talks to door
+ 1299404, // doorman opens door
+ 1321354, // doorman speaks,
+ 1334608, // talks to doorman at door
+ 1349402, // doorman walks to car
+ 1463880, // doorman talks next to car
+
+ 1471630, // talks to doorman next to car
+ 1480982, // doorman opens car
+ 1500902, // doorman talks with car open
+ 1508036, // doorman leaves with car
+ 1701780, // main char speaks alone
+ // 17 Sacrifice
+ 1712400, // character drinks from cup,
+ 1783054, // prayers
+ 1806212, // sacrifice
+ // 20 Others
+ 2124896, // Use sharp scythe with statue,
+ 2216848, // change feather for scythe
+ 2209158, // Use ring with pedestal,
+ 2076280, // Use urn with altar
+ 2441804, // Sharpen scythe
+ 2361800, // Use rope with precipice
+ 2382552, // Trident with dent
+ 2464240, // Rock with mural
+ 2296092, // Press button of oven with the jar
+ 2231140, // Press button of oven with no jar
+ // 30 Ending
+ 2481274, // Part 1
+ 2554766 // Part 2
+ },
+ {
+ 0, // Logo
+ 837602, // Menu reveal
+ // Intro vids
+ 894900, // tv speaks
+ 915430,
+ 978992, // opens car and gets to door
+ 1275642, // knocks door
+ 1291318, // talks to door
+ 1305938, // doorman opens door
+ 1327888, // doorman speaks
+ 1341142, // talks to doorman at door,
+ 1355936, // doorman walks to car
+ 1470414, // doorman talks next to car
+ 1478164, // talks to doorman next to car
+ 1487516, // doorman opens car
+ 1507436, // doorman talks with car open
+ 1514570, // doorman leaves with car
+ 1708314, // main char speaks alone
+ // 17 Sacrifice
+ 1718934, // character drinks from cup
+ 1789588, // prayers
+ 1812746, // sacrifice
+ // 20 others
+ 2399068, // Use sharp scythe with statue
+ 2491020, // change feather for scythe
+ 2483330, // Use ring with pedestal
+ 2350452, // Use urn with altar
+ 2715976, // Sharpen scythe
+ 2635972, // Use rope with precipice
+ 2656724, // Trident with dent
+ 2738412, // Rock with mural
+ 2570264, // Press button of oven with the jar
+ 2505312, // Press button of oven with no jar,
+ // 30 Ending
+ 2082814, // Part 1
+ 2156306 // Part 2
+ }};
} // End of namespace Tot
#endif
diff --git a/engines/tot/util.h b/engines/tot/util.h
index 311782e5265..babe0517bff 100644
--- a/engines/tot/util.h
+++ b/engines/tot/util.h
@@ -7,7 +7,7 @@
#include "common/scummsys.h"
#include "graphics/font.h"
-#include "tot/texts.h"
+#include "tot/statics.h"
#include "tot/tot.h"
namespace Tot {
Commit: 6227954cb7913ed0b0ac935be53594f81ba39bcc
https://github.com/scummvm/scummvm/commit/6227954cb7913ed0b0ac935be53594f81ba39bcc
Author: gsanmartin (gabriel.sanmartin at dna.inc)
Date: 2025-09-08T16:49:50+02:00
Commit Message:
TOT: Fixes diploma saving & chrono adjustments
Changed paths:
engines/tot/anims.cpp
engines/tot/anims.h
engines/tot/chrono.cpp
engines/tot/chrono.h
engines/tot/console.cpp
engines/tot/console.h
engines/tot/dialog.cpp
engines/tot/dialog.h
engines/tot/forest.cpp
engines/tot/forest.h
engines/tot/game.cpp
engines/tot/graphics.cpp
engines/tot/graphics.h
engines/tot/graphman.cpp
engines/tot/mouse.cpp
engines/tot/routines.cpp
engines/tot/routines2.cpp
engines/tot/routines2.h
engines/tot/util.cpp
engines/tot/util.h
engines/tot/vars.cpp
engines/tot/vars.h
diff --git a/engines/tot/anims.cpp b/engines/tot/anims.cpp
index 43acc8f2daf..f7bbd74fce2 100644
--- a/engines/tot/anims.cpp
+++ b/engines/tot/anims.cpp
@@ -46,35 +46,35 @@ bool firstLoop;
void drawText(uint x, uint y, Common::String str1, Common::String str2, Common::String str3, Common::String str4, Common::String str5, byte textColor, byte borderColor) {
- littText(x, (y + 3), str1, borderColor);
+ littText(x, (y + 3), str1, borderColor);
littText(x, (y + 13), str2, borderColor);
littText(x, (y + 23), str3, borderColor);
littText(x, (y + 33), str4, borderColor);
littText(x, (y + 43), str5, borderColor);
g_engine->_screen->update();
- delay(enforcedTextAnimDelay);
- littText(x, (y + 1), str1, borderColor);
+ delay(kEnforcedTextAnimDelay);
+ littText(x, (y + 1), str1, borderColor);
littText(x, (y + 11), str2, borderColor);
littText(x, (y + 21), str3, borderColor);
littText(x, (y + 31), str4, borderColor);
littText(x, (y + 41), str5, borderColor);
g_engine->_screen->update();
- delay(enforcedTextAnimDelay);
- littText(x + 1, (y + 2), str1, borderColor);
+ delay(kEnforcedTextAnimDelay);
+ littText(x + 1, (y + 2), str1, borderColor);
littText(x + 1, (y + 12), str2, borderColor);
littText(x + 1, (y + 22), str3, borderColor);
littText(x + 1, (y + 32), str4, borderColor);
littText(x + 1, (y + 42), str5, borderColor);
g_engine->_screen->update();
- delay(enforcedTextAnimDelay);
- littText(x - 1, (y + 2), str1, borderColor);
+ delay(kEnforcedTextAnimDelay);
+ littText(x - 1, (y + 2), str1, borderColor);
littText(x - 1, (y + 12), str2, borderColor);
littText(x - 1, (y + 22), str3, borderColor);
littText(x - 1, (y + 32), str4, borderColor);
littText(x - 1, (y + 42), str5, borderColor);
g_engine->_screen->update();
- delay(enforcedTextAnimDelay);
- littText(x, (y + 2), str1, textColor);
+ delay(kEnforcedTextAnimDelay);
+ littText(x, (y + 2), str1, textColor);
littText(x, (y + 12), str2, textColor);
littText(x, (y + 22), str3, textColor);
littText(x, (y + 32), str4, textColor);
@@ -952,7 +952,7 @@ static void loadFlc(
if (exitAnim) {
goto Lexit_proc;
}
- if (timeToDraw) {
+ if (gameTick) {
frameCount++;
handleFlcEvent(eventNumber);
const Graphics::Surface *frame = flic.decodeNextFrame();
@@ -993,7 +993,7 @@ static void loadFlc(
updatePalette(isPaletteAnimEnabled);
} else palAnimStep += 1;
- timeToDraw = false;
+ gameTick = false;
} else {
break;
}
@@ -1030,7 +1030,6 @@ void drawFlc(
flicFilePos = offset;
flicRelativePos = x + y * 320;
loadFlc(loop, skipAllowed, exitAnim, numEvent, fullPalette, limitPaletteTo200, speed, x, y);
- debug("Salida flis: %d", exitAnim);
}
void clearAnims() {
diff --git a/engines/tot/anims.h b/engines/tot/anims.h
index 96f26e9a229..a7547af13d1 100644
--- a/engines/tot/anims.h
+++ b/engines/tot/anims.h
@@ -25,9 +25,9 @@
namespace Tot {
-void drawFlc(uint flicx, uint flicy, int32 posicionfli, uint loop,
- byte veloc, byte numevento, bool palcompleta, bool permitesalida,
- bool doscientos, bool &salidaflis);
+void drawFlc(uint x, uint y, int32 offset, uint loop,
+ byte speed, byte eventNumber, bool fullPalette, bool isSkipAllowed,
+ bool limitPaletteTo200, bool &exitAnim);
void clearAnims();
/**
diff --git a/engines/tot/chrono.cpp b/engines/tot/chrono.cpp
index 7b581d836e9..6ecbfa900df 100644
--- a/engines/tot/chrono.cpp
+++ b/engines/tot/chrono.cpp
@@ -21,13 +21,14 @@
#include "common/system.h"
+#include "chrono.h"
#include "tot/chrono.h"
#include "tot/tot.h"
namespace Tot {
-bool timeToDraw = false;
-bool timeToDraw2 = false;
+bool gameTick = false;
+bool gameTickHalfSpeed = false;
bool timeToDrawEffect = false;
ChronoManager::ChronoManager(/* args */) : _lastTick(0), _lastDoubleTick(0) {
@@ -39,18 +40,18 @@ ChronoManager::~ChronoManager() {
void ChronoManager::updateChrono() {
uint32 currentTime = g_system->getMillis();
- if ((currentTime - _lastTick) >= kFrameMs / _speedMultiplier) {
- timeToDraw = true;
- tocapintarTick++;
- if (tocapintarTick == kDoubleFrameMultiplier) {
- tocapintarTick = 0;
- timeToDraw2 = true;
+ if ((currentTime - _lastTick) >= kTickMs / _speedMultiplier) {
+ gameTick = true;
+ _tickCount++;
+ if (_tickCount == kHalfTickMultiplier) {
+ _tickCount = 0;
+ gameTickHalfSpeed = true;
} else {
- timeToDraw2 = false;
+ gameTickHalfSpeed = false;
}
_lastTick = currentTime;
} else {
- timeToDraw = false;
+ gameTick = false;
}
}
@@ -64,13 +65,20 @@ bool ChronoManager::shouldPaintEffect(int speed) {
return false;
}
-void Tot::ChronoManager::delay(int ms) {
- if (ms > 10) {
- debug("Starting delay of %d", ms);
- }
+void ChronoManager::changeSpeed() {
+ if (_speedMultiplier == 1)
+ g_engine->_chrono->_speedMultiplier = 4;
+ else
+ g_engine->_chrono->_speedMultiplier = 1;
+}
+
+void ChronoManager::delay(int ms) {
uint32 delayStart = g_system->getMillis();
Common::Event e;
ms = ms / _speedMultiplier;
+ if (ms > 10) {
+ debug("Starting delay of %d", ms);
+ }
while ((g_system->getMillis() - delayStart) < ms && !g_engine->shouldQuit()) {
while (g_system->getEventManager()->pollEvent(e)) {
}
diff --git a/engines/tot/chrono.h b/engines/tot/chrono.h
index 9fd7b2f0f58..a283d3af2ec 100644
--- a/engines/tot/chrono.h
+++ b/engines/tot/chrono.h
@@ -28,12 +28,11 @@ namespace Tot {
/**
* Flags for animations
*/
-extern bool timeToDraw, timeToDraw2, timeToDrawEffect;
+extern bool gameTick, gameTickHalfSpeed, timeToDrawEffect;
-// Set to 30 for ease of dev
-const int kFrameMs = 20;
-// const int kFrameMs = 50;
-const int kDoubleFrameMultiplier = 3;
+// const int kTickMs = 20;
+const int kTickMs = 50;
+const int kHalfTickMultiplier = 2;
const int kFrameEffectMs = 10;
class ChronoManager {
@@ -41,16 +40,17 @@ private:
uint32 _lastTick = 0;
uint32 _lastTickEffect = 0;
uint32 _lastDoubleTick = 0;
- byte tocapintarTick = 0;
+ byte _tickCount = 0;
uint32 _lastEffectRender = 0;
+ byte _speedMultiplier = 1;
public:
- ChronoManager(/* args */);
+ ChronoManager();
~ChronoManager();
void updateChrono();
void delay(int ms);
bool shouldPaintEffect(int speed);
- byte _speedMultiplier = 1;
+ void changeSpeed();
};
} // End of namespace Tot
diff --git a/engines/tot/console.cpp b/engines/tot/console.cpp
index e34b92851d1..ef4dbcab2c0 100644
--- a/engines/tot/console.cpp
+++ b/engines/tot/console.cpp
@@ -20,8 +20,8 @@
*/
#include "tot/console.h"
-#include "tot/vars.h"
#include "tot/routines.h"
+#include "tot/vars.h"
namespace Tot {
@@ -36,10 +36,8 @@ TotConsole::TotConsole(TotEngine *engine) : _engine(engine) {
}
TotConsole::~TotConsole() {
-
}
-
bool TotConsole::cmdShowMouseGrid(int argc, const char **argv) {
_engine->_showMouseGrid = true;
debugPrintf("Enabled mouse hotspot grid");
@@ -91,7 +89,6 @@ bool TotConsole::cmdLoadRoom(int argc, const char **argv) {
return true;
}
-
bool TotConsole::cmdJumpToPart2(int argc, const char **argv) {
list1Complete = true;
list2Complete = true;
diff --git a/engines/tot/console.h b/engines/tot/console.h
index d4b269c195d..9dc53b9634b 100644
--- a/engines/tot/console.h
+++ b/engines/tot/console.h
@@ -39,6 +39,7 @@ private:
bool cmdShowGameGrid(int argc, const char **argv);
bool cmdShowObjectAreas(int argc, const char **argv);
bool cmdClearLayers(int argc, const char **argv);
+
public:
TotConsole(TotEngine *engine);
~TotConsole() override;
diff --git a/engines/tot/dialog.cpp b/engines/tot/dialog.cpp
index a17261e8763..9b297cbd13d 100644
--- a/engines/tot/dialog.cpp
+++ b/engines/tot/dialog.cpp
@@ -19,17 +19,11 @@
*
*/
-#define __conversa_implementation__
-
#include "common/scummsys.h"
#include "common/textconsole.h"
-#include "tot/chrono.h"
#include "tot/dialog.h"
-#include "tot/mouse.h"
#include "tot/routines.h"
-#include "tot/routines2.h"
-#include "tot/statics.h"
#include "tot/tot.h"
namespace Tot {
@@ -347,11 +341,11 @@ void fixTree(Tree tree) {
}
}
-void showDialogLine(Common::String conversationMatrix[16], uint &choosenTopic) {
- byte firstChat, convselec;
+void showDialogLine(Common::String conversationMatrix[16], uint &chosenTopic) {
+ byte firstChat, selectedConv;
firstChat = 1;
- convselec = 0;
+ selectedConv = 0;
g_engine->_mouseManager->hide();
drawMenu(5);
@@ -380,7 +374,7 @@ void showDialogLine(Common::String conversationMatrix[16], uint &choosenTopic) {
}
}
- if (timeToDraw) {
+ if (gameTick) {
if (currentRoomData->paletteAnimationFlag && palAnimStep >= 4) {
palAnimStep = 0;
if (isPaletteAnimEnabled > 6)
@@ -397,22 +391,22 @@ void showDialogLine(Common::String conversationMatrix[16], uint &choosenTopic) {
if (lMouseClicked) {
if (mouseClickY < 143)
- convselec = 0;
+ selectedConv = 0;
else {
if (mouseClickX >= 0 && mouseClickX <= 280) {
if (mouseClickY >= 143 && mouseClickY <= 155) {
- convselec = firstChat;
+ selectedConv = firstChat;
} else if (mouseClickY >= 156 && mouseClickY <= 166) {
- convselec = firstChat + 1;
+ selectedConv = firstChat + 1;
} else if (mouseClickY >= 167 && mouseClickY <= 177) {
- convselec = firstChat + 2;
+ selectedConv = firstChat + 2;
} else if (mouseClickY >= 178 && mouseClickY <= 186) {
- convselec = firstChat + 3;
+ selectedConv = firstChat + 3;
}
} else if (mouseClickX >= 281 && mouseClickX <= 319) {
if (mouseClickY >= 143 && mouseClickY <= 165) {
if (firstChat > 1) {
- convselec = 0;
+ selectedConv = 0;
firstChat -= 1;
g_engine->_mouseManager->hide();
drawMenu(5);
@@ -424,7 +418,7 @@ void showDialogLine(Common::String conversationMatrix[16], uint &choosenTopic) {
}
} else if (mouseClickY >= 167 && mouseClickY <= 186) {
if (firstChat < 12) {
- convselec = 0;
+ selectedConv = 0;
firstChat += 1;
g_engine->_mouseManager->hide();
drawMenu(5);
@@ -438,14 +432,14 @@ void showDialogLine(Common::String conversationMatrix[16], uint &choosenTopic) {
}
}
} else if (rMouseClicked)
- convselec = conversationIndex;
- } while (!((convselec > 0) && (convselec <= conversationIndex)) && !g_engine->shouldQuit());
+ selectedConv = conversationIndex;
+ } while (!((selectedConv > 0) && (selectedConv <= conversationIndex)) && !g_engine->shouldQuit());
- if (convselec == conversationIndex)
+ if (selectedConv == conversationIndex)
endOfConversation = true;
- for (int i = 1; i <= (convselec - 1); i++)
+ for (int i = 1; i <= (selectedConv - 1); i++)
l1 = l1->next;
- choosenTopic = l1->item;
+ chosenTopic = l1->item;
}
void talk(byte characterIndex) {
@@ -515,22 +509,22 @@ void talk(byte characterIndex) {
case 9: {
obtainedList1 = true;
invIndex = 0;
- while (mobj[invIndex].code != 0) {
+ while (inventory[invIndex].code != 0) {
invIndex += 1;
}
- mobj[invIndex].bitmapIndex = list1Index;
- mobj[invIndex].code = list1code;
- mobj[invIndex].objectName = getObjectName(0);
+ inventory[invIndex].bitmapIndex = list1Index;
+ inventory[invIndex].code = list1code;
+ inventory[invIndex].objectName = getObjectName(0);
} break;
case 25: {
obtainedList2 = true;
invIndex = 0;
- while (mobj[invIndex].code != 0) {
+ while (inventory[invIndex].code != 0) {
invIndex += 1;
}
- mobj[invIndex].bitmapIndex = list2Index;
- mobj[invIndex].code = list2code;
- mobj[invIndex].objectName = getObjectName(1);
+ inventory[invIndex].bitmapIndex = list2Index;
+ inventory[invIndex].code = list2code;
+ inventory[invIndex].objectName = getObjectName(1);
} break;
}
}
diff --git a/engines/tot/dialog.h b/engines/tot/dialog.h
index 9101bee074c..356a6c52996 100644
--- a/engines/tot/dialog.h
+++ b/engines/tot/dialog.h
@@ -24,7 +24,6 @@
#include "common/scummsys.h"
#include "tot/forest.h"
-#include "tot/util.h"
namespace Tot {
diff --git a/engines/tot/forest.cpp b/engines/tot/forest.cpp
index 61652b0f3c9..d3d4ddb6732 100644
--- a/engines/tot/forest.cpp
+++ b/engines/tot/forest.cpp
@@ -19,9 +19,6 @@
*
*/
-#include "common/debug.h"
-#include "common/file.h"
-
#include "tot/forest.h"
namespace Tot {
diff --git a/engines/tot/forest.h b/engines/tot/forest.h
index 63cabff92fe..9803b4b77da 100644
--- a/engines/tot/forest.h
+++ b/engines/tot/forest.h
@@ -21,11 +21,7 @@
#ifndef TOT_FOREST_H
#define TOT_FOREST_H
-#include "common/scummsys.h"
-#include "common/str.h"
-#include "common/stream.h"
-
-#include "util.h"
+#include "tot/util.h"
namespace Tot {
@@ -41,7 +37,7 @@ struct treeDef {
Tree parent, sibling, child;
};
-void initTree(Tree& a, nodeElement data);
+void initTree(Tree &a, nodeElement data);
bool isRoot(Tree node);
@@ -53,15 +49,14 @@ Tree leftChild(Tree node);
int depth(Tree node);
-void expandNode(Tree& node, nodeElement data);
+void expandNode(Tree &node, nodeElement data);
-void preOrder(Tree a, Common::String& string_);
+void preOrder(Tree a, Common::String &string_);
void saveConversations(Common::SeekableWriteStream *s, Tree a, uint location);
-void readTree(Common::SeekableReadStream &f, Tree& a, uint location);
-void readTree(Common::String f, Tree& a, uint location);
+void readTree(Common::SeekableReadStream &f, Tree &a, uint location);
+void readTree(Common::String f, Tree &a, uint location);
} // End of namespace Tot
#endif
-
diff --git a/engines/tot/game.cpp b/engines/tot/game.cpp
index 3bec2cf4844..88d2375721f 100644
--- a/engines/tot/game.cpp
+++ b/engines/tot/game.cpp
@@ -53,16 +53,16 @@ void newGame() {
resetGameState();
inGame = true;
for (int i = 0; i < inventoryIconCount; i++) {
- mobj[i].bitmapIndex = 34;
- mobj[i].code = 0;
- mobj[i].objectName = getObjectName(10);
+ inventory[i].bitmapIndex = 34;
+ inventory[i].code = 0;
+ inventory[i].objectName = getObjectName(10);
}
readConversationFile(Common::String("CONVERSA.TRE"));
initializeScreenFile();
initializeObjectFile();
loadPalette("DEFAULT");
loadScreenData(1);
- screenTransition(13, false, sceneBackground);
+ sceneTransition(13, false, sceneBackground);
mask();
inventoryPosition = 0;
drawBackpack();
@@ -71,7 +71,7 @@ void newGame() {
}
}
-void sceneChange();
+void changeRoom();
int engine_start() {
if (ConfMan.hasKey("save_slot")) {
@@ -345,7 +345,7 @@ int startGame() {
}
} else if (mouseClickY > 166 && mouseClickY < 199) {
if (mouseClickX >= 3 && mouseClickX <= 19) {
- inventory(0, 33);
+ drawInventory(0, 33);
break;
} else if (mouseClickX >= 26 && mouseClickX <= 65) {
handleAction(inventoryPosition);
@@ -366,7 +366,7 @@ int startGame() {
handleAction(inventoryPosition + 5);
break;
} else if (mouseClickX >= 290 && mouseClickX <= 311) {
- inventory(1, 33);
+ drawInventory(1, 33);
break;
} else {
actionCode = 0;
@@ -416,7 +416,7 @@ int startGame() {
// Scene changes
if (xframe2 == 0 && roomChange) {
- sceneChange();
+ changeRoom();
}
if (escapePressed && xframe2 == 0) {
@@ -487,7 +487,7 @@ int startGame() {
g_engine->_sound->fadeOutMusic(musicVolLeft, musicVolRight);
g_engine->_sound->playMidi("SEGUNDA", true);
g_engine->_sound->fadeInMusic(musicVolLeft, musicVolRight);
- screenTransition(1, false, sceneBackground);
+ sceneTransition(1, false, sceneBackground);
mask();
inventoryPosition = 0;
drawBackpack();
@@ -531,8 +531,6 @@ int startGame() {
}
}
}
- // g_engine->_screen->markAllDirty();
- // g_engine->_screen->update();
}
g_engine->_screen->update();
@@ -554,7 +552,7 @@ int startGame() {
return EXIT_SUCCESS;
}
-void sceneChange() {
+void changeRoom() {
roomChange = false;
cpCounter = cpCounter2;
setRoomTrajectories(secondaryAnimHeight, secondaryAnimWidth, RESTORE);
@@ -575,7 +573,7 @@ void sceneChange() {
freeScreenObjects();
g_engine->_mouseManager->hide();
- screenTransition(transitionEffect, true, NULL);
+ sceneTransition(transitionEffect, true, NULL);
g_engine->_sound->stopVoc();
loadScreenData(currentRoomData->doors[doorIndex].nextScene);
if (cpCounter > 89)
@@ -585,7 +583,7 @@ void sceneChange() {
g_engine->_sound->autoPlayVoc("PARASITO", 355778, 20129);
else
loadTV();
- screenTransition(transitionEffect, false, sceneBackground);
+ sceneTransition(transitionEffect, false, sceneBackground);
cpCounter = cpCounter2;
g_engine->_mouseManager->show();
oldGridX = 0;
@@ -603,12 +601,12 @@ void sceneChange() {
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- screenTransition(transitionEffect, true, NULL);
+ sceneTransition(transitionEffect, true, NULL);
loadScreenData(currentRoomData->doors[doorIndex].nextScene);
g_engine->_sound->stopVoc();
g_engine->_sound->autoPlayVoc("CALDERA", 6433, 15386);
g_engine->_sound->setSfxVolume(leftSfxVol, 0);
- screenTransition(transitionEffect, false, sceneBackground);
+ sceneTransition(transitionEffect, false, sceneBackground);
g_engine->_mouseManager->show();
oldGridX = 0;
oldGridY = 0;
@@ -648,7 +646,7 @@ void sceneChange() {
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- screenTransition(transitionEffect, true, NULL);
+ sceneTransition(transitionEffect, true, NULL);
iframe = 0;
currentTrajectoryIndex = 0;
characterPosX = currentRoomData->doors[doorIndex].exitPosX - characterCorrectionX;
@@ -656,7 +654,7 @@ void sceneChange() {
trajectory[currentTrajectoryIndex].x = characterPosX;
trajectory[currentTrajectoryIndex].y = characterPosY;
loadScreenData(currentRoomData->doors[doorIndex].nextScene);
- screenTransition(transitionEffect, false, sceneBackground);
+ sceneTransition(transitionEffect, false, sceneBackground);
g_engine->_mouseManager->show();
oldGridX = 0;
@@ -675,9 +673,9 @@ void sceneChange() {
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- screenTransition(transitionEffect, true, NULL);
+ sceneTransition(transitionEffect, true, NULL);
loadScreenData(currentRoomData->doors[doorIndex].nextScene);
- screenTransition(transitionEffect, false, sceneBackground);
+ sceneTransition(transitionEffect, false, sceneBackground);
g_engine->_mouseManager->show();
oldGridX = 0;
oldGridY = 0;
@@ -736,9 +734,9 @@ void sceneChange() {
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- screenTransition(transitionEffect, true, NULL);
+ sceneTransition(transitionEffect, true, NULL);
loadScreenData(currentRoomData->doors[doorIndex].nextScene);
- screenTransition(transitionEffect, false, sceneBackground);
+ sceneTransition(transitionEffect, false, sceneBackground);
g_engine->_mouseManager->show();
oldGridX = 0;
oldGridY = 0;
@@ -768,7 +766,7 @@ void sceneChange() {
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- screenTransition(transitionEffect, true, NULL);
+ sceneTransition(transitionEffect, true, NULL);
g_engine->_sound->stopVoc();
loadScreenData(currentRoomData->doors[doorIndex].nextScene);
if (bookTopic[0] == true && currentRoomData->animationFlag == true)
@@ -776,7 +774,7 @@ void sceneChange() {
if (cpCounter > 89)
showError(274);
g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
- screenTransition(transitionEffect, false, sceneBackground);
+ sceneTransition(transitionEffect, false, sceneBackground);
cpCounter = cpCounter2;
g_engine->_mouseManager->show();
oldGridX = 0;
@@ -795,9 +793,9 @@ void sceneChange() {
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- screenTransition(transitionEffect, true, NULL);
+ sceneTransition(transitionEffect, true, NULL);
loadScreenData(currentRoomData->doors[doorIndex].nextScene);
- screenTransition(transitionEffect, false, sceneBackground);
+ sceneTransition(transitionEffect, false, sceneBackground);
g_engine->_mouseManager->show();
oldGridX = 0;
oldGridY = 0;
@@ -828,9 +826,9 @@ void sceneChange() {
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- screenTransition(transitionEffect, true, NULL);
+ sceneTransition(transitionEffect, true, NULL);
loadScreenData(currentRoomData->doors[doorIndex].nextScene);
- screenTransition(transitionEffect, false, sceneBackground);
+ sceneTransition(transitionEffect, false, sceneBackground);
g_engine->_mouseManager->show();
oldGridX = 0;
oldGridY = 0;
@@ -860,7 +858,7 @@ void sceneChange() {
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- screenTransition(transitionEffect, true, NULL);
+ sceneTransition(transitionEffect, true, NULL);
g_engine->_sound->stopVoc();
loadScreenData(currentRoomData->doors[doorIndex].nextScene);
switch (niche[0][niche[0][3]]) {
@@ -882,7 +880,7 @@ void sceneChange() {
g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
if (currentRoomData->code == 4)
g_engine->_sound->loadVoc("GOTA", 140972, 1029);
- screenTransition(transitionEffect, false, sceneBackground);
+ sceneTransition(transitionEffect, false, sceneBackground);
cpCounter = cpCounter2;
g_engine->_mouseManager->show();
oldGridX = 0;
@@ -900,7 +898,7 @@ void sceneChange() {
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- screenTransition(transitionEffect, true, NULL);
+ sceneTransition(transitionEffect, true, NULL);
g_engine->_sound->stopVoc();
loadScreenData(currentRoomData->doors[doorIndex].nextScene);
switch (niche[1][niche[1][3]]) {
@@ -945,7 +943,7 @@ void sceneChange() {
}
assembleScreen();
}
- screenTransition(transitionEffect, false, sceneBackground);
+ sceneTransition(transitionEffect, false, sceneBackground);
if ((isRedDevilCaptured == false) && (isTrapSet == false))
runaroundRed();
cpCounter = cpCounter2;
@@ -968,7 +966,7 @@ void sceneChange() {
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- screenTransition(transitionEffect, true, NULL);
+ sceneTransition(transitionEffect, true, NULL);
g_engine->_sound->stopVoc();
loadScreenData(currentRoomData->doors[doorIndex].nextScene);
if (cpCounter > 89)
@@ -982,7 +980,7 @@ void sceneChange() {
g_engine->_sound->autoPlayVoc("FUENTE", 0, 0);
break;
}
- screenTransition(transitionEffect, false, sceneBackground);
+ sceneTransition(transitionEffect, false, sceneBackground);
cpCounter = cpCounter2;
g_engine->_mouseManager->show();
oldGridX = 0;
diff --git a/engines/tot/graphics.cpp b/engines/tot/graphics.cpp
index f8f6b740df2..07a2ff0acff 100644
--- a/engines/tot/graphics.cpp
+++ b/engines/tot/graphics.cpp
@@ -74,7 +74,7 @@ void updateSceneAreaIfNeeded(int speed = 1) {
}
}
-void screenTransition(byte effectNumber, bool fadeToBlack, byte *scene) {
+void sceneTransition(byte effectNumber, bool fadeToBlack, byte *scene) {
int i1, i2, i3, j1, j2, j3;
bool enabled = false;
@@ -425,10 +425,8 @@ void screenTransition(byte effectNumber, bool fadeToBlack, byte *scene) {
byte *src1 = scene + 4 + (j2 * 320) + i2;
byte *src2 = scene + 4 + ((j2 + 1) * 320) + i2;
Common::copy(src1, src1 + 2, screenBuf + j2 * 320 + i2);
- // move(ptr(seg(pantalla2), (ofs(pantalla2) + 4 + (j2 * 320) + i2)), ptr(0xa000, ((j2 * 320) + i2)), 2);
Common::copy(src2, src2 + 2, screenBuf + (j2 + 1) * 320 + i2);
- // move(ptr(seg(pantalla2), (ofs(pantalla2) + 4 + ((j2 + 1) * 320) + i2)), ptr(0xa000, (((j2 + 1) * 320) + i2)), 2);
i2 = Random(320);
j2 = Random(140);
@@ -436,7 +434,6 @@ void screenTransition(byte effectNumber, bool fadeToBlack, byte *scene) {
Common::copy(src3, src3 + 1, screenBuf + (j2 * 320) + i2);
updateSceneAreaIfNeeded();
- // move(ptr(seg(pantalla2), (ofs(pantalla2) + 4 + (j2 * 320) + i2)), ptr(0xa000, ((j2 * 320) + i2)), 1);
}
drawScreen(scene);
} break;
@@ -529,7 +526,6 @@ void turnLightOn() {
intermediate[3 * i + 0] = pal[3 * i + 0];
intermediate[3 * i + 1] = pal[3 * i + 1];
intermediate[3 * i + 2] = pal[3 * i + 2];
- // }
} else {
intermediate[3 * i + 0] = intermediate[3 * i + 0] << 2;
intermediate[3 * i + 1] = intermediate[3 * i + 1] << 2;
diff --git a/engines/tot/graphics.h b/engines/tot/graphics.h
index ee825122d55..5a7a61b71ff 100644
--- a/engines/tot/graphics.h
+++ b/engines/tot/graphics.h
@@ -32,7 +32,7 @@ void copyFromScreen(byte *&screen);
void drawScreen(byte *screen, bool offsetSize = true);
void loadPalette(Common::String image);
-void screenTransition(byte effectNumber, bool fadeToBlack, byte *screen);
+void sceneTransition(byte effectNumber, bool fadeToBlack, byte *screen);
void turnLightOn();
void totalFadeOut(byte red);
void partialFadeOut(byte numCol);
diff --git a/engines/tot/graphman.cpp b/engines/tot/graphman.cpp
index e7f8bf97a99..889b76ed30c 100644
--- a/engines/tot/graphman.cpp
+++ b/engines/tot/graphman.cpp
@@ -189,10 +189,9 @@ void GraphicsManager::putImageArea(uint putcoordx, uint putcoordy, byte *backgro
for (int i = 0; i < h; i++) {
for (int j = 0; j < w; j++) {
- // if(destPtr > 0)
backgroundScreen[posAbs + sourcePtr++] = *destPtr++;
}
- sourcePtr += (320 - w); // Move to the beginning of the next row in PantFondo
+ sourcePtr += (320 - w); // Move to the beginning of the next row in backgroundScreen
}
}
@@ -213,7 +212,6 @@ void GraphicsManager::printPalette() {
}
}
}
- // updateScreen();
}
void GraphicsManager::printColor(int x, int y, int color) {
diff --git a/engines/tot/mouse.cpp b/engines/tot/mouse.cpp
index bb10fc72610..bc840dccb22 100644
--- a/engines/tot/mouse.cpp
+++ b/engines/tot/mouse.cpp
@@ -42,7 +42,7 @@ void MouseManager::drawMask(int idx) {
}
void MouseManager::animateMouseIfNeeded() {
- if (timeToDraw) {
+ if (gameTick) {
setMouseMask(_currentMouseMask);
if (_currentMouseMask < 7) {
// sync this with frame time
@@ -93,7 +93,6 @@ void MouseManager::loadMasks() {
for (int i = 0; i < numMouseMasks; i++) {
_mouseMasks[i].width = mouseMaskFile.readUint16LE();
_mouseMasks[i].height = mouseMaskFile.readUint16LE();
- // mouseMaskFile.readUint16LE();
_mouseMasks[i].mask = (byte *)malloc(mouseMaskSize - 4);
mouseMaskFile.read(_mouseMasks[i].mask, mouseMaskSize - 4);
}
diff --git a/engines/tot/routines.cpp b/engines/tot/routines.cpp
index 24a137f1572..70a58ce907b 100644
--- a/engines/tot/routines.cpp
+++ b/engines/tot/routines.cpp
@@ -40,16 +40,16 @@ void displayLoading() {
setRGBPalette(255, 63, 63, 63);
littText(121, 72, msg, 0);
g_engine->_screen->update();
- delay(enforcedTextAnimDelay);
+ delay(kEnforcedTextAnimDelay);
littText(120, 71, msg, 0);
g_engine->_screen->update();
- delay(enforcedTextAnimDelay);
+ delay(kEnforcedTextAnimDelay);
littText(119, 72, msg, 0);
g_engine->_screen->update();
- delay(enforcedTextAnimDelay);
+ delay(kEnforcedTextAnimDelay);
littText(120, 73, msg, 0);
g_engine->_screen->update();
- delay(enforcedTextAnimDelay);
+ delay(kEnforcedTextAnimDelay);
littText(120, 72, msg, 255);
g_engine->_screen->update();
@@ -83,7 +83,7 @@ void runaroundRed() {
isSecondaryAnimationEnabled = true;
do {
g_engine->_chrono->updateChrono();
- if (timeToDraw) {
+ if (gameTick) {
if (secTrajIndex == secTrajLength)
exitLoop = true;
secTrajIndex += 1;
@@ -107,9 +107,9 @@ void runaroundRed() {
secondaryAnimation.depth = 3;
}
- timeToDraw2 = true;
+ gameTickHalfSpeed = true;
sprites(false);
- timeToDraw = false;
+ gameTick = false;
if (palAnimStep >= 4) {
palAnimStep = 0;
if (isPaletteAnimEnabled > 6)
@@ -267,7 +267,7 @@ void drawMainCharacter() {
bool debug = false;
if (debug) {
- screenTransition(13, false, sceneBackground);
+ sceneTransition(13, false, sceneBackground);
}
uint16 tempW;
@@ -311,7 +311,7 @@ void sprites(bool drawMainCharachter) {
if (currentRoomData->secondaryTrajectoryLength > 1) {
updateMovementGrids();
}
- if (timeToDraw2) {
+ if (gameTickHalfSpeed) {
if (isPeterCoughing && !g_engine->_sound->isVocPlaying()) {
iframe2 = 0;
}
@@ -358,7 +358,7 @@ void sprites(bool drawMainCharachter) {
WRITE_LE_UINT16(characterDirtyRect, patchW);
WRITE_LE_UINT16(characterDirtyRect + 2, patchH);
- assembleBackground(); // {Montar el Sprite Total}
+ assembleBackground();
curDepth = 0;
while (curDepth != depthLevelCount) {
overlayLayers();
@@ -418,7 +418,7 @@ void adjustKey() {
iframe++;
currentTrajectoryIndex += 1;
emptyLoop();
- timeToDraw = false;
+ gameTick = false;
if (palAnimStep >= 4) {
palAnimStep = 0;
if (isPaletteAnimEnabled > 6)
@@ -432,7 +432,7 @@ void adjustKey() {
} while (currentTrajectoryIndex != trajectoryLength);
charFacingDirection = 3;
emptyLoop();
- timeToDraw = false;
+ gameTick = false;
sprites(true);
}
@@ -446,7 +446,7 @@ void adjustKey2() {
iframe++;
currentTrajectoryIndex -= 1;
emptyLoop();
- timeToDraw = false;
+ gameTick = false;
if (palAnimStep >= 4) {
palAnimStep = 0;
if (isPaletteAnimEnabled > 6)
@@ -459,7 +459,7 @@ void adjustKey2() {
sprites(true);
} while (currentTrajectoryIndex != 0);
emptyLoop();
- timeToDraw = false;
+ gameTick = false;
sprites(true);
}
@@ -490,8 +490,8 @@ void animatedSequence(uint numSequence) {
animIndex = 0;
do {
emptyLoop();
- timeToDraw = false;
- if (timeToDraw2) {
+ gameTick = false;
+ if (gameTickHalfSpeed) {
if (currentSecondaryTrajectoryIndex >= currentRoomData->secondaryTrajectoryLength)
currentSecondaryTrajectoryIndex = 1;
else
@@ -533,8 +533,8 @@ void animatedSequence(uint numSequence) {
animIndex = 0;
do {
emptyLoop();
- timeToDraw = false;
- if (timeToDraw2) {
+ gameTick = false;
+ if (gameTickHalfSpeed) {
if (currentSecondaryTrajectoryIndex >= currentRoomData->secondaryTrajectoryLength)
currentSecondaryTrajectoryIndex = 1;
else
@@ -575,8 +575,8 @@ void animatedSequence(uint numSequence) {
animIndex = 0;
do {
emptyLoop();
- timeToDraw = false;
- if (timeToDraw2) {
+ gameTick = false;
+ if (gameTickHalfSpeed) {
if (currentSecondaryTrajectoryIndex >= currentRoomData->secondaryTrajectoryLength)
currentSecondaryTrajectoryIndex = 1;
else
@@ -599,7 +599,7 @@ void animatedSequence(uint numSequence) {
iframe = 0;
charFacingDirection = 2;
emptyLoop();
- timeToDraw = false;
+ gameTick = false;
characterPosX = tmpCharacterPosX;
sprites(true);
} break;
@@ -619,7 +619,7 @@ void animatedSequence(uint numSequence) {
for (animIndex = 1; animIndex <= 31; animIndex++) {
animationFile.read(animptr, animFrameSize);
emptyLoop();
- timeToDraw = false;
+ gameTick = false;
if (palAnimStep >= 4) {
palAnimStep = 0;
if (isPaletteAnimEnabled > 6)
@@ -646,7 +646,7 @@ void animatedSequence(uint numSequence) {
for (animIndex = 32; animIndex <= secFrameCount; animIndex++) {
animationFile.read(animptr, animFrameSize);
emptyLoop();
- timeToDraw = false;
+ gameTick = false;
if (palAnimStep >= 4) {
palAnimStep = 0;
if (isPaletteAnimEnabled > 6)
@@ -678,7 +678,7 @@ void animatedSequence(uint numSequence) {
for (animIndex = 1; animIndex <= 8; animIndex++) {
animationFile.read(animptr, animFrameSize);
emptyLoop();
- timeToDraw = false;
+ gameTick = false;
g_engine->_graphics->putShape(animX, animY, animptr);
if (g_engine->shouldQuit()) {
break;
@@ -696,9 +696,9 @@ void animatedSequence(uint numSequence) {
for (animIndex = 9; animIndex <= secFrameCount; animIndex++) {
animationFile.read(animptr, animFrameSize);
emptyLoop();
- timeToDraw = false;
+ gameTick = false;
emptyLoop();
- timeToDraw = false;
+ gameTick = false;
g_engine->_graphics->putShape(animX, animY, animptr);
if (g_engine->shouldQuit()) {
break;
@@ -709,7 +709,7 @@ void animatedSequence(uint numSequence) {
iframe = 0;
charFacingDirection = 2;
emptyLoop();
- timeToDraw = false;
+ gameTick = false;
sprites(true);
} break;
case 6: {
@@ -726,7 +726,7 @@ void animatedSequence(uint numSequence) {
animIndex = 0;
do {
emptyLoop();
- timeToDraw = false;
+ gameTick = false;
if (palAnimStep >= 4) {
palAnimStep = 0;
if (isPaletteAnimEnabled > 6)
@@ -736,7 +736,7 @@ void animatedSequence(uint numSequence) {
updatePalette(isPaletteAnimEnabled);
} else
palAnimStep += 1;
- if (timeToDraw2) {
+ if (gameTickHalfSpeed) {
animationFile.read(screenLayers[6], animFrameSize);
Common::copy(screenLayers[6], screenLayers[6] + animFrameSize, sceneBackground + 44900);
restoreBackground();
@@ -800,7 +800,6 @@ RoomFileRegister *readScreenDataFile(Common::SeekableReadStream *screenDataFile)
screenData->roomImageSize = screenDataFile->readUint16LE();
screenDataFile->read(screenData->walkAreasGrid, 40 * 28);
screenDataFile->read(screenData->mouseGrid, 40 * 28);
- // read puntos
for (int i = 0; i < 9; i++) {
for (int j = 0; j < 30; j++) {
for (int k = 0; k < 5; k++) {
@@ -933,7 +932,6 @@ void calculateTrajectory(uint finalX, uint finalY) {
trajectory[trajectoryLength + 1].x = finalX;
trajectory[trajectoryLength + 1].y = finalY;
- // longtray--; // decrement because of 1-starting arrays
}
void lookAtObject(byte objectCode) {
@@ -947,7 +945,7 @@ void lookAtObject(byte objectCode) {
cpCounter2 = cpCounter;
g_engine->_mouseManager->hide();
copyPalette(pal, secPalette);
- readItemRegister(mobj[objectCode].code);
+ readItemRegister(inventory[objectCode].code);
g_engine->_graphics->getImg(0, 0, 319, 139, sceneBackground);
partialFadeOut(234);
bar(0, 0, 319, 139, 0);
@@ -976,7 +974,7 @@ void lookAtObject(byte objectCode) {
hyperText(description, 60, 15, 33, 255, 0);
verb.close();
} else {
- description = mobj[objectCode].objectName;
+ description = inventory[objectCode].objectName;
hyperText(description, 60, 15, 33, 255, 0);
}
} else {
@@ -990,14 +988,14 @@ void lookAtObject(byte objectCode) {
hyperText(description, 60, 15, 33, 255, 0);
verb.close();
} else {
- description = mobj[objectCode].objectName;
+ description = inventory[objectCode].objectName;
hyperText(description, 60, 15, 33, 255, 0);
}
}
drawFlc(125, 70, regobj.rotatingObjectAnimation, 60000, 9, 0, false, true, true, foobar);
- screenTransition(3, true, NULL);
+ sceneTransition(3, true, NULL);
partialFadeOut(234);
assembleScreen();
drawScreen(sceneBackground);
@@ -1018,13 +1016,13 @@ void useInventoryObjectWithInventoryObject(uint objectCode1, uint objectCode2) {
}
invIndex = 0;
- while (mobj[invIndex].code != objectCode1) {
+ while (inventory[invIndex].code != objectCode1) {
invIndex += 1;
}
indobj1 = invIndex;
invIndex = 0;
- while (mobj[invIndex].code != objectCode2) {
+ while (inventory[invIndex].code != objectCode2) {
invIndex += 1;
}
@@ -1042,13 +1040,13 @@ void useInventoryObjectWithInventoryObject(uint objectCode1, uint objectCode2) {
} else {
readItemRegister(invItemData, regobj.replaceWith, regobj);
- mobj[indobj1].bitmapIndex = regobj.objectIconBitmap;
- mobj[indobj1].code = regobj.code;
- mobj[indobj1].objectName = regobj.name;
+ inventory[indobj1].bitmapIndex = regobj.objectIconBitmap;
+ inventory[indobj1].code = regobj.code;
+ inventory[indobj1].objectName = regobj.name;
for (indobj1 = indobj2; indobj1 < (inventoryIconCount - 1); indobj1++) {
- mobj[indobj1].bitmapIndex = mobj[indobj1 + 1].bitmapIndex;
- mobj[indobj1].code = mobj[indobj1 + 1].code;
- mobj[indobj1].objectName = mobj[indobj1 + 1].objectName;
+ inventory[indobj1].bitmapIndex = inventory[indobj1 + 1].bitmapIndex;
+ inventory[indobj1].code = inventory[indobj1 + 1].code;
+ inventory[indobj1].objectName = inventory[indobj1 + 1].objectName;
}
g_engine->_mouseManager->hide();
drawBackpack();
@@ -1223,9 +1221,9 @@ void updateMainCharacterDepth() {
}
void advanceAnimations(bool barredZone, bool animateMouse) {
- if (timeToDraw) {
+ if (gameTick) {
- if (currentRoomData->animationFlag && timeToDraw2) {
+ if (currentRoomData->animationFlag && gameTickHalfSpeed) {
if (isPeterCoughing && (Random(100) == 1) && !g_engine->_sound->isVocPlaying() && mintTopic[0] == false) {
debug("Playing tos");
g_engine->_sound->playVoc("TOS", 258006, 14044);
@@ -1328,7 +1326,7 @@ void advanceAnimations(bool barredZone, bool animateMouse) {
if (isDrawingEnabled) {
sprites(true);
}
- timeToDraw = false;
+ gameTick = false;
if (currentRoomData->paletteAnimationFlag && palAnimStep >= 4) {
palAnimStep = 0;
if (isPaletteAnimEnabled > 6)
@@ -1352,7 +1350,7 @@ void animateGive(uint dir, uint height) {
charFacingDirection = dir;
for (uint i = 0; i < 5; i++) {
emptyLoop();
- timeToDraw = false;
+ gameTick = false;
// Must add 1 to i because the original game uses 1-based indices
iframe = 15 + 6 + 5 + height * 10 - (i + 1);
@@ -1375,7 +1373,7 @@ void animatePickup1(uint dir, uint height) {
charFacingDirection = dir;
for (uint i = 0; i < 5; i++) {
emptyLoop();
- timeToDraw = false;
+ gameTick = false;
iframe = 15 + height * 10 + (i + 1);
if (currentRoomData->paletteAnimationFlag && palAnimStep >= 4) {
@@ -1398,7 +1396,7 @@ void animatePickup2(uint dir, uint height) {
for (uint i = 0; i < 5; i++) {
emptyLoop();
- timeToDraw = false;
+ gameTick = false;
iframe = 15 + 5 + height * 10 + (i + 1);
@@ -1415,7 +1413,7 @@ void animatePickup2(uint dir, uint height) {
g_engine->_screen->update();
}
emptyLoop();
- timeToDraw = false;
+ gameTick = false;
sprites(true);
iframe = 0;
}
@@ -1425,7 +1423,7 @@ void animateOpen2(uint dir, uint height) {
cpCounter = cpCounter2;
for (uint i = 0; i < 5; i++) {
emptyLoop();
- timeToDraw = false;
+ gameTick = false;
iframe = 15 + 6 + height * 10 - (i + 1);
if (currentRoomData->paletteAnimationFlag && palAnimStep >= 4) {
@@ -1440,7 +1438,7 @@ void animateOpen2(uint dir, uint height) {
sprites(true);
}
emptyLoop();
- timeToDraw = false;
+ gameTick = false;
sprites(true);
iframe = 0;
}
@@ -1484,7 +1482,7 @@ void animateBat() {
secondaryAnimation.depth = 14;
do {
g_engine->_chrono->updateChrono();
- if (timeToDraw) {
+ if (gameTick) {
if (curAnimIdx == curAnimLength)
loopBreak = true;
curAnimIdx += 1;
@@ -1497,7 +1495,7 @@ void animateBat() {
secondaryAnimation.posy = trajectory[curAnimIdx][1];
secondaryAnimation.dir = 0;
sprites(true);
- timeToDraw = false;
+ gameTick = false;
if (curAnimIdx % 24 == 0)
g_engine->_sound->playVoc();
if (palAnimStep >= 4) {
@@ -1966,10 +1964,10 @@ void pickupScreenObject() {
g_engine->_mouseManager->show();
if (regobj.code != 624)
- for (int j = regobj.yrej1; j <= regobj.yrej2; j++)
- for (int i = regobj.xrej1; i <= regobj.xrej2; i++) {
- currentRoomData->walkAreasGrid[i][j] = regobj.walkAreasPatch[i - regobj.xrej1][j - regobj.yrej1];
- currentRoomData->mouseGrid[i][j] = regobj.mouseGridPatch[i - regobj.xrej1][j - regobj.yrej1];
+ for (int j = regobj.ygrid1; j <= regobj.ygrid2; j++)
+ for (int i = regobj.xgrid1; i <= regobj.xgrid2; i++) {
+ currentRoomData->walkAreasGrid[i][j] = regobj.walkAreasPatch[i - regobj.xgrid1][j - regobj.ygrid1];
+ currentRoomData->mouseGrid[i][j] = regobj.mouseGridPatch[i - regobj.xgrid1][j - regobj.ygrid1];
}
switch (regobj.code) {
case 216: { // chisel
@@ -2039,13 +2037,13 @@ void pickupScreenObject() {
}
inventoryIndex = 0;
- while (mobj[inventoryIndex].code != 0) {
+ while (inventory[inventoryIndex].code != 0) {
inventoryIndex += 1;
}
- mobj[inventoryIndex].bitmapIndex = regobj.objectIconBitmap;
- mobj[inventoryIndex].code = regobj.code;
- mobj[inventoryIndex].objectName = regobj.name;
+ inventory[inventoryIndex].bitmapIndex = regobj.objectIconBitmap;
+ inventory[inventoryIndex].code = regobj.code;
+ inventory[inventoryIndex].objectName = regobj.name;
g_engine->_mouseManager->hide();
drawBackpack();
g_engine->_mouseManager->show();
@@ -2059,9 +2057,9 @@ void pickupScreenObject() {
void replaceBackpack(byte obj1, uint obj2) {
readItemRegister(obj2);
- mobj[obj1].bitmapIndex = regobj.objectIconBitmap;
- mobj[obj1].code = obj2;
- mobj[obj1].objectName = regobj.name;
+ inventory[obj1].bitmapIndex = regobj.objectIconBitmap;
+ inventory[obj1].code = obj2;
+ inventory[obj1].objectName = regobj.name;
cpCounter = cpCounter2;
}
@@ -2084,10 +2082,10 @@ void dropObjectInScreen(ScreenObject replacementObject) {
with.depth = replacementObject.depth;
loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
- for (int j = replacementObject.yrej1; j <= replacementObject.yrej2; j++)
- for (int i = replacementObject.xrej1; i <= replacementObject.xrej2; i++) {
- currentRoomData->walkAreasGrid[i][j] = replacementObject.walkAreasPatch[i - replacementObject.xrej1][j - replacementObject.yrej1];
- currentRoomData->mouseGrid[i][j] = replacementObject.mouseGridPatch[i - replacementObject.xrej1][j - replacementObject.yrej1];
+ for (int j = replacementObject.ygrid1; j <= replacementObject.ygrid2; j++)
+ for (int i = replacementObject.xgrid1; i <= replacementObject.xgrid2; i++) {
+ currentRoomData->walkAreasGrid[i][j] = replacementObject.walkAreasPatch[i - replacementObject.xgrid1][j - replacementObject.ygrid1];
+ currentRoomData->mouseGrid[i][j] = replacementObject.mouseGridPatch[i - replacementObject.xgrid1][j - replacementObject.ygrid1];
}
} else
showError(264);
@@ -2105,11 +2103,11 @@ void useScreenObject() {
if (inventoryObjectName != "") { //Use inv object with something on the scene
usedObjectIndex = 0;
- while (mobj[usedObjectIndex].objectName != inventoryObjectName) {
+ while (inventory[usedObjectIndex].objectName != inventoryObjectName) {
usedObjectIndex += 1;
}
- readItemRegister(mobj[usedObjectIndex].code);
+ readItemRegister(inventory[usedObjectIndex].code);
goToObject(
currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount],
@@ -2140,7 +2138,7 @@ void useScreenObject() {
secondaryAnimation.posx = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].x;
secondaryAnimation.posy = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].y;
emptyLoop();
- timeToDraw = false;
+ gameTick = false;
emptyLoop2();
sprites(true);
g_engine->_screen->update();
@@ -2185,10 +2183,10 @@ void useScreenObject() {
} break;
case 157: { // giving something to john
verifyList = false;
- debug("used object = %d", mobj[usedObjectIndex].code);
+ debug("used object = %d", inventory[usedObjectIndex].code);
if (obtainedList1) {
for (listIndex = 0; listIndex < 5; listIndex++) {
- if (mobj[usedObjectIndex].code == firstList[listIndex])
+ if (inventory[usedObjectIndex].code == firstList[listIndex])
verifyList = true;
}
@@ -2196,7 +2194,7 @@ void useScreenObject() {
int completedListItems = 0;
for (listIndex = 0; listIndex < 5; listIndex++) {
for (invIndex = 0; invIndex < inventoryIconCount; invIndex++) {
- if (mobj[invIndex].code == firstList[listIndex]) {
+ if (inventory[invIndex].code == firstList[listIndex]) {
completedListItems += 1;
break;
}
@@ -2215,13 +2213,13 @@ void useScreenObject() {
animateOpen2(charFacingDirection, 1);
for (listIndex = 0; listIndex < 5; listIndex++) {
invIndex = 0;
- while (mobj[invIndex].code != firstList[listIndex]) {
+ while (inventory[invIndex].code != firstList[listIndex]) {
invIndex += 1;
}
updateInventory(invIndex);
}
listIndex = 0;
- while (mobj[listIndex].code != 149) {
+ while (inventory[listIndex].code != 149) {
listIndex += 1;
}
updateInventory(listIndex);
@@ -2242,13 +2240,13 @@ void useScreenObject() {
verifyList = false;
if (obtainedList2) {
for (listIndex = 0; listIndex < 5; listIndex++)
- if (mobj[usedObjectIndex].code == secondList[listIndex])
+ if (inventory[usedObjectIndex].code == secondList[listIndex])
verifyList = true;
if (verifyList) {
int completedListItems = 0;
for (listIndex = 0; listIndex < 5; listIndex++) {
for (invIndex = 0; invIndex <= inventoryIconCount; invIndex++) {
- if (mobj[invIndex].code == secondList[listIndex]) {
+ if (inventory[invIndex].code == secondList[listIndex]) {
completedListItems += 1;
break;
}
@@ -2266,13 +2264,13 @@ void useScreenObject() {
animateOpen2(charFacingDirection, 1);
for (listIndex = 0; listIndex < 5; listIndex++) {
invIndex = 0;
- while (mobj[invIndex].code != secondList[listIndex]) {
+ while (inventory[invIndex].code != secondList[listIndex]) {
invIndex += 1;
}
updateInventory(invIndex);
}
listIndex = 0;
- while (mobj[listIndex].code != 150) {
+ while (inventory[listIndex].code != 150) {
listIndex += 1;
}
updateInventory(listIndex);
@@ -2540,7 +2538,7 @@ void useScreenObject() {
secondaryAnimation.posx = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].x;
secondaryAnimation.posy = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].y;
emptyLoop();
- timeToDraw = false;
+ gameTick = false;
emptyLoop2();
sprites(true);
} while (!(currentSecondaryTrajectoryIndex == (currentRoomData->secondaryTrajectoryLength / 2)));
@@ -2564,7 +2562,7 @@ void useScreenObject() {
secondaryAnimation.posx = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].x;
secondaryAnimation.posy = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].y;
emptyLoop();
- timeToDraw = false;
+ gameTick = false;
emptyLoop2();
sprites(true);
@@ -2593,7 +2591,7 @@ void useScreenObject() {
animateGive(3, 2);
do {
g_engine->_chrono->updateChrono();
- if (timeToDraw) {
+ if (gameTick) {
if (palAnimStep >= 4) {
palAnimStep = 0;
if (isPaletteAnimEnabled > 6)
@@ -2603,7 +2601,7 @@ void useScreenObject() {
updatePalette(isPaletteAnimEnabled);
} else
palAnimStep += 1;
- timeToDraw = false;
+ gameTick = false;
}
g_engine->_screen->update();
g_system->delayMillis(10);
@@ -2633,12 +2631,12 @@ void useScreenObject() {
currentRoomData->screenLayers[i].depth = 0;
}
usedObjectIndex = 0;
- while (mobj[usedObjectIndex].code != 0) {
+ while (inventory[usedObjectIndex].code != 0) {
usedObjectIndex += 1;
}
- mobj[usedObjectIndex].bitmapIndex = regobj.objectIconBitmap;
- mobj[usedObjectIndex].code = regobj.code;
- mobj[usedObjectIndex].objectName = regobj.name;
+ inventory[usedObjectIndex].bitmapIndex = regobj.objectIconBitmap;
+ inventory[usedObjectIndex].code = regobj.code;
+ inventory[usedObjectIndex].objectName = regobj.name;
animatedSequence(4);
g_engine->_mouseManager->show();
actionCode = 0;
@@ -2650,7 +2648,7 @@ void useScreenObject() {
drawText(regobj.useTextRef);
regobj.used[0] = 9;
usedObjectIndex = 0;
- while (mobj[usedObjectIndex].code != 0) {
+ while (inventory[usedObjectIndex].code != 0) {
usedObjectIndex += 1;
}
@@ -2658,9 +2656,9 @@ void useScreenObject() {
saveItem(regobj, invItemData);
readItemRegister(invItemData, 221, regobj);
- mobj[usedObjectIndex].bitmapIndex = regobj.objectIconBitmap;
- mobj[usedObjectIndex].code = regobj.code;
- mobj[usedObjectIndex].objectName = regobj.name;
+ inventory[usedObjectIndex].bitmapIndex = regobj.objectIconBitmap;
+ inventory[usedObjectIndex].code = regobj.code;
+ inventory[usedObjectIndex].objectName = regobj.name;
g_engine->_mouseManager->hide();
animatePickup1(2, 0);
@@ -2680,7 +2678,7 @@ void useScreenObject() {
replaceBackpack(usedObjectIndex, 453);
drawBackpack();
g_engine->_mouseManager->show();
- updateItem(mobj[usedObjectIndex].code);
+ updateItem(inventory[usedObjectIndex].code);
isCupboardOpen = true;
} break;
case 274: {
@@ -3332,12 +3330,12 @@ void useScreenObject() {
updateItem(regobj.code);
readItemRegister(152);
usedObjectIndex = 0;
- while (mobj[usedObjectIndex].code != 0) {
+ while (inventory[usedObjectIndex].code != 0) {
usedObjectIndex += 1;
}
- mobj[usedObjectIndex].bitmapIndex = regobj.objectIconBitmap;
- mobj[usedObjectIndex].code = regobj.code;
- mobj[usedObjectIndex].objectName = regobj.name;
+ inventory[usedObjectIndex].bitmapIndex = regobj.objectIconBitmap;
+ inventory[usedObjectIndex].code = regobj.code;
+ inventory[usedObjectIndex].objectName = regobj.name;
g_engine->_mouseManager->hide();
drawBackpack();
g_engine->_mouseManager->show();
@@ -3579,10 +3577,10 @@ void openScreenObject() {
} break;
}
g_engine->_mouseManager->show();
- for (yIndex = regobj.yrej1; yIndex <= regobj.yrej2; yIndex++)
- for (xIndex = regobj.xrej1; xIndex <= regobj.xrej2; xIndex++) {
- currentRoomData->walkAreasGrid[xIndex][yIndex] = regobj.walkAreasPatch[xIndex - regobj.xrej1][yIndex - regobj.yrej1];
- currentRoomData->mouseGrid[xIndex][yIndex] = regobj.mouseGridPatch[xIndex - regobj.xrej1][yIndex - regobj.yrej1];
+ for (yIndex = regobj.ygrid1; yIndex <= regobj.ygrid2; yIndex++)
+ for (xIndex = regobj.xgrid1; xIndex <= regobj.xgrid2; xIndex++) {
+ currentRoomData->walkAreasGrid[xIndex][yIndex] = regobj.walkAreasPatch[xIndex - regobj.xgrid1][yIndex - regobj.ygrid1];
+ currentRoomData->mouseGrid[xIndex][yIndex] = regobj.mouseGridPatch[xIndex - regobj.xgrid1][yIndex - regobj.ygrid1];
}
for (xIndex = 0; xIndex < 15; xIndex++)
if (currentRoomData->screenLayers[xIndex].bitmapPointer == regobj.bitmapPointer) {
@@ -3651,10 +3649,10 @@ void closeScreenObject() {
} break;
}
g_engine->_mouseManager->show();
- for (yIndex = regobj.yrej1; yIndex <= regobj.yrej2; yIndex++)
- for (xIndex = regobj.xrej1; xIndex <= regobj.xrej2; xIndex++) {
- currentRoomData->walkAreasGrid[xIndex][yIndex] = regobj.walkAreasPatch[xIndex - regobj.xrej1][yIndex - regobj.yrej1];
- currentRoomData->mouseGrid[xIndex][yIndex] = regobj.mouseGridPatch[xIndex - regobj.xrej1][yIndex - regobj.yrej1];
+ for (yIndex = regobj.ygrid1; yIndex <= regobj.ygrid2; yIndex++)
+ for (xIndex = regobj.xgrid1; xIndex <= regobj.xgrid2; xIndex++) {
+ currentRoomData->walkAreasGrid[xIndex][yIndex] = regobj.walkAreasPatch[xIndex - regobj.xgrid1][yIndex - regobj.ygrid1];
+ currentRoomData->mouseGrid[xIndex][yIndex] = regobj.mouseGridPatch[xIndex - regobj.xgrid1][yIndex - regobj.ygrid1];
}
for (xIndex = 0; xIndex < 15; xIndex++)
if (currentRoomData->screenLayers[xIndex].bitmapPointer == regobj.bitmapPointer) {
@@ -3704,7 +3702,7 @@ void handleAction(byte posinv) {
switch (actionCode) {
case 1: {
g_engine->_mouseManager->hide();
- actionLineText(getActionLineText(1) + mobj[posinv].objectName);
+ actionLineText(getActionLineText(1) + inventory[posinv].objectName);
g_engine->_mouseManager->show();
drawText((Random(10) + 1039));
actionCode = 0;
@@ -3716,7 +3714,7 @@ void handleAction(byte posinv) {
} break;
case 2: {
g_engine->_mouseManager->hide();
- actionLineText(getActionLineText(2) + mobj[posinv].objectName);
+ actionLineText(getActionLineText(2) + inventory[posinv].objectName);
if (cpCounter2 > 13)
showError(274);
g_engine->_mouseManager->show();
@@ -3728,7 +3726,7 @@ void handleAction(byte posinv) {
} break;
case 3: {
g_engine->_mouseManager->hide();
- actionLineText(getActionLineText(3) + mobj[posinv].objectName);
+ actionLineText(getActionLineText(3) + inventory[posinv].objectName);
g_engine->_mouseManager->show();
actionCode = 0;
lookAtObject(posinv);
@@ -3739,16 +3737,16 @@ void handleAction(byte posinv) {
case 4:
if (inventoryObjectName == "") {
g_engine->_mouseManager->hide();
- actionLineText(getActionLineText(4) + mobj[posinv].objectName + getActionLineText(7));
+ actionLineText(getActionLineText(4) + inventory[posinv].objectName + getActionLineText(7));
g_engine->_mouseManager->show();
- inventoryObjectName = mobj[posinv].objectName;
- backpackObjectCode = mobj[posinv].code;
+ inventoryObjectName = inventory[posinv].objectName;
+ backpackObjectCode = inventory[posinv].code;
} else {
actionCode = 0;
if (cpCounter > 25)
showError(274);
- useInventoryObjectWithInventoryObject(backpackObjectCode, mobj[posinv].code);
+ useInventoryObjectWithInventoryObject(backpackObjectCode, inventory[posinv].code);
oldGridX = 0;
oldGridY = 0;
checkMouseGrid();
@@ -3756,7 +3754,7 @@ void handleAction(byte posinv) {
break;
case 5: {
g_engine->_mouseManager->hide();
- actionLineText(getActionLineText(5) + mobj[posinv].objectName);
+ actionLineText(getActionLineText(5) + inventory[posinv].objectName);
g_engine->_mouseManager->show();
drawText(Random(9) + 1059);
actionCode = 0;
@@ -3766,7 +3764,7 @@ void handleAction(byte posinv) {
} break;
case 6: {
g_engine->_mouseManager->hide();
- actionLineText(getActionLineText(6) + mobj[posinv].objectName);
+ actionLineText(getActionLineText(6) + inventory[posinv].objectName);
g_engine->_mouseManager->show();
drawText(Random(10) + 1068);
actionCode = 0;
@@ -3801,9 +3799,9 @@ void loadObjects() {
showError(274);
const char *emptyName = (g_engine->_lang == Common::ES_ESP) ? hardcodedObjects_ES[10] : hardcodedObjects_EN[10];
for (int i = 0; i < inventoryIconCount; i++) {
- mobj[i].bitmapIndex = 34;
- mobj[i].code = 0;
- mobj[i].objectName = emptyName;
+ inventory[i].bitmapIndex = 34;
+ inventory[i].code = 0;
+ inventory[i].objectName = emptyName;
}
objectFile.close();
@@ -4069,9 +4067,9 @@ void saveGameToRegister() {
savedGame.isTrapSet = isTrapSet;
for (int i = 0; i < inventoryIconCount; i++) {
- savedGame.mobj[i].bitmapIndex = mobj[i].bitmapIndex;
- savedGame.mobj[i].code = mobj[i].code;
- savedGame.mobj[i].objectName = mobj[i].objectName;
+ savedGame.mobj[i].bitmapIndex = inventory[i].bitmapIndex;
+ savedGame.mobj[i].code = inventory[i].code;
+ savedGame.mobj[i].objectName = inventory[i].objectName;
}
savedGame.element1 = element1;
@@ -4169,9 +4167,9 @@ void loadGame(SavedGame game) {
isTVOn = game.isTVOn;
isTrapSet = game.isTrapSet;
for (int i = 0; i < inventoryIconCount; i++) {
- mobj[i].bitmapIndex = game.mobj[i].bitmapIndex;
- mobj[i].code = game.mobj[i].code;
- mobj[i].objectName = game.mobj[i].objectName;
+ inventory[i].bitmapIndex = game.mobj[i].bitmapIndex;
+ inventory[i].code = game.mobj[i].code;
+ inventory[i].objectName = game.mobj[i].objectName;
}
element1 = game.element1;
element2 = game.element2;
@@ -4303,7 +4301,7 @@ void loadGame(SavedGame game) {
drawBackpack();
if (isRedDevilCaptured == false && currentRoomData->code == 24 && isTrapSet == false)
runaroundRed();
- screenTransition(transitionEffect, false, sceneBackground);
+ sceneTransition(transitionEffect, false, sceneBackground);
}
/**
@@ -4528,20 +4526,20 @@ void hypertext(
littText(xht - 1, yht, text.text, shadowColor);
g_engine->_screen->update();
- delay(enforcedTextAnimDelay);
+ delay(kEnforcedTextAnimDelay);
littText(xht + 1, yht, text.text, shadowColor);
g_engine->_screen->update();
- delay(enforcedTextAnimDelay);
+ delay(kEnforcedTextAnimDelay);
littText(xht, yht - 1, text.text, shadowColor);
g_engine->_screen->update();
- delay(enforcedTextAnimDelay);
+ delay(kEnforcedTextAnimDelay);
littText(xht, yht + 1, text.text, shadowColor);
g_engine->_screen->update();
- delay(enforcedTextAnimDelay);
+ delay(kEnforcedTextAnimDelay);
littText(xht, yht, text.text, textColor);
g_engine->_screen->update();
- delay(enforcedTextAnimDelay);
+ delay(kEnforcedTextAnimDelay);
} else {
iht = 0;
@@ -4572,19 +4570,19 @@ void hypertext(
littText(xht + 1, yht + ((lineaht - 1) * 11), lineString, shadowColor);
g_engine->_screen->update();
- delay(enforcedTextAnimDelay);
+ delay(kEnforcedTextAnimDelay);
littText(xht - 1, yht + ((lineaht - 1) * 11), lineString, shadowColor);
g_engine->_screen->update();
- delay(enforcedTextAnimDelay);
+ delay(kEnforcedTextAnimDelay);
littText(xht, yht + ((lineaht - 1) * 11) + 1, lineString, shadowColor);
g_engine->_screen->update();
- delay(enforcedTextAnimDelay);
+ delay(kEnforcedTextAnimDelay);
littText(xht, yht + ((lineaht - 1) * 11) - 1, lineString, shadowColor);
g_engine->_screen->update();
- delay(enforcedTextAnimDelay);
+ delay(kEnforcedTextAnimDelay);
littText(xht, yht + ((lineaht - 1) * 11), lineString, textColor);
g_engine->_screen->update();
- delay(enforcedTextAnimDelay);
+ delay(kEnforcedTextAnimDelay);
}
}
@@ -4602,9 +4600,9 @@ void hypertext(
}
changeGameSpeed(e);
}
- if (timeToDraw) {
- timeToDraw = false;
- if (timeToDraw2) {
+ if (gameTick) {
+ gameTick = false;
+ if (gameTickHalfSpeed) {
if (isWithinConversation) {
indiceaniconversa += 1;
if (textColor == 255) {
@@ -4888,10 +4886,10 @@ void saveItem(ScreenObject object, Common::SeekableWriteStream *objectDataStream
objectDataStream->writeUint16LE(object.dropOverlaySize);
objectDataStream->writeUint16LE(object.objectIconBitmap);
- objectDataStream->writeByte(object.xrej1);
- objectDataStream->writeByte(object.yrej1);
- objectDataStream->writeByte(object.xrej2);
- objectDataStream->writeByte(object.yrej2);
+ objectDataStream->writeByte(object.xgrid1);
+ objectDataStream->writeByte(object.ygrid1);
+ objectDataStream->writeByte(object.xgrid2);
+ objectDataStream->writeByte(object.ygrid2);
objectDataStream->write(object.walkAreasPatch, 100);
objectDataStream->write(object.mouseGridPatch, 100);
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
index 52a01b3830c..9ff9f5dfcec 100644
--- a/engines/tot/routines2.cpp
+++ b/engines/tot/routines2.cpp
@@ -22,11 +22,13 @@
#include "common/config-manager.h"
#include "common/debug.h"
#include "common/file.h"
+#include "common/savefile.h"
#include "common/system.h"
#include "common/textconsole.h"
#include "graphics/fonts/dosfont.h"
#include "graphics/paletteman.h"
#include "graphics/surface.h"
+#include "image/png.h"
#include "tot/routines.h"
#include "tot/routines2.h"
@@ -84,10 +86,10 @@ void loadAnimation(Common::String animationName) {
setRoomTrajectories(secondaryAnimHeight, secondaryAnimWidth, SET_WITH_ANIM, false);
readItemRegister(currentRoomData->secondaryAnimDirections[299]);
- maxXGrid = (regobj.xrej2 - regobj.xrej1 + 1);
- maxYGrid = (regobj.yrej2 - regobj.yrej1 + 1);
- oldposx = regobj.xrej1 + 1;
- oldposy = regobj.yrej1 + 1;
+ maxXGrid = (regobj.xgrid2 - regobj.xgrid1 + 1);
+ maxYGrid = (regobj.ygrid2 - regobj.ygrid1 + 1);
+ oldposx = regobj.xgrid1 + 1;
+ oldposy = regobj.ygrid1 + 1;
for (int i = 0; i < 10; i++)
for (int j = 0; j < 10; j++) {
@@ -340,9 +342,9 @@ void loadItem(uint coordx, uint coordy, uint bitmapSize, int32 bitmapIndex, uint
void updateInventory(byte index) {
for (int i = index; i < (inventoryIconCount - 1); i++) {
- mobj[i].bitmapIndex = mobj[i + 1].bitmapIndex;
- mobj[i].code = mobj[i + 1].code;
- mobj[i].objectName = mobj[i + 1].objectName;
+ inventory[i].bitmapIndex = inventory[i + 1].bitmapIndex;
+ inventory[i].code = inventory[i + 1].code;
+ inventory[i].objectName = inventory[i + 1].objectName;
}
// verifyCopyProtection();
}
@@ -398,10 +400,10 @@ void readItemRegister(Common::SeekableReadStream *stream, uint itemPos, ScreenOb
thisRegObj.dropOverlay = stream->readUint32LE();
thisRegObj.dropOverlaySize = stream->readUint16LE();
thisRegObj.objectIconBitmap = stream->readUint16LE();
- thisRegObj.xrej1 = stream->readByte();
- thisRegObj.yrej1 = stream->readByte();
- thisRegObj.xrej2 = stream->readByte();
- thisRegObj.yrej2 = stream->readByte();
+ thisRegObj.xgrid1 = stream->readByte();
+ thisRegObj.ygrid1 = stream->readByte();
+ thisRegObj.xgrid2 = stream->readByte();
+ thisRegObj.ygrid2 = stream->readByte();
stream->read(thisRegObj.walkAreasPatch, 100);
stream->read(thisRegObj.mouseGridPatch, 100);
}
@@ -419,7 +421,7 @@ void drawLookAtItem(RoomObjectListEntry obj) {
void putIcon(uint iconPosX, uint iconPosY, uint iconNum) {
// substract 1 to account for 1-based indices
- g_engine->_graphics->putImg(iconPosX, iconPosY, inventoryIconBitmaps[mobj[iconNum].bitmapIndex - 1]);
+ g_engine->_graphics->putImg(iconPosX, iconPosY, inventoryIconBitmaps[inventory[iconNum].bitmapIndex - 1]);
}
void drawBackpack() {
@@ -459,7 +461,7 @@ void turnOffRight() {
line(311, 190, 292, 190, 255);
}
-void inventory(byte dir, byte max) {
+void drawInventory(byte dir, byte max) {
switch (dir) {
case 0:
if (inventoryPosition > 0) {
@@ -479,7 +481,7 @@ void inventory(byte dir, byte max) {
lightUpLeft();
else
turnOffLeft();
- if (mobj[inventoryPosition + 6].code > 0)
+ if (inventory[inventoryPosition + 6].code > 0)
lightUpRight();
else
turnOffRight();
@@ -499,7 +501,7 @@ void mask() {
lightUpLeft();
else
turnOffLeft();
- if (mobj[inventoryPosition + 6].code > 0)
+ if (inventory[inventoryPosition + 6].code > 0)
lightUpRight();
else
turnOffRight();
@@ -643,51 +645,28 @@ static void loadDiploma(Common::String &photoName, Common::String &key) {
biosText(30, 160, messages[55], 15);
delay(1500);
g_engine->_sound->playVoc("PORTAZO", 434988, 932);
- // putShape(270, 161, (byte *)sello);
g_engine->_graphics->putShape(270, 159, stamp);
free(stamp);
}
static void saveDiploma(Common::String &photoName, Common::String &key) {
- byte *screen;
- Common::DumpFile outDip;
-
- Common::Path path;
+ Common::String name;
if (photoName != "")
- path = Common::Path("DIPLOMA/" + photoName + ".DIP");
+ name = "tot-diploma-" + photoName + ".png";
else
- path = Common::Path("DIPLOMA/DEFAULT.DIP");
-
- outDip.open(path, true);
- debug("Path: %s", path.toString().c_str());
- if (!outDip.isOpen()) {
- error("Could not open output file!");
- }
-
- palette palCopy;
- copyPalette(pal, palCopy);
- byte *palBuf = palCopy;
- for (int i = 0; i < 768; i++) {
- palBuf[i] = palBuf[i] >> 2;
- }
- char fixedKey[10];
- fixedKey[0] = 10;
- for (int i = 1; i < 10; i++) {
- fixedKey[i] = key[i - 1];
- }
- outDip.write(palBuf, 768);
- outDip.write(fixedKey, 10);
- screen = (byte *)malloc(64000);
- copyFromScreen(screen);
- outDip.write(screen, 64000);
- outDip.finalize();
- outDip.close();
- free(screen);
+ "tot-diploma-default.png";
+ Common::OutSaveFile *thumbnail = g_engine->getSaveFileManager()->openForSaving(name);
+ Graphics::Surface *surface = g_system->lockScreen();
+ assert(surface);
+ Image::writePNG(*thumbnail, *surface, g_engine->_graphics->getPalette());
+ g_system->unlockScreen();
+ thumbnail->finalize();
+ delete thumbnail;
}
void generateDiploma(Common::String &photoName) {
Common::String key;
-
+ g_engine->_mouseManager->hide();
photoName.toUppercase();
totalFadeOut(0);
loadDiploma(photoName, key);
@@ -704,6 +683,7 @@ void generateDiploma(Common::String &photoName) {
g_system->delayMillis(10);
} while (!keyPressed && !g_engine->shouldQuit());
saveDiploma(photoName, key);
+ g_engine->_mouseManager->show();
}
void checkMouseGrid() {
@@ -791,17 +771,17 @@ void checkMouseGrid() {
}
} else if (mouseY >= 166 && mouseY <= 199) {
if (mouseX >= 26 && mouseX <= 65) {
- invObject = mobj[inventoryPosition].objectName;
+ invObject = inventory[inventoryPosition].objectName;
} else if (mouseX >= 70 && mouseX <= 108) {
- invObject = mobj[inventoryPosition + 1].objectName;
+ invObject = inventory[inventoryPosition + 1].objectName;
} else if (mouseX >= 113 && mouseX <= 151) {
- invObject = mobj[inventoryPosition + 2].objectName;
+ invObject = inventory[inventoryPosition + 2].objectName;
} else if (mouseX >= 156 && mouseX <= 194) {
- invObject = mobj[inventoryPosition + 3].objectName;
+ invObject = inventory[inventoryPosition + 3].objectName;
} else if (mouseX >= 199 && mouseX <= 237) {
- invObject = mobj[inventoryPosition + 4].objectName;
+ invObject = inventory[inventoryPosition + 4].objectName;
} else if (mouseX >= 242 && mouseX <= 280) {
- invObject = mobj[inventoryPosition + 5].objectName;
+ invObject = inventory[inventoryPosition + 5].objectName;
} else {
invObject = ' ';
}
@@ -939,8 +919,6 @@ void readAlphaGraphSmall(Common::String &output, int length, int posx, int posy,
littText((posx + (output.size()) * 6), posy, "-", textColor);
borracursor = true;
}
- // car = readkey();
- // car = upcase(car);
}
}
@@ -966,10 +944,10 @@ void hyperText(
if (textString.size() < maxWidth) {
euroText((xpos + 1), (ypos + 1), textString, shadowColor);
g_engine->_screen->update();
- delay(enforcedTextAnimDelay);
+ delay(kEnforcedTextAnimDelay);
euroText(xpos, ypos, textString, textColor);
g_engine->_screen->update();
- delay(enforcedTextAnimDelay);
+ delay(kEnforcedTextAnimDelay);
} else {
ihc = 0;
lineCounter = 0;
@@ -990,10 +968,10 @@ void hyperText(
Common::String lineString = textString.substr(newLineMatrix[line - 1], newLineMatrix[line] - newLineMatrix[line - 1]);
euroText((xpos + 1), (ypos + ((line - 1) * 11) + 1), lineString, shadowColor);
g_engine->_screen->update();
- delay(enforcedTextAnimDelay);
+ delay(kEnforcedTextAnimDelay);
euroText(xpos, (ypos + ((line - 1) * 11)), lineString, textColor);
g_engine->_screen->update();
- delay(enforcedTextAnimDelay);
+ delay(kEnforcedTextAnimDelay);
}
}
}
@@ -1132,8 +1110,8 @@ void putCreditsImg(uint x, uint y, byte *img1, byte *img2, bool direct) {
do {
g_engine->_chrono->updateChrono();
g_system->delayMillis(10);
- } while (!timeToDraw && !g_engine->shouldQuit());
- timeToDraw = false;
+ } while (!gameTick && !g_engine->shouldQuit());
+ gameTick = false;
// Copies the credit window directly to the screen
for (int i = 0; i < hImg1; i++) {
@@ -1259,6 +1237,8 @@ inline bool keyPressed() {
}
void credits() {
+ Common::String n = "Gabriel";
+ generateDiploma(n);
saveAllowed = true;
debug("Credits");
palette pal2;
@@ -1278,69 +1258,69 @@ void credits() {
exit = false;
if (keyPressed() || exit)
- goto Lsalida;
+ goto Lexit;
scrollCredit(0, 8004, pal2, background, exit, 10, false, true);
if (keyPressed() || exit)
- goto Lsalida;
+ goto Lexit;
scrollSingleCredit(8772, 8004, pal2, background, exit);
if (keyPressed() || exit)
- goto Lsalida;
+ goto Lexit;
scrollSingleCredit(17544, 8004, pal2, background, exit);
if (keyPressed() || exit)
- goto Lsalida;
+ goto Lexit;
scrollSingleCredit(26316, 7504, pal2, background, exit);
if (keyPressed() || exit)
- goto Lsalida;
+ goto Lexit;
scrollSingleCredit(34588, 7504, pal2, background, exit);
if (keyPressed() || exit)
- goto Lsalida;
+ goto Lexit;
scrollSingleCredit(42860, 8004, pal2, background, exit);
if (keyPressed() || exit)
- goto Lsalida;
+ goto Lexit;
scrollSingleCredit(51632, 7504, pal2, background, exit);
if (keyPressed() || exit)
- goto Lsalida;
+ goto Lexit;
removeTitle(background2);
if (keyPressed() || exit)
- goto Lsalida;
+ goto Lexit;
g_engine->_graphics->putImg(0, 0, background2);
if (keyPressed() || exit)
- goto Lsalida;
+ goto Lexit;
copyFromScreen(background);
if (keyPressed() || exit)
- goto Lsalida;
+ goto Lexit;
scrollCredit(59904, 8004, pal2, background, exit, 10, false, true);
if (keyPressed() || exit)
- goto Lsalida;
+ goto Lexit;
scrollSingleCredit(68676, 8004, pal2, background, exit);
if (keyPressed() || exit)
- goto Lsalida;
+ goto Lexit;
scrollSingleCredit(77448, 8004, pal2, background, exit);
if (keyPressed() || exit)
- goto Lsalida;
+ goto Lexit;
scrollSingleCredit(86220, 8004, pal2, background, exit);
if (keyPressed() || exit)
- goto Lsalida;
+ goto Lexit;
scrollSingleCredit(94992, 8004, pal2, background, exit);
if (keyPressed() || exit)
- goto Lsalida;
+ goto Lexit;
scrollSingleCredit(103764, 8004, pal2, background, exit);
if (keyPressed() || exit)
- goto Lsalida;
+ goto Lexit;
scrollSingleCredit(112536, 8004, pal2, background, exit);
if (keyPressed() || exit)
- goto Lsalida;
+ goto Lexit;
removeTitle(background2);
if (keyPressed() || exit)
- goto Lsalida;
+ goto Lexit;
g_engine->_graphics->putImg(0, 0, background2);
if (keyPressed() || exit)
- goto Lsalida;
+ goto Lexit;
copyFromScreen(background);
if (keyPressed() || exit)
- goto Lsalida;
+ goto Lexit;
scrollCredit(121308, 8004, pal2, background, exit, 80, false, true);
-Lsalida:
+Lexit:
delay(1000);
totalFadeOut(0);
g_engine->_sound->fadeOutMusic(musicVolLeft, musicVolRight);
@@ -1409,7 +1389,7 @@ void introduction() {
goto Lsalirpres;
}
- if (timeToDraw) {
+ if (gameTick) {
loopCount += 1;
}
g_system->delayMillis(10);
diff --git a/engines/tot/routines2.h b/engines/tot/routines2.h
index e36b0569bed..0a14345a22a 100644
--- a/engines/tot/routines2.h
+++ b/engines/tot/routines2.h
@@ -58,7 +58,7 @@ void saveTemporaryGame();
void drawLookAtItem(RoomObjectListEntry obj);
void putIcon(uint posX, uint posY, uint iconNumber);
void drawBackpack();
-void inventory(byte direction, byte limit);
+void drawInventory(byte direction, byte limit);
void mask();
void drawMenu(byte menuNumber);
void generateDiploma(Common::String &photoName);
diff --git a/engines/tot/util.cpp b/engines/tot/util.cpp
index 5ab3f0bb86b..5d53fdc0fb7 100644
--- a/engines/tot/util.cpp
+++ b/engines/tot/util.cpp
@@ -8,7 +8,7 @@
namespace Tot {
// Enforces a small delay when text reveal is supposed to happen
-const int enforcedTextAnimDelay = 0;
+const int kEnforcedTextAnimDelay = 0;
void showError(int code) {
switch (code) {
@@ -472,10 +472,7 @@ void changeGameSpeed(Common::Event e) {
if (e.type == Common::EVENT_KEYUP) {
if (e.kbd.hasFlags(Common::KBD_CTRL)) {
if (e.kbd.keycode == Common::KEYCODE_f) {
- if (g_engine->_chrono->_speedMultiplier == 1)
- g_engine->_chrono->_speedMultiplier = 3;
- else
- g_engine->_chrono->_speedMultiplier = 1;
+ g_engine->_chrono->changeSpeed();
}
}
}
@@ -485,14 +482,14 @@ void emptyLoop() {
do {
g_engine->_chrono->updateChrono();
g_engine->_screen->update();
- } while (!timeToDraw && !g_engine->shouldQuit());
+ } while (!gameTick && !g_engine->shouldQuit());
}
void emptyLoop2() {
do {
g_engine->_chrono->updateChrono();
g_engine->_screen->update();
- } while (!timeToDraw2);
+ } while (!gameTickHalfSpeed);
}
void waitForKey() {
diff --git a/engines/tot/util.h b/engines/tot/util.h
index babe0517bff..808d5c9ccba 100644
--- a/engines/tot/util.h
+++ b/engines/tot/util.h
@@ -12,7 +12,7 @@
namespace Tot {
-extern const int enforcedTextAnimDelay;
+extern const int kEnforcedTextAnimDelay;
void showError(int code);
diff --git a/engines/tot/vars.cpp b/engines/tot/vars.cpp
index ea0e47ca3be..9b2684fe19a 100644
--- a/engines/tot/vars.cpp
+++ b/engines/tot/vars.cpp
@@ -85,7 +85,7 @@ palette palAnimSlice;
palette pal;
-InventoryEntry mobj[inventoryIconCount];
+InventoryEntry inventory[inventoryIconCount];
byte *inventoryIconBitmaps[inventoryIconCount];
@@ -245,10 +245,10 @@ void clearObj() {
regobj.dropOverlay = 0;
regobj.dropOverlaySize = 0;
regobj.objectIconBitmap = 0;
- regobj.xrej1 = 0;
- regobj.yrej1 = 0;
- regobj.xrej2 = 0;
- regobj.yrej2 = 0;
+ regobj.xgrid1 = 0;
+ regobj.ygrid1 = 0;
+ regobj.xgrid2 = 0;
+ regobj.ygrid2 = 0;
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 10; j++) {
regobj.walkAreasPatch[i][j] = 0;
@@ -417,7 +417,6 @@ void resetGameState() {
}
void initPlayAnim() {
- debug("initplayanim!");
isLoadingFromLauncher = false;
decryptionKey = "23313212133122121312132132312312122132322131221322222112121"
"32121121212112111212112333131232323213222132123211213221231"
@@ -428,261 +427,7 @@ void initPlayAnim() {
rooms = nullptr;
conversationData = nullptr;
invItemData = nullptr;
- // encriptado[0] = encripcod1;
- // encriptado[1] = '\63';
- // encriptado[2] = '\63';
- // encriptado[3] = encripcod1 - 1;
- // encriptado[4] = '\63';
- // encriptado[5] = encripcod1;
- // encriptado[6] = encripcod1 - 1;
- // encriptado[7] = encripcod1;
- // encriptado[8] = encripcod1 - 1;
- // encriptado[9] = '\63';
- // encriptado[10] = '\63';
- // encriptado[11] = encripcod1 - 1;
- // encriptado[12] = encripcod1;
- // encriptado[13] = encripcod1;
- // encriptado[14] = encripcod1 - 1;
- // encriptado[15] = encripcod1;
- // encriptado[16] = encripcod1 - 1;
- // encriptado[17] = '\63';
- // encriptado[18] = encripcod1 - 1;
- // encriptado[19] = encripcod1;
- // encriptado[20] = encripcod1 - 1;
- // encriptado[21] = '\63';
- // encriptado[22] = encripcod1;
- // encriptado[23] = encripcod1 - 1;
- // encriptado[24] = '\63';
- // encriptado[25] = encripcod1;
- // encriptado[26] = '\63';
- // encriptado[27] = encripcod1 - 1;
- // encriptado[28] = encripcod1;
- // encriptado[29] = '\63';
- // encriptado[30] = encripcod1 - 1;
- // encriptado[31] = encripcod1;
- // encriptado[32] = encripcod1 - 1;
- // encriptado[33] = encripcod1;
- // encriptado[34] = encripcod1;
- // encriptado[35] = encripcod1 - 1;
- // encriptado[36] = '\63';
- // encriptado[37] = encripcod1;
- // encriptado[38] = '\63';
- // encriptado[39] = encripcod1;
- // encriptado[40] = encripcod1;
- // encriptado[41] = encripcod1 - 1;
- // encriptado[42] = '\63';
- // encriptado[43] = encripcod1 - 1;
- // encriptado[44] = encripcod1;
- // encriptado[45] = encripcod1;
- // encriptado[46] = encripcod1 - 1;
- // encriptado[47] = '\63';
- // encriptado[48] = encripcod1;
- // encriptado[49] = encripcod1;
- // encriptado[50] = encripcod1;
- // encriptado[51] = encripcod1;
- // encriptado[52] = encripcod1;
- // encriptado[53] = encripcod1 - 1;
- // encriptado[54] = encripcod1 - 1;
- // encriptado[55] = encripcod1;
- // encriptado[56] = encripcod1 - 1;
- // encriptado[57] = encripcod1;
- // encriptado[58] = encripcod1 - 1;
- // encriptado[59] = '\63';
- // encriptado[60] = encripcod1;
- // encriptado[61] = encripcod1 - 1;
- // encriptado[62] = encripcod1;
- // encriptado[63] = encripcod1 - 1;
- // encriptado[64] = encripcod1 - 1;
- // encriptado[65] = encripcod1;
- // encriptado[66] = encripcod1 - 1;
- // encriptado[67] = encripcod1;
- // encriptado[68] = encripcod1 - 1;
- // encriptado[69] = encripcod1;
- // encriptado[70] = encripcod1 - 1;
- // encriptado[71] = encripcod1 - 1;
- // encriptado[72] = encripcod1;
- // encriptado[73] = encripcod1 - 1;
- // encriptado[74] = encripcod1 - 1;
- // encriptado[75] = encripcod1 - 1;
- // encriptado[76] = encripcod1;
- // encriptado[77] = encripcod1 - 1;
- // encriptado[78] = encripcod1;
- // encriptado[79] = encripcod1 - 1;
- // encriptado[80] = encripcod1 - 1;
- // encriptado[81] = encripcod1;
- // encriptado[82] = '\63';
- // encriptado[83] = '\63';
- // encriptado[84] = '\63';
- // encriptado[85] = encripcod1 - 1;
- // encriptado[86] = '\63';
- // encriptado[87] = encripcod1 - 1;
- // encriptado[88] = encripcod1;
- // encriptado[89] = '\63';
- // encriptado[90] = encripcod1;
- // encriptado[91] = '\63';
- // encriptado[92] = encripcod1;
- // encriptado[93] = '\63';
- // encriptado[94] = encripcod1;
- // encriptado[95] = encripcod1 - 1;
- // encriptado[96] = '\63';
- // encriptado[97] = encripcod1;
- // encriptado[98] = encripcod1;
- // encriptado[99] = encripcod1;
- // encriptado[100] = encripcod1 - 1;
- // encriptado[101] = '\63';
- // encriptado[102] = encripcod1;
- // encriptado[103] = encripcod1 - 1;
- // encriptado[104] = encripcod1;
- // encriptado[105] = '\63';
- // encriptado[106] = encripcod1;
- // encriptado[107] = encripcod1 - 1;
- // encriptado[108] = encripcod1 - 1;
- // encriptado[109] = encripcod1;
- // encriptado[110] = encripcod1 - 1;
- // encriptado[111] = '\63';
- // encriptado[112] = encripcod1;
- // encriptado[113] = encripcod1;
- // encriptado[114] = encripcod1 - 1;
- // encriptado[115] = encripcod1;
- // encriptado[116] = '\63';
- // encriptado[117] = encripcod1 - 1;
- // encriptado[118] = '\63';
- // encriptado[119] = encripcod1;
- // encriptado[120] = encripcod1 - 1;
- // encriptado[121] = '\63';
- // encriptado[122] = encripcod1;
- // encriptado[123] = encripcod1;
- // encriptado[124] = encripcod1 - 1;
- // encriptado[125] = '\63';
- // encriptado[126] = encripcod1;
- // encriptado[127] = '\63';
- // encriptado[128] = encripcod1;
- // encriptado[129] = '\63';
- // encriptado[130] = '\63';
- // encriptado[131] = '\63';
- // encriptado[132] = '\63';
- // encriptado[133] = '\63';
- // encriptado[134] = '\63';
- // encriptado[135] = encripcod1;
- // encriptado[136] = encripcod1 - 1;
- // encriptado[137] = '\63';
- // encriptado[138] = encripcod1 - 1;
- // encriptado[139] = '\63';
- // encriptado[140] = encripcod1;
- // encriptado[141] = encripcod1 - 1;
- // encriptado[142] = '\63';
- // encriptado[143] = encripcod1;
- // encriptado[144] = encripcod1 - 1;
- // encriptado[145] = '\63';
- // encriptado[146] = encripcod1;
- // encriptado[147] = '\63';
- // encriptado[148] = encripcod1;
- // encriptado[149] = encripcod1;
- // encriptado[150] = encripcod1 - 1;
- // encriptado[151] = encripcod1 - 1;
- // encriptado[152] = '\63';
- // encriptado[153] = encripcod1;
- // encriptado[154] = encripcod1 - 1;
- // encriptado[155] = encripcod1;
- // encriptado[156] = encripcod1 - 1;
- // encriptado[157] = '\63';
- // encriptado[158] = encripcod1;
- // encriptado[159] = encripcod1 - 1;
- // encriptado[160] = encripcod1;
- // encriptado[161] = encripcod1 - 1;
- // encriptado[162] = '\63';
- // encriptado[163] = encripcod1;
- // encriptado[164] = encripcod1;
- // encriptado[165] = encripcod1 - 1;
- // encriptado[166] = encripcod1;
- // encriptado[167] = '\63';
- // encriptado[168] = encripcod1 - 1;
- // encriptado[169] = encripcod1;
- // encriptado[170] = encripcod1 - 1;
- // encriptado[171] = encripcod1;
- // encriptado[172] = '\63';
- // encriptado[173] = encripcod1;
- // encriptado[174] = '\63';
- // encriptado[175] = '\63';
- // encriptado[176] = encripcod1;
- // encriptado[177] = encripcod1;
- // encriptado[178] = '\63';
- // encriptado[179] = encripcod1 - 1;
- // encriptado[180] = encripcod1;
- // encriptado[181] = '\63';
- // encriptado[182] = encripcod1;
- // encriptado[183] = encripcod1;
- // encriptado[184] = encripcod1 - 1;
- // encriptado[185] = '\63';
- // encriptado[186] = encripcod1;
- // encriptado[187] = encripcod1;
- // encriptado[188] = encripcod1;
- // encriptado[189] = encripcod1 - 1;
- // encriptado[190] = '\63';
- // encriptado[191] = encripcod1;
- // encriptado[192] = '\63';
- // encriptado[193] = '\63';
- // encriptado[194] = encripcod1;
- // encriptado[195] = encripcod1;
- // encriptado[196] = encripcod1 - 1;
- // encriptado[197] = encripcod1 - 1;
- // encriptado[198] = encripcod1 - 1;
- // encriptado[199] = encripcod1;
- // encriptado[200] = '\63';
- // encriptado[201] = encripcod1 - 1;
- // encriptado[202] = encripcod1;
- // encriptado[203] = encripcod1;
- // encriptado[204] = '\63';
- // encriptado[205] = encripcod1 - 1;
- // encriptado[206] = encripcod1;
- // encriptado[207] = encripcod1;
- // encriptado[208] = encripcod1 - 1;
- // encriptado[209] = encripcod1;
- // encriptado[210] = '\63';
- // encriptado[211] = '\63';
- // encriptado[212] = encripcod1;
- // encriptado[213] = '\63';
- // encriptado[214] = encripcod1;
- // encriptado[215] = encripcod1 - 1;
- // encriptado[216] = encripcod1;
- // encriptado[217] = encripcod1;
- // encriptado[218] = '\63';
- // encriptado[219] = '\63';
- // encriptado[220] = encripcod1;
- // encriptado[221] = encripcod1;
- // encriptado[222] = encripcod1 - 1;
- // encriptado[223] = encripcod1 - 1;
- // encriptado[224] = encripcod1 - 1;
- // encriptado[225] = encripcod1 - 1;
- // encriptado[226] = encripcod1;
- // encriptado[227] = encripcod1;
- // encriptado[228] = '\63';
- // encriptado[229] = '\63';
- // encriptado[230] = encripcod1 - 1;
- // encriptado[231] = encripcod1;
- // encriptado[232] = encripcod1;
- // encriptado[233] = '\63';
- // encriptado[234] = encripcod1;
- // encriptado[235] = encripcod1 - 1;
- // encriptado[236] = encripcod1;
- // encriptado[237] = encripcod1;
- // encriptado[238] = encripcod1;
- // encriptado[239] = '\63';
- // encriptado[240] = encripcod1 - 1;
- // encriptado[241] = encripcod1;
- // encriptado[242] = encripcod1;
- // encriptado[243] = encripcod1 - 1;
- // encriptado[244] = encripcod1 - 1;
- // encriptado[245] = '\63';
- // encriptado[246] = encripcod1;
- // encriptado[247] = encripcod1;
- // encriptado[248] = '\63';
- // encriptado[249] = encripcod1 - 1;
- // encriptado[250] = encripcod1;
- // encriptado[251] = encripcod1;
- // encriptado[252] = encripcod1;
- // encriptado[253] = '\63';
- timeToDraw = false;
+ gameTick = false;
for (int i = 0; i < numScreenOverlays; i++) {
screenLayers[i] = NULL;
}
diff --git a/engines/tot/vars.h b/engines/tot/vars.h
index f83b6942915..2b51b3aa8d2 100644
--- a/engines/tot/vars.h
+++ b/engines/tot/vars.h
@@ -147,7 +147,7 @@ struct ScreenObject {
uint16 dropOverlaySize;
uint16 objectIconBitmap; /* Icon on the inventory */
- byte xrej1, yrej1, xrej2, yrej2; /* position of patches below*/
+ byte xgrid1, ygrid1, xgrid2, ygrid2; /* position of patches below*/
byte walkAreasPatch[10][10]; /* patch on the scene's walking area (e.g. object prevents character from walking */
byte mouseGridPatch[10][10]; /* patch on the mouse grid area (i.e. selectable area of the object */
@@ -370,7 +370,7 @@ extern palette pal;
/**
* These are the icons currnetly in the inventory
*/
-extern InventoryEntry mobj[inventoryIconCount];
+extern InventoryEntry inventory[inventoryIconCount];
/**
* Keeps an array of all inventory icon bitmaps
*/
Commit: 1e9785c9ffd997f2aa970c642878fcf851572b2d
https://github.com/scummvm/scummvm/commit/1e9785c9ffd997f2aa970c642878fcf851572b2d
Author: gsanmartin (gabriel.sanmartin at dna.inc)
Date: 2025-09-08T16:49:50+02:00
Commit Message:
TOT: Fixes bug when freeing animation pointers
Changed paths:
engines/tot/chrono.h
engines/tot/graphics.cpp
engines/tot/routines2.cpp
engines/tot/vars.cpp
diff --git a/engines/tot/chrono.h b/engines/tot/chrono.h
index a283d3af2ec..5ffb4f81a06 100644
--- a/engines/tot/chrono.h
+++ b/engines/tot/chrono.h
@@ -30,8 +30,8 @@ namespace Tot {
*/
extern bool gameTick, gameTickHalfSpeed, timeToDrawEffect;
-// const int kTickMs = 20;
-const int kTickMs = 50;
+const int kTickMs = 20;
+// const int kTickMs = 50;
const int kHalfTickMultiplier = 2;
const int kFrameEffectMs = 10;
diff --git a/engines/tot/graphics.cpp b/engines/tot/graphics.cpp
index 07a2ff0acff..3f836f6a8d2 100644
--- a/engines/tot/graphics.cpp
+++ b/engines/tot/graphics.cpp
@@ -88,6 +88,7 @@ void sceneTransition(byte effectNumber, bool fadeToBlack, byte *scene) {
drawScreen(scene);
}
} else {
+ effectNumber = 13;
cpCounter2 = cpCounter;
if (cpCounter > 145)
showError(274);
@@ -125,7 +126,7 @@ void sceneTransition(byte effectNumber, bool fadeToBlack, byte *scene) {
j1 = 10;
do {
bar((i1 - i2), (j1 - i2), (i1 + i2), (j1 + i2), 0);
- // updateSceneAreaIfNeeded();
+ updateSceneAreaIfNeeded();
j1 += 20;
} while (j1 != 150);
i1 += 20;
@@ -444,8 +445,8 @@ void sceneTransition(byte effectNumber, bool fadeToBlack, byte *scene) {
int color = scene[4 + (j1 * 320) + i1];
*((byte *)g_engine->_screen->getBasePtr(i1, j1)) = color;
}
- delay(2);
- updateSceneAreaIfNeeded(3);
+ delay(1);
+ updateSceneAreaIfNeeded();
}
} break;
case 14: {
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
index 9ff9f5dfcec..88dec6fbfba 100644
--- a/engines/tot/routines2.cpp
+++ b/engines/tot/routines2.cpp
@@ -308,9 +308,18 @@ void freeScreenObjects() {
void freeAnimation() {
if (isSecondaryAnimationEnabled) {
isSecondaryAnimationEnabled = false;
- if(curSecondaryAnimationFrame)
+ if(curSecondaryAnimationFrame != NULL) {
free(curSecondaryAnimationFrame);
+ }
curSecondaryAnimationFrame = NULL;
+ for(int j = 0; j < secondaryAnimDirCount; j++){
+ for(int i = 0; i < secondaryAnimationFrameCount; i++){
+ if(secondaryAnimation.bitmap[j][i] != NULL) {
+ free(secondaryAnimation.bitmap[j][i]);
+ }
+ secondaryAnimation.bitmap[j][i] = NULL;
+ }
+ }
}
}
diff --git a/engines/tot/vars.cpp b/engines/tot/vars.cpp
index 9b2684fe19a..e14bc0ba657 100644
--- a/engines/tot/vars.cpp
+++ b/engines/tot/vars.cpp
@@ -491,7 +491,7 @@ void clearVars() {
}
}
- for (int i = 0; i < 4; i++) {
+ for (int i = 0; i < secondaryAnimDirCount; i++) {
for (int j = 0; j < secAnimationFrameCount; j++) {
if(secondaryAnimation.bitmap[i][j] != NULL){
free(secondaryAnimation.bitmap[i][j]);
Commit: 26803025a3c3c7d8033f588961cfc094aad671e9
https://github.com/scummvm/scummvm/commit/26803025a3c3c7d8033f588961cfc094aad671e9
Author: gsanmartin (gabriel.sanmartin at dna.inc)
Date: 2025-09-08T16:49:50+02:00
Commit Message:
TOT: Additional cleanup of graphics
Changed paths:
R engines/tot/graphman.cpp
R engines/tot/graphman.h
engines/tot/anims.cpp
engines/tot/console.cpp
engines/tot/dialog.cpp
engines/tot/game.cpp
engines/tot/graphics.cpp
engines/tot/graphics.h
engines/tot/module.mk
engines/tot/routines.cpp
engines/tot/routines.h
engines/tot/routines2.cpp
engines/tot/saveload.cpp
engines/tot/tot.cpp
engines/tot/tot.h
engines/tot/vars.cpp
engines/tot/vars.h
diff --git a/engines/tot/anims.cpp b/engines/tot/anims.cpp
index f7bbd74fce2..309f42dd3ed 100644
--- a/engines/tot/anims.cpp
+++ b/engines/tot/anims.cpp
@@ -966,10 +966,10 @@ static void loadFlc(
palette[1] = 0;
palette[2] = 0;
if (fullPalette) {
- changePalette(g_engine->_graphics->getPalette(), palette);
- copyPalette(palette, pal);
+ g_engine->_graphics->fadePalettes(g_engine->_graphics->getPalette(), palette);
+ g_engine->_graphics->copyPalette(palette, pal);
} else if (limitPaletteTo200) {
- g_engine->_graphics->setPalette(palette, 200);
+ g_engine->_graphics->setPalette(palette, 0, 200);
for (int i = 0; i <= 200; i++) {
if(gamePart == 2 && !shouldQuitGame && (i == 131 || i == 134 || i == 143 || i == 187)) {
continue;
@@ -981,7 +981,7 @@ static void loadFlc(
} else {
g_engine->_graphics->setPalette(palette);
- copyPalette(palette, pal);
+ g_engine->_graphics->copyPalette(palette, pal);
}
}
// Make sure we also update the palette animations! Esp. for part 2
@@ -990,7 +990,7 @@ static void loadFlc(
if (isPaletteAnimEnabled > 6)
isPaletteAnimEnabled = 0;
else isPaletteAnimEnabled += 1;
- updatePalette(isPaletteAnimEnabled);
+ g_engine->_graphics->updatePalette(isPaletteAnimEnabled);
} else palAnimStep += 1;
gameTick = false;
diff --git a/engines/tot/console.cpp b/engines/tot/console.cpp
index ef4dbcab2c0..f0688f0a883 100644
--- a/engines/tot/console.cpp
+++ b/engines/tot/console.cpp
@@ -67,7 +67,7 @@ bool TotConsole::cmdClearLayers(int argc, const char **argv) {
_engine->_showScreenGrid = false;
_engine->_showGameGrid = false;
_engine->_showMouseGrid = false;
- drawScreen(sceneBackground);
+ g_engine->_graphics->drawScreen(sceneBackground);
debugPrintf("Cleared all debug layers");
return true;
}
@@ -84,7 +84,7 @@ bool TotConsole::cmdLoadRoom(int argc, const char **argv) {
freeScreenObjects();
clearScreenData();
loadScreenData(roomID);
- drawScreen(sceneBackground);
+ g_engine->_graphics->drawScreen(sceneBackground);
debugPrintf("Loaded screen %d", roomID);
return true;
}
diff --git a/engines/tot/dialog.cpp b/engines/tot/dialog.cpp
index 9b297cbd13d..c4e63c02226 100644
--- a/engines/tot/dialog.cpp
+++ b/engines/tot/dialog.cpp
@@ -381,7 +381,7 @@ void showDialogLine(Common::String conversationMatrix[16], uint &chosenTopic) {
isPaletteAnimEnabled = 0;
else
isPaletteAnimEnabled += 1;
- updatePalette(isPaletteAnimEnabled);
+ g_engine->_graphics->updatePalette(isPaletteAnimEnabled);
} else
palAnimStep += 1;
}
diff --git a/engines/tot/game.cpp b/engines/tot/game.cpp
index 88d2375721f..db2b2a35786 100644
--- a/engines/tot/game.cpp
+++ b/engines/tot/game.cpp
@@ -45,7 +45,7 @@ void newGame() {
obtainName(characterName);
if (!g_engine->shouldQuit()) {
- totalFadeOut(0);
+ g_engine->_graphics->totalFadeOut(0);
g_engine->_graphics->clear();
displayLoading();
freeInventory();
@@ -60,9 +60,9 @@ void newGame() {
readConversationFile(Common::String("CONVERSA.TRE"));
initializeScreenFile();
initializeObjectFile();
- loadPalette("DEFAULT");
+ g_engine->_graphics->loadPaletteFromFile("DEFAULT");
loadScreenData(1);
- sceneTransition(13, false, sceneBackground);
+ g_engine->_graphics->sceneTransition(13, false, sceneBackground);
mask();
inventoryPosition = 0;
drawBackpack();
@@ -89,10 +89,10 @@ int engine_start() {
g_engine->_mouseManager->setMouseArea(Common::Rect(0, 0, 305, 185));
g_engine->_sound->playMidi("SILENT", true);
- totalFadeOut(0);
+ g_engine->_graphics->totalFadeOut(0);
g_engine->_graphics->clear();
- loadPalette("DEFAULT");
+ g_engine->_graphics->loadPaletteFromFile("DEFAULT");
loadScreenMemory();
initialLogo();
g_engine->_sound->playMidi("INTRODUC", true);
@@ -426,7 +426,7 @@ int startGame() {
startNewGame = false;
continueGame = false;
g_engine->saveAutosaveIfEnabled();
- totalFadeOut(0);
+ g_engine->_graphics->totalFadeOut(0);
g_engine->_sound->fadeOutMusic(musicVolLeft, musicVolRight);
g_engine->_graphics->clear();
g_engine->_sound->playMidi("INTRODUC", true);
@@ -468,7 +468,7 @@ int startGame() {
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- partialFadeOut(234);
+ g_engine->_graphics->partialFadeOut(234);
g_engine->_sound->fadeOutMusic(musicVolLeft, musicVolRight);
g_engine->_sound->playMidi("CREDITOS", true);
g_engine->_sound->fadeInMusic(musicVolLeft, musicVolRight);
@@ -477,7 +477,7 @@ int startGame() {
sacrificeScene();
g_engine->_graphics->clear();
loadObjects();
- loadPalette("SEGUNDA");
+ g_engine->_graphics->loadPaletteFromFile("SEGUNDA");
currentTrajectoryIndex = 0;
characterPosX = 160;
characterPosY = 60;
@@ -487,7 +487,7 @@ int startGame() {
g_engine->_sound->fadeOutMusic(musicVolLeft, musicVolRight);
g_engine->_sound->playMidi("SEGUNDA", true);
g_engine->_sound->fadeInMusic(musicVolLeft, musicVolRight);
- sceneTransition(1, false, sceneBackground);
+ g_engine->_graphics->sceneTransition(1, false, sceneBackground);
mask();
inventoryPosition = 0;
drawBackpack();
@@ -573,7 +573,7 @@ void changeRoom() {
freeScreenObjects();
g_engine->_mouseManager->hide();
- sceneTransition(transitionEffect, true, NULL);
+ g_engine->_graphics->sceneTransition(transitionEffect, true, NULL);
g_engine->_sound->stopVoc();
loadScreenData(currentRoomData->doors[doorIndex].nextScene);
if (cpCounter > 89)
@@ -583,7 +583,7 @@ void changeRoom() {
g_engine->_sound->autoPlayVoc("PARASITO", 355778, 20129);
else
loadTV();
- sceneTransition(transitionEffect, false, sceneBackground);
+ g_engine->_graphics->sceneTransition(transitionEffect, false, sceneBackground);
cpCounter = cpCounter2;
g_engine->_mouseManager->show();
oldGridX = 0;
@@ -601,12 +601,12 @@ void changeRoom() {
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- sceneTransition(transitionEffect, true, NULL);
+ g_engine->_graphics->sceneTransition(transitionEffect, true, NULL);
loadScreenData(currentRoomData->doors[doorIndex].nextScene);
g_engine->_sound->stopVoc();
g_engine->_sound->autoPlayVoc("CALDERA", 6433, 15386);
g_engine->_sound->setSfxVolume(leftSfxVol, 0);
- sceneTransition(transitionEffect, false, sceneBackground);
+ g_engine->_graphics->sceneTransition(transitionEffect, false, sceneBackground);
g_engine->_mouseManager->show();
oldGridX = 0;
oldGridY = 0;
@@ -646,7 +646,7 @@ void changeRoom() {
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- sceneTransition(transitionEffect, true, NULL);
+ g_engine->_graphics->sceneTransition(transitionEffect, true, NULL);
iframe = 0;
currentTrajectoryIndex = 0;
characterPosX = currentRoomData->doors[doorIndex].exitPosX - characterCorrectionX;
@@ -654,7 +654,7 @@ void changeRoom() {
trajectory[currentTrajectoryIndex].x = characterPosX;
trajectory[currentTrajectoryIndex].y = characterPosY;
loadScreenData(currentRoomData->doors[doorIndex].nextScene);
- sceneTransition(transitionEffect, false, sceneBackground);
+ g_engine->_graphics->sceneTransition(transitionEffect, false, sceneBackground);
g_engine->_mouseManager->show();
oldGridX = 0;
@@ -673,9 +673,9 @@ void changeRoom() {
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- sceneTransition(transitionEffect, true, NULL);
+ g_engine->_graphics->sceneTransition(transitionEffect, true, NULL);
loadScreenData(currentRoomData->doors[doorIndex].nextScene);
- sceneTransition(transitionEffect, false, sceneBackground);
+ g_engine->_graphics->sceneTransition(transitionEffect, false, sceneBackground);
g_engine->_mouseManager->show();
oldGridX = 0;
oldGridY = 0;
@@ -734,9 +734,9 @@ void changeRoom() {
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- sceneTransition(transitionEffect, true, NULL);
+ g_engine->_graphics->sceneTransition(transitionEffect, true, NULL);
loadScreenData(currentRoomData->doors[doorIndex].nextScene);
- sceneTransition(transitionEffect, false, sceneBackground);
+ g_engine->_graphics->sceneTransition(transitionEffect, false, sceneBackground);
g_engine->_mouseManager->show();
oldGridX = 0;
oldGridY = 0;
@@ -766,7 +766,7 @@ void changeRoom() {
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- sceneTransition(transitionEffect, true, NULL);
+ g_engine->_graphics->sceneTransition(transitionEffect, true, NULL);
g_engine->_sound->stopVoc();
loadScreenData(currentRoomData->doors[doorIndex].nextScene);
if (bookTopic[0] == true && currentRoomData->animationFlag == true)
@@ -774,7 +774,7 @@ void changeRoom() {
if (cpCounter > 89)
showError(274);
g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
- sceneTransition(transitionEffect, false, sceneBackground);
+ g_engine->_graphics->sceneTransition(transitionEffect, false, sceneBackground);
cpCounter = cpCounter2;
g_engine->_mouseManager->show();
oldGridX = 0;
@@ -793,9 +793,9 @@ void changeRoom() {
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- sceneTransition(transitionEffect, true, NULL);
+ g_engine->_graphics->sceneTransition(transitionEffect, true, NULL);
loadScreenData(currentRoomData->doors[doorIndex].nextScene);
- sceneTransition(transitionEffect, false, sceneBackground);
+ g_engine->_graphics->sceneTransition(transitionEffect, false, sceneBackground);
g_engine->_mouseManager->show();
oldGridX = 0;
oldGridY = 0;
@@ -826,9 +826,9 @@ void changeRoom() {
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- sceneTransition(transitionEffect, true, NULL);
+ g_engine->_graphics->sceneTransition(transitionEffect, true, NULL);
loadScreenData(currentRoomData->doors[doorIndex].nextScene);
- sceneTransition(transitionEffect, false, sceneBackground);
+ g_engine->_graphics->sceneTransition(transitionEffect, false, sceneBackground);
g_engine->_mouseManager->show();
oldGridX = 0;
oldGridY = 0;
@@ -858,7 +858,7 @@ void changeRoom() {
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- sceneTransition(transitionEffect, true, NULL);
+ g_engine->_graphics->sceneTransition(transitionEffect, true, NULL);
g_engine->_sound->stopVoc();
loadScreenData(currentRoomData->doors[doorIndex].nextScene);
switch (niche[0][niche[0][3]]) {
@@ -880,7 +880,7 @@ void changeRoom() {
g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
if (currentRoomData->code == 4)
g_engine->_sound->loadVoc("GOTA", 140972, 1029);
- sceneTransition(transitionEffect, false, sceneBackground);
+ g_engine->_graphics->sceneTransition(transitionEffect, false, sceneBackground);
cpCounter = cpCounter2;
g_engine->_mouseManager->show();
oldGridX = 0;
@@ -898,7 +898,7 @@ void changeRoom() {
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- sceneTransition(transitionEffect, true, NULL);
+ g_engine->_graphics->sceneTransition(transitionEffect, true, NULL);
g_engine->_sound->stopVoc();
loadScreenData(currentRoomData->doors[doorIndex].nextScene);
switch (niche[1][niche[1][3]]) {
@@ -943,7 +943,7 @@ void changeRoom() {
}
assembleScreen();
}
- sceneTransition(transitionEffect, false, sceneBackground);
+ g_engine->_graphics->sceneTransition(transitionEffect, false, sceneBackground);
if ((isRedDevilCaptured == false) && (isTrapSet == false))
runaroundRed();
cpCounter = cpCounter2;
@@ -966,7 +966,7 @@ void changeRoom() {
freeAnimation();
freeScreenObjects();
g_engine->_mouseManager->hide();
- sceneTransition(transitionEffect, true, NULL);
+ g_engine->_graphics->sceneTransition(transitionEffect, true, NULL);
g_engine->_sound->stopVoc();
loadScreenData(currentRoomData->doors[doorIndex].nextScene);
if (cpCounter > 89)
@@ -980,7 +980,7 @@ void changeRoom() {
g_engine->_sound->autoPlayVoc("FUENTE", 0, 0);
break;
}
- sceneTransition(transitionEffect, false, sceneBackground);
+ g_engine->_graphics->sceneTransition(transitionEffect, false, sceneBackground);
cpCounter = cpCounter2;
g_engine->_mouseManager->show();
oldGridX = 0;
diff --git a/engines/tot/graphics.cpp b/engines/tot/graphics.cpp
index 3f836f6a8d2..03a4ef9b7b1 100644
--- a/engines/tot/graphics.cpp
+++ b/engines/tot/graphics.cpp
@@ -18,43 +18,91 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-
-#include "common/endian.h"
-#include "common/file.h"
-#include "common/memstream.h"
+#include "common/debug.h"
#include "common/system.h"
-#include "common/textconsole.h"
+#include "graphics/font.h"
#include "graphics/paletteman.h"
+#include "tot/font/biosfont.h"
#include "tot/graphics.h"
+#include "tot/statics.h"
#include "tot/tot.h"
#include "tot/util.h"
+#include "tot/vars.h"
namespace Tot {
-signed char fadeData[256][256];
-int ipal, jpal;
+GraphicsManager::GraphicsManager() {
+ for (int i = 0; i < 256; i++)
+ for (int j = 0; j < 256; j++)
+ fadeData[i][j] = i / (j + 1);
-void drawFullScreen(byte *screen) {
- Common::copy(screen, screen + 64000, (byte *)g_engine->_screen->getPixels());
+ // loads fonts
+ Common::File exeFile;
+ if (!exeFile.open(Common::Path("TOT.EXE"))) {
+ error("Could not open executable file!");
+ }
+
+ if (g_engine->_lang == Common::ES_ESP) {
+ exeFile.seek(FONT_LITT_OFFSET_ES);
+ } else {
+ exeFile.seek(FONT_LITT_OFFSET_EN);
+ }
+ _litt.loadChr(exeFile);
+ if (g_engine->_lang == Common::ES_ESP) {
+ exeFile.seek(FONT_EURO_OFFSET_ES);
+ } else {
+ exeFile.seek(FONT_EURO_OFFSET_EN);
+ }
+ _euro.loadChr(exeFile);
+ exeFile.close();
+ _bios = new BiosFont();
}
-void copyFromScreen(byte *&screen) {
- byte *src = (byte *)g_engine->_screen->getPixels();
- Common::copy(src, src + 64000, screen);
+GraphicsManager::~GraphicsManager() {
+ delete (_bios);
}
-void drawScreen(byte *screen, bool offsetSize) {
- int offset = offsetSize ? 4 : 0;
- for (int i1 = 0; i1 < 320; i1++) {
- for (int j1 = 0; j1 < 140; j1++) {
- ((byte *)g_engine->_screen->getPixels())[j1 * 320 + i1] = ((byte *)screen)[offset + j1 * 320 + i1];
+void GraphicsManager::restoreBackgroundArea(uint x, uint y, uint x2, uint y2) {
+ for (int j = y; j < y2; j++) {
+ for (int i = x; i < x2; i++) {
+ *((byte *)g_engine->_screen->getBasePtr(i, j)) = 0;
}
}
- g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
+ g_engine->_screen->addDirtyRect(Common::Rect(x, y, x2, y2));
}
-void loadPalette(Common::String paletteName) {
+void GraphicsManager::clear() {
+ g_engine->_screen->clear();
+ g_engine->_screen->markAllDirty();
+ g_engine->_screen->update();
+}
+
+void GraphicsManager::clearActionLine() {
+ restoreBackgroundArea(0, 140, 319, 149);
+}
+
+void GraphicsManager::writeActionLine(const Common::String &str) {
+ euroText(str, 0, 144, 255, Graphics::kTextAlignCenter, true);
+}
+
+void GraphicsManager::setPalette(byte *palette, uint start, uint num) {
+ g_system->getPaletteManager()->setPalette(palette, start, num);
+}
+
+void GraphicsManager::fixPalette(byte *palette, uint num) {
+ for (int i = 0; i < num; i++) {
+ palette[i] = palette[i] << 2;
+ }
+}
+
+byte *GraphicsManager::getPalette() {
+ byte *palette = (byte *)malloc(768);
+ g_system->getPaletteManager()->grabPalette(palette, 0, 256);
+ return palette;
+}
+
+void GraphicsManager::loadPaletteFromFile(Common::String paletteName) {
Common::File fichero;
@@ -63,18 +111,359 @@ void loadPalette(Common::String paletteName) {
fichero.read(pal, 768);
fichero.close();
- g_engine->_graphics->fixPalette(pal, 768);
- g_engine->_graphics->setPalette(pal);
+ fixPalette(pal, 768);
+ setPalette(pal);
+}
+
+void GraphicsManager::fadePalettes(byte *from, byte *to) {
+ byte intermediate[768];
+ int aux;
+
+ copyPalette(from, intermediate);
+ for (int j = 32; j >= 0; j--) {
+ for (int i = 0; i < 256; i++) {
+ aux = to[3 * i + 0] - intermediate[3 * i + 0];
+ if (aux > 0)
+ intermediate[3 * i + 0] = intermediate[3 * i + 0] + fadeData[aux][j];
+ else
+ intermediate[3 * i + 0] = intermediate[3 * i + 0] - fadeData[-aux][j];
+
+ aux = to[3 * i + 1] - intermediate[3 * i + 1];
+ if (aux > 0)
+ intermediate[3 * i + 1] = intermediate[3 * i + 1] + fadeData[aux][j];
+ else
+ intermediate[3 * i + 1] = intermediate[3 * i + 1] - fadeData[-aux][j];
+
+ aux = to[3 * i + 2] - intermediate[3 * i + 2];
+ if (aux > 0)
+ intermediate[3 * i + 2] = intermediate[3 * i + 2] + fadeData[aux][j];
+ else
+ intermediate[3 * i + 2] = intermediate[3 * i + 2] - fadeData[-aux][j];
+ }
+ setPalette(intermediate, 0, 256);
+ g_engine->_screen->markAllDirty();
+ g_engine->_screen->update();
+ }
+}
+
+void GraphicsManager::turnLightOn() {
+ Common::File paletteFile;
+ byte intermediate[768];
+
+ if (!paletteFile.open("PALETAS.DAT")) {
+ showError(311);
+ }
+ paletteFile.seek(1536);
+ paletteFile.read(intermediate, 768);
+ paletteFile.close();
+ for (int i = 0; i < 256; i++) {
+ if (i >= 201) {
+ intermediate[3 * i + 0] = pal[3 * i + 0];
+ intermediate[3 * i + 1] = pal[3 * i + 1];
+ intermediate[3 * i + 2] = pal[3 * i + 2];
+ } else {
+ intermediate[3 * i + 0] = intermediate[3 * i + 0] << 2;
+ intermediate[3 * i + 1] = intermediate[3 * i + 1] << 2;
+ intermediate[3 * i + 2] = intermediate[3 * i + 2] << 2;
+ }
+ }
+ fadePalettes(pal, intermediate);
+ copyPalette(intermediate, pal);
+}
+
+void GraphicsManager::totalFadeOut(byte redComponent) {
+ byte intermediate[768];
+
+ for (int ipal = 0; ipal <= 255; ipal++) {
+ intermediate[3 * ipal + 0] = redComponent;
+ intermediate[3 * ipal + 1] = 0;
+ intermediate[3 * ipal + 2] = 0;
+ }
+ fadePalettes(pal, intermediate);
+ copyPalette(intermediate, pal);
+}
+
+void GraphicsManager::partialFadeOut(byte numcol) {
+ byte intermediate[768];
+
+ for (int i = 0; i <= numcol; i++) {
+ intermediate[3 * i + 0] = 0;
+ intermediate[3 * i + 1] = 0;
+ intermediate[3 * i + 2] = 0;
+ }
+ for (int i = (numcol + 1); i <= 255; i++) {
+ intermediate[3 * i + 0] = pal[3 * i + 0];
+ intermediate[3 * i + 1] = pal[3 * i + 1];
+ intermediate[3 * i + 2] = pal[3 * i + 2];
+ }
+ fadePalettes(pal, intermediate);
+ copyPalette(intermediate, pal);
+}
+
+void GraphicsManager::partialFadeIn(byte numcol) {
+ byte darkPalette[768];
+
+ for (int i = 0; i <= numcol; i++) {
+ darkPalette[3 * i + 0] = 0;
+ darkPalette[3 * i + 1] = 0;
+ darkPalette[3 * i + 2] = 0;
+ }
+ for (int i = (numcol + 1); i <= 255; i++) {
+ darkPalette[3 * i + 0] = pal[3 * i + 0];
+ darkPalette[3 * i + 1] = pal[3 * i + 1];
+ darkPalette[3 * i + 2] = pal[3 * i + 2];
+ }
+ fadePalettes(darkPalette, pal);
+}
+
+void GraphicsManager::totalFadeIn(uint paletteNumber, Common::String paletteName) {
+ byte intermediate[768];
+ byte darkPalette[768];
+
+ Common::File paletteFile;
+ if (paletteNumber > 0) {
+ if (!paletteFile.open("PALETAS.DAT"))
+ showError(311);
+ paletteFile.seek(paletteNumber);
+ paletteFile.read(intermediate, 768);
+ paletteFile.close();
+ } else {
+ if (!paletteFile.open(Common::Path(Common::String(paletteName + ".PAL")))) {
+ showError(311);
+ }
+ paletteFile.read(intermediate, 768);
+ paletteFile.close();
+ }
+ for (int i = 0; i <= 255; i++) {
+ darkPalette[3 * i + 0] = 0;
+ darkPalette[3 * i + 1] = 0;
+ darkPalette[3 * i + 2] = 0;
+ // 6-bit color correction
+ intermediate[3 * i + 0] = intermediate[3 * i + 0] << 2;
+ intermediate[3 * i + 1] = intermediate[3 * i + 1] << 2;
+ intermediate[3 * i + 2] = intermediate[3 * i + 2] << 2;
+ }
+
+ fadePalettes(darkPalette, intermediate);
+ copyPalette(intermediate, pal);
+}
+
+void GraphicsManager::redFadeIn(byte *intermediatePalette) {
+ byte dark[768];
+
+ for (int i = 0; i < 256; i++) {
+ dark[3 * i + 0] = 0;
+ dark[3 * i + 1] = 0;
+ dark[3 * i + 2] = 0;
+ }
+ fadePalettes(pal, dark);
+ fadePalettes(dark, intermediatePalette);
+ copyPalette(intermediatePalette, pal);
+}
+
+void GraphicsManager::updatePalette(byte paletteIndex) {
+ int ip;
+
+ switch (gamePart) {
+ case 1: {
+ for (int i = 0; i <= 5; i++) {
+ pal[(i + 195) * 3 + 0] = palAnimSlice[(paletteIndex * 6 + i) * 3 + 0];
+ pal[(i + 195) * 3 + 1] = palAnimSlice[(paletteIndex * 6 + i) * 3 + 1];
+ pal[(i + 195) * 3 + 2] = palAnimSlice[(paletteIndex * 6 + i) * 3 + 2];
+ }
+ setPalette(&pal[195 * 3 + 0], 195, 6);
+ } break;
+ case 2: {
+ switch (paletteIndex) {
+ case 0:
+ ip = 0;
+ break;
+ case 1:
+ ip = 4;
+ break;
+ case 2:
+ ip = 8;
+ break;
+ case 3:
+ ip = 4;
+ break;
+ case 4:
+ ip = 0;
+ break;
+ case 5:
+ ip = -4;
+ break;
+ case 6:
+ ip = -8;
+ break;
+ case 7:
+ ip = -4;
+ break;
+ }
+
+ for (int i = 0; i < 3; i++) {
+ pal[131 * 3 + i] = pal[131 * 3 + i] - ip;
+ pal[134 * 3 + i] = pal[134 * 3 + i] - ip;
+ pal[143 * 3 + i] = pal[143 * 3 + i] - ip;
+ pal[187 * 3 + i] = pal[187 * 3 + i] - ip;
+ }
+ setPalette(pal);
+
+ } break;
+ }
+}
+
+void GraphicsManager::copyPalette(byte *from, byte *to) {
+ Common::copy(from, from + 768, to);
+}
+
+void GraphicsManager::printColor(int x, int y, int color) {
+ int squareHeight = 10;
+ for (int k = 0; k < squareHeight; k++) {
+ for (int l = 0; l < squareHeight; l++) {
+ g_engine->_screen->setPixel(x + l, y + k, color);
+ }
+ }
+}
+
+void GraphicsManager::getImg(uint coordx1, uint coordy1, uint coordx2, uint coordy2, byte *image) {
+
+ uint16 width = coordx2 - coordx1;
+ uint16 height = coordy2 - coordy1;
+
+ WRITE_LE_UINT16(image, width);
+ WRITE_LE_UINT16(image + 2, height);
+
+ width++;
+ height++;
+
+ for (int j = 0; j < width; j++) {
+ for (int i = 0; i < height; i++) {
+ int idx = 4 + i * width + j;
+ *(image + idx) = *(byte *)g_engine->_screen->getBasePtr(coordx1 + j, coordy1 + i);
+ }
+ }
+}
+
+void GraphicsManager::putShape(uint coordx, uint coordy, byte *image) {
+ putImg(coordx, coordy, image, true);
}
-void updateSceneAreaIfNeeded(int speed = 1) {
+void GraphicsManager::putImg(uint coordx, uint coordy, byte *image, bool transparency) {
+ uint16 w, h;
+
+ w = READ_LE_UINT16(image);
+ h = READ_LE_UINT16(image + 2);
+
+ w++;
+ h++;
+ for (int i = 0; i < w; i++) {
+ for (int j = 0; j < h; j++) {
+ int index = 4 + (j * w + i);
+ if (!transparency || image[index] != 0) {
+ *(byte *)g_engine->_screen->getBasePtr(coordx + i, coordy + j) = image[index];
+ }
+ }
+ }
+ g_engine->_screen->addDirtyRect(Common::Rect(coordx, coordy, coordx + w, coordy + h));
+}
+
+// Copies the rectangle delimited by getCoord** from backgroundScreen into image
+void GraphicsManager::getImageArea(
+ uint getcoordx1, // xframe
+ uint getcoordy1, // yframe
+ uint getcoordx2, // xframe + framewidth
+ uint getcoordy2, // yframe + frameheight
+ byte *backgroundScreen,
+ byte *image) {
+ uint16 w = getcoordx2 - getcoordx1;
+ uint16 h = getcoordy2 - getcoordy1;
+
+ WRITE_UINT16(image, w);
+ WRITE_UINT16(image + 2, h);
+ w++;
+ h++;
+ int posAbs = 4 + getcoordx1 + (getcoordy1 * 320);
+
+ int sourcePtr = 0;
+ byte *destPtr = 4 + image; // Start writing after width and height
+
+ for (int i = 0; i < h; i++) {
+ for (int j = 0; j < w; j++) {
+ *destPtr++ = backgroundScreen[posAbs + sourcePtr++];
+ }
+ sourcePtr += (320 - w); // Move to the beginning of the next row in backgroundScreen
+ }
+}
+
+// puts an image into a buffer in the given position, asuming 320 width
+void GraphicsManager::putImageArea(uint putcoordx, uint putcoordy, byte *backgroundScreen, byte *image) {
+ uint16 w, h;
+
+ w = READ_LE_UINT16(image);
+ h = READ_LE_UINT16(image + 2);
+
+ w++;
+ h++;
+ int posAbs = 4 + putcoordx + (putcoordy * 320);
+
+ int sourcePtr = 0;
+ byte *destPtr = 4 + image; // Start writing after width and height
+
+ for (int i = 0; i < h; i++) {
+ for (int j = 0; j < w; j++) {
+ backgroundScreen[posAbs + sourcePtr++] = *destPtr++;
+ }
+ sourcePtr += (320 - w); // Move to the beginning of the next row in backgroundScreen
+ }
+}
+
+void GraphicsManager::littText(const Common::String &str, int x, int y, uint32 color, Graphics::TextAlign align, bool alignCenterY) {
+ int height = _euro.getFontHeight();
+ if (alignCenterY) {
+ y = y - _euro.getFontHeight() / 2 + 2;
+ }
+ _litt.drawString(g_engine->_screen, str, x, y, 320, color, align);
+}
+
+void GraphicsManager::euroText(const Common::String &str, int x, int y, uint32 color, Graphics::TextAlign align, bool alignCenterY) {
+ if (alignCenterY) {
+ y = y - _euro.getFontHeight() / 2;
+ }
+ _euro.drawString(g_engine->_screen, str, x, y, 320, color, align);
+}
+
+void GraphicsManager::biosText(const Common::String &str, int x, int y, uint32 color) {
+ _bios->drawString(g_engine->_screen, str, x, y, 320, color, Graphics::TextAlign::kTextAlignLeft);
+}
+
+void GraphicsManager::drawFullScreen(byte *screen) {
+ Common::copy(screen, screen + 64000, (byte *)g_engine->_screen->getPixels());
+}
+
+void GraphicsManager::copyFromScreen(byte *&screen) {
+ byte *src = (byte *)g_engine->_screen->getPixels();
+ Common::copy(src, src + 64000, screen);
+}
+
+void GraphicsManager::drawScreen(byte *screen, bool offsetSize) {
+ int offset = offsetSize ? 4 : 0;
+ for (int i1 = 0; i1 < 320; i1++) {
+ for (int j1 = 0; j1 < 140; j1++) {
+ ((byte *)g_engine->_screen->getPixels())[j1 * 320 + i1] = ((byte *)screen)[offset + j1 * 320 + i1];
+ }
+ }
+ g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
+}
+
+void GraphicsManager::updateSceneAreaIfNeeded(int speed) {
if (g_engine->_chrono->shouldPaintEffect(speed)) {
g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
g_engine->_screen->update();
}
}
-void sceneTransition(byte effectNumber, bool fadeToBlack, byte *scene) {
+void GraphicsManager::sceneTransition(byte effectNumber, bool fadeToBlack, byte *scene) {
int i1, i2, i3, j1, j2, j3;
bool enabled = false;
@@ -477,221 +866,17 @@ void sceneTransition(byte effectNumber, bool fadeToBlack, byte *scene) {
}
}
-void changeRGBBlock(byte initialColor, uint numColors, byte *rgb) {
- g_system->getPaletteManager()->setPalette(rgb, initialColor, numColors);
-}
-
-void changePalette(palette from, palette to) {
- palette intermediate;
- int aux;
-
- copyPalette(from, intermediate);
- for (jpal = 32; jpal >= 0; jpal--) {
- for (ipal = 0; ipal < 256; ipal++) {
- aux = to[3 * ipal + 0] - intermediate[3 * ipal + 0];
- if (aux > 0)
- intermediate[3 * ipal + 0] = intermediate[3 * ipal + 0] + fadeData[aux][jpal];
- else
- intermediate[3 * ipal + 0] = intermediate[3 * ipal + 0] - fadeData[-aux][jpal];
-
- aux = to[3 * ipal + 1] - intermediate[3 * ipal + 1];
- if (aux > 0)
- intermediate[3 * ipal + 1] = intermediate[3 * ipal + 1] + fadeData[aux][jpal];
- else
- intermediate[3 * ipal + 1] = intermediate[3 * ipal + 1] - fadeData[-aux][jpal];
-
- aux = to[3 * ipal + 2] - intermediate[3 * ipal + 2];
- if (aux > 0)
- intermediate[3 * ipal + 2] = intermediate[3 * ipal + 2] + fadeData[aux][jpal];
- else
- intermediate[3 * ipal + 2] = intermediate[3 * ipal + 2] - fadeData[-aux][jpal];
- }
- changeRGBBlock(0, 256, intermediate);
- g_engine->_screen->markAllDirty();
- g_engine->_screen->update();
- }
-}
-
-void turnLightOn() {
- Common::File paletteFile;
- palette intermediate;
-
- if (!paletteFile.open("PALETAS.DAT")) {
- showError(311);
- }
- paletteFile.seek(1536);
- paletteFile.read(intermediate, 768);
- paletteFile.close();
- for (int i = 0; i < 256; i++) {
- if (i >= 201) {
- intermediate[3 * i + 0] = pal[3 * i + 0];
- intermediate[3 * i + 1] = pal[3 * i + 1];
- intermediate[3 * i + 2] = pal[3 * i + 2];
- } else {
- intermediate[3 * i + 0] = intermediate[3 * i + 0] << 2;
- intermediate[3 * i + 1] = intermediate[3 * i + 1] << 2;
- intermediate[3 * i + 2] = intermediate[3 * i + 2] << 2;
- }
- }
- changePalette(pal, intermediate);
- copyPalette(intermediate, pal);
-}
-
-void totalFadeOut(byte redComponent) {
- palette intermediate;
-
- for (ipal = 0; ipal <= 255; ipal++) {
- intermediate[3 * ipal + 0] = redComponent;
- intermediate[3 * ipal + 1] = 0;
- intermediate[3 * ipal + 2] = 0;
- }
- changePalette(pal, intermediate);
- copyPalette(intermediate, pal);
-}
-
-void partialFadeOut(byte numcol) {
- palette intermediate;
-
- for (ipal = 0; ipal <= numcol; ipal++) {
- intermediate[3 * ipal + 0] = 0;
- intermediate[3 * ipal + 1] = 0;
- intermediate[3 * ipal + 2] = 0;
- }
- for (ipal = (numcol + 1); ipal <= 255; ipal++) {
- intermediate[3 * ipal + 0] = pal[3 * ipal + 0];
- intermediate[3 * ipal + 1] = pal[3 * ipal + 1];
- intermediate[3 * ipal + 2] = pal[3 * ipal + 2];
- }
- changePalette(pal, intermediate);
- copyPalette(intermediate, pal);
-}
-
-void partialFadeIn(byte numcol) {
- palette darkPalette;
-
- for (ipal = 0; ipal <= numcol; ipal++) {
- darkPalette[3 * ipal + 0] = 0;
- darkPalette[3 * ipal + 1] = 0;
- darkPalette[3 * ipal + 2] = 0;
- }
- for (ipal = (numcol + 1); ipal <= 255; ipal++) {
- darkPalette[3 * ipal + 0] = pal[3 * ipal + 0];
- darkPalette[3 * ipal + 1] = pal[3 * ipal + 1];
- darkPalette[3 * ipal + 2] = pal[3 * ipal + 2];
- }
- changePalette(darkPalette, pal);
-}
-
-void totalFadeIn(uint paletteNumber, Common::String paletteName) {
- palette intermediate, darkPalette;
- Common::File paletteFile;
- if (paletteNumber > 0) {
- if (!paletteFile.open("PALETAS.DAT"))
- showError(311);
- paletteFile.seek(paletteNumber);
- paletteFile.read(intermediate, 768);
- paletteFile.close();
- } else {
- if (!paletteFile.open(Common::Path(Common::String(paletteName + ".PAL")))) {
- showError(311);
- }
- paletteFile.read(intermediate, 768);
- paletteFile.close();
- }
- for (ipal = 0; ipal <= 255; ipal++) {
- darkPalette[3 * ipal + 0] = 0;
- darkPalette[3 * ipal + 1] = 0;
- darkPalette[3 * ipal + 2] = 0;
- // 6-bit color correction
- intermediate[3 * ipal + 0] = intermediate[3 * ipal + 0] << 2;
- intermediate[3 * ipal + 1] = intermediate[3 * ipal + 1] << 2;
- intermediate[3 * ipal + 2] = intermediate[3 * ipal + 2] << 2;
- }
-
- changePalette(darkPalette, intermediate);
- copyPalette(intermediate, pal);
-}
-
-void redFadeIn(palette intermediatePalette) {
- palette dark;
-
- for (ipal = 0; ipal < 256; ipal++) {
- dark[3 * ipal + 0] = 0;
- dark[3 * ipal + 1] = 0;
- dark[3 * ipal + 2] = 0;
- }
- changePalette(pal, dark);
- changePalette(dark, intermediatePalette);
- copyPalette(intermediatePalette, pal);
-}
-
-void updatePalette(byte paletteIndex) {
- int ip;
-
- switch (gamePart) {
- case 1: {
- for (ipal = 0; ipal <= 5; ipal++) {
- pal[(ipal + 195) * 3 + 0] = palAnimSlice[(paletteIndex * 6 + ipal) * 3 + 0];
- pal[(ipal + 195) * 3 + 1] = palAnimSlice[(paletteIndex * 6 + ipal) * 3 + 1];
- pal[(ipal + 195) * 3 + 2] = palAnimSlice[(paletteIndex * 6 + ipal) * 3 + 2];
- }
- changeRGBBlock(195, 6, &pal[195 * 3 + 0]);
- } break;
- case 2: {
- switch (paletteIndex) {
- case 0:
- ip = 0;
- break;
- case 1:
- ip = 4;
- break;
- case 2:
- ip = 8;
- break;
- case 3:
- ip = 4;
- break;
- case 4:
- ip = 0;
- break;
- case 5:
- ip = -4;
- break;
- case 6:
- ip = -8;
- break;
- case 7:
- ip = -4;
- break;
- }
-
- for (int i = 0; i < 3; i++) {
- pal[131 * 3 + i] = pal[131 * 3 + i] - ip;
- pal[134 * 3 + i] = pal[134 * 3 + i] - ip;
- pal[143 * 3 + i] = pal[143 * 3 + i] - ip;
- pal[187 * 3 + i] = pal[187 * 3 + i] - ip;
- }
- g_engine->_graphics->setPalette(pal);
-
- } break;
- }
-}
-
-void initGraph() {
+void GraphicsManager::init() {
for (int i = 0; i < 256; i++)
for (int j = 0; j < 256; j++)
fadeData[i][j] = i / (j + 1);
}
-void restoreBackground() {
+void GraphicsManager::restoreBackground() {
Common::copy(backgroundCopy + 4, backgroundCopy + screenSize, sceneBackground + 4);
}
-void copyPalette(palette from, palette to) {
- Common::copy(from, from + 768, to);
-}
-
-void loadAnimationIntoBuffer(Common::SeekableReadStream *stream, byte *&buf, int animSize) {
+void GraphicsManager::loadAnimationIntoBuffer(Common::SeekableReadStream *stream, byte *&buf, int animSize) {
buf = (byte *)malloc(animSize);
stream->read(buf, animSize);
Common::copy(buf, buf + animSize, curSecondaryAnimationFrame);
diff --git a/engines/tot/graphics.h b/engines/tot/graphics.h
index 5a7a61b71ff..eccd3000fe5 100644
--- a/engines/tot/graphics.h
+++ b/engines/tot/graphics.h
@@ -21,30 +21,70 @@
#ifndef TOT_GRAPHICS_H
#define TOT_GRAPHICS_H
-#include "engines/tot/vars.h"
-#include "engines/tot/util.h"
+#include "common/scummsys.h"
+#include "common/system.h"
+#include "graphics/font.h"
+
+#include "tot/font/bgifont.h"
+// #include "tot/font/biosfont.h"
+// #include "tot/vars.h"
namespace Tot {
-void initGraph();
-void drawFullScreen(byte *screen);
-void copyFromScreen(byte *&screen);
-void drawScreen(byte *screen, bool offsetSize = true);
-
-void loadPalette(Common::String image);
-void sceneTransition(byte effectNumber, bool fadeToBlack, byte *screen);
-void turnLightOn();
-void totalFadeOut(byte red);
-void partialFadeOut(byte numCol);
-void totalFadeIn(uint paletteNumber, Common::String paletteName);
-void redFadeIn(palette palette);
-void partialFadeIn(byte numCol);
-void updatePalette(byte paletteIndex);
-void changePalette(palette fromPalette, palette toPalette);
-void changeRGBBlock(byte initialColor, uint numColors, byte *rgb);
-void restoreBackground();
-void copyPalette(palette from, palette to);
-void loadAnimationIntoBuffer(Common::SeekableReadStream *stream, byte *&buf, int animSize);
-} // End of namespace Tot
+class GraphicsManager {
+public:
+ GraphicsManager();
+ ~GraphicsManager();
+
+ void init();
+ void fixPalette(byte *palette, uint num = 768);
+ byte *getPalette();
+ void setPalette(byte palette[768], uint start = 0, uint num = 256);
+ void loadPaletteFromFile(Common::String image);
+ void turnLightOn();
+ void totalFadeOut(byte red);
+ void partialFadeOut(byte numCol);
+ void totalFadeIn(uint paletteNumber, Common::String paletteName);
+ void redFadeIn(byte *palette);
+ void partialFadeIn(byte numCol);
+ void updatePalette(byte paletteIndex);
+ void fadePalettes(byte *fromPalette, byte *toPalette);
+ void copyPalette(byte *from, byte *to);
+
+ void putImg(uint coordx, uint coordy, byte *image, bool transparency = false);
+ void getImg(uint coordx1, uint coordy1, uint coordx2, uint coordy2, byte *image);
+ void putShape(uint coordx, uint coordy, byte *image);
+ void putImageArea(uint putcoordx, uint putcoordy, byte *backgroundScreen, byte *image);
+ void getImageArea(uint getcoordx1, uint getcoordy1, uint getcoordx2, uint getcoordy2, byte *backgroundScreen, byte *image);
+
+ void littText(const Common::String &str, int x, int y, uint32 color, Graphics::TextAlign align = Graphics::kTextAlignLeft, bool alignCenterY = false);
+ void euroText(const Common::String &str, int x, int y, uint32 color, Graphics::TextAlign align = Graphics::kTextAlignLeft, bool alignCenterY = false);
+ void biosText(const Common::String &str, int x, int y, uint32 color);
+
+ void clear();
+
+ void clearActionLine();
+ void writeActionLine(const Common::String &str);
+ void drawFullScreen(byte *screen);
+ void copyFromScreen(byte *&screen);
+ void drawScreen(byte *screen, bool offsetSize = true);
+ void restoreBackground();
+ void restoreBackgroundArea(uint x, uint y, uint x2, uint y2);
+
+ void sceneTransition(byte effectNumber, bool fadeToBlack, byte *screen);
+
+ void loadAnimationIntoBuffer(Common::SeekableReadStream *stream, byte *&buf, int animSize);
+ void printColor(int x, int y, int color);
+
+
+private:
+ void updateSceneAreaIfNeeded(int speed = 1);
+ signed char fadeData[256][256];
+ Graphics::BgiFont _litt;
+ Graphics::BgiFont _euro;
+ Graphics::Font *_bios;
+};
+
+} // End of namespace Tot
#endif
diff --git a/engines/tot/graphman.cpp b/engines/tot/graphman.cpp
deleted file mode 100644
index 889b76ed30c..00000000000
--- a/engines/tot/graphman.cpp
+++ /dev/null
@@ -1,245 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-#include "common/debug.h"
-#include "common/system.h"
-#include "graphics/font.h"
-#include "graphics/paletteman.h"
-
-#include "tot/font/biosfont.h"
-#include "tot/graphman.h"
-#include "tot/statics.h"
-#include "tot/tot.h"
-
-namespace Tot {
-
-GraphicsManager::GraphicsManager() {
- for (int i = 0; i < 256; i++)
- for (int j = 0; j < 256; j++)
- fadeData[i][j] = i / (j + 1);
-
- // loads fonts
- Common::File exeFile;
- if (!exeFile.open(Common::Path("TOT.EXE"))) {
- error("Could not open executable file!");
- }
-
- if (g_engine->_lang == Common::ES_ESP) {
- exeFile.seek(FONT_LITT_OFFSET_ES);
- } else {
- exeFile.seek(FONT_LITT_OFFSET_EN);
- }
- _litt.loadChr(exeFile);
- if (g_engine->_lang == Common::ES_ESP) {
- exeFile.seek(FONT_EURO_OFFSET_ES);
- } else {
- exeFile.seek(FONT_EURO_OFFSET_EN);
- }
- _euro.loadChr(exeFile);
- exeFile.close();
- _bios = new BiosFont();
-}
-
-GraphicsManager::~GraphicsManager() {
- delete(_bios);
-}
-
-void GraphicsManager::restoreBackgroundArea(uint x, uint y, uint x2, uint y2) {
- for (int j = y; j < y2; j++) {
- for (int i = x; i < x2; i++) {
- *((byte *)g_engine->_screen->getBasePtr(i, j)) = 0;
- }
- }
- g_engine->_screen->addDirtyRect(Common::Rect(x, y, x2, y2));
-}
-
-void GraphicsManager::clear() {
- g_engine->_screen->clear();
- g_engine->_screen->markAllDirty();
- g_engine->_screen->update();
-}
-
-void GraphicsManager::clearActionLine() {
- restoreBackgroundArea(0, 140, 319, 149);
-}
-
-void GraphicsManager::writeActionLine(const Common::String &str) {
- euroText(str, 0, 144, 255, Graphics::kTextAlignCenter, true);
-}
-
-void GraphicsManager::setPalette(byte *palette, uint num) {
- g_system->getPaletteManager()->setPalette(palette, 0, num);
-}
-
-void GraphicsManager::fixPalette(byte *palette, uint num) {
- for (int i = 0; i < num; i++) {
- palette[i] = palette[i] << 2;
- }
-}
-
-
-void GraphicsManager::getImg(uint coordx1, uint coordy1, uint coordx2, uint coordy2, byte *image) {
-
- uint16 width = coordx2 - coordx1;
- uint16 height = coordy2 - coordy1;
-
- WRITE_LE_UINT16(image, width);
- WRITE_LE_UINT16(image + 2, height);
-
- width++;
- height++;
-
- for (int j = 0; j < width; j++) {
- for (int i = 0; i < height; i++) {
- int idx = 4 + i * width + j;
- *(image + idx) = *(byte *)g_engine->_screen->getBasePtr(coordx1 + j, coordy1 + i);
- }
- }
-}
-
-void GraphicsManager::putShape(uint coordx, uint coordy, byte *image) {
- putImg(coordx, coordy, image, true);
-}
-
-void GraphicsManager::putImg(uint coordx, uint coordy, byte *image, bool transparency) {
- uint16 w, h;
-
- w = READ_LE_UINT16(image);
- h = READ_LE_UINT16(image + 2);
-
- w++;
- h++;
- for (int i = 0; i < w; i++) {
- for (int j = 0; j < h; j++) {
- int index = 4 + (j * w + i);
- if (!transparency || image[index] != 0) {
- *(byte *)g_engine->_screen->getBasePtr(coordx + i, coordy + j) = image[index];
- }
- }
- }
- g_engine->_screen->addDirtyRect(Common::Rect(coordx, coordy, coordx + w, coordy + h));
-}
-
-byte *GraphicsManager::getPalette() {
- byte *palette = (byte *)malloc(768);
- g_system->getPaletteManager()->grabPalette(palette, 0, 256);
- return palette;
-}
-
-
-// Copies the rectangle delimited by getCoord** from backgroundScreen into image
-void GraphicsManager::getImageArea(
- uint getcoordx1, // xframe
- uint getcoordy1, // yframe
- uint getcoordx2, // xframe + framewidth
- uint getcoordy2, // yframe + frameheight
- byte *backgroundScreen,
- byte *image
-) {
- uint16 w = getcoordx2 - getcoordx1;
- uint16 h = getcoordy2 - getcoordy1;
-
- WRITE_UINT16(image, w);
- WRITE_UINT16(image + 2, h);
- w++;
- h++;
- int posAbs = 4 + getcoordx1 + (getcoordy1 * 320);
-
- int sourcePtr = 0;
- byte *destPtr = 4 + image; // Start writing after width and height
-
- for (int i = 0; i < h; i++) {
- for (int j = 0; j < w; j++) {
- *destPtr++ = backgroundScreen[posAbs + sourcePtr++];
- }
- sourcePtr += (320 - w); // Move to the beginning of the next row in backgroundScreen
- }
-}
-
-// puts an image into a buffer in the given position, asuming 320 width
-void GraphicsManager::putImageArea(uint putcoordx, uint putcoordy, byte *backgroundScreen, byte *image) {
- uint16 w, h;
-
- w = READ_LE_UINT16(image);
- h = READ_LE_UINT16(image + 2);
-
- w++;
- h++;
- int posAbs = 4 + putcoordx + (putcoordy * 320);
-
- int sourcePtr = 0;
- byte *destPtr = 4 + image; // Start writing after width and height
-
- for (int i = 0; i < h; i++) {
- for (int j = 0; j < w; j++) {
- backgroundScreen[posAbs + sourcePtr++] = *destPtr++;
- }
- sourcePtr += (320 - w); // Move to the beginning of the next row in backgroundScreen
- }
-}
-
-// Debug function just to print a palette on the screen
-void GraphicsManager::printPalette() {
-
- int x = 0;
- int y = 0;
- int width = 64;
- int height = 256 / width;
- int squareHeight = 3;
- for (uint16 i = 0; i <= height; i++) {
- for (uint16 j = 0; j <= width; j++) {
- for (int k = 0; k < squareHeight; k++) {
- for (int l = 0; l < squareHeight; l++) {
- *((byte *)g_engine->_screen->getBasePtr(x + j * squareHeight + l, y + i * squareHeight + k)) = i * j;
- }
- }
- }
- }
-}
-
-void GraphicsManager::printColor(int x, int y, int color) {
- int squareHeight = 10;
- for (int k = 0; k < squareHeight; k++) {
- for (int l = 0; l < squareHeight; l++) {
- g_engine->_screen->setPixel(x + l, y + k, color);
- }
- }
-}
-
-void GraphicsManager::littText(const Common::String &str, int x, int y, uint32 color, Graphics::TextAlign align, bool alignCenterY) {
- int height = _euro.getFontHeight();
- if (alignCenterY) {
- y = y - _euro.getFontHeight() / 2 + 2;
- }
- _litt.drawString(g_engine->_screen, str, x, y, 320, color, align);
-}
-
-void GraphicsManager::euroText(const Common::String &str, int x, int y, uint32 color, Graphics::TextAlign align, bool alignCenterY) {
- if (alignCenterY) {
- y = y - _euro.getFontHeight() / 2;
- }
- _euro.drawString(g_engine->_screen, str, x, y, 320, color, align);
-}
-
-void GraphicsManager::biosText(const Common::String &str, int x, int y, uint32 color) {
- _bios->drawString(g_engine->_screen, str, x, y, 320, color, Graphics::TextAlign::kTextAlignLeft);
-}
-
-} // End of namespace Tot
diff --git a/engines/tot/graphman.h b/engines/tot/graphman.h
deleted file mode 100644
index 2dd445819b5..00000000000
--- a/engines/tot/graphman.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-#ifndef TOT_GRAPHMAN_H
-#define TOT_GRAPHMAN_H
-
-#include "common/scummsys.h"
-#include "common/system.h"
-#include "graphics/font.h"
-
-#include "tot/font/bgifont.h"
-#include "tot/font/biosfont.h"
-
-namespace Tot {
-
-class GraphicsManager {
-public:
- GraphicsManager();
- ~GraphicsManager();
-
- void printPalette();
- void fixPalette(byte *palette, uint num = 768);
- byte *getPalette();
- void setPalette(byte palette[768], uint num = 256);
-
- void restoreBackgroundArea(uint x, uint y, uint x2, uint y2);
-
-
- void putImg(uint coordx, uint coordy, byte *image, bool transparency = false);
- void getImg(uint coordx1, uint coordy1, uint coordx2, uint coordy2, byte *image);
- void putShape(uint coordx, uint coordy, byte *image);
- void putImageArea(uint putcoordx, uint putcoordy, byte *backgroundScreen, byte *image);
- void getImageArea(uint getcoordx1, uint getcoordy1, uint getcoordx2, uint getcoordy2, byte *backgroundScreen, byte *image);
-
-
- void littText(const Common::String &str, int x, int y, uint32 color, Graphics::TextAlign align = Graphics::kTextAlignLeft, bool alignCenterY = false);
- void euroText(const Common::String &str, int x, int y, uint32 color, Graphics::TextAlign align = Graphics::kTextAlignLeft, bool alignCenterY = false);
- void biosText(const Common::String &str, int x, int y, uint32 color);
-
- void clear();
-
- void clearActionLine();
- void writeActionLine(const Common::String &str);
-
- void printColor(int x, int y, int color);
- Graphics::BgiFont _litt;
- Graphics::BgiFont _euro;
- Graphics::Font *_bios;
-
-private:
- signed char fadeData[256][256];
-};
-
-} // End of namespace Tot
-#endif
diff --git a/engines/tot/module.mk b/engines/tot/module.mk
index ba837d31769..d47e073e2da 100644
--- a/engines/tot/module.mk
+++ b/engines/tot/module.mk
@@ -7,7 +7,6 @@ MODULE_OBJS = \
forest.o \
util.o \
vars.o \
- graphics.o \
anims.o \
routines2.o \
routines.o \
@@ -17,7 +16,7 @@ MODULE_OBJS = \
font/biosfont.o \
decoder/TotFlicDecoder.o \
sound.o \
- graphman.o \
+ graphics.o \
mouse.o \
chrono.o \
saveload.o \
diff --git a/engines/tot/routines.cpp b/engines/tot/routines.cpp
index 70a58ce907b..c18e48001d2 100644
--- a/engines/tot/routines.cpp
+++ b/engines/tot/routines.cpp
@@ -116,16 +116,16 @@ void runaroundRed() {
isPaletteAnimEnabled = 0;
else
isPaletteAnimEnabled += 1;
- updatePalette(isPaletteAnimEnabled);
+ g_engine->_graphics->updatePalette(isPaletteAnimEnabled);
} else
palAnimStep += 1;
g_engine->_screen->update();
}
} while (!exitLoop && !g_engine->shouldQuit());
freeAnimation();
- restoreBackground();
+ g_engine->_graphics->restoreBackground();
assembleScreen();
- drawScreen(sceneBackground);
+ g_engine->_graphics->drawScreen(sceneBackground);
}
void updateMovementGrids() {
@@ -179,7 +179,7 @@ static void assembleBackground() {
// copies the entire clean background in backgroundCopy back into background
- restoreBackground();
+ g_engine->_graphics->restoreBackground();
posabs = 4 + dirtyMainSpriteY * 320 + dirtyMainSpriteX;
uint16 w, h;
@@ -267,7 +267,7 @@ void drawMainCharacter() {
bool debug = false;
if (debug) {
- sceneTransition(13, false, sceneBackground);
+ g_engine->_graphics->sceneTransition(13, false, sceneBackground);
}
uint16 tempW;
@@ -425,7 +425,7 @@ void adjustKey() {
isPaletteAnimEnabled = 0;
else
isPaletteAnimEnabled += 1;
- updatePalette(isPaletteAnimEnabled);
+ g_engine->_graphics->updatePalette(isPaletteAnimEnabled);
} else
palAnimStep += 1;
sprites(true);
@@ -453,7 +453,7 @@ void adjustKey2() {
isPaletteAnimEnabled = 0;
else
isPaletteAnimEnabled += 1;
- updatePalette(isPaletteAnimEnabled);
+ g_engine->_graphics->updatePalette(isPaletteAnimEnabled);
} else
palAnimStep += 1;
sprites(true);
@@ -485,7 +485,7 @@ void animatedSequence(uint numSequence) {
secFrameCount = animationFile.readByte();
animationFile.readByte();
animptr = (byte *)malloc(animFrameSize);
- for (uint loopIdx = 1; loopIdx <= 3; repIndex++) {
+ for (uint loopIdx = 1; loopIdx <= 3; loopIdx++) {
g_engine->_sound->playVoc("POZO", 180395, 6034);
animIndex = 0;
do {
@@ -626,20 +626,20 @@ void animatedSequence(uint numSequence) {
isPaletteAnimEnabled = 0;
else
isPaletteAnimEnabled += 1;
- updatePalette(isPaletteAnimEnabled);
+ g_engine->_graphics->updatePalette(isPaletteAnimEnabled);
} else
palAnimStep += 1;
g_engine->_graphics->putShape(animX, animY, animptr);
}
screenLayers[regobj.depth - 1] = NULL;
- restoreBackground();
+ g_engine->_graphics->restoreBackground();
animIndex = mainCharAnimation.depth;
mainCharAnimation.depth = 30;
screenLayers[13] = animptr;
depthMap[13].posx = animX;
depthMap[13].posy = animY;
assembleScreen();
- drawScreen(sceneBackground);
+ g_engine->_graphics->drawScreen(sceneBackground);
screenLayers[13] = NULL;
mainCharAnimation.depth = animIndex;
drawBackpack();
@@ -653,7 +653,7 @@ void animatedSequence(uint numSequence) {
isPaletteAnimEnabled = 0;
else
isPaletteAnimEnabled += 1;
- updatePalette(isPaletteAnimEnabled);
+ g_engine->_graphics->updatePalette(isPaletteAnimEnabled);
} else
palAnimStep += 1;
g_engine->_graphics->putImg(animX, animY, animptr);
@@ -692,7 +692,7 @@ void animatedSequence(uint numSequence) {
disableSecondAnimation();
screenLayers[12] = NULL;
mainCharAnimation.depth = animIndex;
- drawScreen(sceneBackground);
+ g_engine->_graphics->drawScreen(sceneBackground);
for (animIndex = 9; animIndex <= secFrameCount; animIndex++) {
animationFile.read(animptr, animFrameSize);
emptyLoop();
@@ -733,15 +733,15 @@ void animatedSequence(uint numSequence) {
isPaletteAnimEnabled = 0;
else
isPaletteAnimEnabled += 1;
- updatePalette(isPaletteAnimEnabled);
+ g_engine->_graphics->updatePalette(isPaletteAnimEnabled);
} else
palAnimStep += 1;
if (gameTickHalfSpeed) {
animationFile.read(screenLayers[6], animFrameSize);
Common::copy(screenLayers[6], screenLayers[6] + animFrameSize, sceneBackground + 44900);
- restoreBackground();
+ g_engine->_graphics->restoreBackground();
assembleScreen();
- drawScreen(sceneBackground);
+ g_engine->_graphics->drawScreen(sceneBackground);
animIndex += 1;
if (animIndex == 8)
g_engine->_sound->playVoc("PUFF", 191183, 18001);
@@ -944,10 +944,10 @@ void lookAtObject(byte objectCode) {
cpCounter2 = cpCounter;
g_engine->_mouseManager->hide();
- copyPalette(pal, secPalette);
+ g_engine->_graphics->copyPalette(pal, secPalette);
readItemRegister(inventory[objectCode].code);
g_engine->_graphics->getImg(0, 0, 319, 139, sceneBackground);
- partialFadeOut(234);
+ g_engine->_graphics->partialFadeOut(234);
bar(0, 0, 319, 139, 0);
for (yaux = 1; yaux <= 12; yaux++)
buttonBorder(
@@ -995,12 +995,12 @@ void lookAtObject(byte objectCode) {
drawFlc(125, 70, regobj.rotatingObjectAnimation, 60000, 9, 0, false, true, true, foobar);
- sceneTransition(3, true, NULL);
- partialFadeOut(234);
+ g_engine->_graphics->sceneTransition(3, true, NULL);
+ g_engine->_graphics->partialFadeOut(234);
assembleScreen();
- drawScreen(sceneBackground);
- copyPalette(secPalette, pal);
- partialFadeIn(234);
+ g_engine->_graphics->drawScreen(sceneBackground);
+ g_engine->_graphics->copyPalette(secPalette, pal);
+ g_engine->_graphics->partialFadeIn(234);
g_engine->_mouseManager->show();
}
@@ -1335,7 +1335,7 @@ void advanceAnimations(bool barredZone, bool animateMouse) {
isPaletteAnimEnabled += 1;
if (currentRoomData->code == 4 && isPaletteAnimEnabled == 4)
g_engine->_sound->playVoc();
- updatePalette(isPaletteAnimEnabled);
+ g_engine->_graphics->updatePalette(isPaletteAnimEnabled);
} else {
palAnimStep += 1;
}
@@ -1360,7 +1360,7 @@ void animateGive(uint dir, uint height) {
isPaletteAnimEnabled = 0;
else
isPaletteAnimEnabled += 1;
- updatePalette(isPaletteAnimEnabled);
+ g_engine->_graphics->updatePalette(isPaletteAnimEnabled);
} else
palAnimStep += 1;
sprites(true);
@@ -1382,7 +1382,7 @@ void animatePickup1(uint dir, uint height) {
isPaletteAnimEnabled = 0;
else
isPaletteAnimEnabled += 1;
- updatePalette(isPaletteAnimEnabled);
+ g_engine->_graphics->updatePalette(isPaletteAnimEnabled);
} else
palAnimStep += 1;
sprites(true);
@@ -1406,7 +1406,7 @@ void animatePickup2(uint dir, uint height) {
isPaletteAnimEnabled = 0;
else
isPaletteAnimEnabled += 1;
- updatePalette(isPaletteAnimEnabled);
+ g_engine->_graphics->updatePalette(isPaletteAnimEnabled);
} else
palAnimStep += 1;
sprites(true);
@@ -1432,7 +1432,7 @@ void animateOpen2(uint dir, uint height) {
isPaletteAnimEnabled = 0;
else
isPaletteAnimEnabled += 1;
- updatePalette(isPaletteAnimEnabled);
+ g_engine->_graphics->updatePalette(isPaletteAnimEnabled);
} else
palAnimStep += 1;
sprites(true);
@@ -1504,7 +1504,7 @@ void animateBat() {
isPaletteAnimEnabled = 0;
else
isPaletteAnimEnabled += 1;
- updatePalette(isPaletteAnimEnabled);
+ g_engine->_graphics->updatePalette(isPaletteAnimEnabled);
} else
palAnimStep += 1;
}
@@ -1525,16 +1525,16 @@ void animateBat() {
secondaryAnimation.depth = curAnimDepth;
secondaryAnimation.dir = curAnimDir;
}
- restoreBackground();
+ g_engine->_graphics->restoreBackground();
assembleScreen();
- drawScreen(sceneBackground);
+ g_engine->_graphics->drawScreen(sceneBackground);
}
void updateVideo() {
readBitmap(regobj.dropOverlay, screenLayers[regobj.depth - 1], regobj.dropOverlaySize, 319);
- restoreBackground();
+ g_engine->_graphics->restoreBackground();
assembleScreen();
- drawScreen(sceneBackground);
+ g_engine->_graphics->drawScreen(sceneBackground);
}
void nicheAnimation(byte nicheDir, int32 bitmap) {
@@ -1578,21 +1578,21 @@ void nicheAnimation(byte nicheDir, int32 bitmap) {
// Set the height to double to animate 2 images of the same height moving up/down
*(sceneBackground + 44900 + 2) = (nicheHeight * 2) + 1;
- restoreBackground();
+ g_engine->_graphics->restoreBackground();
for (uint i = 1; i <= nicheHeight; i++) {
bitmapOffset = bitmapOffset + (increment * (nicheWidth + 1));
Common::copy(sceneBackground + bitmapOffset, sceneBackground + bitmapOffset + 888, screenLayers[0] + 4);
assembleScreen();
- drawScreen(sceneBackground);
+ g_engine->_graphics->drawScreen(sceneBackground);
g_engine->_screen->update();
}
readBitmap(bitmap, screenLayers[0], 892, 319);
- restoreBackground();
+ g_engine->_graphics->restoreBackground();
assembleScreen();
- drawScreen(sceneBackground);
+ g_engine->_graphics->drawScreen(sceneBackground);
if (currentRoomData->code == 24) {
free(screenLayers[1]);
@@ -1651,9 +1651,9 @@ void pickupScreenObject() {
default: {
animatePickup1(charFacingDirection, 0);
screenLayers[regobj.depth - 1] = NULL;
- restoreBackground();
+ g_engine->_graphics->restoreBackground();
assembleScreen();
- drawScreen(sceneBackground);
+ g_engine->_graphics->drawScreen(sceneBackground);
animatePickup2(charFacingDirection, 0);
}
}
@@ -1710,10 +1710,10 @@ void pickupScreenObject() {
loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
screenLayers[regobj.depth - 1] = NULL;
- restoreBackground();
+ g_engine->_graphics->restoreBackground();
assembleScreen();
- drawScreen(sceneBackground);
+ g_engine->_graphics->drawScreen(sceneBackground);
animatePickup2(0, 1);
} break;
case 562: { // niche
@@ -1732,9 +1732,9 @@ void pickupScreenObject() {
currentRoomData->screenLayers[1].coordx = 66;
currentRoomData->screenLayers[1].coordy = 35;
currentRoomData->screenLayers[1].depth = 1;
- restoreBackground();
+ g_engine->_graphics->restoreBackground();
assembleScreen();
- drawScreen(sceneBackground);
+ g_engine->_graphics->drawScreen(sceneBackground);
animatePickup2(3, 1);
} else {
readItemRegister(niche[0][niche[0][3]]);
@@ -1745,9 +1745,9 @@ void pickupScreenObject() {
animatePickup1(3, 1);
readBitmap(1190768, screenLayers[regobj.depth - 1],
892, 319);
- restoreBackground();
+ g_engine->_graphics->restoreBackground();
assembleScreen();
- drawScreen(sceneBackground);
+ g_engine->_graphics->drawScreen(sceneBackground);
animatePickup2(3, 1);
g_engine->_sound->playVoc("PLATAF", 375907, 14724);
currentRoomData->screenLayers[1].bitmapSize = 892;
@@ -1799,9 +1799,9 @@ void pickupScreenObject() {
currentRoomData->screenLayers[0].coordx = 217;
currentRoomData->screenLayers[0].coordy = 48;
currentRoomData->screenLayers[0].depth = 1;
- restoreBackground();
+ g_engine->_graphics->restoreBackground();
assembleScreen();
- drawScreen(sceneBackground);
+ g_engine->_graphics->drawScreen(sceneBackground);
animatePickup2(0, 1);
} else {
readItemRegister(niche[1][niche[1][3]]);
@@ -1811,9 +1811,9 @@ void pickupScreenObject() {
currentRoomData->screenObjectIndex[8]->objectName = " ";
animatePickup1(0, 1);
readBitmap(1399610, screenLayers[0], 892, 319);
- restoreBackground();
+ g_engine->_graphics->restoreBackground();
assembleScreen();
- drawScreen(sceneBackground);
+ g_engine->_graphics->drawScreen(sceneBackground);
animatePickup2(0, 1);
g_engine->_sound->playVoc("PLATAF", 375907, 14724);
currentRoomData->screenLayers[0].bitmapSize = 892;
@@ -1871,7 +1871,7 @@ void pickupScreenObject() {
}
screenLayers[3] = NULL;
disableSecondAnimation();
- drawScreen(sceneBackground);
+ g_engine->_graphics->drawScreen(sceneBackground);
animatePickup2(2, 1);
isRedDevilCaptured = true;
isTrapSet = false;
@@ -1879,9 +1879,9 @@ void pickupScreenObject() {
default: {
animatePickup1(charFacingDirection, 1);
screenLayers[regobj.depth - 1] = NULL;
- restoreBackground();
+ g_engine->_graphics->restoreBackground();
assembleScreen();
- drawScreen(sceneBackground);
+ g_engine->_graphics->drawScreen(sceneBackground);
animatePickup2(charFacingDirection, 1);
}
}
@@ -1931,16 +1931,16 @@ void pickupScreenObject() {
with.depth = 3;
loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
- restoreBackground();
+ g_engine->_graphics->restoreBackground();
assembleScreen();
- drawScreen(sceneBackground);
+ g_engine->_graphics->drawScreen(sceneBackground);
animatePickup2(3, 2);
} break;
default: {
animatePickup1(charFacingDirection, 2);
screenLayers[regobj.depth - 1] = NULL;
assembleScreen();
- drawScreen(sceneBackground);
+ g_engine->_graphics->drawScreen(sceneBackground);
animatePickup2(charFacingDirection, 2);
}
}
@@ -2568,7 +2568,7 @@ void useScreenObject() {
sprites(true);
} while (currentSecondaryTrajectoryIndex != currentRoomData->secondaryTrajectoryLength);
disableSecondAnimation();
- drawScreen(sceneBackground);
+ g_engine->_graphics->drawScreen(sceneBackground);
g_engine->_mouseManager->show();
} break;
case 201: {
@@ -2598,7 +2598,7 @@ void useScreenObject() {
isPaletteAnimEnabled = 0;
else
isPaletteAnimEnabled += 1;
- updatePalette(isPaletteAnimEnabled);
+ g_engine->_graphics->updatePalette(isPaletteAnimEnabled);
} else
palAnimStep += 1;
gameTick = false;
@@ -2609,7 +2609,7 @@ void useScreenObject() {
animateOpen2(3, 2);
updateItem(regobj.code);
disableSecondAnimation();
- drawScreen(sceneBackground);
+ g_engine->_graphics->drawScreen(sceneBackground);
g_engine->_mouseManager->show();
drawText(2652);
g_engine->_mouseManager->hide();
@@ -2761,9 +2761,9 @@ void useScreenObject() {
currentRoomData->screenLayers[1].coordx = 66;
currentRoomData->screenLayers[1].coordy = 35;
currentRoomData->screenLayers[1].depth = 1;
- restoreBackground();
+ g_engine->_graphics->restoreBackground();
assembleScreen();
- drawScreen(sceneBackground);
+ g_engine->_graphics->drawScreen(sceneBackground);
animateOpen2(3, 1);
updateInventory(usedObjectIndex);
drawBackpack();
@@ -2784,9 +2784,9 @@ void useScreenObject() {
readBitmap(1181760, screenLayers[0], 892, 319);
break;
}
- restoreBackground();
+ g_engine->_graphics->restoreBackground();
assembleScreen();
- drawScreen(sceneBackground);
+ g_engine->_graphics->drawScreen(sceneBackground);
animateOpen2(3, 1);
updateInventory(usedObjectIndex);
drawBackpack();
@@ -2851,9 +2851,9 @@ void useScreenObject() {
currentRoomData->screenLayers[0].coordx = 217;
currentRoomData->screenLayers[0].coordy = 48;
currentRoomData->screenLayers[0].depth = 1;
- restoreBackground();
+ g_engine->_graphics->restoreBackground();
assembleScreen();
- drawScreen(sceneBackground);
+ g_engine->_graphics->drawScreen(sceneBackground);
animateOpen2(0, 1);
updateInventory(usedObjectIndex);
drawBackpack();
@@ -2877,9 +2877,9 @@ void useScreenObject() {
892, 319);
break;
}
- restoreBackground();
+ g_engine->_graphics->restoreBackground();
assembleScreen();
- drawScreen(sceneBackground);
+ g_engine->_graphics->drawScreen(sceneBackground);
animateOpen2(0, 1);
updateInventory(usedObjectIndex);
drawBackpack();
@@ -2970,9 +2970,9 @@ void useScreenObject() {
loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
readBitmap(1243652, screenLayers[5], 2718, 319);
- restoreBackground();
+ g_engine->_graphics->restoreBackground();
assembleScreen();
- drawScreen(sceneBackground);
+ g_engine->_graphics->drawScreen(sceneBackground);
} break;
case 594: {
drawText(regobj.useTextRef);
@@ -2999,9 +2999,9 @@ void useScreenObject() {
with.depth = 4;
loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
- restoreBackground();
+ g_engine->_graphics->restoreBackground();
assembleScreen();
- drawScreen(sceneBackground);
+ g_engine->_graphics->drawScreen(sceneBackground);
updateInventory(usedObjectIndex);
drawBackpack();
isTrapSet = true;
@@ -3015,9 +3015,9 @@ void useScreenObject() {
// Show feather on pedestal
loadItem(187, 70, 104, 1545820, 8);
- restoreBackground();
+ g_engine->_graphics->restoreBackground();
assembleScreen();
- drawScreen(sceneBackground);
+ g_engine->_graphics->drawScreen(sceneBackground);
g_engine->_screen->update();
animateOpen2(charFacingDirection, 1);
@@ -3045,9 +3045,9 @@ void useScreenObject() {
currentRoomData->screenLayers[4].depth = 8;
loadItem(186, 63, 464, 1447508, 8);
- restoreBackground();
+ g_engine->_graphics->restoreBackground();
assembleScreen();
- drawScreen(sceneBackground);
+ g_engine->_graphics->drawScreen(sceneBackground);
g_engine->_mouseManager->show();
goToObject(currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount], 18);
g_engine->_mouseManager->hide();
@@ -3059,9 +3059,9 @@ void useScreenObject() {
currentRoomData->screenLayers[4].coordy = 0;
currentRoomData->screenLayers[4].depth = 0;
screenLayers[7] = NULL;
- restoreBackground();
+ g_engine->_graphics->restoreBackground();
assembleScreen();
- drawScreen(sceneBackground);
+ g_engine->_graphics->drawScreen(sceneBackground);
animatePickup2(1, 1);
drawBackpack();
g_engine->_mouseManager->show();
@@ -3079,9 +3079,9 @@ void useScreenObject() {
g_engine->_mouseManager->hide();
animateGive(3, 1);
loadItem(86, 55, 92, 1591272, 8);
- restoreBackground();
+ g_engine->_graphics->restoreBackground();
assembleScreen();
- drawScreen(sceneBackground);
+ g_engine->_graphics->drawScreen(sceneBackground);
animateOpen2(3, 1);
g_engine->_mouseManager->show();
goToObject(currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount], 10);
@@ -3105,7 +3105,7 @@ void useScreenObject() {
currentRoomData->screenLayers[4].depth = 8;
loadItem(82, 53, 384, 1746554, 8);
assembleScreen();
- drawScreen(sceneBackground);
+ g_engine->_graphics->drawScreen(sceneBackground);
g_engine->_mouseManager->show();
goToObject(currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount], 15);
g_engine->_mouseManager->hide();
@@ -3117,9 +3117,9 @@ void useScreenObject() {
currentRoomData->screenLayers[4].coordy = 0;
currentRoomData->screenLayers[4].depth = 0;
screenLayers[7] = NULL;
- restoreBackground();
+ g_engine->_graphics->restoreBackground();
assembleScreen();
- drawScreen(sceneBackground);
+ g_engine->_graphics->drawScreen(sceneBackground);
animatePickup2(3, 1);
drawBackpack();
g_engine->_mouseManager->show();
@@ -3184,9 +3184,9 @@ void useScreenObject() {
animateGive(1, 1);
updateInventory(usedObjectIndex);
dropObjectInScreen(regobj);
- restoreBackground();
+ g_engine->_graphics->restoreBackground();
assembleScreen();
- drawScreen(sceneBackground);
+ g_engine->_graphics->drawScreen(sceneBackground);
drawBackpack();
animateOpen2(1, 1);
for (listIndex = 19; listIndex <= 21; listIndex++)
@@ -3205,9 +3205,9 @@ void useScreenObject() {
drawFlc(110, 79, offset, 0, 9, 0, false, false, true, foobar);
replaceBackpack(usedObjectIndex, 701);
drawBackpack();
- restoreBackground();
+ g_engine->_graphics->restoreBackground();
assembleScreen();
- drawScreen(sceneBackground);
+ g_engine->_graphics->drawScreen(sceneBackground);
g_engine->_mouseManager->show();
for (listIndex = 18; listIndex <= 20; listIndex++)
currentRoomData->mouseGrid[listIndex][26] = 10;
@@ -3276,9 +3276,9 @@ void useScreenObject() {
with.depth = 1;
loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
- restoreBackground();
+ g_engine->_graphics->restoreBackground();
assembleScreen();
- drawScreen(sceneBackground);
+ g_engine->_graphics->drawScreen(sceneBackground);
g_engine->_sound->waitForSoundEnd();
g_engine->_sound->playVoc("PUFF", 191183, 18001);
@@ -3373,7 +3373,7 @@ void useScreenObject() {
animateOpen2(0, 0);
g_engine->_sound->stopVoc();
g_engine->_sound->autoPlayVoc("CALDERA", 6433, 15386);
- turnLightOn();
+ g_engine->_graphics->turnLightOn();
g_engine->_mouseManager->show();
currentRoomData->palettePointer = 1536;
currentRoomData->screenObjectIndex[1]->fileIndex = 424;
@@ -3487,9 +3487,9 @@ void openScreenObject() {
currentRoomData->screenLayers[yIndex].coordy = 0;
currentRoomData->screenLayers[yIndex].depth = 0;
currentRoomData->doors[2].openclosed = 1;
- restoreBackground();
+ g_engine->_graphics->restoreBackground();
assembleScreen();
- drawScreen(sceneBackground);
+ g_engine->_graphics->drawScreen(sceneBackground);
animateOpen2(0, 1);
g_engine->_mouseManager->show();
for (yIndex = 0; yIndex <= 12; yIndex++)
@@ -3522,9 +3522,9 @@ void openScreenObject() {
currentRoomData->screenLayers[yIndex].coordy = 0;
currentRoomData->screenLayers[yIndex].depth = 0;
currentRoomData->doors[0].openclosed = 1;
- restoreBackground();
+ g_engine->_graphics->restoreBackground();
assembleScreen();
- drawScreen(sceneBackground);
+ g_engine->_graphics->drawScreen(sceneBackground);
animateOpen2(1, 1);
g_engine->_mouseManager->show();
xIndex = 30;
@@ -3901,7 +3901,7 @@ static void scrollRight(uint &horizontalPos) {
characterPosX -= 4;
g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
g_engine->_screen->update();
- drawScreen(sceneBackground);
+ g_engine->_graphics->drawScreen(sceneBackground);
}
free(assembledCharacterFrame);
}
@@ -3953,7 +3953,7 @@ static void scrollLeft(uint &horizontalPos) {
g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
g_engine->_screen->update();
- drawScreen(sceneBackground);
+ g_engine->_graphics->drawScreen(sceneBackground);
}
free(assembledCharacterFrame);
}
@@ -3964,7 +3964,7 @@ static void scrollLeft(uint &horizontalPos) {
*/
void loadScrollData(uint roomCode, bool rightScroll, uint horizontalPos, int scrollCorrection) {
- restoreBackground();
+ g_engine->_graphics->restoreBackground();
// background now contains background A, backgroundCopy contains background A
uint characterFrameW = READ_LE_UINT16(curCharacterAnimationFrame);
@@ -4000,7 +4000,7 @@ void loadScrollData(uint roomCode, bool rightScroll, uint horizontalPos, int scr
getScreen(sceneBackground);
// background now contains full background A again, backgroundCopy contains background B + objects
- drawScreen(sceneBackground);
+ g_engine->_graphics->drawScreen(sceneBackground);
if (rightScroll)
scrollRight(horizontalPos);
else
@@ -4012,7 +4012,7 @@ void loadScrollData(uint roomCode, bool rightScroll, uint horizontalPos, int scr
characterPosX += scrollCorrection;
assembleScreen();
- drawScreen(sceneBackground);
+ g_engine->_graphics->drawScreen(sceneBackground);
free(spriteBackground);
loadScreen();
trajectory[currentTrajectoryIndex].x = characterPosX;
@@ -4205,9 +4205,9 @@ void loadGame(SavedGame game) {
niche[1][i] = game.niche[1][i];
}
- totalFadeOut(0);
+ g_engine->_graphics->totalFadeOut(0);
g_engine->_screen->clear();
- loadPalette("DEFAULT");
+ g_engine->_graphics->loadPaletteFromFile("DEFAULT");
loadScreenData(game.roomCode);
switch (currentRoomData->code) {
@@ -4301,7 +4301,7 @@ void loadGame(SavedGame game) {
drawBackpack();
if (isRedDevilCaptured == false && currentRoomData->code == 24 && isTrapSet == false)
runaroundRed();
- sceneTransition(transitionEffect, false, sceneBackground);
+ g_engine->_graphics->sceneTransition(transitionEffect, false, sceneBackground);
}
/**
@@ -4647,7 +4647,7 @@ void hypertext(
isPaletteAnimEnabled += 1;
if (currentRoomData->code == 4 && isPaletteAnimEnabled == 4)
g_engine->_sound->playVoc();
- updatePalette(isPaletteAnimEnabled);
+ g_engine->_graphics->updatePalette(isPaletteAnimEnabled);
} else
palAnimStep += 1;
}
@@ -4669,10 +4669,10 @@ void wcScene() {
currentZone = currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount];
goToObject(currentZone, targetZone);
- copyPalette(pal, wcPalette);
+ g_engine->_graphics->copyPalette(pal, wcPalette);
g_engine->_mouseManager->hide();
- partialFadeOut(234);
+ g_engine->_graphics->partialFadeOut(234);
const char *const *messages = (g_engine->_lang == Common::ES_ESP) ? fullScreenMessages[0] : fullScreenMessages[1];
@@ -4703,11 +4703,11 @@ void wcScene() {
characterPosX = 76 - characterCorrectionX;
characterPosY = 78 - characerCorrectionY;
- copyPalette(wcPalette, pal);
- restoreBackground();
+ g_engine->_graphics->copyPalette(wcPalette, pal);
+ g_engine->_graphics->restoreBackground();
assembleScreen();
- drawScreen(sceneBackground);
- partialFadeIn(234);
+ g_engine->_graphics->drawScreen(sceneBackground);
+ g_engine->_graphics->partialFadeIn(234);
xframe2 = 0;
currentTrajectoryIndex = 0;
trajectoryLength = 1;
diff --git a/engines/tot/routines.h b/engines/tot/routines.h
index 77213cba58e..f479fc33daf 100644
--- a/engines/tot/routines.h
+++ b/engines/tot/routines.h
@@ -24,7 +24,6 @@
#include "common/scummsys.h"
#include "tot/anims.h"
-#include "tot/graphics.h"
#include "tot/vars.h"
#include "tot/routines2.h"
#include "tot/util.h"
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
index 88dec6fbfba..2928cfd8635 100644
--- a/engines/tot/routines2.cpp
+++ b/engines/tot/routines2.cpp
@@ -46,7 +46,7 @@ void loadScreenMemory() {
void loadAnimationForDirection(Common::SeekableReadStream *stream, int direction) {
for (int j = 0; j < secondaryAnimationFrameCount; j++) {
- loadAnimationIntoBuffer(stream, secondaryAnimation.bitmap[direction][j], secondaryAnimFrameSize);
+ g_engine->_graphics->loadAnimationIntoBuffer(stream, secondaryAnimation.bitmap[direction][j], secondaryAnimFrameSize);
}
}
@@ -268,7 +268,7 @@ void loadScreen() {
g_system->getPaletteManager()->setPalette(pal, 0, 201);
} break;
case 2: {
- loadPalette("SEGUNDA");
+ g_engine->_graphics->loadPaletteFromFile("SEGUNDA");
currentRoomData->paletteAnimationFlag = true;
} break;
}
@@ -601,7 +601,7 @@ static void loadDiploma(Common::String &photoName, Common::String &key) {
stamp = (byte *)malloc(2054);
dipFile.read(stamp, 2054);
dipFile.close();
- drawFullScreen(screen);
+ g_engine->_graphics->drawFullScreen(screen);
free(screen);
@@ -620,7 +620,7 @@ static void loadDiploma(Common::String &photoName, Common::String &key) {
auxPal[i * 3 + 2] = pal[i * 3 + 2];
}
- copyPalette(auxPal, pal);
+ g_engine->_graphics->copyPalette(auxPal, pal);
g_engine->_graphics->fixPalette(pal, 768);
g_engine->_graphics->setPalette(pal);
g_engine->_screen->markAllDirty();
@@ -663,7 +663,7 @@ static void saveDiploma(Common::String &photoName, Common::String &key) {
if (photoName != "")
name = "tot-diploma-" + photoName + ".png";
else
- "tot-diploma-default.png";
+ name = "tot-diploma-default.png";
Common::OutSaveFile *thumbnail = g_engine->getSaveFileManager()->openForSaving(name);
Graphics::Surface *surface = g_system->lockScreen();
assert(surface);
@@ -677,7 +677,7 @@ void generateDiploma(Common::String &photoName) {
Common::String key;
g_engine->_mouseManager->hide();
photoName.toUppercase();
- totalFadeOut(0);
+ g_engine->_graphics->totalFadeOut(0);
loadDiploma(photoName, key);
Common::Event e;
@@ -1022,7 +1022,7 @@ void drawCreditsScreen(byte *&backgroundPointer, uint &sizeAuxBG, byte *&auxBG)
ppFile.read(backgroundPointer, 64000);
ppFile.close();
- drawFullScreen(backgroundPointer);
+ g_engine->_graphics->drawFullScreen(backgroundPointer);
sizeAuxBG = imagesize(0, 0, 319, 59);
@@ -1040,8 +1040,8 @@ void drawCreditsScreen(byte *&backgroundPointer, uint &sizeAuxBG, byte *&auxBG)
intermediatePalette[i * 3 + 2] = intermediatePalette[i * 3 + 2] << 2;
}
- changePalette(darkPalette, intermediatePalette);
- copyPalette(intermediatePalette, pal);
+ g_engine->_graphics->fadePalettes(darkPalette, intermediatePalette);
+ g_engine->_graphics->copyPalette(intermediatePalette, pal);
if (cpCounter2 > 9)
showError(274);
}
@@ -1161,7 +1161,7 @@ void scrollCredit(
pal[i * 3 + 2] = pal2[i * 3 + 2];
}
- changeRGBBlock(16, 240, &pal[16 * 3 + 0]);
+ g_engine->_graphics->setPalette(&pal[16 * 3 + 0], 16, 240);
Common::Event e;
bool keyPressed = false;
@@ -1183,7 +1183,7 @@ void scrollCredit(
break;
}
if (refresh) {
- copyFromScreen(background);
+ g_engine->_graphics->copyFromScreen(background);
}
}
@@ -1246,8 +1246,6 @@ inline bool keyPressed() {
}
void credits() {
- Common::String n = "Gabriel";
- generateDiploma(n);
saveAllowed = true;
debug("Credits");
palette pal2;
@@ -1257,7 +1255,7 @@ void credits() {
bool exit;
g_engine->_mouseManager->hide();
- totalFadeOut(0);
+ g_engine->_graphics->totalFadeOut(0);
g_engine->_sound->fadeOutMusic(musicVolLeft, musicVolRight);
g_engine->_screen->clear();
g_engine->_sound->playMidi("CREDITOS", true);
@@ -1295,7 +1293,7 @@ void credits() {
g_engine->_graphics->putImg(0, 0, background2);
if (keyPressed() || exit)
goto Lexit;
- copyFromScreen(background);
+ g_engine->_graphics->copyFromScreen(background);
if (keyPressed() || exit)
goto Lexit;
scrollCredit(59904, 8004, pal2, background, exit, 10, false, true);
@@ -1325,13 +1323,13 @@ void credits() {
g_engine->_graphics->putImg(0, 0, background2);
if (keyPressed() || exit)
goto Lexit;
- copyFromScreen(background);
+ g_engine->_graphics->copyFromScreen(background);
if (keyPressed() || exit)
goto Lexit;
scrollCredit(121308, 8004, pal2, background, exit, 80, false, true);
Lexit:
delay(1000);
- totalFadeOut(0);
+ g_engine->_graphics->totalFadeOut(0);
g_engine->_sound->fadeOutMusic(musicVolLeft, musicVolRight);
g_engine->_screen->clear();
g_engine->_sound->playMidi("INTRODUC", true);
@@ -1350,7 +1348,7 @@ void introduction() {
const char *const *messages = (isSpanish) ? fullScreenMessages[0] : fullScreenMessages[1];
const long *offsets = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0] : flcOffsets[1];
exitPressed = false;
- totalFadeOut(0);
+ g_engine->_graphics->totalFadeOut(0);
if (cpCounter > 6)
showError(270);
@@ -1361,7 +1359,7 @@ void introduction() {
drawFlc(135, 54, offsets[3], 0, 9, 2, true, true, false, exitPressed);
if (exitPressed)
goto Lsalirpres;
- totalFadeOut(0);
+ g_engine->_graphics->totalFadeOut(0);
g_engine->_screen->clear();
if(isSpanish) {
littText(25, 20, messages[0], 253);
@@ -1385,7 +1383,7 @@ void introduction() {
if(g_engine->shouldQuit()){
return;
}
- totalFadeIn(0, "DEFAULT");
+ g_engine->_graphics->totalFadeIn(0, "DEFAULT");
g_engine->_screen->markAllDirty();
g_engine->_screen->update();
loopCount = 0;
@@ -1404,7 +1402,7 @@ void introduction() {
g_system->delayMillis(10);
} while (loopCount < 180 && !g_engine->shouldQuit());
- totalFadeOut(0);
+ g_engine->_graphics->totalFadeOut(0);
g_engine->_screen->clear();
drawFlc(0, 0, offsets[4], 0, 9, 3, true, true, false, exitPressed);
if (exitPressed)
@@ -1466,7 +1464,7 @@ void introduction() {
delay(1000);
Lsalirpres:
debug("Exiting intro!");
- totalFadeOut(0);
+ g_engine->_graphics->totalFadeOut(0);
g_engine->_screen->clear();
g_engine->_mouseManager->show();
}
@@ -1531,7 +1529,7 @@ void initialMenu(bool fade) {
}
} else if (y > 140 && y < 155) {
if (x > 173 && x < 292) {
- totalFadeOut(0);
+ g_engine->_graphics->totalFadeOut(0);
g_engine->_screen->clear();
introduction();
drawFlc(0, 0, offset, 0, 9, 0, true, false, false, bar);
@@ -1909,15 +1907,15 @@ void sacrificeScene() {
}
// We dont have the width and height here in the byte buffer
- drawScreen(sceneBackground, false);
- partialFadeIn(234);
+ g_engine->_graphics->drawScreen(sceneBackground, false);
+ g_engine->_graphics->partialFadeIn(234);
g_engine->_sound->stopVoc();
if (g_engine->shouldQuit())
return;
drawFlc(0, 0, offsets[17], 0, 9, 19, false, false, true, exitPressed);
- totalFadeOut(128);
+ g_engine->_graphics->totalFadeOut(128);
g_engine->_sound->stopVoc();
delay(1000);
if (g_engine->shouldQuit())
@@ -1975,13 +1973,13 @@ void sacrificeScene() {
file.read(sceneBackground, 64000);
file.close();
- drawFullScreen(sceneBackground);
+ g_engine->_graphics->drawFullScreen(sceneBackground);
palaux[0] = 0;
palaux[1] = 0;
palaux[2] = 0;
- redFadeIn(palaux);
+ g_engine->_graphics->redFadeIn(palaux);
drawFlc(112, 57, offsets[18], 33, 9, 20, true, false, true, exitPressed);
g_engine->_sound->autoPlayVoc("REZOS", 0, 0);
@@ -1993,7 +1991,7 @@ void sacrificeScene() {
if (g_engine->shouldQuit())
return;
- totalFadeOut(128);
+ g_engine->_graphics->totalFadeOut(128);
g_engine->_sound->stopVoc();
g_engine->_graphics->clear();
@@ -2169,7 +2167,7 @@ void sacrificeScene() {
setRGBPalette(254, 32 - i, 0, 0);
}
delay(2000);
- totalFadeOut(0);
+ g_engine->_graphics->totalFadeOut(0);
currentRoomData->paletteAnimationFlag = exitPressed;
saveAllowed = true;
}
@@ -2197,7 +2195,7 @@ void ending() {
return;
}
delay(4000);
- totalFadeOut(0);
+ g_engine->_graphics->totalFadeOut(0);
g_engine->_graphics->clear();
if(g_engine->shouldQuit()) {
return;
@@ -2298,7 +2296,7 @@ void disableSecondAnimation() {
setRoomTrajectories(secondaryAnimHeight, secondaryAnimWidth, RESTORE);
currentRoomData->animationFlag = false;
freeAnimation();
- restoreBackground();
+ g_engine->_graphics->restoreBackground();
assembleScreen();
}
diff --git a/engines/tot/saveload.cpp b/engines/tot/saveload.cpp
index 4ee54b80521..3fea8f131cc 100644
--- a/engines/tot/saveload.cpp
+++ b/engines/tot/saveload.cpp
@@ -253,10 +253,10 @@ Common::Error TotEngine::syncGame(Common::Serializer &s) {
loadCharAnimation();
loadObjects();
- loadPalette("DEFAULT");
+ g_engine->_graphics->loadPaletteFromFile("DEFAULT");
loadScreenMemory();
- totalFadeOut(0);
+ g_engine->_graphics->totalFadeOut(0);
g_engine->_graphics->clear();
displayLoading();
initializeScreenFile();
diff --git a/engines/tot/tot.cpp b/engines/tot/tot.cpp
index f5b0cb831b0..75cf892628f 100644
--- a/engines/tot/tot.cpp
+++ b/engines/tot/tot.cpp
@@ -33,7 +33,6 @@
#include "tot/console.h"
#include "tot/detection.h"
#include "tot/font/bgifont.h"
-#include "tot/graphman.h"
#include "tot/vars.h"
#include "tot/routines.h"
#include "tot/routines2.h"
@@ -47,7 +46,6 @@ TotEngine *g_engine;
TotEngine::TotEngine(OSystem *syst, const ADGameDescription *gameDesc) : Engine(syst),
_gameDescription(gameDesc), _randomSource("Tot") {
g_engine = this;
-
_lang = _gameDescription->language;
}
@@ -82,7 +80,7 @@ Common::Error TotEngine::run() {
_mouseManager = new MouseManager();
_sound->init();
- initGraph();
+ _graphics->init();
initPlayAnim();
isIntroSeen = ConfMan.getBool("introSeen");
diff --git a/engines/tot/tot.h b/engines/tot/tot.h
index 40bee2c9059..0216498214a 100644
--- a/engines/tot/tot.h
+++ b/engines/tot/tot.h
@@ -37,7 +37,7 @@
#include "tot/chrono.h"
#include "tot/detection.h"
-#include "tot/graphman.h"
+#include "tot/graphics.h"
#include "tot/mouse.h"
#include "tot/sound.h"
@@ -64,7 +64,7 @@ protected:
public:
Graphics::Screen *_screen = nullptr;
- GraphicsManager *_graphics = nullptr;
+ Tot::GraphicsManager *_graphics = nullptr;
SoundManager *_sound = nullptr;
MouseManager *_mouseManager = nullptr;
ChronoManager *_chrono = nullptr;
diff --git a/engines/tot/vars.cpp b/engines/tot/vars.cpp
index e14bc0ba657..3b246d7d19c 100644
--- a/engines/tot/vars.cpp
+++ b/engines/tot/vars.cpp
@@ -81,9 +81,9 @@ bool isDrawingEnabled;
bool isSecondaryAnimationEnabled;
-palette palAnimSlice;
+byte palAnimSlice[768];
-palette pal;
+byte pal[768];
InventoryEntry inventory[inventoryIconCount];
diff --git a/engines/tot/vars.h b/engines/tot/vars.h
index 2b51b3aa8d2..3e879bd3cdd 100644
--- a/engines/tot/vars.h
+++ b/engines/tot/vars.h
@@ -361,11 +361,11 @@ extern bool isSecondaryAnimationEnabled;
/**
* 54 color palette slice.
*/
-extern palette palAnimSlice;
+extern byte palAnimSlice[768];
/**
* General palette
*/
-extern palette pal;
+extern byte pal[768];
/**
* These are the icons currnetly in the inventory
Commit: 0df576285fbb94ad40b8fc44f012374e0e7bb5b2
https://github.com/scummvm/scummvm/commit/0df576285fbb94ad40b8fc44f012374e0e7bb5b2
Author: gsanmartin (gabriel.sanmartin at dna.inc)
Date: 2025-09-08T16:49:50+02:00
Commit Message:
TOT: Merges game and tot source files
Changed paths:
R engines/tot/game.cpp
engines/tot/module.mk
engines/tot/tot.cpp
engines/tot/tot.h
engines/tot/util.cpp
engines/tot/vars.cpp
diff --git a/engines/tot/game.cpp b/engines/tot/game.cpp
deleted file mode 100644
index db2b2a35786..00000000000
--- a/engines/tot/game.cpp
+++ /dev/null
@@ -1,993 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "common/config-manager.h"
-#include "common/textconsole.h"
-
-#include "tot/dialog.h"
-#include "tot/graphics.h"
-#include "tot/mouse.h"
-#include "tot/routines.h"
-#include "tot/routines2.h"
-#include "tot/statics.h"
-#include "tot/tot.h"
-#include "tot/util.h"
-
-namespace Tot {
-
-void loadTemporaryGame() {
- g_engine->loadGameState(g_engine->getMetaEngine()->getAutosaveSlot());
-}
-
-int startGame();
-
-void newGame() {
- saveAllowed = true;
- g_engine->_mouseManager->hide();
- obtainName(characterName);
-
- if (!g_engine->shouldQuit()) {
- g_engine->_graphics->totalFadeOut(0);
- g_engine->_graphics->clear();
- displayLoading();
- freeInventory();
- loadObjects();
- resetGameState();
- inGame = true;
- for (int i = 0; i < inventoryIconCount; i++) {
- inventory[i].bitmapIndex = 34;
- inventory[i].code = 0;
- inventory[i].objectName = getObjectName(10);
- }
- readConversationFile(Common::String("CONVERSA.TRE"));
- initializeScreenFile();
- initializeObjectFile();
- g_engine->_graphics->loadPaletteFromFile("DEFAULT");
- loadScreenData(1);
- g_engine->_graphics->sceneTransition(13, false, sceneBackground);
- mask();
- inventoryPosition = 0;
- drawBackpack();
- iframe = 0;
- g_engine->_mouseManager->show();
- }
-}
-
-void changeRoom();
-
-int engine_start() {
- if (ConfMan.hasKey("save_slot")) {
- return startGame();
- }
- g_engine->_graphics->clear();
- displayLoading();
-
- loadCharAnimation();
- loadObjects();
-
- g_engine->_sound->setMidiVolume(0, 0);
- g_engine->_sound->playMidi("SILENT", false);
-
- g_engine->_mouseManager->setMouseArea(Common::Rect(0, 0, 305, 185));
- g_engine->_sound->playMidi("SILENT", true);
-
- g_engine->_graphics->totalFadeOut(0);
- g_engine->_graphics->clear();
-
- g_engine->_graphics->loadPaletteFromFile("DEFAULT");
- loadScreenMemory();
- initialLogo();
- g_engine->_sound->playMidi("INTRODUC", true);
- g_engine->_sound->setMidiVolume(3, 3);
- firstIntroduction();
- g_engine->_mouseManager->setMousePos(1, mouseX, mouseY);
- initialMenu(firstTimeDone);
- if (startNewGame && !g_engine->shouldQuit()) {
- newGame();
- } else if (continueGame && !g_engine->shouldQuit()) {
- loadTemporaryGame();
- } else {
- isSavingDisabled = true;
- g_engine->openMainMenuDialog();
- isSavingDisabled = false;
- }
-
- return startGame();
-}
-
-int startGame() {
- g_engine->_sound->fadeOutMusic(musicVolLeft, musicVolRight);
- switch (gamePart) {
- case 1:
- g_engine->_sound->playMidi("PRIMERA", true);
- break;
- case 2:
- g_engine->_sound->playMidi("SEGUNDA", true);
- break;
- }
- cpCounter2 = cpCounter;
- g_engine->_sound->fadeInMusic(musicVolLeft, musicVolRight);
- inGame = true;
-
- Common::Event e;
- const char hotKeyOpen = hotKeyFor(OPEN);
- const char hotKeyClose = hotKeyFor(CLOSE);
- const char hotKeyPickup = hotKeyFor(PICKUP);
- const char hotKeyTalk = hotKeyFor(TALK);
- const char hotKeyLook = hotKeyFor(LOOKAT);
- const char hotKeyUse = hotKeyFor(USE);
-
- while (!shouldQuitGame && !g_engine->shouldQuit()) {
- bool escapePressed = false;
- g_engine->_chrono->updateChrono();
- g_engine->_mouseManager->animateMouseIfNeeded();
- // debug
- while (g_system->getEventManager()->pollEvent(e)) {
- if (isMouseEvent(e)) {
- g_engine->_mouseManager->setMousePos(e.mouse);
- mouseX = e.mouse.x;
- mouseY = e.mouse.y;
- }
- if (e.type == Common::EVENT_KEYUP) {
- changeGameSpeed(e);
-
- switch (e.kbd.keycode) {
-
- case Common::KEYCODE_ESCAPE:
- escapePressed = true;
- break;
- case Common::KEYCODE_F1:
- soundControls();
- break;
- case Common::KEYCODE_F2:
- g_engine->openMainMenuDialog();
- // saveLoad();
- break;
- default:
- if (e.kbd.keycode == hotKeyOpen) {
- actionCode = 5;
- action();
- oldGridX = 0;
- oldGridY = 0;
- } else if (e.kbd.keycode == hotKeyClose) {
- actionCode = 6;
- action();
- oldGridX = 0;
- oldGridY = 0;
- } else if (e.kbd.keycode == hotKeyPickup) {
- actionCode = 2;
- action();
- oldGridX = 0;
- oldGridY = 0;
- } else if (e.kbd.keycode == hotKeyTalk) {
- actionCode = 1;
- action();
- oldGridX = 0;
- oldGridY = 0;
- } else if (e.kbd.keycode == hotKeyLook) {
- actionCode = 3;
- action();
- oldGridX = 0;
- oldGridY = 0;
- } else if (e.kbd.keycode == hotKeyUse) {
- actionCode = 4;
- action();
- oldGridX = 0;
- oldGridY = 0;
- } else {
- actionCode = 0; // go to
- }
- }
- } else if (e.type == Common::EVENT_LBUTTONUP) {
- mouseClickX = e.mouse.x;
- mouseClickY = e.mouse.y;
- if (mouseClickY > 0 && mouseClickY < 131) {
- switch (actionCode) {
- case 0: // go to
- cpCounter2 = cpCounter;
- // gets the zone where the character is now standing. Zone is calculated using xframe,yframe plus some adjustments to get the center of the feet
- currentZone = currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount];
- if (currentZone < 10) {
- xframe2 = mouseClickX + 7;
- yframe2 = mouseClickY + 7;
- // obtains the target zone from the clicked coordinates
- targetZone = currentRoomData->walkAreasGrid[xframe2 / xGridCount][yframe2 / yGridCount];
- if (currentRoomData->code == 21 && currentRoomData->animationFlag) {
- if ((targetZone >= 1 && targetZone <= 5) ||
- (targetZone >= 9 && targetZone <= 13) ||
- (targetZone >= 18 && targetZone <= 21) ||
- targetZone == 24 || targetZone == 25) {
-
- targetZone = 7;
- mouseClickX = 232;
- mouseClickY = 75;
-
- xframe2 = mouseClickX + 7;
- yframe2 = mouseClickY + 7;
- }
- }
-
- if (oldTargetZone != targetZone || targetZone < 10) {
- oldTargetZone = targetZone;
- // Resets the entire route
- calculateRoute(currentZone, targetZone);
-
- doorIndex = 0;
- roomChange = false;
-
- for (doorIndex = 0; doorIndex < 5; doorIndex++) {
- if (currentRoomData->doors[doorIndex].doorcode == targetZone) {
-
- if (currentRoomData->doors[doorIndex].openclosed == 1) {
- roomChange = true;
- break;
- } else if ((currentRoomData->code == 5 && targetZone == 27) || (currentRoomData->code == 6 && targetZone == 21)) {
- ;
- } else {
- steps -= 1;
- }
- }
- }
- // Sets xframe2 again due to the substraction when closed doors
- xframe2 = steps;
- } else
- xframe2 = 0;
- }
- break;
- case 1: // talk
- roomChange = false;
- actionCode = 0;
- talkToSceneObject();
- cpCounter2 = cpCounter;
- break;
- case 2: // pick up
- roomChange = false;
- actionCode = 0;
- pickupScreenObject();
- cpCounter = cpCounter2;
- break;
- case 3: // look at
- roomChange = false;
- destinationStepX = (mouseClickX + 7) / xGridCount;
- destinationStepY = (mouseClickY + 7) / yGridCount;
- if (currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[destinationStepX][destinationStepY]]->fileIndex > 0) {
- goToObject(
- currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount],
- currentRoomData->walkAreasGrid[destinationStepX][destinationStepY]);
- if (currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[destinationStepX][destinationStepY]]->fileIndex == 562)
-
- switch (currentRoomData->code) {
- case 20:
- if (niche[0][niche[0][3]] > 0)
- readItemRegister(niche[0][niche[0][3]]);
- else
- readItemRegister(562);
- break;
- case 24:
- if (niche[1][niche[1][3]] > 0)
- readItemRegister(niche[1][niche[1][3]]);
- else
- readItemRegister(562);
- break;
- }
- else
- readItemRegister(currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[destinationStepX][destinationStepY]]->fileIndex);
- if (regobj.lookAtTextRef > 0)
- drawText(regobj.lookAtTextRef);
- actionCode = 0;
- }
- break;
- case 4: // use
- roomChange = false;
- actionCode = 0;
- useScreenObject();
- cpCounter = cpCounter2;
- break;
- case 5: // open
- roomChange = false;
- actionCode = 0;
- openScreenObject();
- break;
- case 6: { // close
- roomChange = false;
- actionCode = 0;
- closeScreenObject();
- cpCounter = cpCounter2;
- } break;
- }
- } else if (mouseClickY > 148 && mouseClickY < 158) {
- if (mouseClickX >= 3 && mouseClickX <= 53) {
- actionCode = 1;
- action();
- break;
- } else if (mouseClickX >= 58 && mouseClickX <= 103) {
- actionCode = 2;
- action();
- break;
- } else if (mouseClickX >= 108 && mouseClickX <= 153) {
- actionCode = 3;
- action();
- break;
- } else if (mouseClickX >= 158 && mouseClickX <= 198) {
- actionCode = 4;
- action();
- break;
- } else if (mouseClickX >= 203 && mouseClickX <= 248) {
- actionCode = 5;
- action();
- break;
- } else if (mouseClickX >= 253 && mouseClickX <= 311) {
- actionCode = 6;
- action();
- break;
- } else {
- actionCode = 0;
- action();
- cpCounter2 = cpCounter;
- }
- } else if (mouseClickY > 166 && mouseClickY < 199) {
- if (mouseClickX >= 3 && mouseClickX <= 19) {
- drawInventory(0, 33);
- break;
- } else if (mouseClickX >= 26 && mouseClickX <= 65) {
- handleAction(inventoryPosition);
- break;
- } else if (mouseClickX >= 70 && mouseClickX <= 108) {
- handleAction(inventoryPosition + 1);
- break;
- } else if (mouseClickX >= 113 && mouseClickX <= 151) {
- handleAction(inventoryPosition + 2);
- break;
- } else if (mouseClickX >= 156 && mouseClickX <= 194) {
- handleAction(inventoryPosition + 3);
- break;
- } else if (mouseClickX >= 199 && mouseClickX <= 237) {
- handleAction(inventoryPosition + 4);
- break;
- } else if (mouseClickX >= 242 && mouseClickX <= 280) {
- handleAction(inventoryPosition + 5);
- break;
- } else if (mouseClickX >= 290 && mouseClickX <= 311) {
- drawInventory(1, 33);
- break;
- } else {
- actionCode = 0;
- action();
- }
- }
- } else if (e.type == Common::EVENT_RBUTTONUP) {
- mouseClickX = e.mouse.x;
- mouseClickY = e.mouse.y;
- destinationStepX = (mouseClickX + 7) / xGridCount;
- destinationStepY = (mouseClickY + 7) / yGridCount;
- cpCounter2 = cpCounter;
- if (destinationStepY < 28) {
- RoomObjectListEntry obj = *currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[destinationStepX][destinationStepY]];
- if (obj.fileIndex > 0) {
-
- drawLookAtItem(obj);
- goToObject(currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount], currentRoomData->walkAreasGrid[destinationStepX][destinationStepY]);
- if (obj.fileIndex == 562)
-
- switch (currentRoomData->code) {
- case 20:
- if (niche[0][niche[0][3]] > 0)
- readItemRegister(niche[0][niche[0][3]]);
- else
- readItemRegister(562);
- break;
- case 24:
- if (niche[1][niche[1][3]] > 0)
- readItemRegister(niche[1][niche[1][3]]);
- else
- readItemRegister(562);
- break;
- }
- else
- readItemRegister(obj.fileIndex);
- if (regobj.lookAtTextRef > 0)
- drawText(regobj.lookAtTextRef);
- actionCode = 0;
- }
- }
- }
- }
-
- checkMouseGrid();
- advanceAnimations(false, true);
-
- // Scene changes
- if (xframe2 == 0 && roomChange) {
- changeRoom();
- }
-
- if (escapePressed && xframe2 == 0) {
- freeAnimation();
- freeScreenObjects();
- cpCounter2 = cpCounter;
- startNewGame = false;
- continueGame = false;
- g_engine->saveAutosaveIfEnabled();
- g_engine->_graphics->totalFadeOut(0);
- g_engine->_sound->fadeOutMusic(musicVolLeft, musicVolRight);
- g_engine->_graphics->clear();
- g_engine->_sound->playMidi("INTRODUC", true);
- g_engine->_sound->fadeInMusic(musicVolLeft, musicVolRight);
- initialMenu(true);
- verifyCopyProtection2();
-
- if (startNewGame && !g_engine->shouldQuit()) {
- newGame();
- } else if (continueGame && !g_engine->shouldQuit())
- loadTemporaryGame();
- else {
- isSavingDisabled = true;
- g_engine->openMainMenuDialog();
- cpCounter = cpCounter2;
- isSavingDisabled = false;
- }
- g_engine->_sound->fadeOutMusic(musicVolLeft, musicVolRight);
- switch (gamePart) {
- case 1:
- g_engine->_sound->playMidi("PRIMERA", true);
- break;
- case 2:
- g_engine->_sound->playMidi("SEGUNDA", true);
- break;
- }
- g_engine->_sound->fadeInMusic(musicVolLeft, musicVolRight);
- }
-
- switch (gamePart) {
- case 1:
- if (list1Complete && list2Complete) {
- list1Complete = false;
- list2Complete = false;
- cpCounter = cpCounter2;
- gamePart = 2;
- iframe = 0;
- freeInventory();
- freeAnimation();
- freeScreenObjects();
- g_engine->_mouseManager->hide();
- g_engine->_graphics->partialFadeOut(234);
- g_engine->_sound->fadeOutMusic(musicVolLeft, musicVolRight);
- g_engine->_sound->playMidi("CREDITOS", true);
- g_engine->_sound->fadeInMusic(musicVolLeft, musicVolRight);
- if (cpCounter2 > 43)
- showError(274);
- sacrificeScene();
- g_engine->_graphics->clear();
- loadObjects();
- g_engine->_graphics->loadPaletteFromFile("SEGUNDA");
- currentTrajectoryIndex = 0;
- characterPosX = 160;
- characterPosY = 60;
- trajectory[currentTrajectoryIndex].x = characterPosX;
- trajectory[currentTrajectoryIndex].y = characterPosY;
- loadScreenData(20);
- g_engine->_sound->fadeOutMusic(musicVolLeft, musicVolRight);
- g_engine->_sound->playMidi("SEGUNDA", true);
- g_engine->_sound->fadeInMusic(musicVolLeft, musicVolRight);
- g_engine->_graphics->sceneTransition(1, false, sceneBackground);
- mask();
- inventoryPosition = 0;
- drawBackpack();
- g_engine->_mouseManager->show();
-
- firstTimeTopicA[8] = true;
- oldGridX = 0;
- oldGridY = 0;
- checkMouseGrid();
- }
- break;
- }
-
- // Debug graphics
- {
- // g_engine->_graphics->euroText(Common::String::format("Room: %d", currentRoomNumber), 0, 0, 220, Graphics::kTextAlignLeft);
- // g_engine->_mouseManager->printPos(xraton, yraton, 220, 0);
- // printPos(characterPosX, characterPosY, 220, 10, "CharPos");
- if (g_engine->_showMouseGrid) {
- drawMouseGrid(currentRoomData);
- }
- if (g_engine->_showScreenGrid) {
- drawScreenGrid(currentRoomData);
- }
- if (g_engine->_showGameGrid) {
- drawGrid();
- }
-
- if (g_engine->_drawObjectAreas) {
- for (int i = 0; i < depthLevelCount; i++) {
- if (screenLayers[i] != NULL) {
- if (true) {
- // debug
- uint16 w = READ_LE_UINT16(screenLayers[i]);
- uint16 h = READ_LE_UINT16(screenLayers[i] + 2);
- Common::Rect r = Common::Rect(depthMap[i].posx, depthMap[i].posy, depthMap[i].posx + w, depthMap[i].posy + h);
- drawRect(180, depthMap[i].posx, depthMap[i].posy, depthMap[i].posx + w, depthMap[i].posy + h);
-
- littText(r.left, r.top, Common::String().format("%d", i), 0);
- }
- }
- }
- }
- }
-
- g_engine->_screen->update();
- g_system->delayMillis(10);
- }
- g_engine->_mouseManager->hide();
- if (!g_engine->shouldQuit()) {
- ending();
- }
- if (!g_engine->shouldQuit()) {
- obtainName(photoFileName);
- }
- if (!g_engine->shouldQuit()) {
- generateDiploma(photoFileName);
- }
- if (!g_engine->shouldQuit()) {
- credits();
- }
- return EXIT_SUCCESS;
-}
-
-void changeRoom() {
- roomChange = false;
- cpCounter = cpCounter2;
- setRoomTrajectories(secondaryAnimHeight, secondaryAnimWidth, RESTORE);
- saveRoomData(currentRoomData, rooms);
- // verifyCopyProtection();
- g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
-
- switch (currentRoomData->doors[doorIndex].nextScene) {
- case 2: {
- transitionEffect = Random(15) + 1;
- iframe = 0;
- currentTrajectoryIndex = 0;
- characterPosX = currentRoomData->doors[doorIndex].exitPosX - characterCorrectionX;
- characterPosY = currentRoomData->doors[doorIndex].exitPosY - characerCorrectionY;
- trajectory[currentTrajectoryIndex].x = characterPosX;
- trajectory[currentTrajectoryIndex].y = characterPosY;
- freeAnimation();
- freeScreenObjects();
- g_engine->_mouseManager->hide();
-
- g_engine->_graphics->sceneTransition(transitionEffect, true, NULL);
- g_engine->_sound->stopVoc();
- loadScreenData(currentRoomData->doors[doorIndex].nextScene);
- if (cpCounter > 89)
- showError(274);
- g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
- if (isTVOn)
- g_engine->_sound->autoPlayVoc("PARASITO", 355778, 20129);
- else
- loadTV();
- g_engine->_graphics->sceneTransition(transitionEffect, false, sceneBackground);
- cpCounter = cpCounter2;
- g_engine->_mouseManager->show();
- oldGridX = 0;
- oldGridY = 0;
- } break;
- case 5: {
- if (currentRoomData->code != 6) {
- transitionEffect = Random(15) + 1;
- iframe = 0;
- currentTrajectoryIndex = 0;
- characterPosX = currentRoomData->doors[doorIndex].exitPosX - characterCorrectionX;
- characterPosY = currentRoomData->doors[doorIndex].exitPosY - characerCorrectionY + 15;
- trajectory[currentTrajectoryIndex].x = characterPosX;
- trajectory[currentTrajectoryIndex].y = characterPosY;
- freeAnimation();
- freeScreenObjects();
- g_engine->_mouseManager->hide();
- g_engine->_graphics->sceneTransition(transitionEffect, true, NULL);
- loadScreenData(currentRoomData->doors[doorIndex].nextScene);
- g_engine->_sound->stopVoc();
- g_engine->_sound->autoPlayVoc("CALDERA", 6433, 15386);
- g_engine->_sound->setSfxVolume(leftSfxVol, 0);
- g_engine->_graphics->sceneTransition(transitionEffect, false, sceneBackground);
- g_engine->_mouseManager->show();
- oldGridX = 0;
- oldGridY = 0;
- checkMouseGrid();
- } else {
-
- currentZone = currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount];
- targetZone = 21;
- goToObject(currentZone, targetZone);
- freeAnimation();
- freeScreenObjects();
- g_engine->_mouseManager->hide();
- g_engine->_sound->setSfxVolume(leftSfxVol, 0);
- loadScrollData(currentRoomData->doors[doorIndex].nextScene, true, 22, -2);
- g_engine->_mouseManager->show();
- oldGridX = 0;
- oldGridY = 0;
- checkMouseGrid();
- }
- } break;
- case 6: {
- currentZone = currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount];
- targetZone = 27;
- goToObject(currentZone, targetZone);
- freeAnimation();
- freeScreenObjects();
- g_engine->_mouseManager->hide();
- g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
- loadScrollData(currentRoomData->doors[doorIndex].nextScene, false, 22, 2);
- g_engine->_mouseManager->show();
- oldGridX = 0;
- oldGridY = 0;
- checkMouseGrid();
- } break;
- case 9: {
- transitionEffect = Random(15) + 1;
- freeAnimation();
- freeScreenObjects();
- g_engine->_mouseManager->hide();
- g_engine->_graphics->sceneTransition(transitionEffect, true, NULL);
- iframe = 0;
- currentTrajectoryIndex = 0;
- characterPosX = currentRoomData->doors[doorIndex].exitPosX - characterCorrectionX;
- characterPosY = currentRoomData->doors[doorIndex].exitPosY - characerCorrectionY;
- trajectory[currentTrajectoryIndex].x = characterPosX;
- trajectory[currentTrajectoryIndex].y = characterPosY;
- loadScreenData(currentRoomData->doors[doorIndex].nextScene);
- g_engine->_graphics->sceneTransition(transitionEffect, false, sceneBackground);
- g_engine->_mouseManager->show();
-
- oldGridX = 0;
- oldGridY = 0;
- checkMouseGrid();
- } break;
- case 12: {
- if (currentRoomData->code != 13) {
- transitionEffect = Random(15) + 1;
- iframe = 0;
- currentTrajectoryIndex = 0;
- characterPosX = currentRoomData->doors[doorIndex].exitPosX - characterCorrectionX;
- characterPosY = currentRoomData->doors[doorIndex].exitPosY - characerCorrectionY;
- trajectory[currentTrajectoryIndex].x = characterPosX;
- trajectory[currentTrajectoryIndex].y = characterPosY;
- freeAnimation();
- freeScreenObjects();
- g_engine->_mouseManager->hide();
- g_engine->_graphics->sceneTransition(transitionEffect, true, NULL);
- loadScreenData(currentRoomData->doors[doorIndex].nextScene);
- g_engine->_graphics->sceneTransition(transitionEffect, false, sceneBackground);
- g_engine->_mouseManager->show();
- oldGridX = 0;
- oldGridY = 0;
- g_engine->_mouseManager->show();
- } else {
-
- currentZone = currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount];
- goToObject(currentZone, targetZone);
- freeAnimation();
- freeScreenObjects();
- g_engine->_mouseManager->hide();
- loadScrollData(currentRoomData->doors[doorIndex].nextScene, false, 64, 0);
- g_engine->_mouseManager->show();
- oldGridX = 0;
- oldGridY = 0;
- checkMouseGrid();
- }
- } break;
- case 13: {
- switch (currentRoomData->code) {
- case 12: {
- currentZone = currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount];
- goToObject(currentZone, targetZone);
- freeAnimation();
- freeScreenObjects();
- g_engine->_mouseManager->hide();
- loadScrollData(currentRoomData->doors[doorIndex].nextScene, true, 64, 0);
- g_engine->_mouseManager->show();
- oldGridX = 0;
- oldGridY = 0;
- checkMouseGrid();
- } break;
- case 14: {
- currentZone = currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount];
- goToObject(currentZone, targetZone);
- freeAnimation();
- freeScreenObjects();
- g_engine->_mouseManager->hide();
- loadScrollData(currentRoomData->doors[doorIndex].nextScene, false, 56, 0);
- g_engine->_mouseManager->show();
- oldGridX = 0;
- oldGridY = 0;
- checkMouseGrid();
- } break;
- }
- } break;
- case 14: {
- if (currentRoomData->code != 13) {
- transitionEffect = Random(15) + 1;
- iframe = 0;
- currentTrajectoryIndex = 0;
- characterPosX = currentRoomData->doors[doorIndex].exitPosX - characterCorrectionX;
- characterPosY = currentRoomData->doors[doorIndex].exitPosY - characerCorrectionY;
- trajectory[currentTrajectoryIndex].x = characterPosX;
- trajectory[currentTrajectoryIndex].y = characterPosY;
- freeAnimation();
- freeScreenObjects();
- g_engine->_mouseManager->hide();
- g_engine->_graphics->sceneTransition(transitionEffect, true, NULL);
- loadScreenData(currentRoomData->doors[doorIndex].nextScene);
- g_engine->_graphics->sceneTransition(transitionEffect, false, sceneBackground);
- g_engine->_mouseManager->show();
- oldGridX = 0;
- oldGridY = 0;
- checkMouseGrid();
- } else {
-
- currentZone = currentRoomData->walkAreasGrid[((characterPosX + characterCorrectionX) / xGridCount)][((characterPosY + characerCorrectionY) / yGridCount)];
- goToObject(currentZone, targetZone);
- freeAnimation();
- freeScreenObjects();
- g_engine->_mouseManager->hide();
- loadScrollData(currentRoomData->doors[doorIndex].nextScene, true, 56, 0);
- g_engine->_mouseManager->show();
- oldGridX = 0;
- oldGridY = 0;
- checkMouseGrid();
- }
- } break;
- case 17: {
- transitionEffect = Random(15) + 1;
- iframe = 0;
- currentTrajectoryIndex = 0;
- characterPosX = currentRoomData->doors[doorIndex].exitPosX - characterCorrectionX;
- characterPosY = currentRoomData->doors[doorIndex].exitPosY - characerCorrectionY;
- trajectory[currentTrajectoryIndex].x = characterPosX;
- trajectory[currentTrajectoryIndex].y = characterPosY;
- freeAnimation();
- freeScreenObjects();
- g_engine->_mouseManager->hide();
- g_engine->_graphics->sceneTransition(transitionEffect, true, NULL);
- g_engine->_sound->stopVoc();
- loadScreenData(currentRoomData->doors[doorIndex].nextScene);
- if (bookTopic[0] == true && currentRoomData->animationFlag == true)
- disableSecondAnimation();
- if (cpCounter > 89)
- showError(274);
- g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
- g_engine->_graphics->sceneTransition(transitionEffect, false, sceneBackground);
- cpCounter = cpCounter2;
- g_engine->_mouseManager->show();
- oldGridX = 0;
- oldGridY = 0;
- checkMouseGrid();
- } break;
- case 18: {
- if (currentRoomData->code != 19) {
- transitionEffect = Random(15) + 1;
- iframe = 0;
- currentTrajectoryIndex = 0;
- characterPosX = currentRoomData->doors[doorIndex].exitPosX - characterCorrectionX;
- characterPosY = currentRoomData->doors[doorIndex].exitPosY - characerCorrectionY;
- trajectory[currentTrajectoryIndex].x = characterPosX;
- trajectory[currentTrajectoryIndex].y = characterPosY;
- freeAnimation();
- freeScreenObjects();
- g_engine->_mouseManager->hide();
- g_engine->_graphics->sceneTransition(transitionEffect, true, NULL);
- loadScreenData(currentRoomData->doors[doorIndex].nextScene);
- g_engine->_graphics->sceneTransition(transitionEffect, false, sceneBackground);
- g_engine->_mouseManager->show();
- oldGridX = 0;
- oldGridY = 0;
- checkMouseGrid();
- } else {
-
- currentZone = currentRoomData->walkAreasGrid[((characterPosX + characterCorrectionX) / xGridCount)][((characterPosY + characerCorrectionY) / yGridCount)];
- goToObject(currentZone, targetZone);
- freeAnimation();
- freeScreenObjects();
- g_engine->_mouseManager->hide();
- loadScrollData(currentRoomData->doors[doorIndex].nextScene, true, 131, -1);
- g_engine->_mouseManager->show();
- oldGridX = 0;
- oldGridY = 0;
- checkMouseGrid();
- }
- } break;
- case 19: {
- if (currentRoomData->code != 18) {
- transitionEffect = Random(15) + 1;
- iframe = 0;
- currentTrajectoryIndex = 0;
- characterPosX = currentRoomData->doors[doorIndex].exitPosX - characterCorrectionX;
- characterPosY = currentRoomData->doors[doorIndex].exitPosY - characerCorrectionY;
- trajectory[currentTrajectoryIndex].x = characterPosX;
- trajectory[currentTrajectoryIndex].y = characterPosY;
- freeAnimation();
- freeScreenObjects();
- g_engine->_mouseManager->hide();
- g_engine->_graphics->sceneTransition(transitionEffect, true, NULL);
- loadScreenData(currentRoomData->doors[doorIndex].nextScene);
- g_engine->_graphics->sceneTransition(transitionEffect, false, sceneBackground);
- g_engine->_mouseManager->show();
- oldGridX = 0;
- oldGridY = 0;
- checkMouseGrid();
- } else {
-
- currentZone = currentRoomData->walkAreasGrid[((characterPosX + characterCorrectionX) / xGridCount)][((characterPosY + characerCorrectionY) / yGridCount)];
- goToObject(currentZone, targetZone);
- freeAnimation();
- freeScreenObjects();
- g_engine->_mouseManager->hide();
- loadScrollData(currentRoomData->doors[doorIndex].nextScene, false, 131, 1);
- g_engine->_mouseManager->show();
- oldGridX = 0;
- oldGridY = 0;
- checkMouseGrid();
- }
- } break;
- case 20: {
- transitionEffect = Random(15) + 1;
- iframe = 0;
- currentTrajectoryIndex = 0;
- characterPosX = currentRoomData->doors[doorIndex].exitPosX - characterCorrectionX;
- characterPosY = currentRoomData->doors[doorIndex].exitPosY - characerCorrectionY;
- trajectory[currentTrajectoryIndex].x = characterPosX;
- trajectory[currentTrajectoryIndex].y = characterPosY;
- freeAnimation();
- freeScreenObjects();
- g_engine->_mouseManager->hide();
- g_engine->_graphics->sceneTransition(transitionEffect, true, NULL);
- g_engine->_sound->stopVoc();
- loadScreenData(currentRoomData->doors[doorIndex].nextScene);
- switch (niche[0][niche[0][3]]) {
- case 0:
- currentRoomData->screenObjectIndex[9]->objectName = getObjectName(4);
- break;
- case 561:
- currentRoomData->screenObjectIndex[9]->objectName = getObjectName(5);
- break;
- case 563:
- currentRoomData->screenObjectIndex[9]->objectName = getObjectName(6);
- break;
- case 615:
- currentRoomData->screenObjectIndex[9]->objectName = getObjectName(7);
- break;
- }
- if (cpCounter > 89)
- showError(274);
- g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
- if (currentRoomData->code == 4)
- g_engine->_sound->loadVoc("GOTA", 140972, 1029);
- g_engine->_graphics->sceneTransition(transitionEffect, false, sceneBackground);
- cpCounter = cpCounter2;
- g_engine->_mouseManager->show();
- oldGridX = 0;
- oldGridY = 0;
- checkMouseGrid();
- } break;
- case 24: {
- transitionEffect = Random(15) + 1;
- iframe = 0;
- currentTrajectoryIndex = 0;
- characterPosX = currentRoomData->doors[doorIndex].exitPosX - characterCorrectionX;
- characterPosY = currentRoomData->doors[doorIndex].exitPosY - characerCorrectionY;
- trajectory[currentTrajectoryIndex].x = characterPosX;
- trajectory[currentTrajectoryIndex].y = characterPosY;
- freeAnimation();
- freeScreenObjects();
- g_engine->_mouseManager->hide();
- g_engine->_graphics->sceneTransition(transitionEffect, true, NULL);
- g_engine->_sound->stopVoc();
- loadScreenData(currentRoomData->doors[doorIndex].nextScene);
- switch (niche[1][niche[1][3]]) {
- case 0:
- currentRoomData->screenObjectIndex[8]->objectName = getObjectName(4);
- break;
- case 561:
- currentRoomData->screenObjectIndex[8]->objectName = getObjectName(5);
- break;
- case 615:
- currentRoomData->screenObjectIndex[8]->objectName = getObjectName(7);
- break;
- case 622:
- currentRoomData->screenObjectIndex[8]->objectName = getObjectName(8);
- break;
- case 623:
- currentRoomData->screenObjectIndex[8]->objectName = getObjectName(9);
- break;
- }
- if (cpCounter > 89)
- showError(274);
- g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
- if (isTrapSet) {
- currentRoomData->animationFlag = true;
- loadAnimation(currentRoomData->animationName);
- iframe2 = 0;
- currentSecondaryTrajectoryIndex = 1;
- currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].x = 214 - 15;
- currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].y = 115 - 42;
- secondaryAnimation.dir = currentRoomData->secondaryAnimDirections[currentSecondaryTrajectoryIndex - 1];
- secondaryAnimation.posx = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].x;
- secondaryAnimation.posy = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].y;
- secondaryAnimation.depth = 14;
-
- for (int i = 0; i < maxXGrid; i++)
- for (int j = 0; j < maxYGrid; j++) {
- if (maskGridSecondaryAnim[i][j] > 0) {
- currentRoomData->walkAreasGrid[oldposx + i][oldposy + j] = maskGridSecondaryAnim[i][j];
- }
- if (maskMouseSecondaryAnim[i][j] > 0)
- currentRoomData->mouseGrid[oldposx + i][oldposy + j] = maskMouseSecondaryAnim[i][j];
- }
- assembleScreen();
- }
- g_engine->_graphics->sceneTransition(transitionEffect, false, sceneBackground);
- if ((isRedDevilCaptured == false) && (isTrapSet == false))
- runaroundRed();
- cpCounter = cpCounter2;
- g_engine->_mouseManager->show();
- oldGridX = 0;
- oldGridY = 0;
- checkMouseGrid();
- } break;
- case 255:
- wcScene();
- break;
- default: {
- transitionEffect = Random(15) + 1;
- iframe = 0;
- currentTrajectoryIndex = 0;
- characterPosX = currentRoomData->doors[doorIndex].exitPosX - characterCorrectionX;
- characterPosY = currentRoomData->doors[doorIndex].exitPosY - characerCorrectionY;
- trajectory[currentTrajectoryIndex].x = characterPosX;
- trajectory[currentTrajectoryIndex].y = characterPosY;
- freeAnimation();
- freeScreenObjects();
- g_engine->_mouseManager->hide();
- g_engine->_graphics->sceneTransition(transitionEffect, true, NULL);
- g_engine->_sound->stopVoc();
- loadScreenData(currentRoomData->doors[doorIndex].nextScene);
- if (cpCounter > 89)
- showError(274);
- g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
- switch (currentRoomData->code) {
- case 4:
- g_engine->_sound->loadVoc("GOTA", 140972, 1029);
- break;
- case 23:
- g_engine->_sound->autoPlayVoc("FUENTE", 0, 0);
- break;
- }
- g_engine->_graphics->sceneTransition(transitionEffect, false, sceneBackground);
- cpCounter = cpCounter2;
- g_engine->_mouseManager->show();
- oldGridX = 0;
- oldGridY = 0;
- checkMouseGrid();
- }
- }
- oldTargetZone = 0;
-}
-} // end of namespace Tot
diff --git a/engines/tot/module.mk b/engines/tot/module.mk
index d47e073e2da..05eb2f0b5bc 100644
--- a/engines/tot/module.mk
+++ b/engines/tot/module.mk
@@ -11,7 +11,6 @@ MODULE_OBJS = \
routines2.o \
routines.o \
dialog.o \
- game.o \
font/bgifont.o \
font/biosfont.o \
decoder/TotFlicDecoder.o \
diff --git a/engines/tot/tot.cpp b/engines/tot/tot.cpp
index 75cf892628f..14035e5af46 100644
--- a/engines/tot/tot.cpp
+++ b/engines/tot/tot.cpp
@@ -32,6 +32,7 @@
#include "tot/chrono.h"
#include "tot/console.h"
#include "tot/detection.h"
+#include "tot/dialog.h"
#include "tot/font/bgifont.h"
#include "tot/vars.h"
#include "tot/routines.h"
@@ -94,9 +95,964 @@ Common::Error TotEngine::run() {
if (saveSlot != -1)
(void)loadGameState(saveSlot);
- engine_start();
+ engineStart();
return Common::kNoError;
}
+
+int TotEngine::engineStart() {
+ if (ConfMan.hasKey("save_slot")) {
+ return startGame();
+ }
+ g_engine->_graphics->clear();
+ displayLoading();
+
+ loadCharAnimation();
+ loadObjects();
+
+ g_engine->_sound->setMidiVolume(0, 0);
+ g_engine->_sound->playMidi("SILENT", false);
+
+ g_engine->_mouseManager->setMouseArea(Common::Rect(0, 0, 305, 185));
+ g_engine->_sound->playMidi("SILENT", true);
+
+ g_engine->_graphics->totalFadeOut(0);
+ g_engine->_graphics->clear();
+
+ g_engine->_graphics->loadPaletteFromFile("DEFAULT");
+ loadScreenMemory();
+ initialLogo();
+ g_engine->_sound->playMidi("INTRODUC", true);
+ g_engine->_sound->setMidiVolume(3, 3);
+ firstIntroduction();
+ g_engine->_mouseManager->setMousePos(1, mouseX, mouseY);
+ initialMenu(firstTimeDone);
+ if (startNewGame && !g_engine->shouldQuit()) {
+ newGame();
+ } else if (continueGame && !g_engine->shouldQuit()) {
+ loadTemporaryGame();
+ } else {
+ isSavingDisabled = true;
+ g_engine->openMainMenuDialog();
+ isSavingDisabled = false;
+ }
+
+ return startGame();
+}
+
+void TotEngine::loadTemporaryGame() {
+ g_engine->loadGameState(g_engine->getMetaEngine()->getAutosaveSlot());
+}
+
+int TotEngine::startGame() {
+ g_engine->_sound->fadeOutMusic(musicVolLeft, musicVolRight);
+ switch (gamePart) {
+ case 1:
+ g_engine->_sound->playMidi("PRIMERA", true);
+ break;
+ case 2:
+ g_engine->_sound->playMidi("SEGUNDA", true);
+ break;
+ }
+ cpCounter2 = cpCounter;
+ g_engine->_sound->fadeInMusic(musicVolLeft, musicVolRight);
+ inGame = true;
+
+ Common::Event e;
+ const char hotKeyOpen = hotKeyFor(OPEN);
+ const char hotKeyClose = hotKeyFor(CLOSE);
+ const char hotKeyPickup = hotKeyFor(PICKUP);
+ const char hotKeyTalk = hotKeyFor(TALK);
+ const char hotKeyLook = hotKeyFor(LOOKAT);
+ const char hotKeyUse = hotKeyFor(USE);
+
+ while (!shouldQuitGame && !g_engine->shouldQuit()) {
+ bool escapePressed = false;
+ g_engine->_chrono->updateChrono();
+ g_engine->_mouseManager->animateMouseIfNeeded();
+ // debug
+ while (g_system->getEventManager()->pollEvent(e)) {
+ if (isMouseEvent(e)) {
+ g_engine->_mouseManager->setMousePos(e.mouse);
+ mouseX = e.mouse.x;
+ mouseY = e.mouse.y;
+ }
+ if (e.type == Common::EVENT_KEYUP) {
+ changeGameSpeed(e);
+
+ switch (e.kbd.keycode) {
+
+ case Common::KEYCODE_ESCAPE:
+ escapePressed = true;
+ break;
+ case Common::KEYCODE_F1:
+ soundControls();
+ break;
+ case Common::KEYCODE_F2:
+ g_engine->openMainMenuDialog();
+ // saveLoad();
+ break;
+ default:
+ if (e.kbd.keycode == hotKeyOpen) {
+ actionCode = 5;
+ action();
+ oldGridX = 0;
+ oldGridY = 0;
+ } else if (e.kbd.keycode == hotKeyClose) {
+ actionCode = 6;
+ action();
+ oldGridX = 0;
+ oldGridY = 0;
+ } else if (e.kbd.keycode == hotKeyPickup) {
+ actionCode = 2;
+ action();
+ oldGridX = 0;
+ oldGridY = 0;
+ } else if (e.kbd.keycode == hotKeyTalk) {
+ actionCode = 1;
+ action();
+ oldGridX = 0;
+ oldGridY = 0;
+ } else if (e.kbd.keycode == hotKeyLook) {
+ actionCode = 3;
+ action();
+ oldGridX = 0;
+ oldGridY = 0;
+ } else if (e.kbd.keycode == hotKeyUse) {
+ actionCode = 4;
+ action();
+ oldGridX = 0;
+ oldGridY = 0;
+ } else {
+ actionCode = 0; // go to
+ }
+ }
+ } else if (e.type == Common::EVENT_LBUTTONUP) {
+ mouseClickX = e.mouse.x;
+ mouseClickY = e.mouse.y;
+ if (mouseClickY > 0 && mouseClickY < 131) {
+ switch (actionCode) {
+ case 0: // go to
+ cpCounter2 = cpCounter;
+ // gets the zone where the character is now standing. Zone is calculated using xframe,yframe plus some adjustments to get the center of the feet
+ currentZone = currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount];
+ if (currentZone < 10) {
+ xframe2 = mouseClickX + 7;
+ yframe2 = mouseClickY + 7;
+ // obtains the target zone from the clicked coordinates
+ targetZone = currentRoomData->walkAreasGrid[xframe2 / xGridCount][yframe2 / yGridCount];
+ if (currentRoomData->code == 21 && currentRoomData->animationFlag) {
+ if ((targetZone >= 1 && targetZone <= 5) ||
+ (targetZone >= 9 && targetZone <= 13) ||
+ (targetZone >= 18 && targetZone <= 21) ||
+ targetZone == 24 || targetZone == 25) {
+
+ targetZone = 7;
+ mouseClickX = 232;
+ mouseClickY = 75;
+
+ xframe2 = mouseClickX + 7;
+ yframe2 = mouseClickY + 7;
+ }
+ }
+
+ if (oldTargetZone != targetZone || targetZone < 10) {
+ oldTargetZone = targetZone;
+ // Resets the entire route
+ calculateRoute(currentZone, targetZone);
+
+ doorIndex = 0;
+ roomChange = false;
+
+ for (doorIndex = 0; doorIndex < 5; doorIndex++) {
+ if (currentRoomData->doors[doorIndex].doorcode == targetZone) {
+
+ if (currentRoomData->doors[doorIndex].openclosed == 1) {
+ roomChange = true;
+ break;
+ } else if ((currentRoomData->code == 5 && targetZone == 27) || (currentRoomData->code == 6 && targetZone == 21)) {
+ ;
+ } else {
+ steps -= 1;
+ }
+ }
+ }
+ // Sets xframe2 again due to the substraction when closed doors
+ xframe2 = steps;
+ } else
+ xframe2 = 0;
+ }
+ break;
+ case 1: // talk
+ roomChange = false;
+ actionCode = 0;
+ talkToSceneObject();
+ cpCounter2 = cpCounter;
+ break;
+ case 2: // pick up
+ roomChange = false;
+ actionCode = 0;
+ pickupScreenObject();
+ cpCounter = cpCounter2;
+ break;
+ case 3: // look at
+ roomChange = false;
+ destinationStepX = (mouseClickX + 7) / xGridCount;
+ destinationStepY = (mouseClickY + 7) / yGridCount;
+ if (currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[destinationStepX][destinationStepY]]->fileIndex > 0) {
+ goToObject(
+ currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount],
+ currentRoomData->walkAreasGrid[destinationStepX][destinationStepY]);
+ if (currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[destinationStepX][destinationStepY]]->fileIndex == 562)
+
+ switch (currentRoomData->code) {
+ case 20:
+ if (niche[0][niche[0][3]] > 0)
+ readItemRegister(niche[0][niche[0][3]]);
+ else
+ readItemRegister(562);
+ break;
+ case 24:
+ if (niche[1][niche[1][3]] > 0)
+ readItemRegister(niche[1][niche[1][3]]);
+ else
+ readItemRegister(562);
+ break;
+ }
+ else
+ readItemRegister(currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[destinationStepX][destinationStepY]]->fileIndex);
+ if (regobj.lookAtTextRef > 0)
+ drawText(regobj.lookAtTextRef);
+ actionCode = 0;
+ }
+ break;
+ case 4: // use
+ roomChange = false;
+ actionCode = 0;
+ useScreenObject();
+ cpCounter = cpCounter2;
+ break;
+ case 5: // open
+ roomChange = false;
+ actionCode = 0;
+ openScreenObject();
+ break;
+ case 6: { // close
+ roomChange = false;
+ actionCode = 0;
+ closeScreenObject();
+ cpCounter = cpCounter2;
+ } break;
+ }
+ } else if (mouseClickY > 148 && mouseClickY < 158) {
+ if (mouseClickX >= 3 && mouseClickX <= 53) {
+ actionCode = 1;
+ action();
+ break;
+ } else if (mouseClickX >= 58 && mouseClickX <= 103) {
+ actionCode = 2;
+ action();
+ break;
+ } else if (mouseClickX >= 108 && mouseClickX <= 153) {
+ actionCode = 3;
+ action();
+ break;
+ } else if (mouseClickX >= 158 && mouseClickX <= 198) {
+ actionCode = 4;
+ action();
+ break;
+ } else if (mouseClickX >= 203 && mouseClickX <= 248) {
+ actionCode = 5;
+ action();
+ break;
+ } else if (mouseClickX >= 253 && mouseClickX <= 311) {
+ actionCode = 6;
+ action();
+ break;
+ } else {
+ actionCode = 0;
+ action();
+ cpCounter2 = cpCounter;
+ }
+ } else if (mouseClickY > 166 && mouseClickY < 199) {
+ if (mouseClickX >= 3 && mouseClickX <= 19) {
+ drawInventory(0, 33);
+ break;
+ } else if (mouseClickX >= 26 && mouseClickX <= 65) {
+ handleAction(inventoryPosition);
+ break;
+ } else if (mouseClickX >= 70 && mouseClickX <= 108) {
+ handleAction(inventoryPosition + 1);
+ break;
+ } else if (mouseClickX >= 113 && mouseClickX <= 151) {
+ handleAction(inventoryPosition + 2);
+ break;
+ } else if (mouseClickX >= 156 && mouseClickX <= 194) {
+ handleAction(inventoryPosition + 3);
+ break;
+ } else if (mouseClickX >= 199 && mouseClickX <= 237) {
+ handleAction(inventoryPosition + 4);
+ break;
+ } else if (mouseClickX >= 242 && mouseClickX <= 280) {
+ handleAction(inventoryPosition + 5);
+ break;
+ } else if (mouseClickX >= 290 && mouseClickX <= 311) {
+ drawInventory(1, 33);
+ break;
+ } else {
+ actionCode = 0;
+ action();
+ }
+ }
+ } else if (e.type == Common::EVENT_RBUTTONUP) {
+ mouseClickX = e.mouse.x;
+ mouseClickY = e.mouse.y;
+ destinationStepX = (mouseClickX + 7) / xGridCount;
+ destinationStepY = (mouseClickY + 7) / yGridCount;
+ cpCounter2 = cpCounter;
+ if (destinationStepY < 28) {
+ RoomObjectListEntry obj = *currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[destinationStepX][destinationStepY]];
+ if (obj.fileIndex > 0) {
+
+ drawLookAtItem(obj);
+ goToObject(currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount], currentRoomData->walkAreasGrid[destinationStepX][destinationStepY]);
+ if (obj.fileIndex == 562)
+
+ switch (currentRoomData->code) {
+ case 20:
+ if (niche[0][niche[0][3]] > 0)
+ readItemRegister(niche[0][niche[0][3]]);
+ else
+ readItemRegister(562);
+ break;
+ case 24:
+ if (niche[1][niche[1][3]] > 0)
+ readItemRegister(niche[1][niche[1][3]]);
+ else
+ readItemRegister(562);
+ break;
+ }
+ else
+ readItemRegister(obj.fileIndex);
+ if (regobj.lookAtTextRef > 0)
+ drawText(regobj.lookAtTextRef);
+ actionCode = 0;
+ }
+ }
+ }
+ }
+
+ checkMouseGrid();
+ advanceAnimations(false, true);
+
+ // Scene changes
+ if (xframe2 == 0 && roomChange) {
+ changeRoom();
+ }
+
+ if (escapePressed && xframe2 == 0) {
+ freeAnimation();
+ freeScreenObjects();
+ cpCounter2 = cpCounter;
+ startNewGame = false;
+ continueGame = false;
+ g_engine->saveAutosaveIfEnabled();
+ g_engine->_graphics->totalFadeOut(0);
+ g_engine->_sound->fadeOutMusic(musicVolLeft, musicVolRight);
+ g_engine->_graphics->clear();
+ g_engine->_sound->playMidi("INTRODUC", true);
+ g_engine->_sound->fadeInMusic(musicVolLeft, musicVolRight);
+ initialMenu(true);
+ verifyCopyProtection2();
+
+ if (startNewGame && !g_engine->shouldQuit()) {
+ newGame();
+ } else if (continueGame && !g_engine->shouldQuit())
+ loadTemporaryGame();
+ else {
+ isSavingDisabled = true;
+ g_engine->openMainMenuDialog();
+ cpCounter = cpCounter2;
+ isSavingDisabled = false;
+ }
+ g_engine->_sound->fadeOutMusic(musicVolLeft, musicVolRight);
+ switch (gamePart) {
+ case 1:
+ g_engine->_sound->playMidi("PRIMERA", true);
+ break;
+ case 2:
+ g_engine->_sound->playMidi("SEGUNDA", true);
+ break;
+ }
+ g_engine->_sound->fadeInMusic(musicVolLeft, musicVolRight);
+ }
+
+ switch (gamePart) {
+ case 1:
+ if (list1Complete && list2Complete) {
+ list1Complete = false;
+ list2Complete = false;
+ cpCounter = cpCounter2;
+ gamePart = 2;
+ iframe = 0;
+ freeInventory();
+ freeAnimation();
+ freeScreenObjects();
+ g_engine->_mouseManager->hide();
+ g_engine->_graphics->partialFadeOut(234);
+ g_engine->_sound->fadeOutMusic(musicVolLeft, musicVolRight);
+ g_engine->_sound->playMidi("CREDITOS", true);
+ g_engine->_sound->fadeInMusic(musicVolLeft, musicVolRight);
+ if (cpCounter2 > 43)
+ showError(274);
+ sacrificeScene();
+ g_engine->_graphics->clear();
+ loadObjects();
+ g_engine->_graphics->loadPaletteFromFile("SEGUNDA");
+ currentTrajectoryIndex = 0;
+ characterPosX = 160;
+ characterPosY = 60;
+ trajectory[currentTrajectoryIndex].x = characterPosX;
+ trajectory[currentTrajectoryIndex].y = characterPosY;
+ loadScreenData(20);
+ g_engine->_sound->fadeOutMusic(musicVolLeft, musicVolRight);
+ g_engine->_sound->playMidi("SEGUNDA", true);
+ g_engine->_sound->fadeInMusic(musicVolLeft, musicVolRight);
+ g_engine->_graphics->sceneTransition(1, false, sceneBackground);
+ mask();
+ inventoryPosition = 0;
+ drawBackpack();
+ g_engine->_mouseManager->show();
+
+ firstTimeTopicA[8] = true;
+ oldGridX = 0;
+ oldGridY = 0;
+ checkMouseGrid();
+ }
+ break;
+ }
+
+ // Debug graphics
+ {
+ // g_engine->_graphics->euroText(Common::String::format("Room: %d", currentRoomNumber), 0, 0, 220, Graphics::kTextAlignLeft);
+ // g_engine->_mouseManager->printPos(xraton, yraton, 220, 0);
+ // printPos(characterPosX, characterPosY, 220, 10, "CharPos");
+ if (g_engine->_showMouseGrid) {
+ drawMouseGrid(currentRoomData);
+ }
+ if (g_engine->_showScreenGrid) {
+ drawScreenGrid(currentRoomData);
+ }
+ if (g_engine->_showGameGrid) {
+ drawGrid();
+ }
+
+ if (g_engine->_drawObjectAreas) {
+ for (int i = 0; i < depthLevelCount; i++) {
+ if (screenLayers[i] != NULL) {
+ if (true) {
+ // debug
+ uint16 w = READ_LE_UINT16(screenLayers[i]);
+ uint16 h = READ_LE_UINT16(screenLayers[i] + 2);
+ Common::Rect r = Common::Rect(depthMap[i].posx, depthMap[i].posy, depthMap[i].posx + w, depthMap[i].posy + h);
+ drawRect(180, depthMap[i].posx, depthMap[i].posy, depthMap[i].posx + w, depthMap[i].posy + h);
+
+ littText(r.left, r.top, Common::String().format("%d", i), 0);
+ }
+ }
+ }
+ }
+ }
+
+ g_engine->_screen->update();
+ g_system->delayMillis(10);
+ }
+ g_engine->_mouseManager->hide();
+ if (!g_engine->shouldQuit()) {
+ ending();
+ }
+ if (!g_engine->shouldQuit()) {
+ obtainName(photoFileName);
+ }
+ if (!g_engine->shouldQuit()) {
+ generateDiploma(photoFileName);
+ }
+ if (!g_engine->shouldQuit()) {
+ credits();
+ }
+ return EXIT_SUCCESS;
+}
+
+void TotEngine::newGame() {
+ saveAllowed = true;
+ g_engine->_mouseManager->hide();
+ obtainName(characterName);
+
+ if (!g_engine->shouldQuit()) {
+ g_engine->_graphics->totalFadeOut(0);
+ g_engine->_graphics->clear();
+ displayLoading();
+ freeInventory();
+ loadObjects();
+ resetGameState();
+ inGame = true;
+ for (int i = 0; i < inventoryIconCount; i++) {
+ inventory[i].bitmapIndex = 34;
+ inventory[i].code = 0;
+ inventory[i].objectName = getObjectName(10);
+ }
+ readConversationFile(Common::String("CONVERSA.TRE"));
+ initializeScreenFile();
+ initializeObjectFile();
+ g_engine->_graphics->loadPaletteFromFile("DEFAULT");
+ loadScreenData(1);
+ g_engine->_graphics->sceneTransition(13, false, sceneBackground);
+ mask();
+ inventoryPosition = 0;
+ drawBackpack();
+ iframe = 0;
+ g_engine->_mouseManager->show();
+ }
+}
+
+void TotEngine::changeRoom() {
+ roomChange = false;
+ cpCounter = cpCounter2;
+ setRoomTrajectories(secondaryAnimHeight, secondaryAnimWidth, RESTORE);
+ saveRoomData(currentRoomData, rooms);
+ // verifyCopyProtection();
+ g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
+
+ switch (currentRoomData->doors[doorIndex].nextScene) {
+ case 2: {
+ transitionEffect = Random(15) + 1;
+ iframe = 0;
+ currentTrajectoryIndex = 0;
+ characterPosX = currentRoomData->doors[doorIndex].exitPosX - characterCorrectionX;
+ characterPosY = currentRoomData->doors[doorIndex].exitPosY - characerCorrectionY;
+ trajectory[currentTrajectoryIndex].x = characterPosX;
+ trajectory[currentTrajectoryIndex].y = characterPosY;
+ freeAnimation();
+ freeScreenObjects();
+ g_engine->_mouseManager->hide();
+
+ g_engine->_graphics->sceneTransition(transitionEffect, true, NULL);
+ g_engine->_sound->stopVoc();
+ loadScreenData(currentRoomData->doors[doorIndex].nextScene);
+ if (cpCounter > 89)
+ showError(274);
+ g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
+ if (isTVOn)
+ g_engine->_sound->autoPlayVoc("PARASITO", 355778, 20129);
+ else
+ loadTV();
+ g_engine->_graphics->sceneTransition(transitionEffect, false, sceneBackground);
+ cpCounter = cpCounter2;
+ g_engine->_mouseManager->show();
+ oldGridX = 0;
+ oldGridY = 0;
+ } break;
+ case 5: {
+ if (currentRoomData->code != 6) {
+ transitionEffect = Random(15) + 1;
+ iframe = 0;
+ currentTrajectoryIndex = 0;
+ characterPosX = currentRoomData->doors[doorIndex].exitPosX - characterCorrectionX;
+ characterPosY = currentRoomData->doors[doorIndex].exitPosY - characerCorrectionY + 15;
+ trajectory[currentTrajectoryIndex].x = characterPosX;
+ trajectory[currentTrajectoryIndex].y = characterPosY;
+ freeAnimation();
+ freeScreenObjects();
+ g_engine->_mouseManager->hide();
+ g_engine->_graphics->sceneTransition(transitionEffect, true, NULL);
+ loadScreenData(currentRoomData->doors[doorIndex].nextScene);
+ g_engine->_sound->stopVoc();
+ g_engine->_sound->autoPlayVoc("CALDERA", 6433, 15386);
+ g_engine->_sound->setSfxVolume(leftSfxVol, 0);
+ g_engine->_graphics->sceneTransition(transitionEffect, false, sceneBackground);
+ g_engine->_mouseManager->show();
+ oldGridX = 0;
+ oldGridY = 0;
+ checkMouseGrid();
+ } else {
+
+ currentZone = currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount];
+ targetZone = 21;
+ goToObject(currentZone, targetZone);
+ freeAnimation();
+ freeScreenObjects();
+ g_engine->_mouseManager->hide();
+ g_engine->_sound->setSfxVolume(leftSfxVol, 0);
+ loadScrollData(currentRoomData->doors[doorIndex].nextScene, true, 22, -2);
+ g_engine->_mouseManager->show();
+ oldGridX = 0;
+ oldGridY = 0;
+ checkMouseGrid();
+ }
+ } break;
+ case 6: {
+ currentZone = currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount];
+ targetZone = 27;
+ goToObject(currentZone, targetZone);
+ freeAnimation();
+ freeScreenObjects();
+ g_engine->_mouseManager->hide();
+ g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
+ loadScrollData(currentRoomData->doors[doorIndex].nextScene, false, 22, 2);
+ g_engine->_mouseManager->show();
+ oldGridX = 0;
+ oldGridY = 0;
+ checkMouseGrid();
+ } break;
+ case 9: {
+ transitionEffect = Random(15) + 1;
+ freeAnimation();
+ freeScreenObjects();
+ g_engine->_mouseManager->hide();
+ g_engine->_graphics->sceneTransition(transitionEffect, true, NULL);
+ iframe = 0;
+ currentTrajectoryIndex = 0;
+ characterPosX = currentRoomData->doors[doorIndex].exitPosX - characterCorrectionX;
+ characterPosY = currentRoomData->doors[doorIndex].exitPosY - characerCorrectionY;
+ trajectory[currentTrajectoryIndex].x = characterPosX;
+ trajectory[currentTrajectoryIndex].y = characterPosY;
+ loadScreenData(currentRoomData->doors[doorIndex].nextScene);
+ g_engine->_graphics->sceneTransition(transitionEffect, false, sceneBackground);
+ g_engine->_mouseManager->show();
+
+ oldGridX = 0;
+ oldGridY = 0;
+ checkMouseGrid();
+ } break;
+ case 12: {
+ if (currentRoomData->code != 13) {
+ transitionEffect = Random(15) + 1;
+ iframe = 0;
+ currentTrajectoryIndex = 0;
+ characterPosX = currentRoomData->doors[doorIndex].exitPosX - characterCorrectionX;
+ characterPosY = currentRoomData->doors[doorIndex].exitPosY - characerCorrectionY;
+ trajectory[currentTrajectoryIndex].x = characterPosX;
+ trajectory[currentTrajectoryIndex].y = characterPosY;
+ freeAnimation();
+ freeScreenObjects();
+ g_engine->_mouseManager->hide();
+ g_engine->_graphics->sceneTransition(transitionEffect, true, NULL);
+ loadScreenData(currentRoomData->doors[doorIndex].nextScene);
+ g_engine->_graphics->sceneTransition(transitionEffect, false, sceneBackground);
+ g_engine->_mouseManager->show();
+ oldGridX = 0;
+ oldGridY = 0;
+ g_engine->_mouseManager->show();
+ } else {
+
+ currentZone = currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount];
+ goToObject(currentZone, targetZone);
+ freeAnimation();
+ freeScreenObjects();
+ g_engine->_mouseManager->hide();
+ loadScrollData(currentRoomData->doors[doorIndex].nextScene, false, 64, 0);
+ g_engine->_mouseManager->show();
+ oldGridX = 0;
+ oldGridY = 0;
+ checkMouseGrid();
+ }
+ } break;
+ case 13: {
+ switch (currentRoomData->code) {
+ case 12: {
+ currentZone = currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount];
+ goToObject(currentZone, targetZone);
+ freeAnimation();
+ freeScreenObjects();
+ g_engine->_mouseManager->hide();
+ loadScrollData(currentRoomData->doors[doorIndex].nextScene, true, 64, 0);
+ g_engine->_mouseManager->show();
+ oldGridX = 0;
+ oldGridY = 0;
+ checkMouseGrid();
+ } break;
+ case 14: {
+ currentZone = currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount];
+ goToObject(currentZone, targetZone);
+ freeAnimation();
+ freeScreenObjects();
+ g_engine->_mouseManager->hide();
+ loadScrollData(currentRoomData->doors[doorIndex].nextScene, false, 56, 0);
+ g_engine->_mouseManager->show();
+ oldGridX = 0;
+ oldGridY = 0;
+ checkMouseGrid();
+ } break;
+ }
+ } break;
+ case 14: {
+ if (currentRoomData->code != 13) {
+ transitionEffect = Random(15) + 1;
+ iframe = 0;
+ currentTrajectoryIndex = 0;
+ characterPosX = currentRoomData->doors[doorIndex].exitPosX - characterCorrectionX;
+ characterPosY = currentRoomData->doors[doorIndex].exitPosY - characerCorrectionY;
+ trajectory[currentTrajectoryIndex].x = characterPosX;
+ trajectory[currentTrajectoryIndex].y = characterPosY;
+ freeAnimation();
+ freeScreenObjects();
+ g_engine->_mouseManager->hide();
+ g_engine->_graphics->sceneTransition(transitionEffect, true, NULL);
+ loadScreenData(currentRoomData->doors[doorIndex].nextScene);
+ g_engine->_graphics->sceneTransition(transitionEffect, false, sceneBackground);
+ g_engine->_mouseManager->show();
+ oldGridX = 0;
+ oldGridY = 0;
+ checkMouseGrid();
+ } else {
+
+ currentZone = currentRoomData->walkAreasGrid[((characterPosX + characterCorrectionX) / xGridCount)][((characterPosY + characerCorrectionY) / yGridCount)];
+ goToObject(currentZone, targetZone);
+ freeAnimation();
+ freeScreenObjects();
+ g_engine->_mouseManager->hide();
+ loadScrollData(currentRoomData->doors[doorIndex].nextScene, true, 56, 0);
+ g_engine->_mouseManager->show();
+ oldGridX = 0;
+ oldGridY = 0;
+ checkMouseGrid();
+ }
+ } break;
+ case 17: {
+ transitionEffect = Random(15) + 1;
+ iframe = 0;
+ currentTrajectoryIndex = 0;
+ characterPosX = currentRoomData->doors[doorIndex].exitPosX - characterCorrectionX;
+ characterPosY = currentRoomData->doors[doorIndex].exitPosY - characerCorrectionY;
+ trajectory[currentTrajectoryIndex].x = characterPosX;
+ trajectory[currentTrajectoryIndex].y = characterPosY;
+ freeAnimation();
+ freeScreenObjects();
+ g_engine->_mouseManager->hide();
+ g_engine->_graphics->sceneTransition(transitionEffect, true, NULL);
+ g_engine->_sound->stopVoc();
+ loadScreenData(currentRoomData->doors[doorIndex].nextScene);
+ if (bookTopic[0] == true && currentRoomData->animationFlag == true)
+ disableSecondAnimation();
+ if (cpCounter > 89)
+ showError(274);
+ g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
+ g_engine->_graphics->sceneTransition(transitionEffect, false, sceneBackground);
+ cpCounter = cpCounter2;
+ g_engine->_mouseManager->show();
+ oldGridX = 0;
+ oldGridY = 0;
+ checkMouseGrid();
+ } break;
+ case 18: {
+ if (currentRoomData->code != 19) {
+ transitionEffect = Random(15) + 1;
+ iframe = 0;
+ currentTrajectoryIndex = 0;
+ characterPosX = currentRoomData->doors[doorIndex].exitPosX - characterCorrectionX;
+ characterPosY = currentRoomData->doors[doorIndex].exitPosY - characerCorrectionY;
+ trajectory[currentTrajectoryIndex].x = characterPosX;
+ trajectory[currentTrajectoryIndex].y = characterPosY;
+ freeAnimation();
+ freeScreenObjects();
+ g_engine->_mouseManager->hide();
+ g_engine->_graphics->sceneTransition(transitionEffect, true, NULL);
+ loadScreenData(currentRoomData->doors[doorIndex].nextScene);
+ g_engine->_graphics->sceneTransition(transitionEffect, false, sceneBackground);
+ g_engine->_mouseManager->show();
+ oldGridX = 0;
+ oldGridY = 0;
+ checkMouseGrid();
+ } else {
+
+ currentZone = currentRoomData->walkAreasGrid[((characterPosX + characterCorrectionX) / xGridCount)][((characterPosY + characerCorrectionY) / yGridCount)];
+ goToObject(currentZone, targetZone);
+ freeAnimation();
+ freeScreenObjects();
+ g_engine->_mouseManager->hide();
+ loadScrollData(currentRoomData->doors[doorIndex].nextScene, true, 131, -1);
+ g_engine->_mouseManager->show();
+ oldGridX = 0;
+ oldGridY = 0;
+ checkMouseGrid();
+ }
+ } break;
+ case 19: {
+ if (currentRoomData->code != 18) {
+ transitionEffect = Random(15) + 1;
+ iframe = 0;
+ currentTrajectoryIndex = 0;
+ characterPosX = currentRoomData->doors[doorIndex].exitPosX - characterCorrectionX;
+ characterPosY = currentRoomData->doors[doorIndex].exitPosY - characerCorrectionY;
+ trajectory[currentTrajectoryIndex].x = characterPosX;
+ trajectory[currentTrajectoryIndex].y = characterPosY;
+ freeAnimation();
+ freeScreenObjects();
+ g_engine->_mouseManager->hide();
+ g_engine->_graphics->sceneTransition(transitionEffect, true, NULL);
+ loadScreenData(currentRoomData->doors[doorIndex].nextScene);
+ g_engine->_graphics->sceneTransition(transitionEffect, false, sceneBackground);
+ g_engine->_mouseManager->show();
+ oldGridX = 0;
+ oldGridY = 0;
+ checkMouseGrid();
+ } else {
+
+ currentZone = currentRoomData->walkAreasGrid[((characterPosX + characterCorrectionX) / xGridCount)][((characterPosY + characerCorrectionY) / yGridCount)];
+ goToObject(currentZone, targetZone);
+ freeAnimation();
+ freeScreenObjects();
+ g_engine->_mouseManager->hide();
+ loadScrollData(currentRoomData->doors[doorIndex].nextScene, false, 131, 1);
+ g_engine->_mouseManager->show();
+ oldGridX = 0;
+ oldGridY = 0;
+ checkMouseGrid();
+ }
+ } break;
+ case 20: {
+ transitionEffect = Random(15) + 1;
+ iframe = 0;
+ currentTrajectoryIndex = 0;
+ characterPosX = currentRoomData->doors[doorIndex].exitPosX - characterCorrectionX;
+ characterPosY = currentRoomData->doors[doorIndex].exitPosY - characerCorrectionY;
+ trajectory[currentTrajectoryIndex].x = characterPosX;
+ trajectory[currentTrajectoryIndex].y = characterPosY;
+ freeAnimation();
+ freeScreenObjects();
+ g_engine->_mouseManager->hide();
+ g_engine->_graphics->sceneTransition(transitionEffect, true, NULL);
+ g_engine->_sound->stopVoc();
+ loadScreenData(currentRoomData->doors[doorIndex].nextScene);
+ switch (niche[0][niche[0][3]]) {
+ case 0:
+ currentRoomData->screenObjectIndex[9]->objectName = getObjectName(4);
+ break;
+ case 561:
+ currentRoomData->screenObjectIndex[9]->objectName = getObjectName(5);
+ break;
+ case 563:
+ currentRoomData->screenObjectIndex[9]->objectName = getObjectName(6);
+ break;
+ case 615:
+ currentRoomData->screenObjectIndex[9]->objectName = getObjectName(7);
+ break;
+ }
+ if (cpCounter > 89)
+ showError(274);
+ g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
+ if (currentRoomData->code == 4)
+ g_engine->_sound->loadVoc("GOTA", 140972, 1029);
+ g_engine->_graphics->sceneTransition(transitionEffect, false, sceneBackground);
+ cpCounter = cpCounter2;
+ g_engine->_mouseManager->show();
+ oldGridX = 0;
+ oldGridY = 0;
+ checkMouseGrid();
+ } break;
+ case 24: {
+ transitionEffect = Random(15) + 1;
+ iframe = 0;
+ currentTrajectoryIndex = 0;
+ characterPosX = currentRoomData->doors[doorIndex].exitPosX - characterCorrectionX;
+ characterPosY = currentRoomData->doors[doorIndex].exitPosY - characerCorrectionY;
+ trajectory[currentTrajectoryIndex].x = characterPosX;
+ trajectory[currentTrajectoryIndex].y = characterPosY;
+ freeAnimation();
+ freeScreenObjects();
+ g_engine->_mouseManager->hide();
+ g_engine->_graphics->sceneTransition(transitionEffect, true, NULL);
+ g_engine->_sound->stopVoc();
+ loadScreenData(currentRoomData->doors[doorIndex].nextScene);
+ switch (niche[1][niche[1][3]]) {
+ case 0:
+ currentRoomData->screenObjectIndex[8]->objectName = getObjectName(4);
+ break;
+ case 561:
+ currentRoomData->screenObjectIndex[8]->objectName = getObjectName(5);
+ break;
+ case 615:
+ currentRoomData->screenObjectIndex[8]->objectName = getObjectName(7);
+ break;
+ case 622:
+ currentRoomData->screenObjectIndex[8]->objectName = getObjectName(8);
+ break;
+ case 623:
+ currentRoomData->screenObjectIndex[8]->objectName = getObjectName(9);
+ break;
+ }
+ if (cpCounter > 89)
+ showError(274);
+ g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
+ if (isTrapSet) {
+ currentRoomData->animationFlag = true;
+ loadAnimation(currentRoomData->animationName);
+ iframe2 = 0;
+ currentSecondaryTrajectoryIndex = 1;
+ currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].x = 214 - 15;
+ currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].y = 115 - 42;
+ secondaryAnimation.dir = currentRoomData->secondaryAnimDirections[currentSecondaryTrajectoryIndex - 1];
+ secondaryAnimation.posx = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].x;
+ secondaryAnimation.posy = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].y;
+ secondaryAnimation.depth = 14;
+
+ for (int i = 0; i < maxXGrid; i++)
+ for (int j = 0; j < maxYGrid; j++) {
+ if (maskGridSecondaryAnim[i][j] > 0) {
+ currentRoomData->walkAreasGrid[oldposx + i][oldposy + j] = maskGridSecondaryAnim[i][j];
+ }
+ if (maskMouseSecondaryAnim[i][j] > 0)
+ currentRoomData->mouseGrid[oldposx + i][oldposy + j] = maskMouseSecondaryAnim[i][j];
+ }
+ assembleScreen();
+ }
+ g_engine->_graphics->sceneTransition(transitionEffect, false, sceneBackground);
+ if ((isRedDevilCaptured == false) && (isTrapSet == false))
+ runaroundRed();
+ cpCounter = cpCounter2;
+ g_engine->_mouseManager->show();
+ oldGridX = 0;
+ oldGridY = 0;
+ checkMouseGrid();
+ } break;
+ case 255:
+ wcScene();
+ break;
+ default: {
+ transitionEffect = Random(15) + 1;
+ iframe = 0;
+ currentTrajectoryIndex = 0;
+ characterPosX = currentRoomData->doors[doorIndex].exitPosX - characterCorrectionX;
+ characterPosY = currentRoomData->doors[doorIndex].exitPosY - characerCorrectionY;
+ trajectory[currentTrajectoryIndex].x = characterPosX;
+ trajectory[currentTrajectoryIndex].y = characterPosY;
+ freeAnimation();
+ freeScreenObjects();
+ g_engine->_mouseManager->hide();
+ g_engine->_graphics->sceneTransition(transitionEffect, true, NULL);
+ g_engine->_sound->stopVoc();
+ loadScreenData(currentRoomData->doors[doorIndex].nextScene);
+ if (cpCounter > 89)
+ showError(274);
+ g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
+ switch (currentRoomData->code) {
+ case 4:
+ g_engine->_sound->loadVoc("GOTA", 140972, 1029);
+ break;
+ case 23:
+ g_engine->_sound->autoPlayVoc("FUENTE", 0, 0);
+ break;
+ }
+ g_engine->_graphics->sceneTransition(transitionEffect, false, sceneBackground);
+ cpCounter = cpCounter2;
+ g_engine->_mouseManager->show();
+ oldGridX = 0;
+ oldGridY = 0;
+ checkMouseGrid();
+ }
+ }
+ oldTargetZone = 0;
+}
+
} // End of namespace Tot
diff --git a/engines/tot/tot.h b/engines/tot/tot.h
index 0216498214a..e58572af662 100644
--- a/engines/tot/tot.h
+++ b/engines/tot/tot.h
@@ -58,6 +58,12 @@ private:
*/
Common::Error syncGame(Common::Serializer &s);
+ int engineStart();
+ int startGame();
+ void newGame();
+ void changeRoom();
+ void loadTemporaryGame();
+
protected:
// Engine APIs
Common::Error run() override;
diff --git a/engines/tot/util.cpp b/engines/tot/util.cpp
index 5d53fdc0fb7..c085743f895 100644
--- a/engines/tot/util.cpp
+++ b/engines/tot/util.cpp
@@ -83,7 +83,7 @@ void showError(int code) {
error("Error 152: Unidad no preparada.");
break;
case 153:
- error("Error %d: JOZU!! que Barbari\xA0.");
+ error("Error 153: JOZU!! que Barbari\xA0.");
break;
case 154:
error("Error 154: Comprobaci\xA2n err\xA2nea en el control de redundancia c\xA1"
diff --git a/engines/tot/vars.cpp b/engines/tot/vars.cpp
index 3b246d7d19c..ebc343b7a6c 100644
--- a/engines/tot/vars.cpp
+++ b/engines/tot/vars.cpp
@@ -27,9 +27,6 @@
namespace Tot {
-int doserror = 0;
-int exitcode = 0;
-
Common::MemorySeekableReadWriteStream *conversationData;
Common::MemorySeekableReadWriteStream *rooms;
Common::MemorySeekableReadWriteStream *invItemData;
Commit: 93b9a54496ee7b8fa35fd4ec3c6252c5d66bbcd1
https://github.com/scummvm/scummvm/commit/93b9a54496ee7b8fa35fd4ec3c6252c5d66bbcd1
Author: gsanmartin (gabriel.sanmartin at dna.inc)
Date: 2025-09-08T16:49:50+02:00
Commit Message:
TOT: Remove global vars from
Changed paths:
A engines/tot/debug.cpp
A engines/tot/debug.h
A engines/tot/types.h
R engines/tot/routines.h
R engines/tot/routines2.h
engines/tot/anims.cpp
engines/tot/chrono.cpp
engines/tot/chrono.h
engines/tot/console.cpp
engines/tot/dialog.cpp
engines/tot/dialog.h
engines/tot/graphics.cpp
engines/tot/graphics.h
engines/tot/module.mk
engines/tot/mouse.cpp
engines/tot/mouse.h
engines/tot/routines.cpp
engines/tot/routines2.cpp
engines/tot/saveload.cpp
engines/tot/sound.cpp
engines/tot/sound.h
engines/tot/tot.cpp
engines/tot/tot.h
engines/tot/vars.cpp
engines/tot/vars.h
diff --git a/engines/tot/anims.cpp b/engines/tot/anims.cpp
index 309f42dd3ed..17ebeb8cf33 100644
--- a/engines/tot/anims.cpp
+++ b/engines/tot/anims.cpp
@@ -114,7 +114,7 @@ void handleFlcEvent(byte eventNumber) {
bool isEnglish = !isSpanish;
switch (eventNumber) {
case 0:
- if (cpCounter > 103)
+ if (g_engine->_cpCounter > 103)
showError(274);
break;
case 1:
@@ -899,7 +899,7 @@ void blit(const Graphics::Surface *src, Common::Rect bounds) {
for (int i = 0; i < height - 1; i++) {
for (int j = 0; j < width - 1; j++) {
- *((byte *)dest.getBasePtr(j, i)) = *((byte *)src->getBasePtr(j, i));
+ *((byte *)dest.getBasePtr(j, i)) = *((const byte *)src->getBasePtr(j, i));
}
}
g_engine->_screen->addDirtyRect(bounds);
@@ -967,32 +967,27 @@ static void loadFlc(
palette[2] = 0;
if (fullPalette) {
g_engine->_graphics->fadePalettes(g_engine->_graphics->getPalette(), palette);
- g_engine->_graphics->copyPalette(palette, pal);
+ g_engine->_graphics->copyPalette(palette, g_engine->_graphics->_pal);
} else if (limitPaletteTo200) {
g_engine->_graphics->setPalette(palette, 0, 200);
for (int i = 0; i <= 200; i++) {
- if(gamePart == 2 && !shouldQuitGame && (i == 131 || i == 134 || i == 143 || i == 187)) {
+ if(g_engine->_gamePart == 2 && !g_engine->_shouldQuitGame && (i == 131 || i == 134 || i == 143 || i == 187)) {
continue;
}
- pal[i * 3 + 0] = palette[i * 3 + 0];
- pal[i * 3 + 1] = palette[i * 3 + 1];
- pal[i * 3 + 2] = palette[i * 3 + 2];
+ g_engine->_graphics->_pal[i * 3 + 0] = palette[i * 3 + 0];
+ g_engine->_graphics->_pal[i * 3 + 1] = palette[i * 3 + 1];
+ g_engine->_graphics->_pal[i * 3 + 2] = palette[i * 3 + 2];
}
} else {
g_engine->_graphics->setPalette(palette);
- g_engine->_graphics->copyPalette(palette, pal);
+ g_engine->_graphics->copyPalette(palette, g_engine->_graphics->_pal);
}
}
// Make sure we also update the palette animations! Esp. for part 2
- if (currentRoomData != NULL && (currentRoomData->paletteAnimationFlag) && (palAnimStep >= 4) && !shouldQuitGame) {
- palAnimStep = 0;
- if (isPaletteAnimEnabled > 6)
- isPaletteAnimEnabled = 0;
- else isPaletteAnimEnabled += 1;
- g_engine->_graphics->updatePalette(isPaletteAnimEnabled);
- } else palAnimStep += 1;
-
+ if(g_engine->_currentRoomData != NULL && !g_engine->_shouldQuitGame) {
+ g_engine->_graphics->advancePaletteAnim();
+ }
gameTick = false;
} else {
break;
diff --git a/engines/tot/chrono.cpp b/engines/tot/chrono.cpp
index 6ecbfa900df..2ff86606320 100644
--- a/engines/tot/chrono.cpp
+++ b/engines/tot/chrono.cpp
@@ -31,7 +31,7 @@ bool gameTick = false;
bool gameTickHalfSpeed = false;
bool timeToDrawEffect = false;
-ChronoManager::ChronoManager(/* args */) : _lastTick(0), _lastDoubleTick(0) {
+ChronoManager::ChronoManager(/* args */) : _lastTick(0) {
}
ChronoManager::~ChronoManager() {
diff --git a/engines/tot/chrono.h b/engines/tot/chrono.h
index 5ffb4f81a06..d5004889ae3 100644
--- a/engines/tot/chrono.h
+++ b/engines/tot/chrono.h
@@ -38,8 +38,6 @@ const int kFrameEffectMs = 10;
class ChronoManager {
private:
uint32 _lastTick = 0;
- uint32 _lastTickEffect = 0;
- uint32 _lastDoubleTick = 0;
byte _tickCount = 0;
uint32 _lastEffectRender = 0;
byte _speedMultiplier = 1;
diff --git a/engines/tot/console.cpp b/engines/tot/console.cpp
index f0688f0a883..3b092bc1370 100644
--- a/engines/tot/console.cpp
+++ b/engines/tot/console.cpp
@@ -20,7 +20,6 @@
*/
#include "tot/console.h"
-#include "tot/routines.h"
#include "tot/vars.h"
namespace Tot {
@@ -67,7 +66,7 @@ bool TotConsole::cmdClearLayers(int argc, const char **argv) {
_engine->_showScreenGrid = false;
_engine->_showGameGrid = false;
_engine->_showMouseGrid = false;
- g_engine->_graphics->drawScreen(sceneBackground);
+ g_engine->_graphics->drawScreen(g_engine->sceneBackground);
debugPrintf("Cleared all debug layers");
return true;
}
@@ -80,18 +79,17 @@ bool TotConsole::cmdLoadRoom(int argc, const char **argv) {
debugPrintf("Invalid RoomID %d!\n", roomID);
return true;
}
- freeAnimation();
- freeScreenObjects();
- clearScreenData();
- loadScreenData(roomID);
- g_engine->_graphics->drawScreen(sceneBackground);
+ g_engine->freeAnimation();
+ g_engine->freeScreenObjects();
+ g_engine->loadScreenData(roomID);
+ g_engine->_graphics->drawScreen(g_engine->sceneBackground);
debugPrintf("Loaded screen %d", roomID);
return true;
}
bool TotConsole::cmdJumpToPart2(int argc, const char **argv) {
- list1Complete = true;
- list2Complete = true;
+ g_engine->_list1Complete = true;
+ g_engine->_list2Complete = true;
debugPrintf("Moving on to part 2 of the game");
return true;
}
diff --git a/engines/tot/debug.cpp b/engines/tot/debug.cpp
new file mode 100644
index 00000000000..e8200c905bb
--- /dev/null
+++ b/engines/tot/debug.cpp
@@ -0,0 +1,136 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "tot/debug.h"
+#include "tot/tot.h"
+#include "tot/vars.h"
+#include "debug.h"
+
+ namespace Tot {
+
+// Debug
+void drawMouseGrid(RoomFileRegister *screen) {
+ for (int i = 0; i < 39; i++) {
+ for (int j = 0; j < 27; j++) {
+ int color = screen->mouseGrid[i][j];
+ if (color != 0) {
+ int startX = i * kXGridCount + 7;
+ int startY = j * kYGridCount;
+ for (int i2 = 0; i2 < kXGridCount; i2 += 2) {
+ for (int j2 = 0; j2 < kYGridCount; j2++) {
+ int absPixel = startY + j2;
+ int offsetX = (absPixel % 2 == 0) ? 1 : 0;
+ if (offsetX < startX + kXGridCount && color != 0) {
+ *(byte *)g_engine->_screen->getBasePtr(startX + i2 + offsetX, startY + j2) = 255 - color;
+ }
+ }
+ }
+ }
+ }
+ }
+ g_engine->_screen->markAllDirty();
+}
+
+void drawScreenGrid(RoomFileRegister *screen) {
+ for (int i = 0; i < 39; i++) {
+ for (int j = 0; j < 27; j++) {
+ int color = screen->walkAreasGrid[i][j];
+ if (color != 0) {
+ int startX = i * kXGridCount + 7;
+ int startY = j * kYGridCount;
+ for (int i2 = 0; i2 < kXGridCount; i2 += 2) {
+ for (int j2 = 0; j2 < kYGridCount; j2++) {
+ int absPixel = startY + j2;
+ int offsetX = (absPixel % 2 == 0) ? 1 : 0;
+ if (offsetX < startX + kXGridCount && color != 0) {
+ *(byte *)g_engine->_screen->getBasePtr(startX + i2 + offsetX, startY + j2) = 255 - color;
+ }
+ }
+ }
+ }
+ }
+ }
+ g_engine->_screen->markAllDirty();
+}
+
+void drawPos(uint x, uint y, byte color) {
+ if (x < 320 && x > 0 && y > 0 && y < 200)
+ *(byte *)g_engine->_screen->getBasePtr(x, y) = color;
+
+ g_engine->_screen->addDirtyRect(Common::Rect(x, y, x + 1, y + 1));
+ g_engine->_screen->markAllDirty();
+}
+
+void drawLine(int x, int y, int x2, int y2, byte color) {
+ g_engine->_screen->drawLine(x, y, x2, y2, color);
+}
+
+void printNiches() {
+ debug("| | %03d | %03d | %03d | %03d |", 0, 1, 2, 3);
+ debug("| 0 | %03d | %03d | %03d | %03d |", g_engine->_niche[0][0], g_engine->_niche[0][1], g_engine->_niche[0][2], g_engine->_niche[0][3]);
+ debug("| 1 | %03d | %03d | %03d | %03d |", g_engine->_niche[1][0], g_engine->_niche[1][1], g_engine->_niche[1][2], g_engine->_niche[1][3]);
+ debug("niche[0][niche[0][3]] = %d", g_engine->_niche[0][g_engine->_niche[0][3]]);
+ debug("niche[1][niche[1][3]] = %d", g_engine->_niche[1][g_engine->_niche[1][3]]);
+}
+
+void drawX(int x, int y, byte color) {
+ if (x > 0 && y > 0)
+ *(byte *)g_engine->_screen->getBasePtr(x, y) = color;
+ if (x - 1 > 0 && y - 1 > 0)
+ *(byte *)g_engine->_screen->getBasePtr(x - 1, y - 1) = color;
+ if (x - 1 > 0 && y + 1 < 140)
+ *(byte *)g_engine->_screen->getBasePtr(x - 1, y + 1) = color;
+ if (x + 1 < 320 && y + 1 < 140)
+ *(byte *)g_engine->_screen->getBasePtr(x + 1, y + 1) = color;
+ if (x + 1 < 320 && y - 1 > 0)
+ *(byte *)g_engine->_screen->getBasePtr(x + 1, y - 1) = color;
+}
+
+void drawCharacterPosition() {
+ drawX(g_engine->_characterPosX, g_engine->_characterPosY, 210);
+ drawX(g_engine->_characterPosX + kCharacterCorrectionX, g_engine->_characterPosY + kCharacerCorrectionY, 218);
+}
+
+void drawRect(byte color, int x, int y, int x2, int y2) {
+ rectangle(x, y, x2, y2, color);
+}
+
+void printPos(int x, int y, int screenPosX, int screenPosY, const char *label) {
+ g_engine->_graphics->restoreBackgroundArea(screenPosX, screenPosY, screenPosX + 100, screenPosY + 10);
+ g_engine->_graphics->euroText(Common::String::format("%s: %d, %d", label, x, y), screenPosX, screenPosY, Graphics::kTextAlignLeft);
+}
+
+void drawGrid() {
+ int horizontal = 320 / kXGridCount;
+ int vertical = 140 / kYGridCount;
+ for (int i = 0; i < horizontal; i++) {
+ int startX = i * kXGridCount;
+ g_engine->_screen->drawLine(startX, 0, startX, 140, 200);
+ }
+
+ for (int j = 0; j < vertical; j++) {
+ int startY = j * kYGridCount;
+ g_engine->_screen->drawLine(0, startY, 320, startY, 200);
+ }
+ g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
+}
+
+ } // End of namespace Tot
diff --git a/engines/tot/debug.h b/engines/tot/debug.h
new file mode 100644
index 00000000000..de2f386203a
--- /dev/null
+++ b/engines/tot/debug.h
@@ -0,0 +1,43 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef TOT_DEBUG_H
+#define TOT_DEBUG_H
+
+#include "tot/tot.h"
+
+namespace Tot {
+
+ // Debug methods
+ void drawMouseGrid(RoomFileRegister *screen);
+ void drawScreenGrid(RoomFileRegister *screen);
+ void drawCharacterPosition();
+ void printPos(int x, int y, int screenPosX, int screenPosY, const char *label);
+ void drawPos(uint x, uint y, byte color);
+ void drawGrid();
+ void drawRect(byte color, int x, int y, int x2, int y2);
+ void drawX(int x, int y, byte color);
+ void drawLine(int x, int y, int x2, int y2, byte color);
+ void printNiches();
+
+} // End of namespace Tot
+
+#endif
diff --git a/engines/tot/dialog.cpp b/engines/tot/dialog.cpp
index c4e63c02226..a9664703929 100644
--- a/engines/tot/dialog.cpp
+++ b/engines/tot/dialog.cpp
@@ -23,8 +23,8 @@
#include "common/textconsole.h"
#include "tot/dialog.h"
-#include "tot/routines.h"
#include "tot/tot.h"
+#include "tot/vars.h"
namespace Tot {
@@ -37,7 +37,7 @@ bool endOfConversation;
Common::String decrypt(Common::String encryptedText) {
for (int i = 0; i < encryptedText.size(); i++) {
- encryptedText.setChar(decryptionKey[i] ^ (char)encryptedText[i], i);
+ encryptedText.setChar(g_engine->_decryptionKey[i] ^ (char)encryptedText[i], i);
}
return encryptedText;
}
@@ -84,21 +84,21 @@ void findDialogLine(byte characterIndex) {
step = NULL;
} break;
case '3':
- if (bookTopic[0] && (characterIndex == 3)) {
+ if (g_engine->_bookTopic[0] && (characterIndex == 3)) {
speak = false;
ascend = true;
} else
speak = true;
break;
case '4':
- if (firstTimeTopicA[characterIndex - 1]) {
+ if (g_engine->_firstTimeTopicA[characterIndex - 1]) {
speak = false;
ascend = true;
} else
speak = true;
break;
case '5':
- if (bookTopic[characterIndex - 1] && firstTimeTopicB[characterIndex - 1])
+ if (g_engine->_bookTopic[characterIndex - 1] && g_engine->_firstTimeTopicB[characterIndex - 1])
speak = true;
else {
speak = false;
@@ -106,7 +106,7 @@ void findDialogLine(byte characterIndex) {
}
break;
case '6':
- if (bookTopic[characterIndex - 1] && !firstTimeTopicB[characterIndex - 1])
+ if (g_engine->_bookTopic[characterIndex - 1] && !g_engine->_firstTimeTopicB[characterIndex - 1])
speak = true;
else {
speak = false;
@@ -114,10 +114,10 @@ void findDialogLine(byte characterIndex) {
}
break;
case '7':
- if (bookTopic[characterIndex - 1]) {
+ if (g_engine->_bookTopic[characterIndex - 1]) {
speak = false;
ascend = true;
- } else if (!firstTimeTopicA[characterIndex - 1])
+ } else if (!g_engine->_firstTimeTopicA[characterIndex - 1])
speak = true;
else {
speak = false;
@@ -125,7 +125,7 @@ void findDialogLine(byte characterIndex) {
}
break;
case '8':
- if (mintTopic[characterIndex - 1] && firstTimeTopicC[characterIndex - 1])
+ if (g_engine->_mintTopic[characterIndex - 1] && g_engine->_firstTimeTopicC[characterIndex - 1])
speak = true;
else {
speak = false;
@@ -133,7 +133,7 @@ void findDialogLine(byte characterIndex) {
}
break;
case '9':
- if (mintTopic[characterIndex - 1] && !firstTimeTopicC[characterIndex - 1])
+ if (g_engine->_mintTopic[characterIndex - 1] && !g_engine->_firstTimeTopicC[characterIndex - 1])
speak = true;
else {
speak = false;
@@ -141,7 +141,7 @@ void findDialogLine(byte characterIndex) {
}
break;
case 'A':
- if (!mintTopic[characterIndex - 1] && !firstTimeTopicA[characterIndex - 1])
+ if (!g_engine->_mintTopic[characterIndex - 1] && !g_engine->_firstTimeTopicA[characterIndex - 1])
speak = true;
else {
speak = false;
@@ -149,43 +149,43 @@ void findDialogLine(byte characterIndex) {
}
break;
case 'B':
- if (caves[0] && !firstTimeTopicA[8])
+ if (g_engine->_caves[0] && !g_engine->_firstTimeTopicA[8])
speak = true;
else
speak = false;
break;
case 'C':
- if (caves[1] && !firstTimeTopicA[8])
+ if (g_engine->_caves[1] && !g_engine->_firstTimeTopicA[8])
speak = true;
else
speak = false;
break;
case 'D':
- if ((caves[0] && caves[1]) && !firstTimeTopicA[8])
+ if ((g_engine->_caves[0] && g_engine->_caves[1]) && !g_engine->_firstTimeTopicA[8])
speak = true;
else
speak = false;
break;
case 'E':
- if ((caves[0] && !caves[2]) && !firstTimeTopicA[8])
+ if ((g_engine->_caves[0] && !g_engine->_caves[2]) && !g_engine->_firstTimeTopicA[8])
speak = true;
else
speak = false;
break;
case 'F':
- if (!caves[3])
+ if (!g_engine->_caves[3])
speak = true;
else
speak = false;
break;
case 'G':
- if (!caves[4])
+ if (!g_engine->_caves[4])
speak = true;
else
speak = false;
break;
case 'I':
- if (!isSealRemoved)
+ if (!g_engine->_isSealRemoved)
speak = true;
else
speak = false;
@@ -200,10 +200,10 @@ void findDialogLine(byte characterIndex) {
border = true;
switch (characterIndex) {
case 1:
- if (firstTimeTopicA[characterIndex - 1]) {
+ if (g_engine->_firstTimeTopicA[characterIndex - 1]) {
l1->item = 12;
forward = true;
- } else if (bookTopic[characterIndex - 1]) {
+ } else if (g_engine->_bookTopic[characterIndex - 1]) {
forward = true;
l1->item = 33;
} else {
@@ -212,7 +212,7 @@ void findDialogLine(byte characterIndex) {
}
break;
case 3:
- if (firstTimeTopicA[characterIndex - 1]) {
+ if (g_engine->_firstTimeTopicA[characterIndex - 1]) {
l1->item = 103;
forward = true;
} else {
@@ -321,13 +321,13 @@ void modifyTree(uint node) {
void drawTalkMenu() {
byte auxTextY;
- g_engine->_mouseManager->hide();
+ g_engine->_mouse->hide();
for (auxTextY = 25; auxTextY >= 1; auxTextY--)
rectangle(0, 175 - auxTextY, 319, 174 + auxTextY, 0);
for (auxTextY = 1; auxTextY <= 25; auxTextY++)
- buttonBorder(0, 175 - auxTextY, 319, 174 + auxTextY, 253, 253, 253, 253, 0);
- drawMenu(5);
- g_engine->_mouseManager->show();
+ g_engine->buttonBorder(0, 175 - auxTextY, 319, 174 + auxTextY, 253, 253, 253, 253, 0);
+ g_engine->drawMenu(5);
+ g_engine->_mouse->show();
}
void fixTree(Tree tree) {
@@ -346,87 +346,79 @@ void showDialogLine(Common::String conversationMatrix[16], uint &chosenTopic) {
firstChat = 1;
selectedConv = 0;
- g_engine->_mouseManager->hide();
+ g_engine->_mouse->hide();
- drawMenu(5);
+ g_engine->drawMenu(5);
euroText(6, 151, conversationMatrix[1], 255);
euroText(6, 162, conversationMatrix[2], 255);
euroText(6, 173, conversationMatrix[3], 255);
euroText(6, 184, conversationMatrix[4], 255);
- g_engine->_mouseManager->show();
+ g_engine->_mouse->show();
Common::Event e;
do {
bool lMouseClicked = false;
bool rMouseClicked = false;
do {
g_engine->_chrono->updateChrono();
- g_engine->_mouseManager->animateMouseIfNeeded();
+ g_engine->_mouse->animateMouseIfNeeded();
while (g_system->getEventManager()->pollEvent(e)) {
if (e.type == Common::EVENT_LBUTTONUP) {
lMouseClicked = true;
- mouseClickX = e.mouse.x;
- mouseClickY = e.mouse.y;
+ g_engine->_mouse->mouseClickX = e.mouse.x;
+ g_engine->_mouse->mouseClickY = e.mouse.y;
} else if (e.type == Common::EVENT_RBUTTONUP) {
rMouseClicked = true;
- mouseClickX = e.mouse.x;
- mouseClickY = e.mouse.y;
+ g_engine->_mouse->mouseClickX = e.mouse.x;
+ g_engine->_mouse->mouseClickY = e.mouse.y;
}
}
if (gameTick) {
- if (currentRoomData->paletteAnimationFlag && palAnimStep >= 4) {
- palAnimStep = 0;
- if (isPaletteAnimEnabled > 6)
- isPaletteAnimEnabled = 0;
- else
- isPaletteAnimEnabled += 1;
- g_engine->_graphics->updatePalette(isPaletteAnimEnabled);
- } else
- palAnimStep += 1;
+ g_engine->_graphics->advancePaletteAnim();
}
g_system->delayMillis(10);
g_engine->_screen->update();
} while (!lMouseClicked && !rMouseClicked && !g_engine->shouldQuit());
if (lMouseClicked) {
- if (mouseClickY < 143)
+ if (g_engine->_mouse->mouseClickY < 143)
selectedConv = 0;
else {
- if (mouseClickX >= 0 && mouseClickX <= 280) {
- if (mouseClickY >= 143 && mouseClickY <= 155) {
+ if (g_engine->_mouse->mouseClickX >= 0 && g_engine->_mouse->mouseClickX <= 280) {
+ if (g_engine->_mouse->mouseClickY >= 143 && g_engine->_mouse->mouseClickY <= 155) {
selectedConv = firstChat;
- } else if (mouseClickY >= 156 && mouseClickY <= 166) {
+ } else if (g_engine->_mouse->mouseClickY >= 156 && g_engine->_mouse->mouseClickY <= 166) {
selectedConv = firstChat + 1;
- } else if (mouseClickY >= 167 && mouseClickY <= 177) {
+ } else if (g_engine->_mouse->mouseClickY >= 167 && g_engine->_mouse->mouseClickY <= 177) {
selectedConv = firstChat + 2;
- } else if (mouseClickY >= 178 && mouseClickY <= 186) {
+ } else if (g_engine->_mouse->mouseClickY >= 178 && g_engine->_mouse->mouseClickY <= 186) {
selectedConv = firstChat + 3;
}
- } else if (mouseClickX >= 281 && mouseClickX <= 319) {
- if (mouseClickY >= 143 && mouseClickY <= 165) {
+ } else if (g_engine->_mouse->mouseClickX >= 281 && g_engine->_mouse->mouseClickX <= 319) {
+ if (g_engine->_mouse->mouseClickY >= 143 && g_engine->_mouse->mouseClickY <= 165) {
if (firstChat > 1) {
selectedConv = 0;
firstChat -= 1;
- g_engine->_mouseManager->hide();
- drawMenu(5);
+ g_engine->_mouse->hide();
+ g_engine->drawMenu(5);
euroText(6, 151, conversationMatrix[firstChat], 255);
euroText(6, 162, conversationMatrix[firstChat + 1], 255);
euroText(6, 173, conversationMatrix[firstChat + 2], 255);
euroText(6, 184, conversationMatrix[firstChat + 3], 255);
- g_engine->_mouseManager->show();
+ g_engine->_mouse->show();
}
- } else if (mouseClickY >= 167 && mouseClickY <= 186) {
+ } else if (g_engine->_mouse->mouseClickY >= 167 && g_engine->_mouse->mouseClickY <= 186) {
if (firstChat < 12) {
selectedConv = 0;
firstChat += 1;
- g_engine->_mouseManager->hide();
- drawMenu(5);
+ g_engine->_mouse->hide();
+ g_engine->drawMenu(5);
euroText(6, 151, conversationMatrix[firstChat], 255);
euroText(6, 162, conversationMatrix[firstChat + 1], 255);
euroText(6, 173, conversationMatrix[firstChat + 2], 255);
euroText(6, 184, conversationMatrix[firstChat + 3], 255);
- g_engine->_mouseManager->show();
+ g_engine->_mouse->show();
}
}
}
@@ -451,11 +443,11 @@ void talk(byte characterIndex) {
Common::String conversationMatrix[16];
drawTalkMenu();
endOfConversation = false;
- assignText();
+ g_engine->assignText();
// The original game makes a copy of the file upon starting a new game. .007 is the current game (the game
// that resumes when clicking "continue game" in the main menu. Part of the savegame data is this 007
// conversation file which marks conversatino topics as already gone through or not.
- readTree(*conversationData, ar, characterIndex - 1);
+ readTree(*g_engine->_conversationData, ar, characterIndex - 1);
loadTalkAnimations();
do {
@@ -467,9 +459,9 @@ void talk(byte characterIndex) {
conversationIndex = 0;
l1 = l;
do {
- verb.seek(verbRegSize * l1->item);
+ g_engine->_verbFile.seek(kVerbRegSize * l1->item);
conversationIndex += 1;
- text = readVerbRegister();
+ text = g_engine->readVerbRegister();
insertName = 0;
conversationMatrix[conversationIndex] = decrypt(text.text);
@@ -479,7 +471,7 @@ void talk(byte characterIndex) {
}
if (insertName > 0) {
conversationMatrix[conversationIndex].deleteChar(insertName);
- conversationMatrix[conversationIndex].insertString(characterName, insertName);
+ conversationMatrix[conversationIndex].insertString(g_engine->_characterName, insertName);
}
if (conversationMatrix[conversationIndex].size() > 45) {
stringAux = 45;
@@ -494,7 +486,7 @@ void talk(byte characterIndex) {
l1 = l;
showDialogLine(conversationMatrix, newNode);
delete l;
- hypertext(newNode, 255, 0, response, true);
+ g_engine->sayLine(newNode, 255, 0, response, true);
stringAux = 0;
modifyTree(newNode);
// verifyCopyProtection();
@@ -502,29 +494,29 @@ void talk(byte characterIndex) {
newNode = response;
stringAux += 1;
if (odd(stringAux))
- hypertext(newNode, 253, 249, response, true);
+ g_engine->sayLine(newNode, 253, 249, response, true);
else
- hypertext(newNode, 255, 0, response, true);
+ g_engine->sayLine(newNode, 255, 0, response, true);
switch (newNode) {
case 9: {
- obtainedList1 = true;
+ g_engine->_obtainedList1 = true;
invIndex = 0;
- while (inventory[invIndex].code != 0) {
+ while (g_engine->_inventory[invIndex].code != 0) {
invIndex += 1;
}
- inventory[invIndex].bitmapIndex = list1Index;
- inventory[invIndex].code = list1code;
- inventory[invIndex].objectName = getObjectName(0);
+ g_engine->_inventory[invIndex].bitmapIndex = kList1Index;
+ g_engine->_inventory[invIndex].code = kList1code;
+ g_engine->_inventory[invIndex].objectName = getObjectName(0);
} break;
case 25: {
- obtainedList2 = true;
+ g_engine->_obtainedList2 = true;
invIndex = 0;
- while (inventory[invIndex].code != 0) {
+ while (g_engine->_inventory[invIndex].code != 0) {
invIndex += 1;
}
- inventory[invIndex].bitmapIndex = list2Index;
- inventory[invIndex].code = list2code;
- inventory[invIndex].objectName = getObjectName(1);
+ g_engine->_inventory[invIndex].bitmapIndex = kList2Index;
+ g_engine->_inventory[invIndex].code = kList2code;
+ g_engine->_inventory[invIndex].objectName = getObjectName(1);
} break;
}
}
@@ -534,54 +526,147 @@ void talk(byte characterIndex) {
unloadTalkAnimations();
step = ar;
fixTree(step);
- saveConversations(conversationData, ar, characterIndex - 1);
+ saveConversations(g_engine->_conversationData, ar, characterIndex - 1);
- verb.close();
+ g_engine->_verbFile.close();
if (g_engine->shouldQuit()) {
return;
}
delete ar;
l1 = NULL;
- g_engine->_mouseManager->hide();
+ g_engine->_mouse->hide();
for (int i = 25; i >= 1; i--)
rectangle(0, 175 - i, 319, 174 + i, 0);
- mask();
- drawBackpack();
- g_engine->_mouseManager->show();
+ g_engine->mask();
+ g_engine->drawBackpack();
+ g_engine->_mouse->show();
if (characterIndex < 5) {
- if (firstTimeTopicA[characterIndex - 1])
- firstTimeTopicA[characterIndex - 1] = false;
- if (firstTimeTopicB[characterIndex - 1])
- firstTimeTopicB[characterIndex - 1] = false;
- if (firstTimeTopicC[characterIndex - 1])
- firstTimeTopicC[characterIndex - 1] = false;
+ if (g_engine->_firstTimeTopicA[characterIndex - 1])
+ g_engine->_firstTimeTopicA[characterIndex - 1] = false;
+ if (g_engine->_firstTimeTopicB[characterIndex - 1])
+ g_engine->_firstTimeTopicB[characterIndex - 1] = false;
+ if (g_engine->_firstTimeTopicC[characterIndex - 1])
+ g_engine->_firstTimeTopicC[characterIndex - 1] = false;
} else if (characterIndex == 8)
- firstTimeTopicA[8] = false;
+ g_engine->_firstTimeTopicA[8] = false;
}
void talkToSceneObject() {
- int mouseX = (mouseClickX + 7) / xGridCount;
- int mouseY = (mouseClickY + 7) / yGridCount;
- uint sceneObject = currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[mouseX][mouseY]]->fileIndex;
+ Common::Point p = g_engine->_mouse->getClickCoordsWithinGrid();
+ int correctedMouseX = p.x;
+ int correctedMouseY = p.y;
+ uint sceneObject = g_engine->_currentRoomData->screenObjectIndex[g_engine->_currentRoomData->mouseGrid[correctedMouseX][correctedMouseY]]->fileIndex;
if (sceneObject == 0)
return;
// verifyCopyProtection2();
- readItemRegister(sceneObject);
- goToObject(currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount],
- currentRoomData->walkAreasGrid[mouseX][mouseY]);
+ g_engine->readItemRegister(sceneObject);
+ g_engine->goToObject(g_engine->_currentRoomData->walkAreasGrid[(g_engine->_characterPosX + kCharacterCorrectionX) / kXGridCount][(g_engine->_characterPosY + kCharacerCorrectionY) / kYGridCount],
+ g_engine->_currentRoomData->walkAreasGrid[correctedMouseX][correctedMouseY]);
- if (regobj.speaking > 0) {
- talk(regobj.speaking);
+ if (g_engine->_curObject.speaking > 0) {
+ talk(g_engine->_curObject.speaking);
} else {
- assignText();
- hypertext((Random(10) + 1039), 255, 0, foo, false);
- verb.close();
- if (cpCounter > 198)
+ g_engine->assignText();
+ uint foo = 0;
+ g_engine->sayLine((Random(10) + 1039), 255, 0, foo, false);
+ g_engine->_verbFile.close();
+ if (g_engine->_cpCounter > 198)
showError(274);
}
}
+/**
+ * Loads talking animation of main adn secondary character
+ */
+void loadTalkAnimations() {
+ Common::File animFile;
+
+ if (!animFile.open("TIOHABLA.SEC")) {
+ showError(265);
+ }
+ g_engine->_mainCharFrameSize = animFile.readUint16LE();
+
+ int32 offset = g_engine->_mainCharFrameSize * 16;
+ offset = (offset * g_engine->_charFacingDirection) + 2;
+ animFile.seek(offset);
+ //Will load talking anim always in the upwards direction of the walk cycle array
+ for (int i = 0; i < 16; i++) {
+ g_engine->_mainCharAnimation.bitmap[0][i] = (byte *)malloc(g_engine->_mainCharFrameSize);
+ animFile.read(g_engine->_mainCharAnimation.bitmap[0][i], g_engine->_mainCharFrameSize);
+ }
+ animFile.close();
+
+ if ((g_engine->_currentRoomData->animationName != "PETER") && (g_engine->_currentRoomData->animationName != "ARZCAEL")) {
+ g_engine->_iframe2 = 0;
+ free(g_engine->_curSecondaryAnimationFrame);
+ bool result;
+ switch (g_engine->_curObject.speaking) {
+ case 1:
+ result = animFile.open("JOHN.SEC");
+ break;
+ case 5:
+ result = animFile.open("ALFRED.SEC");
+ break;
+ default:
+ result = animFile.open(Common::Path(g_engine->_currentRoomData->animationName + Common::String(".SEC")));
+ }
+
+ if (!result)
+ showError(265);
+ g_engine->_secondaryAnimFrameSize = animFile.readUint16LE();
+ g_engine->_secondaryAnimationFrameCount = animFile.readByte();
+ g_engine->_secondaryAnimDirCount = animFile.readByte();
+
+ g_engine->_curSecondaryAnimationFrame = (byte *)malloc(g_engine->_secondaryAnimFrameSize);
+ if (g_engine->_secondaryAnimDirCount != 0) {
+ g_engine->_secondaryAnimationFrameCount = g_engine->_secondaryAnimationFrameCount / 4;
+ for (int i = 0; i <= 3; i++) {
+ g_engine->loadAnimationForDirection(&animFile, i);
+ }
+ } else {
+ g_engine->loadAnimationForDirection(&animFile, 0);
+ }
+ animFile.close();
+ }
+}
+
+void unloadTalkAnimations() {
+
+ Common::File animFile;
+ if (!animFile.open("PERSONAJ.SPT")) {
+ showError(265);
+ }
+ g_engine->_mainCharFrameSize = animFile.readUint16LE();
+
+ for (int i = 0; i < kWalkFrameCount; i++) {
+ g_engine->_mainCharAnimation.bitmap[0][i] = (byte *)malloc(g_engine->_mainCharFrameSize);
+ animFile.read(g_engine->_mainCharAnimation.bitmap[0][i], g_engine->_mainCharFrameSize);
+ }
+ animFile.close();
+
+ if ((g_engine->_currentRoomData->animationName != "PETER") && (g_engine->_currentRoomData->animationName != "ARZCAEL")) {
+ if (!animFile.open(Common::Path(g_engine->_currentRoomData->animationName + ".DAT"))) {
+ showError(265);
+ }
+ g_engine->_secondaryAnimFrameSize = animFile.readUint16LE();
+ g_engine->_secondaryAnimationFrameCount = animFile.readByte();
+ g_engine->_secondaryAnimDirCount = animFile.readByte();
+ g_engine->_curSecondaryAnimationFrame = (byte *)malloc(g_engine->_secondaryAnimFrameSize);
+ if (g_engine->_secondaryAnimDirCount != 0) {
+
+ g_engine->_secondaryAnimationFrameCount = g_engine->_secondaryAnimationFrameCount / 4;
+ for (int i = 0; i <= 3; i++) {
+ g_engine->loadAnimationForDirection(&animFile, i);
+ }
+ } else {
+ g_engine->loadAnimationForDirection(&animFile, 0);
+ }
+ animFile.close();
+ }
+}
+
+
} // End of namespace Tot
diff --git a/engines/tot/dialog.h b/engines/tot/dialog.h
index 356a6c52996..b5a56bb02df 100644
--- a/engines/tot/dialog.h
+++ b/engines/tot/dialog.h
@@ -41,6 +41,9 @@ extern bool endOfConversation;
void talkToSceneObject();
+void loadTalkAnimations();
+void unloadTalkAnimations();
+
} // End of namespace Tot
#endif
diff --git a/engines/tot/graphics.cpp b/engines/tot/graphics.cpp
index 03a4ef9b7b1..3a170fe08a4 100644
--- a/engines/tot/graphics.cpp
+++ b/engines/tot/graphics.cpp
@@ -92,7 +92,7 @@ void GraphicsManager::setPalette(byte *palette, uint start, uint num) {
void GraphicsManager::fixPalette(byte *palette, uint num) {
for (int i = 0; i < num; i++) {
- palette[i] = palette[i] << 2;
+ palette[i] <<= 2;
}
}
@@ -102,17 +102,31 @@ byte *GraphicsManager::getPalette() {
return palette;
}
+void GraphicsManager::advancePaletteAnim() {
+ if (g_engine->_currentRoomData->paletteAnimationFlag && _palAnimStep >= 4) {
+ _palAnimStep = 0;
+ if (_paletteAnimFrame > 6)
+ _paletteAnimFrame = 0;
+ else
+ _paletteAnimFrame += 1;
+ if (g_engine->_currentRoomData->code == 4 && _paletteAnimFrame == 4)
+ g_engine->_sound->playVoc();
+ g_engine->_graphics->updatePalette(_paletteAnimFrame);
+ } else
+ _palAnimStep += 1;
+}
+
void GraphicsManager::loadPaletteFromFile(Common::String paletteName) {
Common::File fichero;
if (!fichero.open(Common::Path(paletteName + ".PAL")))
showError(310);
- fichero.read(pal, 768);
+ fichero.read(_pal, 768);
fichero.close();
- fixPalette(pal, 768);
- setPalette(pal);
+ fixPalette(_pal, 768);
+ setPalette(_pal);
}
void GraphicsManager::fadePalettes(byte *from, byte *to) {
@@ -158,17 +172,17 @@ void GraphicsManager::turnLightOn() {
paletteFile.close();
for (int i = 0; i < 256; i++) {
if (i >= 201) {
- intermediate[3 * i + 0] = pal[3 * i + 0];
- intermediate[3 * i + 1] = pal[3 * i + 1];
- intermediate[3 * i + 2] = pal[3 * i + 2];
+ intermediate[3 * i + 0] = _pal[3 * i + 0];
+ intermediate[3 * i + 1] = _pal[3 * i + 1];
+ intermediate[3 * i + 2] = _pal[3 * i + 2];
} else {
- intermediate[3 * i + 0] = intermediate[3 * i + 0] << 2;
- intermediate[3 * i + 1] = intermediate[3 * i + 1] << 2;
- intermediate[3 * i + 2] = intermediate[3 * i + 2] << 2;
+ intermediate[3 * i + 0] <<= 2;
+ intermediate[3 * i + 1] <<= 2;
+ intermediate[3 * i + 2] <<= 2;
}
}
- fadePalettes(pal, intermediate);
- copyPalette(intermediate, pal);
+ fadePalettes(_pal, intermediate);
+ copyPalette(intermediate, _pal);
}
void GraphicsManager::totalFadeOut(byte redComponent) {
@@ -179,8 +193,8 @@ void GraphicsManager::totalFadeOut(byte redComponent) {
intermediate[3 * ipal + 1] = 0;
intermediate[3 * ipal + 2] = 0;
}
- fadePalettes(pal, intermediate);
- copyPalette(intermediate, pal);
+ fadePalettes(_pal, intermediate);
+ copyPalette(intermediate, _pal);
}
void GraphicsManager::partialFadeOut(byte numcol) {
@@ -192,12 +206,12 @@ void GraphicsManager::partialFadeOut(byte numcol) {
intermediate[3 * i + 2] = 0;
}
for (int i = (numcol + 1); i <= 255; i++) {
- intermediate[3 * i + 0] = pal[3 * i + 0];
- intermediate[3 * i + 1] = pal[3 * i + 1];
- intermediate[3 * i + 2] = pal[3 * i + 2];
+ intermediate[3 * i + 0] = _pal[3 * i + 0];
+ intermediate[3 * i + 1] = _pal[3 * i + 1];
+ intermediate[3 * i + 2] = _pal[3 * i + 2];
}
- fadePalettes(pal, intermediate);
- copyPalette(intermediate, pal);
+ fadePalettes(_pal, intermediate);
+ copyPalette(intermediate, _pal);
}
void GraphicsManager::partialFadeIn(byte numcol) {
@@ -209,11 +223,11 @@ void GraphicsManager::partialFadeIn(byte numcol) {
darkPalette[3 * i + 2] = 0;
}
for (int i = (numcol + 1); i <= 255; i++) {
- darkPalette[3 * i + 0] = pal[3 * i + 0];
- darkPalette[3 * i + 1] = pal[3 * i + 1];
- darkPalette[3 * i + 2] = pal[3 * i + 2];
+ darkPalette[3 * i + 0] = _pal[3 * i + 0];
+ darkPalette[3 * i + 1] = _pal[3 * i + 1];
+ darkPalette[3 * i + 2] = _pal[3 * i + 2];
}
- fadePalettes(darkPalette, pal);
+ fadePalettes(darkPalette, _pal);
}
void GraphicsManager::totalFadeIn(uint paletteNumber, Common::String paletteName) {
@@ -239,13 +253,13 @@ void GraphicsManager::totalFadeIn(uint paletteNumber, Common::String paletteName
darkPalette[3 * i + 1] = 0;
darkPalette[3 * i + 2] = 0;
// 6-bit color correction
- intermediate[3 * i + 0] = intermediate[3 * i + 0] << 2;
- intermediate[3 * i + 1] = intermediate[3 * i + 1] << 2;
- intermediate[3 * i + 2] = intermediate[3 * i + 2] << 2;
+ intermediate[3 * i + 0] <<= 2;
+ intermediate[3 * i + 1] <<= 2;
+ intermediate[3 * i + 2] <<= 2;
}
fadePalettes(darkPalette, intermediate);
- copyPalette(intermediate, pal);
+ copyPalette(intermediate, _pal);
}
void GraphicsManager::redFadeIn(byte *intermediatePalette) {
@@ -256,22 +270,22 @@ void GraphicsManager::redFadeIn(byte *intermediatePalette) {
dark[3 * i + 1] = 0;
dark[3 * i + 2] = 0;
}
- fadePalettes(pal, dark);
+ fadePalettes(_pal, dark);
fadePalettes(dark, intermediatePalette);
- copyPalette(intermediatePalette, pal);
+ copyPalette(intermediatePalette, _pal);
}
void GraphicsManager::updatePalette(byte paletteIndex) {
int ip;
- switch (gamePart) {
+ switch (g_engine->_gamePart) {
case 1: {
for (int i = 0; i <= 5; i++) {
- pal[(i + 195) * 3 + 0] = palAnimSlice[(paletteIndex * 6 + i) * 3 + 0];
- pal[(i + 195) * 3 + 1] = palAnimSlice[(paletteIndex * 6 + i) * 3 + 1];
- pal[(i + 195) * 3 + 2] = palAnimSlice[(paletteIndex * 6 + i) * 3 + 2];
+ _pal[(i + 195) * 3 + 0] = _palAnimSlice[(paletteIndex * 6 + i) * 3 + 0];
+ _pal[(i + 195) * 3 + 1] = _palAnimSlice[(paletteIndex * 6 + i) * 3 + 1];
+ _pal[(i + 195) * 3 + 2] = _palAnimSlice[(paletteIndex * 6 + i) * 3 + 2];
}
- setPalette(&pal[195 * 3 + 0], 195, 6);
+ setPalette(&_pal[195 * 3 + 0], 195, 6);
} break;
case 2: {
switch (paletteIndex) {
@@ -302,12 +316,12 @@ void GraphicsManager::updatePalette(byte paletteIndex) {
}
for (int i = 0; i < 3; i++) {
- pal[131 * 3 + i] = pal[131 * 3 + i] - ip;
- pal[134 * 3 + i] = pal[134 * 3 + i] - ip;
- pal[143 * 3 + i] = pal[143 * 3 + i] - ip;
- pal[187 * 3 + i] = pal[187 * 3 + i] - ip;
+ _pal[131 * 3 + i] = _pal[131 * 3 + i] - ip;
+ _pal[134 * 3 + i] = _pal[134 * 3 + i] - ip;
+ _pal[143 * 3 + i] = _pal[143 * 3 + i] - ip;
+ _pal[187 * 3 + i] = _pal[187 * 3 + i] - ip;
}
- setPalette(pal);
+ setPalette(_pal);
} break;
}
@@ -419,7 +433,6 @@ void GraphicsManager::putImageArea(uint putcoordx, uint putcoordy, byte *backgro
}
void GraphicsManager::littText(const Common::String &str, int x, int y, uint32 color, Graphics::TextAlign align, bool alignCenterY) {
- int height = _euro.getFontHeight();
if (alignCenterY) {
y = y - _euro.getFontHeight() / 2 + 2;
}
@@ -462,8 +475,11 @@ void GraphicsManager::updateSceneAreaIfNeeded(int speed) {
g_engine->_screen->update();
}
}
+void GraphicsManager::sceneTransition(bool fadeToBlack, byte *scene) {
+ sceneTransition(fadeToBlack, scene, Random(15) + 1);
+}
-void GraphicsManager::sceneTransition(byte effectNumber, bool fadeToBlack, byte *scene) {
+void GraphicsManager::sceneTransition(bool fadeToBlack, byte *scene, byte effectNumber) {
int i1, i2, i3, j1, j2, j3;
bool enabled = false;
@@ -477,9 +493,9 @@ void GraphicsManager::sceneTransition(byte effectNumber, bool fadeToBlack, byte
drawScreen(scene);
}
} else {
- effectNumber = 13;
- cpCounter2 = cpCounter;
- if (cpCounter > 145)
+ // effectNumber = 13;
+ g_engine->_cpCounter2 = g_engine->_cpCounter;
+ if (g_engine->_cpCounter > 145)
showError(274);
debug("Effect %d, pasaraanegro=%d", effectNumber, fadeToBlack);
if (fadeToBlack)
@@ -873,13 +889,13 @@ void GraphicsManager::init() {
}
void GraphicsManager::restoreBackground() {
- Common::copy(backgroundCopy + 4, backgroundCopy + screenSize, sceneBackground + 4);
+ Common::copy(g_engine->backgroundCopy + 4, g_engine->backgroundCopy + g_engine->_screenSize, g_engine->sceneBackground + 4);
}
void GraphicsManager::loadAnimationIntoBuffer(Common::SeekableReadStream *stream, byte *&buf, int animSize) {
buf = (byte *)malloc(animSize);
stream->read(buf, animSize);
- Common::copy(buf, buf + animSize, curSecondaryAnimationFrame);
+ Common::copy(buf, buf + animSize, g_engine->_curSecondaryAnimationFrame);
}
} // End of namespace Tot
diff --git a/engines/tot/graphics.h b/engines/tot/graphics.h
index eccd3000fe5..d35f82a589c 100644
--- a/engines/tot/graphics.h
+++ b/engines/tot/graphics.h
@@ -72,11 +72,29 @@ public:
void restoreBackground();
void restoreBackgroundArea(uint x, uint y, uint x2, uint y2);
- void sceneTransition(byte effectNumber, bool fadeToBlack, byte *screen);
+ void sceneTransition(bool fadeToBlack, byte *screen, byte effectNumber);
+ void sceneTransition(bool fadeToBlack, byte *screen);
+ void advancePaletteAnim();
void loadAnimationIntoBuffer(Common::SeekableReadStream *stream, byte *&buf, int animSize);
void printColor(int x, int y, int color);
+ /**
+ * Aux for palette animation
+ */
+ byte _paletteAnimFrame = 0;
+ /**
+ * Delay of palette animation
+ */
+ byte _palAnimStep = 0;
+ /**
+ * 54 color palette slice.
+ */
+ byte _palAnimSlice[768] = { 0 };
+ /**
+ * General palette
+ */
+ byte _pal[768] = { 0 };
private:
void updateSceneAreaIfNeeded(int speed = 1);
diff --git a/engines/tot/module.mk b/engines/tot/module.mk
index 05eb2f0b5bc..8bb6c5cafdd 100644
--- a/engines/tot/module.mk
+++ b/engines/tot/module.mk
@@ -19,7 +19,8 @@ MODULE_OBJS = \
mouse.o \
chrono.o \
saveload.o \
- midi.o
+ midi.o \
+ debug.o
# This module can be built as a plugin
ifeq ($(ENABLE_TOT), DYNAMIC_PLUGIN)
diff --git a/engines/tot/mouse.cpp b/engines/tot/mouse.cpp
index bc840dccb22..d4eff431d20 100644
--- a/engines/tot/mouse.cpp
+++ b/engines/tot/mouse.cpp
@@ -26,12 +26,18 @@
#include "tot/mouse.h"
#include "tot/tot.h"
#include "tot/util.h"
+#include "mouse.h"
namespace Tot {
MouseManager::MouseManager() {
_mouseArea = Common::Rect(0, 0, 320, 200);
loadMasks();
+ mouseX = 160;
+ mouseY = 100;
+ mouseClickX = mouseX;
+ mouseClickY = mouseY;
+ mouseMaskIndex = 1;
}
MouseManager::~MouseManager() {
@@ -65,7 +71,7 @@ void MouseManager::setMouseArea(Common::Rect rect) {
_mouseArea = rect;
}
-void MouseManager::setMousePos(Common::Point p) {
+void MouseManager::warpMouse(Common::Point p) {
p.x = CLIP<int16>(p.x, _mouseArea.left, _mouseArea.right);
p.y = CLIP<int16>(p.y, _mouseArea.top, _mouseArea.bottom);
@@ -77,7 +83,19 @@ void MouseManager::printPos(int x, int y, int screenPosX, int screenPosY) {
g_engine->_graphics->euroText(Common::String::format("MousePos: %d, %d", x + 7, y + 7), screenPosX, screenPosY, Graphics::kTextAlignLeft);
}
-void MouseManager::setMousePos(int mask, int x, int y) {
+Common::Point MouseManager::getClickCoordsWithinGrid() {
+ int correctedMouseX = (mouseClickX + 7) / kXGridCount;
+ int correctedMouseY = (mouseClickY + 7) / kYGridCount;
+ return Common::Point(correctedMouseX, correctedMouseY);
+}
+
+Common::Point MouseManager::getMouseCoordsWithinGrid() {
+ int correctedMouseX = (mouseX + 7) / kXGridCount;
+ int correctedMouseY = (mouseY + 7) / kYGridCount;
+ return Common::Point(correctedMouseX, correctedMouseY);
+}
+
+void MouseManager::warpMouse(int mask, int x, int y) {
setMouseMask(_currentMouseMask);
g_system->warpMouse(x, y);
}
diff --git a/engines/tot/mouse.h b/engines/tot/mouse.h
index 73fcf348c52..f7878dd9e39 100644
--- a/engines/tot/mouse.h
+++ b/engines/tot/mouse.h
@@ -27,6 +27,7 @@
#include "tot/chrono.h"
namespace Tot {
+
struct MouseMask {
void *mask;
uint width;
@@ -38,14 +39,20 @@ public:
MouseManager();
~MouseManager();
void drawMask(int idx);
- void setMousePos(int mask, int x, int y);
+ void warpMouse(int mask, int x, int y);
void setMask(int maskNum);
void animateMouseIfNeeded();
void hide();
void show();
void setMouseArea(Common::Rect rect);
- void setMousePos(Common::Point p);
+ void warpMouse(Common::Point p);
void printPos(int x, int y, int screenPosX, int screenPosY);
+ Common::Point getClickCoordsWithinGrid();
+ Common::Point getMouseCoordsWithinGrid();
+
+ uint mouseX, mouseY; // Coords of the mouse sprite
+ uint mouseClickX, mouseClickY; // Coords of mouse clicks
+ byte mouseMaskIndex; // Frame index of the mouse mask
private:
Common::Rect _mouseArea;
diff --git a/engines/tot/routines.cpp b/engines/tot/routines.cpp
index c18e48001d2..b8a7f9a573d 100644
--- a/engines/tot/routines.cpp
+++ b/engines/tot/routines.cpp
@@ -22,44 +22,47 @@
#include "common/debug.h"
#include "common/endian.h"
-#include "tot/routines.h"
+#include "tot/anims.h"
+#include "tot/debug.h"
#include "tot/statics.h"
#include "tot/tot.h"
+#include "tot/vars.h"
namespace Tot {
-void drawText(uint number) {
+void TotEngine::drawText(uint number) {
assignText();
- hypertext(number, 255, 0, foo, false);
- verb.close();
+ uint foo = 0;
+ sayLine(number, 255, 0, foo, false);
+ _verbFile.close();
}
-void displayLoading() {
- const char *msg = (g_engine->_lang == Common::ES_ESP) ? fullScreenMessages[0][58] : fullScreenMessages[1][58];
+void TotEngine::displayLoading() {
+ const char *msg = (_lang == Common::ES_ESP) ? fullScreenMessages[0][58] : fullScreenMessages[1][58];
setRGBPalette(255, 63, 63, 63);
littText(121, 72, msg, 0);
- g_engine->_screen->update();
+ _screen->update();
delay(kEnforcedTextAnimDelay);
littText(120, 71, msg, 0);
- g_engine->_screen->update();
+ _screen->update();
delay(kEnforcedTextAnimDelay);
littText(119, 72, msg, 0);
- g_engine->_screen->update();
+ _screen->update();
delay(kEnforcedTextAnimDelay);
littText(120, 73, msg, 0);
- g_engine->_screen->update();
+ _screen->update();
delay(kEnforcedTextAnimDelay);
littText(120, 72, msg, 255);
- g_engine->_screen->update();
+ _screen->update();
// enforce a delay for now so it's visible
g_system->delayMillis(200);
}
-void runaroundRed() {
- const uint trajectory[91][2] = {
+void TotEngine::runaroundRed() {
+ const uint devilTrajectory[91][2] = {
{204, 47}, {204, 49}, {203, 51}, {203, 53}, {201, 55}, {199, 57}, {197, 59}, {195, 61},
{193, 63}, {192, 65}, {192, 67}, {192, 69}, {192, 71}, {192, 73}, {191, 75}, {191, 77},
{191, 79}, {191, 81}, {191, 83}, {191, 85}, {191, 87}, {192, 89}, {192, 91}, {192, 93},
@@ -79,84 +82,76 @@ void runaroundRed() {
loadDevil();
uint secTrajIndex = 0;
uint secTrajLength = 82;
- iframe2 = 0;
- isSecondaryAnimationEnabled = true;
+ _iframe2 = 0;
+ _isSecondaryAnimationEnabled = true;
do {
- g_engine->_chrono->updateChrono();
+ _chrono->updateChrono();
if (gameTick) {
if (secTrajIndex == secTrajLength)
exitLoop = true;
secTrajIndex += 1;
- if (iframe2 >= secondaryAnimationFrameCount - 1)
- iframe2 = 0;
+ if (_iframe2 >= _secondaryAnimationFrameCount - 1)
+ _iframe2 = 0;
else
- iframe2++;
- secondaryAnimation.posx = trajectory[secTrajIndex][0] - 15;
- secondaryAnimation.posy = trajectory[secTrajIndex][1] - 42;
+ _iframe2++;
+ _secondaryAnimation.posx = devilTrajectory[secTrajIndex][0] - 15;
+ _secondaryAnimation.posy = devilTrajectory[secTrajIndex][1] - 42;
if (secTrajIndex >= 0 && secTrajIndex <= 8) {
- secondaryAnimation.dir = 2;
- secondaryAnimation.depth = 1;
+ _secondaryAnimation.dir = 2;
+ _secondaryAnimation.depth = 1;
} else if (secTrajIndex >= 9 && secTrajIndex <= 33) {
- secondaryAnimation.dir = 2;
- secondaryAnimation.depth = 14;
+ _secondaryAnimation.dir = 2;
+ _secondaryAnimation.depth = 14;
} else if (secTrajIndex >= 34 && secTrajIndex <= 63) {
- secondaryAnimation.dir = 1;
- secondaryAnimation.depth = 14;
+ _secondaryAnimation.dir = 1;
+ _secondaryAnimation.depth = 14;
} else {
- secondaryAnimation.dir = 0;
- secondaryAnimation.depth = 3;
+ _secondaryAnimation.dir = 0;
+ _secondaryAnimation.depth = 3;
}
gameTickHalfSpeed = true;
sprites(false);
gameTick = false;
- if (palAnimStep >= 4) {
- palAnimStep = 0;
- if (isPaletteAnimEnabled > 6)
- isPaletteAnimEnabled = 0;
- else
- isPaletteAnimEnabled += 1;
- g_engine->_graphics->updatePalette(isPaletteAnimEnabled);
- } else
- palAnimStep += 1;
- g_engine->_screen->update();
+ _graphics->advancePaletteAnim();
+ _screen->update();
}
- } while (!exitLoop && !g_engine->shouldQuit());
+ } while (!exitLoop && !shouldQuit());
freeAnimation();
- g_engine->_graphics->restoreBackground();
+ _graphics->restoreBackground();
assembleScreen();
- g_engine->_graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(sceneBackground);
}
void updateMovementGrids() {
uint j1arm, j2arm;
byte i1arm, i2arm;
- j1arm = (currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].x / xGridCount) + 1;
- j2arm = (currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].y / yGridCount) + 1;
- if ((oldposx != j1arm) || (oldposy != j2arm)) {
+ j1arm = (g_engine->_currentRoomData->secondaryAnimTrajectory[g_engine->_currentSecondaryTrajectoryIndex - 1].x / kXGridCount) + 1;
+ j2arm = (g_engine->_currentRoomData->secondaryAnimTrajectory[g_engine->_currentSecondaryTrajectoryIndex - 1].y / kYGridCount) + 1;
+ if ((g_engine->_oldposx != j1arm) || (g_engine->_oldposy != j2arm)) {
- for (i1arm = 0; i1arm < maxXGrid; i1arm++)
- for (i2arm = 0; i2arm < maxYGrid; i2arm++) {
- currentRoomData->walkAreasGrid[oldposx + i1arm][oldposy + i2arm] = movementGridForSecondaryAnim[i1arm][i2arm];
- currentRoomData->mouseGrid[oldposx + i1arm][oldposy + i2arm] = mouseGridForSecondaryAnim[i1arm][i2arm];
+ for (i1arm = 0; i1arm < g_engine->_maxXGrid; i1arm++)
+ for (i2arm = 0; i2arm < g_engine->_maxYGrid; i2arm++) {
+ g_engine->_currentRoomData->walkAreasGrid[g_engine->_oldposx + i1arm][g_engine->_oldposy + i2arm] = g_engine->_movementGridForSecondaryAnim[i1arm][i2arm];
+ g_engine->_currentRoomData->mouseGrid[g_engine->_oldposx + i1arm][g_engine->_oldposy + i2arm] = g_engine->_mouseGridForSecondaryAnim[i1arm][i2arm];
}
- for (i1arm = 0; i1arm < maxXGrid; i1arm++)
- for (i2arm = 0; i2arm < maxYGrid; i2arm++) {
- movementGridForSecondaryAnim[i1arm][i2arm] = currentRoomData->walkAreasGrid[j1arm + i1arm][j2arm + i2arm];
- if (maskGridSecondaryAnim[i1arm][i2arm] > 0)
- currentRoomData->walkAreasGrid[j1arm + i1arm][j2arm + i2arm] = maskGridSecondaryAnim[i1arm][i2arm];
+ for (i1arm = 0; i1arm < g_engine->_maxXGrid; i1arm++)
+ for (i2arm = 0; i2arm < g_engine->_maxYGrid; i2arm++) {
+ g_engine->_movementGridForSecondaryAnim[i1arm][i2arm] = g_engine->_currentRoomData->walkAreasGrid[j1arm + i1arm][j2arm + i2arm];
+ if (g_engine->_maskGridSecondaryAnim[i1arm][i2arm] > 0)
+ g_engine->_currentRoomData->walkAreasGrid[j1arm + i1arm][j2arm + i2arm] = g_engine->_maskGridSecondaryAnim[i1arm][i2arm];
- mouseGridForSecondaryAnim[i1arm][i2arm] = currentRoomData->mouseGrid[j1arm + i1arm][j2arm + i2arm];
- if (maskMouseSecondaryAnim[i1arm][i2arm] > 0)
- currentRoomData->mouseGrid[j1arm + i1arm][j2arm + i2arm] = maskMouseSecondaryAnim[i1arm][i2arm];
+ g_engine->_mouseGridForSecondaryAnim[i1arm][i2arm] = g_engine->_currentRoomData->mouseGrid[j1arm + i1arm][j2arm + i2arm];
+ if (g_engine->_maskMouseSecondaryAnim[i1arm][i2arm] > 0)
+ g_engine->_currentRoomData->mouseGrid[j1arm + i1arm][j2arm + i2arm] = g_engine->_maskMouseSecondaryAnim[i1arm][i2arm];
}
- oldposx = j1arm;
- oldposy = j2arm;
- oldGridX = 0;
- oldGridY = 0;
+ g_engine->_oldposx = j1arm;
+ g_engine->_oldposy = j2arm;
+ g_engine->oldGridX = 0;
+ g_engine->oldGridY = 0;
}
}
@@ -183,8 +178,8 @@ static void assembleBackground() {
posabs = 4 + dirtyMainSpriteY * 320 + dirtyMainSpriteX;
uint16 w, h;
- w = READ_LE_UINT16(characterDirtyRect);
- h = READ_LE_UINT16(characterDirtyRect + 2);
+ w = READ_LE_UINT16(g_engine->characterDirtyRect);
+ h = READ_LE_UINT16(g_engine->characterDirtyRect + 2);
w++;
h++;
@@ -195,7 +190,7 @@ static void assembleBackground() {
for (int i = 0; i < w; i++) {
int pos = posabs + j * 320 + i;
int destPos = 4 + (j * w + i);
- characterDirtyRect[destPos] = sceneBackground[pos];
+ g_engine->characterDirtyRect[destPos] = g_engine->sceneBackground[pos];
}
}
}
@@ -214,8 +209,8 @@ static void assembleImage(byte *img, uint imgPosX, uint imgPosY) {
uint16 wImg = READ_LE_UINT16(img) + 1;
uint16 hImg = READ_LE_UINT16(img + 2) + 1;
- uint16 wBg = READ_LE_UINT16(characterDirtyRect) + 1;
- uint16 hBg = READ_LE_UINT16(characterDirtyRect + 2) + 1;
+ uint16 wBg = READ_LE_UINT16(g_engine->characterDirtyRect) + 1;
+ uint16 hBg = READ_LE_UINT16(g_engine->characterDirtyRect + 2) + 1;
// This region calculates the overlapping area of (x, incx, y, incy)
{
@@ -245,20 +240,20 @@ static void assembleImage(byte *img, uint imgPosX, uint imgPosY) {
int bgOffset = 4 + ((y - dirtyMainSpriteY) + j) * wBg + i + (x - dirtyMainSpriteX);
int imgOffset = 4 + (y - imgPosY + j) * wImg + i + (x - imgPosX);
if (img[imgOffset] != 0) {
- characterDirtyRect[bgOffset] = img[imgOffset];
+ g_engine->characterDirtyRect[bgOffset] = img[imgOffset];
}
}
}
}
static void overlayLayers() {
- if (screenLayers[curDepth] != NULL) {
+ if (g_engine->_screenLayers[curDepth] != NULL) {
if (
- (depthMap[curDepth].posx <= dirtyMainSpriteX2) &&
- (depthMap[curDepth].posx2 > dirtyMainSpriteX) &&
- (depthMap[curDepth].posy < dirtyMainSpriteY2) &&
- (depthMap[curDepth].posy2 > dirtyMainSpriteY)) {
- assembleImage(screenLayers[curDepth], depthMap[curDepth].posx, depthMap[curDepth].posy);
+ (g_engine->_depthMap[curDepth].posx <= dirtyMainSpriteX2) &&
+ (g_engine->_depthMap[curDepth].posx2 > dirtyMainSpriteX) &&
+ (g_engine->_depthMap[curDepth].posy < dirtyMainSpriteY2) &&
+ (g_engine->_depthMap[curDepth].posy2 > dirtyMainSpriteY)) {
+ assembleImage(g_engine->_screenLayers[curDepth], g_engine->_depthMap[curDepth].posx, g_engine->_depthMap[curDepth].posy);
}
}
}
@@ -267,82 +262,82 @@ void drawMainCharacter() {
bool debug = false;
if (debug) {
- g_engine->_graphics->sceneTransition(13, false, sceneBackground);
+ g_engine->_graphics->sceneTransition(false, g_engine->sceneBackground, 13);
}
uint16 tempW;
uint16 tempH;
- tempW = READ_LE_UINT16(curCharacterAnimationFrame);
- tempH = READ_LE_UINT16(curCharacterAnimationFrame + 2);
+ tempW = READ_LE_UINT16(g_engine->_curCharacterAnimationFrame);
+ tempH = READ_LE_UINT16(g_engine->_curCharacterAnimationFrame + 2);
tempW += 6;
tempH += 6;
- characterDirtyRect = (byte *)malloc((tempW + 1) * (tempH + 1) + 4);
+ g_engine->characterDirtyRect = (byte *)malloc((tempW + 1) * (tempH + 1) + 4);
- WRITE_LE_UINT16(characterDirtyRect, tempW);
- WRITE_LE_UINT16(characterDirtyRect + 2, tempH);
+ WRITE_LE_UINT16(g_engine->characterDirtyRect, tempW);
+ WRITE_LE_UINT16(g_engine->characterDirtyRect + 2, tempH);
assembleBackground();
curDepth = 0;
- while (curDepth != depthLevelCount) {
+ while (curDepth != kDepthLevelCount) {
overlayLayers();
- if (mainCharAnimation.depth == curDepth)
- assembleImage(curCharacterAnimationFrame, characterPosX, characterPosY);
+ if (g_engine->_mainCharAnimation.depth == curDepth)
+ assembleImage(g_engine->_curCharacterAnimationFrame, g_engine->_characterPosX, g_engine->_characterPosY);
curDepth += 1;
}
- g_engine->_graphics->putImg(dirtyMainSpriteX, dirtyMainSpriteY, characterDirtyRect);
+ g_engine->_graphics->putImg(dirtyMainSpriteX, dirtyMainSpriteY, g_engine->characterDirtyRect);
if (debug) {
// draw background dirty area
drawRect(2, dirtyMainSpriteX, dirtyMainSpriteY, dirtyMainSpriteX + tempW, dirtyMainSpriteY + tempH);
- drawPos(xframe2, yframe2, 218);
+ drawPos(g_engine->_xframe2, g_engine->_yframe2, 218);
}
- free(characterDirtyRect);
+ free(g_engine->characterDirtyRect);
}
-void sprites(bool drawMainCharachter) {
+void TotEngine::sprites(bool drawMainCharachter) {
// grabs the current frame from the walk cycle
- curCharacterAnimationFrame = mainCharAnimation.bitmap[charFacingDirection][iframe];
+ _curCharacterAnimationFrame = _mainCharAnimation.bitmap[_charFacingDirection][_iframe];
- dirtyMainSpriteX = characterPosX - 3;
- dirtyMainSpriteY = characterPosY - 3;
- if (isSecondaryAnimationEnabled) {
- if (currentRoomData->secondaryTrajectoryLength > 1) {
+ dirtyMainSpriteX = _characterPosX - 3;
+ dirtyMainSpriteY = _characterPosY - 3;
+ if (_isSecondaryAnimationEnabled) {
+ if (_currentRoomData->secondaryTrajectoryLength > 1) {
updateMovementGrids();
}
if (gameTickHalfSpeed) {
- if (isPeterCoughing && !g_engine->_sound->isVocPlaying()) {
- iframe2 = 0;
+ if (_isPeterCoughing && !_sound->isVocPlaying()) {
+ _iframe2 = 0;
}
- curSecondaryAnimationFrame = secondaryAnimation.bitmap[secondaryAnimation.dir][iframe2];
+ _curSecondaryAnimationFrame = _secondaryAnimation.bitmap[_secondaryAnimation.dir][_iframe2];
}
- uint16 curCharFrameW = READ_LE_UINT16(curCharacterAnimationFrame);
- uint16 curCharFrameH = READ_LE_UINT16(curCharacterAnimationFrame + 2);
+ uint16 curCharFrameW = READ_LE_UINT16(_curCharacterAnimationFrame);
+ uint16 curCharFrameH = READ_LE_UINT16(_curCharacterAnimationFrame + 2);
- uint16 secAnimW = READ_LE_UINT16(curSecondaryAnimationFrame);
- uint16 secAnimH = READ_LE_UINT16(curSecondaryAnimationFrame + 2);
+ uint16 secAnimW = READ_LE_UINT16(_curSecondaryAnimationFrame);
+ uint16 secAnimH = READ_LE_UINT16(_curSecondaryAnimationFrame + 2);
if (
- ((secondaryAnimation.posx < (characterPosX + curCharFrameW) + 4) &&
- ((secondaryAnimation.posx + secAnimW + 1) > dirtyMainSpriteX) &&
- (secondaryAnimation.posy < (characterPosY + curCharFrameH + 4))) &&
- ((secondaryAnimation.posy + secAnimH + 1) > dirtyMainSpriteY)) { // Character is in the area of the animation
+ ((_secondaryAnimation.posx < (_characterPosX + curCharFrameW) + 4) &&
+ ((_secondaryAnimation.posx + secAnimW + 1) > dirtyMainSpriteX) &&
+ (_secondaryAnimation.posy < (_characterPosY + curCharFrameH + 4))) &&
+ ((_secondaryAnimation.posy + secAnimH + 1) > dirtyMainSpriteY)) { // Character is in the area of the animation
- if (secondaryAnimation.posx < characterPosX) {
- dirtyMainSpriteX = secondaryAnimation.posx - 3;
+ if (_secondaryAnimation.posx < _characterPosX) {
+ dirtyMainSpriteX = _secondaryAnimation.posx - 3;
}
- if (secondaryAnimation.posy < characterPosY) {
- dirtyMainSpriteY = secondaryAnimation.posy - 3;
+ if (_secondaryAnimation.posy < _characterPosY) {
+ dirtyMainSpriteY = _secondaryAnimation.posy - 3;
}
uint16 patchW = secAnimW + curCharFrameW + 6;
uint16 patchH;
- if ((curCharFrameH + characterPosY) > (secondaryAnimation.posy + secAnimH)) {
- patchH = curCharFrameH + 6 + abs(characterPosY - secondaryAnimation.posy);
+ if ((curCharFrameH + _characterPosY) > (_secondaryAnimation.posy + secAnimH)) {
+ patchH = curCharFrameH + 6 + abs(_characterPosY - _secondaryAnimation.posy);
} else {
- patchH = secAnimH + 6 + abs(characterPosY - secondaryAnimation.posy);
+ patchH = secAnimH + 6 + abs(_characterPosY - _secondaryAnimation.posy);
}
if (dirtyMainSpriteY + patchH > 140) {
@@ -360,26 +355,26 @@ void sprites(bool drawMainCharachter) {
assembleBackground();
curDepth = 0;
- while (curDepth != depthLevelCount) {
+ while (curDepth != kDepthLevelCount) {
overlayLayers();
- if (secondaryAnimation.depth == curDepth)
- assembleImage(curSecondaryAnimationFrame, secondaryAnimation.posx, secondaryAnimation.posy);
- if (mainCharAnimation.depth == curDepth)
- assembleImage(curCharacterAnimationFrame, characterPosX, characterPosY);
+ if (_secondaryAnimation.depth == curDepth)
+ assembleImage(_curSecondaryAnimationFrame, _secondaryAnimation.posx, _secondaryAnimation.posy);
+ if (_mainCharAnimation.depth == curDepth)
+ assembleImage(_curCharacterAnimationFrame, _characterPosX, _characterPosY);
curDepth += 1;
}
- g_engine->_graphics->putImg(dirtyMainSpriteX, dirtyMainSpriteY, characterDirtyRect);
+ _graphics->putImg(dirtyMainSpriteX, dirtyMainSpriteY, characterDirtyRect);
} else { // character and animation are in different parts of the screen
if (drawMainCharachter) {
drawMainCharacter();
}
- dirtyMainSpriteX = secondaryAnimation.posx - 3;
- dirtyMainSpriteY = secondaryAnimation.posy - 3;
+ dirtyMainSpriteX = _secondaryAnimation.posx - 3;
+ dirtyMainSpriteY = _secondaryAnimation.posy - 3;
- secAnimW = READ_LE_UINT16(curSecondaryAnimationFrame) + 6;
- secAnimH = READ_LE_UINT16(curSecondaryAnimationFrame + 2) + 6;
+ secAnimW = READ_LE_UINT16(_curSecondaryAnimationFrame) + 6;
+ secAnimH = READ_LE_UINT16(_curSecondaryAnimationFrame + 2) + 6;
if (dirtyMainSpriteY + secAnimH > 140) {
secAnimH -= (dirtyMainSpriteY + secAnimH) - 140 + 1;
@@ -395,75 +390,60 @@ void sprites(bool drawMainCharachter) {
assembleBackground();
curDepth = 0;
- while (curDepth != depthLevelCount) {
+ while (curDepth != kDepthLevelCount) {
overlayLayers();
- if (secondaryAnimation.depth == curDepth)
- assembleImage(curSecondaryAnimationFrame, secondaryAnimation.posx, secondaryAnimation.posy);
+ if (_secondaryAnimation.depth == curDepth)
+ assembleImage(_curSecondaryAnimationFrame, _secondaryAnimation.posx, _secondaryAnimation.posy);
curDepth += 1;
}
- g_engine->_graphics->putImg(dirtyMainSpriteX, dirtyMainSpriteY, characterDirtyRect);
+ _graphics->putImg(dirtyMainSpriteX, dirtyMainSpriteY, characterDirtyRect);
}
} else if (drawMainCharachter) {
drawMainCharacter();
}
}
-void adjustKey() {
- iframe = 0;
+
+void TotEngine::adjustKey() {
+ _iframe = 0;
calculateTrajectory(129, 13);
- charFacingDirection = 0;
+ _charFacingDirection = 0;
do {
- characterPosX = trajectory[currentTrajectoryIndex].x;
- characterPosY = trajectory[currentTrajectoryIndex].y;
- iframe++;
- currentTrajectoryIndex += 1;
+ _characterPosX = _trajectory[_currentTrajectoryIndex].x;
+ _characterPosY = _trajectory[_currentTrajectoryIndex].y;
+ _iframe++;
+ _currentTrajectoryIndex += 1;
emptyLoop();
gameTick = false;
- if (palAnimStep >= 4) {
- palAnimStep = 0;
- if (isPaletteAnimEnabled > 6)
- isPaletteAnimEnabled = 0;
- else
- isPaletteAnimEnabled += 1;
- g_engine->_graphics->updatePalette(isPaletteAnimEnabled);
- } else
- palAnimStep += 1;
+ _graphics->advancePaletteAnim();
sprites(true);
- } while (currentTrajectoryIndex != trajectoryLength);
- charFacingDirection = 3;
+ } while (_currentTrajectoryIndex != _trajectoryLength);
+ _charFacingDirection = 3;
emptyLoop();
gameTick = false;
sprites(true);
}
-void adjustKey2() {
- iframe = 0;
- charFacingDirection = 2;
- trajectoryLength = 1;
+void TotEngine::adjustKey2() {
+ _iframe = 0;
+ _charFacingDirection = 2;
+ _trajectoryLength = 1;
do {
- characterPosX = trajectory[currentTrajectoryIndex].x;
- characterPosY = trajectory[currentTrajectoryIndex].y;
- iframe++;
- currentTrajectoryIndex -= 1;
+ _characterPosX = _trajectory[_currentTrajectoryIndex].x;
+ _characterPosY = _trajectory[_currentTrajectoryIndex].y;
+ _iframe++;
+ _currentTrajectoryIndex -= 1;
emptyLoop();
gameTick = false;
- if (palAnimStep >= 4) {
- palAnimStep = 0;
- if (isPaletteAnimEnabled > 6)
- isPaletteAnimEnabled = 0;
- else
- isPaletteAnimEnabled += 1;
- g_engine->_graphics->updatePalette(isPaletteAnimEnabled);
- } else
- palAnimStep += 1;
+ _graphics->advancePaletteAnim();
sprites(true);
- } while (currentTrajectoryIndex != 0);
+ } while (_currentTrajectoryIndex != 0);
emptyLoop();
gameTick = false;
sprites(true);
}
-void animatedSequence(uint numSequence) {
+void TotEngine::animatedSequence(uint numSequence) {
Common::File animationFile;
uint repIndex, animIndex;
uint16 animFrameSize;
@@ -474,8 +454,8 @@ void animatedSequence(uint numSequence) {
switch (numSequence) {
case 1: {
- tmpCharacterPosX = characterPosX;
- characterPosX = 3;
+ tmpCharacterPosX = _characterPosX;
+ _characterPosX = 3;
if (!animationFile.open("POZO01.DAT")) {
showError(277);
}
@@ -486,42 +466,42 @@ void animatedSequence(uint numSequence) {
animationFile.readByte();
animptr = (byte *)malloc(animFrameSize);
for (uint loopIdx = 1; loopIdx <= 3; loopIdx++) {
- g_engine->_sound->playVoc("POZO", 180395, 6034);
+ _sound->playVoc("POZO", 180395, 6034);
animIndex = 0;
do {
emptyLoop();
gameTick = false;
if (gameTickHalfSpeed) {
- if (currentSecondaryTrajectoryIndex >= currentRoomData->secondaryTrajectoryLength)
- currentSecondaryTrajectoryIndex = 1;
+ if (_currentSecondaryTrajectoryIndex >= _currentRoomData->secondaryTrajectoryLength)
+ _currentSecondaryTrajectoryIndex = 1;
else
- currentSecondaryTrajectoryIndex += 1;
- secondaryAnimation.posx = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].x;
- secondaryAnimation.posy = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].y;
- secondaryAnimation.dir = currentRoomData->secondaryAnimDirections[currentSecondaryTrajectoryIndex - 1];
- if (iframe2 >= secondaryAnimationFrameCount - 1)
- iframe2 = 0;
+ _currentSecondaryTrajectoryIndex += 1;
+ _secondaryAnimation.posx = _currentRoomData->secondaryAnimTrajectory[_currentSecondaryTrajectoryIndex - 1].x;
+ _secondaryAnimation.posy = _currentRoomData->secondaryAnimTrajectory[_currentSecondaryTrajectoryIndex - 1].y;
+ _secondaryAnimation.dir = _currentRoomData->secondaryAnimDirections[_currentSecondaryTrajectoryIndex - 1];
+ if (_iframe2 >= _secondaryAnimationFrameCount - 1)
+ _iframe2 = 0;
else
- iframe2++;
+ _iframe2++;
sprites(false);
animationFile.read(animptr, animFrameSize);
- g_engine->_graphics->putImg(animX, animY, animptr);
+ _graphics->putImg(animX, animY, animptr);
animIndex += 1;
}
- } while (animIndex != secFrameCount && !g_engine->shouldQuit());
+ } while (animIndex != secFrameCount && !shouldQuit());
animationFile.seek(4);
}
free(animptr);
animationFile.close();
- characterPosX = tmpCharacterPosX;
+ _characterPosX = tmpCharacterPosX;
} break;
case 2: {
if (!animationFile.open("POZOATR.DAT")) {
showError(277);
}
animX = 127;
- tmpCharacterPosX = characterPosX;
- characterPosX = 3;
+ tmpCharacterPosX = _characterPosX;
+ _characterPosX = 3;
animY = 70;
animFrameSize = animationFile.readUint16LE();
@@ -529,39 +509,39 @@ void animatedSequence(uint numSequence) {
animationFile.readByte();
animptr = (byte *)malloc(animFrameSize);
for (repIndex = 1; repIndex <= 3; repIndex++) {
- g_engine->_sound->playVoc("POZO", 180395, 6034);
+ _sound->playVoc("POZO", 180395, 6034);
animIndex = 0;
do {
emptyLoop();
gameTick = false;
if (gameTickHalfSpeed) {
- if (currentSecondaryTrajectoryIndex >= currentRoomData->secondaryTrajectoryLength)
- currentSecondaryTrajectoryIndex = 1;
+ if (_currentSecondaryTrajectoryIndex >= _currentRoomData->secondaryTrajectoryLength)
+ _currentSecondaryTrajectoryIndex = 1;
else
- currentSecondaryTrajectoryIndex += 1;
- secondaryAnimation.posx = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].x;
- secondaryAnimation.posy = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].y;
- secondaryAnimation.dir = currentRoomData->secondaryAnimDirections[currentSecondaryTrajectoryIndex - 1];
- if (iframe2 >= secondaryAnimationFrameCount - 1)
- iframe2 = 0;
+ _currentSecondaryTrajectoryIndex += 1;
+ _secondaryAnimation.posx = _currentRoomData->secondaryAnimTrajectory[_currentSecondaryTrajectoryIndex - 1].x;
+ _secondaryAnimation.posy = _currentRoomData->secondaryAnimTrajectory[_currentSecondaryTrajectoryIndex - 1].y;
+ _secondaryAnimation.dir = _currentRoomData->secondaryAnimDirections[_currentSecondaryTrajectoryIndex - 1];
+ if (_iframe2 >= _secondaryAnimationFrameCount - 1)
+ _iframe2 = 0;
else
- iframe2++;
+ _iframe2++;
sprites(false);
animationFile.read(animptr, animFrameSize);
- g_engine->_graphics->putImg(animX, animY, animptr);
+ _graphics->putImg(animX, animY, animptr);
animIndex += 1;
}
- } while (animIndex != secFrameCount && !g_engine->shouldQuit());
+ } while (animIndex != secFrameCount && !shouldQuit());
animationFile.seek(4);
}
- g_engine->_sound->stopVoc();
+ _sound->stopVoc();
free(animptr);
animationFile.close();
- characterPosX = tmpCharacterPosX;
+ _characterPosX = tmpCharacterPosX;
} break;
case 3: {
- tmpCharacterPosX = characterPosX;
- characterPosX = 3;
+ tmpCharacterPosX = _characterPosX;
+ _characterPosX = 3;
if (!animationFile.open("POZO02.DAT")) {
showError(277);
}
@@ -577,30 +557,30 @@ void animatedSequence(uint numSequence) {
emptyLoop();
gameTick = false;
if (gameTickHalfSpeed) {
- if (currentSecondaryTrajectoryIndex >= currentRoomData->secondaryTrajectoryLength)
- currentSecondaryTrajectoryIndex = 1;
+ if (_currentSecondaryTrajectoryIndex >= _currentRoomData->secondaryTrajectoryLength)
+ _currentSecondaryTrajectoryIndex = 1;
else
- currentSecondaryTrajectoryIndex += 1;
- secondaryAnimation.posx = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].x;
- secondaryAnimation.posy = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].y;
- secondaryAnimation.dir = currentRoomData->secondaryAnimDirections[currentSecondaryTrajectoryIndex - 1];
- if (iframe2 >= secondaryAnimationFrameCount - 1)
- iframe2 = 0;
+ _currentSecondaryTrajectoryIndex += 1;
+ _secondaryAnimation.posx = _currentRoomData->secondaryAnimTrajectory[_currentSecondaryTrajectoryIndex - 1].x;
+ _secondaryAnimation.posy = _currentRoomData->secondaryAnimTrajectory[_currentSecondaryTrajectoryIndex - 1].y;
+ _secondaryAnimation.dir = _currentRoomData->secondaryAnimDirections[_currentSecondaryTrajectoryIndex - 1];
+ if (_iframe2 >= _secondaryAnimationFrameCount - 1)
+ _iframe2 = 0;
else
- iframe2++;
+ _iframe2++;
sprites(false);
animationFile.read(animptr, animFrameSize);
- g_engine->_graphics->putImg(animX, animY, animptr);
+ _graphics->putImg(animX, animY, animptr);
animIndex += 1;
}
- } while (animIndex != secFrameCount && !g_engine->shouldQuit());
+ } while (animIndex != secFrameCount && !shouldQuit());
free(animptr);
animationFile.close();
- iframe = 0;
- charFacingDirection = 2;
+ _iframe = 0;
+ _charFacingDirection = 2;
emptyLoop();
gameTick = false;
- characterPosX = tmpCharacterPosX;
+ _characterPosX = tmpCharacterPosX;
sprites(true);
} break;
case 4: {
@@ -620,44 +600,28 @@ void animatedSequence(uint numSequence) {
animationFile.read(animptr, animFrameSize);
emptyLoop();
gameTick = false;
- if (palAnimStep >= 4) {
- palAnimStep = 0;
- if (isPaletteAnimEnabled > 6)
- isPaletteAnimEnabled = 0;
- else
- isPaletteAnimEnabled += 1;
- g_engine->_graphics->updatePalette(isPaletteAnimEnabled);
- } else
- palAnimStep += 1;
- g_engine->_graphics->putShape(animX, animY, animptr);
+ _graphics->advancePaletteAnim();
+ _graphics->putShape(animX, animY, animptr);
}
- screenLayers[regobj.depth - 1] = NULL;
- g_engine->_graphics->restoreBackground();
- animIndex = mainCharAnimation.depth;
- mainCharAnimation.depth = 30;
- screenLayers[13] = animptr;
- depthMap[13].posx = animX;
- depthMap[13].posy = animY;
+ _screenLayers[_curObject.depth - 1] = NULL;
+ _graphics->restoreBackground();
+ animIndex = _mainCharAnimation.depth;
+ _mainCharAnimation.depth = 30;
+ _screenLayers[13] = animptr;
+ _depthMap[13].posx = animX;
+ _depthMap[13].posy = animY;
assembleScreen();
- g_engine->_graphics->drawScreen(sceneBackground);
- screenLayers[13] = NULL;
- mainCharAnimation.depth = animIndex;
+ _graphics->drawScreen(sceneBackground);
+ _screenLayers[13] = NULL;
+ _mainCharAnimation.depth = animIndex;
drawBackpack();
for (animIndex = 32; animIndex <= secFrameCount; animIndex++) {
animationFile.read(animptr, animFrameSize);
emptyLoop();
gameTick = false;
- if (palAnimStep >= 4) {
- palAnimStep = 0;
- if (isPaletteAnimEnabled > 6)
- isPaletteAnimEnabled = 0;
- else
- isPaletteAnimEnabled += 1;
- g_engine->_graphics->updatePalette(isPaletteAnimEnabled);
- } else
- palAnimStep += 1;
- g_engine->_graphics->putImg(animX, animY, animptr);
- if (g_engine->shouldQuit()) {
+ _graphics->advancePaletteAnim();
+ _graphics->putImg(animX, animY, animptr);
+ if (shouldQuit()) {
break;
}
}
@@ -679,78 +643,70 @@ void animatedSequence(uint numSequence) {
animationFile.read(animptr, animFrameSize);
emptyLoop();
gameTick = false;
- g_engine->_graphics->putShape(animX, animY, animptr);
- if (g_engine->shouldQuit()) {
+ _graphics->putShape(animX, animY, animptr);
+ if (shouldQuit()) {
break;
}
}
- animIndex = mainCharAnimation.depth;
- mainCharAnimation.depth = 30;
- screenLayers[12] = animptr;
- depthMap[12].posx = animX;
- depthMap[12].posy = animY;
+ animIndex = _mainCharAnimation.depth;
+ _mainCharAnimation.depth = 30;
+ _screenLayers[12] = animptr;
+ _depthMap[12].posx = animX;
+ _depthMap[12].posy = animY;
disableSecondAnimation();
- screenLayers[12] = NULL;
- mainCharAnimation.depth = animIndex;
- g_engine->_graphics->drawScreen(sceneBackground);
+ _screenLayers[12] = NULL;
+ _mainCharAnimation.depth = animIndex;
+ _graphics->drawScreen(sceneBackground);
for (animIndex = 9; animIndex <= secFrameCount; animIndex++) {
animationFile.read(animptr, animFrameSize);
emptyLoop();
gameTick = false;
emptyLoop();
gameTick = false;
- g_engine->_graphics->putShape(animX, animY, animptr);
- if (g_engine->shouldQuit()) {
+ _graphics->putShape(animX, animY, animptr);
+ if (shouldQuit()) {
break;
}
}
free(animptr);
animationFile.close();
- iframe = 0;
- charFacingDirection = 2;
+ _iframe = 0;
+ _charFacingDirection = 2;
emptyLoop();
gameTick = false;
sprites(true);
} break;
case 6: {
- currentRoomData->animationFlag = false;
+ _currentRoomData->animationFlag = false;
if (!animationFile.open("AZCCOG.DAT")) {
showError(277);
}
animFrameSize = animationFile.readUint16LE();
secFrameCount = animationFile.readByte();
animationFile.readByte();
- screenLayers[6] = (byte *)malloc(animFrameSize);
- depthMap[6].posx = secondaryAnimation.posx + 5;
- depthMap[6].posy = secondaryAnimation.posy - 6;
+ _screenLayers[6] = (byte *)malloc(animFrameSize);
+ _depthMap[6].posx = _secondaryAnimation.posx + 5;
+ _depthMap[6].posy = _secondaryAnimation.posy - 6;
animIndex = 0;
do {
emptyLoop();
gameTick = false;
- if (palAnimStep >= 4) {
- palAnimStep = 0;
- if (isPaletteAnimEnabled > 6)
- isPaletteAnimEnabled = 0;
- else
- isPaletteAnimEnabled += 1;
- g_engine->_graphics->updatePalette(isPaletteAnimEnabled);
- } else
- palAnimStep += 1;
+ _graphics->advancePaletteAnim();
if (gameTickHalfSpeed) {
- animationFile.read(screenLayers[6], animFrameSize);
- Common::copy(screenLayers[6], screenLayers[6] + animFrameSize, sceneBackground + 44900);
- g_engine->_graphics->restoreBackground();
+ animationFile.read(_screenLayers[6], animFrameSize);
+ Common::copy(_screenLayers[6], _screenLayers[6] + animFrameSize, sceneBackground + 44900);
+ _graphics->restoreBackground();
assembleScreen();
- g_engine->_graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(sceneBackground);
animIndex += 1;
if (animIndex == 8)
- g_engine->_sound->playVoc("PUFF", 191183, 18001);
+ _sound->playVoc("PUFF", 191183, 18001);
}
- } while (animIndex != secFrameCount && !g_engine->shouldQuit());
+ } while (animIndex != secFrameCount && !shouldQuit());
animationFile.close();
- g_engine->_sound->stopVoc();
- screenLayers[6] = NULL;
- currentRoomData->animationFlag = true;
+ _sound->stopVoc();
+ _screenLayers[6] = NULL;
+ _currentRoomData->animationFlag = true;
} break;
}
}
@@ -793,7 +749,7 @@ RoomObjectListEntry *readRoomObjects(Common::SeekableReadStream *screenDataFile)
return objectMetadata;
}
-RoomFileRegister *readScreenDataFile(Common::SeekableReadStream *screenDataFile) {
+RoomFileRegister *TotEngine::readScreenDataFile(Common::SeekableReadStream *screenDataFile) {
RoomFileRegister *screenData = new RoomFileRegister();
screenData->code = screenDataFile->readUint16LE();
screenData->roomImagePointer = screenDataFile->readUint32LE();
@@ -831,55 +787,54 @@ RoomFileRegister *readScreenDataFile(Common::SeekableReadStream *screenDataFile)
return screenData;
}
-void loadScreenData(uint screenNumber) {
+void TotEngine::loadScreenData(uint screenNumber) {
debug("Opening screen %d", screenNumber);
currentRoomNumber = screenNumber;
- rooms->seek(screenNumber * roomRegSize, SEEK_SET);
- clearScreenData();
- currentRoomData = readScreenDataFile(rooms);
+ _rooms->seek(screenNumber * kRoomRegSize, SEEK_SET);
+ _currentRoomData = readScreenDataFile(_rooms);
loadScreen();
for (int i = 0; i < 15; i++) {
- RoomBitmapRegister &bitmap = currentRoomData->screenLayers[i];
+ RoomBitmapRegister &bitmap = _currentRoomData->screenLayers[i];
if (bitmap.bitmapSize > 0) {
loadItem(bitmap.coordx, bitmap.coordy, bitmap.bitmapSize, bitmap.bitmapPointer, bitmap.depth);
}
}
- if (currentRoomData->animationFlag && currentRoomData->code != 24) {
- loadAnimation(currentRoomData->animationName);
- iframe2 = 0;
- currentSecondaryTrajectoryIndex = 1;
- secondaryAnimation.dir = currentRoomData->secondaryAnimDirections[currentSecondaryTrajectoryIndex - 1];
- secondaryAnimation.posx = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].x;
- secondaryAnimation.posy = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].y;
- if (currentRoomData->animationName == "FUENTE01")
- secondaryAnimation.depth = 0;
+ if (_currentRoomData->animationFlag && _currentRoomData->code != 24) {
+ loadAnimation(_currentRoomData->animationName);
+ _iframe2 = 0;
+ _currentSecondaryTrajectoryIndex = 1;
+ _secondaryAnimation.dir = _currentRoomData->secondaryAnimDirections[_currentSecondaryTrajectoryIndex - 1];
+ _secondaryAnimation.posx = _currentRoomData->secondaryAnimTrajectory[_currentSecondaryTrajectoryIndex - 1].x;
+ _secondaryAnimation.posy = _currentRoomData->secondaryAnimTrajectory[_currentSecondaryTrajectoryIndex - 1].y;
+ if (_currentRoomData->animationName == "FUENTE01")
+ _secondaryAnimation.depth = 0;
else {
updateSecondaryAnimationDepth();
}
- for (int i = 0; i < maxXGrid; i++)
- for (int j = 0; j < maxYGrid; j++) {
- if (maskGridSecondaryAnim[i][j] > 0)
- currentRoomData->walkAreasGrid[oldposx + i][oldposy + j] = maskGridSecondaryAnim[i][j];
- if (maskMouseSecondaryAnim[i][j] > 0)
- currentRoomData->mouseGrid[oldposx + i][oldposy + j] = maskMouseSecondaryAnim[i][j];
+ for (int i = 0; i < _maxXGrid; i++)
+ for (int j = 0; j < _maxYGrid; j++) {
+ if (_maskGridSecondaryAnim[i][j] > 0)
+ _currentRoomData->walkAreasGrid[_oldposx + i][_oldposy + j] = _maskGridSecondaryAnim[i][j];
+ if (_maskMouseSecondaryAnim[i][j] > 0)
+ _currentRoomData->mouseGrid[_oldposx + i][_oldposy + j] = _maskMouseSecondaryAnim[i][j];
}
} else
- currentRoomData->animationFlag = false;
+ _currentRoomData->animationFlag = false;
updateMainCharacterDepth();
assembleScreen();
- isPaletteAnimEnabled = 0;
+ g_engine->_graphics->_paletteAnimFrame = 0;
}
/**
* Calculates a trajectory between the current position (xframe, yframe)
* and the target position (finalx, finaly) using bresenham's algorithm
*/
-void calculateTrajectory(uint finalX, uint finalY) {
+void TotEngine::calculateTrajectory(uint finalX, uint finalY) {
- int deltaX = finalX - characterPosX;
- int deltaY = finalY - characterPosY;
+ int deltaX = finalX - _characterPosX;
+ int deltaY = finalY - _characterPosY;
int incrXDiag = (deltaX >= 0) ? 1 : -1;
int incrYDiag = (deltaY >= 0) ? 1 : -1;
@@ -903,15 +858,15 @@ void calculateTrajectory(uint finalX, uint finalY) {
int dec = straightAmount - deltaX; // decision variable
// start at initial position
- uint x = characterPosX, y = characterPosY;
- int steps = deltaX + 1; // number of steps
-
- currentTrajectoryIndex = 0;
- trajectoryLength = 0;
- trajectory[trajectoryLength].x = x;
- trajectory[trajectoryLength].y = y;
- trajectoryLength++;
- while (--steps) {
+ uint x = _characterPosX, y = _characterPosY;
+ int trajectorySteps = deltaX + 1; // number of steps
+
+ _currentTrajectoryIndex = 0;
+ _trajectoryLength = 0;
+ _trajectory[_trajectoryLength].x = x;
+ _trajectory[_trajectoryLength].y = y;
+ _trajectoryLength++;
+ while (--trajectorySteps) {
if (dec >= 0) {
x += incrXDiag;
y += incrYDiag;
@@ -921,20 +876,19 @@ void calculateTrajectory(uint finalX, uint finalY) {
y += straightYIncrease;
dec += straightAmount;
}
- trajectory[trajectoryLength].x = x;
- trajectory[trajectoryLength].y = y;
- trajectoryLength++;
+ _trajectory[_trajectoryLength].x = x;
+ _trajectory[_trajectoryLength].y = y;
+ _trajectoryLength++;
}
// Ensure last value is also final position to account for overflow of the route
- trajectory[trajectoryLength].x = finalX;
- trajectory[trajectoryLength].y = finalY;
- trajectory[trajectoryLength + 1].x = finalX;
- trajectory[trajectoryLength + 1].y = finalY;
-
+ _trajectory[_trajectoryLength].x = finalX;
+ _trajectory[_trajectoryLength].y = finalY;
+ _trajectory[_trajectoryLength + 1].x = finalX;
+ _trajectory[_trajectoryLength + 1].y = finalY;
}
-void lookAtObject(byte objectCode) {
+void TotEngine::lookAtObject(byte objectCode) {
byte yaux;
Common::String description;
@@ -942,12 +896,12 @@ void lookAtObject(byte objectCode) {
TextEntry textRef;
palette secPalette;
- cpCounter2 = cpCounter;
- g_engine->_mouseManager->hide();
- g_engine->_graphics->copyPalette(pal, secPalette);
- readItemRegister(inventory[objectCode].code);
- g_engine->_graphics->getImg(0, 0, 319, 139, sceneBackground);
- g_engine->_graphics->partialFadeOut(234);
+ _cpCounter2 = _cpCounter;
+ _mouse->hide();
+ _graphics->copyPalette(g_engine->_graphics->_pal, secPalette);
+ readItemRegister(_inventory[objectCode].code);
+ _graphics->getImg(0, 0, 319, 139, sceneBackground);
+ _graphics->partialFadeOut(234);
bar(0, 0, 319, 139, 0);
for (yaux = 1; yaux <= 12; yaux++)
buttonBorder(
@@ -964,184 +918,184 @@ void lookAtObject(byte objectCode) {
drawMenu(4);
- if (regobj.used[0] != 9) {
- if (regobj.beforeUseTextRef != 0) {
+ if (_curObject.used[0] != 9) {
+ if (_curObject.beforeUseTextRef != 0) {
assignText();
- textRef = readVerbRegister(regobj.beforeUseTextRef);
+ textRef = readVerbRegister(_curObject.beforeUseTextRef);
description = textRef.text;
for (yaux = 0; yaux < textRef.text.size(); yaux++)
- description.setChar(decryptionKey[yaux] ^ textRef.text[yaux], yaux);
- hyperText(description, 60, 15, 33, 255, 0);
- verb.close();
+ description.setChar(_decryptionKey[yaux] ^ textRef.text[yaux], yaux);
+ displayObjectDescription(description, 60, 15, 33, 255, 0);
+ _verbFile.close();
} else {
- description = inventory[objectCode].objectName;
- hyperText(description, 60, 15, 33, 255, 0);
+ description = _inventory[objectCode].objectName;
+ displayObjectDescription(description, 60, 15, 33, 255, 0);
}
} else {
- if (regobj.afterUseTextRef != 0) {
+ if (_curObject.afterUseTextRef != 0) {
assignText();
- textRef = readVerbRegister(regobj.afterUseTextRef);
+ textRef = readVerbRegister(_curObject.afterUseTextRef);
description = textRef.text;
for (yaux = 0; yaux < textRef.text.size(); yaux++)
- description.setChar(decryptionKey[yaux] ^ textRef.text[yaux], yaux);
- hyperText(description, 60, 15, 33, 255, 0);
- verb.close();
+ description.setChar(_decryptionKey[yaux] ^ textRef.text[yaux], yaux);
+ displayObjectDescription(description, 60, 15, 33, 255, 0);
+ _verbFile.close();
} else {
- description = inventory[objectCode].objectName;
- hyperText(description, 60, 15, 33, 255, 0);
+ description = _inventory[objectCode].objectName;
+ displayObjectDescription(description, 60, 15, 33, 255, 0);
}
}
- drawFlc(125, 70, regobj.rotatingObjectAnimation, 60000, 9, 0, false, true, true, foobar);
+ drawFlc(125, 70, _curObject.rotatingObjectAnimation, 60000, 9, 0, false, true, true, foobar);
- g_engine->_graphics->sceneTransition(3, true, NULL);
- g_engine->_graphics->partialFadeOut(234);
+ _graphics->sceneTransition(true, NULL, 3);
+ _graphics->partialFadeOut(234);
assembleScreen();
- g_engine->_graphics->drawScreen(sceneBackground);
- g_engine->_graphics->copyPalette(secPalette, pal);
- g_engine->_graphics->partialFadeIn(234);
- g_engine->_mouseManager->show();
+ _graphics->drawScreen(sceneBackground);
+ _graphics->copyPalette(secPalette, g_engine->_graphics->_pal);
+ _graphics->partialFadeIn(234);
+ _mouse->show();
}
-void useInventoryObjectWithInventoryObject(uint objectCode1, uint objectCode2) {
+void TotEngine::useInventoryObjectWithInventoryObject(uint objectCode1, uint objectCode2) {
byte invIndex, indobj1, indobj2;
debug("Reading item register %d", objectCode1);
- readItemRegister(invItemData, objectCode1, regobj);
+ readItemRegister(_invItemData, objectCode1, _curObject);
// verifyCopyProtection2();
- if (regobj.used[0] != 1 || regobj.useWith != objectCode2) {
+ if (_curObject.used[0] != 1 || _curObject.useWith != objectCode2) {
drawText(Random(11) + 1022);
return;
}
invIndex = 0;
- while (inventory[invIndex].code != objectCode1) {
+ while (_inventory[invIndex].code != objectCode1) {
invIndex += 1;
}
indobj1 = invIndex;
invIndex = 0;
- while (inventory[invIndex].code != objectCode2) {
+ while (_inventory[invIndex].code != objectCode2) {
invIndex += 1;
}
indobj2 = invIndex;
- foo = regobj.useTextRef;
+ uint textRef = _curObject.useTextRef;
- if (regobj.replaceWith == 0) {
- readItemRegister(invItemData, objectCode1, regobj);
- regobj.used[0] = 9;
- saveItemRegister(regobj, invItemData);
+ if (_curObject.replaceWith == 0) {
+ readItemRegister(_invItemData, objectCode1, _curObject);
+ _curObject.used[0] = 9;
+ saveItemRegister(_curObject, _invItemData);
- readItemRegister(invItemData, objectCode2, regobj);
- regobj.used[0] = 9;
- saveItemRegister(regobj, invItemData);
+ readItemRegister(_invItemData, objectCode2, _curObject);
+ _curObject.used[0] = 9;
+ saveItemRegister(_curObject, _invItemData);
} else {
- readItemRegister(invItemData, regobj.replaceWith, regobj);
- inventory[indobj1].bitmapIndex = regobj.objectIconBitmap;
- inventory[indobj1].code = regobj.code;
- inventory[indobj1].objectName = regobj.name;
- for (indobj1 = indobj2; indobj1 < (inventoryIconCount - 1); indobj1++) {
- inventory[indobj1].bitmapIndex = inventory[indobj1 + 1].bitmapIndex;
- inventory[indobj1].code = inventory[indobj1 + 1].code;
- inventory[indobj1].objectName = inventory[indobj1 + 1].objectName;
+ readItemRegister(_invItemData, _curObject.replaceWith, _curObject);
+ _inventory[indobj1].bitmapIndex = _curObject.objectIconBitmap;
+ _inventory[indobj1].code = _curObject.code;
+ _inventory[indobj1].objectName = _curObject.name;
+ for (indobj1 = indobj2; indobj1 < (kInventoryIconCount - 1); indobj1++) {
+ _inventory[indobj1].bitmapIndex = _inventory[indobj1 + 1].bitmapIndex;
+ _inventory[indobj1].code = _inventory[indobj1 + 1].code;
+ _inventory[indobj1].objectName = _inventory[indobj1 + 1].objectName;
}
- g_engine->_mouseManager->hide();
+ _mouse->hide();
drawBackpack();
- g_engine->_mouseManager->show();
+ _mouse->show();
}
- if (foo > 0)
- drawText(foo);
+ if (textRef > 0)
+ drawText(textRef);
}
-void calculateRoute(byte zone1, byte zone2, bool extraCorrection, bool barredZone) {
+void TotEngine::calculateRoute(byte zone1, byte zone2, bool extraCorrection, bool barredZone) {
// Resets the entire route
- for (steps = 0; steps < 7; steps++) {
- mainRoute[steps].x = 0;
- mainRoute[steps].y = 0;
+ for (_trajectorySteps = 0; _trajectorySteps < 7; _trajectorySteps++) {
+ _mainRoute[_trajectorySteps].x = 0;
+ _mainRoute[_trajectorySteps].y = 0;
}
- steps = 0;
+ _trajectorySteps = 0;
// Starts first element of route with current position
- mainRoute[0].x = characterPosX;
- mainRoute[0].y = characterPosY;
+ _mainRoute[0].x = _characterPosX;
+ _mainRoute[0].y = _characterPosY;
Common::Point point;
do {
- steps += 1;
- point = currentRoomData->trajectories[zone1 - 1][zone2 - 1][steps - 1];
+ _trajectorySteps += 1;
+ point = _currentRoomData->trajectories[zone1 - 1][zone2 - 1][_trajectorySteps - 1];
- if (point.x < (characterCorrectionX + 3))
- mainRoute[steps].x = 3;
+ if (point.x < (kCharacterCorrectionX + 3))
+ _mainRoute[_trajectorySteps].x = 3;
else
- mainRoute[steps].x = point.x - characterCorrectionX;
- if (point.y < (characerCorrectionY + 3))
- mainRoute[steps].y = 3;
+ _mainRoute[_trajectorySteps].x = point.x - kCharacterCorrectionX;
+ if (point.y < (kCharacerCorrectionY + 3))
+ _mainRoute[_trajectorySteps].y = 3;
else
- mainRoute[steps].y = point.y - characerCorrectionY;
+ _mainRoute[_trajectorySteps].y = point.y - kCharacerCorrectionY;
- } while (point.y != 9999 && steps != 5);
+ } while (point.y != 9999 && _trajectorySteps != 5);
if (zone2 < 10) {
if (point.y == 9999) {
- mainRoute[steps].x = xframe2 - characterCorrectionX;
- mainRoute[steps].y = yframe2 - characerCorrectionY;
+ _mainRoute[_trajectorySteps].x = _xframe2 - kCharacterCorrectionX;
+ _mainRoute[_trajectorySteps].y = _yframe2 - kCharacerCorrectionY;
} else {
- mainRoute[6].x = xframe2 - characterCorrectionX;
- mainRoute[6].y = yframe2 - characerCorrectionY;
- steps = 6;
+ _mainRoute[6].x = _xframe2 - kCharacterCorrectionX;
+ _mainRoute[6].y = _yframe2 - kCharacerCorrectionY;
+ _trajectorySteps = 6;
}
} else {
- if ((mainRoute[steps].y + characerCorrectionY) == 9999) {
- steps -= 1;
+ if ((_mainRoute[_trajectorySteps].y + kCharacerCorrectionY) == 9999) {
+ _trajectorySteps -= 1;
}
if (extraCorrection) {
- switch (currentRoomData->code) {
+ switch (_currentRoomData->code) {
case 5:
if (zone2 == 27)
- steps += 1;
+ _trajectorySteps += 1;
break;
case 6:
if (zone2 == 21)
- steps += 1;
+ _trajectorySteps += 1;
break;
}
}
}
if (extraCorrection && barredZone) {
- steps -= 1;
+ _trajectorySteps -= 1;
}
// Sets xframe2 now to be the number of steps in the route
- xframe2 = steps;
+ _xframe2 = _trajectorySteps;
// Sets yframe2 to now be current step
- yframe2 = 1;
- trajectoryLength = 10;
- currentTrajectoryIndex = 30;
+ _yframe2 = 1;
+ _trajectoryLength = 10;
+ _currentTrajectoryIndex = 30;
}
-void goToObject(byte zone1, byte zone2) {
+void TotEngine::goToObject(byte zone1, byte zone2) {
bool barredZone = false;
- cpCounter2 = cpCounter;
+ _cpCounter2 = _cpCounter;
for (int i = 0; i < 5; i++) {
- if (currentRoomData->doors[i].doorcode == zone2) {
+ if (_currentRoomData->doors[i].doorcode == zone2) {
barredZone = true;
break;
}
}
- if (currentRoomData->code == 21 && currentRoomData->animationFlag) {
+ if (_currentRoomData->code == 21 && _currentRoomData->animationFlag) {
if ((zone2 >= 1 && zone2 <= 5) ||
(zone2 >= 9 && zone2 <= 13) ||
(zone2 >= 18 && zone2 <= 21) ||
zone2 == 24 || zone2 == 25) {
- targetZone = 7;
- mouseClickX = 232;
- mouseClickY = 75;
+ _targetZone = 7;
+ _mouse->mouseClickX = 232;
+ _mouse->mouseClickY = 75;
zone2 = 7;
}
if (zone2 == 24) {
@@ -1149,102 +1103,102 @@ void goToObject(byte zone1, byte zone2) {
}
}
if (zone1 < 10) {
- xframe2 = mouseClickX + 7;
- yframe2 = mouseClickY + 7;
+ _xframe2 = _mouse->mouseClickX + 7;
+ _yframe2 = _mouse->mouseClickY + 7;
- g_engine->_mouseManager->hide();
+ _mouse->hide();
calculateRoute(zone1, zone2, true, barredZone);
Common::Event e;
do {
- g_engine->_chrono->updateChrono();
+ _chrono->updateChrono();
while (g_system->getEventManager()->pollEvent(e)) {
changeGameSpeed(e);
}
advanceAnimations(barredZone, false);
- g_engine->_screen->update();
+ _screen->update();
g_system->delayMillis(10);
- } while (xframe2 != 0);
+ } while (_xframe2 != 0);
- iframe = 0;
+ _iframe = 0;
sprites(true);
- g_engine->_mouseManager->show();
+ _mouse->show();
}
}
-void updateSecondaryAnimationDepth() {
- uint animationPos = secondaryAnimation.posy + secondaryAnimHeight - 1;
+void TotEngine::updateSecondaryAnimationDepth() {
+ uint animationPos = _secondaryAnimation.posy + _secondaryAnimHeight - 1;
if (animationPos >= 0 && animationPos <= 56) {
- secondaryAnimation.depth = 0;
+ _secondaryAnimation.depth = 0;
} else if (animationPos >= 57 && animationPos <= 66) {
- secondaryAnimation.depth = 1;
+ _secondaryAnimation.depth = 1;
} else if (animationPos >= 65 && animationPos <= 74) {
- secondaryAnimation.depth = 2;
+ _secondaryAnimation.depth = 2;
} else if (animationPos >= 73 && animationPos <= 82) {
- secondaryAnimation.depth = 3;
+ _secondaryAnimation.depth = 3;
} else if (animationPos >= 81 && animationPos <= 90) {
- secondaryAnimation.depth = 4;
+ _secondaryAnimation.depth = 4;
} else if (animationPos >= 89 && animationPos <= 98) {
- secondaryAnimation.depth = 5;
+ _secondaryAnimation.depth = 5;
} else if (animationPos >= 97 && animationPos <= 106) {
- secondaryAnimation.depth = 6;
+ _secondaryAnimation.depth = 6;
} else if (animationPos >= 105 && animationPos <= 114) {
- secondaryAnimation.depth = 7;
+ _secondaryAnimation.depth = 7;
} else if (animationPos >= 113 && animationPos <= 122) {
- secondaryAnimation.depth = 8;
+ _secondaryAnimation.depth = 8;
} else if (animationPos >= 121 && animationPos <= 140) {
- secondaryAnimation.depth = 9;
+ _secondaryAnimation.depth = 9;
}
}
-void updateMainCharacterDepth() {
- if (characterPosY >= 0 && characterPosY <= 7) {
- mainCharAnimation.depth = 0;
- } else if (characterPosY >= 8 && characterPosY <= 17) {
- mainCharAnimation.depth = 1;
- } else if (characterPosY >= 18 && characterPosY <= 25) {
- mainCharAnimation.depth = 2;
- } else if (characterPosY >= 26 && characterPosY <= 33) {
- mainCharAnimation.depth = 3;
- } else if (characterPosY >= 34 && characterPosY <= 41) {
- mainCharAnimation.depth = 4;
- } else if (characterPosY >= 42 && characterPosY <= 49) {
- mainCharAnimation.depth = 5;
- } else if (characterPosY >= 50 && characterPosY <= 57) {
- mainCharAnimation.depth = 6;
- } else if (characterPosY >= 58 && characterPosY <= 65) {
- mainCharAnimation.depth = 7;
- } else if (characterPosY >= 66 && characterPosY <= 73) {
- mainCharAnimation.depth = 8;
- } else if (characterPosY >= 74 && characterPosY <= 139) {
- mainCharAnimation.depth = 9;
+void TotEngine::updateMainCharacterDepth() {
+ if (_characterPosY >= 0 && _characterPosY <= 7) {
+ _mainCharAnimation.depth = 0;
+ } else if (_characterPosY >= 8 && _characterPosY <= 17) {
+ _mainCharAnimation.depth = 1;
+ } else if (_characterPosY >= 18 && _characterPosY <= 25) {
+ _mainCharAnimation.depth = 2;
+ } else if (_characterPosY >= 26 && _characterPosY <= 33) {
+ _mainCharAnimation.depth = 3;
+ } else if (_characterPosY >= 34 && _characterPosY <= 41) {
+ _mainCharAnimation.depth = 4;
+ } else if (_characterPosY >= 42 && _characterPosY <= 49) {
+ _mainCharAnimation.depth = 5;
+ } else if (_characterPosY >= 50 && _characterPosY <= 57) {
+ _mainCharAnimation.depth = 6;
+ } else if (_characterPosY >= 58 && _characterPosY <= 65) {
+ _mainCharAnimation.depth = 7;
+ } else if (_characterPosY >= 66 && _characterPosY <= 73) {
+ _mainCharAnimation.depth = 8;
+ } else if (_characterPosY >= 74 && _characterPosY <= 139) {
+ _mainCharAnimation.depth = 9;
}
}
-void advanceAnimations(bool barredZone, bool animateMouse) {
+void TotEngine::advanceAnimations(bool barredZone, bool animateMouse) {
if (gameTick) {
- if (currentRoomData->animationFlag && gameTickHalfSpeed) {
- if (isPeterCoughing && (Random(100) == 1) && !g_engine->_sound->isVocPlaying() && mintTopic[0] == false) {
+ if (_currentRoomData->animationFlag && gameTickHalfSpeed) {
+ if (_isPeterCoughing && (Random(100) == 1) && !_sound->isVocPlaying() && _mintTopic[0] == false) {
debug("Playing tos");
- g_engine->_sound->playVoc("TOS", 258006, 14044);
+ _sound->playVoc("TOS", 258006, 14044);
}
- if (currentSecondaryTrajectoryIndex >= currentRoomData->secondaryTrajectoryLength)
- currentSecondaryTrajectoryIndex = 1;
+ if (_currentSecondaryTrajectoryIndex >= _currentRoomData->secondaryTrajectoryLength)
+ _currentSecondaryTrajectoryIndex = 1;
else
- currentSecondaryTrajectoryIndex += 1;
- if (iframe2 >= secondaryAnimationFrameCount - 1)
- iframe2 = 0;
+ _currentSecondaryTrajectoryIndex += 1;
+ if (_iframe2 >= _secondaryAnimationFrameCount - 1)
+ _iframe2 = 0;
else
- iframe2++;
- secondaryAnimation.posx = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].x;
- secondaryAnimation.posy = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].y;
- secondaryAnimation.dir = currentRoomData->secondaryAnimDirections[currentSecondaryTrajectoryIndex - 1];
- switch (currentRoomData->code) {
+ _iframe2++;
+ _secondaryAnimation.posx = _currentRoomData->secondaryAnimTrajectory[_currentSecondaryTrajectoryIndex - 1].x;
+ _secondaryAnimation.posy = _currentRoomData->secondaryAnimTrajectory[_currentSecondaryTrajectoryIndex - 1].y;
+ _secondaryAnimation.dir = _currentRoomData->secondaryAnimDirections[_currentSecondaryTrajectoryIndex - 1];
+ switch (_currentRoomData->code) {
case 23:
- secondaryAnimation.depth = 0;
+ _secondaryAnimation.depth = 0;
break;
case 24:
- secondaryAnimation.depth = 14;
+ _secondaryAnimation.depth = 14;
break;
default:
updateSecondaryAnimationDepth();
@@ -1252,199 +1206,156 @@ void advanceAnimations(bool barredZone, bool animateMouse) {
}
// This means character needs to walk
- if (xframe2 > 0) {
- if (charFacingDirection == 1 || charFacingDirection == 3) {
- currentTrajectoryIndex += 1;
+ if (_xframe2 > 0) {
+ if (_charFacingDirection == 1 || _charFacingDirection == 3) {
+ _currentTrajectoryIndex += 1;
}
- currentTrajectoryIndex += 1;
+ _currentTrajectoryIndex += 1;
// yframe2, xframe2 now represent max steps and current step
- if (yframe2 <= xframe2) {
- if (currentTrajectoryIndex > trajectoryLength) {
- element1 = mainRoute[yframe2].x - mainRoute[yframe2 - 1].x;
- element2 = mainRoute[yframe2].y - mainRoute[yframe2 - 1].y;
-
- if ((abs(element1) > 2) || (abs(element2) > 2)) {
- if (abs(element2) > (abs(element1) + 5)) {
- if (element2 < 0)
- charFacingDirection = 0;
+ if (_yframe2 <= _xframe2) {
+ if (_currentTrajectoryIndex > _trajectoryLength) {
+ _element1 = _mainRoute[_yframe2].x - _mainRoute[_yframe2 - 1].x;
+ _element2 = _mainRoute[_yframe2].y - _mainRoute[_yframe2 - 1].y;
+
+ if ((abs(_element1) > 2) || (abs(_element2) > 2)) {
+ if (abs(_element2) > (abs(_element1) + 5)) {
+ if (_element2 < 0)
+ _charFacingDirection = 0;
else
- charFacingDirection = 2;
+ _charFacingDirection = 2;
} else {
- if (element1 > 0)
- charFacingDirection = 1;
+ if (_element1 > 0)
+ _charFacingDirection = 1;
else
- charFacingDirection = 3;
+ _charFacingDirection = 3;
}
}
- yframe2 += 1;
- calculateTrajectory(mainRoute[yframe2 - 1].x, mainRoute[yframe2 - 1].y);
+ _yframe2 += 1;
+ calculateTrajectory(_mainRoute[_yframe2 - 1].x, _mainRoute[_yframe2 - 1].y);
}
- } else if (currentTrajectoryIndex >= trajectoryLength) {
- xframe2 = 0;
- if (!roomChange) {
- element1 = (mouseX + 7) - (characterPosX + characterCorrectionX);
- element2 = (mouseY + 7) - (characterPosY + characerCorrectionY);
- if (abs(element2) > (abs(element1) + 20)) {
- if (element2 < 0)
- charFacingDirection = 0;
+ } else if (_currentTrajectoryIndex >= _trajectoryLength) {
+ _xframe2 = 0;
+ if (!_roomChange) {
+ _element1 = (_mouse->mouseX + 7) - (_characterPosX + kCharacterCorrectionX);
+ _element2 = (_mouse->mouseY + 7) - (_characterPosY + kCharacerCorrectionY);
+ if (abs(_element2) > (abs(_element1) + 20)) {
+ if (_element2 < 0)
+ _charFacingDirection = 0;
else
- charFacingDirection = 2;
+ _charFacingDirection = 2;
} else {
- if (element1 > 0)
- charFacingDirection = 1;
+ if (_element1 > 0)
+ _charFacingDirection = 1;
else
- charFacingDirection = 3;
+ _charFacingDirection = 3;
}
}
}
- iframe++;
- if (iframe > walkFrameCount)
- iframe = 0;
+ _iframe++;
+ if (_iframe > kWalkFrameCount)
+ _iframe = 0;
} else {
- iframe = 0;
- if (barredZone == false && !roomChange) {
- element1 = (mouseX + 7) - (characterPosX + characterCorrectionX);
- element2 = (mouseY + 7) - (characterPosY + characerCorrectionY);
- if (abs(element2) > (abs(element1) + 20)) {
- if (element2 < 0)
- charFacingDirection = 0;
+ _iframe = 0;
+ if (barredZone == false && !_roomChange) {
+ _element1 = (_mouse->mouseX + 7) - (_characterPosX + kCharacterCorrectionX);
+ _element2 = (_mouse->mouseY + 7) - (_characterPosY + kCharacerCorrectionY);
+ if (abs(_element2) > (abs(_element1) + 20)) {
+ if (_element2 < 0)
+ _charFacingDirection = 0;
else
- charFacingDirection = 2;
+ _charFacingDirection = 2;
} else {
- if (element1 > 0)
- charFacingDirection = 1;
+ if (_element1 > 0)
+ _charFacingDirection = 1;
else
- charFacingDirection = 3;
+ _charFacingDirection = 3;
}
}
}
- characterPosX = trajectory[currentTrajectoryIndex].x;
- characterPosY = trajectory[currentTrajectoryIndex].y;
+ _characterPosX = _trajectory[_currentTrajectoryIndex].x;
+ _characterPosY = _trajectory[_currentTrajectoryIndex].y;
updateMainCharacterDepth();
- if (isDrawingEnabled) {
+ if (_isDrawingEnabled) {
sprites(true);
}
gameTick = false;
- if (currentRoomData->paletteAnimationFlag && palAnimStep >= 4) {
- palAnimStep = 0;
- if (isPaletteAnimEnabled > 6)
- isPaletteAnimEnabled = 0;
- else
- isPaletteAnimEnabled += 1;
- if (currentRoomData->code == 4 && isPaletteAnimEnabled == 4)
- g_engine->_sound->playVoc();
- g_engine->_graphics->updatePalette(isPaletteAnimEnabled);
- } else {
- palAnimStep += 1;
- }
+ _graphics->advancePaletteAnim();
}
}
-void actionLineText(Common::String actionLine) {
+void TotEngine::actionLineText(Common::String actionLine) {
euroText(160, 144, actionLine, 255, Graphics::kTextAlignCenter);
}
-void animateGive(uint dir, uint height) {
- charFacingDirection = dir;
+void TotEngine::animateGive(uint dir, uint height) {
+ _charFacingDirection = dir;
for (uint i = 0; i < 5; i++) {
emptyLoop();
gameTick = false;
// Must add 1 to i because the original game uses 1-based indices
- iframe = 15 + 6 + 5 + height * 10 - (i + 1);
+ _iframe = 15 + 6 + 5 + height * 10 - (i + 1);
- if (currentRoomData->paletteAnimationFlag && palAnimStep >= 4) {
- palAnimStep = 0;
- if (isPaletteAnimEnabled > 6)
- isPaletteAnimEnabled = 0;
- else
- isPaletteAnimEnabled += 1;
- g_engine->_graphics->updatePalette(isPaletteAnimEnabled);
- } else
- palAnimStep += 1;
+ _graphics->advancePaletteAnim();
sprites(true);
}
- iframe = 0;
+ _iframe = 0;
}
// Lean over to pick
-void animatePickup1(uint dir, uint height) {
- charFacingDirection = dir;
+void TotEngine::animatePickup1(uint dir, uint height) {
+ _charFacingDirection = dir;
for (uint i = 0; i < 5; i++) {
emptyLoop();
gameTick = false;
- iframe = 15 + height * 10 + (i + 1);
+ _iframe = 15 + height * 10 + (i + 1);
- if (currentRoomData->paletteAnimationFlag && palAnimStep >= 4) {
- palAnimStep = 0;
- if (isPaletteAnimEnabled > 6)
- isPaletteAnimEnabled = 0;
- else
- isPaletteAnimEnabled += 1;
- g_engine->_graphics->updatePalette(isPaletteAnimEnabled);
- } else
- palAnimStep += 1;
+ _graphics->advancePaletteAnim();
sprites(true);
- g_engine->_screen->update();
+ _screen->update();
}
}
// Lean back after pick
-void animatePickup2(uint dir, uint height) {
- charFacingDirection = dir;
+void TotEngine::animatePickup2(uint dir, uint height) {
+ _charFacingDirection = dir;
for (uint i = 0; i < 5; i++) {
emptyLoop();
gameTick = false;
- iframe = 15 + 5 + height * 10 + (i + 1);
+ _iframe = 15 + 5 + height * 10 + (i + 1);
- if (currentRoomData->paletteAnimationFlag && palAnimStep >= 4) {
- palAnimStep = 0;
- if (isPaletteAnimEnabled > 6)
- isPaletteAnimEnabled = 0;
- else
- isPaletteAnimEnabled += 1;
- g_engine->_graphics->updatePalette(isPaletteAnimEnabled);
- } else
- palAnimStep += 1;
+ _graphics->advancePaletteAnim();
sprites(true);
- g_engine->_screen->update();
+ _screen->update();
}
emptyLoop();
gameTick = false;
sprites(true);
- iframe = 0;
+ _iframe = 0;
}
-void animateOpen2(uint dir, uint height) {
- charFacingDirection = dir;
- cpCounter = cpCounter2;
+void TotEngine::animateOpen2(uint dir, uint height) {
+ _charFacingDirection = dir;
+ _cpCounter = _cpCounter2;
for (uint i = 0; i < 5; i++) {
emptyLoop();
gameTick = false;
- iframe = 15 + 6 + height * 10 - (i + 1);
+ _iframe = 15 + 6 + height * 10 - (i + 1);
- if (currentRoomData->paletteAnimationFlag && palAnimStep >= 4) {
- palAnimStep = 0;
- if (isPaletteAnimEnabled > 6)
- isPaletteAnimEnabled = 0;
- else
- isPaletteAnimEnabled += 1;
- g_engine->_graphics->updatePalette(isPaletteAnimEnabled);
- } else
- palAnimStep += 1;
+ _graphics->advancePaletteAnim();
sprites(true);
}
emptyLoop();
gameTick = false;
sprites(true);
- iframe = 0;
+ _iframe = 0;
}
-void animateBat() {
- const uint trajectory[91][2] = {
+void TotEngine::animateBat() {
+ const uint batTrajectory[91][2] = {
{288, 40}, {289, 38}, {289, 36}, {289, 34}, {290, 32}, {290, 30}, {289, 31}, {288, 32},
{288, 34}, {286, 36}, {284, 38}, {282, 40}, {280, 42}, {278, 44}, {276, 46}, {274, 48},
{272, 50}, {270, 48}, {268, 46}, {266, 48}, {265, 50}, {264, 52}, {263, 54}, {263, 56},
@@ -1463,103 +1374,95 @@ void animateBat() {
curAnimIdx, curAnimLength, curAnimX, curAnimY, curAnimDepth, curAnimDir;
bool loopBreak = false;
- if (currentRoomData->animationFlag) {
- curAnimIFrame = iframe2;
- curAnimX = secondaryAnimation.posx;
- curAnimY = secondaryAnimation.posy;
- currAnimWidth = secondaryAnimWidth;
- curAnimHeight = secondaryAnimHeight;
- curAnimDepth = secondaryAnimation.depth;
- curAnimDir = secondaryAnimation.dir;
+ if (_currentRoomData->animationFlag) {
+ curAnimIFrame = _iframe2;
+ curAnimX = _secondaryAnimation.posx;
+ curAnimY = _secondaryAnimation.posy;
+ currAnimWidth = _secondaryAnimWidth;
+ curAnimHeight = _secondaryAnimHeight;
+ curAnimDepth = _secondaryAnimation.depth;
+ curAnimDir = _secondaryAnimation.dir;
freeAnimation();
}
loadBat();
- g_engine->_sound->stopVoc();
- g_engine->_sound->playVoc("MURCIEL", 160848, 4474);
+ _sound->stopVoc();
+ _sound->playVoc("MURCIEL", 160848, 4474);
curAnimIdx = 0;
curAnimLength = 87;
- iframe2 = 0;
- secondaryAnimation.depth = 14;
+ _iframe2 = 0;
+ _secondaryAnimation.depth = 14;
do {
- g_engine->_chrono->updateChrono();
+ _chrono->updateChrono();
if (gameTick) {
if (curAnimIdx == curAnimLength)
loopBreak = true;
curAnimIdx += 1;
- if (iframe2 >= secondaryAnimationFrameCount - 1)
- iframe2 = 0;
+ if (_iframe2 >= _secondaryAnimationFrameCount - 1)
+ _iframe2 = 0;
else
- iframe2++;
+ _iframe2++;
- secondaryAnimation.posx = trajectory[curAnimIdx][0] - 20;
- secondaryAnimation.posy = trajectory[curAnimIdx][1];
- secondaryAnimation.dir = 0;
+ _secondaryAnimation.posx = batTrajectory[curAnimIdx][0] - 20;
+ _secondaryAnimation.posy = batTrajectory[curAnimIdx][1];
+ _secondaryAnimation.dir = 0;
sprites(true);
gameTick = false;
if (curAnimIdx % 24 == 0)
- g_engine->_sound->playVoc();
- if (palAnimStep >= 4) {
- palAnimStep = 0;
- if (isPaletteAnimEnabled > 6)
- isPaletteAnimEnabled = 0;
- else
- isPaletteAnimEnabled += 1;
- g_engine->_graphics->updatePalette(isPaletteAnimEnabled);
- } else
- palAnimStep += 1;
+ _sound->playVoc();
+ _graphics->advancePaletteAnim();
}
- g_engine->_screen->update();
+ _screen->update();
g_system->delayMillis(10);
- } while (!loopBreak && !g_engine->shouldQuit());
+ } while (!loopBreak && !shouldQuit());
- g_engine->_sound->stopVoc();
+ _sound->stopVoc();
freeAnimation();
- if (currentRoomData->animationFlag) {
- secondaryAnimWidth = currAnimWidth;
- secondaryAnimHeight = curAnimHeight;
- setRoomTrajectories(secondaryAnimHeight, secondaryAnimWidth, RESTORE, false);
- loadAnimation(currentRoomData->animationName);
- iframe2 = curAnimIFrame;
- secondaryAnimation.posx = curAnimX;
- secondaryAnimation.posy = curAnimY;
- secondaryAnimation.depth = curAnimDepth;
- secondaryAnimation.dir = curAnimDir;
+ if (_currentRoomData->animationFlag) {
+ _secondaryAnimWidth = currAnimWidth;
+ _secondaryAnimHeight = curAnimHeight;
+ setRoomTrajectories(_secondaryAnimHeight, _secondaryAnimWidth, RESTORE, false);
+ loadAnimation(_currentRoomData->animationName);
+ _iframe2 = curAnimIFrame;
+ _secondaryAnimation.posx = curAnimX;
+ _secondaryAnimation.posy = curAnimY;
+ _secondaryAnimation.depth = curAnimDepth;
+ _secondaryAnimation.dir = curAnimDir;
}
- g_engine->_graphics->restoreBackground();
+ _graphics->restoreBackground();
assembleScreen();
- g_engine->_graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(sceneBackground);
}
-void updateVideo() {
- readBitmap(regobj.dropOverlay, screenLayers[regobj.depth - 1], regobj.dropOverlaySize, 319);
- g_engine->_graphics->restoreBackground();
+void TotEngine::updateVideo() {
+ readBitmap(_curObject.dropOverlay, _screenLayers[_curObject.depth - 1], _curObject.dropOverlaySize, 319);
+ _graphics->restoreBackground();
assembleScreen();
- g_engine->_graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(sceneBackground);
}
-void nicheAnimation(byte nicheDir, int32 bitmap) {
+void TotEngine::nicheAnimation(byte nicheDir, int32 bitmap) {
uint bitmapOffset;
int increment;
// Room with Red
- if (currentRoomData->code == 24) {
- screenLayers[1] = (byte *)malloc(3660);
- readBitmap(1382874, screenLayers[1], 3652, 319);
- uint16 object1Width = READ_LE_UINT16(screenLayers[1]);
- uint16 object1Height = READ_LE_UINT16(screenLayers[1] + 2);
- depthMap[1].posx = 211;
- depthMap[1].posy = 16;
- depthMap[1].posx2 = 211 + object1Width + 1;
- depthMap[1].posy2 = 16 + object1Height + 1;
+ if (_currentRoomData->code == 24) {
+ _screenLayers[1] = (byte *)malloc(3660);
+ readBitmap(1382874, _screenLayers[1], 3652, 319);
+ uint16 object1Width = READ_LE_UINT16(_screenLayers[1]);
+ uint16 object1Height = READ_LE_UINT16(_screenLayers[1] + 2);
+ _depthMap[1].posx = 211;
+ _depthMap[1].posy = 16;
+ _depthMap[1].posx2 = 211 + object1Width + 1;
+ _depthMap[1].posy2 = 16 + object1Height + 1;
}
switch (nicheDir) {
case 0: {
bitmapOffset = 44904;
increment = 1;
- Common::copy(screenLayers[0], screenLayers[0] + 892, sceneBackground + 44900);
- readBitmap(bitmap, screenLayers[0], 892, 319);
- Common::copy(screenLayers[0] + 4, screenLayers[0] + 4 + 888, sceneBackground + 44900 + 892);
+ Common::copy(_screenLayers[0], _screenLayers[0] + 892, sceneBackground + 44900);
+ readBitmap(bitmap, _screenLayers[0], 892, 319);
+ Common::copy(_screenLayers[0] + 4, _screenLayers[0] + 4 + 888, sceneBackground + 44900 + 892);
} break;
case 1: { // object slides to reveal empty stand
bitmapOffset = 892 + 44900;
@@ -1567,106 +1470,106 @@ void nicheAnimation(byte nicheDir, int32 bitmap) {
// Reads the empty niche into a non-visible part of background
readBitmap(bitmap, sceneBackground + 44900, 892, 319);
// Copies whatever is currently on the niche in a non-visible part of background contiguous with the above
- Common::copy(screenLayers[0] + 4, screenLayers[0] + 4 + 888, sceneBackground + 44900 + 892);
+ Common::copy(_screenLayers[0] + 4, _screenLayers[0] + 4 + 888, sceneBackground + 44900 + 892);
// We now have in consecutive pixels the empty stand and the object
} break;
}
- uint16 nicheWidth = READ_LE_UINT16(screenLayers[0]);
- uint16 nicheHeight = READ_LE_UINT16(screenLayers[0] + 2);
+ uint16 nicheWidth = READ_LE_UINT16(_screenLayers[0]);
+ uint16 nicheHeight = READ_LE_UINT16(_screenLayers[0] + 2);
// Set the height to double to animate 2 images of the same height moving up/down
*(sceneBackground + 44900 + 2) = (nicheHeight * 2) + 1;
- g_engine->_graphics->restoreBackground();
+ _graphics->restoreBackground();
for (uint i = 1; i <= nicheHeight; i++) {
bitmapOffset = bitmapOffset + (increment * (nicheWidth + 1));
- Common::copy(sceneBackground + bitmapOffset, sceneBackground + bitmapOffset + 888, screenLayers[0] + 4);
+ Common::copy(sceneBackground + bitmapOffset, sceneBackground + bitmapOffset + 888, _screenLayers[0] + 4);
assembleScreen();
- g_engine->_graphics->drawScreen(sceneBackground);
- g_engine->_screen->update();
+ _graphics->drawScreen(sceneBackground);
+ _screen->update();
}
- readBitmap(bitmap, screenLayers[0], 892, 319);
+ readBitmap(bitmap, _screenLayers[0], 892, 319);
- g_engine->_graphics->restoreBackground();
+ _graphics->restoreBackground();
assembleScreen();
- g_engine->_graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(sceneBackground);
- if (currentRoomData->code == 24) {
- free(screenLayers[1]);
- screenLayers[1] = NULL;
+ if (_currentRoomData->code == 24) {
+ free(_screenLayers[1]);
+ _screenLayers[1] = NULL;
}
}
-void pickupScreenObject() {
+void TotEngine::pickupScreenObject() {
byte inventoryIndex;
uint screenObject;
-
- uint mouseX = (mouseClickX + 7) / xGridCount;
- uint mouseY = (mouseClickY + 7) / yGridCount;
- screenObject = currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[mouseX][mouseY]]->fileIndex;
+ Common::Point p = _mouse->getClickCoordsWithinGrid();
+ uint correctedMouseX = p.x;
+ uint correctedMouseY = p.y;
+ screenObject = _currentRoomData->screenObjectIndex[_currentRoomData->mouseGrid[correctedMouseX][correctedMouseY]]->fileIndex;
if (screenObject == 0)
return;
readItemRegister(screenObject);
goToObject(
- currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount],
- currentRoomData->walkAreasGrid[mouseX][mouseY]);
+ _currentRoomData->walkAreasGrid[(_characterPosX + kCharacterCorrectionX) / kXGridCount][(_characterPosY + kCharacerCorrectionY) / kYGridCount],
+ _currentRoomData->walkAreasGrid[correctedMouseX][correctedMouseY]);
verifyCopyProtection();
- if (regobj.pickupable) {
- g_engine->_mouseManager->hide();
- switch (regobj.code) {
+ if (_curObject.pickupable) {
+ _mouse->hide();
+ switch (_curObject.code) {
case 521: { // Corridor lamp
- currentRoomData->mouseGrid[10][11] = 19;
- currentRoomData->mouseGrid[9][12] = 18;
- currentRoomData->mouseGrid[10][12] = 18;
+ _currentRoomData->mouseGrid[10][11] = 19;
+ _currentRoomData->mouseGrid[9][12] = 18;
+ _currentRoomData->mouseGrid[10][12] = 18;
} break;
case 567: { // Pickup rubble
- if (currentRoomData->animationFlag) {
- g_engine->_mouseManager->show();
+ if (_currentRoomData->animationFlag) {
+ _mouse->show();
drawText(3226);
return;
}
} break;
case 590: // Ectoplasm
- caves[1] = true;
+ _caves[1] = true;
break;
case 665: // Bird
- caves[0] = true;
+ _caves[0] = true;
break;
case 676:
case 688: {
- caves[4] = true;
- isVasePlaced = false;
+ _caves[4] = true;
+ _isVasePlaced = false;
} break;
}
- switch (regobj.height) {
+ switch (_curObject.height) {
case 0: { // Pick up above
- switch (regobj.code) {
+ switch (_curObject.code) {
case 590: { // Ectoplasm
animatePickup1(3, 0);
animatePickup2(3, 0);
} break;
default: {
- animatePickup1(charFacingDirection, 0);
- screenLayers[regobj.depth - 1] = NULL;
- g_engine->_graphics->restoreBackground();
+ animatePickup1(_charFacingDirection, 0);
+ _screenLayers[_curObject.depth - 1] = NULL;
+ _graphics->restoreBackground();
assembleScreen();
- g_engine->_graphics->drawScreen(sceneBackground);
- animatePickup2(charFacingDirection, 0);
+ _graphics->drawScreen(sceneBackground);
+ animatePickup2(_charFacingDirection, 0);
}
}
} break;
case 1: { // Waist level
- switch (regobj.code) {
+ switch (_curObject.code) {
case 218: { // Necronomicon
animatePickup1(0, 1);
animatePickup2(0, 1);
} break;
case 223: { // table cloths
animatePickup1(0, 1);
- currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[mouseX][mouseY]]->fileIndex = regobj.replaceWith;
+ _currentRoomData->screenObjectIndex[_currentRoomData->mouseGrid[correctedMouseX][correctedMouseY]]->fileIndex = _curObject.replaceWith;
updateVideo();
animatePickup2(0, 1);
} break;
@@ -1690,7 +1593,7 @@ void pickupScreenObject() {
case 521: { // Puts plaster and key on the floor
animatePickup1(0, 1);
{
- RoomBitmapRegister &with = currentRoomData->screenLayers[1];
+ RoomBitmapRegister &with = _currentRoomData->screenLayers[1];
with.bitmapPointer = 775611;
with.bitmapSize = 36;
@@ -1700,7 +1603,7 @@ void pickupScreenObject() {
loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
{
- RoomBitmapRegister &with = currentRoomData->screenLayers[2];
+ RoomBitmapRegister &with = _currentRoomData->screenLayers[2];
with.bitmapPointer = 730743;
with.bitmapSize = 64;
@@ -1709,150 +1612,150 @@ void pickupScreenObject() {
with.depth = 1;
loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
- screenLayers[regobj.depth - 1] = NULL;
- g_engine->_graphics->restoreBackground();
+ _screenLayers[_curObject.depth - 1] = NULL;
+ _graphics->restoreBackground();
assembleScreen();
- g_engine->_graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(sceneBackground);
animatePickup2(0, 1);
} break;
case 562: { // niche
- switch (currentRoomData->code) {
+ switch (_currentRoomData->code) {
case 20: { // First scene with niche
- if (niche[0][niche[0][3]] > 0) {
+ if (_niche[0][_niche[0][3]] > 0) {
// Possibly
- if (niche[0][3] == 2 || niche[0][niche[0][3]] == 563) {
- readItemRegister(niche[0][niche[0][3]]);
- niche[0][niche[0][3]] = 0;
- currentRoomData->screenObjectIndex[9]->objectName = getObjectName(4);
+ if (_niche[0][3] == 2 || _niche[0][_niche[0][3]] == 563) {
+ readItemRegister(_niche[0][_niche[0][3]]);
+ _niche[0][_niche[0][3]] = 0;
+ _currentRoomData->screenObjectIndex[9]->objectName = getObjectName(4);
animatePickup1(3, 1);
- readBitmap(1190768, screenLayers[regobj.depth - 1], 892, 319);
- currentRoomData->screenLayers[1].bitmapPointer = 1190768;
- currentRoomData->screenLayers[1].bitmapSize = 892;
- currentRoomData->screenLayers[1].coordx = 66;
- currentRoomData->screenLayers[1].coordy = 35;
- currentRoomData->screenLayers[1].depth = 1;
- g_engine->_graphics->restoreBackground();
+ readBitmap(1190768, _screenLayers[_curObject.depth - 1], 892, 319);
+ _currentRoomData->screenLayers[1].bitmapPointer = 1190768;
+ _currentRoomData->screenLayers[1].bitmapSize = 892;
+ _currentRoomData->screenLayers[1].coordx = 66;
+ _currentRoomData->screenLayers[1].coordy = 35;
+ _currentRoomData->screenLayers[1].depth = 1;
+ _graphics->restoreBackground();
assembleScreen();
- g_engine->_graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(sceneBackground);
animatePickup2(3, 1);
} else {
- readItemRegister(niche[0][niche[0][3]]);
- niche[0][niche[0][3]] = 0;
- niche[0][3] += 1;
- niche[1][3] -= 1;
- currentRoomData->screenObjectIndex[9]->objectName = " ";
+ readItemRegister(_niche[0][_niche[0][3]]);
+ _niche[0][_niche[0][3]] = 0;
+ _niche[0][3] += 1;
+ _niche[1][3] -= 1;
+ _currentRoomData->screenObjectIndex[9]->objectName = " ";
animatePickup1(3, 1);
- readBitmap(1190768, screenLayers[regobj.depth - 1],
+ readBitmap(1190768, _screenLayers[_curObject.depth - 1],
892, 319);
- g_engine->_graphics->restoreBackground();
+ _graphics->restoreBackground();
assembleScreen();
- g_engine->_graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(sceneBackground);
animatePickup2(3, 1);
- g_engine->_sound->playVoc("PLATAF", 375907, 14724);
- currentRoomData->screenLayers[1].bitmapSize = 892;
- currentRoomData->screenLayers[1].coordx = 66;
- currentRoomData->screenLayers[1].coordy = 35;
- currentRoomData->screenLayers[1].depth = 1;
- switch (niche[0][niche[0][3]]) {
+ _sound->playVoc("PLATAF", 375907, 14724);
+ _currentRoomData->screenLayers[1].bitmapSize = 892;
+ _currentRoomData->screenLayers[1].coordx = 66;
+ _currentRoomData->screenLayers[1].coordy = 35;
+ _currentRoomData->screenLayers[1].depth = 1;
+ switch (_niche[0][_niche[0][3]]) {
case 0: {
- currentRoomData->screenObjectIndex[9]->objectName = getObjectName(4);
+ _currentRoomData->screenObjectIndex[9]->objectName = getObjectName(4);
nicheAnimation(0, 1190768);
- currentRoomData->screenLayers[1].bitmapPointer = 1190768;
+ _currentRoomData->screenLayers[1].bitmapPointer = 1190768;
} break;
case 561: {
- currentRoomData->screenObjectIndex[9]->objectName = getObjectName(5);
+ _currentRoomData->screenObjectIndex[9]->objectName = getObjectName(5);
nicheAnimation(0, 1182652);
- currentRoomData->screenLayers[1].bitmapPointer = 1182652;
+ _currentRoomData->screenLayers[1].bitmapPointer = 1182652;
} break;
case 563: {
- currentRoomData->screenObjectIndex[9]->objectName = getObjectName(6);
+ _currentRoomData->screenObjectIndex[9]->objectName = getObjectName(6);
nicheAnimation(0, 1186044);
- currentRoomData->screenLayers[1].bitmapPointer = 1186044;
+ _currentRoomData->screenLayers[1].bitmapPointer = 1186044;
} break;
case 615: {
- currentRoomData->screenObjectIndex[9]->objectName = getObjectName(7);
+ _currentRoomData->screenObjectIndex[9]->objectName = getObjectName(7);
nicheAnimation(0, 1181760);
- currentRoomData->screenLayers[1].bitmapPointer = 1181760;
+ _currentRoomData->screenLayers[1].bitmapPointer = 1181760;
} break;
}
updateAltScreen(24);
}
} else {
- g_engine->_mouseManager->show();
+ _mouse->show();
drawText(1049 + Random(10));
- g_engine->_mouseManager->hide();
+ _mouse->hide();
return;
}
} break;
case 24: { // Second scene with niche
- if (niche[1][niche[1][3]] > 0 && niche[1][3] != 1) {
- if (niche[1][3] == 2) {
- readItemRegister(niche[1][2]);
- niche[1][2] = 0;
- currentRoomData->screenObjectIndex[8]->objectName = getObjectName(4);
+ if (_niche[1][_niche[1][3]] > 0 && _niche[1][3] != 1) {
+ if (_niche[1][3] == 2) {
+ readItemRegister(_niche[1][2]);
+ _niche[1][2] = 0;
+ _currentRoomData->screenObjectIndex[8]->objectName = getObjectName(4);
animatePickup1(0, 1);
- readBitmap(1399610, screenLayers[regobj.depth - 1], 892, 319);
- currentRoomData->screenLayers[0].bitmapPointer = 1399610;
- currentRoomData->screenLayers[0].bitmapSize = 892;
- currentRoomData->screenLayers[0].coordx = 217;
- currentRoomData->screenLayers[0].coordy = 48;
- currentRoomData->screenLayers[0].depth = 1;
- g_engine->_graphics->restoreBackground();
+ readBitmap(1399610, _screenLayers[_curObject.depth - 1], 892, 319);
+ _currentRoomData->screenLayers[0].bitmapPointer = 1399610;
+ _currentRoomData->screenLayers[0].bitmapSize = 892;
+ _currentRoomData->screenLayers[0].coordx = 217;
+ _currentRoomData->screenLayers[0].coordy = 48;
+ _currentRoomData->screenLayers[0].depth = 1;
+ _graphics->restoreBackground();
assembleScreen();
- g_engine->_graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(sceneBackground);
animatePickup2(0, 1);
} else {
- readItemRegister(niche[1][niche[1][3]]);
- niche[1][niche[1][3]] = 622;
- niche[1][3] += 1;
- niche[0][3] -= 1;
- currentRoomData->screenObjectIndex[8]->objectName = " ";
+ readItemRegister(_niche[1][_niche[1][3]]);
+ _niche[1][_niche[1][3]] = 622;
+ _niche[1][3] += 1;
+ _niche[0][3] -= 1;
+ _currentRoomData->screenObjectIndex[8]->objectName = " ";
animatePickup1(0, 1);
- readBitmap(1399610, screenLayers[0], 892, 319);
- g_engine->_graphics->restoreBackground();
+ readBitmap(1399610, _screenLayers[0], 892, 319);
+ _graphics->restoreBackground();
assembleScreen();
- g_engine->_graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(sceneBackground);
animatePickup2(0, 1);
- g_engine->_sound->playVoc("PLATAF", 375907, 14724);
- currentRoomData->screenLayers[0].bitmapSize = 892;
- currentRoomData->screenLayers[0].coordx = 217;
- currentRoomData->screenLayers[0].coordy = 48;
- currentRoomData->screenLayers[0].depth = 1;
- switch (niche[1][niche[1][3]]) {
+ _sound->playVoc("PLATAF", 375907, 14724);
+ _currentRoomData->screenLayers[0].bitmapSize = 892;
+ _currentRoomData->screenLayers[0].coordx = 217;
+ _currentRoomData->screenLayers[0].coordy = 48;
+ _currentRoomData->screenLayers[0].depth = 1;
+ switch (_niche[1][_niche[1][3]]) {
case 0: {
- currentRoomData->screenObjectIndex[8]->objectName = getObjectName(4);
+ _currentRoomData->screenObjectIndex[8]->objectName = getObjectName(4);
nicheAnimation(0, 1399610);
- currentRoomData->screenLayers[0].bitmapPointer = 1399610;
+ _currentRoomData->screenLayers[0].bitmapPointer = 1399610;
} break;
case 561: {
- currentRoomData->screenObjectIndex[8]->objectName = getObjectName(5);
+ _currentRoomData->screenObjectIndex[8]->objectName = getObjectName(5);
nicheAnimation(0, 1381982);
- currentRoomData->screenLayers[0].bitmapPointer = 1381982;
+ _currentRoomData->screenLayers[0].bitmapPointer = 1381982;
} break;
case 615: {
- currentRoomData->screenObjectIndex[8]->objectName = getObjectName(7);
+ _currentRoomData->screenObjectIndex[8]->objectName = getObjectName(7);
nicheAnimation(0, 1381090);
- currentRoomData->screenLayers[0].bitmapPointer = 1381090;
+ _currentRoomData->screenLayers[0].bitmapPointer = 1381090;
} break;
case 622: {
- currentRoomData->screenObjectIndex[8]->objectName = getObjectName(8);
+ _currentRoomData->screenObjectIndex[8]->objectName = getObjectName(8);
nicheAnimation(0, 1400502);
- currentRoomData->screenLayers[0].bitmapPointer = 1400502;
+ _currentRoomData->screenLayers[0].bitmapPointer = 1400502;
} break;
case 623: {
- currentRoomData->screenObjectIndex[8]->objectName = getObjectName(9);
+ _currentRoomData->screenObjectIndex[8]->objectName = getObjectName(9);
nicheAnimation(0, 1398718);
- currentRoomData->screenLayers[0].bitmapPointer = 1398718;
+ _currentRoomData->screenLayers[0].bitmapPointer = 1398718;
} break;
}
updateAltScreen(20);
}
} else {
- g_engine->_mouseManager->show();
+ _mouse->show();
drawText(1049 + Random(10));
- g_engine->_mouseManager->hide();
+ _mouse->hide();
return;
}
} break;
@@ -1861,7 +1764,7 @@ void pickupScreenObject() {
case 624: { // red devil
animatePickup1(2, 1);
{
- RoomBitmapRegister &with = currentRoomData->screenLayers[3];
+ RoomBitmapRegister &with = _currentRoomData->screenLayers[3];
with.bitmapPointer = 0;
with.bitmapSize = 0;
@@ -1869,34 +1772,34 @@ void pickupScreenObject() {
with.coordy = 0;
with.depth = 0;
}
- screenLayers[3] = NULL;
+ _screenLayers[3] = NULL;
disableSecondAnimation();
- g_engine->_graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(sceneBackground);
animatePickup2(2, 1);
- isRedDevilCaptured = true;
- isTrapSet = false;
+ _isRedDevilCaptured = true;
+ _isTrapSet = false;
} break;
default: {
- animatePickup1(charFacingDirection, 1);
- screenLayers[regobj.depth - 1] = NULL;
- g_engine->_graphics->restoreBackground();
+ animatePickup1(_charFacingDirection, 1);
+ _screenLayers[_curObject.depth - 1] = NULL;
+ _graphics->restoreBackground();
assembleScreen();
- g_engine->_graphics->drawScreen(sceneBackground);
- animatePickup2(charFacingDirection, 1);
+ _graphics->drawScreen(sceneBackground);
+ animatePickup2(_charFacingDirection, 1);
}
}
} break;
case 2: { // Pick up feet level
- switch (regobj.code) {
+ switch (_curObject.code) {
case 216: { // chisel
animatePickup1(0, 2);
- currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[mouseX][mouseY]]->fileIndex = regobj.replaceWith;
+ _currentRoomData->screenObjectIndex[_currentRoomData->mouseGrid[correctedMouseX][correctedMouseY]]->fileIndex = _curObject.replaceWith;
updateVideo();
animatePickup2(0, 2);
} break;
case 295: { // candles
animatePickup1(3, 2);
- currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[mouseX][mouseY]]->fileIndex = regobj.replaceWith;
+ _currentRoomData->screenObjectIndex[_currentRoomData->mouseGrid[correctedMouseX][correctedMouseY]]->fileIndex = _curObject.replaceWith;
updateVideo();
animatePickup2(3, 2);
} break;
@@ -1910,9 +1813,9 @@ void pickupScreenObject() {
} break;
case 659: { // spider web, puts bird and ring on the floor
animatePickup1(3, 2);
- screenLayers[regobj.depth - 1] = NULL;
+ _screenLayers[_curObject.depth - 1] = NULL;
{ // bird
- RoomBitmapRegister &with = currentRoomData->screenLayers[2];
+ RoomBitmapRegister &with = _currentRoomData->screenLayers[2];
with.bitmapPointer = 1545924;
with.bitmapSize = 172;
@@ -1922,7 +1825,7 @@ void pickupScreenObject() {
loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
{ // ring
- RoomBitmapRegister &with = currentRoomData->screenLayers[1];
+ RoomBitmapRegister &with = _currentRoomData->screenLayers[1];
with.bitmapPointer = 1591272;
with.bitmapSize = 92;
@@ -1931,78 +1834,78 @@ void pickupScreenObject() {
with.depth = 3;
loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
- g_engine->_graphics->restoreBackground();
+ _graphics->restoreBackground();
assembleScreen();
- g_engine->_graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(sceneBackground);
animatePickup2(3, 2);
} break;
default: {
- animatePickup1(charFacingDirection, 2);
- screenLayers[regobj.depth - 1] = NULL;
+ animatePickup1(_charFacingDirection, 2);
+ _screenLayers[_curObject.depth - 1] = NULL;
assembleScreen();
- g_engine->_graphics->drawScreen(sceneBackground);
- animatePickup2(charFacingDirection, 2);
+ _graphics->drawScreen(sceneBackground);
+ animatePickup2(_charFacingDirection, 2);
}
}
} break;
case 9: { // bat
- foo = regobj.pickTextRef;
+ uint textRef = _curObject.pickTextRef;
readItemRegister(204);
animatePickup1(0, 1);
animateOpen2(0, 1);
animateBat();
- g_engine->_mouseManager->show();
- drawText(foo);
- currentRoomData->mouseGrid[34][8] = 24;
- actionCode = 0;
+ _mouse->show();
+ drawText(textRef);
+ _currentRoomData->mouseGrid[34][8] = 24;
+ _actionCode = 0;
oldGridX = 0;
oldGridY = 0;
checkMouseGrid();
return;
} break;
}
- g_engine->_mouseManager->show();
+ _mouse->show();
- if (regobj.code != 624)
- for (int j = regobj.ygrid1; j <= regobj.ygrid2; j++)
- for (int i = regobj.xgrid1; i <= regobj.xgrid2; i++) {
- currentRoomData->walkAreasGrid[i][j] = regobj.walkAreasPatch[i - regobj.xgrid1][j - regobj.ygrid1];
- currentRoomData->mouseGrid[i][j] = regobj.mouseGridPatch[i - regobj.xgrid1][j - regobj.ygrid1];
+ if (_curObject.code != 624)
+ for (int j = _curObject.ygrid1; j <= _curObject.ygrid2; j++)
+ for (int i = _curObject.xgrid1; i <= _curObject.xgrid2; i++) {
+ _currentRoomData->walkAreasGrid[i][j] = _curObject.walkAreasPatch[i - _curObject.xgrid1][j - _curObject.ygrid1];
+ _currentRoomData->mouseGrid[i][j] = _curObject.mouseGridPatch[i - _curObject.xgrid1][j - _curObject.ygrid1];
}
- switch (regobj.code) {
+ switch (_curObject.code) {
case 216: { // chisel
- currentRoomData->screenLayers[5].bitmapPointer = 517485;
- currentRoomData->screenLayers[5].bitmapSize = 964;
- currentRoomData->screenLayers[5].coordx = 223;
- currentRoomData->screenLayers[5].coordy = 34;
- currentRoomData->screenLayers[5].depth = 1;
+ _currentRoomData->screenLayers[5].bitmapPointer = 517485;
+ _currentRoomData->screenLayers[5].bitmapSize = 964;
+ _currentRoomData->screenLayers[5].coordx = 223;
+ _currentRoomData->screenLayers[5].coordy = 34;
+ _currentRoomData->screenLayers[5].depth = 1;
} break;
case 218:; // necronomicon
break;
case 223: { // table cloth
- currentRoomData->screenLayers[6].bitmapPointer = 436752;
- currentRoomData->screenLayers[6].bitmapSize = 1372;
- currentRoomData->screenLayers[6].coordx = 174;
- currentRoomData->screenLayers[6].coordy = 32;
- currentRoomData->screenLayers[6].depth = 1;
+ _currentRoomData->screenLayers[6].bitmapPointer = 436752;
+ _currentRoomData->screenLayers[6].bitmapSize = 1372;
+ _currentRoomData->screenLayers[6].coordx = 174;
+ _currentRoomData->screenLayers[6].coordy = 32;
+ _currentRoomData->screenLayers[6].depth = 1;
} break;
case 295: { // candles
- currentRoomData->screenLayers[3].bitmapPointer = 1130756;
- currentRoomData->screenLayers[3].bitmapSize = 1764;
- currentRoomData->screenLayers[3].coordx = 100;
- currentRoomData->screenLayers[3].coordy = 28;
- currentRoomData->screenLayers[3].depth = 1;
+ _currentRoomData->screenLayers[3].bitmapPointer = 1130756;
+ _currentRoomData->screenLayers[3].bitmapSize = 1764;
+ _currentRoomData->screenLayers[3].coordx = 100;
+ _currentRoomData->screenLayers[3].coordy = 28;
+ _currentRoomData->screenLayers[3].depth = 1;
} break;
case 308:; // mistletoe
break;
case 362:; // charcoal
break;
case 402: {
- currentRoomData->screenLayers[5].bitmapPointer = 68130;
- currentRoomData->screenLayers[5].bitmapSize = 2564;
- currentRoomData->screenLayers[5].coordx = 148;
- currentRoomData->screenLayers[5].coordy = 49;
- currentRoomData->screenLayers[5].depth = 7;
+ _currentRoomData->screenLayers[5].bitmapPointer = 68130;
+ _currentRoomData->screenLayers[5].bitmapSize = 2564;
+ _currentRoomData->screenLayers[5].coordx = 148;
+ _currentRoomData->screenLayers[5].coordy = 49;
+ _currentRoomData->screenLayers[5].depth = 7;
} break;
case 479:; // scissors
break;
@@ -2016,20 +1919,20 @@ void pickupScreenObject() {
break;
default: {
for (int i = 0; i < 15; i++)
- if (currentRoomData->screenLayers[i].bitmapPointer ==
- regobj.bitmapPointer) {
- currentRoomData->screenLayers[i].bitmapPointer = 0;
- currentRoomData->screenLayers[i].bitmapSize = 0;
- currentRoomData->screenLayers[i].coordx = 0;
- currentRoomData->screenLayers[i].coordy = 0;
- currentRoomData->screenLayers[i].depth = 0;
+ if (_currentRoomData->screenLayers[i].bitmapPointer ==
+ _curObject.bitmapPointer) {
+ _currentRoomData->screenLayers[i].bitmapPointer = 0;
+ _currentRoomData->screenLayers[i].bitmapSize = 0;
+ _currentRoomData->screenLayers[i].coordx = 0;
+ _currentRoomData->screenLayers[i].coordy = 0;
+ _currentRoomData->screenLayers[i].depth = 0;
}
}
}
} else {
- if (regobj.pickTextRef > 0)
- drawText(regobj.pickTextRef);
- actionCode = 0;
+ if (_curObject.pickTextRef > 0)
+ drawText(_curObject.pickTextRef);
+ _actionCode = 0;
oldGridX = 0;
oldGridY = 0;
checkMouseGrid();
@@ -2037,43 +1940,43 @@ void pickupScreenObject() {
}
inventoryIndex = 0;
- while (inventory[inventoryIndex].code != 0) {
+ while (_inventory[inventoryIndex].code != 0) {
inventoryIndex += 1;
}
- inventory[inventoryIndex].bitmapIndex = regobj.objectIconBitmap;
- inventory[inventoryIndex].code = regobj.code;
- inventory[inventoryIndex].objectName = regobj.name;
- g_engine->_mouseManager->hide();
+ _inventory[inventoryIndex].bitmapIndex = _curObject.objectIconBitmap;
+ _inventory[inventoryIndex].code = _curObject.code;
+ _inventory[inventoryIndex].objectName = _curObject.name;
+ _mouse->hide();
drawBackpack();
- g_engine->_mouseManager->show();
- if (regobj.pickTextRef > 0)
- drawText(regobj.pickTextRef);
- actionCode = 0;
+ _mouse->show();
+ if (_curObject.pickTextRef > 0)
+ drawText(_curObject.pickTextRef);
+ _actionCode = 0;
oldGridX = 0;
oldGridY = 0;
checkMouseGrid();
}
-void replaceBackpack(byte obj1, uint obj2) {
+void TotEngine::replaceBackpack(byte obj1, uint obj2) {
readItemRegister(obj2);
- inventory[obj1].bitmapIndex = regobj.objectIconBitmap;
- inventory[obj1].code = obj2;
- inventory[obj1].objectName = regobj.name;
- cpCounter = cpCounter2;
+ _inventory[obj1].bitmapIndex = _curObject.objectIconBitmap;
+ _inventory[obj1].code = obj2;
+ _inventory[obj1].objectName = _curObject.name;
+ _cpCounter = _cpCounter2;
}
-void dropObjectInScreen(ScreenObject replacementObject) {
+void TotEngine::dropObjectInScreen(ScreenObject replacementObject) {
byte objIndex;
if (replacementObject.bitmapSize > 0) {
objIndex = 0;
- while (!(currentRoomData->screenLayers[objIndex].bitmapSize == 0) || objIndex == 15) {
+ while (!(_currentRoomData->screenLayers[objIndex].bitmapSize == 0) || objIndex == 15) {
objIndex++;
}
- if (currentRoomData->screenLayers[objIndex].bitmapSize == 0) {
+ if (_currentRoomData->screenLayers[objIndex].bitmapSize == 0) {
{
- RoomBitmapRegister &with = currentRoomData->screenLayers[objIndex];
+ RoomBitmapRegister &with = _currentRoomData->screenLayers[objIndex];
with.bitmapPointer = replacementObject.bitmapPointer;
with.bitmapSize = replacementObject.bitmapSize;
@@ -2084,281 +1987,282 @@ void dropObjectInScreen(ScreenObject replacementObject) {
}
for (int j = replacementObject.ygrid1; j <= replacementObject.ygrid2; j++)
for (int i = replacementObject.xgrid1; i <= replacementObject.xgrid2; i++) {
- currentRoomData->walkAreasGrid[i][j] = replacementObject.walkAreasPatch[i - replacementObject.xgrid1][j - replacementObject.ygrid1];
- currentRoomData->mouseGrid[i][j] = replacementObject.mouseGridPatch[i - replacementObject.xgrid1][j - replacementObject.ygrid1];
+ _currentRoomData->walkAreasGrid[i][j] = replacementObject.walkAreasPatch[i - replacementObject.xgrid1][j - replacementObject.ygrid1];
+ _currentRoomData->mouseGrid[i][j] = replacementObject.mouseGridPatch[i - replacementObject.xgrid1][j - replacementObject.ygrid1];
}
} else
showError(264);
}
}
-void useScreenObject() {
+void TotEngine::useScreenObject() {
byte usedObjectIndex,
listIndex, invIndex;
bool verifyList, foobar;
+ uint foo;
+ Common::Point p = _mouse->getClickCoordsWithinGrid();
+ uint correctedMouseX = p.x;
+ uint correctedMouseY = p.y;
+ uint sceneObject = _currentRoomData->screenObjectIndex[_currentRoomData->mouseGrid[correctedMouseX][correctedMouseY]]->fileIndex;
- uint mouseX = (mouseClickX + 7) / xGridCount;
- uint mouseY = (mouseClickY + 7) / yGridCount;
- uint sceneObject = currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[mouseX][mouseY]]->fileIndex;
-
- if (inventoryObjectName != "") { //Use inv object with something on the scene
+ if (_inventoryObjectName != "") { //Use inv object with something on the scene
usedObjectIndex = 0;
- while (inventory[usedObjectIndex].objectName != inventoryObjectName) {
+ while (_inventory[usedObjectIndex].objectName != _inventoryObjectName) {
usedObjectIndex += 1;
}
- readItemRegister(inventory[usedObjectIndex].code);
+ readItemRegister(_inventory[usedObjectIndex].code);
goToObject(
- currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount],
- currentRoomData->walkAreasGrid[mouseX][mouseY]);
+ _currentRoomData->walkAreasGrid[(_characterPosX + kCharacterCorrectionX) / kXGridCount][(_characterPosY + kCharacerCorrectionY) / kYGridCount],
+ _currentRoomData->walkAreasGrid[correctedMouseX][correctedMouseY]);
- if (regobj.useWith == sceneObject && sceneObject > 0 && regobj.used[0] == 5) {
- switch (regobj.useWith) {
+ if (_curObject.useWith == sceneObject && sceneObject > 0 && _curObject.used[0] == 5) {
+ switch (_curObject.useWith) {
case 30: { // corn with rooster
- drawText(regobj.useTextRef);
- g_engine->_mouseManager->hide();
+ drawText(_curObject.useTextRef);
+ _mouse->hide();
animateGive(1, 2);
animatePickup2(1, 2);
- updateItem(regobj.code);
- currentRoomData->screenObjectIndex[27]->fileIndex = 201;
+ updateItem(_curObject.code);
+ _currentRoomData->screenObjectIndex[27]->fileIndex = 201;
do {
- g_engine->_chrono->updateChrono();
- if (iframe2 >= secondaryAnimationFrameCount - 1)
- iframe2 = 0;
+ _chrono->updateChrono();
+ if (_iframe2 >= _secondaryAnimationFrameCount - 1)
+ _iframe2 = 0;
else
- iframe2++;
- if (currentSecondaryTrajectoryIndex >= currentRoomData->secondaryTrajectoryLength)
- currentSecondaryTrajectoryIndex = 1;
+ _iframe2++;
+ if (_currentSecondaryTrajectoryIndex >= _currentRoomData->secondaryTrajectoryLength)
+ _currentSecondaryTrajectoryIndex = 1;
else
- currentSecondaryTrajectoryIndex += 1;
- secondaryAnimation.dir = currentRoomData->secondaryAnimDirections[currentSecondaryTrajectoryIndex - 1];
- secondaryAnimation.posx = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].x;
- secondaryAnimation.posy = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].y;
+ _currentSecondaryTrajectoryIndex += 1;
+ _secondaryAnimation.dir = _currentRoomData->secondaryAnimDirections[_currentSecondaryTrajectoryIndex - 1];
+ _secondaryAnimation.posx = _currentRoomData->secondaryAnimTrajectory[_currentSecondaryTrajectoryIndex - 1].x;
+ _secondaryAnimation.posy = _currentRoomData->secondaryAnimTrajectory[_currentSecondaryTrajectoryIndex - 1].y;
emptyLoop();
gameTick = false;
emptyLoop2();
sprites(true);
- g_engine->_screen->update();
- } while (currentSecondaryTrajectoryIndex != 4);
+ _screen->update();
+ } while (_currentSecondaryTrajectoryIndex != 4);
- for (listIndex = 0; listIndex < maxXGrid; listIndex++)
- for (invIndex = 0; invIndex < maxYGrid; invIndex++) {
- currentRoomData->walkAreasGrid[oldposx + listIndex][oldposy + invIndex] = movementGridForSecondaryAnim[listIndex][invIndex];
- currentRoomData->mouseGrid[oldposx + listIndex][oldposy + invIndex] = mouseGridForSecondaryAnim[listIndex][invIndex];
+ for (listIndex = 0; listIndex < _maxXGrid; listIndex++)
+ for (invIndex = 0; invIndex < _maxYGrid; invIndex++) {
+ _currentRoomData->walkAreasGrid[_oldposx + listIndex][_oldposy + invIndex] = _movementGridForSecondaryAnim[listIndex][invIndex];
+ _currentRoomData->mouseGrid[_oldposx + listIndex][_oldposy + invIndex] = _mouseGridForSecondaryAnim[listIndex][invIndex];
}
freeAnimation();
- secondaryAnimation.posx = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].x + 8;
- secondaryAnimation.posy = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].y;
- currentRoomData->animationName = "GALLOPIC";
- currentRoomData->secondaryAnimDirections[299] = 201;
+ _secondaryAnimation.posx = _currentRoomData->secondaryAnimTrajectory[_currentSecondaryTrajectoryIndex - 1].x + 8;
+ _secondaryAnimation.posy = _currentRoomData->secondaryAnimTrajectory[_currentSecondaryTrajectoryIndex - 1].y;
+ _currentRoomData->animationName = "GALLOPIC";
+ _currentRoomData->secondaryAnimDirections[299] = 201;
loadAnimation("GALLOPIC");
- currentRoomData->secondaryAnimDirections[0] = 0;
- currentRoomData->secondaryAnimTrajectory[0].x = secondaryAnimation.posx;
- currentRoomData->secondaryAnimTrajectory[0].y = secondaryAnimation.posy;
- currentSecondaryTrajectoryIndex = 1;
- currentRoomData->secondaryTrajectoryLength = 1;
-
- for (listIndex = 0; listIndex < maxXGrid; listIndex++)
- for (invIndex = 0; invIndex < maxYGrid; invIndex++) {
- if (maskGridSecondaryAnim[listIndex][invIndex] > 0)
- currentRoomData->walkAreasGrid[oldposx + listIndex][oldposy + invIndex] = maskGridSecondaryAnim[listIndex][invIndex];
- if (maskMouseSecondaryAnim[listIndex][invIndex] > 0)
- currentRoomData->mouseGrid[oldposx + listIndex][oldposy + invIndex] = maskMouseSecondaryAnim[listIndex][invIndex];
+ _currentRoomData->secondaryAnimDirections[0] = 0;
+ _currentRoomData->secondaryAnimTrajectory[0].x = _secondaryAnimation.posx;
+ _currentRoomData->secondaryAnimTrajectory[0].y = _secondaryAnimation.posy;
+ _currentSecondaryTrajectoryIndex = 1;
+ _currentRoomData->secondaryTrajectoryLength = 1;
+
+ for (listIndex = 0; listIndex < _maxXGrid; listIndex++)
+ for (invIndex = 0; invIndex < _maxYGrid; invIndex++) {
+ if (_maskGridSecondaryAnim[listIndex][invIndex] > 0)
+ _currentRoomData->walkAreasGrid[_oldposx + listIndex][_oldposy + invIndex] = _maskGridSecondaryAnim[listIndex][invIndex];
+ if (_maskMouseSecondaryAnim[listIndex][invIndex] > 0)
+ _currentRoomData->mouseGrid[_oldposx + listIndex][_oldposy + invIndex] = _maskMouseSecondaryAnim[listIndex][invIndex];
}
- g_engine->_mouseManager->show();
+ _mouse->show();
} break;
case 153: { // oil with well
- drawText(regobj.useTextRef);
- g_engine->_mouseManager->hide();
- g_engine->_sound->playVoc("BLUP", 330921, 3858);
+ drawText(_curObject.useTextRef);
+ _mouse->hide();
+ _sound->playVoc("BLUP", 330921, 3858);
animateGive(3, 1);
animatePickup2(3, 1);
- g_engine->_mouseManager->show();
- updateItem(regobj.code);
- currentRoomData->screenObjectIndex[21]->fileIndex = 154;
+ _mouse->show();
+ updateItem(_curObject.code);
+ _currentRoomData->screenObjectIndex[21]->fileIndex = 154;
} break;
case 157: { // giving something to john
verifyList = false;
- debug("used object = %d", inventory[usedObjectIndex].code);
- if (obtainedList1) {
+ debug("used object = %d", _inventory[usedObjectIndex].code);
+ if (_obtainedList1) {
for (listIndex = 0; listIndex < 5; listIndex++) {
- if (inventory[usedObjectIndex].code == firstList[listIndex])
+ if (_inventory[usedObjectIndex].code == _firstList[listIndex])
verifyList = true;
}
if (verifyList) {
int completedListItems = 0;
for (listIndex = 0; listIndex < 5; listIndex++) {
- for (invIndex = 0; invIndex < inventoryIconCount; invIndex++) {
- if (inventory[invIndex].code == firstList[listIndex]) {
+ for (invIndex = 0; invIndex < kInventoryIconCount; invIndex++) {
+ if (_inventory[invIndex].code == _firstList[listIndex]) {
completedListItems += 1;
break;
}
}
}
if (completedListItems == 5) {
- obtainedList1 = false;
- list1Complete = true;
+ _obtainedList1 = false;
+ _list1Complete = true;
assignText();
- hypertext(1018, 255, 0, foo, false);
- hypertext(foo, 253, 249, foo, true);
- verb.close();
+ sayLine(1018, 255, 0, foo, false);
+ sayLine(foo, 253, 249, foo, true);
+ _verbFile.close();
- g_engine->_mouseManager->hide();
- animateGive(charFacingDirection, 1);
- animateOpen2(charFacingDirection, 1);
+ _mouse->hide();
+ animateGive(_charFacingDirection, 1);
+ animateOpen2(_charFacingDirection, 1);
for (listIndex = 0; listIndex < 5; listIndex++) {
invIndex = 0;
- while (inventory[invIndex].code != firstList[listIndex]) {
+ while (_inventory[invIndex].code != _firstList[listIndex]) {
invIndex += 1;
}
updateInventory(invIndex);
}
listIndex = 0;
- while (inventory[listIndex].code != 149) {
+ while (_inventory[listIndex].code != 149) {
listIndex += 1;
}
updateInventory(listIndex);
drawBackpack();
- g_engine->_mouseManager->show();
+ _mouse->show();
} else {
assignText();
- hypertext(regobj.useTextRef, 255, 0, foo, false);
- g_engine->_mouseManager->hide();
- animateGive(charFacingDirection, 1);
- animateOpen2(charFacingDirection, 1);
- g_engine->_mouseManager->show();
- hypertext(foo, 253, 249, foo, true);
- verb.close();
+ sayLine(_curObject.useTextRef, 255, 0, foo, false);
+ _mouse->hide();
+ animateGive(_charFacingDirection, 1);
+ animateOpen2(_charFacingDirection, 1);
+ _mouse->show();
+ sayLine(foo, 253, 249, foo, true);
+ _verbFile.close();
}
}
}
verifyList = false;
- if (obtainedList2) {
+ if (_obtainedList2) {
for (listIndex = 0; listIndex < 5; listIndex++)
- if (inventory[usedObjectIndex].code == secondList[listIndex])
+ if (_inventory[usedObjectIndex].code == _secondList[listIndex])
verifyList = true;
if (verifyList) {
int completedListItems = 0;
for (listIndex = 0; listIndex < 5; listIndex++) {
- for (invIndex = 0; invIndex <= inventoryIconCount; invIndex++) {
- if (inventory[invIndex].code == secondList[listIndex]) {
+ for (invIndex = 0; invIndex <= kInventoryIconCount; invIndex++) {
+ if (_inventory[invIndex].code == _secondList[listIndex]) {
completedListItems += 1;
break;
}
}
}
if (completedListItems == 5) {
- obtainedList2 = false;
- list2Complete = true;
+ _obtainedList2 = false;
+ _list2Complete = true;
assignText();
- hypertext(1020, 255, 0, foo, false);
- hypertext(foo, 253, 249, foo, true);
- verb.close();
- g_engine->_mouseManager->hide();
- animateGive(charFacingDirection, 1);
- animateOpen2(charFacingDirection, 1);
+ sayLine(1020, 255, 0, foo, false);
+ sayLine(foo, 253, 249, foo, true);
+ _verbFile.close();
+ _mouse->hide();
+ animateGive(_charFacingDirection, 1);
+ animateOpen2(_charFacingDirection, 1);
for (listIndex = 0; listIndex < 5; listIndex++) {
invIndex = 0;
- while (inventory[invIndex].code != secondList[listIndex]) {
+ while (_inventory[invIndex].code != _secondList[listIndex]) {
invIndex += 1;
}
updateInventory(invIndex);
}
listIndex = 0;
- while (inventory[listIndex].code != 150) {
+ while (_inventory[listIndex].code != 150) {
listIndex += 1;
}
updateInventory(listIndex);
drawBackpack();
- g_engine->_mouseManager->show();
+ _mouse->show();
} else {
assignText();
- hypertext(regobj.useTextRef, 255, 0, foo, false);
- g_engine->_mouseManager->hide();
- animateGive(charFacingDirection, 1);
- animateOpen2(charFacingDirection, 1);
- g_engine->_mouseManager->show();
- hypertext(foo, 253, 249, foo, true);
- verb.close();
+ sayLine(_curObject.useTextRef, 255, 0, foo, false);
+ _mouse->hide();
+ animateGive(_charFacingDirection, 1);
+ animateOpen2(_charFacingDirection, 1);
+ _mouse->show();
+ sayLine(foo, 253, 249, foo, true);
+ _verbFile.close();
}
}
}
} break;
case 159: {
- switch (regobj.code) {
+ switch (_curObject.code) {
case 173: {
assignText();
- hypertext(1118, 255, 0, foo, false);
- g_engine->_mouseManager->hide();
- animateGive(charFacingDirection, 1);
- animateOpen2(charFacingDirection, 1);
- g_engine->_mouseManager->show();
- hypertext(foo, 253, 249, foo, true);
- verb.close();
+ sayLine(1118, 255, 0, foo, false);
+ _mouse->hide();
+ animateGive(_charFacingDirection, 1);
+ animateOpen2(_charFacingDirection, 1);
+ _mouse->show();
+ sayLine(foo, 253, 249, foo, true);
+ _verbFile.close();
} break;
case 218: {
assignText();
- hypertext(687, 255, 0, foo, false);
- g_engine->_mouseManager->hide();
- animateGive(charFacingDirection, 1);
- animateOpen2(charFacingDirection, 1);
- g_engine->_mouseManager->show();
- hypertext(foo, 253, 249, foo, true);
- verb.close();
- g_engine->_mouseManager->hide();
+ sayLine(687, 255, 0, foo, false);
+ _mouse->hide();
+ animateGive(_charFacingDirection, 1);
+ animateOpen2(_charFacingDirection, 1);
+ _mouse->show();
+ sayLine(foo, 253, 249, foo, true);
+ _verbFile.close();
+ _mouse->hide();
updateInventory(usedObjectIndex);
drawBackpack();
- g_engine->_mouseManager->show();
- for (foo = 0; foo < characterCount; foo++)
- bookTopic[foo] = true;
- firstTimeTopicB[0] = true;
+ _mouse->show();
+ for (foo = 0; foo < kCharacterCount; foo++)
+ _bookTopic[foo] = true;
+ _firstTimeTopicB[0] = true;
} break;
}
} break;
case 160: {
assignText();
- hypertext(2466, 255, 0, foo, false);
- g_engine->_mouseManager->hide();
- animateGive(charFacingDirection, 1);
- animateOpen2(charFacingDirection, 1);
- g_engine->_mouseManager->show();
- hypertext(foo, 253, 249, foo, true);
- verb.close();
- g_engine->_mouseManager->hide();
+ sayLine(2466, 255, 0, foo, false);
+ _mouse->hide();
+ animateGive(_charFacingDirection, 1);
+ animateOpen2(_charFacingDirection, 1);
+ _mouse->show();
+ sayLine(foo, 253, 249, foo, true);
+ _verbFile.close();
+ _mouse->hide();
updateInventory(usedObjectIndex);
drawBackpack();
- g_engine->_mouseManager->show();
- for (foo = 0; foo < characterCount; foo++) {
- mintTopic[foo] = true;
- firstTimeTopicC[foo] = true;
+ _mouse->show();
+ for (foo = 0; foo < kCharacterCount; foo++) {
+ _mintTopic[foo] = true;
+ _firstTimeTopicC[foo] = true;
}
} break;
case 164: {
- switch (regobj.code) {
+ switch (_curObject.code) {
case 563: {
- isPottersManualDelivered = true;
- if (isPottersWheelDelivered && isGreenDevilDelivered && isMudDelivered) {
+ _isPottersManualDelivered = true;
+ if (_isPottersWheelDelivered && _isGreenDevilDelivered && _isMudDelivered) {
assignText();
- hypertext(2696, 255, 0, foo, false);
- g_engine->_mouseManager->hide();
+ sayLine(2696, 255, 0, foo, false);
+ _mouse->hide();
animateGive(0, 1);
animateOpen2(0, 1);
- g_engine->_mouseManager->show();
- hypertext(foo, 253, 249, foo, true);
- caves[4] = true;
- hypertext(3247, 253, 249, foo, true);
- verb.close();
- g_engine->_mouseManager->hide();
+ _mouse->show();
+ sayLine(foo, 253, 249, foo, true);
+ _caves[4] = true;
+ sayLine(3247, 253, 249, foo, true);
+ _verbFile.close();
+ _mouse->hide();
replaceBackpack(usedObjectIndex, 676);
drawBackpack();
disableSecondAnimation();
{
- RoomBitmapRegister &with = currentRoomData->screenLayers[0];
+ RoomBitmapRegister &with = _currentRoomData->screenLayers[0];
with.bitmapPointer = 1545820;
with.bitmapSize = 104;
@@ -2367,43 +2271,43 @@ void useScreenObject() {
with.depth = 1;
loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
- currentRoomData->mouseGrid[15][12] = 7;
- g_engine->_mouseManager->show();
+ _currentRoomData->mouseGrid[15][12] = 7;
+ _mouse->show();
} else {
assignText();
- hypertext(2696, 255, 0, foo, false);
- g_engine->_mouseManager->hide();
+ sayLine(2696, 255, 0, foo, false);
+ _mouse->hide();
animateGive(0, 1);
animateOpen2(0, 1);
- g_engine->_mouseManager->show();
- hypertext(foo, 253, 249, foo, true);
- hypertext(3246, 253, 249, foo, true);
- verb.close();
- g_engine->_mouseManager->hide();
+ _mouse->show();
+ sayLine(foo, 253, 249, foo, true);
+ sayLine(3246, 253, 249, foo, true);
+ _verbFile.close();
+ _mouse->hide();
updateInventory(usedObjectIndex);
drawBackpack();
- g_engine->_mouseManager->show();
+ _mouse->show();
}
} break;
case 598: {
- isMudDelivered = true;
- if (isPottersWheelDelivered && isGreenDevilDelivered && isPottersManualDelivered) {
+ _isMudDelivered = true;
+ if (_isPottersWheelDelivered && _isGreenDevilDelivered && _isPottersManualDelivered) {
assignText();
- hypertext(2821, 255, 0, foo, false);
- g_engine->_mouseManager->hide();
+ sayLine(2821, 255, 0, foo, false);
+ _mouse->hide();
animateGive(0, 1);
animatePickup2(0, 1);
- g_engine->_mouseManager->show();
- hypertext(foo, 253, 249, foo, true);
- caves[4] = true;
- hypertext(3247, 253, 249, foo, true);
- verb.close();
- g_engine->_mouseManager->hide();
+ _mouse->show();
+ sayLine(foo, 253, 249, foo, true);
+ _caves[4] = true;
+ sayLine(3247, 253, 249, foo, true);
+ _verbFile.close();
+ _mouse->hide();
replaceBackpack(usedObjectIndex, 676);
drawBackpack();
disableSecondAnimation();
{
- RoomBitmapRegister &with = currentRoomData->screenLayers[0];
+ RoomBitmapRegister &with = _currentRoomData->screenLayers[0];
with.bitmapPointer = 1545820;
with.bitmapSize = 104;
@@ -2412,43 +2316,43 @@ void useScreenObject() {
with.depth = 1;
loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
- currentRoomData->mouseGrid[15][12] = 7;
- g_engine->_mouseManager->show();
+ _currentRoomData->mouseGrid[15][12] = 7;
+ _mouse->show();
} else {
assignText();
- hypertext(2821, 255, 0, foo, false);
- g_engine->_mouseManager->hide();
+ sayLine(2821, 255, 0, foo, false);
+ _mouse->hide();
animateGive(0, 1);
animateOpen2(0, 1);
- g_engine->_mouseManager->show();
- hypertext(foo, 253, 249, foo, true);
- hypertext(3246, 253, 249, foo, true);
- verb.close();
- g_engine->_mouseManager->hide();
+ _mouse->show();
+ sayLine(foo, 253, 249, foo, true);
+ sayLine(3246, 253, 249, foo, true);
+ _verbFile.close();
+ _mouse->hide();
updateInventory(usedObjectIndex);
drawBackpack();
- g_engine->_mouseManager->show();
+ _mouse->show();
}
} break;
case 623: {
- isPottersWheelDelivered = true;
- if (isMudDelivered && isGreenDevilDelivered && isPottersManualDelivered) {
+ _isPottersWheelDelivered = true;
+ if (_isMudDelivered && _isGreenDevilDelivered && _isPottersManualDelivered) {
assignText();
- hypertext(2906, 255, 0, foo, false);
- g_engine->_mouseManager->hide();
+ sayLine(2906, 255, 0, foo, false);
+ _mouse->hide();
animateGive(0, 1);
animatePickup2(0, 1);
- g_engine->_mouseManager->show();
- hypertext(foo, 253, 249, foo, true);
- caves[4] = true;
- hypertext(3247, 253, 249, foo, true);
- verb.close();
- g_engine->_mouseManager->hide();
+ _mouse->show();
+ sayLine(foo, 253, 249, foo, true);
+ _caves[4] = true;
+ sayLine(3247, 253, 249, foo, true);
+ _verbFile.close();
+ _mouse->hide();
replaceBackpack(usedObjectIndex, 676);
drawBackpack();
disableSecondAnimation();
{
- RoomBitmapRegister &with = currentRoomData->screenLayers[0];
+ RoomBitmapRegister &with = _currentRoomData->screenLayers[0];
with.bitmapPointer = 1545820;
with.bitmapSize = 104;
@@ -2457,43 +2361,43 @@ void useScreenObject() {
with.depth = 1;
loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
- currentRoomData->mouseGrid[15][12] = 7;
- g_engine->_mouseManager->show();
+ _currentRoomData->mouseGrid[15][12] = 7;
+ _mouse->show();
} else {
assignText();
- hypertext(2906, 255, 0, foo, false);
- g_engine->_mouseManager->hide();
+ sayLine(2906, 255, 0, foo, false);
+ _mouse->hide();
animateGive(0, 1);
animateOpen2(0, 1);
- g_engine->_mouseManager->show();
- hypertext(foo, 253, 249, foo, true);
- hypertext(3246, 253, 249, foo, true);
- verb.close();
- g_engine->_mouseManager->hide();
+ _mouse->show();
+ sayLine(foo, 253, 249, foo, true);
+ sayLine(3246, 253, 249, foo, true);
+ _verbFile.close();
+ _mouse->hide();
updateInventory(usedObjectIndex);
drawBackpack();
- g_engine->_mouseManager->show();
+ _mouse->show();
}
} break;
case 701: {
- isGreenDevilDelivered = true;
- if (isMudDelivered && isPottersWheelDelivered && isPottersManualDelivered) {
+ _isGreenDevilDelivered = true;
+ if (_isMudDelivered && _isPottersWheelDelivered && _isPottersManualDelivered) {
assignText();
- hypertext(3188, 255, 0, foo, false);
- g_engine->_mouseManager->hide();
+ sayLine(3188, 255, 0, foo, false);
+ _mouse->hide();
animateGive(0, 1);
animatePickup2(0, 1);
- g_engine->_mouseManager->show();
- hypertext(foo, 253, 249, foo, true);
- caves[4] = true;
- hypertext(3247, 253, 249, foo, true);
- verb.close();
- g_engine->_mouseManager->hide();
+ _mouse->show();
+ sayLine(foo, 253, 249, foo, true);
+ _caves[4] = true;
+ sayLine(3247, 253, 249, foo, true);
+ _verbFile.close();
+ _mouse->hide();
replaceBackpack(usedObjectIndex, 676);
drawBackpack();
disableSecondAnimation();
{
- RoomBitmapRegister &with = currentRoomData->screenLayers[0];
+ RoomBitmapRegister &with = _currentRoomData->screenLayers[0];
with.bitmapPointer = 1545820;
with.bitmapSize = 104;
@@ -2502,46 +2406,46 @@ void useScreenObject() {
with.depth = 1;
loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
- currentRoomData->mouseGrid[15][12] = 7;
- g_engine->_mouseManager->show();
+ _currentRoomData->mouseGrid[15][12] = 7;
+ _mouse->show();
} else {
assignText();
- hypertext(3188, 255, 0, foo, false);
- g_engine->_mouseManager->hide();
+ sayLine(3188, 255, 0, foo, false);
+ _mouse->hide();
animateGive(0, 1);
animateOpen2(0, 1);
- g_engine->_mouseManager->show();
- hypertext(foo, 253, 249, foo, true);
- hypertext(3246, 253, 249, foo, true);
- verb.close();
- g_engine->_mouseManager->hide();
+ _mouse->show();
+ sayLine(foo, 253, 249, foo, true);
+ sayLine(3246, 253, 249, foo, true);
+ _verbFile.close();
+ _mouse->hide();
updateInventory(usedObjectIndex);
drawBackpack();
- g_engine->_mouseManager->show();
+ _mouse->show();
}
} break;
}
} break;
case 165: {
drawText(1098);
- g_engine->_mouseManager->hide();
+ _mouse->hide();
do {
- if (iframe2 >= secondaryAnimationFrameCount - 1)
- iframe2 = 0;
+ if (_iframe2 >= _secondaryAnimationFrameCount - 1)
+ _iframe2 = 0;
else
- iframe2++;
- if (currentSecondaryTrajectoryIndex >= currentRoomData->secondaryTrajectoryLength)
- currentSecondaryTrajectoryIndex = 1;
+ _iframe2++;
+ if (_currentSecondaryTrajectoryIndex >= _currentRoomData->secondaryTrajectoryLength)
+ _currentSecondaryTrajectoryIndex = 1;
else
- currentSecondaryTrajectoryIndex += 1;
- secondaryAnimation.dir = currentRoomData->secondaryAnimDirections[currentSecondaryTrajectoryIndex - 1];
- secondaryAnimation.posx = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].x;
- secondaryAnimation.posy = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].y;
+ _currentSecondaryTrajectoryIndex += 1;
+ _secondaryAnimation.dir = _currentRoomData->secondaryAnimDirections[_currentSecondaryTrajectoryIndex - 1];
+ _secondaryAnimation.posx = _currentRoomData->secondaryAnimTrajectory[_currentSecondaryTrajectoryIndex - 1].x;
+ _secondaryAnimation.posy = _currentRoomData->secondaryAnimTrajectory[_currentSecondaryTrajectoryIndex - 1].y;
emptyLoop();
gameTick = false;
emptyLoop2();
sprites(true);
- } while (!(currentSecondaryTrajectoryIndex == (currentRoomData->secondaryTrajectoryLength / 2)));
+ } while (!(_currentSecondaryTrajectoryIndex == (_currentRoomData->secondaryTrajectoryLength / 2)));
animateGive(3, 2);
updateInventory(usedObjectIndex);
@@ -2550,275 +2454,267 @@ void useScreenObject() {
animatedSequence(6);
do {
- if (iframe2 >= secondaryAnimationFrameCount - 1)
- iframe2 = 0;
+ if (_iframe2 >= _secondaryAnimationFrameCount - 1)
+ _iframe2 = 0;
else
- iframe2++;
- if (currentSecondaryTrajectoryIndex >= currentRoomData->secondaryTrajectoryLength)
- currentSecondaryTrajectoryIndex = 1;
+ _iframe2++;
+ if (_currentSecondaryTrajectoryIndex >= _currentRoomData->secondaryTrajectoryLength)
+ _currentSecondaryTrajectoryIndex = 1;
else
- currentSecondaryTrajectoryIndex += 1;
- secondaryAnimation.dir = currentRoomData->secondaryAnimDirections[currentSecondaryTrajectoryIndex - 1];
- secondaryAnimation.posx = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].x;
- secondaryAnimation.posy = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].y;
+ _currentSecondaryTrajectoryIndex += 1;
+ _secondaryAnimation.dir = _currentRoomData->secondaryAnimDirections[_currentSecondaryTrajectoryIndex - 1];
+ _secondaryAnimation.posx = _currentRoomData->secondaryAnimTrajectory[_currentSecondaryTrajectoryIndex - 1].x;
+ _secondaryAnimation.posy = _currentRoomData->secondaryAnimTrajectory[_currentSecondaryTrajectoryIndex - 1].y;
emptyLoop();
gameTick = false;
emptyLoop2();
sprites(true);
- } while (currentSecondaryTrajectoryIndex != currentRoomData->secondaryTrajectoryLength);
+ } while (_currentSecondaryTrajectoryIndex != _currentRoomData->secondaryTrajectoryLength);
disableSecondAnimation();
- g_engine->_graphics->drawScreen(sceneBackground);
- g_engine->_mouseManager->show();
+ _graphics->drawScreen(sceneBackground);
+ _mouse->show();
} break;
case 201: {
- drawText(regobj.useTextRef);
- g_engine->_sound->playVoc("GALLO", 94965, 46007);
- g_engine->_mouseManager->hide();
+ drawText(_curObject.useTextRef);
+ _sound->playVoc("GALLO", 94965, 46007);
+ _mouse->hide();
animatedSequence(5);
replaceBackpack(usedObjectIndex, 423);
drawBackpack();
- g_engine->_mouseManager->show();
- actionCode = 0;
+ _mouse->show();
+ _actionCode = 0;
oldGridX = 0;
oldGridY = 0;
checkMouseGrid();
} break;
case 219: {
- drawText(regobj.useTextRef);
- g_engine->_mouseManager->hide();
- g_engine->_sound->playVoc("TAZA", 223698, 29066);
+ drawText(_curObject.useTextRef);
+ _mouse->hide();
+ _sound->playVoc("TAZA", 223698, 29066);
animateGive(3, 2);
do {
- g_engine->_chrono->updateChrono();
+ _chrono->updateChrono();
if (gameTick) {
- if (palAnimStep >= 4) {
- palAnimStep = 0;
- if (isPaletteAnimEnabled > 6)
- isPaletteAnimEnabled = 0;
- else
- isPaletteAnimEnabled += 1;
- g_engine->_graphics->updatePalette(isPaletteAnimEnabled);
- } else
- palAnimStep += 1;
+ _graphics->advancePaletteAnim();
gameTick = false;
}
- g_engine->_screen->update();
+ _screen->update();
g_system->delayMillis(10);
- } while (g_engine->_sound->isVocPlaying());
+ } while (_sound->isVocPlaying());
animateOpen2(3, 2);
- updateItem(regobj.code);
+ updateItem(_curObject.code);
disableSecondAnimation();
- g_engine->_graphics->drawScreen(sceneBackground);
- g_engine->_mouseManager->show();
+ _graphics->drawScreen(sceneBackground);
+ _mouse->show();
drawText(2652);
- g_engine->_mouseManager->hide();
+ _mouse->hide();
readItemRegister(536);
for (int i = 12; i <= 13; i++)
for (int j = 7; j <= 14; j++)
- currentRoomData->mouseGrid[i][j] = 14;
+ _currentRoomData->mouseGrid[i][j] = 14;
for (int i = 8; i <= 12; i++)
- currentRoomData->mouseGrid[14][i] = 14;
- currentRoomData->mouseGrid[9][10] = 1;
- currentRoomData->mouseGrid[10][10] = 1;
+ _currentRoomData->mouseGrid[14][i] = 14;
+ _currentRoomData->mouseGrid[9][10] = 1;
+ _currentRoomData->mouseGrid[10][10] = 1;
for (int i = 0; i < 15; i++)
- if (currentRoomData->screenLayers[i].bitmapPointer ==
- regobj.bitmapPointer) {
- currentRoomData->screenLayers[i].bitmapPointer = 0;
- currentRoomData->screenLayers[i].bitmapSize = 0;
- currentRoomData->screenLayers[i].coordx = 0;
- currentRoomData->screenLayers[i].coordy = 0;
- currentRoomData->screenLayers[i].depth = 0;
+ if (_currentRoomData->screenLayers[i].bitmapPointer ==
+ _curObject.bitmapPointer) {
+ _currentRoomData->screenLayers[i].bitmapPointer = 0;
+ _currentRoomData->screenLayers[i].bitmapSize = 0;
+ _currentRoomData->screenLayers[i].coordx = 0;
+ _currentRoomData->screenLayers[i].coordy = 0;
+ _currentRoomData->screenLayers[i].depth = 0;
}
usedObjectIndex = 0;
- while (inventory[usedObjectIndex].code != 0) {
+ while (_inventory[usedObjectIndex].code != 0) {
usedObjectIndex += 1;
}
- inventory[usedObjectIndex].bitmapIndex = regobj.objectIconBitmap;
- inventory[usedObjectIndex].code = regobj.code;
- inventory[usedObjectIndex].objectName = regobj.name;
+ _inventory[usedObjectIndex].bitmapIndex = _curObject.objectIconBitmap;
+ _inventory[usedObjectIndex].code = _curObject.code;
+ _inventory[usedObjectIndex].objectName = _curObject.name;
animatedSequence(4);
- g_engine->_mouseManager->show();
- actionCode = 0;
+ _mouse->show();
+ _actionCode = 0;
oldGridX = 0;
oldGridY = 0;
checkMouseGrid();
} break;
case 221: {
- drawText(regobj.useTextRef);
- regobj.used[0] = 9;
+ drawText(_curObject.useTextRef);
+ _curObject.used[0] = 9;
usedObjectIndex = 0;
- while (inventory[usedObjectIndex].code != 0) {
+ while (_inventory[usedObjectIndex].code != 0) {
usedObjectIndex += 1;
}
- invItemData->seek(regobj.code);
+ _invItemData->seek(_curObject.code);
- saveItem(regobj, invItemData);
- readItemRegister(invItemData, 221, regobj);
- inventory[usedObjectIndex].bitmapIndex = regobj.objectIconBitmap;
- inventory[usedObjectIndex].code = regobj.code;
- inventory[usedObjectIndex].objectName = regobj.name;
+ saveItem(_curObject, _invItemData);
+ readItemRegister(_invItemData, 221, _curObject);
+ _inventory[usedObjectIndex].bitmapIndex = _curObject.objectIconBitmap;
+ _inventory[usedObjectIndex].code = _curObject.code;
+ _inventory[usedObjectIndex].objectName = _curObject.name;
- g_engine->_mouseManager->hide();
+ _mouse->hide();
animatePickup1(2, 0);
- g_engine->_sound->playVoc("TIJERAS", 252764, 5242);
- g_engine->_sound->waitForSoundEnd();
+ _sound->playVoc("TIJERAS", 252764, 5242);
+ _sound->waitForSoundEnd();
animatePickup2(2, 0);
drawBackpack();
- g_engine->_mouseManager->show();
+ _mouse->show();
} break;
case 227: {
- drawText(regobj.useTextRef);
- g_engine->_mouseManager->hide();
- g_engine->_sound->playVoc("ALACENA", 319112, 11809);
+ drawText(_curObject.useTextRef);
+ _mouse->hide();
+ _sound->playVoc("ALACENA", 319112, 11809);
animatePickup1(0, 2);
- g_engine->_sound->waitForSoundEnd();
+ _sound->waitForSoundEnd();
animateOpen2(0, 2);
replaceBackpack(usedObjectIndex, 453);
drawBackpack();
- g_engine->_mouseManager->show();
- updateItem(inventory[usedObjectIndex].code);
- isCupboardOpen = true;
+ _mouse->show();
+ updateItem(_inventory[usedObjectIndex].code);
+ _isCupboardOpen = true;
} break;
case 274: {
- drawText(regobj.useTextRef);
- g_engine->_mouseManager->hide();
- g_engine->_sound->playVoc("CINCEL", 334779, 19490);
- animatePickup1(charFacingDirection, 2);
- g_engine->_sound->waitForSoundEnd();
- animateOpen2(charFacingDirection, 2);
- g_engine->_mouseManager->show();
- updateItem(regobj.code);
- isChestOpen = true;
+ drawText(_curObject.useTextRef);
+ _mouse->hide();
+ _sound->playVoc("CINCEL", 334779, 19490);
+ animatePickup1(_charFacingDirection, 2);
+ _sound->waitForSoundEnd();
+ animateOpen2(_charFacingDirection, 2);
+ _mouse->show();
+ updateItem(_curObject.code);
+ _isChestOpen = true;
} break;
case 416: {
- updateItem(regobj.code);
- g_engine->_mouseManager->hide();
- g_engine->_sound->playVoc("PUERTA", 186429, 4754);
+ updateItem(_curObject.code);
+ _mouse->hide();
+ _sound->playVoc("PUERTA", 186429, 4754);
animatePickup1(0, 1);
animateOpen2(0, 1);
- g_engine->_sound->loadVoc("GOTA", 140972, 1029);
- g_engine->_mouseManager->show();
- drawText(regobj.useTextRef);
- currentRoomData->doors[2].openclosed = 0;
+ _sound->loadVoc("GOTA", 140972, 1029);
+ _mouse->show();
+ drawText(_curObject.useTextRef);
+ _currentRoomData->doors[2].openclosed = 0;
} break;
case 446: {
- drawText(regobj.useTextRef);
- g_engine->_mouseManager->hide();
- g_engine->_sound->playVoc("TAZA", 223698, 29066);
+ drawText(_curObject.useTextRef);
+ _mouse->hide();
+ _sound->playVoc("TAZA", 223698, 29066);
animateGive(0, 2);
- g_engine->_sound->waitForSoundEnd();
+ _sound->waitForSoundEnd();
animatePickup2(0, 2);
replaceBackpack(usedObjectIndex, 204);
drawBackpack();
- g_engine->_mouseManager->show();
+ _mouse->show();
} break;
case 507: {
- g_engine->_mouseManager->hide();
+ _mouse->hide();
animatePickup1(0, 1);
- g_engine->_sound->playVoc("MAQUINA", 153470, 7378);
+ _sound->playVoc("MAQUINA", 153470, 7378);
animateOpen2(0, 1);
updateInventory(usedObjectIndex);
drawBackpack();
- g_engine->_mouseManager->show();
- currentRoomData->mouseGrid[27][8] = 22;
+ _mouse->show();
+ _currentRoomData->mouseGrid[27][8] = 22;
} break;
case 549: {
- updateItem(regobj.code);
- g_engine->_mouseManager->hide();
- g_engine->_sound->playVoc("PUERTA", 186429, 4754);
+ updateItem(_curObject.code);
+ _mouse->hide();
+ _sound->playVoc("PUERTA", 186429, 4754);
animatePickup1(1, 1);
animateOpen2(1, 1);
- g_engine->_mouseManager->show();
- drawText(regobj.useTextRef);
- currentRoomData->doors[0].openclosed = 0;
+ _mouse->show();
+ drawText(_curObject.useTextRef);
+ _currentRoomData->doors[0].openclosed = 0;
} break;
case 562: { // put any object in the niches
- switch (currentRoomData->code) {
+ switch (_currentRoomData->code) {
case 20: {
- if (niche[0][niche[0][3]] == 0) {
+ if (_niche[0][_niche[0][3]] == 0) {
- if (niche[0][3] == 0) {
- niche[0][0] = regobj.code;
- drawText(regobj.useTextRef);
- g_engine->_mouseManager->hide();
- currentRoomData->screenObjectIndex[9]->objectName = " ";
+ if (_niche[0][3] == 0) {
+ _niche[0][0] = _curObject.code;
+ drawText(_curObject.useTextRef);
+ _mouse->hide();
+ _currentRoomData->screenObjectIndex[9]->objectName = " ";
animateGive(3, 1);
- switch (niche[0][0]) {
+ switch (_niche[0][0]) {
case 561: {
- currentRoomData->screenObjectIndex[9]->objectName = getObjectName(5);
- readBitmap(1182652, screenLayers[0], 892, 319);
- currentRoomData->screenLayers[1].bitmapPointer = 1182652;
+ _currentRoomData->screenObjectIndex[9]->objectName = getObjectName(5);
+ readBitmap(1182652, _screenLayers[0], 892, 319);
+ _currentRoomData->screenLayers[1].bitmapPointer = 1182652;
} break;
case 615: {
- currentRoomData->screenObjectIndex[9]->objectName = getObjectName(7);
- readBitmap(1181760, screenLayers[0], 892, 319);
- currentRoomData->screenLayers[1].bitmapPointer = 1181760;
+ _currentRoomData->screenObjectIndex[9]->objectName = getObjectName(7);
+ readBitmap(1181760, _screenLayers[0], 892, 319);
+ _currentRoomData->screenLayers[1].bitmapPointer = 1181760;
} break;
}
- currentRoomData->screenLayers[1].bitmapSize = 892;
- currentRoomData->screenLayers[1].coordx = 66;
- currentRoomData->screenLayers[1].coordy = 35;
- currentRoomData->screenLayers[1].depth = 1;
- g_engine->_graphics->restoreBackground();
+ _currentRoomData->screenLayers[1].bitmapSize = 892;
+ _currentRoomData->screenLayers[1].coordx = 66;
+ _currentRoomData->screenLayers[1].coordy = 35;
+ _currentRoomData->screenLayers[1].depth = 1;
+ _graphics->restoreBackground();
assembleScreen();
- g_engine->_graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(sceneBackground);
animateOpen2(3, 1);
updateInventory(usedObjectIndex);
drawBackpack();
- g_engine->_mouseManager->show();
+ _mouse->show();
} else {
- niche[0][niche[0][3]] = regobj.code;
- niche[1][3] += 1;
- niche[0][3] -= 1;
- drawText(regobj.useTextRef);
- g_engine->_mouseManager->hide();
+ _niche[0][_niche[0][3]] = _curObject.code;
+ _niche[1][3] += 1;
+ _niche[0][3] -= 1;
+ drawText(_curObject.useTextRef);
+ _mouse->hide();
animateGive(3, 1);
- switch (regobj.code) {
+ switch (_curObject.code) {
case 561:
- readBitmap(1182652, screenLayers[0], 892, 319);
+ readBitmap(1182652, _screenLayers[0], 892, 319);
break;
case 615:
- readBitmap(1181760, screenLayers[0], 892, 319);
+ readBitmap(1181760, _screenLayers[0], 892, 319);
break;
}
- g_engine->_graphics->restoreBackground();
+ _graphics->restoreBackground();
assembleScreen();
- g_engine->_graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(sceneBackground);
animateOpen2(3, 1);
updateInventory(usedObjectIndex);
drawBackpack();
- currentRoomData->screenObjectIndex[9]->objectName = " ";
- g_engine->_sound->playVoc("PLATAF", 375907, 14724);
- switch (niche[0][niche[0][3]]) {
+ _currentRoomData->screenObjectIndex[9]->objectName = " ";
+ _sound->playVoc("PLATAF", 375907, 14724);
+ switch (_niche[0][_niche[0][3]]) {
case 0: {
- currentRoomData->screenObjectIndex[9]->objectName = getObjectName(4);
+ _currentRoomData->screenObjectIndex[9]->objectName = getObjectName(4);
nicheAnimation(1, 1190768);
- currentRoomData->screenLayers[1].bitmapPointer = 1190768;
+ _currentRoomData->screenLayers[1].bitmapPointer = 1190768;
} break;
case 561: {
- currentRoomData->screenObjectIndex[9]->objectName = getObjectName(5);
+ _currentRoomData->screenObjectIndex[9]->objectName = getObjectName(5);
nicheAnimation(1, 1182652);
- currentRoomData->screenLayers[1].bitmapPointer = 1182652;
+ _currentRoomData->screenLayers[1].bitmapPointer = 1182652;
} break;
case 563: {
- currentRoomData->screenObjectIndex[9]->objectName = getObjectName(6);
+ _currentRoomData->screenObjectIndex[9]->objectName = getObjectName(6);
nicheAnimation(1, 1186044);
- currentRoomData->screenLayers[1].bitmapPointer = 1186044;
+ _currentRoomData->screenLayers[1].bitmapPointer = 1186044;
} break;
case 615: {
- currentRoomData->screenObjectIndex[9]->objectName = getObjectName(7);
+ _currentRoomData->screenObjectIndex[9]->objectName = getObjectName(7);
nicheAnimation(1, 1181760);
- currentRoomData->screenLayers[1].bitmapPointer = 1181760;
+ _currentRoomData->screenLayers[1].bitmapPointer = 1181760;
} break;
}
- currentRoomData->screenLayers[1].bitmapSize = 892;
- currentRoomData->screenLayers[1].coordx = 66;
- currentRoomData->screenLayers[1].coordy = 35;
- currentRoomData->screenLayers[1].depth = 1;
- g_engine->_mouseManager->show();
+ _currentRoomData->screenLayers[1].bitmapSize = 892;
+ _currentRoomData->screenLayers[1].coordx = 66;
+ _currentRoomData->screenLayers[1].coordy = 35;
+ _currentRoomData->screenLayers[1].depth = 1;
+ _mouse->show();
updateAltScreen(24);
}
} else {
@@ -2826,97 +2722,97 @@ void useScreenObject() {
}
} break;
case 24: {
- if (niche[1][niche[1][3]] == 0) {
+ if (_niche[1][_niche[1][3]] == 0) {
- if (niche[1][3] == 0) {
+ if (_niche[1][3] == 0) {
- niche[1][0] = regobj.code;
- drawText(regobj.useTextRef);
- g_engine->_mouseManager->hide();
- currentRoomData->screenObjectIndex[8]->objectName = " ";
+ _niche[1][0] = _curObject.code;
+ drawText(_curObject.useTextRef);
+ _mouse->hide();
+ _currentRoomData->screenObjectIndex[8]->objectName = " ";
animateGive(0, 1);
- switch (niche[1][0]) {
+ switch (_niche[1][0]) {
case 561: {
- currentRoomData->screenObjectIndex[8]->objectName = getObjectName(5);
- readBitmap(1381982, screenLayers[0], 892, 319);
- currentRoomData->screenLayers[0].bitmapPointer = 1381982;
+ _currentRoomData->screenObjectIndex[8]->objectName = getObjectName(5);
+ readBitmap(1381982, _screenLayers[0], 892, 319);
+ _currentRoomData->screenLayers[0].bitmapPointer = 1381982;
} break;
case 615: {
- currentRoomData->screenObjectIndex[8]->objectName = getObjectName(7);
- readBitmap(1381090, screenLayers[0], 892, 319);
- currentRoomData->screenLayers[0].bitmapPointer = 1381090;
+ _currentRoomData->screenObjectIndex[8]->objectName = getObjectName(7);
+ readBitmap(1381090, _screenLayers[0], 892, 319);
+ _currentRoomData->screenLayers[0].bitmapPointer = 1381090;
} break;
}
- currentRoomData->screenLayers[0].bitmapSize = 892;
- currentRoomData->screenLayers[0].coordx = 217;
- currentRoomData->screenLayers[0].coordy = 48;
- currentRoomData->screenLayers[0].depth = 1;
- g_engine->_graphics->restoreBackground();
+ _currentRoomData->screenLayers[0].bitmapSize = 892;
+ _currentRoomData->screenLayers[0].coordx = 217;
+ _currentRoomData->screenLayers[0].coordy = 48;
+ _currentRoomData->screenLayers[0].depth = 1;
+ _graphics->restoreBackground();
assembleScreen();
- g_engine->_graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(sceneBackground);
animateOpen2(0, 1);
updateInventory(usedObjectIndex);
drawBackpack();
- g_engine->_mouseManager->show();
+ _mouse->show();
} else {
- niche[1][niche[1][3]] = regobj.code;
- niche[0][3] += 1;
- niche[1][3] -= 1;
- drawText(regobj.useTextRef);
- g_engine->_mouseManager->hide();
+ _niche[1][_niche[1][3]] = _curObject.code;
+ _niche[0][3] += 1;
+ _niche[1][3] -= 1;
+ drawText(_curObject.useTextRef);
+ _mouse->hide();
animateGive(0, 1);
- switch (regobj.code) {
+ switch (_curObject.code) {
case 561:
- readBitmap(1381982, screenLayers[regobj.depth - 1],
+ readBitmap(1381982, _screenLayers[_curObject.depth - 1],
892, 319);
break;
case 615:
- readBitmap(1381090, screenLayers[regobj.depth - 1],
+ readBitmap(1381090, _screenLayers[_curObject.depth - 1],
892, 319);
break;
}
- g_engine->_graphics->restoreBackground();
+ _graphics->restoreBackground();
assembleScreen();
- g_engine->_graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(sceneBackground);
animateOpen2(0, 1);
updateInventory(usedObjectIndex);
drawBackpack();
- currentRoomData->screenObjectIndex[8]->objectName = " ";
- g_engine->_sound->playVoc("PLATAF", 375907, 14724);
- switch (niche[1][niche[1][3]]) {
+ _currentRoomData->screenObjectIndex[8]->objectName = " ";
+ _sound->playVoc("PLATAF", 375907, 14724);
+ switch (_niche[1][_niche[1][3]]) {
case 0: {
- currentRoomData->screenObjectIndex[8]->objectName = getObjectName(4);
+ _currentRoomData->screenObjectIndex[8]->objectName = getObjectName(4);
nicheAnimation(1, 1399610);
- currentRoomData->screenLayers[0].bitmapPointer = 1399610;
+ _currentRoomData->screenLayers[0].bitmapPointer = 1399610;
} break;
case 561: {
- currentRoomData->screenObjectIndex[8]->objectName = getObjectName(5);
+ _currentRoomData->screenObjectIndex[8]->objectName = getObjectName(5);
nicheAnimation(1, 1381982);
- currentRoomData->screenLayers[0].bitmapPointer = 1381982;
+ _currentRoomData->screenLayers[0].bitmapPointer = 1381982;
} break;
case 615: {
- currentRoomData->screenObjectIndex[8]->objectName = getObjectName(7);
+ _currentRoomData->screenObjectIndex[8]->objectName = getObjectName(7);
nicheAnimation(1, 1381090);
- currentRoomData->screenLayers[0].bitmapPointer = 1381090;
+ _currentRoomData->screenLayers[0].bitmapPointer = 1381090;
} break;
case 622: {
- currentRoomData->screenObjectIndex[8]->objectName = getObjectName(8);
+ _currentRoomData->screenObjectIndex[8]->objectName = getObjectName(8);
nicheAnimation(1, 1400502);
- currentRoomData->screenLayers[0].bitmapPointer = 1400502;
+ _currentRoomData->screenLayers[0].bitmapPointer = 1400502;
} break;
case 623: {
- currentRoomData->screenObjectIndex[8]->objectName = getObjectName(9);
+ _currentRoomData->screenObjectIndex[8]->objectName = getObjectName(9);
nicheAnimation(1, 1398718);
- currentRoomData->screenLayers[0].bitmapPointer = 1398718;
+ _currentRoomData->screenLayers[0].bitmapPointer = 1398718;
} break;
}
- currentRoomData->screenLayers[0].bitmapSize = 892;
- currentRoomData->screenLayers[0].coordx = 217;
- currentRoomData->screenLayers[0].coordy = 48;
- currentRoomData->screenLayers[0].depth = 1;
- g_engine->_mouseManager->show();
+ _currentRoomData->screenLayers[0].bitmapSize = 892;
+ _currentRoomData->screenLayers[0].coordx = 217;
+ _currentRoomData->screenLayers[0].coordy = 48;
+ _currentRoomData->screenLayers[0].depth = 1;
+ _mouse->show();
updateAltScreen(20);
}
} else {
@@ -2927,21 +2823,21 @@ void useScreenObject() {
} break;
case 583: {
- long offset = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0][20] : flcOffsets[1][20];
+ long offset = (_lang == Common::ES_ESP) ? flcOffsets[0][20] : flcOffsets[1][20];
- drawText(regobj.useTextRef);
- g_engine->_mouseManager->hide();
+ drawText(_curObject.useTextRef);
+ _mouse->hide();
drawFlc(140, 34, offset, 0, 9, 24, false, false, true, foobar);
- g_engine->_mouseManager->show();
- updateItem(regobj.code);
- currentRoomData->screenObjectIndex[7]->fileIndex = 716;
- currentRoomData->mouseGrid[19][9] = 14;
- currentRoomData->mouseGrid[22][16] = 15;
+ _mouse->show();
+ updateItem(_curObject.code);
+ _currentRoomData->screenObjectIndex[7]->fileIndex = 716;
+ _currentRoomData->mouseGrid[19][9] = 14;
+ _currentRoomData->mouseGrid[22][16] = 15;
for (listIndex = 21; listIndex <= 22; listIndex++)
for (invIndex = 17; invIndex <= 20; invIndex++)
- currentRoomData->mouseGrid[listIndex][invIndex] = 17;
+ _currentRoomData->mouseGrid[listIndex][invIndex] = 17;
{
- RoomBitmapRegister &with = currentRoomData->screenLayers[0];
+ RoomBitmapRegister &with = _currentRoomData->screenLayers[0];
with.bitmapPointer = 1243652;
with.bitmapSize = 2718;
@@ -2950,7 +2846,7 @@ void useScreenObject() {
with.depth = 6;
}
{
- RoomBitmapRegister &with = currentRoomData->screenLayers[1];
+ RoomBitmapRegister &with = _currentRoomData->screenLayers[1];
with.bitmapPointer = 1240474;
with.bitmapSize = 344;
@@ -2960,7 +2856,7 @@ void useScreenObject() {
loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
{
- RoomBitmapRegister &with = currentRoomData->screenLayers[2];
+ RoomBitmapRegister &with = _currentRoomData->screenLayers[2];
with.bitmapPointer = 1240818;
with.bitmapSize = 116;
@@ -2969,28 +2865,28 @@ void useScreenObject() {
with.depth = 1;
loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
- readBitmap(1243652, screenLayers[5], 2718, 319);
- g_engine->_graphics->restoreBackground();
+ readBitmap(1243652, _screenLayers[5], 2718, 319);
+ _graphics->restoreBackground();
assembleScreen();
- g_engine->_graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(sceneBackground);
} break;
case 594: {
- drawText(regobj.useTextRef);
- g_engine->_mouseManager->hide();
+ drawText(_curObject.useTextRef);
+ _mouse->hide();
animateGive(3, 2);
animatePickup2(3, 2);
replaceBackpack(usedObjectIndex, 607);
drawBackpack();
- g_engine->_mouseManager->show();
+ _mouse->show();
} break;
case 608: {
- drawText(regobj.useTextRef);
- goToObject(currentRoomData->walkAreasGrid[mouseX][mouseY], 26);
- g_engine->_mouseManager->hide();
+ drawText(_curObject.useTextRef);
+ goToObject(_currentRoomData->walkAreasGrid[correctedMouseX][correctedMouseY], 26);
+ _mouse->hide();
animateGive(2, 2);
animateOpen2(2, 2);
{
- RoomBitmapRegister &with = currentRoomData->screenLayers[3];
+ RoomBitmapRegister &with = _currentRoomData->screenLayers[3];
with.bitmapPointer = 1546096;
with.bitmapSize = 372;
@@ -2999,151 +2895,151 @@ void useScreenObject() {
with.depth = 4;
loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
- g_engine->_graphics->restoreBackground();
+ _graphics->restoreBackground();
assembleScreen();
- g_engine->_graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(sceneBackground);
updateInventory(usedObjectIndex);
drawBackpack();
- isTrapSet = true;
- g_engine->_mouseManager->show();
+ _isTrapSet = true;
+ _mouse->show();
} break;
case 632: {
- long offset = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0][21] : flcOffsets[1][21];
- drawText(regobj.useTextRef);
- g_engine->_mouseManager->hide();
- animateGive(charFacingDirection, 1);
+ long offset = (_lang == Common::ES_ESP) ? flcOffsets[0][21] : flcOffsets[1][21];
+ drawText(_curObject.useTextRef);
+ _mouse->hide();
+ animateGive(_charFacingDirection, 1);
// Show feather on pedestal
loadItem(187, 70, 104, 1545820, 8);
- g_engine->_graphics->restoreBackground();
+ _graphics->restoreBackground();
assembleScreen();
- g_engine->_graphics->drawScreen(sceneBackground);
- g_engine->_screen->update();
-
- animateOpen2(charFacingDirection, 1);
- g_engine->_mouseManager->show();
- goToObject(currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount], 14);
- g_engine->_mouseManager->hide();
- g_engine->_sound->playVoc("PUFF", 191183, 18001);
+ _graphics->drawScreen(sceneBackground);
+ _screen->update();
+
+ animateOpen2(_charFacingDirection, 1);
+ _mouse->show();
+ goToObject(_currentRoomData->walkAreasGrid[(_characterPosX + kCharacterCorrectionX) / kXGridCount][(_characterPosY + kCharacerCorrectionY) / kYGridCount], 14);
+ _mouse->hide();
+ _sound->playVoc("PUFF", 191183, 18001);
// Animate to scythe
debug("Start anim!");
drawFlc(180, 60, offset, 0, 9, 0, false, false, true, foobar);
debug("End Anim!");
// load Scythe
- currentRoomData->screenLayers[2].bitmapPointer = 1545820;
- currentRoomData->screenLayers[2].bitmapSize = 104;
- currentRoomData->screenLayers[2].coordx = 277;
- currentRoomData->screenLayers[2].coordy = 104;
- currentRoomData->screenLayers[2].depth = 1;
- depthMap[0].posy = 104;
- readBitmap(1545820, screenLayers[0], 104, 319);
-
- currentRoomData->screenLayers[4].bitmapPointer = 1447508;
- currentRoomData->screenLayers[4].bitmapSize = 464;
- currentRoomData->screenLayers[4].coordx = 186;
- currentRoomData->screenLayers[4].coordy = 64;
- currentRoomData->screenLayers[4].depth = 8;
+ _currentRoomData->screenLayers[2].bitmapPointer = 1545820;
+ _currentRoomData->screenLayers[2].bitmapSize = 104;
+ _currentRoomData->screenLayers[2].coordx = 277;
+ _currentRoomData->screenLayers[2].coordy = 104;
+ _currentRoomData->screenLayers[2].depth = 1;
+ _depthMap[0].posy = 104;
+ readBitmap(1545820, _screenLayers[0], 104, 319);
+
+ _currentRoomData->screenLayers[4].bitmapPointer = 1447508;
+ _currentRoomData->screenLayers[4].bitmapSize = 464;
+ _currentRoomData->screenLayers[4].coordx = 186;
+ _currentRoomData->screenLayers[4].coordy = 64;
+ _currentRoomData->screenLayers[4].depth = 8;
loadItem(186, 63, 464, 1447508, 8);
- g_engine->_graphics->restoreBackground();
+ _graphics->restoreBackground();
assembleScreen();
- g_engine->_graphics->drawScreen(sceneBackground);
- g_engine->_mouseManager->show();
- goToObject(currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount], 18);
- g_engine->_mouseManager->hide();
+ _graphics->drawScreen(sceneBackground);
+ _mouse->show();
+ goToObject(_currentRoomData->walkAreasGrid[(_characterPosX + kCharacterCorrectionX) / kXGridCount][(_characterPosY + kCharacerCorrectionY) / kYGridCount], 18);
+ _mouse->hide();
animatePickup1(1, 1);
replaceBackpack(usedObjectIndex, 638);
- currentRoomData->screenLayers[4].bitmapPointer = 0;
- currentRoomData->screenLayers[4].bitmapSize = 0;
- currentRoomData->screenLayers[4].coordx = 0;
- currentRoomData->screenLayers[4].coordy = 0;
- currentRoomData->screenLayers[4].depth = 0;
- screenLayers[7] = NULL;
- g_engine->_graphics->restoreBackground();
+ _currentRoomData->screenLayers[4].bitmapPointer = 0;
+ _currentRoomData->screenLayers[4].bitmapSize = 0;
+ _currentRoomData->screenLayers[4].coordx = 0;
+ _currentRoomData->screenLayers[4].coordy = 0;
+ _currentRoomData->screenLayers[4].depth = 0;
+ _screenLayers[7] = NULL;
+ _graphics->restoreBackground();
assembleScreen();
- g_engine->_graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(sceneBackground);
animatePickup2(1, 1);
drawBackpack();
- g_engine->_mouseManager->show();
+ _mouse->show();
for (listIndex = 35; listIndex <= 37; listIndex++)
for (invIndex = 21; invIndex <= 25; invIndex++)
- currentRoomData->mouseGrid[listIndex][invIndex] = 11;
- isScytheTaken = true;
- if (isTridentTaken)
- caves[3] = true;
+ _currentRoomData->mouseGrid[listIndex][invIndex] = 11;
+ _isScytheTaken = true;
+ if (_isTridentTaken)
+ _caves[3] = true;
} break;
case 633: { //Use ring!
- long offset = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0][22] : flcOffsets[1][22];
+ long offset = (_lang == Common::ES_ESP) ? flcOffsets[0][22] : flcOffsets[1][22];
- drawText(regobj.useTextRef);
- g_engine->_mouseManager->hide();
+ drawText(_curObject.useTextRef);
+ _mouse->hide();
animateGive(3, 1);
loadItem(86, 55, 92, 1591272, 8);
- g_engine->_graphics->restoreBackground();
+ _graphics->restoreBackground();
assembleScreen();
- g_engine->_graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(sceneBackground);
animateOpen2(3, 1);
- g_engine->_mouseManager->show();
- goToObject(currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount], 10);
- g_engine->_mouseManager->hide();
- g_engine->_sound->playVoc("PUFF", 191183, 18001);
+ _mouse->show();
+ goToObject(_currentRoomData->walkAreasGrid[(_characterPosX + kCharacterCorrectionX) / kXGridCount][(_characterPosY + kCharacerCorrectionY) / kYGridCount], 10);
+ _mouse->hide();
+ _sound->playVoc("PUFF", 191183, 18001);
drawFlc(0, 47, offset, 0, 9, 0, false, false, true, foobar);
- currentRoomData->screenLayers[3].bitmapPointer = 1591272;
- currentRoomData->screenLayers[3].bitmapSize = 92;
- currentRoomData->screenLayers[3].coordx = 18;
- currentRoomData->screenLayers[3].coordy = 60;
- currentRoomData->screenLayers[3].depth = 3;
- depthMap[2].posx = 18;
- depthMap[2].posy = 60;
- readBitmap(1591272, screenLayers[2], 92, 319);
-
- currentRoomData->screenLayers[4].bitmapPointer = 1746554;
- currentRoomData->screenLayers[4].bitmapSize = 384;
- currentRoomData->screenLayers[4].coordx = 82;
- currentRoomData->screenLayers[4].coordy = 53;
- currentRoomData->screenLayers[4].depth = 8;
+ _currentRoomData->screenLayers[3].bitmapPointer = 1591272;
+ _currentRoomData->screenLayers[3].bitmapSize = 92;
+ _currentRoomData->screenLayers[3].coordx = 18;
+ _currentRoomData->screenLayers[3].coordy = 60;
+ _currentRoomData->screenLayers[3].depth = 3;
+ _depthMap[2].posx = 18;
+ _depthMap[2].posy = 60;
+ readBitmap(1591272, _screenLayers[2], 92, 319);
+
+ _currentRoomData->screenLayers[4].bitmapPointer = 1746554;
+ _currentRoomData->screenLayers[4].bitmapSize = 384;
+ _currentRoomData->screenLayers[4].coordx = 82;
+ _currentRoomData->screenLayers[4].coordy = 53;
+ _currentRoomData->screenLayers[4].depth = 8;
loadItem(82, 53, 384, 1746554, 8);
assembleScreen();
- g_engine->_graphics->drawScreen(sceneBackground);
- g_engine->_mouseManager->show();
- goToObject(currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount], 15);
- g_engine->_mouseManager->hide();
+ _graphics->drawScreen(sceneBackground);
+ _mouse->show();
+ goToObject(_currentRoomData->walkAreasGrid[(_characterPosX + kCharacterCorrectionX) / kXGridCount][(_characterPosY + kCharacerCorrectionY) / kYGridCount], 15);
+ _mouse->hide();
animatePickup1(3, 1);
replaceBackpack(usedObjectIndex, 637);
- currentRoomData->screenLayers[4].bitmapPointer = 0;
- currentRoomData->screenLayers[4].bitmapSize = 0;
- currentRoomData->screenLayers[4].coordx = 0;
- currentRoomData->screenLayers[4].coordy = 0;
- currentRoomData->screenLayers[4].depth = 0;
- screenLayers[7] = NULL;
- g_engine->_graphics->restoreBackground();
+ _currentRoomData->screenLayers[4].bitmapPointer = 0;
+ _currentRoomData->screenLayers[4].bitmapSize = 0;
+ _currentRoomData->screenLayers[4].coordx = 0;
+ _currentRoomData->screenLayers[4].coordy = 0;
+ _currentRoomData->screenLayers[4].depth = 0;
+ _screenLayers[7] = NULL;
+ _graphics->restoreBackground();
assembleScreen();
- g_engine->_graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(sceneBackground);
animatePickup2(3, 1);
drawBackpack();
- g_engine->_mouseManager->show();
+ _mouse->show();
for (listIndex = 0; listIndex <= 2; listIndex++)
for (invIndex = 10; invIndex <= 12; invIndex++)
- currentRoomData->mouseGrid[listIndex][invIndex] = 10;
- isTridentTaken = true;
- if (isScytheTaken)
- caves[3] = true;
+ _currentRoomData->mouseGrid[listIndex][invIndex] = 10;
+ _isTridentTaken = true;
+ if (_isScytheTaken)
+ _caves[3] = true;
} break;
case 643: { // Urn with altar
- long offset = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0][23] : flcOffsets[1][23];
-
- if (currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount] != 5)
- drawText(regobj.useTextRef);
- mouseClickX = 149 - 7;
- mouseClickY = 126 - 7;
- goToObject(currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount], 5);
- g_engine->_mouseManager->hide();
+ long offset = (_lang == Common::ES_ESP) ? flcOffsets[0][23] : flcOffsets[1][23];
+
+ if (_currentRoomData->walkAreasGrid[(_characterPosX + kCharacterCorrectionX) / kXGridCount][(_characterPosY + kCharacerCorrectionY) / kYGridCount] != 5)
+ drawText(_curObject.useTextRef);
+ _mouse->mouseClickX = 149 - 7;
+ _mouse->mouseClickY = 126 - 7;
+ goToObject(_currentRoomData->walkAreasGrid[(_characterPosX + kCharacterCorrectionX) / kXGridCount][(_characterPosY + kCharacerCorrectionY) / kYGridCount], 5);
+ _mouse->hide();
updateInventory(usedObjectIndex);
drawBackpack();
drawFlc(133, 0, offset, 0, 9, 22, false, false, true, foobar);
{
- RoomBitmapRegister &with = currentRoomData->screenLayers[2];
+ RoomBitmapRegister &with = _currentRoomData->screenLayers[2];
with.bitmapPointer = 1744230;
with.bitmapSize = 824;
@@ -3155,119 +3051,119 @@ void useScreenObject() {
updateAltScreen(31);
for (listIndex = 18; listIndex <= 20; listIndex++)
for (invIndex = 8; invIndex <= 14; invIndex++)
- currentRoomData->mouseGrid[listIndex][invIndex] = 12;
- isSealRemoved = true;
- caves[1] = false;
- caves[0] = false;
- caves[4] = false;
- g_engine->_mouseManager->show();
+ _currentRoomData->mouseGrid[listIndex][invIndex] = 12;
+ _isSealRemoved = true;
+ _caves[1] = false;
+ _caves[0] = false;
+ _caves[4] = false;
+ _mouse->show();
} break;
case 657: { // sharpen scythe
- long offset = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0][24] : flcOffsets[1][24];
-
- drawText(regobj.useTextRef);
- mouseClickX = 178 - 7;
- mouseClickY = 71 - 7;
- goToObject(currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount], 3);
- g_engine->_mouseManager->hide();
- g_engine->_sound->playVoc("AFILAR", 0, 6433);
+ long offset = (_lang == Common::ES_ESP) ? flcOffsets[0][24] : flcOffsets[1][24];
+
+ drawText(_curObject.useTextRef);
+ _mouse->mouseClickX = 178 - 7;
+ _mouse->mouseClickY = 71 - 7;
+ goToObject(_currentRoomData->walkAreasGrid[(_characterPosX + kCharacterCorrectionX) / kXGridCount][(_characterPosY + kCharacerCorrectionY) / kYGridCount], 3);
+ _mouse->hide();
+ _sound->playVoc("AFILAR", 0, 6433);
drawFlc(160, 15, offset, 0, 9, 23, false, false, true, foobar);
replaceBackpack(usedObjectIndex, 715);
drawBackpack();
- g_engine->_mouseManager->show();
+ _mouse->show();
} break;
case 686: {
- drawText(regobj.useTextRef);
- isVasePlaced = true;
- caves[4] = false;
- g_engine->_mouseManager->hide();
+ drawText(_curObject.useTextRef);
+ _isVasePlaced = true;
+ _caves[4] = false;
+ _mouse->hide();
animateGive(1, 1);
updateInventory(usedObjectIndex);
- dropObjectInScreen(regobj);
- g_engine->_graphics->restoreBackground();
+ dropObjectInScreen(_curObject);
+ _graphics->restoreBackground();
assembleScreen();
- g_engine->_graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(sceneBackground);
drawBackpack();
animateOpen2(1, 1);
for (listIndex = 19; listIndex <= 21; listIndex++)
for (invIndex = 10; invIndex <= 13; invIndex++)
- currentRoomData->mouseGrid[listIndex][invIndex] = 13;
- g_engine->_mouseManager->show();
+ _currentRoomData->mouseGrid[listIndex][invIndex] = 13;
+ _mouse->show();
} break;
case 689: { // rope
- long offset = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0][25] : flcOffsets[1][25];
+ long offset = (_lang == Common::ES_ESP) ? flcOffsets[0][25] : flcOffsets[1][25];
- drawText(regobj.useTextRef);
- mouseClickX = 124 - 7;
- mouseClickY = 133 - 7;
- goToObject(currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount], 9);
- g_engine->_mouseManager->hide();
+ drawText(_curObject.useTextRef);
+ _mouse->mouseClickX = 124 - 7;
+ _mouse->mouseClickY = 133 - 7;
+ goToObject(_currentRoomData->walkAreasGrid[(_characterPosX + kCharacterCorrectionX) / kXGridCount][(_characterPosY + kCharacerCorrectionY) / kYGridCount], 9);
+ _mouse->hide();
drawFlc(110, 79, offset, 0, 9, 0, false, false, true, foobar);
replaceBackpack(usedObjectIndex, 701);
drawBackpack();
- g_engine->_graphics->restoreBackground();
+ _graphics->restoreBackground();
assembleScreen();
- g_engine->_graphics->drawScreen(sceneBackground);
- g_engine->_mouseManager->show();
+ _graphics->drawScreen(sceneBackground);
+ _mouse->show();
for (listIndex = 18; listIndex <= 20; listIndex++)
- currentRoomData->mouseGrid[listIndex][26] = 10;
+ _currentRoomData->mouseGrid[listIndex][26] = 10;
for (listIndex = 17; listIndex <= 21; listIndex++)
- currentRoomData->mouseGrid[listIndex][27] = 10;
+ _currentRoomData->mouseGrid[listIndex][27] = 10;
} break;
case 700: { // Trident
- long offset = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0][26] : flcOffsets[1][26];
- drawText(regobj.useTextRef);
- mouseClickX = 224 - 7;
- mouseClickY = 91 - 7;
- goToObject(currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount], 7);
- g_engine->_mouseManager->hide();
+ long offset = (_lang == Common::ES_ESP) ? flcOffsets[0][26] : flcOffsets[1][26];
+ drawText(_curObject.useTextRef);
+ _mouse->mouseClickX = 224 - 7;
+ _mouse->mouseClickY = 91 - 7;
+ goToObject(_currentRoomData->walkAreasGrid[(_characterPosX + kCharacterCorrectionX) / kXGridCount][(_characterPosY + kCharacerCorrectionY) / kYGridCount], 7);
+ _mouse->hide();
drawFlc(208, 0, offset, 0, 9, 21, false, false, true, foobar);
- currentRoomData->screenLayers[0].bitmapPointer = 0;
- currentRoomData->screenLayers[0].bitmapSize = 0;
- currentRoomData->screenLayers[0].coordx = 0;
- currentRoomData->screenLayers[0].coordy = 0;
- currentRoomData->screenLayers[0].depth = 0;
- screenLayers[2] = NULL;
+ _currentRoomData->screenLayers[0].bitmapPointer = 0;
+ _currentRoomData->screenLayers[0].bitmapSize = 0;
+ _currentRoomData->screenLayers[0].coordx = 0;
+ _currentRoomData->screenLayers[0].coordy = 0;
+ _currentRoomData->screenLayers[0].depth = 0;
+ _screenLayers[2] = NULL;
for (invIndex = 6; invIndex <= 9; invIndex++)
- currentRoomData->mouseGrid[26][invIndex] = 3;
+ _currentRoomData->mouseGrid[26][invIndex] = 3;
for (invIndex = 3; invIndex <= 5; invIndex++)
- currentRoomData->mouseGrid[27][invIndex] = 3;
+ _currentRoomData->mouseGrid[27][invIndex] = 3;
for (invIndex = 6; invIndex <= 10; invIndex++)
- currentRoomData->mouseGrid[27][invIndex] = 4;
+ _currentRoomData->mouseGrid[27][invIndex] = 4;
for (invIndex = 11; invIndex <= 12; invIndex++)
- currentRoomData->mouseGrid[27][invIndex] = 7;
+ _currentRoomData->mouseGrid[27][invIndex] = 7;
for (invIndex = 2; invIndex <= 10; invIndex++)
- currentRoomData->mouseGrid[28][invIndex] = 4;
+ _currentRoomData->mouseGrid[28][invIndex] = 4;
for (invIndex = 11; invIndex <= 12; invIndex++)
- currentRoomData->mouseGrid[28][invIndex] = 7;
- currentRoomData->mouseGrid[28][13] = 4;
+ _currentRoomData->mouseGrid[28][invIndex] = 7;
+ _currentRoomData->mouseGrid[28][13] = 4;
for (invIndex = 1; invIndex <= 14; invIndex++)
- currentRoomData->mouseGrid[29][invIndex] = 4;
+ _currentRoomData->mouseGrid[29][invIndex] = 4;
for (listIndex = 30; listIndex <= 32; listIndex++)
for (invIndex = 0; invIndex <= 15; invIndex++)
- currentRoomData->mouseGrid[listIndex][invIndex] = 4;
+ _currentRoomData->mouseGrid[listIndex][invIndex] = 4;
for (invIndex = 1; invIndex <= 14; invIndex++)
- currentRoomData->mouseGrid[33][invIndex] = 4;
+ _currentRoomData->mouseGrid[33][invIndex] = 4;
for (invIndex = 2; invIndex <= 14; invIndex++)
- currentRoomData->mouseGrid[34][invIndex] = 4;
+ _currentRoomData->mouseGrid[34][invIndex] = 4;
for (invIndex = 3; invIndex <= 8; invIndex++)
- currentRoomData->mouseGrid[35][invIndex] = 4;
+ _currentRoomData->mouseGrid[35][invIndex] = 4;
for (invIndex = 9; invIndex <= 11; invIndex++)
- currentRoomData->mouseGrid[35][invIndex] = 7;
- currentRoomData->doors[1].openclosed = 1;
- g_engine->_mouseManager->show();
- updateItem(regobj.code);
+ _currentRoomData->mouseGrid[35][invIndex] = 7;
+ _currentRoomData->doors[1].openclosed = 1;
+ _mouse->show();
+ updateItem(_curObject.code);
} break;
case 709: { // rock with mural
- long offset = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0][27] : flcOffsets[1][27];
+ long offset = (_lang == Common::ES_ESP) ? flcOffsets[0][27] : flcOffsets[1][27];
- if (isSealRemoved) {
- drawText(regobj.useTextRef);
- g_engine->_mouseManager->hide();
+ if (_isSealRemoved) {
+ drawText(_curObject.useTextRef);
+ _mouse->hide();
animatePickup1(0, 1);
- g_engine->_sound->playVoc("TIZA", 390631, 18774);
+ _sound->playVoc("TIZA", 390631, 18774);
{
- RoomBitmapRegister &with = currentRoomData->screenLayers[1];
+ RoomBitmapRegister &with = _currentRoomData->screenLayers[1];
with.bitmapPointer = 1745054;
with.bitmapSize = 1500;
@@ -3276,22 +3172,22 @@ void useScreenObject() {
with.depth = 1;
loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
- g_engine->_graphics->restoreBackground();
+ _graphics->restoreBackground();
assembleScreen();
- g_engine->_graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(sceneBackground);
- g_engine->_sound->waitForSoundEnd();
- g_engine->_sound->playVoc("PUFF", 191183, 18001);
+ _sound->waitForSoundEnd();
+ _sound->playVoc("PUFF", 191183, 18001);
animateOpen2(0, 1);
drawFlc(180, 50, offset, 0, 9, 22, false, false, true, foobar);
- shouldQuitGame = true;
+ _shouldQuitGame = true;
} else
drawText(Random(11) + 1022);
} break;
}
} else {
- goToObject(currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount], currentRoomData->walkAreasGrid[mouseX][mouseY]);
- if (regobj.code == 536 || regobj.code == 220)
+ goToObject(_currentRoomData->walkAreasGrid[(_characterPosX + kCharacterCorrectionX) / kXGridCount][(_characterPosY + kCharacerCorrectionY) / kYGridCount], _currentRoomData->walkAreasGrid[correctedMouseX][correctedMouseY]);
+ if (_curObject.code == 536 || _curObject.code == 220)
drawText(Random(6) + 1033);
else
drawText(Random(11) + 1022);
@@ -3299,118 +3195,118 @@ void useScreenObject() {
} else { //use object with something on the scene
if (sceneObject > 0) {
readItemRegister(sceneObject);
- goToObject(currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount], currentRoomData->walkAreasGrid[mouseX][mouseY]);
- switch (regobj.used[0]) {
+ goToObject(_currentRoomData->walkAreasGrid[(_characterPosX + kCharacterCorrectionX) / kXGridCount][(_characterPosY + kCharacerCorrectionY) / kYGridCount], _currentRoomData->walkAreasGrid[correctedMouseX][correctedMouseY]);
+ switch (_curObject.used[0]) {
case 0: {
- if (regobj.useTextRef > 0)
- drawText(regobj.useTextRef);
+ if (_curObject.useTextRef > 0)
+ drawText(_curObject.useTextRef);
} break;
case 9: {
- if (regobj.afterUseTextRef > 0)
- drawText(regobj.afterUseTextRef);
+ if (_curObject.afterUseTextRef > 0)
+ drawText(_curObject.afterUseTextRef);
} break;
case 100: {
- switch (regobj.code) {
+ switch (_curObject.code) {
case 153: {
- g_engine->_mouseManager->hide();
+ _mouse->hide();
animatedSequence(2);
- g_engine->_mouseManager->show();
+ _mouse->show();
} break;
case 154: {
- regobj.used[0] = 9;
- if (regobj.beforeUseTextRef > 0)
- drawText(regobj.beforeUseTextRef);
- g_engine->_mouseManager->hide();
+ _curObject.used[0] = 9;
+ if (_curObject.beforeUseTextRef > 0)
+ drawText(_curObject.beforeUseTextRef);
+ _mouse->hide();
animatedSequence(1);
- g_engine->_mouseManager->show();
+ _mouse->show();
drawText(1425);
- g_engine->_mouseManager->hide();
+ _mouse->hide();
animatedSequence(3);
- g_engine->_mouseManager->show();
- updateItem(regobj.code);
+ _mouse->show();
+ updateItem(_curObject.code);
readItemRegister(152);
usedObjectIndex = 0;
- while (inventory[usedObjectIndex].code != 0) {
+ while (_inventory[usedObjectIndex].code != 0) {
usedObjectIndex += 1;
}
- inventory[usedObjectIndex].bitmapIndex = regobj.objectIconBitmap;
- inventory[usedObjectIndex].code = regobj.code;
- inventory[usedObjectIndex].objectName = regobj.name;
- g_engine->_mouseManager->hide();
+ _inventory[usedObjectIndex].bitmapIndex = _curObject.objectIconBitmap;
+ _inventory[usedObjectIndex].code = _curObject.code;
+ _inventory[usedObjectIndex].objectName = _curObject.name;
+ _mouse->hide();
drawBackpack();
- g_engine->_mouseManager->show();
+ _mouse->show();
} break;
case 169: {
- g_engine->_mouseManager->hide();
+ _mouse->hide();
animatePickup1(0, 1);
animateOpen2(0, 1);
- isTVOn = !(isTVOn);
- if (isTVOn) {
- g_engine->_sound->playVoc("CLICK", 27742, 2458);
- g_engine->_sound->waitForSoundEnd();
- currentRoomData->paletteAnimationFlag = true;
- g_engine->_sound->autoPlayVoc("PARASITO", 355778, 20129);
+ _isTVOn = !(_isTVOn);
+ if (_isTVOn) {
+ _sound->playVoc("CLICK", 27742, 2458);
+ _sound->waitForSoundEnd();
+ _currentRoomData->paletteAnimationFlag = true;
+ _sound->autoPlayVoc("PARASITO", 355778, 20129);
} else {
- g_engine->_sound->stopVoc();
- g_engine->_sound->playVoc("CLICK", 27742, 2458);
- currentRoomData->paletteAnimationFlag = false;
+ _sound->stopVoc();
+ _sound->playVoc("CLICK", 27742, 2458);
+ _currentRoomData->paletteAnimationFlag = false;
for (int i = 195; i <= 200; i++) {
- pal[i * 3 + 0] = 2 << 2;
- pal[i * 3 + 1] = 2 << 2;
- pal[i * 3 + 2] = 2 << 2;
+ g_engine->_graphics->_pal[i * 3 + 0] = 2 << 2;
+ g_engine->_graphics->_pal[i * 3 + 1] = 2 << 2;
+ g_engine->_graphics->_pal[i * 3 + 2] = 2 << 2;
setRGBPalette(i, 2, 2, 2);
}
}
- g_engine->_mouseManager->show();
+ _mouse->show();
} break;
case 347: {
- drawText(regobj.useTextRef);
- g_engine->_sound->stopVoc();
- g_engine->_sound->playVoc("CLICK", 27742, 2458);
- g_engine->_mouseManager->hide();
+ drawText(_curObject.useTextRef);
+ _sound->stopVoc();
+ _sound->playVoc("CLICK", 27742, 2458);
+ _mouse->hide();
animatePickup1(0, 0);
delay(100);
animateOpen2(0, 0);
- g_engine->_sound->stopVoc();
- g_engine->_sound->autoPlayVoc("CALDERA", 6433, 15386);
- g_engine->_graphics->turnLightOn();
- g_engine->_mouseManager->show();
- currentRoomData->palettePointer = 1536;
- currentRoomData->screenObjectIndex[1]->fileIndex = 424;
- currentRoomData->doors[1].openclosed = 1;
+ _sound->stopVoc();
+ _sound->autoPlayVoc("CALDERA", 6433, 15386);
+ _graphics->turnLightOn();
+ _mouse->show();
+ _currentRoomData->palettePointer = 1536;
+ _currentRoomData->screenObjectIndex[1]->fileIndex = 424;
+ _currentRoomData->doors[1].openclosed = 1;
} break;
case 359: {
- drawText(regobj.useTextRef);
- g_engine->_sound->stopVoc();
- g_engine->_sound->playVoc("CARBON", 21819, 5923);
- g_engine->_mouseManager->hide();
+ drawText(_curObject.useTextRef);
+ _sound->stopVoc();
+ _sound->playVoc("CARBON", 21819, 5923);
+ _mouse->hide();
animatePickup1(0, 0);
delay(100);
animateOpen2(0, 0);
- g_engine->_mouseManager->show();
- updateItem(regobj.code);
- currentRoomData->screenObjectIndex[16]->fileIndex = 362;
- currentRoomData->screenObjectIndex[16]->objectName = getObjectName(2);
- currentRoomData->screenObjectIndex[1]->fileIndex = 347;
- currentRoomData->screenObjectIndex[1]->objectName = getObjectName(3);
- g_engine->_sound->stopVoc();
- g_engine->_sound->autoPlayVoc("CALDERA", 6433, 15386);
+ _mouse->show();
+ updateItem(_curObject.code);
+ _currentRoomData->screenObjectIndex[16]->fileIndex = 362;
+ _currentRoomData->screenObjectIndex[16]->objectName = getObjectName(2);
+ _currentRoomData->screenObjectIndex[1]->fileIndex = 347;
+ _currentRoomData->screenObjectIndex[1]->objectName = getObjectName(3);
+ _sound->stopVoc();
+ _sound->autoPlayVoc("CALDERA", 6433, 15386);
} break;
case 682: {
- long offsetWithJar = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0][28] : flcOffsets[1][28];
- long offsetNoJar = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0][29] : flcOffsets[1][29];
+ long offsetWithJar = (_lang == Common::ES_ESP) ? flcOffsets[0][28] : flcOffsets[1][28];
+ long offsetNoJar = (_lang == Common::ES_ESP) ? flcOffsets[0][29] : flcOffsets[1][29];
- g_engine->_mouseManager->hide();
- g_engine->_sound->playVoc("CLICK", 27742, 2458);
+ _mouse->hide();
+ _sound->playVoc("CLICK", 27742, 2458);
animatePickup1(0, 1);
- g_engine->_sound->waitForSoundEnd();
+ _sound->waitForSoundEnd();
animateOpen2(0, 1);
- g_engine->_sound->playVoc("FUEGO", 72598, 9789);
- if (isVasePlaced) {
+ _sound->playVoc("FUEGO", 72598, 9789);
+ if (_isVasePlaced) {
drawFlc(108, 0, offsetWithJar, 0, 9, 0, false, false, true, foobar);
{
- RoomBitmapRegister &with = currentRoomData->screenLayers[0];
+ RoomBitmapRegister &with = _currentRoomData->screenLayers[0];
with.bitmapPointer = 1636796;
with.bitmapSize = 628;
@@ -3420,14 +3316,14 @@ void useScreenObject() {
}
for (listIndex = 19; listIndex <= 21; listIndex++)
for (invIndex = 10; invIndex <= 13; invIndex++)
- currentRoomData->mouseGrid[listIndex][invIndex] = 12;
+ _currentRoomData->mouseGrid[listIndex][invIndex] = 12;
} else
drawFlc(108, 0, offsetNoJar, 0, 9, 0, false, false, true, foobar);
- g_engine->_mouseManager->show();
+ _mouse->show();
} break;
}
- if ((regobj.beforeUseTextRef > 0) && (regobj.code != 154))
- drawText(regobj.beforeUseTextRef);
+ if ((_curObject.beforeUseTextRef > 0) && (_curObject.code != 154))
+ drawText(_curObject.beforeUseTextRef);
} break;
default:
drawText(1022 + Random(11));
@@ -3436,116 +3332,117 @@ void useScreenObject() {
}
oldGridX = 0;
oldGridY = 0;
- actionCode = 0;
+ _actionCode = 0;
checkMouseGrid();
}
-void openScreenObject() {
+void TotEngine::openScreenObject() {
byte xIndex, yIndex;
bool shouldSpeak; //Whether the character should speak to reject the action or not
- uint mouseX = (mouseClickX + 7) / xGridCount;
- uint mouseY = (mouseClickY + 7) / yGridCount;
- uint screenObject = currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[mouseX][mouseY]]->fileIndex;
+ Common::Point p = _mouse->getClickCoordsWithinGrid();
+ uint correctedMouseX = p.x;
+ uint correctedMouseY = p.y;
+ uint screenObject = _currentRoomData->screenObjectIndex[_currentRoomData->mouseGrid[correctedMouseX][correctedMouseY]]->fileIndex;
if (screenObject == 0)
return;
readItemRegister(screenObject);
- debug("Read screen object = %s, with code = %d, depth=%d", regobj.name.c_str(), regobj.code, regobj.depth);
- goToObject(currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount],
- currentRoomData->walkAreasGrid[mouseX][mouseY]);
+ debug("Read screen object = %s, with code = %d, depth=%d", _curObject.name.c_str(), _curObject.code, _curObject.depth);
+ goToObject(_currentRoomData->walkAreasGrid[(_characterPosX + kCharacterCorrectionX) / kXGridCount][(_characterPosY + kCharacerCorrectionY) / kYGridCount],
+ _currentRoomData->walkAreasGrid[correctedMouseX][correctedMouseY]);
- if (regobj.openable == false) {
+ if (_curObject.openable == false) {
drawText(Random(9) + 1059);
return;
} else {
shouldSpeak = false;
- switch (regobj.code) {
+ switch (_curObject.code) {
case 227:
- if (isCupboardOpen == false)
+ if (_isCupboardOpen == false)
shouldSpeak = true;
break;
case 274:
- if (isChestOpen == false)
+ if (_isChestOpen == false)
shouldSpeak = true;
break;
case 415:
- if (currentRoomData->doors[2].openclosed == 2)
+ if (_currentRoomData->doors[2].openclosed == 2)
shouldSpeak = true;
else {
- g_engine->_mouseManager->hide();
+ _mouse->hide();
animatePickup1(0, 1);
- screenLayers[regobj.depth - 1] = NULL;
+ _screenLayers[_curObject.depth - 1] = NULL;
yIndex = 0;
- while (currentRoomData->screenLayers[yIndex].depth != regobj.depth && yIndex != 15) {
+ while (_currentRoomData->screenLayers[yIndex].depth != _curObject.depth && yIndex != 15) {
yIndex++;
}
- debug("changing bitmap at %d, with depth = %d", yIndex, currentRoomData->screenLayers[yIndex].depth);
- currentRoomData->screenLayers[yIndex].bitmapPointer = 0;
- currentRoomData->screenLayers[yIndex].bitmapSize = 0;
- currentRoomData->screenLayers[yIndex].coordx = 0;
- currentRoomData->screenLayers[yIndex].coordy = 0;
- currentRoomData->screenLayers[yIndex].depth = 0;
- currentRoomData->doors[2].openclosed = 1;
- g_engine->_graphics->restoreBackground();
+ debug("changing bitmap at %d, with depth = %d", yIndex, _currentRoomData->screenLayers[yIndex].depth);
+ _currentRoomData->screenLayers[yIndex].bitmapPointer = 0;
+ _currentRoomData->screenLayers[yIndex].bitmapSize = 0;
+ _currentRoomData->screenLayers[yIndex].coordx = 0;
+ _currentRoomData->screenLayers[yIndex].coordy = 0;
+ _currentRoomData->screenLayers[yIndex].depth = 0;
+ _currentRoomData->doors[2].openclosed = 1;
+ _graphics->restoreBackground();
assembleScreen();
- g_engine->_graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(sceneBackground);
animateOpen2(0, 1);
- g_engine->_mouseManager->show();
+ _mouse->show();
for (yIndex = 0; yIndex <= 12; yIndex++)
for (xIndex = 33; xIndex <= 36; xIndex++)
- currentRoomData->mouseGrid[xIndex][yIndex] = 43;
+ _currentRoomData->mouseGrid[xIndex][yIndex] = 43;
for (xIndex = 33; xIndex <= 35; xIndex++)
- currentRoomData->mouseGrid[xIndex][13] = 43;
- actionCode = 0;
+ _currentRoomData->mouseGrid[xIndex][13] = 43;
+ _actionCode = 0;
oldGridX = 0;
oldGridY = 0;
- oldTargetZone = 0;
+ _oldTargetZone = 0;
checkMouseGrid();
return;
}
break;
case 548:
- if (currentRoomData->doors[0].openclosed == 2)
+ if (_currentRoomData->doors[0].openclosed == 2)
shouldSpeak = true;
else {
- g_engine->_mouseManager->hide();
+ _mouse->hide();
animatePickup1(1, 1);
- screenLayers[regobj.depth - 1] = NULL;
+ _screenLayers[_curObject.depth - 1] = NULL;
yIndex = 0;
- while (currentRoomData->screenLayers[yIndex].depth != regobj.depth && yIndex != 14) {
+ while (_currentRoomData->screenLayers[yIndex].depth != _curObject.depth && yIndex != 14) {
yIndex++;
}
- currentRoomData->screenLayers[yIndex].bitmapPointer = 0;
- currentRoomData->screenLayers[yIndex].bitmapSize = 0;
- currentRoomData->screenLayers[yIndex].coordx = 0;
- currentRoomData->screenLayers[yIndex].coordy = 0;
- currentRoomData->screenLayers[yIndex].depth = 0;
- currentRoomData->doors[0].openclosed = 1;
- g_engine->_graphics->restoreBackground();
+ _currentRoomData->screenLayers[yIndex].bitmapPointer = 0;
+ _currentRoomData->screenLayers[yIndex].bitmapSize = 0;
+ _currentRoomData->screenLayers[yIndex].coordx = 0;
+ _currentRoomData->screenLayers[yIndex].coordy = 0;
+ _currentRoomData->screenLayers[yIndex].depth = 0;
+ _currentRoomData->doors[0].openclosed = 1;
+ _graphics->restoreBackground();
assembleScreen();
- g_engine->_graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(sceneBackground);
animateOpen2(1, 1);
- g_engine->_mouseManager->show();
+ _mouse->show();
xIndex = 30;
for (yIndex = 17; yIndex <= 18; yIndex++)
- currentRoomData->mouseGrid[xIndex][yIndex] = 8;
+ _currentRoomData->mouseGrid[xIndex][yIndex] = 8;
xIndex += 1;
for (yIndex = 4; yIndex <= 20; yIndex++)
- currentRoomData->mouseGrid[xIndex][yIndex] = 8;
+ _currentRoomData->mouseGrid[xIndex][yIndex] = 8;
xIndex += 1;
for (yIndex = 0; yIndex <= 20; yIndex++)
- currentRoomData->mouseGrid[xIndex][yIndex] = 8;
+ _currentRoomData->mouseGrid[xIndex][yIndex] = 8;
xIndex += 1;
for (yIndex = 0; yIndex <= 17; yIndex++)
- currentRoomData->mouseGrid[xIndex][yIndex] = 8;
+ _currentRoomData->mouseGrid[xIndex][yIndex] = 8;
xIndex += 1;
for (yIndex = 0; yIndex <= 12; yIndex++)
- currentRoomData->mouseGrid[xIndex][yIndex] = 8;
+ _currentRoomData->mouseGrid[xIndex][yIndex] = 8;
for (xIndex = 35; xIndex <= 39; xIndex++)
for (yIndex = 0; yIndex <= 10; yIndex++)
- currentRoomData->mouseGrid[xIndex][yIndex] = 8;
- actionCode = 0;
+ _currentRoomData->mouseGrid[xIndex][yIndex] = 8;
+ _actionCode = 0;
oldGridX = 0;
oldGridY = 0;
checkMouseGrid();
@@ -3557,71 +3454,71 @@ void openScreenObject() {
drawText(Random(9) + 1059);
return;
}
- currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[mouseX][mouseY]]->fileIndex = regobj.replaceWith;
- g_engine->_mouseManager->hide();
- switch (regobj.height) {
+ _currentRoomData->screenObjectIndex[_currentRoomData->mouseGrid[correctedMouseX][correctedMouseY]]->fileIndex = _curObject.replaceWith;
+ _mouse->hide();
+ switch (_curObject.height) {
case 0: {
- animatePickup1(charFacingDirection, 0);
+ animatePickup1(_charFacingDirection, 0);
updateVideo();
- animateOpen2(charFacingDirection, 0);
+ animateOpen2(_charFacingDirection, 0);
} break;
case 1: {
- animatePickup1(charFacingDirection, 1);
+ animatePickup1(_charFacingDirection, 1);
updateVideo();
- animateOpen2(charFacingDirection, 1);
+ animateOpen2(_charFacingDirection, 1);
} break;
case 2: {
- animatePickup1(charFacingDirection, 2);
+ animatePickup1(_charFacingDirection, 2);
updateVideo();
- animateOpen2(charFacingDirection, 2);
+ animateOpen2(_charFacingDirection, 2);
} break;
}
- g_engine->_mouseManager->show();
- for (yIndex = regobj.ygrid1; yIndex <= regobj.ygrid2; yIndex++)
- for (xIndex = regobj.xgrid1; xIndex <= regobj.xgrid2; xIndex++) {
- currentRoomData->walkAreasGrid[xIndex][yIndex] = regobj.walkAreasPatch[xIndex - regobj.xgrid1][yIndex - regobj.ygrid1];
- currentRoomData->mouseGrid[xIndex][yIndex] = regobj.mouseGridPatch[xIndex - regobj.xgrid1][yIndex - regobj.ygrid1];
+ _mouse->show();
+ for (yIndex = _curObject.ygrid1; yIndex <= _curObject.ygrid2; yIndex++)
+ for (xIndex = _curObject.xgrid1; xIndex <= _curObject.xgrid2; xIndex++) {
+ _currentRoomData->walkAreasGrid[xIndex][yIndex] = _curObject.walkAreasPatch[xIndex - _curObject.xgrid1][yIndex - _curObject.ygrid1];
+ _currentRoomData->mouseGrid[xIndex][yIndex] = _curObject.mouseGridPatch[xIndex - _curObject.xgrid1][yIndex - _curObject.ygrid1];
}
for (xIndex = 0; xIndex < 15; xIndex++)
- if (currentRoomData->screenLayers[xIndex].bitmapPointer == regobj.bitmapPointer) {
- currentRoomData->screenLayers[xIndex].bitmapPointer = regobj.dropOverlay;
- currentRoomData->screenLayers[xIndex].bitmapSize = regobj.dropOverlaySize;
+ if (_currentRoomData->screenLayers[xIndex].bitmapPointer == _curObject.bitmapPointer) {
+ _currentRoomData->screenLayers[xIndex].bitmapPointer = _curObject.dropOverlay;
+ _currentRoomData->screenLayers[xIndex].bitmapSize = _curObject.dropOverlaySize;
}
- actionCode = 0;
+ _actionCode = 0;
}
oldGridX = 0;
oldGridY = 0;
checkMouseGrid();
}
-void closeScreenObject() {
+void TotEngine::closeScreenObject() {
byte xIndex, yIndex;
bool shouldSpeak;
uint sceneObject;
-
- byte mouseX = (mouseClickX + 7) / xGridCount;
- byte mouseY = (mouseClickY + 7) / yGridCount;
- sceneObject = currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[mouseX][mouseY]]->fileIndex;
+ Common::Point p = _mouse->getClickCoordsWithinGrid();
+ uint correctedMouseX = p.x;
+ uint correctedMouseY = p.y;
+ sceneObject = _currentRoomData->screenObjectIndex[_currentRoomData->mouseGrid[correctedMouseX][correctedMouseY]]->fileIndex;
if (sceneObject == 0)
return;
// verifyCopyProtection2();
readItemRegister(sceneObject);
- goToObject(currentRoomData->walkAreasGrid[((characterPosX + characterCorrectionX) / xGridCount)][((characterPosY + characerCorrectionY) / yGridCount)],
- currentRoomData->walkAreasGrid[mouseX][mouseY]);
- if (regobj.closeable == false) {
+ goToObject(_currentRoomData->walkAreasGrid[((_characterPosX + kCharacterCorrectionX) / kXGridCount)][((_characterPosY + kCharacerCorrectionY) / kYGridCount)],
+ _currentRoomData->walkAreasGrid[correctedMouseX][correctedMouseY]);
+ if (_curObject.closeable == false) {
drawText((Random(10) + 1068));
return;
} else {
shouldSpeak = false;
- switch (regobj.code) {
+ switch (_curObject.code) {
case 224:
case 226:
- if (isCupboardOpen == false)
+ if (_isCupboardOpen == false)
shouldSpeak = true;
break;
case 275:
case 277:
- if (isChestOpen == false)
+ if (_isChestOpen == false)
shouldSpeak = true;
break;
}
@@ -3629,47 +3526,47 @@ void closeScreenObject() {
drawText(Random(10) + 1068);
return;
}
- currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[mouseX][mouseY]]->fileIndex = regobj.replaceWith;
- g_engine->_mouseManager->hide();
- switch (regobj.height) {
+ _currentRoomData->screenObjectIndex[_currentRoomData->mouseGrid[correctedMouseX][correctedMouseY]]->fileIndex = _curObject.replaceWith;
+ _mouse->hide();
+ switch (_curObject.height) {
case 0: {
- animatePickup1(charFacingDirection, 0);
+ animatePickup1(_charFacingDirection, 0);
updateVideo();
- animateOpen2(charFacingDirection, 0);
+ animateOpen2(_charFacingDirection, 0);
} break;
case 1: {
- animatePickup1(charFacingDirection, 1);
+ animatePickup1(_charFacingDirection, 1);
updateVideo();
- animateOpen2(charFacingDirection, 1);
+ animateOpen2(_charFacingDirection, 1);
} break;
case 2: {
- animatePickup1(charFacingDirection, 2);
+ animatePickup1(_charFacingDirection, 2);
updateVideo();
- animateOpen2(charFacingDirection, 2);
+ animateOpen2(_charFacingDirection, 2);
} break;
}
- g_engine->_mouseManager->show();
- for (yIndex = regobj.ygrid1; yIndex <= regobj.ygrid2; yIndex++)
- for (xIndex = regobj.xgrid1; xIndex <= regobj.xgrid2; xIndex++) {
- currentRoomData->walkAreasGrid[xIndex][yIndex] = regobj.walkAreasPatch[xIndex - regobj.xgrid1][yIndex - regobj.ygrid1];
- currentRoomData->mouseGrid[xIndex][yIndex] = regobj.mouseGridPatch[xIndex - regobj.xgrid1][yIndex - regobj.ygrid1];
+ _mouse->show();
+ for (yIndex = _curObject.ygrid1; yIndex <= _curObject.ygrid2; yIndex++)
+ for (xIndex = _curObject.xgrid1; xIndex <= _curObject.xgrid2; xIndex++) {
+ _currentRoomData->walkAreasGrid[xIndex][yIndex] = _curObject.walkAreasPatch[xIndex - _curObject.xgrid1][yIndex - _curObject.ygrid1];
+ _currentRoomData->mouseGrid[xIndex][yIndex] = _curObject.mouseGridPatch[xIndex - _curObject.xgrid1][yIndex - _curObject.ygrid1];
}
for (xIndex = 0; xIndex < 15; xIndex++)
- if (currentRoomData->screenLayers[xIndex].bitmapPointer == regobj.bitmapPointer) {
- currentRoomData->screenLayers[xIndex].bitmapPointer = regobj.dropOverlay;
- currentRoomData->screenLayers[xIndex].bitmapSize = regobj.dropOverlaySize;
+ if (_currentRoomData->screenLayers[xIndex].bitmapPointer == _curObject.bitmapPointer) {
+ _currentRoomData->screenLayers[xIndex].bitmapPointer = _curObject.dropOverlay;
+ _currentRoomData->screenLayers[xIndex].bitmapSize = _curObject.dropOverlaySize;
}
- actionCode = 0;
+ _actionCode = 0;
}
oldGridX = 0;
oldGridY = 0;
checkMouseGrid();
}
-void action() {
+void TotEngine::action() {
bar(0, 140, 319, 149, 0);
Common::String actionLine;
- switch (actionCode) {
+ switch (_actionCode) {
case 0:
actionLine = getActionLineText(0);
break;
@@ -3684,7 +3581,7 @@ void action() {
break;
case 4: {
actionLine = getActionLineText(4);
- inventoryObjectName = "";
+ _inventoryObjectName = "";
} break;
case 5:
actionLine = getActionLineText(5);
@@ -3696,79 +3593,79 @@ void action() {
actionLineText(actionLine);
}
-void handleAction(byte posinv) {
+void TotEngine::handleAction(byte invPos) {
bar(0, 140, 319, 149, 0);
- switch (actionCode) {
+ switch (_actionCode) {
case 1: {
- g_engine->_mouseManager->hide();
- actionLineText(getActionLineText(1) + inventory[posinv].objectName);
- g_engine->_mouseManager->show();
+ _mouse->hide();
+ actionLineText(getActionLineText(1) + _inventory[invPos].objectName);
+ _mouse->show();
drawText((Random(10) + 1039));
- actionCode = 0;
- if (cpCounter > 130)
+ _actionCode = 0;
+ if (_cpCounter > 130)
showError(274);
oldGridX = 0;
oldGridY = 0;
checkMouseGrid();
} break;
case 2: {
- g_engine->_mouseManager->hide();
- actionLineText(getActionLineText(2) + inventory[posinv].objectName);
- if (cpCounter2 > 13)
+ _mouse->hide();
+ actionLineText(getActionLineText(2) + _inventory[invPos].objectName);
+ if (_cpCounter2 > 13)
showError(274);
- g_engine->_mouseManager->show();
+ _mouse->show();
drawText((Random(10) + 1049));
- actionCode = 0;
+ _actionCode = 0;
oldGridX = 0;
oldGridY = 0;
checkMouseGrid();
} break;
case 3: {
- g_engine->_mouseManager->hide();
- actionLineText(getActionLineText(3) + inventory[posinv].objectName);
- g_engine->_mouseManager->show();
- actionCode = 0;
- lookAtObject(posinv);
+ _mouse->hide();
+ actionLineText(getActionLineText(3) + _inventory[invPos].objectName);
+ _mouse->show();
+ _actionCode = 0;
+ lookAtObject(invPos);
oldGridX = 0;
oldGridY = 0;
checkMouseGrid();
} break;
case 4:
- if (inventoryObjectName == "") {
- g_engine->_mouseManager->hide();
- actionLineText(getActionLineText(4) + inventory[posinv].objectName + getActionLineText(7));
- g_engine->_mouseManager->show();
- inventoryObjectName = inventory[posinv].objectName;
- backpackObjectCode = inventory[posinv].code;
+ if (_inventoryObjectName == "") {
+ _mouse->hide();
+ actionLineText(getActionLineText(4) + _inventory[invPos].objectName + getActionLineText(7));
+ _mouse->show();
+ _inventoryObjectName = _inventory[invPos].objectName;
+ _backpackObjectCode = _inventory[invPos].code;
} else {
- actionCode = 0;
- if (cpCounter > 25)
+ _actionCode = 0;
+ if (_cpCounter > 25)
showError(274);
- useInventoryObjectWithInventoryObject(backpackObjectCode, inventory[posinv].code);
+ useInventoryObjectWithInventoryObject(_backpackObjectCode, _inventory[invPos].code);
oldGridX = 0;
oldGridY = 0;
checkMouseGrid();
}
break;
case 5: {
- g_engine->_mouseManager->hide();
- actionLineText(getActionLineText(5) + inventory[posinv].objectName);
- g_engine->_mouseManager->show();
+ _mouse->hide();
+ actionLineText(getActionLineText(5) + _inventory[invPos].objectName);
+ _mouse->show();
drawText(Random(9) + 1059);
- actionCode = 0;
+ _actionCode = 0;
oldGridX = 0;
oldGridY = 0;
checkMouseGrid();
} break;
case 6: {
- g_engine->_mouseManager->hide();
- actionLineText(getActionLineText(6) + inventory[posinv].objectName);
- g_engine->_mouseManager->show();
+ _mouse->hide();
+ actionLineText(getActionLineText(6) + _inventory[invPos].objectName);
+ _mouse->show();
drawText(Random(10) + 1068);
- actionCode = 0;
- if (cpCounter2 > 35)
+ _actionCode = 0;
+ if (_cpCounter2 > 35)
showError(274);
oldGridX = 0;
oldGridY = 0;
@@ -3777,10 +3674,10 @@ void handleAction(byte posinv) {
}
}
-void loadObjects() {
+void TotEngine::loadObjects() {
Common::File objectFile;
- switch (gamePart) {
+ switch (_gamePart) {
case 1:
objectFile.open("OBJMOCH.DAT");
break;
@@ -3791,37 +3688,37 @@ void loadObjects() {
if (!objectFile.isOpen())
showError(312);
- for (int i = 0; i < inventoryIconCount; i++) {
- inventoryIconBitmaps[i] = (byte *)malloc(inventoryIconSize);
- objectFile.read(inventoryIconBitmaps[i], inventoryIconSize);
+ for (int i = 0; i < kInventoryIconCount; i++) {
+ _inventoryIconBitmaps[i] = (byte *)malloc(kInventoryIconSize);
+ objectFile.read(_inventoryIconBitmaps[i], kInventoryIconSize);
}
- if (cpCounter > 65)
+ if (_cpCounter > 65)
showError(274);
- const char *emptyName = (g_engine->_lang == Common::ES_ESP) ? hardcodedObjects_ES[10] : hardcodedObjects_EN[10];
- for (int i = 0; i < inventoryIconCount; i++) {
- inventory[i].bitmapIndex = 34;
- inventory[i].code = 0;
- inventory[i].objectName = emptyName;
+ const char *emptyName = (_lang == Common::ES_ESP) ? hardcodedObjects_ES[10] : hardcodedObjects_EN[10];
+ for (int i = 0; i < kInventoryIconCount; i++) {
+ _inventory[i].bitmapIndex = 34;
+ _inventory[i].code = 0;
+ _inventory[i].objectName = emptyName;
}
objectFile.close();
debug("Successfully read objects!");
}
-void obtainName(Common::String &playerName) {
+void TotEngine::obtainName(Common::String &playerName) {
uint16 namePromptBGSize;
byte *namePromptBG;
namePromptBGSize = imagesize(84, 34, 235, 80);
namePromptBG = (byte *)malloc(namePromptBGSize);
- g_engine->_graphics->getImg(84, 34, 235, 80, namePromptBG);
+ _graphics->getImg(84, 34, 235, 80, namePromptBG);
drawMenu(8);
- g_engine->_screen->update();
+ _screen->update();
Common::String prompt;
readAlphaGraph(prompt, 8, 125, 62, 252);
playerName = prompt.c_str();
- g_engine->_graphics->putImg(84, 34, namePromptBG);
- g_engine->_screen->update();
+ _graphics->putImg(84, 34, namePromptBG);
+ _screen->update();
free(namePromptBG);
}
@@ -3855,12 +3752,12 @@ static void getScreen(byte *bg) {
Common::copy(screenBuf, screenBuf + (22400 * 2), bg + 4);
}
-static void scrollRight(uint &horizontalPos) {
+void TotEngine::scrollRight(uint &horizontalPos) {
- int characterPos = 25 + (320 - (characterPosX + characterCorrectionX * 2));
+ int characterPos = 25 + (320 - (_characterPosX + kCharacterCorrectionX * 2));
// We scroll 4 by 4 pixels so we divide by 4 to find out the number of necessary steps
uint stepCount = (320 - horizontalPos) >> 2;
- byte *assembledCharacterFrame = (byte *)malloc(mainCharFrameSize);
+ byte *assembledCharacterFrame = (byte *)malloc(_mainCharFrameSize);
// Number of bytes to move
size_t numBytes = 44796;
for (int i = 0; i < stepCount; i++) {
@@ -3875,45 +3772,45 @@ static void scrollRight(uint &horizontalPos) {
}
if (characterPos > 0) {
characterPos -= 2;
- if (characterPos > 0 && iframe < 15) {
- iframe++;
+ if (characterPos > 0 && _iframe < 15) {
+ _iframe++;
} else
- iframe = 0;
+ _iframe = 0;
- characterPosX -= 2;
+ _characterPosX -= 2;
- curCharacterAnimationFrame = mainCharAnimation.bitmap[1][iframe];
+ _curCharacterAnimationFrame = _mainCharAnimation.bitmap[1][_iframe];
// We need to copy the original frame as to not replace its black background for after
// the scroll ends. Original code would copy from XMS memory.
- Common::copy(curCharacterAnimationFrame, curCharacterAnimationFrame + mainCharFrameSize, assembledCharacterFrame);
+ Common::copy(_curCharacterAnimationFrame, _curCharacterAnimationFrame + _mainCharFrameSize, assembledCharacterFrame);
// puts the original captured background back in the background for next iteration
- g_engine->_graphics->putImageArea(characterPosX - 2, characterPosY, sceneBackground, spriteBackground);
+ _graphics->putImageArea(_characterPosX - 2, _characterPosY, sceneBackground, spriteBackground);
uint16 pasoframeW = READ_LE_UINT16(assembledCharacterFrame);
uint16 pasoframeH = READ_LE_UINT16(assembledCharacterFrame + 2);
// Grabs current area surrounding character (which might contain parts of A and B)
- g_engine->_graphics->getImageArea(characterPosX, characterPosY, characterPosX + pasoframeW, characterPosY + pasoframeH, sceneBackground, spriteBackground);
+ _graphics->getImageArea(_characterPosX, _characterPosY, _characterPosX + pasoframeW, _characterPosY + pasoframeH, sceneBackground, spriteBackground);
// blits over the character sprite, only on black pixels
blit(spriteBackground, assembledCharacterFrame);
// puts it back in the background (character + piece of background)
- g_engine->_graphics->putImageArea(characterPosX, characterPosY, sceneBackground, assembledCharacterFrame);
+ _graphics->putImageArea(_characterPosX, _characterPosY, sceneBackground, assembledCharacterFrame);
} else
- characterPosX -= 4;
- g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
- g_engine->_screen->update();
- g_engine->_graphics->drawScreen(sceneBackground);
+ _characterPosX -= 4;
+ _screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
+ _screen->update();
+ _graphics->drawScreen(sceneBackground);
}
free(assembledCharacterFrame);
}
-static void scrollLeft(uint &horizontalPos) {
+void TotEngine::scrollLeft(uint &horizontalPos) {
- int characterPos = 25 + characterPosX;
+ int characterPos = 25 + _characterPosX;
horizontalPos = 320 - horizontalPos;
// We scroll 4 by 4 pixels so we divide by 4 to find out the number of necessary steps
uint stepCount = horizontalPos >> 2;
- byte *assembledCharacterFrame = (byte *)malloc(mainCharFrameSize);
+ byte *assembledCharacterFrame = (byte *)malloc(_mainCharFrameSize);
size_t numBytes = 44796;
for (int i = stepCount; i >= 1; i--) {
for (int j = numBytes; j > 0; j--) {
@@ -3930,30 +3827,30 @@ static void scrollLeft(uint &horizontalPos) {
if (characterPos > 0) {
characterPos -= 2;
- if (characterPos > 0 && iframe < 15)
- iframe++;
+ if (characterPos > 0 && _iframe < 15)
+ _iframe++;
else
- iframe = 0;
+ _iframe = 0;
- characterPosX += 2;
+ _characterPosX += 2;
- curCharacterAnimationFrame = mainCharAnimation.bitmap[3][iframe];
- Common::copy(curCharacterAnimationFrame, curCharacterAnimationFrame + mainCharFrameSize, assembledCharacterFrame);
+ _curCharacterAnimationFrame = _mainCharAnimation.bitmap[3][_iframe];
+ Common::copy(_curCharacterAnimationFrame, _curCharacterAnimationFrame + _mainCharFrameSize, assembledCharacterFrame);
- g_engine->_graphics->putImageArea(characterPosX + 2, characterPosY, sceneBackground, spriteBackground);
+ _graphics->putImageArea(_characterPosX + 2, _characterPosY, sceneBackground, spriteBackground);
uint16 pasoframeW = READ_LE_UINT16(assembledCharacterFrame);
uint16 pasoframeH = READ_LE_UINT16(assembledCharacterFrame + 2);
- g_engine->_graphics->getImageArea(characterPosX, characterPosY, characterPosX + pasoframeW, characterPosY + pasoframeH, sceneBackground, spriteBackground);
+ _graphics->getImageArea(_characterPosX, _characterPosY, _characterPosX + pasoframeW, _characterPosY + pasoframeH, sceneBackground, spriteBackground);
blit(spriteBackground, assembledCharacterFrame);
- g_engine->_graphics->putImageArea(characterPosX, characterPosY, sceneBackground, assembledCharacterFrame);
+ _graphics->putImageArea(_characterPosX, _characterPosY, sceneBackground, assembledCharacterFrame);
} else
- characterPosX += 4;
+ _characterPosX += 4;
- g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
- g_engine->_screen->update();
- g_engine->_graphics->drawScreen(sceneBackground);
+ _screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
+ _screen->update();
+ _graphics->drawScreen(sceneBackground);
}
free(assembledCharacterFrame);
}
@@ -3962,28 +3859,28 @@ static void scrollLeft(uint &horizontalPos) {
* Scrolling happens between two screens. We grab the area surroudning the player from screen A,
* then transition to screen B.
*/
-void loadScrollData(uint roomCode, bool rightScroll, uint horizontalPos, int scrollCorrection) {
+void TotEngine::loadScrollData(uint roomCode, bool rightScroll, uint horizontalPos, int scrollCorrection) {
- g_engine->_graphics->restoreBackground();
+ _graphics->restoreBackground();
// background now contains background A, backgroundCopy contains background A
- uint characterFrameW = READ_LE_UINT16(curCharacterAnimationFrame);
- uint characterFrameH = READ_LE_UINT16(curCharacterAnimationFrame + 2);
- debug("characterPos=%d,%d, size=%d,%d", characterPosX, characterPosY, characterFrameW, characterFrameH);
+ uint characterFrameW = READ_LE_UINT16(_curCharacterAnimationFrame);
+ uint characterFrameH = READ_LE_UINT16(_curCharacterAnimationFrame + 2);
+ debug("characterPos=%d,%d, size=%d,%d", _characterPosX, _characterPosY, characterFrameW, characterFrameH);
/* Copy the area with the player from previous scren*/
spriteBackground = (byte *)malloc(4 + (characterFrameW + 8) * (characterFrameH + 8));
- g_engine->_graphics->getImageArea(characterPosX, characterPosY, characterPosX + characterFrameW, characterPosY + characterFrameH, sceneBackground, spriteBackground);
+ _graphics->getImageArea(_characterPosX, _characterPosY, _characterPosX + characterFrameW, _characterPosY + characterFrameH, sceneBackground, spriteBackground);
// Start screen 2
- rooms->seek(roomCode * roomRegSize, SEEK_SET);
- currentRoomData = readScreenDataFile(rooms);
+ _rooms->seek(roomCode * kRoomRegSize, SEEK_SET);
+ _currentRoomData = readScreenDataFile(_rooms);
loadScreen();
// Background now contains background B, backgroundCopy contains background B
for (int i = 0; i < 15; i++) {
{
- RoomBitmapRegister &with = currentRoomData->screenLayers[i];
+ RoomBitmapRegister &with = _currentRoomData->screenLayers[i];
if (with.bitmapSize > 0)
loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
@@ -3996,11 +3893,11 @@ void loadScrollData(uint roomCode, bool rightScroll, uint horizontalPos, int scr
Common::copy(sceneBackground, sceneBackground + 44804, backgroundCopy);
// background contains background B + objects, backgroundCopy contains background B + objects
- isPaletteAnimEnabled = 0;
+ g_engine->_graphics->_paletteAnimFrame = 0;
getScreen(sceneBackground);
// background now contains full background A again, backgroundCopy contains background B + objects
- g_engine->_graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(sceneBackground);
if (rightScroll)
scrollRight(horizontalPos);
else
@@ -4009,287 +3906,286 @@ void loadScrollData(uint roomCode, bool rightScroll, uint horizontalPos, int scr
// After scroll is done, backgroundCopy will now contain the resulting background (background B + objects)
Common::copy(backgroundCopy, backgroundCopy + 44804, sceneBackground);
- characterPosX += scrollCorrection;
+ _characterPosX += scrollCorrection;
assembleScreen();
- g_engine->_graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(sceneBackground);
free(spriteBackground);
loadScreen();
- trajectory[currentTrajectoryIndex].x = characterPosX;
- trajectory[currentTrajectoryIndex].y = characterPosY;
+ _trajectory[_currentTrajectoryIndex].x = _characterPosX;
+ _trajectory[_currentTrajectoryIndex].y = _characterPosY;
}
-void saveGameToRegister() {
- savedGame.roomCode = currentRoomData->code;
- savedGame.trajectoryLength = trajectoryLength;
- savedGame.currentTrajectoryIndex = currentTrajectoryIndex;
- savedGame.backpackObjectCode = backpackObjectCode;
- savedGame.rightSfxVol = rightSfxVol;
- savedGame.leftSfxVol = leftSfxVol;
- savedGame.musicVolRight = musicVolRight;
- savedGame.musicVolLeft = musicVolLeft;
+void TotEngine::saveGameToRegister() {
+ savedGame.roomCode = _currentRoomData->code;
+ savedGame.trajectoryLength = _trajectoryLength;
+ savedGame.currentTrajectoryIndex = _currentTrajectoryIndex;
+ savedGame.backpackObjectCode = _backpackObjectCode;
+ savedGame.rightSfxVol = _sound->_rightSfxVol;
+ savedGame.leftSfxVol = _sound->_leftSfxVol;
+ savedGame.musicVolRight = _sound->_musicVolRight;
+ savedGame.musicVolLeft = _sound->_musicVolLeft;
savedGame.oldGridX = oldGridX;
savedGame.oldGridY = oldGridY;
- savedGame.secAnimDepth = secondaryAnimation.depth;
- savedGame.secAnimDir = secondaryAnimation.dir;
- savedGame.secAnimX = secondaryAnimation.posx;
- savedGame.secAnimY = secondaryAnimation.posy;
- savedGame.secAnimIFrame = iframe2;
-
- savedGame.currentZone = currentZone;
- savedGame.targetZone = targetZone;
- savedGame.oldTargetZone = oldTargetZone;
- savedGame.inventoryPosition = inventoryPosition;
- savedGame.actionCode = actionCode;
- savedGame.oldActionCode = oldActionCode;
- savedGame.steps = steps;
- savedGame.doorIndex = doorIndex;
- savedGame.characterFacingDir = charFacingDirection;
- savedGame.iframe = iframe;
- savedGame.gamePart = gamePart;
-
- savedGame.isSealRemoved = isSealRemoved;
- savedGame.obtainedList1 = obtainedList1;
- savedGame.obtainedList2 = obtainedList2;
- savedGame.list1Complete = list1Complete;
- savedGame.list2Complete = list2Complete;
- savedGame.isVasePlaced = isVasePlaced;
- savedGame.isScytheTaken = isScytheTaken;
- savedGame.isTridentTaken = isTridentTaken;
- savedGame.isPottersWheelDelivered = isPottersWheelDelivered;
- savedGame.isMudDelivered = isMudDelivered;
- savedGame.isGreenDevilDelivered = isGreenDevilDelivered;
- savedGame.isRedDevilCaptured = isRedDevilCaptured;
- savedGame.isPottersManualDelivered = isPottersManualDelivered;
- savedGame.isCupboardOpen = isCupboardOpen;
- savedGame.isChestOpen = isChestOpen;
- savedGame.isTVOn = isTVOn;
- savedGame.isTrapSet = isTrapSet;
-
- for (int i = 0; i < inventoryIconCount; i++) {
- savedGame.mobj[i].bitmapIndex = inventory[i].bitmapIndex;
- savedGame.mobj[i].code = inventory[i].code;
- savedGame.mobj[i].objectName = inventory[i].objectName;
+ savedGame.secAnimDepth = _secondaryAnimation.depth;
+ savedGame.secAnimDir = _secondaryAnimation.dir;
+ savedGame.secAnimX = _secondaryAnimation.posx;
+ savedGame.secAnimY = _secondaryAnimation.posy;
+ savedGame.secAnimIFrame = _iframe2;
+
+ savedGame.currentZone = _currentZone;
+ savedGame.targetZone = _targetZone;
+ savedGame.oldTargetZone = _oldTargetZone;
+ savedGame.inventoryPosition = _inventoryPosition;
+ savedGame.actionCode = _actionCode;
+ savedGame.oldActionCode = _oldActionCode;
+ savedGame.steps = _trajectorySteps;
+ savedGame.doorIndex = _doorIndex;
+ savedGame.characterFacingDir = _charFacingDirection;
+ savedGame.iframe = _iframe;
+ savedGame.gamePart = _gamePart;
+
+ savedGame.isSealRemoved = _isSealRemoved;
+ savedGame.obtainedList1 = _obtainedList1;
+ savedGame.obtainedList2 = _obtainedList2;
+ savedGame.list1Complete = _list1Complete;
+ savedGame.list2Complete = _list2Complete;
+ savedGame.isVasePlaced = _isVasePlaced;
+ savedGame.isScytheTaken = _isScytheTaken;
+ savedGame.isTridentTaken = _isTridentTaken;
+ savedGame.isPottersWheelDelivered = _isPottersWheelDelivered;
+ savedGame.isMudDelivered = _isMudDelivered;
+ savedGame.isGreenDevilDelivered = _isGreenDevilDelivered;
+ savedGame.isRedDevilCaptured = _isRedDevilCaptured;
+ savedGame.isPottersManualDelivered = _isPottersManualDelivered;
+ savedGame.isCupboardOpen = _isCupboardOpen;
+ savedGame.isChestOpen = _isChestOpen;
+ savedGame.isTVOn = _isTVOn;
+ savedGame.isTrapSet = _isTrapSet;
+
+ for (int i = 0; i < kInventoryIconCount; i++) {
+ savedGame.mobj[i].bitmapIndex = _inventory[i].bitmapIndex;
+ savedGame.mobj[i].code = _inventory[i].code;
+ savedGame.mobj[i].objectName = _inventory[i].objectName;
}
- savedGame.element1 = element1;
- savedGame.element2 = element2;
- savedGame.characterPosX = characterPosX;
- savedGame.characterPosY = characterPosY;
- savedGame.xframe2 = xframe2;
- savedGame.yframe2 = yframe2;
+ savedGame.element1 = _element1;
+ savedGame.element2 = _element2;
+ savedGame.characterPosX = _characterPosX;
+ savedGame.characterPosY = _characterPosY;
+ savedGame.xframe2 = _xframe2;
+ savedGame.yframe2 = _yframe2;
- savedGame.oldInventoryObjectName = oldInventoryObjectName;
- savedGame.objetomoinventoryObjectNamehila = inventoryObjectName;
- savedGame.characterName = characterName;
+ savedGame.oldInventoryObjectName = _oldInventoryObjectName;
+ savedGame.objetomoinventoryObjectNamehila = _inventoryObjectName;
+ savedGame.characterName = _characterName;
- for (int i = 0; i < routePointCount; i++) {
- savedGame.mainRoute[i].x = mainRoute[i].x;
- savedGame.mainRoute[i].y = mainRoute[i].y;
+ for (int i = 0; i < kRoutePointCount; i++) {
+ savedGame.mainRoute[i].x = _mainRoute[i].x;
+ savedGame.mainRoute[i].y = _mainRoute[i].y;
}
for (int i = 0; i < 300; i++) {
- savedGame.trajectory[i].x = trajectory[i].x;
- savedGame.trajectory[i].y = trajectory[i].y;
+ savedGame.trajectory[i].x = _trajectory[i].x;
+ savedGame.trajectory[i].y = _trajectory[i].y;
}
- for (int i = 0; i < characterCount; i++) {
- savedGame.firstTimeTopicA[i] = firstTimeTopicA[i];
- savedGame.firstTimeTopicB[i] = firstTimeTopicB[i];
- savedGame.firstTimeTopicC[i] = firstTimeTopicC[i];
- savedGame.bookTopic[i] = bookTopic[i];
- savedGame.mintTopic[i] = mintTopic[i];
+ for (int i = 0; i < kCharacterCount; i++) {
+ savedGame.firstTimeTopicA[i] = _firstTimeTopicA[i];
+ savedGame.firstTimeTopicB[i] = _firstTimeTopicB[i];
+ savedGame.firstTimeTopicC[i] = _firstTimeTopicC[i];
+ savedGame.bookTopic[i] = _bookTopic[i];
+ savedGame.mintTopic[i] = _mintTopic[i];
}
for (int i = 0; i < 5; i++) {
- savedGame.caves[i] = caves[i];
- savedGame.firstList[i] = firstList[i];
- savedGame.secondList[i] = secondList[i];
+ savedGame.caves[i] = _caves[i];
+ savedGame.firstList[i] = _firstList[i];
+ savedGame.secondList[i] = _secondList[i];
}
for (int i = 0; i < 4; i++) {
- savedGame.niche[0][i] = niche[0][i];
- savedGame.niche[1][i] = niche[1][i];
+ savedGame.niche[0][i] = _niche[0][i];
+ savedGame.niche[1][i] = _niche[1][i];
}
}
-void loadGame(SavedGame game) {
+void TotEngine::loadGame(SavedGame game) {
freeAnimation();
freeScreenObjects();
- transitionEffect = Random(15) + 1;
-
- trajectoryLength = game.trajectoryLength;
- currentTrajectoryIndex = game.currentTrajectoryIndex;
- backpackObjectCode = game.backpackObjectCode;
- rightSfxVol = game.rightSfxVol;
- leftSfxVol = game.leftSfxVol;
- musicVolRight = game.musicVolRight;
- musicVolLeft = game.musicVolLeft;
+
+ _trajectoryLength = game.trajectoryLength;
+ _currentTrajectoryIndex = game.currentTrajectoryIndex;
+ _backpackObjectCode = game.backpackObjectCode;
+ _sound->_rightSfxVol = game.rightSfxVol;
+ _sound->_leftSfxVol = game.leftSfxVol;
+ _sound->_musicVolRight = game.musicVolRight;
+ _sound->_musicVolLeft = game.musicVolLeft;
oldGridX = game.oldGridX;
oldGridY = game.oldGridY;
- secondaryAnimation.depth = game.secAnimDepth;
- secondaryAnimation.dir = game.secAnimDir;
- secondaryAnimation.posx = game.secAnimX;
- secondaryAnimation.posy = game.secAnimY;
- iframe2 = game.secAnimIFrame;
- currentZone = game.currentZone;
- targetZone = game.targetZone;
- oldTargetZone = game.oldTargetZone;
- inventoryPosition = game.inventoryPosition;
- actionCode = game.actionCode;
- oldActionCode = game.oldActionCode;
- steps = game.steps;
- doorIndex = game.doorIndex;
- charFacingDirection = game.characterFacingDir;
- iframe = game.iframe;
- if (game.gamePart != gamePart) {
- gamePart = game.gamePart;
- for (int i = 0; i < inventoryIconCount; i++) {
- free(inventoryIconBitmaps[i]);
+ _secondaryAnimation.depth = game.secAnimDepth;
+ _secondaryAnimation.dir = game.secAnimDir;
+ _secondaryAnimation.posx = game.secAnimX;
+ _secondaryAnimation.posy = game.secAnimY;
+ _iframe2 = game.secAnimIFrame;
+ _currentZone = game.currentZone;
+ _targetZone = game.targetZone;
+ _oldTargetZone = game.oldTargetZone;
+ _inventoryPosition = game.inventoryPosition;
+ _actionCode = game.actionCode;
+ _oldActionCode = game.oldActionCode;
+ _trajectorySteps = game.steps;
+ _doorIndex = game.doorIndex;
+ _charFacingDirection = game.characterFacingDir;
+ _iframe = game.iframe;
+ if (game.gamePart != _gamePart) {
+ _gamePart = game.gamePart;
+ for (int i = 0; i < kInventoryIconCount; i++) {
+ free(_inventoryIconBitmaps[i]);
}
loadObjects();
}
- isSealRemoved = game.isSealRemoved;
- obtainedList1 = game.obtainedList1;
- obtainedList2 = game.obtainedList2;
- list1Complete = game.list1Complete;
- list2Complete = game.list2Complete;
- isVasePlaced = game.isVasePlaced;
- isScytheTaken = game.isScytheTaken;
- if (cpCounter > 24)
+ _isSealRemoved = game.isSealRemoved;
+ _obtainedList1 = game.obtainedList1;
+ _obtainedList2 = game.obtainedList2;
+ _list1Complete = game.list1Complete;
+ _list2Complete = game.list2Complete;
+ _isVasePlaced = game.isVasePlaced;
+ _isScytheTaken = game.isScytheTaken;
+ if (_cpCounter > 24)
showError(274);
- isTridentTaken = game.isTridentTaken;
- isPottersWheelDelivered = game.isPottersWheelDelivered;
- isMudDelivered = game.isMudDelivered;
- isGreenDevilDelivered = game.isGreenDevilDelivered;
- isRedDevilCaptured = game.isRedDevilCaptured;
- isPottersManualDelivered = game.isPottersManualDelivered;
- isCupboardOpen = game.isCupboardOpen;
- isChestOpen = game.isChestOpen;
- isTVOn = game.isTVOn;
- isTrapSet = game.isTrapSet;
- for (int i = 0; i < inventoryIconCount; i++) {
- inventory[i].bitmapIndex = game.mobj[i].bitmapIndex;
- inventory[i].code = game.mobj[i].code;
- inventory[i].objectName = game.mobj[i].objectName;
+ _isTridentTaken = game.isTridentTaken;
+ _isPottersWheelDelivered = game.isPottersWheelDelivered;
+ _isMudDelivered = game.isMudDelivered;
+ _isGreenDevilDelivered = game.isGreenDevilDelivered;
+ _isRedDevilCaptured = game.isRedDevilCaptured;
+ _isPottersManualDelivered = game.isPottersManualDelivered;
+ _isCupboardOpen = game.isCupboardOpen;
+ _isChestOpen = game.isChestOpen;
+ _isTVOn = game.isTVOn;
+ _isTrapSet = game.isTrapSet;
+ for (int i = 0; i < kInventoryIconCount; i++) {
+ _inventory[i].bitmapIndex = game.mobj[i].bitmapIndex;
+ _inventory[i].code = game.mobj[i].code;
+ _inventory[i].objectName = game.mobj[i].objectName;
}
- element1 = game.element1;
- element2 = game.element2;
- characterPosX = game.characterPosX;
- characterPosY = game.characterPosY;
- xframe2 = game.xframe2;
- yframe2 = game.yframe2;
- oldInventoryObjectName = game.oldInventoryObjectName;
- inventoryObjectName = game.objetomoinventoryObjectNamehila;
- characterName = game.characterName;
- for (int i = 0; i < routePointCount; i++) {
- mainRoute[i].x = game.mainRoute[i].x;
- mainRoute[i].y = game.mainRoute[i].y;
+ _element1 = game.element1;
+ _element2 = game.element2;
+ _characterPosX = game.characterPosX;
+ _characterPosY = game.characterPosY;
+ _xframe2 = game.xframe2;
+ _yframe2 = game.yframe2;
+ _oldInventoryObjectName = game.oldInventoryObjectName;
+ _inventoryObjectName = game.objetomoinventoryObjectNamehila;
+ _characterName = game.characterName;
+ for (int i = 0; i < kRoutePointCount; i++) {
+ _mainRoute[i].x = game.mainRoute[i].x;
+ _mainRoute[i].y = game.mainRoute[i].y;
}
for (int indiaux = 0; indiaux < 300; indiaux++) {
- trajectory[indiaux].x = game.trajectory[indiaux].x;
- trajectory[indiaux].y = game.trajectory[indiaux].y;
+ _trajectory[indiaux].x = game.trajectory[indiaux].x;
+ _trajectory[indiaux].y = game.trajectory[indiaux].y;
}
- for (int i = 0; i < characterCount; i++) {
- firstTimeTopicA[i] = game.firstTimeTopicA[i];
- firstTimeTopicB[i] = game.firstTimeTopicB[i];
- firstTimeTopicC[i] = game.firstTimeTopicC[i];
- bookTopic[i] = game.bookTopic[i];
- mintTopic[i] = game.mintTopic[i];
+ for (int i = 0; i < kCharacterCount; i++) {
+ _firstTimeTopicA[i] = game.firstTimeTopicA[i];
+ _firstTimeTopicB[i] = game.firstTimeTopicB[i];
+ _firstTimeTopicC[i] = game.firstTimeTopicC[i];
+ _bookTopic[i] = game.bookTopic[i];
+ _mintTopic[i] = game.mintTopic[i];
}
for (int i = 0; i < 5; i++) {
- caves[i] = game.caves[i];
- firstList[i] = game.firstList[i];
- secondList[i] = game.secondList[i];
+ _caves[i] = game.caves[i];
+ _firstList[i] = game.firstList[i];
+ _secondList[i] = game.secondList[i];
}
for (int i = 0; i < 4; i++) {
- niche[0][i] = game.niche[0][i];
- niche[1][i] = game.niche[1][i];
+ _niche[0][i] = game.niche[0][i];
+ _niche[1][i] = game.niche[1][i];
}
- g_engine->_graphics->totalFadeOut(0);
- g_engine->_screen->clear();
- g_engine->_graphics->loadPaletteFromFile("DEFAULT");
+ _graphics->totalFadeOut(0);
+ _screen->clear();
+ _graphics->loadPaletteFromFile("DEFAULT");
loadScreenData(game.roomCode);
- switch (currentRoomData->code) {
+ switch (_currentRoomData->code) {
case 2: {
- if (isTVOn)
- g_engine->_sound->autoPlayVoc("PARASITO", 355778, 20129);
+ if (_isTVOn)
+ _sound->autoPlayVoc("PARASITO", 355778, 20129);
else
loadTV();
- g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
+ _sound->setSfxVolume(_sound->_leftSfxVol, _sound->_rightSfxVol);
} break;
case 4: {
- g_engine->_sound->loadVoc("GOTA", 140972, 1029);
- g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
+ _sound->loadVoc("GOTA", 140972, 1029);
+ _sound->setSfxVolume(_sound->_leftSfxVol, _sound->_rightSfxVol);
} break;
case 5: {
- g_engine->_sound->setSfxVolume(leftSfxVol, 0);
- g_engine->_sound->autoPlayVoc("CALDERA", 6433, 15386);
+ _sound->setSfxVolume(_sound->_leftSfxVol, 0);
+ _sound->autoPlayVoc("CALDERA", 6433, 15386);
} break;
case 6: {
- g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
- g_engine->_sound->autoPlayVoc("CALDERA", 6433, 15386);
+ _sound->setSfxVolume(_sound->_leftSfxVol, _sound->_rightSfxVol);
+ _sound->autoPlayVoc("CALDERA", 6433, 15386);
} break;
case 17: {
- if (bookTopic[0] == true && currentRoomData->animationFlag)
+ if (_bookTopic[0] == true && _currentRoomData->animationFlag)
disableSecondAnimation();
} break;
case 20: {
- switch (niche[0][niche[0][3]]) {
+ switch (_niche[0][_niche[0][3]]) {
case 0:
- currentRoomData->screenObjectIndex[9]->objectName = getObjectName(4);
+ _currentRoomData->screenObjectIndex[9]->objectName = getObjectName(4);
break;
case 561:
- currentRoomData->screenObjectIndex[9]->objectName = getObjectName(5);
+ _currentRoomData->screenObjectIndex[9]->objectName = getObjectName(5);
break;
case 563:
- currentRoomData->screenObjectIndex[9]->objectName = getObjectName(6);
+ _currentRoomData->screenObjectIndex[9]->objectName = getObjectName(6);
break;
case 615:
- currentRoomData->screenObjectIndex[9]->objectName = getObjectName(7);
+ _currentRoomData->screenObjectIndex[9]->objectName = getObjectName(7);
break;
}
} break;
case 23: {
- g_engine->_sound->autoPlayVoc("Fuente", 0, 0);
- g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
+ _sound->autoPlayVoc("Fuente", 0, 0);
+ _sound->setSfxVolume(_sound->_leftSfxVol, _sound->_rightSfxVol);
} break;
case 24: {
- switch (niche[1][niche[1][3]]) {
+ switch (_niche[1][_niche[1][3]]) {
case 0:
- currentRoomData->screenObjectIndex[8]->objectName = getObjectName(4);
+ _currentRoomData->screenObjectIndex[8]->objectName = getObjectName(4);
break;
case 561:
- currentRoomData->screenObjectIndex[8]->objectName = getObjectName(5);
+ _currentRoomData->screenObjectIndex[8]->objectName = getObjectName(5);
break;
case 615:
- currentRoomData->screenObjectIndex[8]->objectName = getObjectName(7);
+ _currentRoomData->screenObjectIndex[8]->objectName = getObjectName(7);
break;
case 622:
- currentRoomData->screenObjectIndex[8]->objectName = getObjectName(8);
+ _currentRoomData->screenObjectIndex[8]->objectName = getObjectName(8);
break;
case 623:
- currentRoomData->screenObjectIndex[8]->objectName = getObjectName(9);
+ _currentRoomData->screenObjectIndex[8]->objectName = getObjectName(9);
break;
}
- if (isTrapSet) {
- currentRoomData->animationFlag = true;
- loadAnimation(currentRoomData->animationName);
- iframe2 = 0;
- currentSecondaryTrajectoryIndex = 1;
- currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].x = 214 - 15;
- currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].y = 115 - 42;
- secondaryAnimation.dir = currentRoomData->secondaryAnimDirections[currentSecondaryTrajectoryIndex - 1];
- secondaryAnimation.posx = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].x;
- secondaryAnimation.posy = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].y;
- secondaryAnimation.depth = 14;
-
- for (int i = 0; i < maxXGrid; i++)
- for (int j = 0; j < maxYGrid; j++) {
- if (maskGridSecondaryAnim[i][j] > 0)
- currentRoomData->walkAreasGrid[oldposx + i][oldposy + j] = maskGridSecondaryAnim[i][j];
- if (maskMouseSecondaryAnim[i][j] > 0)
- currentRoomData->mouseGrid[oldposx + i][oldposy + j] = maskMouseSecondaryAnim[i][j];
+ if (_isTrapSet) {
+ _currentRoomData->animationFlag = true;
+ loadAnimation(_currentRoomData->animationName);
+ _iframe2 = 0;
+ _currentSecondaryTrajectoryIndex = 1;
+ _currentRoomData->secondaryAnimTrajectory[_currentSecondaryTrajectoryIndex - 1].x = 214 - 15;
+ _currentRoomData->secondaryAnimTrajectory[_currentSecondaryTrajectoryIndex - 1].y = 115 - 42;
+ _secondaryAnimation.dir = _currentRoomData->secondaryAnimDirections[_currentSecondaryTrajectoryIndex - 1];
+ _secondaryAnimation.posx = _currentRoomData->secondaryAnimTrajectory[_currentSecondaryTrajectoryIndex - 1].x;
+ _secondaryAnimation.posy = _currentRoomData->secondaryAnimTrajectory[_currentSecondaryTrajectoryIndex - 1].y;
+ _secondaryAnimation.depth = 14;
+
+ for (int i = 0; i < _maxXGrid; i++)
+ for (int j = 0; j < _maxYGrid; j++) {
+ if (_maskGridSecondaryAnim[i][j] > 0)
+ _currentRoomData->walkAreasGrid[_oldposx + i][_oldposy + j] = _maskGridSecondaryAnim[i][j];
+ if (_maskMouseSecondaryAnim[i][j] > 0)
+ _currentRoomData->mouseGrid[_oldposx + i][_oldposy + j] = _maskMouseSecondaryAnim[i][j];
}
}
assembleScreen();
@@ -4297,124 +4193,33 @@ void loadGame(SavedGame game) {
}
mask();
- inventoryPosition = 0;
+ _inventoryPosition = 0;
drawBackpack();
- if (isRedDevilCaptured == false && currentRoomData->code == 24 && isTrapSet == false)
+ if (_isRedDevilCaptured == false && _currentRoomData->code == 24 && _isTrapSet == false)
runaroundRed();
- g_engine->_graphics->sceneTransition(transitionEffect, false, sceneBackground);
-}
-
-/**
- * Loads talking animation of main adn secondary character
- */
-void loadTalkAnimations() {
- Common::File animFile;
-
- if (!animFile.open("TIOHABLA.SEC")) {
- showError(265);
- }
- mainCharFrameSize = animFile.readUint16LE();
-
- int32 offset = mainCharFrameSize * 16;
- offset = (offset * charFacingDirection) + 2;
- animFile.seek(offset);
- debug("LoadTalk charFacingDirection=%d", charFacingDirection);
- //Will load talking anim always in the upwards direction of the walk cycle array
- for (int i = 0; i < 16; i++) {
- mainCharAnimation.bitmap[0][i] = (byte *)malloc(mainCharFrameSize);
- animFile.read(mainCharAnimation.bitmap[0][i], mainCharFrameSize);
- }
- animFile.close();
-
- if ((currentRoomData->animationName != "PETER") && (currentRoomData->animationName != "ARZCAEL")) {
- iframe2 = 0;
- free(curSecondaryAnimationFrame);
- bool result;
- switch (regobj.speaking) {
- case 1:
- result = animFile.open("JOHN.SEC");
- break;
- case 5:
- result = animFile.open("ALFRED.SEC");
- break;
- default:
- result = animFile.open(Common::Path(currentRoomData->animationName + Common::String(".SEC")));
- }
-
- if (!result)
- showError(265);
- secondaryAnimFrameSize = animFile.readUint16LE();
- secondaryAnimationFrameCount = animFile.readByte();
- secondaryAnimDirCount = animFile.readByte();
-
- curSecondaryAnimationFrame = (byte *)malloc(secondaryAnimFrameSize);
- if (secondaryAnimDirCount != 0) {
- secondaryAnimationFrameCount = secondaryAnimationFrameCount / 4;
- for (int i = 0; i <= 3; i++) {
- loadAnimationForDirection(&animFile, i);
- }
- } else {
- loadAnimationForDirection(&animFile, 0);
- }
- animFile.close();
- }
-}
-
-void unloadTalkAnimations() {
-
- Common::File animFile;
- if (!animFile.open("PERSONAJ.SPT")) {
- showError(265);
- }
- mainCharFrameSize = animFile.readUint16LE();
-
- for (int i = 0; i < walkFrameCount; i++) {
- mainCharAnimation.bitmap[0][i] = (byte *)malloc(mainCharFrameSize);
- animFile.read(mainCharAnimation.bitmap[0][i], mainCharFrameSize);
- }
- animFile.close();
-
- if ((currentRoomData->animationName != "PETER") && (currentRoomData->animationName != "ARZCAEL")) {
- if (!animFile.open(Common::Path(currentRoomData->animationName + ".DAT"))) {
- showError(265);
- }
- secondaryAnimFrameSize = animFile.readUint16LE();
- secondaryAnimationFrameCount = animFile.readByte();
- secondaryAnimDirCount = animFile.readByte();
- curSecondaryAnimationFrame = (byte *)malloc(secondaryAnimFrameSize);
- if (secondaryAnimDirCount != 0) {
-
- secondaryAnimationFrameCount = secondaryAnimationFrameCount / 4;
- for (int i = 0; i <= 3; i++) {
- loadAnimationForDirection(&animFile, i);
- }
- } else {
- loadAnimationForDirection(&animFile, 0);
- }
- animFile.close();
- }
+ _graphics->sceneTransition(false, sceneBackground);
}
-TextEntry readVerbRegister(uint numRegister) {
- verb.seek(numRegister * verbRegSize);
+TextEntry TotEngine::readVerbRegister(uint numRegister) {
+ _verbFile.seek(numRegister * kVerbRegSize);
return readVerbRegister();
}
-TextEntry readVerbRegister() {
+TextEntry TotEngine::readVerbRegister() {
TextEntry regmht;
// Since the text is encrypted it's safer to save the size as reported by
// the pascal string.
- byte size = verb.readByte();
- verb.seek(-1, SEEK_CUR);
- regmht.text = verb.readPascalString(false);
- verb.skip(255 - size);
- regmht.continued = verb.readByte();
- regmht.response = verb.readUint16LE();
- regmht.pointer = verb.readSint32LE();
+ byte size = _verbFile.readByte();
+ _verbFile.seek(-1, SEEK_CUR);
+ regmht.text = _verbFile.readPascalString(false);
+ _verbFile.skip(255 - size);
+ regmht.continued = _verbFile.readByte();
+ regmht.response = _verbFile.readUint16LE();
+ regmht.pointer = _verbFile.readSint32LE();
return regmht;
}
-void hypertext(
+void TotEngine::sayLine(
uint textRef,
byte textColor,
byte shadowColor,
@@ -4423,83 +4228,83 @@ void hypertext(
bool isWithinConversation) {
TextEntry text;
- byte insertName, iht, iteracionesht, lineaht, anchoht;
- byte direccionmovimientopaso;
+ byte insertName, charCounter, lineBreakCount, width;
+ byte characterFacingDir;
- uint indiceaniconversa, tambackgroundht, xht, yht;
+ uint talkAnimIndex, bgSize, posx, posy;
byte *backgroundtextht;
- byte matrizsaltosht[15];
- g_engine->_mouseManager->hide();
- switch (currentRoomData->code) {
+ byte lineBreaks[15];
+ _mouse->hide();
+ switch (_currentRoomData->code) {
case 2: { // Leisure room
- xht = 10;
- yht = 2;
- anchoht = 28;
+ posx = 10;
+ posy = 2;
+ width = 28;
} break;
case 3: { // dining room
- xht = 130;
- yht = 2;
- anchoht = 30;
+ posx = 130;
+ posy = 2;
+ width = 30;
} break;
case 8: { // patch
- xht = 10;
- yht = 100;
- anchoht = 50;
+ posx = 10;
+ posy = 100;
+ width = 50;
} break;
case 10: { // well
- xht = 10;
- yht = 2;
- anchoht = 40;
+ posx = 10;
+ posy = 2;
+ width = 40;
} break;
case 11: { // pond
- xht = 172;
- yht = 2;
- anchoht = 26;
+ posx = 172;
+ posy = 2;
+ width = 26;
} break;
case 16: { // dorm. 1
- xht = 140;
- yht = 2;
- anchoht = 30;
+ posx = 140;
+ posy = 2;
+ width = 30;
} break;
case 17: { // dorm. 2
- xht = 10;
- yht = 2;
- anchoht = 30;
+ posx = 10;
+ posy = 2;
+ width = 30;
} break;
case 21: { // p4
- xht = 10;
- yht = 100;
- anchoht = 50;
+ posx = 10;
+ posy = 100;
+ width = 50;
} break;
case 23: { // fountain
- xht = 10;
- yht = 2;
- anchoht = 19;
+ posx = 10;
+ posy = 2;
+ width = 19;
} break;
case 25: { // catacombs
- xht = 10;
- yht = 2;
- anchoht = 22;
+ posx = 10;
+ posy = 2;
+ width = 22;
} break;
case 28: { // storage room
- xht = 180;
- yht = 60;
- anchoht = 24;
+ posx = 180;
+ posy = 60;
+ width = 24;
} break;
case 31: { // prison
- xht = 10;
- yht = 2;
- anchoht = 25;
+ posx = 10;
+ posy = 2;
+ width = 25;
} break;
default: { // any other room
- xht = 10;
- yht = 2;
- anchoht = 50;
+ posx = 10;
+ posy = 2;
+ width = 50;
}
}
- verb.seek(textRef * verbRegSize);
+ _verbFile.seek(textRef * kVerbRegSize);
do {
@@ -4508,90 +4313,90 @@ void hypertext(
insertName = 0;
for (int i = 0; i < text.text.size(); i++) {
- text.text.setChar(decryptionKey[i] ^ text.text[i], i);
+ text.text.setChar(_decryptionKey[i] ^ text.text[i], i);
if (text.text[i] == '@')
insertName = i;
}
if (insertName > 0) {
text.text.deleteChar(insertName);
- text.text.insertString(characterName, insertName);
+ text.text.insertString(_characterName, insertName);
}
- if (text.text.size() < anchoht) {
- tambackgroundht = imagesize(xht - 1, yht - 1, xht + (text.text.size() * 8) + 2, yht + 13);
- backgroundtextht = (byte *)malloc(tambackgroundht);
+ if (text.text.size() < width) {
+ bgSize = imagesize(posx - 1, posy - 1, posx + (text.text.size() * 8) + 2, posy + 13);
+ backgroundtextht = (byte *)malloc(bgSize);
- g_engine->_graphics->getImg(xht - 1, yht - 1, xht + (text.text.size() * 8) + 2, yht + 13, backgroundtextht);
+ _graphics->getImg(posx - 1, posy - 1, posx + (text.text.size() * 8) + 2, posy + 13, backgroundtextht);
- littText(xht - 1, yht, text.text, shadowColor);
- g_engine->_screen->update();
+ littText(posx - 1, posy, text.text, shadowColor);
+ _screen->update();
delay(kEnforcedTextAnimDelay);
- littText(xht + 1, yht, text.text, shadowColor);
- g_engine->_screen->update();
+ littText(posx + 1, posy, text.text, shadowColor);
+ _screen->update();
delay(kEnforcedTextAnimDelay);
- littText(xht, yht - 1, text.text, shadowColor);
- g_engine->_screen->update();
+ littText(posx, posy - 1, text.text, shadowColor);
+ _screen->update();
delay(kEnforcedTextAnimDelay);
- littText(xht, yht + 1, text.text, shadowColor);
- g_engine->_screen->update();
+ littText(posx, posy + 1, text.text, shadowColor);
+ _screen->update();
delay(kEnforcedTextAnimDelay);
- littText(xht, yht, text.text, textColor);
- g_engine->_screen->update();
+ littText(posx, posy, text.text, textColor);
+ _screen->update();
delay(kEnforcedTextAnimDelay);
} else {
- iht = 0;
- iteracionesht = 0;
- matrizsaltosht[0] = 0;
+ charCounter = 0;
+ lineBreakCount = 0;
+ lineBreaks[0] = 0;
// Breaks text lines on the last space when reaching the [anchoht]
do {
- iht += anchoht;
- iteracionesht += 1;
+ charCounter += width;
+ lineBreakCount += 1;
do {
- iht -= 1;
- } while (text.text[iht] != ' ');
- matrizsaltosht[iteracionesht] = iht + 1;
- } while (iht + 1 <= text.text.size() - anchoht);
+ charCounter -= 1;
+ } while (text.text[charCounter] != ' ');
+ lineBreaks[lineBreakCount] = charCounter + 1;
+ } while (charCounter + 1 <= text.text.size() - width);
- iteracionesht += 1;
- matrizsaltosht[iteracionesht] = text.text.size();
+ lineBreakCount += 1;
+ lineBreaks[lineBreakCount] = text.text.size();
// Grab patch of background behind where the text will be, to paste it back later
- tambackgroundht = imagesize(xht - 1, yht - 1, xht + (anchoht * 8) + 2, yht + iteracionesht * 13);
- backgroundtextht = (byte *)malloc(tambackgroundht);
- g_engine->_graphics->getImg(xht - 1, yht - 1, xht + (anchoht * 8) + 2, yht + iteracionesht * 13, backgroundtextht);
+ bgSize = imagesize(posx - 1, posy - 1, posx + (width * 8) + 2, posy + lineBreakCount * 13);
+ backgroundtextht = (byte *)malloc(bgSize);
+ _graphics->getImg(posx - 1, posy - 1, posx + (width * 8) + 2, posy + lineBreakCount * 13, backgroundtextht);
- for (lineaht = 1; lineaht <= iteracionesht; lineaht++) {
+ for (int i = 1; i <= lineBreakCount; i++) {
- Common::String lineString = Common::String(text.text.c_str() + matrizsaltosht[lineaht - 1], text.text.c_str() + matrizsaltosht[lineaht]);
+ Common::String lineString = Common::String(text.text.c_str() + lineBreaks[i - 1], text.text.c_str() + lineBreaks[i]);
- littText(xht + 1, yht + ((lineaht - 1) * 11), lineString, shadowColor);
- g_engine->_screen->update();
+ littText(posx + 1, posy + ((i - 1) * 11), lineString, shadowColor);
+ _screen->update();
delay(kEnforcedTextAnimDelay);
- littText(xht - 1, yht + ((lineaht - 1) * 11), lineString, shadowColor);
- g_engine->_screen->update();
+ littText(posx - 1, posy + ((i - 1) * 11), lineString, shadowColor);
+ _screen->update();
delay(kEnforcedTextAnimDelay);
- littText(xht, yht + ((lineaht - 1) * 11) + 1, lineString, shadowColor);
- g_engine->_screen->update();
+ littText(posx, posy + ((i - 1) * 11) + 1, lineString, shadowColor);
+ _screen->update();
delay(kEnforcedTextAnimDelay);
- littText(xht, yht + ((lineaht - 1) * 11) - 1, lineString, shadowColor);
- g_engine->_screen->update();
+ littText(posx, posy + ((i - 1) * 11) - 1, lineString, shadowColor);
+ _screen->update();
delay(kEnforcedTextAnimDelay);
- littText(xht, yht + ((lineaht - 1) * 11), lineString, textColor);
- g_engine->_screen->update();
+ littText(posx, posy + ((i - 1) * 11), lineString, textColor);
+ _screen->update();
delay(kEnforcedTextAnimDelay);
}
}
- indiceaniconversa = 0;
+ talkAnimIndex = 0;
bool mouseClicked = false;
Common::Event e;
// Plays talk cycle if needed
do {
- g_engine->_chrono->updateChrono();
+ _chrono->updateChrono();
while (g_system->getEventManager()->pollEvent(e)) {
if (isMouseEvent(e)) {
if (e.type == Common::EVENT_LBUTTONUP || e.type == Common::EVENT_RBUTTONUP) {
@@ -4604,77 +4409,67 @@ void hypertext(
gameTick = false;
if (gameTickHalfSpeed) {
if (isWithinConversation) {
- indiceaniconversa += 1;
+ talkAnimIndex += 1;
if (textColor == 255) {
- iframe2 = 0;
- if (iframe >= 15)
- iframe = 0;
+ _iframe2 = 0;
+ if (_iframe >= 15)
+ _iframe = 0;
else
- iframe++;
+ _iframe++;
} else {
- iframe = 0;
- if (iframe2 >= secondaryAnimationFrameCount - 1)
- iframe2 = 0;
+ _iframe = 0;
+ if (_iframe2 >= _secondaryAnimationFrameCount - 1)
+ _iframe2 = 0;
else
- iframe2++;
+ _iframe2++;
}
// Talk sprites are always put in facing direction 0
- direccionmovimientopaso = charFacingDirection;
- charFacingDirection = 0;
+ characterFacingDir = _charFacingDirection;
+ _charFacingDirection = 0;
sprites(true);
- charFacingDirection = direccionmovimientopaso;
+ _charFacingDirection = characterFacingDir;
} else {
- if (currentSecondaryTrajectoryIndex >= currentRoomData->secondaryTrajectoryLength)
- currentSecondaryTrajectoryIndex = 1;
+ if (_currentSecondaryTrajectoryIndex >= _currentRoomData->secondaryTrajectoryLength)
+ _currentSecondaryTrajectoryIndex = 1;
else
- currentSecondaryTrajectoryIndex += 1;
- secondaryAnimation.posx = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].x;
- secondaryAnimation.posy = currentRoomData->secondaryAnimTrajectory[currentSecondaryTrajectoryIndex - 1].y;
- secondaryAnimation.dir = currentRoomData->secondaryAnimDirections[currentSecondaryTrajectoryIndex - 1];
- if (iframe2 >= secondaryAnimationFrameCount - 1)
- iframe2 = 0;
+ _currentSecondaryTrajectoryIndex += 1;
+ _secondaryAnimation.posx = _currentRoomData->secondaryAnimTrajectory[_currentSecondaryTrajectoryIndex - 1].x;
+ _secondaryAnimation.posy = _currentRoomData->secondaryAnimTrajectory[_currentSecondaryTrajectoryIndex - 1].y;
+ _secondaryAnimation.dir = _currentRoomData->secondaryAnimDirections[_currentSecondaryTrajectoryIndex - 1];
+ if (_iframe2 >= _secondaryAnimationFrameCount - 1)
+ _iframe2 = 0;
else
- iframe2++;
+ _iframe2++;
sprites(false);
}
}
- if (currentRoomData->paletteAnimationFlag && palAnimStep >= 4) {
- palAnimStep = 0;
- if (isPaletteAnimEnabled > 6)
- isPaletteAnimEnabled = 0;
- else
- isPaletteAnimEnabled += 1;
- if (currentRoomData->code == 4 && isPaletteAnimEnabled == 4)
- g_engine->_sound->playVoc();
- g_engine->_graphics->updatePalette(isPaletteAnimEnabled);
- } else
- palAnimStep += 1;
+ _graphics->advancePaletteAnim();
}
- g_engine->_screen->update();
+ _screen->update();
g_system->delayMillis(10);
- } while (indiceaniconversa <= (text.text.size() * 4) && !mouseClicked && !g_engine->shouldQuit());
+ } while (talkAnimIndex <= (text.text.size() * 4) && !mouseClicked && !shouldQuit());
- g_engine->_graphics->putImg(xht - 1, yht - 1, backgroundtextht);
+ _graphics->putImg(posx - 1, posy - 1, backgroundtextht);
free(backgroundtextht);
g_system->delayMillis(10);
- } while (text.continued && !g_engine->shouldQuit());
+ } while (text.continued && !shouldQuit());
responseNumber = text.response;
- g_engine->_mouseManager->show();
+ _mouse->show();
}
-void wcScene() {
+void TotEngine::wcScene() {
palette wcPalette;
- currentZone = currentRoomData->walkAreasGrid[(characterPosX + characterCorrectionX) / xGridCount][(characterPosY + characerCorrectionY) / yGridCount];
- goToObject(currentZone, targetZone);
+ _currentZone = _currentRoomData->walkAreasGrid[(_characterPosX + kCharacterCorrectionX) / kXGridCount][(_characterPosY + kCharacerCorrectionY) / kYGridCount];
+ goToObject(_currentZone, _targetZone);
- g_engine->_graphics->copyPalette(pal, wcPalette);
- g_engine->_mouseManager->hide();
+ _graphics->copyPalette(g_engine->_graphics->_pal, wcPalette);
+ _mouse->hide();
- g_engine->_graphics->partialFadeOut(234);
+ _graphics->partialFadeOut(234);
- const char *const *messages = (g_engine->_lang == Common::ES_ESP) ? fullScreenMessages[0] : fullScreenMessages[1];
+ const char *const *messages = (_lang == Common::ES_ESP) ? fullScreenMessages[0] : fullScreenMessages[1];
littText(10, 20, messages[45], 253);
delay(1000);
@@ -4697,29 +4492,29 @@ void wcScene() {
littText(50, 90, messages[48], 248);
delay(1000);
- g_engine->_sound->playVoc("WATER", 272050, 47062);
+ _sound->playVoc("WATER", 272050, 47062);
bar(50, 90, 200, 100, 0);
delay(4000);
- characterPosX = 76 - characterCorrectionX;
- characterPosY = 78 - characerCorrectionY;
- g_engine->_graphics->copyPalette(wcPalette, pal);
- g_engine->_graphics->restoreBackground();
+ _characterPosX = 76 - kCharacterCorrectionX;
+ _characterPosY = 78 - kCharacerCorrectionY;
+ _graphics->copyPalette(wcPalette, g_engine->_graphics->_pal);
+ _graphics->restoreBackground();
assembleScreen();
- g_engine->_graphics->drawScreen(sceneBackground);
- g_engine->_graphics->partialFadeIn(234);
- xframe2 = 0;
- currentTrajectoryIndex = 0;
- trajectoryLength = 1;
- currentZone = 8;
- targetZone = 8;
- trajectory[0].x = characterPosX;
- trajectory[0].y = characterPosY;
-
- g_engine->_mouseManager->show();
+ _graphics->drawScreen(sceneBackground);
+ _graphics->partialFadeIn(234);
+ _xframe2 = 0;
+ _currentTrajectoryIndex = 0;
+ _trajectoryLength = 1;
+ _currentZone = 8;
+ _targetZone = 8;
+ _trajectory[0].x = _characterPosX;
+ _trajectory[0].y = _characterPosY;
+
+ _mouse->show();
}
-void readConversationFile(Common::String f) {
+void TotEngine::readConversationFile(Common::String f) {
Common::File conversationFile;
debug("Filename = %s", f.c_str());
if (!conversationFile.open(Common::Path(f))) {
@@ -4729,7 +4524,7 @@ void readConversationFile(Common::String f) {
byte *buf = (byte *)malloc(fileSize);
conversationFile.read(buf, fileSize);
- conversationData = new Common::MemorySeekableReadWriteStream(buf, fileSize, DisposeAfterUse::NO);
+ _conversationData = new Common::MemorySeekableReadWriteStream(buf, fileSize, DisposeAfterUse::NO);
conversationFile.close();
}
@@ -4822,33 +4617,33 @@ void saveRoom(RoomFileRegister *room, Common::SeekableWriteStream *screenDataStr
screenDataStream->writeUint16LE(room->secondaryTrajectoryLength);
}
-void saveRoomData(RoomFileRegister *room, Common::SeekableWriteStream *stream) {
- rooms->seek(room->code * roomRegSize, SEEK_SET);
+void TotEngine::saveRoomData(RoomFileRegister *room, Common::SeekableWriteStream *stream) {
+ _rooms->seek(room->code * kRoomRegSize, SEEK_SET);
saveRoom(room, stream);
}
/**
* Object files contain a single register per object, with a set of 8 flags, to mark them as used in each save.
*/
-void initializeObjectFile() {
+void TotEngine::initializeObjectFile() {
Common::File objFile;
if (!objFile.open(Common::Path("OBJETOS.DAT"))) {
showError(261);
}
- delete (invItemData);
+ delete (_invItemData);
byte *objectData = (byte *)malloc(objFile.size());
objFile.read(objectData, objFile.size());
- invItemData = new Common::MemorySeekableReadWriteStream(objectData, objFile.size(), DisposeAfterUse::NO);
+ _invItemData = new Common::MemorySeekableReadWriteStream(objectData, objFile.size(), DisposeAfterUse::NO);
objFile.close();
}
-void saveItem(ScreenObject object, Common::SeekableWriteStream *objectDataStream) {
+void TotEngine::saveItem(ScreenObject object, Common::SeekableWriteStream *objectDataStream) {
objectDataStream->writeUint16LE(object.code);
objectDataStream->writeByte(object.height);
objectDataStream->writeByte(object.name.size());
objectDataStream->writeString(object.name);
- int paddingSize = objectNameLength - object.name.size();
+ int paddingSize = kObjectNameLength - object.name.size();
if (paddingSize > 0) {
char *padding = (char *)malloc(paddingSize);
for (int i = 0; i < paddingSize; i++) {
@@ -4895,17 +4690,9 @@ void saveItem(ScreenObject object, Common::SeekableWriteStream *objectDataStream
objectDataStream->write(object.mouseGridPatch, 100);
}
-void saveItemRegister(ScreenObject object, Common::SeekableWriteStream *stream) {
- invItemData->seek(object.code * itemRegSize, SEEK_SET);
+void TotEngine::saveItemRegister(ScreenObject object, Common::SeekableWriteStream *stream) {
+ _invItemData->seek(object.code * kItemRegSize, SEEK_SET);
saveItem(object, stream);
}
-void printNiches() {
- debug("| | %03d | %03d | %03d | %03d |", 0, 1, 2, 3);
- debug("| 0 | %03d | %03d | %03d | %03d |", niche[0][0], niche[0][1], niche[0][2], niche[0][3]);
- debug("| 1 | %03d | %03d | %03d | %03d |", niche[1][0], niche[1][1], niche[1][2], niche[1][3]);
- debug("niche[0][niche[0][3]] = %d", niche[0][niche[0][3]]);
- debug("niche[1][niche[1][3]] = %d", niche[1][niche[1][3]]);
-}
-
} // End of namespace Tot
diff --git a/engines/tot/routines.h b/engines/tot/routines.h
deleted file mode 100644
index f479fc33daf..00000000000
--- a/engines/tot/routines.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-#ifndef TOT_ROUTINES_H
-#define TOT_ROUTINES_H
-
-#include "common/scummsys.h"
-
-#include "tot/anims.h"
-#include "tot/vars.h"
-#include "tot/routines2.h"
-#include "tot/util.h"
-
-namespace Tot {
-
-void drawText(uint number);
-void displayLoading();
-void runaroundRed();
-void sprites(bool drawCharacter);
-void loadScreenData(uint screenNumber);
-RoomFileRegister *readScreenDataFile(Common::SeekableReadStream *screenDataFile);
-void saveRoomData(RoomFileRegister *room, Common::SeekableWriteStream *stream);
-void calculateTrajectory(uint finalx, uint finaly);
-void lookAtObject(byte objectNumber);
-void useInventoryObjectWithInventoryObject(uint objectNo1, uint objectNo2);
-void pickupScreenObject();
-void useScreenObject();
-void openScreenObject();
-void closeScreenObject();
-void action();
-void handleAction(byte posinv);
-void loadObjects();
-void obtainName(Common::String &playerName);
-void loadScrollData(uint screenNumber, bool scrollder, uint poshor, int correction);
-void loadGame(SavedGame game);
-void saveGameToRegister();
-void saveLoad();
-void calculateRoute(byte zona1, byte zona2, bool extraCorrection = false, bool zonavedada = false);
-void goToObject(byte zone1, byte zone2);
-void loadTalkAnimations();
-void unloadTalkAnimations();
-void hypertext(uint numreght, byte colortextoht, byte colorsombraht, uint &numresp, bool banderaconversa);
-void wcScene();
-void advanceAnimations(bool zonavedada, bool animateMouse);
-void updateSecondaryAnimationDepth();
-void updateMainCharacterDepth();
-void actionLineText(Common::String actionLine);
-void initializeObjectFile();
-void saveItem(ScreenObject object, Common::SeekableWriteStream *objectDataStream);
-
-TextEntry readVerbRegister(uint numRegister);
-TextEntry readVerbRegister();
-
-void readConversationFile(Common::String f);
-void printNiches();
-
-} // End of namespace Tot
-
-#endif
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
index 2928cfd8635..969b1f50ea7 100644
--- a/engines/tot/routines2.cpp
+++ b/engines/tot/routines2.cpp
@@ -30,47 +30,47 @@
#include "graphics/surface.h"
#include "image/png.h"
-#include "tot/routines.h"
-#include "tot/routines2.h"
+#include "tot/anims.h"
#include "tot/statics.h"
#include "tot/tot.h"
#include "tot/util.h"
+#include "tot/vars.h"
namespace Tot {
-void loadScreenMemory() {
- screenSize = 65520;
- sceneBackground = (byte *)malloc(screenSize);
- backgroundCopy = (byte *)malloc(screenSize);
+void TotEngine::loadScreenMemory() {
+ _screenSize = 65520;
+ sceneBackground = (byte *)malloc(_screenSize);
+ backgroundCopy = (byte *)malloc(_screenSize);
}
-void loadAnimationForDirection(Common::SeekableReadStream *stream, int direction) {
- for (int j = 0; j < secondaryAnimationFrameCount; j++) {
- g_engine->_graphics->loadAnimationIntoBuffer(stream, secondaryAnimation.bitmap[direction][j], secondaryAnimFrameSize);
+void TotEngine::loadAnimationForDirection(Common::SeekableReadStream *stream, int direction) {
+ for (int j = 0; j < _secondaryAnimationFrameCount; j++) {
+ _graphics->loadAnimationIntoBuffer(stream, _secondaryAnimation.bitmap[direction][j], _secondaryAnimFrameSize);
}
}
-void loadAnimation(Common::String animationName) {
+void TotEngine::loadAnimation(Common::String animationName) {
debug("Loading animation!");
Common::File animFile;
if (animationName == "PETER")
- isPeterCoughing = true;
+ _isPeterCoughing = true;
else
- isPeterCoughing = false;
+ _isPeterCoughing = false;
- isSecondaryAnimationEnabled = true;
+ _isSecondaryAnimationEnabled = true;
if (!animFile.open(Common::Path(animationName + ".DAT"))) {
showError(265);
}
- secondaryAnimFrameSize = animFile.readUint16LE();
- secondaryAnimationFrameCount = animFile.readByte();
- secondaryAnimDirCount = animFile.readByte();
- curSecondaryAnimationFrame = (byte *)malloc(secondaryAnimFrameSize);
- if (secondaryAnimDirCount != 0) {
+ _secondaryAnimFrameSize = animFile.readUint16LE();
+ _secondaryAnimationFrameCount = animFile.readByte();
+ _secondaryAnimDirCount = animFile.readByte();
+ _curSecondaryAnimationFrame = (byte *)malloc(_secondaryAnimFrameSize);
+ if (_secondaryAnimDirCount != 0) {
- secondaryAnimationFrameCount = secondaryAnimationFrameCount / 4;
+ _secondaryAnimationFrameCount = _secondaryAnimationFrameCount / 4;
for (int i = 0; i <= 3; i++) {
loadAnimationForDirection(&animFile, i);
}
@@ -79,286 +79,284 @@ void loadAnimation(Common::String animationName) {
}
animFile.close();
- debug("Read all frames! longtray2=%d", currentRoomData->secondaryTrajectoryLength);
- secondaryAnimWidth = READ_LE_UINT16(secondaryAnimation.bitmap[0][1]) + 1;
- secondaryAnimHeight = READ_LE_UINT16(secondaryAnimation.bitmap[0][1] + 2) + 1;
+ debug("Read all frames! longtray2=%d", _currentRoomData->secondaryTrajectoryLength);
+ _secondaryAnimWidth = READ_LE_UINT16(_secondaryAnimation.bitmap[0][1]) + 1;
+ _secondaryAnimHeight = READ_LE_UINT16(_secondaryAnimation.bitmap[0][1] + 2) + 1;
- setRoomTrajectories(secondaryAnimHeight, secondaryAnimWidth, SET_WITH_ANIM, false);
+ setRoomTrajectories(_secondaryAnimHeight, _secondaryAnimWidth, SET_WITH_ANIM, false);
- readItemRegister(currentRoomData->secondaryAnimDirections[299]);
- maxXGrid = (regobj.xgrid2 - regobj.xgrid1 + 1);
- maxYGrid = (regobj.ygrid2 - regobj.ygrid1 + 1);
- oldposx = regobj.xgrid1 + 1;
- oldposy = regobj.ygrid1 + 1;
+ readItemRegister(_currentRoomData->secondaryAnimDirections[299]);
+ _maxXGrid = (_curObject.xgrid2 - _curObject.xgrid1 + 1);
+ _maxYGrid = (_curObject.ygrid2 - _curObject.ygrid1 + 1);
+ _oldposx = _curObject.xgrid1 + 1;
+ _oldposy = _curObject.ygrid1 + 1;
for (int i = 0; i < 10; i++)
for (int j = 0; j < 10; j++) {
- maskGridSecondaryAnim[i][j] = 0;
- maskMouseSecondaryAnim[i][j] = 0;
- movementGridForSecondaryAnim[i][j] = 0;
- mouseGridForSecondaryAnim[i][j] = 0;
+ _maskGridSecondaryAnim[i][j] = 0;
+ _maskMouseSecondaryAnim[i][j] = 0;
+ _movementGridForSecondaryAnim[i][j] = 0;
+ _mouseGridForSecondaryAnim[i][j] = 0;
}
- for (int i = 0; i < maxXGrid; i++)
- for (int j = 0; j < maxYGrid; j++) {
- maskGridSecondaryAnim[i][j] = regobj.walkAreasPatch[i][j];
- maskMouseSecondaryAnim[i][j] = regobj.mouseGridPatch[i][j];
- movementGridForSecondaryAnim[i][j] = currentRoomData->walkAreasGrid[oldposx + i][oldposy + j];
- mouseGridForSecondaryAnim[i][j] = currentRoomData->mouseGrid[oldposx + i][oldposy + j];
+ for (int i = 0; i < _maxXGrid; i++)
+ for (int j = 0; j < _maxYGrid; j++) {
+ _maskGridSecondaryAnim[i][j] = _curObject.walkAreasPatch[i][j];
+ _maskMouseSecondaryAnim[i][j] = _curObject.mouseGridPatch[i][j];
+ _movementGridForSecondaryAnim[i][j] = _currentRoomData->walkAreasGrid[_oldposx + i][_oldposy + j];
+ _mouseGridForSecondaryAnim[i][j] = _currentRoomData->mouseGrid[_oldposx + i][_oldposy + j];
}
- iframe2 = 0;
+ _iframe2 = 0;
debug("Finished loading animation!");
}
-void assignText() {
- if (!verb.open("CONVERSA.TXT")) {
+void TotEngine::assignText() {
+ if (!_verbFile.open("CONVERSA.TXT")) {
showError(313);
}
}
-void updateAltScreen(byte otherScreenNumber) {
+void TotEngine::updateAltScreen(byte otherScreenNumber) {
uint i22;
uint i11;
- byte currentScreen = currentRoomData->code;
+ byte currentScreen = _currentRoomData->code;
- setRoomTrajectories(secondaryAnimHeight, secondaryAnimWidth, RESTORE);
+ setRoomTrajectories(_secondaryAnimHeight, _secondaryAnimWidth, RESTORE);
// Save current room
- saveRoomData(currentRoomData, rooms);
+ saveRoomData(_currentRoomData, _rooms);
// Load other screen
- rooms->seek(otherScreenNumber * roomRegSize, SEEK_SET);
- currentRoomData = readScreenDataFile(rooms);
+ _rooms->seek(otherScreenNumber * kRoomRegSize, SEEK_SET);
+ _currentRoomData = readScreenDataFile(_rooms);
switch (otherScreenNumber) {
case 20: {
- switch (niche[0][niche[0][3]]) {
+ switch (_niche[0][_niche[0][3]]) {
case 0: {
- currentRoomData->screenObjectIndex[9]->objectName = getObjectName(4);
- currentRoomData->screenLayers[1].bitmapPointer = 1190768;
+ _currentRoomData->screenObjectIndex[9]->objectName = getObjectName(4);
+ _currentRoomData->screenLayers[1].bitmapPointer = 1190768;
} break;
case 561: {
- currentRoomData->screenObjectIndex[9]->objectName = getObjectName(5);
- currentRoomData->screenLayers[1].bitmapPointer = 1182652;
+ _currentRoomData->screenObjectIndex[9]->objectName = getObjectName(5);
+ _currentRoomData->screenLayers[1].bitmapPointer = 1182652;
} break;
case 563: {
- currentRoomData->screenObjectIndex[9]->objectName = getObjectName(6);
- currentRoomData->screenLayers[1].bitmapPointer = 1186044;
+ _currentRoomData->screenObjectIndex[9]->objectName = getObjectName(6);
+ _currentRoomData->screenLayers[1].bitmapPointer = 1186044;
} break;
case 615: {
- currentRoomData->screenObjectIndex[9]->objectName = getObjectName(7);
- currentRoomData->screenLayers[1].bitmapPointer = 1181760;
+ _currentRoomData->screenObjectIndex[9]->objectName = getObjectName(7);
+ _currentRoomData->screenLayers[1].bitmapPointer = 1181760;
} break;
}
- currentRoomData->screenLayers[1].bitmapSize = 892;
- currentRoomData->screenLayers[1].coordx = 66;
- currentRoomData->screenLayers[1].coordy = 35;
- currentRoomData->screenLayers[1].depth = 1;
+ _currentRoomData->screenLayers[1].bitmapSize = 892;
+ _currentRoomData->screenLayers[1].coordx = 66;
+ _currentRoomData->screenLayers[1].coordy = 35;
+ _currentRoomData->screenLayers[1].depth = 1;
} break;
case 24: {
- switch (niche[1][niche[1][3]]) {
+ switch (_niche[1][_niche[1][3]]) {
case 0: {
- currentRoomData->screenObjectIndex[8]->objectName = getObjectName(4);
- currentRoomData->screenLayers[0].bitmapPointer = 1399610;
+ _currentRoomData->screenObjectIndex[8]->objectName = getObjectName(4);
+ _currentRoomData->screenLayers[0].bitmapPointer = 1399610;
} break;
case 561: {
- currentRoomData->screenObjectIndex[8]->objectName = getObjectName(5);
- currentRoomData->screenLayers[0].bitmapPointer = 1381982;
+ _currentRoomData->screenObjectIndex[8]->objectName = getObjectName(5);
+ _currentRoomData->screenLayers[0].bitmapPointer = 1381982;
} break;
case 615: {
- currentRoomData->screenObjectIndex[8]->objectName = getObjectName(7);
- currentRoomData->screenLayers[0].bitmapPointer = 1381090;
+ _currentRoomData->screenObjectIndex[8]->objectName = getObjectName(7);
+ _currentRoomData->screenLayers[0].bitmapPointer = 1381090;
} break;
case 622: {
- currentRoomData->screenObjectIndex[8]->objectName = getObjectName(8);
- currentRoomData->screenLayers[0].bitmapPointer = 1400502;
+ _currentRoomData->screenObjectIndex[8]->objectName = getObjectName(8);
+ _currentRoomData->screenLayers[0].bitmapPointer = 1400502;
} break;
case 623: {
- currentRoomData->screenObjectIndex[8]->objectName = getObjectName(9);
- currentRoomData->screenLayers[0].bitmapPointer = 1398718;
+ _currentRoomData->screenObjectIndex[8]->objectName = getObjectName(9);
+ _currentRoomData->screenLayers[0].bitmapPointer = 1398718;
} break;
}
- currentRoomData->screenLayers[0].bitmapSize = 892;
- currentRoomData->screenLayers[0].coordx = 217;
- currentRoomData->screenLayers[0].coordy = 48;
- currentRoomData->screenLayers[0].depth = 1;
+ _currentRoomData->screenLayers[0].bitmapSize = 892;
+ _currentRoomData->screenLayers[0].coordx = 217;
+ _currentRoomData->screenLayers[0].coordy = 48;
+ _currentRoomData->screenLayers[0].depth = 1;
} break;
case 31: {
for (i11 = 23; i11 <= 25; i11++)
for (i22 = 4; i22 <= 9; i22++)
- currentRoomData->mouseGrid[i11][i22] = 4;
+ _currentRoomData->mouseGrid[i11][i22] = 4;
for (i11 = 23; i11 <= 25; i11++)
for (i22 = 10; i22 <= 11; i22++)
- currentRoomData->mouseGrid[i11][i22] = 3;
+ _currentRoomData->mouseGrid[i11][i22] = 3;
- currentRoomData->screenLayers[0].bitmapSize = 0;
- currentRoomData->screenLayers[0].bitmapPointer = 0;
- currentRoomData->screenLayers[0].coordx = 0;
- currentRoomData->screenLayers[0].coordy = 0;
- currentRoomData->screenLayers[0].depth = 0;
+ _currentRoomData->screenLayers[0].bitmapSize = 0;
+ _currentRoomData->screenLayers[0].bitmapPointer = 0;
+ _currentRoomData->screenLayers[0].coordx = 0;
+ _currentRoomData->screenLayers[0].coordy = 0;
+ _currentRoomData->screenLayers[0].depth = 0;
} break;
}
// Save other screen
- saveRoomData(currentRoomData, rooms);
+ saveRoomData(_currentRoomData, _rooms);
// Restore current room again
- rooms->seek(currentScreen * roomRegSize, SEEK_SET);
- currentRoomData = readScreenDataFile(rooms);
+ _rooms->seek(currentScreen * kRoomRegSize, SEEK_SET);
+ _currentRoomData = readScreenDataFile(_rooms);
- setRoomTrajectories(secondaryAnimHeight, secondaryAnimWidth, SET_WITH_ANIM);
+ setRoomTrajectories(_secondaryAnimHeight, _secondaryAnimWidth, SET_WITH_ANIM);
}
-void verifyCopyProtection() {
+void TotEngine::verifyCopyProtection() {
//TODO: Copy protection
}
-void loadTV() {
+void TotEngine::loadTV() {
Common::File fichct;
if (!fichct.open("PALETAS.DAT")) {
showError(310);
}
- fichct.seek(currentRoomData->palettePointer + 603);
- fichct.read(palAnimSlice, 144);
+ fichct.seek(_currentRoomData->palettePointer + 603);
+ fichct.read(g_engine->_graphics->_palAnimSlice, 144);
for (int i = 0; i <= 48; i++) {
- palAnimSlice[i * 3 + 0] = palAnimSlice[i * 3 + 0] << 2;
- palAnimSlice[i * 3 + 1] = palAnimSlice[i * 3 + 1] << 2;
- palAnimSlice[i * 3 + 2] = palAnimSlice[i * 3 + 2] << 2;
+ g_engine->_graphics->_palAnimSlice[i * 3 + 0] <<= 2;
+ g_engine->_graphics->_palAnimSlice[i * 3 + 1] <<= 2;
+ g_engine->_graphics->_palAnimSlice[i * 3 + 2] <<= 2;
}
fichct.close();
for (int ix = 195; ix <= 200; ix++) {
- pal[ix * 3 + 0] = 2 << 2;
- pal[ix * 3 + 1] = 2 << 2;
- pal[ix * 3 + 2] = 2 << 2;
+ g_engine->_graphics->_pal[ix * 3 + 0] = 2 << 2;
+ g_engine->_graphics->_pal[ix * 3 + 1] = 2 << 2;
+ g_engine->_graphics->_pal[ix * 3 + 2] = 2 << 2;
setRGBPalette(ix, 2, 2, 2);
}
}
-void loadScreen() {
+void TotEngine::loadScreen() {
Common::File paletteFile;
palette palcp;
- screenSize = currentRoomData->roomImageSize;
- readBitmap(currentRoomData->roomImagePointer, sceneBackground, screenSize, 316);
- Common::copy(sceneBackground, sceneBackground + screenSize, backgroundCopy);
- switch (gamePart) {
+ _screenSize = _currentRoomData->roomImageSize;
+ readBitmap(_currentRoomData->roomImagePointer, sceneBackground, _screenSize, 316);
+ Common::copy(sceneBackground, sceneBackground + _screenSize, backgroundCopy);
+ switch (_gamePart) {
case 1: {
if (!paletteFile.open("PALETAS.DAT")) {
showError(310);
}
- paletteFile.seek(currentRoomData->palettePointer);
+ paletteFile.seek(_currentRoomData->palettePointer);
paletteFile.read(palcp, 603);
- if (currentRoomData->paletteAnimationFlag) {
- paletteFile.read(palAnimSlice, 144);
+ if (_currentRoomData->paletteAnimationFlag) {
+ paletteFile.read(g_engine->_graphics->_palAnimSlice, 144);
for (int i = 0; i <= 48; i++) {
- palAnimSlice[i * 3 + 0] = palAnimSlice[i * 3 + 0] << 2;
- palAnimSlice[i * 3 + 1] = palAnimSlice[i * 3 + 1] << 2;
- palAnimSlice[i * 3 + 2] = palAnimSlice[i * 3 + 2] << 2;
+ g_engine->_graphics->_palAnimSlice[i * 3 + 0] <<= 2;
+ g_engine->_graphics->_palAnimSlice[i * 3 + 1] <<= 2;
+ g_engine->_graphics->_palAnimSlice[i * 3 + 2] <<= 2;
}
}
paletteFile.close();
for (int i = 1; i <= 200; i++) {
- pal[i * 3 + 0] = palcp[i * 3 + 0] << 2;
- pal[i * 3 + 1] = palcp[i * 3 + 1] << 2;
- pal[i * 3 + 2] = palcp[i * 3 + 2] << 2;
+ g_engine->_graphics->_pal[i * 3 + 0] = palcp[i * 3 + 0] << 2;
+ g_engine->_graphics->_pal[i * 3 + 1] = palcp[i * 3 + 1] << 2;
+ g_engine->_graphics->_pal[i * 3 + 2] = palcp[i * 3 + 2] << 2;
}
- g_system->getPaletteManager()->setPalette(pal, 0, 201);
+ g_system->getPaletteManager()->setPalette(g_engine->_graphics->_pal, 0, 201);
} break;
case 2: {
- g_engine->_graphics->loadPaletteFromFile("SEGUNDA");
- currentRoomData->paletteAnimationFlag = true;
+ _graphics->loadPaletteFromFile("SEGUNDA");
+ _currentRoomData->paletteAnimationFlag = true;
} break;
}
}
-void loadCharAnimation() {
+void TotEngine::loadCharAnimation() {
Common::File characterFile;
- cpCounter = cpCounter2;
+ _cpCounter = _cpCounter2;
if (!characterFile.open("PERSONAJ.SPT"))
showError(265);
- mainCharFrameSize = characterFile.readUint16LE();
+ _mainCharFrameSize = characterFile.readUint16LE();
verifyCopyProtection();
for (int i = 0; i <= 3; i++)
- for (int j = 0; j < walkFrameCount; j++) {
- mainCharAnimation.bitmap[i][j] = (byte *)malloc(mainCharFrameSize);
- characterFile.read(mainCharAnimation.bitmap[i][j], mainCharFrameSize);
+ for (int j = 0; j < kWalkFrameCount; j++) {
+ _mainCharAnimation.bitmap[i][j] = (byte *)malloc(_mainCharFrameSize);
+ characterFile.read(_mainCharAnimation.bitmap[i][j], _mainCharFrameSize);
}
for (int i = 0; i < 4; i++)
- for (int j = walkFrameCount; j < (walkFrameCount + 10 * 3); j++) {
- mainCharAnimation.bitmap[i][j] = (byte *)malloc(mainCharFrameSize);
- characterFile.read(mainCharAnimation.bitmap[i][j], mainCharFrameSize);
+ for (int j = kWalkFrameCount; j < (kWalkFrameCount + 10 * 3); j++) {
+ _mainCharAnimation.bitmap[i][j] = (byte *)malloc(_mainCharFrameSize);
+ characterFile.read(_mainCharAnimation.bitmap[i][j], _mainCharFrameSize);
}
characterFile.close();
}
-void freeScreenObjects() {
- for (int i = 0; i < numScreenOverlays; i++) {
- if (screenLayers[i] != NULL)
- free(screenLayers[i]);
- screenLayers[i] = NULL;
+void TotEngine::freeScreenObjects() {
+ for (int i = 0; i < kNumScreenOverlays; i++) {
+ if (_screenLayers[i] != NULL)
+ free(_screenLayers[i]);
+ _screenLayers[i] = NULL;
}
}
-void freeAnimation() {
- if (isSecondaryAnimationEnabled) {
- isSecondaryAnimationEnabled = false;
- if(curSecondaryAnimationFrame != NULL) {
- free(curSecondaryAnimationFrame);
- }
- curSecondaryAnimationFrame = NULL;
- for(int j = 0; j < secondaryAnimDirCount; j++){
- for(int i = 0; i < secondaryAnimationFrameCount; i++){
- if(secondaryAnimation.bitmap[j][i] != NULL) {
- free(secondaryAnimation.bitmap[j][i]);
+void TotEngine::freeAnimation() {
+ if (_isSecondaryAnimationEnabled) {
+ _isSecondaryAnimationEnabled = false;
+ _curSecondaryAnimationFrame = NULL;
+ for(int j = 0; j < _secondaryAnimDirCount; j++){
+ for(int i = 0; i < _secondaryAnimationFrameCount; i++){
+ if(_secondaryAnimation.bitmap[j][i] != NULL && _secondaryAnimation.bitmap[j][i] != _curSecondaryAnimationFrame) {
+ free(_secondaryAnimation.bitmap[j][i]);
}
- secondaryAnimation.bitmap[j][i] = NULL;
+ _secondaryAnimation.bitmap[j][i] = NULL;
}
}
}
}
-void freeInventory() {
- for (int i = 0; i < inventoryIconCount; i++) {
- free(inventoryIconBitmaps[i]);
+void TotEngine::freeInventory() {
+ for (int i = 0; i < kInventoryIconCount; i++) {
+ free(_inventoryIconBitmaps[i]);
}
}
-void verifyCopyProtection2() {
+void TotEngine::verifyCopyProtection2() {
// TODO:
}
-void loadItemWithFixedDepth(uint coordx, uint coordy, uint bitmapSize, int32 bitmapIndex, uint depth) {
- screenLayers[depth] = (byte *)malloc(bitmapSize);
- readBitmap(bitmapIndex, screenLayers[depth], bitmapSize, 319);
+
+void TotEngine::loadItemWithFixedDepth(uint coordx, uint coordy, uint bitmapSize, int32 bitmapIndex, uint depth) {
+ _screenLayers[depth] = (byte *)malloc(bitmapSize);
+ readBitmap(bitmapIndex, _screenLayers[depth], bitmapSize, 319);
uint16 w, h;
- w = READ_LE_UINT16(screenLayers[depth]);
- h = READ_LE_UINT16(screenLayers[depth] + 2);
- depthMap[depth].posx = coordx;
- depthMap[depth].posy = coordy;
- depthMap[depth].posx2 = coordx + w + 1;
- depthMap[depth].posy2 = coordy + h + 1;
+ w = READ_LE_UINT16(_screenLayers[depth]);
+ h = READ_LE_UINT16(_screenLayers[depth] + 2);
+ _depthMap[depth].posx = coordx;
+ _depthMap[depth].posy = coordy;
+ _depthMap[depth].posx2 = coordx + w + 1;
+ _depthMap[depth].posy2 = coordy + h + 1;
}
-void loadItem(uint coordx, uint coordy, uint bitmapSize, int32 bitmapIndex, uint depth) {
+void TotEngine::loadItem(uint coordx, uint coordy, uint bitmapSize, int32 bitmapIndex, uint depth) {
loadItemWithFixedDepth(coordx, coordy, bitmapSize, bitmapIndex, depth - 1);
}
-void updateInventory(byte index) {
- for (int i = index; i < (inventoryIconCount - 1); i++) {
- inventory[i].bitmapIndex = inventory[i + 1].bitmapIndex;
- inventory[i].code = inventory[i + 1].code;
- inventory[i].objectName = inventory[i + 1].objectName;
+void TotEngine::updateInventory(byte index) {
+ for (int i = index; i < (kInventoryIconCount - 1); i++) {
+ _inventory[i].bitmapIndex = _inventory[i + 1].bitmapIndex;
+ _inventory[i].code = _inventory[i + 1].code;
+ _inventory[i].objectName = _inventory[i + 1].objectName;
}
// verifyCopyProtection();
}
-void readBitmap(int32 bitmapPosition, byte *buf, uint bitmapSize, uint error) {
+void TotEngine::readBitmap(int32 bitmapPosition, byte *buf, uint bitmapSize, uint error) {
Common::File bitmapFile;
if (!bitmapFile.open("BITMAPS.DAT")) {
showError(error);
@@ -369,21 +367,21 @@ void readBitmap(int32 bitmapPosition, byte *buf, uint bitmapSize, uint error) {
bitmapFile.close();
}
-void updateItem(uint itemPosition) {
- regobj.used[0] = 9;
- invItemData->seek(itemPosition);
- saveItemRegister(regobj, invItemData);
+void TotEngine::updateItem(uint itemPosition) {
+ _curObject.used[0] = 9;
+ _invItemData->seek(itemPosition);
+ saveItemRegister(_curObject, _invItemData);
}
-void readItemRegister(Common::SeekableReadStream *stream, uint itemPos, ScreenObject &thisRegObj) {
- stream->seek(itemPos * itemRegSize);
+void TotEngine::readItemRegister(Common::SeekableReadStream *stream, uint itemPos, ScreenObject &thisRegObj) {
+ stream->seek(itemPos * kItemRegSize);
clearObj();
thisRegObj.code = stream->readUint16LE();
thisRegObj.height = stream->readByte();
thisRegObj.name = stream->readPascalString();
- stream->skip(objectNameLength - thisRegObj.name.size());
+ stream->skip(kObjectNameLength - thisRegObj.name.size());
thisRegObj.lookAtTextRef = stream->readUint16LE();
thisRegObj.beforeUseTextRef = stream->readUint16LE();
@@ -417,29 +415,29 @@ void readItemRegister(Common::SeekableReadStream *stream, uint itemPos, ScreenOb
stream->read(thisRegObj.mouseGridPatch, 100);
}
-void readItemRegister(uint itemPosition) {
- readItemRegister(invItemData, itemPosition, regobj);
+void TotEngine::readItemRegister(uint itemPosition) {
+ readItemRegister(_invItemData, itemPosition, _curObject);
}
-void drawLookAtItem(RoomObjectListEntry obj) {
- g_engine->_mouseManager->hide();
+void TotEngine::drawLookAtItem(RoomObjectListEntry obj) {
+ _mouse->hide();
bar(0, 140, 319, 149, 0);
actionLineText(getActionLineText(3) + obj.objectName);
- g_engine->_mouseManager->show();
+ _mouse->show();
}
-void putIcon(uint iconPosX, uint iconPosY, uint iconNum) {
+void TotEngine::putIcon(uint iconPosX, uint iconPosY, uint iconNum) {
// substract 1 to account for 1-based indices
- g_engine->_graphics->putImg(iconPosX, iconPosY, inventoryIconBitmaps[inventory[iconNum].bitmapIndex - 1]);
+ _graphics->putImg(iconPosX, iconPosY, _inventoryIconBitmaps[_inventory[iconNum].bitmapIndex - 1]);
}
-void drawBackpack() {
- putIcon(34, 169, inventoryPosition);
- putIcon(77, 169, inventoryPosition + 1);
- putIcon(120, 169, inventoryPosition + 2);
- putIcon(163, 169, inventoryPosition + 3);
- putIcon(206, 169, inventoryPosition + 4);
- putIcon(249, 169, inventoryPosition + 5);
+void TotEngine::drawBackpack() {
+ putIcon(34, 169, _inventoryPosition);
+ putIcon(77, 169, _inventoryPosition + 1);
+ putIcon(120, 169, _inventoryPosition + 2);
+ putIcon(163, 169, _inventoryPosition + 3);
+ putIcon(206, 169, _inventoryPosition + 4);
+ putIcon(249, 169, _inventoryPosition + 5);
}
void lightUpLeft() {
@@ -470,53 +468,53 @@ void turnOffRight() {
line(311, 190, 292, 190, 255);
}
-void drawInventory(byte dir, byte max) {
+void TotEngine::drawInventory(byte dir, byte max) {
switch (dir) {
case 0:
- if (inventoryPosition > 0) {
- inventoryPosition -= 1;
+ if (_inventoryPosition > 0) {
+ _inventoryPosition -= 1;
drawBackpack();
}
break;
case 1:
- if (inventoryPosition < (max - 6)) {
- inventoryPosition += 1;
+ if (_inventoryPosition < (max - 6)) {
+ _inventoryPosition += 1;
drawBackpack();
}
break;
}
- g_engine->_mouseManager->hide();
- if (inventoryPosition > 0)
+ _mouse->hide();
+ if (_inventoryPosition > 0)
lightUpLeft();
else
turnOffLeft();
- if (inventory[inventoryPosition + 6].code > 0)
+ if (_inventory[_inventoryPosition + 6].code > 0)
lightUpRight();
else
turnOffRight();
- g_engine->_mouseManager->show();
- if (cpCounter > 145)
+ _mouse->show();
+ if (_cpCounter > 145)
showError(274);
}
-void mask() {
+void TotEngine::mask() {
buttonBorder(0, 140, 319, 149, 0, 0, 0, 0, 0);
for (int i = 1; i <= 25; i++)
buttonBorder(0, (175 - i), 319, (174 + i), 251, 251, 251, 251, 0);
drawMenu(1);
// verifyCopyProtection();
- if (inventoryPosition > 1)
+ if (_inventoryPosition > 1)
lightUpLeft();
else
turnOffLeft();
- if (inventory[inventoryPosition + 6].code > 0)
+ if (_inventory[_inventoryPosition + 6].code > 0)
lightUpRight();
else
turnOffRight();
}
-void drawMenu(byte menuNumber) {
+void TotEngine::drawMenu(byte menuNumber) {
byte *bitmap;
uint menuSize;
byte xmenu, ymenu;
@@ -527,8 +525,8 @@ void drawMenu(byte menuNumber) {
showError(258);
}
- menuOffset = g_engine->_lang == Common::ES_ESP ? menuOffsets_ES[menuNumber - 1][0] : menuOffsets_EN[menuNumber - 1][0];
- menuSize = g_engine->_lang == Common::ES_ESP ? menuOffsets_ES[menuNumber - 1][1] : menuOffsets_EN[menuNumber - 1][1];
+ menuOffset = _lang == Common::ES_ESP ? menuOffsets_ES[menuNumber - 1][0] : menuOffsets_EN[menuNumber - 1][0];
+ menuSize = _lang == Common::ES_ESP ? menuOffsets_ES[menuNumber - 1][1] : menuOffsets_EN[menuNumber - 1][1];
switch (menuNumber) {
case 1: {
@@ -544,13 +542,13 @@ void drawMenu(byte menuNumber) {
ymenu = 10;
} break;
case 4: {
- if (cpCounter2 > 20)
+ if (_cpCounter2 > 20)
showError(274);
xmenu = 50;
ymenu = 10;
} break;
case 5: {
- if (cpCounter > 23)
+ if (_cpCounter > 23)
showError(274);
xmenu = 0;
ymenu = 150;
@@ -572,13 +570,11 @@ void drawMenu(byte menuNumber) {
bitmap = (byte *)malloc(menuSize);
menuFile.seek(menuOffset);
menuFile.read(bitmap, menuSize);
- g_engine->_graphics->putImg(xmenu, ymenu, bitmap);
+ _graphics->putImg(xmenu, ymenu, bitmap);
free(bitmap);
menuFile.close();
}
-void generateDiploma(Common::String &photoName);
-
static void loadDiploma(Common::String &photoName, Common::String &key) {
palette auxPal;
byte *screen;
@@ -608,21 +604,21 @@ static void loadDiploma(Common::String &photoName, Common::String &key) {
if (dipFile.open(Common::Path("DIPLOMA/" + photoName + ".FOT"))) {
size = dipFile.size() - 768;
screen = (byte *)malloc(size);
- dipFile.read(pal, 768);
+ dipFile.read(g_engine->_graphics->_pal, 768);
dipFile.read(screen, size);
dipFile.close();
g_engine->_graphics->putShape(10, 20, screen);
free(screen);
}
for (int i = 16; i <= 255; i++) {
- auxPal[i * 3 + 0] = pal[i * 3 + 0];
- auxPal[i * 3 + 1] = pal[i * 3 + 1];
- auxPal[i * 3 + 2] = pal[i * 3 + 2];
+ auxPal[i * 3 + 0] = g_engine->_graphics->_pal[i * 3 + 0];
+ auxPal[i * 3 + 1] = g_engine->_graphics->_pal[i * 3 + 1];
+ auxPal[i * 3 + 2] = g_engine->_graphics->_pal[i * 3 + 2];
}
- g_engine->_graphics->copyPalette(auxPal, pal);
- g_engine->_graphics->fixPalette(pal, 768);
- g_engine->_graphics->setPalette(pal);
+ g_engine->_graphics->copyPalette(auxPal, g_engine->_graphics->_pal);
+ g_engine->_graphics->fixPalette(g_engine->_graphics->_pal, 768);
+ g_engine->_graphics->setPalette(g_engine->_graphics->_pal);
g_engine->_screen->markAllDirty();
g_engine->_screen->update();
@@ -638,7 +634,7 @@ static void loadDiploma(Common::String &photoName, Common::String &key) {
biosText(81, 61, messages[50], 0);
biosText(61, 81, messages[51], 0);
- biosText(31, 101, messages[52] + characterName, 0);
+ biosText(31, 101, messages[52] + g_engine->_characterName, 0);
biosText(31, 121, messages[53], 0);
biosText(31, 141, messages[54], 0);
biosText(31, 161, messages[55], 0);
@@ -647,7 +643,7 @@ static void loadDiploma(Common::String &photoName, Common::String &key) {
biosText(60, 80, messages[51], 15);
biosText(30, 100, messages[52], 15);
- biosText(150, 100, characterName, 13);
+ biosText(150, 100, g_engine->_characterName, 13);
biosText(30, 120, messages[53], 15);
biosText(30, 140, messages[54], 15);
@@ -673,79 +669,79 @@ static void saveDiploma(Common::String &photoName, Common::String &key) {
delete thumbnail;
}
-void generateDiploma(Common::String &photoName) {
+void TotEngine::generateDiploma(Common::String &photoName) {
Common::String key;
- g_engine->_mouseManager->hide();
+ _mouse->hide();
photoName.toUppercase();
- g_engine->_graphics->totalFadeOut(0);
+ _graphics->totalFadeOut(0);
loadDiploma(photoName, key);
Common::Event e;
bool keyPressed = false;
do {
- g_engine->_screen->update();
+ _screen->update();
while (g_system->getEventManager()->pollEvent(e)) {
if (e.type == Common::EVENT_KEYUP) {
keyPressed = true;
}
}
g_system->delayMillis(10);
- } while (!keyPressed && !g_engine->shouldQuit());
+ } while (!keyPressed && !shouldQuit());
saveDiploma(photoName, key);
- g_engine->_mouseManager->show();
+ _mouse->show();
}
-void checkMouseGrid() {
+void TotEngine::checkMouseGrid() {
uint xGrid, yGrid;
Common::String invObject;
- if (cpCounter2 > 120)
+ if (_cpCounter2 > 120)
showError(274);
- if (mouseY >= 0 && mouseY <= 131) {
- xGrid = (mouseX + 7) / xGridCount;
- yGrid = (mouseY + 7) / yGridCount;
- if (currentRoomData->mouseGrid[xGrid][yGrid] != currentRoomData->mouseGrid[oldGridX][oldGridY] || oldInventoryObjectName != "") {
+ if (_mouse->mouseY >= 0 && _mouse->mouseY <= 131) {
+ xGrid = _mouse->getMouseCoordsWithinGrid().x;
+ yGrid = _mouse->getMouseCoordsWithinGrid().y;
+ if (_currentRoomData->mouseGrid[xGrid][yGrid] != _currentRoomData->mouseGrid[oldGridX][oldGridY] || _oldInventoryObjectName != "") {
bar(0, 140, 319, 149, 0);
Common::String actionLine;
- switch (actionCode) {
+ switch (_actionCode) {
case 0:
- actionLine = getActionLineText(0) + currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[xGrid][yGrid]]->objectName;
+ actionLine = getActionLineText(0) + _currentRoomData->screenObjectIndex[_currentRoomData->mouseGrid[xGrid][yGrid]]->objectName;
break;
case 1:
- actionLine = getActionLineText(1) + currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[xGrid][yGrid]]->objectName;
+ actionLine = getActionLineText(1) + _currentRoomData->screenObjectIndex[_currentRoomData->mouseGrid[xGrid][yGrid]]->objectName;
break;
case 2:
- actionLine = getActionLineText(2) + currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[xGrid][yGrid]]->objectName;
+ actionLine = getActionLineText(2) + _currentRoomData->screenObjectIndex[_currentRoomData->mouseGrid[xGrid][yGrid]]->objectName;
break;
case 3:
- actionLine = getActionLineText(3) + currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[xGrid][yGrid]]->objectName;
+ actionLine = getActionLineText(3) + _currentRoomData->screenObjectIndex[_currentRoomData->mouseGrid[xGrid][yGrid]]->objectName;
break;
case 4:
- if (inventoryObjectName != "")
- actionLine = getActionLineText(4) + inventoryObjectName + getActionLineText(7) + currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[xGrid][yGrid]]->objectName;
+ if (_inventoryObjectName != "")
+ actionLine = getActionLineText(4) + _inventoryObjectName + getActionLineText(7) + _currentRoomData->screenObjectIndex[_currentRoomData->mouseGrid[xGrid][yGrid]]->objectName;
else
- actionLine = getActionLineText(4) + currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[xGrid][yGrid]]->objectName;
+ actionLine = getActionLineText(4) + _currentRoomData->screenObjectIndex[_currentRoomData->mouseGrid[xGrid][yGrid]]->objectName;
break;
case 5:
- actionLine = getActionLineText(5) + currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[xGrid][yGrid]]->objectName;
+ actionLine = getActionLineText(5) + _currentRoomData->screenObjectIndex[_currentRoomData->mouseGrid[xGrid][yGrid]]->objectName;
break;
case 6:
- actionLine = getActionLineText(6) + currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[xGrid][yGrid]]->objectName;
+ actionLine = getActionLineText(6) + _currentRoomData->screenObjectIndex[_currentRoomData->mouseGrid[xGrid][yGrid]]->objectName;
break;
default:
- actionLine = getActionLineText(0) + currentRoomData->screenObjectIndex[currentRoomData->mouseGrid[xGrid][yGrid]]->objectName;
+ actionLine = getActionLineText(0) + _currentRoomData->screenObjectIndex[_currentRoomData->mouseGrid[xGrid][yGrid]]->objectName;
}
actionLineText(actionLine);
- g_engine->_mouseManager->show();
+ _mouse->show();
oldGridX = xGrid;
oldGridY = yGrid;
}
- oldActionCode = 253;
- oldInventoryObjectName = "";
- } else if (mouseY >= 132 && mouseY <= 165) {
- if (actionCode != oldActionCode) {
+ _oldActionCode = 253;
+ _oldInventoryObjectName = "";
+ } else if (_mouse->mouseY >= 132 && _mouse->mouseY <= 165) {
+ if (_actionCode != _oldActionCode) {
bar(0, 140, 319, 149, 0);
Common::String actionLine;
- switch (actionCode) {
+ switch (_actionCode) {
case 0:
actionLine = getActionLineText(0);
break;
@@ -759,8 +755,8 @@ void checkMouseGrid() {
actionLine = getActionLineText(3);
break;
case 4:
- if (inventoryObjectName != "")
- actionLine = getActionLineText(4) + inventoryObjectName + getActionLineText(7);
+ if (_inventoryObjectName != "")
+ actionLine = getActionLineText(4) + _inventoryObjectName + getActionLineText(7);
else
actionLine = getActionLineText(4);
break;
@@ -772,33 +768,33 @@ void checkMouseGrid() {
break;
}
actionLineText(actionLine);
- g_engine->_mouseManager->show();
- oldActionCode = actionCode;
- oldInventoryObjectName = "";
+ _mouse->show();
+ _oldActionCode = _actionCode;
+ _oldInventoryObjectName = "";
oldGridX = 0;
oldGridY = 0;
}
- } else if (mouseY >= 166 && mouseY <= 199) {
- if (mouseX >= 26 && mouseX <= 65) {
- invObject = inventory[inventoryPosition].objectName;
- } else if (mouseX >= 70 && mouseX <= 108) {
- invObject = inventory[inventoryPosition + 1].objectName;
- } else if (mouseX >= 113 && mouseX <= 151) {
- invObject = inventory[inventoryPosition + 2].objectName;
- } else if (mouseX >= 156 && mouseX <= 194) {
- invObject = inventory[inventoryPosition + 3].objectName;
- } else if (mouseX >= 199 && mouseX <= 237) {
- invObject = inventory[inventoryPosition + 4].objectName;
- } else if (mouseX >= 242 && mouseX <= 280) {
- invObject = inventory[inventoryPosition + 5].objectName;
+ } else if (_mouse->mouseY >= 166 && _mouse->mouseY <= 199) {
+ if (_mouse->mouseX >= 26 && _mouse->mouseX <= 65) {
+ invObject = _inventory[_inventoryPosition].objectName;
+ } else if (_mouse->mouseX >= 70 && _mouse->mouseX <= 108) {
+ invObject = _inventory[_inventoryPosition + 1].objectName;
+ } else if (_mouse->mouseX >= 113 && _mouse->mouseX <= 151) {
+ invObject = _inventory[_inventoryPosition + 2].objectName;
+ } else if (_mouse->mouseX >= 156 && _mouse->mouseX <= 194) {
+ invObject = _inventory[_inventoryPosition + 3].objectName;
+ } else if (_mouse->mouseX >= 199 && _mouse->mouseX <= 237) {
+ invObject = _inventory[_inventoryPosition + 4].objectName;
+ } else if (_mouse->mouseX >= 242 && _mouse->mouseX <= 280) {
+ invObject = _inventory[_inventoryPosition + 5].objectName;
} else {
invObject = ' ';
}
- if (invObject != oldInventoryObjectName || oldGridX != 0) {
+ if (invObject != _oldInventoryObjectName || oldGridX != 0) {
bar(0, 140, 319, 149, 0);
Common::String actionLine;
- switch (actionCode) {
+ switch (_actionCode) {
case 1:
actionLine = getActionLineText(1) + invObject;
break;
@@ -809,10 +805,10 @@ void checkMouseGrid() {
actionLine = getActionLineText(3) + invObject;
break;
case 4:
- if (inventoryObjectName == "")
+ if (_inventoryObjectName == "")
actionLine = getActionLineText(4) + invObject;
else
- actionLine = getActionLineText(4) + inventoryObjectName + getActionLineText(7) + invObject;
+ actionLine = getActionLineText(4) + _inventoryObjectName + getActionLineText(7) + invObject;
break;
case 5:
actionLine = getActionLineText(5) + invObject;
@@ -824,16 +820,16 @@ void checkMouseGrid() {
euroText(160, 144, invObject, 255, Graphics::kTextAlignCenter);
}
actionLineText(actionLine);
- g_engine->_mouseManager->show();
- oldInventoryObjectName = invObject;
+ _mouse->show();
+ _oldInventoryObjectName = invObject;
}
- oldActionCode = 255;
+ _oldActionCode = 255;
oldGridX = 0;
oldGridY = 0;
}
}
-void readAlphaGraph(Common::String &output, int length, int posx, int posy, byte barColor) {
+void TotEngine::readAlphaGraph(Common::String &output, int length, int posx, int posy, byte barColor) {
int pun = 1;
bar(posx, posy - 2, posx + length * 8, posy + 8, barColor);
@@ -841,7 +837,7 @@ void readAlphaGraph(Common::String &output, int length, int posx, int posy, byte
Common::Event e;
bool done = false;
- while (!done && !g_engine->shouldQuit()) {
+ while (!done && !shouldQuit()) {
while (g_system->getEventManager()->pollEvent(e)) {
if (e.type == Common::EVENT_KEYDOWN) {
@@ -856,7 +852,7 @@ void readAlphaGraph(Common::String &output, int length, int posx, int posy, byte
}
// Max 8 chars
if (pun > length && asciiCode != 8) {
- g_engine->_sound->beep(750, 60);
+ _sound->beep(750, 60);
bar((posx + (output.size()) * 8), (posy - 2), (posx + (output.size() + 1) * 8), (posy + 8), 0);
} else if (asciiCode == 8 && pun > 1) { // delete
output = output.substr(0, output.size() - 1);
@@ -869,7 +865,7 @@ void readAlphaGraph(Common::String &output, int length, int posx, int posy, byte
(asciiCode < 65 || asciiCode > 90) &&
(asciiCode < 32 || asciiCode > 57) &&
(asciiCode < 164 || asciiCode > 165)) {
- g_engine->_sound->beep(1200, 60);
+ _sound->beep(1200, 60);
} else {
pun += 1;
output = output + (char)e.kbd.ascii;
@@ -880,11 +876,11 @@ void readAlphaGraph(Common::String &output, int length, int posx, int posy, byte
}
}
g_system->delayMillis(10);
- g_engine->_screen->update();
+ _screen->update();
}
}
-void readAlphaGraphSmall(Common::String &output, int length, int posx, int posy, byte barColor,
+void TotEngine::readAlphaGraphSmall(Common::String &output, int length, int posx, int posy, byte barColor,
byte textColor) {
int pun = 1;
bool borracursor;
@@ -894,7 +890,7 @@ void readAlphaGraphSmall(Common::String &output, int length, int posx, int posy,
Common::Event e;
bool done = false;
- while (!done && !g_engine->shouldQuit()) {
+ while (!done && !shouldQuit()) {
while (g_system->getEventManager()->pollEvent(e)) {
if (e.type == Common::EVENT_KEYDOWN) {
int keycode = e.kbd.keycode;
@@ -908,7 +904,7 @@ void readAlphaGraphSmall(Common::String &output, int length, int posx, int posy,
}
if (pun > length && asciiCode != 8) {
- g_engine->_sound->beep(750, 60);
+ _sound->beep(750, 60);
bar((posx + (output.size()) * 6), (posy + 2), (posx + (output.size() + 1) * 6), (posy + 9), barColor);
} else if (asciiCode == 8 && pun > 1) {
output = output.substr(0, output.size() - 1);
@@ -918,7 +914,7 @@ void readAlphaGraphSmall(Common::String &output, int length, int posx, int posy,
pun -= 1;
borracursor = true;
} else if ((asciiCode < '\40') || (asciiCode > '\373')) {
- g_engine->_sound->beep(1200, 60);
+ _sound->beep(1200, 60);
borracursor = false;
} else {
pun += 1;
@@ -932,14 +928,14 @@ void readAlphaGraphSmall(Common::String &output, int length, int posx, int posy,
}
g_system->delayMillis(10);
- g_engine->_screen->update();
+ _screen->update();
}
if (borracursor)
bar(posx + (output.size()) * 6, posy + 2, (posx + (output.size()) * 6) + 6, posy + 9, barColor);
}
-void hyperText(
+void TotEngine::displayObjectDescription(
Common::String textString,
uint xpos,
uint ypos,
@@ -952,10 +948,10 @@ void hyperText(
if (textString.size() < maxWidth) {
euroText((xpos + 1), (ypos + 1), textString, shadowColor);
- g_engine->_screen->update();
+ _screen->update();
delay(kEnforcedTextAnimDelay);
euroText(xpos, ypos, textString, textColor);
- g_engine->_screen->update();
+ _screen->update();
delay(kEnforcedTextAnimDelay);
} else {
ihc = 0;
@@ -976,16 +972,16 @@ void hyperText(
for (byte line = 1; line <= lineCounter; line++) {
Common::String lineString = textString.substr(newLineMatrix[line - 1], newLineMatrix[line] - newLineMatrix[line - 1]);
euroText((xpos + 1), (ypos + ((line - 1) * 11) + 1), lineString, shadowColor);
- g_engine->_screen->update();
+ _screen->update();
delay(kEnforcedTextAnimDelay);
euroText(xpos, (ypos + ((line - 1) * 11)), lineString, textColor);
- g_engine->_screen->update();
+ _screen->update();
delay(kEnforcedTextAnimDelay);
}
}
}
-void buttonBorder(uint x1, uint y1, uint x2, uint y2,
+void TotEngine::buttonBorder(uint x1, uint y1, uint x2, uint y2,
byte color1, byte color2, byte color3, byte color4, byte color5) {
bar(x1, y1, x2, y2, color4);
@@ -998,12 +994,12 @@ void buttonBorder(uint x1, uint y1, uint x2, uint y2,
putpixel(x2, y1, color3);
putpixel(x1, y2, color3);
- g_engine->_screen->addDirtyRect(Common::Rect(
+ _screen->addDirtyRect(Common::Rect(
x1, y1, x2, y2));
- g_engine->_screen->update();
+ _screen->update();
}
-void copyProtection() {
+void TotEngine::copyProtection() {
//todo
}
@@ -1035,14 +1031,14 @@ void drawCreditsScreen(byte *&backgroundPointer, uint &sizeAuxBG, byte *&auxBG)
darkPalette[i * 3 + 1] = 0;
darkPalette[i * 3 + 2] = 0;
// Adjust for 6-bit DAC color
- intermediatePalette[i * 3 + 0] = intermediatePalette[i * 3 + 0] << 2;
- intermediatePalette[i * 3 + 1] = intermediatePalette[i * 3 + 1] << 2;
- intermediatePalette[i * 3 + 2] = intermediatePalette[i * 3 + 2] << 2;
+ intermediatePalette[i * 3 + 0] <<= 2;
+ intermediatePalette[i * 3 + 1] <<= 2;
+ intermediatePalette[i * 3 + 2] <<= 2;
}
g_engine->_graphics->fadePalettes(darkPalette, intermediatePalette);
- g_engine->_graphics->copyPalette(intermediatePalette, pal);
- if (cpCounter2 > 9)
+ g_engine->_graphics->copyPalette(intermediatePalette, g_engine->_graphics->_pal);
+ if (g_engine->_cpCounter2 > 9)
showError(274);
}
@@ -1059,10 +1055,10 @@ void putCreditsImg(uint x, uint y, byte *img1, byte *img2, bool direct) {
step = (byte *)malloc((wImg1 + 1) * (hImg1 + 1) + 4);
horizontalAux = wImg1 + 1;
- foo = hImg1 + y;
+ uint yPos = hImg1 + y;
// makes sure that if the image is at the bottom of the screen we chop the bottom part
- for (int i = foo; i >= 200; i--)
+ for (int i = yPos; i >= 200; i--)
hImg1 -= 1;
hImg1++;
@@ -1076,13 +1072,13 @@ void putCreditsImg(uint x, uint y, byte *img1, byte *img2, bool direct) {
for (int kk = 0; kk < hImg1; kk++) {
inc2 = (kk * wImg1) + 4;
- foo = kk + y;
+ yPos = kk + y;
for (int jj = 0; jj <= wImg1; jj++) {
inc = inc2 + jj;
- if ((direct && img1[inc] > 0) || (img1[inc] > 16 && foo >= 66 && foo <= 192)) {
+ if ((direct && img1[inc] > 0) || (img1[inc] > 16 && yPos >= 66 && yPos <= 192)) {
step[inc] = img1[inc];
} else if (img1[inc] > 16) {
- switch (foo) {
+ switch (yPos) {
case 59:
case 199:
step[inc] = img1[inc] + 210;
@@ -1146,22 +1142,22 @@ void scrollCredit(
showError(270);
}
creditFile.seek(position);
- creditFile.read(sceneBackground, size);
+ creditFile.read(g_engine->sceneBackground, size);
creditFile.read(pal2, 768);
creditFile.close();
for (int i = 16; i <= 255; i++) {
// Adjust for 6-bit DAC
- pal2[i * 3 + 0] = pal2[i * 3 + 0] << 2;
- pal2[i * 3 + 1] = pal2[i * 3 + 1] << 2;
- pal2[i * 3 + 2] = pal2[i * 3 + 2] << 2;
+ pal2[i * 3 + 0] <<= 2;
+ pal2[i * 3 + 1] <<= 2;
+ pal2[i * 3 + 2] <<= 2;
- pal[i * 3 + 0] = pal2[i * 3 + 0];
- pal[i * 3 + 1] = pal2[i * 3 + 1];
- pal[i * 3 + 2] = pal2[i * 3 + 2];
+ g_engine->_graphics->_pal[i * 3 + 0] = pal2[i * 3 + 0];
+ g_engine->_graphics->_pal[i * 3 + 1] = pal2[i * 3 + 1];
+ g_engine->_graphics->_pal[i * 3 + 2] = pal2[i * 3 + 2];
}
- g_engine->_graphics->setPalette(&pal[16 * 3 + 0], 16, 240);
+ g_engine->_graphics->setPalette(&g_engine->_graphics->_pal[16 * 3 + 0], 16, 240);
Common::Event e;
bool keyPressed = false;
@@ -1172,7 +1168,7 @@ void scrollCredit(
keyPressed = true;
}
}
- putCreditsImg(85, i, sceneBackground, background, !withFade);
+ putCreditsImg(85, i, g_engine->sceneBackground, background, !withFade);
if (keyPressed) {
exit = true;
break;
@@ -1245,7 +1241,7 @@ inline bool keyPressed() {
return e.type == Common::EVENT_KEYUP;
}
-void credits() {
+void TotEngine::credits() {
saveAllowed = true;
debug("Credits");
palette pal2;
@@ -1254,12 +1250,12 @@ void credits() {
uint sizeBg2;
bool exit;
- g_engine->_mouseManager->hide();
- g_engine->_graphics->totalFadeOut(0);
- g_engine->_sound->fadeOutMusic(musicVolLeft, musicVolRight);
- g_engine->_screen->clear();
- g_engine->_sound->playMidi("CREDITOS", true);
- g_engine->_sound->fadeInMusic(musicVolLeft, musicVolRight);
+ _mouse->hide();
+ _graphics->totalFadeOut(0);
+ _sound->fadeOutMusic(_sound->_musicVolLeft, _sound->_musicVolRight);
+ _screen->clear();
+ _sound->playMidi("CREDITOS", true);
+ _sound->fadeInMusic(_sound->_musicVolLeft, _sound->_musicVolRight);
drawCreditsScreen(background, sizeBg2, background2);
exit = false;
@@ -1290,10 +1286,10 @@ void credits() {
removeTitle(background2);
if (keyPressed() || exit)
goto Lexit;
- g_engine->_graphics->putImg(0, 0, background2);
+ _graphics->putImg(0, 0, background2);
if (keyPressed() || exit)
goto Lexit;
- g_engine->_graphics->copyFromScreen(background);
+ _graphics->copyFromScreen(background);
if (keyPressed() || exit)
goto Lexit;
scrollCredit(59904, 8004, pal2, background, exit, 10, false, true);
@@ -1320,47 +1316,47 @@ void credits() {
removeTitle(background2);
if (keyPressed() || exit)
goto Lexit;
- g_engine->_graphics->putImg(0, 0, background2);
+ _graphics->putImg(0, 0, background2);
if (keyPressed() || exit)
goto Lexit;
- g_engine->_graphics->copyFromScreen(background);
+ _graphics->copyFromScreen(background);
if (keyPressed() || exit)
goto Lexit;
scrollCredit(121308, 8004, pal2, background, exit, 80, false, true);
Lexit:
delay(1000);
- g_engine->_graphics->totalFadeOut(0);
- g_engine->_sound->fadeOutMusic(musicVolLeft, musicVolRight);
- g_engine->_screen->clear();
- g_engine->_sound->playMidi("INTRODUC", true);
- g_engine->_sound->fadeInMusic(musicVolLeft, musicVolRight);
- g_engine->_mouseManager->show();
+ _graphics->totalFadeOut(0);
+ _sound->fadeOutMusic(_sound->_musicVolLeft, _sound->_musicVolRight);
+ _screen->clear();
+ _sound->playMidi("INTRODUC", true);
+ _sound->fadeInMusic(_sound->_musicVolLeft, _sound->_musicVolRight);
+ _mouse->show();
free(background);
free(background2);
}
-void introduction() {
+void TotEngine::introduction() {
saveAllowed = false;
- g_engine->_mouseManager->hide();
+ _mouse->hide();
bool exitPressed;
uint loopCount;
- bool isSpanish = g_engine->_lang == Common::ES_ESP;
+ bool isSpanish = _lang == Common::ES_ESP;
const char *const *messages = (isSpanish) ? fullScreenMessages[0] : fullScreenMessages[1];
- const long *offsets = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0] : flcOffsets[1];
+ const long *offsets = (_lang == Common::ES_ESP) ? flcOffsets[0] : flcOffsets[1];
exitPressed = false;
- g_engine->_graphics->totalFadeOut(0);
+ _graphics->totalFadeOut(0);
- if (cpCounter > 6)
+ if (_cpCounter > 6)
showError(270);
- g_engine->_screen->clear();
+ _screen->clear();
drawFlc(136, 53, offsets[2], 136, 9, 1, true, true, false, exitPressed);
if (exitPressed)
goto Lsalirpres;
drawFlc(135, 54, offsets[3], 0, 9, 2, true, true, false, exitPressed);
if (exitPressed)
goto Lsalirpres;
- g_engine->_graphics->totalFadeOut(0);
- g_engine->_screen->clear();
+ _graphics->totalFadeOut(0);
+ _screen->clear();
if(isSpanish) {
littText(25, 20, messages[0], 253);
littText(25, 35, messages[1], 253);
@@ -1380,16 +1376,16 @@ void introduction() {
littText(25, 115, messages[4], 253);
littText(25, 135, messages[5], 253);
}
- if(g_engine->shouldQuit()){
+ if(shouldQuit()){
return;
}
- g_engine->_graphics->totalFadeIn(0, "DEFAULT");
- g_engine->_screen->markAllDirty();
- g_engine->_screen->update();
+ _graphics->totalFadeIn(0, "DEFAULT");
+ _screen->markAllDirty();
+ _screen->update();
loopCount = 0;
do {
- g_engine->_chrono->updateChrono();
+ _chrono->updateChrono();
Common::Event e;
g_system->getEventManager()->pollEvent(e);
if (e.type == Common::EVENT_KEYDOWN || e.type == Common::EVENT_LBUTTONUP) {
@@ -1400,10 +1396,10 @@ void introduction() {
loopCount += 1;
}
g_system->delayMillis(10);
- } while (loopCount < 180 && !g_engine->shouldQuit());
+ } while (loopCount < 180 && !shouldQuit());
- g_engine->_graphics->totalFadeOut(0);
- g_engine->_screen->clear();
+ _graphics->totalFadeOut(0);
+ _screen->clear();
drawFlc(0, 0, offsets[4], 0, 9, 3, true, true, false, exitPressed);
if (exitPressed)
goto Lsalirpres;
@@ -1464,51 +1460,51 @@ void introduction() {
delay(1000);
Lsalirpres:
debug("Exiting intro!");
- g_engine->_graphics->totalFadeOut(0);
- g_engine->_screen->clear();
- g_engine->_mouseManager->show();
+ _graphics->totalFadeOut(0);
+ _screen->clear();
+ _mouse->show();
}
-void firstIntroduction() {
- if (!firstTimeDone && !isIntroSeen) {
+void TotEngine::firstIntroduction() {
+ if (!_firstTimeDone && !_isIntroSeen) {
introduction();
- firstTimeDone = true;
+ _firstTimeDone = true;
ConfMan.setBool("introSeen", true);
ConfMan.flushToDisk();
}
}
-void initialLogo() {
+void TotEngine::initialLogo() {
bool foobar = false;
- long offset = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0][0] : flcOffsets[1][0];
+ long offset = (_lang == Common::ES_ESP) ? flcOffsets[0][0] : flcOffsets[1][0];
drawFlc(0, 0, offset, 0, 18, 25, false, false, false, foobar);
delay(1000);
}
-void initialMenu(bool fade) {
+void TotEngine::initialMenu(bool fade) {
bool bar = false;
bool validOption = false;
- g_engine->_sound->stopVoc();
+ _sound->stopVoc();
- long offset = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0][1] : flcOffsets[1][1];
+ long offset = (_lang == Common::ES_ESP) ? flcOffsets[0][1] : flcOffsets[1][1];
if (fade)
drawFlc(0, 0, offset, 0, 9, 0, true, false, false, bar);
else
drawFlc(0, 0, offset, 0, 9, 0, false, false, false, bar);
- if (cpCounter2 > 10)
+ if (_cpCounter2 > 10)
showError(274);
- mouseX = 160;
- mouseY = 95;
- mouseMaskIndex = 1;
- g_engine->_mouseManager->setMousePos(mouseMaskIndex, mouseX, mouseY);
+ _mouse->mouseX = 160;
+ _mouse->mouseY = 95;
+ _mouse->mouseMaskIndex = 1;
+ _mouse->warpMouse(_mouse->mouseMaskIndex, _mouse->mouseX, _mouse->mouseY);
Common::Event e;
do {
- g_engine->_chrono->updateChrono();
- g_engine->_mouseManager->animateMouseIfNeeded();
+ _chrono->updateChrono();
+ _mouse->animateMouseIfNeeded();
while (g_system->getEventManager()->pollEvent(e)) {
if (isMouseEvent(e)) {
- g_engine->_mouseManager->setMousePos(e.mouse);
+ _mouse->warpMouse(e.mouse);
}
if (e.type == Common::EVENT_KEYDOWN) {
if (e.kbd.keycode == Common::KEYCODE_ESCAPE) {
@@ -1520,8 +1516,8 @@ void initialMenu(bool fade) {
uint y = e.mouse.y + 7;
if (y > 105 && y < 120) {
if (x > 46 && x < 145) {
- startNewGame = true;
- continueGame = false;
+ _startNewGame = true;
+ _continueGame = false;
validOption = true;
} else if (x > 173 && x < 267) {
credits();
@@ -1529,30 +1525,30 @@ void initialMenu(bool fade) {
}
} else if (y > 140 && y < 155) {
if (x > 173 && x < 292) {
- g_engine->_graphics->totalFadeOut(0);
- g_engine->_screen->clear();
+ _graphics->totalFadeOut(0);
+ _screen->clear();
introduction();
drawFlc(0, 0, offset, 0, 9, 0, true, false, false, bar);
} else if (x >= 18 && x <= 145) {
debug("Load");
- startNewGame = false;
- continueGame = false;
+ _startNewGame = false;
+ _continueGame = false;
validOption = true;
}
} else if (y > 174 && y < 190) {
if (x > 20 && x < 145) {
- startNewGame = false;
+ _startNewGame = false;
validOption = true;
- continueGame = true;
+ _continueGame = true;
} else if (x > 173 && y < 288) {
exitToDOS();
}
}
}
}
- g_engine->_screen->update();
+ _screen->update();
g_system->delayMillis(10);
- } while (!validOption && !g_engine->shouldQuit());
+ } while (!validOption && !shouldQuit());
}
void exitGame() {
@@ -1560,45 +1556,45 @@ void exitGame() {
g_system->quit();
}
-void clearGame() {
+void TotEngine::clearGame() {
debug("releasing game...");
resetGameState();
clearAnims();
clearVars();
}
-void exitToDOS() {
+void TotEngine::exitToDOS() {
debug("Exit to dos!");
uint oldMousePosX, oldMousePosY, dialogSize;
byte oldMouseMask;
char exitChar;
- oldMousePosX = mouseX;
- oldMousePosY = mouseY;
- oldMouseMask = mouseMaskIndex;
- g_engine->_mouseManager->hide();
+ oldMousePosX = _mouse->mouseX;
+ oldMousePosY = _mouse->mouseY;
+ oldMouseMask = _mouse->mouseMaskIndex;
+ _mouse->hide();
dialogSize = imagesize(58, 48, 262, 120);
byte *dialogBackground = (byte *)malloc(dialogSize);
- g_engine->_graphics->getImg(58, 48, 262, 120, dialogBackground);
+ _graphics->getImg(58, 48, 262, 120, dialogBackground);
drawMenu(7);
- mouseX = 160;
- mouseY = 90;
- mouseMaskIndex = 1;
+ _mouse->mouseX = 160;
+ _mouse->mouseY = 90;
+ _mouse->mouseMaskIndex = 1;
- g_engine->_mouseManager->setMouseArea(Common::Rect(115, 80, 190, 100));
- g_engine->_mouseManager->setMousePos(mouseMaskIndex, mouseX, mouseY);
+ _mouse->setMouseArea(Common::Rect(115, 80, 190, 100));
+ _mouse->warpMouse(_mouse->mouseMaskIndex, _mouse->mouseX, _mouse->mouseY);
Common::Event e;
const char hotKeyYes = hotKeyFor(YES);
const char hotKeyNo = hotKeyFor(NO);
exitChar = '@';
do {
- g_engine->_chrono->updateChrono();
- g_engine->_mouseManager->animateMouseIfNeeded();
+ _chrono->updateChrono();
+ _mouse->animateMouseIfNeeded();
while (g_system->getEventManager()->pollEvent(e)) {
if (isMouseEvent(e)) {
- g_engine->_mouseManager->setMousePos(e.mouse);
+ _mouse->warpMouse(e.mouse);
}
if (e.type == Common::EVENT_KEYDOWN) {
if (e.kbd.keycode == Common::KEYCODE_ESCAPE) {
@@ -1620,19 +1616,19 @@ void exitToDOS() {
}
}
}
- g_engine->_screen->update();
- } while (exitChar != '\33' && !g_engine->shouldQuit());
+ _screen->update();
+ } while (exitChar != '\33' && !shouldQuit());
debug("finished exitToDos");
- g_engine->_graphics->putImg(58, 48, dialogBackground);
- mouseX = oldMousePosX;
- mouseY = oldMousePosY;
- mouseMaskIndex = oldMouseMask;
- g_engine->_mouseManager->show();
+ _graphics->putImg(58, 48, dialogBackground);
+ _mouse->mouseX = oldMousePosX;
+ _mouse->mouseY = oldMousePosY;
+ _mouse->mouseMaskIndex = oldMouseMask;
+ _mouse->show();
free(dialogBackground);
- g_engine->_mouseManager->setMouseArea(Common::Rect(0, 0, 305, 185));
+ _mouse->setMouseArea(Common::Rect(0, 0, 305, 185));
}
-void soundControls() {
+void TotEngine::soundControls() {
uint oldMouseX,
oldMouseY,
soundControlsSize,
@@ -1647,21 +1643,21 @@ void soundControls() {
bool exitSoundControls;
exitSoundControls = false;
- oldMouseX = mouseX;
- oldMouseY = mouseY;
- oldMouseMask = mouseMaskIndex;
- g_engine->_mouseManager->hide();
+ oldMouseX = _mouse->mouseX;
+ oldMouseY = _mouse->mouseY;
+ oldMouseMask = _mouse->mouseMaskIndex;
+ _mouse->hide();
soundControlsSize = imagesize(50, 10, 270, 120);
//What was on the screen before blitting sound controls
byte *soundControlsBackground = (byte *)malloc(soundControlsSize);
- g_engine->_graphics->getImg(50, 10, 270, 120, soundControlsBackground);
+ _graphics->getImg(50, 10, 270, 120, soundControlsBackground);
- mouseX = 150;
- mouseY = 60;
- mouseMaskIndex = 1;
+ _mouse->mouseX = 150;
+ _mouse->mouseY = 60;
+ _mouse->mouseMaskIndex = 1;
- g_engine->_mouseManager->setMouseArea(Common::Rect(55, 13, 250, 105));
+ _mouse->setMouseArea(Common::Rect(55, 13, 250, 105));
for (ytext = 1; ytext <= 6; ytext++)
buttonBorder(120 - (ytext * 10), 80 - (ytext * 10), 200 + (ytext * 10), 60 + (ytext * 10), 251, 251, 251, 251, 0);
@@ -1672,51 +1668,51 @@ void soundControls() {
sliderSize = imagesize(86, 31, 94, 44);
byte *slider = (byte *)malloc(sliderSize);
- g_engine->_graphics->getImg(86, 31, 94, 44, slider);
+ _graphics->getImg(86, 31, 94, 44, slider);
drawMenu(3);
sliderBgSize = imagesize(86, 31, 234, 44);
byte *sliderBackground1 = (byte *)malloc(sliderBgSize);
byte *sliderBackground2 = (byte *)malloc(sliderBgSize);
- g_engine->_graphics->getImg(86, 31, 234, 44, sliderBackground1);
- g_engine->_graphics->getImg(86, 76, 234, 89, sliderBackground2);
+ _graphics->getImg(86, 31, 234, 44, sliderBackground1);
+ _graphics->getImg(86, 76, 234, 89, sliderBackground2);
- sfxVol = round(((rightSfxVol + leftSfxVol) / 2) * 20);
- musicVol = round(((musicVolRight + musicVolLeft) / 2) * 20);
- g_engine->_graphics->putImg(sfxVol + 86, 31, slider);
- g_engine->_graphics->putImg(musicVol + 86, 76, slider);
+ sfxVol = round(((_sound->_rightSfxVol + _sound->_leftSfxVol) / 2) * 20);
+ musicVol = round(((_sound->_musicVolRight + _sound->_musicVolLeft) / 2) * 20);
+ _graphics->putImg(sfxVol + 86, 31, slider);
+ _graphics->putImg(musicVol + 86, 76, slider);
- g_engine->_mouseManager->setMousePos(1, mouseX, mouseY);
+ _mouse->warpMouse(1, _mouse->mouseX, _mouse->mouseY);
bool keyPressed = false;
bool mouseClicked = false;
Common::Event e;
do {
- g_engine->_chrono->updateChrono();
+ _chrono->updateChrono();
do {
- g_engine->_chrono->updateChrono();
- g_engine->_mouseManager->animateMouseIfNeeded();
+ _chrono->updateChrono();
+ _mouse->animateMouseIfNeeded();
while (g_system->getEventManager()->pollEvent(e)) {
if (e.type == Common::EVENT_KEYUP) {
keyPressed = true;
}
if (e.type == Common::EVENT_LBUTTONDOWN) {
mouseClicked = true;
- mouseClickX = e.mouse.x;
- mouseClickY = e.mouse.y;
+ _mouse->mouseClickX = e.mouse.x;
+ _mouse->mouseClickY = e.mouse.y;
}
}
- g_engine->_screen->update();
- } while ((!keyPressed && !mouseClicked) && !g_engine->shouldQuit());
+ _screen->update();
+ } while ((!keyPressed && !mouseClicked) && !shouldQuit());
- g_engine->_chrono->updateChrono();
- g_engine->_mouseManager->animateMouseIfNeeded();
+ _chrono->updateChrono();
+ _mouse->animateMouseIfNeeded();
if (keyPressed) {
exitSoundControls = true;
}
if (mouseClicked) {
- if (mouseClickY >= 22 && mouseClickY <= 37) {
- g_engine->_mouseManager->hide();
+ if (_mouse->mouseClickY >= 22 && _mouse->mouseClickY <= 37) {
+ _mouse->hide();
xfade = 86 + sfxVol;
bool mouseReleased = false;
do {
@@ -1736,22 +1732,22 @@ void soundControls() {
}
if (oldxfade != xfade) {
- g_engine->_graphics->putImg(86, 31, sliderBackground1);
- g_engine->_graphics->putImg(xfade, 31, slider);
+ _graphics->putImg(86, 31, sliderBackground1);
+ _graphics->putImg(xfade, 31, slider);
// This yields a volume between 0 and 140
sfxVol = xfade - 86;
debug("volumefx=%d", sfxVol);
- rightSfxVol = round((float)sfxVol / 20);
- leftSfxVol = round((float)sfxVol / 20);
- g_engine->_sound->setSfxVolume(leftSfxVol, rightSfxVol);
+ _sound->_rightSfxVol = round((float)sfxVol / 20);
+ _sound->_leftSfxVol = round((float)sfxVol / 20);
+ _sound->setSfxVolume(_sound->_leftSfxVol, _sound->_rightSfxVol);
}
- g_engine->_screen->update();
+ _screen->update();
} while (!mouseReleased);
- g_engine->_mouseManager->show();
- } else if (mouseClickY >= 67 && mouseClickY <= 82) {
- g_engine->_mouseManager->hide();
+ _mouse->show();
+ } else if (_mouse->mouseClickY >= 67 && _mouse->mouseClickY <= 82) {
+ _mouse->hide();
xfade = 86 + musicVol;
bool mouseReleased = false;
do {
@@ -1769,55 +1765,55 @@ void soundControls() {
}
if (oldxfade != xfade) {
- g_engine->_graphics->putImg(86, 76, sliderBackground2);
- g_engine->_graphics->putImg(xfade, 76, slider);
+ _graphics->putImg(86, 76, sliderBackground2);
+ _graphics->putImg(xfade, 76, slider);
musicVol = xfade - 86;
- musicVolRight = round((float)(musicVol) / 20);
- musicVolLeft = round((float)(musicVol) / 20);
- g_engine->_sound->setMidiVolume(musicVolLeft, musicVolRight);
+ _sound->_musicVolRight = round((float)(musicVol) / 20);
+ _sound->_musicVolLeft = round((float)(musicVol) / 20);
+ _sound->setMidiVolume(_sound->_musicVolLeft, _sound->_musicVolRight);
}
- g_engine->_screen->update();
+ _screen->update();
} while (!mouseReleased);
- g_engine->_mouseManager->show();
- } else if (mouseClickY >= 97 && mouseClickY <= 107) {
+ _mouse->show();
+ } else if (_mouse->mouseClickY >= 97 && _mouse->mouseClickY <= 107) {
exitSoundControls = true;
}
mouseClicked = false;
}
g_system->delayMillis(10);
- g_engine->_screen->update();
- } while (!exitSoundControls && !g_engine->shouldQuit());
-
- g_engine->_graphics->putImg(50, 10, soundControlsBackground);
- mouseX = oldMouseX;
- mouseY = oldMouseY;
- mouseMaskIndex = oldMouseMask;
- g_engine->_mouseManager->setMousePos(mouseMaskIndex, mouseX, mouseY);
+ _screen->update();
+ } while (!exitSoundControls && !shouldQuit());
+
+ _graphics->putImg(50, 10, soundControlsBackground);
+ _mouse->mouseX = oldMouseX;
+ _mouse->mouseY = oldMouseY;
+ _mouse->mouseMaskIndex = oldMouseMask;
+ _mouse->warpMouse(_mouse->mouseMaskIndex, _mouse->mouseX, _mouse->mouseY);
free(soundControlsBackground);
free(slider);
free(sliderBackground1);
free(sliderBackground2);
- if (cpCounter > 7)
+ if (_cpCounter > 7)
showError(274);
- g_engine->_mouseManager->setMouseArea(Common::Rect(0, 0, 305, 185));
+ _mouse->setMouseArea(Common::Rect(0, 0, 305, 185));
}
-void sacrificeScene() {
+void TotEngine::sacrificeScene() {
saveAllowed = false;
palette palaux;
Common::File file;
- bool isSpanish = (g_engine->_lang == Common::ES_ESP);
+ bool isSpanish = (_lang == Common::ES_ESP);
const char *const *messages = (isSpanish) ? fullScreenMessages[0] : fullScreenMessages[1];
const long *offsets = (isSpanish) ? flcOffsets[0] : flcOffsets[1];
- g_engine->_sound->stopVoc();
- bool exitPressed = currentRoomData->paletteAnimationFlag;
- currentRoomData->paletteAnimationFlag = false;
+ _sound->stopVoc();
+ bool exitPressed = _currentRoomData->paletteAnimationFlag;
+ _currentRoomData->paletteAnimationFlag = false;
bar(0, 139, 319, 149, 0);
bar(10, 10, 310, 120, 0);
@@ -1839,7 +1835,7 @@ void sacrificeScene() {
setRGBPalette(200, i * 2, i * 2, i * 2);
delay(10000);
- if (g_engine->shouldQuit())
+ if (shouldQuit())
return;
for (int i = 28; i >= 0; i--)
@@ -1862,7 +1858,7 @@ void sacrificeScene() {
for (int i = 0; i <= 28; i++)
setRGBPalette(200, i * 2, i * 2, i * 2);
delay(10000);
- if (g_engine->shouldQuit())
+ if (shouldQuit())
return;
for (int i = 28; i >= 0; i--)
@@ -1883,7 +1879,7 @@ void sacrificeScene() {
for (int i = 0; i <= 28; i++)
setRGBPalette(200, i * 2, i * 2, i * 2);
delay(10000);
- if (g_engine->shouldQuit())
+ if (shouldQuit())
return;
for (int i = 28; i >= 0; i--)
@@ -1897,34 +1893,34 @@ void sacrificeScene() {
file.read(sceneBackground, 44800);
file.close();
- pal[0] = 0;
- pal[1] = 0;
- pal[2] = 0;
+ g_engine->_graphics->_pal[0] = 0;
+ g_engine->_graphics->_pal[1] = 0;
+ g_engine->_graphics->_pal[2] = 0;
for (int i = 1; i <= 234; i++) {
- pal[i * 3 + 1] = palaux[i * 3 + 1] << 2;
- pal[i * 3 + 2] = palaux[i * 3 + 2] << 2;
- pal[i * 3 + 3] = palaux[i * 3 + 3] << 2;
+ g_engine->_graphics->_pal[i * 3 + 1] = palaux[i * 3 + 1] << 2;
+ g_engine->_graphics->_pal[i * 3 + 2] = palaux[i * 3 + 2] << 2;
+ g_engine->_graphics->_pal[i * 3 + 3] = palaux[i * 3 + 3] << 2;
}
// We dont have the width and height here in the byte buffer
- g_engine->_graphics->drawScreen(sceneBackground, false);
- g_engine->_graphics->partialFadeIn(234);
- g_engine->_sound->stopVoc();
+ _graphics->drawScreen(sceneBackground, false);
+ _graphics->partialFadeIn(234);
+ _sound->stopVoc();
- if (g_engine->shouldQuit())
+ if (shouldQuit())
return;
drawFlc(0, 0, offsets[17], 0, 9, 19, false, false, true, exitPressed);
- g_engine->_graphics->totalFadeOut(128);
- g_engine->_sound->stopVoc();
+ _graphics->totalFadeOut(128);
+ _sound->stopVoc();
delay(1000);
- if (g_engine->shouldQuit())
+ if (shouldQuit())
return;
- g_engine->_sound->fadeOutMusic(musicVolLeft, musicVolRight);
- g_engine->_sound->playMidi("SACRIFIC", true);
- g_engine->_sound->fadeInMusic(musicVolLeft, musicVolRight);
- g_engine->_graphics->clear();
+ _sound->fadeOutMusic(_sound->_musicVolLeft, _sound->_musicVolRight);
+ _sound->playMidi("SACRIFIC", true);
+ _sound->fadeInMusic(_sound->_musicVolLeft, _sound->_musicVolRight);
+ _graphics->clear();
littText(10, 31, messages[23], 254);
littText(10, 29, messages[23], 254);
@@ -1951,7 +1947,7 @@ void sacrificeScene() {
}
delay(10000);
- if (g_engine->shouldQuit())
+ if (shouldQuit())
return;
for (int i = 32; i > 0; i--) {
@@ -1966,34 +1962,34 @@ void sacrificeScene() {
file.read(palaux, 768);
for (int i = 0; i < 256; i++) {
- palaux[i * 3 + 0] = palaux[i * 3 + 0] << 2;
- palaux[i * 3 + 1] = palaux[i * 3 + 1] << 2;
- palaux[i * 3 + 2] = palaux[i * 3 + 2] << 2;
+ palaux[i * 3 + 0] <<= 2;
+ palaux[i * 3 + 1] <<= 2;
+ palaux[i * 3 + 2] <<= 2;
}
file.read(sceneBackground, 64000);
file.close();
- g_engine->_graphics->drawFullScreen(sceneBackground);
+ _graphics->drawFullScreen(sceneBackground);
palaux[0] = 0;
palaux[1] = 0;
palaux[2] = 0;
- g_engine->_graphics->redFadeIn(palaux);
+ _graphics->redFadeIn(palaux);
drawFlc(112, 57, offsets[18], 33, 9, 20, true, false, true, exitPressed);
- g_engine->_sound->autoPlayVoc("REZOS", 0, 0);
- if (g_engine->shouldQuit())
+ _sound->autoPlayVoc("REZOS", 0, 0);
+ if (shouldQuit())
return;
drawFlc(42, 30, offsets[19], 0, 9, 27, false, false, false, exitPressed);
- if (g_engine->shouldQuit())
+ if (shouldQuit())
return;
- g_engine->_graphics->totalFadeOut(128);
- g_engine->_sound->stopVoc();
- g_engine->_graphics->clear();
+ _graphics->totalFadeOut(128);
+ _sound->stopVoc();
+ _graphics->clear();
littText(10, 21, messages[26], 254);
littText(10, 19, messages[26], 254);
@@ -2060,7 +2056,7 @@ void sacrificeScene() {
setRGBPalette(254, 32 - i, 0, 0);
}
delay(16000);
- if (g_engine->shouldQuit())
+ if (shouldQuit())
return;
for (int i = 31; i >= 0; i--) {
@@ -2068,10 +2064,10 @@ void sacrificeScene() {
setRGBPalette(254, 32 - i, 0, 0);
}
delay(2000);
- if (g_engine->shouldQuit())
+ if (shouldQuit())
return;
- g_engine->_graphics->clear();
+ _graphics->clear();
littText(10, 21, messages[33], 254);
littText(10, 19, messages[33], 254);
@@ -2124,7 +2120,7 @@ void sacrificeScene() {
setRGBPalette(254, 32 - i, 0, 0);
}
delay(13000);
- if (g_engine->shouldQuit())
+ if (shouldQuit())
return;
for (int i = 32; i > 0; i--) {
@@ -2132,9 +2128,9 @@ void sacrificeScene() {
setRGBPalette(254, 32 - i, 0, 0);
}
delay(2000);
- if (g_engine->shouldQuit())
+ if (shouldQuit())
return;
- g_engine->_graphics->clear();
+ _graphics->clear();
littText(10, 61, messages[40], 254);
littText(10, 59, messages[40], 254);
@@ -2160,24 +2156,24 @@ void sacrificeScene() {
setRGBPalette(254, 32 - i, 0, 0);
}
delay(7000);
- if (g_engine->shouldQuit())
+ if (shouldQuit())
return;
for (int i = 32; i > 0; i--) {
setRGBPalette(255, 63 - (32 - i), i * 2, i * 2);
setRGBPalette(254, 32 - i, 0, 0);
}
delay(2000);
- g_engine->_graphics->totalFadeOut(0);
- currentRoomData->paletteAnimationFlag = exitPressed;
+ _graphics->totalFadeOut(0);
+ _currentRoomData->paletteAnimationFlag = exitPressed;
saveAllowed = true;
}
-void ending() {
+void TotEngine::ending() {
saveAllowed = false;
bool exitRequested;
- const char *const *messages = (g_engine->_lang == Common::ES_ESP) ? fullScreenMessages[0] : fullScreenMessages[1];
- const long *offsets = (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0] : flcOffsets[1];
+ const char *const *messages = (_lang == Common::ES_ESP) ? fullScreenMessages[0] : fullScreenMessages[1];
+ const long *offsets = (_lang == Common::ES_ESP) ? flcOffsets[0] : flcOffsets[1];
littText(10, 41, messages[43], 249);
littText(10, 39, messages[43], 249);
@@ -2191,18 +2187,18 @@ void ending() {
littText(10, 40, messages[43], 253);
littText(10, 60, messages[44], 253);
- if(g_engine->shouldQuit()) {
+ if(shouldQuit()) {
return;
}
delay(4000);
- g_engine->_graphics->totalFadeOut(0);
- g_engine->_graphics->clear();
- if(g_engine->shouldQuit()) {
+ _graphics->totalFadeOut(0);
+ _graphics->clear();
+ if(shouldQuit()) {
return;
}
- g_engine->_sound->fadeOutMusic(musicVolLeft, musicVolRight);
- g_engine->_sound->playMidi("SACRIFIC", true);
- g_engine->_sound->fadeInMusic(musicVolLeft, musicVolRight);
+ _sound->fadeOutMusic(_sound->_musicVolLeft, _sound->_musicVolRight);
+ _sound->playMidi("SACRIFIC", true);
+ _sound->fadeInMusic(_sound->_musicVolLeft, _sound->_musicVolRight);
drawFlc(0, 0, offsets[30], 12, 9, 26, true, false, false, exitRequested);
if(exitRequested){
return;
@@ -2212,39 +2208,39 @@ void ending() {
return;
}
delay(1000);
- g_engine->_sound->playVoc("NOOO", 0, 0);
+ _sound->playVoc("NOOO", 0, 0);
delay(3000);
saveAllowed = true;
}
-void loadBat() {
+void TotEngine::loadBat() {
Common::File animFile;
- isSecondaryAnimationEnabled = true;
+ _isSecondaryAnimationEnabled = true;
if (!animFile.open("MURCIE.DAT")) {
showError(265);
}
- secondaryAnimFrameSize = animFile.readUint16LE();
- secondaryAnimationFrameCount = animFile.readByte();
- secondaryAnimDirCount = animFile.readByte();
- curSecondaryAnimationFrame = (byte *)malloc(secondaryAnimFrameSize);
+ _secondaryAnimFrameSize = animFile.readUint16LE();
+ _secondaryAnimationFrameCount = animFile.readByte();
+ _secondaryAnimDirCount = animFile.readByte();
+ _curSecondaryAnimationFrame = (byte *)malloc(_secondaryAnimFrameSize);
loadAnimationForDirection(&animFile, 0);
animFile.close();
}
-void loadDevil() {
+void TotEngine::loadDevil() {
Common::File animFile;
- isSecondaryAnimationEnabled = true;
+ _isSecondaryAnimationEnabled = true;
if (!animFile.open("ROJOMOV.DAT")) {
showError(265);
}
- secondaryAnimFrameSize = animFile.readUint16LE();
- secondaryAnimationFrameCount = animFile.readByte();
- secondaryAnimDirCount = animFile.readByte();
- curSecondaryAnimationFrame = (byte *)malloc(secondaryAnimFrameSize);
- if (secondaryAnimDirCount != 0) {
- secondaryAnimationFrameCount = secondaryAnimationFrameCount / 4;
+ _secondaryAnimFrameSize = animFile.readUint16LE();
+ _secondaryAnimationFrameCount = animFile.readByte();
+ _secondaryAnimDirCount = animFile.readByte();
+ _curSecondaryAnimationFrame = (byte *)malloc(_secondaryAnimFrameSize);
+ if (_secondaryAnimDirCount != 0) {
+ _secondaryAnimationFrameCount = _secondaryAnimationFrameCount / 4;
for (int i = 0; i <= 3; i++) {
loadAnimationForDirection(&animFile, i);
}
@@ -2252,7 +2248,7 @@ void loadDevil() {
animFile.close();
}
-void assembleCompleteBackground(byte *image, uint coordx, uint coordy) {
+void TotEngine::assembleCompleteBackground(byte *image, uint coordx, uint coordy) {
uint16 w, h;
uint16 wFondo;
w = READ_LE_UINT16(image);
@@ -2277,152 +2273,54 @@ void assembleCompleteBackground(byte *image, uint coordx, uint coordy) {
* Assemble the screen for scroll assembles only the objects because scrolling screens
* never have secondary animations and character animation is assembled elsewhere.
*/
-void assembleScreen(bool scroll) {
+void TotEngine::assembleScreen(bool scroll) {
- for (int indice = 0; indice < depthLevelCount; indice++) {
- if (screenLayers[indice] != NULL) {
- assembleCompleteBackground(screenLayers[indice], depthMap[indice].posx, depthMap[indice].posy);
+ for (int indice = 0; indice < kDepthLevelCount; indice++) {
+ if (_screenLayers[indice] != NULL) {
+ assembleCompleteBackground(_screenLayers[indice], _depthMap[indice].posx, _depthMap[indice].posy);
}
- if (!scroll && mainCharAnimation.depth == indice) {
- assembleCompleteBackground(mainCharAnimation.bitmap[charFacingDirection][iframe], characterPosX, characterPosY);
+ if (!scroll && _mainCharAnimation.depth == indice) {
+ assembleCompleteBackground(_mainCharAnimation.bitmap[_charFacingDirection][_iframe], _characterPosX, _characterPosY);
}
- if (!scroll && currentRoomData->animationFlag && secondaryAnimation.depth == indice) {
- assembleCompleteBackground(curSecondaryAnimationFrame, secondaryAnimation.posx, secondaryAnimation.posy);
+ if (!scroll && _currentRoomData->animationFlag && _secondaryAnimation.depth == indice) {
+ assembleCompleteBackground(_curSecondaryAnimationFrame, _secondaryAnimation.posx, _secondaryAnimation.posy);
}
}
}
-void disableSecondAnimation() {
- setRoomTrajectories(secondaryAnimHeight, secondaryAnimWidth, RESTORE);
- currentRoomData->animationFlag = false;
+void TotEngine::disableSecondAnimation() {
+ setRoomTrajectories(_secondaryAnimHeight, _secondaryAnimWidth, RESTORE);
+ _currentRoomData->animationFlag = false;
freeAnimation();
- g_engine->_graphics->restoreBackground();
+ _graphics->restoreBackground();
assembleScreen();
}
-// Debug
-void drawMouseGrid(RoomFileRegister *screen) {
- for (int i = 0; i < 39; i++) {
- for (int j = 0; j < 27; j++) {
- int color = screen->mouseGrid[i][j];
- if (color != 0) {
- int startX = i * xGridCount + 7;
- int startY = j * yGridCount;
- for (int i2 = 0; i2 < xGridCount; i2 += 2) {
- for (int j2 = 0; j2 < yGridCount; j2++) {
- int absPixel = startY + j2;
- int offsetX = (absPixel % 2 == 0) ? 1 : 0;
- if (offsetX < startX + xGridCount && color != 0) {
- *(byte *)g_engine->_screen->getBasePtr(startX + i2 + offsetX, startY + j2) = 255 - color;
- }
- }
- }
- }
- }
- }
- g_engine->_screen->markAllDirty();
-}
-
-void drawScreenGrid(RoomFileRegister *screen) {
- for (int i = 0; i < 39; i++) {
- for (int j = 0; j < 27; j++) {
- int color = screen->walkAreasGrid[i][j];
- if (color != 0) {
- int startX = i * xGridCount + 7;
- int startY = j * yGridCount;
- for (int i2 = 0; i2 < xGridCount; i2 += 2) {
- for (int j2 = 0; j2 < yGridCount; j2++) {
- int absPixel = startY + j2;
- int offsetX = (absPixel % 2 == 0) ? 1 : 0;
- if (offsetX < startX + xGridCount && color != 0) {
- *(byte *)g_engine->_screen->getBasePtr(startX + i2 + offsetX, startY + j2) = 255 - color;
- }
- }
- }
- }
- }
- }
- g_engine->_screen->markAllDirty();
-}
-
-void drawPos(uint x, uint y, byte color) {
- if (x < 320 && x > 0 && y > 0 && y < 200)
- *(byte *)g_engine->_screen->getBasePtr(x, y) = color;
-
- g_engine->_screen->addDirtyRect(Common::Rect(x, y, x + 1, y + 1));
- g_engine->_screen->markAllDirty();
-}
-
-void drawLine(int x, int y, int x2, int y2, byte color) {
- g_engine->_screen->drawLine(x, y, x2, y2, color);
-}
-
-void drawX(int x, int y, byte color) {
- if (x > 0 && y > 0)
- *(byte *)g_engine->_screen->getBasePtr(x, y) = color;
- if (x - 1 > 0 && y - 1 > 0)
- *(byte *)g_engine->_screen->getBasePtr(x - 1, y - 1) = color;
- if (x - 1 > 0 && y + 1 < 140)
- *(byte *)g_engine->_screen->getBasePtr(x - 1, y + 1) = color;
- if (x + 1 < 320 && y + 1 < 140)
- *(byte *)g_engine->_screen->getBasePtr(x + 1, y + 1) = color;
- if (x + 1 < 320 && y - 1 > 0)
- *(byte *)g_engine->_screen->getBasePtr(x + 1, y - 1) = color;
-}
-
-void drawCharacterPosition() {
- drawX(characterPosX, characterPosY, 210);
- drawX(characterPosX + characterCorrectionX, characterPosY + characerCorrectionY, 218);
-}
-
-void drawRect(byte color, int x, int y, int x2, int y2) {
- rectangle(x, y, x2, y2, color);
-}
-
-void printPos(int x, int y, int screenPosX, int screenPosY, const char *label) {
- g_engine->_graphics->restoreBackgroundArea(screenPosX, screenPosY, screenPosX + 100, screenPosY + 10);
- g_engine->_graphics->euroText(Common::String::format("%s: %d, %d", label, x, y), screenPosX, screenPosY, Graphics::kTextAlignLeft);
-}
-
-void drawGrid() {
- int horizontal = 320 / xGridCount;
- int vertical = 140 / yGridCount;
- for (int i = 0; i < horizontal; i++) {
- int startX = i * xGridCount;
- g_engine->_screen->drawLine(startX, 0, startX, 140, 200);
- }
-
- for (int j = 0; j < vertical; j++) {
- int startY = j * yGridCount;
- g_engine->_screen->drawLine(0, startY, 320, startY, 200);
- }
- g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
-}
-void setRoomTrajectories(int animationHeight, int animationWidth, TRAJECTORIES_OP op, bool fixGrids) {
+void TotEngine::setRoomTrajectories(int animationHeight, int animationWidth, TRAJECTORIES_OP op, bool fixGrids) {
// add to restore the room, subtract to adjust before loading the screen
- if (currentRoomData->animationFlag && currentRoomData->animationName != "QQQQQQQQ") {
- for (int i = 0; i < currentRoomData->secondaryTrajectoryLength; i++) {
+ if (_currentRoomData->animationFlag && _currentRoomData->animationName != "QQQQQQQQ") {
+ for (int i = 0; i < _currentRoomData->secondaryTrajectoryLength; i++) {
if (op == RESTORE) {
- currentRoomData->secondaryAnimTrajectory[i].x = currentRoomData->secondaryAnimTrajectory[i].x + (animationWidth >> 1);
- currentRoomData->secondaryAnimTrajectory[i].y = currentRoomData->secondaryAnimTrajectory[i].y + animationHeight;
+ _currentRoomData->secondaryAnimTrajectory[i].x = _currentRoomData->secondaryAnimTrajectory[i].x + (animationWidth >> 1);
+ _currentRoomData->secondaryAnimTrajectory[i].y = _currentRoomData->secondaryAnimTrajectory[i].y + animationHeight;
} else {
- currentRoomData->secondaryAnimTrajectory[i].x = currentRoomData->secondaryAnimTrajectory[i].x - (animationWidth >> 1);
- currentRoomData->secondaryAnimTrajectory[i].y = currentRoomData->secondaryAnimTrajectory[i].y - animationHeight;
+ _currentRoomData->secondaryAnimTrajectory[i].x = _currentRoomData->secondaryAnimTrajectory[i].x - (animationWidth >> 1);
+ _currentRoomData->secondaryAnimTrajectory[i].y = _currentRoomData->secondaryAnimTrajectory[i].y - animationHeight;
}
}
if (fixGrids) {
- for (int i = 0; i < maxXGrid; i++) {
- for (int j = 0; j < maxYGrid; j++) {
+ for (int i = 0; i < _maxXGrid; i++) {
+ for (int j = 0; j < _maxYGrid; j++) {
if (op == RESTORE) {
- currentRoomData->walkAreasGrid[oldposx + i][oldposy + j] = movementGridForSecondaryAnim[i][j];
- currentRoomData->mouseGrid[oldposx + i][oldposy + j] = mouseGridForSecondaryAnim[i][j];
+ _currentRoomData->walkAreasGrid[_oldposx + i][_oldposy + j] = _movementGridForSecondaryAnim[i][j];
+ _currentRoomData->mouseGrid[_oldposx + i][_oldposy + j] = _mouseGridForSecondaryAnim[i][j];
} else {
- if (maskGridSecondaryAnim[i][j] > 0)
- currentRoomData->walkAreasGrid[oldposx + i][oldposy + j] = maskGridSecondaryAnim[i][j];
- if (maskMouseSecondaryAnim[i][j] > 0)
- currentRoomData->mouseGrid[oldposx + i][oldposy + j] = maskMouseSecondaryAnim[i][j];
+ if (_maskGridSecondaryAnim[i][j] > 0)
+ _currentRoomData->walkAreasGrid[_oldposx + i][_oldposy + j] = _maskGridSecondaryAnim[i][j];
+ if (_maskMouseSecondaryAnim[i][j] > 0)
+ _currentRoomData->mouseGrid[_oldposx + i][_oldposy + j] = _maskMouseSecondaryAnim[i][j];
}
}
}
diff --git a/engines/tot/routines2.h b/engines/tot/routines2.h
deleted file mode 100644
index 0a14345a22a..00000000000
--- a/engines/tot/routines2.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-#ifndef TOT_ROUTINES2_H
-#define TOT_ROUTINES2_H
-
-#include "tot/anims.h"
-#include "tot/graphics.h"
-#include "tot/vars.h"
-#include "tot/util.h"
-
-namespace Tot {
-
-enum TRAJECTORIES_OP {
- // Subtracts the animation dimensions to the trajectory coordinates to adjust movement
- SET_WITH_ANIM = false,
- // Adds the animation dimensions to the trajectory coordinates to restore
- RESTORE = true
-};
-
-void loadScreenMemory();
-void loadAnimation(Common::String animacion);
-void assignText();
-void updateAltScreen(byte altScreenNumber);
-void verifyCopyProtection();
-void verifyCopyProtection2();
-void loadTV();
-void loadScreen();
-void loadCharAnimation();
-void freeScreenObjects();
-void freeAnimation();
-void freeInventory();
-void loadItem(uint coordx, uint coordy, uint picSize, int32 pic, uint prof);
Commit: 2ad357ff178dc39f983608f233d3a1e55f41275b
https://github.com/scummvm/scummvm/commit/2ad357ff178dc39f983608f233d3a1e55f41275b
Author: gsanmartin (gabriel.sanmartin at dna.inc)
Date: 2025-09-08T16:49:50+02:00
Commit Message:
TOT: Refactor midi fade in/out
Changed paths:
engines/tot/routines2.cpp
engines/tot/sound.cpp
engines/tot/sound.h
engines/tot/tot.cpp
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
index 969b1f50ea7..bcf7901766b 100644
--- a/engines/tot/routines2.cpp
+++ b/engines/tot/routines2.cpp
@@ -1252,10 +1252,10 @@ void TotEngine::credits() {
_mouse->hide();
_graphics->totalFadeOut(0);
- _sound->fadeOutMusic(_sound->_musicVolLeft, _sound->_musicVolRight);
+ _sound->fadeOutMusic();
_screen->clear();
_sound->playMidi("CREDITOS", true);
- _sound->fadeInMusic(_sound->_musicVolLeft, _sound->_musicVolRight);
+ _sound->fadeInMusic();
drawCreditsScreen(background, sizeBg2, background2);
exit = false;
@@ -1326,10 +1326,10 @@ void TotEngine::credits() {
Lexit:
delay(1000);
_graphics->totalFadeOut(0);
- _sound->fadeOutMusic(_sound->_musicVolLeft, _sound->_musicVolRight);
+ _sound->fadeOutMusic();
_screen->clear();
_sound->playMidi("INTRODUC", true);
- _sound->fadeInMusic(_sound->_musicVolLeft, _sound->_musicVolRight);
+ _sound->fadeInMusic();
_mouse->show();
free(background);
free(background2);
@@ -1768,6 +1768,7 @@ void TotEngine::soundControls() {
_graphics->putImg(86, 76, sliderBackground2);
_graphics->putImg(xfade, 76, slider);
musicVol = xfade - 86;
+ debug("musicvol=%d", musicVol);
_sound->_musicVolRight = round((float)(musicVol) / 20);
_sound->_musicVolLeft = round((float)(musicVol) / 20);
_sound->setMidiVolume(_sound->_musicVolLeft, _sound->_musicVolRight);
@@ -1917,9 +1918,9 @@ void TotEngine::sacrificeScene() {
if (shouldQuit())
return;
- _sound->fadeOutMusic(_sound->_musicVolLeft, _sound->_musicVolRight);
+ _sound->fadeOutMusic();
_sound->playMidi("SACRIFIC", true);
- _sound->fadeInMusic(_sound->_musicVolLeft, _sound->_musicVolRight);
+ _sound->fadeInMusic();
_graphics->clear();
littText(10, 31, messages[23], 254);
@@ -2196,9 +2197,9 @@ void TotEngine::ending() {
if(shouldQuit()) {
return;
}
- _sound->fadeOutMusic(_sound->_musicVolLeft, _sound->_musicVolRight);
+ _sound->fadeOutMusic();
_sound->playMidi("SACRIFIC", true);
- _sound->fadeInMusic(_sound->_musicVolLeft, _sound->_musicVolRight);
+ _sound->fadeInMusic();
drawFlc(0, 0, offsets[30], 12, 9, 26, true, false, false, exitRequested);
if(exitRequested){
return;
diff --git a/engines/tot/sound.cpp b/engines/tot/sound.cpp
index bfc96164bbf..e5ac2d10a06 100644
--- a/engines/tot/sound.cpp
+++ b/engines/tot/sound.cpp
@@ -170,23 +170,23 @@ void SoundManager::setSfxVolume(byte voll, byte volr) {
void SoundManager::setMidiVolume(byte voll, byte volr) {
int volume = (voll) / (float)7 * 255;
+ debug("Setting Midi volume to %d", volume);
setMusicVolume(volume);
}
-void SoundManager::fadeOutMusic(byte voll, byte volr) {
- byte stepVol = (voll + volr) / 2;
- for (int ivol = stepVol; ivol >= 0; ivol--) {
- setMidiVolume(ivol, ivol);
+void SoundManager::fadeOutMusic() {
+ byte stepVol = (_musicVolLeft + _musicVolRight) / 2;
+ for (int i = stepVol; i >= 0; i--) {
+ setMidiVolume(i, i);
delay(10);
}
}
-void SoundManager::fadeInMusic(byte voll, byte volr) {
- byte ivol, stepVol;
+void SoundManager::fadeInMusic() {
- stepVol = (voll + volr) / 2;
- for (ivol = 0; ivol <= stepVol; ivol++) {
- setMidiVolume(ivol, ivol);
+ byte stepVol = (_musicVolLeft + _musicVolRight) / 2;
+ for (int i = 0; i <= stepVol; i++) {
+ setMidiVolume(i, i);
delay(10);
}
}
diff --git a/engines/tot/sound.h b/engines/tot/sound.h
index 952c72fa5a1..f9961963421 100644
--- a/engines/tot/sound.h
+++ b/engines/tot/sound.h
@@ -53,8 +53,8 @@ public:
void waitForSoundEnd();
void setSfxVolume(byte leftVol, byte rightVol);
void setMidiVolume(byte leftVol, byte rightVol);
- void fadeOutMusic(byte leftVol, byte rightVol);
- void fadeInMusic(byte leftVol, byte rightVol);
+ void fadeOutMusic();
+ void fadeInMusic();
void setMasterVolume(byte leftVol, byte rightVol);
void setSfxBalance(bool left, bool right);
uint _rightSfxVol, _leftSfxVol;
diff --git a/engines/tot/tot.cpp b/engines/tot/tot.cpp
index 660d1d2724d..a253dd7242f 100644
--- a/engines/tot/tot.cpp
+++ b/engines/tot/tot.cpp
@@ -48,9 +48,9 @@ TotEngine::TotEngine(OSystem *syst, const ADGameDescription *gameDesc) : Engine(
_gameDescription(gameDesc), _randomSource("Tot") {
g_engine = this;
_lang = _gameDescription->language;
- g_engine->_rooms = nullptr;
- g_engine->_conversationData = nullptr;
- g_engine->_invItemData = nullptr;
+ _rooms = nullptr;
+ _conversationData = nullptr;
+ _invItemData = nullptr;
}
TotEngine::~TotEngine() {
@@ -108,36 +108,36 @@ int TotEngine::engineStart() {
if (ConfMan.hasKey("save_slot")) {
return startGame();
}
- g_engine->_graphics->clear();
+ _graphics->clear();
displayLoading();
loadCharAnimation();
loadObjects();
- g_engine->_sound->setMidiVolume(0, 0);
- g_engine->_sound->playMidi("SILENT", false);
+ _sound->setMidiVolume(0, 0);
+ _sound->playMidi("SILENT", false);
- g_engine->_mouse->setMouseArea(Common::Rect(0, 0, 305, 185));
- g_engine->_sound->playMidi("SILENT", true);
+ _mouse->setMouseArea(Common::Rect(0, 0, 305, 185));
+ _sound->playMidi("SILENT", true);
- g_engine->_graphics->totalFadeOut(0);
- g_engine->_graphics->clear();
+ _graphics->totalFadeOut(0);
+ _graphics->clear();
- g_engine->_graphics->loadPaletteFromFile("DEFAULT");
+ _graphics->loadPaletteFromFile("DEFAULT");
loadScreenMemory();
initialLogo();
- g_engine->_sound->playMidi("INTRODUC", true);
- g_engine->_sound->setMidiVolume(3, 3);
+ _sound->playMidi("INTRODUC", true);
+ _sound->setMidiVolume(3, 3);
firstIntroduction();
- g_engine->_mouse->warpMouse(1, _mouse->mouseX, _mouse->mouseY);
+ _mouse->warpMouse(1, _mouse->mouseX, _mouse->mouseY);
initialMenu(_firstTimeDone);
- if (_startNewGame && !g_engine->shouldQuit()) {
+ if (_startNewGame && !shouldQuit()) {
newGame();
- } else if (_continueGame && !g_engine->shouldQuit()) {
+ } else if (_continueGame && !shouldQuit()) {
loadTemporaryGame();
} else {
_isSavingDisabled = true;
- g_engine->openMainMenuDialog();
+ openMainMenuDialog();
_isSavingDisabled = false;
}
@@ -145,21 +145,21 @@ int TotEngine::engineStart() {
}
void TotEngine::loadTemporaryGame() {
- g_engine->loadGameState(g_engine->getMetaEngine()->getAutosaveSlot());
+ loadGameState(getMetaEngine()->getAutosaveSlot());
}
int TotEngine::startGame() {
- g_engine->_sound->fadeOutMusic(g_engine->_sound->_musicVolLeft, g_engine->_sound->_musicVolRight);
+ _sound->fadeOutMusic();
switch (_gamePart) {
case 1:
- g_engine->_sound->playMidi("PRIMERA", true);
+ _sound->playMidi("PRIMERA", true);
break;
case 2:
- g_engine->_sound->playMidi("SEGUNDA", true);
+ _sound->playMidi("SEGUNDA", true);
break;
}
_cpCounter2 = _cpCounter;
- g_engine->_sound->fadeInMusic(g_engine->_sound->_musicVolLeft,g_engine->_sound->_musicVolRight);
+ _sound->fadeInMusic();
_inGame = true;
Common::Event e;
@@ -170,14 +170,14 @@ int TotEngine::startGame() {
const char hotKeyLook = hotKeyFor(LOOKAT);
const char hotKeyUse = hotKeyFor(USE);
- while (!_shouldQuitGame && !g_engine->shouldQuit()) {
+ while (!_shouldQuitGame && !shouldQuit()) {
bool escapePressed = false;
- g_engine->_chrono->updateChrono();
- g_engine->_mouse->animateMouseIfNeeded();
+ _chrono->updateChrono();
+ _mouse->animateMouseIfNeeded();
// debug
while (g_system->getEventManager()->pollEvent(e)) {
if (isMouseEvent(e)) {
- g_engine->_mouse->warpMouse(e.mouse);
+ _mouse->warpMouse(e.mouse);
_mouse->mouseX = e.mouse.x;
_mouse->mouseY = e.mouse.y;
}
@@ -186,6 +186,14 @@ int TotEngine::startGame() {
switch (e.kbd.keycode) {
+ case Common::KEYCODE_UP:
+ _sound->fadeInMusic();
+ break;
+
+ case Common::KEYCODE_DOWN:
+ _sound->fadeOutMusic();
+ break;
+
case Common::KEYCODE_ESCAPE:
escapePressed = true;
break;
@@ -193,7 +201,7 @@ int TotEngine::startGame() {
soundControls();
break;
case Common::KEYCODE_F2:
- g_engine->openMainMenuDialog();
+ openMainMenuDialog();
// saveLoad();
break;
default:
@@ -461,35 +469,35 @@ int TotEngine::startGame() {
_cpCounter2 = _cpCounter;
_startNewGame = false;
_continueGame = false;
- g_engine->saveAutosaveIfEnabled();
- g_engine->_graphics->totalFadeOut(0);
- g_engine->_sound->fadeOutMusic(g_engine->_sound->_musicVolLeft, g_engine->_sound->_musicVolRight);
- g_engine->_graphics->clear();
- g_engine->_sound->playMidi("INTRODUC", true);
- g_engine->_sound->fadeInMusic(g_engine->_sound->_musicVolLeft, g_engine->_sound->_musicVolRight);
+ saveAutosaveIfEnabled();
+ _graphics->totalFadeOut(0);
+ _sound->fadeOutMusic();
+ _graphics->clear();
+ _sound->playMidi("INTRODUC", true);
+ _sound->fadeInMusic();
initialMenu(true);
verifyCopyProtection2();
- if (_startNewGame && !g_engine->shouldQuit()) {
+ if (_startNewGame && !shouldQuit()) {
newGame();
- } else if (_continueGame && !g_engine->shouldQuit())
+ } else if (_continueGame && !shouldQuit())
loadTemporaryGame();
else {
_isSavingDisabled = true;
- g_engine->openMainMenuDialog();
+ openMainMenuDialog();
_cpCounter = _cpCounter2;
_isSavingDisabled = false;
}
- g_engine->_sound->fadeOutMusic(g_engine->_sound->_musicVolLeft, g_engine->_sound->_musicVolRight);
+ _sound->fadeOutMusic();
switch (_gamePart) {
case 1:
- g_engine->_sound->playMidi("PRIMERA", true);
+ _sound->playMidi("PRIMERA", true);
break;
case 2:
- g_engine->_sound->playMidi("SEGUNDA", true);
+ _sound->playMidi("SEGUNDA", true);
break;
}
- g_engine->_sound->fadeInMusic(g_engine->_sound->_musicVolLeft, g_engine->_sound->_musicVolRight);
+ _sound->fadeInMusic();
}
switch (_gamePart) {
@@ -503,31 +511,31 @@ int TotEngine::startGame() {
freeInventory();
freeAnimation();
freeScreenObjects();
- g_engine->_mouse->hide();
- g_engine->_graphics->partialFadeOut(234);
- g_engine->_sound->fadeOutMusic(g_engine->_sound->_musicVolLeft, g_engine->_sound->_musicVolRight);
- g_engine->_sound->playMidi("CREDITOS", true);
- g_engine->_sound->fadeInMusic(g_engine->_sound->_musicVolLeft, g_engine->_sound->_musicVolRight);
+ _mouse->hide();
+ _graphics->partialFadeOut(234);
+ _sound->fadeOutMusic();
+ _sound->playMidi("CREDITOS", true);
+ _sound->fadeInMusic();
if (_cpCounter2 > 43)
showError(274);
sacrificeScene();
- g_engine->_graphics->clear();
+ _graphics->clear();
loadObjects();
- g_engine->_graphics->loadPaletteFromFile("SEGUNDA");
+ _graphics->loadPaletteFromFile("SEGUNDA");
_currentTrajectoryIndex = 0;
_characterPosX = 160;
_characterPosY = 60;
_trajectory[_currentTrajectoryIndex].x = _characterPosX;
_trajectory[_currentTrajectoryIndex].y = _characterPosY;
loadScreenData(20);
- g_engine->_sound->fadeOutMusic(g_engine->_sound->_musicVolLeft, g_engine->_sound->_musicVolRight);
- g_engine->_sound->playMidi("SEGUNDA", true);
- g_engine->_sound->fadeInMusic(g_engine->_sound->_musicVolLeft, g_engine->_sound->_musicVolRight);
- g_engine->_graphics->sceneTransition(false, sceneBackground, 1);
+ _sound->fadeOutMusic();
+ _sound->playMidi("SEGUNDA", true);
+ _sound->fadeInMusic();
+ _graphics->sceneTransition(false, sceneBackground, 1);
mask();
_inventoryPosition = 0;
drawBackpack();
- g_engine->_mouse->show();
+ _mouse->show();
_firstTimeTopicA[8] = true;
oldGridX = 0;
@@ -539,20 +547,20 @@ int TotEngine::startGame() {
// Debug graphics
{
- // g_engine->_graphics->euroText(Common::String::format("Room: %d", currentRoomNumber), 0, 0, 220, Graphics::kTextAlignLeft);
- // g_engine->_mouseManager->printPos(xraton, yraton, 220, 0);
+ // _graphics->euroText(Common::String::format("Room: %d", currentRoomNumber), 0, 0, 220, Graphics::kTextAlignLeft);
+ // _mouseManager->printPos(xraton, yraton, 220, 0);
// printPos(characterPosX, characterPosY, 220, 10, "CharPos");
- if (g_engine->_showMouseGrid) {
+ if (_showMouseGrid) {
drawMouseGrid(_currentRoomData);
}
- if (g_engine->_showScreenGrid) {
+ if (_showScreenGrid) {
drawScreenGrid(_currentRoomData);
}
- if (g_engine->_showGameGrid) {
+ if (_showGameGrid) {
drawGrid();
}
- if (g_engine->_drawObjectAreas) {
+ if (_drawObjectAreas) {
for (int i = 0; i < kDepthLevelCount; i++) {
if (_screenLayers[i] != NULL) {
if (true) {
@@ -569,21 +577,21 @@ int TotEngine::startGame() {
}
}
- g_engine->_screen->update();
+ _screen->update();
g_system->delayMillis(10);
}
- g_engine->_mouse->hide();
- if (!g_engine->shouldQuit()) {
+ _mouse->hide();
+ if (!shouldQuit()) {
ending();
}
Common::String photoFileName;
- if (!g_engine->shouldQuit()) {
+ if (!shouldQuit()) {
obtainName(photoFileName);
}
- if (!g_engine->shouldQuit()) {
+ if (!shouldQuit()) {
generateDiploma(photoFileName);
}
- if (!g_engine->shouldQuit()) {
+ if (!shouldQuit()) {
credits();
}
return EXIT_SUCCESS;
@@ -591,12 +599,12 @@ int TotEngine::startGame() {
void TotEngine::newGame() {
saveAllowed = true;
- g_engine->_mouse->hide();
+ _mouse->hide();
obtainName(_characterName);
- if (!g_engine->shouldQuit()) {
- g_engine->_graphics->totalFadeOut(0);
- g_engine->_graphics->clear();
+ if (!shouldQuit()) {
+ _graphics->totalFadeOut(0);
+ _graphics->clear();
displayLoading();
freeInventory();
loadObjects();
@@ -610,14 +618,14 @@ void TotEngine::newGame() {
readConversationFile(Common::String("CONVERSA.TRE"));
initializeScreenFile();
initializeObjectFile();
- g_engine->_graphics->loadPaletteFromFile("DEFAULT");
+ _graphics->loadPaletteFromFile("DEFAULT");
loadScreenData(1);
- g_engine->_graphics->sceneTransition(false, sceneBackground, 13);
+ _graphics->sceneTransition(false, sceneBackground, 13);
mask();
_inventoryPosition = 0;
drawBackpack();
_iframe = 0;
- g_engine->_mouse->show();
+ _mouse->show();
}
}
@@ -627,7 +635,7 @@ void TotEngine::changeRoom() {
setRoomTrajectories(_secondaryAnimHeight, _secondaryAnimWidth, RESTORE);
saveRoomData(_currentRoomData, _rooms);
// verifyCopyProtection();
- g_engine->_sound->setSfxVolume(g_engine->_sound->_leftSfxVol, g_engine->_sound->_rightSfxVol);
+ _sound->setSfxVolume(_sound->_leftSfxVol, _sound->_rightSfxVol);
switch (_currentRoomData->doors[_doorIndex].nextScene) {
case 2: {
@@ -639,21 +647,21 @@ void TotEngine::changeRoom() {
_trajectory[_currentTrajectoryIndex].y = _characterPosY;
freeAnimation();
freeScreenObjects();
- g_engine->_mouse->hide();
+ _mouse->hide();
- g_engine->_graphics->sceneTransition(true, NULL);
- g_engine->_sound->stopVoc();
+ _graphics->sceneTransition(true, NULL);
+ _sound->stopVoc();
loadScreenData(_currentRoomData->doors[_doorIndex].nextScene);
if (_cpCounter > 89)
showError(274);
- g_engine->_sound->setSfxVolume(g_engine->_sound->_leftSfxVol, g_engine->_sound->_rightSfxVol);
+ _sound->setSfxVolume(_sound->_leftSfxVol, _sound->_rightSfxVol);
if (_isTVOn)
- g_engine->_sound->autoPlayVoc("PARASITO", 355778, 20129);
+ _sound->autoPlayVoc("PARASITO", 355778, 20129);
else
loadTV();
- g_engine->_graphics->sceneTransition(false, sceneBackground);
+ _graphics->sceneTransition(false, sceneBackground);
_cpCounter = _cpCounter2;
- g_engine->_mouse->show();
+ _mouse->show();
oldGridX = 0;
oldGridY = 0;
} break;
@@ -667,14 +675,14 @@ void TotEngine::changeRoom() {
_trajectory[_currentTrajectoryIndex].y = _characterPosY;
freeAnimation();
freeScreenObjects();
- g_engine->_mouse->hide();
- g_engine->_graphics->sceneTransition(true, NULL);
+ _mouse->hide();
+ _graphics->sceneTransition(true, NULL);
loadScreenData(_currentRoomData->doors[_doorIndex].nextScene);
- g_engine->_sound->stopVoc();
- g_engine->_sound->autoPlayVoc("CALDERA", 6433, 15386);
- g_engine->_sound->setSfxVolume(g_engine->_sound->_leftSfxVol, 0);
- g_engine->_graphics->sceneTransition(false, sceneBackground);
- g_engine->_mouse->show();
+ _sound->stopVoc();
+ _sound->autoPlayVoc("CALDERA", 6433, 15386);
+ _sound->setSfxVolume(_sound->_leftSfxVol, 0);
+ _graphics->sceneTransition(false, sceneBackground);
+ _mouse->show();
oldGridX = 0;
oldGridY = 0;
checkMouseGrid();
@@ -685,10 +693,10 @@ void TotEngine::changeRoom() {
goToObject(_currentZone, _targetZone);
freeAnimation();
freeScreenObjects();
- g_engine->_mouse->hide();
- g_engine->_sound->setSfxVolume(g_engine->_sound->_leftSfxVol, 0);
+ _mouse->hide();
+ _sound->setSfxVolume(_sound->_leftSfxVol, 0);
loadScrollData(_currentRoomData->doors[_doorIndex].nextScene, true, 22, -2);
- g_engine->_mouse->show();
+ _mouse->show();
oldGridX = 0;
oldGridY = 0;
checkMouseGrid();
@@ -700,10 +708,10 @@ void TotEngine::changeRoom() {
goToObject(_currentZone, _targetZone);
freeAnimation();
freeScreenObjects();
- g_engine->_mouse->hide();
- g_engine->_sound->setSfxVolume(g_engine->_sound->_leftSfxVol, g_engine->_sound->_rightSfxVol);
+ _mouse->hide();
+ _sound->setSfxVolume(_sound->_leftSfxVol, _sound->_rightSfxVol);
loadScrollData(_currentRoomData->doors[_doorIndex].nextScene, false, 22, 2);
- g_engine->_mouse->show();
+ _mouse->show();
oldGridX = 0;
oldGridY = 0;
checkMouseGrid();
@@ -711,8 +719,8 @@ void TotEngine::changeRoom() {
case 9: {
freeAnimation();
freeScreenObjects();
- g_engine->_mouse->hide();
- g_engine->_graphics->sceneTransition(true, NULL);
+ _mouse->hide();
+ _graphics->sceneTransition(true, NULL);
_iframe = 0;
_currentTrajectoryIndex = 0;
_characterPosX = _currentRoomData->doors[_doorIndex].exitPosX - kCharacterCorrectionX;
@@ -720,8 +728,8 @@ void TotEngine::changeRoom() {
_trajectory[_currentTrajectoryIndex].x = _characterPosX;
_trajectory[_currentTrajectoryIndex].y = _characterPosY;
loadScreenData(_currentRoomData->doors[_doorIndex].nextScene);
- g_engine->_graphics->sceneTransition(false, sceneBackground);
- g_engine->_mouse->show();
+ _graphics->sceneTransition(false, sceneBackground);
+ _mouse->show();
oldGridX = 0;
oldGridY = 0;
@@ -737,23 +745,23 @@ void TotEngine::changeRoom() {
_trajectory[_currentTrajectoryIndex].y = _characterPosY;
freeAnimation();
freeScreenObjects();
- g_engine->_mouse->hide();
- g_engine->_graphics->sceneTransition(true, NULL);
+ _mouse->hide();
+ _graphics->sceneTransition(true, NULL);
loadScreenData(_currentRoomData->doors[_doorIndex].nextScene);
- g_engine->_graphics->sceneTransition(false, sceneBackground);
- g_engine->_mouse->show();
+ _graphics->sceneTransition(false, sceneBackground);
+ _mouse->show();
oldGridX = 0;
oldGridY = 0;
- g_engine->_mouse->show();
+ _mouse->show();
} else {
_currentZone = _currentRoomData->walkAreasGrid[(_characterPosX + kCharacterCorrectionX) / kXGridCount][(_characterPosY + kCharacerCorrectionY) / kYGridCount];
goToObject(_currentZone, _targetZone);
freeAnimation();
freeScreenObjects();
- g_engine->_mouse->hide();
+ _mouse->hide();
loadScrollData(_currentRoomData->doors[_doorIndex].nextScene, false, 64, 0);
- g_engine->_mouse->show();
+ _mouse->show();
oldGridX = 0;
oldGridY = 0;
checkMouseGrid();
@@ -766,9 +774,9 @@ void TotEngine::changeRoom() {
goToObject(_currentZone, _targetZone);
freeAnimation();
freeScreenObjects();
- g_engine->_mouse->hide();
+ _mouse->hide();
loadScrollData(_currentRoomData->doors[_doorIndex].nextScene, true, 64, 0);
- g_engine->_mouse->show();
+ _mouse->show();
oldGridX = 0;
oldGridY = 0;
checkMouseGrid();
@@ -778,9 +786,9 @@ void TotEngine::changeRoom() {
goToObject(_currentZone, _targetZone);
freeAnimation();
freeScreenObjects();
- g_engine->_mouse->hide();
+ _mouse->hide();
loadScrollData(_currentRoomData->doors[_doorIndex].nextScene, false, 56, 0);
- g_engine->_mouse->show();
+ _mouse->show();
oldGridX = 0;
oldGridY = 0;
checkMouseGrid();
@@ -797,11 +805,11 @@ void TotEngine::changeRoom() {
_trajectory[_currentTrajectoryIndex].y = _characterPosY;
freeAnimation();
freeScreenObjects();
- g_engine->_mouse->hide();
- g_engine->_graphics->sceneTransition(true, NULL);
+ _mouse->hide();
+ _graphics->sceneTransition(true, NULL);
loadScreenData(_currentRoomData->doors[_doorIndex].nextScene);
- g_engine->_graphics->sceneTransition(false, sceneBackground);
- g_engine->_mouse->show();
+ _graphics->sceneTransition(false, sceneBackground);
+ _mouse->show();
oldGridX = 0;
oldGridY = 0;
checkMouseGrid();
@@ -811,9 +819,9 @@ void TotEngine::changeRoom() {
goToObject(_currentZone, _targetZone);
freeAnimation();
freeScreenObjects();
- g_engine->_mouse->hide();
+ _mouse->hide();
loadScrollData(_currentRoomData->doors[_doorIndex].nextScene, true, 56, 0);
- g_engine->_mouse->show();
+ _mouse->show();
oldGridX = 0;
oldGridY = 0;
checkMouseGrid();
@@ -828,18 +836,18 @@ void TotEngine::changeRoom() {
_trajectory[_currentTrajectoryIndex].y = _characterPosY;
freeAnimation();
freeScreenObjects();
- g_engine->_mouse->hide();
- g_engine->_graphics->sceneTransition(true, NULL);
- g_engine->_sound->stopVoc();
+ _mouse->hide();
+ _graphics->sceneTransition(true, NULL);
+ _sound->stopVoc();
loadScreenData(_currentRoomData->doors[_doorIndex].nextScene);
if (_bookTopic[0] == true && _currentRoomData->animationFlag == true)
disableSecondAnimation();
if (_cpCounter > 89)
showError(274);
- g_engine->_sound->setSfxVolume(g_engine->_sound->_leftSfxVol, g_engine->_sound->_rightSfxVol);
- g_engine->_graphics->sceneTransition(false, sceneBackground);
+ _sound->setSfxVolume(_sound->_leftSfxVol, _sound->_rightSfxVol);
+ _graphics->sceneTransition(false, sceneBackground);
_cpCounter = _cpCounter2;
- g_engine->_mouse->show();
+ _mouse->show();
oldGridX = 0;
oldGridY = 0;
checkMouseGrid();
@@ -854,11 +862,11 @@ void TotEngine::changeRoom() {
_trajectory[_currentTrajectoryIndex].y = _characterPosY;
freeAnimation();
freeScreenObjects();
- g_engine->_mouse->hide();
- g_engine->_graphics->sceneTransition(true, NULL);
+ _mouse->hide();
+ _graphics->sceneTransition(true, NULL);
loadScreenData(_currentRoomData->doors[_doorIndex].nextScene);
- g_engine->_graphics->sceneTransition(false, sceneBackground);
- g_engine->_mouse->show();
+ _graphics->sceneTransition(false, sceneBackground);
+ _mouse->show();
oldGridX = 0;
oldGridY = 0;
checkMouseGrid();
@@ -868,9 +876,9 @@ void TotEngine::changeRoom() {
goToObject(_currentZone, _targetZone);
freeAnimation();
freeScreenObjects();
- g_engine->_mouse->hide();
+ _mouse->hide();
loadScrollData(_currentRoomData->doors[_doorIndex].nextScene, true, 131, -1);
- g_engine->_mouse->show();
+ _mouse->show();
oldGridX = 0;
oldGridY = 0;
checkMouseGrid();
@@ -886,11 +894,11 @@ void TotEngine::changeRoom() {
_trajectory[_currentTrajectoryIndex].y = _characterPosY;
freeAnimation();
freeScreenObjects();
- g_engine->_mouse->hide();
- g_engine->_graphics->sceneTransition(true, NULL);
+ _mouse->hide();
+ _graphics->sceneTransition(true, NULL);
loadScreenData(_currentRoomData->doors[_doorIndex].nextScene);
- g_engine->_graphics->sceneTransition(false, sceneBackground);
- g_engine->_mouse->show();
+ _graphics->sceneTransition(false, sceneBackground);
+ _mouse->show();
oldGridX = 0;
oldGridY = 0;
checkMouseGrid();
@@ -900,9 +908,9 @@ void TotEngine::changeRoom() {
goToObject(_currentZone, _targetZone);
freeAnimation();
freeScreenObjects();
- g_engine->_mouse->hide();
+ _mouse->hide();
loadScrollData(_currentRoomData->doors[_doorIndex].nextScene, false, 131, 1);
- g_engine->_mouse->show();
+ _mouse->show();
oldGridX = 0;
oldGridY = 0;
checkMouseGrid();
@@ -917,9 +925,9 @@ void TotEngine::changeRoom() {
_trajectory[_currentTrajectoryIndex].y = _characterPosY;
freeAnimation();
freeScreenObjects();
- g_engine->_mouse->hide();
- g_engine->_graphics->sceneTransition(true, NULL);
- g_engine->_sound->stopVoc();
+ _mouse->hide();
+ _graphics->sceneTransition(true, NULL);
+ _sound->stopVoc();
loadScreenData(_currentRoomData->doors[_doorIndex].nextScene);
switch (_niche[0][_niche[0][3]]) {
case 0:
@@ -937,12 +945,12 @@ void TotEngine::changeRoom() {
}
if (_cpCounter > 89)
showError(274);
- g_engine->_sound->setSfxVolume(g_engine->_sound->_leftSfxVol, g_engine->_sound->_rightSfxVol);
+ _sound->setSfxVolume(_sound->_leftSfxVol, _sound->_rightSfxVol);
if (_currentRoomData->code == 4)
- g_engine->_sound->loadVoc("GOTA", 140972, 1029);
- g_engine->_graphics->sceneTransition(false, sceneBackground);
+ _sound->loadVoc("GOTA", 140972, 1029);
+ _graphics->sceneTransition(false, sceneBackground);
_cpCounter = _cpCounter2;
- g_engine->_mouse->show();
+ _mouse->show();
oldGridX = 0;
oldGridY = 0;
checkMouseGrid();
@@ -956,9 +964,9 @@ void TotEngine::changeRoom() {
_trajectory[_currentTrajectoryIndex].y = _characterPosY;
freeAnimation();
freeScreenObjects();
- g_engine->_mouse->hide();
- g_engine->_graphics->sceneTransition(true, NULL);
- g_engine->_sound->stopVoc();
+ _mouse->hide();
+ _graphics->sceneTransition(true, NULL);
+ _sound->stopVoc();
loadScreenData(_currentRoomData->doors[_doorIndex].nextScene);
switch (_niche[1][_niche[1][3]]) {
case 0:
@@ -979,7 +987,7 @@ void TotEngine::changeRoom() {
}
if (_cpCounter > 89)
showError(274);
- g_engine->_sound->setSfxVolume(g_engine->_sound->_leftSfxVol, g_engine->_sound->_rightSfxVol);
+ _sound->setSfxVolume(_sound->_leftSfxVol, _sound->_rightSfxVol);
if (_isTrapSet) {
_currentRoomData->animationFlag = true;
loadAnimation(_currentRoomData->animationName);
@@ -1002,11 +1010,11 @@ void TotEngine::changeRoom() {
}
assembleScreen();
}
- g_engine->_graphics->sceneTransition(false, sceneBackground);
+ _graphics->sceneTransition(false, sceneBackground);
if ((_isRedDevilCaptured == false) && (_isTrapSet == false))
runaroundRed();
_cpCounter = _cpCounter2;
- g_engine->_mouse->show();
+ _mouse->show();
oldGridX = 0;
oldGridY = 0;
checkMouseGrid();
@@ -1023,24 +1031,24 @@ void TotEngine::changeRoom() {
_trajectory[_currentTrajectoryIndex].y = _characterPosY;
freeAnimation();
freeScreenObjects();
- g_engine->_mouse->hide();
- g_engine->_graphics->sceneTransition(true, NULL);
- g_engine->_sound->stopVoc();
+ _mouse->hide();
+ _graphics->sceneTransition(true, NULL);
+ _sound->stopVoc();
loadScreenData(_currentRoomData->doors[_doorIndex].nextScene);
if (_cpCounter > 89)
showError(274);
- g_engine->_sound->setSfxVolume(g_engine->_sound->_leftSfxVol, g_engine->_sound->_rightSfxVol);
+ _sound->setSfxVolume(_sound->_leftSfxVol, _sound->_rightSfxVol);
switch (_currentRoomData->code) {
case 4:
- g_engine->_sound->loadVoc("GOTA", 140972, 1029);
+ _sound->loadVoc("GOTA", 140972, 1029);
break;
case 23:
- g_engine->_sound->autoPlayVoc("FUENTE", 0, 0);
+ _sound->autoPlayVoc("FUENTE", 0, 0);
break;
}
- g_engine->_graphics->sceneTransition(false, sceneBackground);
+ _graphics->sceneTransition(false, sceneBackground);
_cpCounter = _cpCounter2;
- g_engine->_mouse->show();
+ _mouse->show();
oldGridX = 0;
oldGridY = 0;
checkMouseGrid();
Commit: efbec6bcb47137b16a9cce38597281ad936ed5c3
https://github.com/scummvm/scummvm/commit/efbec6bcb47137b16a9cce38597281ad936ed5c3
Author: gsanmartin (gabriel.sanmartin at dna.inc)
Date: 2025-09-08T16:49:50+02:00
Commit Message:
TOT: Renames initialization functions
Changed paths:
engines/tot/dialog.cpp
engines/tot/routines.cpp
engines/tot/routines2.cpp
engines/tot/saveload.cpp
engines/tot/tot.cpp
engines/tot/tot.h
diff --git a/engines/tot/dialog.cpp b/engines/tot/dialog.cpp
index a9664703929..038333aeee9 100644
--- a/engines/tot/dialog.cpp
+++ b/engines/tot/dialog.cpp
@@ -443,7 +443,7 @@ void talk(byte characterIndex) {
Common::String conversationMatrix[16];
drawTalkMenu();
endOfConversation = false;
- g_engine->assignText();
+ g_engine->readTextFile();
// The original game makes a copy of the file upon starting a new game. .007 is the current game (the game
// that resumes when clicking "continue game" in the main menu. Part of the savegame data is this 007
// conversation file which marks conversatino topics as already gone through or not.
@@ -569,7 +569,7 @@ void talkToSceneObject() {
if (g_engine->_curObject.speaking > 0) {
talk(g_engine->_curObject.speaking);
} else {
- g_engine->assignText();
+ g_engine->readTextFile();
uint foo = 0;
g_engine->sayLine((Random(10) + 1039), 255, 0, foo, false);
g_engine->_verbFile.close();
diff --git a/engines/tot/routines.cpp b/engines/tot/routines.cpp
index b8a7f9a573d..96b6570291b 100644
--- a/engines/tot/routines.cpp
+++ b/engines/tot/routines.cpp
@@ -31,7 +31,7 @@
namespace Tot {
void TotEngine::drawText(uint number) {
- assignText();
+ readTextFile();
uint foo = 0;
sayLine(number, 255, 0, foo, false);
_verbFile.close();
@@ -920,7 +920,7 @@ void TotEngine::lookAtObject(byte objectCode) {
if (_curObject.used[0] != 9) {
if (_curObject.beforeUseTextRef != 0) {
- assignText();
+ readTextFile();
textRef = readVerbRegister(_curObject.beforeUseTextRef);
description = textRef.text;
for (yaux = 0; yaux < textRef.text.size(); yaux++)
@@ -934,7 +934,7 @@ void TotEngine::lookAtObject(byte objectCode) {
} else {
if (_curObject.afterUseTextRef != 0) {
- assignText();
+ readTextFile();
textRef = readVerbRegister(_curObject.afterUseTextRef);
description = textRef.text;
for (yaux = 0; yaux < textRef.text.size(); yaux++)
@@ -2107,7 +2107,7 @@ void TotEngine::useScreenObject() {
if (completedListItems == 5) {
_obtainedList1 = false;
_list1Complete = true;
- assignText();
+ readTextFile();
sayLine(1018, 255, 0, foo, false);
sayLine(foo, 253, 249, foo, true);
_verbFile.close();
@@ -2130,7 +2130,7 @@ void TotEngine::useScreenObject() {
drawBackpack();
_mouse->show();
} else {
- assignText();
+ readTextFile();
sayLine(_curObject.useTextRef, 255, 0, foo, false);
_mouse->hide();
animateGive(_charFacingDirection, 1);
@@ -2159,7 +2159,7 @@ void TotEngine::useScreenObject() {
if (completedListItems == 5) {
_obtainedList2 = false;
_list2Complete = true;
- assignText();
+ readTextFile();
sayLine(1020, 255, 0, foo, false);
sayLine(foo, 253, 249, foo, true);
_verbFile.close();
@@ -2181,7 +2181,7 @@ void TotEngine::useScreenObject() {
drawBackpack();
_mouse->show();
} else {
- assignText();
+ readTextFile();
sayLine(_curObject.useTextRef, 255, 0, foo, false);
_mouse->hide();
animateGive(_charFacingDirection, 1);
@@ -2196,7 +2196,7 @@ void TotEngine::useScreenObject() {
case 159: {
switch (_curObject.code) {
case 173: {
- assignText();
+ readTextFile();
sayLine(1118, 255, 0, foo, false);
_mouse->hide();
animateGive(_charFacingDirection, 1);
@@ -2206,7 +2206,7 @@ void TotEngine::useScreenObject() {
_verbFile.close();
} break;
case 218: {
- assignText();
+ readTextFile();
sayLine(687, 255, 0, foo, false);
_mouse->hide();
animateGive(_charFacingDirection, 1);
@@ -2225,7 +2225,7 @@ void TotEngine::useScreenObject() {
}
} break;
case 160: {
- assignText();
+ readTextFile();
sayLine(2466, 255, 0, foo, false);
_mouse->hide();
animateGive(_charFacingDirection, 1);
@@ -2247,7 +2247,7 @@ void TotEngine::useScreenObject() {
case 563: {
_isPottersManualDelivered = true;
if (_isPottersWheelDelivered && _isGreenDevilDelivered && _isMudDelivered) {
- assignText();
+ readTextFile();
sayLine(2696, 255, 0, foo, false);
_mouse->hide();
animateGive(0, 1);
@@ -2274,7 +2274,7 @@ void TotEngine::useScreenObject() {
_currentRoomData->mouseGrid[15][12] = 7;
_mouse->show();
} else {
- assignText();
+ readTextFile();
sayLine(2696, 255, 0, foo, false);
_mouse->hide();
animateGive(0, 1);
@@ -2292,7 +2292,7 @@ void TotEngine::useScreenObject() {
case 598: {
_isMudDelivered = true;
if (_isPottersWheelDelivered && _isGreenDevilDelivered && _isPottersManualDelivered) {
- assignText();
+ readTextFile();
sayLine(2821, 255, 0, foo, false);
_mouse->hide();
animateGive(0, 1);
@@ -2319,7 +2319,7 @@ void TotEngine::useScreenObject() {
_currentRoomData->mouseGrid[15][12] = 7;
_mouse->show();
} else {
- assignText();
+ readTextFile();
sayLine(2821, 255, 0, foo, false);
_mouse->hide();
animateGive(0, 1);
@@ -2337,7 +2337,7 @@ void TotEngine::useScreenObject() {
case 623: {
_isPottersWheelDelivered = true;
if (_isMudDelivered && _isGreenDevilDelivered && _isPottersManualDelivered) {
- assignText();
+ readTextFile();
sayLine(2906, 255, 0, foo, false);
_mouse->hide();
animateGive(0, 1);
@@ -2364,7 +2364,7 @@ void TotEngine::useScreenObject() {
_currentRoomData->mouseGrid[15][12] = 7;
_mouse->show();
} else {
- assignText();
+ readTextFile();
sayLine(2906, 255, 0, foo, false);
_mouse->hide();
animateGive(0, 1);
@@ -2382,7 +2382,7 @@ void TotEngine::useScreenObject() {
case 701: {
_isGreenDevilDelivered = true;
if (_isMudDelivered && _isPottersWheelDelivered && _isPottersManualDelivered) {
- assignText();
+ readTextFile();
sayLine(3188, 255, 0, foo, false);
_mouse->hide();
animateGive(0, 1);
@@ -2409,7 +2409,7 @@ void TotEngine::useScreenObject() {
_currentRoomData->mouseGrid[15][12] = 7;
_mouse->show();
} else {
- assignText();
+ readTextFile();
sayLine(3188, 255, 0, foo, false);
_mouse->hide();
animateGive(0, 1);
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
index bcf7901766b..f6448263bba 100644
--- a/engines/tot/routines2.cpp
+++ b/engines/tot/routines2.cpp
@@ -38,7 +38,7 @@
namespace Tot {
-void TotEngine::loadScreenMemory() {
+void TotEngine::initScreenPointers() {
_screenSize = 65520;
sceneBackground = (byte *)malloc(_screenSize);
backgroundCopy = (byte *)malloc(_screenSize);
@@ -110,7 +110,7 @@ void TotEngine::loadAnimation(Common::String animationName) {
debug("Finished loading animation!");
}
-void TotEngine::assignText() {
+void TotEngine::readTextFile() {
if (!_verbFile.open("CONVERSA.TXT")) {
showError(313);
}
diff --git a/engines/tot/saveload.cpp b/engines/tot/saveload.cpp
index 69cb8c529c6..5bde5b90bfb 100644
--- a/engines/tot/saveload.cpp
+++ b/engines/tot/saveload.cpp
@@ -253,7 +253,7 @@ Common::Error TotEngine::syncGame(Common::Serializer &s) {
loadObjects();
g_engine->_graphics->loadPaletteFromFile("DEFAULT");
- loadScreenMemory();
+ initScreenPointers();
g_engine->_graphics->totalFadeOut(0);
g_engine->_graphics->clear();
diff --git a/engines/tot/tot.cpp b/engines/tot/tot.cpp
index a253dd7242f..7e52e2d7673 100644
--- a/engines/tot/tot.cpp
+++ b/engines/tot/tot.cpp
@@ -124,7 +124,7 @@ int TotEngine::engineStart() {
_graphics->clear();
_graphics->loadPaletteFromFile("DEFAULT");
- loadScreenMemory();
+ initScreenPointers();
initialLogo();
_sound->playMidi("INTRODUC", true);
_sound->setMidiVolume(3, 3);
diff --git a/engines/tot/tot.h b/engines/tot/tot.h
index ce433f8d886..884e55cd5d1 100644
--- a/engines/tot/tot.h
+++ b/engines/tot/tot.h
@@ -112,7 +112,7 @@ private:
void dropObjectInScreen(ScreenObject replacementObject);
void calculateTrajectory(uint finalX, uint finalY);
void animatedSequence(uint numSequence);
- void loadScreenMemory();
+ void initScreenPointers();
void loadAnimation(Common::String animation);
void updateAltScreen(byte altScreenNumber);
void verifyCopyProtection();
@@ -477,7 +477,7 @@ public:
void freeAnimation();
void buttonBorder(uint x1, uint y1, uint x2, uint y2, byte color1, byte color2, byte color3, byte color4, byte color5);
void drawMenu(byte menuNumber);
- void assignText();
+ void readTextFile();
void loadAnimationForDirection(Common::SeekableReadStream *stream, int direction);
void sayLine(uint textRef, byte textColor, byte shadowColor, uint &responseNumber, bool isWithinConversation);
void goToObject(byte zone1, byte zone2);
Commit: 4643050ab380ca9de23b12c5c2aa83b5eb0470b9
https://github.com/scummvm/scummvm/commit/4643050ab380ca9de23b12c5c2aa83b5eb0470b9
Author: gsanmartin (gabriel.sanmartin at dna.inc)
Date: 2025-09-08T16:49:51+02:00
Commit Message:
TOT: Remove global variables on animations
Changed paths:
engines/tot/anims.cpp
engines/tot/graphics.h
diff --git a/engines/tot/anims.cpp b/engines/tot/anims.cpp
index 17ebeb8cf33..86ce9b8d03b 100644
--- a/engines/tot/anims.cpp
+++ b/engines/tot/anims.cpp
@@ -36,14 +36,6 @@
namespace Tot {
-const int textAreaSize = 320 * 70 + 4;
-
-int32 flicFilePos;
-uint loopNumber, flicRelativePos;
-byte *textAreaBackground = (byte *)malloc(textAreaSize);
-byte frameCount;
-bool firstLoop;
-
void drawText(uint x, uint y, Common::String str1, Common::String str2, Common::String str3, Common::String str4, Common::String str5, byte textColor, byte borderColor) {
littText(x, (y + 3), str1, borderColor);
@@ -107,7 +99,7 @@ void clearCharacterText() {
removeText(2, 100, 134, 199, 0);
}
-void handleFlcEvent(byte eventNumber) {
+void handleFlcEvent(byte eventNumber, uint loopNumber, byte frameCount) {
const char *const *messages = g_engine->_lang == Common::ES_ESP ? animMessages[0] : animMessages[1];
bool isSpanish = g_engine->_lang == Common::ES_ESP;
@@ -332,7 +324,7 @@ void handleFlcEvent(byte eventNumber) {
g_engine->_sound->playVoc("PORTAZO", 434988, 932);
break;
case 60:
- g_engine->_graphics->getImg(0, 0, 319, 29, textAreaBackground);
+ g_engine->_graphics->getImg(0, 0, 319, 29, g_engine->_graphics->_textAreaBackground);
break;
}
break;
@@ -352,7 +344,7 @@ void handleFlcEvent(byte eventNumber) {
messages[104],
255, 249);
delay(3500);
- g_engine->_graphics->putImg(0, 0, textAreaBackground);
+ g_engine->_graphics->putImg(0, 0, g_engine->_graphics->_textAreaBackground);
drawText(5, 1,
messages[105],
messages[106],
@@ -364,7 +356,7 @@ void handleFlcEvent(byte eventNumber) {
break;
case 6:
if ((loopNumber == 1) && (frameCount == 3)) {
- g_engine->_graphics->putImg(0, 0, textAreaBackground);
+ g_engine->_graphics->putImg(0, 0, g_engine->_graphics->_textAreaBackground);
drawText(5, 1,
messages[110],
messages[111],
@@ -374,7 +366,7 @@ void handleFlcEvent(byte eventNumber) {
255, 249);
}
else if ((loopNumber == 5) && (frameCount == 3)) {
- g_engine->_graphics->putImg(0, 0, textAreaBackground);
+ g_engine->_graphics->putImg(0, 0, g_engine->_graphics->_textAreaBackground);
drawText(5, 1,
messages[275],
messages[276],
@@ -386,7 +378,7 @@ void handleFlcEvent(byte eventNumber) {
break;
case 7:
if ((loopNumber == 1) && (frameCount == 3)) {
- g_engine->_graphics->putImg(0, 0, textAreaBackground);
+ g_engine->_graphics->putImg(0, 0, g_engine->_graphics->_textAreaBackground);
drawText(5, 1,
messages[115],
messages[116],
@@ -398,7 +390,7 @@ void handleFlcEvent(byte eventNumber) {
break;
case 8:
if ((loopNumber == 1) && (frameCount == 3)) {
- g_engine->_graphics->putImg(0, 0, textAreaBackground);
+ g_engine->_graphics->putImg(0, 0, g_engine->_graphics->_textAreaBackground);
drawText(5, 1,
messages[120],
messages[121],
@@ -408,7 +400,7 @@ void handleFlcEvent(byte eventNumber) {
255, 249);
}
else if ((loopNumber == 5) && (frameCount == 3)) {
- g_engine->_graphics->putImg(0, 0, textAreaBackground);
+ g_engine->_graphics->putImg(0, 0, g_engine->_graphics->_textAreaBackground);
drawText(5, 1,
messages[280],
messages[281],
@@ -420,7 +412,7 @@ void handleFlcEvent(byte eventNumber) {
break;
case 9:
if ((loopNumber == 1) && (frameCount == 3)) {
- g_engine->_graphics->putImg(0, 0, textAreaBackground);
+ g_engine->_graphics->putImg(0, 0, g_engine->_graphics->_textAreaBackground);
drawText(5, 1,
messages[125],
messages[126],
@@ -432,7 +424,7 @@ void handleFlcEvent(byte eventNumber) {
break;
case 10:
if ((loopNumber == 1) && (frameCount == 3)) {
- g_engine->_graphics->putImg(0, 0, textAreaBackground);
+ g_engine->_graphics->putImg(0, 0, g_engine->_graphics->_textAreaBackground);
drawText(5, 1,
messages[130],
messages[131],
@@ -444,7 +436,7 @@ void handleFlcEvent(byte eventNumber) {
break;
case 11:
if ((loopNumber == 1) && (frameCount == 3)) {
- g_engine->_graphics->putImg(0, 0, textAreaBackground);
+ g_engine->_graphics->putImg(0, 0, g_engine->_graphics->_textAreaBackground);
drawText(5, 1,
messages[135],
messages[136],
@@ -456,7 +448,7 @@ void handleFlcEvent(byte eventNumber) {
break;
case 12:
if ((loopNumber == 1) && (frameCount == 3)) {
- g_engine->_graphics->putImg(0, 0, textAreaBackground);
+ g_engine->_graphics->putImg(0, 0, g_engine->_graphics->_textAreaBackground);
drawText(5, 1,
messages[140],
messages[141],
@@ -468,7 +460,7 @@ void handleFlcEvent(byte eventNumber) {
break;
case 13:
if ((loopNumber == 1) && (frameCount == 3)) {
- g_engine->_graphics->putImg(0, 0, textAreaBackground);
+ g_engine->_graphics->putImg(0, 0, g_engine->_graphics->_textAreaBackground);
drawText(5, 1,
messages[145],
messages[146],
@@ -480,7 +472,7 @@ void handleFlcEvent(byte eventNumber) {
break;
case 14:
if ((loopNumber == 1) && (frameCount == 3)) {
- g_engine->_graphics->putImg(0, 0, textAreaBackground);
+ g_engine->_graphics->putImg(0, 0, g_engine->_graphics->_textAreaBackground);
drawText(5, 1,
messages[150],
messages[151],
@@ -490,7 +482,7 @@ void handleFlcEvent(byte eventNumber) {
255, 249);
}
else if ((loopNumber == 5) && (frameCount == 3)) {
- g_engine->_graphics->putImg(0, 0, textAreaBackground);
+ g_engine->_graphics->putImg(0, 0, g_engine->_graphics->_textAreaBackground);
drawText(5, 1,
messages[285],
messages[286],
@@ -502,7 +494,7 @@ void handleFlcEvent(byte eventNumber) {
break;
case 15:
if ((loopNumber == 1) && (frameCount == 3)) {
- g_engine->_graphics->putImg(0, 0, textAreaBackground);
+ g_engine->_graphics->putImg(0, 0, g_engine->_graphics->_textAreaBackground);
drawText(5, 1,
messages[155],
messages[156],
@@ -514,7 +506,7 @@ void handleFlcEvent(byte eventNumber) {
break;
case 16:
if ((loopNumber == 1) && (frameCount == 3)) {
- g_engine->_graphics->putImg(0, 0, textAreaBackground);
+ g_engine->_graphics->putImg(0, 0, g_engine->_graphics->_textAreaBackground);
drawText(5, 1,
messages[160],
messages[161],
@@ -527,7 +519,7 @@ void handleFlcEvent(byte eventNumber) {
case 17:
switch (frameCount) {
case 1:
- g_engine->_graphics->putImg(0, 0, textAreaBackground);
+ g_engine->_graphics->putImg(0, 0, g_engine->_graphics->_textAreaBackground);
break;
case 17:
delay(500);
@@ -539,7 +531,7 @@ void handleFlcEvent(byte eventNumber) {
break;
case 18:
if ((loopNumber == 1) && (frameCount == 3)) {
- g_engine->_graphics->putImg(0, 0, textAreaBackground);
+ g_engine->_graphics->putImg(0, 0, g_engine->_graphics->_textAreaBackground);
drawText(5, 1,
messages[165],
messages[166],
@@ -564,7 +556,7 @@ void handleFlcEvent(byte eventNumber) {
case 1:
switch (frameCount) {
case 1:
- g_engine->_graphics->getImg(0, 0, 319, 69, textAreaBackground);
+ g_engine->_graphics->getImg(0, 0, 319, 69, g_engine->_graphics->_textAreaBackground);
break;
case 3:
drawText(15, 1,
@@ -580,7 +572,7 @@ void handleFlcEvent(byte eventNumber) {
case 3:
switch (frameCount) {
case 1:
- g_engine->_graphics->putImg(0, 0, textAreaBackground);
+ g_engine->_graphics->putImg(0, 0, g_engine->_graphics->_textAreaBackground);
break;
case 3:
drawText(15, 1,
@@ -596,7 +588,7 @@ void handleFlcEvent(byte eventNumber) {
case 6:
switch (frameCount) {
case 1:
- g_engine->_graphics->putImg(0, 0, textAreaBackground);
+ g_engine->_graphics->putImg(0, 0, g_engine->_graphics->_textAreaBackground);
break;
case 3:
drawText(15, 1,
@@ -612,7 +604,7 @@ void handleFlcEvent(byte eventNumber) {
case 9:
switch (frameCount) {
case 1:
- g_engine->_graphics->putImg(0, 0, textAreaBackground);
+ g_engine->_graphics->putImg(0, 0, g_engine->_graphics->_textAreaBackground);
break;
case 3:
drawText(15, 1,
@@ -628,7 +620,7 @@ void handleFlcEvent(byte eventNumber) {
case 12:
switch (frameCount) {
case 1:
- g_engine->_graphics->putImg(0, 0, textAreaBackground);
+ g_engine->_graphics->putImg(0, 0, g_engine->_graphics->_textAreaBackground);
break;
case 3:
drawText(15, 1,
@@ -644,7 +636,7 @@ void handleFlcEvent(byte eventNumber) {
case 15:
switch (frameCount) {
case 1:
- g_engine->_graphics->putImg(0, 0, textAreaBackground);
+ g_engine->_graphics->putImg(0, 0, g_engine->_graphics->_textAreaBackground);
break;
case 3:
drawText(15, 1,
@@ -660,7 +652,7 @@ void handleFlcEvent(byte eventNumber) {
case 18:
switch (frameCount) {
case 1:
- g_engine->_graphics->putImg(0, 0, textAreaBackground);
+ g_engine->_graphics->putImg(0, 0, g_engine->_graphics->_textAreaBackground);
break;
case 3:
drawText(15, 1,
@@ -676,7 +668,7 @@ void handleFlcEvent(byte eventNumber) {
case 21:
switch (frameCount) {
case 1:
- g_engine->_graphics->putImg(0, 0, textAreaBackground);
+ g_engine->_graphics->putImg(0, 0, g_engine->_graphics->_textAreaBackground);
break;
case 3:
drawText(15, 1,
@@ -692,7 +684,7 @@ void handleFlcEvent(byte eventNumber) {
case 24:
switch (frameCount) {
case 1:
- g_engine->_graphics->putImg(0, 0, textAreaBackground);
+ g_engine->_graphics->putImg(0, 0, g_engine->_graphics->_textAreaBackground);
break;
case 3:
drawText(15, 1,
@@ -708,7 +700,7 @@ void handleFlcEvent(byte eventNumber) {
case 27:
switch (frameCount) {
case 1:
- g_engine->_graphics->putImg(0, 0, textAreaBackground);
+ g_engine->_graphics->putImg(0, 0, g_engine->_graphics->_textAreaBackground);
break;
case 3:
drawText(15, 1,
@@ -724,7 +716,7 @@ void handleFlcEvent(byte eventNumber) {
case 30:
switch (frameCount) {
case 1:
- g_engine->_graphics->putImg(0, 0, textAreaBackground);
+ g_engine->_graphics->putImg(0, 0, g_engine->_graphics->_textAreaBackground);
break;
case 3:
drawText(15, 1,
@@ -739,7 +731,7 @@ void handleFlcEvent(byte eventNumber) {
break;
case 33:
if (frameCount == 17)
- g_engine->_graphics->putImg(0, 0, textAreaBackground);
+ g_engine->_graphics->putImg(0, 0, g_engine->_graphics->_textAreaBackground);
break;
}
break;
@@ -780,7 +772,7 @@ void handleFlcEvent(byte eventNumber) {
case 1:
switch (frameCount) {
case 2:
- g_engine->_graphics->getImg(0, 0, 319, 69, textAreaBackground);
+ g_engine->_graphics->getImg(0, 0, 319, 69, g_engine->_graphics->_textAreaBackground);
break;
case 3:
drawText(65, 1,
@@ -796,7 +788,7 @@ void handleFlcEvent(byte eventNumber) {
case 2:
switch (frameCount) {
case 1:
- g_engine->_graphics->putImg(0, 0, textAreaBackground);
+ g_engine->_graphics->putImg(0, 0, g_engine->_graphics->_textAreaBackground);
break;
case 2:
drawText(65, 1,
@@ -812,7 +804,7 @@ void handleFlcEvent(byte eventNumber) {
case 5:
switch (frameCount) {
case 1:
- g_engine->_graphics->putImg(0, 0, textAreaBackground);
+ g_engine->_graphics->putImg(0, 0, g_engine->_graphics->_textAreaBackground);
break;
case 2:
drawText(65, 1,
@@ -828,7 +820,7 @@ void handleFlcEvent(byte eventNumber) {
case 8:
switch (frameCount) {
case 1:
- g_engine->_graphics->putImg(0, 0, textAreaBackground);
+ g_engine->_graphics->putImg(0, 0, g_engine->_graphics->_textAreaBackground);
break;
case 2:
drawText(65, 1,
@@ -906,19 +898,20 @@ void blit(const Graphics::Surface *src, Common::Rect bounds) {
g_engine->_screen->update();
}
-static void loadFlc(
- uint &loop,
- bool &isSkipAllowed,
- bool &exitAnim,
- byte &eventNumber,
- bool &fullPalette,
- bool &limitPaletteTo200,
- byte &speed,
- uint &x,
- uint &y) {
+void drawFlc(
+ uint x,
+ uint y,
+ int32 offset,
+ uint loop,
+ byte speed,
+ byte eventNumber,
+ bool fullPalette,
+ bool isSkipAllowed,
+ bool limitPaletteTo200,
+ bool &exitAnim) {
- frameCount = 0;
- loopNumber = 0;
+ uint loopNumber = 0;
+ byte frameCount = 0;
Common::File animationsFile;
Common::String fileName;
@@ -930,13 +923,13 @@ static void loadFlc(
if (!animationsFile.open(Common::Path(fileName))) {
showError(272);
}
- animationsFile.seek(flicFilePos, SEEK_SET);
+ animationsFile.seek(offset, SEEK_SET);
// Need to read header to get the total size of the FLIC file.
FliHeader header = readHeader(&animationsFile);
Common::SeekableSubReadStream *thisFlic = new Common::SeekableSubReadStream(
&animationsFile,
- flicFilePos,
- flicFilePos + header.size);
+ offset,
+ offset + header.size);
TotFlicDecoder flic = TotFlicDecoder();
@@ -954,7 +947,7 @@ static void loadFlc(
}
if (gameTick) {
frameCount++;
- handleFlcEvent(eventNumber);
+ handleFlcEvent(eventNumber, loopNumber, frameCount);
const Graphics::Surface *frame = flic.decodeNextFrame();
if (frame) {
Common::Rect boundingBox = Common::Rect(x, y, x + flic.getWidth() + 1, y + flic.getHeight() + 1);
@@ -971,7 +964,7 @@ static void loadFlc(
} else if (limitPaletteTo200) {
g_engine->_graphics->setPalette(palette, 0, 200);
for (int i = 0; i <= 200; i++) {
- if(g_engine->_gamePart == 2 && !g_engine->_shouldQuitGame && (i == 131 || i == 134 || i == 143 || i == 187)) {
+ if (g_engine->_gamePart == 2 && !g_engine->_shouldQuitGame && (i == 131 || i == 134 || i == 143 || i == 187)) {
continue;
}
g_engine->_graphics->_pal[i * 3 + 0] = palette[i * 3 + 0];
@@ -985,7 +978,7 @@ static void loadFlc(
}
}
// Make sure we also update the palette animations! Esp. for part 2
- if(g_engine->_currentRoomData != NULL && !g_engine->_shouldQuitGame) {
+ if (g_engine->_currentRoomData != NULL && !g_engine->_shouldQuitGame) {
g_engine->_graphics->advancePaletteAnim();
}
gameTick = false;
@@ -1001,7 +994,6 @@ static void loadFlc(
flic.rewind();
}
frameCount = 0;
- firstLoop = false;
}
} while (loopNumber <= loop && !g_engine->shouldQuit());
flic.stop();
@@ -1009,25 +1001,7 @@ Lexit_proc:
animationsFile.close();
}
-void drawFlc(
- uint x,
- uint y,
- int32 offset,
- uint loop,
- byte speed,
- byte numEvent,
- bool fullPalette,
- bool skipAllowed,
- bool limitPaletteTo200,
- bool &exitAnim) {
-
- firstLoop = true;
- flicFilePos = offset;
- flicRelativePos = x + y * 320;
- loadFlc(loop, skipAllowed, exitAnim, numEvent, fullPalette, limitPaletteTo200, speed, x, y);
-}
-
void clearAnims() {
- free(textAreaBackground);
+ free(g_engine->_graphics->_textAreaBackground);
}
} // End of namespace Tot
diff --git a/engines/tot/graphics.h b/engines/tot/graphics.h
index d35f82a589c..b1766700250 100644
--- a/engines/tot/graphics.h
+++ b/engines/tot/graphics.h
@@ -31,6 +31,9 @@
namespace Tot {
+
+const int kTextAreaSize = 320 * 70 + 4;
+
class GraphicsManager {
public:
GraphicsManager();
@@ -96,6 +99,10 @@ public:
*/
byte _pal[768] = { 0 };
+ /**
+ * TextArea for animations text
+ */
+ byte *_textAreaBackground = (byte *)malloc(kTextAreaSize);
private:
void updateSceneAreaIfNeeded(int speed = 1);
signed char fadeData[256][256];
Commit: f2ba02a0cfdac79b314ad27d5b69765adb664577
https://github.com/scummvm/scummvm/commit/f2ba02a0cfdac79b314ad27d5b69765adb664577
Author: gsanmartin (gabriel.sanmartin at dna.inc)
Date: 2025-09-08T16:49:51+02:00
Commit Message:
TOT: Remove global vars on dialogue
Changed paths:
engines/tot/dialog.cpp
engines/tot/dialog.h
diff --git a/engines/tot/dialog.cpp b/engines/tot/dialog.cpp
index 038333aeee9..f6673615cea 100644
--- a/engines/tot/dialog.cpp
+++ b/engines/tot/dialog.cpp
@@ -28,13 +28,6 @@
namespace Tot {
-byte conversationIndex;
-
-listP l1, l;
-Tree ar, auxTree, step;
-
-bool endOfConversation;
-
Common::String decrypt(Common::String encryptedText) {
for (int i = 0; i < encryptedText.size(); i++) {
encryptedText.setChar(g_engine->_decryptionKey[i] ^ (char)encryptedText[i], i);
@@ -42,7 +35,7 @@ Common::String decrypt(Common::String encryptedText) {
return encryptedText;
}
-void findDialogLine(byte characterIndex);
+void findDialogLine(LinkedList* linkedList, Tree tree, byte characterIndex);
static void findDownwards(Tree curTree, bool &descend) {
if (curTree != NULL) {
@@ -56,17 +49,16 @@ static void findDownwards(Tree curTree, bool &descend) {
}
}
-void findDialogLine(byte characterIndex) {
+void findDialogLine(LinkedList* linkedList, Tree tree, byte characterIndex) {
bool speak, ascend, descend, border, forward;
- auxTree = ar;
- auxTree = auxTree->child;
+ Tree auxTree = tree->child;
bool done = false;
- l = new list;
- l->next = NULL;
- l1 = l;
+ linkedList->next = NULL;
+ LinkedList* l1 = linkedList;
border = false;
ascend = false;
+ Tree step;
do {
switch (auxTree->element.spoken) {
case '0':
@@ -234,7 +226,7 @@ void findDialogLine(byte characterIndex) {
}
if (forward) {
forward = false;
- l1->next = new list;
+ l1->next = new LinkedList;
l1 = l1->next;
l1->next = NULL;
}
@@ -292,10 +284,10 @@ void findDialogLine(byte characterIndex) {
l1 = NULL;
}
-void modifyTree(uint node) {
+void modifyTree(Tree tree, uint node) {
bool found = false;
- auxTree = ar->child;
+ Tree auxTree = tree->child;
do {
if (auxTree->element.index == node) {
@@ -341,11 +333,15 @@ void fixTree(Tree tree) {
}
}
-void showDialogLine(Common::String conversationMatrix[16], uint &chosenTopic) {
- byte firstChat, selectedConv;
+void showDialogLine(
+ Common::String conversationMatrix[16],
+ uint &chosenTopic,
+ byte conversationIndex,
+ LinkedList* l1,
+ bool &endOfConversation) {
- firstChat = 1;
- selectedConv = 0;
+ byte firstChat = 1;
+ byte selectedConv = 0;
g_engine->_mouse->hide();
g_engine->drawMenu(5);
@@ -442,22 +438,25 @@ void talk(byte characterIndex) {
Common::String conversationMatrix[16];
drawTalkMenu();
- endOfConversation = false;
+ bool endOfConversation = false;
g_engine->readTextFile();
// The original game makes a copy of the file upon starting a new game. .007 is the current game (the game
// that resumes when clicking "continue game" in the main menu. Part of the savegame data is this 007
// conversation file which marks conversatino topics as already gone through or not.
- readTree(*g_engine->_conversationData, ar, characterIndex - 1);
+ Tree tree;
+ readTree(*g_engine->_conversationData, tree, characterIndex - 1);
loadTalkAnimations();
+ LinkedList* l1;
do {
for (int i = 0; i < 16; i++) {
conversationMatrix[i] = "";
}
- findDialogLine(characterIndex);
- conversationIndex = 0;
- l1 = l;
+ LinkedList *linkedList = new LinkedList;
+ findDialogLine(linkedList, tree, characterIndex);
+ byte conversationIndex = 0;
+ l1 = linkedList;
do {
g_engine->_verbFile.seek(kVerbRegSize * l1->item);
conversationIndex += 1;
@@ -483,12 +482,12 @@ void talk(byte characterIndex) {
}
l1 = l1->next;
} while ((l1->next != NULL) && (l1 != NULL) && !g_engine->shouldQuit());
- l1 = l;
- showDialogLine(conversationMatrix, newNode);
- delete l;
+ l1 = linkedList;
+ showDialogLine(conversationMatrix, newNode, conversationIndex, l1, endOfConversation);
+ delete linkedList;
g_engine->sayLine(newNode, 255, 0, response, true);
stringAux = 0;
- modifyTree(newNode);
+ modifyTree(tree, newNode);
// verifyCopyProtection();
while (response > 0 && !g_engine->shouldQuit()) {
newNode = response;
@@ -524,15 +523,15 @@ void talk(byte characterIndex) {
} while (!endOfConversation && !g_engine->shouldQuit());
unloadTalkAnimations();
- step = ar;
+ Tree step = tree;
fixTree(step);
- saveConversations(g_engine->_conversationData, ar, characterIndex - 1);
+ saveConversations(g_engine->_conversationData, tree, characterIndex - 1);
g_engine->_verbFile.close();
if (g_engine->shouldQuit()) {
return;
}
- delete ar;
+ delete tree;
l1 = NULL;
g_engine->_mouse->hide();
diff --git a/engines/tot/dialog.h b/engines/tot/dialog.h
index b5a56bb02df..1b8ac7a2ca6 100644
--- a/engines/tot/dialog.h
+++ b/engines/tot/dialog.h
@@ -27,18 +27,11 @@
namespace Tot {
-typedef struct list *listP;
-
-struct list {
+struct LinkedList {
uint item;
- listP next;
+ LinkedList* next;
};
-extern byte conversationIndex;
-extern listP l1, l;
-extern Tree ar, auxTree, step;
-extern bool endOfConversation;
-
void talkToSceneObject();
void loadTalkAnimations();
Commit: 8a7828563c55871fbd27fdad191983df3c4e491e
https://github.com/scummvm/scummvm/commit/8a7828563c55871fbd27fdad191983df3c4e491e
Author: gsanmartin (gabriel.sanmartin at dna.inc)
Date: 2025-09-08T16:49:51+02:00
Commit Message:
TOT: Remove remaining warnings
Changed paths:
engines/tot/anims.cpp
engines/tot/font/bgifont.cpp
engines/tot/midi.cpp
engines/tot/routines2.cpp
engines/tot/saveload.cpp
engines/tot/tot.cpp
engines/tot/tot.h
diff --git a/engines/tot/anims.cpp b/engines/tot/anims.cpp
index 86ce9b8d03b..d367bedb8e5 100644
--- a/engines/tot/anims.cpp
+++ b/engines/tot/anims.cpp
@@ -953,7 +953,10 @@ void drawFlc(
Common::Rect boundingBox = Common::Rect(x, y, x + flic.getWidth() + 1, y + flic.getHeight() + 1);
blit(frame, boundingBox);
if (flic.hasDirtyPalette()) {
- byte *palette = (byte *)flic.getPalette();
+
+ const byte *fliPalette = (const byte *)flic.getPalette();
+ byte *palette = (byte *)malloc(768);
+ Common::copy(fliPalette, fliPalette + 768, palette);
// game fixes background to 0
palette[0] = 0;
palette[1] = 0;
diff --git a/engines/tot/font/bgifont.cpp b/engines/tot/font/bgifont.cpp
index 47fbb142005..8a91b7486c5 100644
--- a/engines/tot/font/bgifont.cpp
+++ b/engines/tot/font/bgifont.cpp
@@ -39,29 +39,29 @@ bool BgiFont::loadChr(const Common::Path &fileName) {
}
bool BgiFont::loadChr(Common::SeekableReadStream &stream) {
- uint16 fileSignature = stream.readUint16LE();
+ /* fileSignature = */ stream.readUint16LE();
/*
Description until finding value 0x1A
*/
Common::String description = stream.readString(0x1A);
uint16 headerSize = stream.readUint16LE();
Common::String name = stream.readString(0, 4);
- uint16 fontSize = stream.readUint16LE();
- byte majorVersion = stream.readByte();
- byte minorVersion = stream.readByte();
- byte majorRevision = stream.readByte();
- byte minorRevision = stream.readByte();
+ /*uint16 fontSize = */ stream.readUint16LE();
+ /* byte majorVersion = */ stream.readByte();
+ /* byte minorVersion = */ stream.readByte();
+ /* byte majorRevision = */ stream.readByte();
+ /* byte minorRevision = */ stream.readByte();
int remainingBytes = headerSize - (description.size() + 1 + 14);
stream.seek(remainingBytes, SEEK_CUR);
- char signature = stream.readByte();
+ /* char signature = */ stream.readByte();
_charCount = stream.readUint16LE();
// undefined byte
stream.skip(1);
_firstChar = stream.readByte();
- uint16 strokeOffset = stream.readUint16LE();
+ /* uint16 strokeOffset = */ stream.readUint16LE();
/*byte scanFlag = */ stream.readByte();
// Distance from the origin to the font's highest point
@@ -127,7 +127,7 @@ bool BgiFont::loadChr(Common::SeekableReadStream &stream) {
byte Graphics::BgiFont::fixSign(byte original) {
// If negative shifts the sign bit to the right position
- return original & 0x7F | ((original & 0x40) << 1);
+ return (original & 0x7F) | ((original & 0x40) << 1);
}
BgiFont::CachedFont *BgiFont::drawCachedFont(int size) {
diff --git a/engines/tot/midi.cpp b/engines/tot/midi.cpp
index c7dc9c494b6..0424f255934 100644
--- a/engines/tot/midi.cpp
+++ b/engines/tot/midi.cpp
@@ -61,12 +61,11 @@ int MidiPlayer::open() {
// Don't call open() twice!
assert(!_driver);
- int devFlags = MDT_MIDI | MDT_ADLIB;
OPL::Config::OplType oplType =
MidiDriver_ADLIB_Multisource::detectOplType(OPL::Config::kOpl3) ? OPL::Config::kOpl3 : OPL::Config::kOpl2;
- _driverMsMusic = new MidiDriver_AdLib(OPL::Config::kOpl3);
+ _driverMsMusic = new MidiDriver_AdLib(oplType);
_parserMusic = MidiParser::createParser_SMF();
_driver = _driverMsMusic;
@@ -190,7 +189,6 @@ void MidiDriver_AdLib::loadInstrumentBankFromDriver(long offset) {
if (!driverFile.open("CTMIDI.DRV")) {
error("Couldnt find midi file!");
}
- debug("Loading bank from offset: %d", offset);
driverFile.seek(offset, SEEK_SET);
uint8 *data = (uint8 *)malloc(128 * (11 + 21));
driverFile.read(data, 128 * (11 + 21));
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
index f6448263bba..adf4d5ca6e1 100644
--- a/engines/tot/routines2.cpp
+++ b/engines/tot/routines2.cpp
@@ -1521,16 +1521,19 @@ void TotEngine::initialMenu(bool fade) {
validOption = true;
} else if (x > 173 && x < 267) {
credits();
- drawFlc(0, 0, offset, 0, 9, 0, true, false, false, bar);
+ if(!g_engine->shouldQuit()) {
+ drawFlc(0, 0, offset, 0, 9, 0, true, false, false, bar);
+ }
}
} else if (y > 140 && y < 155) {
if (x > 173 && x < 292) {
_graphics->totalFadeOut(0);
_screen->clear();
introduction();
- drawFlc(0, 0, offset, 0, 9, 0, true, false, false, bar);
+ if(!g_engine->shouldQuit()) {
+ drawFlc(0, 0, offset, 0, 9, 0, true, false, false, bar);
+ }
} else if (x >= 18 && x <= 145) {
- debug("Load");
_startNewGame = false;
_continueGame = false;
validOption = true;
diff --git a/engines/tot/saveload.cpp b/engines/tot/saveload.cpp
index 5bde5b90bfb..ab0e29fa96e 100644
--- a/engines/tot/saveload.cpp
+++ b/engines/tot/saveload.cpp
@@ -132,9 +132,7 @@ bool syncGeneralData(Common::Serializer &s, SavedGame &game) {
s.syncAsUint16LE(game.niche[1][indiaux]);
}
- uint32 newBytes = s.bytesSynced();
- debug("return generalData totalBytes synced %d", s.bytesSynced());
- return true;
+ return s.bytesSynced() == 1740;
}
bool syncRoomData(Common::Serializer &s, Common::MemorySeekableReadWriteStream *roomStream) {
@@ -155,9 +153,7 @@ bool syncRoomData(Common::Serializer &s, Common::MemorySeekableReadWriteStream *
roomStream->read(roomBuf, size);
s.syncBytes(roomBuf, size);
free(roomBuf);
- debug("return room totalBytes synced %d", s.bytesSynced());
}
- uint32 newBytes = s.bytesSynced();
if (s.isLoading()) {
int size = g_engine->_rooms->size();
delete (g_engine->_rooms);
@@ -168,7 +164,7 @@ bool syncRoomData(Common::Serializer &s, Common::MemorySeekableReadWriteStream *
// TODO: Will roomBuf be automatically freed?
g_engine->_rooms = new Common::MemorySeekableReadWriteStream(roomBuf, size, DisposeAfterUse::NO);
}
- return true;
+ return s.bytesSynced() - startBytes == 347392;
}
bool syncConversationData(Common::Serializer &s, Common::MemorySeekableReadWriteStream *conversations) {
@@ -182,7 +178,6 @@ bool syncConversationData(Common::Serializer &s, Common::MemorySeekableReadWrite
conversations->read(convBuf, size);
s.syncBytes(convBuf, size);
free(convBuf);
- debug("return conversation totalBytes synced %d", s.bytesSynced());
}
if (s.isLoading()) {
delete (g_engine->_conversationData);
@@ -192,7 +187,7 @@ bool syncConversationData(Common::Serializer &s, Common::MemorySeekableReadWrite
// TODO: Will objBuf be automatically freed?
g_engine->_conversationData = new Common::MemorySeekableReadWriteStream(convBuf, size, DisposeAfterUse::NO);
}
- return true;
+ return s.bytesSynced() - startBytes == 2304;
}
bool syncItemData(Common::Serializer &s, Common::MemorySeekableReadWriteStream *items) {
@@ -204,7 +199,6 @@ bool syncItemData(Common::Serializer &s, Common::MemorySeekableReadWriteStream *
items->read(objBuf, size);
s.syncBytes(objBuf, size);
free(objBuf);
- debug("return items totalBytes synced %d", s.bytesSynced());
}
uint32 newBytes = s.bytesSynced();
if (s.isLoading()) {
@@ -215,7 +209,7 @@ bool syncItemData(Common::Serializer &s, Common::MemorySeekableReadWriteStream *
// TODO: Will objBuf be automatically freed?
g_engine->_invItemData = new Common::MemorySeekableReadWriteStream(objBuf, size, DisposeAfterUse::NO);
}
- return true;
+ return s.bytesSynced() - startBytes == 200322;
}
Common::Error syncSaveData(Common::Serializer &ser, SavedGame &game) {
@@ -235,6 +229,11 @@ Common::Error syncSaveData(Common::Serializer &ser, SavedGame &game) {
warning("Error while syncrhonizing conversation data");
return Common::kUnknownError;
}
+ if (ser.err()) {
+ warning("Error while synchronizing");
+ return Common::kUnknownError;
+ }
+
return Common::kNoError;
}
diff --git a/engines/tot/tot.cpp b/engines/tot/tot.cpp
index 7e52e2d7673..8e0ce66fb26 100644
--- a/engines/tot/tot.cpp
+++ b/engines/tot/tot.cpp
@@ -85,7 +85,7 @@ Common::Error TotEngine::run() {
_sound->init();
_graphics->init();
- initPlayAnim();
+ initVars();
_isIntroSeen = ConfMan.getBool("introSeen");
// _inventoryManager = new InventoryManager();
@@ -1247,7 +1247,7 @@ void TotEngine::resetGameState() {
_inventoryPosition = 0;
}
-void TotEngine::initPlayAnim() {
+void TotEngine::initVars() {
isLoadingFromLauncher = false;
_decryptionKey = "23313212133122121312132132312312122132322131221322222112121"
"32121121212112111212112333131232323213222132123211213221231"
diff --git a/engines/tot/tot.h b/engines/tot/tot.h
index 884e55cd5d1..abe13c18873 100644
--- a/engines/tot/tot.h
+++ b/engines/tot/tot.h
@@ -157,7 +157,7 @@ private:
// vars
void clearObj();
- void initPlayAnim();
+ void initVars();
void resetGameState();
void clearVars();
Commit: ae527dc4da58f081c2caf827fb5442719cff26ed
https://github.com/scummvm/scummvm/commit/ae527dc4da58f081c2caf827fb5442719cff26ed
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:51+02:00
Commit Message:
TOT: Extra cleanup
Changed paths:
engines/tot/saveload.cpp
engines/tot/util.cpp
diff --git a/engines/tot/saveload.cpp b/engines/tot/saveload.cpp
index ab0e29fa96e..2f832e3c0bd 100644
--- a/engines/tot/saveload.cpp
+++ b/engines/tot/saveload.cpp
@@ -34,7 +34,6 @@ namespace Tot {
#define SAVEGAME_CURRENT_VERSION 1
bool syncGeneralData(Common::Serializer &s, SavedGame &game) {
- uint32 startBytes = s.bytesSynced();
// Uint16
s.syncAsUint16LE(game.roomCode);
s.syncAsUint16LE(game.trajectoryLength);
@@ -161,7 +160,6 @@ bool syncRoomData(Common::Serializer &s, Common::MemorySeekableReadWriteStream *
s.syncBytes(roomBuf, size);
debug("Loading room data now");
- // TODO: Will roomBuf be automatically freed?
g_engine->_rooms = new Common::MemorySeekableReadWriteStream(roomBuf, size, DisposeAfterUse::NO);
}
return s.bytesSynced() - startBytes == 347392;
@@ -184,7 +182,6 @@ bool syncConversationData(Common::Serializer &s, Common::MemorySeekableReadWrite
byte *convBuf = (byte *)malloc(size);
s.syncBytes(convBuf, size);
debug("Loading conversation data now");
- // TODO: Will objBuf be automatically freed?
g_engine->_conversationData = new Common::MemorySeekableReadWriteStream(convBuf, size, DisposeAfterUse::NO);
}
return s.bytesSynced() - startBytes == 2304;
@@ -200,13 +197,11 @@ bool syncItemData(Common::Serializer &s, Common::MemorySeekableReadWriteStream *
s.syncBytes(objBuf, size);
free(objBuf);
}
- uint32 newBytes = s.bytesSynced();
if (s.isLoading()) {
delete (g_engine->_invItemData);
byte *objBuf = (byte *)malloc(size);
s.syncBytes(objBuf, size);
debug("Loading item data now");
- // TODO: Will objBuf be automatically freed?
g_engine->_invItemData = new Common::MemorySeekableReadWriteStream(objBuf, size, DisposeAfterUse::NO);
}
return s.bytesSynced() - startBytes == 200322;
diff --git a/engines/tot/util.cpp b/engines/tot/util.cpp
index c085743f895..5a9e4b3885e 100644
--- a/engines/tot/util.cpp
+++ b/engines/tot/util.cpp
@@ -394,7 +394,6 @@ void littText(int x, int y, Common::String text, byte color, Graphics::TextAlign
void littText(int x, int y, char const *text, byte color, Graphics::TextAlign align) {
bool yAligned = (align == Graphics::kTextAlignCenter) ? true : false;
x = (align == Graphics::kTextAlignCenter) ? 0 : x;
- // TODO: Investigate why this is needed
y = y + 2;
g_engine->_graphics->littText(text, x, y, color, align, yAligned);
}
@@ -406,7 +405,6 @@ void euroText(int x, int y, Common::String text, byte color, Graphics::TextAlign
void euroText(int x, int y, char const *text, byte color, Graphics::TextAlign align) {
bool yAligned = (align == Graphics::kTextAlignCenter) ? true : false;
x = (align == Graphics::kTextAlignCenter) ? 0 : x;
- // TODO: Investigate why this is needed
y = y + 2;
g_engine->_graphics->euroText(text, x, y, color, align, yAligned);
}
@@ -422,7 +420,6 @@ void outtextxy(int x, int y, Common::String text, byte color, bool euro, Graphic
void outtextxy(int x, int y, char const *text, byte color, bool euro, Graphics::TextAlign align) {
bool yAligned = (align == Graphics::kTextAlignCenter) ? true : false;
x = (align == Graphics::kTextAlignCenter) ? 0 : x;
- // TODO: Investigate why this is needed
y = y + 2;
if (euro) {
g_engine->_graphics->euroText(text, x, y, color, align, yAligned);
Commit: 90de7190aadb6b15ce059c68d5d813b890cbea48
https://github.com/scummvm/scummvm/commit/90de7190aadb6b15ce059c68d5d813b890cbea48
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:51+02:00
Commit Message:
TOT: Replace custom linkedlist for Common::List
Changed paths:
engines/tot/dialog.cpp
engines/tot/dialog.h
engines/tot/routines.cpp
diff --git a/engines/tot/dialog.cpp b/engines/tot/dialog.cpp
index f6673615cea..37095de4097 100644
--- a/engines/tot/dialog.cpp
+++ b/engines/tot/dialog.cpp
@@ -35,7 +35,7 @@ Common::String decrypt(Common::String encryptedText) {
return encryptedText;
}
-void findDialogLine(LinkedList* linkedList, Tree tree, byte characterIndex);
+Common::List<uint>* findDialogue(Tree tree, byte characterIndex);
static void findDownwards(Tree curTree, bool &descend) {
if (curTree != NULL) {
@@ -49,13 +49,12 @@ static void findDownwards(Tree curTree, bool &descend) {
}
}
-void findDialogLine(LinkedList* linkedList, Tree tree, byte characterIndex) {
+Common::List<uint>* findDialogue(Tree tree, byte characterIndex) {
bool speak, ascend, descend, border, forward;
Tree auxTree = tree->child;
bool done = false;
- linkedList->next = NULL;
- LinkedList* l1 = linkedList;
+ Common::List<uint> *linkedList = new Common::List<uint>();
border = false;
ascend = false;
Tree step;
@@ -193,27 +192,34 @@ void findDialogLine(LinkedList* linkedList, Tree tree, byte characterIndex) {
switch (characterIndex) {
case 1:
if (g_engine->_firstTimeTopicA[characterIndex - 1]) {
- l1->item = 12;
+ linkedList->push_back(12);
+ // l1->item = 12;
forward = true;
} else if (g_engine->_bookTopic[characterIndex - 1]) {
forward = true;
- l1->item = 33;
+ linkedList->push_back(33);
+
+ // l1->item = 33;
} else {
- l1->item = 21;
+ linkedList->push_back(21);
+ // l1->item = 21;
forward = true;
}
break;
case 3:
if (g_engine->_firstTimeTopicA[characterIndex - 1]) {
- l1->item = 103;
+ linkedList->push_back(103);
+ // l1->item = 103;
forward = true;
} else {
- l1->item = 112;
+ linkedList->push_back(112);
+ // l1->item = 112;
forward = true;
}
break;
default: {
- l1->item = auxTree->element.index;
+ linkedList->push_back(auxTree->element.index);
+ // l1->item = auxTree->element.index;
forward = true;
}
}
@@ -221,14 +227,15 @@ void findDialogLine(LinkedList* linkedList, Tree tree, byte characterIndex) {
;
}
else {
- l1->item = auxTree->element.index;
+ linkedList->push_back(auxTree->element.index);
+ // l1->item = auxTree->element.index;
forward = true;
}
if (forward) {
forward = false;
- l1->next = new LinkedList;
- l1 = l1->next;
- l1->next = NULL;
+ // l1->next = new LinkedList;
+ // l1 = l1->next;
+ // l1->next = NULL;
}
if (rightSibling(auxTree) != NULL)
auxTree = rightSibling(auxTree);
@@ -281,7 +288,7 @@ void findDialogLine(LinkedList* linkedList, Tree tree, byte characterIndex) {
} while (!done);
auxTree = NULL;
step = NULL;
- l1 = NULL;
+ return linkedList;
}
void modifyTree(Tree tree, uint node) {
@@ -333,11 +340,11 @@ void fixTree(Tree tree) {
}
}
-void showDialogLine(
+void showDialogueLine(
Common::String conversationMatrix[16],
uint &chosenTopic,
byte conversationIndex,
- LinkedList* l1,
+ Common::ListInternal::Iterator<uint> l1,
bool &endOfConversation) {
byte firstChat = 1;
@@ -426,8 +433,8 @@ void showDialogLine(
if (selectedConv == conversationIndex)
endOfConversation = true;
for (int i = 1; i <= (selectedConv - 1); i++)
- l1 = l1->next;
- chosenTopic = l1->item;
+ l1++;
+ chosenTopic = *l1;
}
void talk(byte characterIndex) {
@@ -446,19 +453,18 @@ void talk(byte characterIndex) {
Tree tree;
readTree(*g_engine->_conversationData, tree, characterIndex - 1);
loadTalkAnimations();
- LinkedList* l1;
+ Common::ListInternal::Iterator<uint> l1;
do {
for (int i = 0; i < 16; i++) {
conversationMatrix[i] = "";
}
- LinkedList *linkedList = new LinkedList;
- findDialogLine(linkedList, tree, characterIndex);
+ Common::List<uint> *linkedList = findDialogue(tree, characterIndex);
byte conversationIndex = 0;
- l1 = linkedList;
- do {
- g_engine->_verbFile.seek(kVerbRegSize * l1->item);
+ l1 = linkedList->begin();
+ while (l1 != linkedList->end() && !g_engine->shouldQuit()) {
+ g_engine->_verbFile.seek(kVerbRegSize * (*l1));
conversationIndex += 1;
text = g_engine->readVerbRegister();
insertName = 0;
@@ -480,10 +486,10 @@ void talk(byte characterIndex) {
conversationMatrix[conversationIndex] = conversationMatrix[conversationIndex].substr(0, stringAux);
conversationMatrix[conversationIndex].insertString(" ...", stringAux);
}
- l1 = l1->next;
- } while ((l1->next != NULL) && (l1 != NULL) && !g_engine->shouldQuit());
- l1 = linkedList;
- showDialogLine(conversationMatrix, newNode, conversationIndex, l1, endOfConversation);
+ l1++;
+ };
+ l1 = linkedList->begin();
+ showDialogueLine(conversationMatrix, newNode, conversationIndex, l1, endOfConversation);
delete linkedList;
g_engine->sayLine(newNode, 255, 0, response, true);
stringAux = 0;
@@ -532,7 +538,7 @@ void talk(byte characterIndex) {
return;
}
delete tree;
- l1 = NULL;
+
g_engine->_mouse->hide();
for (int i = 25; i >= 1; i--)
diff --git a/engines/tot/dialog.h b/engines/tot/dialog.h
index 1b8ac7a2ca6..60716c391da 100644
--- a/engines/tot/dialog.h
+++ b/engines/tot/dialog.h
@@ -27,13 +27,7 @@
namespace Tot {
-struct LinkedList {
- uint item;
- LinkedList* next;
-};
-
void talkToSceneObject();
-
void loadTalkAnimations();
void unloadTalkAnimations();
diff --git a/engines/tot/routines.cpp b/engines/tot/routines.cpp
index 96b6570291b..a85e20d8625 100644
--- a/engines/tot/routines.cpp
+++ b/engines/tot/routines.cpp
@@ -750,6 +750,7 @@ RoomObjectListEntry *readRoomObjects(Common::SeekableReadStream *screenDataFile)
}
RoomFileRegister *TotEngine::readScreenDataFile(Common::SeekableReadStream *screenDataFile) {
+ debug("reading screen data file!");
RoomFileRegister *screenData = new RoomFileRegister();
screenData->code = screenDataFile->readUint16LE();
screenData->roomImagePointer = screenDataFile->readUint32LE();
@@ -793,6 +794,7 @@ void TotEngine::loadScreenData(uint screenNumber) {
_rooms->seek(screenNumber * kRoomRegSize, SEEK_SET);
_currentRoomData = readScreenDataFile(_rooms);
+ debug("Current roomData is = %p", _currentRoomData);
loadScreen();
for (int i = 0; i < 15; i++) {
RoomBitmapRegister &bitmap = _currentRoomData->screenLayers[i];
Commit: a2da43994ddb6a6d31e4ad93a7f9579d561f5ded
https://github.com/scummvm/scummvm/commit/a2da43994ddb6a6d31e4ad93a7f9579d561f5ded
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:51+02:00
Commit Message:
TOT: Fixes crash on starting new game
Changed paths:
engines/tot/routines.cpp
engines/tot/tot.h
diff --git a/engines/tot/routines.cpp b/engines/tot/routines.cpp
index a85e20d8625..9c4dd201b84 100644
--- a/engines/tot/routines.cpp
+++ b/engines/tot/routines.cpp
@@ -794,7 +794,6 @@ void TotEngine::loadScreenData(uint screenNumber) {
_rooms->seek(screenNumber * kRoomRegSize, SEEK_SET);
_currentRoomData = readScreenDataFile(_rooms);
- debug("Current roomData is = %p", _currentRoomData);
loadScreen();
for (int i = 0; i < 15; i++) {
RoomBitmapRegister &bitmap = _currentRoomData->screenLayers[i];
diff --git a/engines/tot/tot.h b/engines/tot/tot.h
index abe13c18873..40c16fc06b2 100644
--- a/engines/tot/tot.h
+++ b/engines/tot/tot.h
@@ -435,7 +435,7 @@ public:
/**
* Previous positions of the mouse within the screen grid
*/
- uint oldGridX, oldGridY;
+ uint oldGridX = 0, oldGridY = 0;
SavedGame savedGame;
Commit: aec89256ed45d81eed82d39233bb79870e4ce8ff
https://github.com/scummvm/scummvm/commit/aec89256ed45d81eed82d39233bb79870e4ce8ff
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:51+02:00
Commit Message:
TOT: Improve detection
Changed paths:
engines/tot/detection_tables.h
diff --git a/engines/tot/detection_tables.h b/engines/tot/detection_tables.h
index 095b9501422..3b5e8964270 100644
--- a/engines/tot/detection_tables.h
+++ b/engines/tot/detection_tables.h
@@ -22,7 +22,7 @@
namespace Tot {
const PlainGameDescriptor totGames[] = {
- { "tot", "Tot" },
+ { "tot", "Trick or Treat" },
{ 0, 0 }
};
@@ -30,7 +30,10 @@ const ADGameDescription gameDescriptions[] = {
{
"tot",
nullptr,
- AD_ENTRY1s("CREDITOS.DAT", "6885c1fadd25a0c0da1c88f071a30e63", 130080),
+ AD_ENTRY2s(
+ "AZCCOG.DAT", "2f66724fcd7f51c5b4a715b30f088581", 79916,
+ "CREDITOS.DAT", "6885c1fadd25a0c0da1c88f071a30e63", 130080
+ ),
Common::ES_ESP,
Common::kPlatformDOS,
ADGF_UNSTABLE,
@@ -39,7 +42,10 @@ const ADGameDescription gameDescriptions[] = {
{
"tot",
nullptr,
- AD_ENTRY1s("CREDITOS.DAT", "bca1c63cfee9ec8b722f7715e21b5e8e", 130080),
+ AD_ENTRY2s(
+ "AZCCOG.DAT", "2f66724fcd7f51c5b4a715b30f088581", 79916,
+ "CREDITOS.DAT", "bca1c63cfee9ec8b722f7715e21b5e8e", 130080
+ ),
Common::EN_ANY,
Common::kPlatformDOS,
ADGF_UNSTABLE,
Commit: 21587a41dc2ecf37e67323329c6dcd7c59411828
https://github.com/scummvm/scummvm/commit/21587a41dc2ecf37e67323329c6dcd7c59411828
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:51+02:00
Commit Message:
TOT: Fixes timing issues with FLICs
Changed paths:
engines/tot/anims.cpp
engines/tot/chrono.h
engines/tot/detection.h
engines/tot/routines.cpp
engines/tot/routines2.cpp
engines/tot/tot.h
diff --git a/engines/tot/anims.cpp b/engines/tot/anims.cpp
index d367bedb8e5..20efcdc007c 100644
--- a/engines/tot/anims.cpp
+++ b/engines/tot/anims.cpp
@@ -934,8 +934,9 @@ void drawFlc(
TotFlicDecoder flic = TotFlicDecoder();
flic.loadStream(thisFlic);
- flic.start();
+ flic.start();
+ bool skipFrame = false;
do {
exitProcedure(exitAnim, isSkipAllowed);
loopNumber++;
@@ -945,7 +946,10 @@ void drawFlc(
if (exitAnim) {
goto Lexit_proc;
}
- if (gameTick) {
+ if(speed == 9) {
+ skipFrame = !skipFrame;
+ }
+ if (gameTick && !skipFrame) {
frameCount++;
handleFlcEvent(eventNumber, loopNumber, frameCount);
const Graphics::Surface *frame = flic.decodeNextFrame();
diff --git a/engines/tot/chrono.h b/engines/tot/chrono.h
index d5004889ae3..7a2d13fe5b1 100644
--- a/engines/tot/chrono.h
+++ b/engines/tot/chrono.h
@@ -30,8 +30,8 @@ namespace Tot {
*/
extern bool gameTick, gameTickHalfSpeed, timeToDrawEffect;
-const int kTickMs = 20;
-// const int kTickMs = 50;
+// const int kTickMs = 20;
+const int kTickMs = 50;
const int kHalfTickMultiplier = 2;
const int kFrameEffectMs = 10;
diff --git a/engines/tot/detection.h b/engines/tot/detection.h
index ee7fc5caea5..7827df25c3a 100644
--- a/engines/tot/detection.h
+++ b/engines/tot/detection.h
@@ -54,7 +54,7 @@ public:
}
const char *getEngineName() const override {
- return "Tot";
+ return "Trick or Treat";
}
const char *getOriginalCopyright() const override {
diff --git a/engines/tot/routines.cpp b/engines/tot/routines.cpp
index 9c4dd201b84..e01aa1348a1 100644
--- a/engines/tot/routines.cpp
+++ b/engines/tot/routines.cpp
@@ -926,11 +926,11 @@ void TotEngine::lookAtObject(byte objectCode) {
description = textRef.text;
for (yaux = 0; yaux < textRef.text.size(); yaux++)
description.setChar(_decryptionKey[yaux] ^ textRef.text[yaux], yaux);
- displayObjectDescription(description, 60, 15, 33, 255, 0);
+ displayObjectDescription(description);
_verbFile.close();
} else {
description = _inventory[objectCode].objectName;
- displayObjectDescription(description, 60, 15, 33, 255, 0);
+ displayObjectDescription(description);
}
} else {
@@ -940,11 +940,11 @@ void TotEngine::lookAtObject(byte objectCode) {
description = textRef.text;
for (yaux = 0; yaux < textRef.text.size(); yaux++)
description.setChar(_decryptionKey[yaux] ^ textRef.text[yaux], yaux);
- displayObjectDescription(description, 60, 15, 33, 255, 0);
+ displayObjectDescription(description);
_verbFile.close();
} else {
description = _inventory[objectCode].objectName;
- displayObjectDescription(description, 60, 15, 33, 255, 0);
+ displayObjectDescription(description);
}
}
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
index adf4d5ca6e1..87fda5f5b92 100644
--- a/engines/tot/routines2.cpp
+++ b/engines/tot/routines2.cpp
@@ -935,14 +935,12 @@ void TotEngine::readAlphaGraphSmall(Common::String &output, int length, int posx
bar(posx + (output.size()) * 6, posy + 2, (posx + (output.size()) * 6) + 6, posy + 9, barColor);
}
-void TotEngine::displayObjectDescription(
- Common::String textString,
- uint xpos,
- uint ypos,
- byte maxWidth,
- byte textColor,
- byte shadowColor) {
-
+void TotEngine::displayObjectDescription(Common::String textString) {
+ uint xpos = 60;
+ uint ypos = 15;
+ byte maxWidth = 33;
+ byte textColor = 255;
+ byte shadowColor = 0;
byte ihc, lineCounter;
byte newLineMatrix[10];
diff --git a/engines/tot/tot.h b/engines/tot/tot.h
index 40c16fc06b2..f6a250eca4a 100644
--- a/engines/tot/tot.h
+++ b/engines/tot/tot.h
@@ -139,7 +139,7 @@ private:
void firstIntroduction();
void readAlphaGraph(Common::String &data, int length, int x, int y, byte barColor);
void readAlphaGraphSmall(Common::String &data, int length, int x, int y, byte barColor, byte textColor);
- void displayObjectDescription(Common::String text, uint x, uint y, byte width, byte textColor, byte shadowColor);
+ void displayObjectDescription(Common::String text);
void copyProtection();
void initialLogo();
void initialMenu(bool fade);
Commit: df05df68868547965f059c98fdda5262c59e305f
https://github.com/scummvm/scummvm/commit/df05df68868547965f059c98fdda5262c59e305f
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:51+02:00
Commit Message:
TOT: Fixes crash when exiting from main menu
Changed paths:
engines/tot/console.cpp
engines/tot/graphics.cpp
engines/tot/routines.cpp
engines/tot/routines2.cpp
engines/tot/saveload.cpp
engines/tot/tot.cpp
engines/tot/tot.h
diff --git a/engines/tot/console.cpp b/engines/tot/console.cpp
index 3b092bc1370..07d702a74d2 100644
--- a/engines/tot/console.cpp
+++ b/engines/tot/console.cpp
@@ -66,7 +66,7 @@ bool TotConsole::cmdClearLayers(int argc, const char **argv) {
_engine->_showScreenGrid = false;
_engine->_showGameGrid = false;
_engine->_showMouseGrid = false;
- g_engine->_graphics->drawScreen(g_engine->sceneBackground);
+ g_engine->_graphics->drawScreen(g_engine->_sceneBackground);
debugPrintf("Cleared all debug layers");
return true;
}
@@ -82,7 +82,7 @@ bool TotConsole::cmdLoadRoom(int argc, const char **argv) {
g_engine->freeAnimation();
g_engine->freeScreenObjects();
g_engine->loadScreenData(roomID);
- g_engine->_graphics->drawScreen(g_engine->sceneBackground);
+ g_engine->_graphics->drawScreen(g_engine->_sceneBackground);
debugPrintf("Loaded screen %d", roomID);
return true;
}
diff --git a/engines/tot/graphics.cpp b/engines/tot/graphics.cpp
index 3a170fe08a4..0190163d492 100644
--- a/engines/tot/graphics.cpp
+++ b/engines/tot/graphics.cpp
@@ -889,7 +889,7 @@ void GraphicsManager::init() {
}
void GraphicsManager::restoreBackground() {
- Common::copy(g_engine->backgroundCopy + 4, g_engine->backgroundCopy + g_engine->_screenSize, g_engine->sceneBackground + 4);
+ Common::copy(g_engine->_backgroundCopy + 4, g_engine->_backgroundCopy + g_engine->_screenSize, g_engine->_sceneBackground + 4);
}
void GraphicsManager::loadAnimationIntoBuffer(Common::SeekableReadStream *stream, byte *&buf, int animSize) {
diff --git a/engines/tot/routines.cpp b/engines/tot/routines.cpp
index e01aa1348a1..bc1cb10f5e4 100644
--- a/engines/tot/routines.cpp
+++ b/engines/tot/routines.cpp
@@ -120,7 +120,7 @@ void TotEngine::runaroundRed() {
freeAnimation();
_graphics->restoreBackground();
assembleScreen();
- _graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(_sceneBackground);
}
void updateMovementGrids() {
@@ -150,8 +150,8 @@ void updateMovementGrids() {
g_engine->_oldposx = j1arm;
g_engine->_oldposy = j2arm;
- g_engine->oldGridX = 0;
- g_engine->oldGridY = 0;
+ g_engine->_oldGridX = 0;
+ g_engine->_oldGridY = 0;
}
}
@@ -178,8 +178,8 @@ static void assembleBackground() {
posabs = 4 + dirtyMainSpriteY * 320 + dirtyMainSpriteX;
uint16 w, h;
- w = READ_LE_UINT16(g_engine->characterDirtyRect);
- h = READ_LE_UINT16(g_engine->characterDirtyRect + 2);
+ w = READ_LE_UINT16(g_engine->_characterDirtyRect);
+ h = READ_LE_UINT16(g_engine->_characterDirtyRect + 2);
w++;
h++;
@@ -190,7 +190,7 @@ static void assembleBackground() {
for (int i = 0; i < w; i++) {
int pos = posabs + j * 320 + i;
int destPos = 4 + (j * w + i);
- g_engine->characterDirtyRect[destPos] = g_engine->sceneBackground[pos];
+ g_engine->_characterDirtyRect[destPos] = g_engine->_sceneBackground[pos];
}
}
}
@@ -209,8 +209,8 @@ static void assembleImage(byte *img, uint imgPosX, uint imgPosY) {
uint16 wImg = READ_LE_UINT16(img) + 1;
uint16 hImg = READ_LE_UINT16(img + 2) + 1;
- uint16 wBg = READ_LE_UINT16(g_engine->characterDirtyRect) + 1;
- uint16 hBg = READ_LE_UINT16(g_engine->characterDirtyRect + 2) + 1;
+ uint16 wBg = READ_LE_UINT16(g_engine->_characterDirtyRect) + 1;
+ uint16 hBg = READ_LE_UINT16(g_engine->_characterDirtyRect + 2) + 1;
// This region calculates the overlapping area of (x, incx, y, incy)
{
@@ -240,7 +240,7 @@ static void assembleImage(byte *img, uint imgPosX, uint imgPosY) {
int bgOffset = 4 + ((y - dirtyMainSpriteY) + j) * wBg + i + (x - dirtyMainSpriteX);
int imgOffset = 4 + (y - imgPosY + j) * wImg + i + (x - imgPosX);
if (img[imgOffset] != 0) {
- g_engine->characterDirtyRect[bgOffset] = img[imgOffset];
+ g_engine->_characterDirtyRect[bgOffset] = img[imgOffset];
}
}
}
@@ -262,7 +262,7 @@ void drawMainCharacter() {
bool debug = false;
if (debug) {
- g_engine->_graphics->sceneTransition(false, g_engine->sceneBackground, 13);
+ g_engine->_graphics->sceneTransition(false, g_engine->_sceneBackground, 13);
}
uint16 tempW;
@@ -272,10 +272,10 @@ void drawMainCharacter() {
tempW += 6;
tempH += 6;
- g_engine->characterDirtyRect = (byte *)malloc((tempW + 1) * (tempH + 1) + 4);
+ g_engine->_characterDirtyRect = (byte *)malloc((tempW + 1) * (tempH + 1) + 4);
- WRITE_LE_UINT16(g_engine->characterDirtyRect, tempW);
- WRITE_LE_UINT16(g_engine->characterDirtyRect + 2, tempH);
+ WRITE_LE_UINT16(g_engine->_characterDirtyRect, tempW);
+ WRITE_LE_UINT16(g_engine->_characterDirtyRect + 2, tempH);
assembleBackground();
curDepth = 0;
@@ -286,14 +286,14 @@ void drawMainCharacter() {
curDepth += 1;
}
- g_engine->_graphics->putImg(dirtyMainSpriteX, dirtyMainSpriteY, g_engine->characterDirtyRect);
+ g_engine->_graphics->putImg(dirtyMainSpriteX, dirtyMainSpriteY, g_engine->_characterDirtyRect);
if (debug) {
// draw background dirty area
drawRect(2, dirtyMainSpriteX, dirtyMainSpriteY, dirtyMainSpriteX + tempW, dirtyMainSpriteY + tempH);
drawPos(g_engine->_xframe2, g_engine->_yframe2, 218);
}
- free(g_engine->characterDirtyRect);
+ free(g_engine->_characterDirtyRect);
}
void TotEngine::sprites(bool drawMainCharachter) {
@@ -348,10 +348,10 @@ void TotEngine::sprites(bool drawMainCharachter) {
patchW -= (dirtyMainSpriteX + patchW) - 320 + 1;
}
- characterDirtyRect = (byte *)malloc((patchW + 1) * (patchH + 1) + 4);
+ _characterDirtyRect = (byte *)malloc((patchW + 1) * (patchH + 1) + 4);
- WRITE_LE_UINT16(characterDirtyRect, patchW);
- WRITE_LE_UINT16(characterDirtyRect + 2, patchH);
+ WRITE_LE_UINT16(_characterDirtyRect, patchW);
+ WRITE_LE_UINT16(_characterDirtyRect + 2, patchH);
assembleBackground();
curDepth = 0;
@@ -363,7 +363,7 @@ void TotEngine::sprites(bool drawMainCharachter) {
assembleImage(_curCharacterAnimationFrame, _characterPosX, _characterPosY);
curDepth += 1;
}
- _graphics->putImg(dirtyMainSpriteX, dirtyMainSpriteY, characterDirtyRect);
+ _graphics->putImg(dirtyMainSpriteX, dirtyMainSpriteY, _characterDirtyRect);
} else { // character and animation are in different parts of the screen
if (drawMainCharachter) {
@@ -384,9 +384,9 @@ void TotEngine::sprites(bool drawMainCharachter) {
secAnimW -= (dirtyMainSpriteX + secAnimW) - 320 + 1;
}
- characterDirtyRect = (byte *)malloc((secAnimW + 1) * (secAnimH + 1) + 4);
- WRITE_LE_UINT16(characterDirtyRect, secAnimW);
- WRITE_LE_UINT16(characterDirtyRect + 2, secAnimH);
+ _characterDirtyRect = (byte *)malloc((secAnimW + 1) * (secAnimH + 1) + 4);
+ WRITE_LE_UINT16(_characterDirtyRect, secAnimW);
+ WRITE_LE_UINT16(_characterDirtyRect + 2, secAnimH);
assembleBackground();
curDepth = 0;
@@ -396,7 +396,7 @@ void TotEngine::sprites(bool drawMainCharachter) {
assembleImage(_curSecondaryAnimationFrame, _secondaryAnimation.posx, _secondaryAnimation.posy);
curDepth += 1;
}
- _graphics->putImg(dirtyMainSpriteX, dirtyMainSpriteY, characterDirtyRect);
+ _graphics->putImg(dirtyMainSpriteX, dirtyMainSpriteY, _characterDirtyRect);
}
} else if (drawMainCharachter) {
drawMainCharacter();
@@ -611,7 +611,7 @@ void TotEngine::animatedSequence(uint numSequence) {
_depthMap[13].posx = animX;
_depthMap[13].posy = animY;
assembleScreen();
- _graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(_sceneBackground);
_screenLayers[13] = NULL;
_mainCharAnimation.depth = animIndex;
drawBackpack();
@@ -656,7 +656,7 @@ void TotEngine::animatedSequence(uint numSequence) {
disableSecondAnimation();
_screenLayers[12] = NULL;
_mainCharAnimation.depth = animIndex;
- _graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(_sceneBackground);
for (animIndex = 9; animIndex <= secFrameCount; animIndex++) {
animationFile.read(animptr, animFrameSize);
emptyLoop();
@@ -694,10 +694,10 @@ void TotEngine::animatedSequence(uint numSequence) {
_graphics->advancePaletteAnim();
if (gameTickHalfSpeed) {
animationFile.read(_screenLayers[6], animFrameSize);
- Common::copy(_screenLayers[6], _screenLayers[6] + animFrameSize, sceneBackground + 44900);
+ Common::copy(_screenLayers[6], _screenLayers[6] + animFrameSize, _sceneBackground + 44900);
_graphics->restoreBackground();
assembleScreen();
- _graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(_sceneBackground);
animIndex += 1;
if (animIndex == 8)
_sound->playVoc("PUFF", 191183, 18001);
@@ -790,7 +790,7 @@ RoomFileRegister *TotEngine::readScreenDataFile(Common::SeekableReadStream *scre
void TotEngine::loadScreenData(uint screenNumber) {
debug("Opening screen %d", screenNumber);
- currentRoomNumber = screenNumber;
+ _currentRoomNumber = screenNumber;
_rooms->seek(screenNumber * kRoomRegSize, SEEK_SET);
_currentRoomData = readScreenDataFile(_rooms);
@@ -901,7 +901,7 @@ void TotEngine::lookAtObject(byte objectCode) {
_mouse->hide();
_graphics->copyPalette(g_engine->_graphics->_pal, secPalette);
readItemRegister(_inventory[objectCode].code);
- _graphics->getImg(0, 0, 319, 139, sceneBackground);
+ _graphics->getImg(0, 0, 319, 139, _sceneBackground);
_graphics->partialFadeOut(234);
bar(0, 0, 319, 139, 0);
for (yaux = 1; yaux <= 12; yaux++)
@@ -953,7 +953,7 @@ void TotEngine::lookAtObject(byte objectCode) {
_graphics->sceneTransition(true, NULL, 3);
_graphics->partialFadeOut(234);
assembleScreen();
- _graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(_sceneBackground);
_graphics->copyPalette(secPalette, g_engine->_graphics->_pal);
_graphics->partialFadeIn(234);
_mouse->show();
@@ -1431,14 +1431,14 @@ void TotEngine::animateBat() {
}
_graphics->restoreBackground();
assembleScreen();
- _graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(_sceneBackground);
}
void TotEngine::updateVideo() {
readBitmap(_curObject.dropOverlay, _screenLayers[_curObject.depth - 1], _curObject.dropOverlaySize, 319);
_graphics->restoreBackground();
assembleScreen();
- _graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(_sceneBackground);
}
void TotEngine::nicheAnimation(byte nicheDir, int32 bitmap) {
@@ -1461,17 +1461,17 @@ void TotEngine::nicheAnimation(byte nicheDir, int32 bitmap) {
case 0: {
bitmapOffset = 44904;
increment = 1;
- Common::copy(_screenLayers[0], _screenLayers[0] + 892, sceneBackground + 44900);
+ Common::copy(_screenLayers[0], _screenLayers[0] + 892, _sceneBackground + 44900);
readBitmap(bitmap, _screenLayers[0], 892, 319);
- Common::copy(_screenLayers[0] + 4, _screenLayers[0] + 4 + 888, sceneBackground + 44900 + 892);
+ Common::copy(_screenLayers[0] + 4, _screenLayers[0] + 4 + 888, _sceneBackground + 44900 + 892);
} break;
case 1: { // object slides to reveal empty stand
bitmapOffset = 892 + 44900;
increment = -1;
// Reads the empty niche into a non-visible part of background
- readBitmap(bitmap, sceneBackground + 44900, 892, 319);
+ readBitmap(bitmap, _sceneBackground + 44900, 892, 319);
// Copies whatever is currently on the niche in a non-visible part of background contiguous with the above
- Common::copy(_screenLayers[0] + 4, _screenLayers[0] + 4 + 888, sceneBackground + 44900 + 892);
+ Common::copy(_screenLayers[0] + 4, _screenLayers[0] + 4 + 888, _sceneBackground + 44900 + 892);
// We now have in consecutive pixels the empty stand and the object
} break;
@@ -1480,23 +1480,23 @@ void TotEngine::nicheAnimation(byte nicheDir, int32 bitmap) {
uint16 nicheHeight = READ_LE_UINT16(_screenLayers[0] + 2);
// Set the height to double to animate 2 images of the same height moving up/down
- *(sceneBackground + 44900 + 2) = (nicheHeight * 2) + 1;
+ *(_sceneBackground + 44900 + 2) = (nicheHeight * 2) + 1;
_graphics->restoreBackground();
for (uint i = 1; i <= nicheHeight; i++) {
bitmapOffset = bitmapOffset + (increment * (nicheWidth + 1));
- Common::copy(sceneBackground + bitmapOffset, sceneBackground + bitmapOffset + 888, _screenLayers[0] + 4);
+ Common::copy(_sceneBackground + bitmapOffset, _sceneBackground + bitmapOffset + 888, _screenLayers[0] + 4);
assembleScreen();
- _graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(_sceneBackground);
_screen->update();
}
readBitmap(bitmap, _screenLayers[0], 892, 319);
_graphics->restoreBackground();
assembleScreen();
- _graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(_sceneBackground);
if (_currentRoomData->code == 24) {
free(_screenLayers[1]);
@@ -1557,7 +1557,7 @@ void TotEngine::pickupScreenObject() {
_screenLayers[_curObject.depth - 1] = NULL;
_graphics->restoreBackground();
assembleScreen();
- _graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(_sceneBackground);
animatePickup2(_charFacingDirection, 0);
}
}
@@ -1617,7 +1617,7 @@ void TotEngine::pickupScreenObject() {
_graphics->restoreBackground();
assembleScreen();
- _graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(_sceneBackground);
animatePickup2(0, 1);
} break;
case 562: { // niche
@@ -1638,7 +1638,7 @@ void TotEngine::pickupScreenObject() {
_currentRoomData->screenLayers[1].depth = 1;
_graphics->restoreBackground();
assembleScreen();
- _graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(_sceneBackground);
animatePickup2(3, 1);
} else {
readItemRegister(_niche[0][_niche[0][3]]);
@@ -1651,7 +1651,7 @@ void TotEngine::pickupScreenObject() {
892, 319);
_graphics->restoreBackground();
assembleScreen();
- _graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(_sceneBackground);
animatePickup2(3, 1);
_sound->playVoc("PLATAF", 375907, 14724);
_currentRoomData->screenLayers[1].bitmapSize = 892;
@@ -1705,7 +1705,7 @@ void TotEngine::pickupScreenObject() {
_currentRoomData->screenLayers[0].depth = 1;
_graphics->restoreBackground();
assembleScreen();
- _graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(_sceneBackground);
animatePickup2(0, 1);
} else {
readItemRegister(_niche[1][_niche[1][3]]);
@@ -1717,7 +1717,7 @@ void TotEngine::pickupScreenObject() {
readBitmap(1399610, _screenLayers[0], 892, 319);
_graphics->restoreBackground();
assembleScreen();
- _graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(_sceneBackground);
animatePickup2(0, 1);
_sound->playVoc("PLATAF", 375907, 14724);
_currentRoomData->screenLayers[0].bitmapSize = 892;
@@ -1775,7 +1775,7 @@ void TotEngine::pickupScreenObject() {
}
_screenLayers[3] = NULL;
disableSecondAnimation();
- _graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(_sceneBackground);
animatePickup2(2, 1);
_isRedDevilCaptured = true;
_isTrapSet = false;
@@ -1785,7 +1785,7 @@ void TotEngine::pickupScreenObject() {
_screenLayers[_curObject.depth - 1] = NULL;
_graphics->restoreBackground();
assembleScreen();
- _graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(_sceneBackground);
animatePickup2(_charFacingDirection, 1);
}
}
@@ -1837,14 +1837,14 @@ void TotEngine::pickupScreenObject() {
}
_graphics->restoreBackground();
assembleScreen();
- _graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(_sceneBackground);
animatePickup2(3, 2);
} break;
default: {
animatePickup1(_charFacingDirection, 2);
_screenLayers[_curObject.depth - 1] = NULL;
assembleScreen();
- _graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(_sceneBackground);
animatePickup2(_charFacingDirection, 2);
}
}
@@ -1859,8 +1859,8 @@ void TotEngine::pickupScreenObject() {
drawText(textRef);
_currentRoomData->mouseGrid[34][8] = 24;
_actionCode = 0;
- oldGridX = 0;
- oldGridY = 0;
+ _oldGridX = 0;
+ _oldGridY = 0;
checkMouseGrid();
return;
} break;
@@ -1934,8 +1934,8 @@ void TotEngine::pickupScreenObject() {
if (_curObject.pickTextRef > 0)
drawText(_curObject.pickTextRef);
_actionCode = 0;
- oldGridX = 0;
- oldGridY = 0;
+ _oldGridX = 0;
+ _oldGridY = 0;
checkMouseGrid();
return;
}
@@ -1954,8 +1954,8 @@ void TotEngine::pickupScreenObject() {
if (_curObject.pickTextRef > 0)
drawText(_curObject.pickTextRef);
_actionCode = 0;
- oldGridX = 0;
- oldGridY = 0;
+ _oldGridX = 0;
+ _oldGridY = 0;
checkMouseGrid();
}
@@ -2473,7 +2473,7 @@ void TotEngine::useScreenObject() {
sprites(true);
} while (_currentSecondaryTrajectoryIndex != _currentRoomData->secondaryTrajectoryLength);
disableSecondAnimation();
- _graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(_sceneBackground);
_mouse->show();
} break;
case 201: {
@@ -2485,8 +2485,8 @@ void TotEngine::useScreenObject() {
drawBackpack();
_mouse->show();
_actionCode = 0;
- oldGridX = 0;
- oldGridY = 0;
+ _oldGridX = 0;
+ _oldGridY = 0;
checkMouseGrid();
} break;
case 219: {
@@ -2506,7 +2506,7 @@ void TotEngine::useScreenObject() {
animateOpen2(3, 2);
updateItem(_curObject.code);
disableSecondAnimation();
- _graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(_sceneBackground);
_mouse->show();
drawText(2652);
_mouse->hide();
@@ -2537,8 +2537,8 @@ void TotEngine::useScreenObject() {
animatedSequence(4);
_mouse->show();
_actionCode = 0;
- oldGridX = 0;
- oldGridY = 0;
+ _oldGridX = 0;
+ _oldGridY = 0;
checkMouseGrid();
} break;
case 221: {
@@ -2660,7 +2660,7 @@ void TotEngine::useScreenObject() {
_currentRoomData->screenLayers[1].depth = 1;
_graphics->restoreBackground();
assembleScreen();
- _graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(_sceneBackground);
animateOpen2(3, 1);
updateInventory(usedObjectIndex);
drawBackpack();
@@ -2683,7 +2683,7 @@ void TotEngine::useScreenObject() {
}
_graphics->restoreBackground();
assembleScreen();
- _graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(_sceneBackground);
animateOpen2(3, 1);
updateInventory(usedObjectIndex);
drawBackpack();
@@ -2750,7 +2750,7 @@ void TotEngine::useScreenObject() {
_currentRoomData->screenLayers[0].depth = 1;
_graphics->restoreBackground();
assembleScreen();
- _graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(_sceneBackground);
animateOpen2(0, 1);
updateInventory(usedObjectIndex);
drawBackpack();
@@ -2776,7 +2776,7 @@ void TotEngine::useScreenObject() {
}
_graphics->restoreBackground();
assembleScreen();
- _graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(_sceneBackground);
animateOpen2(0, 1);
updateInventory(usedObjectIndex);
drawBackpack();
@@ -2869,7 +2869,7 @@ void TotEngine::useScreenObject() {
readBitmap(1243652, _screenLayers[5], 2718, 319);
_graphics->restoreBackground();
assembleScreen();
- _graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(_sceneBackground);
} break;
case 594: {
drawText(_curObject.useTextRef);
@@ -2898,7 +2898,7 @@ void TotEngine::useScreenObject() {
}
_graphics->restoreBackground();
assembleScreen();
- _graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(_sceneBackground);
updateInventory(usedObjectIndex);
drawBackpack();
_isTrapSet = true;
@@ -2914,7 +2914,7 @@ void TotEngine::useScreenObject() {
loadItem(187, 70, 104, 1545820, 8);
_graphics->restoreBackground();
assembleScreen();
- _graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(_sceneBackground);
_screen->update();
animateOpen2(_charFacingDirection, 1);
@@ -2944,7 +2944,7 @@ void TotEngine::useScreenObject() {
_graphics->restoreBackground();
assembleScreen();
- _graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(_sceneBackground);
_mouse->show();
goToObject(_currentRoomData->walkAreasGrid[(_characterPosX + kCharacterCorrectionX) / kXGridCount][(_characterPosY + kCharacerCorrectionY) / kYGridCount], 18);
_mouse->hide();
@@ -2958,7 +2958,7 @@ void TotEngine::useScreenObject() {
_screenLayers[7] = NULL;
_graphics->restoreBackground();
assembleScreen();
- _graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(_sceneBackground);
animatePickup2(1, 1);
drawBackpack();
_mouse->show();
@@ -2978,7 +2978,7 @@ void TotEngine::useScreenObject() {
loadItem(86, 55, 92, 1591272, 8);
_graphics->restoreBackground();
assembleScreen();
- _graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(_sceneBackground);
animateOpen2(3, 1);
_mouse->show();
goToObject(_currentRoomData->walkAreasGrid[(_characterPosX + kCharacterCorrectionX) / kXGridCount][(_characterPosY + kCharacerCorrectionY) / kYGridCount], 10);
@@ -3002,7 +3002,7 @@ void TotEngine::useScreenObject() {
_currentRoomData->screenLayers[4].depth = 8;
loadItem(82, 53, 384, 1746554, 8);
assembleScreen();
- _graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(_sceneBackground);
_mouse->show();
goToObject(_currentRoomData->walkAreasGrid[(_characterPosX + kCharacterCorrectionX) / kXGridCount][(_characterPosY + kCharacerCorrectionY) / kYGridCount], 15);
_mouse->hide();
@@ -3016,7 +3016,7 @@ void TotEngine::useScreenObject() {
_screenLayers[7] = NULL;
_graphics->restoreBackground();
assembleScreen();
- _graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(_sceneBackground);
animatePickup2(3, 1);
drawBackpack();
_mouse->show();
@@ -3083,7 +3083,7 @@ void TotEngine::useScreenObject() {
dropObjectInScreen(_curObject);
_graphics->restoreBackground();
assembleScreen();
- _graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(_sceneBackground);
drawBackpack();
animateOpen2(1, 1);
for (listIndex = 19; listIndex <= 21; listIndex++)
@@ -3104,7 +3104,7 @@ void TotEngine::useScreenObject() {
drawBackpack();
_graphics->restoreBackground();
assembleScreen();
- _graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(_sceneBackground);
_mouse->show();
for (listIndex = 18; listIndex <= 20; listIndex++)
_currentRoomData->mouseGrid[listIndex][26] = 10;
@@ -3175,7 +3175,7 @@ void TotEngine::useScreenObject() {
}
_graphics->restoreBackground();
assembleScreen();
- _graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(_sceneBackground);
_sound->waitForSoundEnd();
_sound->playVoc("PUFF", 191183, 18001);
@@ -3331,8 +3331,8 @@ void TotEngine::useScreenObject() {
}
}
}
- oldGridX = 0;
- oldGridY = 0;
+ _oldGridX = 0;
+ _oldGridY = 0;
_actionCode = 0;
checkMouseGrid();
}
@@ -3387,7 +3387,7 @@ void TotEngine::openScreenObject() {
_currentRoomData->doors[2].openclosed = 1;
_graphics->restoreBackground();
assembleScreen();
- _graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(_sceneBackground);
animateOpen2(0, 1);
_mouse->show();
for (yIndex = 0; yIndex <= 12; yIndex++)
@@ -3396,8 +3396,8 @@ void TotEngine::openScreenObject() {
for (xIndex = 33; xIndex <= 35; xIndex++)
_currentRoomData->mouseGrid[xIndex][13] = 43;
_actionCode = 0;
- oldGridX = 0;
- oldGridY = 0;
+ _oldGridX = 0;
+ _oldGridY = 0;
_oldTargetZone = 0;
checkMouseGrid();
return;
@@ -3422,7 +3422,7 @@ void TotEngine::openScreenObject() {
_currentRoomData->doors[0].openclosed = 1;
_graphics->restoreBackground();
assembleScreen();
- _graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(_sceneBackground);
animateOpen2(1, 1);
_mouse->show();
xIndex = 30;
@@ -3444,8 +3444,8 @@ void TotEngine::openScreenObject() {
for (yIndex = 0; yIndex <= 10; yIndex++)
_currentRoomData->mouseGrid[xIndex][yIndex] = 8;
_actionCode = 0;
- oldGridX = 0;
- oldGridY = 0;
+ _oldGridX = 0;
+ _oldGridY = 0;
checkMouseGrid();
return;
}
@@ -3487,8 +3487,8 @@ void TotEngine::openScreenObject() {
}
_actionCode = 0;
}
- oldGridX = 0;
- oldGridY = 0;
+ _oldGridX = 0;
+ _oldGridY = 0;
checkMouseGrid();
}
@@ -3559,8 +3559,8 @@ void TotEngine::closeScreenObject() {
}
_actionCode = 0;
}
- oldGridX = 0;
- oldGridY = 0;
+ _oldGridX = 0;
+ _oldGridY = 0;
checkMouseGrid();
}
@@ -3606,8 +3606,8 @@ void TotEngine::handleAction(byte invPos) {
_actionCode = 0;
if (_cpCounter > 130)
showError(274);
- oldGridX = 0;
- oldGridY = 0;
+ _oldGridX = 0;
+ _oldGridY = 0;
checkMouseGrid();
} break;
case 2: {
@@ -3618,8 +3618,8 @@ void TotEngine::handleAction(byte invPos) {
_mouse->show();
drawText((Random(10) + 1049));
_actionCode = 0;
- oldGridX = 0;
- oldGridY = 0;
+ _oldGridX = 0;
+ _oldGridY = 0;
checkMouseGrid();
} break;
case 3: {
@@ -3628,8 +3628,8 @@ void TotEngine::handleAction(byte invPos) {
_mouse->show();
_actionCode = 0;
lookAtObject(invPos);
- oldGridX = 0;
- oldGridY = 0;
+ _oldGridX = 0;
+ _oldGridY = 0;
checkMouseGrid();
} break;
case 4:
@@ -3645,8 +3645,8 @@ void TotEngine::handleAction(byte invPos) {
if (_cpCounter > 25)
showError(274);
useInventoryObjectWithInventoryObject(_backpackObjectCode, _inventory[invPos].code);
- oldGridX = 0;
- oldGridY = 0;
+ _oldGridX = 0;
+ _oldGridY = 0;
checkMouseGrid();
}
break;
@@ -3656,8 +3656,8 @@ void TotEngine::handleAction(byte invPos) {
_mouse->show();
drawText(Random(9) + 1059);
_actionCode = 0;
- oldGridX = 0;
- oldGridY = 0;
+ _oldGridX = 0;
+ _oldGridY = 0;
checkMouseGrid();
} break;
case 6: {
@@ -3668,8 +3668,8 @@ void TotEngine::handleAction(byte invPos) {
_actionCode = 0;
if (_cpCounter2 > 35)
showError(274);
- oldGridX = 0;
- oldGridY = 0;
+ _oldGridX = 0;
+ _oldGridY = 0;
checkMouseGrid();
} break;
}
@@ -3763,12 +3763,12 @@ void TotEngine::scrollRight(uint &horizontalPos) {
size_t numBytes = 44796;
for (int i = 0; i < stepCount; i++) {
// move everything to the left
- memmove(sceneBackground + 4, sceneBackground + 8, numBytes);
+ memmove(_sceneBackground + 4, _sceneBackground + 8, numBytes);
horizontalPos += 4;
for (int k = 0; k < 140; k++) {
for (int j = 0; j < 4; j++) {
- sceneBackground[320 + k * 320 + j] = backgroundCopy[horizontalPos + k * 320 + j];
+ _sceneBackground[320 + k * 320 + j] = _backgroundCopy[horizontalPos + k * 320 + j];
}
}
if (characterPos > 0) {
@@ -3786,20 +3786,20 @@ void TotEngine::scrollRight(uint &horizontalPos) {
Common::copy(_curCharacterAnimationFrame, _curCharacterAnimationFrame + _mainCharFrameSize, assembledCharacterFrame);
// puts the original captured background back in the background for next iteration
- _graphics->putImageArea(_characterPosX - 2, _characterPosY, sceneBackground, spriteBackground);
+ _graphics->putImageArea(_characterPosX - 2, _characterPosY, _sceneBackground, spriteBackground);
uint16 pasoframeW = READ_LE_UINT16(assembledCharacterFrame);
uint16 pasoframeH = READ_LE_UINT16(assembledCharacterFrame + 2);
// Grabs current area surrounding character (which might contain parts of A and B)
- _graphics->getImageArea(_characterPosX, _characterPosY, _characterPosX + pasoframeW, _characterPosY + pasoframeH, sceneBackground, spriteBackground);
+ _graphics->getImageArea(_characterPosX, _characterPosY, _characterPosX + pasoframeW, _characterPosY + pasoframeH, _sceneBackground, spriteBackground);
// blits over the character sprite, only on black pixels
blit(spriteBackground, assembledCharacterFrame);
// puts it back in the background (character + piece of background)
- _graphics->putImageArea(_characterPosX, _characterPosY, sceneBackground, assembledCharacterFrame);
+ _graphics->putImageArea(_characterPosX, _characterPosY, _sceneBackground, assembledCharacterFrame);
} else
_characterPosX -= 4;
_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
_screen->update();
- _graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(_sceneBackground);
}
free(assembledCharacterFrame);
}
@@ -3816,13 +3816,13 @@ void TotEngine::scrollLeft(uint &horizontalPos) {
for (int i = stepCount; i >= 1; i--) {
for (int j = numBytes; j > 0; j--) {
// move the previous background to the right
- sceneBackground[j + 4] = sceneBackground[j];
+ _sceneBackground[j + 4] = _sceneBackground[j];
}
horizontalPos -= 4;
for (int k = 0; k < 140; k++) {
for (int j = 0; j < 4; j++) {
- sceneBackground[4 + k * 320 + j] = backgroundCopy[4 + horizontalPos + k * 320 + j];
+ _sceneBackground[4 + k * 320 + j] = _backgroundCopy[4 + horizontalPos + k * 320 + j];
}
}
@@ -3838,20 +3838,20 @@ void TotEngine::scrollLeft(uint &horizontalPos) {
_curCharacterAnimationFrame = _mainCharAnimation.bitmap[3][_iframe];
Common::copy(_curCharacterAnimationFrame, _curCharacterAnimationFrame + _mainCharFrameSize, assembledCharacterFrame);
- _graphics->putImageArea(_characterPosX + 2, _characterPosY, sceneBackground, spriteBackground);
+ _graphics->putImageArea(_characterPosX + 2, _characterPosY, _sceneBackground, spriteBackground);
uint16 pasoframeW = READ_LE_UINT16(assembledCharacterFrame);
uint16 pasoframeH = READ_LE_UINT16(assembledCharacterFrame + 2);
- _graphics->getImageArea(_characterPosX, _characterPosY, _characterPosX + pasoframeW, _characterPosY + pasoframeH, sceneBackground, spriteBackground);
+ _graphics->getImageArea(_characterPosX, _characterPosY, _characterPosX + pasoframeW, _characterPosY + pasoframeH, _sceneBackground, spriteBackground);
blit(spriteBackground, assembledCharacterFrame);
- _graphics->putImageArea(_characterPosX, _characterPosY, sceneBackground, assembledCharacterFrame);
+ _graphics->putImageArea(_characterPosX, _characterPosY, _sceneBackground, assembledCharacterFrame);
} else
_characterPosX += 4;
_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
_screen->update();
- _graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(_sceneBackground);
}
free(assembledCharacterFrame);
}
@@ -3870,7 +3870,7 @@ void TotEngine::loadScrollData(uint roomCode, bool rightScroll, uint horizontalP
debug("characterPos=%d,%d, size=%d,%d", _characterPosX, _characterPosY, characterFrameW, characterFrameH);
/* Copy the area with the player from previous scren*/
spriteBackground = (byte *)malloc(4 + (characterFrameW + 8) * (characterFrameH + 8));
- _graphics->getImageArea(_characterPosX, _characterPosY, _characterPosX + characterFrameW, _characterPosY + characterFrameH, sceneBackground, spriteBackground);
+ _graphics->getImageArea(_characterPosX, _characterPosY, _characterPosX + characterFrameW, _characterPosY + characterFrameH, _sceneBackground, spriteBackground);
// Start screen 2
@@ -3891,26 +3891,26 @@ void TotEngine::loadScrollData(uint roomCode, bool rightScroll, uint horizontalP
// background contains background B + objects, backgroundCopy contains plain background B
// Copies the contents of background into backgroundCopy
- Common::copy(sceneBackground, sceneBackground + 44804, backgroundCopy);
+ Common::copy(_sceneBackground, _sceneBackground + 44804, _backgroundCopy);
// background contains background B + objects, backgroundCopy contains background B + objects
g_engine->_graphics->_paletteAnimFrame = 0;
- getScreen(sceneBackground);
+ getScreen(_sceneBackground);
// background now contains full background A again, backgroundCopy contains background B + objects
- _graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(_sceneBackground);
if (rightScroll)
scrollRight(horizontalPos);
else
scrollLeft(horizontalPos);
// After scroll is done, backgroundCopy will now contain the resulting background (background B + objects)
- Common::copy(backgroundCopy, backgroundCopy + 44804, sceneBackground);
+ Common::copy(_backgroundCopy, _backgroundCopy + 44804, _sceneBackground);
_characterPosX += scrollCorrection;
assembleScreen();
- _graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(_sceneBackground);
free(spriteBackground);
loadScreen();
_trajectory[_currentTrajectoryIndex].x = _characterPosX;
@@ -3918,94 +3918,94 @@ void TotEngine::loadScrollData(uint roomCode, bool rightScroll, uint horizontalP
}
void TotEngine::saveGameToRegister() {
- savedGame.roomCode = _currentRoomData->code;
- savedGame.trajectoryLength = _trajectoryLength;
- savedGame.currentTrajectoryIndex = _currentTrajectoryIndex;
- savedGame.backpackObjectCode = _backpackObjectCode;
- savedGame.rightSfxVol = _sound->_rightSfxVol;
- savedGame.leftSfxVol = _sound->_leftSfxVol;
- savedGame.musicVolRight = _sound->_musicVolRight;
- savedGame.musicVolLeft = _sound->_musicVolLeft;
- savedGame.oldGridX = oldGridX;
- savedGame.oldGridY = oldGridY;
- savedGame.secAnimDepth = _secondaryAnimation.depth;
- savedGame.secAnimDir = _secondaryAnimation.dir;
- savedGame.secAnimX = _secondaryAnimation.posx;
- savedGame.secAnimY = _secondaryAnimation.posy;
- savedGame.secAnimIFrame = _iframe2;
-
- savedGame.currentZone = _currentZone;
- savedGame.targetZone = _targetZone;
- savedGame.oldTargetZone = _oldTargetZone;
- savedGame.inventoryPosition = _inventoryPosition;
- savedGame.actionCode = _actionCode;
- savedGame.oldActionCode = _oldActionCode;
- savedGame.steps = _trajectorySteps;
- savedGame.doorIndex = _doorIndex;
- savedGame.characterFacingDir = _charFacingDirection;
- savedGame.iframe = _iframe;
- savedGame.gamePart = _gamePart;
-
- savedGame.isSealRemoved = _isSealRemoved;
- savedGame.obtainedList1 = _obtainedList1;
- savedGame.obtainedList2 = _obtainedList2;
- savedGame.list1Complete = _list1Complete;
- savedGame.list2Complete = _list2Complete;
- savedGame.isVasePlaced = _isVasePlaced;
- savedGame.isScytheTaken = _isScytheTaken;
- savedGame.isTridentTaken = _isTridentTaken;
- savedGame.isPottersWheelDelivered = _isPottersWheelDelivered;
- savedGame.isMudDelivered = _isMudDelivered;
- savedGame.isGreenDevilDelivered = _isGreenDevilDelivered;
- savedGame.isRedDevilCaptured = _isRedDevilCaptured;
- savedGame.isPottersManualDelivered = _isPottersManualDelivered;
- savedGame.isCupboardOpen = _isCupboardOpen;
- savedGame.isChestOpen = _isChestOpen;
- savedGame.isTVOn = _isTVOn;
- savedGame.isTrapSet = _isTrapSet;
+ _savedGame.roomCode = _currentRoomData->code;
+ _savedGame.trajectoryLength = _trajectoryLength;
+ _savedGame.currentTrajectoryIndex = _currentTrajectoryIndex;
+ _savedGame.backpackObjectCode = _backpackObjectCode;
+ _savedGame.rightSfxVol = _sound->_rightSfxVol;
+ _savedGame.leftSfxVol = _sound->_leftSfxVol;
+ _savedGame.musicVolRight = _sound->_musicVolRight;
+ _savedGame.musicVolLeft = _sound->_musicVolLeft;
+ _savedGame.oldGridX = _oldGridX;
+ _savedGame.oldGridY = _oldGridY;
+ _savedGame.secAnimDepth = _secondaryAnimation.depth;
+ _savedGame.secAnimDir = _secondaryAnimation.dir;
+ _savedGame.secAnimX = _secondaryAnimation.posx;
+ _savedGame.secAnimY = _secondaryAnimation.posy;
+ _savedGame.secAnimIFrame = _iframe2;
+
+ _savedGame.currentZone = _currentZone;
+ _savedGame.targetZone = _targetZone;
+ _savedGame.oldTargetZone = _oldTargetZone;
+ _savedGame.inventoryPosition = _inventoryPosition;
+ _savedGame.actionCode = _actionCode;
+ _savedGame.oldActionCode = _oldActionCode;
+ _savedGame.steps = _trajectorySteps;
+ _savedGame.doorIndex = _doorIndex;
+ _savedGame.characterFacingDir = _charFacingDirection;
+ _savedGame.iframe = _iframe;
+ _savedGame.gamePart = _gamePart;
+
+ _savedGame.isSealRemoved = _isSealRemoved;
+ _savedGame.obtainedList1 = _obtainedList1;
+ _savedGame.obtainedList2 = _obtainedList2;
+ _savedGame.list1Complete = _list1Complete;
+ _savedGame.list2Complete = _list2Complete;
+ _savedGame.isVasePlaced = _isVasePlaced;
+ _savedGame.isScytheTaken = _isScytheTaken;
+ _savedGame.isTridentTaken = _isTridentTaken;
+ _savedGame.isPottersWheelDelivered = _isPottersWheelDelivered;
+ _savedGame.isMudDelivered = _isMudDelivered;
+ _savedGame.isGreenDevilDelivered = _isGreenDevilDelivered;
+ _savedGame.isRedDevilCaptured = _isRedDevilCaptured;
+ _savedGame.isPottersManualDelivered = _isPottersManualDelivered;
+ _savedGame.isCupboardOpen = _isCupboardOpen;
+ _savedGame.isChestOpen = _isChestOpen;
+ _savedGame.isTVOn = _isTVOn;
+ _savedGame.isTrapSet = _isTrapSet;
for (int i = 0; i < kInventoryIconCount; i++) {
- savedGame.mobj[i].bitmapIndex = _inventory[i].bitmapIndex;
- savedGame.mobj[i].code = _inventory[i].code;
- savedGame.mobj[i].objectName = _inventory[i].objectName;
+ _savedGame.mobj[i].bitmapIndex = _inventory[i].bitmapIndex;
+ _savedGame.mobj[i].code = _inventory[i].code;
+ _savedGame.mobj[i].objectName = _inventory[i].objectName;
}
- savedGame.element1 = _element1;
- savedGame.element2 = _element2;
- savedGame.characterPosX = _characterPosX;
- savedGame.characterPosY = _characterPosY;
- savedGame.xframe2 = _xframe2;
- savedGame.yframe2 = _yframe2;
+ _savedGame.element1 = _element1;
+ _savedGame.element2 = _element2;
+ _savedGame.characterPosX = _characterPosX;
+ _savedGame.characterPosY = _characterPosY;
+ _savedGame.xframe2 = _xframe2;
+ _savedGame.yframe2 = _yframe2;
- savedGame.oldInventoryObjectName = _oldInventoryObjectName;
- savedGame.objetomoinventoryObjectNamehila = _inventoryObjectName;
- savedGame.characterName = _characterName;
+ _savedGame.oldInventoryObjectName = _oldInventoryObjectName;
+ _savedGame.objetomoinventoryObjectNamehila = _inventoryObjectName;
+ _savedGame.characterName = _characterName;
for (int i = 0; i < kRoutePointCount; i++) {
- savedGame.mainRoute[i].x = _mainRoute[i].x;
- savedGame.mainRoute[i].y = _mainRoute[i].y;
+ _savedGame.mainRoute[i].x = _mainRoute[i].x;
+ _savedGame.mainRoute[i].y = _mainRoute[i].y;
}
for (int i = 0; i < 300; i++) {
- savedGame.trajectory[i].x = _trajectory[i].x;
- savedGame.trajectory[i].y = _trajectory[i].y;
+ _savedGame.trajectory[i].x = _trajectory[i].x;
+ _savedGame.trajectory[i].y = _trajectory[i].y;
}
for (int i = 0; i < kCharacterCount; i++) {
- savedGame.firstTimeTopicA[i] = _firstTimeTopicA[i];
- savedGame.firstTimeTopicB[i] = _firstTimeTopicB[i];
- savedGame.firstTimeTopicC[i] = _firstTimeTopicC[i];
- savedGame.bookTopic[i] = _bookTopic[i];
- savedGame.mintTopic[i] = _mintTopic[i];
+ _savedGame.firstTimeTopicA[i] = _firstTimeTopicA[i];
+ _savedGame.firstTimeTopicB[i] = _firstTimeTopicB[i];
+ _savedGame.firstTimeTopicC[i] = _firstTimeTopicC[i];
+ _savedGame.bookTopic[i] = _bookTopic[i];
+ _savedGame.mintTopic[i] = _mintTopic[i];
}
for (int i = 0; i < 5; i++) {
- savedGame.caves[i] = _caves[i];
- savedGame.firstList[i] = _firstList[i];
- savedGame.secondList[i] = _secondList[i];
+ _savedGame.caves[i] = _caves[i];
+ _savedGame.firstList[i] = _firstList[i];
+ _savedGame.secondList[i] = _secondList[i];
}
for (int i = 0; i < 4; i++) {
- savedGame.niche[0][i] = _niche[0][i];
- savedGame.niche[1][i] = _niche[1][i];
+ _savedGame.niche[0][i] = _niche[0][i];
+ _savedGame.niche[1][i] = _niche[1][i];
}
}
@@ -4020,8 +4020,8 @@ void TotEngine::loadGame(SavedGame game) {
_sound->_leftSfxVol = game.leftSfxVol;
_sound->_musicVolRight = game.musicVolRight;
_sound->_musicVolLeft = game.musicVolLeft;
- oldGridX = game.oldGridX;
- oldGridY = game.oldGridY;
+ _oldGridX = game.oldGridX;
+ _oldGridY = game.oldGridY;
_secondaryAnimation.depth = game.secAnimDepth;
_secondaryAnimation.dir = game.secAnimDir;
_secondaryAnimation.posx = game.secAnimX;
@@ -4198,7 +4198,7 @@ void TotEngine::loadGame(SavedGame game) {
drawBackpack();
if (_isRedDevilCaptured == false && _currentRoomData->code == 24 && _isTrapSet == false)
runaroundRed();
- _graphics->sceneTransition(false, sceneBackground);
+ _graphics->sceneTransition(false, _sceneBackground);
}
TextEntry TotEngine::readVerbRegister(uint numRegister) {
@@ -4502,7 +4502,7 @@ void TotEngine::wcScene() {
_graphics->copyPalette(wcPalette, g_engine->_graphics->_pal);
_graphics->restoreBackground();
assembleScreen();
- _graphics->drawScreen(sceneBackground);
+ _graphics->drawScreen(_sceneBackground);
_graphics->partialFadeIn(234);
_xframe2 = 0;
_currentTrajectoryIndex = 0;
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
index 87fda5f5b92..4e7e229ddf6 100644
--- a/engines/tot/routines2.cpp
+++ b/engines/tot/routines2.cpp
@@ -40,8 +40,8 @@ namespace Tot {
void TotEngine::initScreenPointers() {
_screenSize = 65520;
- sceneBackground = (byte *)malloc(_screenSize);
- backgroundCopy = (byte *)malloc(_screenSize);
+ _sceneBackground = (byte *)malloc(_screenSize);
+ _backgroundCopy = (byte *)malloc(_screenSize);
}
void TotEngine::loadAnimationForDirection(Common::SeekableReadStream *stream, int direction) {
@@ -242,8 +242,8 @@ void TotEngine::loadScreen() {
palette palcp;
_screenSize = _currentRoomData->roomImageSize;
- readBitmap(_currentRoomData->roomImagePointer, sceneBackground, _screenSize, 316);
- Common::copy(sceneBackground, sceneBackground + _screenSize, backgroundCopy);
+ readBitmap(_currentRoomData->roomImagePointer, _sceneBackground, _screenSize, 316);
+ Common::copy(_sceneBackground, _sceneBackground + _screenSize, _backgroundCopy);
switch (_gamePart) {
case 1: {
if (!paletteFile.open("PALETAS.DAT")) {
@@ -699,7 +699,7 @@ void TotEngine::checkMouseGrid() {
if (_mouse->mouseY >= 0 && _mouse->mouseY <= 131) {
xGrid = _mouse->getMouseCoordsWithinGrid().x;
yGrid = _mouse->getMouseCoordsWithinGrid().y;
- if (_currentRoomData->mouseGrid[xGrid][yGrid] != _currentRoomData->mouseGrid[oldGridX][oldGridY] || _oldInventoryObjectName != "") {
+ if (_currentRoomData->mouseGrid[xGrid][yGrid] != _currentRoomData->mouseGrid[_oldGridX][_oldGridY] || _oldInventoryObjectName != "") {
bar(0, 140, 319, 149, 0);
Common::String actionLine;
switch (_actionCode) {
@@ -732,8 +732,8 @@ void TotEngine::checkMouseGrid() {
}
actionLineText(actionLine);
_mouse->show();
- oldGridX = xGrid;
- oldGridY = yGrid;
+ _oldGridX = xGrid;
+ _oldGridY = yGrid;
}
_oldActionCode = 253;
_oldInventoryObjectName = "";
@@ -771,8 +771,8 @@ void TotEngine::checkMouseGrid() {
_mouse->show();
_oldActionCode = _actionCode;
_oldInventoryObjectName = "";
- oldGridX = 0;
- oldGridY = 0;
+ _oldGridX = 0;
+ _oldGridY = 0;
}
} else if (_mouse->mouseY >= 166 && _mouse->mouseY <= 199) {
if (_mouse->mouseX >= 26 && _mouse->mouseX <= 65) {
@@ -791,7 +791,7 @@ void TotEngine::checkMouseGrid() {
invObject = ' ';
}
- if (invObject != _oldInventoryObjectName || oldGridX != 0) {
+ if (invObject != _oldInventoryObjectName || _oldGridX != 0) {
bar(0, 140, 319, 149, 0);
Common::String actionLine;
switch (_actionCode) {
@@ -824,8 +824,8 @@ void TotEngine::checkMouseGrid() {
_oldInventoryObjectName = invObject;
}
_oldActionCode = 255;
- oldGridX = 0;
- oldGridY = 0;
+ _oldGridX = 0;
+ _oldGridY = 0;
}
}
@@ -1140,7 +1140,7 @@ void scrollCredit(
showError(270);
}
creditFile.seek(position);
- creditFile.read(g_engine->sceneBackground, size);
+ creditFile.read(g_engine->_sceneBackground, size);
creditFile.read(pal2, 768);
creditFile.close();
@@ -1166,7 +1166,7 @@ void scrollCredit(
keyPressed = true;
}
}
- putCreditsImg(85, i, g_engine->sceneBackground, background, !withFade);
+ putCreditsImg(85, i, g_engine->_sceneBackground, background, !withFade);
if (keyPressed) {
exit = true;
break;
@@ -1240,7 +1240,7 @@ inline bool keyPressed() {
}
void TotEngine::credits() {
- saveAllowed = true;
+ _saveAllowed = true;
debug("Credits");
palette pal2;
byte *background;
@@ -1334,7 +1334,7 @@ Lexit:
}
void TotEngine::introduction() {
- saveAllowed = false;
+ _saveAllowed = false;
_mouse->hide();
bool exitPressed;
uint loopCount;
@@ -1804,7 +1804,7 @@ void TotEngine::soundControls() {
}
void TotEngine::sacrificeScene() {
- saveAllowed = false;
+ _saveAllowed = false;
palette palaux;
Common::File file;
@@ -1892,7 +1892,7 @@ void TotEngine::sacrificeScene() {
showError(318);
}
file.read(palaux, 768);
- file.read(sceneBackground, 44800);
+ file.read(_sceneBackground, 44800);
file.close();
g_engine->_graphics->_pal[0] = 0;
@@ -1905,7 +1905,7 @@ void TotEngine::sacrificeScene() {
}
// We dont have the width and height here in the byte buffer
- _graphics->drawScreen(sceneBackground, false);
+ _graphics->drawScreen(_sceneBackground, false);
_graphics->partialFadeIn(234);
_sound->stopVoc();
@@ -1969,9 +1969,9 @@ void TotEngine::sacrificeScene() {
palaux[i * 3 + 2] <<= 2;
}
- file.read(sceneBackground, 64000);
+ file.read(_sceneBackground, 64000);
file.close();
- _graphics->drawFullScreen(sceneBackground);
+ _graphics->drawFullScreen(_sceneBackground);
palaux[0] = 0;
palaux[1] = 0;
@@ -2167,11 +2167,11 @@ void TotEngine::sacrificeScene() {
delay(2000);
_graphics->totalFadeOut(0);
_currentRoomData->paletteAnimationFlag = exitPressed;
- saveAllowed = true;
+ _saveAllowed = true;
}
void TotEngine::ending() {
- saveAllowed = false;
+ _saveAllowed = false;
bool exitRequested;
const char *const *messages = (_lang == Common::ES_ESP) ? fullScreenMessages[0] : fullScreenMessages[1];
@@ -2212,7 +2212,7 @@ void TotEngine::ending() {
delay(1000);
_sound->playVoc("NOOO", 0, 0);
delay(3000);
- saveAllowed = true;
+ _saveAllowed = true;
}
void TotEngine::loadBat() {
@@ -2256,7 +2256,7 @@ void TotEngine::assembleCompleteBackground(byte *image, uint coordx, uint coordy
w = READ_LE_UINT16(image);
h = READ_LE_UINT16(image + 2);
- wFondo = READ_LE_UINT16(sceneBackground);
+ wFondo = READ_LE_UINT16(_sceneBackground);
wFondo++;
w++;
@@ -2265,7 +2265,7 @@ void TotEngine::assembleCompleteBackground(byte *image, uint coordx, uint coordy
for (int j = 0; j < h; j++) {
int color = image[4 + j * w + i];
if (color != 0) {
- sceneBackground[4 + (coordy + j) * wFondo + (coordx + i)] = color;
+ _sceneBackground[4 + (coordy + j) * wFondo + (coordx + i)] = color;
}
}
}
diff --git a/engines/tot/saveload.cpp b/engines/tot/saveload.cpp
index 2f832e3c0bd..2f2f3fd6813 100644
--- a/engines/tot/saveload.cpp
+++ b/engines/tot/saveload.cpp
@@ -260,7 +260,7 @@ Common::Error TotEngine::syncGame(Common::Serializer &s) {
loadGame(loadedGame);
} else {
saveGameToRegister();
- result = syncSaveData(s, savedGame);
+ result = syncSaveData(s, _savedGame);
}
return result;
}
@@ -291,7 +291,7 @@ bool TotEngine::canLoadGameStateCurrently(Common::U32String *msg) {
return true;
}
bool TotEngine::canSaveGameStateCurrently(Common::U32String *msg) {
- return _inGame && saveAllowed;
+ return _inGame && _saveAllowed;
}
} // End of namespace Tot
diff --git a/engines/tot/tot.cpp b/engines/tot/tot.cpp
index 8e0ce66fb26..fa2021b6fa0 100644
--- a/engines/tot/tot.cpp
+++ b/engines/tot/tot.cpp
@@ -80,7 +80,6 @@ Common::Error TotEngine::run() {
_graphics = new GraphicsManager();
_sound = new SoundManager(_mixer);
_chrono = new ChronoManager();
- // _room = new RoomManager();
_mouse = new MouseManager();
_sound->init();
@@ -208,33 +207,33 @@ int TotEngine::startGame() {
if (e.kbd.keycode == hotKeyOpen) {
_actionCode = 5;
action();
- oldGridX = 0;
- oldGridY = 0;
+ _oldGridX = 0;
+ _oldGridY = 0;
} else if (e.kbd.keycode == hotKeyClose) {
_actionCode = 6;
action();
- oldGridX = 0;
- oldGridY = 0;
+ _oldGridX = 0;
+ _oldGridY = 0;
} else if (e.kbd.keycode == hotKeyPickup) {
_actionCode = 2;
action();
- oldGridX = 0;
- oldGridY = 0;
+ _oldGridX = 0;
+ _oldGridY = 0;
} else if (e.kbd.keycode == hotKeyTalk) {
_actionCode = 1;
action();
- oldGridX = 0;
- oldGridY = 0;
+ _oldGridX = 0;
+ _oldGridY = 0;
} else if (e.kbd.keycode == hotKeyLook) {
_actionCode = 3;
action();
- oldGridX = 0;
- oldGridY = 0;
+ _oldGridX = 0;
+ _oldGridY = 0;
} else if (e.kbd.keycode == hotKeyUse) {
_actionCode = 4;
action();
- oldGridX = 0;
- oldGridY = 0;
+ _oldGridX = 0;
+ _oldGridY = 0;
} else {
_actionCode = 0; // go to
}
@@ -531,15 +530,15 @@ int TotEngine::startGame() {
_sound->fadeOutMusic();
_sound->playMidi("SEGUNDA", true);
_sound->fadeInMusic();
- _graphics->sceneTransition(false, sceneBackground, 1);
+ _graphics->sceneTransition(false, _sceneBackground, 1);
mask();
_inventoryPosition = 0;
drawBackpack();
_mouse->show();
_firstTimeTopicA[8] = true;
- oldGridX = 0;
- oldGridY = 0;
+ _oldGridX = 0;
+ _oldGridY = 0;
checkMouseGrid();
}
break;
@@ -598,7 +597,7 @@ int TotEngine::startGame() {
}
void TotEngine::newGame() {
- saveAllowed = true;
+ _saveAllowed = true;
_mouse->hide();
obtainName(_characterName);
@@ -620,7 +619,7 @@ void TotEngine::newGame() {
initializeObjectFile();
_graphics->loadPaletteFromFile("DEFAULT");
loadScreenData(1);
- _graphics->sceneTransition(false, sceneBackground, 13);
+ _graphics->sceneTransition(false, _sceneBackground, 13);
mask();
_inventoryPosition = 0;
drawBackpack();
@@ -659,11 +658,11 @@ void TotEngine::changeRoom() {
_sound->autoPlayVoc("PARASITO", 355778, 20129);
else
loadTV();
- _graphics->sceneTransition(false, sceneBackground);
+ _graphics->sceneTransition(false, _sceneBackground);
_cpCounter = _cpCounter2;
_mouse->show();
- oldGridX = 0;
- oldGridY = 0;
+ _oldGridX = 0;
+ _oldGridY = 0;
} break;
case 5: {
if (_currentRoomData->code != 6) {
@@ -681,10 +680,10 @@ void TotEngine::changeRoom() {
_sound->stopVoc();
_sound->autoPlayVoc("CALDERA", 6433, 15386);
_sound->setSfxVolume(_sound->_leftSfxVol, 0);
- _graphics->sceneTransition(false, sceneBackground);
+ _graphics->sceneTransition(false, _sceneBackground);
_mouse->show();
- oldGridX = 0;
- oldGridY = 0;
+ _oldGridX = 0;
+ _oldGridY = 0;
checkMouseGrid();
} else {
@@ -697,8 +696,8 @@ void TotEngine::changeRoom() {
_sound->setSfxVolume(_sound->_leftSfxVol, 0);
loadScrollData(_currentRoomData->doors[_doorIndex].nextScene, true, 22, -2);
_mouse->show();
- oldGridX = 0;
- oldGridY = 0;
+ _oldGridX = 0;
+ _oldGridY = 0;
checkMouseGrid();
}
} break;
@@ -712,8 +711,8 @@ void TotEngine::changeRoom() {
_sound->setSfxVolume(_sound->_leftSfxVol, _sound->_rightSfxVol);
loadScrollData(_currentRoomData->doors[_doorIndex].nextScene, false, 22, 2);
_mouse->show();
- oldGridX = 0;
- oldGridY = 0;
+ _oldGridX = 0;
+ _oldGridY = 0;
checkMouseGrid();
} break;
case 9: {
@@ -728,11 +727,11 @@ void TotEngine::changeRoom() {
_trajectory[_currentTrajectoryIndex].x = _characterPosX;
_trajectory[_currentTrajectoryIndex].y = _characterPosY;
loadScreenData(_currentRoomData->doors[_doorIndex].nextScene);
- _graphics->sceneTransition(false, sceneBackground);
+ _graphics->sceneTransition(false, _sceneBackground);
_mouse->show();
- oldGridX = 0;
- oldGridY = 0;
+ _oldGridX = 0;
+ _oldGridY = 0;
checkMouseGrid();
} break;
case 12: {
@@ -748,10 +747,10 @@ void TotEngine::changeRoom() {
_mouse->hide();
_graphics->sceneTransition(true, NULL);
loadScreenData(_currentRoomData->doors[_doorIndex].nextScene);
- _graphics->sceneTransition(false, sceneBackground);
+ _graphics->sceneTransition(false, _sceneBackground);
_mouse->show();
- oldGridX = 0;
- oldGridY = 0;
+ _oldGridX = 0;
+ _oldGridY = 0;
_mouse->show();
} else {
@@ -762,8 +761,8 @@ void TotEngine::changeRoom() {
_mouse->hide();
loadScrollData(_currentRoomData->doors[_doorIndex].nextScene, false, 64, 0);
_mouse->show();
- oldGridX = 0;
- oldGridY = 0;
+ _oldGridX = 0;
+ _oldGridY = 0;
checkMouseGrid();
}
} break;
@@ -777,8 +776,8 @@ void TotEngine::changeRoom() {
_mouse->hide();
loadScrollData(_currentRoomData->doors[_doorIndex].nextScene, true, 64, 0);
_mouse->show();
- oldGridX = 0;
- oldGridY = 0;
+ _oldGridX = 0;
+ _oldGridY = 0;
checkMouseGrid();
} break;
case 14: {
@@ -789,8 +788,8 @@ void TotEngine::changeRoom() {
_mouse->hide();
loadScrollData(_currentRoomData->doors[_doorIndex].nextScene, false, 56, 0);
_mouse->show();
- oldGridX = 0;
- oldGridY = 0;
+ _oldGridX = 0;
+ _oldGridY = 0;
checkMouseGrid();
} break;
}
@@ -808,10 +807,10 @@ void TotEngine::changeRoom() {
_mouse->hide();
_graphics->sceneTransition(true, NULL);
loadScreenData(_currentRoomData->doors[_doorIndex].nextScene);
- _graphics->sceneTransition(false, sceneBackground);
+ _graphics->sceneTransition(false, _sceneBackground);
_mouse->show();
- oldGridX = 0;
- oldGridY = 0;
+ _oldGridX = 0;
+ _oldGridY = 0;
checkMouseGrid();
} else {
@@ -822,8 +821,8 @@ void TotEngine::changeRoom() {
_mouse->hide();
loadScrollData(_currentRoomData->doors[_doorIndex].nextScene, true, 56, 0);
_mouse->show();
- oldGridX = 0;
- oldGridY = 0;
+ _oldGridX = 0;
+ _oldGridY = 0;
checkMouseGrid();
}
} break;
@@ -845,11 +844,11 @@ void TotEngine::changeRoom() {
if (_cpCounter > 89)
showError(274);
_sound->setSfxVolume(_sound->_leftSfxVol, _sound->_rightSfxVol);
- _graphics->sceneTransition(false, sceneBackground);
+ _graphics->sceneTransition(false, _sceneBackground);
_cpCounter = _cpCounter2;
_mouse->show();
- oldGridX = 0;
- oldGridY = 0;
+ _oldGridX = 0;
+ _oldGridY = 0;
checkMouseGrid();
} break;
case 18: {
@@ -865,10 +864,10 @@ void TotEngine::changeRoom() {
_mouse->hide();
_graphics->sceneTransition(true, NULL);
loadScreenData(_currentRoomData->doors[_doorIndex].nextScene);
- _graphics->sceneTransition(false, sceneBackground);
+ _graphics->sceneTransition(false, _sceneBackground);
_mouse->show();
- oldGridX = 0;
- oldGridY = 0;
+ _oldGridX = 0;
+ _oldGridY = 0;
checkMouseGrid();
} else {
@@ -879,8 +878,8 @@ void TotEngine::changeRoom() {
_mouse->hide();
loadScrollData(_currentRoomData->doors[_doorIndex].nextScene, true, 131, -1);
_mouse->show();
- oldGridX = 0;
- oldGridY = 0;
+ _oldGridX = 0;
+ _oldGridY = 0;
checkMouseGrid();
}
} break;
@@ -897,10 +896,10 @@ void TotEngine::changeRoom() {
_mouse->hide();
_graphics->sceneTransition(true, NULL);
loadScreenData(_currentRoomData->doors[_doorIndex].nextScene);
- _graphics->sceneTransition(false, sceneBackground);
+ _graphics->sceneTransition(false, _sceneBackground);
_mouse->show();
- oldGridX = 0;
- oldGridY = 0;
+ _oldGridX = 0;
+ _oldGridY = 0;
checkMouseGrid();
} else {
@@ -911,8 +910,8 @@ void TotEngine::changeRoom() {
_mouse->hide();
loadScrollData(_currentRoomData->doors[_doorIndex].nextScene, false, 131, 1);
_mouse->show();
- oldGridX = 0;
- oldGridY = 0;
+ _oldGridX = 0;
+ _oldGridY = 0;
checkMouseGrid();
}
} break;
@@ -948,11 +947,11 @@ void TotEngine::changeRoom() {
_sound->setSfxVolume(_sound->_leftSfxVol, _sound->_rightSfxVol);
if (_currentRoomData->code == 4)
_sound->loadVoc("GOTA", 140972, 1029);
- _graphics->sceneTransition(false, sceneBackground);
+ _graphics->sceneTransition(false, _sceneBackground);
_cpCounter = _cpCounter2;
_mouse->show();
- oldGridX = 0;
- oldGridY = 0;
+ _oldGridX = 0;
+ _oldGridY = 0;
checkMouseGrid();
} break;
case 24: {
@@ -1010,13 +1009,13 @@ void TotEngine::changeRoom() {
}
assembleScreen();
}
- _graphics->sceneTransition(false, sceneBackground);
+ _graphics->sceneTransition(false, _sceneBackground);
if ((_isRedDevilCaptured == false) && (_isTrapSet == false))
runaroundRed();
_cpCounter = _cpCounter2;
_mouse->show();
- oldGridX = 0;
- oldGridY = 0;
+ _oldGridX = 0;
+ _oldGridY = 0;
checkMouseGrid();
} break;
case 255:
@@ -1046,11 +1045,11 @@ void TotEngine::changeRoom() {
_sound->autoPlayVoc("FUENTE", 0, 0);
break;
}
- _graphics->sceneTransition(false, sceneBackground);
+ _graphics->sceneTransition(false, _sceneBackground);
_cpCounter = _cpCounter2;
_mouse->show();
- oldGridX = 0;
- oldGridY = 0;
+ _oldGridX = 0;
+ _oldGridY = 0;
checkMouseGrid();
}
}
@@ -1248,7 +1247,7 @@ void TotEngine::resetGameState() {
}
void TotEngine::initVars() {
- isLoadingFromLauncher = false;
+ _isLoadingFromLauncher = false;
_decryptionKey = "23313212133122121312132132312312122132322131221322222112121"
"32121121212112111212112333131232323213222132123211213221231"
"32132213232333333213132132132322113212132121322123121232332"
@@ -1278,14 +1277,41 @@ void TotEngine::initVars() {
_firstTimeDone = false;
_isIntroSeen = false;
_inGame = false;
+
+ _sceneBackground = NULL;
+ _backgroundCopy = NULL;
+ _conversationData = NULL;
+ _rooms = NULL;
+ _invItemData = NULL;
+
+ for(int i = 0; i < kNumScreenOverlays; i++) {
+ _screenLayers[i] = NULL;
+ }
+
+ for(int i = 0; i < kInventoryIconCount; i++) {
+ _inventoryIconBitmaps[i] = NULL;
+ }
+
+ for(int i = 0; i < 4; i++) {
+ for(int j = 0; j < kWalkFrameCount + 30; j++) {
+ _mainCharAnimation.bitmap[i][j] = NULL;
+ }
+ }
+
+ for (int i = 0; i < _secondaryAnimDirCount; i++) {
+ for (int j = 0; j < kSecAnimationFrameCount; j++) {
+ _secondaryAnimation.bitmap[i][j] = NULL;
+ }
+ }
}
void TotEngine::clearVars() {
- if(sceneBackground != NULL) {
- free(sceneBackground);
+ if(_sceneBackground != NULL) {
+ free(_sceneBackground);
}
- if(backgroundCopy != NULL) {
- free(backgroundCopy);
+
+ if(_backgroundCopy != NULL) {
+ free(_backgroundCopy);
}
if(_conversationData != NULL) {
free(_conversationData);
diff --git a/engines/tot/tot.h b/engines/tot/tot.h
index f6a250eca4a..dafb071f046 100644
--- a/engines/tot/tot.h
+++ b/engines/tot/tot.h
@@ -415,29 +415,29 @@ public:
/**
* Pointer storing the screen as it displays on the game
*/
- byte *sceneBackground;
+ byte *_sceneBackground;
/**
* Dirty patch of screen to repaint on every frame
*/
- byte *characterDirtyRect;
+ byte *_characterDirtyRect;
/**
* Stores a copy of the background bitmap
*/
- byte *backgroundCopy;
+ byte *_backgroundCopy;
- uint currentRoomNumber;
+ uint _currentRoomNumber;
- bool isLoadingFromLauncher = false;
+ bool _isLoadingFromLauncher = false;
- bool saveAllowed = false;
+ bool _saveAllowed = false;
/**
* Previous positions of the mouse within the screen grid
*/
- uint oldGridX = 0, oldGridY = 0;
+ uint _oldGridX = 0, _oldGridY = 0;
- SavedGame savedGame;
+ SavedGame _savedGame;
public:
Commit: faf55f8c26c67f87abf0f31d1c37e505d1fb21ba
https://github.com/scummvm/scummvm/commit/faf55f8c26c67f87abf0f31d1c37e505d1fb21ba
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:51+02:00
Commit Message:
TOT: Improve naming
Changed paths:
engines/tot/console.cpp
engines/tot/dialog.cpp
engines/tot/routines.cpp
engines/tot/routines2.cpp
engines/tot/tot.cpp
engines/tot/tot.h
diff --git a/engines/tot/console.cpp b/engines/tot/console.cpp
index 07d702a74d2..b3763e6e796 100644
--- a/engines/tot/console.cpp
+++ b/engines/tot/console.cpp
@@ -79,8 +79,8 @@ bool TotConsole::cmdLoadRoom(int argc, const char **argv) {
debugPrintf("Invalid RoomID %d!\n", roomID);
return true;
}
- g_engine->freeAnimation();
- g_engine->freeScreenObjects();
+ g_engine->clearAnimation();
+ g_engine->clearScreenLayers();
g_engine->loadScreenData(roomID);
g_engine->_graphics->drawScreen(g_engine->_sceneBackground);
debugPrintf("Loaded screen %d", roomID);
diff --git a/engines/tot/dialog.cpp b/engines/tot/dialog.cpp
index 37095de4097..59bf9006706 100644
--- a/engines/tot/dialog.cpp
+++ b/engines/tot/dialog.cpp
@@ -543,8 +543,8 @@ void talk(byte characterIndex) {
for (int i = 25; i >= 1; i--)
rectangle(0, 175 - i, 319, 174 + i, 0);
- g_engine->mask();
- g_engine->drawBackpack();
+ g_engine->drawInventoryMask();
+ g_engine->drawInventory();
g_engine->_mouse->show();
if (characterIndex < 5) {
diff --git a/engines/tot/routines.cpp b/engines/tot/routines.cpp
index bc1cb10f5e4..82c57139014 100644
--- a/engines/tot/routines.cpp
+++ b/engines/tot/routines.cpp
@@ -117,7 +117,7 @@ void TotEngine::runaroundRed() {
_screen->update();
}
} while (!exitLoop && !shouldQuit());
- freeAnimation();
+ clearAnimation();
_graphics->restoreBackground();
assembleScreen();
_graphics->drawScreen(_sceneBackground);
@@ -614,7 +614,7 @@ void TotEngine::animatedSequence(uint numSequence) {
_graphics->drawScreen(_sceneBackground);
_screenLayers[13] = NULL;
_mainCharAnimation.depth = animIndex;
- drawBackpack();
+ drawInventory();
for (animIndex = 32; animIndex <= secFrameCount; animIndex++) {
animationFile.read(animptr, animFrameSize);
emptyLoop();
@@ -798,7 +798,7 @@ void TotEngine::loadScreenData(uint screenNumber) {
for (int i = 0; i < 15; i++) {
RoomBitmapRegister &bitmap = _currentRoomData->screenLayers[i];
if (bitmap.bitmapSize > 0) {
- loadItem(bitmap.coordx, bitmap.coordy, bitmap.bitmapSize, bitmap.bitmapPointer, bitmap.depth);
+ loadScreenLayer(bitmap.coordx, bitmap.coordy, bitmap.bitmapSize, bitmap.bitmapPointer, bitmap.depth);
}
}
if (_currentRoomData->animationFlag && _currentRoomData->code != 24) {
@@ -1004,7 +1004,7 @@ void TotEngine::useInventoryObjectWithInventoryObject(uint objectCode1, uint obj
_inventory[indobj1].objectName = _inventory[indobj1 + 1].objectName;
}
_mouse->hide();
- drawBackpack();
+ drawInventory();
_mouse->show();
}
if (textRef > 0)
@@ -1383,7 +1383,7 @@ void TotEngine::animateBat() {
curAnimHeight = _secondaryAnimHeight;
curAnimDepth = _secondaryAnimation.depth;
curAnimDir = _secondaryAnimation.dir;
- freeAnimation();
+ clearAnimation();
}
loadBat();
_sound->stopVoc();
@@ -1417,7 +1417,7 @@ void TotEngine::animateBat() {
} while (!loopBreak && !shouldQuit());
_sound->stopVoc();
- freeAnimation();
+ clearAnimation();
if (_currentRoomData->animationFlag) {
_secondaryAnimWidth = currAnimWidth;
_secondaryAnimHeight = curAnimHeight;
@@ -1601,7 +1601,7 @@ void TotEngine::pickupScreenObject() {
with.coordx = 80;
with.coordy = 56;
with.depth = 2;
- loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
+ loadScreenLayer(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
{
RoomBitmapRegister &with = _currentRoomData->screenLayers[2];
@@ -1611,7 +1611,7 @@ void TotEngine::pickupScreenObject() {
with.coordx = 76;
with.coordy = 62;
with.depth = 1;
- loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
+ loadScreenLayer(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
_screenLayers[_curObject.depth - 1] = NULL;
_graphics->restoreBackground();
@@ -1823,7 +1823,7 @@ void TotEngine::pickupScreenObject() {
with.coordx = 38;
with.coordy = 58;
with.depth = 1;
- loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
+ loadScreenLayer(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
{ // ring
RoomBitmapRegister &with = _currentRoomData->screenLayers[1];
@@ -1833,7 +1833,7 @@ void TotEngine::pickupScreenObject() {
with.coordx = 50;
with.coordy = 58;
with.depth = 3;
- loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
+ loadScreenLayer(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
_graphics->restoreBackground();
assembleScreen();
@@ -1949,7 +1949,7 @@ void TotEngine::pickupScreenObject() {
_inventory[inventoryIndex].code = _curObject.code;
_inventory[inventoryIndex].objectName = _curObject.name;
_mouse->hide();
- drawBackpack();
+ drawInventory();
_mouse->show();
if (_curObject.pickTextRef > 0)
drawText(_curObject.pickTextRef);
@@ -1984,7 +1984,7 @@ void TotEngine::dropObjectInScreen(ScreenObject replacementObject) {
with.coordx = replacementObject.dropOverlayX;
with.coordy = replacementObject.dropOverlayY;
with.depth = replacementObject.depth;
- loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
+ loadScreenLayer(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
for (int j = replacementObject.ygrid1; j <= replacementObject.ygrid2; j++)
for (int i = replacementObject.xgrid1; i <= replacementObject.xgrid2; i++) {
@@ -2055,7 +2055,7 @@ void TotEngine::useScreenObject() {
_currentRoomData->mouseGrid[_oldposx + listIndex][_oldposy + invIndex] = _mouseGridForSecondaryAnim[listIndex][invIndex];
}
- freeAnimation();
+ clearAnimation();
_secondaryAnimation.posx = _currentRoomData->secondaryAnimTrajectory[_currentSecondaryTrajectoryIndex - 1].x + 8;
_secondaryAnimation.posy = _currentRoomData->secondaryAnimTrajectory[_currentSecondaryTrajectoryIndex - 1].y;
_currentRoomData->animationName = "GALLOPIC";
@@ -2128,7 +2128,7 @@ void TotEngine::useScreenObject() {
listIndex += 1;
}
updateInventory(listIndex);
- drawBackpack();
+ drawInventory();
_mouse->show();
} else {
readTextFile();
@@ -2179,7 +2179,7 @@ void TotEngine::useScreenObject() {
listIndex += 1;
}
updateInventory(listIndex);
- drawBackpack();
+ drawInventory();
_mouse->show();
} else {
readTextFile();
@@ -2217,7 +2217,7 @@ void TotEngine::useScreenObject() {
_verbFile.close();
_mouse->hide();
updateInventory(usedObjectIndex);
- drawBackpack();
+ drawInventory();
_mouse->show();
for (foo = 0; foo < kCharacterCount; foo++)
_bookTopic[foo] = true;
@@ -2236,7 +2236,7 @@ void TotEngine::useScreenObject() {
_verbFile.close();
_mouse->hide();
updateInventory(usedObjectIndex);
- drawBackpack();
+ drawInventory();
_mouse->show();
for (foo = 0; foo < kCharacterCount; foo++) {
_mintTopic[foo] = true;
@@ -2260,7 +2260,7 @@ void TotEngine::useScreenObject() {
_verbFile.close();
_mouse->hide();
replaceBackpack(usedObjectIndex, 676);
- drawBackpack();
+ drawInventory();
disableSecondAnimation();
{
RoomBitmapRegister &with = _currentRoomData->screenLayers[0];
@@ -2270,7 +2270,7 @@ void TotEngine::useScreenObject() {
with.coordx = 120;
with.coordy = 55;
with.depth = 1;
- loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
+ loadScreenLayer(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
_currentRoomData->mouseGrid[15][12] = 7;
_mouse->show();
@@ -2286,7 +2286,7 @@ void TotEngine::useScreenObject() {
_verbFile.close();
_mouse->hide();
updateInventory(usedObjectIndex);
- drawBackpack();
+ drawInventory();
_mouse->show();
}
} break;
@@ -2305,7 +2305,7 @@ void TotEngine::useScreenObject() {
_verbFile.close();
_mouse->hide();
replaceBackpack(usedObjectIndex, 676);
- drawBackpack();
+ drawInventory();
disableSecondAnimation();
{
RoomBitmapRegister &with = _currentRoomData->screenLayers[0];
@@ -2315,7 +2315,7 @@ void TotEngine::useScreenObject() {
with.coordx = 120;
with.coordy = 55;
with.depth = 1;
- loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
+ loadScreenLayer(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
_currentRoomData->mouseGrid[15][12] = 7;
_mouse->show();
@@ -2331,7 +2331,7 @@ void TotEngine::useScreenObject() {
_verbFile.close();
_mouse->hide();
updateInventory(usedObjectIndex);
- drawBackpack();
+ drawInventory();
_mouse->show();
}
} break;
@@ -2350,7 +2350,7 @@ void TotEngine::useScreenObject() {
_verbFile.close();
_mouse->hide();
replaceBackpack(usedObjectIndex, 676);
- drawBackpack();
+ drawInventory();
disableSecondAnimation();
{
RoomBitmapRegister &with = _currentRoomData->screenLayers[0];
@@ -2360,7 +2360,7 @@ void TotEngine::useScreenObject() {
with.coordx = 120;
with.coordy = 55;
with.depth = 1;
- loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
+ loadScreenLayer(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
_currentRoomData->mouseGrid[15][12] = 7;
_mouse->show();
@@ -2376,7 +2376,7 @@ void TotEngine::useScreenObject() {
_verbFile.close();
_mouse->hide();
updateInventory(usedObjectIndex);
- drawBackpack();
+ drawInventory();
_mouse->show();
}
} break;
@@ -2395,7 +2395,7 @@ void TotEngine::useScreenObject() {
_verbFile.close();
_mouse->hide();
replaceBackpack(usedObjectIndex, 676);
- drawBackpack();
+ drawInventory();
disableSecondAnimation();
{
RoomBitmapRegister &with = _currentRoomData->screenLayers[0];
@@ -2405,7 +2405,7 @@ void TotEngine::useScreenObject() {
with.coordx = 120;
with.coordy = 55;
with.depth = 1;
- loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
+ loadScreenLayer(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
_currentRoomData->mouseGrid[15][12] = 7;
_mouse->show();
@@ -2421,7 +2421,7 @@ void TotEngine::useScreenObject() {
_verbFile.close();
_mouse->hide();
updateInventory(usedObjectIndex);
- drawBackpack();
+ drawInventory();
_mouse->show();
}
} break;
@@ -2450,7 +2450,7 @@ void TotEngine::useScreenObject() {
animateGive(3, 2);
updateInventory(usedObjectIndex);
- drawBackpack();
+ drawInventory();
animateOpen2(3, 2);
animatedSequence(6);
@@ -2482,7 +2482,7 @@ void TotEngine::useScreenObject() {
_mouse->hide();
animatedSequence(5);
replaceBackpack(usedObjectIndex, 423);
- drawBackpack();
+ drawInventory();
_mouse->show();
_actionCode = 0;
_oldGridX = 0;
@@ -2562,7 +2562,7 @@ void TotEngine::useScreenObject() {
_sound->playVoc("TIJERAS", 252764, 5242);
_sound->waitForSoundEnd();
animatePickup2(2, 0);
- drawBackpack();
+ drawInventory();
_mouse->show();
} break;
case 227: {
@@ -2573,7 +2573,7 @@ void TotEngine::useScreenObject() {
_sound->waitForSoundEnd();
animateOpen2(0, 2);
replaceBackpack(usedObjectIndex, 453);
- drawBackpack();
+ drawInventory();
_mouse->show();
updateItem(_inventory[usedObjectIndex].code);
_isCupboardOpen = true;
@@ -2608,7 +2608,7 @@ void TotEngine::useScreenObject() {
_sound->waitForSoundEnd();
animatePickup2(0, 2);
replaceBackpack(usedObjectIndex, 204);
- drawBackpack();
+ drawInventory();
_mouse->show();
} break;
case 507: {
@@ -2617,7 +2617,7 @@ void TotEngine::useScreenObject() {
_sound->playVoc("MAQUINA", 153470, 7378);
animateOpen2(0, 1);
updateInventory(usedObjectIndex);
- drawBackpack();
+ drawInventory();
_mouse->show();
_currentRoomData->mouseGrid[27][8] = 22;
} break;
@@ -2663,7 +2663,7 @@ void TotEngine::useScreenObject() {
_graphics->drawScreen(_sceneBackground);
animateOpen2(3, 1);
updateInventory(usedObjectIndex);
- drawBackpack();
+ drawInventory();
_mouse->show();
} else {
@@ -2686,7 +2686,7 @@ void TotEngine::useScreenObject() {
_graphics->drawScreen(_sceneBackground);
animateOpen2(3, 1);
updateInventory(usedObjectIndex);
- drawBackpack();
+ drawInventory();
_currentRoomData->screenObjectIndex[9]->objectName = " ";
_sound->playVoc("PLATAF", 375907, 14724);
switch (_niche[0][_niche[0][3]]) {
@@ -2753,7 +2753,7 @@ void TotEngine::useScreenObject() {
_graphics->drawScreen(_sceneBackground);
animateOpen2(0, 1);
updateInventory(usedObjectIndex);
- drawBackpack();
+ drawInventory();
_mouse->show();
} else {
@@ -2779,7 +2779,7 @@ void TotEngine::useScreenObject() {
_graphics->drawScreen(_sceneBackground);
animateOpen2(0, 1);
updateInventory(usedObjectIndex);
- drawBackpack();
+ drawInventory();
_currentRoomData->screenObjectIndex[8]->objectName = " ";
_sound->playVoc("PLATAF", 375907, 14724);
switch (_niche[1][_niche[1][3]]) {
@@ -2854,7 +2854,7 @@ void TotEngine::useScreenObject() {
with.coordx = 168;
with.coordy = 83;
with.depth = 12;
- loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
+ loadScreenLayer(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
{
RoomBitmapRegister &with = _currentRoomData->screenLayers[2];
@@ -2864,7 +2864,7 @@ void TotEngine::useScreenObject() {
with.coordx = 177;
with.coordy = 82;
with.depth = 1;
- loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
+ loadScreenLayer(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
readBitmap(1243652, _screenLayers[5], 2718, 319);
_graphics->restoreBackground();
@@ -2877,7 +2877,7 @@ void TotEngine::useScreenObject() {
animateGive(3, 2);
animatePickup2(3, 2);
replaceBackpack(usedObjectIndex, 607);
- drawBackpack();
+ drawInventory();
_mouse->show();
} break;
case 608: {
@@ -2894,13 +2894,13 @@ void TotEngine::useScreenObject() {
with.coordx = 208;
with.coordy = 105;
with.depth = 4;
- loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
+ loadScreenLayer(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
_graphics->restoreBackground();
assembleScreen();
_graphics->drawScreen(_sceneBackground);
updateInventory(usedObjectIndex);
- drawBackpack();
+ drawInventory();
_isTrapSet = true;
_mouse->show();
} break;
@@ -2911,7 +2911,7 @@ void TotEngine::useScreenObject() {
animateGive(_charFacingDirection, 1);
// Show feather on pedestal
- loadItem(187, 70, 104, 1545820, 8);
+ loadScreenLayer(187, 70, 104, 1545820, 8);
_graphics->restoreBackground();
assembleScreen();
_graphics->drawScreen(_sceneBackground);
@@ -2940,7 +2940,7 @@ void TotEngine::useScreenObject() {
_currentRoomData->screenLayers[4].coordx = 186;
_currentRoomData->screenLayers[4].coordy = 64;
_currentRoomData->screenLayers[4].depth = 8;
- loadItem(186, 63, 464, 1447508, 8);
+ loadScreenLayer(186, 63, 464, 1447508, 8);
_graphics->restoreBackground();
assembleScreen();
@@ -2960,7 +2960,7 @@ void TotEngine::useScreenObject() {
assembleScreen();
_graphics->drawScreen(_sceneBackground);
animatePickup2(1, 1);
- drawBackpack();
+ drawInventory();
_mouse->show();
for (listIndex = 35; listIndex <= 37; listIndex++)
for (invIndex = 21; invIndex <= 25; invIndex++)
@@ -2975,7 +2975,7 @@ void TotEngine::useScreenObject() {
drawText(_curObject.useTextRef);
_mouse->hide();
animateGive(3, 1);
- loadItem(86, 55, 92, 1591272, 8);
+ loadScreenLayer(86, 55, 92, 1591272, 8);
_graphics->restoreBackground();
assembleScreen();
_graphics->drawScreen(_sceneBackground);
@@ -3000,7 +3000,7 @@ void TotEngine::useScreenObject() {
_currentRoomData->screenLayers[4].coordx = 82;
_currentRoomData->screenLayers[4].coordy = 53;
_currentRoomData->screenLayers[4].depth = 8;
- loadItem(82, 53, 384, 1746554, 8);
+ loadScreenLayer(82, 53, 384, 1746554, 8);
assembleScreen();
_graphics->drawScreen(_sceneBackground);
_mouse->show();
@@ -3018,7 +3018,7 @@ void TotEngine::useScreenObject() {
assembleScreen();
_graphics->drawScreen(_sceneBackground);
animatePickup2(3, 1);
- drawBackpack();
+ drawInventory();
_mouse->show();
for (listIndex = 0; listIndex <= 2; listIndex++)
for (invIndex = 10; invIndex <= 12; invIndex++)
@@ -3037,7 +3037,7 @@ void TotEngine::useScreenObject() {
goToObject(_currentRoomData->walkAreasGrid[(_characterPosX + kCharacterCorrectionX) / kXGridCount][(_characterPosY + kCharacerCorrectionY) / kYGridCount], 5);
_mouse->hide();
updateInventory(usedObjectIndex);
- drawBackpack();
+ drawInventory();
drawFlc(133, 0, offset, 0, 9, 22, false, false, true, foobar);
{
RoomBitmapRegister &with = _currentRoomData->screenLayers[2];
@@ -3047,7 +3047,7 @@ void TotEngine::useScreenObject() {
with.coordx = 147;
with.coordy = 38;
with.depth = 9;
- loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
+ loadScreenLayer(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
updateAltScreen(31);
for (listIndex = 18; listIndex <= 20; listIndex++)
@@ -3070,7 +3070,7 @@ void TotEngine::useScreenObject() {
_sound->playVoc("AFILAR", 0, 6433);
drawFlc(160, 15, offset, 0, 9, 23, false, false, true, foobar);
replaceBackpack(usedObjectIndex, 715);
- drawBackpack();
+ drawInventory();
_mouse->show();
} break;
case 686: {
@@ -3084,7 +3084,7 @@ void TotEngine::useScreenObject() {
_graphics->restoreBackground();
assembleScreen();
_graphics->drawScreen(_sceneBackground);
- drawBackpack();
+ drawInventory();
animateOpen2(1, 1);
for (listIndex = 19; listIndex <= 21; listIndex++)
for (invIndex = 10; invIndex <= 13; invIndex++)
@@ -3101,7 +3101,7 @@ void TotEngine::useScreenObject() {
_mouse->hide();
drawFlc(110, 79, offset, 0, 9, 0, false, false, true, foobar);
replaceBackpack(usedObjectIndex, 701);
- drawBackpack();
+ drawInventory();
_graphics->restoreBackground();
assembleScreen();
_graphics->drawScreen(_sceneBackground);
@@ -3171,7 +3171,7 @@ void TotEngine::useScreenObject() {
with.coordx = 39;
with.coordy = 16;
with.depth = 1;
- loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
+ loadScreenLayer(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
_graphics->restoreBackground();
assembleScreen();
@@ -3234,7 +3234,7 @@ void TotEngine::useScreenObject() {
_inventory[usedObjectIndex].code = _curObject.code;
_inventory[usedObjectIndex].objectName = _curObject.name;
_mouse->hide();
- drawBackpack();
+ drawInventory();
_mouse->show();
} break;
case 169: {
@@ -3883,7 +3883,7 @@ void TotEngine::loadScrollData(uint roomCode, bool rightScroll, uint horizontalP
{
RoomBitmapRegister &with = _currentRoomData->screenLayers[i];
if (with.bitmapSize > 0)
- loadItem(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
+ loadScreenLayer(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
}
// assembles the screen objects into background
@@ -4010,8 +4010,8 @@ void TotEngine::saveGameToRegister() {
}
void TotEngine::loadGame(SavedGame game) {
- freeAnimation();
- freeScreenObjects();
+ clearAnimation();
+ clearScreenLayers();
_trajectoryLength = game.trajectoryLength;
_currentTrajectoryIndex = game.currentTrajectoryIndex;
@@ -4193,9 +4193,9 @@ void TotEngine::loadGame(SavedGame game) {
} break;
}
- mask();
+ drawInventoryMask();
_inventoryPosition = 0;
- drawBackpack();
+ drawInventory();
if (_isRedDevilCaptured == false && _currentRoomData->code == 24 && _isTrapSet == false)
runaroundRed();
_graphics->sceneTransition(false, _sceneBackground);
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
index 4e7e229ddf6..c7cf7afdb57 100644
--- a/engines/tot/routines2.cpp
+++ b/engines/tot/routines2.cpp
@@ -297,7 +297,7 @@ void TotEngine::loadCharAnimation() {
characterFile.close();
}
-void TotEngine::freeScreenObjects() {
+void TotEngine::clearScreenLayers() {
for (int i = 0; i < kNumScreenOverlays; i++) {
if (_screenLayers[i] != NULL)
free(_screenLayers[i]);
@@ -305,7 +305,7 @@ void TotEngine::freeScreenObjects() {
}
}
-void TotEngine::freeAnimation() {
+void TotEngine::clearAnimation() {
if (_isSecondaryAnimationEnabled) {
_isSecondaryAnimationEnabled = false;
_curSecondaryAnimationFrame = NULL;
@@ -330,7 +330,7 @@ void TotEngine::verifyCopyProtection2() {
// TODO:
}
-void TotEngine::loadItemWithFixedDepth(uint coordx, uint coordy, uint bitmapSize, int32 bitmapIndex, uint depth) {
+void TotEngine::loadScreenLayerWithDepth(uint coordx, uint coordy, uint bitmapSize, int32 bitmapIndex, uint depth) {
_screenLayers[depth] = (byte *)malloc(bitmapSize);
readBitmap(bitmapIndex, _screenLayers[depth], bitmapSize, 319);
@@ -343,8 +343,8 @@ void TotEngine::loadItemWithFixedDepth(uint coordx, uint coordy, uint bitmapSize
_depthMap[depth].posy2 = coordy + h + 1;
}
-void TotEngine::loadItem(uint coordx, uint coordy, uint bitmapSize, int32 bitmapIndex, uint depth) {
- loadItemWithFixedDepth(coordx, coordy, bitmapSize, bitmapIndex, depth - 1);
+void TotEngine::loadScreenLayer(uint coordx, uint coordy, uint bitmapSize, int32 bitmapIndex, uint depth) {
+ loadScreenLayerWithDepth(coordx, coordy, bitmapSize, bitmapIndex, depth - 1);
}
void TotEngine::updateInventory(byte index) {
@@ -375,7 +375,7 @@ void TotEngine::updateItem(uint itemPosition) {
void TotEngine::readItemRegister(Common::SeekableReadStream *stream, uint itemPos, ScreenObject &thisRegObj) {
stream->seek(itemPos * kItemRegSize);
- clearObj();
+ clearCurrentInventoryObject();
thisRegObj.code = stream->readUint16LE();
thisRegObj.height = stream->readByte();
@@ -431,7 +431,7 @@ void TotEngine::putIcon(uint iconPosX, uint iconPosY, uint iconNum) {
_graphics->putImg(iconPosX, iconPosY, _inventoryIconBitmaps[_inventory[iconNum].bitmapIndex - 1]);
}
-void TotEngine::drawBackpack() {
+void TotEngine::drawInventory() {
putIcon(34, 169, _inventoryPosition);
putIcon(77, 169, _inventoryPosition + 1);
putIcon(120, 169, _inventoryPosition + 2);
@@ -473,13 +473,13 @@ void TotEngine::drawInventory(byte dir, byte max) {
case 0:
if (_inventoryPosition > 0) {
_inventoryPosition -= 1;
- drawBackpack();
+ drawInventory();
}
break;
case 1:
if (_inventoryPosition < (max - 6)) {
_inventoryPosition += 1;
- drawBackpack();
+ drawInventory();
}
break;
}
@@ -497,7 +497,7 @@ void TotEngine::drawInventory(byte dir, byte max) {
showError(274);
}
-void TotEngine::mask() {
+void TotEngine::drawInventoryMask() {
buttonBorder(0, 140, 319, 149, 0, 0, 0, 0, 0);
for (int i = 1; i <= 25; i++)
@@ -883,7 +883,7 @@ void TotEngine::readAlphaGraph(Common::String &output, int length, int posx, int
void TotEngine::readAlphaGraphSmall(Common::String &output, int length, int posx, int posy, byte barColor,
byte textColor) {
int pun = 1;
- bool borracursor;
+ bool removeCaret;
bar(posx, posy + 2, posx + length * 6, posy + 9, barColor);
biosText(posx, posy, "-", textColor);
@@ -912,17 +912,17 @@ void TotEngine::readAlphaGraphSmall(Common::String &output, int length, int posx
biosText(posx, posy, output, textColor);
biosText((posx + (output.size()) * 6), posy, "-", textColor);
pun -= 1;
- borracursor = true;
+ removeCaret = true;
} else if ((asciiCode < '\40') || (asciiCode > '\373')) {
_sound->beep(1200, 60);
- borracursor = false;
+ removeCaret = false;
} else {
pun += 1;
output = output + (char)e.kbd.ascii;
bar(posx, (posy + 2), (posx + length * 6), (posy + 9), barColor);
littText(posx, posy, output, textColor);
littText((posx + (output.size()) * 6), posy, "-", textColor);
- borracursor = true;
+ removeCaret = true;
}
}
}
@@ -931,7 +931,7 @@ void TotEngine::readAlphaGraphSmall(Common::String &output, int length, int posx
_screen->update();
}
- if (borracursor)
+ if (removeCaret)
bar(posx + (output.size()) * 6, posy + 2, (posx + (output.size()) * 6) + 6, posy + 9, barColor);
}
@@ -2293,7 +2293,7 @@ void TotEngine::assembleScreen(bool scroll) {
void TotEngine::disableSecondAnimation() {
setRoomTrajectories(_secondaryAnimHeight, _secondaryAnimWidth, RESTORE);
_currentRoomData->animationFlag = false;
- freeAnimation();
+ clearAnimation();
_graphics->restoreBackground();
assembleScreen();
}
diff --git a/engines/tot/tot.cpp b/engines/tot/tot.cpp
index fa2021b6fa0..0a678722170 100644
--- a/engines/tot/tot.cpp
+++ b/engines/tot/tot.cpp
@@ -463,8 +463,8 @@ int TotEngine::startGame() {
}
if (escapePressed && _xframe2 == 0) {
- freeAnimation();
- freeScreenObjects();
+ clearAnimation();
+ clearScreenLayers();
_cpCounter2 = _cpCounter;
_startNewGame = false;
_continueGame = false;
@@ -508,8 +508,8 @@ int TotEngine::startGame() {
_gamePart = 2;
_iframe = 0;
freeInventory();
- freeAnimation();
- freeScreenObjects();
+ clearAnimation();
+ clearScreenLayers();
_mouse->hide();
_graphics->partialFadeOut(234);
_sound->fadeOutMusic();
@@ -531,9 +531,9 @@ int TotEngine::startGame() {
_sound->playMidi("SEGUNDA", true);
_sound->fadeInMusic();
_graphics->sceneTransition(false, _sceneBackground, 1);
- mask();
+ drawInventoryMask();
_inventoryPosition = 0;
- drawBackpack();
+ drawInventory();
_mouse->show();
_firstTimeTopicA[8] = true;
@@ -620,9 +620,9 @@ void TotEngine::newGame() {
_graphics->loadPaletteFromFile("DEFAULT");
loadScreenData(1);
_graphics->sceneTransition(false, _sceneBackground, 13);
- mask();
+ drawInventoryMask();
_inventoryPosition = 0;
- drawBackpack();
+ drawInventory();
_iframe = 0;
_mouse->show();
}
@@ -644,8 +644,8 @@ void TotEngine::changeRoom() {
_characterPosY = _currentRoomData->doors[_doorIndex].exitPosY - kCharacerCorrectionY;
_trajectory[_currentTrajectoryIndex].x = _characterPosX;
_trajectory[_currentTrajectoryIndex].y = _characterPosY;
- freeAnimation();
- freeScreenObjects();
+ clearAnimation();
+ clearScreenLayers();
_mouse->hide();
_graphics->sceneTransition(true, NULL);
@@ -672,8 +672,8 @@ void TotEngine::changeRoom() {
_characterPosY = _currentRoomData->doors[_doorIndex].exitPosY - kCharacerCorrectionY + 15;
_trajectory[_currentTrajectoryIndex].x = _characterPosX;
_trajectory[_currentTrajectoryIndex].y = _characterPosY;
- freeAnimation();
- freeScreenObjects();
+ clearAnimation();
+ clearScreenLayers();
_mouse->hide();
_graphics->sceneTransition(true, NULL);
loadScreenData(_currentRoomData->doors[_doorIndex].nextScene);
@@ -690,8 +690,8 @@ void TotEngine::changeRoom() {
_currentZone = _currentRoomData->walkAreasGrid[(_characterPosX + kCharacterCorrectionX) / kXGridCount][(_characterPosY + kCharacerCorrectionY) / kYGridCount];
_targetZone = 21;
goToObject(_currentZone, _targetZone);
- freeAnimation();
- freeScreenObjects();
+ clearAnimation();
+ clearScreenLayers();
_mouse->hide();
_sound->setSfxVolume(_sound->_leftSfxVol, 0);
loadScrollData(_currentRoomData->doors[_doorIndex].nextScene, true, 22, -2);
@@ -705,8 +705,8 @@ void TotEngine::changeRoom() {
_currentZone = _currentRoomData->walkAreasGrid[(_characterPosX + kCharacterCorrectionX) / kXGridCount][(_characterPosY + kCharacerCorrectionY) / kYGridCount];
_targetZone = 27;
goToObject(_currentZone, _targetZone);
- freeAnimation();
- freeScreenObjects();
+ clearAnimation();
+ clearScreenLayers();
_mouse->hide();
_sound->setSfxVolume(_sound->_leftSfxVol, _sound->_rightSfxVol);
loadScrollData(_currentRoomData->doors[_doorIndex].nextScene, false, 22, 2);
@@ -716,8 +716,8 @@ void TotEngine::changeRoom() {
checkMouseGrid();
} break;
case 9: {
- freeAnimation();
- freeScreenObjects();
+ clearAnimation();
+ clearScreenLayers();
_mouse->hide();
_graphics->sceneTransition(true, NULL);
_iframe = 0;
@@ -742,8 +742,8 @@ void TotEngine::changeRoom() {
_characterPosY = _currentRoomData->doors[_doorIndex].exitPosY - kCharacerCorrectionY;
_trajectory[_currentTrajectoryIndex].x = _characterPosX;
_trajectory[_currentTrajectoryIndex].y = _characterPosY;
- freeAnimation();
- freeScreenObjects();
+ clearAnimation();
+ clearScreenLayers();
_mouse->hide();
_graphics->sceneTransition(true, NULL);
loadScreenData(_currentRoomData->doors[_doorIndex].nextScene);
@@ -756,8 +756,8 @@ void TotEngine::changeRoom() {
_currentZone = _currentRoomData->walkAreasGrid[(_characterPosX + kCharacterCorrectionX) / kXGridCount][(_characterPosY + kCharacerCorrectionY) / kYGridCount];
goToObject(_currentZone, _targetZone);
- freeAnimation();
- freeScreenObjects();
+ clearAnimation();
+ clearScreenLayers();
_mouse->hide();
loadScrollData(_currentRoomData->doors[_doorIndex].nextScene, false, 64, 0);
_mouse->show();
@@ -771,8 +771,8 @@ void TotEngine::changeRoom() {
case 12: {
_currentZone = _currentRoomData->walkAreasGrid[(_characterPosX + kCharacterCorrectionX) / kXGridCount][(_characterPosY + kCharacerCorrectionY) / kYGridCount];
goToObject(_currentZone, _targetZone);
- freeAnimation();
- freeScreenObjects();
+ clearAnimation();
+ clearScreenLayers();
_mouse->hide();
loadScrollData(_currentRoomData->doors[_doorIndex].nextScene, true, 64, 0);
_mouse->show();
@@ -783,8 +783,8 @@ void TotEngine::changeRoom() {
case 14: {
_currentZone = _currentRoomData->walkAreasGrid[(_characterPosX + kCharacterCorrectionX) / kXGridCount][(_characterPosY + kCharacerCorrectionY) / kYGridCount];
goToObject(_currentZone, _targetZone);
- freeAnimation();
- freeScreenObjects();
+ clearAnimation();
+ clearScreenLayers();
_mouse->hide();
loadScrollData(_currentRoomData->doors[_doorIndex].nextScene, false, 56, 0);
_mouse->show();
@@ -802,8 +802,8 @@ void TotEngine::changeRoom() {
_characterPosY = _currentRoomData->doors[_doorIndex].exitPosY - kCharacerCorrectionY;
_trajectory[_currentTrajectoryIndex].x = _characterPosX;
_trajectory[_currentTrajectoryIndex].y = _characterPosY;
- freeAnimation();
- freeScreenObjects();
+ clearAnimation();
+ clearScreenLayers();
_mouse->hide();
_graphics->sceneTransition(true, NULL);
loadScreenData(_currentRoomData->doors[_doorIndex].nextScene);
@@ -816,8 +816,8 @@ void TotEngine::changeRoom() {
_currentZone = _currentRoomData->walkAreasGrid[((_characterPosX + kCharacterCorrectionX) / kXGridCount)][((_characterPosY + kCharacerCorrectionY) / kYGridCount)];
goToObject(_currentZone, _targetZone);
- freeAnimation();
- freeScreenObjects();
+ clearAnimation();
+ clearScreenLayers();
_mouse->hide();
loadScrollData(_currentRoomData->doors[_doorIndex].nextScene, true, 56, 0);
_mouse->show();
@@ -833,8 +833,8 @@ void TotEngine::changeRoom() {
_characterPosY = _currentRoomData->doors[_doorIndex].exitPosY - kCharacerCorrectionY;
_trajectory[_currentTrajectoryIndex].x = _characterPosX;
_trajectory[_currentTrajectoryIndex].y = _characterPosY;
- freeAnimation();
- freeScreenObjects();
+ clearAnimation();
+ clearScreenLayers();
_mouse->hide();
_graphics->sceneTransition(true, NULL);
_sound->stopVoc();
@@ -859,8 +859,8 @@ void TotEngine::changeRoom() {
_characterPosY = _currentRoomData->doors[_doorIndex].exitPosY - kCharacerCorrectionY;
_trajectory[_currentTrajectoryIndex].x = _characterPosX;
_trajectory[_currentTrajectoryIndex].y = _characterPosY;
- freeAnimation();
- freeScreenObjects();
+ clearAnimation();
+ clearScreenLayers();
_mouse->hide();
_graphics->sceneTransition(true, NULL);
loadScreenData(_currentRoomData->doors[_doorIndex].nextScene);
@@ -873,8 +873,8 @@ void TotEngine::changeRoom() {
_currentZone = _currentRoomData->walkAreasGrid[((_characterPosX + kCharacterCorrectionX) / kXGridCount)][((_characterPosY + kCharacerCorrectionY) / kYGridCount)];
goToObject(_currentZone, _targetZone);
- freeAnimation();
- freeScreenObjects();
+ clearAnimation();
+ clearScreenLayers();
_mouse->hide();
loadScrollData(_currentRoomData->doors[_doorIndex].nextScene, true, 131, -1);
_mouse->show();
@@ -891,8 +891,8 @@ void TotEngine::changeRoom() {
_characterPosY = _currentRoomData->doors[_doorIndex].exitPosY - kCharacerCorrectionY;
_trajectory[_currentTrajectoryIndex].x = _characterPosX;
_trajectory[_currentTrajectoryIndex].y = _characterPosY;
- freeAnimation();
- freeScreenObjects();
+ clearAnimation();
+ clearScreenLayers();
_mouse->hide();
_graphics->sceneTransition(true, NULL);
loadScreenData(_currentRoomData->doors[_doorIndex].nextScene);
@@ -905,8 +905,8 @@ void TotEngine::changeRoom() {
_currentZone = _currentRoomData->walkAreasGrid[((_characterPosX + kCharacterCorrectionX) / kXGridCount)][((_characterPosY + kCharacerCorrectionY) / kYGridCount)];
goToObject(_currentZone, _targetZone);
- freeAnimation();
- freeScreenObjects();
+ clearAnimation();
+ clearScreenLayers();
_mouse->hide();
loadScrollData(_currentRoomData->doors[_doorIndex].nextScene, false, 131, 1);
_mouse->show();
@@ -922,8 +922,8 @@ void TotEngine::changeRoom() {
_characterPosY = _currentRoomData->doors[_doorIndex].exitPosY - kCharacerCorrectionY;
_trajectory[_currentTrajectoryIndex].x = _characterPosX;
_trajectory[_currentTrajectoryIndex].y = _characterPosY;
- freeAnimation();
- freeScreenObjects();
+ clearAnimation();
+ clearScreenLayers();
_mouse->hide();
_graphics->sceneTransition(true, NULL);
_sound->stopVoc();
@@ -961,8 +961,8 @@ void TotEngine::changeRoom() {
_characterPosY = _currentRoomData->doors[_doorIndex].exitPosY - kCharacerCorrectionY;
_trajectory[_currentTrajectoryIndex].x = _characterPosX;
_trajectory[_currentTrajectoryIndex].y = _characterPosY;
- freeAnimation();
- freeScreenObjects();
+ clearAnimation();
+ clearScreenLayers();
_mouse->hide();
_graphics->sceneTransition(true, NULL);
_sound->stopVoc();
@@ -1028,8 +1028,8 @@ void TotEngine::changeRoom() {
_characterPosY = _currentRoomData->doors[_doorIndex].exitPosY - kCharacerCorrectionY;
_trajectory[_currentTrajectoryIndex].x = _characterPosX;
_trajectory[_currentTrajectoryIndex].y = _characterPosY;
- freeAnimation();
- freeScreenObjects();
+ clearAnimation();
+ clearScreenLayers();
_mouse->hide();
_graphics->sceneTransition(true, NULL);
_sound->stopVoc();
@@ -1056,7 +1056,7 @@ void TotEngine::changeRoom() {
_oldTargetZone = 0;
}
-void TotEngine::clearObj() {
+void TotEngine::clearCurrentInventoryObject() {
_curObject.code = 0;
_curObject.height = 0;
diff --git a/engines/tot/tot.h b/engines/tot/tot.h
index dafb071f046..00aa0d44a59 100644
--- a/engines/tot/tot.h
+++ b/engines/tot/tot.h
@@ -101,10 +101,6 @@ private:
//Rout2
void adjustKey();
void adjustKey2();
- void animateGive(uint dir, uint height);
- void animatePickup1(uint dir, uint height);
- void animatePickup2(uint dir, uint height);
- void animateOpen2(uint dir, uint height);
void animateBat();
void updateVideo();
void nicheAnimation(byte nicheDir, int32 bitmap);
@@ -113,21 +109,30 @@ private:
void calculateTrajectory(uint finalX, uint finalY);
void animatedSequence(uint numSequence);
void initScreenPointers();
- void loadAnimation(Common::String animation);
- void updateAltScreen(byte altScreenNumber);
void verifyCopyProtection();
void verifyCopyProtection2();
+
+ void loadAnimation(Common::String animation);
+ void loadCharAnimation();
+ void animateGive(uint dir, uint height);
+ void animatePickup1(uint dir, uint height);
+ void animatePickup2(uint dir, uint height);
+ void animateOpen2(uint dir, uint height);
+
void loadTV();
void loadScreen();
- void loadCharAnimation();
+ void loadScreenLayerWithDepth(uint coordx, uint coordy, uint bitmapSize, int32 bitmapIndex, uint depth);
+ void loadScreenLayer(uint coordx, uint coordy, uint picSize, int32 pic, uint prof);
+ void readBitmap(int32 bitmapOffset, byte *bitmap, uint bitmapSize, uint errorCode);
+ void updateAltScreen(byte altScreenNumber);
+
void freeInventory();
- void loadItemWithFixedDepth(uint coordx, uint coordy, uint bitmapSize, int32 bitmapIndex, uint depth);
- void loadItem(uint coordx, uint coordy, uint picSize, int32 pic, uint prof);
void updateInventory(byte index);
- void readBitmap(int32 bitmapOffset, byte *bitmap, uint bitmapSize, uint errorCode);
void updateItem(uint filePos);
void readItemRegister(Common::SeekableReadStream *stream, uint objPos, ScreenObject &thisRegObj);
void saveItemRegister(ScreenObject object, Common::SeekableWriteStream *stream);
+ void saveItemRegister();
+
void saveTemporaryGame();
void drawLookAtItem(RoomObjectListEntry obj);
void putIcon(uint posX, uint posY, uint iconNumber);
@@ -153,10 +158,9 @@ private:
void assembleScreen(bool scroll = false);
void disableSecondAnimation();
void clearGame();
- void saveItemRegister();
// vars
- void clearObj();
+ void clearCurrentInventoryObject();
void initVars();
void resetGameState();
void clearVars();
@@ -473,8 +477,8 @@ public:
bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override;
void loadScreenData(uint screenNumber);
- void freeScreenObjects();
- void freeAnimation();
+ void clearScreenLayers();
+ void clearAnimation();
void buttonBorder(uint x1, uint y1, uint x2, uint y2, byte color1, byte color2, byte color3, byte color4, byte color5);
void drawMenu(byte menuNumber);
void readTextFile();
@@ -483,8 +487,8 @@ public:
void goToObject(byte zone1, byte zone2);
void readItemRegister(uint objPos);
TextEntry readVerbRegister();
- void drawBackpack();
- void mask();
+ void drawInventory();
+ void drawInventoryMask();
void setRoomTrajectories(int height, int width, TRAJECTORIES_OP op, bool fixGrids = true);
void saveRoomData(RoomFileRegister *room, Common::SeekableWriteStream *stream);
//vars
Commit: 5c38724e73ae090843ecca9ed60c28c9a463efa1
https://github.com/scummvm/scummvm/commit/5c38724e73ae090843ecca9ed60c28c9a463efa1
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:51+02:00
Commit Message:
TOT: Allow speed changes from FLIs
Changed paths:
engines/tot/anims.cpp
diff --git a/engines/tot/anims.cpp b/engines/tot/anims.cpp
index 20efcdc007c..dbad3bff81f 100644
--- a/engines/tot/anims.cpp
+++ b/engines/tot/anims.cpp
@@ -33,6 +33,7 @@
#include "tot/vars.h"
#include "tot/statics.h"
#include "tot/tot.h"
+#include "tot/util.h"
namespace Tot {
@@ -847,14 +848,12 @@ void drawFlc(uint x, uint y, int32 fliOffset, uint loop,
bool doscientos, bool &salidaflis);
static void exitProcedure(bool &exitLoop, bool &isSkipAllowed) {
-
exitLoop = false;
- if (isSkipAllowed) {
- Common::Event e;
- while (g_system->getEventManager()->pollEvent(e)) {
- if (e.type == Common::EVENT_KEYDOWN || (e.type == Common::EVENT_LBUTTONUP)) {
- exitLoop = true;
- }
+ Common::Event e;
+ while (g_system->getEventManager()->pollEvent(e)) {
+ changeGameSpeed(e);
+ if (isSkipAllowed && e.type == Common::EVENT_KEYUP || (e.type == Common::EVENT_LBUTTONUP)) {
+ exitLoop = true;
}
}
}
Commit: 21dc9d0b9efcfe7eb6c8147684ad48f7442110cb
https://github.com/scummvm/scummvm/commit/21dc9d0b9efcfe7eb6c8147684ad48f7442110cb
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:52+02:00
Commit Message:
TOT: Rework transition effects
Changed paths:
engines/tot/anims.cpp
engines/tot/graphics.cpp
engines/tot/graphics.h
engines/tot/routines.cpp
engines/tot/sound.cpp
engines/tot/tot.cpp
diff --git a/engines/tot/anims.cpp b/engines/tot/anims.cpp
index dbad3bff81f..84703ae9b4c 100644
--- a/engines/tot/anims.cpp
+++ b/engines/tot/anims.cpp
@@ -852,7 +852,7 @@ static void exitProcedure(bool &exitLoop, bool &isSkipAllowed) {
Common::Event e;
while (g_system->getEventManager()->pollEvent(e)) {
changeGameSpeed(e);
- if (isSkipAllowed && e.type == Common::EVENT_KEYUP || (e.type == Common::EVENT_LBUTTONUP)) {
+ if (isSkipAllowed && (e.type == Common::EVENT_KEYUP || (e.type == Common::EVENT_LBUTTONUP))) {
exitLoop = true;
}
}
diff --git a/engines/tot/graphics.cpp b/engines/tot/graphics.cpp
index 0190163d492..ea13b56be72 100644
--- a/engines/tot/graphics.cpp
+++ b/engines/tot/graphics.cpp
@@ -469,23 +469,470 @@ void GraphicsManager::drawScreen(byte *screen, bool offsetSize) {
g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
}
-void GraphicsManager::updateSceneAreaIfNeeded(int speed) {
- if (g_engine->_chrono->shouldPaintEffect(speed)) {
+void GraphicsManager::updateSceneArea(int speed) {
+ // if (g_engine->_chrono->shouldPaintEffect(speed)) {
g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
g_engine->_screen->update();
- }
+ // }
}
void GraphicsManager::sceneTransition(bool fadeToBlack, byte *scene) {
sceneTransition(fadeToBlack, scene, Random(15) + 1);
}
-void GraphicsManager::sceneTransition(bool fadeToBlack, byte *scene, byte effectNumber) {
+void updateScreenIfNeeded(uint32 &targetTime) {
+ Common::Event e;
+ while (g_system->getEventManager()->pollEvent(e)) {
+ }
+ if (g_system->getMillis() > targetTime) {
+ g_engine->_graphics->updateSceneArea();
+ targetTime = g_system->getMillis() + 10;
+ }
+ g_system->delayMillis(1);
+}
+
+void effect9(bool fadeToBlack, byte *scene);
+void effect7(bool fadeToBlack, byte *scene);
+
+void effect13(bool fadeToBlack, byte *scene) {
+ uint32 targetTime = 0;
+ if (fadeToBlack) {
+ for (int i1 = 319; i1 >= 0; i1--) {
+ line(i1, 0, i1, 139, 0);
+ updateScreenIfNeeded(targetTime);
+ }
+ } else {
+ for (int i1 = 0; i1 < 320; i1++) {
+ for (int j1 = 0; j1 < 140; j1++) { // one vertical line
+ int color = scene[4 + (j1 * 320) + i1];
+ *((byte *)g_engine->_screen->getBasePtr(i1, j1)) = color;
+ }
+ updateScreenIfNeeded(targetTime);
+ }
+ }
+}
+
+void effect1(bool fadeToBlack, byte *scene) {
+ uint32 targetTime = 0;
+ if (fadeToBlack) {
+ for (int i1 = 0; i1 <= 69; i1++) {
- int i1, i2, i3, j1, j2, j3;
- bool enabled = false;
- // bool enabled = true;
+ line(0, (i1 * 2), 319, (i1 * 2), 0);
+ updateScreenIfNeeded(targetTime);
+ }
+ for (int i1 = 70; i1 >= 1; i1--) {
+
+ line(0, (i1 * 2 - 1), 319, (i1 * 2 - 1), 0);
+ updateScreenIfNeeded(targetTime);
+ }
+ } else {
+ byte *screenBuf = (byte *)g_engine->_screen->getPixels();
+ for (int i1 = 0; i1 <= 69; i1++) {
+ byte *src = scene + (i1 * 640) + 4;
+ Common::copy(src, src + 320, screenBuf + (i1 * 640));
+ updateScreenIfNeeded(targetTime);
+ }
+ for (int i1 = 70; i1 >= 1; i1--) {
+ byte *src = scene + (i1 * 640) - 320 + 4;
+ Common::copy(src, src + 320, screenBuf + (i1 * 640) - 320);
+ updateScreenIfNeeded(targetTime);
+ }
+ }
+}
+
+void effect2(bool fadeToBlack, byte *scene) {
+ uint32 targetTime = 0;
+ if (fadeToBlack) {
+ for (int i1 = 70; i1 >= 1; i1--) {
+ line(0, (i1 * 2 - 1), 319, (i1 * 2 - 1), 0);
+ updateScreenIfNeeded(targetTime);
+ }
+ for (int i1 = 0; i1 <= 69; i1++) {
+ line(0, (i1 * 2), 319, (i1 * 2), 0);
+ updateScreenIfNeeded(targetTime);
+ // delay(5);
+ }
+ } else {
+ effect9(fadeToBlack, scene);
+ }
+}
+void effect9(bool fadeToBlack, byte *scene) {
+ uint32 targetTime = 0;
+ if (fadeToBlack) {
+ for (int i1 = 319; i1 >= 0; i1--) {
+ line(319, 139, i1, 0, 0);
+ updateScreenIfNeeded(targetTime);
+ }
+ for (int i1 = 1; i1 <= 139; i1++) {
+ line(319, 139, 0, i1, 0);
+ updateScreenIfNeeded(targetTime);
+ }
+ } else {
+ byte *screenBuf = (byte *)g_engine->_screen->getPixels();
+
+ for (int i1 = 70; i1 >= 1; i1--) {
+ byte *src = scene + ((i1 * 640) - 320) + 4;
+ Common::copy(src, src + 320, screenBuf + (i1 * 640) - 320);
+ updateScreenIfNeeded(targetTime);
+ // delay(5);
+ }
+ for (int i1 = 0; i1 <= 69; i1++) {
+ byte *src = scene + (i1 * 640) + 4;
+ Common::copy(src, src + 320, screenBuf + (i1 * 640));
+ updateScreenIfNeeded(targetTime);
+ // delay(5);
+ }
+ }
+}
+
+void effect3(bool fadeToBlack, byte *scene) {
+ uint32 targetTime = 0;
+ int i1 = 0, j1 = 0;
+ if (fadeToBlack) {
+ for (int i2 = 1; i2 <= 9; i2++) {
+ i1 = 10;
+ do {
+ j1 = 10;
+ do {
+ bar((i1 - i2), (j1 - i2), (i1 + i2), (j1 + i2), 0);
+ j1 += 20;
+ } while (j1 != 150);
+ i1 += 20;
+ updateScreenIfNeeded(targetTime);
+ } while (i1 != 330);
+ }
+ bar(0, 0, 319, 139, 0);
+ } else {
+ effect7(false, scene);
+ }
+}
+
+void effect7(bool fadeToBlack, byte *scene) {
+ uint32 targetTime = 0;
+ int i1 = 0, j1 = 0;
+ if (fadeToBlack) {
+ for (i1 = 69; i1 >= 0; i1--) {
+ rectangle(i1, i1, (319 - i1), (139 - i1), 0);
+ updateScreenIfNeeded(targetTime);
+ g_system->delayMillis(1);
+ }
+ } else {
+ byte *screenBuf = (byte *)g_engine->_screen->getPixels();
+ for (int i2 = 1; i2 <= 9; i2++) {
+ i1 = 10;
+ do {
+ j1 = 10;
+ do {
+ for (int i3 = (j1 - i2); i3 <= (j1 + i2); i3++) {
+ byte *src = scene + +4 + (i3 * 320) + +(i1 - i2);
+ Common::copy(src, src + (i2 * 2), screenBuf + (i3 * 320) + (i1 - i2));
+ }
+ j1 += 20;
+ } while (j1 != 150);
+ updateScreenIfNeeded(targetTime);
+ i1 += 20;
+ } while (i1 != 330);
+ }
+ g_engine->_graphics->drawScreen(scene);
+ }
+}
+
+void effect4(bool fadeToBlack, byte *scene) {
+ uint32 targetTime = 0;
+ if (fadeToBlack) {
+ for (int i2 = 1; i2 <= 22; i2++) {
+ for (int i1 = 1; i1 <= 16; i1++)
+ for (int j1 = 1; j1 <= 7; j1++) {
+ if ((i1 + j1) == (i2 + 1)) {
+ bar(((i1 - 1) * 20), ((j1 - 1) * 20), ((i1 - 1) * 20 + 19), ((j1 - 1) * 20 + 19), 0);
+ updateScreenIfNeeded(targetTime);
+ // delay(8);
+ }
+ }
+ }
+ } else {
+ byte *screenBuf = (byte *)g_engine->_screen->getPixels();
+ for (int i2 = 1; i2 <= 22; i2++) {
+ for (int i1 = 1; i1 <= 16; i1++)
+ for (int j1 = 1; j1 <= 7; j1++) {
+ if ((i1 + j1) == (i2 + 1)) {
+ for (int i3 = ((j1 - 1) * 20); i3 <= ((j1 - 1) * 20 + 19); i3++) {
+ byte *src = scene + +4 + (i3 * 320) + ((i1 - 1) * 20);
+ Common::copy(src, src + 20, screenBuf + (i3 * 320) + ((i1 - 1) * 20));
+ }
+ updateScreenIfNeeded(targetTime);
+ // delay(8);
+ }
+ }
+ }
+ }
+}
+
+void effect5(bool fadeToBlack, byte *scene) {
+ uint32 targetTime = 0;
+ if (fadeToBlack) {
+ for (int j1 = 0; j1 <= 139; j1++) {
+ line(0, j1, 319, (139 - j1), 0);
+ updateScreenIfNeeded(targetTime);
+ }
+ for (int j1 = 318; j1 >= 1; j1--) {
+ line(j1, 0, (319 - j1), 139, 0);
+ updateScreenIfNeeded(targetTime);
+ }
+ } else {
+ effect9(false, scene);
+ }
+}
+
+void effect6(bool fadeToBlack, byte *scene) {
+ uint32 targetTime = 0;
+ if (fadeToBlack) {
+ for (int i1 = 0; i1 < 70; i1++) {
+ rectangle(i1, i1, (319 - i1), (139 - i1), 0);
+ updateScreenIfNeeded(targetTime);
+ }
+ } else {
+ byte *screenBuf = (byte *)g_engine->_screen->getPixels();
+ for (int i1 = 70; i1 >= 0; i1--) {
+ for (int j1 = i1; j1 <= (139 - i1); j1++) {
+ byte *src = scene + 4 + (j1 * 320) + i1;
+ Common::copy(src, src + 319 - (i1 * 2), screenBuf + (j1 * 320) + i1);
+ }
+ updateScreenIfNeeded(targetTime);
+ }
+ }
+}
+
+void effect8(bool fadeToBlack, byte *scene) {
+ uint32 targetTime = 0;
+ if (fadeToBlack) {
+ for (int i1 = 0; i1 <= 319; i1++) {
+ line(0, 139, i1, 0, 0);
+ updateScreenIfNeeded(targetTime);
+ }
+ for (int i1 = 1; i1 <= 139; i1++) {
+ line(0, 139, 319, i1, 0);
+ updateScreenIfNeeded(targetTime);
+ }
+ } else {
+ effect9(false, scene);
+ }
+}
+
+void effect10(bool fadeToBlack, byte *scene) {
+ uint32 targetTime = 0;
+ if (fadeToBlack) {
+ for (int j1 = 1; j1 <= 7; j1++) {
+ if ((j1 % 2) == 0)
+ for (int i1 = 1; i1 <= 16; i1++) {
+ bar(((i1 - 1) * 20), ((j1 - 1) * 20), ((i1 - 1) * 20 + 19), ((j1 - 1) * 20 + 19), 0);
+ updateScreenIfNeeded(targetTime);
+ g_system->delayMillis(2); // original enforces delay(8);
+ }
+ else
+ for (int i1 = 16; i1 >= 1; i1--) {
+ bar(((i1 - 1) * 20), ((j1 - 1) * 20), ((i1 - 1) * 20 + 19), ((j1 - 1) * 20 + 19), 0);
+ updateScreenIfNeeded(targetTime);
+ g_system->delayMillis(2); // original enforces delay(8);
+ }
+ }
+ } else {
+ byte *screenBuf = (byte *)g_engine->_screen->getPixels();
+ for (int j1 = 1; j1 <= 7; j1++) {
+ if ((j1 % 2) == 0)
+ for (int i1 = 1; i1 <= 16; i1++) {
+ for (int j3 = ((j1 - 1) * 20); j3 <= ((j1 - 1) * 20 + 19); j3++) {
+ byte *src = scene + 4 + (j3 * 320) + ((i1 - 1) * 20);
+
+ Common::copy(src, src + 20, screenBuf + (j3 * 320) + ((i1 - 1) * 20));
+ }
+ updateScreenIfNeeded(targetTime);
+ g_system->delayMillis(2); // original enforces delay(8);
+ }
+ else
+ for (int i1 = 16; i1 >= 1; i1--) {
+ for (int j3 = ((j1 - 1) * 20); j3 <= ((j1 - 1) * 20 + 19); j3++) {
+ byte *src = scene + 4 + (j3 * 320) + ((i1 - 1) * 20);
+ Common::copy(src, src + 20, screenBuf + (j3 * 320) + ((i1 - 1) * 20));
+ }
+ updateScreenIfNeeded(targetTime);
+ g_system->delayMillis(2); // original enforces delay(8);
+ }
+ }
+ }
+}
+
+void effect11(bool fadeToBlack, byte *scene) {
+ uint32 targetTime = 0;
+ int i1 = 0, j1 = 0, j3 = 0;
+ if (fadeToBlack) {
+ for (int i2 = 0; i2 <= 3; i2++) {
+ j1 = 1 + i2;
+ for (i1 = (1 + i2); i1 <= (16 - i2); i1++) {
+ bar(((i1 - 1) * 20), ((j1 - 1) * 20), ((i1 - 1) * 20 + 19), ((j1 - 1) * 20 + 19), 0);
+ updateScreenIfNeeded(targetTime);
+ g_system->delayMillis(1); // delay(8);
+ }
+ i1--;
+ for (j1 = (2 + i2); j1 <= (7 - i2); j1++) {
+ bar(((i1 - 1) * 20), ((j1 - 1) * 20), ((i1 - 1) * 20 + 19), ((j1 - 1) * 20 + 19), 0);
+ updateScreenIfNeeded(targetTime);
+ g_system->delayMillis(1); // delay(8);
+ }
+ j1--;
+ for (i1 = (16 - i2); i1 >= (1 + i2); i1--) {
+ bar(((i1 - 1) * 20), ((j1 - 1) * 20), ((i1 - 1) * 20 + 19), ((j1 - 1) * 20 + 19), 0);
+ updateScreenIfNeeded(targetTime);
+ g_system->delayMillis(1); // delay(8);
+ }
+ i1++;
+ for (j1 = (6 - i2); j1 >= (2 + i2); j1--) {
+ bar(((i1 - 1) * 20), ((j1 - 1) * 20), ((i1 - 1) * 20 + 19), ((j1 - 1) * 20 + 19), 0);
+ updateScreenIfNeeded(targetTime);
+ g_system->delayMillis(1); // delay(8);
+ }
+ }
+ } else {
+ byte *screenBuf = (byte *)g_engine->_screen->getPixels();
+
+ for (int i2 = 0; i2 <= 3; i2++) {
+ j1 = 1 + i2;
+ for (i1 = (1 + i2); i1 <= (16 - i2); i1++) {
+ for (j3 = ((j1 - 1) * 20); j3 <= ((j1 - 1) * 20 + 19); j3++) {
+ byte *buf = scene + 4 + (j3 * 320) + ((i1 - 1) * 20);
+ Common::copy(buf, buf + 20, screenBuf + ((j3 * 320) + ((i1 - 1) * 20)));
+ }
+ updateScreenIfNeeded(targetTime);
+ g_system->delayMillis(1); // delay(8);
+ }
+ i1--;
+ for (j1 = (2 + i2); j1 <= (7 - i2); j1++) {
+ for (j3 = ((j1 - 1) * 20); j3 <= ((j1 - 1) * 20 + 19); j3++) {
+ byte *buf = scene + 4 + (j3 * 320) + ((i1 - 1) * 20);
+ Common::copy(buf, buf + 20, screenBuf + ((j3 * 320) + ((i1 - 1) * 20)));
+ }
+ updateScreenIfNeeded(targetTime);
+ g_system->delayMillis(1); // delay(8);
+ }
+ j1--;
+ for (i1 = (16 - i2); i1 >= (1 + i2); i1--) {
+ for (j3 = ((j1 - 1) * 20); j3 <= ((j1 - 1) * 20 + 19); j3++) {
+ byte *buf = scene + 4 + (j3 * 320) + ((i1 - 1) * 20);
+ Common::copy(buf, buf + 20, screenBuf + ((j3 * 320) + ((i1 - 1) * 20)));
+ }
+ updateScreenIfNeeded(targetTime);
+ g_system->delayMillis(1); // delay(8);
+ }
+ i1++;
+ for (j1 = (6 - i2); j1 >= (2 + i2); j1--) {
+ for (j3 = ((j1 - 1) * 20); j3 <= ((j1 - 1) * 20 + 19); j3++) {
+ byte *buf = scene + 4 + (j3 * 320) + ((i1 - 1) * 20);
+ Common::copy(buf, buf + 20, screenBuf + ((j3 * 320) + ((i1 - 1) * 20)));
+ }
+ updateScreenIfNeeded(targetTime);
+ g_system->delayMillis(1); // delay(8);
+ }
+ }
+ }
+}
+
+void effect12(bool fadeToBlack, byte *scene) {
+ uint32 targetTime = 0;
+ int i2 = 0, j2 = 0;
+ if (fadeToBlack) {
+ for (int i1 = 1; i1 <= 15000; i1++) {
+ i2 = Random(318);
+ j2 = Random(138);
+ bar(i2, j2, (i2 + 2), (j2 + 2), 0);
+ putpixel(Random(320), Random(139), 0);
+ if (i1 % 100 == 0) {
+ updateScreenIfNeeded(targetTime);
+ }
+ }
+ } else {
+ byte *screenBuf = (byte *)g_engine->_screen->getPixels();
+
+ for (int i1 = 1; i1 <= 15000; i1++) {
+ i2 = Random(318);
+ j2 = Random(138);
+
+ byte *src1 = scene + 4 + (j2 * 320) + i2;
+ byte *src2 = scene + 4 + ((j2 + 1) * 320) + i2;
+ Common::copy(src1, src1 + 2, screenBuf + j2 * 320 + i2);
+
+ Common::copy(src2, src2 + 2, screenBuf + (j2 + 1) * 320 + i2);
+ i2 = Random(320);
+ j2 = Random(140);
+
+ byte *src3 = scene + 4 + (j2 * 320) + i2;
+ Common::copy(src3, src3 + 1, screenBuf + (j2 * 320) + i2);
+ if (i1 % 100 == 0) {
+ updateScreenIfNeeded(targetTime);
+ }
+ }
+ g_engine->_graphics->drawScreen(scene);
+ }
+}
+
+void effect14(bool fadeToBlack, byte *scene) {
+ uint32 targetTime = 0;
+ if (fadeToBlack) {
+ for (int i1 = 0; i1 <= 319; i1++) {
+ line(i1, 0, i1, 139, 0);
+ updateScreenIfNeeded(targetTime);
+ }
+ } else {
+ for (int i1 = 320; i1 > 0; i1--) {
+ for (int j1 = 0; j1 < 140; j1++) {
+ int color = scene[4 + (j1 * 320) + i1];
+ *((byte *)g_engine->_screen->getBasePtr(i1, j1)) = color;
+ }
+ updateScreenIfNeeded(targetTime);
+ }
+ }
+}
+
+void effect15(bool fadeToBlack, byte *scene) {
+ uint32 targetTime = 0;
byte *screenBuf = (byte *)g_engine->_screen->getPixels();
+
+ if (fadeToBlack) {
+ for (int j1 = 0; j1 <= 70; j1++) {
+ Common::copy(screenBuf + (j1 * 320), screenBuf + (j1 * 320) + 320, screenBuf + ((j1 + 1) * 320));
+ line(0, j1, 319, j1, 0);
+ Common::copy(screenBuf + ((139 - j1) * 320), screenBuf + ((139 - j1) * 320) + 320, screenBuf + ((138 - j1) * 320));
+ line(0, (139 - j1), 319, (139 - j1), 0);
+ // delay(2);
+ updateScreenIfNeeded(targetTime);
+ }
+ // delay(5);
+ for (int j1 = 0; j1 <= 160; j1++) {
+ line(0, 68, j1, 68, 0);
+ line(319, 68, (319 - j1), 68, 0);
+ updateScreenIfNeeded(targetTime);
+ }
+ } else {
+ for (int j1 = 160; j1 > 0; j1--) {
+ line(j1, 69, (319 - j1), 69, 255);
+ updateScreenIfNeeded(targetTime);
+ }
+ // delay(5);
+ for (int j1 = 70; j1 > 0; j1--) {
+ byte *src1 = scene + 4 + j1 * 320;
+ byte *src2 = scene + 4 + (139 - j1) * 320;
+ Common::copy(src1, src1 + 320, screenBuf + j1 * 320);
+
+ Common::copy(src2, src2 + 320, screenBuf + (139 - j1) * 320);
+ updateScreenIfNeeded(targetTime);
+ }
+ }
+}
+
+void GraphicsManager::sceneTransition(bool fadeToBlack, byte *scene, byte effectNumber) {
+
+ // bool enabled = false;
+ bool enabled = true;
+ uint32 effectStartTime = g_system->getMillis();
// Disable effects for now
if (!enabled) {
debug("Effects disabled! requested effect is %d, with fadeToBlack =%d", effectNumber, fadeToBlack);
@@ -493,7 +940,7 @@ void GraphicsManager::sceneTransition(bool fadeToBlack, byte *scene, byte effect
drawScreen(scene);
}
} else {
- // effectNumber = 13;
+ effectNumber = 15;
g_engine->_cpCounter2 = g_engine->_cpCounter;
if (g_engine->_cpCounter > 145)
showError(274);
@@ -501,385 +948,94 @@ void GraphicsManager::sceneTransition(bool fadeToBlack, byte *scene, byte effect
if (fadeToBlack)
switch (effectNumber) {
case 1: {
- for (i1 = 0; i1 <= 69; i1++) {
- line(0, (i1 * 2), 319, (i1 * 2), 0);
- updateSceneAreaIfNeeded();
- delay(5);
- }
- for (i1 = 70; i1 >= 1; i1--) {
- line(0, (i1 * 2 - 1), 319, (i1 * 2 - 1), 0);
- updateSceneAreaIfNeeded();
- delay(5);
- }
+ effect1(true, scene);
} break;
case 2: {
- for (i1 = 70; i1 >= 1; i1--) {
- line(0, (i1 * 2 - 1), 319, (i1 * 2 - 1), 0);
- updateSceneAreaIfNeeded();
- delay(5);
- }
- for (i1 = 0; i1 <= 69; i1++) {
- line(0, (i1 * 2), 319, (i1 * 2), 0);
- updateSceneAreaIfNeeded();
- delay(5);
- }
+ effect2(true, scene);
} break;
case 3: {
- for (i2 = 1; i2 <= 9; i2++) {
- i1 = 10;
- do {
- j1 = 10;
- do {
- bar((i1 - i2), (j1 - i2), (i1 + i2), (j1 + i2), 0);
- updateSceneAreaIfNeeded();
- j1 += 20;
- } while (j1 != 150);
- i1 += 20;
- updateSceneAreaIfNeeded();
- } while (i1 != 330);
- }
- bar(0, 0, 319, 139, 0);
- updateSceneAreaIfNeeded();
+ effect3(true, scene);
} break;
case 4: {
- for (i2 = 1; i2 <= 22; i2++) {
- for (i1 = 1; i1 <= 16; i1++)
- for (j1 = 1; j1 <= 7; j1++) {
- if ((i1 + j1) == (i2 + 1)) {
- bar(((i1 - 1) * 20), ((j1 - 1) * 20), ((i1 - 1) * 20 + 19), ((j1 - 1) * 20 + 19), 0);
- updateSceneAreaIfNeeded();
- delay(8);
- }
- }
- }
+ effect4(true, scene);
} break;
case 5: {
- for (j1 = 0; j1 <= 139; j1++) {
- line(0, j1, 319, (139 - j1), 0);
- updateSceneAreaIfNeeded();
- }
- for (j1 = 318; j1 >= 1; j1--) {
- line(j1, 0, (319 - j1), 139, 0);
- updateSceneAreaIfNeeded();
- }
+ effect5(true, scene);
} break;
case 6: {
- for (i1 = 0; i1 < 70; i1++) {
- rectangle(i1, i1, (319 - i1), (139 - i1), 0);
- delay(5);
- updateSceneAreaIfNeeded();
- }
+ effect6(true, scene);
} break;
case 7: {
- for (i1 = 69; i1 >= 0; i1--) {
- rectangle(i1, i1, (319 - i1), (139 - i1), 0);
- updateSceneAreaIfNeeded();
- }
+ effect7(true, scene);
} break;
case 8: {
-
- for (i1 = 0; i1 <= 319; i1++) {
- line(0, 139, i1, 0, 0);
- updateSceneAreaIfNeeded();
- }
- for (i1 = 1; i1 <= 139; i1++) {
- line(0, 139, 319, i1, 0);
- updateSceneAreaIfNeeded();
- }
+ effect8(true, scene);
} break;
case 9: {
-
- for (i1 = 319; i1 >= 0; i1--) {
- line(319, 139, i1, 0, 0);
- updateSceneAreaIfNeeded();
- }
- for (i1 = 1; i1 <= 139; i1++) {
- line(319, 139, 0, i1, 0);
- updateSceneAreaIfNeeded();
- }
+ effect9(true, scene);
} break;
case 10: {
- for (j1 = 1; j1 <= 7; j1++) {
- if ((j1 % 2) == 0)
- for (i1 = 1; i1 <= 16; i1++) {
- bar(((i1 - 1) * 20), ((j1 - 1) * 20), ((i1 - 1) * 20 + 19), ((j1 - 1) * 20 + 19), 0);
- updateSceneAreaIfNeeded();
- delay(8);
- }
- else
- for (i1 = 16; i1 >= 1; i1--) {
- bar(((i1 - 1) * 20), ((j1 - 1) * 20), ((i1 - 1) * 20 + 19), ((j1 - 1) * 20 + 19), 0);
- updateSceneAreaIfNeeded();
- delay(8);
- }
- }
+ effect10(true, scene);
} break;
case 11: {
- for (i2 = 0; i2 <= 3; i2++) {
- j1 = 1 + i2;
- for (i1 = (1 + i2); i1 <= (16 - i2); i1++) {
- bar(((i1 - 1) * 20), ((j1 - 1) * 20), ((i1 - 1) * 20 + 19), ((j1 - 1) * 20 + 19), 0);
- updateSceneAreaIfNeeded();
- delay(8);
- }
- i1--;
- for (j1 = (2 + i2); j1 <= (7 - i2); j1++) {
- bar(((i1 - 1) * 20), ((j1 - 1) * 20), ((i1 - 1) * 20 + 19), ((j1 - 1) * 20 + 19), 0);
- updateSceneAreaIfNeeded();
- delay(8);
- }
- j1--;
- for (i1 = (16 - i2); i1 >= (1 + i2); i1--) {
- bar(((i1 - 1) * 20), ((j1 - 1) * 20), ((i1 - 1) * 20 + 19), ((j1 - 1) * 20 + 19), 0);
- updateSceneAreaIfNeeded();
- delay(8);
- }
- i1++;
- for (j1 = (6 - i2); j1 >= (2 + i2); j1--) {
- bar(((i1 - 1) * 20), ((j1 - 1) * 20), ((i1 - 1) * 20 + 19), ((j1 - 1) * 20 + 19), 0);
- updateSceneAreaIfNeeded();
- delay(8);
- }
- }
+ effect11(true, scene);
} break;
case 12: {
- for (i1 = 1; i1 <= 15000; i1++) {
- i2 = Random(318);
- j2 = Random(138);
- bar(i2, j2, (i2 + 2), (j2 + 2), 0);
- putpixel(Random(320), Random(139), 0);
- updateSceneAreaIfNeeded(5);
- }
- bar(0, 0, 319, 139, 0);
- updateSceneAreaIfNeeded();
+ effect12(true, scene);
} break;
case 13: {
- for (i1 = 319; i1 >= 0; i1--) {
- line(i1, 0, i1, 139, 0);
- updateSceneAreaIfNeeded();
- }
+ effect13(true, scene);
} break;
case 14: {
- for (i1 = 0; i1 <= 319; i1++) {
- line(i1, 0, i1, 139, 0);
- updateSceneAreaIfNeeded();
- }
+ effect14(true, scene);
} break;
case 15: {
-
- for (j1 = 0; j1 <= 70; j1++) {
- Common::copy(screenBuf + (j1 * 320), screenBuf + (j1 * 320) + 320, screenBuf + ((j1 + 1) * 320));
- line(0, j1, 319, j1, 0);
- Common::copy(screenBuf + ((139 - j1) * 320), screenBuf + ((139 - j1) * 320) + 320, screenBuf + ((138 - j1) * 320));
- line(0, (139 - j1), 319, (139 - j1), 0);
- delay(2);
- updateSceneAreaIfNeeded();
- }
- delay(5);
- for (j1 = 0; j1 <= 160; j1++) {
- line(0, 68, j1, 68, 0);
- line(319, 68, (319 - j1), 68, 0);
- updateSceneAreaIfNeeded();
- }
+ effect15(true, scene);
} break;
}
else
switch (effectNumber) {
- case 1: {
- for (i1 = 0; i1 <= 69; i1++) {
- byte *src = scene + (i1 * 640) + 4;
- Common::copy(src, src + 320, screenBuf + (i1 * 640));
-
- updateSceneAreaIfNeeded();
- delay(5);
- }
- for (i1 = 70; i1 >= 1; i1--) {
- byte *src = scene + (i1 * 640) - 320 + 4;
- Common::copy(src, src + 320, screenBuf + (i1 * 640) - 320);
- updateSceneAreaIfNeeded();
- delay(5);
- }
- } break;
+ case 1:
+ effect1(false, scene);
+ break;
case 2:
case 5:
case 8:
- case 9: {
- for (i1 = 70; i1 >= 1; i1--) {
- byte *src = scene + ((i1 * 640) - 320) + 4;
- Common::copy(src, src + 320, screenBuf + (i1 * 640) - 320);
- updateSceneAreaIfNeeded();
- delay(5);
- }
- for (i1 = 0; i1 <= 69; i1++) {
- byte *src = scene + (i1 * 640) + 4;
- Common::copy(src, src + 320, screenBuf + (i1 * 640));
- updateSceneAreaIfNeeded();
- delay(5);
- }
- } break;
+ case 9:
+ effect9(false, scene);
+ break;
case 3:
case 7: {
- for (i2 = 1; i2 <= 9; i2++) {
- i1 = 10;
- do {
- j1 = 10;
- do {
- for (i3 = (j1 - i2); i3 <= (j1 + i2); i3++) {
- byte *src = scene + +4 + (i3 * 320) + +(i1 - i2);
- Common::copy(src, src + (i2 * 2), screenBuf + (i3 * 320) + (i1 - i2));
- }
- j1 += 20;
- } while (j1 != 150);
- updateSceneAreaIfNeeded();
- i1 += 20;
- } while (i1 != 330);
- }
- drawScreen(scene);
+ effect7(false, scene);
} break;
case 4: {
- for (i2 = 1; i2 <= 22; i2++) {
- for (i1 = 1; i1 <= 16; i1++)
- for (j1 = 1; j1 <= 7; j1++) {
- if ((i1 + j1) == (i2 + 1)) {
- for (i3 = ((j1 - 1) * 20); i3 <= ((j1 - 1) * 20 + 19); i3++) {
- byte *src = scene + +4 + (i3 * 320) + ((i1 - 1) * 20);
- Common::copy(src, src + 20, screenBuf + (i3 * 320) + ((i1 - 1) * 20));
- updateSceneAreaIfNeeded();
- }
- delay(8);
- }
- }
- }
+ effect4(false, scene);
} break;
case 6: {
- for (i1 = 70; i1 >= 0; i1--) {
- for (j1 = i1; j1 <= (139 - i1); j1++) {
- byte *src = scene + 4 + (j1 * 320) + i1;
- Common::copy(src, src + 319 - (i1 * 2), screenBuf + (j1 * 320) + i1);
- }
- updateSceneAreaIfNeeded();
- }
+ effect6(false, scene);
} break;
case 10: {
- for (j1 = 1; j1 <= 7; j1++) {
- if ((j1 % 2) == 0)
- for (i1 = 1; i1 <= 16; i1++) {
- for (j3 = ((j1 - 1) * 20); j3 <= ((j1 - 1) * 20 + 19); j3++) {
- byte *src = scene + 4 + (j3 * 320) + ((i1 - 1) * 20);
-
- Common::copy(src, src + 20, screenBuf + (j3 * 320) + ((i1 - 1) * 20));
- }
- updateSceneAreaIfNeeded();
- delay(8);
- }
- else
- for (i1 = 16; i1 >= 1; i1--) {
- for (j3 = ((j1 - 1) * 20); j3 <= ((j1 - 1) * 20 + 19); j3++) {
- byte *src = scene + 4 + (j3 * 320) + ((i1 - 1) * 20);
- Common::copy(src, src + 20, screenBuf + (j3 * 320) + ((i1 - 1) * 20));
- }
- updateSceneAreaIfNeeded();
- delay(8);
- }
- }
+ effect10(false, scene);
} break;
case 11: {
- for (i2 = 0; i2 <= 3; i2++) {
- j1 = 1 + i2;
- for (i1 = (1 + i2); i1 <= (16 - i2); i1++) {
- for (j3 = ((j1 - 1) * 20); j3 <= ((j1 - 1) * 20 + 19); j3++) {
- byte *buf = scene + 4 + (j3 * 320) + ((i1 - 1) * 20);
- Common::copy(buf, buf + 20, screenBuf + ((j3 * 320) + ((i1 - 1) * 20)));
- }
- updateSceneAreaIfNeeded();
- delay(8);
- }
- i1--;
- for (j1 = (2 + i2); j1 <= (7 - i2); j1++) {
- for (j3 = ((j1 - 1) * 20); j3 <= ((j1 - 1) * 20 + 19); j3++) {
- byte *buf = scene + 4 + (j3 * 320) + ((i1 - 1) * 20);
- Common::copy(buf, buf + 20, screenBuf + ((j3 * 320) + ((i1 - 1) * 20)));
- }
- updateSceneAreaIfNeeded();
- delay(8);
- }
- j1--;
- for (i1 = (16 - i2); i1 >= (1 + i2); i1--) {
- for (j3 = ((j1 - 1) * 20); j3 <= ((j1 - 1) * 20 + 19); j3++) {
- byte *buf = scene + 4 + (j3 * 320) + ((i1 - 1) * 20);
- Common::copy(buf, buf + 20, screenBuf + ((j3 * 320) + ((i1 - 1) * 20)));
- }
- updateSceneAreaIfNeeded();
- delay(8);
- }
- i1++;
- for (j1 = (6 - i2); j1 >= (2 + i2); j1--) {
- for (j3 = ((j1 - 1) * 20); j3 <= ((j1 - 1) * 20 + 19); j3++) {
- byte *buf = scene + 4 + (j3 * 320) + ((i1 - 1) * 20);
- Common::copy(buf, buf + 20, screenBuf + ((j3 * 320) + ((i1 - 1) * 20)));
- }
- updateSceneAreaIfNeeded();
- delay(8);
- }
- }
+ effect11(false, scene);
} break;
case 12: {
- for (i1 = 1; i1 <= 15000; i1++) {
- i2 = Random(318);
- j2 = Random(138);
-
- byte *src1 = scene + 4 + (j2 * 320) + i2;
- byte *src2 = scene + 4 + ((j2 + 1) * 320) + i2;
- Common::copy(src1, src1 + 2, screenBuf + j2 * 320 + i2);
-
- Common::copy(src2, src2 + 2, screenBuf + (j2 + 1) * 320 + i2);
- i2 = Random(320);
- j2 = Random(140);
-
- byte *src3 = scene + 4 + (j2 * 320) + i2;
- Common::copy(src3, src3 + 1, screenBuf + (j2 * 320) + i2);
-
- updateSceneAreaIfNeeded();
- }
- drawScreen(scene);
- } break;
- case 13: {
- debug("case 13!");
- for (i1 = 0; i1 <= 319; i1++) {
- for (j1 = 0; j1 <= 139; j1++) {
- int color = scene[4 + (j1 * 320) + i1];
- *((byte *)g_engine->_screen->getBasePtr(i1, j1)) = color;
- }
- delay(1);
- updateSceneAreaIfNeeded();
- }
+ effect12(false, scene);
} break;
+ case 13:
+ effect13(false, scene);
+ break;
case 14: {
- for (i1 = 320; i1 > 0; i1--) {
- for (j1 = 0; j1 < 140; j1++) {
- int color = scene[4 + (j1 * 320) + i1];
- *((byte *)g_engine->_screen->getBasePtr(i1, j1)) = color;
- }
- updateSceneAreaIfNeeded();
- }
+ effect14(false, scene);
} break;
case 15: {
- for (j1 = 160; j1 > 0; j1--) {
- line(j1, 69, (319 - j1), 69, 255);
- updateSceneAreaIfNeeded();
- }
- delay(5);
- for (j1 = 70; j1 > 0; j1--) {
- byte *src1 = scene + 4 + j1 * 320;
- byte *src2 = scene + 4 + (139 - j1) * 320;
- Common::copy(src1, src1 + 320, screenBuf + j1 * 320);
-
- Common::copy(src2, src2 + 320, screenBuf + (139 - j1) * 320);
- updateSceneAreaIfNeeded();
- }
+ effect15(false, scene);
} break;
}
}
+ updateSceneArea();
+ debug("Effect finished in %u ms", g_system->getMillis() - effectStartTime);
}
void GraphicsManager::init() {
diff --git a/engines/tot/graphics.h b/engines/tot/graphics.h
index b1766700250..2bca5d3dd8b 100644
--- a/engines/tot/graphics.h
+++ b/engines/tot/graphics.h
@@ -81,6 +81,7 @@ public:
void advancePaletteAnim();
void loadAnimationIntoBuffer(Common::SeekableReadStream *stream, byte *&buf, int animSize);
void printColor(int x, int y, int color);
+ void updateSceneArea(int speed = 1);
/**
* Aux for palette animation
@@ -104,7 +105,6 @@ public:
*/
byte *_textAreaBackground = (byte *)malloc(kTextAreaSize);
private:
- void updateSceneAreaIfNeeded(int speed = 1);
signed char fadeData[256][256];
Graphics::BgiFont _litt;
Graphics::BgiFont _euro;
diff --git a/engines/tot/routines.cpp b/engines/tot/routines.cpp
index 82c57139014..7fe0b7ea6d7 100644
--- a/engines/tot/routines.cpp
+++ b/engines/tot/routines.cpp
@@ -3687,8 +3687,10 @@ void TotEngine::loadObjects() {
break;
}
- if (!objectFile.isOpen())
+ if (!objectFile.isOpen()) {
showError(312);
+ debug("Object file exists? %b", objectFile.exists("OBJMOCH.DAT"));
+ }
for (int i = 0; i < kInventoryIconCount; i++) {
_inventoryIconBitmaps[i] = (byte *)malloc(kInventoryIconSize);
objectFile.read(_inventoryIconBitmaps[i], kInventoryIconSize);
diff --git a/engines/tot/sound.cpp b/engines/tot/sound.cpp
index e5ac2d10a06..c60d12ffbaa 100644
--- a/engines/tot/sound.cpp
+++ b/engines/tot/sound.cpp
@@ -117,7 +117,6 @@ bool SoundManager::isVocPlaying() {
void SoundManager::playMidi(Common::String fileName, bool loop) {
Common::File musicFile;
- debug("Opening music file %s", fileName.c_str());
musicFile.open(Common::Path(fileName + ".MUS"));
if (!musicFile.isOpen()) {
showError(267);
@@ -170,7 +169,6 @@ void SoundManager::setSfxVolume(byte voll, byte volr) {
void SoundManager::setMidiVolume(byte voll, byte volr) {
int volume = (voll) / (float)7 * 255;
- debug("Setting Midi volume to %d", volume);
setMusicVolume(volume);
}
diff --git a/engines/tot/tot.cpp b/engines/tot/tot.cpp
index 0a678722170..1ad90d5b426 100644
--- a/engines/tot/tot.cpp
+++ b/engines/tot/tot.cpp
@@ -124,12 +124,12 @@ int TotEngine::engineStart() {
_graphics->loadPaletteFromFile("DEFAULT");
initScreenPointers();
- initialLogo();
+ // initialLogo();
_sound->playMidi("INTRODUC", true);
_sound->setMidiVolume(3, 3);
firstIntroduction();
_mouse->warpMouse(1, _mouse->mouseX, _mouse->mouseY);
- initialMenu(_firstTimeDone);
+ // initialMenu(_firstTimeDone);
if (_startNewGame && !shouldQuit()) {
newGame();
} else if (_continueGame && !shouldQuit()) {
@@ -599,7 +599,7 @@ int TotEngine::startGame() {
void TotEngine::newGame() {
_saveAllowed = true;
_mouse->hide();
- obtainName(_characterName);
+ // obtainName(_characterName);
if (!shouldQuit()) {
_graphics->totalFadeOut(0);
@@ -620,6 +620,11 @@ void TotEngine::newGame() {
_graphics->loadPaletteFromFile("DEFAULT");
loadScreenData(1);
_graphics->sceneTransition(false, _sceneBackground, 13);
+ // bool fade = false;
+ // while(!g_engine->shouldQuit()){
+ // _graphics->sceneTransition(fade, _sceneBackground, 13);
+ // fade = !fade;
+ // }
drawInventoryMask();
_inventoryPosition = 0;
drawInventory();
Commit: 3efffbbaf835e47f1810e2c8073ca2eb19d11bb0
https://github.com/scummvm/scummvm/commit/3efffbbaf835e47f1810e2c8073ca2eb19d11bb0
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:52+02:00
Commit Message:
TOT: Disable enforcement of a given effect
Changed paths:
engines/tot/graphics.cpp
diff --git a/engines/tot/graphics.cpp b/engines/tot/graphics.cpp
index ea13b56be72..d6c01941a82 100644
--- a/engines/tot/graphics.cpp
+++ b/engines/tot/graphics.cpp
@@ -935,16 +935,13 @@ void GraphicsManager::sceneTransition(bool fadeToBlack, byte *scene, byte effect
uint32 effectStartTime = g_system->getMillis();
// Disable effects for now
if (!enabled) {
- debug("Effects disabled! requested effect is %d, with fadeToBlack =%d", effectNumber, fadeToBlack);
if (!fadeToBlack) {
drawScreen(scene);
}
} else {
- effectNumber = 15;
g_engine->_cpCounter2 = g_engine->_cpCounter;
if (g_engine->_cpCounter > 145)
showError(274);
- debug("Effect %d, pasaraanegro=%d", effectNumber, fadeToBlack);
if (fadeToBlack)
switch (effectNumber) {
case 1: {
Commit: ede6df991aaaafef1f98fa8358ebc46324e63094
https://github.com/scummvm/scummvm/commit/ede6df991aaaafef1f98fa8358ebc46324e63094
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:52+02:00
Commit Message:
TOT: Adds option to disable transitions
Changed paths:
engines/tot/detection.h
engines/tot/detection_tables.h
engines/tot/graphics.cpp
engines/tot/metaengine.cpp
engines/tot/metaengine.h
engines/tot/routines.cpp
engines/tot/tot.cpp
diff --git a/engines/tot/detection.h b/engines/tot/detection.h
index 7827df25c3a..1f492b41be0 100644
--- a/engines/tot/detection.h
+++ b/engines/tot/detection.h
@@ -38,7 +38,7 @@ extern const PlainGameDescriptor totGames[];
extern const ADGameDescription gameDescriptions[];
-#define GAMEOPTION_ORIGINAL_SAVELOAD GUIO_GAMEOPTIONS1
+#define GAMEOPTION_NO_TRANSITIONS GUIO_GAMEOPTIONS1
} // End of namespace Tot
diff --git a/engines/tot/detection_tables.h b/engines/tot/detection_tables.h
index 3b5e8964270..d639a75e77b 100644
--- a/engines/tot/detection_tables.h
+++ b/engines/tot/detection_tables.h
@@ -18,6 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
+#include "tot/detection.h"
namespace Tot {
@@ -37,7 +38,7 @@ const ADGameDescription gameDescriptions[] = {
Common::ES_ESP,
Common::kPlatformDOS,
ADGF_UNSTABLE,
- GUIO1(GUIO_NONE)
+ GUIO1(GAMEOPTION_NO_TRANSITIONS)
},
{
"tot",
@@ -49,7 +50,7 @@ const ADGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformDOS,
ADGF_UNSTABLE,
- GUIO1(GUIO_NONE)
+ GUIO1(GAMEOPTION_NO_TRANSITIONS)
},
AD_TABLE_END_MARKER
};
diff --git a/engines/tot/graphics.cpp b/engines/tot/graphics.cpp
index d6c01941a82..676a12edcb4 100644
--- a/engines/tot/graphics.cpp
+++ b/engines/tot/graphics.cpp
@@ -18,6 +18,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
+
+#include "common/config-manager.h"
#include "common/debug.h"
#include "common/system.h"
#include "graphics/font.h"
@@ -931,7 +933,7 @@ void effect15(bool fadeToBlack, byte *scene) {
void GraphicsManager::sceneTransition(bool fadeToBlack, byte *scene, byte effectNumber) {
// bool enabled = false;
- bool enabled = true;
+ bool enabled = ConfMan.getBool("transitions_disable") == false;
uint32 effectStartTime = g_system->getMillis();
// Disable effects for now
if (!enabled) {
diff --git a/engines/tot/metaengine.cpp b/engines/tot/metaengine.cpp
index 6e7410021f7..87073486ad2 100644
--- a/engines/tot/metaengine.cpp
+++ b/engines/tot/metaengine.cpp
@@ -18,11 +18,27 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
+#include "common/translation.h"
#include "tot/metaengine.h"
#include "tot/detection.h"
#include "tot/tot.h"
+static const ADExtraGuiOptionsMap optionsList[] = {
+ {
+ GAMEOPTION_NO_TRANSITIONS,
+ {
+ _s("Disable scene transitions"),
+ _s("Disable original transition effects between scenes"),
+ "transitions_disable",
+ false,
+ 0,
+ 0
+ }
+ },
+ AD_EXTRA_GUI_OPTIONS_TERMINATOR
+};
+
const char *TotMetaEngine::getName() const {
return "tot";
}
@@ -37,6 +53,10 @@ bool TotMetaEngine::hasFeature(MetaEngineFeature f) const {
(f == kSupportsLoadingDuringStartup);
}
+const ADExtraGuiOptionsMap *TotMetaEngine::getAdvancedExtraGuiOptions() const {
+ return optionsList;
+ }
+
#if PLUGIN_ENABLED_DYNAMIC(TOT)
REGISTER_PLUGIN_DYNAMIC(TOT, PLUGIN_TYPE_ENGINE, TotMetaEngine);
#else
diff --git a/engines/tot/metaengine.h b/engines/tot/metaengine.h
index e33a2d0de90..c97cbff3baf 100644
--- a/engines/tot/metaengine.h
+++ b/engines/tot/metaengine.h
@@ -36,6 +36,8 @@ public:
* Used by e.g. the launcher to determine whether to enable the Load button.
*/
bool hasFeature(MetaEngineFeature f) const override;
+ const ADExtraGuiOptionsMap *getAdvancedExtraGuiOptions() const override;
+
};
#endif // TOT_METAENGINE_H
diff --git a/engines/tot/routines.cpp b/engines/tot/routines.cpp
index 7fe0b7ea6d7..a35e9aaf722 100644
--- a/engines/tot/routines.cpp
+++ b/engines/tot/routines.cpp
@@ -3688,8 +3688,8 @@ void TotEngine::loadObjects() {
}
if (!objectFile.isOpen()) {
+ debug("Object file exists? %d", objectFile.exists("OBJMOCH.DAT"));
showError(312);
- debug("Object file exists? %b", objectFile.exists("OBJMOCH.DAT"));
}
for (int i = 0; i < kInventoryIconCount; i++) {
_inventoryIconBitmaps[i] = (byte *)malloc(kInventoryIconSize);
diff --git a/engines/tot/tot.cpp b/engines/tot/tot.cpp
index 1ad90d5b426..0a678722170 100644
--- a/engines/tot/tot.cpp
+++ b/engines/tot/tot.cpp
@@ -124,12 +124,12 @@ int TotEngine::engineStart() {
_graphics->loadPaletteFromFile("DEFAULT");
initScreenPointers();
- // initialLogo();
+ initialLogo();
_sound->playMidi("INTRODUC", true);
_sound->setMidiVolume(3, 3);
firstIntroduction();
_mouse->warpMouse(1, _mouse->mouseX, _mouse->mouseY);
- // initialMenu(_firstTimeDone);
+ initialMenu(_firstTimeDone);
if (_startNewGame && !shouldQuit()) {
newGame();
} else if (_continueGame && !shouldQuit()) {
@@ -599,7 +599,7 @@ int TotEngine::startGame() {
void TotEngine::newGame() {
_saveAllowed = true;
_mouse->hide();
- // obtainName(_characterName);
+ obtainName(_characterName);
if (!shouldQuit()) {
_graphics->totalFadeOut(0);
@@ -620,11 +620,6 @@ void TotEngine::newGame() {
_graphics->loadPaletteFromFile("DEFAULT");
loadScreenData(1);
_graphics->sceneTransition(false, _sceneBackground, 13);
- // bool fade = false;
- // while(!g_engine->shouldQuit()){
- // _graphics->sceneTransition(fade, _sceneBackground, 13);
- // fade = !fade;
- // }
drawInventoryMask();
_inventoryPosition = 0;
drawInventory();
Commit: 1ca66ecb1a69f4394727e6e3bc14f3511478ed42
https://github.com/scummvm/scummvm/commit/1ca66ecb1a69f4394727e6e3bc14f3511478ed42
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:52+02:00
Commit Message:
TOT: Remove unnecessary logs
Changed paths:
engines/tot/forest.cpp
engines/tot/graphics.cpp
engines/tot/midi.cpp
engines/tot/routines.cpp
engines/tot/routines2.cpp
diff --git a/engines/tot/forest.cpp b/engines/tot/forest.cpp
index d3d4ddb6732..9d97ab0bf30 100644
--- a/engines/tot/forest.cpp
+++ b/engines/tot/forest.cpp
@@ -186,7 +186,6 @@ void readTree(Common::SeekableReadStream &stream, Tree &a, uint position) {
void readTree(Common::String f, Tree &a, uint offset) {
Common::File treeFile;
- debug("Filename = %s", f.c_str());
if (!treeFile.open(Common::Path(f))) {
showError(314);
}
diff --git a/engines/tot/graphics.cpp b/engines/tot/graphics.cpp
index 676a12edcb4..e0d5613de42 100644
--- a/engines/tot/graphics.cpp
+++ b/engines/tot/graphics.cpp
@@ -931,10 +931,7 @@ void effect15(bool fadeToBlack, byte *scene) {
}
void GraphicsManager::sceneTransition(bool fadeToBlack, byte *scene, byte effectNumber) {
-
- // bool enabled = false;
bool enabled = ConfMan.getBool("transitions_disable") == false;
- uint32 effectStartTime = g_system->getMillis();
// Disable effects for now
if (!enabled) {
if (!fadeToBlack) {
@@ -1034,7 +1031,6 @@ void GraphicsManager::sceneTransition(bool fadeToBlack, byte *scene, byte effect
}
}
updateSceneArea();
- debug("Effect finished in %u ms", g_system->getMillis() - effectStartTime);
}
void GraphicsManager::init() {
diff --git a/engines/tot/midi.cpp b/engines/tot/midi.cpp
index 0424f255934..f0c1154a162 100644
--- a/engines/tot/midi.cpp
+++ b/engines/tot/midi.cpp
@@ -156,7 +156,6 @@ void MidiPlayer::load(Common::SeekableReadStream *in, int32 size) {
in->read(*dataPtr, size);
parser->loadMusic(*dataPtr, size);
- debug("Successfully loaded Music");
}
void MidiPlayer::play(int track) {
diff --git a/engines/tot/routines.cpp b/engines/tot/routines.cpp
index a35e9aaf722..34d883a2998 100644
--- a/engines/tot/routines.cpp
+++ b/engines/tot/routines.cpp
@@ -750,7 +750,6 @@ RoomObjectListEntry *readRoomObjects(Common::SeekableReadStream *screenDataFile)
}
RoomFileRegister *TotEngine::readScreenDataFile(Common::SeekableReadStream *screenDataFile) {
- debug("reading screen data file!");
RoomFileRegister *screenData = new RoomFileRegister();
screenData->code = screenDataFile->readUint16LE();
screenData->roomImagePointer = screenDataFile->readUint32LE();
@@ -789,7 +788,6 @@ RoomFileRegister *TotEngine::readScreenDataFile(Common::SeekableReadStream *scre
}
void TotEngine::loadScreenData(uint screenNumber) {
- debug("Opening screen %d", screenNumber);
_currentRoomNumber = screenNumber;
_rooms->seek(screenNumber * kRoomRegSize, SEEK_SET);
@@ -3705,7 +3703,6 @@ void TotEngine::loadObjects() {
}
objectFile.close();
- debug("Successfully read objects!");
}
void TotEngine::obtainName(Common::String &playerName) {
@@ -4519,7 +4516,6 @@ void TotEngine::wcScene() {
void TotEngine::readConversationFile(Common::String f) {
Common::File conversationFile;
- debug("Filename = %s", f.c_str());
if (!conversationFile.open(Common::Path(f))) {
showError(314);
}
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
index c7cf7afdb57..4561ec69fa5 100644
--- a/engines/tot/routines2.cpp
+++ b/engines/tot/routines2.cpp
@@ -51,7 +51,6 @@ void TotEngine::loadAnimationForDirection(Common::SeekableReadStream *stream, in
}
void TotEngine::loadAnimation(Common::String animationName) {
- debug("Loading animation!");
Common::File animFile;
if (animationName == "PETER")
@@ -107,7 +106,6 @@ void TotEngine::loadAnimation(Common::String animationName) {
_mouseGridForSecondaryAnim[i][j] = _currentRoomData->mouseGrid[_oldposx + i][_oldposy + j];
}
_iframe2 = 0;
- debug("Finished loading animation!");
}
void TotEngine::readTextFile() {
Commit: 70f6f3b89cbe5a7dc7172bd7a44bb601eaf5c92d
https://github.com/scummvm/scummvm/commit/70f6f3b89cbe5a7dc7172bd7a44bb601eaf5c92d
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:52+02:00
Commit Message:
TOT: Remove unnecessary files
Changed paths:
R engines/tot/vars.cpp
R engines/tot/vars.h
engines/tot/anims.cpp
engines/tot/console.cpp
engines/tot/debug.cpp
engines/tot/dialog.cpp
engines/tot/graphics.cpp
engines/tot/module.mk
engines/tot/routines.cpp
engines/tot/routines2.cpp
engines/tot/saveload.cpp
engines/tot/tot.cpp
engines/tot/tot.h
diff --git a/engines/tot/anims.cpp b/engines/tot/anims.cpp
index 84703ae9b4c..393e2353f90 100644
--- a/engines/tot/anims.cpp
+++ b/engines/tot/anims.cpp
@@ -30,7 +30,6 @@
#include "tot/anims.h"
#include "tot/decoder/TotFlicDecoder.h"
#include "tot/graphics.h"
-#include "tot/vars.h"
#include "tot/statics.h"
#include "tot/tot.h"
#include "tot/util.h"
diff --git a/engines/tot/console.cpp b/engines/tot/console.cpp
index b3763e6e796..a294cf8d19d 100644
--- a/engines/tot/console.cpp
+++ b/engines/tot/console.cpp
@@ -20,7 +20,6 @@
*/
#include "tot/console.h"
-#include "tot/vars.h"
namespace Tot {
diff --git a/engines/tot/debug.cpp b/engines/tot/debug.cpp
index e8200c905bb..72fd4046fed 100644
--- a/engines/tot/debug.cpp
+++ b/engines/tot/debug.cpp
@@ -21,8 +21,7 @@
#include "tot/debug.h"
#include "tot/tot.h"
-#include "tot/vars.h"
-#include "debug.h"
+#include "tot/util.h"
namespace Tot {
diff --git a/engines/tot/dialog.cpp b/engines/tot/dialog.cpp
index 59bf9006706..4b23166cbd9 100644
--- a/engines/tot/dialog.cpp
+++ b/engines/tot/dialog.cpp
@@ -24,7 +24,6 @@
#include "tot/dialog.h"
#include "tot/tot.h"
-#include "tot/vars.h"
namespace Tot {
diff --git a/engines/tot/graphics.cpp b/engines/tot/graphics.cpp
index e0d5613de42..8d4d7f96fe9 100644
--- a/engines/tot/graphics.cpp
+++ b/engines/tot/graphics.cpp
@@ -30,7 +30,6 @@
#include "tot/statics.h"
#include "tot/tot.h"
#include "tot/util.h"
-#include "tot/vars.h"
namespace Tot {
diff --git a/engines/tot/module.mk b/engines/tot/module.mk
index 8bb6c5cafdd..1ad33c6c387 100644
--- a/engines/tot/module.mk
+++ b/engines/tot/module.mk
@@ -6,7 +6,6 @@ MODULE_OBJS = \
metaengine.o \
forest.o \
util.o \
- vars.o \
anims.o \
routines2.o \
routines.o \
diff --git a/engines/tot/routines.cpp b/engines/tot/routines.cpp
index 34d883a2998..55ac266c51d 100644
--- a/engines/tot/routines.cpp
+++ b/engines/tot/routines.cpp
@@ -26,7 +26,7 @@
#include "tot/debug.h"
#include "tot/statics.h"
#include "tot/tot.h"
-#include "tot/vars.h"
+#include "tot/util.h"
namespace Tot {
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
index 4561ec69fa5..60558b27396 100644
--- a/engines/tot/routines2.cpp
+++ b/engines/tot/routines2.cpp
@@ -34,7 +34,6 @@
#include "tot/statics.h"
#include "tot/tot.h"
#include "tot/util.h"
-#include "tot/vars.h"
namespace Tot {
@@ -1477,7 +1476,7 @@ void TotEngine::initialLogo() {
delay(1000);
}
-void TotEngine::initialMenu(bool fade) {
+void TotEngine::startMenu(bool fade) {
bool bar = false;
bool validOption = false;
_sound->stopVoc();
diff --git a/engines/tot/saveload.cpp b/engines/tot/saveload.cpp
index 2f2f3fd6813..455dbe084bf 100644
--- a/engines/tot/saveload.cpp
+++ b/engines/tot/saveload.cpp
@@ -27,7 +27,6 @@
#include "tot/forest.h"
#include "tot/tot.h"
-#include "tot/vars.h"
namespace Tot {
diff --git a/engines/tot/tot.cpp b/engines/tot/tot.cpp
index 0a678722170..d1a7ce2e980 100644
--- a/engines/tot/tot.cpp
+++ b/engines/tot/tot.cpp
@@ -35,7 +35,6 @@
#include "tot/debug.h"
#include "tot/dialog.h"
#include "tot/font/bgifont.h"
-#include "tot/vars.h"
#include "tot/sound.h"
#include "tot/tot.h"
#include "tot/util.h"
@@ -129,7 +128,7 @@ int TotEngine::engineStart() {
_sound->setMidiVolume(3, 3);
firstIntroduction();
_mouse->warpMouse(1, _mouse->mouseX, _mouse->mouseY);
- initialMenu(_firstTimeDone);
+ startMenu(_firstTimeDone);
if (_startNewGame && !shouldQuit()) {
newGame();
} else if (_continueGame && !shouldQuit()) {
@@ -474,7 +473,7 @@ int TotEngine::startGame() {
_graphics->clear();
_sound->playMidi("INTRODUC", true);
_sound->fadeInMusic();
- initialMenu(true);
+ startMenu(true);
verifyCopyProtection2();
if (_startNewGame && !shouldQuit()) {
diff --git a/engines/tot/tot.h b/engines/tot/tot.h
index 00aa0d44a59..215f6f56328 100644
--- a/engines/tot/tot.h
+++ b/engines/tot/tot.h
@@ -147,7 +147,7 @@ private:
void displayObjectDescription(Common::String text);
void copyProtection();
void initialLogo();
- void initialMenu(bool fade);
+ void startMenu(bool fade);
void exitToDOS();
void soundControls();
void sacrificeScene();
diff --git a/engines/tot/vars.cpp b/engines/tot/vars.cpp
deleted file mode 100644
index 05cee6670b6..00000000000
--- a/engines/tot/vars.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "common/file.h"
-#include "common/textconsole.h"
-
-#include "tot/chrono.h"
-#include "tot/vars.h"
-
-namespace Tot {
-
-
-
-} // End of namespace Tot
diff --git a/engines/tot/vars.h b/engines/tot/vars.h
deleted file mode 100644
index cc414b10aa9..00000000000
--- a/engines/tot/vars.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-#ifndef TOT_VARS_H
-#define TOT_VARS_H
-
-#include "common/file.h"
-#include "common/memstream.h"
-#include "common/scummsys.h"
-
-#include "tot/util.h"
-#include "tot/types.h"
-
-namespace Tot {
-
-
-} // End of namespace Tot
-#endif
Commit: bacb530485f2596c892c650a4dc43d982c4e945a
https://github.com/scummvm/scummvm/commit/bacb530485f2596c892c650a4dc43d982c4e945a
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:52+02:00
Commit Message:
TOT: Fixes crash when loading from main menu
Changed paths:
engines/tot/routines.cpp
engines/tot/routines2.cpp
engines/tot/tot.cpp
diff --git a/engines/tot/routines.cpp b/engines/tot/routines.cpp
index 55ac266c51d..4e90a34e6c9 100644
--- a/engines/tot/routines.cpp
+++ b/engines/tot/routines.cpp
@@ -3686,7 +3686,7 @@ void TotEngine::loadObjects() {
}
if (!objectFile.isOpen()) {
- debug("Object file exists? %d", objectFile.exists("OBJMOCH.DAT"));
+ debug("Object file exists? %d, open? %d", objectFile.exists("OBJMOCH.DAT"), objectFile.isOpen());
showError(312);
}
for (int i = 0; i < kInventoryIconCount; i++) {
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
index 60558b27396..57ef49b3626 100644
--- a/engines/tot/routines2.cpp
+++ b/engines/tot/routines2.cpp
@@ -1529,9 +1529,14 @@ void TotEngine::startMenu(bool fade) {
drawFlc(0, 0, offset, 0, 9, 0, true, false, false, bar);
}
} else if (x >= 18 && x <= 145) {
- _startNewGame = false;
- _continueGame = false;
- validOption = true;
+ _isSavingDisabled = true;
+ bool result = loadGameDialog();
+ _isSavingDisabled = false;
+ if(result) {
+ _startNewGame = false;
+ _continueGame = false;
+ validOption = true;
+ }
}
} else if (y > 174 && y < 190) {
if (x > 20 && x < 145) {
diff --git a/engines/tot/tot.cpp b/engines/tot/tot.cpp
index d1a7ce2e980..304cbc94667 100644
--- a/engines/tot/tot.cpp
+++ b/engines/tot/tot.cpp
@@ -134,9 +134,7 @@ int TotEngine::engineStart() {
} else if (_continueGame && !shouldQuit()) {
loadTemporaryGame();
} else {
- _isSavingDisabled = true;
- openMainMenuDialog();
- _isSavingDisabled = false;
+
}
return startGame();
Commit: a41fc929e32e87df399520e4f17f6dd75fcc5081
https://github.com/scummvm/scummvm/commit/a41fc929e32e87df399520e4f17f6dd75fcc5081
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:52+02:00
Commit Message:
TOT: Fixes occasional error due to GamePart not being initialized
Changed paths:
engines/tot/tot.h
diff --git a/engines/tot/tot.h b/engines/tot/tot.h
index 215f6f56328..d1508e43b63 100644
--- a/engines/tot/tot.h
+++ b/engines/tot/tot.h
@@ -248,7 +248,7 @@ public:
/**
* 1 first part, 2 second part
*/
- byte _gamePart;
+ byte _gamePart = 0;
/**
* Number of frames of secondary animation
*/
Commit: e979d4065b390338cb264b1a5ab331c7a2ed8791
https://github.com/scummvm/scummvm/commit/e979d4065b390338cb264b1a5ab331c7a2ed8791
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:52+02:00
Commit Message:
TOT: moves file reading into resources.cpp
Changed paths:
A engines/tot/cutscenes.cpp
A engines/tot/resources.cpp
engines/tot/chrono.cpp
engines/tot/dialog.cpp
engines/tot/midi.cpp
engines/tot/module.mk
engines/tot/routines.cpp
engines/tot/routines2.cpp
engines/tot/saveload.cpp
engines/tot/tot.cpp
engines/tot/tot.h
diff --git a/engines/tot/chrono.cpp b/engines/tot/chrono.cpp
index 2ff86606320..49de1639428 100644
--- a/engines/tot/chrono.cpp
+++ b/engines/tot/chrono.cpp
@@ -76,9 +76,6 @@ void ChronoManager::delay(int ms) {
uint32 delayStart = g_system->getMillis();
Common::Event e;
ms = ms / _speedMultiplier;
- if (ms > 10) {
- debug("Starting delay of %d", ms);
- }
while ((g_system->getMillis() - delayStart) < ms && !g_engine->shouldQuit()) {
while (g_system->getEventManager()->pollEvent(e)) {
}
diff --git a/engines/tot/cutscenes.cpp b/engines/tot/cutscenes.cpp
new file mode 100644
index 00000000000..8a9d312afdb
--- /dev/null
+++ b/engines/tot/cutscenes.cpp
@@ -0,0 +1,972 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/config-manager.h"
+
+#include "tot/anims.h"
+#include "tot/tot.h"
+#include "tot/util.h"
+
+namespace Tot {
+
+void drawCreditsScreen(byte *&backgroundPointer, uint &sizeAuxBG, byte *&auxBG) {
+ palette intermediatePalette, darkPalette;
+
+ Common::File ppFile;
+
+ if (!ppFile.open("DIPLOMA.PAN")) {
+ showError(315);
+ }
+ backgroundPointer = (byte *)malloc(64000);
+ ppFile.read(intermediatePalette, 768);
+ ppFile.read(backgroundPointer, 64000);
+ ppFile.close();
+
+ g_engine->_graphics->drawFullScreen(backgroundPointer);
+
+ sizeAuxBG = imagesize(0, 0, 319, 59);
+
+ // Screen is now backgroundPointer so auxBG contains a 320x60 crop of backgroundPointer
+ auxBG = (byte *)malloc(sizeAuxBG);
+ g_engine->_graphics->getImg(0, 0, 319, 59, auxBG);
+
+ for (int i = 0; i <= 255; i++) {
+ darkPalette[i * 3 + 0] = 0;
+ darkPalette[i * 3 + 1] = 0;
+ darkPalette[i * 3 + 2] = 0;
+ // Adjust for 6-bit DAC color
+ intermediatePalette[i * 3 + 0] <<= 2;
+ intermediatePalette[i * 3 + 1] <<= 2;
+ intermediatePalette[i * 3 + 2] <<= 2;
+ }
+
+ g_engine->_graphics->fadePalettes(darkPalette, intermediatePalette);
+ g_engine->_graphics->copyPalette(intermediatePalette, g_engine->_graphics->_pal);
+ if (g_engine->_cpCounter2 > 9)
+ showError(274);
+}
+
+void putCreditsImg(uint x, uint y, byte *img1, byte *img2, bool direct) {
+
+ uint16 wImg1, hImg1;
+ uint horizontalAux;
+ uint inc, inc2;
+ byte *step;
+
+ wImg1 = READ_LE_UINT16(img1);
+ hImg1 = READ_LE_UINT16(img1 + 2);
+
+ step = (byte *)malloc((wImg1 + 1) * (hImg1 + 1) + 4);
+
+ horizontalAux = wImg1 + 1;
+ uint yPos = hImg1 + y;
+
+ // makes sure that if the image is at the bottom of the screen we chop the bottom part
+ for (int i = yPos; i >= 200; i--)
+ hImg1 -= 1;
+
+ hImg1++;
+
+ // Copies the crop in the background corresponding to the current credit window in img1
+ for (int i = 0; i < hImg1; i++) {
+ byte *src = img2 + (320 * (y + i)) + x;
+ byte *dst = step + 4 + (horizontalAux * i);
+ Common::copy(src, src + horizontalAux, dst);
+ }
+
+ for (int kk = 0; kk < hImg1; kk++) {
+ inc2 = (kk * wImg1) + 4;
+ yPos = kk + y;
+ for (int jj = 0; jj <= wImg1; jj++) {
+ inc = inc2 + jj;
+ if ((direct && img1[inc] > 0) || (img1[inc] > 16 && yPos >= 66 && yPos <= 192)) {
+ step[inc] = img1[inc];
+ } else if (img1[inc] > 16) {
+ switch (yPos) {
+ case 59:
+ case 199:
+ step[inc] = img1[inc] + 210;
+ break;
+ case 60:
+ case 198:
+ step[inc] = img1[inc] + 180;
+ break;
+ case 61:
+ case 197:
+ step[inc] = img1[inc] + 150;
+ break;
+ case 62:
+ case 196:
+ step[inc] = img1[inc] + 120;
+ break;
+ case 63:
+ case 195:
+ step[inc] = img1[inc] + 90;
+ break;
+ case 64:
+ case 194:
+ step[inc] = img1[inc] + 60;
+ break;
+ case 65:
+ case 193:
+ step[inc] = img1[inc] + 30;
+ break;
+ }
+ }
+ }
+ }
+ // Wait until render tick
+ do {
+ g_engine->_chrono->updateChrono();
+ g_system->delayMillis(10);
+ } while (!gameTick && !g_engine->shouldQuit());
+ gameTick = false;
+
+ // Copies the credit window directly to the screen
+ for (int i = 0; i < hImg1; i++) {
+ byte *src = step + 4 + (horizontalAux * i);
+ byte *dst = ((byte *)g_engine->_screen->getPixels()) + (320 * (y + i)) + x;
+ Common::copy(src, src + horizontalAux, dst);
+ }
+ g_engine->_screen->addDirtyRect(Common::Rect(x, y, x + wImg1 + 1, y + hImg1 + 1));
+ free(step);
+}
+
+void scrollCredit(
+ int32 position,
+ uint size,
+ palette &pal2,
+ byte *&background,
+ bool &exit,
+ int minHeight,
+ bool withFade,
+ bool refresh) {
+ Common::File creditFile;
+ if (!creditFile.open("CREDITOS.DAT")) {
+ showError(270);
+ }
+ creditFile.seek(position);
+ creditFile.read(g_engine->_sceneBackground, size);
+ creditFile.read(pal2, 768);
+ creditFile.close();
+
+ for (int i = 16; i <= 255; i++) {
+ // Adjust for 6-bit DAC
+ pal2[i * 3 + 0] <<= 2;
+ pal2[i * 3 + 1] <<= 2;
+ pal2[i * 3 + 2] <<= 2;
+
+ g_engine->_graphics->_pal[i * 3 + 0] = pal2[i * 3 + 0];
+ g_engine->_graphics->_pal[i * 3 + 1] = pal2[i * 3 + 1];
+ g_engine->_graphics->_pal[i * 3 + 2] = pal2[i * 3 + 2];
+ }
+
+ g_engine->_graphics->setPalette(&g_engine->_graphics->_pal[16 * 3 + 0], 16, 240);
+ Common::Event e;
+ bool keyPressed = false;
+
+ // Loops an image from the bottom of the screen to the top
+ for (int i = 199; i >= minHeight; i--) {
+ while (g_system->getEventManager()->pollEvent(e)) {
+ if (e.type == Common::EVENT_KEYUP) {
+ keyPressed = true;
+ }
+ }
+ putCreditsImg(85, i, g_engine->_sceneBackground, background, !withFade);
+ if (keyPressed) {
+ exit = true;
+ break;
+ }
+ g_engine->_screen->update();
+ g_system->delayMillis(10);
+ if (g_engine->shouldQuit())
+ break;
+ }
+ if (refresh) {
+ g_engine->_graphics->copyFromScreen(background);
+ }
+}
+
+void scrollSingleCredit(
+ int32 pos,
+ uint size,
+ palette &pal2,
+ byte *&background,
+ bool &exit) {
+ scrollCredit(
+ pos,
+ size,
+ pal2,
+ background,
+ exit,
+ 8,
+ true,
+ false);
+}
+
+void removeTitle(byte *&background2) {
+ uint i2, j2;
+ Common::Event e;
+ for (int i1 = 1; i1 <= 15000; i1++) {
+ while (g_system->getEventManager()->pollEvent(e)) {
+ }
+ i2 = Random(318);
+ j2 = Random(58);
+ byte *src = background2 + 4 + (j2 * 320) + i2;
+ byte *dest = ((byte *)g_engine->_screen->getPixels()) + (j2 * 320) + i2;
+ Common::copy(src, src + 2, dest);
+
+ byte *src2 = background2 + 4 + ((j2 + 1) * 320) + i2;
+ byte *dest2 = ((byte *)g_engine->_screen->getPixels()) + ((j2 + 1) * 320) + i2;
+
+ Common::copy(src2, src2 + 2, dest2);
+
+ i2 = Random(320);
+ j2 = Random(60);
+
+ byte *src3 = background2 + 4 + (j2 * 320) + i2;
+ byte *dest3 = ((byte *)g_engine->_screen->getPixels()) + (j2 * 320) + i2;
+ Common::copy(src3, src3 + 1, dest3);
+ if (i1 % 200 == 0) {
+ g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 60));
+ g_engine->_screen->update();
+ }
+ if (g_engine->shouldQuit()) {
+ break;
+ }
+ }
+ g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 60));
+ g_engine->_screen->update();
+}
+
+inline bool keyPressed() {
+ Common::Event e;
+ g_system->getEventManager()->pollEvent(e);
+ return e.type == Common::EVENT_KEYUP;
+}
+
+void TotEngine::credits() {
+ _saveAllowed = true;
+ debug("Credits");
+ palette pal2;
+ byte *background;
+ byte *background2;
+ uint sizeBg2;
+ bool exit;
+
+ _mouse->hide();
+ _graphics->totalFadeOut(0);
+ _sound->fadeOutMusic();
+ _screen->clear();
+ _sound->playMidi("CREDITOS", true);
+ _sound->fadeInMusic();
+ drawCreditsScreen(background, sizeBg2, background2);
+
+ exit = false;
+
+ if (keyPressed() || exit)
+ goto Lexit;
+ scrollCredit(0, 8004, pal2, background, exit, 10, false, true);
+ if (keyPressed() || exit)
+ goto Lexit;
+ scrollSingleCredit(8772, 8004, pal2, background, exit);
+ if (keyPressed() || exit)
+ goto Lexit;
+ scrollSingleCredit(17544, 8004, pal2, background, exit);
+ if (keyPressed() || exit)
+ goto Lexit;
+ scrollSingleCredit(26316, 7504, pal2, background, exit);
+ if (keyPressed() || exit)
+ goto Lexit;
+ scrollSingleCredit(34588, 7504, pal2, background, exit);
+ if (keyPressed() || exit)
+ goto Lexit;
+ scrollSingleCredit(42860, 8004, pal2, background, exit);
+ if (keyPressed() || exit)
+ goto Lexit;
+ scrollSingleCredit(51632, 7504, pal2, background, exit);
+ if (keyPressed() || exit)
+ goto Lexit;
+ removeTitle(background2);
+ if (keyPressed() || exit)
+ goto Lexit;
+ _graphics->putImg(0, 0, background2);
+ if (keyPressed() || exit)
+ goto Lexit;
+ _graphics->copyFromScreen(background);
+ if (keyPressed() || exit)
+ goto Lexit;
+ scrollCredit(59904, 8004, pal2, background, exit, 10, false, true);
+ if (keyPressed() || exit)
+ goto Lexit;
+ scrollSingleCredit(68676, 8004, pal2, background, exit);
+ if (keyPressed() || exit)
+ goto Lexit;
+ scrollSingleCredit(77448, 8004, pal2, background, exit);
+ if (keyPressed() || exit)
+ goto Lexit;
+ scrollSingleCredit(86220, 8004, pal2, background, exit);
+ if (keyPressed() || exit)
+ goto Lexit;
+ scrollSingleCredit(94992, 8004, pal2, background, exit);
+ if (keyPressed() || exit)
+ goto Lexit;
+ scrollSingleCredit(103764, 8004, pal2, background, exit);
+ if (keyPressed() || exit)
+ goto Lexit;
+ scrollSingleCredit(112536, 8004, pal2, background, exit);
+ if (keyPressed() || exit)
+ goto Lexit;
+ removeTitle(background2);
+ if (keyPressed() || exit)
+ goto Lexit;
+ _graphics->putImg(0, 0, background2);
+ if (keyPressed() || exit)
+ goto Lexit;
+ _graphics->copyFromScreen(background);
+ if (keyPressed() || exit)
+ goto Lexit;
+ scrollCredit(121308, 8004, pal2, background, exit, 80, false, true);
+Lexit:
+ delay(1000);
+ _graphics->totalFadeOut(0);
+ _sound->fadeOutMusic();
+ _screen->clear();
+ _sound->playMidi("INTRODUC", true);
+ _sound->fadeInMusic();
+ _mouse->show();
+ free(background);
+ free(background2);
+}
+
+void TotEngine::introduction() {
+ _saveAllowed = false;
+ _mouse->hide();
+ bool exitPressed;
+ uint loopCount;
+ bool isSpanish = _lang == Common::ES_ESP;
+ const char *const *messages = (isSpanish) ? fullScreenMessages[0] : fullScreenMessages[1];
+ const long *offsets = (_lang == Common::ES_ESP) ? flcOffsets[0] : flcOffsets[1];
+ exitPressed = false;
+ _graphics->totalFadeOut(0);
+
+ if (_cpCounter > 6)
+ showError(270);
+ _screen->clear();
+ drawFlc(136, 53, offsets[2], 136, 9, 1, true, true, false, exitPressed);
+ if (exitPressed)
+ goto Lsalirpres;
+ drawFlc(135, 54, offsets[3], 0, 9, 2, true, true, false, exitPressed);
+ if (exitPressed)
+ goto Lsalirpres;
+ _graphics->totalFadeOut(0);
+ _screen->clear();
+ if (isSpanish) {
+ littText(25, 20, messages[0], 253);
+ littText(25, 35, messages[1], 253);
+ littText(25, 50, messages[2], 253);
+ littText(25, 65, messages[3], 253);
+ littText(25, 80, messages[4], 253);
+ littText(25, 95, messages[5], 253);
+ littText(25, 120, messages[6], 253);
+ littText(25, 140, messages[7], 253);
+ littText(25, 155, messages[8], 253);
+ } else {
+ littText(25, 35, messages[0], 253);
+ littText(25, 55, messages[1], 253);
+ littText(25, 75, messages[2], 253);
+ littText(25, 95, messages[3], 253);
+ littText(25, 115, messages[4], 253);
+ littText(25, 135, messages[5], 253);
+ }
+ if (shouldQuit()) {
+ return;
+ }
+ _graphics->totalFadeIn(0, "DEFAULT");
+ _screen->markAllDirty();
+ _screen->update();
+ loopCount = 0;
+
+ do {
+ _chrono->updateChrono();
+ Common::Event e;
+ g_system->getEventManager()->pollEvent(e);
+ if (e.type == Common::EVENT_KEYDOWN || e.type == Common::EVENT_LBUTTONUP) {
+ goto Lsalirpres;
+ }
+
+ if (gameTick) {
+ loopCount += 1;
+ }
+ g_system->delayMillis(10);
+ } while (loopCount < 180 && !shouldQuit());
+
+ _graphics->totalFadeOut(0);
+ _screen->clear();
+ drawFlc(0, 0, offsets[4], 0, 9, 3, true, true, false, exitPressed);
+ if (exitPressed)
+ goto Lsalirpres;
+ drawFlc(110, 30, offsets[5], 2, 9, 4, false, true, false, exitPressed);
+ if (exitPressed)
+ goto Lsalirpres;
+ drawFlc(110, 30, offsets[6], 3, 9, 5, false, true, false, exitPressed);
+ if (exitPressed)
+ goto Lsalirpres;
+ drawFlc(110, 30, offsets[7], 0, 9, 0, false, true, false, exitPressed);
+ if (exitPressed)
+ goto Lsalirpres;
+ drawFlc(110, 30, offsets[8], isSpanish ? 4 : 8, 9, 6, false, true, false, exitPressed);
+ if (exitPressed)
+ goto Lsalirpres;
+ drawFlc(110, 30, offsets[9], 3, 9, 7, false, true, false, exitPressed);
+ if (exitPressed)
+ goto Lsalirpres;
+ drawFlc(110, 30, offsets[8], isSpanish ? 3 : 8, 9, 8, false, true, false, exitPressed);
+ if (exitPressed)
+ goto Lsalirpres;
+ drawFlc(110, 30, offsets[9], 2, 9, 9, false, true, false, exitPressed);
+ if (exitPressed)
+ goto Lsalirpres;
+ drawFlc(0, 0, offsets[10], 0, 9, 0, false, true, false, exitPressed);
+ if (exitPressed)
+ goto Lsalirpres;
+ drawFlc(235, 100, offsets[11], 3, 9, 10, false, true, false, exitPressed);
+ if (exitPressed)
+ goto Lsalirpres;
+ drawFlc(150, 40, offsets[12], 0, 9, 11, false, true, false, exitPressed);
+ if (exitPressed)
+ goto Lsalirpres;
+ drawFlc(235, 100, offsets[11], 3, 9, 12, false, true, false, exitPressed);
+ if (exitPressed)
+ goto Lsalirpres;
+ drawFlc(150, 40, offsets[12], isSpanish ? 0 : 2, 9, 13, false, true, false, exitPressed);
+ if (exitPressed)
+ goto Lsalirpres;
+ drawFlc(235, 100, offsets[11], isSpanish ? 3 : 8, 9, 14, false, true, false, exitPressed);
+ if (exitPressed)
+ goto Lsalirpres;
+ drawFlc(150, 40, offsets[12], 0, 9, 15, false, true, false, exitPressed);
+ if (exitPressed)
+ goto Lsalirpres;
+ drawFlc(173, 98, offsets[13], 0, 9, 0, false, true, false, exitPressed);
+ if (exitPressed)
+ goto Lsalirpres;
+ drawFlc(224, 100, offsets[14], 2, 9, 16, false, true, false, exitPressed);
+ if (exitPressed)
+ goto Lsalirpres;
+ drawFlc(0, 0, offsets[15], 0, 18, 17, false, true, false, exitPressed);
+ if (exitPressed)
+ goto Lsalirpres;
+ drawFlc(150, 40, offsets[16], 0, 9, 18, false, true, false, exitPressed);
+ if (exitPressed)
+ goto Lsalirpres;
+ delay(1000);
+Lsalirpres:
+ debug("Exiting intro!");
+ _graphics->totalFadeOut(0);
+ _screen->clear();
+ _mouse->show();
+}
+
+void TotEngine::firstIntroduction() {
+ if (!_firstTimeDone && !_isIntroSeen) {
+ introduction();
+ _firstTimeDone = true;
+ ConfMan.setBool("introSeen", true);
+ ConfMan.flushToDisk();
+ }
+}
+
+void TotEngine::initialLogo() {
+ bool foobar = false;
+ long offset = (_lang == Common::ES_ESP) ? flcOffsets[0][0] : flcOffsets[1][0];
+ drawFlc(0, 0, offset, 0, 18, 25, false, false, false, foobar);
+ delay(1000);
+}
+
+void TotEngine::sacrificeScene() {
+ _saveAllowed = false;
+ palette palaux;
+
+ Common::File file;
+ bool isSpanish = (_lang == Common::ES_ESP);
+ const char *const *messages = (isSpanish) ? fullScreenMessages[0] : fullScreenMessages[1];
+
+ const long *offsets = (isSpanish) ? flcOffsets[0] : flcOffsets[1];
+
+ _sound->stopVoc();
+ bool exitPressed = _currentRoomData->paletteAnimationFlag;
+ _currentRoomData->paletteAnimationFlag = false;
+
+ bar(0, 139, 319, 149, 0);
+ bar(10, 10, 310, 120, 0);
+ if (isSpanish) {
+ littText(10, 10, messages[9], 200);
+ littText(10, 30, messages[10], 200);
+ littText(10, 50, messages[11], 200);
+ littText(10, 70, messages[12], 200);
+ littText(10, 90, messages[13], 200);
+ } else {
+ littText(10, 20, messages[9], 200);
+ littText(10, 40, messages[10], 200);
+ littText(10, 60, messages[11], 200);
+ littText(10, 80, messages[12], 200);
+ littText(10, 100, messages[13], 200);
+ }
+
+ for (int i = 0; i <= 28; i++)
+ setRGBPalette(200, i * 2, i * 2, i * 2);
+
+ delay(10000);
+ if (shouldQuit())
+ return;
+
+ for (int i = 28; i >= 0; i--)
+ setRGBPalette(200, i * 2, i * 2, i * 2);
+
+ bar(10, 10, 310, 120, 0);
+ if (isSpanish) {
+ littText(10, 10, messages[14], 200);
+ littText(10, 30, messages[15], 200);
+ littText(10, 50, messages[16], 200);
+ littText(10, 70, messages[17], 200);
+ littText(10, 90, messages[18], 200);
+ } else {
+ littText(10, 20, messages[14], 200);
+ littText(10, 40, messages[15], 200);
+ littText(10, 60, messages[16], 200);
+ littText(10, 80, messages[17], 200);
+ }
+
+ for (int i = 0; i <= 28; i++)
+ setRGBPalette(200, i * 2, i * 2, i * 2);
+ delay(10000);
+ if (shouldQuit())
+ return;
+
+ for (int i = 28; i >= 0; i--)
+ setRGBPalette(200, i * 2, i * 2, i * 2);
+
+ bar(10, 10, 310, 120, 0);
+ if (isSpanish) {
+ littText(10, 10, messages[19], 200);
+ littText(10, 50, messages[20], 200);
+ littText(10, 70, messages[21], 200);
+ littText(10, 90, messages[22], 200);
+ } else {
+ littText(10, 30, messages[19], 200);
+ littText(10, 60, messages[20], 200);
+ littText(10, 80, messages[21], 200);
+ }
+
+ for (int i = 0; i <= 28; i++)
+ setRGBPalette(200, i * 2, i * 2, i * 2);
+ delay(10000);
+ if (shouldQuit())
+ return;
+
+ for (int i = 28; i >= 0; i--)
+ setRGBPalette(200, i * 2, i * 2, i * 2);
+ bar(10, 10, 310, 120, 0);
+
+ if (!file.open("SALONREC.PAN")) {
+ showError(318);
+ }
+ file.read(palaux, 768);
+ file.read(_sceneBackground, 44800);
+ file.close();
+
+ g_engine->_graphics->_pal[0] = 0;
+ g_engine->_graphics->_pal[1] = 0;
+ g_engine->_graphics->_pal[2] = 0;
+ for (int i = 1; i <= 234; i++) {
+ g_engine->_graphics->_pal[i * 3 + 1] = palaux[i * 3 + 1] << 2;
+ g_engine->_graphics->_pal[i * 3 + 2] = palaux[i * 3 + 2] << 2;
+ g_engine->_graphics->_pal[i * 3 + 3] = palaux[i * 3 + 3] << 2;
+ }
+
+ // We dont have the width and height here in the byte buffer
+ _graphics->drawScreen(_sceneBackground, false);
+ _graphics->partialFadeIn(234);
+ _sound->stopVoc();
+
+ if (shouldQuit())
+ return;
+
+ drawFlc(0, 0, offsets[17], 0, 9, 19, false, false, true, exitPressed);
+ _graphics->totalFadeOut(128);
+ _sound->stopVoc();
+ delay(1000);
+ if (shouldQuit())
+ return;
+
+ _sound->fadeOutMusic();
+ _sound->playMidi("SACRIFIC", true);
+ _sound->fadeInMusic();
+ _graphics->clear();
+
+ littText(10, 31, messages[23], 254);
+ littText(10, 29, messages[23], 254);
+ littText(11, 30, messages[23], 254);
+ littText(9, 30, messages[23], 254);
+
+ littText(10, 51, messages[24], 254);
+ littText(10, 49, messages[24], 254);
+ littText(11, 50, messages[24], 254);
+ littText(9, 50, messages[24], 254);
+
+ littText(10, 71, messages[25], 254);
+ littText(10, 69, messages[25], 254);
+ littText(11, 70, messages[25], 254);
+ littText(9, 70, messages[25], 254);
+
+ littText(10, 30, messages[23], 255);
+ littText(10, 50, messages[24], 255);
+ littText(10, 70, messages[25], 255);
+
+ for (int i = 0; i < 32; i++) {
+ setRGBPalette(255, 32 + i, i * 2, i * 2);
+ setRGBPalette(254, 32 - i, 0, 0);
+ }
+
+ delay(10000);
+ if (shouldQuit())
+ return;
+
+ for (int i = 32; i > 0; i--) {
+ setRGBPalette(255, 63 - (32 - i), i * 2, i * 2);
+ setRGBPalette(254, 32 - i, 0, 0);
+ }
+ delay(2000);
+
+ if (!file.open("SACRIFIC.PAN")) {
+ showError(318);
+ }
+ file.read(palaux, 768);
+
+ for (int i = 0; i < 256; i++) {
+ palaux[i * 3 + 0] <<= 2;
+ palaux[i * 3 + 1] <<= 2;
+ palaux[i * 3 + 2] <<= 2;
+ }
+
+ file.read(_sceneBackground, 64000);
+ file.close();
+ _graphics->drawFullScreen(_sceneBackground);
+
+ palaux[0] = 0;
+ palaux[1] = 0;
+ palaux[2] = 0;
+
+ _graphics->redFadeIn(palaux);
+
+ drawFlc(112, 57, offsets[18], 33, 9, 20, true, false, true, exitPressed);
+ _sound->autoPlayVoc("REZOS", 0, 0);
+ if (shouldQuit())
+ return;
+
+ drawFlc(42, 30, offsets[19], 0, 9, 27, false, false, false, exitPressed);
+
+ if (shouldQuit())
+ return;
+
+ _graphics->totalFadeOut(128);
+ _sound->stopVoc();
+ _graphics->clear();
+
+ littText(10, 21, messages[26], 254);
+ littText(10, 19, messages[26], 254);
+ littText(11, 20, messages[26], 254);
+ littText(9, 20, messages[26], 254);
+
+ littText(10, 41, messages[27], 254);
+ littText(10, 39, messages[27], 254);
+ littText(11, 40, messages[27], 254);
+ littText(9, 40, messages[27], 254);
+
+ littText(10, 61, messages[28], 254);
+ littText(10, 59, messages[28], 254);
+ littText(11, 60, messages[28], 254);
+ littText(9, 60, messages[28], 254);
+
+ littText(10, 81, messages[29], 254);
+ littText(10, 79, messages[29], 254);
+ littText(11, 80, messages[29], 254);
+ littText(9, 80, messages[29], 254);
+
+ littText(10, 101, messages[30], 254);
+ littText(10, 99, messages[30], 254);
+ littText(11, 100, messages[30], 254);
+ littText(9, 100, messages[30], 254);
+
+ littText(10, 121, messages[31], 254);
+ littText(10, 119, messages[31], 254);
+ littText(11, 120, messages[31], 254);
+ littText(9, 120, messages[31], 254);
+
+ littText(10, 141, messages[32], 254);
+ littText(10, 139, messages[32], 254);
+ littText(11, 140, messages[32], 254);
+ littText(9, 140, messages[32], 254);
+
+ if (!isSpanish) {
+ littText(10, 161, messages[56], 254);
+ littText(10, 159, messages[56], 254);
+ littText(11, 160, messages[56], 254);
+ littText(9, 160, messages[56], 254);
+
+ littText(10, 181, messages[57], 254);
+ littText(10, 179, messages[57], 254);
+ littText(11, 180, messages[57], 254);
+ littText(9, 180, messages[57], 254);
+ }
+
+ littText(10, 20, messages[26], 255);
+ littText(10, 40, messages[27], 255);
+ littText(10, 60, messages[28], 255);
+ littText(10, 80, messages[29], 255);
+ littText(10, 100, messages[30], 255);
+ littText(10, 120, messages[31], 255);
+ littText(10, 140, messages[32], 255);
+
+ if (!isSpanish) {
+ littText(10, 160, messages[56], 255);
+ littText(10, 180, messages[57], 255);
+ }
+
+ for (int i = 0; i <= 31; i++) {
+ setRGBPalette(255, 32 + i, i * 2, i * 2);
+ setRGBPalette(254, 32 - i, 0, 0);
+ }
+ delay(16000);
+ if (shouldQuit())
+ return;
+
+ for (int i = 31; i >= 0; i--) {
+ setRGBPalette(255, 63 - (32 - i), i * 2, i * 2);
+ setRGBPalette(254, 32 - i, 0, 0);
+ }
+ delay(2000);
+ if (shouldQuit())
+ return;
+
+ _graphics->clear();
+
+ littText(10, 21, messages[33], 254);
+ littText(10, 19, messages[33], 254);
+ littText(11, 20, messages[33], 254);
+ littText(9, 20, messages[33], 254);
+
+ littText(10, 41, messages[34], 254);
+ littText(10, 39, messages[34], 254);
+ littText(11, 40, messages[34], 254);
+ littText(9, 40, messages[34], 254);
+
+ littText(10, 61, messages[35], 254);
+ littText(10, 59, messages[35], 254);
+ littText(11, 60, messages[35], 254);
+ littText(9, 60, messages[35], 254);
+ if (isSpanish) {
+ littText(10, 81, messages[36], 254);
+ littText(10, 79, messages[36], 254);
+ littText(11, 80, messages[36], 254);
+ littText(9, 80, messages[36], 254);
+
+ littText(10, 101, messages[37], 254);
+ littText(10, 99, messages[37], 254);
+ littText(11, 100, messages[37], 254);
+ littText(9, 100, messages[37], 254);
+
+ littText(10, 121, messages[38], 254);
+ littText(10, 119, messages[38], 254);
+ littText(11, 120, messages[38], 254);
+ littText(9, 120, messages[38], 254);
+
+ littText(10, 141, messages[39], 254);
+ littText(10, 139, messages[39], 254);
+ littText(11, 140, messages[39], 254);
+ littText(9, 140, messages[39], 254);
+ }
+
+ littText(10, 20, messages[33], 255);
+ littText(10, 40, messages[34], 255);
+ littText(10, 60, messages[35], 255);
+ if (isSpanish) {
+ littText(10, 80, messages[36], 255);
+ littText(10, 100, messages[37], 255);
+ littText(10, 120, messages[38], 255);
+ littText(10, 140, messages[39], 255);
+ }
+
+ for (int i = 0; i < 32; i++) {
+ setRGBPalette(255, 32 + i, i * 2, i * 2);
+ setRGBPalette(254, 32 - i, 0, 0);
+ }
+ delay(13000);
+ if (shouldQuit())
+ return;
+
+ for (int i = 32; i > 0; i--) {
+ setRGBPalette(255, 63 - (32 - i), i * 2, i * 2);
+ setRGBPalette(254, 32 - i, 0, 0);
+ }
+ delay(2000);
+ if (shouldQuit())
+ return;
+ _graphics->clear();
+
+ littText(10, 61, messages[40], 254);
+ littText(10, 59, messages[40], 254);
+ littText(11, 60, messages[40], 254);
+ littText(9, 60, messages[40], 254);
+
+ littText(10, 81, messages[41], 254);
+ littText(10, 79, messages[41], 254);
+ littText(11, 80, messages[41], 254);
+ littText(9, 80, messages[41], 254);
+
+ littText(10, 101, messages[42], 254);
+ littText(10, 99, messages[42], 254);
+ littText(11, 100, messages[42], 254);
+ littText(9, 100, messages[42], 254);
+
+ littText(10, 60, messages[40], 255);
+ littText(10, 80, messages[41], 255);
+ littText(10, 100, messages[42], 255);
+
+ for (int i = 0; i < 32; i++) {
+ setRGBPalette(255, 32 + i, i * 2, i * 2);
+ setRGBPalette(254, 32 - i, 0, 0);
+ }
+ delay(7000);
+ if (shouldQuit())
+ return;
+ for (int i = 32; i > 0; i--) {
+ setRGBPalette(255, 63 - (32 - i), i * 2, i * 2);
+ setRGBPalette(254, 32 - i, 0, 0);
+ }
+ delay(2000);
+ _graphics->totalFadeOut(0);
+ _currentRoomData->paletteAnimationFlag = exitPressed;
+ _saveAllowed = true;
+}
+
+void TotEngine::ending() {
+ _saveAllowed = false;
+ bool exitRequested;
+
+ const char *const *messages = (_lang == Common::ES_ESP) ? fullScreenMessages[0] : fullScreenMessages[1];
+ const long *offsets = (_lang == Common::ES_ESP) ? flcOffsets[0] : flcOffsets[1];
+
+ littText(10, 41, messages[43], 249);
+ littText(10, 39, messages[43], 249);
+ littText(11, 40, messages[43], 249);
+ littText(9, 40, messages[43], 249);
+
+ littText(10, 61, messages[44], 249);
+ littText(10, 59, messages[44], 249);
+ littText(11, 60, messages[44], 249);
+ littText(9, 60, messages[44], 249);
+
+ littText(10, 40, messages[43], 253);
+ littText(10, 60, messages[44], 253);
+ if (shouldQuit()) {
+ return;
+ }
+ delay(4000);
+ _graphics->totalFadeOut(0);
+ _graphics->clear();
+ if (shouldQuit()) {
+ return;
+ }
+ _sound->fadeOutMusic();
+ _sound->playMidi("SACRIFIC", true);
+ _sound->fadeInMusic();
+ drawFlc(0, 0, offsets[30], 12, 9, 26, true, false, false, exitRequested);
+ if (exitRequested) {
+ return;
+ }
+ drawFlc(0, 0, offsets[31], 0, 9, 0, false, false, false, exitRequested);
+ if (exitRequested) {
+ return;
+ }
+ delay(1000);
+ _sound->playVoc("NOOO", 0, 0);
+ delay(3000);
+ _saveAllowed = true;
+}
+
+void TotEngine::wcScene() {
+ palette wcPalette;
+ _currentZone = _currentRoomData->walkAreasGrid[(_characterPosX + kCharacterCorrectionX) / kXGridCount][(_characterPosY + kCharacerCorrectionY) / kYGridCount];
+ goToObject(_currentZone, _targetZone);
+
+ _graphics->copyPalette(g_engine->_graphics->_pal, wcPalette);
+ _mouse->hide();
+
+ _graphics->partialFadeOut(234);
+
+ const char *const *messages = (_lang == Common::ES_ESP) ? fullScreenMessages[0] : fullScreenMessages[1];
+
+ littText(10, 20, messages[45], 253);
+ delay(1000);
+
+ bar(10, 20, 150, 30, 0);
+ delay(2000);
+
+ littText(100, 50, messages[46], 255);
+ delay(1000);
+
+ bar(100, 50, 250, 60, 0);
+ delay(2000);
+
+ littText(30, 110, messages[47], 253);
+ delay(1000);
+
+ bar(30, 110, 210, 120, 0);
+ delay(3000);
+
+ littText(50, 90, messages[48], 248);
+ delay(1000);
+
+ _sound->playVoc("WATER", 272050, 47062);
+ bar(50, 90, 200, 100, 0);
+ delay(4000);
+
+ _characterPosX = 76 - kCharacterCorrectionX;
+ _characterPosY = 78 - kCharacerCorrectionY;
+ _graphics->copyPalette(wcPalette, g_engine->_graphics->_pal);
+ _graphics->restoreBackground();
+ assembleScreen();
+ _graphics->drawScreen(_sceneBackground);
+ _graphics->partialFadeIn(234);
+ _xframe2 = 0;
+ _currentTrajectoryIndex = 0;
+ _trajectoryLength = 1;
+ _currentZone = 8;
+ _targetZone = 8;
+ _trajectory[0].x = _characterPosX;
+ _trajectory[0].y = _characterPosY;
+
+ _mouse->show();
+}
+
+} // End of namespace Tot
diff --git a/engines/tot/dialog.cpp b/engines/tot/dialog.cpp
index 4b23166cbd9..dd50ebe08e2 100644
--- a/engines/tot/dialog.cpp
+++ b/engines/tot/dialog.cpp
@@ -465,7 +465,7 @@ void talk(byte characterIndex) {
while (l1 != linkedList->end() && !g_engine->shouldQuit()) {
g_engine->_verbFile.seek(kVerbRegSize * (*l1));
conversationIndex += 1;
- text = g_engine->readVerbRegister();
+ text = g_engine->readTextRegister();
insertName = 0;
conversationMatrix[conversationIndex] = decrypt(text.text);
@@ -566,7 +566,7 @@ void talkToSceneObject() {
return;
// verifyCopyProtection2();
- g_engine->readItemRegister(sceneObject);
+ g_engine->readObject(sceneObject);
g_engine->goToObject(g_engine->_currentRoomData->walkAreasGrid[(g_engine->_characterPosX + kCharacterCorrectionX) / kXGridCount][(g_engine->_characterPosY + kCharacerCorrectionY) / kYGridCount],
g_engine->_currentRoomData->walkAreasGrid[correctedMouseX][correctedMouseY]);
diff --git a/engines/tot/midi.cpp b/engines/tot/midi.cpp
index f0c1154a162..0724923fed4 100644
--- a/engines/tot/midi.cpp
+++ b/engines/tot/midi.cpp
@@ -81,7 +81,6 @@ int MidiPlayer::open() {
_parserMusic->setMidiDriver(_driver);
_parserMusic->setTimerRate(_driver->getBaseTempo());
_driver->setTimerCallback(this, &onTimer);
- debug("Successfully opened driver");
return 0;
}
@@ -199,7 +198,6 @@ void MidiDriver_AdLib::loadInstrumentBankFromDriver(long offset) {
}
void MidiDriver_AdLib::loadInstrumentBank(uint8 *instrumentBankData) {
- debug("Load instrument bank!");
for (int i = 0; i < 128; i++) {
AdLibIbkInstrumentDefinition instrument;
@@ -227,7 +225,6 @@ void MidiDriver_AdLib::loadInstrumentBank(uint8 *instrumentBankData) {
instrument.padding2 = *instrumentBankData++;
instrument.toOplInstrumentDefinition(_dsfInstrumentBank[i]);
}
- debug("Loaded instrument bank!");
}
} // End of namespace Tot
diff --git a/engines/tot/module.mk b/engines/tot/module.mk
index 1ad33c6c387..0decf393a48 100644
--- a/engines/tot/module.mk
+++ b/engines/tot/module.mk
@@ -19,7 +19,9 @@ MODULE_OBJS = \
chrono.o \
saveload.o \
midi.o \
- debug.o
+ debug.o \
+ cutscenes.o \
+ resources.o
# This module can be built as a plugin
ifeq ($(ENABLE_TOT), DYNAMIC_PLUGIN)
diff --git a/engines/tot/resources.cpp b/engines/tot/resources.cpp
new file mode 100644
index 00000000000..6bfc040823b
--- /dev/null
+++ b/engines/tot/resources.cpp
@@ -0,0 +1,395 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "tot/tot.h"
+#include "tot/util.h"
+
+namespace Tot {
+
+void TotEngine::readBitmap(int32 bitmapPosition, byte *buf, uint bitmapSize, uint error) {
+ Common::File bitmapFile;
+ if (!bitmapFile.open("BITMAPS.DAT")) {
+ showError(error);
+ }
+ bitmapFile.seek(bitmapPosition);
+ bitmapFile.read(buf, bitmapSize);
+
+ bitmapFile.close();
+}
+
+void TotEngine::loadCharAnimation() {
+ Common::File characterFile;
+ _cpCounter = _cpCounter2;
+ if (!characterFile.open("PERSONAJ.SPT"))
+ showError(265);
+
+ _mainCharFrameSize = characterFile.readUint16LE();
+
+ verifyCopyProtection();
+
+ for (int i = 0; i <= 3; i++)
+ for (int j = 0; j < kWalkFrameCount; j++) {
+ _mainCharAnimation.bitmap[i][j] = (byte *)malloc(_mainCharFrameSize);
+ characterFile.read(_mainCharAnimation.bitmap[i][j], _mainCharFrameSize);
+ }
+ for (int i = 0; i < 4; i++)
+ for (int j = kWalkFrameCount; j < (kWalkFrameCount + 10 * 3); j++) {
+ _mainCharAnimation.bitmap[i][j] = (byte *)malloc(_mainCharFrameSize);
+ characterFile.read(_mainCharAnimation.bitmap[i][j], _mainCharFrameSize);
+ }
+ characterFile.close();
+}
+
+void TotEngine::readTextFile() {
+ if (!_verbFile.open("CONVERSA.TXT")) {
+ showError(313);
+ }
+}
+
+TextEntry TotEngine::readTextRegister(uint numRegister) {
+ _verbFile.seek(numRegister * kVerbRegSize);
+ return readTextRegister();
+}
+
+TextEntry TotEngine::readTextRegister() {
+ TextEntry regmht;
+ // Since the text is encrypted it's safer to save the size as reported by
+ // the pascal string, because the encrypter character might be the termination
+ // character
+ byte size = _verbFile.readByte();
+ _verbFile.seek(-1, SEEK_CUR);
+ regmht.text = _verbFile.readPascalString(false);
+ _verbFile.skip(255 - size);
+ regmht.continued = _verbFile.readByte();
+ regmht.response = _verbFile.readUint16LE();
+ regmht.pointer = _verbFile.readSint32LE();
+ return regmht;
+}
+
+void TotEngine::readConversationFile() {
+ Common::File conversationFile;
+ if (!conversationFile.open(Common::Path(Common::String("CONVERSA.TRE")))) {
+ showError(314);
+ }
+ int64 fileSize = conversationFile.size();
+ byte *buf = (byte *)malloc(fileSize);
+ conversationFile.read(buf, fileSize);
+
+ _conversationData = new Common::MemorySeekableReadWriteStream(buf, fileSize, DisposeAfterUse::NO);
+ conversationFile.close();
+}
+
+void saveDoorMetadata(DoorRegistry doors, Common::SeekableWriteStream *screenDataStream) {
+ screenDataStream->writeUint16LE(doors.nextScene);
+ screenDataStream->writeUint16LE(doors.exitPosX);
+ screenDataStream->writeUint16LE(doors.exitPosY);
+ screenDataStream->writeByte(doors.openclosed);
+ screenDataStream->writeByte(doors.doorcode);
+}
+
+void savePoint(Common::Point point, Common::SeekableWriteStream *screenDataStream) {
+ screenDataStream->writeUint16LE(point.x);
+ screenDataStream->writeUint16LE(point.y);
+}
+
+void saveBitmapRegister(RoomBitmapRegister bitmap, Common::SeekableWriteStream *screenDataStream) {
+ screenDataStream->writeSint32LE(bitmap.bitmapPointer);
+ screenDataStream->writeUint16LE(bitmap.bitmapSize);
+ screenDataStream->writeUint16LE(bitmap.coordx);
+ screenDataStream->writeUint16LE(bitmap.coordy);
+ screenDataStream->writeUint16LE(bitmap.depth);
+}
+
+void saveRoomObjectList(RoomObjectListEntry objectList, Common::SeekableWriteStream *screenDataStream) {
+
+ screenDataStream->writeUint16LE(objectList.fileIndex);
+ screenDataStream->writeByte(objectList.objectName.size());
+ int paddingSize = 20 - objectList.objectName.size();
+ if (paddingSize < 20) {
+ screenDataStream->writeString(objectList.objectName);
+ }
+ if (paddingSize > 0) {
+ char *padding = (char *)malloc(paddingSize);
+ for (int i = 0; i < paddingSize; i++) {
+ padding[i] = '\0';
+ }
+ screenDataStream->write(padding, paddingSize);
+
+ free(padding);
+ }
+}
+
+void saveRoom(RoomFileRegister *room, Common::SeekableWriteStream *screenDataStream) {
+ screenDataStream->writeUint16LE(room->code);
+ screenDataStream->writeUint32LE(room->roomImagePointer);
+ screenDataStream->writeUint16LE(room->roomImageSize);
+ screenDataStream->write(room->walkAreasGrid, 40 * 28);
+ screenDataStream->write(room->mouseGrid, 40 * 28);
+
+ // read puntos
+ for (int i = 0; i < 9; i++) {
+ for (int j = 0; j < 30; j++) {
+ for (int k = 0; k < 5; k++) {
+ savePoint(room->trajectories[i][j][k], screenDataStream);
+ }
+ }
+ }
+
+ for (int i = 0; i < 5; i++) {
+ saveDoorMetadata(room->doors[i], screenDataStream);
+ }
+ for (int i = 0; i < 15; i++) {
+ saveBitmapRegister(room->screenLayers[i], screenDataStream);
+ }
+ for (int i = 0; i < 51; i++) {
+ saveRoomObjectList(*room->screenObjectIndex[i], screenDataStream);
+ }
+ screenDataStream->writeByte(room->animationFlag);
+
+ screenDataStream->writeByte(room->animationName.size());
+ screenDataStream->writeString(room->animationName);
+ int paddingSize = 8 - room->animationName.size();
+ if (paddingSize > 0) {
+ char *padding = (char *)malloc(paddingSize);
+ for (int i = 0; i < paddingSize; i++) {
+ padding[i] = '\0';
+ }
+ // 8 max char name
+ screenDataStream->write(padding, paddingSize);
+
+ free(padding);
+ }
+ screenDataStream->writeByte(room->paletteAnimationFlag);
+ screenDataStream->writeUint16LE(room->palettePointer);
+ for (int i = 0; i < 300; i++) {
+ savePoint(room->secondaryAnimTrajectory[i], screenDataStream);
+ }
+ screenDataStream->write(room->secondaryAnimDirections, 600);
+ screenDataStream->writeUint16LE(room->secondaryTrajectoryLength);
+}
+
+void TotEngine::saveRoomData(RoomFileRegister *room, Common::SeekableWriteStream *stream) {
+ _rooms->seek(room->code * kRoomRegSize, SEEK_SET);
+ saveRoom(room, stream);
+}
+
+void TotEngine::readObject(Common::SeekableReadStream *stream, uint itemPos, ScreenObject &thisRegObj) {
+ stream->seek(itemPos * kItemRegSize);
+ clearCurrentInventoryObject();
+ thisRegObj.code = stream->readUint16LE();
+ thisRegObj.height = stream->readByte();
+
+ thisRegObj.name = stream->readPascalString();
+
+ stream->skip(kObjectNameLength - thisRegObj.name.size());
+
+ thisRegObj.lookAtTextRef = stream->readUint16LE();
+ thisRegObj.beforeUseTextRef = stream->readUint16LE();
+ thisRegObj.afterUseTextRef = stream->readUint16LE();
+ thisRegObj.pickTextRef = stream->readUint16LE();
+ thisRegObj.useTextRef = stream->readUint16LE();
+ thisRegObj.speaking = stream->readByte();
+ thisRegObj.openable = stream->readByte();
+ thisRegObj.closeable = stream->readByte();
+
+ stream->read(thisRegObj.used, 8);
+
+ thisRegObj.pickupable = stream->readByte();
+ thisRegObj.useWith = stream->readUint16LE();
+ thisRegObj.replaceWith = stream->readUint16LE();
+ thisRegObj.depth = stream->readByte();
+ thisRegObj.bitmapPointer = stream->readUint32LE();
+ thisRegObj.bitmapSize = stream->readUint16LE();
+ thisRegObj.rotatingObjectAnimation = stream->readUint32LE();
+ thisRegObj.rotatingObjectPalette = stream->readUint16LE();
+ thisRegObj.dropOverlayX = stream->readUint16LE();
+ thisRegObj.dropOverlayY = stream->readUint16LE();
+ thisRegObj.dropOverlay = stream->readUint32LE();
+ thisRegObj.dropOverlaySize = stream->readUint16LE();
+ thisRegObj.objectIconBitmap = stream->readUint16LE();
+ thisRegObj.xgrid1 = stream->readByte();
+ thisRegObj.ygrid1 = stream->readByte();
+ thisRegObj.xgrid2 = stream->readByte();
+ thisRegObj.ygrid2 = stream->readByte();
+ stream->read(thisRegObj.walkAreasPatch, 100);
+ stream->read(thisRegObj.mouseGridPatch, 100);
+}
+
+void TotEngine::readObject(uint itemPosition) {
+ readObject(_sceneObjectsData, itemPosition, _curObject);
+}
+
+void TotEngine::updateObject(uint itemPosition) {
+ _curObject.used[0] = 9;
+ _sceneObjectsData->seek(itemPosition);
+ saveObject(_curObject, _sceneObjectsData);
+}
+
+/**
+ * Object files contain a single register per object, with a set of 8 flags, to mark them as used in each save.
+ */
+void TotEngine::initializeObjectFile() {
+ Common::File objFile;
+ if (!objFile.open(Common::Path("OBJETOS.DAT"))) {
+ showError(261);
+ }
+ delete (_sceneObjectsData);
+ byte *objectData = (byte *)malloc(objFile.size());
+ objFile.read(objectData, objFile.size());
+ _sceneObjectsData = new Common::MemorySeekableReadWriteStream(objectData, objFile.size(), DisposeAfterUse::NO);
+ objFile.close();
+}
+
+void TotEngine::saveObjectsData(ScreenObject object, Common::SeekableWriteStream *objectDataStream) {
+ objectDataStream->writeUint16LE(object.code);
+ objectDataStream->writeByte(object.height);
+
+ objectDataStream->writeByte(object.name.size());
+ objectDataStream->writeString(object.name);
+ int paddingSize = kObjectNameLength - object.name.size();
+ if (paddingSize > 0) {
+ char *padding = (char *)malloc(paddingSize);
+ for (int i = 0; i < paddingSize; i++) {
+ padding[i] = '\0';
+ }
+ // 8 max char name
+ objectDataStream->write(padding, paddingSize);
+ free(padding);
+ }
+
+ objectDataStream->writeUint16LE(object.lookAtTextRef);
+ objectDataStream->writeUint16LE(object.beforeUseTextRef);
+ objectDataStream->writeUint16LE(object.afterUseTextRef);
+ objectDataStream->writeUint16LE(object.pickTextRef);
+ objectDataStream->writeUint16LE(object.useTextRef);
+
+ objectDataStream->writeByte(object.speaking);
+ objectDataStream->writeByte(object.openable);
+ objectDataStream->writeByte(object.closeable);
+
+ objectDataStream->write(object.used, 8);
+
+ objectDataStream->writeByte(object.pickupable);
+
+ objectDataStream->writeUint16LE(object.useWith);
+ objectDataStream->writeUint16LE(object.replaceWith);
+ objectDataStream->writeByte(object.depth);
+ objectDataStream->writeUint32LE(object.bitmapPointer);
+ objectDataStream->writeUint16LE(object.bitmapSize);
+ objectDataStream->writeUint16LE(object.rotatingObjectAnimation);
+ objectDataStream->writeUint16LE(object.rotatingObjectPalette);
+ objectDataStream->writeUint16LE(object.dropOverlayX);
+ objectDataStream->writeUint16LE(object.dropOverlayY);
+ objectDataStream->writeUint32LE(object.dropOverlay);
+ objectDataStream->writeUint16LE(object.dropOverlaySize);
+ objectDataStream->writeUint16LE(object.objectIconBitmap);
+
+ objectDataStream->writeByte(object.xgrid1);
+ objectDataStream->writeByte(object.ygrid1);
+ objectDataStream->writeByte(object.xgrid2);
+ objectDataStream->writeByte(object.ygrid2);
+
+ objectDataStream->write(object.walkAreasPatch, 100);
+ objectDataStream->write(object.mouseGridPatch, 100);
+}
+
+void TotEngine::saveObject(ScreenObject object, Common::SeekableWriteStream *stream) {
+ _sceneObjectsData->seek(object.code * kItemRegSize, SEEK_SET);
+ saveObjectsData(object, stream);
+}
+
+DoorRegistry readDoorMetadata(Common::SeekableReadStream *screenDataFile) {
+ DoorRegistry doorMetadata;
+ doorMetadata.nextScene = screenDataFile->readUint16LE();
+ doorMetadata.exitPosX = screenDataFile->readUint16LE();
+ doorMetadata.exitPosY = screenDataFile->readUint16LE();
+ doorMetadata.openclosed = screenDataFile->readByte();
+ doorMetadata.doorcode = screenDataFile->readByte();
+
+ return doorMetadata;
+}
+
+Common::Point readPoint(Common::SeekableReadStream *screenDataFile) {
+ Common::Point point;
+ point.x = screenDataFile->readUint16LE();
+ point.y = screenDataFile->readUint16LE();
+ return point;
+}
+
+RoomBitmapRegister readAuxBitmaps(Common::SeekableReadStream *screenDataFile) {
+ RoomBitmapRegister bitmapMetadata = RoomBitmapRegister();
+ bitmapMetadata.bitmapPointer = screenDataFile->readSint32LE();
+ bitmapMetadata.bitmapSize = screenDataFile->readUint16LE();
+ bitmapMetadata.coordx = screenDataFile->readUint16LE();
+ bitmapMetadata.coordy = screenDataFile->readUint16LE();
+ bitmapMetadata.depth = screenDataFile->readUint16LE();
+ return bitmapMetadata;
+}
+
+RoomObjectListEntry *readRoomObjects(Common::SeekableReadStream *screenDataFile) {
+ RoomObjectListEntry *objectMetadata = new RoomObjectListEntry();
+ objectMetadata->fileIndex = screenDataFile->readUint16LE();
+ objectMetadata->objectName = screenDataFile->readPascalString();
+
+ screenDataFile->skip(20 - objectMetadata->objectName.size());
+
+ return objectMetadata;
+}
+
+RoomFileRegister *TotEngine::readScreenDataFile(Common::SeekableReadStream *screenDataFile) {
+ RoomFileRegister *screenData = new RoomFileRegister();
+ screenData->code = screenDataFile->readUint16LE();
+ screenData->roomImagePointer = screenDataFile->readUint32LE();
+ screenData->roomImageSize = screenDataFile->readUint16LE();
+ screenDataFile->read(screenData->walkAreasGrid, 40 * 28);
+ screenDataFile->read(screenData->mouseGrid, 40 * 28);
+ for (int i = 0; i < 9; i++) {
+ for (int j = 0; j < 30; j++) {
+ for (int k = 0; k < 5; k++) {
+ screenData->trajectories[i][j][k] = readPoint(screenDataFile);
+ }
+ }
+ }
+
+ for (int i = 0; i < 5; i++) {
+ screenData->doors[i] = readDoorMetadata(screenDataFile);
+ }
+ for (int i = 0; i < 15; i++) {
+ screenData->screenLayers[i] = readAuxBitmaps(screenDataFile);
+ }
+ for (int i = 0; i < 51; i++) {
+ screenData->screenObjectIndex[i] = readRoomObjects(screenDataFile);
+ }
+
+ screenData->animationFlag = screenDataFile->readByte();
+ screenData->animationName = screenDataFile->readPascalString();
+ screenDataFile->skip(8 - screenData->animationName.size());
+ screenData->paletteAnimationFlag = screenDataFile->readByte();
+ screenData->palettePointer = screenDataFile->readUint16LE();
+ for (int i = 0; i < 300; i++) {
+ screenData->secondaryAnimTrajectory[i] = readPoint(screenDataFile);
+ }
+ screenDataFile->read(screenData->secondaryAnimDirections, 600);
+ screenData->secondaryTrajectoryLength = screenDataFile->readUint16LE();
+ return screenData;
+}
+
+} // End of namespace Tot
diff --git a/engines/tot/routines.cpp b/engines/tot/routines.cpp
index 4e90a34e6c9..41ca445530a 100644
--- a/engines/tot/routines.cpp
+++ b/engines/tot/routines.cpp
@@ -60,7 +60,6 @@ void TotEngine::displayLoading() {
g_system->delayMillis(200);
}
-
void TotEngine::runaroundRed() {
const uint devilTrajectory[91][2] = {
{204, 47}, {204, 49}, {203, 51}, {203, 53}, {201, 55}, {199, 57}, {197, 59}, {195, 61},
@@ -403,7 +402,6 @@ void TotEngine::sprites(bool drawMainCharachter) {
}
}
-
void TotEngine::adjustKey() {
_iframe = 0;
calculateTrajectory(129, 13);
@@ -711,82 +709,6 @@ void TotEngine::animatedSequence(uint numSequence) {
}
}
-DoorRegistry readDoorMetadata(Common::SeekableReadStream *screenDataFile) {
- DoorRegistry doorMetadata;
- doorMetadata.nextScene = screenDataFile->readUint16LE();
- doorMetadata.exitPosX = screenDataFile->readUint16LE();
- doorMetadata.exitPosY = screenDataFile->readUint16LE();
- doorMetadata.openclosed = screenDataFile->readByte();
- doorMetadata.doorcode = screenDataFile->readByte();
-
- return doorMetadata;
-}
-
-Common::Point readPoint(Common::SeekableReadStream *screenDataFile) {
- Common::Point point;
- point.x = screenDataFile->readUint16LE();
- point.y = screenDataFile->readUint16LE();
- return point;
-}
-
-RoomBitmapRegister readAuxBitmaps(Common::SeekableReadStream *screenDataFile) {
- RoomBitmapRegister bitmapMetadata = RoomBitmapRegister();
- bitmapMetadata.bitmapPointer = screenDataFile->readSint32LE();
- bitmapMetadata.bitmapSize = screenDataFile->readUint16LE();
- bitmapMetadata.coordx = screenDataFile->readUint16LE();
- bitmapMetadata.coordy = screenDataFile->readUint16LE();
- bitmapMetadata.depth = screenDataFile->readUint16LE();
- return bitmapMetadata;
-}
-
-RoomObjectListEntry *readRoomObjects(Common::SeekableReadStream *screenDataFile) {
- RoomObjectListEntry *objectMetadata = new RoomObjectListEntry();
- objectMetadata->fileIndex = screenDataFile->readUint16LE();
- objectMetadata->objectName = screenDataFile->readPascalString();
-
- screenDataFile->skip(20 - objectMetadata->objectName.size());
-
- return objectMetadata;
-}
-
-RoomFileRegister *TotEngine::readScreenDataFile(Common::SeekableReadStream *screenDataFile) {
- RoomFileRegister *screenData = new RoomFileRegister();
- screenData->code = screenDataFile->readUint16LE();
- screenData->roomImagePointer = screenDataFile->readUint32LE();
- screenData->roomImageSize = screenDataFile->readUint16LE();
- screenDataFile->read(screenData->walkAreasGrid, 40 * 28);
- screenDataFile->read(screenData->mouseGrid, 40 * 28);
- for (int i = 0; i < 9; i++) {
- for (int j = 0; j < 30; j++) {
- for (int k = 0; k < 5; k++) {
- screenData->trajectories[i][j][k] = readPoint(screenDataFile);
- }
- }
- }
-
- for (int i = 0; i < 5; i++) {
- screenData->doors[i] = readDoorMetadata(screenDataFile);
- }
- for (int i = 0; i < 15; i++) {
- screenData->screenLayers[i] = readAuxBitmaps(screenDataFile);
- }
- for (int i = 0; i < 51; i++) {
- screenData->screenObjectIndex[i] = readRoomObjects(screenDataFile);
- }
-
- screenData->animationFlag = screenDataFile->readByte();
- screenData->animationName = screenDataFile->readPascalString();
- screenDataFile->skip(8 - screenData->animationName.size());
- screenData->paletteAnimationFlag = screenDataFile->readByte();
- screenData->palettePointer = screenDataFile->readUint16LE();
- for (int i = 0; i < 300; i++) {
- screenData->secondaryAnimTrajectory[i] = readPoint(screenDataFile);
- }
- screenDataFile->read(screenData->secondaryAnimDirections, 600);
- screenData->secondaryTrajectoryLength = screenDataFile->readUint16LE();
- return screenData;
-}
-
void TotEngine::loadScreenData(uint screenNumber) {
_currentRoomNumber = screenNumber;
@@ -898,7 +820,7 @@ void TotEngine::lookAtObject(byte objectCode) {
_cpCounter2 = _cpCounter;
_mouse->hide();
_graphics->copyPalette(g_engine->_graphics->_pal, secPalette);
- readItemRegister(_inventory[objectCode].code);
+ readObject(_inventory[objectCode].code);
_graphics->getImg(0, 0, 319, 139, _sceneBackground);
_graphics->partialFadeOut(234);
bar(0, 0, 319, 139, 0);
@@ -920,7 +842,7 @@ void TotEngine::lookAtObject(byte objectCode) {
if (_curObject.used[0] != 9) {
if (_curObject.beforeUseTextRef != 0) {
readTextFile();
- textRef = readVerbRegister(_curObject.beforeUseTextRef);
+ textRef = readTextRegister(_curObject.beforeUseTextRef);
description = textRef.text;
for (yaux = 0; yaux < textRef.text.size(); yaux++)
description.setChar(_decryptionKey[yaux] ^ textRef.text[yaux], yaux);
@@ -934,7 +856,7 @@ void TotEngine::lookAtObject(byte objectCode) {
if (_curObject.afterUseTextRef != 0) {
readTextFile();
- textRef = readVerbRegister(_curObject.afterUseTextRef);
+ textRef = readTextRegister(_curObject.afterUseTextRef);
description = textRef.text;
for (yaux = 0; yaux < textRef.text.size(); yaux++)
description.setChar(_decryptionKey[yaux] ^ textRef.text[yaux], yaux);
@@ -961,7 +883,7 @@ void TotEngine::useInventoryObjectWithInventoryObject(uint objectCode1, uint obj
byte invIndex, indobj1, indobj2;
debug("Reading item register %d", objectCode1);
- readItemRegister(_invItemData, objectCode1, _curObject);
+ readObject(_sceneObjectsData, objectCode1, _curObject);
// verifyCopyProtection2();
if (_curObject.used[0] != 1 || _curObject.useWith != objectCode2) {
drawText(Random(11) + 1022);
@@ -983,16 +905,16 @@ void TotEngine::useInventoryObjectWithInventoryObject(uint objectCode1, uint obj
uint textRef = _curObject.useTextRef;
if (_curObject.replaceWith == 0) {
- readItemRegister(_invItemData, objectCode1, _curObject);
+ readObject(_sceneObjectsData, objectCode1, _curObject);
_curObject.used[0] = 9;
- saveItemRegister(_curObject, _invItemData);
+ saveObject(_curObject, _sceneObjectsData);
- readItemRegister(_invItemData, objectCode2, _curObject);
+ readObject(_sceneObjectsData, objectCode2, _curObject);
_curObject.used[0] = 9;
- saveItemRegister(_curObject, _invItemData);
+ saveObject(_curObject, _sceneObjectsData);
} else {
- readItemRegister(_invItemData, _curObject.replaceWith, _curObject);
+ readObject(_sceneObjectsData, _curObject.replaceWith, _curObject);
_inventory[indobj1].bitmapIndex = _curObject.objectIconBitmap;
_inventory[indobj1].code = _curObject.code;
_inventory[indobj1].objectName = _curObject.name;
@@ -1511,7 +1433,7 @@ void TotEngine::pickupScreenObject() {
screenObject = _currentRoomData->screenObjectIndex[_currentRoomData->mouseGrid[correctedMouseX][correctedMouseY]]->fileIndex;
if (screenObject == 0)
return;
- readItemRegister(screenObject);
+ readObject(screenObject);
goToObject(
_currentRoomData->walkAreasGrid[(_characterPosX + kCharacterCorrectionX) / kXGridCount][(_characterPosY + kCharacerCorrectionY) / kYGridCount],
_currentRoomData->walkAreasGrid[correctedMouseX][correctedMouseY]);
@@ -1624,7 +1546,7 @@ void TotEngine::pickupScreenObject() {
if (_niche[0][_niche[0][3]] > 0) {
// Possibly
if (_niche[0][3] == 2 || _niche[0][_niche[0][3]] == 563) {
- readItemRegister(_niche[0][_niche[0][3]]);
+ readObject(_niche[0][_niche[0][3]]);
_niche[0][_niche[0][3]] = 0;
_currentRoomData->screenObjectIndex[9]->objectName = getObjectName(4);
animatePickup1(3, 1);
@@ -1639,7 +1561,7 @@ void TotEngine::pickupScreenObject() {
_graphics->drawScreen(_sceneBackground);
animatePickup2(3, 1);
} else {
- readItemRegister(_niche[0][_niche[0][3]]);
+ readObject(_niche[0][_niche[0][3]]);
_niche[0][_niche[0][3]] = 0;
_niche[0][3] += 1;
_niche[1][3] -= 1;
@@ -1691,7 +1613,7 @@ void TotEngine::pickupScreenObject() {
case 24: { // Second scene with niche
if (_niche[1][_niche[1][3]] > 0 && _niche[1][3] != 1) {
if (_niche[1][3] == 2) {
- readItemRegister(_niche[1][2]);
+ readObject(_niche[1][2]);
_niche[1][2] = 0;
_currentRoomData->screenObjectIndex[8]->objectName = getObjectName(4);
animatePickup1(0, 1);
@@ -1706,7 +1628,7 @@ void TotEngine::pickupScreenObject() {
_graphics->drawScreen(_sceneBackground);
animatePickup2(0, 1);
} else {
- readItemRegister(_niche[1][_niche[1][3]]);
+ readObject(_niche[1][_niche[1][3]]);
_niche[1][_niche[1][3]] = 622;
_niche[1][3] += 1;
_niche[0][3] -= 1;
@@ -1849,7 +1771,7 @@ void TotEngine::pickupScreenObject() {
} break;
case 9: { // bat
uint textRef = _curObject.pickTextRef;
- readItemRegister(204);
+ readObject(204);
animatePickup1(0, 1);
animateOpen2(0, 1);
animateBat();
@@ -1958,7 +1880,7 @@ void TotEngine::pickupScreenObject() {
}
void TotEngine::replaceBackpack(byte obj1, uint obj2) {
- readItemRegister(obj2);
+ readObject(obj2);
_inventory[obj1].bitmapIndex = _curObject.objectIconBitmap;
_inventory[obj1].code = obj2;
_inventory[obj1].objectName = _curObject.name;
@@ -2010,7 +1932,7 @@ void TotEngine::useScreenObject() {
usedObjectIndex += 1;
}
- readItemRegister(_inventory[usedObjectIndex].code);
+ readObject(_inventory[usedObjectIndex].code);
goToObject(
_currentRoomData->walkAreasGrid[(_characterPosX + kCharacterCorrectionX) / kXGridCount][(_characterPosY + kCharacerCorrectionY) / kYGridCount],
@@ -2025,7 +1947,7 @@ void TotEngine::useScreenObject() {
animateGive(1, 2);
animatePickup2(1, 2);
- updateItem(_curObject.code);
+ updateObject(_curObject.code);
_currentRoomData->screenObjectIndex[27]->fileIndex = 201;
do {
_chrono->updateChrono();
@@ -2081,7 +2003,7 @@ void TotEngine::useScreenObject() {
animateGive(3, 1);
animatePickup2(3, 1);
_mouse->show();
- updateItem(_curObject.code);
+ updateObject(_curObject.code);
_currentRoomData->screenObjectIndex[21]->fileIndex = 154;
} break;
case 157: { // giving something to john
@@ -2502,13 +2424,13 @@ void TotEngine::useScreenObject() {
g_system->delayMillis(10);
} while (_sound->isVocPlaying());
animateOpen2(3, 2);
- updateItem(_curObject.code);
+ updateObject(_curObject.code);
disableSecondAnimation();
_graphics->drawScreen(_sceneBackground);
_mouse->show();
drawText(2652);
_mouse->hide();
- readItemRegister(536);
+ readObject(536);
for (int i = 12; i <= 13; i++)
for (int j = 7; j <= 14; j++)
_currentRoomData->mouseGrid[i][j] = 14;
@@ -2547,10 +2469,10 @@ void TotEngine::useScreenObject() {
usedObjectIndex += 1;
}
- _invItemData->seek(_curObject.code);
+ _sceneObjectsData->seek(_curObject.code);
- saveItem(_curObject, _invItemData);
- readItemRegister(_invItemData, 221, _curObject);
+ saveObjectsData(_curObject, _sceneObjectsData);
+ readObject(_sceneObjectsData, 221, _curObject);
_inventory[usedObjectIndex].bitmapIndex = _curObject.objectIconBitmap;
_inventory[usedObjectIndex].code = _curObject.code;
_inventory[usedObjectIndex].objectName = _curObject.name;
@@ -2573,7 +2495,7 @@ void TotEngine::useScreenObject() {
replaceBackpack(usedObjectIndex, 453);
drawInventory();
_mouse->show();
- updateItem(_inventory[usedObjectIndex].code);
+ updateObject(_inventory[usedObjectIndex].code);
_isCupboardOpen = true;
} break;
case 274: {
@@ -2584,11 +2506,11 @@ void TotEngine::useScreenObject() {
_sound->waitForSoundEnd();
animateOpen2(_charFacingDirection, 2);
_mouse->show();
- updateItem(_curObject.code);
+ updateObject(_curObject.code);
_isChestOpen = true;
} break;
case 416: {
- updateItem(_curObject.code);
+ updateObject(_curObject.code);
_mouse->hide();
_sound->playVoc("PUERTA", 186429, 4754);
animatePickup1(0, 1);
@@ -2620,7 +2542,7 @@ void TotEngine::useScreenObject() {
_currentRoomData->mouseGrid[27][8] = 22;
} break;
case 549: {
- updateItem(_curObject.code);
+ updateObject(_curObject.code);
_mouse->hide();
_sound->playVoc("PUERTA", 186429, 4754);
animatePickup1(1, 1);
@@ -2828,7 +2750,7 @@ void TotEngine::useScreenObject() {
_mouse->hide();
drawFlc(140, 34, offset, 0, 9, 24, false, false, true, foobar);
_mouse->show();
- updateItem(_curObject.code);
+ updateObject(_curObject.code);
_currentRoomData->screenObjectIndex[7]->fileIndex = 716;
_currentRoomData->mouseGrid[19][9] = 14;
_currentRoomData->mouseGrid[22][16] = 15;
@@ -3151,7 +3073,7 @@ void TotEngine::useScreenObject() {
_currentRoomData->mouseGrid[35][invIndex] = 7;
_currentRoomData->doors[1].openclosed = 1;
_mouse->show();
- updateItem(_curObject.code);
+ updateObject(_curObject.code);
} break;
case 709: { // rock with mural
long offset = (_lang == Common::ES_ESP) ? flcOffsets[0][27] : flcOffsets[1][27];
@@ -3193,7 +3115,7 @@ void TotEngine::useScreenObject() {
}
} else { //use object with something on the scene
if (sceneObject > 0) {
- readItemRegister(sceneObject);
+ readObject(sceneObject);
goToObject(_currentRoomData->walkAreasGrid[(_characterPosX + kCharacterCorrectionX) / kXGridCount][(_characterPosY + kCharacerCorrectionY) / kYGridCount], _currentRoomData->walkAreasGrid[correctedMouseX][correctedMouseY]);
switch (_curObject.used[0]) {
case 0: {
@@ -3222,8 +3144,8 @@ void TotEngine::useScreenObject() {
_mouse->hide();
animatedSequence(3);
_mouse->show();
- updateItem(_curObject.code);
- readItemRegister(152);
+ updateObject(_curObject.code);
+ readObject(152);
usedObjectIndex = 0;
while (_inventory[usedObjectIndex].code != 0) {
usedObjectIndex += 1;
@@ -3283,7 +3205,7 @@ void TotEngine::useScreenObject() {
delay(100);
animateOpen2(0, 0);
_mouse->show();
- updateItem(_curObject.code);
+ updateObject(_curObject.code);
_currentRoomData->screenObjectIndex[16]->fileIndex = 362;
_currentRoomData->screenObjectIndex[16]->objectName = getObjectName(2);
_currentRoomData->screenObjectIndex[1]->fileIndex = 347;
@@ -3346,7 +3268,7 @@ void TotEngine::openScreenObject() {
if (screenObject == 0)
return;
- readItemRegister(screenObject);
+ readObject(screenObject);
debug("Read screen object = %s, with code = %d, depth=%d", _curObject.name.c_str(), _curObject.code, _curObject.depth);
goToObject(_currentRoomData->walkAreasGrid[(_characterPosX + kCharacterCorrectionX) / kXGridCount][(_characterPosY + kCharacerCorrectionY) / kYGridCount],
_currentRoomData->walkAreasGrid[correctedMouseX][correctedMouseY]);
@@ -3501,7 +3423,7 @@ void TotEngine::closeScreenObject() {
if (sceneObject == 0)
return;
// verifyCopyProtection2();
- readItemRegister(sceneObject);
+ readObject(sceneObject);
goToObject(_currentRoomData->walkAreasGrid[((_characterPosX + kCharacterCorrectionX) / kXGridCount)][((_characterPosY + kCharacerCorrectionY) / kYGridCount)],
_currentRoomData->walkAreasGrid[correctedMouseX][correctedMouseY]);
if (_curObject.closeable == false) {
@@ -3673,7 +3595,7 @@ void TotEngine::handleAction(byte invPos) {
}
}
-void TotEngine::loadObjects() {
+void TotEngine::loadInventory() {
Common::File objectFile;
switch (_gamePart) {
@@ -3686,7 +3608,7 @@ void TotEngine::loadObjects() {
}
if (!objectFile.isOpen()) {
- debug("Object file exists? %d, open? %d", objectFile.exists("OBJMOCH.DAT"), objectFile.isOpen());
+ debug("Object file exists? %d, open? %d, gamepart? %d", objectFile.exists("OBJMOCH.DAT"), objectFile.isOpen(), _gamePart);
showError(312);
}
for (int i = 0; i < kInventoryIconCount; i++) {
@@ -3866,7 +3788,6 @@ void TotEngine::loadScrollData(uint roomCode, bool rightScroll, uint horizontalP
// background now contains background A, backgroundCopy contains background A
uint characterFrameW = READ_LE_UINT16(_curCharacterAnimationFrame);
uint characterFrameH = READ_LE_UINT16(_curCharacterAnimationFrame + 2);
- debug("characterPos=%d,%d, size=%d,%d", _characterPosX, _characterPosY, characterFrameW, characterFrameH);
/* Copy the area with the player from previous scren*/
spriteBackground = (byte *)malloc(4 + (characterFrameW + 8) * (characterFrameH + 8));
_graphics->getImageArea(_characterPosX, _characterPosY, _characterPosX + characterFrameW, _characterPosY + characterFrameH, _sceneBackground, spriteBackground);
@@ -4041,7 +3962,7 @@ void TotEngine::loadGame(SavedGame game) {
for (int i = 0; i < kInventoryIconCount; i++) {
free(_inventoryIconBitmaps[i]);
}
- loadObjects();
+ loadInventory();
}
_isSealRemoved = game.isSealRemoved;
_obtainedList1 = game.obtainedList1;
@@ -4200,25 +4121,6 @@ void TotEngine::loadGame(SavedGame game) {
_graphics->sceneTransition(false, _sceneBackground);
}
-TextEntry TotEngine::readVerbRegister(uint numRegister) {
- _verbFile.seek(numRegister * kVerbRegSize);
- return readVerbRegister();
-}
-
-TextEntry TotEngine::readVerbRegister() {
- TextEntry regmht;
- // Since the text is encrypted it's safer to save the size as reported by
- // the pascal string.
- byte size = _verbFile.readByte();
- _verbFile.seek(-1, SEEK_CUR);
- regmht.text = _verbFile.readPascalString(false);
- _verbFile.skip(255 - size);
- regmht.continued = _verbFile.readByte();
- regmht.response = _verbFile.readUint16LE();
- regmht.pointer = _verbFile.readSint32LE();
- return regmht;
-}
-
void TotEngine::sayLine(
uint textRef,
byte textColor,
@@ -4308,7 +4210,7 @@ void TotEngine::sayLine(
do {
- text = readVerbRegister();
+ text = readTextRegister();
insertName = 0;
@@ -4459,239 +4361,4 @@ void TotEngine::sayLine(
_mouse->show();
}
-void TotEngine::wcScene() {
- palette wcPalette;
- _currentZone = _currentRoomData->walkAreasGrid[(_characterPosX + kCharacterCorrectionX) / kXGridCount][(_characterPosY + kCharacerCorrectionY) / kYGridCount];
- goToObject(_currentZone, _targetZone);
-
- _graphics->copyPalette(g_engine->_graphics->_pal, wcPalette);
- _mouse->hide();
-
- _graphics->partialFadeOut(234);
-
- const char *const *messages = (_lang == Common::ES_ESP) ? fullScreenMessages[0] : fullScreenMessages[1];
-
- littText(10, 20, messages[45], 253);
- delay(1000);
-
- bar(10, 20, 150, 30, 0);
- delay(2000);
-
- littText(100, 50, messages[46], 255);
- delay(1000);
-
- bar(100, 50, 250, 60, 0);
- delay(2000);
-
- littText(30, 110, messages[47], 253);
- delay(1000);
-
- bar(30, 110, 210, 120, 0);
- delay(3000);
-
- littText(50, 90, messages[48], 248);
- delay(1000);
-
- _sound->playVoc("WATER", 272050, 47062);
- bar(50, 90, 200, 100, 0);
- delay(4000);
-
- _characterPosX = 76 - kCharacterCorrectionX;
- _characterPosY = 78 - kCharacerCorrectionY;
- _graphics->copyPalette(wcPalette, g_engine->_graphics->_pal);
- _graphics->restoreBackground();
- assembleScreen();
- _graphics->drawScreen(_sceneBackground);
- _graphics->partialFadeIn(234);
- _xframe2 = 0;
- _currentTrajectoryIndex = 0;
- _trajectoryLength = 1;
- _currentZone = 8;
- _targetZone = 8;
- _trajectory[0].x = _characterPosX;
- _trajectory[0].y = _characterPosY;
-
- _mouse->show();
-}
-
-void TotEngine::readConversationFile(Common::String f) {
- Common::File conversationFile;
- if (!conversationFile.open(Common::Path(f))) {
- showError(314);
- }
- int64 fileSize = conversationFile.size();
- byte *buf = (byte *)malloc(fileSize);
- conversationFile.read(buf, fileSize);
-
- _conversationData = new Common::MemorySeekableReadWriteStream(buf, fileSize, DisposeAfterUse::NO);
- conversationFile.close();
-}
-
-void saveDoorMetadata(DoorRegistry doors, Common::SeekableWriteStream *screenDataStream) {
- screenDataStream->writeUint16LE(doors.nextScene);
- screenDataStream->writeUint16LE(doors.exitPosX);
- screenDataStream->writeUint16LE(doors.exitPosY);
- screenDataStream->writeByte(doors.openclosed);
- screenDataStream->writeByte(doors.doorcode);
-}
-
-void savePoint(Common::Point point, Common::SeekableWriteStream *screenDataStream) {
- screenDataStream->writeUint16LE(point.x);
- screenDataStream->writeUint16LE(point.y);
-}
-
-void saveBitmapRegister(RoomBitmapRegister bitmap, Common::SeekableWriteStream *screenDataStream) {
- screenDataStream->writeSint32LE(bitmap.bitmapPointer);
- screenDataStream->writeUint16LE(bitmap.bitmapSize);
- screenDataStream->writeUint16LE(bitmap.coordx);
- screenDataStream->writeUint16LE(bitmap.coordy);
- screenDataStream->writeUint16LE(bitmap.depth);
-}
-
-void saveRoomObjectList(RoomObjectListEntry objectList, Common::SeekableWriteStream *screenDataStream) {
-
- screenDataStream->writeUint16LE(objectList.fileIndex);
- screenDataStream->writeByte(objectList.objectName.size());
- int paddingSize = 20 - objectList.objectName.size();
- if (paddingSize < 20) {
- screenDataStream->writeString(objectList.objectName);
- }
- if (paddingSize > 0) {
- char *padding = (char *)malloc(paddingSize);
- for (int i = 0; i < paddingSize; i++) {
- padding[i] = '\0';
- }
- screenDataStream->write(padding, paddingSize);
-
- free(padding);
- }
-}
-
-void saveRoom(RoomFileRegister *room, Common::SeekableWriteStream *screenDataStream) {
- screenDataStream->writeUint16LE(room->code);
- screenDataStream->writeUint32LE(room->roomImagePointer);
- screenDataStream->writeUint16LE(room->roomImageSize);
- screenDataStream->write(room->walkAreasGrid, 40 * 28);
- screenDataStream->write(room->mouseGrid, 40 * 28);
-
- // read puntos
- for (int i = 0; i < 9; i++) {
- for (int j = 0; j < 30; j++) {
- for (int k = 0; k < 5; k++) {
- savePoint(room->trajectories[i][j][k], screenDataStream);
- }
- }
- }
-
- for (int i = 0; i < 5; i++) {
- saveDoorMetadata(room->doors[i], screenDataStream);
- }
- for (int i = 0; i < 15; i++) {
- saveBitmapRegister(room->screenLayers[i], screenDataStream);
- }
- for (int i = 0; i < 51; i++) {
- saveRoomObjectList(*room->screenObjectIndex[i], screenDataStream);
- }
- screenDataStream->writeByte(room->animationFlag);
-
- screenDataStream->writeByte(room->animationName.size());
- screenDataStream->writeString(room->animationName);
- int paddingSize = 8 - room->animationName.size();
- if (paddingSize > 0) {
- char *padding = (char *)malloc(paddingSize);
- for (int i = 0; i < paddingSize; i++) {
- padding[i] = '\0';
- }
- // 8 max char name
- screenDataStream->write(padding, paddingSize);
-
- free(padding);
- }
- screenDataStream->writeByte(room->paletteAnimationFlag);
- screenDataStream->writeUint16LE(room->palettePointer);
- for (int i = 0; i < 300; i++) {
- savePoint(room->secondaryAnimTrajectory[i], screenDataStream);
- }
- screenDataStream->write(room->secondaryAnimDirections, 600);
- screenDataStream->writeUint16LE(room->secondaryTrajectoryLength);
-}
-
-void TotEngine::saveRoomData(RoomFileRegister *room, Common::SeekableWriteStream *stream) {
- _rooms->seek(room->code * kRoomRegSize, SEEK_SET);
- saveRoom(room, stream);
-}
-
-/**
- * Object files contain a single register per object, with a set of 8 flags, to mark them as used in each save.
- */
-void TotEngine::initializeObjectFile() {
- Common::File objFile;
- if (!objFile.open(Common::Path("OBJETOS.DAT"))) {
- showError(261);
- }
- delete (_invItemData);
- byte *objectData = (byte *)malloc(objFile.size());
- objFile.read(objectData, objFile.size());
- _invItemData = new Common::MemorySeekableReadWriteStream(objectData, objFile.size(), DisposeAfterUse::NO);
- objFile.close();
-}
-
-void TotEngine::saveItem(ScreenObject object, Common::SeekableWriteStream *objectDataStream) {
- objectDataStream->writeUint16LE(object.code);
- objectDataStream->writeByte(object.height);
-
- objectDataStream->writeByte(object.name.size());
- objectDataStream->writeString(object.name);
- int paddingSize = kObjectNameLength - object.name.size();
- if (paddingSize > 0) {
- char *padding = (char *)malloc(paddingSize);
- for (int i = 0; i < paddingSize; i++) {
- padding[i] = '\0';
- }
- // 8 max char name
- objectDataStream->write(padding, paddingSize);
- free(padding);
- }
-
- objectDataStream->writeUint16LE(object.lookAtTextRef);
- objectDataStream->writeUint16LE(object.beforeUseTextRef);
- objectDataStream->writeUint16LE(object.afterUseTextRef);
- objectDataStream->writeUint16LE(object.pickTextRef);
- objectDataStream->writeUint16LE(object.useTextRef);
-
- objectDataStream->writeByte(object.speaking);
- objectDataStream->writeByte(object.openable);
- objectDataStream->writeByte(object.closeable);
-
- objectDataStream->write(object.used, 8);
-
- objectDataStream->writeByte(object.pickupable);
-
- objectDataStream->writeUint16LE(object.useWith);
- objectDataStream->writeUint16LE(object.replaceWith);
- objectDataStream->writeByte(object.depth);
- objectDataStream->writeUint32LE(object.bitmapPointer);
- objectDataStream->writeUint16LE(object.bitmapSize);
- objectDataStream->writeUint16LE(object.rotatingObjectAnimation);
- objectDataStream->writeUint16LE(object.rotatingObjectPalette);
- objectDataStream->writeUint16LE(object.dropOverlayX);
- objectDataStream->writeUint16LE(object.dropOverlayY);
- objectDataStream->writeUint32LE(object.dropOverlay);
- objectDataStream->writeUint16LE(object.dropOverlaySize);
- objectDataStream->writeUint16LE(object.objectIconBitmap);
-
- objectDataStream->writeByte(object.xgrid1);
- objectDataStream->writeByte(object.ygrid1);
- objectDataStream->writeByte(object.xgrid2);
- objectDataStream->writeByte(object.ygrid2);
-
- objectDataStream->write(object.walkAreasPatch, 100);
- objectDataStream->write(object.mouseGridPatch, 100);
-}
-
-void TotEngine::saveItemRegister(ScreenObject object, Common::SeekableWriteStream *stream) {
- _invItemData->seek(object.code * kItemRegSize, SEEK_SET);
- saveItem(object, stream);
-}
-
} // End of namespace Tot
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
index 57ef49b3626..2f1d6bef06c 100644
--- a/engines/tot/routines2.cpp
+++ b/engines/tot/routines2.cpp
@@ -83,7 +83,7 @@ void TotEngine::loadAnimation(Common::String animationName) {
setRoomTrajectories(_secondaryAnimHeight, _secondaryAnimWidth, SET_WITH_ANIM, false);
- readItemRegister(_currentRoomData->secondaryAnimDirections[299]);
+ readObject(_currentRoomData->secondaryAnimDirections[299]);
_maxXGrid = (_curObject.xgrid2 - _curObject.xgrid1 + 1);
_maxYGrid = (_curObject.ygrid2 - _curObject.ygrid1 + 1);
_oldposx = _curObject.xgrid1 + 1;
@@ -107,12 +107,6 @@ void TotEngine::loadAnimation(Common::String animationName) {
_iframe2 = 0;
}
-void TotEngine::readTextFile() {
- if (!_verbFile.open("CONVERSA.TXT")) {
- showError(313);
- }
-}
-
void TotEngine::updateAltScreen(byte otherScreenNumber) {
uint i22;
uint i11;
@@ -271,29 +265,6 @@ void TotEngine::loadScreen() {
}
}
-void TotEngine::loadCharAnimation() {
- Common::File characterFile;
- _cpCounter = _cpCounter2;
- if (!characterFile.open("PERSONAJ.SPT"))
- showError(265);
-
- _mainCharFrameSize = characterFile.readUint16LE();
-
- verifyCopyProtection();
-
- for (int i = 0; i <= 3; i++)
- for (int j = 0; j < kWalkFrameCount; j++) {
- _mainCharAnimation.bitmap[i][j] = (byte *)malloc(_mainCharFrameSize);
- characterFile.read(_mainCharAnimation.bitmap[i][j], _mainCharFrameSize);
- }
- for (int i = 0; i < 4; i++)
- for (int j = kWalkFrameCount; j < (kWalkFrameCount + 10 * 3); j++) {
- _mainCharAnimation.bitmap[i][j] = (byte *)malloc(_mainCharFrameSize);
- characterFile.read(_mainCharAnimation.bitmap[i][j], _mainCharFrameSize);
- }
- characterFile.close();
-}
-
void TotEngine::clearScreenLayers() {
for (int i = 0; i < kNumScreenOverlays; i++) {
if (_screenLayers[i] != NULL)
@@ -353,69 +324,6 @@ void TotEngine::updateInventory(byte index) {
// verifyCopyProtection();
}
-void TotEngine::readBitmap(int32 bitmapPosition, byte *buf, uint bitmapSize, uint error) {
- Common::File bitmapFile;
- if (!bitmapFile.open("BITMAPS.DAT")) {
- showError(error);
- }
- bitmapFile.seek(bitmapPosition);
- bitmapFile.read(buf, bitmapSize);
-
- bitmapFile.close();
-}
-
-void TotEngine::updateItem(uint itemPosition) {
- _curObject.used[0] = 9;
- _invItemData->seek(itemPosition);
- saveItemRegister(_curObject, _invItemData);
-}
-
-void TotEngine::readItemRegister(Common::SeekableReadStream *stream, uint itemPos, ScreenObject &thisRegObj) {
- stream->seek(itemPos * kItemRegSize);
- clearCurrentInventoryObject();
- thisRegObj.code = stream->readUint16LE();
- thisRegObj.height = stream->readByte();
-
- thisRegObj.name = stream->readPascalString();
-
- stream->skip(kObjectNameLength - thisRegObj.name.size());
-
- thisRegObj.lookAtTextRef = stream->readUint16LE();
- thisRegObj.beforeUseTextRef = stream->readUint16LE();
- thisRegObj.afterUseTextRef = stream->readUint16LE();
- thisRegObj.pickTextRef = stream->readUint16LE();
- thisRegObj.useTextRef = stream->readUint16LE();
- thisRegObj.speaking = stream->readByte();
- thisRegObj.openable = stream->readByte();
- thisRegObj.closeable = stream->readByte();
-
- stream->read(thisRegObj.used, 8);
-
- thisRegObj.pickupable = stream->readByte();
- thisRegObj.useWith = stream->readUint16LE();
- thisRegObj.replaceWith = stream->readUint16LE();
- thisRegObj.depth = stream->readByte();
- thisRegObj.bitmapPointer = stream->readUint32LE();
- thisRegObj.bitmapSize = stream->readUint16LE();
- thisRegObj.rotatingObjectAnimation = stream->readUint32LE();
- thisRegObj.rotatingObjectPalette = stream->readUint16LE();
- thisRegObj.dropOverlayX = stream->readUint16LE();
- thisRegObj.dropOverlayY = stream->readUint16LE();
- thisRegObj.dropOverlay = stream->readUint32LE();
- thisRegObj.dropOverlaySize = stream->readUint16LE();
- thisRegObj.objectIconBitmap = stream->readUint16LE();
- thisRegObj.xgrid1 = stream->readByte();
- thisRegObj.ygrid1 = stream->readByte();
- thisRegObj.xgrid2 = stream->readByte();
- thisRegObj.ygrid2 = stream->readByte();
- stream->read(thisRegObj.walkAreasPatch, 100);
- stream->read(thisRegObj.mouseGridPatch, 100);
-}
-
-void TotEngine::readItemRegister(uint itemPosition) {
- readItemRegister(_invItemData, itemPosition, _curObject);
-}
-
void TotEngine::drawLookAtItem(RoomObjectListEntry obj) {
_mouse->hide();
bar(0, 140, 319, 149, 0);
@@ -998,639 +906,6 @@ void TotEngine::copyProtection() {
//todo
}
-void credits();
-
-void drawCreditsScreen(byte *&backgroundPointer, uint &sizeAuxBG, byte *&auxBG) {
- palette intermediatePalette, darkPalette;
-
- Common::File ppFile;
-
- if (!ppFile.open("DIPLOMA.PAN")) {
- showError(315);
- }
- backgroundPointer = (byte *)malloc(64000);
- ppFile.read(intermediatePalette, 768);
- ppFile.read(backgroundPointer, 64000);
- ppFile.close();
-
- g_engine->_graphics->drawFullScreen(backgroundPointer);
-
- sizeAuxBG = imagesize(0, 0, 319, 59);
-
- // Screen is now backgroundPointer so auxBG contains a 320x60 crop of backgroundPointer
- auxBG = (byte *)malloc(sizeAuxBG);
- g_engine->_graphics->getImg(0, 0, 319, 59, auxBG);
-
- for (int i = 0; i <= 255; i++) {
- darkPalette[i * 3 + 0] = 0;
- darkPalette[i * 3 + 1] = 0;
- darkPalette[i * 3 + 2] = 0;
- // Adjust for 6-bit DAC color
- intermediatePalette[i * 3 + 0] <<= 2;
- intermediatePalette[i * 3 + 1] <<= 2;
- intermediatePalette[i * 3 + 2] <<= 2;
- }
-
- g_engine->_graphics->fadePalettes(darkPalette, intermediatePalette);
- g_engine->_graphics->copyPalette(intermediatePalette, g_engine->_graphics->_pal);
- if (g_engine->_cpCounter2 > 9)
- showError(274);
-}
-
-void putCreditsImg(uint x, uint y, byte *img1, byte *img2, bool direct) {
-
- uint16 wImg1, hImg1;
- uint horizontalAux;
- uint inc, inc2;
- byte *step;
-
- wImg1 = READ_LE_UINT16(img1);
- hImg1 = READ_LE_UINT16(img1 + 2);
-
- step = (byte *)malloc((wImg1 + 1) * (hImg1 + 1) + 4);
-
- horizontalAux = wImg1 + 1;
- uint yPos = hImg1 + y;
-
- // makes sure that if the image is at the bottom of the screen we chop the bottom part
- for (int i = yPos; i >= 200; i--)
- hImg1 -= 1;
-
- hImg1++;
-
- // Copies the crop in the background corresponding to the current credit window in img1
- for (int i = 0; i < hImg1; i++) {
- byte *src = img2 + (320 * (y + i)) + x;
- byte *dst = step + 4 + (horizontalAux * i);
- Common::copy(src, src + horizontalAux, dst);
- }
-
- for (int kk = 0; kk < hImg1; kk++) {
- inc2 = (kk * wImg1) + 4;
- yPos = kk + y;
- for (int jj = 0; jj <= wImg1; jj++) {
- inc = inc2 + jj;
- if ((direct && img1[inc] > 0) || (img1[inc] > 16 && yPos >= 66 && yPos <= 192)) {
- step[inc] = img1[inc];
- } else if (img1[inc] > 16) {
- switch (yPos) {
- case 59:
- case 199:
- step[inc] = img1[inc] + 210;
- break;
- case 60:
- case 198:
- step[inc] = img1[inc] + 180;
- break;
- case 61:
- case 197:
- step[inc] = img1[inc] + 150;
- break;
- case 62:
- case 196:
- step[inc] = img1[inc] + 120;
- break;
- case 63:
- case 195:
- step[inc] = img1[inc] + 90;
- break;
- case 64:
- case 194:
- step[inc] = img1[inc] + 60;
- break;
- case 65:
- case 193:
- step[inc] = img1[inc] + 30;
- break;
- }
- }
- }
- }
- // Wait until render tick
- do {
- g_engine->_chrono->updateChrono();
- g_system->delayMillis(10);
- } while (!gameTick && !g_engine->shouldQuit());
- gameTick = false;
-
- // Copies the credit window directly to the screen
- for (int i = 0; i < hImg1; i++) {
- byte *src = step + 4 + (horizontalAux * i);
- byte *dst = ((byte *)g_engine->_screen->getPixels()) + (320 * (y + i)) + x;
- Common::copy(src, src + horizontalAux, dst);
- }
- g_engine->_screen->addDirtyRect(Common::Rect(x, y, x + wImg1 + 1, y + hImg1 + 1));
- free(step);
-}
-
-void scrollCredit(
- int32 position,
- uint size,
- palette &pal2,
- byte *&background,
- bool &exit,
- int minHeight,
- bool withFade,
- bool refresh) {
- Common::File creditFile;
- if (!creditFile.open("CREDITOS.DAT")) {
- showError(270);
- }
- creditFile.seek(position);
- creditFile.read(g_engine->_sceneBackground, size);
- creditFile.read(pal2, 768);
- creditFile.close();
-
- for (int i = 16; i <= 255; i++) {
- // Adjust for 6-bit DAC
- pal2[i * 3 + 0] <<= 2;
- pal2[i * 3 + 1] <<= 2;
- pal2[i * 3 + 2] <<= 2;
-
- g_engine->_graphics->_pal[i * 3 + 0] = pal2[i * 3 + 0];
- g_engine->_graphics->_pal[i * 3 + 1] = pal2[i * 3 + 1];
- g_engine->_graphics->_pal[i * 3 + 2] = pal2[i * 3 + 2];
- }
-
- g_engine->_graphics->setPalette(&g_engine->_graphics->_pal[16 * 3 + 0], 16, 240);
- Common::Event e;
- bool keyPressed = false;
-
- // Loops an image from the bottom of the screen to the top
- for (int i = 199; i >= minHeight; i--) {
- while (g_system->getEventManager()->pollEvent(e)) {
- if (e.type == Common::EVENT_KEYUP) {
- keyPressed = true;
- }
- }
- putCreditsImg(85, i, g_engine->_sceneBackground, background, !withFade);
- if (keyPressed) {
- exit = true;
- break;
- }
- g_engine->_screen->update();
- g_system->delayMillis(10);
- if (g_engine->shouldQuit())
- break;
- }
- if (refresh) {
- g_engine->_graphics->copyFromScreen(background);
- }
-}
-
-void scrollSingleCredit(
- int32 pos,
- uint size,
- palette &pal2,
- byte *&background,
- bool &exit) {
- scrollCredit(
- pos,
- size,
- pal2,
- background,
- exit,
- 8,
- true,
- false);
-}
-
-void removeTitle(byte *&background2) {
- uint i2, j2;
- Common::Event e;
- for (int i1 = 1; i1 <= 15000; i1++) {
- while (g_system->getEventManager()->pollEvent(e)) {
- }
- i2 = Random(318);
- j2 = Random(58);
- byte *src = background2 + 4 + (j2 * 320) + i2;
- byte *dest = ((byte *)g_engine->_screen->getPixels()) + (j2 * 320) + i2;
- Common::copy(src, src + 2, dest);
-
- byte *src2 = background2 + 4 + ((j2 + 1) * 320) + i2;
- byte *dest2 = ((byte *)g_engine->_screen->getPixels()) + ((j2 + 1) * 320) + i2;
-
- Common::copy(src2, src2 + 2, dest2);
-
- i2 = Random(320);
- j2 = Random(60);
-
- byte *src3 = background2 + 4 + (j2 * 320) + i2;
- byte *dest3 = ((byte *)g_engine->_screen->getPixels()) + (j2 * 320) + i2;
- Common::copy(src3, src3 + 1, dest3);
- if (i1 % 200 == 0) {
- g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 60));
- g_engine->_screen->update();
- }
- if (g_engine->shouldQuit()) {
- break;
- }
- }
- g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 60));
- g_engine->_screen->update();
-}
-
-inline bool keyPressed() {
- Common::Event e;
- g_system->getEventManager()->pollEvent(e);
- return e.type == Common::EVENT_KEYUP;
-}
-
-void TotEngine::credits() {
- _saveAllowed = true;
- debug("Credits");
- palette pal2;
- byte *background;
- byte *background2;
- uint sizeBg2;
- bool exit;
-
- _mouse->hide();
- _graphics->totalFadeOut(0);
- _sound->fadeOutMusic();
- _screen->clear();
- _sound->playMidi("CREDITOS", true);
- _sound->fadeInMusic();
- drawCreditsScreen(background, sizeBg2, background2);
-
- exit = false;
-
- if (keyPressed() || exit)
- goto Lexit;
- scrollCredit(0, 8004, pal2, background, exit, 10, false, true);
- if (keyPressed() || exit)
- goto Lexit;
- scrollSingleCredit(8772, 8004, pal2, background, exit);
- if (keyPressed() || exit)
- goto Lexit;
- scrollSingleCredit(17544, 8004, pal2, background, exit);
- if (keyPressed() || exit)
- goto Lexit;
- scrollSingleCredit(26316, 7504, pal2, background, exit);
- if (keyPressed() || exit)
- goto Lexit;
- scrollSingleCredit(34588, 7504, pal2, background, exit);
- if (keyPressed() || exit)
- goto Lexit;
- scrollSingleCredit(42860, 8004, pal2, background, exit);
- if (keyPressed() || exit)
- goto Lexit;
- scrollSingleCredit(51632, 7504, pal2, background, exit);
- if (keyPressed() || exit)
- goto Lexit;
- removeTitle(background2);
- if (keyPressed() || exit)
- goto Lexit;
- _graphics->putImg(0, 0, background2);
- if (keyPressed() || exit)
- goto Lexit;
- _graphics->copyFromScreen(background);
- if (keyPressed() || exit)
- goto Lexit;
- scrollCredit(59904, 8004, pal2, background, exit, 10, false, true);
- if (keyPressed() || exit)
- goto Lexit;
- scrollSingleCredit(68676, 8004, pal2, background, exit);
- if (keyPressed() || exit)
- goto Lexit;
- scrollSingleCredit(77448, 8004, pal2, background, exit);
- if (keyPressed() || exit)
- goto Lexit;
- scrollSingleCredit(86220, 8004, pal2, background, exit);
- if (keyPressed() || exit)
- goto Lexit;
- scrollSingleCredit(94992, 8004, pal2, background, exit);
- if (keyPressed() || exit)
- goto Lexit;
- scrollSingleCredit(103764, 8004, pal2, background, exit);
- if (keyPressed() || exit)
- goto Lexit;
- scrollSingleCredit(112536, 8004, pal2, background, exit);
- if (keyPressed() || exit)
- goto Lexit;
- removeTitle(background2);
- if (keyPressed() || exit)
- goto Lexit;
- _graphics->putImg(0, 0, background2);
- if (keyPressed() || exit)
- goto Lexit;
- _graphics->copyFromScreen(background);
- if (keyPressed() || exit)
- goto Lexit;
- scrollCredit(121308, 8004, pal2, background, exit, 80, false, true);
-Lexit:
- delay(1000);
- _graphics->totalFadeOut(0);
- _sound->fadeOutMusic();
- _screen->clear();
- _sound->playMidi("INTRODUC", true);
- _sound->fadeInMusic();
- _mouse->show();
- free(background);
- free(background2);
-}
-
-void TotEngine::introduction() {
- _saveAllowed = false;
- _mouse->hide();
- bool exitPressed;
- uint loopCount;
- bool isSpanish = _lang == Common::ES_ESP;
- const char *const *messages = (isSpanish) ? fullScreenMessages[0] : fullScreenMessages[1];
- const long *offsets = (_lang == Common::ES_ESP) ? flcOffsets[0] : flcOffsets[1];
- exitPressed = false;
- _graphics->totalFadeOut(0);
-
- if (_cpCounter > 6)
- showError(270);
- _screen->clear();
- drawFlc(136, 53, offsets[2], 136, 9, 1, true, true, false, exitPressed);
- if (exitPressed)
- goto Lsalirpres;
- drawFlc(135, 54, offsets[3], 0, 9, 2, true, true, false, exitPressed);
- if (exitPressed)
- goto Lsalirpres;
- _graphics->totalFadeOut(0);
- _screen->clear();
- if(isSpanish) {
- littText(25, 20, messages[0], 253);
- littText(25, 35, messages[1], 253);
- littText(25, 50, messages[2], 253);
- littText(25, 65, messages[3], 253);
- littText(25, 80, messages[4], 253);
- littText(25, 95, messages[5], 253);
- littText(25, 120, messages[6], 253);
- littText(25, 140, messages[7], 253);
- littText(25, 155, messages[8], 253);
- }
- else {
- littText(25, 35, messages[0], 253);
- littText(25, 55, messages[1], 253);
- littText(25, 75, messages[2], 253);
- littText(25, 95, messages[3], 253);
- littText(25, 115, messages[4], 253);
- littText(25, 135, messages[5], 253);
- }
- if(shouldQuit()){
- return;
- }
- _graphics->totalFadeIn(0, "DEFAULT");
- _screen->markAllDirty();
- _screen->update();
- loopCount = 0;
-
- do {
- _chrono->updateChrono();
- Common::Event e;
- g_system->getEventManager()->pollEvent(e);
- if (e.type == Common::EVENT_KEYDOWN || e.type == Common::EVENT_LBUTTONUP) {
- goto Lsalirpres;
- }
-
- if (gameTick) {
- loopCount += 1;
- }
- g_system->delayMillis(10);
- } while (loopCount < 180 && !shouldQuit());
-
- _graphics->totalFadeOut(0);
- _screen->clear();
- drawFlc(0, 0, offsets[4], 0, 9, 3, true, true, false, exitPressed);
- if (exitPressed)
- goto Lsalirpres;
- drawFlc(110, 30, offsets[5], 2, 9, 4, false, true, false, exitPressed);
- if (exitPressed)
- goto Lsalirpres;
- drawFlc(110, 30, offsets[6], 3, 9, 5, false, true, false, exitPressed);
- if (exitPressed)
- goto Lsalirpres;
- drawFlc(110, 30, offsets[7], 0, 9, 0, false, true, false, exitPressed);
- if (exitPressed)
- goto Lsalirpres;
- drawFlc(110, 30, offsets[8], isSpanish? 4:8, 9, 6, false, true, false, exitPressed);
- if (exitPressed)
- goto Lsalirpres;
- drawFlc(110, 30, offsets[9], 3, 9, 7, false, true, false, exitPressed);
- if (exitPressed)
- goto Lsalirpres;
- drawFlc(110, 30, offsets[8], isSpanish? 3:8, 9, 8, false, true, false, exitPressed);
- if (exitPressed)
- goto Lsalirpres;
- drawFlc(110, 30, offsets[9], 2, 9, 9, false, true, false, exitPressed);
- if (exitPressed)
- goto Lsalirpres;
- drawFlc(0, 0, offsets[10], 0, 9, 0, false, true, false, exitPressed);
- if (exitPressed)
- goto Lsalirpres;
- drawFlc(235, 100, offsets[11], 3, 9, 10, false, true, false, exitPressed);
- if (exitPressed)
- goto Lsalirpres;
- drawFlc(150, 40, offsets[12], 0, 9, 11, false, true, false, exitPressed);
- if (exitPressed)
- goto Lsalirpres;
- drawFlc(235, 100, offsets[11], 3, 9, 12, false, true, false, exitPressed);
- if (exitPressed)
- goto Lsalirpres;
- drawFlc(150, 40, offsets[12], isSpanish? 0:2, 9, 13, false, true, false, exitPressed);
- if (exitPressed)
- goto Lsalirpres;
- drawFlc(235, 100, offsets[11], isSpanish? 3:8, 9, 14, false, true, false, exitPressed);
- if (exitPressed)
- goto Lsalirpres;
- drawFlc(150, 40, offsets[12], 0, 9, 15, false, true, false, exitPressed);
- if (exitPressed)
- goto Lsalirpres;
- drawFlc(173, 98, offsets[13], 0, 9, 0, false, true, false, exitPressed);
- if (exitPressed)
- goto Lsalirpres;
- drawFlc(224, 100, offsets[14], 2, 9, 16, false, true, false, exitPressed);
- if (exitPressed)
- goto Lsalirpres;
- drawFlc(0, 0, offsets[15], 0, 18, 17, false, true, false, exitPressed);
- if (exitPressed)
- goto Lsalirpres;
- drawFlc(150, 40, offsets[16], 0, 9, 18, false, true, false, exitPressed);
- if (exitPressed)
- goto Lsalirpres;
- delay(1000);
-Lsalirpres:
- debug("Exiting intro!");
- _graphics->totalFadeOut(0);
- _screen->clear();
- _mouse->show();
-}
-
-void TotEngine::firstIntroduction() {
- if (!_firstTimeDone && !_isIntroSeen) {
- introduction();
- _firstTimeDone = true;
- ConfMan.setBool("introSeen", true);
- ConfMan.flushToDisk();
- }
-}
-
-void TotEngine::initialLogo() {
- bool foobar = false;
- long offset = (_lang == Common::ES_ESP) ? flcOffsets[0][0] : flcOffsets[1][0];
- drawFlc(0, 0, offset, 0, 18, 25, false, false, false, foobar);
- delay(1000);
-}
-
-void TotEngine::startMenu(bool fade) {
- bool bar = false;
- bool validOption = false;
- _sound->stopVoc();
-
- long offset = (_lang == Common::ES_ESP) ? flcOffsets[0][1] : flcOffsets[1][1];
-
- if (fade)
- drawFlc(0, 0, offset, 0, 9, 0, true, false, false, bar);
- else
- drawFlc(0, 0, offset, 0, 9, 0, false, false, false, bar);
- if (_cpCounter2 > 10)
- showError(274);
- _mouse->mouseX = 160;
- _mouse->mouseY = 95;
- _mouse->mouseMaskIndex = 1;
- _mouse->warpMouse(_mouse->mouseMaskIndex, _mouse->mouseX, _mouse->mouseY);
- Common::Event e;
- do {
- _chrono->updateChrono();
- _mouse->animateMouseIfNeeded();
- while (g_system->getEventManager()->pollEvent(e)) {
- if (isMouseEvent(e)) {
- _mouse->warpMouse(e.mouse);
- }
- if (e.type == Common::EVENT_KEYDOWN) {
- if (e.kbd.keycode == Common::KEYCODE_ESCAPE) {
- exitToDOS();
- }
- }
- if (e.type == Common::EVENT_LBUTTONUP) {
- uint x = e.mouse.x + 7;
- uint y = e.mouse.y + 7;
- if (y > 105 && y < 120) {
- if (x > 46 && x < 145) {
- _startNewGame = true;
- _continueGame = false;
- validOption = true;
- } else if (x > 173 && x < 267) {
- credits();
- if(!g_engine->shouldQuit()) {
- drawFlc(0, 0, offset, 0, 9, 0, true, false, false, bar);
- }
- }
- } else if (y > 140 && y < 155) {
- if (x > 173 && x < 292) {
- _graphics->totalFadeOut(0);
- _screen->clear();
- introduction();
- if(!g_engine->shouldQuit()) {
- drawFlc(0, 0, offset, 0, 9, 0, true, false, false, bar);
- }
- } else if (x >= 18 && x <= 145) {
- _isSavingDisabled = true;
- bool result = loadGameDialog();
- _isSavingDisabled = false;
- if(result) {
- _startNewGame = false;
- _continueGame = false;
- validOption = true;
- }
- }
- } else if (y > 174 && y < 190) {
- if (x > 20 && x < 145) {
- _startNewGame = false;
- validOption = true;
- _continueGame = true;
- } else if (x > 173 && y < 288) {
- exitToDOS();
- }
- }
- }
- }
- _screen->update();
- g_system->delayMillis(10);
- } while (!validOption && !shouldQuit());
-}
-
-void exitGame() {
- g_engine->_graphics->clear();
- g_system->quit();
-}
-
-void TotEngine::clearGame() {
- debug("releasing game...");
- resetGameState();
- clearAnims();
- clearVars();
-}
-
-void TotEngine::exitToDOS() {
- debug("Exit to dos!");
- uint oldMousePosX, oldMousePosY, dialogSize;
- byte oldMouseMask;
- char exitChar;
-
- oldMousePosX = _mouse->mouseX;
- oldMousePosY = _mouse->mouseY;
- oldMouseMask = _mouse->mouseMaskIndex;
- _mouse->hide();
- dialogSize = imagesize(58, 48, 262, 120);
- byte *dialogBackground = (byte *)malloc(dialogSize);
- _graphics->getImg(58, 48, 262, 120, dialogBackground);
-
- drawMenu(7);
- _mouse->mouseX = 160;
- _mouse->mouseY = 90;
- _mouse->mouseMaskIndex = 1;
-
- _mouse->setMouseArea(Common::Rect(115, 80, 190, 100));
- _mouse->warpMouse(_mouse->mouseMaskIndex, _mouse->mouseX, _mouse->mouseY);
- Common::Event e;
- const char hotKeyYes = hotKeyFor(YES);
- const char hotKeyNo = hotKeyFor(NO);
- exitChar = '@';
- do {
- _chrono->updateChrono();
- _mouse->animateMouseIfNeeded();
-
- while (g_system->getEventManager()->pollEvent(e)) {
- if (isMouseEvent(e)) {
- _mouse->warpMouse(e.mouse);
- }
- if (e.type == Common::EVENT_KEYDOWN) {
- if (e.kbd.keycode == Common::KEYCODE_ESCAPE) {
- exitChar = '\33';
- } else if (e.kbd.keycode == hotKeyYes) {
- debug("would exit game now");
- free(dialogBackground);
- exitGame();
- } else if (e.kbd.keycode == hotKeyNo) {
- exitChar = '\33';
- }
- } else if (e.type == Common::EVENT_LBUTTONUP) {
- uint x = e.mouse.x;
- if (x < 145) {
- free(dialogBackground);
- g_system->quit();
- } else if (x > 160) {
- exitChar = '\33';
- }
- }
- }
- _screen->update();
- } while (exitChar != '\33' && !shouldQuit());
- debug("finished exitToDos");
- _graphics->putImg(58, 48, dialogBackground);
- _mouse->mouseX = oldMousePosX;
- _mouse->mouseY = oldMousePosY;
- _mouse->mouseMaskIndex = oldMouseMask;
- _mouse->show();
- free(dialogBackground);
- _mouse->setMouseArea(Common::Rect(0, 0, 305, 185));
-}
-
void TotEngine::soundControls() {
uint oldMouseX,
oldMouseY,
@@ -1805,418 +1080,6 @@ void TotEngine::soundControls() {
_mouse->setMouseArea(Common::Rect(0, 0, 305, 185));
}
-void TotEngine::sacrificeScene() {
- _saveAllowed = false;
- palette palaux;
-
- Common::File file;
- bool isSpanish = (_lang == Common::ES_ESP);
- const char *const *messages = (isSpanish) ? fullScreenMessages[0] : fullScreenMessages[1];
-
- const long *offsets = (isSpanish) ? flcOffsets[0] : flcOffsets[1];
-
- _sound->stopVoc();
- bool exitPressed = _currentRoomData->paletteAnimationFlag;
- _currentRoomData->paletteAnimationFlag = false;
-
- bar(0, 139, 319, 149, 0);
- bar(10, 10, 310, 120, 0);
- if (isSpanish) {
- littText(10, 10, messages[9], 200);
- littText(10, 30, messages[10], 200);
- littText(10, 50, messages[11], 200);
- littText(10, 70, messages[12], 200);
- littText(10, 90, messages[13], 200);
- } else {
- littText(10, 20, messages[9], 200);
- littText(10, 40, messages[10], 200);
- littText(10, 60, messages[11], 200);
- littText(10, 80, messages[12], 200);
- littText(10, 100, messages[13], 200);
- }
-
- for (int i = 0; i <= 28; i++)
- setRGBPalette(200, i * 2, i * 2, i * 2);
-
- delay(10000);
- if (shouldQuit())
- return;
-
- for (int i = 28; i >= 0; i--)
- setRGBPalette(200, i * 2, i * 2, i * 2);
-
- bar(10, 10, 310, 120, 0);
- if (isSpanish) {
- littText(10, 10, messages[14], 200);
- littText(10, 30, messages[15], 200);
- littText(10, 50, messages[16], 200);
- littText(10, 70, messages[17], 200);
- littText(10, 90, messages[18], 200);
- } else {
- littText(10, 20, messages[14], 200);
- littText(10, 40, messages[15], 200);
- littText(10, 60, messages[16], 200);
- littText(10, 80, messages[17], 200);
- }
-
- for (int i = 0; i <= 28; i++)
- setRGBPalette(200, i * 2, i * 2, i * 2);
- delay(10000);
- if (shouldQuit())
- return;
-
- for (int i = 28; i >= 0; i--)
- setRGBPalette(200, i * 2, i * 2, i * 2);
-
- bar(10, 10, 310, 120, 0);
- if (isSpanish) {
- littText(10, 10, messages[19], 200);
- littText(10, 50, messages[20], 200);
- littText(10, 70, messages[21], 200);
- littText(10, 90, messages[22], 200);
- } else {
- littText(10, 30, messages[19], 200);
- littText(10, 60, messages[20], 200);
- littText(10, 80, messages[21], 200);
- }
-
- for (int i = 0; i <= 28; i++)
- setRGBPalette(200, i * 2, i * 2, i * 2);
- delay(10000);
- if (shouldQuit())
- return;
-
- for (int i = 28; i >= 0; i--)
- setRGBPalette(200, i * 2, i * 2, i * 2);
- bar(10, 10, 310, 120, 0);
-
- if (!file.open("SALONREC.PAN")) {
- showError(318);
- }
- file.read(palaux, 768);
- file.read(_sceneBackground, 44800);
- file.close();
-
- g_engine->_graphics->_pal[0] = 0;
- g_engine->_graphics->_pal[1] = 0;
- g_engine->_graphics->_pal[2] = 0;
- for (int i = 1; i <= 234; i++) {
- g_engine->_graphics->_pal[i * 3 + 1] = palaux[i * 3 + 1] << 2;
- g_engine->_graphics->_pal[i * 3 + 2] = palaux[i * 3 + 2] << 2;
- g_engine->_graphics->_pal[i * 3 + 3] = palaux[i * 3 + 3] << 2;
- }
-
- // We dont have the width and height here in the byte buffer
- _graphics->drawScreen(_sceneBackground, false);
- _graphics->partialFadeIn(234);
- _sound->stopVoc();
-
- if (shouldQuit())
- return;
-
- drawFlc(0, 0, offsets[17], 0, 9, 19, false, false, true, exitPressed);
- _graphics->totalFadeOut(128);
- _sound->stopVoc();
- delay(1000);
- if (shouldQuit())
- return;
-
- _sound->fadeOutMusic();
- _sound->playMidi("SACRIFIC", true);
- _sound->fadeInMusic();
- _graphics->clear();
-
- littText(10, 31, messages[23], 254);
- littText(10, 29, messages[23], 254);
- littText(11, 30, messages[23], 254);
- littText(9, 30, messages[23], 254);
-
- littText(10, 51, messages[24], 254);
- littText(10, 49, messages[24], 254);
- littText(11, 50, messages[24], 254);
- littText(9, 50, messages[24], 254);
-
- littText(10, 71, messages[25], 254);
- littText(10, 69, messages[25], 254);
- littText(11, 70, messages[25], 254);
- littText(9, 70, messages[25], 254);
-
- littText(10, 30, messages[23], 255);
- littText(10, 50, messages[24], 255);
- littText(10, 70, messages[25], 255);
-
- for (int i = 0; i < 32; i++) {
- setRGBPalette(255, 32 + i, i * 2, i * 2);
- setRGBPalette(254, 32 - i, 0, 0);
- }
-
- delay(10000);
- if (shouldQuit())
- return;
-
- for (int i = 32; i > 0; i--) {
- setRGBPalette(255, 63 - (32 - i), i * 2, i * 2);
- setRGBPalette(254, 32 - i, 0, 0);
- }
- delay(2000);
-
- if (!file.open("SACRIFIC.PAN")) {
- showError(318);
- }
- file.read(palaux, 768);
-
- for (int i = 0; i < 256; i++) {
- palaux[i * 3 + 0] <<= 2;
- palaux[i * 3 + 1] <<= 2;
- palaux[i * 3 + 2] <<= 2;
- }
-
- file.read(_sceneBackground, 64000);
- file.close();
- _graphics->drawFullScreen(_sceneBackground);
-
- palaux[0] = 0;
- palaux[1] = 0;
- palaux[2] = 0;
-
- _graphics->redFadeIn(palaux);
-
- drawFlc(112, 57, offsets[18], 33, 9, 20, true, false, true, exitPressed);
- _sound->autoPlayVoc("REZOS", 0, 0);
- if (shouldQuit())
- return;
-
- drawFlc(42, 30, offsets[19], 0, 9, 27, false, false, false, exitPressed);
-
- if (shouldQuit())
- return;
-
- _graphics->totalFadeOut(128);
- _sound->stopVoc();
- _graphics->clear();
-
- littText(10, 21, messages[26], 254);
- littText(10, 19, messages[26], 254);
- littText(11, 20, messages[26], 254);
- littText(9, 20, messages[26], 254);
-
- littText(10, 41, messages[27], 254);
- littText(10, 39, messages[27], 254);
- littText(11, 40, messages[27], 254);
- littText(9, 40, messages[27], 254);
-
- littText(10, 61, messages[28], 254);
- littText(10, 59, messages[28], 254);
- littText(11, 60, messages[28], 254);
- littText(9, 60, messages[28], 254);
-
- littText(10, 81, messages[29], 254);
- littText(10, 79, messages[29], 254);
- littText(11, 80, messages[29], 254);
- littText(9, 80, messages[29], 254);
-
- littText(10, 101, messages[30], 254);
- littText(10, 99, messages[30], 254);
- littText(11, 100, messages[30], 254);
- littText(9, 100, messages[30], 254);
-
- littText(10, 121, messages[31], 254);
- littText(10, 119, messages[31], 254);
- littText(11, 120, messages[31], 254);
- littText(9, 120, messages[31], 254);
-
- littText(10, 141, messages[32], 254);
- littText(10, 139, messages[32], 254);
- littText(11, 140, messages[32], 254);
- littText(9, 140, messages[32], 254);
-
- if (!isSpanish) {
- littText(10, 161, messages[56], 254);
- littText(10, 159, messages[56], 254);
- littText(11, 160, messages[56], 254);
- littText(9, 160, messages[56], 254);
-
- littText(10, 181, messages[57], 254);
- littText(10, 179, messages[57], 254);
- littText(11, 180, messages[57], 254);
- littText(9, 180, messages[57], 254);
- }
-
- littText(10, 20, messages[26], 255);
- littText(10, 40, messages[27], 255);
- littText(10, 60, messages[28], 255);
- littText(10, 80, messages[29], 255);
- littText(10, 100, messages[30], 255);
- littText(10, 120, messages[31], 255);
- littText(10, 140, messages[32], 255);
-
- if (!isSpanish) {
- littText(10, 160, messages[56], 255);
- littText(10, 180, messages[57], 255);
- }
-
- for (int i = 0; i <= 31; i++) {
- setRGBPalette(255, 32 + i, i * 2, i * 2);
- setRGBPalette(254, 32 - i, 0, 0);
- }
- delay(16000);
- if (shouldQuit())
- return;
-
- for (int i = 31; i >= 0; i--) {
- setRGBPalette(255, 63 - (32 - i), i * 2, i * 2);
- setRGBPalette(254, 32 - i, 0, 0);
- }
- delay(2000);
- if (shouldQuit())
- return;
-
- _graphics->clear();
-
- littText(10, 21, messages[33], 254);
- littText(10, 19, messages[33], 254);
- littText(11, 20, messages[33], 254);
- littText(9, 20, messages[33], 254);
-
- littText(10, 41, messages[34], 254);
- littText(10, 39, messages[34], 254);
- littText(11, 40, messages[34], 254);
- littText(9, 40, messages[34], 254);
-
- littText(10, 61, messages[35], 254);
- littText(10, 59, messages[35], 254);
- littText(11, 60, messages[35], 254);
- littText(9, 60, messages[35], 254);
- if (isSpanish) {
- littText(10, 81, messages[36], 254);
- littText(10, 79, messages[36], 254);
- littText(11, 80, messages[36], 254);
- littText(9, 80, messages[36], 254);
-
- littText(10, 101, messages[37], 254);
- littText(10, 99, messages[37], 254);
- littText(11, 100, messages[37], 254);
- littText(9, 100, messages[37], 254);
-
- littText(10, 121, messages[38], 254);
- littText(10, 119, messages[38], 254);
- littText(11, 120, messages[38], 254);
- littText(9, 120, messages[38], 254);
-
- littText(10, 141, messages[39], 254);
- littText(10, 139, messages[39], 254);
- littText(11, 140, messages[39], 254);
- littText(9, 140, messages[39], 254);
- }
-
- littText(10, 20, messages[33], 255);
- littText(10, 40, messages[34], 255);
- littText(10, 60, messages[35], 255);
- if (isSpanish) {
- littText(10, 80, messages[36], 255);
- littText(10, 100, messages[37], 255);
- littText(10, 120, messages[38], 255);
- littText(10, 140, messages[39], 255);
- }
-
- for (int i = 0; i < 32; i++) {
- setRGBPalette(255, 32 + i, i * 2, i * 2);
- setRGBPalette(254, 32 - i, 0, 0);
- }
- delay(13000);
- if (shouldQuit())
- return;
-
- for (int i = 32; i > 0; i--) {
- setRGBPalette(255, 63 - (32 - i), i * 2, i * 2);
- setRGBPalette(254, 32 - i, 0, 0);
- }
- delay(2000);
- if (shouldQuit())
- return;
- _graphics->clear();
-
- littText(10, 61, messages[40], 254);
- littText(10, 59, messages[40], 254);
- littText(11, 60, messages[40], 254);
- littText(9, 60, messages[40], 254);
-
- littText(10, 81, messages[41], 254);
- littText(10, 79, messages[41], 254);
- littText(11, 80, messages[41], 254);
- littText(9, 80, messages[41], 254);
-
- littText(10, 101, messages[42], 254);
- littText(10, 99, messages[42], 254);
- littText(11, 100, messages[42], 254);
- littText(9, 100, messages[42], 254);
-
- littText(10, 60, messages[40], 255);
- littText(10, 80, messages[41], 255);
- littText(10, 100, messages[42], 255);
-
- for (int i = 0; i < 32; i++) {
- setRGBPalette(255, 32 + i, i * 2, i * 2);
- setRGBPalette(254, 32 - i, 0, 0);
- }
- delay(7000);
- if (shouldQuit())
- return;
- for (int i = 32; i > 0; i--) {
- setRGBPalette(255, 63 - (32 - i), i * 2, i * 2);
- setRGBPalette(254, 32 - i, 0, 0);
- }
- delay(2000);
- _graphics->totalFadeOut(0);
- _currentRoomData->paletteAnimationFlag = exitPressed;
- _saveAllowed = true;
-}
-
-void TotEngine::ending() {
- _saveAllowed = false;
- bool exitRequested;
-
- const char *const *messages = (_lang == Common::ES_ESP) ? fullScreenMessages[0] : fullScreenMessages[1];
- const long *offsets = (_lang == Common::ES_ESP) ? flcOffsets[0] : flcOffsets[1];
-
- littText(10, 41, messages[43], 249);
- littText(10, 39, messages[43], 249);
- littText(11, 40, messages[43], 249);
- littText(9, 40, messages[43], 249);
-
- littText(10, 61, messages[44], 249);
- littText(10, 59, messages[44], 249);
- littText(11, 60, messages[44], 249);
- littText(9, 60, messages[44], 249);
-
- littText(10, 40, messages[43], 253);
- littText(10, 60, messages[44], 253);
- if(shouldQuit()) {
- return;
- }
- delay(4000);
- _graphics->totalFadeOut(0);
- _graphics->clear();
- if(shouldQuit()) {
- return;
- }
- _sound->fadeOutMusic();
- _sound->playMidi("SACRIFIC", true);
- _sound->fadeInMusic();
- drawFlc(0, 0, offsets[30], 12, 9, 26, true, false, false, exitRequested);
- if(exitRequested){
- return;
- }
- drawFlc(0, 0, offsets[31], 0, 9, 0, false, false, false, exitRequested);
- if(exitRequested){
- return;
- }
- delay(1000);
- _sound->playVoc("NOOO", 0, 0);
- delay(3000);
- _saveAllowed = true;
-}
-
void TotEngine::loadBat() {
Common::File animFile;
@@ -2300,7 +1163,6 @@ void TotEngine::disableSecondAnimation() {
assembleScreen();
}
-
void TotEngine::setRoomTrajectories(int animationHeight, int animationWidth, TRAJECTORIES_OP op, bool fixGrids) {
// add to restore the room, subtract to adjust before loading the screen
diff --git a/engines/tot/saveload.cpp b/engines/tot/saveload.cpp
index 455dbe084bf..17f71d5ccfa 100644
--- a/engines/tot/saveload.cpp
+++ b/engines/tot/saveload.cpp
@@ -129,12 +129,10 @@ bool syncGeneralData(Common::Serializer &s, SavedGame &game) {
s.syncAsUint16LE(game.niche[0][indiaux]);
s.syncAsUint16LE(game.niche[1][indiaux]);
}
-
- return s.bytesSynced() == 1740;
+ return true;
}
bool syncRoomData(Common::Serializer &s, Common::MemorySeekableReadWriteStream *roomStream) {
- uint32 startBytes = s.bytesSynced();
if (s.isSaving()) {
// Restore trajectory
@@ -161,11 +159,10 @@ bool syncRoomData(Common::Serializer &s, Common::MemorySeekableReadWriteStream *
debug("Loading room data now");
g_engine->_rooms = new Common::MemorySeekableReadWriteStream(roomBuf, size, DisposeAfterUse::NO);
}
- return s.bytesSynced() - startBytes == 347392;
+ return true;
}
bool syncConversationData(Common::Serializer &s, Common::MemorySeekableReadWriteStream *conversations) {
- uint32 startBytes = s.bytesSynced();
int size = conversations->size();
if (s.isSaving()) {
@@ -183,27 +180,26 @@ bool syncConversationData(Common::Serializer &s, Common::MemorySeekableReadWrite
debug("Loading conversation data now");
g_engine->_conversationData = new Common::MemorySeekableReadWriteStream(convBuf, size, DisposeAfterUse::NO);
}
- return s.bytesSynced() - startBytes == 2304;
+ return true;
}
-bool syncItemData(Common::Serializer &s, Common::MemorySeekableReadWriteStream *items) {
- uint32 startBytes = s.bytesSynced();
- int size = items->size();
+bool syncItemData(Common::Serializer &s, Common::MemorySeekableReadWriteStream *sceneObjects) {
+ int size = sceneObjects->size();
if (s.isSaving()) {
byte *objBuf = (byte *)malloc(size);
- items->seek(0, 0);
- items->read(objBuf, size);
+ sceneObjects->seek(0, 0);
+ sceneObjects->read(objBuf, size);
s.syncBytes(objBuf, size);
free(objBuf);
}
if (s.isLoading()) {
- delete (g_engine->_invItemData);
+ delete (g_engine->_sceneObjectsData);
byte *objBuf = (byte *)malloc(size);
s.syncBytes(objBuf, size);
debug("Loading item data now");
- g_engine->_invItemData = new Common::MemorySeekableReadWriteStream(objBuf, size, DisposeAfterUse::NO);
+ g_engine->_sceneObjectsData = new Common::MemorySeekableReadWriteStream(objBuf, size, DisposeAfterUse::NO);
}
- return s.bytesSynced() - startBytes == 200322;
+ return true;
}
Common::Error syncSaveData(Common::Serializer &ser, SavedGame &game) {
@@ -215,7 +211,7 @@ Common::Error syncSaveData(Common::Serializer &ser, SavedGame &game) {
warning("Error while synchronizing room data");
return Common::kUnknownError;
}
- if (!syncItemData(ser, g_engine->_invItemData)) {
+ if (!syncItemData(ser, g_engine->_sceneObjectsData)) {
warning("Error while syncrhonizing object data");
return Common::kUnknownError;
}
@@ -243,17 +239,16 @@ Common::Error TotEngine::syncGame(Common::Serializer &s) {
displayLoading();
loadCharAnimation();
- loadObjects();
+ loadInventory();
g_engine->_graphics->loadPaletteFromFile("DEFAULT");
initScreenPointers();
g_engine->_graphics->totalFadeOut(0);
g_engine->_graphics->clear();
- displayLoading();
initializeScreenFile();
initializeObjectFile();
- readConversationFile(Common::String("CONVERSA.TRE"));
+ readConversationFile();
// }
result = syncSaveData(s, loadedGame);
loadGame(loadedGame);
diff --git a/engines/tot/tot.cpp b/engines/tot/tot.cpp
index 304cbc94667..ed9e4f4101f 100644
--- a/engines/tot/tot.cpp
+++ b/engines/tot/tot.cpp
@@ -29,12 +29,12 @@
#include "graphics/framelimiter.h"
#include "graphics/paletteman.h"
+#include "tot/anims.h"
#include "tot/chrono.h"
#include "tot/console.h"
#include "tot/detection.h"
#include "tot/debug.h"
#include "tot/dialog.h"
-#include "tot/font/bgifont.h"
#include "tot/sound.h"
#include "tot/tot.h"
#include "tot/util.h"
@@ -49,7 +49,7 @@ TotEngine::TotEngine(OSystem *syst, const ADGameDescription *gameDesc) : Engine(
_lang = _gameDescription->language;
_rooms = nullptr;
_conversationData = nullptr;
- _invItemData = nullptr;
+ _sceneObjectsData = nullptr;
}
TotEngine::~TotEngine() {
@@ -101,7 +101,6 @@ Common::Error TotEngine::run() {
return Common::kNoError;
}
-
int TotEngine::engineStart() {
if (ConfMan.hasKey("save_slot")) {
return startGame();
@@ -110,7 +109,7 @@ int TotEngine::engineStart() {
displayLoading();
loadCharAnimation();
- loadObjects();
+ loadInventory();
_sound->setMidiVolume(0, 0);
_sound->playMidi("SILENT", false);
@@ -128,11 +127,11 @@ int TotEngine::engineStart() {
_sound->setMidiVolume(3, 3);
firstIntroduction();
_mouse->warpMouse(1, _mouse->mouseX, _mouse->mouseY);
- startMenu(_firstTimeDone);
+ mainMenu(_firstTimeDone);
if (_startNewGame && !shouldQuit()) {
newGame();
} else if (_continueGame && !shouldQuit()) {
- loadTemporaryGame();
+ resumeGame();
} else {
}
@@ -140,7 +139,7 @@ int TotEngine::engineStart() {
return startGame();
}
-void TotEngine::loadTemporaryGame() {
+void TotEngine::resumeGame() {
loadGameState(getMetaEngine()->getAutosaveSlot());
}
@@ -316,19 +315,19 @@ int TotEngine::startGame() {
switch (_currentRoomData->code) {
case 20:
if (_niche[0][_niche[0][3]] > 0)
- readItemRegister(_niche[0][_niche[0][3]]);
+ readObject(_niche[0][_niche[0][3]]);
else
- readItemRegister(562);
+ readObject(562);
break;
case 24:
if (_niche[1][_niche[1][3]] > 0)
- readItemRegister(_niche[1][_niche[1][3]]);
+ readObject(_niche[1][_niche[1][3]]);
else
- readItemRegister(562);
+ readObject(562);
break;
}
else
- readItemRegister(_currentRoomData->screenObjectIndex[_currentRoomData->mouseGrid[_destinationX][_destinationY]]->fileIndex);
+ readObject(_currentRoomData->screenObjectIndex[_currentRoomData->mouseGrid[_destinationX][_destinationY]]->fileIndex);
if (_curObject.lookAtTextRef > 0)
drawText(_curObject.lookAtTextRef);
_actionCode = 0;
@@ -430,19 +429,19 @@ int TotEngine::startGame() {
switch (_currentRoomData->code) {
case 20:
if (_niche[0][_niche[0][3]] > 0)
- readItemRegister(_niche[0][_niche[0][3]]);
+ readObject(_niche[0][_niche[0][3]]);
else
- readItemRegister(562);
+ readObject(562);
break;
case 24:
if (_niche[1][_niche[1][3]] > 0)
- readItemRegister(_niche[1][_niche[1][3]]);
+ readObject(_niche[1][_niche[1][3]]);
else
- readItemRegister(562);
+ readObject(562);
break;
}
else
- readItemRegister(obj.fileIndex);
+ readObject(obj.fileIndex);
if (_curObject.lookAtTextRef > 0)
drawText(_curObject.lookAtTextRef);
_actionCode = 0;
@@ -471,13 +470,13 @@ int TotEngine::startGame() {
_graphics->clear();
_sound->playMidi("INTRODUC", true);
_sound->fadeInMusic();
- startMenu(true);
+ mainMenu(true);
verifyCopyProtection2();
if (_startNewGame && !shouldQuit()) {
newGame();
} else if (_continueGame && !shouldQuit())
- loadTemporaryGame();
+ resumeGame();
else {
_isSavingDisabled = true;
openMainMenuDialog();
@@ -516,7 +515,7 @@ int TotEngine::startGame() {
showError(274);
sacrificeScene();
_graphics->clear();
- loadObjects();
+ loadInventory();
_graphics->loadPaletteFromFile("SEGUNDA");
_currentTrajectoryIndex = 0;
_characterPosX = 160;
@@ -603,7 +602,7 @@ void TotEngine::newGame() {
_graphics->clear();
displayLoading();
freeInventory();
- loadObjects();
+ loadInventory();
resetGameState();
_inGame = true;
for (int i = 0; i < kInventoryIconCount; i++) {
@@ -611,7 +610,7 @@ void TotEngine::newGame() {
_inventory[i].code = 0;
_inventory[i].objectName = getObjectName(10);
}
- readConversationFile(Common::String("CONVERSA.TRE"));
+ readConversationFile();
initializeScreenFile();
initializeObjectFile();
_graphics->loadPaletteFromFile("DEFAULT");
@@ -1131,6 +1130,7 @@ void TotEngine::initializeScreenFile() {
}
void TotEngine::resetGameState() {
+ debug("Reset game state");
_characterPosX = 160;
_characterPosY = 80;
_iframe = 0;
@@ -1279,7 +1279,7 @@ void TotEngine::initVars() {
_backgroundCopy = NULL;
_conversationData = NULL;
_rooms = NULL;
- _invItemData = NULL;
+ _sceneObjectsData = NULL;
for(int i = 0; i < kNumScreenOverlays; i++) {
_screenLayers[i] = NULL;
@@ -1316,8 +1316,8 @@ void TotEngine::clearVars() {
if(_rooms != NULL) {
free(_rooms);
}
- if(_invItemData != NULL) {
- free(_invItemData);
+ if(_sceneObjectsData != NULL) {
+ free(_sceneObjectsData);
}
for(int i = 0; i < kNumScreenOverlays; i++) {
if(_screenLayers[i] != NULL) {
@@ -1346,4 +1346,158 @@ void TotEngine::clearVars() {
}
}
+void TotEngine::mainMenu(bool fade) {
+ bool bar = false;
+ bool validOption = false;
+ _sound->stopVoc();
+
+ long offset = (_lang == Common::ES_ESP) ? flcOffsets[0][1] : flcOffsets[1][1];
+
+ if (fade)
+ drawFlc(0, 0, offset, 0, 9, 0, true, false, false, bar);
+ else
+ drawFlc(0, 0, offset, 0, 9, 0, false, false, false, bar);
+ if (_cpCounter2 > 10)
+ showError(274);
+ _mouse->mouseX = 160;
+ _mouse->mouseY = 95;
+ _mouse->mouseMaskIndex = 1;
+ _mouse->warpMouse(_mouse->mouseMaskIndex, _mouse->mouseX, _mouse->mouseY);
+ Common::Event e;
+ do {
+ _chrono->updateChrono();
+ _mouse->animateMouseIfNeeded();
+ while (g_system->getEventManager()->pollEvent(e)) {
+ if (isMouseEvent(e)) {
+ _mouse->warpMouse(e.mouse);
+ }
+ if (e.type == Common::EVENT_KEYDOWN) {
+ if (e.kbd.keycode == Common::KEYCODE_ESCAPE) {
+ exitToDOS();
+ }
+ }
+ if (e.type == Common::EVENT_LBUTTONUP) {
+ uint x = e.mouse.x + 7;
+ uint y = e.mouse.y + 7;
+ if (y > 105 && y < 120) {
+ if (x > 46 && x < 145) {
+ _startNewGame = true;
+ _continueGame = false;
+ validOption = true;
+ } else if (x > 173 && x < 267) {
+ credits();
+ if(!g_engine->shouldQuit()) {
+ drawFlc(0, 0, offset, 0, 9, 0, true, false, false, bar);
+ }
+ }
+ } else if (y > 140 && y < 155) {
+ if (x > 173 && x < 292) {
+ _graphics->totalFadeOut(0);
+ _screen->clear();
+ introduction();
+ if(!g_engine->shouldQuit()) {
+ drawFlc(0, 0, offset, 0, 9, 0, true, false, false, bar);
+ }
+ } else if (x >= 18 && x <= 145) {
+ _isSavingDisabled = true;
+ bool result = loadGameDialog();
+ _isSavingDisabled = false;
+ if(result) {
+ _startNewGame = false;
+ _continueGame = false;
+ validOption = true;
+ }
+ }
+ } else if (y > 174 && y < 190) {
+ if (x > 20 && x < 145) {
+ _startNewGame = false;
+ validOption = true;
+ _continueGame = true;
+ } else if (x > 173 && y < 288) {
+ exitToDOS();
+ }
+ }
+ }
+ }
+ _screen->update();
+ g_system->delayMillis(10);
+ } while (!validOption && !shouldQuit());
+}
+
+void exitGame() {
+ g_engine->_graphics->clear();
+ g_system->quit();
+}
+
+void TotEngine::clearGame() {
+ resetGameState();
+ clearAnims();
+ clearVars();
+}
+
+void TotEngine::exitToDOS() {
+ debug("Exit to dos!");
+ uint oldMousePosX, oldMousePosY, dialogSize;
+ byte oldMouseMask;
+ char exitChar;
+
+ oldMousePosX = _mouse->mouseX;
+ oldMousePosY = _mouse->mouseY;
+ oldMouseMask = _mouse->mouseMaskIndex;
+ _mouse->hide();
+ dialogSize = imagesize(58, 48, 262, 120);
+ byte *dialogBackground = (byte *)malloc(dialogSize);
+ _graphics->getImg(58, 48, 262, 120, dialogBackground);
+
+ drawMenu(7);
+ _mouse->mouseX = 160;
+ _mouse->mouseY = 90;
+ _mouse->mouseMaskIndex = 1;
+
+ _mouse->setMouseArea(Common::Rect(115, 80, 190, 100));
+ _mouse->warpMouse(_mouse->mouseMaskIndex, _mouse->mouseX, _mouse->mouseY);
+ Common::Event e;
+ const char hotKeyYes = hotKeyFor(YES);
+ const char hotKeyNo = hotKeyFor(NO);
+ exitChar = '@';
+ do {
+ _chrono->updateChrono();
+ _mouse->animateMouseIfNeeded();
+
+ while (g_system->getEventManager()->pollEvent(e)) {
+ if (isMouseEvent(e)) {
+ _mouse->warpMouse(e.mouse);
+ }
+ if (e.type == Common::EVENT_KEYDOWN) {
+ if (e.kbd.keycode == Common::KEYCODE_ESCAPE) {
+ exitChar = '\33';
+ } else if (e.kbd.keycode == hotKeyYes) {
+ debug("would exit game now");
+ free(dialogBackground);
+ exitGame();
+ } else if (e.kbd.keycode == hotKeyNo) {
+ exitChar = '\33';
+ }
+ } else if (e.type == Common::EVENT_LBUTTONUP) {
+ uint x = e.mouse.x;
+ if (x < 145) {
+ free(dialogBackground);
+ g_system->quit();
+ } else if (x > 160) {
+ exitChar = '\33';
+ }
+ }
+ }
+ _screen->update();
+ } while (exitChar != '\33' && !shouldQuit());
+ debug("finished exitToDos");
+ _graphics->putImg(58, 48, dialogBackground);
+ _mouse->mouseX = oldMousePosX;
+ _mouse->mouseY = oldMousePosY;
+ _mouse->mouseMaskIndex = oldMouseMask;
+ _mouse->show();
+ free(dialogBackground);
+ _mouse->setMouseArea(Common::Rect(0, 0, 305, 185));
+}
+
} // End of namespace Tot
diff --git a/engines/tot/tot.h b/engines/tot/tot.h
index d1508e43b63..091dbdc7cd1 100644
--- a/engines/tot/tot.h
+++ b/engines/tot/tot.h
@@ -63,12 +63,18 @@ private:
int engineStart();
int startGame();
void newGame();
+ void resumeGame();
+
void changeRoom();
- void loadTemporaryGame();
+ void loadScrollData(uint roomCode, bool rightScroll, uint horizontalPos, int scrollCorrection);
void drawText(uint number);
void displayLoading();
void runaroundRed();
void sprites(bool drawCharacter);
+ void saveGameToRegister();
+ void saveLoad();
+ void loadGame(SavedGame game);
+
RoomFileRegister *readScreenDataFile(Common::SeekableReadStream *screenDataFile);
void lookAtObject(byte objectNumber);
void useInventoryObjectWithInventoryObject(uint obj1, uint obj2);
@@ -78,12 +84,8 @@ private:
void closeScreenObject();
void action();
void handleAction(byte invPos);
- void loadObjects();
+ void loadInventory();
void obtainName(Common::String &playerName);
- void loadScrollData(uint roomCode, bool rightScroll, uint horizontalPos, int scrollCorrection);
- void loadGame(SavedGame game);
- void saveGameToRegister();
- void saveLoad();
void calculateRoute(byte zone1, byte zone2, bool extraCorrection = false, bool zonavedada = false);
void wcScene();
void advanceAnimations(bool barredZone, bool animateMouse);
@@ -91,12 +93,12 @@ private:
void updateMainCharacterDepth();
void actionLineText(Common::String actionLine);
void initializeObjectFile();
- void saveItem(ScreenObject object, Common::SeekableWriteStream *objectDataStream);
+ void saveObjectsData(ScreenObject object, Common::SeekableWriteStream *objectDataStream);
void scrollLeft(uint &horizontalPos);
void scrollRight(uint &horizontalPos);
- TextEntry readVerbRegister(uint numRegister);
+ TextEntry readTextRegister(uint numRegister);
- void readConversationFile(Common::String f);
+ void readConversationFile();
//Rout2
void adjustKey();
@@ -128,9 +130,9 @@ private:
void freeInventory();
void updateInventory(byte index);
- void updateItem(uint filePos);
- void readItemRegister(Common::SeekableReadStream *stream, uint objPos, ScreenObject &thisRegObj);
- void saveItemRegister(ScreenObject object, Common::SeekableWriteStream *stream);
+ void updateObject(uint filePos);
+ void readObject(Common::SeekableReadStream *stream, uint objPos, ScreenObject &thisRegObj);
+ void saveObject(ScreenObject object, Common::SeekableWriteStream *stream);
void saveItemRegister();
void saveTemporaryGame();
@@ -147,7 +149,7 @@ private:
void displayObjectDescription(Common::String text);
void copyProtection();
void initialLogo();
- void startMenu(bool fade);
+ void mainMenu(bool fade);
void exitToDOS();
void soundControls();
void sacrificeScene();
@@ -185,7 +187,7 @@ public:
Common::MemorySeekableReadWriteStream *_conversationData;
Common::MemorySeekableReadWriteStream *_rooms;
- Common::MemorySeekableReadWriteStream *_invItemData;
+ Common::MemorySeekableReadWriteStream *_sceneObjectsData;
bool _roomChange;
bool _isTVOn,
@@ -248,7 +250,7 @@ public:
/**
* 1 first part, 2 second part
*/
- byte _gamePart = 0;
+ byte _gamePart;
/**
* Number of frames of secondary animation
*/
@@ -485,8 +487,8 @@ public:
void loadAnimationForDirection(Common::SeekableReadStream *stream, int direction);
void sayLine(uint textRef, byte textColor, byte shadowColor, uint &responseNumber, bool isWithinConversation);
void goToObject(byte zone1, byte zone2);
- void readItemRegister(uint objPos);
- TextEntry readVerbRegister();
+ void readObject(uint objPos);
+ TextEntry readTextRegister();
void drawInventory();
void drawInventoryMask();
void setRoomTrajectories(int height, int width, TRAJECTORIES_OP op, bool fixGrids = true);
Commit: 3787be797f7e8792ef5e13870633d53aa4bea9c0
https://github.com/scummvm/scummvm/commit/3787be797f7e8792ef5e13870633d53aa4bea9c0
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:52+02:00
Commit Message:
TOT: Fixes issue with game crashing on start
Changed paths:
engines/tot/tot.cpp
engines/tot/tot.h
diff --git a/engines/tot/tot.cpp b/engines/tot/tot.cpp
index ed9e4f4101f..89d7e290df6 100644
--- a/engines/tot/tot.cpp
+++ b/engines/tot/tot.cpp
@@ -95,7 +95,6 @@ Common::Error TotEngine::run() {
int saveSlot = ConfMan.getInt("save_slot");
if (saveSlot != -1)
(void)loadGameState(saveSlot);
-
engineStart();
return Common::kNoError;
@@ -1251,12 +1250,32 @@ void TotEngine::initVars() {
"23123221322213233221112312231221233232122332211112233122321"
"222312211322312223";
- gameTick = false;
- for (int i = 0; i < kNumScreenOverlays; i++) {
+
+ for(int i = 0; i < kNumScreenOverlays; i++) {
_screenLayers[i] = NULL;
}
+ for(int i = 0; i < kInventoryIconCount; i++) {
+ _inventoryIconBitmaps[i] = NULL;
+ }
+
+ for(int i = 0; i < 4; i++) {
+ for(int j = 0; j < kWalkFrameCount + 30; j++) {
+ _mainCharAnimation.bitmap[i][j] = NULL;
+ }
+ }
+
+ for (int i = 0; i < _secondaryAnimDirCount; i++) {
+ for (int j = 0; j < kSecAnimationFrameCount; j++) {
+ _secondaryAnimation.bitmap[i][j] = NULL;
+ }
+ }
+
resetGameState();
+ gameTick = false;
+ for (int i = 0; i < kNumScreenOverlays; i++) {
+ _screenLayers[i] = NULL;
+ }
_firstList[0] = 222;
_firstList[1] = 295;
_firstList[2] = 402;
@@ -1280,26 +1299,6 @@ void TotEngine::initVars() {
_conversationData = NULL;
_rooms = NULL;
_sceneObjectsData = NULL;
-
- for(int i = 0; i < kNumScreenOverlays; i++) {
- _screenLayers[i] = NULL;
- }
-
- for(int i = 0; i < kInventoryIconCount; i++) {
- _inventoryIconBitmaps[i] = NULL;
- }
-
- for(int i = 0; i < 4; i++) {
- for(int j = 0; j < kWalkFrameCount + 30; j++) {
- _mainCharAnimation.bitmap[i][j] = NULL;
- }
- }
-
- for (int i = 0; i < _secondaryAnimDirCount; i++) {
- for (int j = 0; j < kSecAnimationFrameCount; j++) {
- _secondaryAnimation.bitmap[i][j] = NULL;
- }
- }
}
void TotEngine::clearVars() {
diff --git a/engines/tot/tot.h b/engines/tot/tot.h
index 091dbdc7cd1..386228da8c3 100644
--- a/engines/tot/tot.h
+++ b/engines/tot/tot.h
@@ -250,7 +250,7 @@ public:
/**
* 1 first part, 2 second part
*/
- byte _gamePart;
+ byte _gamePart = 1;
/**
* Number of frames of secondary animation
*/
Commit: 58911b4d1601a369951e8ee50031b4fb8e7455f8
https://github.com/scummvm/scummvm/commit/58911b4d1601a369951e8ee50031b4fb8e7455f8
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:52+02:00
Commit Message:
TOT: Fixes glitch with inputting 8+ name
Changed paths:
A engines/tot/engine.cpp
R engines/tot/routines.cpp
R engines/tot/routines2.cpp
engines/tot/module.mk
engines/tot/tot.cpp
diff --git a/engines/tot/routines.cpp b/engines/tot/engine.cpp
similarity index 80%
rename from engines/tot/routines.cpp
rename to engines/tot/engine.cpp
index 41ca445530a..397f4f63ed5 100644
--- a/engines/tot/routines.cpp
+++ b/engines/tot/engine.cpp
@@ -21,6 +21,8 @@
#include "common/debug.h"
#include "common/endian.h"
+#include "common/savefile.h"
+#include "image/png.h"
#include "tot/anims.h"
#include "tot/debug.h"
@@ -4361,4 +4363,1162 @@ void TotEngine::sayLine(
_mouse->show();
}
+
+void TotEngine::initScreenPointers() {
+ _screenSize = 65520;
+ _sceneBackground = (byte *)malloc(_screenSize);
+ _backgroundCopy = (byte *)malloc(_screenSize);
+}
+
+void TotEngine::loadAnimationForDirection(Common::SeekableReadStream *stream, int direction) {
+ for (int j = 0; j < _secondaryAnimationFrameCount; j++) {
+ _graphics->loadAnimationIntoBuffer(stream, _secondaryAnimation.bitmap[direction][j], _secondaryAnimFrameSize);
+ }
+}
+
+void TotEngine::loadAnimation(Common::String animationName) {
+ Common::File animFile;
+
+ if (animationName == "PETER")
+ _isPeterCoughing = true;
+ else
+ _isPeterCoughing = false;
+
+ _isSecondaryAnimationEnabled = true;
+ if (!animFile.open(Common::Path(animationName + ".DAT"))) {
+ showError(265);
+ }
+
+ _secondaryAnimFrameSize = animFile.readUint16LE();
+ _secondaryAnimationFrameCount = animFile.readByte();
+ _secondaryAnimDirCount = animFile.readByte();
+ _curSecondaryAnimationFrame = (byte *)malloc(_secondaryAnimFrameSize);
+ if (_secondaryAnimDirCount != 0) {
+
+ _secondaryAnimationFrameCount = _secondaryAnimationFrameCount / 4;
+ for (int i = 0; i <= 3; i++) {
+ loadAnimationForDirection(&animFile, i);
+ }
+ } else {
+ loadAnimationForDirection(&animFile, 0);
+ }
+
+ animFile.close();
+ debug("Read all frames! longtray2=%d", _currentRoomData->secondaryTrajectoryLength);
+ _secondaryAnimWidth = READ_LE_UINT16(_secondaryAnimation.bitmap[0][1]) + 1;
+ _secondaryAnimHeight = READ_LE_UINT16(_secondaryAnimation.bitmap[0][1] + 2) + 1;
+
+ setRoomTrajectories(_secondaryAnimHeight, _secondaryAnimWidth, SET_WITH_ANIM, false);
+
+ readObject(_currentRoomData->secondaryAnimDirections[299]);
+ _maxXGrid = (_curObject.xgrid2 - _curObject.xgrid1 + 1);
+ _maxYGrid = (_curObject.ygrid2 - _curObject.ygrid1 + 1);
+ _oldposx = _curObject.xgrid1 + 1;
+ _oldposy = _curObject.ygrid1 + 1;
+
+ for (int i = 0; i < 10; i++)
+ for (int j = 0; j < 10; j++) {
+ _maskGridSecondaryAnim[i][j] = 0;
+ _maskMouseSecondaryAnim[i][j] = 0;
+ _movementGridForSecondaryAnim[i][j] = 0;
+ _mouseGridForSecondaryAnim[i][j] = 0;
+ }
+
+ for (int i = 0; i < _maxXGrid; i++)
+ for (int j = 0; j < _maxYGrid; j++) {
+ _maskGridSecondaryAnim[i][j] = _curObject.walkAreasPatch[i][j];
+ _maskMouseSecondaryAnim[i][j] = _curObject.mouseGridPatch[i][j];
+ _movementGridForSecondaryAnim[i][j] = _currentRoomData->walkAreasGrid[_oldposx + i][_oldposy + j];
+ _mouseGridForSecondaryAnim[i][j] = _currentRoomData->mouseGrid[_oldposx + i][_oldposy + j];
+ }
+ _iframe2 = 0;
+}
+
+void TotEngine::updateAltScreen(byte otherScreenNumber) {
+ uint i22;
+ uint i11;
+
+ byte currentScreen = _currentRoomData->code;
+
+ setRoomTrajectories(_secondaryAnimHeight, _secondaryAnimWidth, RESTORE);
+
+ // Save current room
+ saveRoomData(_currentRoomData, _rooms);
+
+ // Load other screen
+ _rooms->seek(otherScreenNumber * kRoomRegSize, SEEK_SET);
+ _currentRoomData = readScreenDataFile(_rooms);
+
+ switch (otherScreenNumber) {
+ case 20: {
+ switch (_niche[0][_niche[0][3]]) {
+ case 0: {
+ _currentRoomData->screenObjectIndex[9]->objectName = getObjectName(4);
+ _currentRoomData->screenLayers[1].bitmapPointer = 1190768;
+ } break;
+ case 561: {
+ _currentRoomData->screenObjectIndex[9]->objectName = getObjectName(5);
+ _currentRoomData->screenLayers[1].bitmapPointer = 1182652;
+ } break;
+ case 563: {
+ _currentRoomData->screenObjectIndex[9]->objectName = getObjectName(6);
+ _currentRoomData->screenLayers[1].bitmapPointer = 1186044;
+ } break;
+ case 615: {
+ _currentRoomData->screenObjectIndex[9]->objectName = getObjectName(7);
+ _currentRoomData->screenLayers[1].bitmapPointer = 1181760;
+ } break;
+ }
+ _currentRoomData->screenLayers[1].bitmapSize = 892;
+ _currentRoomData->screenLayers[1].coordx = 66;
+ _currentRoomData->screenLayers[1].coordy = 35;
+ _currentRoomData->screenLayers[1].depth = 1;
+ } break;
+ case 24: {
+ switch (_niche[1][_niche[1][3]]) {
+ case 0: {
+ _currentRoomData->screenObjectIndex[8]->objectName = getObjectName(4);
+ _currentRoomData->screenLayers[0].bitmapPointer = 1399610;
+ } break;
+ case 561: {
+ _currentRoomData->screenObjectIndex[8]->objectName = getObjectName(5);
+ _currentRoomData->screenLayers[0].bitmapPointer = 1381982;
+ } break;
+ case 615: {
+ _currentRoomData->screenObjectIndex[8]->objectName = getObjectName(7);
+ _currentRoomData->screenLayers[0].bitmapPointer = 1381090;
+ } break;
+ case 622: {
+ _currentRoomData->screenObjectIndex[8]->objectName = getObjectName(8);
+ _currentRoomData->screenLayers[0].bitmapPointer = 1400502;
+ } break;
+ case 623: {
+ _currentRoomData->screenObjectIndex[8]->objectName = getObjectName(9);
+ _currentRoomData->screenLayers[0].bitmapPointer = 1398718;
+ } break;
+ }
+ _currentRoomData->screenLayers[0].bitmapSize = 892;
+ _currentRoomData->screenLayers[0].coordx = 217;
+ _currentRoomData->screenLayers[0].coordy = 48;
+ _currentRoomData->screenLayers[0].depth = 1;
+ } break;
+ case 31: {
+ for (i11 = 23; i11 <= 25; i11++)
+ for (i22 = 4; i22 <= 9; i22++)
+ _currentRoomData->mouseGrid[i11][i22] = 4;
+ for (i11 = 23; i11 <= 25; i11++)
+ for (i22 = 10; i22 <= 11; i22++)
+ _currentRoomData->mouseGrid[i11][i22] = 3;
+
+ _currentRoomData->screenLayers[0].bitmapSize = 0;
+ _currentRoomData->screenLayers[0].bitmapPointer = 0;
+ _currentRoomData->screenLayers[0].coordx = 0;
+ _currentRoomData->screenLayers[0].coordy = 0;
+ _currentRoomData->screenLayers[0].depth = 0;
+ } break;
+ }
+
+ // Save other screen
+ saveRoomData(_currentRoomData, _rooms);
+
+ // Restore current room again
+ _rooms->seek(currentScreen * kRoomRegSize, SEEK_SET);
+ _currentRoomData = readScreenDataFile(_rooms);
+
+ setRoomTrajectories(_secondaryAnimHeight, _secondaryAnimWidth, SET_WITH_ANIM);
+}
+
+void TotEngine::verifyCopyProtection() {
+ //TODO: Copy protection
+}
+
+void TotEngine::loadTV() {
+
+ Common::File fichct;
+ if (!fichct.open("PALETAS.DAT")) {
+ showError(310);
+ }
+ fichct.seek(_currentRoomData->palettePointer + 603);
+ fichct.read(g_engine->_graphics->_palAnimSlice, 144);
+ for (int i = 0; i <= 48; i++) {
+ g_engine->_graphics->_palAnimSlice[i * 3 + 0] <<= 2;
+ g_engine->_graphics->_palAnimSlice[i * 3 + 1] <<= 2;
+ g_engine->_graphics->_palAnimSlice[i * 3 + 2] <<= 2;
+ }
+
+ fichct.close();
+ for (int ix = 195; ix <= 200; ix++) {
+ g_engine->_graphics->_pal[ix * 3 + 0] = 2 << 2;
+ g_engine->_graphics->_pal[ix * 3 + 1] = 2 << 2;
+ g_engine->_graphics->_pal[ix * 3 + 2] = 2 << 2;
+ setRGBPalette(ix, 2, 2, 2);
+ }
+}
+
+void TotEngine::loadScreen() {
+ Common::File paletteFile;
+ palette palcp;
+
+ _screenSize = _currentRoomData->roomImageSize;
+ readBitmap(_currentRoomData->roomImagePointer, _sceneBackground, _screenSize, 316);
+ Common::copy(_sceneBackground, _sceneBackground + _screenSize, _backgroundCopy);
+ switch (_gamePart) {
+ case 1: {
+ if (!paletteFile.open("PALETAS.DAT")) {
+ showError(310);
+ }
+ paletteFile.seek(_currentRoomData->palettePointer);
+ paletteFile.read(palcp, 603);
+ if (_currentRoomData->paletteAnimationFlag) {
+ paletteFile.read(g_engine->_graphics->_palAnimSlice, 144);
+ for (int i = 0; i <= 48; i++) {
+ g_engine->_graphics->_palAnimSlice[i * 3 + 0] <<= 2;
+ g_engine->_graphics->_palAnimSlice[i * 3 + 1] <<= 2;
+ g_engine->_graphics->_palAnimSlice[i * 3 + 2] <<= 2;
+ }
+ }
+ paletteFile.close();
+ for (int i = 1; i <= 200; i++) {
+ g_engine->_graphics->_pal[i * 3 + 0] = palcp[i * 3 + 0] << 2;
+ g_engine->_graphics->_pal[i * 3 + 1] = palcp[i * 3 + 1] << 2;
+ g_engine->_graphics->_pal[i * 3 + 2] = palcp[i * 3 + 2] << 2;
+ }
+ _graphics->setPalette(g_engine->_graphics->_pal, 0, 201);
+ } break;
+ case 2: {
+ _graphics->loadPaletteFromFile("SEGUNDA");
+ _currentRoomData->paletteAnimationFlag = true;
+ } break;
+ }
+}
+
+void TotEngine::clearScreenLayers() {
+ for (int i = 0; i < kNumScreenOverlays; i++) {
+ if (_screenLayers[i] != NULL)
+ free(_screenLayers[i]);
+ _screenLayers[i] = NULL;
+ }
+}
+
+void TotEngine::clearAnimation() {
+ if (_isSecondaryAnimationEnabled) {
+ _isSecondaryAnimationEnabled = false;
+ _curSecondaryAnimationFrame = NULL;
+ for(int j = 0; j < _secondaryAnimDirCount; j++){
+ for(int i = 0; i < _secondaryAnimationFrameCount; i++){
+ if(_secondaryAnimation.bitmap[j][i] != NULL && _secondaryAnimation.bitmap[j][i] != _curSecondaryAnimationFrame) {
+ free(_secondaryAnimation.bitmap[j][i]);
+ }
+ _secondaryAnimation.bitmap[j][i] = NULL;
+ }
+ }
+ }
+}
+
+void TotEngine::freeInventory() {
+ for (int i = 0; i < kInventoryIconCount; i++) {
+ free(_inventoryIconBitmaps[i]);
+ }
+}
+
+void TotEngine::verifyCopyProtection2() {
+ // TODO:
+}
+
+void TotEngine::loadScreenLayerWithDepth(uint coordx, uint coordy, uint bitmapSize, int32 bitmapIndex, uint depth) {
+ _screenLayers[depth] = (byte *)malloc(bitmapSize);
+ readBitmap(bitmapIndex, _screenLayers[depth], bitmapSize, 319);
+
+ uint16 w, h;
+ w = READ_LE_UINT16(_screenLayers[depth]);
+ h = READ_LE_UINT16(_screenLayers[depth] + 2);
+ _depthMap[depth].posx = coordx;
+ _depthMap[depth].posy = coordy;
+ _depthMap[depth].posx2 = coordx + w + 1;
+ _depthMap[depth].posy2 = coordy + h + 1;
+}
+
+void TotEngine::loadScreenLayer(uint coordx, uint coordy, uint bitmapSize, int32 bitmapIndex, uint depth) {
+ loadScreenLayerWithDepth(coordx, coordy, bitmapSize, bitmapIndex, depth - 1);
+}
+
+void TotEngine::updateInventory(byte index) {
+ for (int i = index; i < (kInventoryIconCount - 1); i++) {
+ _inventory[i].bitmapIndex = _inventory[i + 1].bitmapIndex;
+ _inventory[i].code = _inventory[i + 1].code;
+ _inventory[i].objectName = _inventory[i + 1].objectName;
+ }
+ // verifyCopyProtection();
+}
+
+void TotEngine::drawLookAtItem(RoomObjectListEntry obj) {
+ _mouse->hide();
+ bar(0, 140, 319, 149, 0);
+ actionLineText(getActionLineText(3) + obj.objectName);
+ _mouse->show();
+}
+
+void TotEngine::putIcon(uint iconPosX, uint iconPosY, uint iconNum) {
+ // substract 1 to account for 1-based indices
+ _graphics->putImg(iconPosX, iconPosY, _inventoryIconBitmaps[_inventory[iconNum].bitmapIndex - 1]);
+}
+
+void TotEngine::drawInventory() {
+ putIcon(34, 169, _inventoryPosition);
+ putIcon(77, 169, _inventoryPosition + 1);
+ putIcon(120, 169, _inventoryPosition + 2);
+ putIcon(163, 169, _inventoryPosition + 3);
+ putIcon(206, 169, _inventoryPosition + 4);
+ putIcon(249, 169, _inventoryPosition + 5);
+}
+
+void lightUpLeft() {
+ line(10, 173, 29, 173, 255);
+ line(10, 173, 10, 189, 255);
+ line(30, 174, 30, 190, 249);
+ line(30, 190, 11, 190, 249);
+}
+
+void turnOffLeft() {
+ line(10, 173, 29, 173, 249);
+ line(10, 173, 10, 189, 249);
+ line(30, 174, 30, 190, 255);
+ line(30, 190, 11, 190, 255);
+}
+
+void lightUpRight() {
+ line(291, 173, 310, 173, 255);
+ line(291, 173, 291, 189, 255);
+ line(311, 174, 311, 190, 249);
+ line(311, 190, 292, 190, 249);
+}
+
+void turnOffRight() {
+ line(291, 173, 310, 173, 249);
+ line(291, 173, 291, 189, 249);
+ line(311, 174, 311, 190, 255);
+ line(311, 190, 292, 190, 255);
+}
+
+void TotEngine::drawInventory(byte dir, byte max) {
+ switch (dir) {
+ case 0:
+ if (_inventoryPosition > 0) {
+ _inventoryPosition -= 1;
+ drawInventory();
+ }
+ break;
+ case 1:
+ if (_inventoryPosition < (max - 6)) {
+ _inventoryPosition += 1;
+ drawInventory();
+ }
+ break;
+ }
+ _mouse->hide();
+ if (_inventoryPosition > 0)
+ lightUpLeft();
+ else
+ turnOffLeft();
+ if (_inventory[_inventoryPosition + 6].code > 0)
+ lightUpRight();
+ else
+ turnOffRight();
+ _mouse->show();
+ if (_cpCounter > 145)
+ showError(274);
+}
+
+void TotEngine::drawInventoryMask() {
+
+ buttonBorder(0, 140, 319, 149, 0, 0, 0, 0, 0);
+ for (int i = 1; i <= 25; i++)
+ buttonBorder(0, (175 - i), 319, (174 + i), 251, 251, 251, 251, 0);
+ drawMenu(1);
+ // verifyCopyProtection();
+ if (_inventoryPosition > 1)
+ lightUpLeft();
+ else
+ turnOffLeft();
+ if (_inventory[_inventoryPosition + 6].code > 0)
+ lightUpRight();
+ else
+ turnOffRight();
+}
+
+void TotEngine::drawMenu(byte menuNumber) {
+ byte *bitmap;
+ uint menuSize;
+ byte xmenu, ymenu;
+ long menuOffset;
+
+ Common::File menuFile;
+ if (!menuFile.open("MENUS.DAT")) {
+ showError(258);
+ }
+
+ menuOffset = _lang == Common::ES_ESP ? menuOffsets_ES[menuNumber - 1][0] : menuOffsets_EN[menuNumber - 1][0];
+ menuSize = _lang == Common::ES_ESP ? menuOffsets_ES[menuNumber - 1][1] : menuOffsets_EN[menuNumber - 1][1];
+
+ switch (menuNumber) {
+ case 1: {
+ xmenu = 0;
+ ymenu = 150;
+ } break;
+ case 2: {
+ xmenu = 50;
+ ymenu = 10;
+ } break;
+ case 3: {
+ xmenu = 50;
+ ymenu = 10;
+ } break;
+ case 4: {
+ if (_cpCounter2 > 20)
+ showError(274);
+ xmenu = 50;
+ ymenu = 10;
+ } break;
+ case 5: {
+ if (_cpCounter > 23)
+ showError(274);
+ xmenu = 0;
+ ymenu = 150;
+ } break;
+ case 6: {
+ xmenu = 50;
+ ymenu = 10;
+ } break;
+ case 7: {
+ xmenu = 58;
+ ymenu = 48;
+ } break;
+ case 8: {
+ xmenu = 84;
+ ymenu = 34;
+ } break;
+ }
+
+ bitmap = (byte *)malloc(menuSize);
+ menuFile.seek(menuOffset);
+ menuFile.read(bitmap, menuSize);
+ _graphics->putImg(xmenu, ymenu, bitmap);
+ free(bitmap);
+ menuFile.close();
+}
+
+static void loadDiploma(Common::String &photoName, Common::String &key) {
+ palette auxPal;
+ byte *screen;
+ uint size;
+ byte *stamp;
+
+ Common::File dipFile;
+ if (!dipFile.open("DIPLOMA.PAN")) {
+ showError(318);
+ }
+
+ dipFile.read(auxPal, 768);
+
+ screen = (byte *)malloc(64000);
+ dipFile.read(screen, 64000);
+ dipFile.close();
+
+ if (!dipFile.open(Common::Path("DIPLOMA/SELLO.BMP")))
+ showError(271);
+ stamp = (byte *)malloc(2054);
+ dipFile.read(stamp, 2054);
+ dipFile.close();
+ g_engine->_graphics->drawFullScreen(screen);
+
+ free(screen);
+
+ if (dipFile.open(Common::Path("DIPLOMA/" + photoName + ".FOT"))) {
+ size = dipFile.size() - 768;
+ screen = (byte *)malloc(size);
+ dipFile.read(g_engine->_graphics->_pal, 768);
+ dipFile.read(screen, size);
+ dipFile.close();
+ g_engine->_graphics->putShape(10, 20, screen);
+ free(screen);
+ }
+ for (int i = 16; i <= 255; i++) {
+ auxPal[i * 3 + 0] = g_engine->_graphics->_pal[i * 3 + 0];
+ auxPal[i * 3 + 1] = g_engine->_graphics->_pal[i * 3 + 1];
+ auxPal[i * 3 + 2] = g_engine->_graphics->_pal[i * 3 + 2];
+ }
+
+ g_engine->_graphics->copyPalette(auxPal, g_engine->_graphics->_pal);
+ g_engine->_graphics->fixPalette(g_engine->_graphics->_pal, 768);
+ g_engine->_graphics->setPalette(g_engine->_graphics->_pal);
+ g_engine->_screen->markAllDirty();
+ g_engine->_screen->update();
+
+ char *passArray = (char *)malloc(10);
+ for (int i = 0; i < 10; i++)
+ passArray[i] = (char)(Random(10) + 48);
+
+ key.append(passArray, passArray + 10);
+
+ const char *const *messages = (g_engine->_lang == Common::ES_ESP) ? fullScreenMessages[0] : fullScreenMessages[1];
+ biosText(91, 16, messages[49] + key, 255);
+ biosText(90, 15, messages[49] + key, 13);
+
+ biosText(81, 61, messages[50], 0);
+ biosText(61, 81, messages[51], 0);
+ biosText(31, 101, messages[52] + g_engine->_characterName, 0);
+ biosText(31, 121, messages[53], 0);
+ biosText(31, 141, messages[54], 0);
+ biosText(31, 161, messages[55], 0);
+
+ biosText(80, 60, messages[50], 15);
+ biosText(60, 80, messages[51], 15);
+ biosText(30, 100, messages[52], 15);
+
+ biosText(150, 100, g_engine->_characterName, 13);
+
+ biosText(30, 120, messages[53], 15);
+ biosText(30, 140, messages[54], 15);
+ biosText(30, 160, messages[55], 15);
+ delay(1500);
+ g_engine->_sound->playVoc("PORTAZO", 434988, 932);
+ g_engine->_graphics->putShape(270, 159, stamp);
+ free(stamp);
+}
+
+static void saveDiploma(Common::String &photoName, Common::String &key) {
+ Common::String name;
+ if (photoName != "")
+ name = "tot-diploma-" + photoName + ".png";
+ else
+ name = "tot-diploma-default.png";
+ Common::OutSaveFile *thumbnail = g_engine->getSaveFileManager()->openForSaving(name);
+ Graphics::Surface *surface = g_system->lockScreen();
+ assert(surface);
+ Image::writePNG(*thumbnail, *surface, g_engine->_graphics->getPalette());
+ g_system->unlockScreen();
+ thumbnail->finalize();
+ delete thumbnail;
+}
+
+void TotEngine::generateDiploma(Common::String &photoName) {
+ Common::String key;
+ _mouse->hide();
+ photoName.toUppercase();
+ _graphics->totalFadeOut(0);
+ loadDiploma(photoName, key);
+
+ Common::Event e;
+ bool keyPressed = false;
+ do {
+ _screen->update();
+ while (g_system->getEventManager()->pollEvent(e)) {
+ if (e.type == Common::EVENT_KEYUP) {
+ keyPressed = true;
+ }
+ }
+ g_system->delayMillis(10);
+ } while (!keyPressed && !shouldQuit());
+ saveDiploma(photoName, key);
+ _mouse->show();
+}
+
+void TotEngine::checkMouseGrid() {
+ uint xGrid, yGrid;
+ Common::String invObject;
+ if (_cpCounter2 > 120)
+ showError(274);
+ if (_mouse->mouseY >= 0 && _mouse->mouseY <= 131) {
+ xGrid = _mouse->getMouseCoordsWithinGrid().x;
+ yGrid = _mouse->getMouseCoordsWithinGrid().y;
+ if (_currentRoomData->mouseGrid[xGrid][yGrid] != _currentRoomData->mouseGrid[_oldGridX][_oldGridY] || _oldInventoryObjectName != "") {
+ bar(0, 140, 319, 149, 0);
+ Common::String actionLine;
+ switch (_actionCode) {
+ case 0:
+ actionLine = getActionLineText(0) + _currentRoomData->screenObjectIndex[_currentRoomData->mouseGrid[xGrid][yGrid]]->objectName;
+ break;
+ case 1:
+ actionLine = getActionLineText(1) + _currentRoomData->screenObjectIndex[_currentRoomData->mouseGrid[xGrid][yGrid]]->objectName;
+ break;
+ case 2:
+ actionLine = getActionLineText(2) + _currentRoomData->screenObjectIndex[_currentRoomData->mouseGrid[xGrid][yGrid]]->objectName;
+ break;
+ case 3:
+ actionLine = getActionLineText(3) + _currentRoomData->screenObjectIndex[_currentRoomData->mouseGrid[xGrid][yGrid]]->objectName;
+ break;
+ case 4:
+ if (_inventoryObjectName != "")
+ actionLine = getActionLineText(4) + _inventoryObjectName + getActionLineText(7) + _currentRoomData->screenObjectIndex[_currentRoomData->mouseGrid[xGrid][yGrid]]->objectName;
+ else
+ actionLine = getActionLineText(4) + _currentRoomData->screenObjectIndex[_currentRoomData->mouseGrid[xGrid][yGrid]]->objectName;
+ break;
+ case 5:
+ actionLine = getActionLineText(5) + _currentRoomData->screenObjectIndex[_currentRoomData->mouseGrid[xGrid][yGrid]]->objectName;
+ break;
+ case 6:
+ actionLine = getActionLineText(6) + _currentRoomData->screenObjectIndex[_currentRoomData->mouseGrid[xGrid][yGrid]]->objectName;
+ break;
+ default:
+ actionLine = getActionLineText(0) + _currentRoomData->screenObjectIndex[_currentRoomData->mouseGrid[xGrid][yGrid]]->objectName;
+ }
+ actionLineText(actionLine);
+ _mouse->show();
+ _oldGridX = xGrid;
+ _oldGridY = yGrid;
+ }
+ _oldActionCode = 253;
+ _oldInventoryObjectName = "";
+ } else if (_mouse->mouseY >= 132 && _mouse->mouseY <= 165) {
+ if (_actionCode != _oldActionCode) {
+ bar(0, 140, 319, 149, 0);
+ Common::String actionLine;
+ switch (_actionCode) {
+ case 0:
+ actionLine = getActionLineText(0);
+ break;
+ case 1:
+ actionLine = getActionLineText(1);
+ break;
+ case 2:
+ actionLine = getActionLineText(2);
+ break;
+ case 3:
+ actionLine = getActionLineText(3);
+ break;
+ case 4:
+ if (_inventoryObjectName != "")
+ actionLine = getActionLineText(4) + _inventoryObjectName + getActionLineText(7);
+ else
+ actionLine = getActionLineText(4);
+ break;
+ case 5:
+ actionLine = getActionLineText(5);
+ break;
+ case 6:
+ actionLine = getActionLineText(6);
+ break;
+ }
+ actionLineText(actionLine);
+ _mouse->show();
+ _oldActionCode = _actionCode;
+ _oldInventoryObjectName = "";
+ _oldGridX = 0;
+ _oldGridY = 0;
+ }
+ } else if (_mouse->mouseY >= 166 && _mouse->mouseY <= 199) {
+ if (_mouse->mouseX >= 26 && _mouse->mouseX <= 65) {
+ invObject = _inventory[_inventoryPosition].objectName;
+ } else if (_mouse->mouseX >= 70 && _mouse->mouseX <= 108) {
+ invObject = _inventory[_inventoryPosition + 1].objectName;
+ } else if (_mouse->mouseX >= 113 && _mouse->mouseX <= 151) {
+ invObject = _inventory[_inventoryPosition + 2].objectName;
+ } else if (_mouse->mouseX >= 156 && _mouse->mouseX <= 194) {
+ invObject = _inventory[_inventoryPosition + 3].objectName;
+ } else if (_mouse->mouseX >= 199 && _mouse->mouseX <= 237) {
+ invObject = _inventory[_inventoryPosition + 4].objectName;
+ } else if (_mouse->mouseX >= 242 && _mouse->mouseX <= 280) {
+ invObject = _inventory[_inventoryPosition + 5].objectName;
+ } else {
+ invObject = ' ';
+ }
+
+ if (invObject != _oldInventoryObjectName || _oldGridX != 0) {
+ bar(0, 140, 319, 149, 0);
+ Common::String actionLine;
+ switch (_actionCode) {
+ case 1:
+ actionLine = getActionLineText(1) + invObject;
+ break;
+ case 2:
+ actionLine = getActionLineText(2) + invObject;
+ break;
+ case 3:
+ actionLine = getActionLineText(3) + invObject;
+ break;
+ case 4:
+ if (_inventoryObjectName == "")
+ actionLine = getActionLineText(4) + invObject;
+ else
+ actionLine = getActionLineText(4) + _inventoryObjectName + getActionLineText(7) + invObject;
+ break;
+ case 5:
+ actionLine = getActionLineText(5) + invObject;
+ break;
+ case 6:
+ actionLine = getActionLineText(6) + invObject;
+ break;
+ default:
+ euroText(160, 144, invObject, 255, Graphics::kTextAlignCenter);
+ }
+ actionLineText(actionLine);
+ _mouse->show();
+ _oldInventoryObjectName = invObject;
+ }
+ _oldActionCode = 255;
+ _oldGridX = 0;
+ _oldGridY = 0;
+ }
+}
+
+void TotEngine::readAlphaGraph(Common::String &output, int length, int posx, int posy, byte barColor) {
+ int pun = 1;
+ bar(posx, posy - 2, posx + length * 8, posy + 8, barColor);
+
+ biosText(posx, posy, "_", 0);
+
+ Common::Event e;
+ bool done = false;
+ while (!done && !shouldQuit()) {
+ while (g_system->getEventManager()->pollEvent(e)) {
+
+ if (e.type == Common::EVENT_KEYDOWN) {
+ int keycode = e.kbd.keycode;
+ int asciiCode = e.kbd.ascii;
+ // ENTER key
+ if (keycode == Common::KEYCODE_RETURN || keycode == Common::KEYCODE_KP_ENTER) {
+ if (output.size() > 0) {
+ done = true;
+ continue;
+ }
+ }
+ // Max 8 chars
+ if (pun > length && asciiCode != 8) {
+ _sound->beep(750, 60);
+ bar((posx + (output.size()) * 8), (posy - 2), (posx + (output.size() + 1) * 8), (posy + 8), barColor);
+ } else if (asciiCode == 8 && pun > 1) { // delete
+ output = output.substr(0, output.size() - 1);
+ bar(posx, (posy - 2), (posx + length * 8), (posy + 8), barColor);
+ biosText(posx, posy, output.c_str(), 0);
+ biosText((posx + (output.size()) * 8), posy, "_", 0);
+ pun -= 1;
+ } else if (
+ (asciiCode < 97 || asciiCode > 122) &&
+ (asciiCode < 65 || asciiCode > 90) &&
+ (asciiCode < 32 || asciiCode > 57) &&
+ (asciiCode < 164 || asciiCode > 165)) {
+ _sound->beep(1200, 60);
+ } else {
+ pun += 1;
+ output = output + (char)e.kbd.ascii;
+ bar(posx, (posy - 2), (posx + length * 8), (posy + 8), barColor);
+ biosText(posx, posy, output.c_str(), 0);
+ biosText((posx + (output.size()) * 8), posy, "_", 0);
+ }
+ }
+ }
+ g_system->delayMillis(10);
+ _screen->update();
+ }
+}
+
+void TotEngine::readAlphaGraphSmall(Common::String &output, int length, int posx, int posy, byte barColor,
+ byte textColor) {
+ int pun = 1;
+ bool removeCaret;
+ bar(posx, posy + 2, posx + length * 6, posy + 9, barColor);
+
+ biosText(posx, posy, "-", textColor);
+ Common::Event e;
+ bool done = false;
+
+ while (!done && !shouldQuit()) {
+ while (g_system->getEventManager()->pollEvent(e)) {
+ if (e.type == Common::EVENT_KEYDOWN) {
+ int keycode = e.kbd.keycode;
+ int asciiCode = e.kbd.ascii;
+ // ENTER key
+ if (keycode == Common::KEYCODE_RETURN || keycode == Common::KEYCODE_KP_ENTER) {
+ if (output.size() > 0) {
+ done = true;
+ continue;
+ }
+ }
+
+ if (pun > length && asciiCode != 8) {
+ _sound->beep(750, 60);
+ bar((posx + (output.size()) * 6), (posy + 2), (posx + (output.size() + 1) * 6), (posy + 9), barColor);
+ } else if (asciiCode == 8 && pun > 1) {
+ output = output.substr(0, output.size() - 1);
+ bar(posx, (posy + 2), (posx + length * 6), (posy + 9), barColor);
+ biosText(posx, posy, output, textColor);
+ biosText((posx + (output.size()) * 6), posy, "-", textColor);
+ pun -= 1;
+ removeCaret = true;
+ } else if ((asciiCode < '\40') || (asciiCode > '\373')) {
+ _sound->beep(1200, 60);
+ removeCaret = false;
+ } else {
+ pun += 1;
+ output = output + (char)e.kbd.ascii;
+ bar(posx, (posy + 2), (posx + length * 6), (posy + 9), barColor);
+ littText(posx, posy, output, textColor);
+ littText((posx + (output.size()) * 6), posy, "-", textColor);
+ removeCaret = true;
+ }
+ }
+ }
+
+ g_system->delayMillis(10);
+ _screen->update();
+ }
+
+ if (removeCaret)
+ bar(posx + (output.size()) * 6, posy + 2, (posx + (output.size()) * 6) + 6, posy + 9, barColor);
+}
+
+void TotEngine::displayObjectDescription(Common::String textString) {
+ uint xpos = 60;
+ uint ypos = 15;
+ byte maxWidth = 33;
+ byte textColor = 255;
+ byte shadowColor = 0;
+ byte ihc, lineCounter;
+ byte newLineMatrix[10];
+
+ if (textString.size() < maxWidth) {
+ euroText((xpos + 1), (ypos + 1), textString, shadowColor);
+ _screen->update();
+ delay(kEnforcedTextAnimDelay);
+ euroText(xpos, ypos, textString, textColor);
+ _screen->update();
+ delay(kEnforcedTextAnimDelay);
+ } else {
+ ihc = 0;
+ lineCounter = 0;
+ newLineMatrix[0] = 0;
+ do {
+ ihc += maxWidth + 1;
+ lineCounter += 1;
+ do {
+ ihc -= 1;
+ } while (textString[ihc] != ' ');
+ newLineMatrix[lineCounter] = ihc + 1;
+ } while (ihc + 1 <= textString.size() - maxWidth);
+
+ lineCounter += 1;
+ newLineMatrix[lineCounter] = textString.size();
+
+ for (byte line = 1; line <= lineCounter; line++) {
+ Common::String lineString = textString.substr(newLineMatrix[line - 1], newLineMatrix[line] - newLineMatrix[line - 1]);
+ euroText((xpos + 1), (ypos + ((line - 1) * 11) + 1), lineString, shadowColor);
+ _screen->update();
+ delay(kEnforcedTextAnimDelay);
+ euroText(xpos, (ypos + ((line - 1) * 11)), lineString, textColor);
+ _screen->update();
+ delay(kEnforcedTextAnimDelay);
+ }
+ }
+}
+
+void TotEngine::buttonBorder(uint x1, uint y1, uint x2, uint y2,
+ byte color1, byte color2, byte color3, byte color4, byte color5) {
+
+ bar(x1, y1, x2, y2, color4);
+ line(x1, y1, x1, y2, color1);
+ line(x1, y1, x2, y1, color1);
+
+ line(x2, y1, x2, y2, color2);
+ line(x2, y2, x1, y2, color2);
+
+ putpixel(x2, y1, color3);
+ putpixel(x1, y2, color3);
+
+ _screen->addDirtyRect(Common::Rect(
+ x1, y1, x2, y2));
+ _screen->update();
+}
+
+void TotEngine::copyProtection() {
+ //todo
+}
+
+void TotEngine::soundControls() {
+ uint oldMouseX,
+ oldMouseY,
+ soundControlsSize,
+ sliderSize,
+ sliderBgSize,
+ sfxVol,
+ musicVol,
+ xfade,
+ oldxfade;
+
+ byte ytext, oldMouseMask;
+ bool exitSoundControls;
+
+ exitSoundControls = false;
+ oldMouseX = _mouse->mouseX;
+ oldMouseY = _mouse->mouseY;
+ oldMouseMask = _mouse->mouseMaskIndex;
+ _mouse->hide();
+
+ soundControlsSize = imagesize(50, 10, 270, 120);
+ //What was on the screen before blitting sound controls
+ byte *soundControlsBackground = (byte *)malloc(soundControlsSize);
+ _graphics->getImg(50, 10, 270, 120, soundControlsBackground);
+
+ _mouse->mouseX = 150;
+ _mouse->mouseY = 60;
+ _mouse->mouseMaskIndex = 1;
+
+ _mouse->setMouseArea(Common::Rect(55, 13, 250, 105));
+
+ for (ytext = 1; ytext <= 6; ytext++)
+ buttonBorder(120 - (ytext * 10), 80 - (ytext * 10), 200 + (ytext * 10), 60 + (ytext * 10), 251, 251, 251, 251, 0);
+
+ buttonBorder(86, 31, 94, 44, 0, 0, 0, 0, 0);
+
+ line(90, 31, 90, 44, 255);
+
+ sliderSize = imagesize(86, 31, 94, 44);
+ byte *slider = (byte *)malloc(sliderSize);
+ _graphics->getImg(86, 31, 94, 44, slider);
+
+ drawMenu(3);
+ sliderBgSize = imagesize(86, 31, 234, 44);
+
+ byte *sliderBackground1 = (byte *)malloc(sliderBgSize);
+ byte *sliderBackground2 = (byte *)malloc(sliderBgSize);
+ _graphics->getImg(86, 31, 234, 44, sliderBackground1);
+ _graphics->getImg(86, 76, 234, 89, sliderBackground2);
+
+ sfxVol = round(((_sound->_rightSfxVol + _sound->_leftSfxVol) / 2) * 20);
+ musicVol = round(((_sound->_musicVolRight + _sound->_musicVolLeft) / 2) * 20);
+ _graphics->putImg(sfxVol + 86, 31, slider);
+ _graphics->putImg(musicVol + 86, 76, slider);
+
+ _mouse->warpMouse(1, _mouse->mouseX, _mouse->mouseY);
+ bool keyPressed = false;
+ bool mouseClicked = false;
+ Common::Event e;
+ do {
+ _chrono->updateChrono();
+ do {
+ _chrono->updateChrono();
+ _mouse->animateMouseIfNeeded();
+ while (g_system->getEventManager()->pollEvent(e)) {
+ if (e.type == Common::EVENT_KEYUP) {
+ keyPressed = true;
+ }
+ if (e.type == Common::EVENT_LBUTTONDOWN) {
+ mouseClicked = true;
+ _mouse->mouseClickX = e.mouse.x;
+ _mouse->mouseClickY = e.mouse.y;
+ }
+ }
+ _screen->update();
+ } while ((!keyPressed && !mouseClicked) && !shouldQuit());
+
+ _chrono->updateChrono();
+ _mouse->animateMouseIfNeeded();
+ if (keyPressed) {
+ exitSoundControls = true;
+ }
+ if (mouseClicked) {
+ if (_mouse->mouseClickY >= 22 && _mouse->mouseClickY <= 37) {
+ _mouse->hide();
+ xfade = 86 + sfxVol;
+ bool mouseReleased = false;
+ do {
+
+ oldxfade = xfade;
+ while (g_system->getEventManager()->pollEvent(e)) {
+ if (e.type == Common::EVENT_LBUTTONUP) {
+ mouseReleased = true;
+ } else if (e.type == Common::EVENT_MOUSEMOVE) {
+ xfade = e.mouse.x;
+ }
+ }
+ if (xfade < 86) {
+ xfade = 86;
+ } else if (xfade > 226) {
+ xfade = 226;
+ }
+
+ if (oldxfade != xfade) {
+ _graphics->putImg(86, 31, sliderBackground1);
+ _graphics->putImg(xfade, 31, slider);
+ // This yields a volume between 0 and 140
+ sfxVol = xfade - 86;
+
+ debug("volumefx=%d", sfxVol);
+ _sound->_rightSfxVol = round((float)sfxVol / 20);
+ _sound->_leftSfxVol = round((float)sfxVol / 20);
+ _sound->setSfxVolume(_sound->_leftSfxVol, _sound->_rightSfxVol);
+ }
+ _screen->update();
+ } while (!mouseReleased);
+
+ _mouse->show();
+ } else if (_mouse->mouseClickY >= 67 && _mouse->mouseClickY <= 82) {
+ _mouse->hide();
+ xfade = 86 + musicVol;
+ bool mouseReleased = false;
+ do {
+ while (g_system->getEventManager()->pollEvent(e)) {
+ if (e.type == Common::EVENT_LBUTTONUP) {
+ mouseReleased = true;
+ } else if (e.type == Common::EVENT_MOUSEMOVE) {
+ xfade = e.mouse.x;
+ }
+ }
+ if (xfade < 86) {
+ xfade = 86;
+ } else if (xfade > 226) {
+ xfade = 226;
+ }
+
+ if (oldxfade != xfade) {
+ _graphics->putImg(86, 76, sliderBackground2);
+ _graphics->putImg(xfade, 76, slider);
+ musicVol = xfade - 86;
+ debug("musicvol=%d", musicVol);
+ _sound->_musicVolRight = round((float)(musicVol) / 20);
+ _sound->_musicVolLeft = round((float)(musicVol) / 20);
+ _sound->setMidiVolume(_sound->_musicVolLeft, _sound->_musicVolRight);
+ }
+ _screen->update();
+ } while (!mouseReleased);
+
+ _mouse->show();
+ } else if (_mouse->mouseClickY >= 97 && _mouse->mouseClickY <= 107) {
+ exitSoundControls = true;
+ }
+ mouseClicked = false;
+ }
+ g_system->delayMillis(10);
+ _screen->update();
+ } while (!exitSoundControls && !shouldQuit());
+
+ _graphics->putImg(50, 10, soundControlsBackground);
+ _mouse->mouseX = oldMouseX;
+ _mouse->mouseY = oldMouseY;
+ _mouse->mouseMaskIndex = oldMouseMask;
+ _mouse->warpMouse(_mouse->mouseMaskIndex, _mouse->mouseX, _mouse->mouseY);
+ free(soundControlsBackground);
+ free(slider);
+ free(sliderBackground1);
+ free(sliderBackground2);
+
+ if (_cpCounter > 7)
+ showError(274);
+
+ _mouse->setMouseArea(Common::Rect(0, 0, 305, 185));
+}
+
+void TotEngine::loadBat() {
+ Common::File animFile;
+
+ _isSecondaryAnimationEnabled = true;
+ if (!animFile.open("MURCIE.DAT")) {
+ showError(265);
+ }
+ _secondaryAnimFrameSize = animFile.readUint16LE();
+ _secondaryAnimationFrameCount = animFile.readByte();
+ _secondaryAnimDirCount = animFile.readByte();
+ _curSecondaryAnimationFrame = (byte *)malloc(_secondaryAnimFrameSize);
+ loadAnimationForDirection(&animFile, 0);
+ animFile.close();
+}
+
+void TotEngine::loadDevil() {
+ Common::File animFile;
+
+ _isSecondaryAnimationEnabled = true;
+ if (!animFile.open("ROJOMOV.DAT")) {
+ showError(265);
+ }
+ _secondaryAnimFrameSize = animFile.readUint16LE();
+ _secondaryAnimationFrameCount = animFile.readByte();
+ _secondaryAnimDirCount = animFile.readByte();
+ _curSecondaryAnimationFrame = (byte *)malloc(_secondaryAnimFrameSize);
+ if (_secondaryAnimDirCount != 0) {
+ _secondaryAnimationFrameCount = _secondaryAnimationFrameCount / 4;
+ for (int i = 0; i <= 3; i++) {
+ loadAnimationForDirection(&animFile, i);
+ }
+ }
+ animFile.close();
+}
+
+void TotEngine::assembleCompleteBackground(byte *image, uint coordx, uint coordy) {
+ uint16 w, h;
+ uint16 wFondo;
+ w = READ_LE_UINT16(image);
+ h = READ_LE_UINT16(image + 2);
+
+ wFondo = READ_LE_UINT16(_sceneBackground);
+
+ wFondo++;
+ w++;
+ h++;
+ for (int i = 0; i < w; i++) {
+ for (int j = 0; j < h; j++) {
+ int color = image[4 + j * w + i];
+ if (color != 0) {
+ _sceneBackground[4 + (coordy + j) * wFondo + (coordx + i)] = color;
+ }
+ }
+ }
+}
+
+/**
+ * Assemble the screen for scroll assembles only the objects because scrolling screens
+ * never have secondary animations and character animation is assembled elsewhere.
+ */
+void TotEngine::assembleScreen(bool scroll) {
+
+ for (int indice = 0; indice < kDepthLevelCount; indice++) {
+ if (_screenLayers[indice] != NULL) {
+ assembleCompleteBackground(_screenLayers[indice], _depthMap[indice].posx, _depthMap[indice].posy);
+ }
+ if (!scroll && _mainCharAnimation.depth == indice) {
+ assembleCompleteBackground(_mainCharAnimation.bitmap[_charFacingDirection][_iframe], _characterPosX, _characterPosY);
+ }
+ if (!scroll && _currentRoomData->animationFlag && _secondaryAnimation.depth == indice) {
+ assembleCompleteBackground(_curSecondaryAnimationFrame, _secondaryAnimation.posx, _secondaryAnimation.posy);
+ }
+ }
+}
+
+void TotEngine::disableSecondAnimation() {
+ setRoomTrajectories(_secondaryAnimHeight, _secondaryAnimWidth, RESTORE);
+ _currentRoomData->animationFlag = false;
+ clearAnimation();
+ _graphics->restoreBackground();
+ assembleScreen();
+}
+
+void TotEngine::setRoomTrajectories(int animationHeight, int animationWidth, TRAJECTORIES_OP op, bool fixGrids) {
+ // add to restore the room, subtract to adjust before loading the screen
+
+ if (_currentRoomData->animationFlag && _currentRoomData->animationName != "QQQQQQQQ") {
+ for (int i = 0; i < _currentRoomData->secondaryTrajectoryLength; i++) {
+ if (op == RESTORE) {
+ _currentRoomData->secondaryAnimTrajectory[i].x = _currentRoomData->secondaryAnimTrajectory[i].x + (animationWidth >> 1);
+ _currentRoomData->secondaryAnimTrajectory[i].y = _currentRoomData->secondaryAnimTrajectory[i].y + animationHeight;
+ } else {
+ _currentRoomData->secondaryAnimTrajectory[i].x = _currentRoomData->secondaryAnimTrajectory[i].x - (animationWidth >> 1);
+ _currentRoomData->secondaryAnimTrajectory[i].y = _currentRoomData->secondaryAnimTrajectory[i].y - animationHeight;
+ }
+ }
+ if (fixGrids) {
+ for (int i = 0; i < _maxXGrid; i++) {
+ for (int j = 0; j < _maxYGrid; j++) {
+ if (op == RESTORE) {
+ _currentRoomData->walkAreasGrid[_oldposx + i][_oldposy + j] = _movementGridForSecondaryAnim[i][j];
+ _currentRoomData->mouseGrid[_oldposx + i][_oldposy + j] = _mouseGridForSecondaryAnim[i][j];
+ } else {
+ if (_maskGridSecondaryAnim[i][j] > 0)
+ _currentRoomData->walkAreasGrid[_oldposx + i][_oldposy + j] = _maskGridSecondaryAnim[i][j];
+ if (_maskMouseSecondaryAnim[i][j] > 0)
+ _currentRoomData->mouseGrid[_oldposx + i][_oldposy + j] = _maskMouseSecondaryAnim[i][j];
+ }
+ }
+ }
+ }
+ }
+}
+
} // End of namespace Tot
diff --git a/engines/tot/module.mk b/engines/tot/module.mk
index 0decf393a48..a9c971c4830 100644
--- a/engines/tot/module.mk
+++ b/engines/tot/module.mk
@@ -7,8 +7,7 @@ MODULE_OBJS = \
forest.o \
util.o \
anims.o \
- routines2.o \
- routines.o \
+ engine.o \
dialog.o \
font/bgifont.o \
font/biosfont.o \
diff --git a/engines/tot/routines2.cpp b/engines/tot/routines2.cpp
deleted file mode 100644
index 2f1d6bef06c..00000000000
--- a/engines/tot/routines2.cpp
+++ /dev/null
@@ -1,1197 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "common/config-manager.h"
-#include "common/debug.h"
-#include "common/file.h"
-#include "common/savefile.h"
-#include "common/system.h"
-#include "common/textconsole.h"
-#include "graphics/fonts/dosfont.h"
-#include "graphics/paletteman.h"
-#include "graphics/surface.h"
-#include "image/png.h"
-
-#include "tot/anims.h"
-#include "tot/statics.h"
-#include "tot/tot.h"
-#include "tot/util.h"
-
-namespace Tot {
-
-void TotEngine::initScreenPointers() {
- _screenSize = 65520;
- _sceneBackground = (byte *)malloc(_screenSize);
- _backgroundCopy = (byte *)malloc(_screenSize);
-}
-
-void TotEngine::loadAnimationForDirection(Common::SeekableReadStream *stream, int direction) {
- for (int j = 0; j < _secondaryAnimationFrameCount; j++) {
- _graphics->loadAnimationIntoBuffer(stream, _secondaryAnimation.bitmap[direction][j], _secondaryAnimFrameSize);
- }
-}
-
-void TotEngine::loadAnimation(Common::String animationName) {
- Common::File animFile;
-
- if (animationName == "PETER")
- _isPeterCoughing = true;
- else
- _isPeterCoughing = false;
-
- _isSecondaryAnimationEnabled = true;
- if (!animFile.open(Common::Path(animationName + ".DAT"))) {
- showError(265);
- }
-
- _secondaryAnimFrameSize = animFile.readUint16LE();
- _secondaryAnimationFrameCount = animFile.readByte();
- _secondaryAnimDirCount = animFile.readByte();
- _curSecondaryAnimationFrame = (byte *)malloc(_secondaryAnimFrameSize);
- if (_secondaryAnimDirCount != 0) {
-
- _secondaryAnimationFrameCount = _secondaryAnimationFrameCount / 4;
- for (int i = 0; i <= 3; i++) {
- loadAnimationForDirection(&animFile, i);
- }
- } else {
- loadAnimationForDirection(&animFile, 0);
- }
-
- animFile.close();
- debug("Read all frames! longtray2=%d", _currentRoomData->secondaryTrajectoryLength);
- _secondaryAnimWidth = READ_LE_UINT16(_secondaryAnimation.bitmap[0][1]) + 1;
- _secondaryAnimHeight = READ_LE_UINT16(_secondaryAnimation.bitmap[0][1] + 2) + 1;
-
- setRoomTrajectories(_secondaryAnimHeight, _secondaryAnimWidth, SET_WITH_ANIM, false);
-
- readObject(_currentRoomData->secondaryAnimDirections[299]);
- _maxXGrid = (_curObject.xgrid2 - _curObject.xgrid1 + 1);
- _maxYGrid = (_curObject.ygrid2 - _curObject.ygrid1 + 1);
- _oldposx = _curObject.xgrid1 + 1;
- _oldposy = _curObject.ygrid1 + 1;
-
- for (int i = 0; i < 10; i++)
- for (int j = 0; j < 10; j++) {
- _maskGridSecondaryAnim[i][j] = 0;
- _maskMouseSecondaryAnim[i][j] = 0;
- _movementGridForSecondaryAnim[i][j] = 0;
- _mouseGridForSecondaryAnim[i][j] = 0;
- }
-
- for (int i = 0; i < _maxXGrid; i++)
- for (int j = 0; j < _maxYGrid; j++) {
- _maskGridSecondaryAnim[i][j] = _curObject.walkAreasPatch[i][j];
- _maskMouseSecondaryAnim[i][j] = _curObject.mouseGridPatch[i][j];
- _movementGridForSecondaryAnim[i][j] = _currentRoomData->walkAreasGrid[_oldposx + i][_oldposy + j];
- _mouseGridForSecondaryAnim[i][j] = _currentRoomData->mouseGrid[_oldposx + i][_oldposy + j];
- }
- _iframe2 = 0;
-}
-
-void TotEngine::updateAltScreen(byte otherScreenNumber) {
- uint i22;
- uint i11;
-
- byte currentScreen = _currentRoomData->code;
-
- setRoomTrajectories(_secondaryAnimHeight, _secondaryAnimWidth, RESTORE);
-
- // Save current room
- saveRoomData(_currentRoomData, _rooms);
-
- // Load other screen
- _rooms->seek(otherScreenNumber * kRoomRegSize, SEEK_SET);
- _currentRoomData = readScreenDataFile(_rooms);
-
- switch (otherScreenNumber) {
- case 20: {
- switch (_niche[0][_niche[0][3]]) {
- case 0: {
- _currentRoomData->screenObjectIndex[9]->objectName = getObjectName(4);
- _currentRoomData->screenLayers[1].bitmapPointer = 1190768;
- } break;
- case 561: {
- _currentRoomData->screenObjectIndex[9]->objectName = getObjectName(5);
- _currentRoomData->screenLayers[1].bitmapPointer = 1182652;
- } break;
- case 563: {
- _currentRoomData->screenObjectIndex[9]->objectName = getObjectName(6);
- _currentRoomData->screenLayers[1].bitmapPointer = 1186044;
- } break;
- case 615: {
- _currentRoomData->screenObjectIndex[9]->objectName = getObjectName(7);
- _currentRoomData->screenLayers[1].bitmapPointer = 1181760;
- } break;
- }
- _currentRoomData->screenLayers[1].bitmapSize = 892;
- _currentRoomData->screenLayers[1].coordx = 66;
- _currentRoomData->screenLayers[1].coordy = 35;
- _currentRoomData->screenLayers[1].depth = 1;
- } break;
- case 24: {
- switch (_niche[1][_niche[1][3]]) {
- case 0: {
- _currentRoomData->screenObjectIndex[8]->objectName = getObjectName(4);
- _currentRoomData->screenLayers[0].bitmapPointer = 1399610;
- } break;
- case 561: {
- _currentRoomData->screenObjectIndex[8]->objectName = getObjectName(5);
- _currentRoomData->screenLayers[0].bitmapPointer = 1381982;
- } break;
- case 615: {
- _currentRoomData->screenObjectIndex[8]->objectName = getObjectName(7);
- _currentRoomData->screenLayers[0].bitmapPointer = 1381090;
- } break;
- case 622: {
- _currentRoomData->screenObjectIndex[8]->objectName = getObjectName(8);
- _currentRoomData->screenLayers[0].bitmapPointer = 1400502;
- } break;
- case 623: {
- _currentRoomData->screenObjectIndex[8]->objectName = getObjectName(9);
- _currentRoomData->screenLayers[0].bitmapPointer = 1398718;
- } break;
- }
- _currentRoomData->screenLayers[0].bitmapSize = 892;
- _currentRoomData->screenLayers[0].coordx = 217;
- _currentRoomData->screenLayers[0].coordy = 48;
- _currentRoomData->screenLayers[0].depth = 1;
- } break;
- case 31: {
- for (i11 = 23; i11 <= 25; i11++)
- for (i22 = 4; i22 <= 9; i22++)
- _currentRoomData->mouseGrid[i11][i22] = 4;
- for (i11 = 23; i11 <= 25; i11++)
- for (i22 = 10; i22 <= 11; i22++)
- _currentRoomData->mouseGrid[i11][i22] = 3;
-
- _currentRoomData->screenLayers[0].bitmapSize = 0;
- _currentRoomData->screenLayers[0].bitmapPointer = 0;
- _currentRoomData->screenLayers[0].coordx = 0;
- _currentRoomData->screenLayers[0].coordy = 0;
- _currentRoomData->screenLayers[0].depth = 0;
- } break;
- }
-
- // Save other screen
- saveRoomData(_currentRoomData, _rooms);
-
- // Restore current room again
- _rooms->seek(currentScreen * kRoomRegSize, SEEK_SET);
- _currentRoomData = readScreenDataFile(_rooms);
-
- setRoomTrajectories(_secondaryAnimHeight, _secondaryAnimWidth, SET_WITH_ANIM);
-}
-
-void TotEngine::verifyCopyProtection() {
- //TODO: Copy protection
-}
-
-void TotEngine::loadTV() {
-
- Common::File fichct;
- if (!fichct.open("PALETAS.DAT")) {
- showError(310);
- }
- fichct.seek(_currentRoomData->palettePointer + 603);
- fichct.read(g_engine->_graphics->_palAnimSlice, 144);
- for (int i = 0; i <= 48; i++) {
- g_engine->_graphics->_palAnimSlice[i * 3 + 0] <<= 2;
- g_engine->_graphics->_palAnimSlice[i * 3 + 1] <<= 2;
- g_engine->_graphics->_palAnimSlice[i * 3 + 2] <<= 2;
- }
-
- fichct.close();
- for (int ix = 195; ix <= 200; ix++) {
- g_engine->_graphics->_pal[ix * 3 + 0] = 2 << 2;
- g_engine->_graphics->_pal[ix * 3 + 1] = 2 << 2;
- g_engine->_graphics->_pal[ix * 3 + 2] = 2 << 2;
- setRGBPalette(ix, 2, 2, 2);
- }
-}
-
-void TotEngine::loadScreen() {
- Common::File paletteFile;
- palette palcp;
-
- _screenSize = _currentRoomData->roomImageSize;
- readBitmap(_currentRoomData->roomImagePointer, _sceneBackground, _screenSize, 316);
- Common::copy(_sceneBackground, _sceneBackground + _screenSize, _backgroundCopy);
- switch (_gamePart) {
- case 1: {
- if (!paletteFile.open("PALETAS.DAT")) {
- showError(310);
- }
- paletteFile.seek(_currentRoomData->palettePointer);
- paletteFile.read(palcp, 603);
- if (_currentRoomData->paletteAnimationFlag) {
- paletteFile.read(g_engine->_graphics->_palAnimSlice, 144);
- for (int i = 0; i <= 48; i++) {
- g_engine->_graphics->_palAnimSlice[i * 3 + 0] <<= 2;
- g_engine->_graphics->_palAnimSlice[i * 3 + 1] <<= 2;
- g_engine->_graphics->_palAnimSlice[i * 3 + 2] <<= 2;
- }
- }
- paletteFile.close();
- for (int i = 1; i <= 200; i++) {
- g_engine->_graphics->_pal[i * 3 + 0] = palcp[i * 3 + 0] << 2;
- g_engine->_graphics->_pal[i * 3 + 1] = palcp[i * 3 + 1] << 2;
- g_engine->_graphics->_pal[i * 3 + 2] = palcp[i * 3 + 2] << 2;
- }
- g_system->getPaletteManager()->setPalette(g_engine->_graphics->_pal, 0, 201);
- } break;
- case 2: {
- _graphics->loadPaletteFromFile("SEGUNDA");
- _currentRoomData->paletteAnimationFlag = true;
- } break;
- }
-}
-
-void TotEngine::clearScreenLayers() {
- for (int i = 0; i < kNumScreenOverlays; i++) {
- if (_screenLayers[i] != NULL)
- free(_screenLayers[i]);
- _screenLayers[i] = NULL;
- }
-}
-
-void TotEngine::clearAnimation() {
- if (_isSecondaryAnimationEnabled) {
- _isSecondaryAnimationEnabled = false;
- _curSecondaryAnimationFrame = NULL;
- for(int j = 0; j < _secondaryAnimDirCount; j++){
- for(int i = 0; i < _secondaryAnimationFrameCount; i++){
- if(_secondaryAnimation.bitmap[j][i] != NULL && _secondaryAnimation.bitmap[j][i] != _curSecondaryAnimationFrame) {
- free(_secondaryAnimation.bitmap[j][i]);
- }
- _secondaryAnimation.bitmap[j][i] = NULL;
- }
- }
- }
-}
-
-void TotEngine::freeInventory() {
- for (int i = 0; i < kInventoryIconCount; i++) {
- free(_inventoryIconBitmaps[i]);
- }
-}
-
-void TotEngine::verifyCopyProtection2() {
- // TODO:
-}
-
-void TotEngine::loadScreenLayerWithDepth(uint coordx, uint coordy, uint bitmapSize, int32 bitmapIndex, uint depth) {
- _screenLayers[depth] = (byte *)malloc(bitmapSize);
- readBitmap(bitmapIndex, _screenLayers[depth], bitmapSize, 319);
-
- uint16 w, h;
- w = READ_LE_UINT16(_screenLayers[depth]);
- h = READ_LE_UINT16(_screenLayers[depth] + 2);
- _depthMap[depth].posx = coordx;
- _depthMap[depth].posy = coordy;
- _depthMap[depth].posx2 = coordx + w + 1;
- _depthMap[depth].posy2 = coordy + h + 1;
-}
-
-void TotEngine::loadScreenLayer(uint coordx, uint coordy, uint bitmapSize, int32 bitmapIndex, uint depth) {
- loadScreenLayerWithDepth(coordx, coordy, bitmapSize, bitmapIndex, depth - 1);
-}
-
-void TotEngine::updateInventory(byte index) {
- for (int i = index; i < (kInventoryIconCount - 1); i++) {
- _inventory[i].bitmapIndex = _inventory[i + 1].bitmapIndex;
- _inventory[i].code = _inventory[i + 1].code;
- _inventory[i].objectName = _inventory[i + 1].objectName;
- }
- // verifyCopyProtection();
-}
-
-void TotEngine::drawLookAtItem(RoomObjectListEntry obj) {
- _mouse->hide();
- bar(0, 140, 319, 149, 0);
- actionLineText(getActionLineText(3) + obj.objectName);
- _mouse->show();
-}
-
-void TotEngine::putIcon(uint iconPosX, uint iconPosY, uint iconNum) {
- // substract 1 to account for 1-based indices
- _graphics->putImg(iconPosX, iconPosY, _inventoryIconBitmaps[_inventory[iconNum].bitmapIndex - 1]);
-}
-
-void TotEngine::drawInventory() {
- putIcon(34, 169, _inventoryPosition);
- putIcon(77, 169, _inventoryPosition + 1);
- putIcon(120, 169, _inventoryPosition + 2);
- putIcon(163, 169, _inventoryPosition + 3);
- putIcon(206, 169, _inventoryPosition + 4);
- putIcon(249, 169, _inventoryPosition + 5);
-}
-
-void lightUpLeft() {
- line(10, 173, 29, 173, 255);
- line(10, 173, 10, 189, 255);
- line(30, 174, 30, 190, 249);
- line(30, 190, 11, 190, 249);
-}
-
-void turnOffLeft() {
- line(10, 173, 29, 173, 249);
- line(10, 173, 10, 189, 249);
- line(30, 174, 30, 190, 255);
- line(30, 190, 11, 190, 255);
-}
-
-void lightUpRight() {
- line(291, 173, 310, 173, 255);
- line(291, 173, 291, 189, 255);
- line(311, 174, 311, 190, 249);
- line(311, 190, 292, 190, 249);
-}
-
-void turnOffRight() {
- line(291, 173, 310, 173, 249);
- line(291, 173, 291, 189, 249);
- line(311, 174, 311, 190, 255);
- line(311, 190, 292, 190, 255);
-}
-
-void TotEngine::drawInventory(byte dir, byte max) {
- switch (dir) {
- case 0:
- if (_inventoryPosition > 0) {
- _inventoryPosition -= 1;
- drawInventory();
- }
- break;
- case 1:
- if (_inventoryPosition < (max - 6)) {
- _inventoryPosition += 1;
- drawInventory();
- }
- break;
- }
- _mouse->hide();
- if (_inventoryPosition > 0)
- lightUpLeft();
- else
- turnOffLeft();
- if (_inventory[_inventoryPosition + 6].code > 0)
- lightUpRight();
- else
- turnOffRight();
- _mouse->show();
- if (_cpCounter > 145)
- showError(274);
-}
-
-void TotEngine::drawInventoryMask() {
-
- buttonBorder(0, 140, 319, 149, 0, 0, 0, 0, 0);
- for (int i = 1; i <= 25; i++)
- buttonBorder(0, (175 - i), 319, (174 + i), 251, 251, 251, 251, 0);
- drawMenu(1);
- // verifyCopyProtection();
- if (_inventoryPosition > 1)
- lightUpLeft();
- else
- turnOffLeft();
- if (_inventory[_inventoryPosition + 6].code > 0)
- lightUpRight();
- else
- turnOffRight();
-}
-
-void TotEngine::drawMenu(byte menuNumber) {
- byte *bitmap;
- uint menuSize;
- byte xmenu, ymenu;
- long menuOffset;
-
- Common::File menuFile;
- if (!menuFile.open("MENUS.DAT")) {
- showError(258);
- }
-
- menuOffset = _lang == Common::ES_ESP ? menuOffsets_ES[menuNumber - 1][0] : menuOffsets_EN[menuNumber - 1][0];
- menuSize = _lang == Common::ES_ESP ? menuOffsets_ES[menuNumber - 1][1] : menuOffsets_EN[menuNumber - 1][1];
-
- switch (menuNumber) {
- case 1: {
- xmenu = 0;
- ymenu = 150;
- } break;
- case 2: {
- xmenu = 50;
- ymenu = 10;
- } break;
- case 3: {
- xmenu = 50;
- ymenu = 10;
- } break;
- case 4: {
- if (_cpCounter2 > 20)
- showError(274);
- xmenu = 50;
- ymenu = 10;
- } break;
- case 5: {
- if (_cpCounter > 23)
- showError(274);
- xmenu = 0;
- ymenu = 150;
- } break;
- case 6: {
- xmenu = 50;
- ymenu = 10;
- } break;
- case 7: {
- xmenu = 58;
- ymenu = 48;
- } break;
- case 8: {
- xmenu = 84;
- ymenu = 34;
- } break;
- }
-
- bitmap = (byte *)malloc(menuSize);
- menuFile.seek(menuOffset);
- menuFile.read(bitmap, menuSize);
- _graphics->putImg(xmenu, ymenu, bitmap);
- free(bitmap);
- menuFile.close();
-}
-
-static void loadDiploma(Common::String &photoName, Common::String &key) {
- palette auxPal;
- byte *screen;
- uint size;
- byte *stamp;
-
- Common::File dipFile;
- if (!dipFile.open("DIPLOMA.PAN")) {
- showError(318);
- }
-
- dipFile.read(auxPal, 768);
-
- screen = (byte *)malloc(64000);
- dipFile.read(screen, 64000);
- dipFile.close();
-
- if (!dipFile.open(Common::Path("DIPLOMA/SELLO.BMP")))
- showError(271);
- stamp = (byte *)malloc(2054);
- dipFile.read(stamp, 2054);
- dipFile.close();
- g_engine->_graphics->drawFullScreen(screen);
-
- free(screen);
-
- if (dipFile.open(Common::Path("DIPLOMA/" + photoName + ".FOT"))) {
- size = dipFile.size() - 768;
- screen = (byte *)malloc(size);
- dipFile.read(g_engine->_graphics->_pal, 768);
- dipFile.read(screen, size);
- dipFile.close();
- g_engine->_graphics->putShape(10, 20, screen);
- free(screen);
- }
- for (int i = 16; i <= 255; i++) {
- auxPal[i * 3 + 0] = g_engine->_graphics->_pal[i * 3 + 0];
- auxPal[i * 3 + 1] = g_engine->_graphics->_pal[i * 3 + 1];
- auxPal[i * 3 + 2] = g_engine->_graphics->_pal[i * 3 + 2];
- }
-
- g_engine->_graphics->copyPalette(auxPal, g_engine->_graphics->_pal);
- g_engine->_graphics->fixPalette(g_engine->_graphics->_pal, 768);
- g_engine->_graphics->setPalette(g_engine->_graphics->_pal);
- g_engine->_screen->markAllDirty();
- g_engine->_screen->update();
-
- char *passArray = (char *)malloc(10);
- for (int i = 0; i < 10; i++)
- passArray[i] = (char)(Random(10) + 48);
-
- key.append(passArray, passArray + 10);
-
- const char *const *messages = (g_engine->_lang == Common::ES_ESP) ? fullScreenMessages[0] : fullScreenMessages[1];
- biosText(91, 16, messages[49] + key, 255);
- biosText(90, 15, messages[49] + key, 13);
-
- biosText(81, 61, messages[50], 0);
- biosText(61, 81, messages[51], 0);
- biosText(31, 101, messages[52] + g_engine->_characterName, 0);
- biosText(31, 121, messages[53], 0);
- biosText(31, 141, messages[54], 0);
- biosText(31, 161, messages[55], 0);
-
- biosText(80, 60, messages[50], 15);
- biosText(60, 80, messages[51], 15);
- biosText(30, 100, messages[52], 15);
-
- biosText(150, 100, g_engine->_characterName, 13);
-
- biosText(30, 120, messages[53], 15);
- biosText(30, 140, messages[54], 15);
- biosText(30, 160, messages[55], 15);
- delay(1500);
- g_engine->_sound->playVoc("PORTAZO", 434988, 932);
- g_engine->_graphics->putShape(270, 159, stamp);
- free(stamp);
-}
-
-static void saveDiploma(Common::String &photoName, Common::String &key) {
- Common::String name;
- if (photoName != "")
- name = "tot-diploma-" + photoName + ".png";
- else
- name = "tot-diploma-default.png";
- Common::OutSaveFile *thumbnail = g_engine->getSaveFileManager()->openForSaving(name);
- Graphics::Surface *surface = g_system->lockScreen();
- assert(surface);
- Image::writePNG(*thumbnail, *surface, g_engine->_graphics->getPalette());
- g_system->unlockScreen();
- thumbnail->finalize();
- delete thumbnail;
-}
-
-void TotEngine::generateDiploma(Common::String &photoName) {
- Common::String key;
- _mouse->hide();
- photoName.toUppercase();
- _graphics->totalFadeOut(0);
- loadDiploma(photoName, key);
-
- Common::Event e;
- bool keyPressed = false;
- do {
- _screen->update();
- while (g_system->getEventManager()->pollEvent(e)) {
- if (e.type == Common::EVENT_KEYUP) {
- keyPressed = true;
- }
- }
- g_system->delayMillis(10);
- } while (!keyPressed && !shouldQuit());
- saveDiploma(photoName, key);
- _mouse->show();
-}
-
-void TotEngine::checkMouseGrid() {
- uint xGrid, yGrid;
- Common::String invObject;
- if (_cpCounter2 > 120)
- showError(274);
- if (_mouse->mouseY >= 0 && _mouse->mouseY <= 131) {
- xGrid = _mouse->getMouseCoordsWithinGrid().x;
- yGrid = _mouse->getMouseCoordsWithinGrid().y;
- if (_currentRoomData->mouseGrid[xGrid][yGrid] != _currentRoomData->mouseGrid[_oldGridX][_oldGridY] || _oldInventoryObjectName != "") {
- bar(0, 140, 319, 149, 0);
- Common::String actionLine;
- switch (_actionCode) {
- case 0:
- actionLine = getActionLineText(0) + _currentRoomData->screenObjectIndex[_currentRoomData->mouseGrid[xGrid][yGrid]]->objectName;
- break;
- case 1:
- actionLine = getActionLineText(1) + _currentRoomData->screenObjectIndex[_currentRoomData->mouseGrid[xGrid][yGrid]]->objectName;
- break;
- case 2:
- actionLine = getActionLineText(2) + _currentRoomData->screenObjectIndex[_currentRoomData->mouseGrid[xGrid][yGrid]]->objectName;
- break;
- case 3:
- actionLine = getActionLineText(3) + _currentRoomData->screenObjectIndex[_currentRoomData->mouseGrid[xGrid][yGrid]]->objectName;
- break;
- case 4:
- if (_inventoryObjectName != "")
- actionLine = getActionLineText(4) + _inventoryObjectName + getActionLineText(7) + _currentRoomData->screenObjectIndex[_currentRoomData->mouseGrid[xGrid][yGrid]]->objectName;
- else
- actionLine = getActionLineText(4) + _currentRoomData->screenObjectIndex[_currentRoomData->mouseGrid[xGrid][yGrid]]->objectName;
- break;
- case 5:
- actionLine = getActionLineText(5) + _currentRoomData->screenObjectIndex[_currentRoomData->mouseGrid[xGrid][yGrid]]->objectName;
- break;
- case 6:
- actionLine = getActionLineText(6) + _currentRoomData->screenObjectIndex[_currentRoomData->mouseGrid[xGrid][yGrid]]->objectName;
- break;
- default:
- actionLine = getActionLineText(0) + _currentRoomData->screenObjectIndex[_currentRoomData->mouseGrid[xGrid][yGrid]]->objectName;
- }
- actionLineText(actionLine);
- _mouse->show();
- _oldGridX = xGrid;
- _oldGridY = yGrid;
- }
- _oldActionCode = 253;
- _oldInventoryObjectName = "";
- } else if (_mouse->mouseY >= 132 && _mouse->mouseY <= 165) {
- if (_actionCode != _oldActionCode) {
- bar(0, 140, 319, 149, 0);
- Common::String actionLine;
- switch (_actionCode) {
- case 0:
- actionLine = getActionLineText(0);
- break;
- case 1:
- actionLine = getActionLineText(1);
- break;
- case 2:
- actionLine = getActionLineText(2);
- break;
- case 3:
- actionLine = getActionLineText(3);
- break;
- case 4:
- if (_inventoryObjectName != "")
- actionLine = getActionLineText(4) + _inventoryObjectName + getActionLineText(7);
- else
- actionLine = getActionLineText(4);
- break;
- case 5:
- actionLine = getActionLineText(5);
- break;
- case 6:
- actionLine = getActionLineText(6);
- break;
- }
- actionLineText(actionLine);
- _mouse->show();
- _oldActionCode = _actionCode;
- _oldInventoryObjectName = "";
- _oldGridX = 0;
- _oldGridY = 0;
- }
- } else if (_mouse->mouseY >= 166 && _mouse->mouseY <= 199) {
- if (_mouse->mouseX >= 26 && _mouse->mouseX <= 65) {
- invObject = _inventory[_inventoryPosition].objectName;
- } else if (_mouse->mouseX >= 70 && _mouse->mouseX <= 108) {
- invObject = _inventory[_inventoryPosition + 1].objectName;
- } else if (_mouse->mouseX >= 113 && _mouse->mouseX <= 151) {
- invObject = _inventory[_inventoryPosition + 2].objectName;
- } else if (_mouse->mouseX >= 156 && _mouse->mouseX <= 194) {
- invObject = _inventory[_inventoryPosition + 3].objectName;
- } else if (_mouse->mouseX >= 199 && _mouse->mouseX <= 237) {
- invObject = _inventory[_inventoryPosition + 4].objectName;
- } else if (_mouse->mouseX >= 242 && _mouse->mouseX <= 280) {
- invObject = _inventory[_inventoryPosition + 5].objectName;
- } else {
- invObject = ' ';
- }
-
- if (invObject != _oldInventoryObjectName || _oldGridX != 0) {
- bar(0, 140, 319, 149, 0);
- Common::String actionLine;
- switch (_actionCode) {
- case 1:
- actionLine = getActionLineText(1) + invObject;
- break;
- case 2:
- actionLine = getActionLineText(2) + invObject;
- break;
- case 3:
- actionLine = getActionLineText(3) + invObject;
- break;
- case 4:
- if (_inventoryObjectName == "")
- actionLine = getActionLineText(4) + invObject;
- else
- actionLine = getActionLineText(4) + _inventoryObjectName + getActionLineText(7) + invObject;
- break;
- case 5:
- actionLine = getActionLineText(5) + invObject;
- break;
- case 6:
- actionLine = getActionLineText(6) + invObject;
- break;
- default:
- euroText(160, 144, invObject, 255, Graphics::kTextAlignCenter);
- }
- actionLineText(actionLine);
- _mouse->show();
- _oldInventoryObjectName = invObject;
- }
- _oldActionCode = 255;
- _oldGridX = 0;
- _oldGridY = 0;
- }
-}
-
-void TotEngine::readAlphaGraph(Common::String &output, int length, int posx, int posy, byte barColor) {
- int pun = 1;
- bar(posx, posy - 2, posx + length * 8, posy + 8, barColor);
-
- biosText(posx, posy, "_", 0);
-
- Common::Event e;
- bool done = false;
- while (!done && !shouldQuit()) {
- while (g_system->getEventManager()->pollEvent(e)) {
-
- if (e.type == Common::EVENT_KEYDOWN) {
- int keycode = e.kbd.keycode;
- int asciiCode = e.kbd.ascii;
- // ENTER key
- if (keycode == Common::KEYCODE_RETURN || keycode == Common::KEYCODE_KP_ENTER) {
- if (output.size() > 0) {
- done = true;
- continue;
- }
- }
- // Max 8 chars
- if (pun > length && asciiCode != 8) {
- _sound->beep(750, 60);
- bar((posx + (output.size()) * 8), (posy - 2), (posx + (output.size() + 1) * 8), (posy + 8), 0);
- } else if (asciiCode == 8 && pun > 1) { // delete
- output = output.substr(0, output.size() - 1);
- bar(posx, (posy - 2), (posx + length * 8), (posy + 8), barColor);
- biosText(posx, posy, output.c_str(), 0);
- biosText((posx + (output.size()) * 8), posy, "_", 0);
- pun -= 1;
- } else if (
- (asciiCode < 97 || asciiCode > 122) &&
- (asciiCode < 65 || asciiCode > 90) &&
- (asciiCode < 32 || asciiCode > 57) &&
- (asciiCode < 164 || asciiCode > 165)) {
- _sound->beep(1200, 60);
- } else {
- pun += 1;
- output = output + (char)e.kbd.ascii;
- bar(posx, (posy - 2), (posx + length * 8), (posy + 8), barColor);
- biosText(posx, posy, output.c_str(), 0);
- biosText((posx + (output.size()) * 8), posy, "_", 0);
- }
- }
- }
- g_system->delayMillis(10);
- _screen->update();
- }
-}
-
-void TotEngine::readAlphaGraphSmall(Common::String &output, int length, int posx, int posy, byte barColor,
- byte textColor) {
- int pun = 1;
- bool removeCaret;
- bar(posx, posy + 2, posx + length * 6, posy + 9, barColor);
-
- biosText(posx, posy, "-", textColor);
- Common::Event e;
- bool done = false;
-
- while (!done && !shouldQuit()) {
- while (g_system->getEventManager()->pollEvent(e)) {
- if (e.type == Common::EVENT_KEYDOWN) {
- int keycode = e.kbd.keycode;
- int asciiCode = e.kbd.ascii;
- // ENTER key
- if (keycode == Common::KEYCODE_RETURN || keycode == Common::KEYCODE_KP_ENTER) {
- if (output.size() > 0) {
- done = true;
- continue;
- }
- }
-
- if (pun > length && asciiCode != 8) {
- _sound->beep(750, 60);
- bar((posx + (output.size()) * 6), (posy + 2), (posx + (output.size() + 1) * 6), (posy + 9), barColor);
- } else if (asciiCode == 8 && pun > 1) {
- output = output.substr(0, output.size() - 1);
- bar(posx, (posy + 2), (posx + length * 6), (posy + 9), barColor);
- biosText(posx, posy, output, textColor);
- biosText((posx + (output.size()) * 6), posy, "-", textColor);
- pun -= 1;
- removeCaret = true;
- } else if ((asciiCode < '\40') || (asciiCode > '\373')) {
- _sound->beep(1200, 60);
- removeCaret = false;
- } else {
- pun += 1;
- output = output + (char)e.kbd.ascii;
- bar(posx, (posy + 2), (posx + length * 6), (posy + 9), barColor);
- littText(posx, posy, output, textColor);
- littText((posx + (output.size()) * 6), posy, "-", textColor);
- removeCaret = true;
- }
- }
- }
-
- g_system->delayMillis(10);
- _screen->update();
- }
-
- if (removeCaret)
- bar(posx + (output.size()) * 6, posy + 2, (posx + (output.size()) * 6) + 6, posy + 9, barColor);
-}
-
-void TotEngine::displayObjectDescription(Common::String textString) {
- uint xpos = 60;
- uint ypos = 15;
- byte maxWidth = 33;
- byte textColor = 255;
- byte shadowColor = 0;
- byte ihc, lineCounter;
- byte newLineMatrix[10];
-
- if (textString.size() < maxWidth) {
- euroText((xpos + 1), (ypos + 1), textString, shadowColor);
- _screen->update();
- delay(kEnforcedTextAnimDelay);
- euroText(xpos, ypos, textString, textColor);
- _screen->update();
- delay(kEnforcedTextAnimDelay);
- } else {
- ihc = 0;
- lineCounter = 0;
- newLineMatrix[0] = 0;
- do {
- ihc += maxWidth + 1;
- lineCounter += 1;
- do {
- ihc -= 1;
- } while (textString[ihc] != ' ');
- newLineMatrix[lineCounter] = ihc + 1;
- } while (ihc + 1 <= textString.size() - maxWidth);
-
- lineCounter += 1;
- newLineMatrix[lineCounter] = textString.size();
-
- for (byte line = 1; line <= lineCounter; line++) {
- Common::String lineString = textString.substr(newLineMatrix[line - 1], newLineMatrix[line] - newLineMatrix[line - 1]);
- euroText((xpos + 1), (ypos + ((line - 1) * 11) + 1), lineString, shadowColor);
- _screen->update();
- delay(kEnforcedTextAnimDelay);
- euroText(xpos, (ypos + ((line - 1) * 11)), lineString, textColor);
- _screen->update();
- delay(kEnforcedTextAnimDelay);
- }
- }
-}
-
-void TotEngine::buttonBorder(uint x1, uint y1, uint x2, uint y2,
- byte color1, byte color2, byte color3, byte color4, byte color5) {
-
- bar(x1, y1, x2, y2, color4);
- line(x1, y1, x1, y2, color1);
- line(x1, y1, x2, y1, color1);
-
- line(x2, y1, x2, y2, color2);
- line(x2, y2, x1, y2, color2);
-
- putpixel(x2, y1, color3);
- putpixel(x1, y2, color3);
-
- _screen->addDirtyRect(Common::Rect(
- x1, y1, x2, y2));
- _screen->update();
-}
-
-void TotEngine::copyProtection() {
- //todo
-}
-
-void TotEngine::soundControls() {
- uint oldMouseX,
- oldMouseY,
- soundControlsSize,
- sliderSize,
- sliderBgSize,
- sfxVol,
- musicVol,
- xfade,
- oldxfade;
-
- byte ytext, oldMouseMask;
- bool exitSoundControls;
-
- exitSoundControls = false;
- oldMouseX = _mouse->mouseX;
- oldMouseY = _mouse->mouseY;
- oldMouseMask = _mouse->mouseMaskIndex;
- _mouse->hide();
-
- soundControlsSize = imagesize(50, 10, 270, 120);
- //What was on the screen before blitting sound controls
- byte *soundControlsBackground = (byte *)malloc(soundControlsSize);
- _graphics->getImg(50, 10, 270, 120, soundControlsBackground);
-
- _mouse->mouseX = 150;
- _mouse->mouseY = 60;
- _mouse->mouseMaskIndex = 1;
-
- _mouse->setMouseArea(Common::Rect(55, 13, 250, 105));
-
- for (ytext = 1; ytext <= 6; ytext++)
- buttonBorder(120 - (ytext * 10), 80 - (ytext * 10), 200 + (ytext * 10), 60 + (ytext * 10), 251, 251, 251, 251, 0);
-
- buttonBorder(86, 31, 94, 44, 0, 0, 0, 0, 0);
-
- line(90, 31, 90, 44, 255);
-
- sliderSize = imagesize(86, 31, 94, 44);
- byte *slider = (byte *)malloc(sliderSize);
- _graphics->getImg(86, 31, 94, 44, slider);
-
- drawMenu(3);
- sliderBgSize = imagesize(86, 31, 234, 44);
-
- byte *sliderBackground1 = (byte *)malloc(sliderBgSize);
- byte *sliderBackground2 = (byte *)malloc(sliderBgSize);
- _graphics->getImg(86, 31, 234, 44, sliderBackground1);
- _graphics->getImg(86, 76, 234, 89, sliderBackground2);
-
- sfxVol = round(((_sound->_rightSfxVol + _sound->_leftSfxVol) / 2) * 20);
- musicVol = round(((_sound->_musicVolRight + _sound->_musicVolLeft) / 2) * 20);
- _graphics->putImg(sfxVol + 86, 31, slider);
- _graphics->putImg(musicVol + 86, 76, slider);
-
- _mouse->warpMouse(1, _mouse->mouseX, _mouse->mouseY);
- bool keyPressed = false;
- bool mouseClicked = false;
- Common::Event e;
- do {
- _chrono->updateChrono();
- do {
- _chrono->updateChrono();
- _mouse->animateMouseIfNeeded();
- while (g_system->getEventManager()->pollEvent(e)) {
- if (e.type == Common::EVENT_KEYUP) {
- keyPressed = true;
- }
- if (e.type == Common::EVENT_LBUTTONDOWN) {
- mouseClicked = true;
- _mouse->mouseClickX = e.mouse.x;
- _mouse->mouseClickY = e.mouse.y;
- }
- }
- _screen->update();
- } while ((!keyPressed && !mouseClicked) && !shouldQuit());
-
- _chrono->updateChrono();
- _mouse->animateMouseIfNeeded();
- if (keyPressed) {
- exitSoundControls = true;
- }
- if (mouseClicked) {
- if (_mouse->mouseClickY >= 22 && _mouse->mouseClickY <= 37) {
- _mouse->hide();
- xfade = 86 + sfxVol;
- bool mouseReleased = false;
- do {
-
- oldxfade = xfade;
- while (g_system->getEventManager()->pollEvent(e)) {
- if (e.type == Common::EVENT_LBUTTONUP) {
- mouseReleased = true;
- } else if (e.type == Common::EVENT_MOUSEMOVE) {
- xfade = e.mouse.x;
- }
- }
- if (xfade < 86) {
- xfade = 86;
- } else if (xfade > 226) {
- xfade = 226;
- }
-
- if (oldxfade != xfade) {
- _graphics->putImg(86, 31, sliderBackground1);
- _graphics->putImg(xfade, 31, slider);
- // This yields a volume between 0 and 140
- sfxVol = xfade - 86;
-
- debug("volumefx=%d", sfxVol);
- _sound->_rightSfxVol = round((float)sfxVol / 20);
- _sound->_leftSfxVol = round((float)sfxVol / 20);
- _sound->setSfxVolume(_sound->_leftSfxVol, _sound->_rightSfxVol);
- }
- _screen->update();
- } while (!mouseReleased);
-
- _mouse->show();
- } else if (_mouse->mouseClickY >= 67 && _mouse->mouseClickY <= 82) {
- _mouse->hide();
- xfade = 86 + musicVol;
- bool mouseReleased = false;
- do {
- while (g_system->getEventManager()->pollEvent(e)) {
- if (e.type == Common::EVENT_LBUTTONUP) {
- mouseReleased = true;
- } else if (e.type == Common::EVENT_MOUSEMOVE) {
- xfade = e.mouse.x;
- }
- }
- if (xfade < 86) {
- xfade = 86;
- } else if (xfade > 226) {
- xfade = 226;
- }
-
- if (oldxfade != xfade) {
- _graphics->putImg(86, 76, sliderBackground2);
- _graphics->putImg(xfade, 76, slider);
- musicVol = xfade - 86;
- debug("musicvol=%d", musicVol);
- _sound->_musicVolRight = round((float)(musicVol) / 20);
- _sound->_musicVolLeft = round((float)(musicVol) / 20);
- _sound->setMidiVolume(_sound->_musicVolLeft, _sound->_musicVolRight);
- }
- _screen->update();
- } while (!mouseReleased);
-
- _mouse->show();
- } else if (_mouse->mouseClickY >= 97 && _mouse->mouseClickY <= 107) {
- exitSoundControls = true;
- }
- mouseClicked = false;
- }
- g_system->delayMillis(10);
- _screen->update();
- } while (!exitSoundControls && !shouldQuit());
-
- _graphics->putImg(50, 10, soundControlsBackground);
- _mouse->mouseX = oldMouseX;
- _mouse->mouseY = oldMouseY;
- _mouse->mouseMaskIndex = oldMouseMask;
- _mouse->warpMouse(_mouse->mouseMaskIndex, _mouse->mouseX, _mouse->mouseY);
- free(soundControlsBackground);
- free(slider);
- free(sliderBackground1);
- free(sliderBackground2);
-
- if (_cpCounter > 7)
- showError(274);
-
- _mouse->setMouseArea(Common::Rect(0, 0, 305, 185));
-}
-
-void TotEngine::loadBat() {
- Common::File animFile;
-
- _isSecondaryAnimationEnabled = true;
- if (!animFile.open("MURCIE.DAT")) {
- showError(265);
- }
- _secondaryAnimFrameSize = animFile.readUint16LE();
- _secondaryAnimationFrameCount = animFile.readByte();
- _secondaryAnimDirCount = animFile.readByte();
- _curSecondaryAnimationFrame = (byte *)malloc(_secondaryAnimFrameSize);
- loadAnimationForDirection(&animFile, 0);
- animFile.close();
-}
-
-void TotEngine::loadDevil() {
- Common::File animFile;
-
- _isSecondaryAnimationEnabled = true;
- if (!animFile.open("ROJOMOV.DAT")) {
- showError(265);
- }
- _secondaryAnimFrameSize = animFile.readUint16LE();
- _secondaryAnimationFrameCount = animFile.readByte();
- _secondaryAnimDirCount = animFile.readByte();
- _curSecondaryAnimationFrame = (byte *)malloc(_secondaryAnimFrameSize);
- if (_secondaryAnimDirCount != 0) {
- _secondaryAnimationFrameCount = _secondaryAnimationFrameCount / 4;
- for (int i = 0; i <= 3; i++) {
- loadAnimationForDirection(&animFile, i);
- }
- }
- animFile.close();
-}
-
-void TotEngine::assembleCompleteBackground(byte *image, uint coordx, uint coordy) {
- uint16 w, h;
- uint16 wFondo;
- w = READ_LE_UINT16(image);
- h = READ_LE_UINT16(image + 2);
-
- wFondo = READ_LE_UINT16(_sceneBackground);
-
- wFondo++;
- w++;
- h++;
- for (int i = 0; i < w; i++) {
- for (int j = 0; j < h; j++) {
- int color = image[4 + j * w + i];
- if (color != 0) {
- _sceneBackground[4 + (coordy + j) * wFondo + (coordx + i)] = color;
- }
- }
- }
-}
-
-/**
- * Assemble the screen for scroll assembles only the objects because scrolling screens
- * never have secondary animations and character animation is assembled elsewhere.
- */
-void TotEngine::assembleScreen(bool scroll) {
-
- for (int indice = 0; indice < kDepthLevelCount; indice++) {
- if (_screenLayers[indice] != NULL) {
- assembleCompleteBackground(_screenLayers[indice], _depthMap[indice].posx, _depthMap[indice].posy);
- }
- if (!scroll && _mainCharAnimation.depth == indice) {
- assembleCompleteBackground(_mainCharAnimation.bitmap[_charFacingDirection][_iframe], _characterPosX, _characterPosY);
- }
- if (!scroll && _currentRoomData->animationFlag && _secondaryAnimation.depth == indice) {
- assembleCompleteBackground(_curSecondaryAnimationFrame, _secondaryAnimation.posx, _secondaryAnimation.posy);
- }
- }
-}
-
-void TotEngine::disableSecondAnimation() {
- setRoomTrajectories(_secondaryAnimHeight, _secondaryAnimWidth, RESTORE);
- _currentRoomData->animationFlag = false;
- clearAnimation();
- _graphics->restoreBackground();
- assembleScreen();
-}
-
-void TotEngine::setRoomTrajectories(int animationHeight, int animationWidth, TRAJECTORIES_OP op, bool fixGrids) {
- // add to restore the room, subtract to adjust before loading the screen
-
- if (_currentRoomData->animationFlag && _currentRoomData->animationName != "QQQQQQQQ") {
- for (int i = 0; i < _currentRoomData->secondaryTrajectoryLength; i++) {
- if (op == RESTORE) {
- _currentRoomData->secondaryAnimTrajectory[i].x = _currentRoomData->secondaryAnimTrajectory[i].x + (animationWidth >> 1);
- _currentRoomData->secondaryAnimTrajectory[i].y = _currentRoomData->secondaryAnimTrajectory[i].y + animationHeight;
- } else {
- _currentRoomData->secondaryAnimTrajectory[i].x = _currentRoomData->secondaryAnimTrajectory[i].x - (animationWidth >> 1);
- _currentRoomData->secondaryAnimTrajectory[i].y = _currentRoomData->secondaryAnimTrajectory[i].y - animationHeight;
- }
- }
- if (fixGrids) {
- for (int i = 0; i < _maxXGrid; i++) {
- for (int j = 0; j < _maxYGrid; j++) {
- if (op == RESTORE) {
- _currentRoomData->walkAreasGrid[_oldposx + i][_oldposy + j] = _movementGridForSecondaryAnim[i][j];
- _currentRoomData->mouseGrid[_oldposx + i][_oldposy + j] = _mouseGridForSecondaryAnim[i][j];
- } else {
- if (_maskGridSecondaryAnim[i][j] > 0)
- _currentRoomData->walkAreasGrid[_oldposx + i][_oldposy + j] = _maskGridSecondaryAnim[i][j];
- if (_maskMouseSecondaryAnim[i][j] > 0)
- _currentRoomData->mouseGrid[_oldposx + i][_oldposy + j] = _maskMouseSecondaryAnim[i][j];
- }
- }
- }
- }
- }
-}
-
-} // End of namespace Tot
diff --git a/engines/tot/tot.cpp b/engines/tot/tot.cpp
index 89d7e290df6..e900a34fca1 100644
--- a/engines/tot/tot.cpp
+++ b/engines/tot/tot.cpp
@@ -86,8 +86,6 @@ Common::Error TotEngine::run() {
initVars();
_isIntroSeen = ConfMan.getBool("introSeen");
- // _inventoryManager = new InventoryManager();
- // _totGame = new TotGame();
// Set the engine's debugger console
setDebugger(new TotConsole(this));
Commit: 71a4c8db8be2566bf2cc870389ecf2620df2df1a
https://github.com/scummvm/scummvm/commit/71a4c8db8be2566bf2cc870389ecf2620df2df1a
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:52+02:00
Commit Message:
TOT: Make dirty areas into class members
Changed paths:
engines/tot/engine.cpp
engines/tot/tot.h
diff --git a/engines/tot/engine.cpp b/engines/tot/engine.cpp
index 397f4f63ed5..4104f16eee8 100644
--- a/engines/tot/engine.cpp
+++ b/engines/tot/engine.cpp
@@ -158,34 +158,21 @@ void updateMovementGrids() {
void sprites(bool drawCharacter);
-static uint curDepth;
-/**
- * Point of origin of the area surrounding the main character.
- * Calculated using the position of the character.
- */
-static uint dirtyMainSpriteX, dirtyMainSpriteY;
-/**
- * End point of origin of the area surrounding the main character.
- * Calculated using the position of the character + dimension
- */
-static uint dirtyMainSpriteX2, dirtyMainSpriteY2;
-
static void assembleBackground() {
uint posabs;
-
// copies the entire clean background in backgroundCopy back into background
g_engine->_graphics->restoreBackground();
- posabs = 4 + dirtyMainSpriteY * 320 + dirtyMainSpriteX;
+ posabs = 4 + g_engine->_dirtyMainSpriteY * 320 + g_engine->_dirtyMainSpriteX;
uint16 w, h;
w = READ_LE_UINT16(g_engine->_characterDirtyRect);
h = READ_LE_UINT16(g_engine->_characterDirtyRect + 2);
w++;
h++;
- dirtyMainSpriteX2 = dirtyMainSpriteX + w;
- dirtyMainSpriteY2 = dirtyMainSpriteY + h;
+ g_engine->_dirtyMainSpriteX2 = g_engine->_dirtyMainSpriteX + w;
+ g_engine->_dirtyMainSpriteY2 = g_engine->_dirtyMainSpriteY + h;
for (int j = 0; j < h; j++) {
for (int i = 0; i < w; i++) {
@@ -215,30 +202,30 @@ static void assembleImage(byte *img, uint imgPosX, uint imgPosY) {
// This region calculates the overlapping area of (x, incx, y, incy)
{
- if (imgPosX < dirtyMainSpriteX)
- x = dirtyMainSpriteX;
+ if (imgPosX < g_engine->_dirtyMainSpriteX)
+ x = g_engine->_dirtyMainSpriteX;
else
x = imgPosX;
- if (imgPosX + wImg < dirtyMainSpriteX + wBg)
+ if (imgPosX + wImg < g_engine->_dirtyMainSpriteX + wBg)
incx = imgPosX + wImg - x;
else
- incx = dirtyMainSpriteX + wBg - x;
+ incx = g_engine->_dirtyMainSpriteX + wBg - x;
- if (imgPosY < dirtyMainSpriteY)
- y = dirtyMainSpriteY;
+ if (imgPosY < g_engine->_dirtyMainSpriteY)
+ y = g_engine->_dirtyMainSpriteY;
else
y = imgPosY;
- if (imgPosY + hImg < dirtyMainSpriteY + hBg)
+ if (imgPosY + hImg < g_engine->_dirtyMainSpriteY + hBg)
incy = imgPosY + hImg - y;
else
- incy = dirtyMainSpriteY + hBg - y;
+ incy = g_engine->_dirtyMainSpriteY + hBg - y;
} // end of region calculating overlapping area
for (int j = 0; j < incy; j++) {
for (int i = 0; i < incx; i++) {
- int bgOffset = 4 + ((y - dirtyMainSpriteY) + j) * wBg + i + (x - dirtyMainSpriteX);
+ int bgOffset = 4 + ((y - g_engine->_dirtyMainSpriteY) + j) * wBg + i + (x - g_engine->_dirtyMainSpriteX);
int imgOffset = 4 + (y - imgPosY + j) * wImg + i + (x - imgPosX);
if (img[imgOffset] != 0) {
g_engine->_characterDirtyRect[bgOffset] = img[imgOffset];
@@ -248,13 +235,13 @@ static void assembleImage(byte *img, uint imgPosX, uint imgPosY) {
}
static void overlayLayers() {
- if (g_engine->_screenLayers[curDepth] != NULL) {
+ if (g_engine->_screenLayers[g_engine->_curDepth] != NULL) {
if (
- (g_engine->_depthMap[curDepth].posx <= dirtyMainSpriteX2) &&
- (g_engine->_depthMap[curDepth].posx2 > dirtyMainSpriteX) &&
- (g_engine->_depthMap[curDepth].posy < dirtyMainSpriteY2) &&
- (g_engine->_depthMap[curDepth].posy2 > dirtyMainSpriteY)) {
- assembleImage(g_engine->_screenLayers[curDepth], g_engine->_depthMap[curDepth].posx, g_engine->_depthMap[curDepth].posy);
+ (g_engine->_depthMap[g_engine->_curDepth].posx <= g_engine->_dirtyMainSpriteX2) &&
+ (g_engine->_depthMap[g_engine->_curDepth].posx2 > g_engine->_dirtyMainSpriteX) &&
+ (g_engine->_depthMap[g_engine->_curDepth].posy < g_engine->_dirtyMainSpriteY2) &&
+ (g_engine->_depthMap[g_engine->_curDepth].posy2 > g_engine->_dirtyMainSpriteY)) {
+ assembleImage(g_engine->_screenLayers[g_engine->_curDepth], g_engine->_depthMap[g_engine->_curDepth].posx, g_engine->_depthMap[g_engine->_curDepth].posy);
}
}
}
@@ -279,19 +266,19 @@ void drawMainCharacter() {
WRITE_LE_UINT16(g_engine->_characterDirtyRect + 2, tempH);
assembleBackground();
- curDepth = 0;
- while (curDepth != kDepthLevelCount) {
+ g_engine->_curDepth = 0;
+ while (g_engine->_curDepth != kDepthLevelCount) {
overlayLayers();
- if (g_engine->_mainCharAnimation.depth == curDepth)
+ if (g_engine->_mainCharAnimation.depth == g_engine->_curDepth)
assembleImage(g_engine->_curCharacterAnimationFrame, g_engine->_characterPosX, g_engine->_characterPosY);
- curDepth += 1;
+ g_engine->_curDepth += 1;
}
- g_engine->_graphics->putImg(dirtyMainSpriteX, dirtyMainSpriteY, g_engine->_characterDirtyRect);
+ g_engine->_graphics->putImg(g_engine->_dirtyMainSpriteX, g_engine->_dirtyMainSpriteY, g_engine->_characterDirtyRect);
if (debug) {
// draw background dirty area
- drawRect(2, dirtyMainSpriteX, dirtyMainSpriteY, dirtyMainSpriteX + tempW, dirtyMainSpriteY + tempH);
+ drawRect(2, g_engine->_dirtyMainSpriteX, g_engine->_dirtyMainSpriteY, g_engine->_dirtyMainSpriteX + tempW, g_engine->_dirtyMainSpriteY + tempH);
drawPos(g_engine->_xframe2, g_engine->_yframe2, 218);
}
free(g_engine->_characterDirtyRect);
@@ -301,8 +288,8 @@ void TotEngine::sprites(bool drawMainCharachter) {
// grabs the current frame from the walk cycle
_curCharacterAnimationFrame = _mainCharAnimation.bitmap[_charFacingDirection][_iframe];
- dirtyMainSpriteX = _characterPosX - 3;
- dirtyMainSpriteY = _characterPosY - 3;
+ _dirtyMainSpriteX = _characterPosX - 3;
+ _dirtyMainSpriteY = _characterPosY - 3;
if (_isSecondaryAnimationEnabled) {
if (_currentRoomData->secondaryTrajectoryLength > 1) {
updateMovementGrids();
@@ -321,15 +308,15 @@ void TotEngine::sprites(bool drawMainCharachter) {
if (
((_secondaryAnimation.posx < (_characterPosX + curCharFrameW) + 4) &&
- ((_secondaryAnimation.posx + secAnimW + 1) > dirtyMainSpriteX) &&
+ ((_secondaryAnimation.posx + secAnimW + 1) > _dirtyMainSpriteX) &&
(_secondaryAnimation.posy < (_characterPosY + curCharFrameH + 4))) &&
- ((_secondaryAnimation.posy + secAnimH + 1) > dirtyMainSpriteY)) { // Character is in the area of the animation
+ ((_secondaryAnimation.posy + secAnimH + 1) > _dirtyMainSpriteY)) { // Character is in the area of the animation
if (_secondaryAnimation.posx < _characterPosX) {
- dirtyMainSpriteX = _secondaryAnimation.posx - 3;
+ _dirtyMainSpriteX = _secondaryAnimation.posx - 3;
}
if (_secondaryAnimation.posy < _characterPosY) {
- dirtyMainSpriteY = _secondaryAnimation.posy - 3;
+ _dirtyMainSpriteY = _secondaryAnimation.posy - 3;
}
uint16 patchW = secAnimW + curCharFrameW + 6;
@@ -341,12 +328,12 @@ void TotEngine::sprites(bool drawMainCharachter) {
patchH = secAnimH + 6 + abs(_characterPosY - _secondaryAnimation.posy);
}
- if (dirtyMainSpriteY + patchH > 140) {
- patchH -= (dirtyMainSpriteY + patchH) - 140 + 1;
+ if (_dirtyMainSpriteY + patchH > 140) {
+ patchH -= (_dirtyMainSpriteY + patchH) - 140 + 1;
}
- if (dirtyMainSpriteX + patchW > 320) {
- patchW -= (dirtyMainSpriteX + patchW) - 320 + 1;
+ if (_dirtyMainSpriteX + patchW > 320) {
+ patchW -= (_dirtyMainSpriteX + patchW) - 320 + 1;
}
_characterDirtyRect = (byte *)malloc((patchW + 1) * (patchH + 1) + 4);
@@ -355,34 +342,34 @@ void TotEngine::sprites(bool drawMainCharachter) {
WRITE_LE_UINT16(_characterDirtyRect + 2, patchH);
assembleBackground();
- curDepth = 0;
- while (curDepth != kDepthLevelCount) {
+ _curDepth = 0;
+ while (_curDepth != kDepthLevelCount) {
overlayLayers();
- if (_secondaryAnimation.depth == curDepth)
+ if (_secondaryAnimation.depth == _curDepth)
assembleImage(_curSecondaryAnimationFrame, _secondaryAnimation.posx, _secondaryAnimation.posy);
- if (_mainCharAnimation.depth == curDepth)
+ if (_mainCharAnimation.depth == _curDepth)
assembleImage(_curCharacterAnimationFrame, _characterPosX, _characterPosY);
- curDepth += 1;
+ _curDepth += 1;
}
- _graphics->putImg(dirtyMainSpriteX, dirtyMainSpriteY, _characterDirtyRect);
+ _graphics->putImg(_dirtyMainSpriteX, _dirtyMainSpriteY, _characterDirtyRect);
} else { // character and animation are in different parts of the screen
if (drawMainCharachter) {
drawMainCharacter();
}
- dirtyMainSpriteX = _secondaryAnimation.posx - 3;
- dirtyMainSpriteY = _secondaryAnimation.posy - 3;
+ _dirtyMainSpriteX = _secondaryAnimation.posx - 3;
+ _dirtyMainSpriteY = _secondaryAnimation.posy - 3;
secAnimW = READ_LE_UINT16(_curSecondaryAnimationFrame) + 6;
secAnimH = READ_LE_UINT16(_curSecondaryAnimationFrame + 2) + 6;
- if (dirtyMainSpriteY + secAnimH > 140) {
- secAnimH -= (dirtyMainSpriteY + secAnimH) - 140 + 1;
+ if (_dirtyMainSpriteY + secAnimH > 140) {
+ secAnimH -= (_dirtyMainSpriteY + secAnimH) - 140 + 1;
}
- if (dirtyMainSpriteX + secAnimW > 320) {
- secAnimW -= (dirtyMainSpriteX + secAnimW) - 320 + 1;
+ if (_dirtyMainSpriteX + secAnimW > 320) {
+ secAnimW -= (_dirtyMainSpriteX + secAnimW) - 320 + 1;
}
_characterDirtyRect = (byte *)malloc((secAnimW + 1) * (secAnimH + 1) + 4);
@@ -390,14 +377,14 @@ void TotEngine::sprites(bool drawMainCharachter) {
WRITE_LE_UINT16(_characterDirtyRect + 2, secAnimH);
assembleBackground();
- curDepth = 0;
- while (curDepth != kDepthLevelCount) {
+ _curDepth = 0;
+ while (_curDepth != kDepthLevelCount) {
overlayLayers();
- if (_secondaryAnimation.depth == curDepth)
+ if (_secondaryAnimation.depth == _curDepth)
assembleImage(_curSecondaryAnimationFrame, _secondaryAnimation.posx, _secondaryAnimation.posy);
- curDepth += 1;
+ _curDepth += 1;
}
- _graphics->putImg(dirtyMainSpriteX, dirtyMainSpriteY, _characterDirtyRect);
+ _graphics->putImg(_dirtyMainSpriteX, _dirtyMainSpriteY, _characterDirtyRect);
}
} else if (drawMainCharachter) {
drawMainCharacter();
@@ -3646,11 +3633,6 @@ void TotEngine::obtainName(Common::String &playerName) {
free(namePromptBG);
}
-void loadScrollData(uint roomCode, bool rightScroll,
- uint horizontalPos, int scrollCorrection);
-
-static byte *spriteBackground;
-
/**
* Blits srcImage over dstImage on the zeroed pixels of dstImage
*/
@@ -3709,13 +3691,13 @@ void TotEngine::scrollRight(uint &horizontalPos) {
Common::copy(_curCharacterAnimationFrame, _curCharacterAnimationFrame + _mainCharFrameSize, assembledCharacterFrame);
// puts the original captured background back in the background for next iteration
- _graphics->putImageArea(_characterPosX - 2, _characterPosY, _sceneBackground, spriteBackground);
+ _graphics->putImageArea(_characterPosX - 2, _characterPosY, _sceneBackground, _spriteBackground);
uint16 pasoframeW = READ_LE_UINT16(assembledCharacterFrame);
uint16 pasoframeH = READ_LE_UINT16(assembledCharacterFrame + 2);
// Grabs current area surrounding character (which might contain parts of A and B)
- _graphics->getImageArea(_characterPosX, _characterPosY, _characterPosX + pasoframeW, _characterPosY + pasoframeH, _sceneBackground, spriteBackground);
+ _graphics->getImageArea(_characterPosX, _characterPosY, _characterPosX + pasoframeW, _characterPosY + pasoframeH, _sceneBackground, _spriteBackground);
// blits over the character sprite, only on black pixels
- blit(spriteBackground, assembledCharacterFrame);
+ blit(_spriteBackground, assembledCharacterFrame);
// puts it back in the background (character + piece of background)
_graphics->putImageArea(_characterPosX, _characterPosY, _sceneBackground, assembledCharacterFrame);
} else
@@ -3761,13 +3743,13 @@ void TotEngine::scrollLeft(uint &horizontalPos) {
_curCharacterAnimationFrame = _mainCharAnimation.bitmap[3][_iframe];
Common::copy(_curCharacterAnimationFrame, _curCharacterAnimationFrame + _mainCharFrameSize, assembledCharacterFrame);
- _graphics->putImageArea(_characterPosX + 2, _characterPosY, _sceneBackground, spriteBackground);
+ _graphics->putImageArea(_characterPosX + 2, _characterPosY, _sceneBackground, _spriteBackground);
uint16 pasoframeW = READ_LE_UINT16(assembledCharacterFrame);
uint16 pasoframeH = READ_LE_UINT16(assembledCharacterFrame + 2);
- _graphics->getImageArea(_characterPosX, _characterPosY, _characterPosX + pasoframeW, _characterPosY + pasoframeH, _sceneBackground, spriteBackground);
- blit(spriteBackground, assembledCharacterFrame);
+ _graphics->getImageArea(_characterPosX, _characterPosY, _characterPosX + pasoframeW, _characterPosY + pasoframeH, _sceneBackground, _spriteBackground);
+ blit(_spriteBackground, assembledCharacterFrame);
_graphics->putImageArea(_characterPosX, _characterPosY, _sceneBackground, assembledCharacterFrame);
} else
_characterPosX += 4;
@@ -3791,8 +3773,8 @@ void TotEngine::loadScrollData(uint roomCode, bool rightScroll, uint horizontalP
uint characterFrameW = READ_LE_UINT16(_curCharacterAnimationFrame);
uint characterFrameH = READ_LE_UINT16(_curCharacterAnimationFrame + 2);
/* Copy the area with the player from previous scren*/
- spriteBackground = (byte *)malloc(4 + (characterFrameW + 8) * (characterFrameH + 8));
- _graphics->getImageArea(_characterPosX, _characterPosY, _characterPosX + characterFrameW, _characterPosY + characterFrameH, _sceneBackground, spriteBackground);
+ _spriteBackground = (byte *)malloc(4 + (characterFrameW + 8) * (characterFrameH + 8));
+ _graphics->getImageArea(_characterPosX, _characterPosY, _characterPosX + characterFrameW, _characterPosY + characterFrameH, _sceneBackground, _spriteBackground);
// Start screen 2
@@ -3833,7 +3815,7 @@ void TotEngine::loadScrollData(uint roomCode, bool rightScroll, uint horizontalP
assembleScreen();
_graphics->drawScreen(_sceneBackground);
- free(spriteBackground);
+ free(_spriteBackground);
loadScreen();
_trajectory[_currentTrajectoryIndex].x = _characterPosX;
_trajectory[_currentTrajectoryIndex].y = _characterPosY;
diff --git a/engines/tot/tot.h b/engines/tot/tot.h
index 386228da8c3..962b08c5701 100644
--- a/engines/tot/tot.h
+++ b/engines/tot/tot.h
@@ -445,7 +445,18 @@ public:
SavedGame _savedGame;
-
+ uint _curDepth;
+ /**
+ * Point of origin of the area surrounding the main character.
+ * Calculated using the position of the character.
+ */
+ uint _dirtyMainSpriteX, _dirtyMainSpriteY;
+ /**
+ * End point of origin of the area surrounding the main character.
+ * Calculated using the position of the character + dimension
+ */
+ uint _dirtyMainSpriteX2, _dirtyMainSpriteY2;
+ byte *_spriteBackground;
public:
TotEngine(OSystem *syst, const ADGameDescription *gameDesc);
~TotEngine() override;
Commit: 4f0613b5a02c129d74a58f05811844624ccdf6c5
https://github.com/scummvm/scummvm/commit/4f0613b5a02c129d74a58f05811844624ccdf6c5
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:53+02:00
Commit Message:
TOT: Fixes glitch when restarting from part 2
Changed paths:
engines/tot/engine.cpp
engines/tot/saveload.cpp
engines/tot/tot.cpp
diff --git a/engines/tot/engine.cpp b/engines/tot/engine.cpp
index 4104f16eee8..9f0edf41627 100644
--- a/engines/tot/engine.cpp
+++ b/engines/tot/engine.cpp
@@ -4386,7 +4386,6 @@ void TotEngine::loadAnimation(Common::String animationName) {
}
animFile.close();
- debug("Read all frames! longtray2=%d", _currentRoomData->secondaryTrajectoryLength);
_secondaryAnimWidth = READ_LE_UINT16(_secondaryAnimation.bitmap[0][1]) + 1;
_secondaryAnimHeight = READ_LE_UINT16(_secondaryAnimation.bitmap[0][1] + 2) + 1;
diff --git a/engines/tot/saveload.cpp b/engines/tot/saveload.cpp
index 17f71d5ccfa..08dd5eadffe 100644
--- a/engines/tot/saveload.cpp
+++ b/engines/tot/saveload.cpp
@@ -249,7 +249,7 @@ Common::Error TotEngine::syncGame(Common::Serializer &s) {
initializeScreenFile();
initializeObjectFile();
readConversationFile();
- // }
+
result = syncSaveData(s, loadedGame);
loadGame(loadedGame);
} else {
diff --git a/engines/tot/tot.cpp b/engines/tot/tot.cpp
index e900a34fca1..b46d9430b4a 100644
--- a/engines/tot/tot.cpp
+++ b/engines/tot/tot.cpp
@@ -510,7 +510,7 @@ int TotEngine::startGame() {
_sound->fadeInMusic();
if (_cpCounter2 > 43)
showError(274);
- sacrificeScene();
+ // sacrificeScene();
_graphics->clear();
loadInventory();
_graphics->loadPaletteFromFile("SEGUNDA");
@@ -593,14 +593,13 @@ void TotEngine::newGame() {
_saveAllowed = true;
_mouse->hide();
obtainName(_characterName);
-
if (!shouldQuit()) {
_graphics->totalFadeOut(0);
_graphics->clear();
displayLoading();
freeInventory();
- loadInventory();
resetGameState();
+ loadInventory();
_inGame = true;
for (int i = 0; i < kInventoryIconCount; i++) {
_inventory[i].bitmapIndex = 34;
@@ -1127,7 +1126,6 @@ void TotEngine::initializeScreenFile() {
}
void TotEngine::resetGameState() {
- debug("Reset game state");
_characterPosX = 160;
_characterPosY = 80;
_iframe = 0;
Commit: bec8294e003641dfa7d718e43b06ad5d5564a964
https://github.com/scummvm/scummvm/commit/bec8294e003641dfa7d718e43b06ad5d5564a964
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:53+02:00
Commit Message:
TOT: Fixes crash when loading
Changed paths:
engines/tot/tot.cpp
engines/tot/tot.h
diff --git a/engines/tot/tot.cpp b/engines/tot/tot.cpp
index b46d9430b4a..378fc2c1d56 100644
--- a/engines/tot/tot.cpp
+++ b/engines/tot/tot.cpp
@@ -1261,7 +1261,7 @@ void TotEngine::initVars() {
}
}
- for (int i = 0; i < _secondaryAnimDirCount; i++) {
+ for (int i = 0; i < 4; i++) {
for (int j = 0; j < kSecAnimationFrameCount; j++) {
_secondaryAnimation.bitmap[i][j] = NULL;
}
diff --git a/engines/tot/tot.h b/engines/tot/tot.h
index 962b08c5701..927e2a26b0d 100644
--- a/engines/tot/tot.h
+++ b/engines/tot/tot.h
@@ -250,7 +250,7 @@ public:
/**
* 1 first part, 2 second part
*/
- byte _gamePart = 1;
+ byte _gamePart;
/**
* Number of frames of secondary animation
*/
Commit: 95783adf9823c4dcbf2faf74f65d4882f4cdc45f
https://github.com/scummvm/scummvm/commit/95783adf9823c4dcbf2faf74f65d4882f4cdc45f
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:53+02:00
Commit Message:
TOT: Fixes dirty rect calculation on FLICs
Changed paths:
engines/tot/anims.cpp
engines/tot/cutscenes.cpp
engines/tot/engine.cpp
diff --git a/engines/tot/anims.cpp b/engines/tot/anims.cpp
index 393e2353f90..fa2e866d2ea 100644
--- a/engines/tot/anims.cpp
+++ b/engines/tot/anims.cpp
@@ -882,16 +882,9 @@ static FliHeader readHeader(Common::File *file) {
return headerfile;
}
-void blit(const Graphics::Surface *src, Common::Rect bounds) {
- int16 height = bounds.bottom - bounds.top;
- int16 width = bounds.right - bounds.left;
+void blit(TotFlicDecoder *flic, const Graphics::Surface *src, Common::Rect bounds) {
Graphics::Surface dest = g_engine->_screen->getSubArea(bounds);
-
- for (int i = 0; i < height - 1; i++) {
- for (int j = 0; j < width - 1; j++) {
- *((byte *)dest.getBasePtr(j, i)) = *((const byte *)src->getBasePtr(j, i));
- }
- }
+ flic->copyDirtyRectsToBuffer((byte *)dest.getPixels(), dest.pitch);
g_engine->_screen->addDirtyRect(bounds);
g_engine->_screen->update();
}
@@ -929,11 +922,11 @@ void drawFlc(
offset,
offset + header.size);
- TotFlicDecoder flic = TotFlicDecoder();
+ TotFlicDecoder *flic = new TotFlicDecoder();
- flic.loadStream(thisFlic);
+ flic->loadStream(thisFlic);
- flic.start();
+ flic->start();
bool skipFrame = false;
do {
exitProcedure(exitAnim, isSkipAllowed);
@@ -944,64 +937,68 @@ void drawFlc(
if (exitAnim) {
goto Lexit_proc;
}
- if(speed == 9) {
- skipFrame = !skipFrame;
- }
- if (gameTick && !skipFrame) {
- frameCount++;
+ // if(speed == 9) {
+ // skipFrame = !skipFrame;
+ // }
+ if (gameTick) {
+ // Make sure we also update the palette animations! Esp. for part 2
+ if (g_engine->_currentRoomData != NULL && !g_engine->_shouldQuitGame) {
+ g_engine->_graphics->advancePaletteAnim();
+ }
+
handleFlcEvent(eventNumber, loopNumber, frameCount);
- const Graphics::Surface *frame = flic.decodeNextFrame();
- if (frame) {
- Common::Rect boundingBox = Common::Rect(x, y, x + flic.getWidth() + 1, y + flic.getHeight() + 1);
- blit(frame, boundingBox);
- if (flic.hasDirtyPalette()) {
-
- const byte *fliPalette = (const byte *)flic.getPalette();
- byte *palette = (byte *)malloc(768);
- Common::copy(fliPalette, fliPalette + 768, palette);
- // game fixes background to 0
- palette[0] = 0;
- palette[1] = 0;
- palette[2] = 0;
- if (fullPalette) {
- g_engine->_graphics->fadePalettes(g_engine->_graphics->getPalette(), palette);
- g_engine->_graphics->copyPalette(palette, g_engine->_graphics->_pal);
- } else if (limitPaletteTo200) {
- g_engine->_graphics->setPalette(palette, 0, 200);
- for (int i = 0; i <= 200; i++) {
- if (g_engine->_gamePart == 2 && !g_engine->_shouldQuitGame && (i == 131 || i == 134 || i == 143 || i == 187)) {
- continue;
+ if(!skipFrame) {
+ const Graphics::Surface *frame = flic->decodeNextFrame();
+ if (frame) {
+ frameCount++;
+ Common::Rect boundingBox = Common::Rect(x, y, x + flic->getWidth() + 1, y + flic->getHeight() + 1);
+ blit(flic, frame, boundingBox);
+ if (flic->hasDirtyPalette()) {
+
+ const byte *fliPalette = (const byte *)flic->getPalette();
+ byte *palette = (byte *)malloc(768);
+ Common::copy(fliPalette, fliPalette + 768, palette);
+ // game fixes background to 0
+ palette[0] = 0;
+ palette[1] = 0;
+ palette[2] = 0;
+ if (fullPalette) {
+ g_engine->_graphics->fadePalettes(g_engine->_graphics->getPalette(), palette);
+ g_engine->_graphics->copyPalette(palette, g_engine->_graphics->_pal);
+ } else if (limitPaletteTo200) {
+ g_engine->_graphics->setPalette(palette, 0, 200);
+ for (int i = 0; i <= 200; i++) {
+ if (g_engine->_gamePart == 2 && !g_engine->_shouldQuitGame && (i == 131 || i == 134 || i == 143 || i == 187)) {
+ continue;
+ }
+ g_engine->_graphics->_pal[i * 3 + 0] = palette[i * 3 + 0];
+ g_engine->_graphics->_pal[i * 3 + 1] = palette[i * 3 + 1];
+ g_engine->_graphics->_pal[i * 3 + 2] = palette[i * 3 + 2];
}
- g_engine->_graphics->_pal[i * 3 + 0] = palette[i * 3 + 0];
- g_engine->_graphics->_pal[i * 3 + 1] = palette[i * 3 + 1];
- g_engine->_graphics->_pal[i * 3 + 2] = palette[i * 3 + 2];
- }
- } else {
- g_engine->_graphics->setPalette(palette);
- g_engine->_graphics->copyPalette(palette, g_engine->_graphics->_pal);
+ } else {
+ g_engine->_graphics->setPalette(palette);
+ g_engine->_graphics->copyPalette(palette, g_engine->_graphics->_pal);
+ }
}
+
+ gameTick = false;
+ } else {
+ break;
}
- // Make sure we also update the palette animations! Esp. for part 2
- if (g_engine->_currentRoomData != NULL && !g_engine->_shouldQuitGame) {
- g_engine->_graphics->advancePaletteAnim();
- }
- gameTick = false;
- } else {
- break;
}
}
g_system->delayMillis(10);
- } while (!flic.endOfVideo() && !g_engine->shouldQuit());
+ } while (!flic->endOfVideo() && !g_engine->shouldQuit());
- if (flic.endOfVideo()) {
- if (flic.isRewindable()) {
- flic.rewind();
+ if (flic->endOfVideo()) {
+ if (flic->isRewindable()) {
+ flic->rewind();
}
frameCount = 0;
}
} while (loopNumber <= loop && !g_engine->shouldQuit());
- flic.stop();
+ flic->stop();
Lexit_proc:
animationsFile.close();
}
diff --git a/engines/tot/cutscenes.cpp b/engines/tot/cutscenes.cpp
index 8a9d312afdb..90491fe3ee6 100644
--- a/engines/tot/cutscenes.cpp
+++ b/engines/tot/cutscenes.cpp
@@ -265,7 +265,6 @@ inline bool keyPressed() {
void TotEngine::credits() {
_saveAllowed = true;
- debug("Credits");
palette pal2;
byte *background;
byte *background2;
diff --git a/engines/tot/engine.cpp b/engines/tot/engine.cpp
index 9f0edf41627..b7f64a340a1 100644
--- a/engines/tot/engine.cpp
+++ b/engines/tot/engine.cpp
@@ -871,7 +871,6 @@ void TotEngine::lookAtObject(byte objectCode) {
void TotEngine::useInventoryObjectWithInventoryObject(uint objectCode1, uint objectCode2) {
byte invIndex, indobj1, indobj2;
- debug("Reading item register %d", objectCode1);
readObject(_sceneObjectsData, objectCode1, _curObject);
// verifyCopyProtection2();
if (_curObject.used[0] != 1 || _curObject.useWith != objectCode2) {
@@ -2832,9 +2831,7 @@ void TotEngine::useScreenObject() {
_mouse->hide();
_sound->playVoc("PUFF", 191183, 18001);
// Animate to scythe
- debug("Start anim!");
drawFlc(180, 60, offset, 0, 9, 0, false, false, true, foobar);
- debug("End Anim!");
// load Scythe
_currentRoomData->screenLayers[2].bitmapPointer = 1545820;
_currentRoomData->screenLayers[2].bitmapSize = 104;
Commit: 3084eede9f18dd4a4151eeb5cc90a48d6a59d348
https://github.com/scummvm/scummvm/commit/3084eede9f18dd4a4151eeb5cc90a48d6a59d348
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:53+02:00
Commit Message:
TOT: Fixes timing issues with FLIs
Changed paths:
engines/tot/anims.cpp
engines/tot/statics.h
diff --git a/engines/tot/anims.cpp b/engines/tot/anims.cpp
index fa2e866d2ea..ae7daef3901 100644
--- a/engines/tot/anims.cpp
+++ b/engines/tot/anims.cpp
@@ -925,7 +925,9 @@ void drawFlc(
TotFlicDecoder *flic = new TotFlicDecoder();
flic->loadStream(thisFlic);
-
+ if(speed == 9) {
+ debug("Playing at half speed!");
+ }
flic->start();
bool skipFrame = false;
do {
@@ -937,15 +939,15 @@ void drawFlc(
if (exitAnim) {
goto Lexit_proc;
}
- // if(speed == 9) {
- // skipFrame = !skipFrame;
- // }
+
if (gameTick) {
// Make sure we also update the palette animations! Esp. for part 2
if (g_engine->_currentRoomData != NULL && !g_engine->_shouldQuitGame) {
g_engine->_graphics->advancePaletteAnim();
}
-
+ if(speed == 9) {
+ skipFrame = !skipFrame;
+ }
handleFlcEvent(eventNumber, loopNumber, frameCount);
if(!skipFrame) {
const Graphics::Surface *frame = flic->decodeNextFrame();
@@ -986,6 +988,8 @@ void drawFlc(
} else {
break;
}
+ } else {
+ debug("Skipping frame!");
}
}
g_system->delayMillis(10);
diff --git a/engines/tot/statics.h b/engines/tot/statics.h
index f8f27c291cd..36d14e341c4 100644
--- a/engines/tot/statics.h
+++ b/engines/tot/statics.h
@@ -718,13 +718,13 @@ static const char *const fullScreenMessages[2][59] = {
"... AAAHHHHH!! ...",
// Diploma
// 49
- "CERTIFICATE No:",
- "I, Jacob, the Great Master",
- "of the Sek Umh Fraternity",
- "certify that: ",
- "has liberated me from the",
- "Eternal Caverns, and I shall be",
- "greatful to him forever.",
+ "CERTIFICADO N\xA7:",
+ "Yo, Jacob, el Gran Maestre ",
+ "de la Hermandad de Sek Umh Nejl",
+ "certifico que: ",
+ "me ha liberado de las Cavernas",
+ "Eternas, por lo cual le estar\x82 ",
+ "por siempre agradecido.",
// 56
" him back! If you achieve this your body will",
" live once more.",
Commit: 006e8134ec4e89c7623a0a75442e2b5cb211b0f3
https://github.com/scummvm/scummvm/commit/006e8134ec4e89c7623a0a75442e2b5cb211b0f3
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:53+02:00
Commit Message:
TOT: Fixes printing of name in diploma
Changed paths:
engines/tot/engine.cpp
diff --git a/engines/tot/engine.cpp b/engines/tot/engine.cpp
index b7f64a340a1..39a5dffc4e9 100644
--- a/engines/tot/engine.cpp
+++ b/engines/tot/engine.cpp
@@ -4844,7 +4844,12 @@ static void loadDiploma(Common::String &photoName, Common::String &key) {
biosText(81, 61, messages[50], 0);
biosText(61, 81, messages[51], 0);
- biosText(31, 101, messages[52] + g_engine->_characterName, 0);
+ if(g_engine->_lang == Common::ES_ESP) {
+ biosText(31, 101, messages[52] + g_engine->_characterName, 0);
+ } else {
+ biosText(31, 101, messages[52], 0);
+ biosText(151, 101, g_engine->_characterName, 0);
+ }
biosText(31, 121, messages[53], 0);
biosText(31, 141, messages[54], 0);
biosText(31, 161, messages[55], 0);
@@ -4858,6 +4863,7 @@ static void loadDiploma(Common::String &photoName, Common::String &key) {
biosText(30, 120, messages[53], 15);
biosText(30, 140, messages[54], 15);
biosText(30, 160, messages[55], 15);
+
delay(1500);
g_engine->_sound->playVoc("PORTAZO", 434988, 932);
g_engine->_graphics->putShape(270, 159, stamp);
Commit: 9ba70d698981465fcf50635552d363f3d92c0159
https://github.com/scummvm/scummvm/commit/9ba70d698981465fcf50635552d363f3d92c0159
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:53+02:00
Commit Message:
TOT: Removes gitignore
Changed paths:
R engines/tot/.gitignore
diff --git a/engines/tot/.gitignore b/engines/tot/.gitignore
deleted file mode 100644
index d9720be462c..00000000000
--- a/engines/tot/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-.vscode/
-*.o
-.deps
-*.a
Commit: 99f47964c62ad94d27aa5a6c1c636d85180eea8a
https://github.com/scummvm/scummvm/commit/99f47964c62ad94d27aa5a6c1c636d85180eea8a
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:53+02:00
Commit Message:
TOT: Initializes variables for Windows compiler
Changed paths:
engines/tot/dialog.cpp
engines/tot/engine.cpp
engines/tot/font/bgifont.h
engines/tot/graphics.cpp
engines/tot/types.h
diff --git a/engines/tot/dialog.cpp b/engines/tot/dialog.cpp
index dd50ebe08e2..9be10725d9d 100644
--- a/engines/tot/dialog.cpp
+++ b/engines/tot/dialog.cpp
@@ -49,13 +49,10 @@ static void findDownwards(Tree curTree, bool &descend) {
}
Common::List<uint>* findDialogue(Tree tree, byte characterIndex) {
- bool speak, ascend, descend, border, forward;
+ bool speak = false, ascend = false, descend = false, border = false, forward = false, done = false;
Tree auxTree = tree->child;
- bool done = false;
Common::List<uint> *linkedList = new Common::List<uint>();
- border = false;
- ascend = false;
Tree step;
do {
switch (auxTree->element.spoken) {
@@ -192,33 +189,26 @@ Common::List<uint>* findDialogue(Tree tree, byte characterIndex) {
case 1:
if (g_engine->_firstTimeTopicA[characterIndex - 1]) {
linkedList->push_back(12);
- // l1->item = 12;
forward = true;
} else if (g_engine->_bookTopic[characterIndex - 1]) {
forward = true;
linkedList->push_back(33);
-
- // l1->item = 33;
} else {
linkedList->push_back(21);
- // l1->item = 21;
forward = true;
}
break;
case 3:
if (g_engine->_firstTimeTopicA[characterIndex - 1]) {
linkedList->push_back(103);
- // l1->item = 103;
forward = true;
} else {
linkedList->push_back(112);
- // l1->item = 112;
forward = true;
}
break;
default: {
linkedList->push_back(auxTree->element.index);
- // l1->item = auxTree->element.index;
forward = true;
}
}
@@ -227,14 +217,10 @@ Common::List<uint>* findDialogue(Tree tree, byte characterIndex) {
}
else {
linkedList->push_back(auxTree->element.index);
- // l1->item = auxTree->element.index;
forward = true;
}
if (forward) {
forward = false;
- // l1->next = new LinkedList;
- // l1 = l1->next;
- // l1->next = NULL;
}
if (rightSibling(auxTree) != NULL)
auxTree = rightSibling(auxTree);
diff --git a/engines/tot/engine.cpp b/engines/tot/engine.cpp
index 39a5dffc4e9..5c986c03308 100644
--- a/engines/tot/engine.cpp
+++ b/engines/tot/engine.cpp
@@ -1278,9 +1278,11 @@ void TotEngine::animateBat() {
{290, 110}, {290, 112}, {290, 114}, {289, 116}, {289, 118}, {289, 120}, {289, 122}, {289, 124},
{290, 122}, {290, 120}, {290, 118}
};
- byte curAnimIFrame;
- uint currAnimWidth, curAnimHeight,
- curAnimIdx, curAnimLength, curAnimX, curAnimY, curAnimDepth, curAnimDir;
+ byte curAnimIFrame = 0;
+ uint currAnimWidth = 0, curAnimHeight = 0,
+ curAnimIdx = 0, curAnimLength = 0,
+ curAnimX = 0, curAnimY = 0,
+ curAnimDepth = 0, curAnimDir = 0;
bool loopBreak = false;
if (_currentRoomData->animationFlag) {
@@ -1350,8 +1352,8 @@ void TotEngine::updateVideo() {
}
void TotEngine::nicheAnimation(byte nicheDir, int32 bitmap) {
- uint bitmapOffset;
- int increment;
+ uint bitmapOffset = 0;
+ int increment = 0;
// Room with Red
if (_currentRoomData->code == 24) {
@@ -4727,7 +4729,7 @@ void TotEngine::drawInventoryMask() {
void TotEngine::drawMenu(byte menuNumber) {
byte *bitmap;
uint menuSize;
- byte xmenu, ymenu;
+ byte xmenu = 0, ymenu = 0;
long menuOffset;
Common::File menuFile;
@@ -5099,7 +5101,7 @@ void TotEngine::readAlphaGraph(Common::String &output, int length, int posx, int
void TotEngine::readAlphaGraphSmall(Common::String &output, int length, int posx, int posy, byte barColor,
byte textColor) {
int pun = 1;
- bool removeCaret;
+ bool removeCaret = 0;
bar(posx, posy + 2, posx + length * 6, posy + 9, barColor);
biosText(posx, posy, "-", textColor);
@@ -5340,6 +5342,8 @@ void TotEngine::soundControls() {
xfade = 86 + musicVol;
bool mouseReleased = false;
do {
+
+ oldxfade = xfade;
while (g_system->getEventManager()->pollEvent(e)) {
if (e.type == Common::EVENT_LBUTTONUP) {
mouseReleased = true;
diff --git a/engines/tot/font/bgifont.h b/engines/tot/font/bgifont.h
index 3603f2884b7..54b23917cdd 100644
--- a/engines/tot/font/bgifont.h
+++ b/engines/tot/font/bgifont.h
@@ -60,7 +60,7 @@ private:
charWidth = 0;
offset = 0;
}
- ~GlyphEntry();
+ ~GlyphEntry() {}
uint16 charWidth;
uint32 offset;
diff --git a/engines/tot/graphics.cpp b/engines/tot/graphics.cpp
index 8d4d7f96fe9..57b50bd24c0 100644
--- a/engines/tot/graphics.cpp
+++ b/engines/tot/graphics.cpp
@@ -65,8 +65,8 @@ GraphicsManager::~GraphicsManager() {
}
void GraphicsManager::restoreBackgroundArea(uint x, uint y, uint x2, uint y2) {
- for (int j = y; j < y2; j++) {
- for (int i = x; i < x2; i++) {
+ for (uint j = y; j < y2; j++) {
+ for (uint i = x; i < x2; i++) {
*((byte *)g_engine->_screen->getBasePtr(i, j)) = 0;
}
}
@@ -92,7 +92,7 @@ void GraphicsManager::setPalette(byte *palette, uint start, uint num) {
}
void GraphicsManager::fixPalette(byte *palette, uint num) {
- for (int i = 0; i < num; i++) {
+ for (uint i = 0; i < num; i++) {
palette[i] <<= 2;
}
}
@@ -277,7 +277,7 @@ void GraphicsManager::redFadeIn(byte *intermediatePalette) {
}
void GraphicsManager::updatePalette(byte paletteIndex) {
- int ip;
+ int ip = 0;
switch (g_engine->_gamePart) {
case 1: {
@@ -471,10 +471,8 @@ void GraphicsManager::drawScreen(byte *screen, bool offsetSize) {
}
void GraphicsManager::updateSceneArea(int speed) {
- // if (g_engine->_chrono->shouldPaintEffect(speed)) {
g_engine->_screen->addDirtyRect(Common::Rect(0, 0, 320, 140));
g_engine->_screen->update();
- // }
}
void GraphicsManager::sceneTransition(bool fadeToBlack, byte *scene) {
sceneTransition(fadeToBlack, scene, Random(15) + 1);
diff --git a/engines/tot/types.h b/engines/tot/types.h
index 541cd2b7332..19c176b0425 100644
--- a/engines/tot/types.h
+++ b/engines/tot/types.h
@@ -117,9 +117,9 @@ struct InventoryEntry {
*/
struct TextEntry {
Common::String text; // string
- bool continued; // true if the next entry is a continuation of this one
- uint16 response; // entry number of reply
- int32 pointer;
+ bool continued = false; // true if the next entry is a continuation of this one
+ uint16 response = 0; // entry number of reply
+ int32 pointer = 0;
};
struct ScreenObject {
Commit: e9138bd885673918498b306d82303560925a74c7
https://github.com/scummvm/scummvm/commit/e9138bd885673918498b306d82303560925a74c7
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:53+02:00
Commit Message:
TOT: Seeking issues on Windows
Changed paths:
engines/tot/anims.cpp
engines/tot/font/bgifont.cpp
engines/tot/tot.h
diff --git a/engines/tot/anims.cpp b/engines/tot/anims.cpp
index ae7daef3901..9c41d5aa9ca 100644
--- a/engines/tot/anims.cpp
+++ b/engines/tot/anims.cpp
@@ -988,8 +988,6 @@ void drawFlc(
} else {
break;
}
- } else {
- debug("Skipping frame!");
}
}
g_system->delayMillis(10);
diff --git a/engines/tot/font/bgifont.cpp b/engines/tot/font/bgifont.cpp
index 8a91b7486c5..2970d78914e 100644
--- a/engines/tot/font/bgifont.cpp
+++ b/engines/tot/font/bgifont.cpp
@@ -102,7 +102,7 @@ bool BgiFont::loadChr(Common::SeekableReadStream &stream) {
// Read drawing instructions until next glyph definition
for (int i = 0; i < _charCount; i++) {
_totalWidth += _glyphs[i].charWidth;
- stream.seek(_glyphs[i].offset, pos);
+ stream.seek(pos + _glyphs[i].offset, SEEK_SET);
int m;
do {
DrawingInstruction *inst = new DrawingInstruction();
diff --git a/engines/tot/tot.h b/engines/tot/tot.h
index 927e2a26b0d..ab6b5f5c956 100644
--- a/engines/tot/tot.h
+++ b/engines/tot/tot.h
@@ -283,7 +283,7 @@ public:
/**
* Code of selected object in the backpack
*/
- uint _backpackObjectCode;
+ uint _backpackObjectCode = 0;
/**
* Auxiliary vars for grid update
*/
@@ -296,7 +296,7 @@ public:
/**
* Current position of the main character
*/
- int _characterPosX, _characterPosY;
+ int _characterPosX = 0, _characterPosY = 0;
/**
* Target position of the main character?
*/
Commit: 0f047dbfae5d9279d648110c64d0a52625b83abc
https://github.com/scummvm/scummvm/commit/0f047dbfae5d9279d648110c64d0a52625b83abc
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:53+02:00
Commit Message:
TOT: Remove global vars from Chrono
Changed paths:
engines/tot/anims.cpp
engines/tot/chrono.cpp
engines/tot/chrono.h
engines/tot/cutscenes.cpp
engines/tot/dialog.cpp
engines/tot/engine.cpp
engines/tot/mouse.cpp
engines/tot/tot.cpp
engines/tot/util.cpp
diff --git a/engines/tot/anims.cpp b/engines/tot/anims.cpp
index 9c41d5aa9ca..4b646241280 100644
--- a/engines/tot/anims.cpp
+++ b/engines/tot/anims.cpp
@@ -940,7 +940,7 @@ void drawFlc(
goto Lexit_proc;
}
- if (gameTick) {
+ if (g_engine->_chrono->_gameTick) {
// Make sure we also update the palette animations! Esp. for part 2
if (g_engine->_currentRoomData != NULL && !g_engine->_shouldQuitGame) {
g_engine->_graphics->advancePaletteAnim();
@@ -984,7 +984,7 @@ void drawFlc(
}
}
- gameTick = false;
+ g_engine->_chrono->_gameTick = false;
} else {
break;
}
diff --git a/engines/tot/chrono.cpp b/engines/tot/chrono.cpp
index 49de1639428..0e19b4b188f 100644
--- a/engines/tot/chrono.cpp
+++ b/engines/tot/chrono.cpp
@@ -27,10 +27,6 @@
namespace Tot {
-bool gameTick = false;
-bool gameTickHalfSpeed = false;
-bool timeToDrawEffect = false;
-
ChronoManager::ChronoManager(/* args */) : _lastTick(0) {
}
@@ -41,30 +37,20 @@ void ChronoManager::updateChrono() {
uint32 currentTime = g_system->getMillis();
if ((currentTime - _lastTick) >= kTickMs / _speedMultiplier) {
- gameTick = true;
+ _gameTick = true;
_tickCount++;
if (_tickCount == kHalfTickMultiplier) {
_tickCount = 0;
- gameTickHalfSpeed = true;
+ _gameTickHalfSpeed = true;
} else {
- gameTickHalfSpeed = false;
+ _gameTickHalfSpeed = false;
}
_lastTick = currentTime;
} else {
- gameTick = false;
+ _gameTick = false;
}
}
-bool ChronoManager::shouldPaintEffect(int speed) {
- uint32 curTime = g_system->getMillis();
- // _lastEffectRender += g_system->getMillis();
- if ((curTime - _lastEffectRender) >= kFrameEffectMs * speed) {
- _lastEffectRender = curTime;
- return true;
- } else
- return false;
-}
-
void ChronoManager::changeSpeed() {
if (_speedMultiplier == 1)
g_engine->_chrono->_speedMultiplier = 4;
diff --git a/engines/tot/chrono.h b/engines/tot/chrono.h
index 7a2d13fe5b1..7d8b03365b2 100644
--- a/engines/tot/chrono.h
+++ b/engines/tot/chrono.h
@@ -25,11 +25,6 @@
namespace Tot {
-/**
- * Flags for animations
- */
-extern bool gameTick, gameTickHalfSpeed, timeToDrawEffect;
-
// const int kTickMs = 20;
const int kTickMs = 50;
const int kHalfTickMultiplier = 2;
@@ -39,7 +34,6 @@ class ChronoManager {
private:
uint32 _lastTick = 0;
byte _tickCount = 0;
- uint32 _lastEffectRender = 0;
byte _speedMultiplier = 1;
public:
@@ -47,8 +41,10 @@ public:
~ChronoManager();
void updateChrono();
void delay(int ms);
- bool shouldPaintEffect(int speed);
void changeSpeed();
+
+ bool _gameTick = false;
+ bool _gameTickHalfSpeed = false;
};
} // End of namespace Tot
diff --git a/engines/tot/cutscenes.cpp b/engines/tot/cutscenes.cpp
index 90491fe3ee6..74eea7e1b96 100644
--- a/engines/tot/cutscenes.cpp
+++ b/engines/tot/cutscenes.cpp
@@ -137,8 +137,8 @@ void putCreditsImg(uint x, uint y, byte *img1, byte *img2, bool direct) {
do {
g_engine->_chrono->updateChrono();
g_system->delayMillis(10);
- } while (!gameTick && !g_engine->shouldQuit());
- gameTick = false;
+ } while (!g_engine->_chrono->_gameTick && !g_engine->shouldQuit());
+ g_engine->_chrono->_gameTick = false;
// Copies the credit window directly to the screen
for (int i = 0; i < hImg1; i++) {
@@ -412,7 +412,7 @@ void TotEngine::introduction() {
goto Lsalirpres;
}
- if (gameTick) {
+ if (g_engine->_chrono->_gameTick) {
loopCount += 1;
}
g_system->delayMillis(10);
diff --git a/engines/tot/dialog.cpp b/engines/tot/dialog.cpp
index 9be10725d9d..fb13809ddfb 100644
--- a/engines/tot/dialog.cpp
+++ b/engines/tot/dialog.cpp
@@ -362,7 +362,7 @@ void showDialogueLine(
}
}
- if (gameTick) {
+ if (g_engine->_chrono->_gameTick) {
g_engine->_graphics->advancePaletteAnim();
}
g_system->delayMillis(10);
diff --git a/engines/tot/engine.cpp b/engines/tot/engine.cpp
index 5c986c03308..943e2620e03 100644
--- a/engines/tot/engine.cpp
+++ b/engines/tot/engine.cpp
@@ -87,7 +87,7 @@ void TotEngine::runaroundRed() {
_isSecondaryAnimationEnabled = true;
do {
_chrono->updateChrono();
- if (gameTick) {
+ if (_chrono->_gameTick) {
if (secTrajIndex == secTrajLength)
exitLoop = true;
secTrajIndex += 1;
@@ -111,9 +111,9 @@ void TotEngine::runaroundRed() {
_secondaryAnimation.depth = 3;
}
- gameTickHalfSpeed = true;
+ _chrono->_gameTickHalfSpeed = true;
sprites(false);
- gameTick = false;
+ _chrono->_gameTick = false;
_graphics->advancePaletteAnim();
_screen->update();
}
@@ -294,7 +294,7 @@ void TotEngine::sprites(bool drawMainCharachter) {
if (_currentRoomData->secondaryTrajectoryLength > 1) {
updateMovementGrids();
}
- if (gameTickHalfSpeed) {
+ if (_chrono->_gameTickHalfSpeed) {
if (_isPeterCoughing && !_sound->isVocPlaying()) {
_iframe2 = 0;
}
@@ -401,13 +401,13 @@ void TotEngine::adjustKey() {
_iframe++;
_currentTrajectoryIndex += 1;
emptyLoop();
- gameTick = false;
+ _chrono->_gameTick = false;
_graphics->advancePaletteAnim();
sprites(true);
} while (_currentTrajectoryIndex != _trajectoryLength);
_charFacingDirection = 3;
emptyLoop();
- gameTick = false;
+ _chrono->_gameTick = false;
sprites(true);
}
@@ -421,12 +421,12 @@ void TotEngine::adjustKey2() {
_iframe++;
_currentTrajectoryIndex -= 1;
emptyLoop();
- gameTick = false;
+ _chrono->_gameTick = false;
_graphics->advancePaletteAnim();
sprites(true);
} while (_currentTrajectoryIndex != 0);
emptyLoop();
- gameTick = false;
+ _chrono->_gameTick = false;
sprites(true);
}
@@ -457,8 +457,8 @@ void TotEngine::animatedSequence(uint numSequence) {
animIndex = 0;
do {
emptyLoop();
- gameTick = false;
- if (gameTickHalfSpeed) {
+ _chrono->_gameTick = false;
+ if (_chrono->_gameTickHalfSpeed) {
if (_currentSecondaryTrajectoryIndex >= _currentRoomData->secondaryTrajectoryLength)
_currentSecondaryTrajectoryIndex = 1;
else
@@ -500,8 +500,8 @@ void TotEngine::animatedSequence(uint numSequence) {
animIndex = 0;
do {
emptyLoop();
- gameTick = false;
- if (gameTickHalfSpeed) {
+ _chrono->_gameTick = false;
+ if (_chrono->_gameTickHalfSpeed) {
if (_currentSecondaryTrajectoryIndex >= _currentRoomData->secondaryTrajectoryLength)
_currentSecondaryTrajectoryIndex = 1;
else
@@ -542,8 +542,8 @@ void TotEngine::animatedSequence(uint numSequence) {
animIndex = 0;
do {
emptyLoop();
- gameTick = false;
- if (gameTickHalfSpeed) {
+ _chrono->_gameTick = false;
+ if (_chrono->_gameTickHalfSpeed) {
if (_currentSecondaryTrajectoryIndex >= _currentRoomData->secondaryTrajectoryLength)
_currentSecondaryTrajectoryIndex = 1;
else
@@ -566,7 +566,7 @@ void TotEngine::animatedSequence(uint numSequence) {
_iframe = 0;
_charFacingDirection = 2;
emptyLoop();
- gameTick = false;
+ _chrono->_gameTick = false;
_characterPosX = tmpCharacterPosX;
sprites(true);
} break;
@@ -586,7 +586,7 @@ void TotEngine::animatedSequence(uint numSequence) {
for (animIndex = 1; animIndex <= 31; animIndex++) {
animationFile.read(animptr, animFrameSize);
emptyLoop();
- gameTick = false;
+ _chrono->_gameTick = false;
_graphics->advancePaletteAnim();
_graphics->putShape(animX, animY, animptr);
}
@@ -605,7 +605,7 @@ void TotEngine::animatedSequence(uint numSequence) {
for (animIndex = 32; animIndex <= secFrameCount; animIndex++) {
animationFile.read(animptr, animFrameSize);
emptyLoop();
- gameTick = false;
+ _chrono->_gameTick = false;
_graphics->advancePaletteAnim();
_graphics->putImg(animX, animY, animptr);
if (shouldQuit()) {
@@ -629,7 +629,7 @@ void TotEngine::animatedSequence(uint numSequence) {
for (animIndex = 1; animIndex <= 8; animIndex++) {
animationFile.read(animptr, animFrameSize);
emptyLoop();
- gameTick = false;
+ _chrono->_gameTick = false;
_graphics->putShape(animX, animY, animptr);
if (shouldQuit()) {
break;
@@ -647,9 +647,9 @@ void TotEngine::animatedSequence(uint numSequence) {
for (animIndex = 9; animIndex <= secFrameCount; animIndex++) {
animationFile.read(animptr, animFrameSize);
emptyLoop();
- gameTick = false;
+ _chrono->_gameTick = false;
emptyLoop();
- gameTick = false;
+ _chrono->_gameTick = false;
_graphics->putShape(animX, animY, animptr);
if (shouldQuit()) {
break;
@@ -660,7 +660,7 @@ void TotEngine::animatedSequence(uint numSequence) {
_iframe = 0;
_charFacingDirection = 2;
emptyLoop();
- gameTick = false;
+ _chrono->_gameTick = false;
sprites(true);
} break;
case 6: {
@@ -677,9 +677,9 @@ void TotEngine::animatedSequence(uint numSequence) {
animIndex = 0;
do {
emptyLoop();
- gameTick = false;
+ _chrono->_gameTick = false;
_graphics->advancePaletteAnim();
- if (gameTickHalfSpeed) {
+ if (_chrono->_gameTickHalfSpeed) {
animationFile.read(_screenLayers[6], animFrameSize);
Common::copy(_screenLayers[6], _screenLayers[6] + animFrameSize, _sceneBackground + 44900);
_graphics->restoreBackground();
@@ -1084,9 +1084,9 @@ void TotEngine::updateMainCharacterDepth() {
}
void TotEngine::advanceAnimations(bool barredZone, bool animateMouse) {
- if (gameTick) {
+ if (_chrono->_gameTick) {
- if (_currentRoomData->animationFlag && gameTickHalfSpeed) {
+ if (_currentRoomData->animationFlag && _chrono->_gameTickHalfSpeed) {
if (_isPeterCoughing && (Random(100) == 1) && !_sound->isVocPlaying() && _mintTopic[0] == false) {
debug("Playing tos");
_sound->playVoc("TOS", 258006, 14044);
@@ -1189,7 +1189,7 @@ void TotEngine::advanceAnimations(bool barredZone, bool animateMouse) {
if (_isDrawingEnabled) {
sprites(true);
}
- gameTick = false;
+ _chrono->_gameTick = false;
_graphics->advancePaletteAnim();
}
}
@@ -1202,7 +1202,7 @@ void TotEngine::animateGive(uint dir, uint height) {
_charFacingDirection = dir;
for (uint i = 0; i < 5; i++) {
emptyLoop();
- gameTick = false;
+ _chrono->_gameTick = false;
// Must add 1 to i because the original game uses 1-based indices
_iframe = 15 + 6 + 5 + height * 10 - (i + 1);
@@ -1217,7 +1217,7 @@ void TotEngine::animatePickup1(uint dir, uint height) {
_charFacingDirection = dir;
for (uint i = 0; i < 5; i++) {
emptyLoop();
- gameTick = false;
+ _chrono->_gameTick = false;
_iframe = 15 + height * 10 + (i + 1);
_graphics->advancePaletteAnim();
@@ -1232,7 +1232,7 @@ void TotEngine::animatePickup2(uint dir, uint height) {
for (uint i = 0; i < 5; i++) {
emptyLoop();
- gameTick = false;
+ _chrono->_gameTick = false;
_iframe = 15 + 5 + height * 10 + (i + 1);
@@ -1241,7 +1241,7 @@ void TotEngine::animatePickup2(uint dir, uint height) {
_screen->update();
}
emptyLoop();
- gameTick = false;
+ _chrono->_gameTick = false;
sprites(true);
_iframe = 0;
}
@@ -1251,14 +1251,14 @@ void TotEngine::animateOpen2(uint dir, uint height) {
_cpCounter = _cpCounter2;
for (uint i = 0; i < 5; i++) {
emptyLoop();
- gameTick = false;
+ _chrono->_gameTick = false;
_iframe = 15 + 6 + height * 10 - (i + 1);
_graphics->advancePaletteAnim();
sprites(true);
}
emptyLoop();
- gameTick = false;
+ _chrono->_gameTick = false;
sprites(true);
_iframe = 0;
}
@@ -1304,7 +1304,7 @@ void TotEngine::animateBat() {
_secondaryAnimation.depth = 14;
do {
_chrono->updateChrono();
- if (gameTick) {
+ if (_chrono->_gameTick) {
if (curAnimIdx == curAnimLength)
loopBreak = true;
curAnimIdx += 1;
@@ -1317,7 +1317,7 @@ void TotEngine::animateBat() {
_secondaryAnimation.posy = batTrajectory[curAnimIdx][1];
_secondaryAnimation.dir = 0;
sprites(true);
- gameTick = false;
+ _chrono->_gameTick = false;
if (curAnimIdx % 24 == 0)
_sound->playVoc();
_graphics->advancePaletteAnim();
@@ -1953,7 +1953,7 @@ void TotEngine::useScreenObject() {
_secondaryAnimation.posx = _currentRoomData->secondaryAnimTrajectory[_currentSecondaryTrajectoryIndex - 1].x;
_secondaryAnimation.posy = _currentRoomData->secondaryAnimTrajectory[_currentSecondaryTrajectoryIndex - 1].y;
emptyLoop();
- gameTick = false;
+ _chrono->_gameTick = false;
emptyLoop2();
sprites(true);
_screen->update();
@@ -2353,7 +2353,7 @@ void TotEngine::useScreenObject() {
_secondaryAnimation.posx = _currentRoomData->secondaryAnimTrajectory[_currentSecondaryTrajectoryIndex - 1].x;
_secondaryAnimation.posy = _currentRoomData->secondaryAnimTrajectory[_currentSecondaryTrajectoryIndex - 1].y;
emptyLoop();
- gameTick = false;
+ _chrono->_gameTick = false;
emptyLoop2();
sprites(true);
} while (!(_currentSecondaryTrajectoryIndex == (_currentRoomData->secondaryTrajectoryLength / 2)));
@@ -2377,7 +2377,7 @@ void TotEngine::useScreenObject() {
_secondaryAnimation.posx = _currentRoomData->secondaryAnimTrajectory[_currentSecondaryTrajectoryIndex - 1].x;
_secondaryAnimation.posy = _currentRoomData->secondaryAnimTrajectory[_currentSecondaryTrajectoryIndex - 1].y;
emptyLoop();
- gameTick = false;
+ _chrono->_gameTick = false;
emptyLoop2();
sprites(true);
@@ -2406,9 +2406,9 @@ void TotEngine::useScreenObject() {
animateGive(3, 2);
do {
_chrono->updateChrono();
- if (gameTick) {
+ if (_chrono->_gameTick) {
_graphics->advancePaletteAnim();
- gameTick = false;
+ _chrono->_gameTick = false;
}
_screen->update();
g_system->delayMillis(10);
@@ -4290,9 +4290,9 @@ void TotEngine::sayLine(
}
changeGameSpeed(e);
}
- if (gameTick) {
- gameTick = false;
- if (gameTickHalfSpeed) {
+ if (_chrono->_gameTick) {
+ _chrono->_gameTick = false;
+ if (_chrono->_gameTickHalfSpeed) {
if (isWithinConversation) {
talkAnimIndex += 1;
if (textColor == 255) {
diff --git a/engines/tot/mouse.cpp b/engines/tot/mouse.cpp
index d4eff431d20..79ca0e0cca3 100644
--- a/engines/tot/mouse.cpp
+++ b/engines/tot/mouse.cpp
@@ -48,7 +48,7 @@ void MouseManager::drawMask(int idx) {
}
void MouseManager::animateMouseIfNeeded() {
- if (gameTick) {
+ if (g_engine->_chrono->_gameTick) {
setMouseMask(_currentMouseMask);
if (_currentMouseMask < 7) {
// sync this with frame time
diff --git a/engines/tot/tot.cpp b/engines/tot/tot.cpp
index 378fc2c1d56..68ae397a166 100644
--- a/engines/tot/tot.cpp
+++ b/engines/tot/tot.cpp
@@ -1268,7 +1268,7 @@ void TotEngine::initVars() {
}
resetGameState();
- gameTick = false;
+ _chrono->_gameTick = false;
for (int i = 0; i < kNumScreenOverlays; i++) {
_screenLayers[i] = NULL;
}
diff --git a/engines/tot/util.cpp b/engines/tot/util.cpp
index 5a9e4b3885e..9b5a6ce09bc 100644
--- a/engines/tot/util.cpp
+++ b/engines/tot/util.cpp
@@ -479,14 +479,14 @@ void emptyLoop() {
do {
g_engine->_chrono->updateChrono();
g_engine->_screen->update();
- } while (!gameTick && !g_engine->shouldQuit());
+ } while (!g_engine->_chrono->_gameTick && !g_engine->shouldQuit());
}
void emptyLoop2() {
do {
g_engine->_chrono->updateChrono();
g_engine->_screen->update();
- } while (!gameTickHalfSpeed);
+ } while (!g_engine->_chrono->_gameTickHalfSpeed);
}
void waitForKey() {
Commit: 43053ed45d7e0b5f35cbc713f05b62e57d34598b
https://github.com/scummvm/scummvm/commit/43053ed45d7e0b5f35cbc713f05b62e57d34598b
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:53+02:00
Commit Message:
TOT: Gives all engine vars an initial value
Changed paths:
engines/tot/tot.h
diff --git a/engines/tot/tot.h b/engines/tot/tot.h
index ab6b5f5c956..4840c0c2940 100644
--- a/engines/tot/tot.h
+++ b/engines/tot/tot.h
@@ -189,31 +189,31 @@ public:
Common::MemorySeekableReadWriteStream *_rooms;
Common::MemorySeekableReadWriteStream *_sceneObjectsData;
- bool _roomChange;
- bool _isTVOn,
- _isVasePlaced,
- _isScytheTaken,
- _isTridentTaken,
- _isPottersWheelDelivered,
- _isMudDelivered,
- _isGreenDevilDelivered,
- _isRedDevilCaptured,
- _isPottersManualDelivered,
- _isCupboardOpen,
- _isChestOpen,
- _isTrapSet,
- _isPeterCoughing;
-
- bool _isSealRemoved;
- bool _inGame;
- bool _firstTimeDone; // Flag for first time run of the game.
- bool _isIntroSeen;
- bool _shouldQuitGame;
- bool _startNewGame; // Flag to initialize game
- bool _continueGame; // Flag to resume game
- bool _isSavingDisabled;
- bool _isDrawingEnabled; // true if sprites should be drawn
- bool _isSecondaryAnimationEnabled; // Whether room has secondary animation
+ bool _roomChange = false;
+ bool _isTVOn = false;
+ bool _isVasePlaced = false;
+ bool _isScytheTaken = false;
+ bool _isTridentTaken = false;
+ bool _isPottersWheelDelivered = false;
+ bool _isMudDelivered = false;
+ bool _isGreenDevilDelivered = false;
+ bool _isRedDevilCaptured = false;
+ bool _isPottersManualDelivered = false;
+ bool _isCupboardOpen = false;
+ bool _isChestOpen = false;
+ bool _isTrapSet = false;
+ bool _isPeterCoughing = false;
+
+ bool _isSealRemoved = false;
+ bool _inGame = false;
+ bool _firstTimeDone = false; // Flag for first time run of the game.
+ bool _isIntroSeen = false;
+ bool _shouldQuitGame = false;
+ bool _startNewGame = false; // Flag to initialize game
+ bool _continueGame = false; // Flag to resume game
+ bool _isSavingDisabled = false;
+ bool _isDrawingEnabled = false; // true if sprites should be drawn
+ bool _isSecondaryAnimationEnabled = false; // Whether room has secondary animation
InventoryEntry _inventory[kInventoryIconCount]; // These are the icons currnetly in the inventory
/**
@@ -223,7 +223,7 @@ public:
/**
* Position within inventory
*/
- byte _inventoryPosition;
+ byte _inventoryPosition = 0;
/**
* Animation sequences
*/
@@ -242,31 +242,31 @@ public:
/**
* Number of trajectory changes
*/
- byte _trajectorySteps;
+ byte _trajectorySteps = 0;
/**
* index of currently selected door.
*/
- byte _doorIndex;
+ byte _doorIndex = 0;
/**
* 1 first part, 2 second part
*/
- byte _gamePart;
+ byte _gamePart = 1;
/**
* Number of frames of secondary animation
*/
- byte _secondaryAnimationFrameCount;
+ byte _secondaryAnimationFrameCount = 0;
/**
* Number of directions of the secondary animation
*/
- byte _secondaryAnimDirCount;
+ byte _secondaryAnimDirCount = 0;
/**
* Data protection control
*/
- byte _cpCounter, _cpCounter2;
+ byte _cpCounter = 0, _cpCounter2 = 0;
/**
* Coordinates of target step
*/
- byte _destinationX, _destinationY;
+ byte _destinationX = 0, _destinationY = 0;
/**
* Current character facing direction
* 0: upwards
@@ -274,12 +274,12 @@ public:
* 2: downwards
* 3: left
*/
- byte _charFacingDirection;
+ byte _charFacingDirection = 0;
/**
* Width and height of secondary animation
*/
- uint _secondaryAnimWidth, _secondaryAnimHeight;
+ uint _secondaryAnimWidth = 0, _secondaryAnimHeight = 0;
/**
* Code of selected object in the backpack
*/
@@ -314,7 +314,7 @@ public:
/**
* Name of player
*/
- Common::String _characterName;
+ Common::String _characterName = "";
Common::String _decryptionKey;
@@ -339,15 +339,15 @@ public:
/**
* Longitude of the trajectory matrix.
*/
- uint _trajectoryLength;
+ uint _trajectoryLength = 0;
/**
* Position within the trajectory matrix
*/
- uint _currentTrajectoryIndex;
+ uint _currentTrajectoryIndex = 0;
/**
* Position within the trajectory matrix for secondary animation
*/
- uint _currentSecondaryTrajectoryIndex;
+ uint _currentSecondaryTrajectoryIndex = 0;
/**
* Screen areas
*/
@@ -375,31 +375,31 @@ public:
*/
byte _maskMouseSecondaryAnim[10][10];
- bool _list1Complete,
- _list2Complete,
- _obtainedList1, // whether we've been given list 1
- _obtainedList2; // whether we've been given list 2
+ bool _list1Complete = false,
+ _list2Complete = false,
+ _obtainedList1 = false, // whether we've been given list 1
+ _obtainedList2 = false; // whether we've been given list 2
/** Conversation topic unlocks */
- bool _firstTimeTopicA[kCharacterCount],
- _firstTimeTopicB[kCharacterCount],
- _firstTimeTopicC[kCharacterCount],
- _bookTopic[kCharacterCount],
- _mintTopic[kCharacterCount];
+ bool _firstTimeTopicA[kCharacterCount] = { false },
+ _firstTimeTopicB[kCharacterCount] = { false },
+ _firstTimeTopicC[kCharacterCount] = { false },
+ _bookTopic[kCharacterCount] = { false },
+ _mintTopic[kCharacterCount] = { false };
- bool _caves[5];
+ bool _caves[5] = { false };
/**
* First and second lists of objects to retrieve in the game
*/
- uint16 _firstList[5], _secondList[5];
+ uint16 _firstList[5] = { 0 }, _secondList[5] = { 0 };
- long _screenSize;
+ long _screenSize = 65520;
/**
* Frame number for the animations
*/
- byte _iframe, _iframe2;
+ byte _iframe = 0, _iframe2 = 0;
/**
* Depth of screenobjects
@@ -432,7 +432,7 @@ public:
*/
byte *_backgroundCopy;
- uint _currentRoomNumber;
+ uint _currentRoomNumber = 0;
bool _isLoadingFromLauncher = false;
@@ -445,17 +445,17 @@ public:
SavedGame _savedGame;
- uint _curDepth;
+ uint _curDepth = 0;
/**
* Point of origin of the area surrounding the main character.
* Calculated using the position of the character.
*/
- uint _dirtyMainSpriteX, _dirtyMainSpriteY;
+ uint _dirtyMainSpriteX = 0, _dirtyMainSpriteY = 0;
/**
* End point of origin of the area surrounding the main character.
* Calculated using the position of the character + dimension
*/
- uint _dirtyMainSpriteX2, _dirtyMainSpriteY2;
+ uint _dirtyMainSpriteX2 = 0, _dirtyMainSpriteY2 = 0;
byte *_spriteBackground;
public:
TotEngine(OSystem *syst, const ADGameDescription *gameDesc);
Commit: f2cddc9d910dc10c0238712c64f7212330854414
https://github.com/scummvm/scummvm/commit/f2cddc9d910dc10c0238712c64f7212330854414
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:53+02:00
Commit Message:
TOT: Removes pointer to reference in credits
Changed paths:
engines/tot/cutscenes.cpp
diff --git a/engines/tot/cutscenes.cpp b/engines/tot/cutscenes.cpp
index 74eea7e1b96..2e2c2f881cc 100644
--- a/engines/tot/cutscenes.cpp
+++ b/engines/tot/cutscenes.cpp
@@ -27,7 +27,7 @@
namespace Tot {
-void drawCreditsScreen(byte *&backgroundPointer, uint &sizeAuxBG, byte *&auxBG) {
+byte *drawCreditsScreen(uint &sizeAuxBG, byte *&auxBG) {
palette intermediatePalette, darkPalette;
Common::File ppFile;
@@ -35,7 +35,7 @@ void drawCreditsScreen(byte *&backgroundPointer, uint &sizeAuxBG, byte *&auxBG)
if (!ppFile.open("DIPLOMA.PAN")) {
showError(315);
}
- backgroundPointer = (byte *)malloc(64000);
+ byte *backgroundPointer = (byte *)malloc(64000);
ppFile.read(intermediatePalette, 768);
ppFile.read(backgroundPointer, 64000);
ppFile.close();
@@ -62,6 +62,7 @@ void drawCreditsScreen(byte *&backgroundPointer, uint &sizeAuxBG, byte *&auxBG)
g_engine->_graphics->copyPalette(intermediatePalette, g_engine->_graphics->_pal);
if (g_engine->_cpCounter2 > 9)
showError(274);
+ return backgroundPointer;
}
void putCreditsImg(uint x, uint y, byte *img1, byte *img2, bool direct) {
@@ -266,7 +267,6 @@ inline bool keyPressed() {
void TotEngine::credits() {
_saveAllowed = true;
palette pal2;
- byte *background;
byte *background2;
uint sizeBg2;
bool exit;
@@ -277,7 +277,7 @@ void TotEngine::credits() {
_screen->clear();
_sound->playMidi("CREDITOS", true);
_sound->fadeInMusic();
- drawCreditsScreen(background, sizeBg2, background2);
+ byte *background = drawCreditsScreen(sizeBg2, background2);
exit = false;
Commit: de98ec80b768aaefa629cad4f56237ceedc2fd28
https://github.com/scummvm/scummvm/commit/de98ec80b768aaefa629cad4f56237ceedc2fd28
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:54+02:00
Commit Message:
TOT: Replaces usage of NULL for nullptr
Changed paths:
engines/tot/dialog.cpp
engines/tot/engine.cpp
engines/tot/forest.cpp
engines/tot/tot.cpp
engines/tot/types.h
diff --git a/engines/tot/dialog.cpp b/engines/tot/dialog.cpp
index fb13809ddfb..57de31befdd 100644
--- a/engines/tot/dialog.cpp
+++ b/engines/tot/dialog.cpp
@@ -37,7 +37,7 @@ Common::String decrypt(Common::String encryptedText) {
Common::List<uint>* findDialogue(Tree tree, byte characterIndex);
static void findDownwards(Tree curTree, bool &descend) {
- if (curTree != NULL) {
+ if (curTree != nullptr) {
if (curTree->element.spoken != '1') {
descend = true;
return;
@@ -68,7 +68,7 @@ Common::List<uint>* findDialogue(Tree tree, byte characterIndex) {
findDownwards(step, descend);
if (!(descend))
ascend = true;
- step = NULL;
+ step = nullptr;
} break;
case '3':
if (g_engine->_bookTopic[0] && (characterIndex == 3)) {
@@ -222,7 +222,7 @@ Common::List<uint>* findDialogue(Tree tree, byte characterIndex) {
if (forward) {
forward = false;
}
- if (rightSibling(auxTree) != NULL)
+ if (rightSibling(auxTree) != nullptr)
auxTree = rightSibling(auxTree);
else {
do {
@@ -230,15 +230,15 @@ Common::List<uint>* findDialogue(Tree tree, byte characterIndex) {
auxTree = parent(auxTree);
else
break;
- } while (!(auxTree->element.spoken == '1' && rightSibling(auxTree) != NULL));
- if (rightSibling(auxTree) != NULL)
+ } while (!(auxTree->element.spoken == '1' && rightSibling(auxTree) != nullptr));
+ if (rightSibling(auxTree) != nullptr)
auxTree = rightSibling(auxTree);
else
done = true;
}
} else if (ascend) {
ascend = false;
- if (rightSibling(auxTree) != NULL)
+ if (rightSibling(auxTree) != nullptr)
auxTree = rightSibling(auxTree);
else {
do {
@@ -246,24 +246,24 @@ Common::List<uint>* findDialogue(Tree tree, byte characterIndex) {
auxTree = parent(auxTree);
else
break;
- } while (!((auxTree->element.spoken == '1') && (rightSibling(auxTree) != NULL)));
- if (rightSibling(auxTree) != NULL)
+ } while (!((auxTree->element.spoken == '1') && (rightSibling(auxTree) != nullptr)));
+ if (rightSibling(auxTree) != nullptr)
auxTree = rightSibling(auxTree);
else
done = true;
}
- } else if (leftChild(auxTree) != NULL)
+ } else if (leftChild(auxTree) != nullptr)
auxTree = leftChild(auxTree);
- else if (rightSibling(auxTree) != NULL)
+ else if (rightSibling(auxTree) != nullptr)
auxTree = rightSibling(auxTree);
else {
auxTree = parent(auxTree);
- if (rightSibling(auxTree) != NULL)
+ if (rightSibling(auxTree) != nullptr)
auxTree = rightSibling(auxTree);
else {
do {
auxTree = parent(auxTree);
- } while (!(isRoot(auxTree) || rightSibling(auxTree) != NULL));
+ } while (!(isRoot(auxTree) || rightSibling(auxTree) != nullptr));
if (isRoot(auxTree))
done = true;
else
@@ -271,8 +271,8 @@ Common::List<uint>* findDialogue(Tree tree, byte characterIndex) {
}
}
} while (!done);
- auxTree = NULL;
- step = NULL;
+ auxTree = nullptr;
+ step = nullptr;
return linkedList;
}
@@ -289,14 +289,14 @@ void modifyTree(Tree tree, uint node) {
auxTree->element.spoken = 'Z';
found = true;
} else {
- if (leftChild(auxTree) != NULL)
+ if (leftChild(auxTree) != nullptr)
auxTree = leftChild(auxTree);
- else if (rightSibling(auxTree) != NULL)
+ else if (rightSibling(auxTree) != nullptr)
auxTree = rightSibling(auxTree);
else {
do {
auxTree = parent(auxTree);
- } while (!(rightSibling(auxTree) != NULL));
+ } while (!(rightSibling(auxTree) != nullptr));
auxTree = rightSibling(auxTree);
}
}
@@ -315,7 +315,7 @@ void drawTalkMenu() {
}
void fixTree(Tree tree) {
- if (tree != NULL) {
+ if (tree != nullptr) {
if (tree->element.spoken == 'Z')
tree->element.spoken = '2';
else {
diff --git a/engines/tot/engine.cpp b/engines/tot/engine.cpp
index 943e2620e03..59097d39e9a 100644
--- a/engines/tot/engine.cpp
+++ b/engines/tot/engine.cpp
@@ -235,7 +235,7 @@ static void assembleImage(byte *img, uint imgPosX, uint imgPosY) {
}
static void overlayLayers() {
- if (g_engine->_screenLayers[g_engine->_curDepth] != NULL) {
+ if (g_engine->_screenLayers[g_engine->_curDepth] != nullptr) {
if (
(g_engine->_depthMap[g_engine->_curDepth].posx <= g_engine->_dirtyMainSpriteX2) &&
(g_engine->_depthMap[g_engine->_curDepth].posx2 > g_engine->_dirtyMainSpriteX) &&
@@ -590,7 +590,7 @@ void TotEngine::animatedSequence(uint numSequence) {
_graphics->advancePaletteAnim();
_graphics->putShape(animX, animY, animptr);
}
- _screenLayers[_curObject.depth - 1] = NULL;
+ _screenLayers[_curObject.depth - 1] = nullptr;
_graphics->restoreBackground();
animIndex = _mainCharAnimation.depth;
_mainCharAnimation.depth = 30;
@@ -599,7 +599,7 @@ void TotEngine::animatedSequence(uint numSequence) {
_depthMap[13].posy = animY;
assembleScreen();
_graphics->drawScreen(_sceneBackground);
- _screenLayers[13] = NULL;
+ _screenLayers[13] = nullptr;
_mainCharAnimation.depth = animIndex;
drawInventory();
for (animIndex = 32; animIndex <= secFrameCount; animIndex++) {
@@ -641,7 +641,7 @@ void TotEngine::animatedSequence(uint numSequence) {
_depthMap[12].posx = animX;
_depthMap[12].posy = animY;
disableSecondAnimation();
- _screenLayers[12] = NULL;
+ _screenLayers[12] = nullptr;
_mainCharAnimation.depth = animIndex;
_graphics->drawScreen(_sceneBackground);
for (animIndex = 9; animIndex <= secFrameCount; animIndex++) {
@@ -692,7 +692,7 @@ void TotEngine::animatedSequence(uint numSequence) {
} while (animIndex != secFrameCount && !shouldQuit());
animationFile.close();
_sound->stopVoc();
- _screenLayers[6] = NULL;
+ _screenLayers[6] = nullptr;
_currentRoomData->animationFlag = true;
} break;
}
@@ -859,7 +859,7 @@ void TotEngine::lookAtObject(byte objectCode) {
drawFlc(125, 70, _curObject.rotatingObjectAnimation, 60000, 9, 0, false, true, true, foobar);
- _graphics->sceneTransition(true, NULL, 3);
+ _graphics->sceneTransition(true, nullptr, 3);
_graphics->partialFadeOut(234);
assembleScreen();
_graphics->drawScreen(_sceneBackground);
@@ -1410,7 +1410,7 @@ void TotEngine::nicheAnimation(byte nicheDir, int32 bitmap) {
if (_currentRoomData->code == 24) {
free(_screenLayers[1]);
- _screenLayers[1] = NULL;
+ _screenLayers[1] = nullptr;
}
}
@@ -1464,7 +1464,7 @@ void TotEngine::pickupScreenObject() {
} break;
default: {
animatePickup1(_charFacingDirection, 0);
- _screenLayers[_curObject.depth - 1] = NULL;
+ _screenLayers[_curObject.depth - 1] = nullptr;
_graphics->restoreBackground();
assembleScreen();
_graphics->drawScreen(_sceneBackground);
@@ -1523,7 +1523,7 @@ void TotEngine::pickupScreenObject() {
with.depth = 1;
loadScreenLayer(with.coordx, with.coordy, with.bitmapSize, with.bitmapPointer, with.depth);
}
- _screenLayers[_curObject.depth - 1] = NULL;
+ _screenLayers[_curObject.depth - 1] = nullptr;
_graphics->restoreBackground();
assembleScreen();
@@ -1683,7 +1683,7 @@ void TotEngine::pickupScreenObject() {
with.coordy = 0;
with.depth = 0;
}
- _screenLayers[3] = NULL;
+ _screenLayers[3] = nullptr;
disableSecondAnimation();
_graphics->drawScreen(_sceneBackground);
animatePickup2(2, 1);
@@ -1692,7 +1692,7 @@ void TotEngine::pickupScreenObject() {
} break;
default: {
animatePickup1(_charFacingDirection, 1);
- _screenLayers[_curObject.depth - 1] = NULL;
+ _screenLayers[_curObject.depth - 1] = nullptr;
_graphics->restoreBackground();
assembleScreen();
_graphics->drawScreen(_sceneBackground);
@@ -1724,7 +1724,7 @@ void TotEngine::pickupScreenObject() {
} break;
case 659: { // spider web, puts bird and ring on the floor
animatePickup1(3, 2);
- _screenLayers[_curObject.depth - 1] = NULL;
+ _screenLayers[_curObject.depth - 1] = nullptr;
{ // bird
RoomBitmapRegister &with = _currentRoomData->screenLayers[2];
@@ -1752,7 +1752,7 @@ void TotEngine::pickupScreenObject() {
} break;
default: {
animatePickup1(_charFacingDirection, 2);
- _screenLayers[_curObject.depth - 1] = NULL;
+ _screenLayers[_curObject.depth - 1] = nullptr;
assembleScreen();
_graphics->drawScreen(_sceneBackground);
animatePickup2(_charFacingDirection, 2);
@@ -2863,7 +2863,7 @@ void TotEngine::useScreenObject() {
_currentRoomData->screenLayers[4].coordx = 0;
_currentRoomData->screenLayers[4].coordy = 0;
_currentRoomData->screenLayers[4].depth = 0;
- _screenLayers[7] = NULL;
+ _screenLayers[7] = nullptr;
_graphics->restoreBackground();
assembleScreen();
_graphics->drawScreen(_sceneBackground);
@@ -2921,7 +2921,7 @@ void TotEngine::useScreenObject() {
_currentRoomData->screenLayers[4].coordx = 0;
_currentRoomData->screenLayers[4].coordy = 0;
_currentRoomData->screenLayers[4].depth = 0;
- _screenLayers[7] = NULL;
+ _screenLayers[7] = nullptr;
_graphics->restoreBackground();
assembleScreen();
_graphics->drawScreen(_sceneBackground);
@@ -3032,7 +3032,7 @@ void TotEngine::useScreenObject() {
_currentRoomData->screenLayers[0].coordx = 0;
_currentRoomData->screenLayers[0].coordy = 0;
_currentRoomData->screenLayers[0].depth = 0;
- _screenLayers[2] = NULL;
+ _screenLayers[2] = nullptr;
for (invIndex = 6; invIndex <= 9; invIndex++)
_currentRoomData->mouseGrid[26][invIndex] = 3;
for (invIndex = 3; invIndex <= 5; invIndex++)
@@ -3281,7 +3281,7 @@ void TotEngine::openScreenObject() {
else {
_mouse->hide();
animatePickup1(0, 1);
- _screenLayers[_curObject.depth - 1] = NULL;
+ _screenLayers[_curObject.depth - 1] = nullptr;
yIndex = 0;
while (_currentRoomData->screenLayers[yIndex].depth != _curObject.depth && yIndex != 15) {
yIndex++;
@@ -3317,7 +3317,7 @@ void TotEngine::openScreenObject() {
else {
_mouse->hide();
animatePickup1(1, 1);
- _screenLayers[_curObject.depth - 1] = NULL;
+ _screenLayers[_curObject.depth - 1] = nullptr;
yIndex = 0;
while (_currentRoomData->screenLayers[yIndex].depth != _curObject.depth && yIndex != 14) {
yIndex++;
@@ -4574,22 +4574,22 @@ void TotEngine::loadScreen() {
void TotEngine::clearScreenLayers() {
for (int i = 0; i < kNumScreenOverlays; i++) {
- if (_screenLayers[i] != NULL)
+ if (_screenLayers[i] != nullptr)
free(_screenLayers[i]);
- _screenLayers[i] = NULL;
+ _screenLayers[i] = nullptr;
}
}
void TotEngine::clearAnimation() {
if (_isSecondaryAnimationEnabled) {
_isSecondaryAnimationEnabled = false;
- _curSecondaryAnimationFrame = NULL;
+ _curSecondaryAnimationFrame = nullptr;
for(int j = 0; j < _secondaryAnimDirCount; j++){
for(int i = 0; i < _secondaryAnimationFrameCount; i++){
- if(_secondaryAnimation.bitmap[j][i] != NULL && _secondaryAnimation.bitmap[j][i] != _curSecondaryAnimationFrame) {
+ if(_secondaryAnimation.bitmap[j][i] != nullptr && _secondaryAnimation.bitmap[j][i] != _curSecondaryAnimationFrame) {
free(_secondaryAnimation.bitmap[j][i]);
}
- _secondaryAnimation.bitmap[j][i] = NULL;
+ _secondaryAnimation.bitmap[j][i] = nullptr;
}
}
}
@@ -5458,7 +5458,7 @@ void TotEngine::assembleCompleteBackground(byte *image, uint coordx, uint coordy
void TotEngine::assembleScreen(bool scroll) {
for (int indice = 0; indice < kDepthLevelCount; indice++) {
- if (_screenLayers[indice] != NULL) {
+ if (_screenLayers[indice] != nullptr) {
assembleCompleteBackground(_screenLayers[indice], _depthMap[indice].posx, _depthMap[indice].posy);
}
if (!scroll && _mainCharAnimation.depth == indice) {
diff --git a/engines/tot/forest.cpp b/engines/tot/forest.cpp
index 9d97ab0bf30..58792663b3b 100644
--- a/engines/tot/forest.cpp
+++ b/engines/tot/forest.cpp
@@ -26,14 +26,14 @@ namespace Tot {
void initTree(Tree &a, nodeElement data) {
a = new treeDef;
a->element = data;
- a->parent = NULL;
- a->sibling = NULL;
- a->child = NULL;
+ a->parent = nullptr;
+ a->sibling = nullptr;
+ a->child = nullptr;
}
bool isRoot(Tree node) {
bool root;
- if (node->parent == NULL)
+ if (node->parent == nullptr)
root = true;
else
root = false;
@@ -62,7 +62,7 @@ int depth(Tree node) {
Tree aux;
int depthCount = 0;
aux = node;
- while (aux->parent != NULL) {
+ while (aux->parent != nullptr) {
depthCount += 1;
aux = parent(aux);
}
@@ -71,31 +71,31 @@ int depth(Tree node) {
void expandNode(Tree &node, nodeElement data) {
Tree aux = node;
- if (aux->child != NULL) {
+ if (aux->child != nullptr) {
aux = leftChild(aux);
- while (aux->sibling != NULL)
+ while (aux->sibling != nullptr)
aux = rightSibling(aux);
;
aux->sibling = new treeDef;
aux = aux->sibling;
aux->element = data;
- aux->sibling = NULL;
- aux->child = NULL;
+ aux->sibling = nullptr;
+ aux->child = nullptr;
aux->parent = node;
} else {
aux->child = new treeDef;
aux = aux->child;
aux->element = data;
- aux->sibling = NULL;
- aux->child = NULL;
+ aux->sibling = nullptr;
+ aux->child = nullptr;
aux->parent = node;
}
}
void preOrder(Tree a, Common::String &encodedString) {
- if (a != NULL) {
+ if (a != nullptr) {
encodedString = Common::String::format("%s%d%cN%d@", encodedString.c_str(), a->element.index, a->element.spoken, depth(a));
preOrder(leftChild(a), encodedString);
preOrder(rightSibling(a), encodedString);
@@ -169,7 +169,7 @@ void readTree(Common::SeekableReadStream &stream, Tree &a, uint position) {
else if (level > (currentLevel + 1)) {
aux = leftChild(aux);
currentLevel += 1;
- while (rightSibling(aux) != NULL)
+ while (rightSibling(aux) != nullptr)
aux = rightSibling(aux);
expandNode(aux, data);
} else {
diff --git a/engines/tot/tot.cpp b/engines/tot/tot.cpp
index 68ae397a166..8c296e53379 100644
--- a/engines/tot/tot.cpp
+++ b/engines/tot/tot.cpp
@@ -554,7 +554,7 @@ int TotEngine::startGame() {
if (_drawObjectAreas) {
for (int i = 0; i < kDepthLevelCount; i++) {
- if (_screenLayers[i] != NULL) {
+ if (_screenLayers[i] != nullptr) {
if (true) {
// debug
uint16 w = READ_LE_UINT16(_screenLayers[i]);
@@ -640,7 +640,7 @@ void TotEngine::changeRoom() {
clearScreenLayers();
_mouse->hide();
- _graphics->sceneTransition(true, NULL);
+ _graphics->sceneTransition(true, nullptr);
_sound->stopVoc();
loadScreenData(_currentRoomData->doors[_doorIndex].nextScene);
if (_cpCounter > 89)
@@ -667,7 +667,7 @@ void TotEngine::changeRoom() {
clearAnimation();
clearScreenLayers();
_mouse->hide();
- _graphics->sceneTransition(true, NULL);
+ _graphics->sceneTransition(true, nullptr);
loadScreenData(_currentRoomData->doors[_doorIndex].nextScene);
_sound->stopVoc();
_sound->autoPlayVoc("CALDERA", 6433, 15386);
@@ -711,7 +711,7 @@ void TotEngine::changeRoom() {
clearAnimation();
clearScreenLayers();
_mouse->hide();
- _graphics->sceneTransition(true, NULL);
+ _graphics->sceneTransition(true, nullptr);
_iframe = 0;
_currentTrajectoryIndex = 0;
_characterPosX = _currentRoomData->doors[_doorIndex].exitPosX - kCharacterCorrectionX;
@@ -737,7 +737,7 @@ void TotEngine::changeRoom() {
clearAnimation();
clearScreenLayers();
_mouse->hide();
- _graphics->sceneTransition(true, NULL);
+ _graphics->sceneTransition(true, nullptr);
loadScreenData(_currentRoomData->doors[_doorIndex].nextScene);
_graphics->sceneTransition(false, _sceneBackground);
_mouse->show();
@@ -797,7 +797,7 @@ void TotEngine::changeRoom() {
clearAnimation();
clearScreenLayers();
_mouse->hide();
- _graphics->sceneTransition(true, NULL);
+ _graphics->sceneTransition(true, nullptr);
loadScreenData(_currentRoomData->doors[_doorIndex].nextScene);
_graphics->sceneTransition(false, _sceneBackground);
_mouse->show();
@@ -828,7 +828,7 @@ void TotEngine::changeRoom() {
clearAnimation();
clearScreenLayers();
_mouse->hide();
- _graphics->sceneTransition(true, NULL);
+ _graphics->sceneTransition(true, nullptr);
_sound->stopVoc();
loadScreenData(_currentRoomData->doors[_doorIndex].nextScene);
if (_bookTopic[0] == true && _currentRoomData->animationFlag == true)
@@ -854,7 +854,7 @@ void TotEngine::changeRoom() {
clearAnimation();
clearScreenLayers();
_mouse->hide();
- _graphics->sceneTransition(true, NULL);
+ _graphics->sceneTransition(true, nullptr);
loadScreenData(_currentRoomData->doors[_doorIndex].nextScene);
_graphics->sceneTransition(false, _sceneBackground);
_mouse->show();
@@ -886,7 +886,7 @@ void TotEngine::changeRoom() {
clearAnimation();
clearScreenLayers();
_mouse->hide();
- _graphics->sceneTransition(true, NULL);
+ _graphics->sceneTransition(true, nullptr);
loadScreenData(_currentRoomData->doors[_doorIndex].nextScene);
_graphics->sceneTransition(false, _sceneBackground);
_mouse->show();
@@ -917,7 +917,7 @@ void TotEngine::changeRoom() {
clearAnimation();
clearScreenLayers();
_mouse->hide();
- _graphics->sceneTransition(true, NULL);
+ _graphics->sceneTransition(true, nullptr);
_sound->stopVoc();
loadScreenData(_currentRoomData->doors[_doorIndex].nextScene);
switch (_niche[0][_niche[0][3]]) {
@@ -956,7 +956,7 @@ void TotEngine::changeRoom() {
clearAnimation();
clearScreenLayers();
_mouse->hide();
- _graphics->sceneTransition(true, NULL);
+ _graphics->sceneTransition(true, nullptr);
_sound->stopVoc();
loadScreenData(_currentRoomData->doors[_doorIndex].nextScene);
switch (_niche[1][_niche[1][3]]) {
@@ -1023,7 +1023,7 @@ void TotEngine::changeRoom() {
clearAnimation();
clearScreenLayers();
_mouse->hide();
- _graphics->sceneTransition(true, NULL);
+ _graphics->sceneTransition(true, nullptr);
_sound->stopVoc();
loadScreenData(_currentRoomData->doors[_doorIndex].nextScene);
if (_cpCounter > 89)
@@ -1248,29 +1248,29 @@ void TotEngine::initVars() {
for(int i = 0; i < kNumScreenOverlays; i++) {
- _screenLayers[i] = NULL;
+ _screenLayers[i] = nullptr;
}
for(int i = 0; i < kInventoryIconCount; i++) {
- _inventoryIconBitmaps[i] = NULL;
+ _inventoryIconBitmaps[i] = nullptr;
}
for(int i = 0; i < 4; i++) {
for(int j = 0; j < kWalkFrameCount + 30; j++) {
- _mainCharAnimation.bitmap[i][j] = NULL;
+ _mainCharAnimation.bitmap[i][j] = nullptr;
}
}
for (int i = 0; i < 4; i++) {
for (int j = 0; j < kSecAnimationFrameCount; j++) {
- _secondaryAnimation.bitmap[i][j] = NULL;
+ _secondaryAnimation.bitmap[i][j] = nullptr;
}
}
resetGameState();
_chrono->_gameTick = false;
for (int i = 0; i < kNumScreenOverlays; i++) {
- _screenLayers[i] = NULL;
+ _screenLayers[i] = nullptr;
}
_firstList[0] = 222;
_firstList[1] = 295;
@@ -1290,43 +1290,43 @@ void TotEngine::initVars() {
_isIntroSeen = false;
_inGame = false;
- _sceneBackground = NULL;
- _backgroundCopy = NULL;
- _conversationData = NULL;
- _rooms = NULL;
- _sceneObjectsData = NULL;
+ _sceneBackground = nullptr;
+ _backgroundCopy = nullptr;
+ _conversationData = nullptr;
+ _rooms = nullptr;
+ _sceneObjectsData = nullptr;
}
void TotEngine::clearVars() {
- if(_sceneBackground != NULL) {
+ if(_sceneBackground != nullptr) {
free(_sceneBackground);
}
- if(_backgroundCopy != NULL) {
+ if(_backgroundCopy != nullptr) {
free(_backgroundCopy);
}
- if(_conversationData != NULL) {
+ if(_conversationData != nullptr) {
free(_conversationData);
}
- if(_rooms != NULL) {
+ if(_rooms != nullptr) {
free(_rooms);
}
- if(_sceneObjectsData != NULL) {
+ if(_sceneObjectsData != nullptr) {
free(_sceneObjectsData);
}
for(int i = 0; i < kNumScreenOverlays; i++) {
- if(_screenLayers[i] != NULL) {
+ if(_screenLayers[i] != nullptr) {
free(_screenLayers[i]);
}
}
for(int i = 0; i < kInventoryIconCount; i++) {
- if(_inventoryIconBitmaps[i] != NULL) {
+ if(_inventoryIconBitmaps[i] != nullptr) {
free(_inventoryIconBitmaps[i]);
}
}
for(int i = 0; i < 4; i++) {
for(int j = 0; j < kWalkFrameCount + 30; j++) {
- if(_mainCharAnimation.bitmap[i][j] != NULL) {
+ if(_mainCharAnimation.bitmap[i][j] != nullptr) {
free(_mainCharAnimation.bitmap[i][j]);
}
}
@@ -1334,7 +1334,7 @@ void TotEngine::clearVars() {
for (int i = 0; i < _secondaryAnimDirCount; i++) {
for (int j = 0; j < _secondaryAnimationFrameCount; j++) {
- if(_secondaryAnimation.bitmap[i][j] != NULL){
+ if(_secondaryAnimation.bitmap[i][j] != nullptr){
free(_secondaryAnimation.bitmap[i][j]);
}
}
diff --git a/engines/tot/types.h b/engines/tot/types.h
index 19c176b0425..23ccc3d8664 100644
--- a/engines/tot/types.h
+++ b/engines/tot/types.h
@@ -199,14 +199,14 @@ struct RoomFileRegister {
Common::Point trajectories[9][30][5];
DoorRegistry doors[5]; /* doors in the room */
RoomBitmapRegister screenLayers[15];
- RoomObjectListEntry *screenObjectIndex[51] = {NULL}; /* includes name of objects for mouseover + index to object file*/
- bool animationFlag; /* true if there is a secondary animation */
- Common::String animationName; /* name of the secondary animation, 8 chars*/
- bool paletteAnimationFlag; /* true if there exist palette animation */
- uint16 palettePointer; /* points to the screen palette */
- Common::Point secondaryAnimTrajectory[300]; /* trajectory of the secondary animation */
- uint16 secondaryAnimDirections[300]; /* directions of the secondary trajectory. Pos 300 reflects object code. */
- uint16 secondaryTrajectoryLength; /* length of the trajectory of the secondary animation */
+ RoomObjectListEntry *screenObjectIndex[51] = { nullptr }; /* includes name of objects for mouseover + index to object file*/
+ bool animationFlag; /* true if there is a secondary animation */
+ Common::String animationName; /* name of the secondary animation, 8 chars*/
+ bool paletteAnimationFlag; /* true if there exist palette animation */
+ uint16 palettePointer; /* points to the screen palette */
+ Common::Point secondaryAnimTrajectory[300]; /* trajectory of the secondary animation */
+ uint16 secondaryAnimDirections[300]; /* directions of the secondary trajectory. Pos 300 reflects object code. */
+ uint16 secondaryTrajectoryLength; /* length of the trajectory of the secondary animation */
};
struct SavedGame {
Commit: ab3771163627b32482c1059875bc61cf09cce8cf
https://github.com/scummvm/scummvm/commit/ab3771163627b32482c1059875bc61cf09cce8cf
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:54+02:00
Commit Message:
TOT: Adds translation to POTFILES
Changed paths:
engines/tot/POTFILES
engines/tot/anims.cpp
engines/tot/tot.h
diff --git a/engines/tot/POTFILES b/engines/tot/POTFILES
index e69de29bb2d..2f5dad43330 100644
--- a/engines/tot/POTFILES
+++ b/engines/tot/POTFILES
@@ -0,0 +1 @@
+engines/tot/metaengine.cpp
diff --git a/engines/tot/anims.cpp b/engines/tot/anims.cpp
index 4b646241280..b8526b636af 100644
--- a/engines/tot/anims.cpp
+++ b/engines/tot/anims.cpp
@@ -942,7 +942,7 @@ void drawFlc(
if (g_engine->_chrono->_gameTick) {
// Make sure we also update the palette animations! Esp. for part 2
- if (g_engine->_currentRoomData != NULL && !g_engine->_shouldQuitGame) {
+ if (g_engine->_currentRoomData != nullptr && !g_engine->_shouldQuitGame) {
g_engine->_graphics->advancePaletteAnim();
}
if(speed == 9) {
diff --git a/engines/tot/tot.h b/engines/tot/tot.h
index 4840c0c2940..aeae4ba06fa 100644
--- a/engines/tot/tot.h
+++ b/engines/tot/tot.h
@@ -323,7 +323,7 @@ public:
*/
uint _niche[2][4];
- RoomFileRegister *_currentRoomData = NULL;
+ RoomFileRegister *_currentRoomData = nullptr;
ScreenObject _curObject;
/**
Commit: eec084d54e79a24aba9cdf2e5152ecf1c727c901
https://github.com/scummvm/scummvm/commit/eec084d54e79a24aba9cdf2e5152ecf1c727c901
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:54+02:00
Commit Message:
TOT: Creates localization helper functions
Changed paths:
engines/tot/anims.cpp
engines/tot/cutscenes.cpp
engines/tot/engine.cpp
engines/tot/graphics.cpp
engines/tot/tot.cpp
engines/tot/util.h
diff --git a/engines/tot/anims.cpp b/engines/tot/anims.cpp
index b8526b636af..4d5c0a27110 100644
--- a/engines/tot/anims.cpp
+++ b/engines/tot/anims.cpp
@@ -101,8 +101,8 @@ void clearCharacterText() {
void handleFlcEvent(byte eventNumber, uint loopNumber, byte frameCount) {
- const char *const *messages = g_engine->_lang == Common::ES_ESP ? animMessages[0] : animMessages[1];
- bool isSpanish = g_engine->_lang == Common::ES_ESP;
+ const char *const *messages = getAnimMessagesByCurrentLanguage();
+ bool isSpanish = isLanguageSpanish();
bool isEnglish = !isSpanish;
switch (eventNumber) {
case 0:
@@ -136,12 +136,12 @@ void handleFlcEvent(byte eventNumber, uint loopNumber, byte frameCount) {
break;
// English only
case 40:
- if(isEnglish){
+ if (isEnglish) {
clearCharacterText();
}
break;
case 41:
- if(isEnglish) {
+ if (isEnglish) {
drawCharacterText(messages[250], messages[251], messages[252], messages[253], messages[254]);
}
break;
@@ -161,75 +161,73 @@ void handleFlcEvent(byte eventNumber, uint loopNumber, byte frameCount) {
drawCharacterText(messages[30], messages[31], messages[32], messages[33], messages[34]);
break;
case 70:
- if(isEnglish) {
+ if (isEnglish) {
clearTvText();
}
break;
case 71:
- if(isEnglish) {
+ if (isEnglish) {
drawTvText(messages[255], messages[256], messages[257], messages[258], messages[259]);
}
break;
case 73:
- if(isEnglish) {
+ if (isEnglish) {
clearCharacterText();
}
case 74:
- if(isEnglish) {
+ if (isEnglish) {
drawCharacterText(
messages[35],
messages[36],
messages[37],
messages[38],
- messages[39]
- );
+ messages[39]);
}
case 75:
- if(isSpanish) {
+ if (isSpanish) {
clearCharacterText();
}
break;
case 76:
- if(isSpanish) {
+ if (isSpanish) {
clearTvText();
}
break;
case 77:
- if(isSpanish) {
+ if (isSpanish) {
drawCharacterText(messages[35], messages[36], messages[37], messages[38], messages[39]);
}
break;
case 80:
- if(isEnglish) {
+ if (isEnglish) {
clearTvText();
}
break;
case 82:
- if(isEnglish) {
+ if (isEnglish) {
clearCharacterText();
}
break;
case 83:
- if(isEnglish) {
+ if (isEnglish) {
drawCharacterText(messages[260], messages[261], messages[262], messages[263], messages[264]);
}
break;
case 89:
- if(isSpanish) {
+ if (isSpanish) {
clearCharacterText();
}
break;
case 90:
- if(isSpanish) {
+ if (isSpanish) {
drawCharacterText(messages[40], messages[41], messages[42], messages[43], messages[44]);
- }
- else {
+ } else {
clearCharacterText();
}
break;
case 91:
- if(isEnglish) {
+ if (isEnglish) {
drawCharacterText(messages[40], messages[41], messages[42], messages[43], messages[44]);
}
break;
@@ -284,7 +282,7 @@ void handleFlcEvent(byte eventNumber, uint loopNumber, byte frameCount) {
clearTvText();
drawTvText(messages[80], messages[81], messages[82], messages[83], messages[84]);
- if(isEnglish) {
+ if (isEnglish) {
delay(5000);
clearTvText();
drawTvText(messages[265], messages[266], messages[267], messages[268], messages[269]);
@@ -302,7 +300,7 @@ void handleFlcEvent(byte eventNumber, uint loopNumber, byte frameCount) {
clearCharacterText();
drawCharacterText(messages[95], messages[96], messages[97], messages[98], messages[99]);
- if(isEnglish) {
+ if (isEnglish) {
delay(6000);
clearCharacterText();
drawCharacterText(messages[95], messages[96], messages[97], messages[98], messages[99]);
@@ -337,183 +335,180 @@ void handleFlcEvent(byte eventNumber, uint loopNumber, byte frameCount) {
delay(2000);
drawText(5, 1,
- messages[100],
- messages[101],
- messages[102],
- messages[103],
- messages[104],
- 255, 249);
+ messages[100],
+ messages[101],
+ messages[102],
+ messages[103],
+ messages[104],
+ 255, 249);
delay(3500);
g_engine->_graphics->putImg(0, 0, g_engine->_graphics->_textAreaBackground);
drawText(5, 1,
- messages[105],
- messages[106],
- messages[107],
- messages[108],
- messages[109],
- 255, 0);
+ messages[105],
+ messages[106],
+ messages[107],
+ messages[108],
+ messages[109],
+ 255, 0);
}
break;
case 6:
if ((loopNumber == 1) && (frameCount == 3)) {
g_engine->_graphics->putImg(0, 0, g_engine->_graphics->_textAreaBackground);
drawText(5, 1,
- messages[110],
- messages[111],
- messages[112],
- messages[113],
- messages[114],
- 255, 249);
- }
- else if ((loopNumber == 5) && (frameCount == 3)) {
+ messages[110],
+ messages[111],
+ messages[112],
+ messages[113],
+ messages[114],
+ 255, 249);
+ } else if ((loopNumber == 5) && (frameCount == 3)) {
g_engine->_graphics->putImg(0, 0, g_engine->_graphics->_textAreaBackground);
drawText(5, 1,
- messages[275],
- messages[276],
- messages[277],
- messages[278],
- messages[279],
- 255, 249);
+ messages[275],
+ messages[276],
+ messages[277],
+ messages[278],
+ messages[279],
+ 255, 249);
}
break;
case 7:
if ((loopNumber == 1) && (frameCount == 3)) {
g_engine->_graphics->putImg(0, 0, g_engine->_graphics->_textAreaBackground);
drawText(5, 1,
- messages[115],
- messages[116],
- messages[117],
- messages[118],
- messages[119],
- 255, 0);
+ messages[115],
+ messages[116],
+ messages[117],
+ messages[118],
+ messages[119],
+ 255, 0);
}
break;
case 8:
if ((loopNumber == 1) && (frameCount == 3)) {
g_engine->_graphics->putImg(0, 0, g_engine->_graphics->_textAreaBackground);
drawText(5, 1,
- messages[120],
- messages[121],
- messages[122],
- messages[123],
- messages[124],
- 255, 249);
- }
- else if ((loopNumber == 5) && (frameCount == 3)) {
+ messages[120],
+ messages[121],
+ messages[122],
+ messages[123],
+ messages[124],
+ 255, 249);
+ } else if ((loopNumber == 5) && (frameCount == 3)) {
g_engine->_graphics->putImg(0, 0, g_engine->_graphics->_textAreaBackground);
drawText(5, 1,
- messages[280],
- messages[281],
- messages[282],
- messages[283],
- messages[284],
- 255, 249);
+ messages[280],
+ messages[281],
+ messages[282],
+ messages[283],
+ messages[284],
+ 255, 249);
}
break;
case 9:
if ((loopNumber == 1) && (frameCount == 3)) {
g_engine->_graphics->putImg(0, 0, g_engine->_graphics->_textAreaBackground);
drawText(5, 1,
- messages[125],
- messages[126],
- messages[127],
- messages[128],
- messages[129],
- 255, 0);
+ messages[125],
+ messages[126],
+ messages[127],
+ messages[128],
+ messages[129],
+ 255, 0);
}
break;
case 10:
if ((loopNumber == 1) && (frameCount == 3)) {
g_engine->_graphics->putImg(0, 0, g_engine->_graphics->_textAreaBackground);
drawText(5, 1,
- messages[130],
- messages[131],
- messages[132],
- messages[133],
- messages[134],
- 255, 249);
+ messages[130],
+ messages[131],
+ messages[132],
+ messages[133],
+ messages[134],
+ 255, 249);
}
break;
case 11:
if ((loopNumber == 1) && (frameCount == 3)) {
g_engine->_graphics->putImg(0, 0, g_engine->_graphics->_textAreaBackground);
drawText(5, 1,
- messages[135],
- messages[136],
- messages[137],
- messages[138],
- messages[139],
- 255, 0);
+ messages[135],
+ messages[136],
+ messages[137],
+ messages[138],
+ messages[139],
+ 255, 0);
}
break;
case 12:
if ((loopNumber == 1) && (frameCount == 3)) {
g_engine->_graphics->putImg(0, 0, g_engine->_graphics->_textAreaBackground);
drawText(5, 1,
- messages[140],
- messages[141],
- messages[142],
- messages[143],
- messages[144],
- 255, 249);
+ messages[140],
+ messages[141],
+ messages[142],
+ messages[143],
+ messages[144],
+ 255, 249);
}
break;
case 13:
if ((loopNumber == 1) && (frameCount == 3)) {
g_engine->_graphics->putImg(0, 0, g_engine->_graphics->_textAreaBackground);
drawText(5, 1,
- messages[145],
- messages[146],
- messages[147],
- messages[148],
- messages[149],
- 255, 0);
+ messages[145],
+ messages[146],
+ messages[147],
+ messages[148],
+ messages[149],
+ 255, 0);
}
break;
case 14:
if ((loopNumber == 1) && (frameCount == 3)) {
g_engine->_graphics->putImg(0, 0, g_engine->_graphics->_textAreaBackground);
drawText(5, 1,
- messages[150],
- messages[151],
- messages[152],
- messages[153],
- messages[154],
- 255, 249);
- }
- else if ((loopNumber == 5) && (frameCount == 3)) {
+ messages[150],
+ messages[151],
+ messages[152],
+ messages[153],
+ messages[154],
+ 255, 249);
+ } else if ((loopNumber == 5) && (frameCount == 3)) {
g_engine->_graphics->putImg(0, 0, g_engine->_graphics->_textAreaBackground);
drawText(5, 1,
- messages[285],
- messages[286],
- messages[287],
- messages[288],
- messages[289],
- 255, 249);
+ messages[285],
+ messages[286],
+ messages[287],
+ messages[288],
+ messages[289],
+ 255, 249);
}
break;
case 15:
if ((loopNumber == 1) && (frameCount == 3)) {
g_engine->_graphics->putImg(0, 0, g_engine->_graphics->_textAreaBackground);
drawText(5, 1,
- messages[155],
- messages[156],
- messages[157],
- messages[158],
- messages[159],
- 255, 0);
+ messages[155],
+ messages[156],
+ messages[157],
+ messages[158],
+ messages[159],
+ 255, 0);
}
break;
case 16:
if ((loopNumber == 1) && (frameCount == 3)) {
g_engine->_graphics->putImg(0, 0, g_engine->_graphics->_textAreaBackground);
drawText(5, 1,
- messages[160],
- messages[161],
- messages[162],
- messages[163],
- messages[164],
- 255, 249);
+ messages[160],
+ messages[161],
+ messages[162],
+ messages[163],
+ messages[164],
+ 255, 249);
}
break;
case 17:
@@ -533,23 +528,23 @@ void handleFlcEvent(byte eventNumber, uint loopNumber, byte frameCount) {
if ((loopNumber == 1) && (frameCount == 3)) {
g_engine->_graphics->putImg(0, 0, g_engine->_graphics->_textAreaBackground);
drawText(5, 1,
- messages[165],
- messages[166],
- messages[167],
- messages[168],
- messages[169],
- 255, 0);
+ messages[165],
+ messages[166],
+ messages[167],
+ messages[168],
+ messages[169],
+ 255, 0);
}
break;
case 19:
if (frameCount == 1)
drawText(5, 121,
- messages[170],
- messages[171],
- messages[172],
- messages[173],
- messages[174],
- 253, 249);
+ messages[170],
+ messages[171],
+ messages[172],
+ messages[173],
+ messages[174],
+ 253, 249);
break;
case 20:
switch (loopNumber) {
@@ -560,12 +555,12 @@ void handleFlcEvent(byte eventNumber, uint loopNumber, byte frameCount) {
break;
case 3:
drawText(15, 1,
- messages[175],
- messages[176],
- messages[177],
- messages[178],
- messages[179],
- 255, 0);
+ messages[175],
+ messages[176],
+ messages[177],
+ messages[178],
+ messages[179],
+ 255, 0);
break;
}
break;
@@ -576,12 +571,12 @@ void handleFlcEvent(byte eventNumber, uint loopNumber, byte frameCount) {
break;
case 3:
drawText(15, 1,
- messages[180],
- messages[181],
- messages[182],
- messages[183],
- messages[184],
- 230, 249);
+ messages[180],
+ messages[181],
+ messages[182],
+ messages[183],
+ messages[184],
+ 230, 249);
break;
}
break;
@@ -592,12 +587,12 @@ void handleFlcEvent(byte eventNumber, uint loopNumber, byte frameCount) {
break;
case 3:
drawText(15, 1,
- messages[185],
- messages[186],
- messages[187],
- messages[188],
- messages[189],
- 230, 249);
+ messages[185],
+ messages[186],
+ messages[187],
+ messages[188],
+ messages[189],
+ 230, 249);
break;
}
break;
@@ -608,12 +603,12 @@ void handleFlcEvent(byte eventNumber, uint loopNumber, byte frameCount) {
break;
case 3:
drawText(15, 1,
- messages[190],
- messages[191],
- messages[192],
- messages[193],
- messages[194],
- 230, 249);
+ messages[190],
+ messages[191],
+ messages[192],
+ messages[193],
+ messages[194],
+ 230, 249);
break;
}
break;
@@ -624,12 +619,12 @@ void handleFlcEvent(byte eventNumber, uint loopNumber, byte frameCount) {
break;
case 3:
drawText(15, 1,
- messages[195],
- messages[196],
- messages[197],
- messages[198],
- messages[199],
- 230, 249);
+ messages[195],
+ messages[196],
+ messages[197],
+ messages[198],
+ messages[199],
+ 230, 249);
break;
}
break;
@@ -640,12 +635,12 @@ void handleFlcEvent(byte eventNumber, uint loopNumber, byte frameCount) {
break;
case 3:
drawText(15, 1,
- messages[200],
- messages[201],
- messages[202],
- messages[203],
- messages[204],
- 230, 249);
+ messages[200],
+ messages[201],
+ messages[202],
+ messages[203],
+ messages[204],
+ 230, 249);
break;
}
break;
@@ -656,12 +651,12 @@ void handleFlcEvent(byte eventNumber, uint loopNumber, byte frameCount) {
break;
case 3:
drawText(15, 1,
- messages[205],
- messages[206],
- messages[207],
- messages[208],
- messages[209],
- 230, 249);
+ messages[205],
+ messages[206],
+ messages[207],
+ messages[208],
+ messages[209],
+ 230, 249);
break;
}
break;
@@ -672,12 +667,12 @@ void handleFlcEvent(byte eventNumber, uint loopNumber, byte frameCount) {
break;
case 3:
drawText(15, 1,
- messages[210],
- messages[211],
- messages[212],
- messages[213],
- messages[214],
- 230, 249);
+ messages[210],
+ messages[211],
+ messages[212],
+ messages[213],
+ messages[214],
+ 230, 249);
break;
}
break;
@@ -688,12 +683,12 @@ void handleFlcEvent(byte eventNumber, uint loopNumber, byte frameCount) {
break;
case 3:
drawText(15, 1,
- messages[215],
- messages[216],
- messages[217],
- messages[218],
- messages[219],
- 230, 249);
+ messages[215],
+ messages[216],
+ messages[217],
+ messages[218],
+ messages[219],
+ 230, 249);
break;
}
break;
@@ -704,12 +699,12 @@ void handleFlcEvent(byte eventNumber, uint loopNumber, byte frameCount) {
break;
case 3:
drawText(15, 1,
- messages[220],
- messages[221],
- messages[222],
- messages[223],
- messages[224],
- 230, 249);
+ messages[220],
+ messages[221],
+ messages[222],
+ messages[223],
+ messages[224],
+ 230, 249);
break;
}
break;
@@ -720,12 +715,12 @@ void handleFlcEvent(byte eventNumber, uint loopNumber, byte frameCount) {
break;
case 3:
drawText(15, 1,
- messages[225],
- messages[226],
- messages[227],
- messages[228],
- messages[229],
- 230, 249);
+ messages[225],
+ messages[226],
+ messages[227],
+ messages[228],
+ messages[229],
+ 230, 249);
break;
}
break;
@@ -776,12 +771,12 @@ void handleFlcEvent(byte eventNumber, uint loopNumber, byte frameCount) {
break;
case 3:
drawText(65, 1,
- messages[230],
- messages[231],
- messages[232],
- messages[233],
- messages[234],
- 253, 249);
+ messages[230],
+ messages[231],
+ messages[232],
+ messages[233],
+ messages[234],
+ 253, 249);
break;
}
break;
@@ -792,12 +787,12 @@ void handleFlcEvent(byte eventNumber, uint loopNumber, byte frameCount) {
break;
case 2:
drawText(65, 1,
- messages[235],
- messages[236],
- messages[237],
- messages[238],
- messages[239],
- 253, 249);
+ messages[235],
+ messages[236],
+ messages[237],
+ messages[238],
+ messages[239],
+ 253, 249);
break;
}
break;
@@ -808,12 +803,12 @@ void handleFlcEvent(byte eventNumber, uint loopNumber, byte frameCount) {
break;
case 2:
drawText(65, 1,
- messages[240],
- messages[241],
- messages[242],
- messages[243],
- messages[244],
- 253, 249);
+ messages[240],
+ messages[241],
+ messages[242],
+ messages[243],
+ messages[244],
+ 253, 249);
break;
}
break;
@@ -824,12 +819,12 @@ void handleFlcEvent(byte eventNumber, uint loopNumber, byte frameCount) {
break;
case 2:
drawText(65, 1,
- messages[245],
- messages[246],
- messages[247],
- messages[248],
- messages[249],
- 253, 249);
+ messages[245],
+ messages[246],
+ messages[247],
+ messages[248],
+ messages[249],
+ 253, 249);
break;
}
break;
@@ -846,7 +841,7 @@ void drawFlc(uint x, uint y, int32 fliOffset, uint loop,
byte speed, byte eventNumber, bool fullPalette, bool isSkipAllowed,
bool doscientos, bool &salidaflis);
-static void exitProcedure(bool &exitLoop, bool &isSkipAllowed) {
+static void exitProcedure(bool &exitLoop, bool isSkipAllowed) {
exitLoop = false;
Common::Event e;
while (g_system->getEventManager()->pollEvent(e)) {
diff --git a/engines/tot/cutscenes.cpp b/engines/tot/cutscenes.cpp
index 2e2c2f881cc..d0e0f700baa 100644
--- a/engines/tot/cutscenes.cpp
+++ b/engines/tot/cutscenes.cpp
@@ -69,7 +69,6 @@ void putCreditsImg(uint x, uint y, byte *img1, byte *img2, bool direct) {
uint16 wImg1, hImg1;
uint horizontalAux;
- uint inc, inc2;
byte *step;
wImg1 = READ_LE_UINT16(img1);
@@ -94,10 +93,10 @@ void putCreditsImg(uint x, uint y, byte *img1, byte *img2, bool direct) {
}
for (int kk = 0; kk < hImg1; kk++) {
- inc2 = (kk * wImg1) + 4;
+ uint inc2 = (kk * wImg1) + 4;
yPos = kk + y;
for (int jj = 0; jj <= wImg1; jj++) {
- inc = inc2 + jj;
+ uint inc = inc2 + jj;
if ((direct && img1[inc] > 0) || (img1[inc] > 16 && yPos >= 66 && yPos <= 192)) {
step[inc] = img1[inc];
} else if (img1[inc] > 16) {
@@ -143,7 +142,7 @@ void putCreditsImg(uint x, uint y, byte *img1, byte *img2, bool direct) {
// Copies the credit window directly to the screen
for (int i = 0; i < hImg1; i++) {
- byte *src = step + 4 + (horizontalAux * i);
+ const byte *src = step + 4 + (horizontalAux * i);
byte *dst = ((byte *)g_engine->_screen->getPixels()) + (320 * (y + i)) + x;
Common::copy(src, src + horizontalAux, dst);
}
@@ -361,9 +360,9 @@ void TotEngine::introduction() {
_mouse->hide();
bool exitPressed;
uint loopCount;
- bool isSpanish = _lang == Common::ES_ESP;
- const char *const *messages = (isSpanish) ? fullScreenMessages[0] : fullScreenMessages[1];
- const long *offsets = (_lang == Common::ES_ESP) ? flcOffsets[0] : flcOffsets[1];
+ bool isSpanish = isLanguageSpanish();
+ const char *const *messages = getFullScreenMessagesByCurrentLanguage();
+ const long *offsets = getOffsetsByCurrentLanguage();
exitPressed = false;
_graphics->totalFadeOut(0);
@@ -496,8 +495,8 @@ void TotEngine::firstIntroduction() {
void TotEngine::initialLogo() {
bool foobar = false;
- long offset = (_lang == Common::ES_ESP) ? flcOffsets[0][0] : flcOffsets[1][0];
- drawFlc(0, 0, offset, 0, 18, 25, false, false, false, foobar);
+ const long *offsets = getOffsetsByCurrentLanguage();
+ drawFlc(0, 0, offsets[0], 0, 18, 25, false, false, false, foobar);
delay(1000);
}
@@ -506,10 +505,10 @@ void TotEngine::sacrificeScene() {
palette palaux;
Common::File file;
- bool isSpanish = (_lang == Common::ES_ESP);
- const char *const *messages = (isSpanish) ? fullScreenMessages[0] : fullScreenMessages[1];
+ bool isSpanish = isLanguageSpanish();
+ const char *const *messages = getFullScreenMessagesByCurrentLanguage();
- const long *offsets = (isSpanish) ? flcOffsets[0] : flcOffsets[1];
+ const long *offsets = getOffsetsByCurrentLanguage();
_sound->stopVoc();
bool exitPressed = _currentRoomData->paletteAnimationFlag;
@@ -872,8 +871,8 @@ void TotEngine::ending() {
_saveAllowed = false;
bool exitRequested;
- const char *const *messages = (_lang == Common::ES_ESP) ? fullScreenMessages[0] : fullScreenMessages[1];
- const long *offsets = (_lang == Common::ES_ESP) ? flcOffsets[0] : flcOffsets[1];
+ const char *const *messages = getFullScreenMessagesByCurrentLanguage();
+ const long *offsets = getOffsetsByCurrentLanguage();
littText(10, 41, messages[43], 249);
littText(10, 39, messages[43], 249);
@@ -923,7 +922,7 @@ void TotEngine::wcScene() {
_graphics->partialFadeOut(234);
- const char *const *messages = (_lang == Common::ES_ESP) ? fullScreenMessages[0] : fullScreenMessages[1];
+ const char *const *messages = getFullScreenMessagesByCurrentLanguage();
littText(10, 20, messages[45], 253);
delay(1000);
diff --git a/engines/tot/engine.cpp b/engines/tot/engine.cpp
index 59097d39e9a..60d217eaae2 100644
--- a/engines/tot/engine.cpp
+++ b/engines/tot/engine.cpp
@@ -40,7 +40,7 @@ void TotEngine::drawText(uint number) {
}
void TotEngine::displayLoading() {
- const char *msg = (_lang == Common::ES_ESP) ? fullScreenMessages[0][58] : fullScreenMessages[1][58];
+ const char *msg = getFullScreenMessagesByCurrentLanguage()[58];
setRGBPalette(255, 63, 63, 63);
littText(121, 72, msg, 0);
@@ -2734,7 +2734,7 @@ void TotEngine::useScreenObject() {
} break;
case 583: {
- long offset = (_lang == Common::ES_ESP) ? flcOffsets[0][20] : flcOffsets[1][20];
+ long offset = getOffsetsByCurrentLanguage()[20];
drawText(_curObject.useTextRef);
_mouse->hide();
@@ -2815,7 +2815,7 @@ void TotEngine::useScreenObject() {
_mouse->show();
} break;
case 632: {
- long offset = (_lang == Common::ES_ESP) ? flcOffsets[0][21] : flcOffsets[1][21];
+ long offset = getOffsetsByCurrentLanguage()[21];
drawText(_curObject.useTextRef);
_mouse->hide();
animateGive(_charFacingDirection, 1);
@@ -2878,7 +2878,7 @@ void TotEngine::useScreenObject() {
_caves[3] = true;
} break;
case 633: { //Use ring!
- long offset = (_lang == Common::ES_ESP) ? flcOffsets[0][22] : flcOffsets[1][22];
+ long offset = getOffsetsByCurrentLanguage()[22];
drawText(_curObject.useTextRef);
_mouse->hide();
@@ -2936,7 +2936,7 @@ void TotEngine::useScreenObject() {
_caves[3] = true;
} break;
case 643: { // Urn with altar
- long offset = (_lang == Common::ES_ESP) ? flcOffsets[0][23] : flcOffsets[1][23];
+ long offset = getOffsetsByCurrentLanguage()[23];
if (_currentRoomData->walkAreasGrid[(_characterPosX + kCharacterCorrectionX) / kXGridCount][(_characterPosY + kCharacerCorrectionY) / kYGridCount] != 5)
drawText(_curObject.useTextRef);
@@ -2968,7 +2968,7 @@ void TotEngine::useScreenObject() {
_mouse->show();
} break;
case 657: { // sharpen scythe
- long offset = (_lang == Common::ES_ESP) ? flcOffsets[0][24] : flcOffsets[1][24];
+ long offset = getOffsetsByCurrentLanguage()[24];
drawText(_curObject.useTextRef);
_mouse->mouseClickX = 178 - 7;
@@ -3000,7 +3000,7 @@ void TotEngine::useScreenObject() {
_mouse->show();
} break;
case 689: { // rope
- long offset = (_lang == Common::ES_ESP) ? flcOffsets[0][25] : flcOffsets[1][25];
+ long offset = getOffsetsByCurrentLanguage()[25];
drawText(_curObject.useTextRef);
_mouse->mouseClickX = 124 - 7;
@@ -3020,7 +3020,7 @@ void TotEngine::useScreenObject() {
_currentRoomData->mouseGrid[listIndex][27] = 10;
} break;
case 700: { // Trident
- long offset = (_lang == Common::ES_ESP) ? flcOffsets[0][26] : flcOffsets[1][26];
+ long offset = getOffsetsByCurrentLanguage()[26];
drawText(_curObject.useTextRef);
_mouse->mouseClickX = 224 - 7;
_mouse->mouseClickY = 91 - 7;
@@ -3064,7 +3064,7 @@ void TotEngine::useScreenObject() {
updateObject(_curObject.code);
} break;
case 709: { // rock with mural
- long offset = (_lang == Common::ES_ESP) ? flcOffsets[0][27] : flcOffsets[1][27];
+ long offset = getOffsetsByCurrentLanguage()[27];
if (_isSealRemoved) {
drawText(_curObject.useTextRef);
@@ -3202,8 +3202,8 @@ void TotEngine::useScreenObject() {
_sound->autoPlayVoc("CALDERA", 6433, 15386);
} break;
case 682: {
- long offsetWithJar = (_lang == Common::ES_ESP) ? flcOffsets[0][28] : flcOffsets[1][28];
- long offsetNoJar = (_lang == Common::ES_ESP) ? flcOffsets[0][29] : flcOffsets[1][29];
+ long offsetWithJar = getOffsetsByCurrentLanguage()[28];
+ long offsetNoJar = getOffsetsByCurrentLanguage()[29];
_mouse->hide();
_sound->playVoc("CLICK", 27742, 2458);
@@ -3605,7 +3605,7 @@ void TotEngine::loadInventory() {
}
if (_cpCounter > 65)
showError(274);
- const char *emptyName = (_lang == Common::ES_ESP) ? hardcodedObjects_ES[10] : hardcodedObjects_EN[10];
+ const char *emptyName = getHardcodedObjectsByCurrentLanguage()[10];
for (int i = 0; i < kInventoryIconCount; i++) {
_inventory[i].bitmapIndex = 34;
_inventory[i].code = 0;
@@ -4737,8 +4737,8 @@ void TotEngine::drawMenu(byte menuNumber) {
showError(258);
}
- menuOffset = _lang == Common::ES_ESP ? menuOffsets_ES[menuNumber - 1][0] : menuOffsets_EN[menuNumber - 1][0];
- menuSize = _lang == Common::ES_ESP ? menuOffsets_ES[menuNumber - 1][1] : menuOffsets_EN[menuNumber - 1][1];
+ menuOffset = isLanguageSpanish() ? menuOffsets_ES[menuNumber - 1][0] : menuOffsets_EN[menuNumber - 1][0];
+ menuSize = isLanguageSpanish() ? menuOffsets_ES[menuNumber - 1][1] : menuOffsets_EN[menuNumber - 1][1];
switch (menuNumber) {
case 1: {
@@ -4840,13 +4840,13 @@ static void loadDiploma(Common::String &photoName, Common::String &key) {
key.append(passArray, passArray + 10);
- const char *const *messages = (g_engine->_lang == Common::ES_ESP) ? fullScreenMessages[0] : fullScreenMessages[1];
+ const char *const *messages = getFullScreenMessagesByCurrentLanguage();
biosText(91, 16, messages[49] + key, 255);
biosText(90, 15, messages[49] + key, 13);
biosText(81, 61, messages[50], 0);
biosText(61, 81, messages[51], 0);
- if(g_engine->_lang == Common::ES_ESP) {
+ if(isLanguageSpanish()) {
biosText(31, 101, messages[52] + g_engine->_characterName, 0);
} else {
biosText(31, 101, messages[52], 0);
diff --git a/engines/tot/graphics.cpp b/engines/tot/graphics.cpp
index 57b50bd24c0..144f8a49293 100644
--- a/engines/tot/graphics.cpp
+++ b/engines/tot/graphics.cpp
@@ -44,13 +44,13 @@ GraphicsManager::GraphicsManager() {
error("Could not open executable file!");
}
- if (g_engine->_lang == Common::ES_ESP) {
+ if (isLanguageSpanish()) {
exeFile.seek(FONT_LITT_OFFSET_ES);
} else {
exeFile.seek(FONT_LITT_OFFSET_EN);
}
_litt.loadChr(exeFile);
- if (g_engine->_lang == Common::ES_ESP) {
+ if (isLanguageSpanish()) {
exeFile.seek(FONT_EURO_OFFSET_ES);
} else {
exeFile.seek(FONT_EURO_OFFSET_EN);
diff --git a/engines/tot/tot.cpp b/engines/tot/tot.cpp
index 8c296e53379..3f725904b40 100644
--- a/engines/tot/tot.cpp
+++ b/engines/tot/tot.cpp
@@ -1346,7 +1346,7 @@ void TotEngine::mainMenu(bool fade) {
bool validOption = false;
_sound->stopVoc();
- long offset = (_lang == Common::ES_ESP) ? flcOffsets[0][1] : flcOffsets[1][1];
+ long offset = getOffsetsByCurrentLanguage()[1];
if (fade)
drawFlc(0, 0, offset, 0, 9, 0, true, false, false, bar);
diff --git a/engines/tot/util.h b/engines/tot/util.h
index 808d5c9ccba..75aadddef98 100644
--- a/engines/tot/util.h
+++ b/engines/tot/util.h
@@ -66,6 +66,25 @@ inline Common::KeyCode hotKeyFor(HOTKEYS hotkey) {
return selectedHotkeys[hotkey];
};
+inline const char *const *getFullScreenMessagesByCurrentLanguage() {
+ return (g_engine->_lang == Common::ES_ESP) ? fullScreenMessages[0] : fullScreenMessages[1];
+}
+
+inline const char *const *getAnimMessagesByCurrentLanguage() {
+ return (g_engine->_lang == Common::ES_ESP) ? animMessages[0] : animMessages[1];
+}
+
+inline const char *const *getHardcodedObjectsByCurrentLanguage() {
+ return (g_engine->_lang == Common::ES_ESP) ? hardcodedObjects_ES : hardcodedObjects_EN;
+}
+
+inline const long *getOffsetsByCurrentLanguage() {
+ return (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0] : flcOffsets[1];
+}
+
+inline bool isLanguageSpanish() {
+ return g_engine->_lang == Common::ES_ESP;
+};
} // End of namespace Tot
Commit: 4a102eeeac14351a825623fc1b959b50e1bd8b92
https://github.com/scummvm/scummvm/commit/4a102eeeac14351a825623fc1b959b50e1bd8b92
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:54+02:00
Commit Message:
TOT: Passes strings by ref when possible
Changed paths:
engines/tot/anims.cpp
engines/tot/cutscenes.cpp
engines/tot/debug.cpp
engines/tot/engine.cpp
engines/tot/tot.h
engines/tot/util.cpp
engines/tot/util.h
diff --git a/engines/tot/anims.cpp b/engines/tot/anims.cpp
index 4d5c0a27110..d35abb06acc 100644
--- a/engines/tot/anims.cpp
+++ b/engines/tot/anims.cpp
@@ -36,7 +36,7 @@
namespace Tot {
-void drawText(uint x, uint y, Common::String str1, Common::String str2, Common::String str3, Common::String str4, Common::String str5, byte textColor, byte borderColor) {
+void drawText(uint x, uint y, const Common::String &str1, const Common::String &str2, const Common::String &str3, const Common::String &str4, const Common::String &str5, byte textColor, byte borderColor) {
littText(x, (y + 3), str1, borderColor);
littText(x, (y + 13), str2, borderColor);
@@ -84,7 +84,7 @@ void removeText(uint xTextLine1, uint yTextLine1, uint xTextLine2, uint yTextLin
g_engine->_screen->addDirtyRect(Common::Rect(xTextLine1, yTextLine1, xTextLine2, yTextLine2));
}
-void drawTvText(Common::String str1, Common::String str2, Common::String str3, Common::String str4, Common::String str5) {
+void drawTvText(const Common::String &str1, const Common::String &str2, const Common::String &str3, const Common::String &str4, const Common::String &str5) {
drawText(80, 0, str1, str2, str3, str4, str5, 253, 0);
}
@@ -92,8 +92,8 @@ void clearTvText() {
removeText(80, 0, 319, 53, 0);
}
-void drawCharacterText(Common::String str1, Common::String str2, Common::String str3, Common::String str4, Common::String str5) {
- drawText(2, 100,str1, str2, str3, str4, str5, 255, 0);
+void drawCharacterText(const Common::String &str1, const Common::String &str2, const Common::String &str3, const Common::String &str4, const Common::String &str5) {
+ drawText(2, 100, str1, str2, str3, str4, str5, 255, 0);
}
void clearCharacterText() {
removeText(2, 100, 134, 199, 0);
diff --git a/engines/tot/cutscenes.cpp b/engines/tot/cutscenes.cpp
index d0e0f700baa..11d96800c58 100644
--- a/engines/tot/cutscenes.cpp
+++ b/engines/tot/cutscenes.cpp
@@ -65,7 +65,7 @@ byte *drawCreditsScreen(uint &sizeAuxBG, byte *&auxBG) {
return backgroundPointer;
}
-void putCreditsImg(uint x, uint y, byte *img1, byte *img2, bool direct) {
+void putCreditsImg(uint x, uint y, const byte *img1, const byte *img2, bool direct) {
uint16 wImg1, hImg1;
uint horizontalAux;
@@ -87,7 +87,7 @@ void putCreditsImg(uint x, uint y, byte *img1, byte *img2, bool direct) {
// Copies the crop in the background corresponding to the current credit window in img1
for (int i = 0; i < hImg1; i++) {
- byte *src = img2 + (320 * (y + i)) + x;
+ const byte *src = img2 + (320 * (y + i)) + x;
byte *dst = step + 4 + (horizontalAux * i);
Common::copy(src, src + horizontalAux, dst);
}
diff --git a/engines/tot/debug.cpp b/engines/tot/debug.cpp
index 72fd4046fed..deb54f1a735 100644
--- a/engines/tot/debug.cpp
+++ b/engines/tot/debug.cpp
@@ -30,19 +30,19 @@ void drawMouseGrid(RoomFileRegister *screen) {
for (int i = 0; i < 39; i++) {
for (int j = 0; j < 27; j++) {
int color = screen->mouseGrid[i][j];
- if (color != 0) {
- int startX = i * kXGridCount + 7;
- int startY = j * kYGridCount;
- for (int i2 = 0; i2 < kXGridCount; i2 += 2) {
- for (int j2 = 0; j2 < kYGridCount; j2++) {
- int absPixel = startY + j2;
- int offsetX = (absPixel % 2 == 0) ? 1 : 0;
- if (offsetX < startX + kXGridCount && color != 0) {
- *(byte *)g_engine->_screen->getBasePtr(startX + i2 + offsetX, startY + j2) = 255 - color;
- }
+ if (color == 0) continue;
+ int startX = i * kXGridCount + 7;
+ int startY = j * kYGridCount;
+ for (int i2 = 0; i2 < kXGridCount; i2 += 2) {
+ for (int j2 = 0; j2 < kYGridCount; j2++) {
+ int absPixel = startY + j2;
+ int offsetX = (absPixel % 2 == 0) ? 1 : 0;
+ if (offsetX < startX + kXGridCount && color != 0) {
+ *(byte *)g_engine->_screen->getBasePtr(startX + i2 + offsetX, startY + j2) = 255 - color;
}
}
}
+
}
}
g_engine->_screen->markAllDirty();
@@ -52,16 +52,17 @@ void drawScreenGrid(RoomFileRegister *screen) {
for (int i = 0; i < 39; i++) {
for (int j = 0; j < 27; j++) {
int color = screen->walkAreasGrid[i][j];
- if (color != 0) {
- int startX = i * kXGridCount + 7;
- int startY = j * kYGridCount;
- for (int i2 = 0; i2 < kXGridCount; i2 += 2) {
- for (int j2 = 0; j2 < kYGridCount; j2++) {
- int absPixel = startY + j2;
- int offsetX = (absPixel % 2 == 0) ? 1 : 0;
- if (offsetX < startX + kXGridCount && color != 0) {
- *(byte *)g_engine->_screen->getBasePtr(startX + i2 + offsetX, startY + j2) = 255 - color;
- }
+ if (color == 0)
+ continue;
+
+ int startX = i * kXGridCount + 7;
+ int startY = j * kYGridCount;
+ for (int i2 = 0; i2 < kXGridCount; i2 += 2) {
+ for (int j2 = 0; j2 < kYGridCount; j2++) {
+ int absPixel = startY + j2;
+ int offsetX = (absPixel % 2 == 0) ? 1 : 0;
+ if (offsetX < startX + kXGridCount && color != 0) {
+ *(byte *)g_engine->_screen->getBasePtr(startX + i2 + offsetX, startY + j2) = 255 - color;
}
}
}
diff --git a/engines/tot/engine.cpp b/engines/tot/engine.cpp
index 60d217eaae2..c2cc50adf4e 100644
--- a/engines/tot/engine.cpp
+++ b/engines/tot/engine.cpp
@@ -187,7 +187,7 @@ static void assembleBackground() {
* calculates the overlapping area between the source image and the background,
* then "blits" (copies) the pixels from the image to the overlapping area of the background, respecting transparency.
*/
-static void assembleImage(byte *img, uint imgPosX, uint imgPosY) {
+static void assembleImage(const byte *img, uint imgPosX, uint imgPosY) {
uint x, // starting point of the overlap
y;
@@ -1194,7 +1194,7 @@ void TotEngine::advanceAnimations(bool barredZone, bool animateMouse) {
}
}
-void TotEngine::actionLineText(Common::String actionLine) {
+void TotEngine::actionLineText(const Common::String &actionLine) {
euroText(160, 144, actionLine, 255, Graphics::kTextAlignCenter);
}
@@ -3657,7 +3657,7 @@ static void getScreen(byte *bg) {
Common::copy(screenBuf, screenBuf + (22400 * 2), bg + 4);
}
-void TotEngine::scrollRight(uint &horizontalPos) {
+void TotEngine::scrollRight(uint horizontalPos) {
int characterPos = 25 + (320 - (_characterPosX + kCharacterCorrectionX * 2));
// We scroll 4 by 4 pixels so we divide by 4 to find out the number of necessary steps
@@ -3708,7 +3708,7 @@ void TotEngine::scrollRight(uint &horizontalPos) {
free(assembledCharacterFrame);
}
-void TotEngine::scrollLeft(uint &horizontalPos) {
+void TotEngine::scrollLeft(uint horizontalPos) {
int characterPos = 25 + _characterPosX;
horizontalPos = 320 - horizontalPos;
@@ -4357,7 +4357,7 @@ void TotEngine::loadAnimationForDirection(Common::SeekableReadStream *stream, in
}
}
-void TotEngine::loadAnimation(Common::String animationName) {
+void TotEngine::loadAnimation(const Common::String &animationName) {
Common::File animFile;
if (animationName == "PETER")
@@ -5153,7 +5153,7 @@ void TotEngine::readAlphaGraphSmall(Common::String &output, int length, int posx
bar(posx + (output.size()) * 6, posy + 2, (posx + (output.size()) * 6) + 6, posy + 9, barColor);
}
-void TotEngine::displayObjectDescription(Common::String textString) {
+void TotEngine::displayObjectDescription(const Common::String &textString) {
uint xpos = 60;
uint ypos = 15;
byte maxWidth = 33;
diff --git a/engines/tot/tot.h b/engines/tot/tot.h
index aeae4ba06fa..cd1cecf5d04 100644
--- a/engines/tot/tot.h
+++ b/engines/tot/tot.h
@@ -91,11 +91,11 @@ private:
void advanceAnimations(bool barredZone, bool animateMouse);
void updateSecondaryAnimationDepth();
void updateMainCharacterDepth();
- void actionLineText(Common::String actionLine);
+ void actionLineText(const Common::String &actionLine);
void initializeObjectFile();
void saveObjectsData(ScreenObject object, Common::SeekableWriteStream *objectDataStream);
- void scrollLeft(uint &horizontalPos);
- void scrollRight(uint &horizontalPos);
+ void scrollLeft(uint horizontalPos);
+ void scrollRight(uint horizontalPos);
TextEntry readTextRegister(uint numRegister);
void readConversationFile();
@@ -114,7 +114,7 @@ private:
void verifyCopyProtection();
void verifyCopyProtection2();
- void loadAnimation(Common::String animation);
+ void loadAnimation(const Common::String &animation);
void loadCharAnimation();
void animateGive(uint dir, uint height);
void animatePickup1(uint dir, uint height);
@@ -146,7 +146,7 @@ private:
void firstIntroduction();
void readAlphaGraph(Common::String &data, int length, int x, int y, byte barColor);
void readAlphaGraphSmall(Common::String &data, int length, int x, int y, byte barColor, byte textColor);
- void displayObjectDescription(Common::String text);
+ void displayObjectDescription(const Common::String &text);
void copyProtection();
void initialLogo();
void mainMenu(bool fade);
diff --git a/engines/tot/util.cpp b/engines/tot/util.cpp
index 9b5a6ce09bc..6abab5825fc 100644
--- a/engines/tot/util.cpp
+++ b/engines/tot/util.cpp
@@ -387,7 +387,7 @@ void setRGBPalette(int color, int r, int g, int b) {
g_system->getPaletteManager()->setPalette(palbuf, 0, 256);
}
-void littText(int x, int y, Common::String text, byte color, Graphics::TextAlign align) {
+void littText(int x, int y, const Common::String &text, byte color, Graphics::TextAlign align) {
littText(x, y, text.c_str(), color, align);
}
@@ -398,7 +398,7 @@ void littText(int x, int y, char const *text, byte color, Graphics::TextAlign al
g_engine->_graphics->littText(text, x, y, color, align, yAligned);
}
-void euroText(int x, int y, Common::String text, byte color, Graphics::TextAlign align) {
+void euroText(int x, int y, const Common::String &text, byte color, Graphics::TextAlign align) {
euroText(x, y, text.c_str(), color, align);
}
@@ -409,26 +409,7 @@ void euroText(int x, int y, char const *text, byte color, Graphics::TextAlign al
g_engine->_graphics->euroText(text, x, y, color, align, yAligned);
}
-void outtextxy(int x, int y, Common::String text, byte color, bool euro, Graphics::TextAlign align) {
- if (euro) {
- euroText(x, y, text.c_str(), color, align);
- } else {
- littText(x, y, text.c_str(), color, align);
- }
-}
-
-void outtextxy(int x, int y, char const *text, byte color, bool euro, Graphics::TextAlign align) {
- bool yAligned = (align == Graphics::kTextAlignCenter) ? true : false;
- x = (align == Graphics::kTextAlignCenter) ? 0 : x;
- y = y + 2;
- if (euro) {
- g_engine->_graphics->euroText(text, x, y, color, align, yAligned);
- } else {
- g_engine->_graphics->littText(text, x, y, color, align, yAligned);
- }
-}
-
-void biosText(int x, int y, Common::String text, byte color) {
+void biosText(int x, int y, const Common::String &text, byte color) {
g_engine->_graphics->biosText(text, x, y, color);
}
diff --git a/engines/tot/util.h b/engines/tot/util.h
index 75aadddef98..d0159417309 100644
--- a/engines/tot/util.h
+++ b/engines/tot/util.h
@@ -23,13 +23,13 @@ int engine_start();
void setRGBPalette(int color, int r, int g, int b);
-void littText(int x, int y, Common::String text, byte color, Graphics::TextAlign align = Graphics::kTextAlignStart);
+void littText(int x, int y, const Common::String &text, byte color, Graphics::TextAlign align = Graphics::kTextAlignStart);
void littText(int x, int y, char const *text, byte color, Graphics::TextAlign align = Graphics::kTextAlignStart);
-void euroText(int x, int y, Common::String text, byte color, Graphics::TextAlign align = Graphics::kTextAlignStart);
+void euroText(int x, int y, const Common::String &text, byte color, Graphics::TextAlign align = Graphics::kTextAlignStart);
void euroText(int x, int y, char const *text, byte color, Graphics::TextAlign align = Graphics::kTextAlignStart);
-void biosText(int x, int y, Common::String text, byte color);
+void biosText(int x, int y, const Common::String &text, byte color);
unsigned int imagesize(int x, int y, int x2, int y2);
Commit: aa4d99a30d088e071bcf3072b688b4daaac90e0d
https://github.com/scummvm/scummvm/commit/aa4d99a30d088e071bcf3072b688b4daaac90e0d
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:54+02:00
Commit Message:
TOT: Changes to safe types
Changed paths:
engines/tot/cutscenes.cpp
engines/tot/engine.cpp
engines/tot/midi.cpp
engines/tot/midi.h
engines/tot/sound.cpp
engines/tot/sound.h
engines/tot/statics.h
engines/tot/tot.cpp
engines/tot/tot.h
engines/tot/util.cpp
engines/tot/util.h
diff --git a/engines/tot/cutscenes.cpp b/engines/tot/cutscenes.cpp
index 11d96800c58..beb37a2c0d8 100644
--- a/engines/tot/cutscenes.cpp
+++ b/engines/tot/cutscenes.cpp
@@ -362,7 +362,7 @@ void TotEngine::introduction() {
uint loopCount;
bool isSpanish = isLanguageSpanish();
const char *const *messages = getFullScreenMessagesByCurrentLanguage();
- const long *offsets = getOffsetsByCurrentLanguage();
+ const int32 *offsets = getOffsetsByCurrentLanguage();
exitPressed = false;
_graphics->totalFadeOut(0);
@@ -495,7 +495,7 @@ void TotEngine::firstIntroduction() {
void TotEngine::initialLogo() {
bool foobar = false;
- const long *offsets = getOffsetsByCurrentLanguage();
+ const int32 *offsets = getOffsetsByCurrentLanguage();
drawFlc(0, 0, offsets[0], 0, 18, 25, false, false, false, foobar);
delay(1000);
}
@@ -508,7 +508,7 @@ void TotEngine::sacrificeScene() {
bool isSpanish = isLanguageSpanish();
const char *const *messages = getFullScreenMessagesByCurrentLanguage();
- const long *offsets = getOffsetsByCurrentLanguage();
+ const int32 *offsets = getOffsetsByCurrentLanguage();
_sound->stopVoc();
bool exitPressed = _currentRoomData->paletteAnimationFlag;
@@ -872,7 +872,7 @@ void TotEngine::ending() {
bool exitRequested;
const char *const *messages = getFullScreenMessagesByCurrentLanguage();
- const long *offsets = getOffsetsByCurrentLanguage();
+ const int32 *offsets = getOffsetsByCurrentLanguage();
littText(10, 41, messages[43], 249);
littText(10, 39, messages[43], 249);
diff --git a/engines/tot/engine.cpp b/engines/tot/engine.cpp
index c2cc50adf4e..a1645f49cd9 100644
--- a/engines/tot/engine.cpp
+++ b/engines/tot/engine.cpp
@@ -2734,7 +2734,7 @@ void TotEngine::useScreenObject() {
} break;
case 583: {
- long offset = getOffsetsByCurrentLanguage()[20];
+ int32 offset = getOffsetsByCurrentLanguage()[20];
drawText(_curObject.useTextRef);
_mouse->hide();
@@ -2815,7 +2815,7 @@ void TotEngine::useScreenObject() {
_mouse->show();
} break;
case 632: {
- long offset = getOffsetsByCurrentLanguage()[21];
+ int32 offset = getOffsetsByCurrentLanguage()[21];
drawText(_curObject.useTextRef);
_mouse->hide();
animateGive(_charFacingDirection, 1);
@@ -2878,7 +2878,7 @@ void TotEngine::useScreenObject() {
_caves[3] = true;
} break;
case 633: { //Use ring!
- long offset = getOffsetsByCurrentLanguage()[22];
+ int32 offset = getOffsetsByCurrentLanguage()[22];
drawText(_curObject.useTextRef);
_mouse->hide();
@@ -2936,7 +2936,7 @@ void TotEngine::useScreenObject() {
_caves[3] = true;
} break;
case 643: { // Urn with altar
- long offset = getOffsetsByCurrentLanguage()[23];
+ int32 offset = getOffsetsByCurrentLanguage()[23];
if (_currentRoomData->walkAreasGrid[(_characterPosX + kCharacterCorrectionX) / kXGridCount][(_characterPosY + kCharacerCorrectionY) / kYGridCount] != 5)
drawText(_curObject.useTextRef);
@@ -2968,7 +2968,7 @@ void TotEngine::useScreenObject() {
_mouse->show();
} break;
case 657: { // sharpen scythe
- long offset = getOffsetsByCurrentLanguage()[24];
+ int32 offset = getOffsetsByCurrentLanguage()[24];
drawText(_curObject.useTextRef);
_mouse->mouseClickX = 178 - 7;
@@ -3000,7 +3000,7 @@ void TotEngine::useScreenObject() {
_mouse->show();
} break;
case 689: { // rope
- long offset = getOffsetsByCurrentLanguage()[25];
+ int32 offset = getOffsetsByCurrentLanguage()[25];
drawText(_curObject.useTextRef);
_mouse->mouseClickX = 124 - 7;
@@ -3020,7 +3020,7 @@ void TotEngine::useScreenObject() {
_currentRoomData->mouseGrid[listIndex][27] = 10;
} break;
case 700: { // Trident
- long offset = getOffsetsByCurrentLanguage()[26];
+ int32 offset = getOffsetsByCurrentLanguage()[26];
drawText(_curObject.useTextRef);
_mouse->mouseClickX = 224 - 7;
_mouse->mouseClickY = 91 - 7;
@@ -3064,7 +3064,7 @@ void TotEngine::useScreenObject() {
updateObject(_curObject.code);
} break;
case 709: { // rock with mural
- long offset = getOffsetsByCurrentLanguage()[27];
+ int32 offset = getOffsetsByCurrentLanguage()[27];
if (_isSealRemoved) {
drawText(_curObject.useTextRef);
@@ -3202,8 +3202,8 @@ void TotEngine::useScreenObject() {
_sound->autoPlayVoc("CALDERA", 6433, 15386);
} break;
case 682: {
- long offsetWithJar = getOffsetsByCurrentLanguage()[28];
- long offsetNoJar = getOffsetsByCurrentLanguage()[29];
+ int32 offsetWithJar = getOffsetsByCurrentLanguage()[28];
+ int32 offsetNoJar = getOffsetsByCurrentLanguage()[29];
_mouse->hide();
_sound->playVoc("CLICK", 27742, 2458);
@@ -4730,7 +4730,7 @@ void TotEngine::drawMenu(byte menuNumber) {
byte *bitmap;
uint menuSize;
byte xmenu = 0, ymenu = 0;
- long menuOffset;
+ int32 menuOffset;
Common::File menuFile;
if (!menuFile.open("MENUS.DAT")) {
diff --git a/engines/tot/midi.cpp b/engines/tot/midi.cpp
index 0724923fed4..121f507b265 100644
--- a/engines/tot/midi.cpp
+++ b/engines/tot/midi.cpp
@@ -182,7 +182,7 @@ MidiDriver_AdLib::~MidiDriver_AdLib() {
delete[] _dsfInstrumentBank;
}
-void MidiDriver_AdLib::loadInstrumentBankFromDriver(long offset) {
+void MidiDriver_AdLib::loadInstrumentBankFromDriver(int32 offset) {
Common::File driverFile;
if (!driverFile.open("CTMIDI.DRV")) {
error("Couldnt find midi file!");
diff --git a/engines/tot/midi.h b/engines/tot/midi.h
index f8ee7b303db..ecbc9f99fee 100644
--- a/engines/tot/midi.h
+++ b/engines/tot/midi.h
@@ -35,7 +35,7 @@ public:
~MidiDriver_AdLib();
void loadInstrumentBank(uint8 *instrumentBankData);
- void loadInstrumentBankFromDriver(long offset);
+ void loadInstrumentBankFromDriver(int32 offset);
protected:
OplInstrumentDefinition *_dsfInstrumentBank;
diff --git a/engines/tot/sound.cpp b/engines/tot/sound.cpp
index c60d12ffbaa..8792edf0428 100644
--- a/engines/tot/sound.cpp
+++ b/engines/tot/sound.cpp
@@ -64,7 +64,7 @@ void SoundManager::init() {
_musicVolLeft = 3;
}
-void SoundManager::loadVoc(Common::String vocFile, long startPos, int16 size) {
+void SoundManager::loadVoc(Common::String vocFile, int32 startPos, int16 size) {
Common::File vocResource;
if (size == 0) {
diff --git a/engines/tot/sound.h b/engines/tot/sound.h
index f9961963421..3272200ddec 100644
--- a/engines/tot/sound.h
+++ b/engines/tot/sound.h
@@ -40,7 +40,7 @@ public:
~SoundManager();
void init();
- void loadVoc(Common::String vocFile, long startPos, int16 vocSize);
+ void loadVoc(Common::String vocFile, int32 startPos, int16 vocSize);
void autoPlayVoc(Common::String vocFile, int32 startPos, int16 vocSize);
void playVoc(Common::String vocFile, int32 startPos, uint vocSize);
void playVoc();
diff --git a/engines/tot/statics.h b/engines/tot/statics.h
index 36d14e341c4..3e2047c8cd7 100644
--- a/engines/tot/statics.h
+++ b/engines/tot/statics.h
@@ -916,7 +916,7 @@ const int FONT_EURO_OFFSET_ES = 159681;
const int FONT_LITT_OFFSET_EN = 153010;
const int FONT_EURO_OFFSET_EN = 159107;
-static const long menuOffsets_ES[8][2] = {
+static const int32 menuOffsets_ES[8][2] = {
{0, 16004},
{16004, 24535},
{40539, 24535},
@@ -927,7 +927,7 @@ static const long menuOffsets_ES[8][2] = {
{147327, 7148},
};
-static const long menuOffsets_EN[8][2] = {
+static const int32 menuOffsets_EN[8][2] = {
{0, 16004},
{16004, 24535},
{40539, 24535},
@@ -938,7 +938,7 @@ static const long menuOffsets_EN[8][2] = {
{146775, 7148},
};
-static const long flcOffsets[2][32] = {
+static const int32 flcOffsets[2][32] = {
{
0, // Logo
837602, // Menu reveal
diff --git a/engines/tot/tot.cpp b/engines/tot/tot.cpp
index 3f725904b40..62bf6f7f31d 100644
--- a/engines/tot/tot.cpp
+++ b/engines/tot/tot.cpp
@@ -1346,7 +1346,7 @@ void TotEngine::mainMenu(bool fade) {
bool validOption = false;
_sound->stopVoc();
- long offset = getOffsetsByCurrentLanguage()[1];
+ int32 offset = getOffsetsByCurrentLanguage()[1];
if (fade)
drawFlc(0, 0, offset, 0, 9, 0, true, false, false, bar);
diff --git a/engines/tot/tot.h b/engines/tot/tot.h
index cd1cecf5d04..d9319b0bedb 100644
--- a/engines/tot/tot.h
+++ b/engines/tot/tot.h
@@ -394,7 +394,7 @@ public:
*/
uint16 _firstList[5] = { 0 }, _secondList[5] = { 0 };
- long _screenSize = 65520;
+ int32 _screenSize = 65520;
/**
* Frame number for the animations
diff --git a/engines/tot/util.cpp b/engines/tot/util.cpp
index 6abab5825fc..449a243c716 100644
--- a/engines/tot/util.cpp
+++ b/engines/tot/util.cpp
@@ -413,7 +413,7 @@ void biosText(int x, int y, const Common::String &text, byte color) {
g_engine->_graphics->biosText(text, x, y, color);
}
-unsigned int imagesize(int x, int y, int x2, int y2) {
+uint imagesize(int x, int y, int x2, int y2) {
int w = x2 - x + 1;
int h = y2 - y + 1;
return 4 + (w * h);
@@ -442,7 +442,7 @@ void putpixel(int x, int y, byte color) {
g_engine->_screen->setPixel(x, y, color);
}
-void line(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2, byte color) {
+void line(uint x1, uint y1, uint x2, uint y2, byte color) {
g_engine->_screen->drawLine(x1, y1, x2, y2, color);
}
@@ -486,7 +486,7 @@ void waitForKey() {
}
}
-unsigned int Random(unsigned int range) { return g_engine->getRandomNumber(range); }
+uint Random(uint range) { return g_engine->getRandomNumber(range); }
int Random(int range) { return g_engine->getRandomNumber(range - 1); }
} // End of namespace Tot
diff --git a/engines/tot/util.h b/engines/tot/util.h
index d0159417309..7f9f1b6e311 100644
--- a/engines/tot/util.h
+++ b/engines/tot/util.h
@@ -31,11 +31,11 @@ void euroText(int x, int y, char const *text, byte color, Graphics::TextAlign al
void biosText(int x, int y, const Common::String &text, byte color);
-unsigned int imagesize(int x, int y, int x2, int y2);
+uint imagesize(int x, int y, int x2, int y2);
void rectangle(int x1, int y1, int x2, int y2, byte color);
-void line(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2, byte color);
+void line(uint x1, uint y1, uint x2, uint y2, byte color);
void bar(int x1, int y1, int x2, int y2, byte color);
@@ -49,9 +49,9 @@ void waitForKey();
void changeGameSpeed(Common::Event e);
-inline bool odd(long i) { return i % 2 != 0; }
+inline bool odd(int32 i) { return i % 2 != 0; }
-unsigned Random(unsigned range);
+uint Random(uint range);
int Random(int range);
inline Common::String getObjectName(int idx) {
@@ -78,7 +78,7 @@ inline const char *const *getHardcodedObjectsByCurrentLanguage() {
return (g_engine->_lang == Common::ES_ESP) ? hardcodedObjects_ES : hardcodedObjects_EN;
}
-inline const long *getOffsetsByCurrentLanguage() {
+inline const int32 *getOffsetsByCurrentLanguage() {
return (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0] : flcOffsets[1];
}
Commit: 0f1bab1dc86f04df6f628912b01d92b5dea5d481
https://github.com/scummvm/scummvm/commit/0f1bab1dc86f04df6f628912b01d92b5dea5d481
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:54+02:00
Commit Message:
TOT: Formatting & cosmetics
Changed paths:
engines/tot/anims.cpp
engines/tot/chrono.cpp
engines/tot/cutscenes.cpp
engines/tot/dialog.cpp
engines/tot/engine.cpp
engines/tot/font/biosfont.h
engines/tot/module.mk
engines/tot/resources.cpp
engines/tot/saveload.cpp
engines/tot/sound.cpp
engines/tot/tot.cpp
engines/tot/tot.h
engines/tot/types.h
engines/tot/util.cpp
engines/tot/util.h
diff --git a/engines/tot/anims.cpp b/engines/tot/anims.cpp
index d35abb06acc..24d0f49105d 100644
--- a/engines/tot/anims.cpp
+++ b/engines/tot/anims.cpp
@@ -944,7 +944,7 @@ void drawFlc(
skipFrame = !skipFrame;
}
handleFlcEvent(eventNumber, loopNumber, frameCount);
- if(!skipFrame) {
+ if (!skipFrame) {
const Graphics::Surface *frame = flic->decodeNextFrame();
if (frame) {
frameCount++;
diff --git a/engines/tot/chrono.cpp b/engines/tot/chrono.cpp
index 0e19b4b188f..0810ea58f68 100644
--- a/engines/tot/chrono.cpp
+++ b/engines/tot/chrono.cpp
@@ -65,9 +65,6 @@ void ChronoManager::delay(int ms) {
while ((g_system->getMillis() - delayStart) < ms && !g_engine->shouldQuit()) {
while (g_system->getEventManager()->pollEvent(e)) {
}
- if (ms > 10) {
- g_system->delayMillis(10);
- }
g_engine->_screen->update();
}
}
diff --git a/engines/tot/cutscenes.cpp b/engines/tot/cutscenes.cpp
index beb37a2c0d8..0480ce1f31d 100644
--- a/engines/tot/cutscenes.cpp
+++ b/engines/tot/cutscenes.cpp
@@ -28,16 +28,16 @@
namespace Tot {
byte *drawCreditsScreen(uint &sizeAuxBG, byte *&auxBG) {
- palette intermediatePalette, darkPalette;
+ Palette intermediatePalette, darkPalette;
Common::File ppFile;
if (!ppFile.open("DIPLOMA.PAN")) {
showError(315);
}
- byte *backgroundPointer = (byte *)malloc(64000);
- ppFile.read(intermediatePalette, 768);
- ppFile.read(backgroundPointer, 64000);
+ byte *backgroundPointer = (byte *)malloc(320 * 200);
+ ppFile.read(intermediatePalette, 256 * 3);
+ ppFile.read(backgroundPointer, 320 * 200);
ppFile.close();
g_engine->_graphics->drawFullScreen(backgroundPointer);
@@ -48,7 +48,7 @@ byte *drawCreditsScreen(uint &sizeAuxBG, byte *&auxBG) {
auxBG = (byte *)malloc(sizeAuxBG);
g_engine->_graphics->getImg(0, 0, 319, 59, auxBG);
- for (int i = 0; i <= 255; i++) {
+ for (int i = 0; i < 256; i++) {
darkPalette[i * 3 + 0] = 0;
darkPalette[i * 3 + 1] = 0;
darkPalette[i * 3 + 2] = 0;
@@ -153,7 +153,7 @@ void putCreditsImg(uint x, uint y, const byte *img1, const byte *img2, bool dire
void scrollCredit(
int32 position,
uint size,
- palette &pal2,
+ Palette &pal2,
byte *&background,
bool &exit,
int minHeight,
@@ -168,7 +168,7 @@ void scrollCredit(
creditFile.read(pal2, 768);
creditFile.close();
- for (int i = 16; i <= 255; i++) {
+ for (int i = 16; i < 256; i++) {
// Adjust for 6-bit DAC
pal2[i * 3 + 0] <<= 2;
pal2[i * 3 + 1] <<= 2;
@@ -208,7 +208,7 @@ void scrollCredit(
void scrollSingleCredit(
int32 pos,
uint size,
- palette &pal2,
+ Palette &pal2,
byte *&background,
bool &exit) {
scrollCredit(
@@ -265,10 +265,10 @@ inline bool keyPressed() {
void TotEngine::credits() {
_saveAllowed = true;
- palette pal2;
+ Palette pal2;
byte *background2;
uint sizeBg2;
- bool exit;
+ bool shouldExit = false;
_mouse->hide();
_graphics->totalFadeOut(0);
@@ -278,71 +278,69 @@ void TotEngine::credits() {
_sound->fadeInMusic();
byte *background = drawCreditsScreen(sizeBg2, background2);
- exit = false;
-
- if (keyPressed() || exit)
+ if (keyPressed() || shouldExit)
goto Lexit;
- scrollCredit(0, 8004, pal2, background, exit, 10, false, true);
- if (keyPressed() || exit)
+ scrollCredit(0, 8004, pal2, background, shouldExit, 10, false, true);
+ if (keyPressed() || shouldExit)
goto Lexit;
- scrollSingleCredit(8772, 8004, pal2, background, exit);
- if (keyPressed() || exit)
+ scrollSingleCredit(8772, 8004, pal2, background, shouldExit);
+ if (keyPressed() || shouldExit)
goto Lexit;
- scrollSingleCredit(17544, 8004, pal2, background, exit);
- if (keyPressed() || exit)
+ scrollSingleCredit(17544, 8004, pal2, background, shouldExit);
+ if (keyPressed() || shouldExit)
goto Lexit;
- scrollSingleCredit(26316, 7504, pal2, background, exit);
- if (keyPressed() || exit)
+ scrollSingleCredit(26316, 7504, pal2, background, shouldExit);
+ if (keyPressed() || shouldExit)
goto Lexit;
- scrollSingleCredit(34588, 7504, pal2, background, exit);
- if (keyPressed() || exit)
+ scrollSingleCredit(34588, 7504, pal2, background, shouldExit);
+ if (keyPressed() || shouldExit)
goto Lexit;
- scrollSingleCredit(42860, 8004, pal2, background, exit);
- if (keyPressed() || exit)
+ scrollSingleCredit(42860, 8004, pal2, background, shouldExit);
+ if (keyPressed() || shouldExit)
goto Lexit;
- scrollSingleCredit(51632, 7504, pal2, background, exit);
- if (keyPressed() || exit)
+ scrollSingleCredit(51632, 7504, pal2, background, shouldExit);
+ if (keyPressed() || shouldExit)
goto Lexit;
removeTitle(background2);
- if (keyPressed() || exit)
+ if (keyPressed() || shouldExit)
goto Lexit;
_graphics->putImg(0, 0, background2);
- if (keyPressed() || exit)
+ if (keyPressed() || shouldExit)
goto Lexit;
_graphics->copyFromScreen(background);
- if (keyPressed() || exit)
+ if (keyPressed() || shouldExit)
goto Lexit;
- scrollCredit(59904, 8004, pal2, background, exit, 10, false, true);
- if (keyPressed() || exit)
+ scrollCredit(59904, 8004, pal2, background, shouldExit, 10, false, true);
+ if (keyPressed() || shouldExit)
goto Lexit;
- scrollSingleCredit(68676, 8004, pal2, background, exit);
- if (keyPressed() || exit)
+ scrollSingleCredit(68676, 8004, pal2, background, shouldExit);
+ if (keyPressed() || shouldExit)
goto Lexit;
- scrollSingleCredit(77448, 8004, pal2, background, exit);
- if (keyPressed() || exit)
+ scrollSingleCredit(77448, 8004, pal2, background, shouldExit);
+ if (keyPressed() || shouldExit)
goto Lexit;
- scrollSingleCredit(86220, 8004, pal2, background, exit);
- if (keyPressed() || exit)
+ scrollSingleCredit(86220, 8004, pal2, background, shouldExit);
+ if (keyPressed() || shouldExit)
goto Lexit;
- scrollSingleCredit(94992, 8004, pal2, background, exit);
- if (keyPressed() || exit)
+ scrollSingleCredit(94992, 8004, pal2, background, shouldExit);
+ if (keyPressed() || shouldExit)
goto Lexit;
- scrollSingleCredit(103764, 8004, pal2, background, exit);
- if (keyPressed() || exit)
+ scrollSingleCredit(103764, 8004, pal2, background, shouldExit);
+ if (keyPressed() || shouldExit)
goto Lexit;
- scrollSingleCredit(112536, 8004, pal2, background, exit);
- if (keyPressed() || exit)
+ scrollSingleCredit(112536, 8004, pal2, background, shouldExit);
+ if (keyPressed() || shouldExit)
goto Lexit;
removeTitle(background2);
- if (keyPressed() || exit)
+ if (keyPressed() || shouldExit)
goto Lexit;
_graphics->putImg(0, 0, background2);
- if (keyPressed() || exit)
+ if (keyPressed() || shouldExit)
goto Lexit;
_graphics->copyFromScreen(background);
- if (keyPressed() || exit)
+ if (keyPressed() || shouldExit)
goto Lexit;
- scrollCredit(121308, 8004, pal2, background, exit, 80, false, true);
+ scrollCredit(121308, 8004, pal2, background, shouldExit, 80, false, true);
Lexit:
delay(1000);
_graphics->totalFadeOut(0);
@@ -502,7 +500,7 @@ void TotEngine::initialLogo() {
void TotEngine::sacrificeScene() {
_saveAllowed = false;
- palette palaux;
+ Palette palaux;
Common::File file;
bool isSpanish = isLanguageSpanish();
@@ -913,7 +911,7 @@ void TotEngine::ending() {
}
void TotEngine::wcScene() {
- palette wcPalette;
+ Palette wcPalette;
_currentZone = _currentRoomData->walkAreasGrid[(_characterPosX + kCharacterCorrectionX) / kXGridCount][(_characterPosY + kCharacerCorrectionY) / kYGridCount];
goToObject(_currentZone, _targetZone);
diff --git a/engines/tot/dialog.cpp b/engines/tot/dialog.cpp
index 57de31befdd..8c02dbc0a36 100644
--- a/engines/tot/dialog.cpp
+++ b/engines/tot/dialog.cpp
@@ -182,7 +182,7 @@ Common::List<uint>* findDialogue(Tree tree, byte characterIndex) {
break;
}
if (speak) {
- if (auxTree->element.spoken == '2')
+ if (auxTree->element.spoken == '2') {
if (!border) {
border = true;
switch (characterIndex) {
@@ -212,10 +212,8 @@ Common::List<uint>* findDialogue(Tree tree, byte characterIndex) {
forward = true;
}
}
- } else {
- ;
}
- else {
+ } else {
linkedList->push_back(auxTree->element.index);
forward = true;
}
@@ -582,7 +580,7 @@ void loadTalkAnimations() {
int32 offset = g_engine->_mainCharFrameSize * 16;
offset = (offset * g_engine->_charFacingDirection) + 2;
animFile.seek(offset);
- //Will load talking anim always in the upwards direction of the walk cycle array
+ // Will load talking anim always in the upwards direction of the walk cycle array
for (int i = 0; i < 16; i++) {
g_engine->_mainCharAnimation.bitmap[0][i] = (byte *)malloc(g_engine->_mainCharFrameSize);
animFile.read(g_engine->_mainCharAnimation.bitmap[0][i], g_engine->_mainCharFrameSize);
diff --git a/engines/tot/engine.cpp b/engines/tot/engine.cpp
index a1645f49cd9..f0b9ef37d80 100644
--- a/engines/tot/engine.cpp
+++ b/engines/tot/engine.cpp
@@ -804,7 +804,7 @@ void TotEngine::lookAtObject(byte objectCode) {
Common::String description;
bool foobar = false;
TextEntry textRef;
- palette secPalette;
+ Palette secPalette;
_cpCounter2 = _cpCounter;
_mouse->hide();
@@ -823,7 +823,7 @@ void TotEngine::lookAtObject(byte objectCode) {
251, // color2
251, // color3
251, // color4
- 0 // color5
+ 0 // color5
);
drawMenu(4);
@@ -4537,7 +4537,7 @@ void TotEngine::loadTV() {
void TotEngine::loadScreen() {
Common::File paletteFile;
- palette palcp;
+ Palette palcp;
_screenSize = _currentRoomData->roomImageSize;
readBitmap(_currentRoomData->roomImagePointer, _sceneBackground, _screenSize, 316);
@@ -4788,7 +4788,7 @@ void TotEngine::drawMenu(byte menuNumber) {
}
static void loadDiploma(Common::String &photoName, Common::String &key) {
- palette auxPal;
+ Palette auxPal;
byte *screen;
uint size;
byte *stamp;
diff --git a/engines/tot/font/biosfont.h b/engines/tot/font/biosfont.h
index 0db0e1d26ca..a073fbbd643 100644
--- a/engines/tot/font/biosfont.h
+++ b/engines/tot/font/biosfont.h
@@ -19,8 +19,8 @@
*
*/
-#ifndef TOT_BIG5FONT_H
-#define TOT_BIG5FONT_H
+#ifndef TOT_BIOSFONT_H
+#define TOT_BIOSFONT_H
#include "graphics/big5.h"
#include "graphics/font.h"
diff --git a/engines/tot/module.mk b/engines/tot/module.mk
index a9c971c4830..a2d1125918d 100644
--- a/engines/tot/module.mk
+++ b/engines/tot/module.mk
@@ -1,26 +1,26 @@
MODULE := engines/tot
MODULE_OBJS = \
- tot.o \
- console.o \
- metaengine.o \
- forest.o \
- util.o \
- anims.o \
- engine.o \
- dialog.o \
+ decoder/TotFlicDecoder.o \
font/bgifont.o \
font/biosfont.o \
- decoder/TotFlicDecoder.o \
- sound.o \
+ anims.o \
+ chrono.o \
+ console.o \
+ cutscenes.o \
+ debug.o \
+ dialog.o \
+ engine.o \
+ forest.o \
graphics.o \
+ metaengine.o \
+ midi.o \
mouse.o \
- chrono.o \
+ resources.o \
saveload.o \
- midi.o \
- debug.o \
- cutscenes.o \
- resources.o
+ sound.o \
+ tot.o \
+ util.o
# This module can be built as a plugin
ifeq ($(ENABLE_TOT), DYNAMIC_PLUGIN)
diff --git a/engines/tot/resources.cpp b/engines/tot/resources.cpp
index 6bfc040823b..526dce31945 100644
--- a/engines/tot/resources.cpp
+++ b/engines/tot/resources.cpp
@@ -97,98 +97,92 @@ void TotEngine::readConversationFile() {
conversationFile.close();
}
-void saveDoorMetadata(DoorRegistry doors, Common::SeekableWriteStream *screenDataStream) {
- screenDataStream->writeUint16LE(doors.nextScene);
- screenDataStream->writeUint16LE(doors.exitPosX);
- screenDataStream->writeUint16LE(doors.exitPosY);
- screenDataStream->writeByte(doors.openclosed);
- screenDataStream->writeByte(doors.doorcode);
+void saveDoorMetadata(DoorRegistry doors, Common::SeekableWriteStream *out) {
+ out->writeUint16LE(doors.nextScene);
+ out->writeUint16LE(doors.exitPosX);
+ out->writeUint16LE(doors.exitPosY);
+ out->writeByte(doors.openclosed);
+ out->writeByte(doors.doorcode);
}
-void savePoint(Common::Point point, Common::SeekableWriteStream *screenDataStream) {
- screenDataStream->writeUint16LE(point.x);
- screenDataStream->writeUint16LE(point.y);
+void savePoint(Common::Point point, Common::SeekableWriteStream *out) {
+ out->writeUint16LE(point.x);
+ out->writeUint16LE(point.y);
}
-void saveBitmapRegister(RoomBitmapRegister bitmap, Common::SeekableWriteStream *screenDataStream) {
- screenDataStream->writeSint32LE(bitmap.bitmapPointer);
- screenDataStream->writeUint16LE(bitmap.bitmapSize);
- screenDataStream->writeUint16LE(bitmap.coordx);
- screenDataStream->writeUint16LE(bitmap.coordy);
- screenDataStream->writeUint16LE(bitmap.depth);
+void saveBitmapRegister(RoomBitmapRegister bitmap, Common::SeekableWriteStream *out) {
+ out->writeSint32LE(bitmap.bitmapPointer);
+ out->writeUint16LE(bitmap.bitmapSize);
+ out->writeUint16LE(bitmap.coordx);
+ out->writeUint16LE(bitmap.coordy);
+ out->writeUint16LE(bitmap.depth);
}
-void saveRoomObjectList(RoomObjectListEntry objectList, Common::SeekableWriteStream *screenDataStream) {
+void saveRoomObjectList(RoomObjectListEntry objectList, Common::SeekableWriteStream *out) {
- screenDataStream->writeUint16LE(objectList.fileIndex);
- screenDataStream->writeByte(objectList.objectName.size());
+ out->writeUint16LE(objectList.fileIndex);
+ out->writeByte(objectList.objectName.size());
int paddingSize = 20 - objectList.objectName.size();
if (paddingSize < 20) {
- screenDataStream->writeString(objectList.objectName);
+ out->writeString(objectList.objectName);
}
if (paddingSize > 0) {
- char *padding = (char *)malloc(paddingSize);
- for (int i = 0; i < paddingSize; i++) {
- padding[i] = '\0';
- }
- screenDataStream->write(padding, paddingSize);
+ char *padding = (char *)calloc(paddingSize, 1);
+ out->write(padding, paddingSize);
free(padding);
}
}
-void saveRoom(RoomFileRegister *room, Common::SeekableWriteStream *screenDataStream) {
- screenDataStream->writeUint16LE(room->code);
- screenDataStream->writeUint32LE(room->roomImagePointer);
- screenDataStream->writeUint16LE(room->roomImageSize);
- screenDataStream->write(room->walkAreasGrid, 40 * 28);
- screenDataStream->write(room->mouseGrid, 40 * 28);
+void saveRoom(RoomFileRegister *room, Common::SeekableWriteStream *out) {
+ out->writeUint16LE(room->code);
+ out->writeUint32LE(room->roomImagePointer);
+ out->writeUint16LE(room->roomImageSize);
+ out->write(room->walkAreasGrid, 40 * 28);
+ out->write(room->mouseGrid, 40 * 28);
// read puntos
for (int i = 0; i < 9; i++) {
for (int j = 0; j < 30; j++) {
for (int k = 0; k < 5; k++) {
- savePoint(room->trajectories[i][j][k], screenDataStream);
+ savePoint(room->trajectories[i][j][k], out);
}
}
}
for (int i = 0; i < 5; i++) {
- saveDoorMetadata(room->doors[i], screenDataStream);
+ saveDoorMetadata(room->doors[i], out);
}
for (int i = 0; i < 15; i++) {
- saveBitmapRegister(room->screenLayers[i], screenDataStream);
+ saveBitmapRegister(room->screenLayers[i], out);
}
for (int i = 0; i < 51; i++) {
- saveRoomObjectList(*room->screenObjectIndex[i], screenDataStream);
+ saveRoomObjectList(*room->screenObjectIndex[i], out);
}
- screenDataStream->writeByte(room->animationFlag);
+ out->writeByte(room->animationFlag);
- screenDataStream->writeByte(room->animationName.size());
- screenDataStream->writeString(room->animationName);
+ out->writeByte(room->animationName.size());
+ out->writeString(room->animationName);
int paddingSize = 8 - room->animationName.size();
if (paddingSize > 0) {
- char *padding = (char *)malloc(paddingSize);
- for (int i = 0; i < paddingSize; i++) {
- padding[i] = '\0';
- }
+ char *padding = (char *)calloc(paddingSize, 1);
// 8 max char name
- screenDataStream->write(padding, paddingSize);
+ out->write(padding, paddingSize);
free(padding);
}
- screenDataStream->writeByte(room->paletteAnimationFlag);
- screenDataStream->writeUint16LE(room->palettePointer);
+ out->writeByte(room->paletteAnimationFlag);
+ out->writeUint16LE(room->palettePointer);
for (int i = 0; i < 300; i++) {
- savePoint(room->secondaryAnimTrajectory[i], screenDataStream);
+ savePoint(room->secondaryAnimTrajectory[i], out);
}
- screenDataStream->write(room->secondaryAnimDirections, 600);
- screenDataStream->writeUint16LE(room->secondaryTrajectoryLength);
+ out->write(room->secondaryAnimDirections, 600);
+ out->writeUint16LE(room->secondaryTrajectoryLength);
}
-void TotEngine::saveRoomData(RoomFileRegister *room, Common::SeekableWriteStream *stream) {
+void TotEngine::saveRoomData(RoomFileRegister *room, Common::SeekableWriteStream *out) {
_rooms->seek(room->code * kRoomRegSize, SEEK_SET);
- saveRoom(room, stream);
+ saveRoom(room, out);
}
void TotEngine::readObject(Common::SeekableReadStream *stream, uint itemPos, ScreenObject &thisRegObj) {
@@ -258,137 +252,134 @@ void TotEngine::initializeObjectFile() {
objFile.close();
}
-void TotEngine::saveObjectsData(ScreenObject object, Common::SeekableWriteStream *objectDataStream) {
- objectDataStream->writeUint16LE(object.code);
- objectDataStream->writeByte(object.height);
+void TotEngine::saveObjectsData(ScreenObject object, Common::SeekableWriteStream *out) {
+ out->writeUint16LE(object.code);
+ out->writeByte(object.height);
- objectDataStream->writeByte(object.name.size());
- objectDataStream->writeString(object.name);
+ out->writeByte(object.name.size());
+ out->writeString(object.name);
int paddingSize = kObjectNameLength - object.name.size();
if (paddingSize > 0) {
- char *padding = (char *)malloc(paddingSize);
- for (int i = 0; i < paddingSize; i++) {
- padding[i] = '\0';
- }
+ char *padding = (char *)calloc(paddingSize, 1);
// 8 max char name
- objectDataStream->write(padding, paddingSize);
+ out->write(padding, paddingSize);
free(padding);
}
- objectDataStream->writeUint16LE(object.lookAtTextRef);
- objectDataStream->writeUint16LE(object.beforeUseTextRef);
- objectDataStream->writeUint16LE(object.afterUseTextRef);
- objectDataStream->writeUint16LE(object.pickTextRef);
- objectDataStream->writeUint16LE(object.useTextRef);
-
- objectDataStream->writeByte(object.speaking);
- objectDataStream->writeByte(object.openable);
- objectDataStream->writeByte(object.closeable);
-
- objectDataStream->write(object.used, 8);
-
- objectDataStream->writeByte(object.pickupable);
-
- objectDataStream->writeUint16LE(object.useWith);
- objectDataStream->writeUint16LE(object.replaceWith);
- objectDataStream->writeByte(object.depth);
- objectDataStream->writeUint32LE(object.bitmapPointer);
- objectDataStream->writeUint16LE(object.bitmapSize);
- objectDataStream->writeUint16LE(object.rotatingObjectAnimation);
- objectDataStream->writeUint16LE(object.rotatingObjectPalette);
- objectDataStream->writeUint16LE(object.dropOverlayX);
- objectDataStream->writeUint16LE(object.dropOverlayY);
- objectDataStream->writeUint32LE(object.dropOverlay);
- objectDataStream->writeUint16LE(object.dropOverlaySize);
- objectDataStream->writeUint16LE(object.objectIconBitmap);
-
- objectDataStream->writeByte(object.xgrid1);
- objectDataStream->writeByte(object.ygrid1);
- objectDataStream->writeByte(object.xgrid2);
- objectDataStream->writeByte(object.ygrid2);
-
- objectDataStream->write(object.walkAreasPatch, 100);
- objectDataStream->write(object.mouseGridPatch, 100);
+ out->writeUint16LE(object.lookAtTextRef);
+ out->writeUint16LE(object.beforeUseTextRef);
+ out->writeUint16LE(object.afterUseTextRef);
+ out->writeUint16LE(object.pickTextRef);
+ out->writeUint16LE(object.useTextRef);
+
+ out->writeByte(object.speaking);
+ out->writeByte(object.openable);
+ out->writeByte(object.closeable);
+
+ out->write(object.used, 8);
+
+ out->writeByte(object.pickupable);
+
+ out->writeUint16LE(object.useWith);
+ out->writeUint16LE(object.replaceWith);
+ out->writeByte(object.depth);
+ out->writeUint32LE(object.bitmapPointer);
+ out->writeUint16LE(object.bitmapSize);
+ out->writeUint16LE(object.rotatingObjectAnimation);
+ out->writeUint16LE(object.rotatingObjectPalette);
+ out->writeUint16LE(object.dropOverlayX);
+ out->writeUint16LE(object.dropOverlayY);
+ out->writeUint32LE(object.dropOverlay);
+ out->writeUint16LE(object.dropOverlaySize);
+ out->writeUint16LE(object.objectIconBitmap);
+
+ out->writeByte(object.xgrid1);
+ out->writeByte(object.ygrid1);
+ out->writeByte(object.xgrid2);
+ out->writeByte(object.ygrid2);
+
+ out->write(object.walkAreasPatch, 100);
+ out->write(object.mouseGridPatch, 100);
}
-void TotEngine::saveObject(ScreenObject object, Common::SeekableWriteStream *stream) {
+void TotEngine::saveObject(ScreenObject object, Common::SeekableWriteStream *out) {
_sceneObjectsData->seek(object.code * kItemRegSize, SEEK_SET);
- saveObjectsData(object, stream);
+ saveObjectsData(object, out);
}
-DoorRegistry readDoorMetadata(Common::SeekableReadStream *screenDataFile) {
+DoorRegistry readDoorMetadata(Common::SeekableReadStream *in) {
DoorRegistry doorMetadata;
- doorMetadata.nextScene = screenDataFile->readUint16LE();
- doorMetadata.exitPosX = screenDataFile->readUint16LE();
- doorMetadata.exitPosY = screenDataFile->readUint16LE();
- doorMetadata.openclosed = screenDataFile->readByte();
- doorMetadata.doorcode = screenDataFile->readByte();
+ doorMetadata.nextScene = in->readUint16LE();
+ doorMetadata.exitPosX = in->readUint16LE();
+ doorMetadata.exitPosY = in->readUint16LE();
+ doorMetadata.openclosed = in->readByte();
+ doorMetadata.doorcode = in->readByte();
return doorMetadata;
}
-Common::Point readPoint(Common::SeekableReadStream *screenDataFile) {
+Common::Point readPoint(Common::SeekableReadStream *in) {
Common::Point point;
- point.x = screenDataFile->readUint16LE();
- point.y = screenDataFile->readUint16LE();
+ point.x = in->readUint16LE();
+ point.y = in->readUint16LE();
return point;
}
-RoomBitmapRegister readAuxBitmaps(Common::SeekableReadStream *screenDataFile) {
+RoomBitmapRegister readAuxBitmaps(Common::SeekableReadStream *in) {
RoomBitmapRegister bitmapMetadata = RoomBitmapRegister();
- bitmapMetadata.bitmapPointer = screenDataFile->readSint32LE();
- bitmapMetadata.bitmapSize = screenDataFile->readUint16LE();
- bitmapMetadata.coordx = screenDataFile->readUint16LE();
- bitmapMetadata.coordy = screenDataFile->readUint16LE();
- bitmapMetadata.depth = screenDataFile->readUint16LE();
+ bitmapMetadata.bitmapPointer = in->readSint32LE();
+ bitmapMetadata.bitmapSize = in->readUint16LE();
+ bitmapMetadata.coordx = in->readUint16LE();
+ bitmapMetadata.coordy = in->readUint16LE();
+ bitmapMetadata.depth = in->readUint16LE();
return bitmapMetadata;
}
-RoomObjectListEntry *readRoomObjects(Common::SeekableReadStream *screenDataFile) {
+RoomObjectListEntry *readRoomObjects(Common::SeekableReadStream *in) {
RoomObjectListEntry *objectMetadata = new RoomObjectListEntry();
- objectMetadata->fileIndex = screenDataFile->readUint16LE();
- objectMetadata->objectName = screenDataFile->readPascalString();
+ objectMetadata->fileIndex = in->readUint16LE();
+ objectMetadata->objectName = in->readPascalString();
- screenDataFile->skip(20 - objectMetadata->objectName.size());
+ in->skip(20 - objectMetadata->objectName.size());
return objectMetadata;
}
-RoomFileRegister *TotEngine::readScreenDataFile(Common::SeekableReadStream *screenDataFile) {
+RoomFileRegister *TotEngine::readScreenDataFile(Common::SeekableReadStream *in) {
RoomFileRegister *screenData = new RoomFileRegister();
- screenData->code = screenDataFile->readUint16LE();
- screenData->roomImagePointer = screenDataFile->readUint32LE();
- screenData->roomImageSize = screenDataFile->readUint16LE();
- screenDataFile->read(screenData->walkAreasGrid, 40 * 28);
- screenDataFile->read(screenData->mouseGrid, 40 * 28);
+ screenData->code = in->readUint16LE();
+ screenData->roomImagePointer = in->readUint32LE();
+ screenData->roomImageSize = in->readUint16LE();
+ in->read(screenData->walkAreasGrid, 40 * 28);
+ in->read(screenData->mouseGrid, 40 * 28);
for (int i = 0; i < 9; i++) {
for (int j = 0; j < 30; j++) {
for (int k = 0; k < 5; k++) {
- screenData->trajectories[i][j][k] = readPoint(screenDataFile);
+ screenData->trajectories[i][j][k] = readPoint(in);
}
}
}
for (int i = 0; i < 5; i++) {
- screenData->doors[i] = readDoorMetadata(screenDataFile);
+ screenData->doors[i] = readDoorMetadata(in);
}
for (int i = 0; i < 15; i++) {
- screenData->screenLayers[i] = readAuxBitmaps(screenDataFile);
+ screenData->screenLayers[i] = readAuxBitmaps(in);
}
for (int i = 0; i < 51; i++) {
- screenData->screenObjectIndex[i] = readRoomObjects(screenDataFile);
+ screenData->screenObjectIndex[i] = readRoomObjects(in);
}
- screenData->animationFlag = screenDataFile->readByte();
- screenData->animationName = screenDataFile->readPascalString();
- screenDataFile->skip(8 - screenData->animationName.size());
- screenData->paletteAnimationFlag = screenDataFile->readByte();
- screenData->palettePointer = screenDataFile->readUint16LE();
+ screenData->animationFlag = in->readByte();
+ screenData->animationName = in->readPascalString();
+ in->skip(8 - screenData->animationName.size());
+ screenData->paletteAnimationFlag = in->readByte();
+ screenData->palettePointer = in->readUint16LE();
for (int i = 0; i < 300; i++) {
- screenData->secondaryAnimTrajectory[i] = readPoint(screenDataFile);
+ screenData->secondaryAnimTrajectory[i] = readPoint(in);
}
- screenDataFile->read(screenData->secondaryAnimDirections, 600);
- screenData->secondaryTrajectoryLength = screenDataFile->readUint16LE();
+ in->read(screenData->secondaryAnimDirections, 600);
+ screenData->secondaryTrajectoryLength = in->readUint16LE();
return screenData;
}
diff --git a/engines/tot/saveload.cpp b/engines/tot/saveload.cpp
index 08dd5eadffe..1f8d35c0e3a 100644
--- a/engines/tot/saveload.cpp
+++ b/engines/tot/saveload.cpp
@@ -231,7 +231,6 @@ Common::Error TotEngine::syncGame(Common::Serializer &s) {
Common::Error result;
if (s.isLoading()) {
- debug("Loading game!!");
SavedGame loadedGame;
// Means we are loading from before the game has started
// if(rooms == nullptr) {
diff --git a/engines/tot/sound.cpp b/engines/tot/sound.cpp
index 8792edf0428..82620ff34f2 100644
--- a/engines/tot/sound.cpp
+++ b/engines/tot/sound.cpp
@@ -47,6 +47,7 @@ SoundManager::SoundManager(Audio::Mixer *mixer) : _mixer(mixer) {
_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, 100);
_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, 100);
}
+
SoundManager::~SoundManager() {
if (_midiPlayer)
delete _midiPlayer;
@@ -105,9 +106,12 @@ void SoundManager::stopVoc() {
}
void SoundManager::waitForSoundEnd() {
+ Common::Event e;
do {
+ while (g_system->getEventManager()->pollEvent(e)) { }
g_engine->_chrono->updateChrono();
g_engine->_screen->update();
+ g_system->delayMillis(10);
} while (g_engine->_sound->isVocPlaying());
}
diff --git a/engines/tot/tot.cpp b/engines/tot/tot.cpp
index 62bf6f7f31d..8277573d788 100644
--- a/engines/tot/tot.cpp
+++ b/engines/tot/tot.cpp
@@ -1137,60 +1137,17 @@ void TotEngine::resetGameState() {
_targetZone = 1;
_oldTargetZone = 0;
_charFacingDirection = 1;
- _firstTimeTopicA[0] = true;
- _firstTimeTopicA[1] = true;
- _firstTimeTopicA[2] = true;
- _firstTimeTopicA[3] = true;
- _firstTimeTopicA[4] = true;
- _firstTimeTopicA[5] = true;
- _firstTimeTopicA[6] = true;
- _firstTimeTopicA[7] = true;
- _firstTimeTopicA[8] = true;
- _firstTimeTopicB[0] = false;
- _firstTimeTopicB[1] = false;
- _firstTimeTopicB[2] = false;
- _firstTimeTopicB[3] = false;
- _firstTimeTopicB[4] = false;
- _firstTimeTopicB[5] = false;
- _firstTimeTopicB[6] = false;
- _firstTimeTopicB[7] = false;
- _firstTimeTopicB[8] = false;
-
- _firstTimeTopicC[0] = false;
- _firstTimeTopicC[1] = false;
- _firstTimeTopicC[2] = false;
- _firstTimeTopicC[3] = false;
- _firstTimeTopicC[4] = false;
- _firstTimeTopicC[5] = false;
- _firstTimeTopicC[6] = false;
- _firstTimeTopicC[7] = false;
- _firstTimeTopicC[8] = false;
-
- _bookTopic[0] = false;
- _bookTopic[1] = false;
- _bookTopic[2] = false;
- _bookTopic[3] = false;
- _bookTopic[4] = false;
- _bookTopic[5] = false;
- _bookTopic[6] = false;
- _bookTopic[7] = false;
- _bookTopic[8] = false;
-
- _mintTopic[0] = false;
- _mintTopic[1] = false;
- _mintTopic[2] = false;
- _mintTopic[3] = false;
- _mintTopic[4] = false;
- _mintTopic[5] = false;
- _mintTopic[6] = false;
- _mintTopic[7] = false;
- _mintTopic[8] = false;
-
- _caves[0] = false;
- _caves[1] = false;
- _caves[2] = false;
- _caves[3] = false;
- _caves[4] = false;
+ for (int i = 0; i < 9; i++) {
+ _firstTimeTopicA[i] = true;
+ _firstTimeTopicB[i] = false;
+ _firstTimeTopicC[i] = false;
+ _bookTopic[i] = false;
+ _mintTopic[i] = false;
+ }
+
+ for (int i = 0; i < 5; i++) {
+ _caves[i] = false;
+ }
_isSecondaryAnimationEnabled = false;
_mainCharAnimation.depth = 0;
@@ -1298,35 +1255,35 @@ void TotEngine::initVars() {
}
void TotEngine::clearVars() {
- if(_sceneBackground != nullptr) {
+ if (_sceneBackground != nullptr) {
free(_sceneBackground);
}
- if(_backgroundCopy != nullptr) {
+ if (_backgroundCopy != nullptr) {
free(_backgroundCopy);
}
- if(_conversationData != nullptr) {
+ if (_conversationData != nullptr) {
free(_conversationData);
}
- if(_rooms != nullptr) {
+ if (_rooms != nullptr) {
free(_rooms);
}
- if(_sceneObjectsData != nullptr) {
+ if (_sceneObjectsData != nullptr) {
free(_sceneObjectsData);
}
- for(int i = 0; i < kNumScreenOverlays; i++) {
- if(_screenLayers[i] != nullptr) {
+ for (int i = 0; i < kNumScreenOverlays; i++) {
+ if (_screenLayers[i] != nullptr) {
free(_screenLayers[i]);
}
}
- for(int i = 0; i < kInventoryIconCount; i++) {
- if(_inventoryIconBitmaps[i] != nullptr) {
+ for (int i = 0; i < kInventoryIconCount; i++) {
+ if (_inventoryIconBitmaps[i] != nullptr) {
free(_inventoryIconBitmaps[i]);
}
}
- for(int i = 0; i < 4; i++) {
- for(int j = 0; j < kWalkFrameCount + 30; j++) {
- if(_mainCharAnimation.bitmap[i][j] != nullptr) {
+ for (int i = 0; i < 4; i++) {
+ for (int j = 0; j < kWalkFrameCount + 30; j++) {
+ if (_mainCharAnimation.bitmap[i][j] != nullptr) {
free(_mainCharAnimation.bitmap[i][j]);
}
}
@@ -1334,7 +1291,7 @@ void TotEngine::clearVars() {
for (int i = 0; i < _secondaryAnimDirCount; i++) {
for (int j = 0; j < _secondaryAnimationFrameCount; j++) {
- if(_secondaryAnimation.bitmap[i][j] != nullptr){
+ if (_secondaryAnimation.bitmap[i][j] != nullptr) {
free(_secondaryAnimation.bitmap[i][j]);
}
}
diff --git a/engines/tot/tot.h b/engines/tot/tot.h
index d9319b0bedb..899d78471fb 100644
--- a/engines/tot/tot.h
+++ b/engines/tot/tot.h
@@ -59,7 +59,7 @@ private:
* loading and saving using a single method
*/
Common::Error syncGame(Common::Serializer &s);
- //rout 1
+
int engineStart();
int startGame();
void newGame();
@@ -100,7 +100,6 @@ private:
void readConversationFile();
- //Rout2
void adjustKey();
void adjustKey2();
void animateBat();
diff --git a/engines/tot/types.h b/engines/tot/types.h
index 23ccc3d8664..b0d42270429 100644
--- a/engines/tot/types.h
+++ b/engines/tot/types.h
@@ -277,7 +277,7 @@ struct SavedGame {
uint niche[2][4];
};
-typedef byte palette[768];
+typedef byte Palette[768];
} // End of namespace Tot
diff --git a/engines/tot/util.cpp b/engines/tot/util.cpp
index 449a243c716..57327ed1105 100644
--- a/engines/tot/util.cpp
+++ b/engines/tot/util.cpp
@@ -1,4 +1,23 @@
-
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
#include "common/textconsole.h"
#include "graphics/paletteman.h"
@@ -391,7 +410,7 @@ void littText(int x, int y, const Common::String &text, byte color, Graphics::Te
littText(x, y, text.c_str(), color, align);
}
-void littText(int x, int y, char const *text, byte color, Graphics::TextAlign align) {
+void littText(int x, int y, const char *text, byte color, Graphics::TextAlign align) {
bool yAligned = (align == Graphics::kTextAlignCenter) ? true : false;
x = (align == Graphics::kTextAlignCenter) ? 0 : x;
y = y + 2;
@@ -402,7 +421,7 @@ void euroText(int x, int y, const Common::String &text, byte color, Graphics::Te
euroText(x, y, text.c_str(), color, align);
}
-void euroText(int x, int y, char const *text, byte color, Graphics::TextAlign align) {
+void euroText(int x, int y, const char *text, byte color, Graphics::TextAlign align) {
bool yAligned = (align == Graphics::kTextAlignCenter) ? true : false;
x = (align == Graphics::kTextAlignCenter) ? 0 : x;
y = y + 2;
@@ -471,13 +490,13 @@ void emptyLoop2() {
}
void waitForKey() {
- bool teclapulsada = false;
+ bool waitForKey = false;
Common::Event e;
debug("Waiting for key!");
- while (!teclapulsada && !g_engine->shouldQuit()) {
+ while (!waitForKey && !g_engine->shouldQuit()) {
while (g_system->getEventManager()->pollEvent(e)) {
if (e.type == Common::EVENT_KEYDOWN) {
- teclapulsada = true;
+ waitForKey = true;
}
}
diff --git a/engines/tot/util.h b/engines/tot/util.h
index 7f9f1b6e311..fdcc3e5e787 100644
--- a/engines/tot/util.h
+++ b/engines/tot/util.h
@@ -1,3 +1,23 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
#ifndef TOT_UTIL_H
#define TOT_UTIL_H
@@ -24,10 +44,10 @@ int engine_start();
void setRGBPalette(int color, int r, int g, int b);
void littText(int x, int y, const Common::String &text, byte color, Graphics::TextAlign align = Graphics::kTextAlignStart);
-void littText(int x, int y, char const *text, byte color, Graphics::TextAlign align = Graphics::kTextAlignStart);
+void littText(int x, int y, const char *text, byte color, Graphics::TextAlign align = Graphics::kTextAlignStart);
void euroText(int x, int y, const Common::String &text, byte color, Graphics::TextAlign align = Graphics::kTextAlignStart);
-void euroText(int x, int y, char const *text, byte color, Graphics::TextAlign align = Graphics::kTextAlignStart);
+void euroText(int x, int y, const char *text, byte color, Graphics::TextAlign align = Graphics::kTextAlignStart);
void biosText(int x, int y, const Common::String &text, byte color);
Commit: 24980a2bef70046fd9498466c660f47ccdc00f51
https://github.com/scummvm/scummvm/commit/24980a2bef70046fd9498466c660f47ccdc00f51
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:54+02:00
Commit Message:
TOT: Add engine credits
Changed paths:
engines/tot/credits.pl
diff --git a/engines/tot/credits.pl b/engines/tot/credits.pl
index e9c0c47ab04..588a5925253 100644
--- a/engines/tot/credits.pl
+++ b/engines/tot/credits.pl
@@ -1,3 +1,3 @@
begin_section("Tot");
- add_person("Name 1", "Handle 1", "");
+ add_person("Gabriel SanmartÃn", "kelmer", "");
end_section();
Commit: ccd40000a83bfd5c251ae199fb4c8fa326750ad8
https://github.com/scummvm/scummvm/commit/ccd40000a83bfd5c251ae199fb4c8fa326750ad8
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:54+02:00
Commit Message:
TOT: Properly initialize resource pointers
Changed paths:
engines/tot/tot.h
diff --git a/engines/tot/tot.h b/engines/tot/tot.h
index 899d78471fb..a374eaac148 100644
--- a/engines/tot/tot.h
+++ b/engines/tot/tot.h
@@ -184,9 +184,9 @@ public:
Common::Language _lang = Common::ES_ESP;
- Common::MemorySeekableReadWriteStream *_conversationData;
- Common::MemorySeekableReadWriteStream *_rooms;
- Common::MemorySeekableReadWriteStream *_sceneObjectsData;
+ Common::MemorySeekableReadWriteStream *_conversationData = nullptr;
+ Common::MemorySeekableReadWriteStream *_rooms = nullptr;
+ Common::MemorySeekableReadWriteStream *_sceneObjectsData = nullptr;
bool _roomChange = false;
bool _isTVOn = false;
Commit: 8b0ee82daa61a123b86fa8e94c08a329c80a20a1
https://github.com/scummvm/scummvm/commit/8b0ee82daa61a123b86fa8e94c08a329c80a20a1
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:54+02:00
Commit Message:
GRAPHICS: FONTS: Add support for Borland BGI fonts
Changed paths:
A graphics/fonts/bgifont.cpp
A graphics/fonts/bgifont.h
graphics/module.mk
diff --git a/graphics/fonts/bgifont.cpp b/graphics/fonts/bgifont.cpp
new file mode 100644
index 00000000000..e91c4fb8010
--- /dev/null
+++ b/graphics/fonts/bgifont.cpp
@@ -0,0 +1,205 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "graphics/fonts/bgifont.h"
+
+namespace Graphics {
+
+BgiFont::BgiFont() {
+}
+
+BgiFont::~BgiFont() {
+}
+
+bool BgiFont::loadChr(const Common::Path &fileName) {
+
+ Common::File fontFile;
+ if (!fontFile.open(fileName)) {
+ error("unable to load font file %s", fileName.toString().c_str());
+ }
+ return loadChr(fontFile);
+}
+
+bool BgiFont::loadChr(Common::SeekableReadStream &stream) {
+ /* fileSignature = */ stream.readUint16LE();
+ /*
+ Description until finding value 0x1A
+ */
+ Common::String description = stream.readString(0x1A);
+ uint16 headerSize = stream.readUint16LE();
+ Common::String name = stream.readString(0, 4);
+ /*uint16 fontSize = */ stream.readUint16LE();
+ /* byte majorVersion = */ stream.readByte();
+ /* byte minorVersion = */ stream.readByte();
+ /* byte majorRevision = */ stream.readByte();
+ /* byte minorRevision = */ stream.readByte();
+
+ int remainingBytes = headerSize - (description.size() + 1 + 14);
+ stream.seek(remainingBytes, SEEK_CUR);
+
+ /* char signature = */ stream.readByte();
+ _charCount = stream.readUint16LE();
+ // undefined byte
+ stream.skip(1);
+
+ _firstChar = stream.readByte();
+ /* uint16 strokeOffset = */ stream.readUint16LE();
+ /*byte scanFlag = */ stream.readByte();
+
+ // Distance from the origin to the font's highest point
+ _originToAscender = stream.readByte();
+ // Distance from the origin to the font's baseline (typically 0). Ignored.
+ /*signed char originToBaseline = */ stream.readByte();
+ // Distance from the origin to the font's lowest point.
+ _originToDescender = stream.readByte();
+ /**
+ * ----------- originToAscender
+ *
+ *
+ *
+ * ----------- 0
+ *
+ * ----------- originToDescender
+ * totalHeight is the distance between originToAscender and originToDescender plus 1 (the baseline or the zero)
+ */
+ _totalHeight = (_originToAscender - _originToDescender) + 1;
+ // Unused bytes
+ stream.skip(5);
+
+ _glyphs = new GlyphEntry[_charCount];
+
+ // Glyph offsets
+ for (int i = 0; i < _charCount; i++) {
+ _glyphs[i].offset = stream.readUint16LE();
+ }
+ _maxWidth = 0;
+ // Glyph widths
+ for (int i = 0; i < _charCount; i++) {
+ _glyphs[i].charWidth = stream.readByte();
+ if (_maxWidth < _glyphs[i].charWidth)
+ _maxWidth = _glyphs[i].charWidth;
+ }
+ int64 pos = stream.pos();
+
+ // Read drawing instructions until next glyph definition
+ for (int i = 0; i < _charCount; i++) {
+ _totalWidth += _glyphs[i].charWidth;
+ stream.seek(pos + _glyphs[i].offset, SEEK_SET);
+ int m;
+ do {
+ DrawingInstruction *inst = new DrawingInstruction();
+ byte instructionX = stream.readByte();
+ byte instructionY = stream.readByte();
+ // Grabs the most significant bit which is the opcode
+ m = instructionX >> 7 & 0x1;
+ m += m + (instructionY >> 7 & 0x1);
+ instructionX = fixSign(instructionX);
+ instructionY = fixSign(instructionY);
+
+ inst->opCode = m;
+ inst->xCoord = instructionX;
+ inst->yCoord = instructionY;
+ _glyphs[i].insts.push_back(inst);
+
+ } while (m);
+ }
+ _fontCache.push_back(drawCachedFont(1));
+ return false;
+}
+
+byte Graphics::BgiFont::fixSign(byte original) {
+ // If negative shifts the sign bit to the right position
+ return (original & 0x7F) | ((original & 0x40) << 1);
+}
+
+BgiFont::CachedFont *BgiFont::drawCachedFont(int size) {
+ CachedFont *cachedFont = new CachedFont();
+ Graphics::Surface *surface = new Graphics::Surface();
+ surface->create(_totalWidth, _totalHeight, Graphics::PixelFormat::createFormatCLUT8());
+ uint32 offsetCount = 0;
+ for (int i = 0; i < _charCount; i++) {
+
+ int curPosX = offsetCount;
+ int curPosY = 0;
+ cachedFont->offsets[i] = offsetCount;
+ cachedFont->widths[i] = _glyphs[i].charWidth;
+
+ for (int j = 0; j < _glyphs[i].insts.size(); j++) {
+ int opCode = _glyphs[i].insts[j]->opCode;
+ // Need to normalize Y coord because the stroke instructions start at origin and extend upwards up to originAscender, downwards to originToDescender
+ int adjustedY = _originToAscender - _glyphs[i].insts[j]->yCoord;
+
+ switch (opCode) {
+ case OPCODE_END:
+ break;
+ case OPCODE_MOVE:
+ break;
+ case OPCODE_DRAW:
+ surface->drawLine(
+ curPosX,
+ curPosY,
+ offsetCount + _glyphs[i].insts[j]->xCoord,
+ adjustedY,
+ 255);
+ break;
+ default:
+ /* nothing to do */
+ break;
+ };
+ curPosX = offsetCount + _glyphs[i].insts[j]->xCoord;
+ curPosY = adjustedY;
+ }
+ offsetCount += _glyphs[i].charWidth;
+ }
+
+ cachedFont->surface = surface;
+ return cachedFont;
+}
+
+void Graphics::BgiFont::close() {
+}
+
+int BgiFont::getCharWidth(uint32 chr) const {
+ return _glyphs[characterToIndex(chr)].charWidth;
+}
+
+void BgiFont::drawChar(Surface *dst, uint32 chr, int x, int y, uint32 color) const {
+ CachedFont *font = _fontCache[0];
+ uint16 charIndex = characterToIndex(chr);
+ int charWidth = font->widths[charIndex];
+
+ for (uint16 i = 0; i < _totalHeight; i++) {
+ for (uint16 j = 0; j < charWidth; j++) {
+ if (font->surface->getPixel(font->offsets[charIndex] + j, i)) {
+ *((byte *)dst->getBasePtr(x + j, y + i)) = color;
+ }
+ }
+ }
+}
+
+uint16 BgiFont::characterToIndex(uint32 character) const {
+ if (character - _firstChar >= 0 && character - _firstChar < _charCount) {
+ return character - _firstChar;
+ } else
+ return _firstChar;
+}
+
+} // End of namespace Graphics
diff --git a/graphics/fonts/bgifont.h b/graphics/fonts/bgifont.h
new file mode 100644
index 00000000000..54b23917cdd
--- /dev/null
+++ b/graphics/fonts/bgifont.h
@@ -0,0 +1,93 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+#ifndef GRAPHICS_FONTS_BGIFONT_H
+#define GRAPHICS_FONTS_BGIFONT_H
+
+#include "common/file.h"
+#include "common/std/vector.h"
+#include "graphics/font.h"
+#include "graphics/surface.h"
+
+namespace Graphics {
+
+const int OPCODE_END = 0;
+const int OPCODE_DOSCAN = 1;
+const int OPCODE_MOVE = 2;
+const int OPCODE_DRAW = 3;
+
+class BgiFont : public Font {
+public:
+ BgiFont();
+ ~BgiFont();
+
+ bool loadChr(const Common::Path &fileName);
+ bool loadChr(Common::SeekableReadStream &stream);
+
+ void close();
+
+ int getFontHeight() const { return _totalHeight; }
+ int getCharWidth(uint32 chr) const;
+ int getMaxCharWidth() const { return _maxWidth; }
+ void drawChar(Surface *dst, uint32 chr, int x, int y, uint32 color) const;
+
+private:
+ struct DrawingInstruction {
+ int opCode;
+ int8 xCoord;
+ int8 yCoord;
+ };
+
+ struct GlyphEntry {
+ GlyphEntry() {
+ charWidth = 0;
+ offset = 0;
+ }
+ ~GlyphEntry() {}
+
+ uint16 charWidth;
+ uint32 offset;
+ Common::Array<DrawingInstruction *> insts;
+ } *_glyphs;
+
+ struct CachedFont {
+ int widths[256];
+ int offsets[256];
+ Graphics::Surface *surface;
+ };
+
+ uint16 _charCount;
+ byte _firstChar;
+ // uint16 _pixHeight;
+ uint16 _maxWidth = 10;
+ uint32 _totalWidth = 0;
+ int16 _totalHeight = 0;
+ int8 _originToAscender = 0;
+ int8 _originToDescender = 0;
+ Common::Array<CachedFont *> _fontCache;
+
+ uint16 characterToIndex(uint32 character) const;
+ byte fixSign(byte original);
+ CachedFont *drawCachedFont(int size);
+};
+
+} // namespace Graphics
+
+#endif
diff --git a/graphics/module.mk b/graphics/module.mk
index 2339657e181..4d50d112724 100644
--- a/graphics/module.mk
+++ b/graphics/module.mk
@@ -13,6 +13,7 @@ MODULE_OBJS := \
fontman.o \
fonts/amigafont.o \
fonts/bdf.o \
+ fonts/bgifont.o \
fonts/consolefont.o \
fonts/dosfont.o \
fonts/freetype.o \
Commit: 107abe913836180898f7142b7f24a34b0465b9a4
https://github.com/scummvm/scummvm/commit/107abe913836180898f7142b7f24a34b0465b9a4
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:54+02:00
Commit Message:
TOT: Switch to BGI to graphics/fonts
Changed paths:
engines/tot/graphics.h
engines/tot/module.mk
diff --git a/engines/tot/graphics.h b/engines/tot/graphics.h
index 2bca5d3dd8b..9692b4a02ef 100644
--- a/engines/tot/graphics.h
+++ b/engines/tot/graphics.h
@@ -25,13 +25,10 @@
#include "common/system.h"
#include "graphics/font.h"
-#include "tot/font/bgifont.h"
-// #include "tot/font/biosfont.h"
-// #include "tot/vars.h"
+#include "graphics/fonts/bgifont.h"
namespace Tot {
-
const int kTextAreaSize = 320 * 70 + 4;
class GraphicsManager {
diff --git a/engines/tot/module.mk b/engines/tot/module.mk
index a2d1125918d..c2a86cb802f 100644
--- a/engines/tot/module.mk
+++ b/engines/tot/module.mk
@@ -2,7 +2,6 @@ MODULE := engines/tot
MODULE_OBJS = \
decoder/TotFlicDecoder.o \
- font/bgifont.o \
font/biosfont.o \
anims.o \
chrono.o \
Commit: 2c1ccc22c3242cbe67974e3d9212bba1e5165039
https://github.com/scummvm/scummvm/commit/2c1ccc22c3242cbe67974e3d9212bba1e5165039
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:54+02:00
Commit Message:
GRAPHICS: FONTS: Adds DosFont as a Renderable font
Changed paths:
graphics/fonts/dosfont.cpp
graphics/fonts/dosfont.h
diff --git a/graphics/fonts/dosfont.cpp b/graphics/fonts/dosfont.cpp
index a0bce224a5b..771a8fc1e2e 100644
--- a/graphics/fonts/dosfont.cpp
+++ b/graphics/fonts/dosfont.cpp
@@ -20,8 +20,41 @@
*/
#include "graphics/fonts/dosfont.h"
+#include "graphics/surface.h"
namespace Graphics {
+
+DosFont::DosFont() {}
+
+int DosFont::getFontHeight() const {
+ return 8;
+}
+
+int DosFont::getMaxCharWidth() const {
+ return 8;
+}
+
+int DosFont::getCharWidth(uint32 chr) const {
+ return 8;
+}
+
+void DosFont::drawChar(Graphics::Surface *dst, uint32 chr, int x, int y, uint32 color) const {
+ byte *ptr = (byte *)dst->getBasePtr(x, y);
+ int srcPixel = chr * 8;
+ for (int sy = 0; sy < 8; sy++) {
+ for (int sx = 0; sx < 8; sx++) {
+ if (Graphics::DosFont::fontData_PCBIOS[srcPixel] & 1 << (7 - sx)) {
+ *ptr = color;
+ }
+ ptr++;
+ }
+ srcPixel++;
+ ptr -= 8;
+ ptr += (dst->pitch);
+ }
+}
+
+
// 8x8 font patterns
// this is basically the standard PC BIOS font, taken from Dos-Box, with a few modifications
diff --git a/graphics/fonts/dosfont.h b/graphics/fonts/dosfont.h
index f10cc7555a6..75474ae84b3 100644
--- a/graphics/fonts/dosfont.h
+++ b/graphics/fonts/dosfont.h
@@ -27,7 +27,14 @@
namespace Graphics {
// For now just a holder for static data. May become a child of Font if needed.
-class DosFont {
+class DosFont : public Graphics::Font {
+public:
+ DosFont();
+
+ int getFontHeight() const override;
+ int getMaxCharWidth() const override;
+ int getCharWidth(uint32 chr) const override;
+ void drawChar(Graphics::Surface *dst, uint32 chr, int x, int y, uint32 color) const override;
public:
// 8x8 font patterns
Commit: 22fe69465ac9b994aa7f1a902f4ecf673b5c81c3
https://github.com/scummvm/scummvm/commit/22fe69465ac9b994aa7f1a902f4ecf673b5c81c3
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:55+02:00
Commit Message:
TOT: Switch DosFont to fonts/dosfont
Changed paths:
R engines/tot/font/biosfont.cpp
R engines/tot/font/biosfont.h
engines/tot/graphics.cpp
engines/tot/graphics.h
engines/tot/module.mk
diff --git a/engines/tot/font/biosfont.cpp b/engines/tot/font/biosfont.cpp
deleted file mode 100644
index 771a13bf16f..00000000000
--- a/engines/tot/font/biosfont.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "graphics/fonts/dosfont.h"
-#include "graphics/surface.h"
-
-#include "tot/font/biosfont.h"
-#include "tot/tot.h"
-
-namespace Tot {
-
-BiosFont::BiosFont() {}
-
-int BiosFont::getFontHeight() const {
- return 8;
-}
-
-int BiosFont::getMaxCharWidth() const {
- return 8;
-}
-
-int BiosFont::getCharWidth(uint32 chr) const {
- return 8;
-}
-
-void BiosFont::drawChar(Graphics::Surface *dst, uint32 chr, int x, int y, uint32 color) const {
- drawBiosFontGlyph(chr, x, y, color);
-}
-
-void BiosFont::drawBiosFontGlyph(uint8 chr, int x, int y, uint8 color) const {
- byte *ptr = (byte *)g_engine->_screen->getBasePtr(x, y);
- int srcPixel = chr * 8;
- for (int sy = 0; sy < 8; sy++) {
- for (int sx = 0; sx < 8; sx++) {
- if (Graphics::DosFont::fontData_PCBIOS[srcPixel] & 1 << (7 - sx)) {
- *ptr = color;
- }
- ptr++;
- }
- srcPixel++;
- ptr -= 8;
- ptr += (g_engine->_screen->pitch);
- }
-}
-
-} // namespace Tot
diff --git a/engines/tot/font/biosfont.h b/engines/tot/font/biosfont.h
deleted file mode 100644
index a073fbbd643..00000000000
--- a/engines/tot/font/biosfont.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef TOT_BIOSFONT_H
-#define TOT_BIOSFONT_H
-
-#include "graphics/big5.h"
-#include "graphics/font.h"
-#include "graphics/surface.h"
-
-namespace Tot {
-
-class BiosFont : public Graphics::Font {
-public:
- BiosFont();
-
- int getFontHeight() const override;
- int getMaxCharWidth() const override;
- int getCharWidth(uint32 chr) const override;
- void drawChar(Graphics::Surface *dst, uint32 chr, int x, int y, uint32 color) const override;
-
-private:
- void drawBiosFontGlyph(uint8 chr, int x, int y, uint8 color) const;
-};
-
-} // End of namespace Tot
-
-#endif // TOT_BIG5FONT_H
diff --git a/engines/tot/graphics.cpp b/engines/tot/graphics.cpp
index 144f8a49293..80130181269 100644
--- a/engines/tot/graphics.cpp
+++ b/engines/tot/graphics.cpp
@@ -20,12 +20,9 @@
*/
#include "common/config-manager.h"
-#include "common/debug.h"
-#include "common/system.h"
-#include "graphics/font.h"
+#include "graphics/fonts/dosfont.h"
#include "graphics/paletteman.h"
-#include "tot/font/biosfont.h"
#include "tot/graphics.h"
#include "tot/statics.h"
#include "tot/tot.h"
@@ -57,11 +54,11 @@ GraphicsManager::GraphicsManager() {
}
_euro.loadChr(exeFile);
exeFile.close();
- _bios = new BiosFont();
+ _dosFont = new Graphics::DosFont();
}
GraphicsManager::~GraphicsManager() {
- delete (_bios);
+ delete (_dosFont);
}
void GraphicsManager::restoreBackgroundArea(uint x, uint y, uint x2, uint y2) {
@@ -448,7 +445,7 @@ void GraphicsManager::euroText(const Common::String &str, int x, int y, uint32 c
}
void GraphicsManager::biosText(const Common::String &str, int x, int y, uint32 color) {
- _bios->drawString(g_engine->_screen, str, x, y, 320, color, Graphics::TextAlign::kTextAlignLeft);
+ _dosFont->drawString(g_engine->_screen, str, x, y, 320, color, Graphics::TextAlign::kTextAlignLeft);
}
void GraphicsManager::drawFullScreen(byte *screen) {
diff --git a/engines/tot/graphics.h b/engines/tot/graphics.h
index 9692b4a02ef..5cc324d14ba 100644
--- a/engines/tot/graphics.h
+++ b/engines/tot/graphics.h
@@ -105,7 +105,7 @@ private:
signed char fadeData[256][256];
Graphics::BgiFont _litt;
Graphics::BgiFont _euro;
- Graphics::Font *_bios;
+ Graphics::Font *_dosFont;
};
} // End of namespace Tot
diff --git a/engines/tot/module.mk b/engines/tot/module.mk
index c2a86cb802f..0400b425d08 100644
--- a/engines/tot/module.mk
+++ b/engines/tot/module.mk
@@ -1,13 +1,12 @@
MODULE := engines/tot
MODULE_OBJS = \
- decoder/TotFlicDecoder.o \
- font/biosfont.o \
anims.o \
chrono.o \
console.o \
cutscenes.o \
debug.o \
+ decoder/TotFlicDecoder.o \
dialog.o \
engine.o \
forest.o \
Commit: 4f46c115d0291ed60f0ccdfec07de23c7cd863e8
https://github.com/scummvm/scummvm/commit/4f46c115d0291ed60f0ccdfec07de23c7cd863e8
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:55+02:00
Commit Message:
TOT: Turns all fonts into pointers
Changed paths:
engines/tot/graphics.cpp
engines/tot/graphics.h
diff --git a/engines/tot/graphics.cpp b/engines/tot/graphics.cpp
index 80130181269..a4ab916c9cf 100644
--- a/engines/tot/graphics.cpp
+++ b/engines/tot/graphics.cpp
@@ -46,19 +46,23 @@ GraphicsManager::GraphicsManager() {
} else {
exeFile.seek(FONT_LITT_OFFSET_EN);
}
- _litt.loadChr(exeFile);
+ _litt = new Graphics::BgiFont();
+ _litt->loadChr(exeFile);
if (isLanguageSpanish()) {
exeFile.seek(FONT_EURO_OFFSET_ES);
} else {
exeFile.seek(FONT_EURO_OFFSET_EN);
}
- _euro.loadChr(exeFile);
+ _euro = new Graphics::BgiFont();
+ _euro->loadChr(exeFile);
exeFile.close();
_dosFont = new Graphics::DosFont();
}
GraphicsManager::~GraphicsManager() {
delete (_dosFont);
+ delete (_litt);
+ delete (_euro);
}
void GraphicsManager::restoreBackgroundArea(uint x, uint y, uint x2, uint y2) {
@@ -432,16 +436,16 @@ void GraphicsManager::putImageArea(uint putcoordx, uint putcoordy, byte *backgro
void GraphicsManager::littText(const Common::String &str, int x, int y, uint32 color, Graphics::TextAlign align, bool alignCenterY) {
if (alignCenterY) {
- y = y - _euro.getFontHeight() / 2 + 2;
+ y = y - _litt->getFontHeight() / 2 + 2;
}
- _litt.drawString(g_engine->_screen, str, x, y, 320, color, align);
+ _litt->drawString(g_engine->_screen, str, x, y, 320, color, align);
}
void GraphicsManager::euroText(const Common::String &str, int x, int y, uint32 color, Graphics::TextAlign align, bool alignCenterY) {
if (alignCenterY) {
- y = y - _euro.getFontHeight() / 2;
+ y = y - _euro->getFontHeight() / 2;
}
- _euro.drawString(g_engine->_screen, str, x, y, 320, color, align);
+ _euro->drawString(g_engine->_screen, str, x, y, 320, color, align);
}
void GraphicsManager::biosText(const Common::String &str, int x, int y, uint32 color) {
diff --git a/engines/tot/graphics.h b/engines/tot/graphics.h
index 5cc324d14ba..8759ad3870c 100644
--- a/engines/tot/graphics.h
+++ b/engines/tot/graphics.h
@@ -103,8 +103,8 @@ public:
byte *_textAreaBackground = (byte *)malloc(kTextAreaSize);
private:
signed char fadeData[256][256];
- Graphics::BgiFont _litt;
- Graphics::BgiFont _euro;
+ Graphics::BgiFont *_litt;
+ Graphics::BgiFont *_euro;
Graphics::Font *_dosFont;
};
Commit: 8c325d03a924ca8a32c3d24616394ef7ce2c4cb7
https://github.com/scummvm/scummvm/commit/8c325d03a924ca8a32c3d24616394ef7ce2c4cb7
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:55+02:00
Commit Message:
TOT: Move save/load into the right file
Changed paths:
engines/tot/engine.cpp
engines/tot/saveload.cpp
diff --git a/engines/tot/engine.cpp b/engines/tot/engine.cpp
index f0b9ef37d80..956492c5010 100644
--- a/engines/tot/engine.cpp
+++ b/engines/tot/engine.cpp
@@ -3820,290 +3820,6 @@ void TotEngine::loadScrollData(uint roomCode, bool rightScroll, uint horizontalP
_trajectory[_currentTrajectoryIndex].y = _characterPosY;
}
-void TotEngine::saveGameToRegister() {
- _savedGame.roomCode = _currentRoomData->code;
- _savedGame.trajectoryLength = _trajectoryLength;
- _savedGame.currentTrajectoryIndex = _currentTrajectoryIndex;
- _savedGame.backpackObjectCode = _backpackObjectCode;
- _savedGame.rightSfxVol = _sound->_rightSfxVol;
- _savedGame.leftSfxVol = _sound->_leftSfxVol;
- _savedGame.musicVolRight = _sound->_musicVolRight;
- _savedGame.musicVolLeft = _sound->_musicVolLeft;
- _savedGame.oldGridX = _oldGridX;
- _savedGame.oldGridY = _oldGridY;
- _savedGame.secAnimDepth = _secondaryAnimation.depth;
- _savedGame.secAnimDir = _secondaryAnimation.dir;
- _savedGame.secAnimX = _secondaryAnimation.posx;
- _savedGame.secAnimY = _secondaryAnimation.posy;
- _savedGame.secAnimIFrame = _iframe2;
-
- _savedGame.currentZone = _currentZone;
- _savedGame.targetZone = _targetZone;
- _savedGame.oldTargetZone = _oldTargetZone;
- _savedGame.inventoryPosition = _inventoryPosition;
- _savedGame.actionCode = _actionCode;
- _savedGame.oldActionCode = _oldActionCode;
- _savedGame.steps = _trajectorySteps;
- _savedGame.doorIndex = _doorIndex;
- _savedGame.characterFacingDir = _charFacingDirection;
- _savedGame.iframe = _iframe;
- _savedGame.gamePart = _gamePart;
-
- _savedGame.isSealRemoved = _isSealRemoved;
- _savedGame.obtainedList1 = _obtainedList1;
- _savedGame.obtainedList2 = _obtainedList2;
- _savedGame.list1Complete = _list1Complete;
- _savedGame.list2Complete = _list2Complete;
- _savedGame.isVasePlaced = _isVasePlaced;
- _savedGame.isScytheTaken = _isScytheTaken;
- _savedGame.isTridentTaken = _isTridentTaken;
- _savedGame.isPottersWheelDelivered = _isPottersWheelDelivered;
- _savedGame.isMudDelivered = _isMudDelivered;
- _savedGame.isGreenDevilDelivered = _isGreenDevilDelivered;
- _savedGame.isRedDevilCaptured = _isRedDevilCaptured;
- _savedGame.isPottersManualDelivered = _isPottersManualDelivered;
- _savedGame.isCupboardOpen = _isCupboardOpen;
- _savedGame.isChestOpen = _isChestOpen;
- _savedGame.isTVOn = _isTVOn;
- _savedGame.isTrapSet = _isTrapSet;
-
- for (int i = 0; i < kInventoryIconCount; i++) {
- _savedGame.mobj[i].bitmapIndex = _inventory[i].bitmapIndex;
- _savedGame.mobj[i].code = _inventory[i].code;
- _savedGame.mobj[i].objectName = _inventory[i].objectName;
- }
-
- _savedGame.element1 = _element1;
- _savedGame.element2 = _element2;
- _savedGame.characterPosX = _characterPosX;
- _savedGame.characterPosY = _characterPosY;
- _savedGame.xframe2 = _xframe2;
- _savedGame.yframe2 = _yframe2;
-
- _savedGame.oldInventoryObjectName = _oldInventoryObjectName;
- _savedGame.objetomoinventoryObjectNamehila = _inventoryObjectName;
- _savedGame.characterName = _characterName;
-
- for (int i = 0; i < kRoutePointCount; i++) {
- _savedGame.mainRoute[i].x = _mainRoute[i].x;
- _savedGame.mainRoute[i].y = _mainRoute[i].y;
- }
-
- for (int i = 0; i < 300; i++) {
- _savedGame.trajectory[i].x = _trajectory[i].x;
- _savedGame.trajectory[i].y = _trajectory[i].y;
- }
-
- for (int i = 0; i < kCharacterCount; i++) {
- _savedGame.firstTimeTopicA[i] = _firstTimeTopicA[i];
- _savedGame.firstTimeTopicB[i] = _firstTimeTopicB[i];
- _savedGame.firstTimeTopicC[i] = _firstTimeTopicC[i];
- _savedGame.bookTopic[i] = _bookTopic[i];
- _savedGame.mintTopic[i] = _mintTopic[i];
- }
- for (int i = 0; i < 5; i++) {
- _savedGame.caves[i] = _caves[i];
- _savedGame.firstList[i] = _firstList[i];
- _savedGame.secondList[i] = _secondList[i];
- }
- for (int i = 0; i < 4; i++) {
- _savedGame.niche[0][i] = _niche[0][i];
- _savedGame.niche[1][i] = _niche[1][i];
- }
-}
-
-void TotEngine::loadGame(SavedGame game) {
- clearAnimation();
- clearScreenLayers();
-
- _trajectoryLength = game.trajectoryLength;
- _currentTrajectoryIndex = game.currentTrajectoryIndex;
- _backpackObjectCode = game.backpackObjectCode;
- _sound->_rightSfxVol = game.rightSfxVol;
- _sound->_leftSfxVol = game.leftSfxVol;
- _sound->_musicVolRight = game.musicVolRight;
- _sound->_musicVolLeft = game.musicVolLeft;
- _oldGridX = game.oldGridX;
- _oldGridY = game.oldGridY;
- _secondaryAnimation.depth = game.secAnimDepth;
- _secondaryAnimation.dir = game.secAnimDir;
- _secondaryAnimation.posx = game.secAnimX;
- _secondaryAnimation.posy = game.secAnimY;
- _iframe2 = game.secAnimIFrame;
- _currentZone = game.currentZone;
- _targetZone = game.targetZone;
- _oldTargetZone = game.oldTargetZone;
- _inventoryPosition = game.inventoryPosition;
- _actionCode = game.actionCode;
- _oldActionCode = game.oldActionCode;
- _trajectorySteps = game.steps;
- _doorIndex = game.doorIndex;
- _charFacingDirection = game.characterFacingDir;
- _iframe = game.iframe;
- if (game.gamePart != _gamePart) {
- _gamePart = game.gamePart;
- for (int i = 0; i < kInventoryIconCount; i++) {
- free(_inventoryIconBitmaps[i]);
- }
- loadInventory();
- }
- _isSealRemoved = game.isSealRemoved;
- _obtainedList1 = game.obtainedList1;
- _obtainedList2 = game.obtainedList2;
- _list1Complete = game.list1Complete;
- _list2Complete = game.list2Complete;
- _isVasePlaced = game.isVasePlaced;
- _isScytheTaken = game.isScytheTaken;
- if (_cpCounter > 24)
- showError(274);
- _isTridentTaken = game.isTridentTaken;
- _isPottersWheelDelivered = game.isPottersWheelDelivered;
- _isMudDelivered = game.isMudDelivered;
- _isGreenDevilDelivered = game.isGreenDevilDelivered;
- _isRedDevilCaptured = game.isRedDevilCaptured;
- _isPottersManualDelivered = game.isPottersManualDelivered;
- _isCupboardOpen = game.isCupboardOpen;
- _isChestOpen = game.isChestOpen;
- _isTVOn = game.isTVOn;
- _isTrapSet = game.isTrapSet;
- for (int i = 0; i < kInventoryIconCount; i++) {
- _inventory[i].bitmapIndex = game.mobj[i].bitmapIndex;
- _inventory[i].code = game.mobj[i].code;
- _inventory[i].objectName = game.mobj[i].objectName;
- }
- _element1 = game.element1;
- _element2 = game.element2;
- _characterPosX = game.characterPosX;
- _characterPosY = game.characterPosY;
- _xframe2 = game.xframe2;
- _yframe2 = game.yframe2;
- _oldInventoryObjectName = game.oldInventoryObjectName;
- _inventoryObjectName = game.objetomoinventoryObjectNamehila;
- _characterName = game.characterName;
- for (int i = 0; i < kRoutePointCount; i++) {
- _mainRoute[i].x = game.mainRoute[i].x;
- _mainRoute[i].y = game.mainRoute[i].y;
- }
- for (int indiaux = 0; indiaux < 300; indiaux++) {
- _trajectory[indiaux].x = game.trajectory[indiaux].x;
- _trajectory[indiaux].y = game.trajectory[indiaux].y;
- }
- for (int i = 0; i < kCharacterCount; i++) {
- _firstTimeTopicA[i] = game.firstTimeTopicA[i];
- _firstTimeTopicB[i] = game.firstTimeTopicB[i];
- _firstTimeTopicC[i] = game.firstTimeTopicC[i];
- _bookTopic[i] = game.bookTopic[i];
- _mintTopic[i] = game.mintTopic[i];
- }
- for (int i = 0; i < 5; i++) {
- _caves[i] = game.caves[i];
- _firstList[i] = game.firstList[i];
- _secondList[i] = game.secondList[i];
- }
- for (int i = 0; i < 4; i++) {
- _niche[0][i] = game.niche[0][i];
- _niche[1][i] = game.niche[1][i];
- }
-
- _graphics->totalFadeOut(0);
- _screen->clear();
- _graphics->loadPaletteFromFile("DEFAULT");
- loadScreenData(game.roomCode);
-
- switch (_currentRoomData->code) {
- case 2: {
- if (_isTVOn)
- _sound->autoPlayVoc("PARASITO", 355778, 20129);
- else
- loadTV();
- _sound->setSfxVolume(_sound->_leftSfxVol, _sound->_rightSfxVol);
- } break;
- case 4: {
- _sound->loadVoc("GOTA", 140972, 1029);
- _sound->setSfxVolume(_sound->_leftSfxVol, _sound->_rightSfxVol);
- } break;
- case 5: {
- _sound->setSfxVolume(_sound->_leftSfxVol, 0);
- _sound->autoPlayVoc("CALDERA", 6433, 15386);
- } break;
- case 6: {
- _sound->setSfxVolume(_sound->_leftSfxVol, _sound->_rightSfxVol);
- _sound->autoPlayVoc("CALDERA", 6433, 15386);
- } break;
- case 17: {
- if (_bookTopic[0] == true && _currentRoomData->animationFlag)
- disableSecondAnimation();
- } break;
- case 20: {
- switch (_niche[0][_niche[0][3]]) {
- case 0:
- _currentRoomData->screenObjectIndex[9]->objectName = getObjectName(4);
- break;
- case 561:
- _currentRoomData->screenObjectIndex[9]->objectName = getObjectName(5);
- break;
- case 563:
- _currentRoomData->screenObjectIndex[9]->objectName = getObjectName(6);
- break;
- case 615:
- _currentRoomData->screenObjectIndex[9]->objectName = getObjectName(7);
- break;
- }
- } break;
- case 23: {
- _sound->autoPlayVoc("Fuente", 0, 0);
- _sound->setSfxVolume(_sound->_leftSfxVol, _sound->_rightSfxVol);
- } break;
- case 24: {
- switch (_niche[1][_niche[1][3]]) {
- case 0:
- _currentRoomData->screenObjectIndex[8]->objectName = getObjectName(4);
- break;
- case 561:
- _currentRoomData->screenObjectIndex[8]->objectName = getObjectName(5);
- break;
- case 615:
- _currentRoomData->screenObjectIndex[8]->objectName = getObjectName(7);
- break;
- case 622:
- _currentRoomData->screenObjectIndex[8]->objectName = getObjectName(8);
- break;
- case 623:
- _currentRoomData->screenObjectIndex[8]->objectName = getObjectName(9);
- break;
- }
- if (_isTrapSet) {
- _currentRoomData->animationFlag = true;
- loadAnimation(_currentRoomData->animationName);
- _iframe2 = 0;
- _currentSecondaryTrajectoryIndex = 1;
- _currentRoomData->secondaryAnimTrajectory[_currentSecondaryTrajectoryIndex - 1].x = 214 - 15;
- _currentRoomData->secondaryAnimTrajectory[_currentSecondaryTrajectoryIndex - 1].y = 115 - 42;
- _secondaryAnimation.dir = _currentRoomData->secondaryAnimDirections[_currentSecondaryTrajectoryIndex - 1];
- _secondaryAnimation.posx = _currentRoomData->secondaryAnimTrajectory[_currentSecondaryTrajectoryIndex - 1].x;
- _secondaryAnimation.posy = _currentRoomData->secondaryAnimTrajectory[_currentSecondaryTrajectoryIndex - 1].y;
- _secondaryAnimation.depth = 14;
-
- for (int i = 0; i < _maxXGrid; i++)
- for (int j = 0; j < _maxYGrid; j++) {
- if (_maskGridSecondaryAnim[i][j] > 0)
- _currentRoomData->walkAreasGrid[_oldposx + i][_oldposy + j] = _maskGridSecondaryAnim[i][j];
- if (_maskMouseSecondaryAnim[i][j] > 0)
- _currentRoomData->mouseGrid[_oldposx + i][_oldposy + j] = _maskMouseSecondaryAnim[i][j];
- }
- }
- assembleScreen();
- } break;
- }
-
- drawInventoryMask();
- _inventoryPosition = 0;
- drawInventory();
- if (_isRedDevilCaptured == false && _currentRoomData->code == 24 && _isTrapSet == false)
- runaroundRed();
- _graphics->sceneTransition(false, _sceneBackground);
-}
-
void TotEngine::sayLine(
uint textRef,
byte textColor,
diff --git a/engines/tot/saveload.cpp b/engines/tot/saveload.cpp
index 1f8d35c0e3a..6f4a6e9ac87 100644
--- a/engines/tot/saveload.cpp
+++ b/engines/tot/saveload.cpp
@@ -287,4 +287,288 @@ bool TotEngine::canSaveGameStateCurrently(Common::U32String *msg) {
return _inGame && _saveAllowed;
}
+void TotEngine::saveGameToRegister() {
+ _savedGame.roomCode = _currentRoomData->code;
+ _savedGame.trajectoryLength = _trajectoryLength;
+ _savedGame.currentTrajectoryIndex = _currentTrajectoryIndex;
+ _savedGame.backpackObjectCode = _backpackObjectCode;
+ _savedGame.rightSfxVol = _sound->_rightSfxVol;
+ _savedGame.leftSfxVol = _sound->_leftSfxVol;
+ _savedGame.musicVolRight = _sound->_musicVolRight;
+ _savedGame.musicVolLeft = _sound->_musicVolLeft;
+ _savedGame.oldGridX = _oldGridX;
+ _savedGame.oldGridY = _oldGridY;
+ _savedGame.secAnimDepth = _secondaryAnimation.depth;
+ _savedGame.secAnimDir = _secondaryAnimation.dir;
+ _savedGame.secAnimX = _secondaryAnimation.posx;
+ _savedGame.secAnimY = _secondaryAnimation.posy;
+ _savedGame.secAnimIFrame = _iframe2;
+
+ _savedGame.currentZone = _currentZone;
+ _savedGame.targetZone = _targetZone;
+ _savedGame.oldTargetZone = _oldTargetZone;
+ _savedGame.inventoryPosition = _inventoryPosition;
+ _savedGame.actionCode = _actionCode;
+ _savedGame.oldActionCode = _oldActionCode;
+ _savedGame.steps = _trajectorySteps;
+ _savedGame.doorIndex = _doorIndex;
+ _savedGame.characterFacingDir = _charFacingDirection;
+ _savedGame.iframe = _iframe;
+ _savedGame.gamePart = _gamePart;
+
+ _savedGame.isSealRemoved = _isSealRemoved;
+ _savedGame.obtainedList1 = _obtainedList1;
+ _savedGame.obtainedList2 = _obtainedList2;
+ _savedGame.list1Complete = _list1Complete;
+ _savedGame.list2Complete = _list2Complete;
+ _savedGame.isVasePlaced = _isVasePlaced;
+ _savedGame.isScytheTaken = _isScytheTaken;
+ _savedGame.isTridentTaken = _isTridentTaken;
+ _savedGame.isPottersWheelDelivered = _isPottersWheelDelivered;
+ _savedGame.isMudDelivered = _isMudDelivered;
+ _savedGame.isGreenDevilDelivered = _isGreenDevilDelivered;
+ _savedGame.isRedDevilCaptured = _isRedDevilCaptured;
+ _savedGame.isPottersManualDelivered = _isPottersManualDelivered;
+ _savedGame.isCupboardOpen = _isCupboardOpen;
+ _savedGame.isChestOpen = _isChestOpen;
+ _savedGame.isTVOn = _isTVOn;
+ _savedGame.isTrapSet = _isTrapSet;
+
+ for (int i = 0; i < kInventoryIconCount; i++) {
+ _savedGame.mobj[i].bitmapIndex = _inventory[i].bitmapIndex;
+ _savedGame.mobj[i].code = _inventory[i].code;
+ _savedGame.mobj[i].objectName = _inventory[i].objectName;
+ }
+
+ _savedGame.element1 = _element1;
+ _savedGame.element2 = _element2;
+ _savedGame.characterPosX = _characterPosX;
+ _savedGame.characterPosY = _characterPosY;
+ _savedGame.xframe2 = _xframe2;
+ _savedGame.yframe2 = _yframe2;
+
+ _savedGame.oldInventoryObjectName = _oldInventoryObjectName;
+ _savedGame.objetomoinventoryObjectNamehila = _inventoryObjectName;
+ _savedGame.characterName = _characterName;
+
+ for (int i = 0; i < kRoutePointCount; i++) {
+ _savedGame.mainRoute[i].x = _mainRoute[i].x;
+ _savedGame.mainRoute[i].y = _mainRoute[i].y;
+ }
+
+ for (int i = 0; i < 300; i++) {
+ _savedGame.trajectory[i].x = _trajectory[i].x;
+ _savedGame.trajectory[i].y = _trajectory[i].y;
+ }
+
+ for (int i = 0; i < kCharacterCount; i++) {
+ _savedGame.firstTimeTopicA[i] = _firstTimeTopicA[i];
+ _savedGame.firstTimeTopicB[i] = _firstTimeTopicB[i];
+ _savedGame.firstTimeTopicC[i] = _firstTimeTopicC[i];
+ _savedGame.bookTopic[i] = _bookTopic[i];
+ _savedGame.mintTopic[i] = _mintTopic[i];
+ }
+ for (int i = 0; i < 5; i++) {
+ _savedGame.caves[i] = _caves[i];
+ _savedGame.firstList[i] = _firstList[i];
+ _savedGame.secondList[i] = _secondList[i];
+ }
+ for (int i = 0; i < 4; i++) {
+ _savedGame.niche[0][i] = _niche[0][i];
+ _savedGame.niche[1][i] = _niche[1][i];
+ }
+}
+
+void TotEngine::loadGame(SavedGame game) {
+ clearAnimation();
+ clearScreenLayers();
+
+ _trajectoryLength = game.trajectoryLength;
+ _currentTrajectoryIndex = game.currentTrajectoryIndex;
+ _backpackObjectCode = game.backpackObjectCode;
+ _sound->_rightSfxVol = game.rightSfxVol;
+ _sound->_leftSfxVol = game.leftSfxVol;
+ _sound->_musicVolRight = game.musicVolRight;
+ _sound->_musicVolLeft = game.musicVolLeft;
+ _oldGridX = game.oldGridX;
+ _oldGridY = game.oldGridY;
+ _secondaryAnimation.depth = game.secAnimDepth;
+ _secondaryAnimation.dir = game.secAnimDir;
+ _secondaryAnimation.posx = game.secAnimX;
+ _secondaryAnimation.posy = game.secAnimY;
+ _iframe2 = game.secAnimIFrame;
+ _currentZone = game.currentZone;
+ _targetZone = game.targetZone;
+ _oldTargetZone = game.oldTargetZone;
+ _inventoryPosition = game.inventoryPosition;
+ _actionCode = game.actionCode;
+ _oldActionCode = game.oldActionCode;
+ _trajectorySteps = game.steps;
+ _doorIndex = game.doorIndex;
+ _charFacingDirection = game.characterFacingDir;
+ _iframe = game.iframe;
+ if (game.gamePart != _gamePart) {
+ _gamePart = game.gamePart;
+ for (int i = 0; i < kInventoryIconCount; i++) {
+ free(_inventoryIconBitmaps[i]);
+ }
+ loadInventory();
+ }
+ _isSealRemoved = game.isSealRemoved;
+ _obtainedList1 = game.obtainedList1;
+ _obtainedList2 = game.obtainedList2;
+ _list1Complete = game.list1Complete;
+ _list2Complete = game.list2Complete;
+ _isVasePlaced = game.isVasePlaced;
+ _isScytheTaken = game.isScytheTaken;
+ if (_cpCounter > 24)
+ showError(274);
+ _isTridentTaken = game.isTridentTaken;
+ _isPottersWheelDelivered = game.isPottersWheelDelivered;
+ _isMudDelivered = game.isMudDelivered;
+ _isGreenDevilDelivered = game.isGreenDevilDelivered;
+ _isRedDevilCaptured = game.isRedDevilCaptured;
+ _isPottersManualDelivered = game.isPottersManualDelivered;
+ _isCupboardOpen = game.isCupboardOpen;
+ _isChestOpen = game.isChestOpen;
+ _isTVOn = game.isTVOn;
+ _isTrapSet = game.isTrapSet;
+ for (int i = 0; i < kInventoryIconCount; i++) {
+ _inventory[i].bitmapIndex = game.mobj[i].bitmapIndex;
+ _inventory[i].code = game.mobj[i].code;
+ _inventory[i].objectName = game.mobj[i].objectName;
+ }
+ _element1 = game.element1;
+ _element2 = game.element2;
+ _characterPosX = game.characterPosX;
+ _characterPosY = game.characterPosY;
+ _xframe2 = game.xframe2;
+ _yframe2 = game.yframe2;
+ _oldInventoryObjectName = game.oldInventoryObjectName;
+ _inventoryObjectName = game.objetomoinventoryObjectNamehila;
+ _characterName = game.characterName;
+ for (int i = 0; i < kRoutePointCount; i++) {
+ _mainRoute[i].x = game.mainRoute[i].x;
+ _mainRoute[i].y = game.mainRoute[i].y;
+ }
+ for (int indiaux = 0; indiaux < 300; indiaux++) {
+ _trajectory[indiaux].x = game.trajectory[indiaux].x;
+ _trajectory[indiaux].y = game.trajectory[indiaux].y;
+ }
+ for (int i = 0; i < kCharacterCount; i++) {
+ _firstTimeTopicA[i] = game.firstTimeTopicA[i];
+ _firstTimeTopicB[i] = game.firstTimeTopicB[i];
+ _firstTimeTopicC[i] = game.firstTimeTopicC[i];
+ _bookTopic[i] = game.bookTopic[i];
+ _mintTopic[i] = game.mintTopic[i];
+ }
+ for (int i = 0; i < 5; i++) {
+ _caves[i] = game.caves[i];
+ _firstList[i] = game.firstList[i];
+ _secondList[i] = game.secondList[i];
+ }
+ for (int i = 0; i < 4; i++) {
+ _niche[0][i] = game.niche[0][i];
+ _niche[1][i] = game.niche[1][i];
+ }
+
+ _graphics->totalFadeOut(0);
+ _screen->clear();
+ _graphics->loadPaletteFromFile("DEFAULT");
+ loadScreenData(game.roomCode);
+
+ switch (_currentRoomData->code) {
+ case 2: {
+ if (_isTVOn)
+ _sound->autoPlayVoc("PARASITO", 355778, 20129);
+ else
+ loadTV();
+ _sound->setSfxVolume(_sound->_leftSfxVol, _sound->_rightSfxVol);
+ } break;
+ case 4: {
+ _sound->loadVoc("GOTA", 140972, 1029);
+ _sound->setSfxVolume(_sound->_leftSfxVol, _sound->_rightSfxVol);
+ } break;
+ case 5: {
+ _sound->setSfxVolume(_sound->_leftSfxVol, 0);
+ _sound->autoPlayVoc("CALDERA", 6433, 15386);
+ } break;
+ case 6: {
+ _sound->setSfxVolume(_sound->_leftSfxVol, _sound->_rightSfxVol);
+ _sound->autoPlayVoc("CALDERA", 6433, 15386);
+ } break;
+ case 17: {
+ if (_bookTopic[0] == true && _currentRoomData->animationFlag)
+ disableSecondAnimation();
+ } break;
+ case 20: {
+ switch (_niche[0][_niche[0][3]]) {
+ case 0:
+ _currentRoomData->screenObjectIndex[9]->objectName = getObjectName(4);
+ break;
+ case 561:
+ _currentRoomData->screenObjectIndex[9]->objectName = getObjectName(5);
+ break;
+ case 563:
+ _currentRoomData->screenObjectIndex[9]->objectName = getObjectName(6);
+ break;
+ case 615:
+ _currentRoomData->screenObjectIndex[9]->objectName = getObjectName(7);
+ break;
+ }
+ } break;
+ case 23: {
+ _sound->autoPlayVoc("Fuente", 0, 0);
+ _sound->setSfxVolume(_sound->_leftSfxVol, _sound->_rightSfxVol);
+ } break;
+ case 24: {
+ switch (_niche[1][_niche[1][3]]) {
+ case 0:
+ _currentRoomData->screenObjectIndex[8]->objectName = getObjectName(4);
+ break;
+ case 561:
+ _currentRoomData->screenObjectIndex[8]->objectName = getObjectName(5);
+ break;
+ case 615:
+ _currentRoomData->screenObjectIndex[8]->objectName = getObjectName(7);
+ break;
+ case 622:
+ _currentRoomData->screenObjectIndex[8]->objectName = getObjectName(8);
+ break;
+ case 623:
+ _currentRoomData->screenObjectIndex[8]->objectName = getObjectName(9);
+ break;
+ }
+ if (_isTrapSet) {
+ _currentRoomData->animationFlag = true;
+ loadAnimation(_currentRoomData->animationName);
+ _iframe2 = 0;
+ _currentSecondaryTrajectoryIndex = 1;
+ _currentRoomData->secondaryAnimTrajectory[_currentSecondaryTrajectoryIndex - 1].x = 214 - 15;
+ _currentRoomData->secondaryAnimTrajectory[_currentSecondaryTrajectoryIndex - 1].y = 115 - 42;
+ _secondaryAnimation.dir = _currentRoomData->secondaryAnimDirections[_currentSecondaryTrajectoryIndex - 1];
+ _secondaryAnimation.posx = _currentRoomData->secondaryAnimTrajectory[_currentSecondaryTrajectoryIndex - 1].x;
+ _secondaryAnimation.posy = _currentRoomData->secondaryAnimTrajectory[_currentSecondaryTrajectoryIndex - 1].y;
+ _secondaryAnimation.depth = 14;
+
+ for (int i = 0; i < _maxXGrid; i++)
+ for (int j = 0; j < _maxYGrid; j++) {
+ if (_maskGridSecondaryAnim[i][j] > 0)
+ _currentRoomData->walkAreasGrid[_oldposx + i][_oldposy + j] = _maskGridSecondaryAnim[i][j];
+ if (_maskMouseSecondaryAnim[i][j] > 0)
+ _currentRoomData->mouseGrid[_oldposx + i][_oldposy + j] = _maskMouseSecondaryAnim[i][j];
+ }
+ }
+ assembleScreen();
+ } break;
+ }
+
+ drawInventoryMask();
+ _inventoryPosition = 0;
+ drawInventory();
+ if (_isRedDevilCaptured == false && _currentRoomData->code == 24 && _isTrapSet == false)
+ runaroundRed();
+ _graphics->sceneTransition(false, _sceneBackground);
+}
+
} // End of namespace Tot
Commit: 74b39b302f51002e91a96eba22554cfa328d2b4b
https://github.com/scummvm/scummvm/commit/74b39b302f51002e91a96eba22554cfa328d2b4b
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:55+02:00
Commit Message:
TOT: Adds EXE to detection
Changed paths:
engines/tot/detection_tables.h
diff --git a/engines/tot/detection_tables.h b/engines/tot/detection_tables.h
index d639a75e77b..3174f558227 100644
--- a/engines/tot/detection_tables.h
+++ b/engines/tot/detection_tables.h
@@ -31,9 +31,10 @@ const ADGameDescription gameDescriptions[] = {
{
"tot",
nullptr,
- AD_ENTRY2s(
+ AD_ENTRY3s(
"AZCCOG.DAT", "2f66724fcd7f51c5b4a715b30f088581", 79916,
- "CREDITOS.DAT", "6885c1fadd25a0c0da1c88f071a30e63", 130080
+ "CREDITOS.DAT", "6885c1fadd25a0c0da1c88f071a30e63", 130080,
+ "TOT.EXE", "cf3a34941be45d3207e38f8f5d66ba00", 209520
),
Common::ES_ESP,
Common::kPlatformDOS,
@@ -43,9 +44,10 @@ const ADGameDescription gameDescriptions[] = {
{
"tot",
nullptr,
- AD_ENTRY2s(
+ AD_ENTRY3s(
"AZCCOG.DAT", "2f66724fcd7f51c5b4a715b30f088581", 79916,
- "CREDITOS.DAT", "bca1c63cfee9ec8b722f7715e21b5e8e", 130080
+ "CREDITOS.DAT", "bca1c63cfee9ec8b722f7715e21b5e8e", 130080,
+ "TOT.EXE", "e711989e516bd33d0da6c278c82a0493", 207280
),
Common::EN_ANY,
Common::kPlatformDOS,
Commit: 80601dd7b6ee1ce36ac442c1ccd18ec382f3ecb3
https://github.com/scummvm/scummvm/commit/80601dd7b6ee1ce36ac442c1ccd18ec382f3ecb3
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:55+02:00
Commit Message:
TOT: Error messages in English
Changed paths:
engines/tot/statics.h
engines/tot/util.cpp
diff --git a/engines/tot/statics.h b/engines/tot/statics.h
index 3e2047c8cd7..27d7734f88b 100644
--- a/engines/tot/statics.h
+++ b/engines/tot/statics.h
@@ -812,6 +812,286 @@ static const char *const fullScreenMessages[2][59] = {
},
};
+static const char *const errorMessages[2][114] = {
+{
+ // 0
+ "Error 1: Función no existe.",
+ "Error 2: Fichero no encontrado.",
+ "Error 3: Camino no encontrado.",
+ "Error 4: Demasiados ficheros abiertos.",
+ "Error 5: Acceso denegado.",
+ // 5
+ "Error 6: Asignacion de fichero incorrecta.",
+ "Error 12: C\xA2""digo de acceso a fichero incorrecto.",
+ "Error %d: \xA8" "Alguien ha visto por ah\xA1 un bol\xA1grafo?.",
+ "Error 15: Unidad incorrecta.",
+ "Error 16: No se puede borrar el directorio.",
+ // 10
+ "Error 17: No se puede renombrar en distintas unidades.",
+ "Error 18: No hay m\xA0s ficheros.",
+ "Error 100: No se pudo leer del disco.",
+ "Error 101: No se pudo escribir en el disco.",
+ "Error 102: Fichero sin asignar.",
+ // 15
+ "Error 103: Fichero sin abrir.",
+ "Error 104: Fichero abierto para salida.",
+ "Error 105: Fichero abierto para entrada.",
+ "Error 106: Formato num\x82rico no v\xA0lido.",
+ "Error 150: Disco protegido contra escritura.",
+ // 20
+ "Error 151: El driver del disco devuelve una estructura incorrecta.",
+ "Error 152: Unidad no preparada.",
+ "Error 153: JOZU!! que Barbari\xA0.",
+ "Error 154: Comprobaci\xA2n err\xA2nea en el control de redundancia c\xA1""clica.",
+ "Error %d: Cerrado por vacaciones.",
+ // 25
+ "Error 156: Posicionamiento err\xA2neo en el fichero.",
+ "Error 157: Disco de formato desconocido.",
+ "Error 158: Sector no encontrado en el disco.",
+ "Error 159: Impresora sin papel.",
+ "Error 160: No se pudo escribir en el dispositivo.",
+ // 30
+ "Error 161: No se pudo leer del dispositivo.",
+ "Error 162: Problema con el dispositivo.",
+ "Error 200: Division por cero.",
+ "Error 201: Variable fuera de rango.",
+ "Error 202: Desbordamiento en la pila.",
+ // 35
+ "Error 203: Desbordamiento en la memoria din\xA0mica.",
+ "Error 204: Operaci\xA2n err\xA2nea con un puntero.",
+ "Error 205: Desbordamiento en coma flotante.",
+ "Error 206: Desbordamiento negativo en coma flotante.",
+ "Error 207: Operaci\xA2n err\xA2nea de coma flotante.",
+ // 40
+ "Error 208: Gestor de solapamiento sin instalar.",
+ "Error 209: Lectura err\xA2nea del fichero de solapamiento.",
+ "Error 210: Objeto sin inicializar.",
+ "Error 211: Llamada a un metodo abstracto.",
+ "Error 212: Cadena de asignaci\xA2n del objeto err\xA2nea.",
+ // 45
+ "Error 213: Indice para colecci\xA2n fuera de rango.",
+ "Error 214: Desbordamiento en la colecci\xA2n.",
+ "Error 215: Desbordamiento en operaci\xA2n aritm\x82tica.",
+ "Error 216: Acceso a memoria sin asignar.",
+ "Error 250: El driver de AdLib no est\xA0 instalado.",
+ // 50
+ "Error 251: Libre para AdLib.",
+ "Error 252: No se encontr\xA2 el fichero de efectos para SBlaster.",
+ "Error 253: No se encontr\xA2 el fichero de m\xA3sica para SBlaster.",
+ "Error 254: Libre para el fichero de configuraci\xA2n del sonido.",
+ "Error 255: Detectado Ctrl-Break.",
+ // 55
+ "Error 256: La tarjeta de video no soporta el modo gr\xA0""fico requerido.",
+ "Error 257: El tipo de pantalla no es correcto.",
+ "Error 258: No se encontr\xA2 el fichero con la imagen del menu.",
+ "Error 259: Clave de protecci\xA2n erronea.",
+ "Error 260: No se encontr\xA2 el driver del modo X de v\xA1""deo.",
+ // 60
+ "Error 261: No se encontr\xA2 el fichero de datos de los objetos.",
+ "Error 262: No se encontr\xA2 el fichero de los BITMAP.",
+ "Error 263: No se encontr\xA2 el fichero de paleta para la imagen girando.",
+ "Error 264: Se desbord\xA2 la pila de montaje de bitmaps",
+ "Error 265: No se encontr\xA2 el fichero de la animaci\xA2n.",
+ // 65
+ "Error 266: No se encontr\xA2 el fichero del efecto de sonido.",
+ "Error 267: No se encontr\xA2 el fichero de la melodia.",
+ "Error 268: No se encontr\xA2 el driver de sonido MIDI.",
+ "Error 269: No se pudo capturar un vector de interrupci\xA2n.",
+ "Error 270: No se encontr\xA2 el fichero de los cr\x82""ditos.",
+ // 70
+ "Error 271: No se encontr\xA2 el fichero del BitMap del sello.",
+ "Error 272: No se encontr\xA2 el fichero de la animaci\xA2n.",
+ "Error 273: No se encontraron los \xA1ndices de los modos X de acceso a v\xA1""deo.",
+ "Error 274: Fichero de datos corrupto, instale de nuevo el programa.",
+ "Error 275: Posici\xA2n incorrecta del Sprite.",
+ // 75
+ "Error 276: Alineaci\xA2n incorrecta del driver de sonido.",
+ "Error 277: No se encontr\xA2 el fichero de la animaci\xA2n.",
+ "Error 278: No se encontr\xA2 el fichero para la actualizaci\xA2n.",
+ "Error 279: No se actualiz\xA2 el puntero del rat\xA2n.",
+ "Error 280: No se encontr\xA2 el puntero de video.",
+ // 80
+ "Error 281: No se actualiz\xA2 el puntero de video.",
+ "Error 282: No se actualiz\xA2 el flag del trace.",
+ "Error 299: No se pudo reubicar los datos en la memoria XMS.",
+ "Error 300: No hay memoria XMS suficiente.",
+ "Error 301: No se pudo reservar memoria XMS suficiente.",
+ // 85
+ "Error 302: No se pudo liberar la memoria XMS.",
+ "Error 303: No se encuentra disponible un handle para XMS.",
+ "Error 304: No se encontr\xA2 el fichero de gr\xA0""ficos.",
+ "Error 305: Necesita una versi\xA2n 6.0 o posterior del driver del rat\xA2n.",
+ "Error 306: No se pudo inicializar correctamente el driver del rat\xA2n.",
+ // 90
+ "Error 307: No hay memoria baja suficiente.",
+ "Error 308: No se pudo inicializar correctamente el modo gr\xA0""fico.",
+ "Error 309: No se pudieron inicializar correctamente los tipos de letra.",
+ "Error 310: No se encontr\xA2 el fichero de paleta.",
+ "Error 311: No se encontr\xA2 el fichero de paleta para fundido.",
+ // 95
+ "Error 312: No se encontr\xA2 el fichero de los BITMAP del inventario.",
+ "Error 313: No se encontr\xA2 el fichero de hipertexto.",
+ "Error 314: No se encontr\xA2 el fichero del arbol de conversaciones.",
+ "Error 315: No se encontr\xA2 el fichero de la pantalla a pintar.",
+ "Error 316: No se encontr\xA2 el fichero de la pantalla a cargar.",
+ // 100
+ "Error 317: No se encontr\xA2 el fichero de las mascaras del rat\xA2n.",
+ "Error 318: No se encontr\xA2 el fichero del diploma.",
+ "Error 319: No se encontr\xA2 el fichero de los objetos en pantalla.",
+ "Error 320: No se encontr\xA2 el fichero de la rejilla de pantalla.",
+ "Error 321: No se encontr\xA2 el fichero del objeto rotando.",
+ // 105
+ "Error 322: No se encontr\xA2 el fichero de la partida salvada.",
+ "Error 323: No se encontr\xA2 el fichero de configuraci\xA2n.",
+ "Error %d: Espera... Espera... La placa madre est\xA0 teniendo gemelos",
+ "Error %d: Mi, mi, mi, mi, mi.... etc.",
+ "Error %d: Tr\xA0""fico intenso en el bus de datos.",
+ // 110
+ "Error %d: No sabe, no contesta.",
+ "Error %d: Dios mio... estoy lleno de chips.",
+ "Error %d: Coffe not found. Operator Halted.",
+ "Error %d: La parab\xA2lica est\xA0 mal orientada."
+},
+{
+ "Error 1: Function not found.",
+ "Error 2: File not found.",
+ "Error 3: Path not found.",
+ "Error 4: Too many files opened.",
+ "Error 5: Access denied.",
+
+ "Error 6: Ilegal file assign.",
+ "Error 12: Ilegal file access.",
+ "Error %d: Somebody has seen my pen?",
+ "Error 15: Ilegal drive access.",
+ "Error 16: Ilegal directory manipulation.",
+ // 10
+ "Error 17: That's imposible.",
+ "Error 18: No more files allowed.",
+ "Error 100: Disk read crash.",
+ "Error 101: Disk write crash.",
+ "Error 102: File?... What file?.",
+ // 15
+ "Error 103: File not open.",
+ "Error 104: File open for output.",
+ "Error 105: File open for input.",
+ "Error 106: Missing numeric format.",
+ "Error 150: Disk said NO.",
+ // 20
+ "Error 151: Invalid drive parameters.",
+ "Error 152: Drive not ready.",
+ "Error %d: JOZU!! que Barbari\xA0. in spanish in the original",
+ "Error 154: CRC crash.",
+ "Error %d: Close for holidays.",
+ // 25
+ "Error 156: Ilegal file seek.",
+ "Error 157: Ilegal drive media.",
+ "Error 158: Sector not found.",
+ "Error 159: No paper.",
+ "Error 160: Writing access crash.",
+ // 30
+ "Error 161: Reading access crash.",
+ "Error 162: Hardware not response.",
+ "Error 200: Division by zero.",
+ "Error 201: Range check crash.",
+ "Error 202: Stack overflow.",
+ // 35
+ "Error 203: Heap overflow.",
+ "Error 204: Ilegal pointer operation.",
+ "Error 205: Floating overflow.",
+ "Error 206: Floating underflow.",
+ "Error 207: Ilegal floating operation.",
+ // 40
+ "Error 208: Overlay manager crash.",
+ "Error 209: Reading overlay crash.",
+ "Error 210: Ilegal Object operation.",
+ "Error 211: Abstract method call crash.",
+ "Error 212: Object string crash.",
+ // 45
+ "Error 213: Index collection overflow.",
+ "Error 214: Collection overflow.",
+ "Error 215: Aritmethic overflow.",
+ "Error 216: Ilegal memory access.",
+ "Error 250: AdLib Driver crash.",
+ // 50
+ "Error 251: Free for AdLib.",
+ "Error 252: FX file not found for SBlaster.",
+ "Error 253: Music file not found for SBlaster.",
+ "Error 254: Free for sound configuration file.",
+ "Error 255: Ctrl-Break flag detected.",
+ // 55
+ "Error 256: Video mode not supported.",
+ "Error 257: Video driver not supported.",
+ "Error 258: Menu data file not found.",
+ "Error 259: Ilegal password.",
+ "Error 260: Tweacked mode failure.",
+ // 60
+ "Error 261: Object data file not found.",
+ "Error 262: BITMAP data file not found.",
+ "Error 263: Spiring palette file not found.",
+ "Error 264: Bitmaps heap overflow.",
+ "Error 265: Animation data file not found.",
+ // 65
+ "Error 266: FX data file not found.",
+ "Error 267: Music data file not found.",
+ "Error 268: MIDI driver not found.",
+ "Error 269: Interrupt vector not available.",
+ "Error 270: Credits data file not found.",
+ // 70
+ "Error 271: Stamp data file not found.",
+ "Error 272: Animation data file not found.",
+ "Error 273: Index video acces data not found.",
+ "Error 274: File corrupt, install again.",
+ "Error 275: Ilegal sprite position.",
+ // 75
+ "Error 276: Ilegal Sound driver position.",
+ "Error 277: Animation file data not found.",
+ "Error 278: Temporary file not found.",
+ "Error 279: Mouse pointer not actualized.",
+ "Error 280: Video pointer not found.",
+ // 80
+ "Error 281: Video pointer not actualized.",
+ "Error 282: Ilegal trace flag operation.",
+ "Error 299: XMS relocation failure.",
+ "Error 300: Not enough XMS available.",
+ "Error 301: Reserving XMS crash.",
+ // 85
+ "Error 302: Releasing XMS crash.",
+ "Error 303: Handle for XMS not available.",
+ "Error 304: Graph data file not found.",
+ "Error 305: Mouse driver Ver 6.0 or higher needed.",
+ "Error 306: Mouse driver crash.",
+ // 90
+ "Error 307: Not enough memory. ",
+ "Error 308: Video mode crash.",
+ "Error 309: Font types crash.",
+ "Error 310: Palette data file not found.",
+ "Error 311: Palette data file for FX not found.",
+ // 95
+ "Error 312: Inventory data file not found.",
+ "Error 313: Text data file not found.",
+ "Error 314: Text tree data file not found.",
+ "Error 315: Drawing screen data file not found.",
+ "Error 316: Loading screen data file not found.",
+ // 100
+ "Error 317: Mouse mask data file not found.",
+ "Error 318: Certify data file not found.",
+ "Error 319: Screen object data file not found.",
+ "Error 320: Screen paths data not found.",
+ "Error 321: Spiring object data file not found.",
+ // 105
+ "Error 322: Saved game data file not found.",
+ "Error 323: Configuration data file not found.",
+ "Error %d: Wait... the mother board is having twin.",
+ "Error %d: Mi, mi, mi, mi, mi.... etc.",
+ "Error %d: Data bus collapsed.",
+ // 110
+ "Error %d: I'm innocent.",
+ "Error %d: My God... I'm full of chips.",
+ "Error %d: Coffe not found. Operator halted.",
+ "Error %d: Satellite plate with wrong orientation",
+}
+};
+
static const char *const actionLine_ES[] = {
"IR A ",
"HABLAR CON ",
diff --git a/engines/tot/util.cpp b/engines/tot/util.cpp
index 57327ed1105..c1c7bed44c8 100644
--- a/engines/tot/util.cpp
+++ b/engines/tot/util.cpp
@@ -30,357 +30,348 @@ namespace Tot {
const int kEnforcedTextAnimDelay = 0;
void showError(int code) {
+ const char *const *messages = (isLanguageSpanish()) ? errorMessages[0] : errorMessages[1];
+
switch (code) {
case 1:
- error("Error 1: Funci\xA2n no existe.");
+ error(messages[0]);
break;
case 2:
- error("Error 2: Fichero no encontrado.");
+ error(messages[1]);
break;
case 3:
- error("Error 3: Camino no encontrado.");
+ error(messages[2]);
break;
case 4:
- error("Error 4: Demasiados ficheros abiertos.");
+ error(messages[3]);
break;
case 5:
- error("Error 5: Acceso denegado.");
+ error(messages[4]);
break;
case 6:
- error("Error 6: Asignacion de fichero incorrecta.");
+ error(messages[5]);
break;
case 12:
- error("Error 12: C\xA2"
- "digo de acceso a fichero incorrecto.");
+ error(messages[6]);
break;
case 13:
case 14:
- error("Error %d: \xA8"
- "Alguien ha visto por ah\xA1 un bol\xA1grafo?.",
+ error(messages[7],
code);
break;
case 15:
- error("Error 15: Unidad incorrecta.");
+ error(messages[8]);
break;
case 16:
- error("Error 16: No se puede borrar el directorio.");
+ error(messages[9]);
break;
case 17:
- error("Error 17: No se puede renombrar en distintas unidades.");
+ error(messages[10]);
break;
case 18:
- error("Error 18: No hay m\xA0s ficheros.");
+ error(messages[11]);
break;
case 100:
- error("Error 100: No se pudo leer del disco.");
+ error(messages[12]);
break;
case 101:
- error("Error 101: No se pudo escribir en el disco.");
+ error(messages[13]);
break;
case 102:
- error("Error 102: Fichero sin asignar.");
+ error(messages[14]);
break;
case 103:
- error("Error 103: Fichero sin abrir.");
+ error(messages[15]);
break;
case 104:
- error("Error 104: Fichero abierto para salida.");
+ error(messages[16]);
break;
case 105:
- error("Error 105: Fichero abierto para entrada.");
+ error(messages[17]);
break;
case 106:
- error("Error 106: Formato num\x82rico no v\xA0lido.");
+ error(messages[18]);
break;
case 150:
- error("Error 150: Disco protegido contra escritura.");
+ error(messages[19]);
break;
case 151:
- error("Error 151: El driver del disco devuelve una estructura incorrecta.");
+ error(messages[20]);
break;
case 152:
- error("Error 152: Unidad no preparada.");
+ error(messages[21]);
break;
case 153:
- error("Error 153: JOZU!! que Barbari\xA0.");
+ error(messages[22]);
break;
case 154:
- error("Error 154: Comprobaci\xA2n err\xA2nea en el control de redundancia c\xA1"
- "clica.");
+ error(messages[23]);
break;
case 155:
- error("Error %d: Cerrado por vacaciones.", code);
+ error(messages[24], code);
break;
case 156:
- error("Error 156: Posicionamiento err\xA2neo en el fichero.");
+ error(messages[25]);
break;
case 157:
- error("Error 157: Disco de formato desconocido.");
+ error(messages[26]);
break;
case 158:
- error("Error 158: Sector no encontrado en el disco.");
+ error(messages[27]);
break;
case 159:
- error("Error 159: Impresora sin papel.");
+ error(messages[28]);
break;
case 160:
- error("Error 160: No se pudo escribir en el dispositivo.");
+ error(messages[29]);
break;
case 161:
- error("Error 161: No se pudo leer del dispositivo.");
+ error(messages[30]);
break;
case 162:
- error("Error 162: Problema con el dispositivo.");
+ error(messages[31]);
break;
case 200:
- error("Error 200: Division por cero.");
+ error(messages[32]);
break;
case 201:
- error("Error 201: Variable fuera de rango.");
+ error(messages[33]);
break;
case 202:
- error("Error 202: Desbordamiento en la pila.");
+ error(messages[34]);
break;
case 203:
- error("Error 203: Desbordamiento en la memoria din\xA0mica.");
+ error(messages[35]);
break;
case 204:
- error("Error 204: Operaci\xA2n err\xA2nea con un puntero.");
+ error(messages[36]);
break;
case 205:
- error("Error 205: Desbordamiento en coma flotante.");
+ error(messages[37]);
break;
case 206:
- error("Error 206: Desbordamiento negativo en coma flotante.");
+ error(messages[38]);
break;
case 207:
- error("Error 207: Operaci\xA2n err\xA2nea de coma flotante.");
+ error(messages[39]);
break;
case 208:
- error("Error 208: Gestor de solapamiento sin instalar.");
+ error(messages[40]);
break;
case 209:
- error("Error 209: Lectura err\xA2nea del fichero de solapamiento.");
+ error(messages[41]);
break;
case 210:
- error("Error 210: Objeto sin inicializar.");
+ error(messages[42]);
break;
case 211:
- error("Error 211: Llamada a un metodo abstracto.");
+ error(messages[43]);
break;
case 212:
- error("Error 212: Cadena de asignaci\xA2n del objeto err\xA2nea.");
+ error(messages[44]);
break;
case 213:
- error("Error 213: Indice para colecci\xA2n fuera de rango.");
+ error(messages[45]);
break;
case 214:
- error("Error 214: Desbordamiento en la colecci\xA2n.");
+ error(messages[46]);
break;
case 215:
- error("Error 215: Desbordamiento en operaci\xA2n aritm\x82tica.");
+ error(messages[47]);
break;
case 216:
- error("Error 216: Acceso a memoria sin asignar.");
+ error(messages[48]);
break;
case 250:
- error("Error 250: El driver de AdLib no est\xA0 instalado.");
+ error(messages[49]);
break;
case 251:
- error("Error 251: Libre para AdLib.");
+ error(messages[50]);
break;
case 252:
- error("Error 252: No se encontr\xA2 el fichero de efectos para SBlaster.");
+ error(messages[51]);
break;
case 253:
- error("Error 253: No se encontr\xA2 el fichero de m\xA3sica para SBlaster.");
+ error(messages[52]);
break;
case 254:
- error("Error 254: Libre para el fichero de configuraci\xA2n del sonido.");
+ error(messages[53]);
break;
case 255:
- error("Error 255: Detectado Ctrl-Break.");
+ error(messages[54]);
break;
case 256:
- error("Error 256: La tarjeta de video no soporta el modo gr\xA0"
- "fico requerido.");
+ error(messages[55]);
break;
case 257:
- error("Error 257: El tipo de pantalla no es correcto.");
+ error(messages[56]);
break;
case 258:
- error("Error 258: No se encontr\xA2 el fichero con la imagen del menu.");
+ error(messages[57]);
break;
case 259:
- error("Error 259: Clave de protecci\xA2n erronea.");
+ error(messages[58]);
break;
case 260:
- error("Error 260: No se encontr\xA2 el driver del modo X de v\xA1"
- "deo.");
+ error(messages[59]);
break;
case 261:
- error("Error 261: No se encontr\xA2 el fichero de datos de los objetos.");
+ error(messages[60]);
break;
case 262:
- error("Error 262: No se encontr\xA2 el fichero de los BITMAP.");
+ error(messages[61]);
break;
case 263:
- error("Error 263: No se encontr\xA2 el fichero de paleta para la imagen girando.");
+ error(messages[62]);
break;
case 264:
- error("Error 264: Se desbord\xA2 la pila de montaje de bitmaps");
+ error(messages[63]);
break;
case 265:
- error("Error 265: No se encontr\xA2 el fichero de la animaci\xA2n.");
+ error(messages[64]);
break;
case 266:
- error("Error 266: No se encontr\xA2 el fichero del efecto de sonido.");
+ error(messages[65]);
break;
case 267:
- error("Error 267: No se encontr\xA2 el fichero de la melodia.");
+ error(messages[66]);
break;
case 268:
- error("Error 268: No se encontr\xA2 el driver de sonido MIDI.");
+ error(messages[67]);
break;
case 269:
- error("Error 269: No se pudo capturar un vector de interrupci\xA2n.");
+ error(messages[68]);
break;
case 270:
- error("Error 270: No se encontr\xA2 el fichero de los cr\x82"
- "ditos.");
+ error(messages[69]);
break;
case 271:
- error("Error 271: No se encontr\xA2 el fichero del BitMap del sello.");
+ error(messages[70]);
break;
case 272:
- error("Error 272: No se encontr\xA2 el fichero de la animaci\xA2n.");
+ error(messages[71]);
break;
case 273:
- error("Error 273: No se encontraron los \xA1"
- "ndices de los modos X de acceso a v\xA1"
- "deo.");
+ error(messages[72]);
break;
case 274:
- error("Error 274: Fichero de datos corrupto, instale de nuevo el programa.");
+ error(messages[73]);
break;
case 275:
- error("Error 275: Posici\xA2n incorrecta del Sprite.");
+ error(messages[74]);
break;
case 276:
- error("Error 276: Alineaci\xA2n incorrecta del driver de sonido.");
+ error(messages[75]);
break;
case 277:
- error("Error 277: No se encontr\xA2 el fichero de la animaci\xA2n.");
+ error(messages[76]);
break;
case 278:
- error("Error 278: No se encontr\xA2 el fichero para la actualizaci\xA2n.");
+ error(messages[77]);
break;
case 279:
- error("Error 279: No se actualiz\xA2 el puntero del rat\xA2n.");
+ error(messages[78]);
break;
case 280:
- error("Error 280: No se encontr\xA2 el puntero de video.");
+ error(messages[79]);
break;
case 281:
- error("Error 281: No se actualiz\xA2 el puntero de video.");
+ error(messages[80]);
break;
case 282:
- error("Error 282: No se actualiz\xA2 el flag del trace.");
+ error(messages[81]);
break;
case 299:
- error("Error 299: No se pudo reubicar los datos en la memoria XMS.");
+ error(messages[82]);
break;
case 300:
- error("Error 300: No hay memoria XMS suficiente.");
+ error(messages[83]);
break;
case 301:
- error("Error 301: No se pudo reservar memoria XMS suficiente.");
+ error(messages[84]);
break;
case 302:
- error("Error 302: No se pudo liberar la memoria XMS.");
+ error(messages[85]);
break;
case 303:
- error("Error 303: No se encuentra disponible un handle para XMS.");
+ error(messages[86]);
break;
case 304:
- error("Error 304: No se encontr\xA2 el fichero de gr\xA0"
- "ficos.");
+ error(messages[87]);
break;
case 305:
- error("Error 305: Necesita una versi\xA2n 6.0 o posterior del driver del rat\xA2n.");
+ error(messages[88]);
break;
case 306:
- error("Error 306: No se pudo inicializar correctamente el driver del rat\xA2n.");
+ error(messages[89]);
break;
case 307:
- error("Error 307: No hay memoria baja suficiente.");
+ error(messages[90]);
break;
case 308:
- error("Error 308: No se pudo inicializar correctamente el modo gr\xA0"
- "fico.");
+ error(messages[91]);
break;
case 309:
- error("Error 309: No se pudieron inicializar correctamente los tipos de letra.");
+ error(messages[92]);
break;
case 310:
- error("Error 310: No se encontr\xA2 el fichero de paleta.");
+ error(messages[93]);
break;
case 311:
- error("Error 311: No se encontr\xA2 el fichero de paleta para fundido.");
+ error(messages[94]);
break;
case 312:
- error("Error 312: No se encontr\xA2 el fichero de los BITMAP del inventario.");
+ error(messages[95]);
break;
case 313:
- error("Error 313: No se encontr\xA2 el fichero de hipertexto.");
+ error(messages[96]);
break;
case 314:
- error("Error 314: No se encontr\xA2 el fichero del arbol de conversaciones.");
+ error(messages[97]);
break;
case 315:
- error("Error 315: No se encontr\xA2 el fichero de la pantalla a pintar.");
+ error(messages[98]);
break;
case 316:
- error("Error 316: No se encontr\xA2 el fichero de la pantalla a cargar.");
+ error(messages[99]);
break;
case 317:
- error("Error 317: No se encontr\xA2 el fichero de las mascaras del rat\xA2n.");
+ error(messages[100]);
break;
case 318:
- error("Error 318: No se encontr\xA2 el fichero del diploma.");
+ error(messages[101]);
break;
case 319:
- error("Error 319: No se encontr\xA2 el fichero de los objetos en pantalla.");
+ error(messages[102]);
break;
case 320:
- error("Error 320: No se encontr\xA2 el fichero de la rejilla de pantalla.");
+ error(messages[103]);
break;
case 321:
- error("Error 321: No se encontr\xA2 el fichero del objeto rotando.");
+ error(messages[104]);
break;
case 322:
- error("Error 322: No se encontr\xA2 el fichero de la partida salvada.");
+ error(messages[105]);
break;
case 323:
- error("Error 323: No se encontr\xA2 el fichero de configuraci\xA2n.");
+ error(messages[106]);
break;
default: {
if (code >= 7 && code <= 11) {
- error("Error %d: Espera... Espera... La placa madre est\xA0 teniendo gemelos", code);
+ error(messages[107], code);
} else if (code >= 19 && code <= 99) {
- error("Error %d: Mi, mi, mi, mi, mi.... etc.", code);
+ error(messages[108], code);
} else if (code >= 107 && code <= 149) {
- error("Error %d: Tr\xA0"
- "fico intenso en el bus de datos.",
+ error(messages[109],
code);
} else if (code >= 163 && code <= 199) {
- error("Error %d: No sabe, no contesta.", code);
+ error(messages[110], code);
} else if (code >= 217 && code <= 249) {
- error("Error %d: Dios mio... estoy lleno de chips.", code);
+ error(messages[111], code);
} else if (code >= 283 && code <= 298) {
- error("Error %d: Coffe not found. Operator Halted.", code);
+ error(messages[112], code);
} else {
- error("Error %d: La parab\xA2lica est\xA0 mal orientada.", code);
+ error(messages[113], code);
}
}
}
Commit: 63801e6efdb08beb77d0a48b8dcaf8bdfc5f9857
https://github.com/scummvm/scummvm/commit/63801e6efdb08beb77d0a48b8dcaf8bdfc5f9857
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:55+02:00
Commit Message:
TOT: Cleanup of includes
Changed paths:
engines/tot/anims.cpp
engines/tot/chrono.cpp
engines/tot/detection.cpp
engines/tot/dialog.cpp
engines/tot/engine.cpp
engines/tot/graphics.h
engines/tot/midi.cpp
engines/tot/midi.h
engines/tot/mouse.cpp
engines/tot/mouse.h
engines/tot/saveload.cpp
engines/tot/sound.cpp
engines/tot/sound.h
engines/tot/statics.h
engines/tot/tot.cpp
engines/tot/types.h
engines/tot/util.cpp
engines/tot/util.h
diff --git a/engines/tot/anims.cpp b/engines/tot/anims.cpp
index 24d0f49105d..93a47f91630 100644
--- a/engines/tot/anims.cpp
+++ b/engines/tot/anims.cpp
@@ -20,16 +20,10 @@
*/
#include "common/debug.h"
-#include "common/events.h"
-#include "common/file.h"
#include "common/substream.h"
-#include "common/system.h"
-#include "common/textconsole.h"
-#include "graphics/paletteman.h"
#include "tot/anims.h"
#include "tot/decoder/TotFlicDecoder.h"
-#include "tot/graphics.h"
#include "tot/statics.h"
#include "tot/tot.h"
#include "tot/util.h"
diff --git a/engines/tot/chrono.cpp b/engines/tot/chrono.cpp
index 0810ea58f68..79cdea6ad92 100644
--- a/engines/tot/chrono.cpp
+++ b/engines/tot/chrono.cpp
@@ -21,7 +21,6 @@
#include "common/system.h"
-#include "chrono.h"
#include "tot/chrono.h"
#include "tot/tot.h"
@@ -53,9 +52,9 @@ void ChronoManager::updateChrono() {
void ChronoManager::changeSpeed() {
if (_speedMultiplier == 1)
- g_engine->_chrono->_speedMultiplier = 4;
+ _speedMultiplier = 4;
else
- g_engine->_chrono->_speedMultiplier = 1;
+ _speedMultiplier = 1;
}
void ChronoManager::delay(int ms) {
diff --git a/engines/tot/detection.cpp b/engines/tot/detection.cpp
index fe89f8a2a9e..074e1b4478e 100644
--- a/engines/tot/detection.cpp
+++ b/engines/tot/detection.cpp
@@ -19,13 +19,6 @@
*
*/
-#include "base/plugins.h"
-#include "common/config-manager.h"
-#include "common/file.h"
-#include "common/md5.h"
-#include "common/str-array.h"
-#include "common/translation.h"
-#include "common/util.h"
#include "tot/detection.h"
#include "tot/detection_tables.h"
diff --git a/engines/tot/dialog.cpp b/engines/tot/dialog.cpp
index 8c02dbc0a36..6a075e273b1 100644
--- a/engines/tot/dialog.cpp
+++ b/engines/tot/dialog.cpp
@@ -19,9 +19,6 @@
*
*/
-#include "common/scummsys.h"
-#include "common/textconsole.h"
-
#include "tot/dialog.h"
#include "tot/tot.h"
diff --git a/engines/tot/engine.cpp b/engines/tot/engine.cpp
index 956492c5010..555b0fc19e2 100644
--- a/engines/tot/engine.cpp
+++ b/engines/tot/engine.cpp
@@ -19,8 +19,6 @@
*
*/
-#include "common/debug.h"
-#include "common/endian.h"
#include "common/savefile.h"
#include "image/png.h"
diff --git a/engines/tot/graphics.h b/engines/tot/graphics.h
index 8759ad3870c..dced943460d 100644
--- a/engines/tot/graphics.h
+++ b/engines/tot/graphics.h
@@ -21,9 +21,7 @@
#ifndef TOT_GRAPHICS_H
#define TOT_GRAPHICS_H
-#include "common/scummsys.h"
#include "common/system.h"
-#include "graphics/font.h"
#include "graphics/fonts/bgifont.h"
diff --git a/engines/tot/midi.cpp b/engines/tot/midi.cpp
index 121f507b265..775ee531d3f 100644
--- a/engines/tot/midi.cpp
+++ b/engines/tot/midi.cpp
@@ -19,9 +19,7 @@
*
*/
-#include "audio/adlib_ms.h"
#include "audio/midiparser.h"
-#include "common/debug.h"
#include "common/file.h"
#include "tot/midi.h"
diff --git a/engines/tot/midi.h b/engines/tot/midi.h
index ecbc9f99fee..a4d24e1521c 100644
--- a/engines/tot/midi.h
+++ b/engines/tot/midi.h
@@ -23,7 +23,6 @@
#define TOT_MIDI_H
#include "audio/adlib_ms.h"
-#include "audio/mididrv.h"
#include "audio/mididrv_ms.h"
#include "audio/midiparser.h"
diff --git a/engines/tot/mouse.cpp b/engines/tot/mouse.cpp
index 79ca0e0cca3..c7f2f770a34 100644
--- a/engines/tot/mouse.cpp
+++ b/engines/tot/mouse.cpp
@@ -18,15 +18,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-
-#include "common/file.h"
-#include "common/system.h"
#include "graphics/cursorman.h"
#include "tot/mouse.h"
#include "tot/tot.h"
#include "tot/util.h"
-#include "mouse.h"
namespace Tot {
diff --git a/engines/tot/mouse.h b/engines/tot/mouse.h
index f7878dd9e39..0d27761f3b2 100644
--- a/engines/tot/mouse.h
+++ b/engines/tot/mouse.h
@@ -21,11 +21,6 @@
#ifndef TOT_MOUSE_H
#define TOT_MOUSE_H
-#include "common/rect.h"
-#include "common/scummsys.h"
-
-#include "tot/chrono.h"
-
namespace Tot {
struct MouseMask {
diff --git a/engines/tot/saveload.cpp b/engines/tot/saveload.cpp
index 6f4a6e9ac87..127cb012424 100644
--- a/engines/tot/saveload.cpp
+++ b/engines/tot/saveload.cpp
@@ -18,11 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-#include "gui/saveload.h"
-#include "common/error.h"
-#include "common/savefile.h"
-#include "common/serializer.h"
-#include "common/system.h"
#include "gui/message.h"
#include "tot/forest.h"
diff --git a/engines/tot/sound.cpp b/engines/tot/sound.cpp
index 82620ff34f2..2c6702ddcba 100644
--- a/engines/tot/sound.cpp
+++ b/engines/tot/sound.cpp
@@ -18,17 +18,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-
-#include "audio/adlib_ms.h"
-#include "audio/audiostream.h"
#include "audio/decoders/voc.h"
-#include "audio/midiparser.h"
-#include "audio/midiplayer.h"
#include "audio/mixer.h"
#include "audio/softsynth/pcspk.h"
#include "common/config-manager.h"
-#include "common/memstream.h"
-#include "common/substream.h"
#include "tot/sound.h"
#include "tot/tot.h"
diff --git a/engines/tot/sound.h b/engines/tot/sound.h
index 3272200ddec..c1ce83a7f2a 100644
--- a/engines/tot/sound.h
+++ b/engines/tot/sound.h
@@ -21,11 +21,7 @@
#ifndef TOT_SOUND_H
#define TOT_SOUND_H
-#include "audio/audiostream.h"
#include "audio/decoders/raw.h"
-#include "audio/mididrv.h"
-#include "audio/midiparser.h"
-#include "audio/midiplayer.h"
#include "audio/mixer.h"
#include "common/file.h"
diff --git a/engines/tot/statics.h b/engines/tot/statics.h
index 27d7734f88b..4e56514c612 100644
--- a/engines/tot/statics.h
+++ b/engines/tot/statics.h
@@ -1143,17 +1143,6 @@ static const char *const hardcodedObjects_EN[] = {
"FREE"
};
-enum HOTKEYS {
- TALK = 0,
- PICKUP = 1,
- LOOKAT = 2,
- USE = 3,
- OPEN = 4,
- CLOSE = 5,
- YES = 6,
- NO = 7
-};
-
static const Common::KeyCode hotkeys[2][8]{
// Spanish
{// TALK
diff --git a/engines/tot/tot.cpp b/engines/tot/tot.cpp
index 8277573d788..8ed70c3470e 100644
--- a/engines/tot/tot.cpp
+++ b/engines/tot/tot.cpp
@@ -26,8 +26,6 @@
#include "common/system.h"
#include "engines/util.h"
-#include "graphics/framelimiter.h"
-#include "graphics/paletteman.h"
#include "tot/anims.h"
#include "tot/chrono.h"
@@ -107,7 +105,6 @@ int TotEngine::engineStart() {
loadCharAnimation();
loadInventory();
-
_sound->setMidiVolume(0, 0);
_sound->playMidi("SILENT", false);
@@ -1304,17 +1301,19 @@ void TotEngine::mainMenu(bool fade) {
_sound->stopVoc();
int32 offset = getOffsetsByCurrentLanguage()[1];
-
+ _mouse->hide();
if (fade)
drawFlc(0, 0, offset, 0, 9, 0, true, false, false, bar);
else
drawFlc(0, 0, offset, 0, 9, 0, false, false, false, bar);
+
if (_cpCounter2 > 10)
showError(274);
_mouse->mouseX = 160;
_mouse->mouseY = 95;
_mouse->mouseMaskIndex = 1;
_mouse->warpMouse(_mouse->mouseMaskIndex, _mouse->mouseX, _mouse->mouseY);
+ _mouse->show();
Common::Event e;
do {
_chrono->updateChrono();
diff --git a/engines/tot/types.h b/engines/tot/types.h
index b0d42270429..2fb63bcc980 100644
--- a/engines/tot/types.h
+++ b/engines/tot/types.h
@@ -279,6 +279,17 @@ struct SavedGame {
typedef byte Palette[768];
+enum HOTKEYS {
+ TALK = 0,
+ PICKUP = 1,
+ LOOKAT = 2,
+ USE = 3,
+ OPEN = 4,
+ CLOSE = 5,
+ YES = 6,
+ NO = 7
+};
+
} // End of namespace Tot
#endif
diff --git a/engines/tot/util.cpp b/engines/tot/util.cpp
index c1c7bed44c8..e68bfa6de6e 100644
--- a/engines/tot/util.cpp
+++ b/engines/tot/util.cpp
@@ -21,6 +21,7 @@
#include "common/textconsole.h"
#include "graphics/paletteman.h"
+#include "tot/statics.h"
#include "tot/tot.h"
#include "tot/util.h"
@@ -31,330 +32,328 @@ const int kEnforcedTextAnimDelay = 0;
void showError(int code) {
const char *const *messages = (isLanguageSpanish()) ? errorMessages[0] : errorMessages[1];
-
switch (code) {
case 1:
- error(messages[0]);
+ error("%s", messages[0]);
break;
case 2:
- error(messages[1]);
+ error("%s", messages[1]);
break;
case 3:
- error(messages[2]);
+ error("%s", messages[2]);
break;
case 4:
- error(messages[3]);
+ error("%s", messages[3]);
break;
case 5:
- error(messages[4]);
+ error("%s", messages[4]);
break;
case 6:
- error(messages[5]);
+ error("%s", messages[5]);
break;
case 12:
- error(messages[6]);
+ error("%s", messages[6]);
break;
case 13:
case 14:
- error(messages[7],
- code);
+ error(messages[7], code);
break;
case 15:
- error(messages[8]);
+ error("%s", messages[8]);
break;
case 16:
- error(messages[9]);
+ error("%s", messages[9]);
break;
case 17:
- error(messages[10]);
+ error("%s", messages[10]);
break;
case 18:
- error(messages[11]);
+ error("%s", messages[11]);
break;
case 100:
- error(messages[12]);
+ error("%s", messages[12]);
break;
case 101:
- error(messages[13]);
+ error("%s", messages[13]);
break;
case 102:
- error(messages[14]);
+ error("%s", messages[14]);
break;
case 103:
- error(messages[15]);
+ error("%s", messages[15]);
break;
case 104:
- error(messages[16]);
+ error("%s", messages[16]);
break;
case 105:
- error(messages[17]);
+ error("%s", messages[17]);
break;
case 106:
- error(messages[18]);
+ error("%s", messages[18]);
break;
case 150:
- error(messages[19]);
+ error("%s", messages[19]);
break;
case 151:
- error(messages[20]);
+ error("%s", messages[20]);
break;
case 152:
- error(messages[21]);
+ error("%s", messages[21]);
break;
case 153:
- error(messages[22]);
+ error("%s", messages[22]);
break;
case 154:
- error(messages[23]);
+ error("%s", messages[23]);
break;
case 155:
error(messages[24], code);
break;
case 156:
- error(messages[25]);
+ error("%s", messages[25]);
break;
case 157:
- error(messages[26]);
+ error("%s", messages[26]);
break;
case 158:
- error(messages[27]);
+ error("%s", messages[27]);
break;
case 159:
- error(messages[28]);
+ error("%s", messages[28]);
break;
case 160:
- error(messages[29]);
+ error("%s", messages[29]);
break;
case 161:
- error(messages[30]);
+ error("%s", messages[30]);
break;
case 162:
- error(messages[31]);
+ error("%s", messages[31]);
break;
case 200:
- error(messages[32]);
+ error("%s", messages[32]);
break;
case 201:
- error(messages[33]);
+ error("%s", messages[33]);
break;
case 202:
- error(messages[34]);
+ error("%s", messages[34]);
break;
case 203:
- error(messages[35]);
+ error("%s", messages[35]);
break;
case 204:
- error(messages[36]);
+ error("%s", messages[36]);
break;
case 205:
- error(messages[37]);
+ error("%s", messages[37]);
break;
case 206:
- error(messages[38]);
+ error("%s", messages[38]);
break;
case 207:
- error(messages[39]);
+ error("%s", messages[39]);
break;
case 208:
- error(messages[40]);
+ error("%s", messages[40]);
break;
case 209:
- error(messages[41]);
+ error("%s", messages[41]);
break;
case 210:
- error(messages[42]);
+ error("%s", messages[42]);
break;
case 211:
- error(messages[43]);
+ error("%s", messages[43]);
break;
case 212:
- error(messages[44]);
+ error("%s", messages[44]);
break;
case 213:
- error(messages[45]);
+ error("%s", messages[45]);
break;
case 214:
- error(messages[46]);
+ error("%s", messages[46]);
break;
case 215:
- error(messages[47]);
+ error("%s", messages[47]);
break;
case 216:
- error(messages[48]);
+ error("%s", messages[48]);
break;
case 250:
- error(messages[49]);
+ error("%s", messages[49]);
break;
case 251:
- error(messages[50]);
+ error("%s", messages[50]);
break;
case 252:
- error(messages[51]);
+ error("%s", messages[51]);
break;
case 253:
- error(messages[52]);
+ error("%s", messages[52]);
break;
case 254:
- error(messages[53]);
+ error("%s", messages[53]);
break;
case 255:
- error(messages[54]);
+ error("%s", messages[54]);
break;
case 256:
- error(messages[55]);
+ error("%s", messages[55]);
break;
case 257:
- error(messages[56]);
+ error("%s", messages[56]);
break;
case 258:
- error(messages[57]);
+ error("%s", messages[57]);
break;
case 259:
- error(messages[58]);
+ error("%s", messages[58]);
break;
case 260:
- error(messages[59]);
+ error("%s", messages[59]);
break;
case 261:
- error(messages[60]);
+ error("%s", messages[60]);
break;
case 262:
- error(messages[61]);
+ error("%s", messages[61]);
break;
case 263:
- error(messages[62]);
+ error("%s", messages[62]);
break;
case 264:
- error(messages[63]);
+ error("%s", messages[63]);
break;
case 265:
- error(messages[64]);
+ error("%s", messages[64]);
break;
case 266:
- error(messages[65]);
+ error("%s", messages[65]);
break;
case 267:
- error(messages[66]);
+ error("%s", messages[66]);
break;
case 268:
- error(messages[67]);
+ error("%s", messages[67]);
break;
case 269:
- error(messages[68]);
+ error("%s", messages[68]);
break;
case 270:
- error(messages[69]);
+ error("%s", messages[69]);
break;
case 271:
- error(messages[70]);
+ error("%s", messages[70]);
break;
case 272:
- error(messages[71]);
+ error("%s", messages[71]);
break;
case 273:
- error(messages[72]);
+ error("%s", messages[72]);
break;
case 274:
- error(messages[73]);
+ error("%s", messages[73]);
break;
case 275:
- error(messages[74]);
+ error("%s", messages[74]);
break;
case 276:
- error(messages[75]);
+ error("%s", messages[75]);
break;
case 277:
- error(messages[76]);
+ error("%s", messages[76]);
break;
case 278:
- error(messages[77]);
+ error("%s", messages[77]);
break;
case 279:
- error(messages[78]);
+ error("%s", messages[78]);
break;
case 280:
- error(messages[79]);
+ error("%s", messages[79]);
break;
case 281:
- error(messages[80]);
+ error("%s", messages[80]);
break;
case 282:
- error(messages[81]);
+ error("%s", messages[81]);
break;
case 299:
- error(messages[82]);
+ error("%s", messages[82]);
break;
case 300:
- error(messages[83]);
+ error("%s", messages[83]);
break;
case 301:
- error(messages[84]);
+ error("%s", messages[84]);
break;
case 302:
- error(messages[85]);
+ error("%s", messages[85]);
break;
case 303:
- error(messages[86]);
+ error("%s", messages[86]);
break;
case 304:
- error(messages[87]);
+ error("%s", messages[87]);
break;
case 305:
- error(messages[88]);
+ error("%s", messages[88]);
break;
case 306:
- error(messages[89]);
+ error("%s", messages[89]);
break;
case 307:
- error(messages[90]);
+ error("%s", messages[90]);
break;
case 308:
- error(messages[91]);
+ error("%s", messages[91]);
break;
case 309:
- error(messages[92]);
+ error("%s", messages[92]);
break;
case 310:
- error(messages[93]);
+ error("%s", messages[93]);
break;
case 311:
- error(messages[94]);
+ error("%s", messages[94]);
break;
case 312:
- error(messages[95]);
+ error("%s", messages[95]);
break;
case 313:
- error(messages[96]);
+ error("%s", messages[96]);
break;
case 314:
- error(messages[97]);
+ error("%s", messages[97]);
break;
case 315:
- error(messages[98]);
+ error("%s", messages[98]);
break;
case 316:
- error(messages[99]);
+ error("%s", messages[99]);
break;
case 317:
- error(messages[100]);
+ error("%s", messages[100]);
break;
case 318:
- error(messages[101]);
+ error("%s", messages[101]);
break;
case 319:
- error(messages[102]);
+ error("%s", messages[102]);
break;
case 320:
- error(messages[103]);
+ error("%s", messages[103]);
break;
case 321:
- error(messages[104]);
+ error("%s", messages[104]);
break;
case 322:
- error(messages[105]);
+ error("%s", messages[105]);
break;
case 323:
- error(messages[106]);
+ error("%s", messages[106]);
break;
default: {
if (code >= 7 && code <= 11) {
@@ -499,4 +498,34 @@ void waitForKey() {
uint Random(uint range) { return g_engine->getRandomNumber(range); }
int Random(int range) { return g_engine->getRandomNumber(range - 1); }
+Common::String getObjectName(int idx) {
+ return g_engine->_lang == Common::ES_ESP ? hardcodedObjects_ES[idx] : hardcodedObjects_EN[idx];
+}
+
+Common::KeyCode hotKeyFor(HOTKEYS hotkey) {
+ const Common::KeyCode *selectedHotkeys = (g_engine->_lang == Common::ES_ESP)? hotkeys[0]: hotkeys[1];
+ return selectedHotkeys[hotkey];
+};
+
+Common::String getActionLineText(int idx) {
+ return g_engine->_lang == Common::ES_ESP ? actionLine_ES[idx] : actionLine_EN[idx];
+}
+
+const char *const *getFullScreenMessagesByCurrentLanguage() {
+ return (g_engine->_lang == Common::ES_ESP) ? fullScreenMessages[0] : fullScreenMessages[1];
+}
+
+const char *const *getAnimMessagesByCurrentLanguage() {
+ return (g_engine->_lang == Common::ES_ESP) ? animMessages[0] : animMessages[1];
+}
+
+const char *const *getHardcodedObjectsByCurrentLanguage() {
+ return (g_engine->_lang == Common::ES_ESP) ? hardcodedObjects_ES : hardcodedObjects_EN;
+}
+
+const int32 *getOffsetsByCurrentLanguage() {
+ return (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0] : flcOffsets[1];
+}
+
+
} // End of namespace Tot
diff --git a/engines/tot/util.h b/engines/tot/util.h
index fdcc3e5e787..49420255cf8 100644
--- a/engines/tot/util.h
+++ b/engines/tot/util.h
@@ -21,13 +21,6 @@
#ifndef TOT_UTIL_H
#define TOT_UTIL_H
-#include "common/endian.h"
-#include "common/events.h"
-#include "common/language.h"
-#include "common/scummsys.h"
-#include "graphics/font.h"
-
-#include "tot/statics.h"
#include "tot/tot.h"
namespace Tot {
@@ -74,33 +67,19 @@ inline bool odd(int32 i) { return i % 2 != 0; }
uint Random(uint range);
int Random(int range);
-inline Common::String getObjectName(int idx) {
- return g_engine->_lang == Common::ES_ESP ? hardcodedObjects_ES[idx] : hardcodedObjects_EN[idx];
-}
+Common::String getObjectName(int idx);
-inline Common::String getActionLineText(int idx) {
- return g_engine->_lang == Common::ES_ESP ? actionLine_ES[idx] : actionLine_EN[idx];
-}
-inline Common::KeyCode hotKeyFor(HOTKEYS hotkey) {
- const Common::KeyCode *selectedHotkeys = (g_engine->_lang == Common::ES_ESP)? hotkeys[0]: hotkeys[1];
- return selectedHotkeys[hotkey];
-};
+Common::KeyCode hotKeyFor(HOTKEYS hotkey);
+
+Common::String getActionLineText(int idx);
-inline const char *const *getFullScreenMessagesByCurrentLanguage() {
- return (g_engine->_lang == Common::ES_ESP) ? fullScreenMessages[0] : fullScreenMessages[1];
-}
+const char *const *getFullScreenMessagesByCurrentLanguage();
-inline const char *const *getAnimMessagesByCurrentLanguage() {
- return (g_engine->_lang == Common::ES_ESP) ? animMessages[0] : animMessages[1];
-}
+const char *const *getAnimMessagesByCurrentLanguage();
-inline const char *const *getHardcodedObjectsByCurrentLanguage() {
- return (g_engine->_lang == Common::ES_ESP) ? hardcodedObjects_ES : hardcodedObjects_EN;
-}
+const char *const *getHardcodedObjectsByCurrentLanguage();
-inline const int32 *getOffsetsByCurrentLanguage() {
- return (g_engine->_lang == Common::ES_ESP) ? flcOffsets[0] : flcOffsets[1];
-}
+const int32 *getOffsetsByCurrentLanguage();
inline bool isLanguageSpanish() {
return g_engine->_lang == Common::ES_ESP;
Commit: 34e62122555c64b1709640a29fb38beb02f93b65
https://github.com/scummvm/scummvm/commit/34e62122555c64b1709640a29fb38beb02f93b65
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:55+02:00
Commit Message:
TOT: Adds string in saveload to translatables
Changed paths:
engines/tot/POTFILES
engines/tot/saveload.cpp
diff --git a/engines/tot/POTFILES b/engines/tot/POTFILES
index 2f5dad43330..69eb7227358 100644
--- a/engines/tot/POTFILES
+++ b/engines/tot/POTFILES
@@ -1 +1,2 @@
engines/tot/metaengine.cpp
+engines/tot/saveload.cpp
diff --git a/engines/tot/saveload.cpp b/engines/tot/saveload.cpp
index 127cb012424..61910baa0ce 100644
--- a/engines/tot/saveload.cpp
+++ b/engines/tot/saveload.cpp
@@ -18,6 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
+#include "common/translation.h"
#include "gui/message.h"
#include "tot/forest.h"
@@ -151,7 +152,6 @@ bool syncRoomData(Common::Serializer &s, Common::MemorySeekableReadWriteStream *
byte *roomBuf = (byte *)malloc(size);
s.syncBytes(roomBuf, size);
- debug("Loading room data now");
g_engine->_rooms = new Common::MemorySeekableReadWriteStream(roomBuf, size, DisposeAfterUse::NO);
}
return true;
@@ -172,7 +172,6 @@ bool syncConversationData(Common::Serializer &s, Common::MemorySeekableReadWrite
delete (g_engine->_conversationData);
byte *convBuf = (byte *)malloc(size);
s.syncBytes(convBuf, size);
- debug("Loading conversation data now");
g_engine->_conversationData = new Common::MemorySeekableReadWriteStream(convBuf, size, DisposeAfterUse::NO);
}
return true;
@@ -191,7 +190,6 @@ bool syncItemData(Common::Serializer &s, Common::MemorySeekableReadWriteStream *
delete (g_engine->_sceneObjectsData);
byte *objBuf = (byte *)malloc(size);
s.syncBytes(objBuf, size);
- debug("Loading item data now");
g_engine->_sceneObjectsData = new Common::MemorySeekableReadWriteStream(objBuf, size, DisposeAfterUse::NO);
}
return true;
@@ -264,7 +262,7 @@ Common::Error TotEngine::saveGameStream(Common::WriteStream *stream, bool isAuto
Common::Error TotEngine::loadGameStream(Common::SeekableReadStream *stream) {
byte version = stream->readByte();
if (version > SAVEGAME_CURRENT_VERSION) {
- GUI::MessageDialog dialog(Common::String("Saved game was created with a newer version of ScummVM. Unable to load."));
+ GUI::MessageDialog dialog(_("Saved game was created with a newer version of ScummVM. Unable to load."));
dialog.runModal();
return Common::kUnknownError;
}
Commit: 3a2479aedd4c9febeea5c78ddbbc34cb332af8d9
https://github.com/scummvm/scummvm/commit/3a2479aedd4c9febeea5c78ddbbc34cb332af8d9
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:55+02:00
Commit Message:
TOT: Remove unused Random function
Changed paths:
engines/tot/util.cpp
engines/tot/util.h
diff --git a/engines/tot/util.cpp b/engines/tot/util.cpp
index e68bfa6de6e..c3fe7c9b95a 100644
--- a/engines/tot/util.cpp
+++ b/engines/tot/util.cpp
@@ -495,7 +495,6 @@ void waitForKey() {
}
}
-uint Random(uint range) { return g_engine->getRandomNumber(range); }
int Random(int range) { return g_engine->getRandomNumber(range - 1); }
Common::String getObjectName(int idx) {
diff --git a/engines/tot/util.h b/engines/tot/util.h
index 49420255cf8..5eed533f166 100644
--- a/engines/tot/util.h
+++ b/engines/tot/util.h
@@ -64,7 +64,6 @@ void changeGameSpeed(Common::Event e);
inline bool odd(int32 i) { return i % 2 != 0; }
-uint Random(uint range);
int Random(int range);
Common::String getObjectName(int idx);
Commit: 21adf5fadcb893b9fa8755203f78613949919ea3
https://github.com/scummvm/scummvm/commit/21adf5fadcb893b9fa8755203f78613949919ea3
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:55+02:00
Commit Message:
TOT: Changes key events to EVENT_KEYDOWN
Changed paths:
engines/tot/anims.cpp
engines/tot/cutscenes.cpp
engines/tot/engine.cpp
engines/tot/tot.cpp
engines/tot/util.cpp
diff --git a/engines/tot/anims.cpp b/engines/tot/anims.cpp
index 93a47f91630..cba07ea2345 100644
--- a/engines/tot/anims.cpp
+++ b/engines/tot/anims.cpp
@@ -840,7 +840,7 @@ static void exitProcedure(bool &exitLoop, bool isSkipAllowed) {
Common::Event e;
while (g_system->getEventManager()->pollEvent(e)) {
changeGameSpeed(e);
- if (isSkipAllowed && (e.type == Common::EVENT_KEYUP || (e.type == Common::EVENT_LBUTTONUP))) {
+ if (isSkipAllowed && (e.type == Common::EVENT_KEYDOWN || (e.type == Common::EVENT_LBUTTONUP))) {
exitLoop = true;
}
}
diff --git a/engines/tot/cutscenes.cpp b/engines/tot/cutscenes.cpp
index 0480ce1f31d..9e8350a5841 100644
--- a/engines/tot/cutscenes.cpp
+++ b/engines/tot/cutscenes.cpp
@@ -186,7 +186,7 @@ void scrollCredit(
// Loops an image from the bottom of the screen to the top
for (int i = 199; i >= minHeight; i--) {
while (g_system->getEventManager()->pollEvent(e)) {
- if (e.type == Common::EVENT_KEYUP) {
+ if (e.type == Common::EVENT_KEYDOWN) {
keyPressed = true;
}
}
@@ -228,7 +228,7 @@ void removeTitle(byte *&background2) {
for (int i1 = 1; i1 <= 15000; i1++) {
while (g_system->getEventManager()->pollEvent(e)) {
}
- i2 = Random(318);
+ i2 = g_engine->getRandomNumber(318);
j2 = Random(58);
byte *src = background2 + 4 + (j2 * 320) + i2;
byte *dest = ((byte *)g_engine->_screen->getPixels()) + (j2 * 320) + i2;
@@ -260,7 +260,7 @@ void removeTitle(byte *&background2) {
inline bool keyPressed() {
Common::Event e;
g_system->getEventManager()->pollEvent(e);
- return e.type == Common::EVENT_KEYUP;
+ return e.type == Common::EVENT_KEYDOWN;
}
void TotEngine::credits() {
diff --git a/engines/tot/engine.cpp b/engines/tot/engine.cpp
index 555b0fc19e2..9c4e90de483 100644
--- a/engines/tot/engine.cpp
+++ b/engines/tot/engine.cpp
@@ -4613,7 +4613,7 @@ void TotEngine::generateDiploma(Common::String &photoName) {
do {
_screen->update();
while (g_system->getEventManager()->pollEvent(e)) {
- if (e.type == Common::EVENT_KEYUP) {
+ if (e.type == Common::EVENT_KEYDOWN) {
keyPressed = true;
}
}
@@ -4998,7 +4998,7 @@ void TotEngine::soundControls() {
_chrono->updateChrono();
_mouse->animateMouseIfNeeded();
while (g_system->getEventManager()->pollEvent(e)) {
- if (e.type == Common::EVENT_KEYUP) {
+ if (e.type == Common::EVENT_KEYDOWN) {
keyPressed = true;
}
if (e.type == Common::EVENT_LBUTTONDOWN) {
diff --git a/engines/tot/tot.cpp b/engines/tot/tot.cpp
index 8ed70c3470e..cafe139f7b4 100644
--- a/engines/tot/tot.cpp
+++ b/engines/tot/tot.cpp
@@ -170,7 +170,7 @@ int TotEngine::startGame() {
_mouse->mouseX = e.mouse.x;
_mouse->mouseY = e.mouse.y;
}
- if (e.type == Common::EVENT_KEYUP) {
+ if (e.type == Common::EVENT_KEYDOWN) {
changeGameSpeed(e);
switch (e.kbd.keycode) {
diff --git a/engines/tot/util.cpp b/engines/tot/util.cpp
index c3fe7c9b95a..6454cbe05ee 100644
--- a/engines/tot/util.cpp
+++ b/engines/tot/util.cpp
@@ -456,7 +456,7 @@ void line(uint x1, uint y1, uint x2, uint y2, byte color) {
}
void changeGameSpeed(Common::Event e) {
- if (e.type == Common::EVENT_KEYUP) {
+ if (e.type == Common::EVENT_KEYDOWN) {
if (e.kbd.hasFlags(Common::KBD_CTRL)) {
if (e.kbd.keycode == Common::KEYCODE_f) {
g_engine->_chrono->changeSpeed();
Commit: d21d63ea5416142332904f2a28984116537421b2
https://github.com/scummvm/scummvm/commit/d21d63ea5416142332904f2a28984116537421b2
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:55+02:00
Commit Message:
TOT: fix palette indices on sacrifice scene
Changed paths:
engines/tot/cutscenes.cpp
diff --git a/engines/tot/cutscenes.cpp b/engines/tot/cutscenes.cpp
index 9e8350a5841..4d3b5d36008 100644
--- a/engines/tot/cutscenes.cpp
+++ b/engines/tot/cutscenes.cpp
@@ -638,7 +638,7 @@ void TotEngine::sacrificeScene() {
littText(10, 50, messages[24], 255);
littText(10, 70, messages[25], 255);
- for (int i = 0; i < 32; i++) {
+ for (int i = 0; i <= 31; i++) {
setRGBPalette(255, 32 + i, i * 2, i * 2);
setRGBPalette(254, 32 - i, 0, 0);
}
@@ -647,7 +647,7 @@ void TotEngine::sacrificeScene() {
if (shouldQuit())
return;
- for (int i = 32; i > 0; i--) {
+ for (int i = 31; i >= 0; i--) {
setRGBPalette(255, 63 - (32 - i), i * 2, i * 2);
setRGBPalette(254, 32 - i, 0, 0);
}
@@ -812,7 +812,7 @@ void TotEngine::sacrificeScene() {
littText(10, 140, messages[39], 255);
}
- for (int i = 0; i < 32; i++) {
+ for (int i = 0; i <= 31; i++) {
setRGBPalette(255, 32 + i, i * 2, i * 2);
setRGBPalette(254, 32 - i, 0, 0);
}
@@ -820,7 +820,7 @@ void TotEngine::sacrificeScene() {
if (shouldQuit())
return;
- for (int i = 32; i > 0; i--) {
+ for (int i = 31; i >= 0; i--) {
setRGBPalette(255, 63 - (32 - i), i * 2, i * 2);
setRGBPalette(254, 32 - i, 0, 0);
}
@@ -848,14 +848,14 @@ void TotEngine::sacrificeScene() {
littText(10, 80, messages[41], 255);
littText(10, 100, messages[42], 255);
- for (int i = 0; i < 32; i++) {
+ for (int i = 0; i <= 31; i++) {
setRGBPalette(255, 32 + i, i * 2, i * 2);
setRGBPalette(254, 32 - i, 0, 0);
}
delay(7000);
if (shouldQuit())
return;
- for (int i = 32; i > 0; i--) {
+ for (int i = 31; i >= 0; i--) {
setRGBPalette(255, 63 - (32 - i), i * 2, i * 2);
setRGBPalette(254, 32 - i, 0, 0);
}
Commit: d3c4b7bff7c0f1430f4d54152910c8ccbe84b67c
https://github.com/scummvm/scummvm/commit/d3c4b7bff7c0f1430f4d54152910c8ccbe84b67c
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:55+02:00
Commit Message:
TOT: Renames Random function
Changed paths:
engines/tot/cutscenes.cpp
engines/tot/dialog.cpp
engines/tot/engine.cpp
engines/tot/graphics.cpp
engines/tot/util.cpp
engines/tot/util.h
diff --git a/engines/tot/cutscenes.cpp b/engines/tot/cutscenes.cpp
index 4d3b5d36008..d6f4d956a5c 100644
--- a/engines/tot/cutscenes.cpp
+++ b/engines/tot/cutscenes.cpp
@@ -229,7 +229,7 @@ void removeTitle(byte *&background2) {
while (g_system->getEventManager()->pollEvent(e)) {
}
i2 = g_engine->getRandomNumber(318);
- j2 = Random(58);
+ j2 = getRandom(58);
byte *src = background2 + 4 + (j2 * 320) + i2;
byte *dest = ((byte *)g_engine->_screen->getPixels()) + (j2 * 320) + i2;
Common::copy(src, src + 2, dest);
@@ -239,8 +239,8 @@ void removeTitle(byte *&background2) {
Common::copy(src2, src2 + 2, dest2);
- i2 = Random(320);
- j2 = Random(60);
+ i2 = getRandom(320);
+ j2 = getRandom(60);
byte *src3 = background2 + 4 + (j2 * 320) + i2;
byte *dest3 = ((byte *)g_engine->_screen->getPixels()) + (j2 * 320) + i2;
diff --git a/engines/tot/dialog.cpp b/engines/tot/dialog.cpp
index 6a075e273b1..cf0928fcca6 100644
--- a/engines/tot/dialog.cpp
+++ b/engines/tot/dialog.cpp
@@ -556,7 +556,7 @@ void talkToSceneObject() {
} else {
g_engine->readTextFile();
uint foo = 0;
- g_engine->sayLine((Random(10) + 1039), 255, 0, foo, false);
+ g_engine->sayLine((getRandom(10) + 1039), 255, 0, foo, false);
g_engine->_verbFile.close();
if (g_engine->_cpCounter > 198)
showError(274);
diff --git a/engines/tot/engine.cpp b/engines/tot/engine.cpp
index 9c4e90de483..5dfa62bfba7 100644
--- a/engines/tot/engine.cpp
+++ b/engines/tot/engine.cpp
@@ -872,7 +872,7 @@ void TotEngine::useInventoryObjectWithInventoryObject(uint objectCode1, uint obj
readObject(_sceneObjectsData, objectCode1, _curObject);
// verifyCopyProtection2();
if (_curObject.used[0] != 1 || _curObject.useWith != objectCode2) {
- drawText(Random(11) + 1022);
+ drawText(getRandom(11) + 1022);
return;
}
@@ -1085,7 +1085,7 @@ void TotEngine::advanceAnimations(bool barredZone, bool animateMouse) {
if (_chrono->_gameTick) {
if (_currentRoomData->animationFlag && _chrono->_gameTickHalfSpeed) {
- if (_isPeterCoughing && (Random(100) == 1) && !_sound->isVocPlaying() && _mintTopic[0] == false) {
+ if (_isPeterCoughing && (getRandom(100) == 1) && !_sound->isVocPlaying() && _mintTopic[0] == false) {
debug("Playing tos");
_sound->playVoc("TOS", 258006, 14044);
}
@@ -1593,7 +1593,7 @@ void TotEngine::pickupScreenObject() {
} else {
_mouse->show();
- drawText(1049 + Random(10));
+ drawText(1049 + getRandom(10));
_mouse->hide();
return;
}
@@ -1663,7 +1663,7 @@ void TotEngine::pickupScreenObject() {
}
} else {
_mouse->show();
- drawText(1049 + Random(10));
+ drawText(1049 + getRandom(10));
_mouse->hide();
return;
}
@@ -2627,7 +2627,7 @@ void TotEngine::useScreenObject() {
updateAltScreen(24);
}
} else {
- drawText(Random(11) + 1022);
+ drawText(getRandom(11) + 1022);
}
} break;
case 24: {
@@ -2725,7 +2725,7 @@ void TotEngine::useScreenObject() {
updateAltScreen(20);
}
} else {
- drawText(Random(11) + 1022);
+ drawText(getRandom(11) + 1022);
}
} break;
}
@@ -3089,15 +3089,15 @@ void TotEngine::useScreenObject() {
drawFlc(180, 50, offset, 0, 9, 22, false, false, true, foobar);
_shouldQuitGame = true;
} else
- drawText(Random(11) + 1022);
+ drawText(getRandom(11) + 1022);
} break;
}
} else {
goToObject(_currentRoomData->walkAreasGrid[(_characterPosX + kCharacterCorrectionX) / kXGridCount][(_characterPosY + kCharacerCorrectionY) / kYGridCount], _currentRoomData->walkAreasGrid[correctedMouseX][correctedMouseY]);
if (_curObject.code == 536 || _curObject.code == 220)
- drawText(Random(6) + 1033);
+ drawText(getRandom(6) + 1033);
else
- drawText(Random(11) + 1022);
+ drawText(getRandom(11) + 1022);
}
} else { //use object with something on the scene
if (sceneObject > 0) {
@@ -3233,7 +3233,7 @@ void TotEngine::useScreenObject() {
drawText(_curObject.beforeUseTextRef);
} break;
default:
- drawText(1022 + Random(11));
+ drawText(1022 + getRandom(11));
}
}
}
@@ -3260,7 +3260,7 @@ void TotEngine::openScreenObject() {
_currentRoomData->walkAreasGrid[correctedMouseX][correctedMouseY]);
if (_curObject.openable == false) {
- drawText(Random(9) + 1059);
+ drawText(getRandom(9) + 1059);
return;
} else {
shouldSpeak = false;
@@ -3358,7 +3358,7 @@ void TotEngine::openScreenObject() {
break;
}
if (shouldSpeak) {
- drawText(Random(9) + 1059);
+ drawText(getRandom(9) + 1059);
return;
}
_currentRoomData->screenObjectIndex[_currentRoomData->mouseGrid[correctedMouseX][correctedMouseY]]->fileIndex = _curObject.replaceWith;
@@ -3413,7 +3413,7 @@ void TotEngine::closeScreenObject() {
goToObject(_currentRoomData->walkAreasGrid[((_characterPosX + kCharacterCorrectionX) / kXGridCount)][((_characterPosY + kCharacerCorrectionY) / kYGridCount)],
_currentRoomData->walkAreasGrid[correctedMouseX][correctedMouseY]);
if (_curObject.closeable == false) {
- drawText((Random(10) + 1068));
+ drawText((getRandom(10) + 1068));
return;
} else {
shouldSpeak = false;
@@ -3430,7 +3430,7 @@ void TotEngine::closeScreenObject() {
break;
}
if (shouldSpeak) {
- drawText(Random(10) + 1068);
+ drawText(getRandom(10) + 1068);
return;
}
_currentRoomData->screenObjectIndex[_currentRoomData->mouseGrid[correctedMouseX][correctedMouseY]]->fileIndex = _curObject.replaceWith;
@@ -3508,7 +3508,7 @@ void TotEngine::handleAction(byte invPos) {
_mouse->hide();
actionLineText(getActionLineText(1) + _inventory[invPos].objectName);
_mouse->show();
- drawText((Random(10) + 1039));
+ drawText((getRandom(10) + 1039));
_actionCode = 0;
if (_cpCounter > 130)
showError(274);
@@ -3522,7 +3522,7 @@ void TotEngine::handleAction(byte invPos) {
if (_cpCounter2 > 13)
showError(274);
_mouse->show();
- drawText((Random(10) + 1049));
+ drawText((getRandom(10) + 1049));
_actionCode = 0;
_oldGridX = 0;
_oldGridY = 0;
@@ -3560,7 +3560,7 @@ void TotEngine::handleAction(byte invPos) {
_mouse->hide();
actionLineText(getActionLineText(5) + _inventory[invPos].objectName);
_mouse->show();
- drawText(Random(9) + 1059);
+ drawText(getRandom(9) + 1059);
_actionCode = 0;
_oldGridX = 0;
_oldGridY = 0;
@@ -3570,7 +3570,7 @@ void TotEngine::handleAction(byte invPos) {
_mouse->hide();
actionLineText(getActionLineText(6) + _inventory[invPos].objectName);
_mouse->show();
- drawText(Random(10) + 1068);
+ drawText(getRandom(10) + 1068);
_actionCode = 0;
if (_cpCounter2 > 35)
showError(274);
@@ -4550,7 +4550,7 @@ static void loadDiploma(Common::String &photoName, Common::String &key) {
char *passArray = (char *)malloc(10);
for (int i = 0; i < 10; i++)
- passArray[i] = (char)(Random(10) + 48);
+ passArray[i] = (char)(getRandom(10) + 48);
key.append(passArray, passArray + 10);
diff --git a/engines/tot/graphics.cpp b/engines/tot/graphics.cpp
index a4ab916c9cf..674ce28d5d3 100644
--- a/engines/tot/graphics.cpp
+++ b/engines/tot/graphics.cpp
@@ -476,7 +476,7 @@ void GraphicsManager::updateSceneArea(int speed) {
g_engine->_screen->update();
}
void GraphicsManager::sceneTransition(bool fadeToBlack, byte *scene) {
- sceneTransition(fadeToBlack, scene, Random(15) + 1);
+ sceneTransition(fadeToBlack, scene, getRandom(15) + 1);
}
void updateScreenIfNeeded(uint32 &targetTime) {
@@ -841,10 +841,10 @@ void effect12(bool fadeToBlack, byte *scene) {
int i2 = 0, j2 = 0;
if (fadeToBlack) {
for (int i1 = 1; i1 <= 15000; i1++) {
- i2 = Random(318);
- j2 = Random(138);
+ i2 = getRandom(318);
+ j2 = getRandom(138);
bar(i2, j2, (i2 + 2), (j2 + 2), 0);
- putpixel(Random(320), Random(139), 0);
+ putpixel(getRandom(320), getRandom(139), 0);
if (i1 % 100 == 0) {
updateScreenIfNeeded(targetTime);
}
@@ -853,16 +853,16 @@ void effect12(bool fadeToBlack, byte *scene) {
byte *screenBuf = (byte *)g_engine->_screen->getPixels();
for (int i1 = 1; i1 <= 15000; i1++) {
- i2 = Random(318);
- j2 = Random(138);
+ i2 = getRandom(318);
+ j2 = getRandom(138);
byte *src1 = scene + 4 + (j2 * 320) + i2;
byte *src2 = scene + 4 + ((j2 + 1) * 320) + i2;
Common::copy(src1, src1 + 2, screenBuf + j2 * 320 + i2);
Common::copy(src2, src2 + 2, screenBuf + (j2 + 1) * 320 + i2);
- i2 = Random(320);
- j2 = Random(140);
+ i2 = getRandom(320);
+ j2 = getRandom(140);
byte *src3 = scene + 4 + (j2 * 320) + i2;
Common::copy(src3, src3 + 1, screenBuf + (j2 * 320) + i2);
diff --git a/engines/tot/util.cpp b/engines/tot/util.cpp
index 6454cbe05ee..543ff9aac9d 100644
--- a/engines/tot/util.cpp
+++ b/engines/tot/util.cpp
@@ -495,7 +495,7 @@ void waitForKey() {
}
}
-int Random(int range) { return g_engine->getRandomNumber(range - 1); }
+int getRandom(int range) { return g_engine->getRandomNumber(range - 1); }
Common::String getObjectName(int idx) {
return g_engine->_lang == Common::ES_ESP ? hardcodedObjects_ES[idx] : hardcodedObjects_EN[idx];
diff --git a/engines/tot/util.h b/engines/tot/util.h
index 5eed533f166..02cfbded71e 100644
--- a/engines/tot/util.h
+++ b/engines/tot/util.h
@@ -64,7 +64,7 @@ void changeGameSpeed(Common::Event e);
inline bool odd(int32 i) { return i % 2 != 0; }
-int Random(int range);
+int getRandom(int range);
Common::String getObjectName(int idx);
Commit: a1f764d24eb023c408525623f5de3077e1833ad6
https://github.com/scummvm/scummvm/commit/a1f764d24eb023c408525623f5de3077e1833ad6
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:56+02:00
Commit Message:
TOT: Original save/load screen
Changed paths:
engines/tot/detection.h
engines/tot/detection_tables.h
engines/tot/engine.cpp
engines/tot/metaengine.cpp
engines/tot/saveload.cpp
engines/tot/statics.h
engines/tot/tot.cpp
engines/tot/tot.h
engines/tot/types.h
engines/tot/util.cpp
engines/tot/util.h
diff --git a/engines/tot/detection.h b/engines/tot/detection.h
index 1f492b41be0..bcf648e25b0 100644
--- a/engines/tot/detection.h
+++ b/engines/tot/detection.h
@@ -39,6 +39,7 @@ extern const PlainGameDescriptor totGames[];
extern const ADGameDescription gameDescriptions[];
#define GAMEOPTION_NO_TRANSITIONS GUIO_GAMEOPTIONS1
+#define GAMEOPTION_ORIGINAL_SAVELOAD_DIALOG GUIO_GAMEOPTIONS2
} // End of namespace Tot
diff --git a/engines/tot/detection_tables.h b/engines/tot/detection_tables.h
index 3174f558227..c1a4c74c46b 100644
--- a/engines/tot/detection_tables.h
+++ b/engines/tot/detection_tables.h
@@ -39,7 +39,7 @@ const ADGameDescription gameDescriptions[] = {
Common::ES_ESP,
Common::kPlatformDOS,
ADGF_UNSTABLE,
- GUIO1(GAMEOPTION_NO_TRANSITIONS)
+ GUIO2(GAMEOPTION_NO_TRANSITIONS, GAMEOPTION_ORIGINAL_SAVELOAD_DIALOG)
},
{
"tot",
@@ -52,7 +52,7 @@ const ADGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformDOS,
ADGF_UNSTABLE,
- GUIO1(GAMEOPTION_NO_TRANSITIONS)
+ GUIO2(GAMEOPTION_NO_TRANSITIONS, GAMEOPTION_ORIGINAL_SAVELOAD_DIALOG)
},
AD_TABLE_END_MARKER
};
diff --git a/engines/tot/engine.cpp b/engines/tot/engine.cpp
index 5dfa62bfba7..313f4ea3ebb 100644
--- a/engines/tot/engine.cpp
+++ b/engines/tot/engine.cpp
@@ -3603,7 +3603,7 @@ void TotEngine::loadInventory() {
}
if (_cpCounter > 65)
showError(274);
- const char *emptyName = getHardcodedObjectsByCurrentLanguage()[10];
+ const char *emptyName = getHardcodedTextsByCurrentLanguage()[10];
for (int i = 0; i < kInventoryIconCount; i++) {
_inventory[i].bitmapIndex = 34;
_inventory[i].code = 0;
@@ -4812,21 +4812,38 @@ void TotEngine::readAlphaGraph(Common::String &output, int length, int posx, int
}
}
-void TotEngine::readAlphaGraphSmall(Common::String &output, int length, int posx, int posy, byte barColor,
- byte textColor) {
+void TotEngine::readAlphaGraphSmall(
+ Common::String &output,
+ int length,
+ int posx,
+ int posy,
+ byte barColor,
+ byte textColor,
+ char startChar) {
int pun = 1;
- bool removeCaret = 0;
- bar(posx, posy + 2, posx + length * 6, posy + 9, barColor);
-
- biosText(posx, posy, "-", textColor);
+ bool removeCaret = false;
+ if (startChar != 0) {
+ output.append(1, startChar);
+ output.toUppercase();
+ pun += 1;
+ bar(posx, (posy + 2), (posx + length * 6), (posy + 9), barColor);
+ euroText(posx, posy, output, textColor);
+ euroText((posx + (output.size()) * 6), posy, "-", textColor);
+ removeCaret = true;
+ }
+ else {
+ bar(posx, posy + 2, posx + length * 6, posy + 9, barColor);
+ euroText(posx, posy, "-", textColor);
+ }
Common::Event e;
bool done = false;
-
while (!done && !shouldQuit()) {
while (g_system->getEventManager()->pollEvent(e)) {
+ // debug("Event!");
if (e.type == Common::EVENT_KEYDOWN) {
int keycode = e.kbd.keycode;
int asciiCode = e.kbd.ascii;
+
// ENTER key
if (keycode == Common::KEYCODE_RETURN || keycode == Common::KEYCODE_KP_ENTER) {
if (output.size() > 0) {
@@ -4834,26 +4851,31 @@ void TotEngine::readAlphaGraphSmall(Common::String &output, int length, int posx
continue;
}
}
-
if (pun > length && asciiCode != 8) {
_sound->beep(750, 60);
bar((posx + (output.size()) * 6), (posy + 2), (posx + (output.size() + 1) * 6), (posy + 9), barColor);
} else if (asciiCode == 8 && pun > 1) {
output = output.substr(0, output.size() - 1);
+ output.toUppercase();
bar(posx, (posy + 2), (posx + length * 6), (posy + 9), barColor);
- biosText(posx, posy, output, textColor);
- biosText((posx + (output.size()) * 6), posy, "-", textColor);
+ euroText(posx, posy, output, textColor);
+ euroText((posx + (output.size()) * 6), posy, "-", textColor);
pun -= 1;
removeCaret = true;
- } else if ((asciiCode < '\40') || (asciiCode > '\373')) {
+ } else if (
+ (asciiCode < 97 || asciiCode > 122) &&
+ (asciiCode < 65 || asciiCode > 90) &&
+ (asciiCode < 32 || asciiCode > 57) &&
+ (asciiCode < 164 || asciiCode > 165)) {
_sound->beep(1200, 60);
removeCaret = false;
} else {
pun += 1;
output = output + (char)e.kbd.ascii;
+ output.toUppercase();
bar(posx, (posy + 2), (posx + length * 6), (posy + 9), barColor);
- littText(posx, posy, output, textColor);
- littText((posx + (output.size()) * 6), posy, "-", textColor);
+ euroText(posx, posy, output, textColor);
+ euroText((posx + (output.size()) * 6), posy, "-", textColor);
removeCaret = true;
}
}
diff --git a/engines/tot/metaengine.cpp b/engines/tot/metaengine.cpp
index 87073486ad2..382903c98ad 100644
--- a/engines/tot/metaengine.cpp
+++ b/engines/tot/metaengine.cpp
@@ -36,6 +36,17 @@ static const ADExtraGuiOptionsMap optionsList[] = {
0
}
},
+ {
+ GAMEOPTION_ORIGINAL_SAVELOAD_DIALOG,
+ {
+ _s("Original save/load dialog"),
+ _s("Use original save and load dialogs"),
+ "original_save_load_screen",
+ false,
+ 0,
+ 0
+ }
+ },
AD_EXTRA_GUI_OPTIONS_TERMINATOR
};
diff --git a/engines/tot/saveload.cpp b/engines/tot/saveload.cpp
index 61910baa0ce..da4cc15d4f1 100644
--- a/engines/tot/saveload.cpp
+++ b/engines/tot/saveload.cpp
@@ -19,6 +19,8 @@
*
*/
#include "common/translation.h"
+#include "common/savefile.h"
+#include "graphics/thumbnail.h"
#include "gui/message.h"
#include "tot/forest.h"
@@ -564,4 +566,204 @@ void TotEngine::loadGame(SavedGame game) {
_graphics->sceneTransition(false, _sceneBackground);
}
+Common::String drawAndSelectSaves(Common::StringArray saves, int selectedGame) {
+ g_engine->_mouse->hide();
+ const char *availableText = getHardcodedTextsByCurrentLanguage()[11];
+ int size = saves.size();
+ for (int i = 0; i < 6; i++) {
+
+ int color = i == selectedGame ? 255 : 253;
+ if (i < size) {
+ Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(saves[i]);
+ if (!in) {
+ warning("Could not open save file: %s", saves[i].c_str());
+ }
+ ExtendedSavegameHeader header;
+ bool result = g_engine->getMetaEngine()->readSavegameHeader(in, &header, true);
+ euroText(65, 29 + (i * 15), result ? header.description.c_str() : saves[i].c_str(), color);
+ } else {
+ euroText(65, 29 + (i * 15), availableText, color);
+ }
+ }
+ g_engine->_mouse->show();
+ if (selectedGame < saves.size())
+ return saves[selectedGame];
+ else
+ return "";
+}
+
+void TotEngine::originalSaveLoadScreen() {
+ uint oldMouseX, oldMouseY;
+ int partidaselecc = -1;
+ bool modificada = false;
+ Common::String nombrepartida = "";
+
+ bool exitSaveLoadMenu = false;
+ oldMouseX = _mouse->mouseX;
+ oldMouseY = _mouse->mouseY;
+ _mouse->hide();
+
+ uint menuBgSize = imagesize(50, 10, 270, 120);
+ byte *menuBgPointer = (byte *)malloc(menuBgSize);
+ _graphics->getImg(50, 10, 270, 120, menuBgPointer);
+
+ for (int i = 0; i < 6; i++) {
+ uint textY = i + 1;
+ buttonBorder((120 - (textY * 10)), (80 - (textY * 10)), (200 + (textY * 10)), (60 + (textY * 10)), 251, 251, 251, 251, 0);
+ }
+ drawMenu(2);
+ if (!g_engine->_saveAllowed) {
+ bar(61, 15, 122, 23, 253);
+ bar(201, 15, 259, 23, 253);
+ }
+ Common::String pattern = isLanguageSpanish ? "tot-es.###" : "tot.###";
+ Common::StringArray saves = g_system->getSavefileManager()->listSavefiles(pattern);
+ debug("Found saves:");
+ for (int i = 0; i < saves.size(); i++) {
+ debug("Save %d: %s", i, saves[i].c_str());
+ }
+ nombrepartida = drawAndSelectSaves(saves, partidaselecc);
+ if (_cpCounter2 > 17)
+ showError(274);
+ _mouse->mouseX = 150;
+ _mouse->mouseY = 60;
+ _mouse->mouseMaskIndex = 1;
+ _mouse->setMouseArea(Common::Rect(55, 13, 250, 105));
+ _mouse->warpMouse(1, 150, 60);
+
+ do {
+ Common::Event e;
+ bool mouseClicked = false;
+ bool keyPressed = false;
+ char lastInputChar = '\0';
+ do {
+ _chrono->updateChrono();
+ if (_chrono->_gameTick) {
+ _mouse->animateMouseIfNeeded();
+ }
+ while (g_system->getEventManager()->pollEvent(e)) {
+ if (isMouseEvent(e)) {
+ _mouse->warpMouse(e.mouse);
+ _mouse->mouseX = e.mouse.x;
+ _mouse->mouseY = e.mouse.y;
+ }
+
+ if (e.type == Common::EVENT_LBUTTONUP || e.type == Common::EVENT_RBUTTONUP) {
+ mouseClicked = true;
+ _mouse->mouseClickX = e.mouse.x;
+ _mouse->mouseClickY = e.mouse.y;
+ } else if (e.type == Common::EVENT_KEYDOWN) {
+ keyPressed = true;
+ lastInputChar = e.kbd.ascii;
+ }
+ }
+
+ g_engine->_screen->update();
+ g_system->delayMillis(10);
+ } while (!keyPressed && !mouseClicked && !g_engine->shouldQuit());
+
+ if (mouseClicked) {
+ if (_mouse->mouseY >= 13 && _mouse->mouseY <= 16) {
+ if (_mouse->mouseX >= 54 && _mouse->mouseX <= 124) {
+ if (partidaselecc >= 0 && _saveAllowed && nombrepartida != "") {
+ debug("would save game now!");
+ debug("partidaseleccionada - %d, saveAllowed=%d, nombrepartida = %s", partidaselecc, _saveAllowed, nombrepartida.c_str());
+ saveGameState(partidaselecc, nombrepartida, false);
+ _graphics->putImg(50, 10, menuBgPointer);
+ exitSaveLoadMenu = true;
+ partidaselecc = -1;
+ } else {
+ debug("partidaseleccionada - %d, saveAllowed=%d, nombrepartida = %s", partidaselecc, _saveAllowed, nombrepartida.c_str());
+ _sound->beep(100, 300);
+ }
+ } else if (_mouse->mouseX >= 130 && _mouse->mouseX <= 194) {
+ if (partidaselecc >= 0 && !modificada) {
+ if (partidaselecc < saves.size()) {
+ _mouse->hide();
+ _graphics->putImg(50, 10, menuBgPointer);
+ free(menuBgPointer);
+ if (_saveAllowed) {
+ clearAnimation();
+ clearScreenLayers();
+ }
+ Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(saves[partidaselecc]);
+ if (!in) {
+
+ warning("Could not open save file: %s", saves[partidaselecc].c_str());
+ exitSaveLoadMenu = true;
+ return;
+ }
+ int slotNum = atoi(saves[partidaselecc].c_str() + saves[partidaselecc].size() - 3);
+ loadGameState(slotNum);
+ _mouse->mouseX = oldMouseX;
+ _mouse->mouseY = oldMouseY;
+
+ _mouse->show();
+ _mouse->setMouseArea(Common::Rect(0, 0, 305, 185));
+ exitSaveLoadMenu = true;
+ partidaselecc = -1;
+ delete in;
+ return;
+ } else {
+ debug("partidaseleccionada - %d", partidaselecc);
+ _sound->beep(100, 300);
+ }
+ } else {
+ debug("partidaseleccionada - %d, modificada=%d", partidaselecc, modificada);
+ _sound->beep(100, 300);
+ nombrepartida = drawAndSelectSaves(saves, partidaselecc);
+ _mouse->show();
+ }
+ } else if (_mouse->mouseClickX >= 200 && _mouse->mouseClickX <= 250) {
+ if (_inGame && _saveAllowed) {
+ _graphics->putImg(50, 10, menuBgPointer);
+ exitSaveLoadMenu = true;
+ partidaselecc = -1;
+ } else {
+ _sound->beep(100, 300);
+ }
+ }
+ } else if (_mouse->mouseClickY >= 24 && _mouse->mouseClickY <= 32) {
+ partidaselecc = 0;
+ modificada = false;
+ nombrepartida = drawAndSelectSaves(saves, 0);
+ } else if (_mouse->mouseClickY >= 39 && _mouse->mouseClickY <= 47) {
+ partidaselecc = 1;
+ modificada = false;
+ nombrepartida = drawAndSelectSaves(saves, 1);
+ } else if (_mouse->mouseClickY >= 54 && _mouse->mouseClickY <= 62) {
+ partidaselecc = 2;
+ modificada = false;
+ nombrepartida = drawAndSelectSaves(saves, 2);
+ } else if (_mouse->mouseClickY >= 69 && _mouse->mouseClickY <= 77) {
+ partidaselecc = 3;
+ modificada = false;
+ nombrepartida = drawAndSelectSaves(saves, 3);
+ } else if (_mouse->mouseClickY >= 84 && _mouse->mouseClickY <= 92) {
+ partidaselecc = 4;
+ modificada = false;
+ nombrepartida = drawAndSelectSaves(saves, 4);
+ } else if (_mouse->mouseClickY >= 99 && _mouse->mouseClickY <= 107) {
+ partidaselecc = 5;
+ modificada = false;
+ nombrepartida = drawAndSelectSaves(saves, 5);
+ }
+ }
+
+ if (partidaselecc >= 0 && keyPressed && _saveAllowed) {
+ _mouse->hide();
+ byte ytext = 29 + (partidaselecc * 15);
+ readAlphaGraphSmall(nombrepartida, 30, 65, ytext, 251, 254, lastInputChar);
+ modificada = true;
+ _mouse->show();
+ keyPressed = false;
+ }
+ } while (!exitSaveLoadMenu && !g_engine->shouldQuit());
+ _mouse->mouseX = oldMouseX;
+ _mouse->mouseY = oldMouseY;
+ _mouse->warpMouse(_mouse->mouseMaskIndex, _mouse->mouseX, _mouse->mouseY);
+ free(menuBgPointer);
+ _mouse->setMouseArea(Common::Rect(0, 0, 305, 185));
+}
+
} // End of namespace Tot
diff --git a/engines/tot/statics.h b/engines/tot/statics.h
index 4e56514c612..2cef57c0c7e 100644
--- a/engines/tot/statics.h
+++ b/engines/tot/statics.h
@@ -27,7 +27,6 @@
namespace Tot {
-
static const char *const animMessages[2][290] = {
//Spanish
{
@@ -1114,8 +1113,7 @@ static const char *const actionLine_EN[] = {
" WITH ",
};
-
-static const char *const hardcodedObjects_ES[] = {
+static const char *const hardcodedTexts_ES[] = {
"LISTA ", // 0
"LISTA", // 1
"CARBON", // 2
@@ -1126,10 +1124,11 @@ static const char *const hardcodedObjects_ES[] = {
"ESTATUA GROTESCA",// 7
"PARED", // 8
"TORNO", // 9
- "VACIO"
+ "VACIO",
+ "DISPONIBLE"
};
-static const char *const hardcodedObjects_EN[] = {
+static const char *const hardcodedTexts_EN[] = {
"LIST ",
"LIST",
"COAL",
@@ -1140,7 +1139,8 @@ static const char *const hardcodedObjects_EN[] = {
"GROTESQUE STATUE",
"WALL",
"POTTER""S WHEEL",
- "FREE"
+ "FREE",
+ "AVAILABLE"
};
static const Common::KeyCode hotkeys[2][8]{
diff --git a/engines/tot/tot.cpp b/engines/tot/tot.cpp
index cafe139f7b4..932ad77563a 100644
--- a/engines/tot/tot.cpp
+++ b/engines/tot/tot.cpp
@@ -116,18 +116,16 @@ int TotEngine::engineStart() {
_graphics->loadPaletteFromFile("DEFAULT");
initScreenPointers();
- initialLogo();
- _sound->playMidi("INTRODUC", true);
- _sound->setMidiVolume(3, 3);
- firstIntroduction();
- _mouse->warpMouse(1, _mouse->mouseX, _mouse->mouseY);
+ // initialLogo();
+ // _sound->playMidi("INTRODUC", true);
+ // _sound->setMidiVolume(3, 3);
+ // firstIntroduction();
+ // _mouse->warpMouse(1, _mouse->mouseX, _mouse->mouseY);
mainMenu(_firstTimeDone);
if (_startNewGame && !shouldQuit()) {
newGame();
} else if (_continueGame && !shouldQuit()) {
resumeGame();
- } else {
-
}
return startGame();
@@ -190,8 +188,10 @@ int TotEngine::startGame() {
soundControls();
break;
case Common::KEYCODE_F2:
- openMainMenuDialog();
- // saveLoad();
+ if(ConfMan.getBool("original_save_load_screen"))
+ originalSaveLoadScreen();
+ else
+ openMainMenuDialog();
break;
default:
if (e.kbd.keycode == hotKeyOpen) {
@@ -1351,13 +1351,19 @@ void TotEngine::mainMenu(bool fade) {
}
} else if (x >= 18 && x <= 145) {
_isSavingDisabled = true;
- bool result = loadGameDialog();
- _isSavingDisabled = false;
- if(result) {
- _startNewGame = false;
- _continueGame = false;
+ if(ConfMan.getBool("original_save_load_screen")) {
+ originalSaveLoadScreen();
validOption = true;
}
+ else {
+ bool result = loadGameDialog();
+ if(result) {
+ validOption = true;
+ }
+ }
+ _startNewGame = false;
+ _continueGame = false;
+ _isSavingDisabled = false;
}
} else if (y > 174 && y < 190) {
if (x > 20 && x < 145) {
diff --git a/engines/tot/tot.h b/engines/tot/tot.h
index a374eaac148..910c5408a04 100644
--- a/engines/tot/tot.h
+++ b/engines/tot/tot.h
@@ -72,7 +72,7 @@ private:
void runaroundRed();
void sprites(bool drawCharacter);
void saveGameToRegister();
- void saveLoad();
+ void originalSaveLoadScreen();
void loadGame(SavedGame game);
RoomFileRegister *readScreenDataFile(Common::SeekableReadStream *screenDataFile);
@@ -144,7 +144,7 @@ private:
void introduction();
void firstIntroduction();
void readAlphaGraph(Common::String &data, int length, int x, int y, byte barColor);
- void readAlphaGraphSmall(Common::String &data, int length, int x, int y, byte barColor, byte textColor);
+ void readAlphaGraphSmall(Common::String &data, int length, int x, int y, byte barColor, byte textColor, char startChar = '\0');
void displayObjectDescription(const Common::String &text);
void copyProtection();
void initialLogo();
diff --git a/engines/tot/types.h b/engines/tot/types.h
index 2fb63bcc980..7c6f66797e3 100644
--- a/engines/tot/types.h
+++ b/engines/tot/types.h
@@ -290,6 +290,11 @@ enum HOTKEYS {
NO = 7
};
+struct GameIndex {
+ byte ultimapartida;
+ Common::String listapartidas[6];
+};
+
} // End of namespace Tot
#endif
diff --git a/engines/tot/util.cpp b/engines/tot/util.cpp
index 543ff9aac9d..b5263ea3e74 100644
--- a/engines/tot/util.cpp
+++ b/engines/tot/util.cpp
@@ -498,7 +498,7 @@ void waitForKey() {
int getRandom(int range) { return g_engine->getRandomNumber(range - 1); }
Common::String getObjectName(int idx) {
- return g_engine->_lang == Common::ES_ESP ? hardcodedObjects_ES[idx] : hardcodedObjects_EN[idx];
+ return g_engine->_lang == Common::ES_ESP ? hardcodedTexts_ES[idx] : hardcodedTexts_EN[idx];
}
Common::KeyCode hotKeyFor(HOTKEYS hotkey) {
@@ -518,8 +518,8 @@ const char *const *getAnimMessagesByCurrentLanguage() {
return (g_engine->_lang == Common::ES_ESP) ? animMessages[0] : animMessages[1];
}
-const char *const *getHardcodedObjectsByCurrentLanguage() {
- return (g_engine->_lang == Common::ES_ESP) ? hardcodedObjects_ES : hardcodedObjects_EN;
+const char *const *getHardcodedTextsByCurrentLanguage() {
+ return (g_engine->_lang == Common::ES_ESP) ? hardcodedTexts_ES : hardcodedTexts_EN;
}
const int32 *getOffsetsByCurrentLanguage() {
diff --git a/engines/tot/util.h b/engines/tot/util.h
index 02cfbded71e..78092cf5e70 100644
--- a/engines/tot/util.h
+++ b/engines/tot/util.h
@@ -76,7 +76,7 @@ const char *const *getFullScreenMessagesByCurrentLanguage();
const char *const *getAnimMessagesByCurrentLanguage();
-const char *const *getHardcodedObjectsByCurrentLanguage();
+const char *const *getHardcodedTextsByCurrentLanguage();
const int32 *getOffsetsByCurrentLanguage();
Commit: c09bf646a0c4eccc2a524bdb65cb1e3fb1c0f949
https://github.com/scummvm/scummvm/commit/c09bf646a0c4eccc2a524bdb65cb1e3fb1c0f949
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:56+02:00
Commit Message:
TOT: Cleanup original save screen
Changed paths:
engines/tot/engine.cpp
engines/tot/saveload.cpp
diff --git a/engines/tot/engine.cpp b/engines/tot/engine.cpp
index 313f4ea3ebb..8f5010ad953 100644
--- a/engines/tot/engine.cpp
+++ b/engines/tot/engine.cpp
@@ -4839,7 +4839,6 @@ void TotEngine::readAlphaGraphSmall(
bool done = false;
while (!done && !shouldQuit()) {
while (g_system->getEventManager()->pollEvent(e)) {
- // debug("Event!");
if (e.type == Common::EVENT_KEYDOWN) {
int keycode = e.kbd.keycode;
int asciiCode = e.kbd.ascii;
diff --git a/engines/tot/saveload.cpp b/engines/tot/saveload.cpp
index da4cc15d4f1..dc363cf835f 100644
--- a/engines/tot/saveload.cpp
+++ b/engines/tot/saveload.cpp
@@ -594,9 +594,9 @@ Common::String drawAndSelectSaves(Common::StringArray saves, int selectedGame) {
void TotEngine::originalSaveLoadScreen() {
uint oldMouseX, oldMouseY;
- int partidaselecc = -1;
- bool modificada = false;
- Common::String nombrepartida = "";
+ int selectedGame = -1;
+ bool modified = false;
+ Common::String saveName = "";
bool exitSaveLoadMenu = false;
oldMouseX = _mouse->mouseX;
@@ -618,11 +618,7 @@ void TotEngine::originalSaveLoadScreen() {
}
Common::String pattern = isLanguageSpanish ? "tot-es.###" : "tot.###";
Common::StringArray saves = g_system->getSavefileManager()->listSavefiles(pattern);
- debug("Found saves:");
- for (int i = 0; i < saves.size(); i++) {
- debug("Save %d: %s", i, saves[i].c_str());
- }
- nombrepartida = drawAndSelectSaves(saves, partidaselecc);
+ saveName = drawAndSelectSaves(saves, selectedGame);
if (_cpCounter2 > 17)
showError(274);
_mouse->mouseX = 150;
@@ -665,20 +661,17 @@ void TotEngine::originalSaveLoadScreen() {
if (mouseClicked) {
if (_mouse->mouseY >= 13 && _mouse->mouseY <= 16) {
if (_mouse->mouseX >= 54 && _mouse->mouseX <= 124) {
- if (partidaselecc >= 0 && _saveAllowed && nombrepartida != "") {
- debug("would save game now!");
- debug("partidaseleccionada - %d, saveAllowed=%d, nombrepartida = %s", partidaselecc, _saveAllowed, nombrepartida.c_str());
- saveGameState(partidaselecc, nombrepartida, false);
+ if (selectedGame >= 0 && _saveAllowed && saveName != "") {
+ saveGameState(selectedGame, saveName, false);
_graphics->putImg(50, 10, menuBgPointer);
exitSaveLoadMenu = true;
- partidaselecc = -1;
+ selectedGame = -1;
} else {
- debug("partidaseleccionada - %d, saveAllowed=%d, nombrepartida = %s", partidaselecc, _saveAllowed, nombrepartida.c_str());
_sound->beep(100, 300);
}
} else if (_mouse->mouseX >= 130 && _mouse->mouseX <= 194) {
- if (partidaselecc >= 0 && !modificada) {
- if (partidaselecc < saves.size()) {
+ if (selectedGame >= 0 && !modified) {
+ if (selectedGame < saves.size()) {
_mouse->hide();
_graphics->putImg(50, 10, menuBgPointer);
free(menuBgPointer);
@@ -686,14 +679,13 @@ void TotEngine::originalSaveLoadScreen() {
clearAnimation();
clearScreenLayers();
}
- Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(saves[partidaselecc]);
+ Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(saves[selectedGame]);
if (!in) {
-
- warning("Could not open save file: %s", saves[partidaselecc].c_str());
+ warning("Could not open save file: %s", saves[selectedGame].c_str());
exitSaveLoadMenu = true;
return;
}
- int slotNum = atoi(saves[partidaselecc].c_str() + saves[partidaselecc].size() - 3);
+ int slotNum = atoi(saves[selectedGame].c_str() + saves[selectedGame].size() - 3);
loadGameState(slotNum);
_mouse->mouseX = oldMouseX;
_mouse->mouseY = oldMouseY;
@@ -701,60 +693,58 @@ void TotEngine::originalSaveLoadScreen() {
_mouse->show();
_mouse->setMouseArea(Common::Rect(0, 0, 305, 185));
exitSaveLoadMenu = true;
- partidaselecc = -1;
+ selectedGame = -1;
delete in;
return;
} else {
- debug("partidaseleccionada - %d", partidaselecc);
_sound->beep(100, 300);
}
} else {
- debug("partidaseleccionada - %d, modificada=%d", partidaselecc, modificada);
_sound->beep(100, 300);
- nombrepartida = drawAndSelectSaves(saves, partidaselecc);
+ saveName = drawAndSelectSaves(saves, selectedGame);
_mouse->show();
}
} else if (_mouse->mouseClickX >= 200 && _mouse->mouseClickX <= 250) {
if (_inGame && _saveAllowed) {
_graphics->putImg(50, 10, menuBgPointer);
exitSaveLoadMenu = true;
- partidaselecc = -1;
+ selectedGame = -1;
} else {
_sound->beep(100, 300);
}
}
} else if (_mouse->mouseClickY >= 24 && _mouse->mouseClickY <= 32) {
- partidaselecc = 0;
- modificada = false;
- nombrepartida = drawAndSelectSaves(saves, 0);
+ selectedGame = 0;
+ modified = false;
+ saveName = drawAndSelectSaves(saves, 0);
} else if (_mouse->mouseClickY >= 39 && _mouse->mouseClickY <= 47) {
- partidaselecc = 1;
- modificada = false;
- nombrepartida = drawAndSelectSaves(saves, 1);
+ selectedGame = 1;
+ modified = false;
+ saveName = drawAndSelectSaves(saves, 1);
} else if (_mouse->mouseClickY >= 54 && _mouse->mouseClickY <= 62) {
- partidaselecc = 2;
- modificada = false;
- nombrepartida = drawAndSelectSaves(saves, 2);
+ selectedGame = 2;
+ modified = false;
+ saveName = drawAndSelectSaves(saves, 2);
} else if (_mouse->mouseClickY >= 69 && _mouse->mouseClickY <= 77) {
- partidaselecc = 3;
- modificada = false;
- nombrepartida = drawAndSelectSaves(saves, 3);
+ selectedGame = 3;
+ modified = false;
+ saveName = drawAndSelectSaves(saves, 3);
} else if (_mouse->mouseClickY >= 84 && _mouse->mouseClickY <= 92) {
- partidaselecc = 4;
- modificada = false;
- nombrepartida = drawAndSelectSaves(saves, 4);
+ selectedGame = 4;
+ modified = false;
+ saveName = drawAndSelectSaves(saves, 4);
} else if (_mouse->mouseClickY >= 99 && _mouse->mouseClickY <= 107) {
- partidaselecc = 5;
- modificada = false;
- nombrepartida = drawAndSelectSaves(saves, 5);
+ selectedGame = 5;
+ modified = false;
+ saveName = drawAndSelectSaves(saves, 5);
}
}
- if (partidaselecc >= 0 && keyPressed && _saveAllowed) {
+ if (selectedGame >= 0 && keyPressed && _saveAllowed) {
_mouse->hide();
- byte ytext = 29 + (partidaselecc * 15);
- readAlphaGraphSmall(nombrepartida, 30, 65, ytext, 251, 254, lastInputChar);
- modificada = true;
+ byte ytext = 29 + (selectedGame * 15);
+ readAlphaGraphSmall(saveName, 30, 65, ytext, 251, 254, lastInputChar);
+ modified = true;
_mouse->show();
keyPressed = false;
}
Commit: c2f669507851c801298e6d06a422c4df63ee5771
https://github.com/scummvm/scummvm/commit/c2f669507851c801298e6d06a422c4df63ee5771
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:56+02:00
Commit Message:
TOT: Implements copy protection
Changed paths:
engines/tot/detection.h
engines/tot/detection_tables.h
engines/tot/dialog.cpp
engines/tot/engine.cpp
engines/tot/metaengine.cpp
engines/tot/resources.cpp
engines/tot/statics.h
engines/tot/tot.cpp
engines/tot/tot.h
engines/tot/types.h
diff --git a/engines/tot/detection.h b/engines/tot/detection.h
index bcf648e25b0..c29ad8b675c 100644
--- a/engines/tot/detection.h
+++ b/engines/tot/detection.h
@@ -38,8 +38,9 @@ extern const PlainGameDescriptor totGames[];
extern const ADGameDescription gameDescriptions[];
-#define GAMEOPTION_NO_TRANSITIONS GUIO_GAMEOPTIONS1
-#define GAMEOPTION_ORIGINAL_SAVELOAD_DIALOG GUIO_GAMEOPTIONS2
+#define GAMEOPTION_COPY_PROTECTION GUIO_GAMEOPTIONS1
+#define GAMEOPTION_NO_TRANSITIONS GUIO_GAMEOPTIONS2
+#define GAMEOPTION_ORIGINAL_SAVELOAD_DIALOG GUIO_GAMEOPTIONS3
} // End of namespace Tot
diff --git a/engines/tot/detection_tables.h b/engines/tot/detection_tables.h
index c1a4c74c46b..df6fb1b710d 100644
--- a/engines/tot/detection_tables.h
+++ b/engines/tot/detection_tables.h
@@ -39,7 +39,7 @@ const ADGameDescription gameDescriptions[] = {
Common::ES_ESP,
Common::kPlatformDOS,
ADGF_UNSTABLE,
- GUIO2(GAMEOPTION_NO_TRANSITIONS, GAMEOPTION_ORIGINAL_SAVELOAD_DIALOG)
+ GUIO3(GAMEOPTION_COPY_PROTECTION, GAMEOPTION_NO_TRANSITIONS, GAMEOPTION_ORIGINAL_SAVELOAD_DIALOG)
},
{
"tot",
@@ -52,7 +52,7 @@ const ADGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformDOS,
ADGF_UNSTABLE,
- GUIO2(GAMEOPTION_NO_TRANSITIONS, GAMEOPTION_ORIGINAL_SAVELOAD_DIALOG)
+ GUIO3(GAMEOPTION_COPY_PROTECTION, GAMEOPTION_NO_TRANSITIONS, GAMEOPTION_ORIGINAL_SAVELOAD_DIALOG)
},
AD_TABLE_END_MARKER
};
diff --git a/engines/tot/dialog.cpp b/engines/tot/dialog.cpp
index cf0928fcca6..d46571cce7e 100644
--- a/engines/tot/dialog.cpp
+++ b/engines/tot/dialog.cpp
@@ -474,7 +474,6 @@ void talk(byte characterIndex) {
g_engine->sayLine(newNode, 255, 0, response, true);
stringAux = 0;
modifyTree(tree, newNode);
- // verifyCopyProtection();
while (response > 0 && !g_engine->shouldQuit()) {
newNode = response;
stringAux += 1;
@@ -546,7 +545,6 @@ void talkToSceneObject() {
if (sceneObject == 0)
return;
- // verifyCopyProtection2();
g_engine->readObject(sceneObject);
g_engine->goToObject(g_engine->_currentRoomData->walkAreasGrid[(g_engine->_characterPosX + kCharacterCorrectionX) / kXGridCount][(g_engine->_characterPosY + kCharacerCorrectionY) / kYGridCount],
g_engine->_currentRoomData->walkAreasGrid[correctedMouseX][correctedMouseY]);
diff --git a/engines/tot/engine.cpp b/engines/tot/engine.cpp
index 8f5010ad953..4f6a9aa4236 100644
--- a/engines/tot/engine.cpp
+++ b/engines/tot/engine.cpp
@@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-
+#include "common/config-manager.h"
#include "common/savefile.h"
#include "image/png.h"
@@ -870,7 +870,6 @@ void TotEngine::useInventoryObjectWithInventoryObject(uint objectCode1, uint obj
byte invIndex, indobj1, indobj2;
readObject(_sceneObjectsData, objectCode1, _curObject);
- // verifyCopyProtection2();
if (_curObject.used[0] != 1 || _curObject.useWith != objectCode2) {
drawText(getRandom(11) + 1022);
return;
@@ -1425,7 +1424,6 @@ void TotEngine::pickupScreenObject() {
goToObject(
_currentRoomData->walkAreasGrid[(_characterPosX + kCharacterCorrectionX) / kXGridCount][(_characterPosY + kCharacerCorrectionY) / kYGridCount],
_currentRoomData->walkAreasGrid[correctedMouseX][correctedMouseY]);
- verifyCopyProtection();
if (_curObject.pickupable) {
_mouse->hide();
switch (_curObject.code) {
@@ -3408,7 +3406,6 @@ void TotEngine::closeScreenObject() {
sceneObject = _currentRoomData->screenObjectIndex[_currentRoomData->mouseGrid[correctedMouseX][correctedMouseY]]->fileIndex;
if (sceneObject == 0)
return;
- // verifyCopyProtection2();
readObject(sceneObject);
goToObject(_currentRoomData->walkAreasGrid[((_characterPosX + kCharacterCorrectionX) / kXGridCount)][((_characterPosY + kCharacerCorrectionY) / kYGridCount)],
_currentRoomData->walkAreasGrid[correctedMouseX][correctedMouseY]);
@@ -4222,10 +4219,6 @@ void TotEngine::updateAltScreen(byte otherScreenNumber) {
setRoomTrajectories(_secondaryAnimHeight, _secondaryAnimWidth, SET_WITH_ANIM);
}
-void TotEngine::verifyCopyProtection() {
- //TODO: Copy protection
-}
-
void TotEngine::loadTV() {
Common::File fichct;
@@ -4315,10 +4308,6 @@ void TotEngine::freeInventory() {
}
}
-void TotEngine::verifyCopyProtection2() {
- // TODO:
-}
-
void TotEngine::loadScreenLayerWithDepth(uint coordx, uint coordy, uint bitmapSize, int32 bitmapIndex, uint depth) {
_screenLayers[depth] = (byte *)malloc(bitmapSize);
readBitmap(bitmapIndex, _screenLayers[depth], bitmapSize, 319);
@@ -4342,7 +4331,6 @@ void TotEngine::updateInventory(byte index) {
_inventory[i].code = _inventory[i + 1].code;
_inventory[i].objectName = _inventory[i + 1].objectName;
}
- // verifyCopyProtection();
}
void TotEngine::drawLookAtItem(RoomObjectListEntry obj) {
@@ -4429,7 +4417,6 @@ void TotEngine::drawInventoryMask() {
for (int i = 1; i <= 25; i++)
buttonBorder(0, (175 - i), 319, (174 + i), 251, 251, 251, 251, 0);
drawMenu(1);
- // verifyCopyProtection();
if (_inventoryPosition > 1)
lightUpLeft();
else
@@ -4945,13 +4932,276 @@ void TotEngine::buttonBorder(uint x1, uint y1, uint x2, uint y2,
putpixel(x2, y1, color3);
putpixel(x1, y2, color3);
- _screen->addDirtyRect(Common::Rect(
- x1, y1, x2, y2));
+ _screen->addDirtyRect(Common::Rect(x1, y1, x2, y2));
_screen->update();
}
+static void buttonPress(uint xx1, uint yy1, uint xx2, uint yy2, bool pressed) {
+ g_engine->_mouse->hide();
+
+ uint color = 0;
+ if (pressed)
+ color = 249;
+ else
+ color = 255;
+ line(xx1, yy1, (xx2 - 1), yy1, color);
+ line(xx1, yy1, xx1, (yy2 - 1), color);
+ if (pressed)
+ color = 255;
+ else
+ color = 249;
+ line((xx1 + 1), yy2, xx2, yy2, color);
+ line(xx2, (yy1 + 1), xx2, yy2, color);
+ g_engine->_screen->addDirtyRect(Common::Rect(xx1, yy1, xx2, yy2));
+ g_engine->_screen->update();
+ g_engine->_mouse->show();
+ delay(100);
+}
+
void TotEngine::copyProtection() {
- //todo
+ if (!ConfMan.getBool("copy_protection")) {
+ return;
+ }
+ const char *message = isLanguageSpanish() ? hardcodedTexts_ES[12] : hardcodedTexts_EN[12];
+ int beepDelay = 100;
+ int chunkSize = 4;
+
+ uint inputPassword = 0;
+ byte cursorPos = 0, attempts = 0;
+ int32 diskPass = 0, protXor1 = 0, protXor2 = 0;
+
+ Common::File protectionFile;
+ if (!protectionFile.open("MCGA.DRV")) {
+ showError(260);
+ }
+ Common::String inputString = " ";
+ byte numRow = getRandom(95) + 1;
+ byte numColumn = getRandom(38) + 1;
+
+ protectionFile.seek(1 * chunkSize);
+ protXor1 = 6543736;
+ protXor1 = protectionFile.readUint32LE();
+ protXor2 = 9873254;
+ protectionFile.seek((((numRow - 1) * 38) + numColumn + 1) * chunkSize);
+ protXor2 = protectionFile.readUint32LE();
+ inputPassword = 0;
+ diskPass = protectionFile.readUint32LE();
+ uint correctPassword = ((diskPass ^ protXor1) - protXor2);
+ bool exitDialog = false;
+ protectionFile.close();
+
+ uint oldMouseX = _mouse->mouseX;
+ uint oldMouseY = _mouse->mouseY;
+ uint oldMouseMaskIndex = _mouse->mouseMaskIndex;
+ _mouse->hide();
+
+ uint bgSize = imagesize(50, 10, 270, 120);
+ byte *bgPointer = (byte *)malloc(bgSize);
+ _graphics->getImg(50, 10, 270, 120, bgPointer);
+ _mouse->mouseX = 150;
+ _mouse->mouseY = 60;
+ _mouse->mouseMaskIndex = 1;
+ _mouse->setMouseArea(Common::Rect(55, 13, 250, 105));
+ for (int i = 1; i <= 6; i++)
+ buttonBorder((120 - (i * 10)), (80 - (i * 10)), (200 + (i * 10)), (60 + (i * 10)), 251, 251, 251, 251, 0);
+
+ drawMenu(6);
+ euroText(65, 15, Common::String::format(message, numRow, numColumn), 255);
+ cursorPos = 0;
+ attempts = 0;
+ _mouse->warpMouse(1, _mouse->mouseX, _mouse->mouseY);
+ _screen->markAllDirty();
+ _screen->update();
+ Common::Event e;
+ do {
+ bool mouseClicked = false;
+ do {
+ _chrono->updateChrono();
+ if (_chrono->_gameTick) {
+ _mouse->animateMouseIfNeeded();
+ _chrono->_gameTick = false;
+ }
+ while (g_system->getEventManager()->pollEvent(e)) {
+ if (isMouseEvent(e)) {
+ _mouse->warpMouse(e.mouse);
+ _mouse->mouseX = e.mouse.x;
+ _mouse->mouseY = e.mouse.y;
+ }
+ if (e.type == Common::EVENT_LBUTTONUP) {
+ _mouse->mouseClickX = e.mouse.x;
+ _mouse->mouseClickY = e.mouse.y;
+ mouseClicked = true;
+ }
+ }
+ _screen->markAllDirty();
+ _screen->update();
+ g_system->delayMillis(10);
+ } while (!mouseClicked && !shouldQuit());
+
+ int correctedMouseX = _mouse->mouseClickX + 7;
+ int correctedMouseY = _mouse->mouseClickY + 7;
+
+ if ((correctedMouseX > 59 && correctedMouseX < 180) && (correctedMouseY > 28 && correctedMouseY < 119)) {
+ if (correctedMouseY >= 29 && correctedMouseY <= 58) {
+ if (correctedMouseX >= 60 && correctedMouseX <= 89) {
+ if (cursorPos < 50) {
+ _sound->beep(200, beepDelay);
+ buttonPress(60, 29, 89, 58, true);
+ euroText(205 + cursorPos, 44, "0", 255);
+ inputString = inputString + '0';
+ buttonPress(60, 29, 89, 58, false);
+ cursorPos += 10;
+ } else {
+ _sound->beep(70, 250);
+ }
+ } else if (correctedMouseX >= 90 && correctedMouseX <= 119) {
+ if (cursorPos < 50) {
+ _sound->beep(250, beepDelay);
+ buttonPress(90, 29, 119, 58, true);
+ euroText((205 + cursorPos), 44, "1", 255);
+ inputString = inputString + '1';
+ buttonPress(90, 29, 119, 58, false);
+ cursorPos += 10;
+ } else {
+ _sound->beep(70, 250);
+ }
+ } else if (correctedMouseX >= 120 && correctedMouseX <= 149) {
+ if (cursorPos < 50) {
+ _sound->beep(300, beepDelay);
+ buttonPress(120, 29, 149, 58, true);
+ euroText((205 + cursorPos), 44, "2", 255);
+ inputString = inputString + '2';
+ buttonPress(120, 29, 149, 58, false);
+ cursorPos += 10;
+ } else {
+ _sound->beep(70, 250);
+ }
+ } else if (correctedMouseX >= 150 && correctedMouseX <= 179) {
+ if (cursorPos < 50) {
+ _sound->beep(350, beepDelay);
+ buttonPress(150, 29, 179, 58, true);
+ euroText((205 + cursorPos), 44, "3", 255);
+ inputString = inputString + '3';
+ buttonPress(150, 29, 179, 58, false);
+ cursorPos += 10;
+ } else {
+ _sound->beep(70, 250);
+ }
+ }
+ } else if (correctedMouseY >= 59 && correctedMouseY <= 88) {
+ if (correctedMouseX >= 60 && correctedMouseX <= 89) {
+ if (cursorPos < 50) {
+ _sound->beep(400, beepDelay);
+ buttonPress(60, 59, 89, 88, true);
+ euroText((205 + cursorPos), 44, "4", 255);
+ inputString = inputString + '4';
+ buttonPress(60, 59, 89, 88, false);
+ cursorPos += 10;
+ } else {
+ _sound->beep(70, 250);
+ }
+ } else if (correctedMouseX >= 90 && correctedMouseX <= 119) {
+ if (cursorPos < 50) {
+ _sound->beep(450, beepDelay);
+ buttonPress(90, 59, 119, 88, true);
+ euroText((205 + cursorPos), 44, "5", 255);
+ inputString = inputString + '5';
+ buttonPress(90, 59, 119, 88, false);
+ cursorPos += 10;
+ } else {
+ _sound->beep(70, 250);
+ }
+ } else if (correctedMouseX >= 120 && correctedMouseX <= 149) {
+ if (cursorPos < 50) {
+ _sound->beep(500, beepDelay);
+ buttonPress(120, 59, 149, 88, true);
+ euroText((205 + cursorPos), 44, "6", 255);
+ inputString = inputString + '6';
+ buttonPress(120, 59, 149, 88, false);
+ cursorPos += 10;
+ } else {
+ _sound->beep(70, 250);
+ }
+ } else if (correctedMouseX >= 150 && correctedMouseX <= 179) {
+ if (cursorPos < 50) {
+ _sound->beep(550, beepDelay);
+ buttonPress(150, 59, 179, 88, true);
+ euroText((205 + cursorPos), 44, "7", 255);
+ inputString = inputString + '7';
+ buttonPress(150, 59, 179, 88, false);
+ cursorPos += 10;
+ } else {
+ _sound->beep(70, 250);
+ }
+ }
+ } else if (correctedMouseY >= 89 && correctedMouseY <= 118) {
+ if (correctedMouseX >= 60 && correctedMouseX <= 89) {
+ if (cursorPos < 50) {
+ _sound->beep(600, beepDelay);
+ buttonPress(60, 89, 89, 118, true);
+ euroText((205 + cursorPos), 44, "8", 255);
+ inputString = inputString + '8';
+ buttonPress(60, 89, 89, 118, false);
+ cursorPos += 10;
+ } else {
+ _sound->beep(70, 250);
+ }
+ } else if (correctedMouseX >= 90 && correctedMouseX <= 119) {
+ if (cursorPos < 50) {
+ _sound->beep(650, beepDelay);
+ buttonPress(90, 89, 119, 118, true);
+ euroText((205 + cursorPos), 44, "9", 255);
+ inputString = inputString + '9';
+ buttonPress(90, 89, 119, 118, false);
+ cursorPos += 10;
+ } else {
+ _sound->beep(70, 250);
+ }
+ } else if (correctedMouseX >= 120 && correctedMouseX <= 149) {
+ if (cursorPos > 0) {
+ _sound->beep(700, beepDelay);
+ buttonPress(120, 89, 149, 118, true);
+ cursorPos -= 10;
+ euroText((205 + cursorPos), 44, "\xDB", 250);
+ inputString = inputString.substr(0, inputString.size() - 1);
+ buttonPress(120, 89, 149, 118, false);
+ } else {
+ _sound->beep(70, 250);
+ }
+ } else if (correctedMouseX >= 150 && correctedMouseX <= 179) {
+ if (cursorPos > 39) {
+ _sound->beep(750, beepDelay);
+ buttonPress(150, 89, 179, 118, true);
+ inputPassword = atoi(inputString.c_str());
+ buttonPress(150, 89, 179, 118, false);
+ if (attempts < 3) {
+ if (inputPassword == correctPassword)
+ exitDialog = true;
+ else {
+ attempts += 1;
+ _sound->beep(60, 250);
+ }
+ }
+ if (attempts >= 3)
+ showError(259);
+ } else {
+ _sound->beep(70, 250);
+ }
+ }
+ }
+ }
+
+ } while (!exitDialog && !shouldQuit());
+
+ _graphics->putImg(50, 10, bgPointer);
+ _mouse->mouseX = oldMouseX;
+ _mouse->mouseY = oldMouseY;
+ _mouse->mouseMaskIndex = oldMouseMaskIndex;
+ _mouse->warpMouse(_mouse->mouseMaskIndex, _mouse->mouseX, _mouse->mouseY);
+ if (_cpCounter > 8)
+ showError(274);
+ free(bgPointer);
+ _mouse->setMouseArea(Common::Rect(0, 0, 305, 185));
}
void TotEngine::soundControls() {
diff --git a/engines/tot/metaengine.cpp b/engines/tot/metaengine.cpp
index 382903c98ad..a0aa42eb83a 100644
--- a/engines/tot/metaengine.cpp
+++ b/engines/tot/metaengine.cpp
@@ -25,6 +25,17 @@
#include "tot/tot.h"
static const ADExtraGuiOptionsMap optionsList[] = {
+ {
+ GAMEOPTION_COPY_PROTECTION,
+ {
+ _s("Copy protection"),
+ _s("Enable copy protection"),
+ "copy_protection",
+ false,
+ 0,
+ 0
+ }
+ },
{
GAMEOPTION_NO_TRANSITIONS,
{
diff --git a/engines/tot/resources.cpp b/engines/tot/resources.cpp
index 526dce31945..bd9c40b2bf2 100644
--- a/engines/tot/resources.cpp
+++ b/engines/tot/resources.cpp
@@ -43,8 +43,6 @@ void TotEngine::loadCharAnimation() {
_mainCharFrameSize = characterFile.readUint16LE();
- verifyCopyProtection();
-
for (int i = 0; i <= 3; i++)
for (int j = 0; j < kWalkFrameCount; j++) {
_mainCharAnimation.bitmap[i][j] = (byte *)malloc(_mainCharFrameSize);
diff --git a/engines/tot/statics.h b/engines/tot/statics.h
index 2cef57c0c7e..21eb6d7861b 100644
--- a/engines/tot/statics.h
+++ b/engines/tot/statics.h
@@ -1125,7 +1125,8 @@ static const char *const hardcodedTexts_ES[] = {
"PARED", // 8
"TORNO", // 9
"VACIO",
- "DISPONIBLE"
+ "DISPONIBLE",
+ "Mira en la fila %d y columna %d"
};
static const char *const hardcodedTexts_EN[] = {
@@ -1140,7 +1141,8 @@ static const char *const hardcodedTexts_EN[] = {
"WALL",
"POTTER""S WHEEL",
"FREE",
- "AVAILABLE"
+ "AVAILABLE",
+ "Search in row %d and column %d"
};
static const Common::KeyCode hotkeys[2][8]{
diff --git a/engines/tot/tot.cpp b/engines/tot/tot.cpp
index 932ad77563a..2977b33c96f 100644
--- a/engines/tot/tot.cpp
+++ b/engines/tot/tot.cpp
@@ -116,11 +116,11 @@ int TotEngine::engineStart() {
_graphics->loadPaletteFromFile("DEFAULT");
initScreenPointers();
- // initialLogo();
- // _sound->playMidi("INTRODUC", true);
- // _sound->setMidiVolume(3, 3);
- // firstIntroduction();
- // _mouse->warpMouse(1, _mouse->mouseX, _mouse->mouseY);
+ initialLogo();
+ _sound->playMidi("INTRODUC", true);
+ _sound->setMidiVolume(3, 3);
+ firstIntroduction();
+ _mouse->warpMouse(1, _mouse->mouseX, _mouse->mouseY);
mainMenu(_firstTimeDone);
if (_startNewGame && !shouldQuit()) {
newGame();
@@ -465,7 +465,6 @@ int TotEngine::startGame() {
_sound->playMidi("INTRODUC", true);
_sound->fadeInMusic();
mainMenu(true);
- verifyCopyProtection2();
if (_startNewGame && !shouldQuit()) {
newGame();
@@ -507,7 +506,7 @@ int TotEngine::startGame() {
_sound->fadeInMusic();
if (_cpCounter2 > 43)
showError(274);
- // sacrificeScene();
+ sacrificeScene();
_graphics->clear();
loadInventory();
_graphics->loadPaletteFromFile("SEGUNDA");
@@ -525,7 +524,7 @@ int TotEngine::startGame() {
_inventoryPosition = 0;
drawInventory();
_mouse->show();
-
+ copyProtection();
_firstTimeTopicA[8] = true;
_oldGridX = 0;
_oldGridY = 0;
@@ -622,7 +621,6 @@ void TotEngine::changeRoom() {
_cpCounter = _cpCounter2;
setRoomTrajectories(_secondaryAnimHeight, _secondaryAnimWidth, RESTORE);
saveRoomData(_currentRoomData, _rooms);
- // verifyCopyProtection();
_sound->setSfxVolume(_sound->_leftSfxVol, _sound->_rightSfxVol);
switch (_currentRoomData->doors[_doorIndex].nextScene) {
@@ -718,7 +716,7 @@ void TotEngine::changeRoom() {
loadScreenData(_currentRoomData->doors[_doorIndex].nextScene);
_graphics->sceneTransition(false, _sceneBackground);
_mouse->show();
-
+ if (getRandom(2) == 0) copyProtection();
_oldGridX = 0;
_oldGridY = 0;
checkMouseGrid();
diff --git a/engines/tot/tot.h b/engines/tot/tot.h
index 910c5408a04..597b20aaa46 100644
--- a/engines/tot/tot.h
+++ b/engines/tot/tot.h
@@ -110,8 +110,6 @@ private:
void calculateTrajectory(uint finalX, uint finalY);
void animatedSequence(uint numSequence);
void initScreenPointers();
- void verifyCopyProtection();
- void verifyCopyProtection2();
void loadAnimation(const Common::String &animation);
void loadCharAnimation();
diff --git a/engines/tot/types.h b/engines/tot/types.h
index 7c6f66797e3..2fb63bcc980 100644
--- a/engines/tot/types.h
+++ b/engines/tot/types.h
@@ -290,11 +290,6 @@ enum HOTKEYS {
NO = 7
};
-struct GameIndex {
- byte ultimapartida;
- Common::String listapartidas[6];
-};
-
} // End of namespace Tot
#endif
Commit: d36873c0180c67116d9f416d8373147210c1a341
https://github.com/scummvm/scummvm/commit/d36873c0180c67116d9f416d8373147210c1a341
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:56+02:00
Commit Message:
TOT: Fixes audio with PCSpeaker
Changed paths:
engines/tot/sound.cpp
diff --git a/engines/tot/sound.cpp b/engines/tot/sound.cpp
index 2c6702ddcba..15097d10f59 100644
--- a/engines/tot/sound.cpp
+++ b/engines/tot/sound.cpp
@@ -139,7 +139,8 @@ void SoundManager::toggleMusic() {
void SoundManager::beep(int32 frequency, int32 ms) {
Audio::PCSpeakerStream *speaker = new Audio::PCSpeakerStream(_mixer->getOutputRate());
speaker->setVolume(255);
- speaker->play(Audio::PCSpeaker::kWaveFormSine, frequency, ms);
+ speaker->play(Audio::PCSpeaker::kWaveFormSquare, frequency, ms);
+ _mixer->stopHandle(_speakerHandle);
_mixer->playStream(Audio::Mixer::kSFXSoundType, &_speakerHandle,
speaker,
-1,
Commit: 68c9d97592f32977b56b776065900a731b17b3fa
https://github.com/scummvm/scummvm/commit/68c9d97592f32977b56b776065900a731b17b3fa
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:56+02:00
Commit Message:
TOT: Enhance save pattern selection
Changed paths:
engines/tot/saveload.cpp
diff --git a/engines/tot/saveload.cpp b/engines/tot/saveload.cpp
index dc363cf835f..6af17508a12 100644
--- a/engines/tot/saveload.cpp
+++ b/engines/tot/saveload.cpp
@@ -616,7 +616,7 @@ void TotEngine::originalSaveLoadScreen() {
bar(61, 15, 122, 23, 253);
bar(201, 15, 259, 23, 253);
}
- Common::String pattern = isLanguageSpanish ? "tot-es.###" : "tot.###";
+ Common::String pattern = g_engine->getMetaEngine()->getSavegameFilePattern(_targetName.c_str());
Common::StringArray saves = g_system->getSavefileManager()->listSavefiles(pattern);
saveName = drawAndSelectSaves(saves, selectedGame);
if (_cpCounter2 > 17)
Commit: 075835aaf5d5fa5e8663196883551f908cf6704d
https://github.com/scummvm/scummvm/commit/075835aaf5d5fa5e8663196883551f908cf6704d
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:56+02:00
Commit Message:
TOT: Make fonts ready for 16 & 32 bpp
Changed paths:
graphics/fonts/bgifont.cpp
graphics/fonts/bgifont.h
graphics/fonts/dosfont.cpp
graphics/fonts/dosfont.h
diff --git a/graphics/fonts/bgifont.cpp b/graphics/fonts/bgifont.cpp
index e91c4fb8010..56ca7ebb226 100644
--- a/graphics/fonts/bgifont.cpp
+++ b/graphics/fonts/bgifont.cpp
@@ -189,7 +189,12 @@ void BgiFont::drawChar(Surface *dst, uint32 chr, int x, int y, uint32 color) con
for (uint16 i = 0; i < _totalHeight; i++) {
for (uint16 j = 0; j < charWidth; j++) {
if (font->surface->getPixel(font->offsets[charIndex] + j, i)) {
- *((byte *)dst->getBasePtr(x + j, y + i)) = color;
+ if (dst->format.bytesPerPixel == 1)
+ *((byte *)dst->getBasePtr(x + j, y + i)) = color;
+ else if (dst->format.bytesPerPixel == 2)
+ *((uint16 *)dst->getBasePtr(x + j, y + i)) = color;
+ else if (dst->format.bytesPerPixel == 4)
+ *((uint32 *)dst->getBasePtr(x + j, y + i)) = color;
}
}
}
diff --git a/graphics/fonts/bgifont.h b/graphics/fonts/bgifont.h
index 54b23917cdd..12ab1b7bfb2 100644
--- a/graphics/fonts/bgifont.h
+++ b/graphics/fonts/bgifont.h
@@ -22,7 +22,7 @@
#define GRAPHICS_FONTS_BGIFONT_H
#include "common/file.h"
-#include "common/std/vector.h"
+#include "common/array.h"
#include "graphics/font.h"
#include "graphics/surface.h"
diff --git a/graphics/fonts/dosfont.cpp b/graphics/fonts/dosfont.cpp
index 771a8fc1e2e..4fb7579b0c2 100644
--- a/graphics/fonts/dosfont.cpp
+++ b/graphics/fonts/dosfont.cpp
@@ -39,18 +39,19 @@ int DosFont::getCharWidth(uint32 chr) const {
}
void DosFont::drawChar(Graphics::Surface *dst, uint32 chr, int x, int y, uint32 color) const {
- byte *ptr = (byte *)dst->getBasePtr(x, y);
int srcPixel = chr * 8;
for (int sy = 0; sy < 8; sy++) {
for (int sx = 0; sx < 8; sx++) {
if (Graphics::DosFont::fontData_PCBIOS[srcPixel] & 1 << (7 - sx)) {
- *ptr = color;
+ if (dst->format.bytesPerPixel == 1)
+ *((byte *)dst->getBasePtr(x + sx, y + sy)) = color;
+ else if (dst->format.bytesPerPixel == 2)
+ *((uint16 *)dst->getBasePtr(x + sx, y + sy)) = color;
+ else if (dst->format.bytesPerPixel == 4)
+ *((uint32 *)dst->getBasePtr(x + sx, y + sy)) = color;
}
- ptr++;
}
srcPixel++;
- ptr -= 8;
- ptr += (dst->pitch);
}
}
diff --git a/graphics/fonts/dosfont.h b/graphics/fonts/dosfont.h
index 75474ae84b3..2a5423dbf44 100644
--- a/graphics/fonts/dosfont.h
+++ b/graphics/fonts/dosfont.h
@@ -26,7 +26,6 @@
namespace Graphics {
-// For now just a holder for static data. May become a child of Font if needed.
class DosFont : public Graphics::Font {
public:
DosFont();
Commit: c2fca28a46838ed86523989d2df873fd2d84301a
https://github.com/scummvm/scummvm/commit/c2fca28a46838ed86523989d2df873fd2d84301a
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:56+02:00
Commit Message:
TOT: Use PCSpeaker rather than PCSpeakerStream
Changed paths:
engines/tot/sound.cpp
engines/tot/sound.h
diff --git a/engines/tot/sound.cpp b/engines/tot/sound.cpp
index 15097d10f59..02986d66eb9 100644
--- a/engines/tot/sound.cpp
+++ b/engines/tot/sound.cpp
@@ -32,6 +32,8 @@ namespace Tot {
SoundManager::SoundManager(Audio::Mixer *mixer) : _mixer(mixer) {
_midiPlayer = new MidiPlayer();
+ _speaker = new Audio::PCSpeaker();
+ _speaker->init();
_midiPlayer->open();
g_engine->syncSoundSettings();
@@ -46,6 +48,7 @@ SoundManager::~SoundManager() {
delete _midiPlayer;
free(_lastSrcStream);
free(_audioStream);
+ delete(_speaker);
}
void SoundManager::init() {
@@ -137,17 +140,8 @@ void SoundManager::toggleMusic() {
}
void SoundManager::beep(int32 frequency, int32 ms) {
- Audio::PCSpeakerStream *speaker = new Audio::PCSpeakerStream(_mixer->getOutputRate());
- speaker->setVolume(255);
- speaker->play(Audio::PCSpeaker::kWaveFormSquare, frequency, ms);
- _mixer->stopHandle(_speakerHandle);
- _mixer->playStream(Audio::Mixer::kSFXSoundType, &_speakerHandle,
- speaker,
- -1,
- Audio::Mixer::kMaxChannelVolume,
- 0,
- DisposeAfterUse::NO,
- true);
+ _speaker->stop();
+ _speaker->play(Audio::PCSpeaker::kWaveFormSquare, frequency, ms);
}
void SoundManager::setSfxVolume(byte voll, byte volr) {
diff --git a/engines/tot/sound.h b/engines/tot/sound.h
index c1ce83a7f2a..a29fcec17f0 100644
--- a/engines/tot/sound.h
+++ b/engines/tot/sound.h
@@ -22,6 +22,7 @@
#define TOT_SOUND_H
#include "audio/decoders/raw.h"
+#include "audio/softsynth/pcspk.h"
#include "audio/mixer.h"
#include "common/file.h"
@@ -61,9 +62,9 @@ private:
void setMusicVolume(byte volume);
Audio::SoundHandle _soundHandle;
- Audio::SoundHandle _speakerHandle;
Audio::Mixer *_mixer;
MidiPlayer *_midiPlayer;
+ Audio::PCSpeaker *_speaker;
Common::SeekableReadStream *_lastSrcStream = nullptr;
Audio::SeekableAudioStream *_audioStream = nullptr;
Commit: 872ecc438e10e6d46c8b513feb8327434e7eeefb
https://github.com/scummvm/scummvm/commit/872ecc438e10e6d46c8b513feb8327434e7eeefb
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-08T16:49:56+02:00
Commit Message:
GRAPHICS: FONT: Add tot to BGIFont headers
Changed paths:
engines/tot/font/bgifont.h
diff --git a/engines/tot/font/bgifont.h b/engines/tot/font/bgifont.h
index 54b23917cdd..f4b9be9db32 100644
--- a/engines/tot/font/bgifont.h
+++ b/engines/tot/font/bgifont.h
@@ -33,6 +33,12 @@ const int OPCODE_DOSCAN = 1;
const int OPCODE_MOVE = 2;
const int OPCODE_DRAW = 3;
+/**
+ * Parser for Borland's BGI fonts
+ *
+ * Fonts used in:
+ * - tot
+ */
class BgiFont : public Font {
public:
BgiFont();
More information about the Scummvm-git-logs
mailing list