CHAMBER: Switch to US version at run-time

This commit is contained in:
Eugene Sandulenko 2021-10-06 17:55:38 +03:00
parent 12ca250553
commit 39c5791a4b
13 changed files with 126 additions and 149 deletions

View File

@ -1332,11 +1332,11 @@ void CGA_ZoomImage(byte *pixels, byte w, byte h, byte nw, byte nh, byte *target,
zoom.oh = h;
zoom.ew = (w * 4) - 1;
zoom.eh = h - 1;
#ifdef VERSION_USA
zoom.xbase = 0;
#else
zoom.xbase = ((w * 4 / 2) - 1) % 4;
#endif
if (g_vm->getLanguage() == Common::EN_USA)
zoom.xbase = 0;
else
zoom.xbase = ((w * 4 / 2) - 1) % 4;
/*TODO: why this nw/nh order? maybe bug*/
#if 0

View File

@ -25,8 +25,6 @@
namespace Chamber {
#define VERSION_USA
#define BE(x) ((((x) >> 8) | ((x) << 8)) & 0xffff)
#define LE16(x) (x)

View File

@ -34,7 +34,7 @@ static const ADGameDescription gameDescriptions[] = {
{
"chamber",
"",
AD_ENTRY1s("kult1.pxi", "fc0bd31a3c380338f76ff53e421e47b6", 140537),
AD_ENTRY1s("ere.pxi", "5aa5bd2d79eefde70675b0b6734944f2", 134358),
Common::UNK_LANG, // EN/FR/DE
Common::kPlatformDOS,
ADGF_UNSTABLE,
@ -44,7 +44,7 @@ static const ADGameDescription gameDescriptions[] = {
{
"chamber",
"",
AD_ENTRY1s("ere.pxi", "5aa5bd2d79eefde70675b0b6734944f2", 134358),
AD_ENTRY1s("kult1.pxi", "fc0bd31a3c380338f76ff53e421e47b6", 140537),
Common::EN_USA,
Common::kPlatformDOS,
ADGF_UNSTABLE,

View File

@ -117,11 +117,11 @@ void DrawPersonBubble(byte x, byte y, byte flags, byte *msg) {
char_draw_max_width = flags & 0x1F;
char_xlat_table = chars_color_bonw;
#ifdef VERSION_USA
CalcStringSize(msg, &ww, &nw);
if (ww >= char_draw_max_width)
char_draw_max_width = ww;
#endif
if (g_vm->getLanguage() == Common::EN_USA) {
CalcStringSize(msg, &ww, &nw);
if (ww >= char_draw_max_width)
char_draw_max_width = ww;
}
/*upper border*/
ofs = CGA_CalcXY_p(x, y);

View File

@ -32,11 +32,12 @@ byte ifgm_loaded = 0;
byte ifgm_flag2;
void IFGM_Init(void) {
#ifdef VERSION_USA
/*TODO*/
#else
ifgm_loaded = 0;
#endif
if (g_vm->getLanguage() == Common::EN_USA) {
/*TODO*/
} else {
ifgm_loaded = 0;
}
}
void IFGM_Shutdown(void) {

View File

@ -84,10 +84,6 @@ byte ChamberEngine::readKeyboardChar() {
void ClearKeyboard(void) {
}
#ifdef VERSION_USA
extern int16 AskQuitGame(void);
#endif
void SetInputButtons(byte keys) {
if (keys & 2)
right_button = ~0;
@ -147,8 +143,12 @@ byte PollKeyboard(void) {
Show game exit confirmation dialog and get user's input
*/
int16 AskQuitGame(void) {
/*EU version comes without requited text string*/
if (g_vm->getLanguage() != Common::EN_USA)
return 0;
int16 quit = -1;
#ifdef VERSION_USA
byte *msg = SeekToString(desci_data, 411); /*DO YOU WANT TO QUIT ? (Y OR N).*/
char_draw_max_width = 32;
draw_x = 1;
@ -177,9 +177,8 @@ int16 AskQuitGame(void) {
}
}
CGA_CopyScreenBlock(backbuffer, char_draw_max_width + 2, char_draw_coords_y - draw_y + 8, frontbuffer, CGA_CalcXY_p(draw_x, draw_y));
#endif
/*EU version comes without requited text string*/
return quit == 1;
return quit;
}
void PollInputButtonsOnly() {
@ -194,10 +193,10 @@ void PollInput(void) {
if (event.kbd.keycode == Common::KEYCODE_SPACE)
mouseButtons |= 1;
else if (event.kbd.keycode == Common::KEYCODE_ESCAPE) {
#ifdef VERSION_USA
if (AskQuitGame() != 0)
g_vm->_shouldQuit = true;
#endif
if (g_vm->getLanguage() == Common::EN_USA) {
if (AskQuitGame() != 0)
g_vm->_shouldQuit = true;
}
}
break;

View File

@ -217,19 +217,19 @@ Common::Error ChamberEngine::run() {
/* Install timer callback */
InitTimer();
#ifdef VERSION_USA
/* Load title screen */
if (!LoadSplash("PRESCGA.BIN"))
ExitGame();
if (g_vm->getLanguage() == Common::EN_USA) {
/* Load title screen */
if (!LoadSplash("PRESCGA.BIN"))
ExitGame();
if (ifgm_loaded) {
/*TODO*/
if (ifgm_loaded) {
/*TODO*/
}
} else {
/* Load title screen */
if (!LoadSplash("PRES.BIN"))
ExitGame();
}
#else
/* Load title screen */
if (!LoadSplash("PRES.BIN"))
ExitGame();
#endif
/* Select intense cyan-mageta palette */
CGA_ColorSelect(0x30);
@ -237,36 +237,36 @@ Common::Error ChamberEngine::run() {
/* Show the title screen */
CGA_BackBufferToRealFull();
#ifdef VERSION_USA
if (ifgm_loaded) {
/*TODO*/
if (g_vm->getLanguage() == Common::EN_USA) {
if (ifgm_loaded) {
/*TODO*/
}
/* Force English language */
c = 'E';
} else {
/* Load language selection screen */
if (!LoadSplash("DRAP.BIN"))
ExitGame();
/* Wait for a keypress and show the language selection screen */
ClearKeyboard();
readKeyboardChar();
if (_shouldQuit)
return Common::kNoError;
CGA_BackBufferToRealFull();
ClearKeyboard();
/* Wait for a valid language choice */
do {
c = readKeyboardChar();
if (c > 'F')
c -= ' ';
} while (c < 'D' || c > 'F');
}
/* Force English language */
c = 'E';
#else
/* Load language selection screen */
if (!LoadSplash("DRAP.BIN"))
ExitGame();
/* Wait for a keypress and show the language selection screen */
ClearKeyboard();
readKeyboardChar();
if (_shouldQuit)
return Common::kNoError;
CGA_BackBufferToRealFull();
ClearKeyboard();
/* Wait for a valid language choice */
do {
c = readKeyboardChar();
if (c > 'F')
c -= ' ';
} while (c < 'D' || c > 'F');
#endif
if (_shouldQuit)
return Common::kNoError;
@ -276,9 +276,8 @@ Common::Error ChamberEngine::run() {
res_desci[0].name[4] = c;
res_diali[0].name[4] = c;
#ifndef VERSION_USA
CGA_BackBufferToRealFull();
#endif
if (g_vm->getLanguage() != Common::EN_USA)
CGA_BackBufferToRealFull();
/* Load script and other static resources */
/* Those are normally embedded in the executable, but here we load extracted ones*/
@ -305,11 +304,11 @@ Common::Error ChamberEngine::run() {
/* Detect CPU speed for delay routines */
cpu_speed_delay = BenchmarkCpu() / 8;
#ifdef VERSION_USA
if (ifgm_loaded) {
/*TODO*/
if (g_vm->getLanguage() == Common::EN_USA) {
if (ifgm_loaded) {
/*TODO*/
}
}
#endif
/*restart game from here*/
restart:;

View File

@ -311,20 +311,20 @@ void BlinkToRed(void) {
}
void BlinkToWhite(void) {
#ifdef VERSION_USA
PlayHurtSound(); /*TODO: play here and later? looks like a bug, original code will trash palette selection if pcspeaker is used*/
#endif
if (g_vm->getLanguage() == Common::EN_USA)
PlayHurtSound(); /*TODO: play here and later? looks like a bug, original code will trash palette selection if pcspeaker is used*/
BlinkWithSound(0x3F);
}
volatile byte vblank_ticks;
void WaitVBlankTimer(void) {
#ifdef VERSION_USA
/*A crude attempt to fix the animation speed...*/
while (vblank_ticks < 3) ;
vblank_ticks = 0;
#endif
if (g_vm->getLanguage() == Common::EN_USA) {
/*A crude attempt to fix the animation speed...*/
while (vblank_ticks < 3) ;
vblank_ticks = 0;
}
WaitVBlank();
}

View File

@ -163,12 +163,14 @@ byte *PrintStringLine(byte *str, uint16 *left, byte *target) {
byte *PrintStringPadded(byte *str, byte *target) {
uint16 w;
#ifndef VERSION_USA
uint16 n;
CalcStringSize(str, &w, &n);
if (w + 2 >= char_draw_max_width)
char_draw_max_width = w + 2;
#endif
if (g_vm->getLanguage() != Common::EN_USA) {
uint16 n;
CalcStringSize(str, &w, &n);
if (w + 2 >= char_draw_max_width)
char_draw_max_width = w + 2;
}
str = PrintStringLine(str, &w, target);
if (w != 0)
PrintStringPad(w, target);
@ -199,11 +201,11 @@ void CGA_DrawTextBox(byte *msg, byte *target) {
char_xlat_table = chars_color_bonc;
#ifdef VERSION_USA
CalcStringSize(msg, &ww, &nw);
if (ww >= char_draw_max_width)
char_draw_max_width = ww;
#endif
if (g_vm->getLanguage() == Common::EN_USA) {
CalcStringSize(msg, &ww, &nw);
if (ww >= char_draw_max_width)
char_draw_max_width = ww;
}
x = draw_x * 4;
y = draw_y;

View File

@ -138,7 +138,10 @@ NB! Static data includes the font file, don't use any text print routines before
int16 LoadStaticData() {
Common::File pxi;
pxi.open("ere.pxi");
if (g_vm->getLanguage() == Common::EN_USA)
pxi.open("kult1.pxi");
else
pxi.open("ere.pxi");
uint numMods = pxi.readUint16BE();
uint modBase = 2 + numMods * 4;

View File

@ -36,7 +36,6 @@ typedef struct ResEntry_tp {
} ResEntry_tp;
/* Max resource file size among all languages */
#ifdef VERSION_USA
#define RES_ALEAT_MAX 256
#define RES_ANICO_MAX 667
#define RES_ANIMA_MAX 2046
@ -58,29 +57,6 @@ typedef struct ResEntry_tp {
#define RES_DIALI_MAX 9636
#define RES_MOTSI_MAX 1082
#define RES_VEPCI_MAX 1345
#else
#define RES_ALEAT_MAX 256
#define RES_ANICO_MAX 667
#define RES_ANIMA_MAX 2046
#define RES_ARPLA_MAX 7910
#define RES_CARPC_MAX 384
#define RES_GAUSS_MAX 1449
#define RES_ICONE_MAX 2756
#define RES_LUTIN_MAX 2800
#define RES_MURSM_MAX 76
#define RES_SOUCO_MAX 424
#define RES_SOURI_MAX 1152
#define RES_TEMPL_MAX 27337
#define RES_ZONES_MAX 9014
#define RES_PUZZL_MAX 45671
#define RES_SPRIT_MAX 23811
#define RES_PERS1_MAX 14294
#define RES_PERS2_MAX 10587
#define RES_DESCI_MAX 10515
#define RES_DIALI_MAX 9636
#define RES_MOTSI_MAX 1082
#define RES_VEPCI_MAX 1345
#endif
extern byte vepci_data[];
extern byte motsi_data[];

View File

@ -1527,12 +1527,12 @@ void DrawTheWallDoors(void) {
case 9:
case 102:
CGA_Blit(LoadMursmSprite(0) + 10, 20, 10, 59, CGA_SCREENBUFFER, CGA_CalcXY_p(64 / CGA_PIXELS_PER_BYTE, 32));
#ifdef VERSION_USA
/*This fixes odd black patch on the right gate door*/
CGA_Blit(LoadMursmSprite(1) , 20, 10, 59, CGA_SCREENBUFFER, CGA_CalcXY_p(184 / CGA_PIXELS_PER_BYTE, 32));
#else
CGA_Blit(LoadMursmSprite(1) , 20, 10, 59, CGA_SCREENBUFFER, CGA_CalcXY_p(180 / CGA_PIXELS_PER_BYTE, 32));
#endif
if (g_vm->getLanguage() == Common::EN_USA) {
/*This fixes odd black patch on the right gate door*/
CGA_Blit(LoadMursmSprite(1) , 20, 10, 59, CGA_SCREENBUFFER, CGA_CalcXY_p(184 / CGA_PIXELS_PER_BYTE, 32));
} else {
CGA_Blit(LoadMursmSprite(1) , 20, 10, 59, CGA_SCREENBUFFER, CGA_CalcXY_p(180 / CGA_PIXELS_PER_BYTE, 32));
}
break;
case 95:
case 103:

View File

@ -2885,26 +2885,25 @@ void TheEnd(void) {
AnimSaucer();
#ifdef VERSION_USA
DrawPortraitZoomed(&pimage2);
if (g_vm->getLanguage() == Common::EN_USA) {
DrawPortraitZoomed(&pimage2);
script_byte_vars.zone_index = 135;
script_byte_vars.zone_index = 135;
do
{
PollInputButtonsOnly();
do {
PollInputButtonsOnly();
}
while(buttons == 0);
while (!LoadFond())
AskDisk2();
JaggedZoom(backbuffer, frontbuffer);
CGA_BackBufferToRealFull();
} else {
while (!LoadSplash("PRES.BIN"))
AskDisk2();
CGA_BackBufferToRealFull();
}
while(buttons == 0);
while (!LoadFond())
AskDisk2();
JaggedZoom(backbuffer, frontbuffer);
CGA_BackBufferToRealFull();
#else
while (!LoadSplash("PRES.BIN"))
AskDisk2();
CGA_BackBufferToRealFull();
#endif
}
uint16 SCR_5B_TheEnd(void) {
@ -2913,11 +2912,11 @@ uint16 SCR_5B_TheEnd(void) {
TheEnd();
#ifdef VERSION_USA
RestartGame();
#else
for (;;) ; /*HANG*/
#endif
if (g_vm->getLanguage() == Common::EN_USA)
RestartGame();
else
for (;;) ; /*HANG*/
return 0;
}