CHAMBER: Replace data types with portable ones

This commit is contained in:
Eugene Sandulenko 2021-09-18 01:45:55 +02:00
parent f50556d1bf
commit 79078695aa
41 changed files with 1473 additions and 1473 deletions

View File

@ -31,29 +31,29 @@
namespace Chamber {
unsigned char *anima_end_ofs;
byte *anima_end_ofs;
unsigned char last_anim_y = 0;
unsigned char last_anim_x = 0;
unsigned char anim_shift_y = 0;
unsigned char anim_shift_x = 0;
unsigned char last_anim_height;
unsigned char last_anim_width;
unsigned char anim_cycle;
unsigned char anim_flags;
unsigned char anim_use_dot_effect;
unsigned int anim_draw_delay;
unsigned char dot_effect_step;
unsigned int dot_effect_delay;
byte last_anim_y = 0;
byte last_anim_x = 0;
byte anim_shift_y = 0;
byte anim_shift_x = 0;
byte last_anim_height;
byte last_anim_width;
byte anim_cycle;
byte anim_flags;
byte anim_use_dot_effect;
uint16 anim_draw_delay;
byte dot_effect_step;
uint16 dot_effect_delay;
extern unsigned short cpu_speed_delay;
extern uint16 cpu_speed_delay;
extern unsigned char *SeekToEntry(unsigned char *bank, unsigned int num, unsigned char **end);
extern void LoadLutinSprite(unsigned int lutidx);
extern byte *SeekToEntry(byte *bank, uint16 num, byte **end);
extern void LoadLutinSprite(uint16 lutidx);
void GetScratchBuffer(unsigned char mode) {
unsigned char *buffer = scratch_mem2;
unsigned int offs = 0;
void GetScratchBuffer(byte mode) {
byte *buffer = scratch_mem2;
uint16 offs = 0;
if (mode & 0x80)
offs += 3200;
if (mode & 0x40)
@ -61,16 +61,16 @@ void GetScratchBuffer(unsigned char mode) {
lutin_mem = buffer + offs;
}
void AnimLoadSprite(unsigned char **panim) {
unsigned char mode;
unsigned char index;
void AnimLoadSprite(byte **panim) {
byte mode;
byte index;
mode = *((*panim)++);
index = *((*panim)++);
GetScratchBuffer(mode);
LoadLutinSprite(index);
}
void ClipSprite(unsigned char *x, unsigned char *y, unsigned char *sprw, unsigned char *sprh, unsigned char **sprite, signed char dx, signed char dy) {
void ClipSprite(byte *x, byte *y, byte *sprw, byte *sprh, byte **sprite, int8 dx, int8 dy) {
if (anim_flags == 7)
return;
if (anim_flags & 4) {
@ -106,20 +106,20 @@ void ClipSprite(unsigned char *x, unsigned char *y, unsigned char *sprw, unsigne
}
}
void CopyScreenBlockWithDotEffect(unsigned char *source, unsigned char x, unsigned char y, unsigned char width, unsigned char height, unsigned char *target) {
unsigned int offs;
unsigned int xx = x * 4;
unsigned int ww = width * 4;
unsigned int cur_image_end = ww * height;
void CopyScreenBlockWithDotEffect(byte *source, byte x, byte y, byte width, byte height, byte *target) {
uint16 offs;
uint16 xx = x * 4;
uint16 ww = width * 4;
uint16 cur_image_end = ww * height;
for (offs = 0; offs != cur_image_end;) {
unsigned char mask = 0xC0 >> (((xx + offs % ww) % 4) * 2);
unsigned int ofs = CGA_CalcXY(xx + offs % ww, y + offs / ww);
byte mask = 0xC0 >> (((xx + offs % ww) % 4) * 2);
uint16 ofs = CGA_CalcXY(xx + offs % ww, y + offs / ww);
target[ofs] = (target[ofs] & ~mask) | (source[ofs] & mask);
if (dot_effect_delay / 4 != 0) {
unsigned int i;
uint16 i;
for (i = 0; i < dot_effect_delay / 4; i++) ; /*TODO: weak delay*/
}
@ -129,10 +129,10 @@ void CopyScreenBlockWithDotEffect(unsigned char *source, unsigned char x, unsign
}
}
void AnimDrawSprite(unsigned char x, unsigned char y, unsigned char sprw, unsigned char sprh, unsigned char *pixels, unsigned int pitch) {
unsigned int delay, delay2;
unsigned char ex, ey, updx, updy, updw, updh;
unsigned int ofs = CGA_CalcXY_p(x, y);
void AnimDrawSprite(byte x, byte y, byte sprw, byte sprh, byte *pixels, uint16 pitch) {
uint16 delay, delay2;
byte ex, ey, updx, updy, updw, updh;
uint16 ofs = CGA_CalcXY_p(x, y);
CGA_BackupImage(backbuffer, ofs, sprw, sprh, sprit_load_buffer);
CGA_BlitSprite(pixels, pitch, sprw, sprh, backbuffer, ofs);
ex = x + sprw;
@ -179,10 +179,10 @@ void AnimUndrawSprite(void) {
last_anim_height = 0;
}
void PlayAnimCore(unsigned char **panim) {
unsigned char mode;
unsigned int count, count2;
unsigned char *pframe;
void PlayAnimCore(byte **panim) {
byte mode;
uint16 count, count2;
byte *pframe;
mode = *((*panim)++);
anim_flags = mode & 7;
count = mode >> 3;
@ -195,11 +195,11 @@ void PlayAnimCore(unsigned char **panim) {
dot_effect_delay = 500;
count2 = mode & 7;
while (count2--) {
unsigned char *sprite;
unsigned char sprw, sprh;
unsigned char x, y;
signed char dx, dy;
unsigned int pitch;
byte *sprite;
byte sprw, sprh;
byte x, y;
int8 dx, dy;
uint16 pitch;
mode = *pframe++;
GetScratchBuffer(mode);
dy = mode & 7;
@ -238,49 +238,49 @@ end:
*panim += mode & 7;
}
void Anim1(unsigned char **panim) {
void Anim1(byte **panim) {
anim_cycle = 0xFF;
anim_use_dot_effect = 0;
PlayAnimCore(panim);
}
void Anim2(unsigned char **panim) {
void Anim2(byte **panim) {
anim_cycle = 1;
anim_use_dot_effect = 0;
PlayAnimCore(panim);
}
void Anim3(unsigned char **panim) {
void Anim3(byte **panim) {
anim_cycle = 1;
anim_use_dot_effect = 0;
PlayAnimCore(panim);
}
void Anim4(unsigned char **panim) {
void Anim4(byte **panim) {
anim_cycle = last_anim_width - 1;
anim_use_dot_effect = 0;
PlayAnimCore(panim);
}
void Anim5(unsigned char **panim) {
void Anim5(byte **panim) {
anim_cycle = last_anim_width - 1;
anim_use_dot_effect = 0;
PlayAnimCore(panim);
}
void Anim6(unsigned char **panim) {
void Anim6(byte **panim) {
anim_cycle = last_anim_height;
anim_use_dot_effect = 0;
PlayAnimCore(panim);
}
void Anim7(unsigned char **panim) {
void Anim7(byte **panim) {
anim_cycle = 0xFF;
anim_use_dot_effect = 1;
PlayAnimCore(panim);
}
typedef void (*animhandler_t)(unsigned char **panim);
typedef void (*animhandler_t)(byte **panim);
animhandler_t anim_handlers[] = {
AnimLoadSprite,
@ -293,9 +293,9 @@ animhandler_t anim_handlers[] = {
Anim7
};
void PlayAnim(unsigned char index, unsigned char x, unsigned char y) {
unsigned char sound;
unsigned char *panim;
void PlayAnim(byte index, byte x, byte y) {
byte sound;
byte *panim;
last_anim_width = 0;
last_anim_height = 0;
@ -304,7 +304,7 @@ void PlayAnim(unsigned char index, unsigned char x, unsigned char y) {
panim = SeekToEntry(anima_data, index - 1, &anima_end_ofs);
while (panim != anima_end_ofs) {
unsigned char mode = *panim;
byte mode = *panim;
switch (mode) {
case 0xFE: /*set shift*/
panim++;

View File

@ -25,11 +25,11 @@
namespace Chamber {
void PlayAnim(unsigned char index, unsigned char x, unsigned char y);
void CopyScreenBlockWithDotEffect(unsigned char *source, unsigned char x, unsigned char y, unsigned char width, unsigned char height, unsigned char *target);
void PlayAnim(byte index, byte x, byte y);
void CopyScreenBlockWithDotEffect(byte *source, byte x, byte y, byte width, byte height, byte *target);
extern unsigned char dot_effect_step;
extern unsigned int dot_effect_delay;
extern byte dot_effect_step;
extern uint16 dot_effect_delay;
} // End of namespace Chamber

View File

@ -25,7 +25,7 @@
namespace Chamber {
unsigned char backbuffer[0x4000];
byte backbuffer[0x4000];
} // End of namespace Chamber

View File

@ -30,23 +30,23 @@
namespace Chamber {
extern unsigned char backbuffer[0x4000];
extern byte backbuffer[0x4000];
byte CGA_SCREENBUFFER[0x4000];
byte scrbuffer[320*200];
unsigned char carpc_data[RES_CARPC_MAX];
byte carpc_data[RES_CARPC_MAX];
extern unsigned char *scratch_mem2;
extern byte *scratch_mem2;
unsigned char char_draw_coords_x;
unsigned char char_draw_coords_y;
unsigned char *char_xlat_table;
unsigned char string_ended;
unsigned char char_draw_max_width;
unsigned char char_draw_max_height;
byte char_draw_coords_x;
byte char_draw_coords_y;
byte *char_xlat_table;
byte string_ended;
byte char_draw_max_width;
byte char_draw_max_height;
/*pixels order reverse in a byte*/
unsigned char cga_pixel_flip[256] = {
byte cga_pixel_flip[256] = {
0, 64, 128, 192, 16, 80, 144, 208, 32, 96, 160, 224,
48, 112, 176, 240, 4, 68, 132, 196, 20, 84, 148, 212,
36, 100, 164, 228, 52, 116, 180, 244, 8, 72, 136, 200,
@ -95,16 +95,16 @@ void SwitchToTextMode(void) {
void WaitVBlank(void) {
}
void CGA_ColorSelect(unsigned char csel) {
void CGA_ColorSelect(byte csel) {
warning("STUB: CGA_ColorSelect(%d)", csel);
//outportb(0x3D9, csel);
}
void CGA_blitToScreen(int dx, int dy, int w, int h) {
void CGA_blitToScreen(int16 dx, int16 dy, int16 w, int16 h) {
dx = dy = 0;
w = 320; h = 200;
// Align x by 4
int align = dx & 0x3;
int16 align = dx & 0x3;
dx -= align;
w += align;
@ -117,14 +117,14 @@ void CGA_blitToScreen(int dx, int dy, int w, int h) {
w = (w + 3) / 4;
for (int y = 0; y < h; y++) {
for (int16 y = 0; y < h; y++) {
byte *src = CGA_SCREENBUFFER + CGA_CalcXY(dx, dy + y);
byte *dst = scrbuffer + (y + dy) * 320 + dx;
for (int x = 0; x < w; x++) {
for (int16 x = 0; x < w; x++) {
byte colors = *src++;
for (int c = 0; c < 4; c++) {
for (int16 c = 0; c < 4; c++) {
byte color = (colors & 0xC0) >> 6;
colors <<= 2;
@ -137,9 +137,9 @@ void CGA_blitToScreen(int dx, int dy, int w, int h) {
g_system->updateScreen();
}
void CGA_blitToScreen(int ofs, int w, int h) {
int dy = ofs / 80;
int dx = (ofs % 80) * 4;
void CGA_blitToScreen(int16 ofs, int16 w, int16 h) {
int16 dy = ofs / 80;
int16 dx = (ofs % 80) * 4;
CGA_blitToScreen(dx, dy, w, h);
}
@ -156,9 +156,9 @@ void CGA_RealBufferToBackFull(void) {
/*Copy interlaced screen data to another screen*/
/*NB! w is in bytes*/
void CGA_CopyScreenBlock(unsigned char *source, unsigned int w, unsigned int h, unsigned char *target, unsigned int ofs) {
uint oh = h;
uint oofs = ofs;
void CGA_CopyScreenBlock(byte *source, uint16 w, uint16 h, byte *target, uint16 ofs) {
uint16 oh = h;
uint16 oofs = ofs;
while (h--) {
memcpy(target + ofs, source + ofs, w);
ofs ^= CGA_ODD_LINES_OFS;
@ -174,13 +174,13 @@ void CGA_CopyScreenBlock(unsigned char *source, unsigned int w, unsigned int h,
Flip screen and backbuffer
*/
void CGA_SwapRealBackBuffer(void) {
unsigned int i;
unsigned short *s, *d;
uint16 i;
uint16 *s, *d;
WaitVBlank();
s = (unsigned short *)CGA_SCREENBUFFER;
d = (unsigned short *)backbuffer;
s = (uint16 *)CGA_SCREENBUFFER;
d = (uint16 *)backbuffer;
for (i = 0; i < sizeof(backbuffer) / 2; i++) {
unsigned short t = *s;
uint16 t = *s;
*s++ = *d;
*d++ = t;
}
@ -192,12 +192,12 @@ void CGA_SwapRealBackBuffer(void) {
/*
Copy current screen's pixels to scratch mem, put new pixels to screen
*/
void CGA_SwapScreenRect(unsigned char *pixels, unsigned int w, unsigned int h, unsigned char *screen, unsigned int ofs) {
unsigned char *old = scratch_mem2;
uint oh = h;
uint oofs = ofs;
void CGA_SwapScreenRect(byte *pixels, uint16 w, uint16 h, byte *screen, uint16 ofs) {
byte *old = scratch_mem2;
uint16 oh = h;
uint16 oofs = ofs;
while (h--) {
unsigned int i;
uint16 i;
for (i = 0; i < w; i++) {
*old++ = screen[ofs + i];
screen[ofs + i] = *pixels++;
@ -216,7 +216,7 @@ Calc screen offset from normal pixel coordinates
Out:
screen offset
*/
unsigned int CGA_CalcXY(unsigned int x, unsigned int y) {
uint16 CGA_CalcXY(uint16 x, uint16 y) {
return CGA_CalcXY_p(x / 4, y);
}
@ -225,8 +225,8 @@ Calc screen offset from packed pixel coordinates
Out:
screen offset
*/
unsigned int CGA_CalcXY_p(unsigned int x, unsigned int y) {
unsigned int ofs = 0;
uint16 CGA_CalcXY_p(uint16 x, uint16 y) {
uint16 ofs = 0;
if (y & 1)
ofs += CGA_ODD_LINES_OFS;
ofs += CGA_BYTES_PER_LINE * (y / 2);
@ -239,9 +239,9 @@ backup screen rect to a buffer
Out:
next buffer ptr
*/
unsigned char *CGA_BackupImage(unsigned char *screen, unsigned int ofs, unsigned int w, unsigned int h, unsigned char *buffer) {
*(unsigned char *)(buffer + 0) = h;
*(unsigned char *)(buffer + 1) = w;
byte *CGA_BackupImage(byte *screen, uint16 ofs, uint16 w, uint16 h, byte *buffer) {
*(byte *)(buffer + 0) = h;
*(byte *)(buffer + 1) = w;
*(uint16 *)(buffer + 2) = ofs;
buffer += 4;
while (h--) {
@ -254,7 +254,7 @@ unsigned char *CGA_BackupImage(unsigned char *screen, unsigned int ofs, unsigned
return buffer;
}
unsigned char *CGA_BackupImageReal(unsigned int ofs, unsigned int w, unsigned int h) {
byte *CGA_BackupImageReal(uint16 ofs, uint16 w, uint16 h) {
return CGA_BackupImage(CGA_SCREENBUFFER, ofs, w, h, scratch_mem2);
}
@ -262,10 +262,10 @@ unsigned char *CGA_BackupImageReal(unsigned int ofs, unsigned int w, unsigned in
Blit progressive image to interlaced screen buffer
NB! width and pixelswidth specify a number of bytes, not count of pixels
*/
void CGA_Blit(unsigned char *pixels, unsigned int pw, unsigned int w, unsigned int h, unsigned char *screen, unsigned int ofs) {
void CGA_Blit(byte *pixels, uint16 pw, uint16 w, uint16 h, byte *screen, uint16 ofs) {
byte *src = pixels;
uint oofs = ofs;
for (int y = 0; y < h; y++) {
uint16 oofs = ofs;
for (int16 y = 0; y < h; y++) {
memcpy(screen + ofs, src, w);
src += pw;
ofs ^= CGA_ODD_LINES_OFS;
@ -281,14 +281,14 @@ void CGA_Blit(unsigned char *pixels, unsigned int pw, unsigned int w, unsigned i
Blit progressive image to interlaced screen buffer, then wait for VBlank
NB! width and pixelswidth specify a number of bytes, not count of pixels
*/
void CGA_BlitAndWait(unsigned char *pixels, unsigned int pw, unsigned int w, unsigned int h, unsigned char *screen, unsigned int ofs) {
void CGA_BlitAndWait(byte *pixels, uint16 pw, uint16 w, uint16 h, byte *screen, uint16 ofs) {
CGA_Blit(pixels, pw, w, h, screen, ofs);
WaitVBlank();
}
void CGA_Fill(unsigned char pixel, unsigned int w, unsigned int h, unsigned char *screen, unsigned int ofs) {
uint oofs = ofs;
for (int y = 0; y < h; y++) {
void CGA_Fill(byte pixel, uint16 w, uint16 h, byte *screen, uint16 ofs) {
uint16 oofs = ofs;
for (int16 y = 0; y < h; y++) {
memset(screen + ofs, pixel, w);
ofs ^= CGA_ODD_LINES_OFS;
if ((ofs & CGA_ODD_LINES_OFS) == 0)
@ -299,7 +299,7 @@ void CGA_Fill(unsigned char pixel, unsigned int w, unsigned int h, unsigned char
CGA_blitToScreen(oofs, w * 4, h);
}
void CGA_FillAndWait(unsigned char pixel, unsigned int w, unsigned int h, unsigned char *screen, unsigned int ofs) {
void CGA_FillAndWait(byte pixel, uint16 w, uint16 h, byte *screen, uint16 ofs) {
CGA_Fill(pixel, w, h, screen, ofs);
WaitVBlank();
}
@ -307,15 +307,15 @@ void CGA_FillAndWait(unsigned char pixel, unsigned int w, unsigned int h, unsign
/*
Restore saved image to target screen buffer
*/
void CGA_RestoreImage(unsigned char *buffer, unsigned char *target) {
void CGA_RestoreImage(byte *buffer, byte *target) {
uint16 w, h;
uint16 ofs;
if (!buffer)
return;
h = *(unsigned char *)(buffer + 0);
w = *(unsigned char *)(buffer + 1);
h = *(byte *)(buffer + 0);
w = *(byte *)(buffer + 1);
ofs = *(uint16 *)(buffer + 2);
buffer += 4; /*TODO: fix me for large int*/
@ -325,22 +325,22 @@ void CGA_RestoreImage(unsigned char *buffer, unsigned char *target) {
/*
Restore saved image from scratch mem to target screen buffer
*/
void CGA_RestoreBackupImage(unsigned char *target) {
void CGA_RestoreBackupImage(byte *target) {
CGA_RestoreImage(scratch_mem2, target);
}
/*
Copy image's real screen data to backbuffer
*/
void CGA_RefreshImageData(unsigned char *buffer) {
unsigned int w, h;
unsigned int ofs;
void CGA_RefreshImageData(byte *buffer) {
uint16 w, h;
uint16 ofs;
if (!buffer)
return;
h = *(unsigned char *)(buffer + 0);
w = *(unsigned char *)(buffer + 1);
h = *(byte *)(buffer + 0);
w = *(byte *)(buffer + 1);
ofs = *(uint16 *)(buffer + 2);
CGA_CopyScreenBlock(CGA_SCREENBUFFER, w, h, backbuffer, ofs);
@ -350,18 +350,18 @@ void CGA_RefreshImageData(unsigned char *buffer) {
Draw a vertical line with origin x:y and length l, using color
NB! Line must not wrap around the edge
*/
void CGA_DrawVLine(unsigned int x, unsigned int y, unsigned int l, unsigned char color, unsigned char *target) {
unsigned int ofs;
void CGA_DrawVLine(uint16 x, uint16 y, uint16 l, byte color, byte *target) {
uint16 ofs;
/*pixels are starting from top bits of byte*/
unsigned int mask = ~(3 << ((CGA_PIXELS_PER_BYTE - 1) * CGA_BITS_PER_PIXEL));
unsigned char pixel = color << ((CGA_PIXELS_PER_BYTE - 1) * CGA_BITS_PER_PIXEL);
uint16 mask = ~(3 << ((CGA_PIXELS_PER_BYTE - 1) * CGA_BITS_PER_PIXEL));
byte pixel = color << ((CGA_PIXELS_PER_BYTE - 1) * CGA_BITS_PER_PIXEL);
mask >>= (x % CGA_PIXELS_PER_BYTE) * CGA_BITS_PER_PIXEL;
pixel >>= (x % CGA_PIXELS_PER_BYTE) * CGA_BITS_PER_PIXEL;
ofs = CGA_CalcXY_p(x / CGA_PIXELS_PER_BYTE, y);
uint ol = l;
uint16 ol = l;
while (l--) {
target[ofs] = (target[ofs] & mask) | pixel;
ofs ^= CGA_ODD_LINES_OFS;
@ -377,17 +377,17 @@ void CGA_DrawVLine(unsigned int x, unsigned int y, unsigned int l, unsigned char
Draw a horizontal line with origin x:y and length l, using color
NB! Line must not wrap around the edge
*/
void CGA_DrawHLine(unsigned int x, unsigned int y, unsigned int l, unsigned char color, unsigned char *target) {
unsigned int ofs;
void CGA_DrawHLine(uint16 x, uint16 y, uint16 l, byte color, byte *target) {
uint16 ofs;
/*pixels are starting from top bits of byte*/
uint16 mask = ~(3 << ((CGA_PIXELS_PER_BYTE - 1) * CGA_BITS_PER_PIXEL));
unsigned char pixel = color << ((CGA_PIXELS_PER_BYTE - 1) * CGA_BITS_PER_PIXEL);
byte pixel = color << ((CGA_PIXELS_PER_BYTE - 1) * CGA_BITS_PER_PIXEL);
mask >>= (x % CGA_PIXELS_PER_BYTE) * CGA_BITS_PER_PIXEL;
pixel >>= (x % CGA_PIXELS_PER_BYTE) * CGA_BITS_PER_PIXEL;
ofs = CGA_CalcXY_p(x / CGA_PIXELS_PER_BYTE, y);
uint ol = l;
uint16 ol = l;
while (l--) {
target[ofs] = (target[ofs] & mask) | pixel;
mask >>= CGA_BITS_PER_PIXEL;
@ -407,11 +407,11 @@ Draw horizontal line of length l with color, add surrounding pixels (bmask, bpix
Return next line screen offset
NB! Length specifies byte lenght of inner segment, not amount of pixels
*/
unsigned int CGA_DrawHLineWithEnds(unsigned int bmask, unsigned int bpix, unsigned char color, unsigned int l, unsigned char *target, unsigned int ofs) {
uint16 CGA_DrawHLineWithEnds(uint16 bmask, uint16 bpix, byte color, uint16 l, byte *target, uint16 ofs) {
target[ofs] = (target[ofs] & (bmask >> 8)) | (bpix >> 8);
memset(target + ofs + 1, color, l);
target[ofs + 1 + l] = (target[ofs + 1 + l] & (bmask & 255)) | (bpix & 255);
uint oofs = ofs + 1;
uint16 oofs = ofs + 1;
ofs ^= CGA_ODD_LINES_OFS;
if ((ofs & CGA_ODD_LINES_OFS) == 0)
ofs += CGA_BYTES_PER_LINE;
@ -425,10 +425,10 @@ unsigned int CGA_DrawHLineWithEnds(unsigned int bmask, unsigned int bpix, unsign
/*
Print a character at current cursor pos, then advance
*/
void CGA_PrintChar(unsigned char c, unsigned char *target) {
unsigned int i;
unsigned char *font = carpc_data + c * CGA_FONT_HEIGHT;
unsigned int ofs = CGA_CalcXY_p(char_draw_coords_x++, char_draw_coords_y);
void CGA_PrintChar(byte c, byte *target) {
uint16 i;
byte *font = carpc_data + c * CGA_FONT_HEIGHT;
uint16 ofs = CGA_CalcXY_p(char_draw_coords_x++, char_draw_coords_y);
for (i = 0; i < CGA_FONT_HEIGHT; i++) {
c = *font++;
c = char_xlat_table[c];
@ -448,11 +448,11 @@ Blit progressive sprite (mask+pixel) from scratch buffer to interlaced screen bu
NB! width specify a number of bytes, not count of pixels
TODO: generalize/merge me with BlitSprite
*/
void CGA_BlitScratchBackSprite(unsigned int sprofs, unsigned int w, unsigned int h, unsigned char *screen, unsigned int ofs) {
unsigned char x;
unsigned char *pixels = scratch_mem2 + 2 + sprofs;
uint oh = h;
uint oofs = ofs;
void CGA_BlitScratchBackSprite(uint16 sprofs, uint16 w, uint16 h, byte *screen, uint16 ofs) {
byte x;
byte *pixels = scratch_mem2 + 2 + sprofs;
uint16 oh = h;
uint16 oofs = ofs;
while (h--) {
for (x = 0; x < w; x++)
screen[ofs + x] = (backbuffer[ofs + x] & pixels[x * 2]) | pixels[x * 2 + 1];
@ -466,7 +466,7 @@ void CGA_BlitScratchBackSprite(unsigned int sprofs, unsigned int w, unsigned int
CGA_blitToScreen(oofs, w * 4, oh);
}
void CGA_BlitFromBackBuffer(unsigned char w, unsigned char h, unsigned char *screen, unsigned int ofs) {
void CGA_BlitFromBackBuffer(byte w, byte h, byte *screen, uint16 ofs) {
CGA_CopyScreenBlock(backbuffer, w, h, screen, ofs);
}
@ -474,10 +474,10 @@ void CGA_BlitFromBackBuffer(unsigned char w, unsigned char h, unsigned char *scr
Blit progressive sprite (mask+pixel) to interlaced screen buffer
NB! width and pixelswidth specify a number of bytes, not count of pixels
*/
void CGA_BlitSprite(unsigned char *pixels, signed int pw, unsigned int w, unsigned int h, unsigned char *screen, unsigned int ofs) {
unsigned char x;
uint oh = h;
uint oofs = ofs;
void CGA_BlitSprite(byte *pixels, int16 pw, uint16 w, uint16 h, byte *screen, uint16 ofs) {
byte x;
uint16 oh = h;
uint16 oofs = ofs;
while (h--) {
for (x = 0; x < w; x++)
screen[ofs + x] = (screen[ofs + x] & pixels[x * 2]) | pixels[x * 2 + 1];
@ -495,10 +495,10 @@ void CGA_BlitSprite(unsigned char *pixels, signed int pw, unsigned int w, unsign
Blit progressive sprite (mask+pixel) to interlaced screen buffer. Flip the sprite horizontally
NB! width and pixelswidth specify a number of bytes, not count of pixels
*/
void CGA_BlitSpriteFlip(unsigned char *pixels, signed int pw, unsigned int w, unsigned int h, unsigned char *screen, unsigned int ofs) {
unsigned char x;
uint oh = h;
uint oofs = ofs;
void CGA_BlitSpriteFlip(byte *pixels, int16 pw, uint16 w, uint16 h, byte *screen, uint16 ofs) {
byte x;
uint16 oh = h;
uint16 oofs = ofs;
while (h--) {
for (x = 0; x < w; x++)
screen[ofs - x] = (screen[ofs - x] & cga_pixel_flip[pixels[x * 2]]) | cga_pixel_flip[pixels[x * 2 + 1]];
@ -520,10 +520,10 @@ Used to draw mouse cursor and backup what's under it
NB! width and pixelswidth specify a number of bytes, not count of pixels
NB! pixel+mask comes in reversed order, compared to regular BlitSprite
*/
void CGA_BlitSpriteBak(unsigned char *pixels, signed int pw, unsigned int w, unsigned int h, unsigned char *screen, unsigned int ofs, unsigned char *backup, unsigned char mask) {
unsigned char x;
uint oh = h;
uint oofs = ofs;
void CGA_BlitSpriteBak(byte *pixels, int16 pw, uint16 w, uint16 h, byte *screen, uint16 ofs, byte *backup, byte mask) {
byte x;
uint16 oh = h;
uint16 oofs = ofs;
while (h--) {
for (x = 0; x < w; x++) {
*backup++ = screen[ofs + x];
@ -543,8 +543,8 @@ void CGA_BlitSpriteBak(unsigned char *pixels, signed int pw, unsigned int w, uns
/*
Blit progressive sprite (w+h+mask+pixel) to interlaced screen buffer
*/
void DrawSprite(unsigned char *sprite, unsigned char *screen, unsigned int ofs) {
unsigned char w, h;
void DrawSprite(byte *sprite, byte *screen, uint16 ofs) {
byte w, h;
w = *sprite++;
h = *sprite++;
CGA_BlitSprite(sprite, w * 2, w, h, screen, ofs);
@ -553,8 +553,8 @@ void DrawSprite(unsigned char *sprite, unsigned char *screen, unsigned int ofs)
/*
Blit progressive sprite (w+h+mask+pixel) to interlaced screen buffer, horizontally flipped
*/
void DrawSpriteFlip(unsigned char *sprite, unsigned char *screen, unsigned int ofs) {
unsigned char w, h;
void DrawSpriteFlip(byte *sprite, byte *screen, uint16 ofs) {
byte w, h;
w = *sprite++;
h = *sprite++;
CGA_BlitSpriteFlip(sprite, w * 2, w, h, screen, ofs);
@ -564,11 +564,11 @@ void DrawSpriteFlip(unsigned char *sprite, unsigned char *screen, unsigned int o
Load and uncompress 2-bit sprite
Return next ptr after the loaded sprite
*/
unsigned char *LoadSprite(unsigned char index, unsigned char *bank, unsigned char *buffer, unsigned char header_only) {
unsigned char w, h;
unsigned int rsize;
unsigned char *sprite, *sprite_end;
unsigned char *bitmask;
byte *LoadSprite(byte index, byte *bank, byte *buffer, byte header_only) {
byte w, h;
uint16 rsize;
byte *sprite, *sprite_end;
byte *bitmask;
sprite = SeekToEntryW(bank, index, &sprite_end);
w = *sprite++;
h = *sprite++;
@ -589,10 +589,10 @@ unsigned char *LoadSprite(unsigned char index, unsigned char *bank, unsigned cha
}
} else {
/*with transparency*/
unsigned char bi = 1;
byte bi = 1;
while (rsize--) {
unsigned char pixels = *sprite++;
unsigned char mask = 0;
byte pixels = *sprite++;
byte mask = 0;
if ((pixels & 0xC0) == 0) {
bi >>= 1;
@ -641,16 +641,16 @@ unsigned char *LoadSprite(unsigned char index, unsigned char *bank, unsigned cha
return buffer;
}
extern unsigned char sprit_data[RES_SPRIT_MAX];
extern byte sprit_data[RES_SPRIT_MAX];
unsigned char sprit_load_buffer[1290];
byte sprit_load_buffer[1290];
unsigned char *LoadSprit(unsigned char index) {
byte *LoadSprit(byte index) {
LoadSprite(index, sprit_data + 4, sprit_load_buffer, 0);
return sprit_load_buffer;
}
unsigned char *LoadPersSprit(unsigned char index) {
byte *LoadPersSprit(byte index) {
#if 1
/*Use separate memory for pers1/pers2*/
if (index < 61)
@ -666,26 +666,26 @@ unsigned char *LoadPersSprit(unsigned char index) {
}
void DrawSpriteN(unsigned char index, unsigned int x, unsigned int y, unsigned char *target) {
unsigned int ofs;
unsigned char *sprite;
void DrawSpriteN(byte index, uint16 x, uint16 y, byte *target) {
uint16 ofs;
byte *sprite;
sprite = LoadSprit(index);
ofs = CGA_CalcXY_p(x, y);
DrawSprite(sprite, target, ofs);
}
void DrawSpriteNFlip(unsigned char index, unsigned int x, unsigned int y, unsigned char *target) {
unsigned int ofs;
unsigned char *sprite;
void DrawSpriteNFlip(byte index, uint16 x, uint16 y, byte *target) {
uint16 ofs;
byte *sprite;
sprite = LoadSprit(index);
ofs = CGA_CalcXY_p(x, y);
DrawSpriteFlip(sprite, target, ofs);
}
void BackupAndShowSprite(unsigned char index, unsigned char x, unsigned char y) {
unsigned char w, h;
unsigned int ofs;
unsigned char *sprite = LoadSprit(index);
void BackupAndShowSprite(byte index, byte x, byte y) {
byte w, h;
uint16 ofs;
byte *sprite = LoadSprit(index);
ofs = CGA_CalcXY_p(x, y);
w = sprite[0];
h = sprite[1];
@ -698,8 +698,8 @@ Blit progressive image to interlaced screen buffer, then wait for VBlank
Push image from the top to down
NB! width and pixelswidth specify a number of bytes, not count of pixels
*/
void CGA_AnimLiftToDown(unsigned char *pixels, unsigned int pw, unsigned int w, unsigned int h, unsigned char *screen, unsigned int ofs) {
unsigned int i;
void CGA_AnimLiftToDown(byte *pixels, uint16 pw, uint16 w, uint16 h, byte *screen, uint16 ofs) {
uint16 i;
pixels += pw * (h - 1);
for (i = 1; i <= h; i++) {
CGA_BlitAndWait(pixels, pw, w, i, screen, ofs);
@ -713,8 +713,8 @@ Pull and expand image from the right to left
NB! width and pixelswidth specify a number of bytes, not count of pixels
NB! ofs specifies top-right corner of the image
*/
void CGA_AnimLiftToLeft(unsigned int n, unsigned char *pixels, unsigned int pw, unsigned int w, unsigned int h, unsigned char *screen, unsigned int ofs) {
unsigned int i;
void CGA_AnimLiftToLeft(uint16 n, byte *pixels, uint16 pw, uint16 w, uint16 h, byte *screen, uint16 ofs) {
uint16 i;
for (i = 0; i < n; i++) {
CGA_BlitAndWait(pixels, pw, w + i, h, screen, ofs);
ofs -= 1;
@ -726,8 +726,8 @@ Blit progressive image to interlaced screen buffer, then wait for VBlank
Push image from the left to right
NB! width and pixelswidth specify a number of bytes, not count of pixels
*/
void CGA_AnimLiftToRight(unsigned int n, unsigned char *pixels, unsigned int pw, unsigned int w, unsigned int h, unsigned char *screen, unsigned int ofs) {
unsigned int i;
void CGA_AnimLiftToRight(uint16 n, byte *pixels, uint16 pw, uint16 w, uint16 h, byte *screen, uint16 ofs) {
uint16 i;
for (i = 0; i < n; i++) {
CGA_BlitAndWait(pixels, pw, w + i, h, screen, ofs);
pixels -= 1;
@ -740,8 +740,8 @@ Push image from the down to up
NB! width and pixelswidth specify a number of bytes, not count of pixels
NB! x:y specifies left-bottom coords
*/
void CGA_AnimLiftToUp(unsigned char *pixels, unsigned int pw, unsigned int w, unsigned int h, unsigned char *screen, unsigned int x, unsigned int y) {
unsigned int i;
void CGA_AnimLiftToUp(byte *pixels, uint16 pw, uint16 w, uint16 h, byte *screen, uint16 x, uint16 y) {
uint16 i;
for (i = 1; i <= h; i++) {
CGA_BlitAndWait(pixels, pw, w, i, screen, CGA_CalcXY_p(x, y));
y -= 1;
@ -752,10 +752,10 @@ void CGA_AnimLiftToUp(unsigned char *pixels, unsigned int pw, unsigned int w, un
/*Fill gap with source screen data*/
/*offs points to block's bottom most line, data will be shifted to next line*/
/*NB! w is in bytes*/
void CGA_HideScreenBlockLiftToDown(unsigned int n, unsigned char *screen, unsigned char *source, unsigned int w, unsigned int h, unsigned char *target, unsigned int ofs) {
void CGA_HideScreenBlockLiftToDown(uint16 n, byte *screen, byte *source, uint16 w, uint16 h, byte *target, uint16 ofs) {
while (n--) {
int i;
unsigned int sofs, tofs;
int16 i;
uint16 sofs, tofs;
sofs = ofs;
tofs = ofs;
@ -798,10 +798,10 @@ void CGA_HideScreenBlockLiftToDown(unsigned int n, unsigned char *screen, unsign
/*Fill gap with source screen data*/
/*offs points to block's top most line, data will be shifted to previous line*/
/*NB! w is in bytes*/
void CGA_HideScreenBlockLiftToUp(unsigned int n, unsigned char *screen, unsigned char *source, unsigned int w, unsigned int h, unsigned char *target, unsigned int ofs) {
void CGA_HideScreenBlockLiftToUp(uint16 n, byte *screen, byte *source, uint16 w, uint16 h, byte *target, uint16 ofs) {
while (n--) {
int i;
unsigned int sofs, tofs;
int16 i;
uint16 sofs, tofs;
sofs = ofs;
tofs = ofs;
@ -844,10 +844,10 @@ void CGA_HideScreenBlockLiftToUp(unsigned int n, unsigned char *screen, unsigned
/*Fill gap with source screen data*/
/*offs points to block's left most column, data will be shifted to previous column*/
/*NB! w is in bytes*/
void CGA_HideScreenBlockLiftToLeft(unsigned int n, unsigned char *screen, unsigned char *source, unsigned int w, unsigned int h, unsigned char *target, unsigned int ofs) {
void CGA_HideScreenBlockLiftToLeft(uint16 n, byte *screen, byte *source, uint16 w, uint16 h, byte *target, uint16 ofs) {
while (n--) {
int i;
unsigned int sofs, tofs;
int16 i;
uint16 sofs, tofs;
sofs = ofs;
@ -882,10 +882,10 @@ void CGA_HideScreenBlockLiftToLeft(unsigned int n, unsigned char *screen, unsign
/*Fill gap with source screen data*/
/*offs points to block's right most column, data will be shifted to next column*/
/*NB! w is in bytes*/
void CGA_HideScreenBlockLiftToRight(unsigned int n, unsigned char *screen, unsigned char *source, unsigned int w, unsigned int h, unsigned char *target, unsigned int ofs) {
void CGA_HideScreenBlockLiftToRight(uint16 n, byte *screen, byte *source, uint16 w, uint16 h, byte *target, uint16 ofs) {
while (n--) {
int i;
unsigned int sofs, tofs;
int16 i;
uint16 sofs, tofs;
sofs = ofs;
@ -918,15 +918,15 @@ void CGA_HideScreenBlockLiftToRight(unsigned int n, unsigned char *screen, unsig
typedef struct scrpiece_t {
unsigned int offs;
unsigned char delay; /*speed in bits 1..0, delay in bits 7..2*/
unsigned char pix0;
unsigned char pix2;
unsigned char pix1;
unsigned char pix3;
uint16 offs;
byte delay; /*speed in bits 1..0, delay in bits 7..2*/
byte pix0;
byte pix2;
byte pix1;
byte pix3;
} scrpiece_t;
static const unsigned char piecedelays[] = {
static const byte piecedelays[] = {
219, 182, 237, 187, 110, 219, 187, 120, 219, 109, 182,
219, 109, 182, 219, 104, 182, 214, 218, 219, 91, 107,
107, 104, 213, 107, 90, 214, 181, 182, 214, 216, 213,
@ -945,13 +945,13 @@ static const unsigned char piecedelays[] = {
};
/*break screen area onto 4x4 pix pieces*/
static void ScreenToPieces(unsigned char width, unsigned char height, unsigned char *screen, unsigned int offs, scrpiece_t *pieces) {
const unsigned char *delays = piecedelays;
static void ScreenToPieces(byte width, byte height, byte *screen, uint16 offs, scrpiece_t *pieces) {
const byte *delays = piecedelays;
height = (height + 3) / 4;
while (height--) {
unsigned int x;
uint16 x;
for (x = 0; x < width; x++) {
unsigned int bofs = offs + x;
uint16 bofs = offs + x;
pieces->offs = bofs;
pieces->delay = *delays++;
if (pieces->delay == 0) /*ensure piece is alive*/
@ -971,15 +971,15 @@ static void ScreenToPieces(unsigned char width, unsigned char height, unsigned c
pieces->offs = 0; /*end of list*/
}
static void FallPieces(scrpiece_t *pieces, unsigned char *source, unsigned char *target) {
unsigned char t = 1;
unsigned char again = 0;
static void FallPieces(scrpiece_t *pieces, byte *source, byte *target) {
byte t = 1;
byte again = 0;
do {
scrpiece_t *piece;
for (piece = pieces, again = 0; piece->offs; piece++) {
if ((piece->delay >> 2) < t) {
unsigned int offs = piece->offs;
unsigned int bofs = offs;
uint16 offs = piece->offs;
uint16 bofs = offs;
if (target[bofs] == piece->pix0)
target[bofs] = source[bofs];
if (target[bofs + CGA_BYTES_PER_LINE] == piece->pix2)
@ -1056,19 +1056,19 @@ static void FallPieces(scrpiece_t *pieces, unsigned char *source, unsigned char
} while (again);
}
void CGA_HideShatterFall(unsigned char *screen, unsigned char *source, unsigned int w, unsigned int h, unsigned char *target, unsigned int ofs) {
void CGA_HideShatterFall(byte *screen, byte *source, uint16 w, uint16 h, byte *target, uint16 ofs) {
scrpiece_t *pieces = (scrpiece_t *)scratch_mem2;
ScreenToPieces(w, h, screen, ofs, pieces);
FallPieces(pieces, source, target);
}
void CGA_TraceLine(unsigned int sx, unsigned int ex, unsigned int sy, unsigned int ey, unsigned char *source, unsigned char *target) {
unsigned char b0 = 0;
unsigned char b1 = 0;
unsigned char mask;
unsigned int ofs;
unsigned int count;
int w, h, dx, dy, val;
void CGA_TraceLine(uint16 sx, uint16 ex, uint16 sy, uint16 ey, byte *source, byte *target) {
byte b0 = 0;
byte b1 = 0;
byte mask;
uint16 ofs;
uint16 count;
int16 w, h, dx, dy, val;
if (ex >= sx)
w = ex - sx;

View File

@ -41,87 +41,87 @@ extern byte CGA_SCREENBUFFER[0x4000];
#define CGA_PREV_LINE(offs) ((CGA_ODD_LINES_OFS ^ (offs)) - (((offs) & CGA_ODD_LINES_OFS) ? CGA_BYTES_PER_LINE : 0))
#define frontbuffer CGA_SCREENBUFFER
extern unsigned char backbuffer[0x4000];
extern byte backbuffer[0x4000];
extern unsigned char sprit_load_buffer[1290];
extern byte sprit_load_buffer[1290];
extern unsigned char cga_pixel_flip[256];
extern byte cga_pixel_flip[256];
extern unsigned char char_draw_coords_x;
extern unsigned char char_draw_coords_y;
extern unsigned char *char_xlat_table;
extern unsigned char string_ended;
extern unsigned char char_draw_max_width;
extern unsigned char char_draw_max_height;
extern byte char_draw_coords_x;
extern byte char_draw_coords_y;
extern byte *char_xlat_table;
extern byte string_ended;
extern byte char_draw_max_width;
extern byte char_draw_max_height;
void SwitchToGraphicsMode(void);
void SwitchToTextMode(void);
void WaitVBlank(void);
void CGA_ColorSelect(unsigned char csel);
void CGA_ColorSelect(byte csel);
void CGA_BackBufferToRealFull(void);
void CGA_RealBufferToBackFull(void);
void CGA_SwapRealBackBuffer(void);
void CGA_SwapScreenRect(unsigned char *pixels, unsigned int w, unsigned int h, unsigned char *screen, unsigned int ofs);
void CGA_SwapScreenRect(byte *pixels, uint16 w, uint16 h, byte *screen, uint16 ofs);
unsigned int CGA_CalcXY(unsigned int x, unsigned int y);
unsigned int CGA_CalcXY_p(unsigned int x, unsigned int y);
uint16 CGA_CalcXY(uint16 x, uint16 y);
uint16 CGA_CalcXY_p(uint16 x, uint16 y);
void CGA_CopyScreenBlock(unsigned char *source, unsigned int w, unsigned int h, unsigned char *target, unsigned int ofs);
void CGA_CopyScreenBlock(byte *source, uint16 w, uint16 h, byte *target, uint16 ofs);
unsigned char *CGA_BackupImage(unsigned char *source, unsigned int ofs, unsigned int w, unsigned int h, unsigned char *buffer);
unsigned char *CGA_BackupImageReal(unsigned int ofs, unsigned int w, unsigned int h);
byte *CGA_BackupImage(byte *source, uint16 ofs, uint16 w, uint16 h, byte *buffer);
byte *CGA_BackupImageReal(uint16 ofs, uint16 w, uint16 h);
void CGA_RestoreImage(unsigned char *buffer, unsigned char *target);
void CGA_RefreshImageData(unsigned char *buffer);
void CGA_RestoreBackupImage(unsigned char *target);
void CGA_RestoreImage(byte *buffer, byte *target);
void CGA_RefreshImageData(byte *buffer);
void CGA_RestoreBackupImage(byte *target);
void CGA_Blit(unsigned char *pixels, unsigned int pw, unsigned int w, unsigned int h, unsigned char *screen, unsigned int ofs);
void CGA_BlitAndWait(unsigned char *pixels, unsigned int pw, unsigned int w, unsigned int h, unsigned char *screen, unsigned int ofs);
void CGA_FillAndWait(unsigned char pixel, unsigned int w, unsigned int h, unsigned char *screen, unsigned int ofs);
void CGA_Blit(byte *pixels, uint16 pw, uint16 w, uint16 h, byte *screen, uint16 ofs);
void CGA_BlitAndWait(byte *pixels, uint16 pw, uint16 w, uint16 h, byte *screen, uint16 ofs);
void CGA_FillAndWait(byte pixel, uint16 w, uint16 h, byte *screen, uint16 ofs);
void CGA_DrawVLine(unsigned int x, unsigned int y, unsigned int l, unsigned char color, unsigned char *target);
void CGA_DrawHLine(unsigned int x, unsigned int y, unsigned int l, unsigned char color, unsigned char *target);
unsigned int CGA_DrawHLineWithEnds(unsigned int bmask, unsigned int bpix, unsigned char color, unsigned int l, unsigned char *target, unsigned int ofs);
void CGA_DrawVLine(uint16 x, uint16 y, uint16 l, byte color, byte *target);
void CGA_DrawHLine(uint16 x, uint16 y, uint16 l, byte color, byte *target);
uint16 CGA_DrawHLineWithEnds(uint16 bmask, uint16 bpix, byte color, uint16 l, byte *target, uint16 ofs);
void CGA_PrintChar(unsigned char c, unsigned char *target);
void CGA_PrintChar(byte c, byte *target);
void CGA_BlitScratchBackSprite(unsigned int sprofs, unsigned int w, unsigned int h, unsigned char *screen, unsigned int ofs);
void CGA_BlitFromBackBuffer(unsigned char w, unsigned char h, unsigned char *screen, unsigned int ofs);
void CGA_BlitScratchBackSprite(uint16 sprofs, uint16 w, uint16 h, byte *screen, uint16 ofs);
void CGA_BlitFromBackBuffer(byte w, byte h, byte *screen, uint16 ofs);
void CGA_BlitSprite(unsigned char *pixels, signed int pw, unsigned int w, unsigned int h, unsigned char *screen, unsigned int ofs);
void CGA_BlitSpriteFlip(unsigned char *pixels, signed int pw, unsigned int w, unsigned int h, unsigned char *screen, unsigned int ofs);
void CGA_BlitSprite(byte *pixels, int16 pw, uint16 w, uint16 h, byte *screen, uint16 ofs);
void CGA_BlitSpriteFlip(byte *pixels, int16 pw, uint16 w, uint16 h, byte *screen, uint16 ofs);
void CGA_BlitSpriteBak(unsigned char *pixels, signed int pw, unsigned int w, unsigned int h, unsigned char *screen, unsigned int ofs, unsigned char *backup, unsigned char mask);
void CGA_BlitSpriteBak(byte *pixels, int16 pw, uint16 w, uint16 h, byte *screen, uint16 ofs, byte *backup, byte mask);
void DrawSprite(unsigned char *sprite, unsigned char *screen, unsigned int ofs);
void DrawSpriteFlip(unsigned char *sprite, unsigned char *screen, unsigned int ofs);
void DrawSprite(byte *sprite, byte *screen, uint16 ofs);
void DrawSpriteFlip(byte *sprite, byte *screen, uint16 ofs);
void DrawSpriteN(unsigned char index, unsigned int x, unsigned int y, unsigned char *target);
void DrawSpriteNFlip(unsigned char index, unsigned int x, unsigned int y, unsigned char *target);
void DrawSpriteN(byte index, uint16 x, uint16 y, byte *target);
void DrawSpriteNFlip(byte index, uint16 x, uint16 y, byte *target);
void BackupAndShowSprite(unsigned char index, unsigned char x, unsigned char y);
void BackupAndShowSprite(byte index, byte x, byte y);
unsigned char *LoadSprite(unsigned char index, unsigned char *bank, unsigned char *buffer, unsigned char header_only);
byte *LoadSprite(byte index, byte *bank, byte *buffer, byte header_only);
unsigned char *LoadSprit(unsigned char index);
unsigned char *LoadPersSprit(unsigned char index);
byte *LoadSprit(byte index);
byte *LoadPersSprit(byte index);
void CGA_AnimLiftToUp(unsigned char *pixels, unsigned int pw, unsigned int w, unsigned int h, unsigned char *screen, unsigned int x, unsigned int y);
void CGA_AnimLiftToDown(unsigned char *pixels, unsigned int pw, unsigned int w, unsigned int h, unsigned char *screen, unsigned int ofs);
void CGA_AnimLiftToLeft(unsigned int n, unsigned char *pixels, unsigned int pw, unsigned int w, unsigned int h, unsigned char *screen, unsigned int ofs);
void CGA_AnimLiftToRight(unsigned int n, unsigned char *pixels, unsigned int pw, unsigned int w, unsigned int h, unsigned char *screen, unsigned int ofs);
void CGA_AnimLiftToUp(byte *pixels, uint16 pw, uint16 w, uint16 h, byte *screen, uint16 x, uint16 y);
void CGA_AnimLiftToDown(byte *pixels, uint16 pw, uint16 w, uint16 h, byte *screen, uint16 ofs);
void CGA_AnimLiftToLeft(uint16 n, byte *pixels, uint16 pw, uint16 w, uint16 h, byte *screen, uint16 ofs);
void CGA_AnimLiftToRight(uint16 n, byte *pixels, uint16 pw, uint16 w, uint16 h, byte *screen, uint16 ofs);
void CGA_HideScreenBlockLiftToUp(unsigned int n, unsigned char *screen, unsigned char *source, unsigned int w, unsigned int h, unsigned char *target, unsigned int ofs);
void CGA_HideScreenBlockLiftToDown(unsigned int n, unsigned char *screen, unsigned char *source, unsigned int w, unsigned int h, unsigned char *target, unsigned int ofs);
void CGA_HideScreenBlockLiftToLeft(unsigned int n, unsigned char *screen, unsigned char *source, unsigned int w, unsigned int h, unsigned char *target, unsigned int ofs);
void CGA_HideScreenBlockLiftToRight(unsigned int n, unsigned char *screen, unsigned char *source, unsigned int w, unsigned int h, unsigned char *target, unsigned int ofs);
void CGA_HideScreenBlockLiftToUp(uint16 n, byte *screen, byte *source, uint16 w, uint16 h, byte *target, uint16 ofs);
void CGA_HideScreenBlockLiftToDown(uint16 n, byte *screen, byte *source, uint16 w, uint16 h, byte *target, uint16 ofs);
void CGA_HideScreenBlockLiftToLeft(uint16 n, byte *screen, byte *source, uint16 w, uint16 h, byte *target, uint16 ofs);
void CGA_HideScreenBlockLiftToRight(uint16 n, byte *screen, byte *source, uint16 w, uint16 h, byte *target, uint16 ofs);
void CGA_HideShatterFall(unsigned char *screen, unsigned char *source, unsigned int w, unsigned int h, unsigned char *target, unsigned int ofs);
void CGA_HideShatterFall(byte *screen, byte *source, uint16 w, uint16 h, byte *target, uint16 ofs);
void CGA_TraceLine(unsigned int sx, unsigned int ex, unsigned int sy, unsigned int ey, unsigned char *source, unsigned char *target);
void CGA_TraceLine(uint16 sx, uint16 ex, uint16 sy, uint16 ey, byte *source, byte *target);
} // End of namespace Chamber

View File

@ -76,7 +76,7 @@ Common::Error ChamberEngine::saveGameStream(Common::WriteStream *stream, bool is
void ChamberEngine::syncGameStream(Common::Serializer &s) {
// Use methods of Serializer to save/load fields
int dummy = 0;
int16 dummy = 0;
s.syncAsUint16LE(dummy);
}

View File

@ -37,10 +37,10 @@ namespace Chamber {
#include "common/pack-start.h"
typedef struct rect_t {
unsigned char sx;
unsigned char ex;
unsigned char sy;
unsigned char ey;
byte sx;
byte ex;
byte sy;
byte ey;
} rect_t;
#include "common/pack-end.h"

View File

@ -30,14 +30,14 @@
namespace Chamber {
unsigned char cursor_color = 0;
byte cursor_color = 0;
unsigned char *cursor_shape = NULL;
unsigned char cursor_anim_ticks;
unsigned char cursor_anim_phase;
byte *cursor_shape = NULL;
byte cursor_anim_ticks;
byte cursor_anim_phase;
/*cursors hotspot offsets*/
unsigned int cursor_shifts[CURSOR_MAX][2] = {
uint16 cursor_shifts[CURSOR_MAX][2] = {
{ 0, 0 },
{ 7, 7 },
{ 7, 7 },
@ -49,19 +49,19 @@ unsigned int cursor_shifts[CURSOR_MAX][2] = {
{ 7, 7 }
};
unsigned int cursor_x_shift;
unsigned char cursor_y_shift;
uint16 cursor_x_shift;
byte cursor_y_shift;
unsigned int cursor_x;
unsigned char cursor_y;
unsigned char cursor_backup[CURSOR_WIDTH_SPR * CURSOR_HEIGHT / CGA_BITS_PER_PIXEL];
unsigned int last_cursor_draw_ofs = 0;
unsigned int cursor_draw_ofs;
uint16 cursor_x;
byte cursor_y;
byte cursor_backup[CURSOR_WIDTH_SPR * CURSOR_HEIGHT / CGA_BITS_PER_PIXEL];
uint16 last_cursor_draw_ofs = 0;
uint16 cursor_draw_ofs;
/*
Select cursor shape and its hotspot
*/
void SelectCursor(unsigned int num) {
void SelectCursor(uint16 num) {
cursor_x_shift = cursor_shifts[num][0];
cursor_y_shift = cursor_shifts[num][1];
cursor_shape = souri_data + num * CURSOR_WIDTH * CURSOR_HEIGHT * 2 / CGA_PIXELS_PER_BYTE;
@ -74,13 +74,13 @@ void UpdateCursor(void) {
if (!cursor_shape)
return;
unsigned char *cursor, *sprite, *spr;
unsigned char cursor_bit_shift;
unsigned int x, y;
byte *cursor, *sprite, *spr;
byte cursor_bit_shift;
uint16 x, y;
x = cursor_x - cursor_x_shift;
if ((signed int)x < 0) x = 0;
if ((int16)x < 0) x = 0;
y = cursor_y - cursor_y_shift;
if ((signed int)y < 0) y = 0;
if ((int16)y < 0) y = 0;
cursor_bit_shift = (x % 4) * 2;
cursor_draw_ofs = CGA_CalcXY_p(x / 4, y);
@ -93,7 +93,7 @@ void UpdateCursor(void) {
spr = sprite;
for (y = 0; y < CURSOR_HEIGHT; y++) {
for (x = 0; x < CURSOR_WIDTH / 4; x++) {
unsigned char p = *cursor++;
byte p = *cursor++;
spr[x * 2] = p;
}
spr[x * 2] = 0;
@ -104,7 +104,7 @@ void UpdateCursor(void) {
spr = sprite + 1;
for (y = 0; y < CURSOR_HEIGHT; y++) {
for (x = 0; x < CURSOR_WIDTH / 4; x++) {
unsigned char p = *cursor++;
byte p = *cursor++;
spr[x * 2] = p;
}
spr[x * 2] = 0xFF;
@ -113,12 +113,12 @@ void UpdateCursor(void) {
} else {
spr = sprite;
for (y = 0; y < CURSOR_HEIGHT; y++) {
unsigned char i;
unsigned char p0 = *cursor++;
unsigned char p1 = *cursor++;
unsigned char p2 = *cursor++;
unsigned char p3 = *cursor++;
unsigned char p4 = 0;
byte i;
byte p0 = *cursor++;
byte p1 = *cursor++;
byte p2 = *cursor++;
byte p3 = *cursor++;
byte p4 = 0;
for (i = 0; i < cursor_bit_shift; i++) {
p4 = (p4 >> 1) | (p3 << 7);
p3 = (p3 >> 1) | (p2 << 7);
@ -137,12 +137,12 @@ void UpdateCursor(void) {
spr = sprite + 1;
for (y = 0; y < CURSOR_HEIGHT; y++) {
unsigned char i;
unsigned char p0 = *cursor++;
unsigned char p1 = *cursor++;
unsigned char p2 = *cursor++;
unsigned char p3 = *cursor++;
unsigned char p4 = 0xFF;
byte i;
byte p0 = *cursor++;
byte p1 = *cursor++;
byte p2 = *cursor++;
byte p3 = *cursor++;
byte p4 = 0xFF;
for (i = 0; i < cursor_bit_shift; i++) {
p4 = (p4 >> 1) | (p3 << 7);
p3 = (p3 >> 1) | (p2 << 7);
@ -163,7 +163,7 @@ void UpdateCursor(void) {
/*
Draw cursor sprite and backup background pixels
*/
void DrawCursor(unsigned char *target) {
void DrawCursor(byte *target) {
last_cursor_draw_ofs = cursor_draw_ofs;
CGA_BlitSpriteBak(sprit_load_buffer, CURSOR_WIDTH_SPR / 4, CURSOR_WIDTH_SPR / 4, CURSOR_HEIGHT, target, cursor_draw_ofs, cursor_backup, cursor_color);
}
@ -171,14 +171,14 @@ void DrawCursor(unsigned char *target) {
/*
Restore background pixels under cursor
*/
void UndrawCursor(unsigned char *target) {
void UndrawCursor(byte *target) {
CGA_Blit(cursor_backup, CURSOR_WIDTH_SPR / 4, CURSOR_WIDTH_SPR / 4, CURSOR_HEIGHT, target, last_cursor_draw_ofs);
}
/*
Restore pixels under cursor and update cursor sprite
*/
void UpdateUndrawCursor(unsigned char *target) {
void UpdateUndrawCursor(byte *target) {
/*TODO: does this call order makes any sense?*/
UpdateCursor();
UndrawCursor(target);

View File

@ -42,18 +42,18 @@ enum Cursors {
CURSOR_MAX
};
extern unsigned int cursor_x;
extern unsigned char cursor_y;
extern unsigned char cursor_color;
extern unsigned char *cursor_shape;
extern unsigned char cursor_anim_ticks;
extern unsigned char cursor_anim_phase;
extern uint16 cursor_x;
extern byte cursor_y;
extern byte cursor_color;
extern byte *cursor_shape;
extern byte cursor_anim_ticks;
extern byte cursor_anim_phase;
void SelectCursor(unsigned int num);
void SelectCursor(uint16 num);
void UpdateCursor(void);
void DrawCursor(unsigned char *target);
void UndrawCursor(unsigned char *target);
void UpdateUndrawCursor(unsigned char *target);
void DrawCursor(byte *target);
void UndrawCursor(byte *target);
void UpdateUndrawCursor(byte *target);
} // End of namespace Chamber

View File

@ -26,16 +26,16 @@ namespace Chamber {
static struct {
unsigned char codes[256];
unsigned char prefix[256];
unsigned char suffix[256];
unsigned char coddict[256];
unsigned char codlink[256];
unsigned char stackpos;
byte codes[256];
byte prefix[256];
byte suffix[256];
byte coddict[256];
byte codlink[256];
byte stackpos;
} DecompCtx;
unsigned char decode_string(unsigned char code, unsigned char prev_n, unsigned char *stack) {
unsigned char n;
byte decode_string(byte code, byte prev_n, byte *stack) {
byte n;
while ((n = DecompCtx.coddict[code]) != 0) {
while (n >= prev_n) {
n = DecompCtx.codlink[n];
@ -49,13 +49,13 @@ unsigned char decode_string(unsigned char code, unsigned char prev_n, unsigned c
return code;
}
unsigned long decompress(unsigned char *data, unsigned char *result) {
unsigned char dict_size, more;
unsigned int compsize;
unsigned int i;
unsigned char code, n, suffix;
unsigned char stack[256];
unsigned long decompsize = 0;
uint32 decompress(byte *data, byte *result) {
byte dict_size, more;
uint16 compsize;
uint16 i;
byte code, n, suffix;
byte stack[256];
uint32 decompsize = 0;
do {
dict_size = *data++;

View File

@ -24,7 +24,7 @@
#define CHAMBER_DECOMPR_H
namespace Chamber {
unsigned long decompress(unsigned char *data, unsigned char *result);
uint32 decompress(byte *data, byte *result);
} // End of namespace Chamber

View File

@ -33,13 +33,13 @@
namespace Chamber {
unsigned int cur_str_index;
unsigned int cur_dlg_index;
uint16 cur_str_index;
uint16 cur_dlg_index;
dirty_rect_t dirty_rects[MAX_DIRTY_RECT];
void AddDirtyRect(unsigned char kind, unsigned char x, unsigned char y, unsigned char w, unsigned char h, unsigned int offs) {
int i;
void AddDirtyRect(byte kind, byte x, byte y, byte w, byte h, uint16 offs) {
int16 i;
dirty_rect_t *r = dirty_rects;
for (i = 0; i < MAX_DIRTY_RECT; i++, r++) /*TODO: may go oob*/
if (r->kind == DirtyRectFree)
@ -53,7 +53,7 @@ void AddDirtyRect(unsigned char kind, unsigned char x, unsigned char y, unsigned
script_byte_vars.dirty_rect_kind = dirty_rects[0].kind;
}
void GetDirtyRect(int index, unsigned char *kind, unsigned char *x, unsigned char *y, unsigned char *w, unsigned char *h, unsigned int *offs, unsigned char newkind) {
void GetDirtyRect(int16 index, byte *kind, byte *x, byte *y, byte *w, byte *h, uint16 *offs, byte newkind) {
*kind = dirty_rects[index].kind;
*offs = dirty_rects[index].offs;
*w = dirty_rects[index].width;
@ -65,16 +65,16 @@ void GetDirtyRect(int index, unsigned char *kind, unsigned char *x, unsigned cha
script_byte_vars.dirty_rect_kind = dirty_rects[0].kind;
}
void GetDirtyRectAndFree(int index, unsigned char *kind, unsigned char *x, unsigned char *y, unsigned char *w, unsigned char *h, unsigned int *offs) {
void GetDirtyRectAndFree(int16 index, byte *kind, byte *x, byte *y, byte *w, byte *h, uint16 *offs) {
GetDirtyRect(index - 1, kind, x, y, w, h, offs, DirtyRectFree);
}
void GetDirtyRectAndSetSprite(int index, unsigned char *kind, unsigned char *x, unsigned char *y, unsigned char *w, unsigned char *h, unsigned int *offs) {
void GetDirtyRectAndSetSprite(int16 index, byte *kind, byte *x, byte *y, byte *w, byte *h, uint16 *offs) {
GetDirtyRect(index - 1, kind, x, y, w, h, offs, DirtyRectSprite);
}
int FindDirtyRectAndFree(unsigned char kind, unsigned char *x, unsigned char *y, unsigned char *w, unsigned char *h, unsigned int *offs) {
int i;
int16 FindDirtyRectAndFree(byte kind, byte *x, byte *y, byte *w, byte *h, uint16 *offs) {
int16 i;
for (i = 0; i < MAX_DIRTY_RECT; i++) {
if (dirty_rects[i].kind == kind) {
GetDirtyRect(i, &kind, x, y, w, h, offs, DirtyRectFree);
@ -85,10 +85,10 @@ int FindDirtyRectAndFree(unsigned char kind, unsigned char *x, unsigned char *y,
}
/*Restore screen data from back buffer as specified by dirty rects of kind*/
void PopDirtyRects(unsigned char kind) {
unsigned char x, y;
unsigned char width, height;
unsigned int offs;
void PopDirtyRects(byte kind) {
byte x, y;
byte width, height;
uint16 offs;
while (FindDirtyRectAndFree(kind, &x, &y, &width, &height, &offs)) {
CGA_CopyScreenBlock(backbuffer, width, height, frontbuffer, offs);
if (kind == DirtyRectBubble) {
@ -98,7 +98,7 @@ void PopDirtyRects(unsigned char kind) {
}
}
void DesciTextBox(unsigned int x, unsigned int y, unsigned int width, unsigned char *msg) {
void DesciTextBox(uint16 x, uint16 y, uint16 width, byte *msg) {
draw_x = x;
draw_y = y;
char_draw_max_width = width;
@ -107,9 +107,9 @@ void DesciTextBox(unsigned int x, unsigned int y, unsigned int width, unsigned c
}
/*Draw dialog bubble with text and spike*/
void DrawPersonBubble(unsigned char x, unsigned char y, unsigned char flags, unsigned char *msg) {
unsigned int ofs;
unsigned char w, h;
void DrawPersonBubble(byte x, byte y, byte flags, byte *msg) {
uint16 ofs;
byte w, h;
char_draw_max_width = flags & 0x1F;
char_xlat_table = chars_color_bonw;
@ -182,7 +182,7 @@ void PromptWait(void) {
cursor_anim_phase = 0;
do {
unsigned char ticks = script_byte_vars.timer_ticks;
byte ticks = script_byte_vars.timer_ticks;
if ((ticks % 8) == 0 && ticks != cursor_anim_ticks) {
cursor_anim_ticks = ticks;
ShowPromptAnim();
@ -203,9 +203,9 @@ void PromptWait(void) {
/*
Get string with index num from strings bank
*/
unsigned char *SeekToString(unsigned char *bank, unsigned int num) {
unsigned char len;
unsigned char *p = bank;
byte *SeekToString(byte *bank, uint16 num) {
byte len;
byte *p = bank;
cur_str_index = num;
@ -222,9 +222,9 @@ unsigned char *SeekToString(unsigned char *bank, unsigned int num) {
/*
Get string with index num from strings bank, with large string index support for scripts
*/
unsigned char *SeekToStringScr(unsigned char *bank, unsigned int num, unsigned char **ptr) {
unsigned char len;
unsigned char *p = bank;
byte *SeekToStringScr(byte *bank, uint16 num, byte **ptr) {
byte len;
byte *p = bank;
if (num < 4) {
num = (num << 8) | *(++(*ptr));

View File

@ -25,8 +25,8 @@
namespace Chamber {
extern unsigned int cur_str_index;
extern unsigned int cur_dlg_index;
extern uint16 cur_str_index;
extern uint16 cur_dlg_index;
enum DirtyRectKind {
DirtyRectFree = 0,
@ -36,12 +36,12 @@ enum DirtyRectKind {
};
typedef struct dirty_rect_t {
unsigned char kind;
unsigned int offs;
unsigned char height;
unsigned char width;
unsigned char y; /*for DirtyRectBubble this is spike offs*/
unsigned char x;
byte kind;
uint16 offs;
byte height;
byte width;
byte y; /*for DirtyRectBubble this is spike offs*/
byte x;
} dirty_rect_t;
#define MAX_DIRTY_RECT 10
@ -56,18 +56,18 @@ extern dirty_rect_t dirty_rects[];
#define SPIKE_BUBRIGHT 0xC0
#define SPIKE_BUBLEFT 0xE0
void AddDirtyRect(unsigned char kind, unsigned char x, unsigned char y, unsigned char w, unsigned char h, unsigned int offs);
void GetDirtyRectAndFree(int index, unsigned char *kind, unsigned char *x, unsigned char *y, unsigned char *w, unsigned char *h, unsigned int *offs);
void GetDirtyRectAndSetSprite(int index, unsigned char *kind, unsigned char *x, unsigned char *y, unsigned char *w, unsigned char *h, unsigned int *offs);
void AddDirtyRect(byte kind, byte x, byte y, byte w, byte h, uint16 offs);
void GetDirtyRectAndFree(int16 index, byte *kind, byte *x, byte *y, byte *w, byte *h, uint16 *offs);
void GetDirtyRectAndSetSprite(int16 index, byte *kind, byte *x, byte *y, byte *w, byte *h, uint16 *offs);
void PopDirtyRects(unsigned char kind);
void DrawPersonBubble(unsigned char x, unsigned char y, unsigned char flags, unsigned char *msg);
void DesciTextBox(unsigned int x, unsigned int y, unsigned int width, unsigned char *msg);
void PopDirtyRects(byte kind);
void DrawPersonBubble(byte x, byte y, byte flags, byte *msg);
void DesciTextBox(uint16 x, uint16 y, uint16 width, byte *msg);
void PromptWait(void);
unsigned char *SeekToString(unsigned char *bank, unsigned int num);
unsigned char *SeekToStringScr(unsigned char *bank, unsigned int num, unsigned char **ptr);
byte *SeekToString(byte *bank, uint16 num);
byte *SeekToStringScr(byte *bank, uint16 num, byte **ptr);
} // End of namespace Chamber

View File

@ -32,17 +32,17 @@
namespace Chamber {
unsigned char have_mouse;
unsigned char key_held;
volatile unsigned char key_direction;
volatile unsigned char key_code;
volatile unsigned char esc_pressed;
unsigned char buttons_repeat = 0;
unsigned char buttons;
unsigned char right_button;
unsigned char key_direction_old;
unsigned char accell_countdown;
unsigned int accelleration = 1;
byte have_mouse;
byte key_held;
volatile byte key_direction;
volatile byte key_code;
volatile byte esc_pressed;
byte buttons_repeat = 0;
byte buttons;
byte right_button;
byte key_direction_old;
byte accell_countdown;
uint16 accelleration = 1;
byte mouseButtons = 0;
byte ChamberEngine::readKeyboardChar() {
@ -72,7 +72,7 @@ byte ChamberEngine::readKeyboardChar() {
void ClearKeyboard(void) {
}
void SetInputButtons(unsigned char keys) {
void SetInputButtons(byte keys) {
if (keys && buttons_repeat) {
/*ignore buttons repeat*/
buttons = 0;
@ -86,14 +86,14 @@ void SetInputButtons(unsigned char keys) {
buttons_repeat = keys;
}
unsigned char PollMouse(void) {
byte PollMouse(void) {
PollInput();
return buttons;
}
unsigned char PollKeyboard(void) {
unsigned char direction = key_direction;
byte PollKeyboard(void) {
byte direction = key_direction;
if (direction && direction == key_direction_old) {
if (++accell_countdown == 10) {
accelleration++;
@ -112,7 +112,7 @@ unsigned char PollKeyboard(void) {
cursor_x = 304;
} else {
cursor_x -= accelleration;
if ((signed int)cursor_x < 0)
if ((int16)cursor_x < 0)
cursor_x = 0;
}
}
@ -124,7 +124,7 @@ unsigned char PollKeyboard(void) {
cursor_y = 184;
} else {
cursor_y -= accelleration;
if ((signed char)cursor_y < 0)
if ((int8)cursor_y < 0)
cursor_y = 0;
}
}
@ -189,7 +189,7 @@ void ProcessInput(void) {
void KeyboardIsr() {
warning("STUB: KeyboardIsr()");
#if 0
unsigned char scan, strobe;
byte scan, strobe;
scan = inportb(0x60);
/*consume scan from kbd. controller*/
strobe = inportb(0x61);

View File

@ -25,20 +25,20 @@
namespace Chamber {
extern unsigned char buttons;
extern unsigned char right_button;
extern byte buttons;
extern byte right_button;
extern unsigned char have_mouse;
extern byte have_mouse;
extern volatile unsigned char key_direction;
extern volatile unsigned char key_code;
extern unsigned char key_held;
extern volatile byte key_direction;
extern volatile byte key_code;
extern byte key_held;
void ClearKeyboard(void);
unsigned char PollMouse(void);
unsigned char PollKeyboard(void);
void SetInputButtons(unsigned char keys);
byte PollMouse(void);
byte PollKeyboard(void);
void SetInputButtons(byte keys);
void PollInput(void);
void ProcessInput(void);

View File

@ -35,15 +35,15 @@ namespace Chamber {
#define INVENTORY_SPOTS_MAX (4 * 4)
struct {
unsigned char sx;
unsigned char ex;
unsigned char sy;
unsigned char ey;
unsigned char name;
unsigned char unkn5;
unsigned short command;
unsigned char itemidx;
unsigned char unkn9;
byte sx;
byte ex;
byte sy;
byte ey;
byte name;
byte unkn5;
uint16 command;
byte itemidx;
byte unkn9;
} inventory_spots[] = {
{58, 62, 56, 72, 0, 0, 0, 0, 0},
{62, 66, 56, 72, 0, 0, 0, 0, 0},
@ -64,15 +64,15 @@ struct {
};
unsigned char inv_count = 0; /*TODO: pass this as param?*/
unsigned char inv_bgcolor = 0; /*TODO: pass this as param?*/
byte inv_count = 0; /*TODO: pass this as param?*/
byte inv_bgcolor = 0; /*TODO: pass this as param?*/
/*Filter items and put them inventory box, then draw it if non-empty*/
void DrawInventoryBox(unsigned short filtermask, unsigned short filtervalue) {
int i;
unsigned char count = 0;
void DrawInventoryBox(uint16 filtermask, uint16 filtervalue) {
int16 i;
byte count = 0;
for (i = 0; i < MAX_INV_ITEMS; i++) {
unsigned short flags = (inventory_items[i].flags2 << 8) | inventory_items[i].flags;
uint16 flags = (inventory_items[i].flags2 << 8) | inventory_items[i].flags;
if ((flags & filtermask) != filtervalue)
continue;
if (count == 0) {
@ -89,8 +89,8 @@ void DrawInventoryBox(unsigned short filtermask, unsigned short filtervalue) {
inv_count = count;
}
void CheckInventoryItemHover(unsigned char count) {
int i;
void CheckInventoryItemHover(byte count) {
int16 i;
for (i = 0; i < count; i++) {
if (IsCursorInRect((rect_t *)&inventory_spots[i])) {
the_command = inventory_spots[i].command;
@ -107,7 +107,7 @@ void CheckInventoryItemHover(unsigned char count) {
the_command = 0;
}
void OpenInventory(unsigned short filtermask, unsigned short filtervalue) {
void OpenInventory(uint16 filtermask, uint16 filtervalue) {
the_command = 0;
CGA_BackupImageReal(CGA_CalcXY_p(232 / 4, 56), 64 / 4, 64);
DrawInventoryBox(filtermask, filtervalue);

View File

@ -25,12 +25,12 @@
namespace Chamber {
extern unsigned char inv_count;
extern unsigned char inv_bgcolor;
extern byte inv_count;
extern byte inv_bgcolor;
void DrawInventoryBox(unsigned short filtermask, unsigned short filtervalue);
void DrawInventoryBox(uint16 filtermask, uint16 filtervalue);
void OpenInventory(unsigned short filtermask, unsigned short filtervalue);
void OpenInventory(uint16 filtermask, uint16 filtervalue);
} // End of namespace Chamber

View File

@ -44,7 +44,7 @@
namespace Chamber {
unsigned short cpu_speed_delay;
uint16 cpu_speed_delay;
/*
Prompt user to insert disk #2 to any drive
@ -53,7 +53,7 @@ void AskDisk2(void) {
DrawMessage(SeekToString(vepci_data, 179), frontbuffer);
}
void SaveToFile(char *filename, void *data, unsigned int size) {
void SaveToFile(char *filename, void *data, uint16 size) {
warning("STUB: SaveToFile(%s, data, %d)", filename, size);
#if 0
FILE *f = fopen(filename, "wb");
@ -62,16 +62,16 @@ void SaveToFile(char *filename, void *data, unsigned int size) {
#endif
}
int LoadSplash(const char *filename) {
int16 LoadSplash(const char *filename) {
if (!LoadFile(filename, scratch_mem1))
return 0;
decompress(scratch_mem1 + 8, backbuffer); /* skip compressed/decompressed size fields */
return 1;
}
unsigned int BenchmarkCpu(void) {
unsigned char t;
unsigned int cycles = 0;
uint16 BenchmarkCpu(void) {
byte t;
uint16 cycles = 0;
for (t = script_byte_vars.timer_ticks; t == script_byte_vars.timer_ticks;) ;
for (t = script_byte_vars.timer_ticks; t == script_byte_vars.timer_ticks;) cycles++;
return cycles;
@ -95,7 +95,7 @@ void TRAP() {
}
/* Main Game Loop */
void GameLoop(unsigned char *target) {
void GameLoop(byte *target) {
for (;;) {
#if 1
AnimateSpots(target);
@ -202,7 +202,7 @@ Common::Error ChamberEngine::run() {
SwitchToGraphicsMode();
unsigned char c;
byte c;
/* Load title screen */
if (!LoadSplash("PRES.BIN"))

View File

@ -32,8 +32,8 @@
namespace Chamber {
unsigned char act_menu_x = 0;
unsigned char act_menu_y = 0;
byte act_menu_x = 0;
byte act_menu_y = 0;
rect_t *act_dot_rects_cur;
rect_t *act_dot_rects_end;
@ -41,7 +41,7 @@ rect_t *act_dot_rects_end;
/*choice dots placement on actions menu*/
rect_t act_dot_rects[8 + 1];
struct {
unsigned char x, y;
byte x, y;
} act_dot_coords[8] = {
{ 2, 0},
{ 8, 32},
@ -54,7 +54,7 @@ struct {
};
/*Handle keyboard keys in actions menu (to cycle through choices with directional keys)*/
unsigned char PollKeyboardInActionsMenu(void) {
byte PollKeyboardInActionsMenu(void) {
if (!key_direction) {
key_held = 0;
return key_code;
@ -78,7 +78,7 @@ unsigned char PollKeyboardInActionsMenu(void) {
/*Handle player input in actions menu*/
void PollInputInActionsMenu(void) {
unsigned char keys;
byte keys;
if (have_mouse)
keys = PollMouse();
else
@ -87,11 +87,11 @@ void PollInputInActionsMenu(void) {
}
/*Draw actions menu and process its choices*/
void ActionsMenu(unsigned char **pinfo) {
unsigned char x, y;
unsigned char choices;
int i, choice, numchoices;
unsigned char *menurecs;
void ActionsMenu(byte **pinfo) {
byte x, y;
byte choices;
int16 i, choice, numchoices;
byte *menurecs;
last_object_hint = object_hint;
@ -184,7 +184,7 @@ void ActionsMenu(unsigned char **pinfo) {
}
/*TODO: maybe rename to SpotsLoop*/
void MenuLoop(unsigned char spotmask, unsigned char spotvalue) {
void MenuLoop(byte spotmask, byte spotvalue) {
ProcessInput();
do {
PollInput();
@ -214,7 +214,7 @@ rect_t menu_buttons_rects[] = {
};
void CheckMenuCommandHover(void) {
int i;
int16 i;
for (i = 0; i < 8; i++) {
if (IsCursorInRect(&menu_buttons_rects[i])) {
the_command = 0xA001 + i;
@ -242,7 +242,7 @@ rect_t psi_buttons_rects[] = {
void CheckPsiCommandHover(void) {
/*TODO: maybe merge it with CheckMenuCommandHover()*/
int i;
int16 i;
for (i = 0; i < 8; i++) {
if (IsCursorInRect(&psi_buttons_rects[i])) {
the_command = 0xA00A + i;

View File

@ -25,11 +25,11 @@
namespace Chamber {
extern unsigned char act_menu_x;
extern unsigned char act_menu_y;
extern byte act_menu_x;
extern byte act_menu_y;
void ActionsMenu(unsigned char **pinfo);
void MenuLoop(unsigned char spotmask, unsigned char spotvalue);
void ActionsMenu(byte **pinfo);
void MenuLoop(byte spotmask, byte spotvalue);
void ProcessMenu(void);
void CheckMenuCommandHover(void);

View File

@ -34,27 +34,27 @@
namespace Chamber {
extern unsigned short cpu_speed_delay;
extern uint16 cpu_speed_delay;
unsigned char *cur_image_pixels;
unsigned char cur_image_size_w;
unsigned char cur_image_size_h;
unsigned char cur_image_coords_x;
unsigned char cur_image_coords_y;
unsigned int cur_image_offs;
unsigned int cur_image_end;
unsigned char cur_image_idx;
unsigned char cur_image_anim1;
unsigned char cur_image_anim2;
unsigned int cur_frame_width;
byte *cur_image_pixels;
byte cur_image_size_w;
byte cur_image_size_h;
byte cur_image_coords_x;
byte cur_image_coords_y;
uint16 cur_image_offs;
uint16 cur_image_end;
byte cur_image_idx;
byte cur_image_anim1;
byte cur_image_anim2;
uint16 cur_frame_width;
typedef struct persframe_t {
unsigned char height;
unsigned char width;
unsigned char topbot; /*border and fill colors*/
unsigned char fill;
unsigned char left;
unsigned char right;
byte height;
byte width;
byte topbot; /*border and fill colors*/
byte fill;
byte left;
byte right;
} persframe_t;
persframe_t pers_frames[] = {
@ -69,8 +69,8 @@ persframe_t pers_frames[] = {
{27, 34, 0, 0, 0, 0}
};
void MakePortraitFrame(unsigned char index, unsigned char *target) {
unsigned int i;
void MakePortraitFrame(byte index, byte *target) {
uint16 i;
persframe_t *pframe = &pers_frames[index];
*target++ = pframe->height;
*target++ = pframe->width;
@ -90,11 +90,11 @@ void MakePortraitFrame(unsigned char index, unsigned char *target) {
/*
Superimpose source sprite data over target image data
*/
void MergeImageAndSpriteData(unsigned char *target, signed int pitch, unsigned char *source, unsigned int w, unsigned int h) {
unsigned int x;
void MergeImageAndSpriteData(byte *target, int16 pitch, byte *source, uint16 w, uint16 h) {
uint16 x;
while (h--) {
for (x = 0; x < w; x++) {
unsigned char m = *source++;
byte m = *source++;
*target &= m;
*target++ |= *source++;
}
@ -106,12 +106,12 @@ void MergeImageAndSpriteData(unsigned char *target, signed int pitch, unsigned c
/*
Superimpose horizontally-flipped source sprite data over target image data
*/
void MergeImageAndSpriteDataFlip(unsigned char *target, signed int pitch, unsigned char *source, unsigned int w, unsigned int h) {
unsigned int x;
void MergeImageAndSpriteDataFlip(byte *target, int16 pitch, byte *source, uint16 w, uint16 h) {
uint16 x;
target += w - 1;
while (h--) {
for (x = 0; x < w; x++) {
unsigned char m = cga_pixel_flip[*source++];
byte m = cga_pixel_flip[*source++];
*target &= m;
*target |= cga_pixel_flip[*source++];
target -= 1;
@ -124,13 +124,13 @@ void MergeImageAndSpriteDataFlip(unsigned char *target, signed int pitch, unsign
/*
Build portrait from multiple pers sprites
*/
unsigned char *LoadPortrait(unsigned char **pinfo, unsigned char *end) {
byte *LoadPortrait(byte **pinfo, byte *end) {
while (*pinfo != end) {
unsigned char index;
unsigned int flags;
signed int pitch;
unsigned char *buffer, *sprite;
unsigned char sprw, sprh;
byte index;
uint16 flags;
int16 pitch;
byte *buffer, *sprite;
byte sprw, sprh;
index = *((*pinfo)++);
flags = *((*pinfo)++);
@ -154,8 +154,8 @@ unsigned char *LoadPortrait(unsigned char **pinfo, unsigned char *end) {
return sprit_load_buffer + 2;
}
unsigned char *LoadPortraitWithFrame(unsigned char index) {
unsigned char *pinfo, *end;
byte *LoadPortraitWithFrame(byte index) {
byte *pinfo, *end;
pinfo = SeekToEntry(icone_data, index, &end);
MakePortraitFrame(*pinfo++, sprit_load_buffer + 2);
return LoadPortrait(&pinfo, end);
@ -165,12 +165,12 @@ unsigned char *LoadPortraitWithFrame(unsigned char index) {
#define STATIC_ANIMS_MAX 24
struct {
unsigned char index;
unsigned char image;
unsigned char x;
unsigned char y;
unsigned char anim1;
unsigned char anim2;
byte index;
byte image;
byte x;
byte y;
byte anim1;
byte anim2;
} static_anims[] = {
{ 24, 13, 35, 10, 4, 5},
{ 88, 42, 35, 10, 11, 12},
@ -198,9 +198,9 @@ struct {
{248, 117, 16, 2, 33, 33}
};
unsigned char SelectCurrentAnim(unsigned char *x, unsigned char *y, unsigned char *index) {
int i;
unsigned char aniidx = ((pers_t *)(script_vars[ScrPool8_CurrentPers]))->index & ~7;
byte SelectCurrentAnim(byte *x, byte *y, byte *index) {
int16 i;
byte aniidx = ((pers_t *)(script_vars[ScrPool8_CurrentPers]))->index & ~7;
for (i = 0; i < STATIC_ANIMS_MAX; i++) {
if (static_anims[i].index == aniidx) {
*x = static_anims[i].x;
@ -216,10 +216,10 @@ unsigned char SelectCurrentAnim(unsigned char *x, unsigned char *y, unsigned cha
}
void DrawBoxAroundSpot(void) {
unsigned char *buffer;
unsigned int w, h;
unsigned int ofs;
unsigned int x, y;
byte *buffer;
uint16 w, h;
uint16 ofs;
uint16 x, y;
if (*spot_sprite == 0)
return;
@ -228,8 +228,8 @@ void DrawBoxAroundSpot(void) {
buffer = *spot_sprite;
h = *(unsigned char *)(buffer + 0);
w = *(unsigned char *)(buffer + 1);
h = *(byte *)(buffer + 0);
w = *(byte *)(buffer + 1);
ofs = *(uint16 *)(buffer + 2);
/*decode ofs back to x:y*/
@ -251,10 +251,10 @@ void DrawBoxAroundSpot(void) {
/*Get on-screen image as specified by script to temp buffer and register it with dirty rect of kind 2
If rmb is pressed, draw it immediately and return 0
*/
int DrawPortrait(unsigned char **desc, unsigned char *x, unsigned char *y, unsigned char *width, unsigned char *height) {
unsigned char index;
unsigned char xx, yy;
unsigned char *image;
int16 DrawPortrait(byte **desc, byte *x, byte *y, byte *width, byte *height) {
byte index;
byte xx, yy;
byte *image;
index = *((*desc)++);
if (index == 0xFF) {
@ -292,7 +292,7 @@ int DrawPortrait(unsigned char **desc, unsigned char *x, unsigned char *y, unsig
return 1;
}
void BlinkWithSound(unsigned char color) {
void BlinkWithSound(byte color) {
CGA_ColorSelect(color);
PlaySound(144);
SelectPalette();
@ -306,9 +306,9 @@ void BlinkToWhite(void) {
BlinkWithSound(0x3F);
}
void AnimPortrait(unsigned char layer, unsigned char index, unsigned char delay) {
unsigned char *ani, *ani_end;
unsigned char temp;
void AnimPortrait(byte layer, byte index, byte delay) {
byte *ani, *ani_end;
byte temp;
SelectCurrentAnim(&temp, &temp, &temp);
@ -321,12 +321,12 @@ void AnimPortrait(unsigned char layer, unsigned char index, unsigned char delay)
cur_image_pixels = sprit_load_buffer + 2 + 2;
while (ani != ani_end) {
unsigned char kind;
unsigned char x, y;
unsigned char width, height;
unsigned int offs;
byte kind;
byte x, y;
byte width, height;
uint16 offs;
unsigned char portrait = *ani++;
byte portrait = *ani++;
LoadPortraitWithFrame(portrait - 1);
if (*ani == 0xFF) {
ani++;
@ -342,7 +342,7 @@ void AnimPortrait(unsigned char layer, unsigned char index, unsigned char delay)
else
BlinkToWhite();
} else {
int i;
int16 i;
while (delay--) for (i = 0; i < cpu_speed_delay; i++) ; /*TODO: FIXME weak delay*/
}
}

View File

@ -25,25 +25,25 @@
namespace Chamber {
extern unsigned char *cur_image_pixels;
extern unsigned char cur_image_size_w;
extern unsigned char cur_image_size_h;
extern unsigned char cur_image_coords_x;
extern unsigned char cur_image_coords_y;
extern unsigned int cur_image_offs;
extern unsigned int cur_image_end;
extern unsigned char cur_image_idx;
extern unsigned char cur_image_anim1;
extern unsigned char cur_image_anim2;
extern unsigned int cur_frame_width;
extern byte *cur_image_pixels;
extern byte cur_image_size_w;
extern byte cur_image_size_h;
extern byte cur_image_coords_x;
extern byte cur_image_coords_y;
extern uint16 cur_image_offs;
extern uint16 cur_image_end;
extern byte cur_image_idx;
extern byte cur_image_anim1;
extern byte cur_image_anim2;
extern uint16 cur_frame_width;
int DrawPortrait(unsigned char **desc, unsigned char *x, unsigned char *y, unsigned char *width, unsigned char *height);
void AnimPortrait(unsigned char layer, unsigned char index, unsigned char delay);
int16 DrawPortrait(byte **desc, byte *x, byte *y, byte *width, byte *height);
void AnimPortrait(byte layer, byte index, byte delay);
void DrawBoxAroundSpot(void);
void MergeImageAndSpriteData(unsigned char *target, signed int pitch, unsigned char *source, unsigned int w, unsigned int h);
void MergeImageAndSpriteDataFlip(unsigned char *target, signed int pitch, unsigned char *source, unsigned int w, unsigned int h);
void MergeImageAndSpriteData(byte *target, int16 pitch, byte *source, uint16 w, uint16 h);
void MergeImageAndSpriteDataFlip(byte *target, int16 pitch, byte *source, uint16 w, uint16 h);
void BlinkToRed(void);
void BlinkToWhite(void);

View File

@ -29,18 +29,18 @@
namespace Chamber {
unsigned char *cur_str_end;
byte *cur_str_end;
unsigned char draw_x;
unsigned char draw_y;
byte draw_x;
byte draw_y;
/*
Calculate number of string's character until whitespace
Return current word's characters count and the next word ptr
*/
unsigned char *CalcStringWordWidth(unsigned char *str, unsigned int *w) {
unsigned int ww = 0;
unsigned char c;
byte *CalcStringWordWidth(byte *str, uint16 *w) {
uint16 ww = 0;
byte c;
if ((*str & 0x3F) == 0) {
str++;
@ -69,9 +69,9 @@ unsigned char *CalcStringWordWidth(unsigned char *str, unsigned int *w) {
/*
Calculate number of text's words and max word width (in chars)
*/
void CalcStringSize(unsigned char *str, unsigned int *w, unsigned int *n) {
unsigned int ww = 0, nw = 0, lw;
unsigned char *s = str;
void CalcStringSize(byte *str, uint16 *w, uint16 *n) {
uint16 ww = 0, nw = 0, lw;
byte *s = str;
do {
s = CalcStringWordWidth(s, &lw);
if (lw > ww)
@ -86,9 +86,9 @@ void CalcStringSize(unsigned char *str, unsigned int *w, unsigned int *n) {
Calculate number of text's lines with respect to set max width
If a line is longer, wrap it to the next line
*/
unsigned int CalcTextLines(unsigned char *str) {
unsigned int lines = 1;
unsigned int w, left = char_draw_max_width;
uint16 CalcTextLines(byte *str) {
uint16 lines = 1;
uint16 w, left = char_draw_max_width;
while (str != cur_str_end) {
str = CalcStringWordWidth(str, &w);
if (left > w) {
@ -102,18 +102,18 @@ unsigned int CalcTextLines(unsigned char *str) {
}
/*; translate 1-bit raster (4 columns per byte) to 4 2-bit color pixels*/
unsigned char chars_color_bonw[] = {0xFF, 0xFC, 0xF3, 0xF0, 0xCF, 0xCC, 0xC3, 0xC0, 0x3F, 0x3C, 0x33, 0x30, 0x0F, 0x0C, 3, 0}; /*black on white*/
unsigned char chars_color_bonc[] = {0x55, 0x54, 0x51, 0x50, 0x45, 0x44, 0x41, 0x40, 0x15, 0x14, 0x11, 0x10, 5, 4, 1, 0}; /*black on cyan*/
unsigned char chars_color_wonb[] = { 0, 3, 0x0C, 0x0F, 0x30, 0x33, 0x3C, 0x3F, 0xC0, 0xC3, 0xCC, 0xCF, 0xF0, 0xF3, 0xFC, 0xFF}; /*white on black*/
unsigned char chars_color_wonc[] = {0x55, 0x57, 0x5D, 0x5F, 0x75, 0xF7, 0x7D, 0x7F, 0xD5, 0xD7, 0xDD, 0xDF, 0xF5, 0xF7, 0xFD, 0xFF}; /*white on cyan*/
byte chars_color_bonw[] = {0xFF, 0xFC, 0xF3, 0xF0, 0xCF, 0xCC, 0xC3, 0xC0, 0x3F, 0x3C, 0x33, 0x30, 0x0F, 0x0C, 3, 0}; /*black on white*/
byte chars_color_bonc[] = {0x55, 0x54, 0x51, 0x50, 0x45, 0x44, 0x41, 0x40, 0x15, 0x14, 0x11, 0x10, 5, 4, 1, 0}; /*black on cyan*/
byte chars_color_wonb[] = { 0, 3, 0x0C, 0x0F, 0x30, 0x33, 0x3C, 0x3F, 0xC0, 0xC3, 0xCC, 0xCF, 0xF0, 0xF3, 0xFC, 0xFF}; /*white on black*/
byte chars_color_wonc[] = {0x55, 0x57, 0x5D, 0x5F, 0x75, 0xF7, 0x7D, 0x7F, 0xD5, 0xD7, 0xDD, 0xDF, 0xF5, 0xF7, 0xFD, 0xFF}; /*white on cyan*/
void PrintStringPad(unsigned int w, unsigned char *target) {
void PrintStringPad(uint16 w, byte *target) {
while (w--)
CGA_PrintChar(0, target);
}
unsigned char *PrintWord(unsigned char *str, unsigned char *target) {
unsigned char c, f;
byte *PrintWord(byte *str, byte *target) {
byte c, f;
if ((*str & 0x3F) == 0)
goto skip_1st;
while (str != cur_str_end) {
@ -143,10 +143,10 @@ skip_1st:
return str;
}
unsigned char *PrintStringLine(unsigned char *str, unsigned int *left, unsigned char *target) {
unsigned int mw = char_draw_max_width;
byte *PrintStringLine(byte *str, uint16 *left, byte *target) {
uint16 mw = char_draw_max_width;
for (;;) {
unsigned int w;
uint16 w;
CalcStringWordWidth(str, &w);
if (mw < w)
break;
@ -161,8 +161,8 @@ unsigned char *PrintStringLine(unsigned char *str, unsigned int *left, unsigned
return str;
}
unsigned char *PrintStringPadded(unsigned char *str, unsigned char *target) {
unsigned int w, n;
byte *PrintStringPadded(byte *str, byte *target) {
uint16 w, n;
CalcStringSize(str, &w, &n);
if (w + 2 >= char_draw_max_width)
char_draw_max_width = w + 2;
@ -172,10 +172,10 @@ unsigned char *PrintStringPadded(unsigned char *str, unsigned char *target) {
return str;
}
void PrintStringCentered(unsigned char *str, unsigned char *target) {
unsigned char pad = 0;
unsigned int ww = 0, lw;
unsigned char *s = str;
void PrintStringCentered(byte *str, byte *target) {
byte pad = 0;
uint16 ww = 0, lw;
byte *s = str;
do {
s = CalcStringWordWidth(s, &lw);
ww += lw;
@ -190,8 +190,8 @@ void PrintStringCentered(unsigned char *str, unsigned char *target) {
PrintStringPadded(str, target);
}
void CGA_DrawTextBox(unsigned char *msg, unsigned char *target) {
unsigned int x, y, w, i;
void CGA_DrawTextBox(byte *msg, byte *target) {
uint16 x, y, w, i;
char_xlat_table = chars_color_bonc;
@ -226,9 +226,9 @@ void CGA_DrawTextBox(unsigned char *msg, unsigned char *target) {
CGA_DrawVLine(x + w, y, 1, 0, target); /*bottom right corner*/
}
void DrawMessage(unsigned char *msg, unsigned char *target) {
unsigned int x, y;
unsigned int w, h;
void DrawMessage(byte *msg, byte *target) {
uint16 x, y;
uint16 w, h;
CalcStringSize(msg, &w, &h);
char_draw_max_width = (h < 5) ? (w + 2) : 20;
char_draw_max_height = CalcTextLines(msg) * 6 + 7;
@ -254,9 +254,9 @@ void DrawMessage(unsigned char *msg, unsigned char *target) {
#if 1
void DebugMessage(char *msg, ...) {
int i;
unsigned char c;
unsigned char m[256];
int16 i;
byte c;
byte m[256];
va_list ap;
va_start(ap, msg);

View File

@ -25,22 +25,22 @@
namespace Chamber {
extern unsigned char *cur_str_end;
extern byte *cur_str_end;
extern unsigned char draw_x;
extern unsigned char draw_y;
extern byte draw_x;
extern byte draw_y;
extern unsigned char chars_color_bonw[];
extern unsigned char chars_color_bonc[];
extern unsigned char chars_color_wonb[];
extern unsigned char chars_color_wonc[];
extern byte chars_color_bonw[];
extern byte chars_color_bonc[];
extern byte chars_color_wonb[];
extern byte chars_color_wonc[];
void PrintStringCentered(unsigned char *str, unsigned char *target);
unsigned char *PrintStringPadded(unsigned char *str, unsigned char *target);
void PrintStringCentered(byte *str, byte *target);
byte *PrintStringPadded(byte *str, byte *target);
void DrawMessage(unsigned char *msg, unsigned char *target);
void DrawMessage(byte *msg, byte *target);
void CGA_DrawTextBox(unsigned char *msg, unsigned char *target);
void CGA_DrawTextBox(byte *msg, byte *target);
} // End of namespace Chamber

View File

@ -26,16 +26,16 @@
namespace Chamber {
unsigned char arpla_data[RES_ARPLA_MAX];
unsigned char aleat_data[RES_ALEAT_MAX];
unsigned char icone_data[RES_ICONE_MAX];
unsigned char souco_data[RES_SOUCO_MAX];
unsigned char souri_data[RES_SOURI_MAX];
unsigned char mursm_data[RES_MURSM_MAX];
unsigned char gauss_data[RES_GAUSS_MAX];
unsigned char lutin_data[RES_LUTIN_MAX];
unsigned char anima_data[RES_ANIMA_MAX];
unsigned char anico_data[RES_ANICO_MAX];
unsigned char zones_data[RES_ZONES_MAX];
byte arpla_data[RES_ARPLA_MAX];
byte aleat_data[RES_ALEAT_MAX];
byte icone_data[RES_ICONE_MAX];
byte souco_data[RES_SOUCO_MAX];
byte souri_data[RES_SOURI_MAX];
byte mursm_data[RES_MURSM_MAX];
byte gauss_data[RES_GAUSS_MAX];
byte lutin_data[RES_LUTIN_MAX];
byte anima_data[RES_ANIMA_MAX];
byte anico_data[RES_ANICO_MAX];
byte zones_data[RES_ZONES_MAX];
} // End of namespace Chamber

View File

@ -26,10 +26,10 @@
namespace Chamber {
unsigned char pers1_data[RES_PERS1_MAX];
unsigned char pers2_data[RES_PERS2_MAX];
byte pers1_data[RES_PERS1_MAX];
byte pers2_data[RES_PERS2_MAX];
unsigned char desci_data[RES_DESCI_MAX];
unsigned char diali_data[RES_DIALI_MAX];
byte desci_data[RES_DESCI_MAX];
byte diali_data[RES_DIALI_MAX];
} // End of namespace Chamber

View File

@ -25,6 +25,6 @@
namespace Chamber {
unsigned char puzzl_data[RES_PUZZL_MAX];
byte puzzl_data[RES_PUZZL_MAX];
} // End of namespace Chamber

View File

@ -25,6 +25,6 @@
namespace Chamber {
unsigned char sprit_data[RES_SPRIT_MAX];
byte sprit_data[RES_SPRIT_MAX];
} // End of namespace Chamber

View File

@ -25,6 +25,6 @@
namespace Chamber {
unsigned char templ_data[RES_TEMPL_MAX];
byte templ_data[RES_TEMPL_MAX];
} // End of namespace Chamber

View File

@ -26,7 +26,7 @@
namespace Chamber {
unsigned char vepci_data[RES_VEPCI_MAX];
unsigned char motsi_data[RES_MOTSI_MAX];
byte vepci_data[RES_VEPCI_MAX];
byte motsi_data[RES_MOTSI_MAX];
} // End of namespace Chamber

View File

@ -30,15 +30,15 @@
namespace Chamber {
extern void AskDisk2(void);
extern int LoadSplash(const char *filename);
extern int16 LoadSplash(const char *filename);
/*
Get bank entry
TODO: port SeekToString to this routine
*/
unsigned char *SeekToEntry(unsigned char *bank, unsigned int num, unsigned char **end) {
unsigned char len;
unsigned char *p = bank;
byte *SeekToEntry(byte *bank, uint16 num, byte **end) {
byte len;
byte *p = bank;
while (num--) {
len = *p;
@ -49,9 +49,9 @@ unsigned char *SeekToEntry(unsigned char *bank, unsigned int num, unsigned char
return p + 1;
}
unsigned char *SeekToEntryW(unsigned char *bank, unsigned int num, unsigned char **end) {
unsigned int len;
unsigned char *p = bank;
byte *SeekToEntryW(byte *bank, uint16 num, byte **end) {
uint16 len;
byte *p = bank;
while (num--) {
len = p[0] | (p[1] << 8);
@ -62,7 +62,7 @@ unsigned char *SeekToEntryW(unsigned char *bank, unsigned int num, unsigned char
return p + 2;
}
unsigned int LoadFile(const char *filename, unsigned char *buffer) {
uint16 LoadFile(const char *filename, byte *buffer) {
Common::File in;
in.open(filename);
@ -73,12 +73,12 @@ unsigned int LoadFile(const char *filename, unsigned char *buffer) {
return in.read(buffer, 0xFFFF0);
}
unsigned int SaveFile(char *filename, unsigned char *buffer, unsigned int size) {
uint16 SaveFile(char *filename, byte *buffer, uint16 size) {
warning("STUB: SaveFile(%s, buffer, %d)", filename, size);
return 0;
#if 0
int f;
int wlen;
int16 f;
int16 wlen;
f = open(filename, O_RDONLY | O_BINARY);
if (f == -1)
return 0;
@ -86,12 +86,12 @@ unsigned int SaveFile(char *filename, unsigned char *buffer, unsigned int size)
close(f);
if (wlen == -1)
return 0;
return (unsigned int)wlen;
return (uint16)wlen;
#endif
}
int LoadFilesList(ResEntry_t *entries) {
int i;
int16 LoadFilesList(ResEntry_t *entries) {
int16 i;
for (i = 0; entries[i].name[0] != '$'; i++) {
if (!LoadFile(entries[i].name, (byte *)entries[i].buffer))
return 0;
@ -100,17 +100,17 @@ int LoadFilesList(ResEntry_t *entries) {
}
unsigned char arpla_data[RES_ARPLA_MAX];
unsigned char aleat_data[RES_ALEAT_MAX];
unsigned char icone_data[RES_ICONE_MAX];
unsigned char souco_data[RES_SOUCO_MAX];
unsigned char souri_data[RES_SOURI_MAX];
unsigned char mursm_data[RES_MURSM_MAX];
unsigned char gauss_data[RES_GAUSS_MAX];
unsigned char lutin_data[RES_LUTIN_MAX];
unsigned char anima_data[RES_ANIMA_MAX];
unsigned char anico_data[RES_ANICO_MAX];
unsigned char zones_data[RES_ZONES_MAX];
byte arpla_data[RES_ARPLA_MAX];
byte aleat_data[RES_ALEAT_MAX];
byte icone_data[RES_ICONE_MAX];
byte souco_data[RES_SOUCO_MAX];
byte souri_data[RES_SOURI_MAX];
byte mursm_data[RES_MURSM_MAX];
byte gauss_data[RES_GAUSS_MAX];
byte lutin_data[RES_LUTIN_MAX];
byte anima_data[RES_ANIMA_MAX];
byte anico_data[RES_ANICO_MAX];
byte zones_data[RES_ZONES_MAX];
ResEntry_t res_static[] = {
{"ARPLA.BIN", arpla_data},
@ -133,7 +133,7 @@ ResEntry_t res_static[] = {
Load resident data files. Original game has all these data files embedded in the executable.
NB! Static data includes the font file, don't use any text print routines before it's loaded.
*/
int LoadStaticData() {
int16 LoadStaticData() {
return LoadFilesList(res_static);
}
@ -146,11 +146,11 @@ ResEntry_t res_texts[] = {
/*
Load strings data (commands/names)
*/
int LoadVepciData() {
int16 LoadVepciData() {
return LoadFilesList(res_texts);
}
int LoadFond(void) {
int16 LoadFond(void) {
return LoadSplash("FOND.BIN");
}
@ -160,7 +160,7 @@ ResEntry_t res_sprites[] = {
{"$", NULL}
};
int LoadSpritesData(void) {
int16 LoadSpritesData(void) {
return LoadFilesList(res_sprites);
}
@ -170,7 +170,7 @@ ResEntry_t res_person[] = {
{"$", NULL}
};
int LoadPersData(void) {
int16 LoadPersData(void) {
/*Originally it tries to load pers1 + pers2 as a single contiguos resource, if have enough memory*/
/*If memory is low, neccessary file is loaded on demand, according to requested bank resource index*/
/*Here we load both parts to their own memory buffers then select one in LoadPersSprit()*/
@ -185,7 +185,7 @@ ResEntry_t res_desci[] = {
/*
Load strings data (obj. descriptions)
*/
int LoadDesciData(void) {
int16 LoadDesciData(void) {
while (!LoadFilesList(res_desci))
AskDisk2();
return 1;
@ -199,7 +199,7 @@ ResEntry_t res_diali[] = {
/*
Load strings data (dialogs)
*/
int LoadDialiData(void) {
int16 LoadDialiData(void) {
while (!LoadFilesList(res_diali))
AskDisk2();
return 1;

View File

@ -53,52 +53,52 @@ typedef struct ResEntry_t {
#define RES_MOTSI_MAX 1082
#define RES_VEPCI_MAX 1548
extern unsigned char vepci_data[];
extern unsigned char motsi_data[];
extern byte vepci_data[];
extern byte motsi_data[];
extern unsigned char puzzl_data[];
extern unsigned char sprit_data[];
extern byte puzzl_data[];
extern byte sprit_data[];
extern unsigned char pers1_data[];
extern unsigned char pers2_data[];
extern byte pers1_data[];
extern byte pers2_data[];
extern unsigned char desci_data[];
extern unsigned char diali_data[];
extern byte desci_data[];
extern byte diali_data[];
extern unsigned char arpla_data[];
extern unsigned char aleat_data[];
extern unsigned char carpc_data[];
extern unsigned char icone_data[];
extern unsigned char souco_data[];
extern unsigned char souri_data[];
extern unsigned char templ_data[];
extern unsigned char mursm_data[];
extern unsigned char gauss_data[];
extern unsigned char lutin_data[];
extern unsigned char anima_data[];
extern unsigned char anico_data[];
extern unsigned char zones_data[];
extern byte arpla_data[];
extern byte aleat_data[];
extern byte carpc_data[];
extern byte icone_data[];
extern byte souco_data[];
extern byte souri_data[];
extern byte templ_data[];
extern byte mursm_data[];
extern byte gauss_data[];
extern byte lutin_data[];
extern byte anima_data[];
extern byte anico_data[];
extern byte zones_data[];
unsigned char *SeekToEntry(unsigned char *bank, unsigned int num, unsigned char **end);
unsigned char *SeekToEntryW(unsigned char *bank, unsigned int num, unsigned char **end);
byte *SeekToEntry(byte *bank, uint16 num, byte **end);
byte *SeekToEntryW(byte *bank, uint16 num, byte **end);
unsigned int LoadFile(const char *filename, unsigned char *buffer);
unsigned int SaveFile(char *filename, unsigned char *buffer, unsigned int size);
int LoadFilesList(ResEntry_t *entries);
uint16 LoadFile(const char *filename, byte *buffer);
uint16 SaveFile(char *filename, byte *buffer, uint16 size);
int16 LoadFilesList(ResEntry_t *entries);
int LoadStaticData(void);
int LoadFond(void);
int LoadSpritesData(void);
int LoadPersData(void);
int16 LoadStaticData(void);
int16 LoadFond(void);
int16 LoadSpritesData(void);
int16 LoadPersData(void);
extern ResEntry_t res_texts[];
int LoadVepciData(void);
int16 LoadVepciData(void);
extern ResEntry_t res_desci[];
int LoadDesciData(void);
int16 LoadDesciData(void);
extern ResEntry_t res_diali[];
int LoadDialiData(void);
int16 LoadDialiData(void);
} // End of namespace Chamber

View File

@ -37,26 +37,26 @@
namespace Chamber {
unsigned char scratch_mem1[8010];
unsigned char *scratch_mem2 = scratch_mem1 + 1500;
byte scratch_mem1[8010];
byte *scratch_mem2 = scratch_mem1 + 1500;
rect_t room_bounds_rect = {0, 0, 0, 0};
unsigned char last_object_hint = 0;
unsigned char object_hint = 0;
unsigned char command_hint = 0;
unsigned char zone_name = 0;
unsigned char room_hint_bar_width = 0;
unsigned char last_command_hint = 0;
unsigned char zone_spr_index = 0;
unsigned char zone_obj_count = 0;
byte last_object_hint = 0;
byte object_hint = 0;
byte command_hint = 0;
byte zone_name = 0;
byte room_hint_bar_width = 0;
byte last_command_hint = 0;
byte zone_spr_index = 0;
byte zone_obj_count = 0;
unsigned char cmd_hint_bar_width = 32;
unsigned char cmd_hint_bar_coords_x = 188 / 4;
unsigned char cmd_hint_bar_coords_y = 193;
unsigned char room_hint_bar_coords_x = 0;
unsigned char room_hint_bar_coords_y = 0;
byte cmd_hint_bar_width = 32;
byte cmd_hint_bar_coords_x = 188 / 4;
byte cmd_hint_bar_coords_y = 193;
byte room_hint_bar_coords_x = 0;
byte room_hint_bar_coords_y = 0;
unsigned char *sprites_list[MAX_SPRITES];
byte *sprites_list[MAX_SPRITES];
spot_t *zone_spots;
spot_t *zone_spots_end;
@ -67,27 +67,27 @@ turkeyanims_t *turkeyanims_ptr;
pers_t *pers_ptr;
spot_t *spot_ptr;
spot_t *found_spot;
unsigned char **spot_sprite;
byte **spot_sprite;
unsigned char zone_palette;
byte zone_palette;
unsigned int zsprite_draw_ofs;
unsigned char zsprite_w;
unsigned char zsprite_h;
uint16 zsprite_draw_ofs;
byte zsprite_w;
byte zsprite_h;
unsigned char *lutin_mem;
byte *lutin_mem;
unsigned short inv_update_time = 0;
uint16 inv_update_time = 0;
unsigned char in_de_profundis = 0; /*TODO: useless?*/
byte in_de_profundis = 0; /*TODO: useless?*/
unsigned short next_command3 = 0;
unsigned short next_ticks3 = 0;
unsigned short next_command4 = 0;
unsigned short next_ticks4 = 0;
unsigned short next_ticks2 = 0;
uint16 next_command3 = 0;
uint16 next_ticks3 = 0;
uint16 next_command4 = 0;
uint16 next_ticks4 = 0;
uint16 next_ticks2 = 0;
unsigned char zone_drawn;
byte zone_drawn;
#define VORTANIMS_MAX 25
@ -137,11 +137,11 @@ turkeyanims_t turkeyanim_list[TURKEYANIMS_MAX] = {
{61, {61, {{56, 141}}}, {62, {{56, 141}}}}
};
static const unsigned char cga_color_sels[] = {
static const byte cga_color_sels[] = {
0x30, 0x10, 0x30, 0x10, 0x30, 0x10, 0x10, 0x30, 0x10, 0x10, 0x10, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x10, 0x10, 0x10
};
void SelectSpecificPalette(unsigned char index) {
void SelectSpecificPalette(byte index) {
CGA_ColorSelect(cga_color_sels[index]);
}
@ -154,9 +154,9 @@ void SelectPalette(void) {
Blit sprites to backbuffer
*/
void BlitSpritesToBackBuffer(void) {
int i;
int16 i;
for (i = 0; i < MAX_SPRITES; i++) {
unsigned char *sprite = sprites_list[i];
byte *sprite = sprites_list[i];
CGA_RestoreImage(sprite, backbuffer);
}
}
@ -165,9 +165,9 @@ void BlitSpritesToBackBuffer(void) {
Copy data at sprite's rect from screen to backbuffer
*/
void RefreshSpritesData(void) {
int i;
int16 i;
for (i = 0; i < MAX_SPRITES; i++) {
unsigned char *sprite = sprites_list[i];
byte *sprite = sprites_list[i];
CGA_RefreshImageData(sprite);
}
}
@ -175,7 +175,7 @@ void RefreshSpritesData(void) {
/*
Check if packed x/y coordinates are in rect
*/
int IsInRect(unsigned char x, unsigned char y, rect_t *rect) {
int16 IsInRect(byte x, byte y, rect_t *rect) {
if (x < rect->sx) return 0;
if (x >= rect->ex) return 0;
if (y < rect->sy) return 0;
@ -186,7 +186,7 @@ int IsInRect(unsigned char x, unsigned char y, rect_t *rect) {
/*
Check if cursor is in rect
*/
int IsCursorInRect(rect_t *rect) {
int16 IsCursorInRect(rect_t *rect) {
return IsInRect(cursor_x / CGA_PIXELS_PER_BYTE, cursor_y, rect);
}
@ -194,7 +194,7 @@ int IsCursorInRect(rect_t *rect) {
Find person for a current spot
*/
void FindPerson(void) {
int i;
int16 i;
pers_t *pers = pers_list;
for (i = 0; i < PERS_MAX; i++, pers++) {
if ((pers->flags & 15) == script_byte_vars.cur_spot_idx) {
@ -209,8 +209,8 @@ void FindPerson(void) {
/*
Select a spot under cursor if its flags are matched given criteria
*/
void CheckHotspots(unsigned char m, unsigned char v) {
int i;
void CheckHotspots(byte m, byte v) {
int16 i;
spot_t *spot = zone_spots;
for (i = 0; spot != zone_spots_end; i++, spot++) {
if (IsCursorInRect((rect_t *)spot) && (spot->flags & SPOTFLG_80) && ((spot->flags & m) == v)) {
@ -234,7 +234,7 @@ void CheckHotspots(unsigned char m, unsigned char v) {
Select cursor shape for current spot
*/
void SelectSpotCursor(void) {
int curs = CURSOR_TARGET;
int16 curs = CURSOR_TARGET;
CheckHotspots(script_byte_vars.spot_m, script_byte_vars.spot_v);
if (cursor_color == 0xAA) {
curs = CURSOR_BODY;
@ -251,7 +251,7 @@ void SelectSpotCursor(void) {
#define kBgH 30
/*blocks draw order (clockwise inward spiral)*/
static const signed int background_draw_steps[] = {
static const int16 background_draw_steps[] = {
kBgW, kBgW, kBgW, kBgW, kBgW, kBgW, kBgW,
kBgH / 2 * CGA_BYTES_PER_LINE, kBgH / 2 * CGA_BYTES_PER_LINE, kBgH / 2 * CGA_BYTES_PER_LINE, kBgH / 2 * CGA_BYTES_PER_LINE, kBgH / 2 * CGA_BYTES_PER_LINE,
-kBgW, -kBgW, -kBgW, -kBgW, -kBgW, -kBgW, -kBgW, -kBgW,
@ -268,10 +268,10 @@ static const signed int background_draw_steps[] = {
/*
Draw main backgound pattern, in spiral-like order
*/
void DrawBackground(unsigned char *target, unsigned char vblank) {
int i;
unsigned int offs = (2 / 2) * CGA_BYTES_PER_LINE + 8; /*TODO: calcxy?*/
unsigned char *pixels = gauss_data + 0x3C8; /*TODO: better const*/
void DrawBackground(byte *target, byte vblank) {
int16 i;
uint16 offs = (2 / 2) * CGA_BYTES_PER_LINE + 8; /*TODO: calcxy?*/
byte *pixels = gauss_data + 0x3C8; /*TODO: better const*/
for (i = 0; i < 53; i++) {
/*draw a tile, alternating between two variants*/
CGA_Blit(pixels + (i & 1 ? 0 : kBgW * kBgH), kBgW, kBgW, kBgH, target, offs);
@ -291,7 +291,7 @@ void DrawBackground(unsigned char *target, unsigned char vblank) {
Load and initialize zone data
*/
void LoadZone(void) {
unsigned char *zptr, *zend;
byte *zptr, *zend;
zptr = SeekToEntry(zones_data, script_byte_vars.zone_index - 1, &zend);
script_byte_vars.zone_area = *zptr++;
@ -300,12 +300,12 @@ void LoadZone(void) {
zone_palette = script_byte_vars.palette_index = *zptr++;
zone_obj_count = *zptr++;
if (zone_obj_count != 0) {
unsigned int i;
unsigned short *zcmds = script_word_vars.zone_obj_cmds;
uint16 i;
uint16 *zcmds = script_word_vars.zone_obj_cmds;
memset(script_word_vars.zone_obj_cmds, 0, 15 * 5); /*half of list: TODO: bug? wipe whole list?*/
for (i = 0; i < zone_obj_count; i++) {
/*load spot's reactions*/
unsigned short flags = (*zptr++) << 8;
uint16 flags = (*zptr++) << 8;
flags |= *zptr++;
if (flags & 0x10) {
zcmds[0] = zptr[0] | (zptr[1] << 8); /*TODO: big-endian, but loaded here as le and converted later*/
@ -368,7 +368,7 @@ void ResetZone(void) {
/*
Load puzzl sprite to buffer, return next free buffer ptr
*/
unsigned char *LoadPuzzl(unsigned char index, unsigned char *buffer) {
byte *LoadPuzzl(byte index, byte *buffer) {
if (script_byte_vars.palette_index == 14)
return LoadSprite(index, puzzl_data + 4, buffer, 1);
else
@ -378,8 +378,8 @@ unsigned char *LoadPuzzl(unsigned char index, unsigned char *buffer) {
/*
Load puzzl sprite to scratch buffer, return sprite ptr
*/
unsigned char *LoadPuzzlToScratch(unsigned char index) {
unsigned char *buffer = scratch_mem2;
byte *LoadPuzzlToScratch(byte index) {
byte *buffer = scratch_mem2;
LoadPuzzl(index, buffer);
return buffer;
}
@ -387,29 +387,29 @@ unsigned char *LoadPuzzlToScratch(unsigned char index) {
#define kNumDoorSprites 3
typedef struct doorinfo_t {
unsigned char flipped;
byte flipped;
struct {
unsigned char width;
unsigned char height;
unsigned char *pixels;
unsigned int offs;
byte width;
byte height;
byte *pixels;
uint16 offs;
} layer[kNumDoorSprites];
unsigned char width;
unsigned char height;
unsigned int offs;
unsigned char sprites[1]; /*variable size*/
byte width;
byte height;
uint16 offs;
byte sprites[1]; /*variable size*/
} doorinfo_t;
unsigned char *doors_list[MAX_DOORS];
unsigned char arpla_y_step;
byte *doors_list[MAX_DOORS];
byte arpla_y_step;
/*
Fill in sliding door animation information
*/
void InitRoomDoorInfo(unsigned char index) {
int i;
unsigned char *aptr;
unsigned char *sprbuf;
void InitRoomDoorInfo(byte index) {
int16 i;
byte *aptr;
byte *sprbuf;
doorinfo_t *info = (doorinfo_t *)scratch_mem2;
rect_t bounds = {0xFF, 0, 0xFF, 0};
@ -417,8 +417,8 @@ void InitRoomDoorInfo(unsigned char index) {
info->flipped = (aptr[1] & 0x80) ? ~0 : 0;
sprbuf = info->sprites;
for (i = 0; i < kNumDoorSprites; i++) {
unsigned char x, y, w, h, ox;
unsigned char *sprite = sprbuf;
byte x, y, w, h, ox;
byte *sprite = sprbuf;
sprbuf = LoadPuzzl(aptr[0], sprbuf);
x = aptr[1];
@ -462,13 +462,13 @@ void InitRoomDoorInfo(unsigned char index) {
Draw sliding door
*/
void DrawRoomDoor(void) {
int i;
int16 i;
doorinfo_t *info = (doorinfo_t *)scratch_mem2;
for (i = 0; i < kNumDoorSprites; i++) {
unsigned char w = info->layer[i].width;
unsigned char h = info->layer[i].height;
unsigned char *pixels = info->layer[i].pixels;
unsigned int offs = info->layer[i].offs;
byte w = info->layer[i].width;
byte h = info->layer[i].height;
byte *pixels = info->layer[i].pixels;
uint16 offs = info->layer[i].offs;
if (!info->flipped)
CGA_BlitSprite(pixels, w * 2, w, h, backbuffer, offs);
@ -483,10 +483,10 @@ void DrawRoomDoor(void) {
/*
Animate sliding door open
*/
void AnimRoomDoorOpen(unsigned char index) {
int i;
void AnimRoomDoorOpen(byte index) {
int16 i;
unsigned char oldheight;
byte oldheight;
doorinfo_t *info = (doorinfo_t *)scratch_mem2;
@ -508,11 +508,11 @@ void AnimRoomDoorOpen(unsigned char index) {
/*
Animate sliding door close
*/
void AnimRoomDoorClose(unsigned char index) {
int i;
void AnimRoomDoorClose(byte index) {
int16 i;
unsigned char oldheight;
unsigned char *oldpixels;
byte oldheight;
byte *oldpixels;
doorinfo_t *info = (doorinfo_t *)scratch_mem2;
InitRoomDoorInfo(index);
@ -539,10 +539,10 @@ void AnimRoomDoorClose(unsigned char index) {
}
/*Maybe FindRoomDoor?*/
unsigned char FindInitialSpot(void) {
byte FindInitialSpot(void) {
spot_t *spot;
unsigned char index;
unsigned char flags = script_byte_vars.byte_179B8;
byte index;
byte flags = script_byte_vars.byte_179B8;
if (flags == 0)
return 0;
flags |= SPOTFLG_80 | SPOTFLG_8;
@ -556,9 +556,9 @@ unsigned char FindInitialSpot(void) {
/*
Find first spot index that matches given flags
*/
unsigned char FindSpotByFlags(unsigned char mask, unsigned char value) {
byte FindSpotByFlags(byte mask, byte value) {
spot_t *spot;
unsigned char index;
byte index;
for (index = 1, spot = zone_spots; spot != zone_spots_end; spot++, index++) {
if ((spot->flags & mask) == value)
return index;
@ -570,9 +570,9 @@ unsigned char FindSpotByFlags(unsigned char mask, unsigned char value) {
Find person's spot
TODO: rename me
*/
unsigned char FindAndSelectSpot(unsigned char offset) {
byte FindAndSelectSpot(byte offset) {
/*TODO: replace offset arg with index?*/
unsigned char index = offset / 5; /* / sizeof(pers_t) */
byte index = offset / 5; /* / sizeof(pers_t) */
script_vars[ScrPool8_CurrentPers] = &pers_list[index];
@ -590,7 +590,7 @@ unsigned char FindAndSelectSpot(unsigned char offset) {
Play animation at the selected spot or specified coordinates
*/
void AnimateSpot(const animdesc_t *info) {
unsigned char *sprite = *spot_sprite;
byte *sprite = *spot_sprite;
CGA_RestoreImage(sprite, backbuffer);
if (info->index & ANIMFLG_USESPOT) {
/*at selected spot*/
@ -607,8 +607,8 @@ void AnimateSpot(const animdesc_t *info) {
}
typedef struct lutinanim_t {
unsigned char phase;
unsigned char sprites[8];
byte phase;
byte sprites[8];
} lutinanim_t;
lutinanim_t lutins_table[] = {
@ -647,8 +647,8 @@ lutinanim_t lutins_table[] = {
{0, { 0, 0, 0, 0, 0, 0, 0, 0} }
};
void UpdateZoneSpot(unsigned char index) {
unsigned char oldspot;
void UpdateZoneSpot(byte index) {
byte oldspot;
static const animdesc_t anim57 = {ANIMFLG_USESPOT | 57};
static const animdesc_t anim58 = {ANIMFLG_USESPOT | 58};
@ -673,8 +673,8 @@ void UpdateZoneSpot(unsigned char index) {
script_byte_vars.cur_spot_idx = oldspot;
}
void ChangeZone(unsigned char index) {
unsigned char spridx = 0;
void ChangeZone(byte index) {
byte spridx = 0;
script_byte_vars.prev_zone_index = script_byte_vars.zone_index;
script_byte_vars.zone_index = index;
@ -687,7 +687,7 @@ void ChangeZone(unsigned char index) {
spridx = 222;
if (spridx != 0) {
int i;
int16 i;
lutinanim_t *la = &lutins_table[31];
for (i = 0; i < 8; i++)
la->sprites[i] = spridx;
@ -699,8 +699,8 @@ void ChangeZone(unsigned char index) {
void DrawZoneObjs(void) {
int i;
unsigned char index, pidx;
int16 i;
byte index, pidx;
spot_t *spot;
for (spot = zone_spots; spot != zone_spots_end; spot++) {
@ -733,10 +733,10 @@ void DrawZoneObjs(void) {
/*
Draw room's static object to backbuffer
*/
void DrawRoomStaticObject(unsigned char *aptr, unsigned char *rx, unsigned char *ry, unsigned char *rw, unsigned char *rh) {
unsigned char x, y, w, h;
signed int pitch;
unsigned char *sprite = LoadPuzzlToScratch(aptr[0]);
void DrawRoomStaticObject(byte *aptr, byte *rx, byte *ry, byte *rw, byte *rh) {
byte x, y, w, h;
int16 pitch;
byte *sprite = LoadPuzzlToScratch(aptr[0]);
x = aptr[1];
y = aptr[2];
w = sprite[0];
@ -784,10 +784,10 @@ Initialize room bounds rect to room's dimensions
Draw room's name box and text
*/
void DrawRoomStatics(void) {
unsigned char *aptr, *aend;
unsigned char doorcount = 0;
unsigned char x, y, w, h;
unsigned int xx, ww;
byte *aptr, *aend;
byte doorcount = 0;
byte x, y, w, h;
uint16 xx, ww;
DrawBackground(backbuffer, 0);
arpla_y_step = script_byte_vars.byte_179E1;
@ -800,7 +800,7 @@ void DrawRoomStatics(void) {
/*load and draw room decor*/
for (; aptr != aend; aptr += 3) {
unsigned char index = *aptr;
byte index = *aptr;
/*a door ?*/
if (index >= 50 && index < 61) {
doors_list[doorcount++] = aptr - 3; /*TODO: check for list overflow?*/
@ -851,9 +851,9 @@ void DrawRoomStatics(void) {
/*
Redraw all room's static objects (decorations) to backbuffer
*/
void RedrawRoomStatics(unsigned char index, unsigned char y_step) {
unsigned char *aptr, *aend;
unsigned char x, y, w, h;
void RedrawRoomStatics(byte index, byte y_step) {
byte *aptr, *aend;
byte x, y, w, h;
arpla_y_step = y_step;
aptr = SeekToEntry(arpla_data, index - 1, &aend);
@ -867,8 +867,8 @@ void RedrawRoomStatics(unsigned char index, unsigned char y_step) {
Draw "some item in the room" icon
*/
void DrawRoomItemsIndicator(void) {
unsigned char spridx = 172;
int i;
byte spridx = 172;
int16 i;
for (i = 0; i < MAX_INV_ITEMS; i++) {
if (inventory_items[i].flags == ITEMFLG_40
&& inventory_items[i].flags2 == script_byte_vars.zone_area) {
@ -890,7 +890,7 @@ void DrawZoneSpots(void) {
static const animdesc_t anim59 = {ANIMFLG_USESPOT | 59};
static const animdesc_t anim60 = {ANIMFLG_USESPOT | 60};
unsigned char oldspot = script_byte_vars.cur_spot_idx;
byte oldspot = script_byte_vars.cur_spot_idx;
if (!script_byte_vars.need_draw_spots)
return;
@ -955,7 +955,7 @@ void DrawObjectHint(void) {
/*
Copy object hint from backbuffer to screen
*/
void ShowObjectHint(unsigned char *target) {
void ShowObjectHint(byte *target) {
if (script_byte_vars.zone_index == 135)
return;
CGA_CopyScreenBlock(backbuffer, room_hint_bar_width + 2, 9, target, CGA_CalcXY_p(room_hint_bar_coords_x - 1, room_hint_bar_coords_y - 2));
@ -975,19 +975,19 @@ void DrawCommandHint(void) {
/*
Copy command hint from backbuffer to screen
*/
void ShowCommandHint(unsigned char *target) {
void ShowCommandHint(byte *target) {
CGA_CopyScreenBlock(backbuffer, cmd_hint_bar_width + 2, 9, target, CGA_CalcXY_p(cmd_hint_bar_coords_x - 1, cmd_hint_bar_coords_y - 2));
}
void LoadLutinSprite(unsigned int lutidx) {
unsigned char spridx;
unsigned int flags;
unsigned char *lutin_entry, *lutin_entry_end;
unsigned char *buffer;
unsigned char *sprite;
unsigned char sprw, sprh;
void LoadLutinSprite(uint16 lutidx) {
byte spridx;
uint16 flags;
byte *lutin_entry, *lutin_entry_end;
byte *buffer;
byte *sprite;
byte sprw, sprh;
unsigned int i;
uint16 i;
buffer = lutin_mem;
@ -1021,7 +1021,7 @@ void LoadLutinSprite(unsigned int lutidx) {
/*
Draw specific room's person idle sprite
*/
void DrawCharacterSprite(unsigned char spridx, unsigned char x, unsigned char y, unsigned char *target) {
void DrawCharacterSprite(byte spridx, byte x, byte y, byte *target) {
lutin_mem = scratch_mem2;
LoadLutinSprite(spridx);
@ -1033,9 +1033,9 @@ void DrawCharacterSprite(unsigned char spridx, unsigned char x, unsigned char y,
Draw room's person idle sprite and advance sprite's animation
Return true if a sprite was drawn
*/
char DrawZoneAniSprite(rect_t *rect, unsigned int index, unsigned char *target) {
int i;
unsigned char spridx;
char DrawZoneAniSprite(rect_t *rect, uint16 index, byte *target) {
int16 i;
byte spridx;
pers_t *pers = pers_list;
for (i = 0; i < PERS_MAX; i++, pers++) {
if ((pers->flags & 15) == index) {
@ -1067,9 +1067,9 @@ void SetDelay5(void) {
Aspirants AI
*/
void PrepareCommand1(void) {
unsigned char index;
unsigned char oldr, newr;
unsigned char flags;
byte index;
byte oldr, newr;
byte flags;
if (script_byte_vars.zone_area == 55) {
pers_list[1].area = 55;
@ -1172,7 +1172,7 @@ void PrepareCommand3(void) {
for (spot = zone_spots; spot != zone_spots_end; spot++) {
if ((spot->flags & ~SPOTFLG_80) == (SPOTFLG_40 | SPOTFLG_10)) {
int i;
int16 i;
for (i = 0; i < VORTANIMS_MAX; i++) {
if (vortsanim_list[i].room == script_byte_vars.zone_room) {
vortanims_ptr = &vortsanim_list[i];
@ -1223,7 +1223,7 @@ void PrepareCommand4(void) {
for (spot = zone_spots; spot != zone_spots_end; spot++) {
if ((spot->flags & ~SPOTFLG_80) == (SPOTFLG_40 | SPOTFLG_10 | SPOTFLG_1)) {
int i;
int16 i;
for (i = 0; i < TURKEYANIMS_MAX; i++) {
if (turkeyanim_list[i].room == script_byte_vars.zone_room) {
@ -1256,8 +1256,8 @@ void PrepareCommand4(void) {
/*
Load puzzl sprite to scratch and init draw params
*/
unsigned int GetPuzzlSprite(unsigned char index, unsigned char x, unsigned char y, unsigned int *w, unsigned int *h, unsigned int *ofs) {
unsigned char *spr = LoadPuzzlToScratch(index);
uint16 GetPuzzlSprite(byte index, byte x, byte y, uint16 *w, uint16 *h, uint16 *ofs) {
byte *spr = LoadPuzzlToScratch(index);
*w = spr[0];
*h = spr[1];
*ofs = CGA_CalcXY_p(x, y);
@ -1290,10 +1290,10 @@ void RestoreScreenOfSpecialRoom(void) {
}
}
unsigned char byte_17A1C = 0;
byte byte_17A1C = 0;
void SetAnim127Sprite(unsigned char flags, unsigned char spridx) {
unsigned char *lutin_entry, *lutin_entry_end;
void SetAnim127Sprite(byte flags, byte spridx) {
byte *lutin_entry, *lutin_entry_end;
lutin_entry = SeekToEntry(lutin_data, 127, &lutin_entry_end);
lutin_entry[2] = spridx;
switch (spridx) {
@ -1308,7 +1308,7 @@ void SetAnim127Sprite(unsigned char flags, unsigned char spridx) {
}
}
void BounceCurrentItem(unsigned char flags, unsigned char y) {
void BounceCurrentItem(byte flags, byte y) {
item_t *item = (item_t *)(script_vars[ScrPool3_CurrentItem]);
SetAnim127Sprite(flags, item->sprite);
@ -1321,15 +1321,15 @@ void BounceCurrentItem(unsigned char flags, unsigned char y) {
}
unsigned char *LoadMursmSprite(unsigned char index) {
unsigned char *pinfo, *end;
byte *LoadMursmSprite(byte index) {
byte *pinfo, *end;
pinfo = SeekToEntry(mursm_data, index, &end);
while (pinfo != end) {
unsigned int flags;
signed int pitch;
unsigned char *buffer, *sprite;
unsigned char sprw, sprh;
uint16 flags;
int16 pitch;
byte *buffer, *sprite;
byte sprw, sprh;
index = *pinfo++;
flags = *pinfo++;
@ -1358,8 +1358,8 @@ unsigned char *LoadMursmSprite(unsigned char index) {
thewalldoor_t the_wall_doors[2];
void TheWallOpenRightDoor(unsigned char x, unsigned char y, unsigned char width, unsigned char height, unsigned char limit) {
unsigned int offs = CGA_CalcXY_p(x + width - 2, y);
void TheWallOpenRightDoor(byte x, byte y, byte width, byte height, byte limit) {
uint16 offs = CGA_CalcXY_p(x + width - 2, y);
while (--width) {
CGA_HideScreenBlockLiftToRight(1, CGA_SCREENBUFFER, backbuffer, width, height, CGA_SCREENBUFFER, offs);
@ -1381,8 +1381,8 @@ void TheWallOpenRightDoor(unsigned char x, unsigned char y, unsigned char width,
}
}
void TheWallOpenLeftDoor(unsigned char x, unsigned char y, unsigned char width, unsigned char height, unsigned char limit) {
unsigned int offs = CGA_CalcXY_p(x + 1, y);
void TheWallOpenLeftDoor(byte x, byte y, byte width, byte height, byte limit) {
uint16 offs = CGA_CalcXY_p(x + 1, y);
while (--width) {
CGA_HideScreenBlockLiftToLeft(1, CGA_SCREENBUFFER, backbuffer, width, height, CGA_SCREENBUFFER, offs);
@ -1437,7 +1437,7 @@ Animate The Wall doors
Phase 1: Opened -> Half closed
*/
void TheWallPhase1_DoorClose1(void) {
unsigned char *spr;
byte *spr;
script_byte_vars.zone_index = (script_byte_vars.zone_index == 24) ? 9 : 102;
LoadZone();
@ -1459,7 +1459,7 @@ Animate The Wall doors
Phase 2: Half closed -> Fully closed
*/
void TheWallPhase2_DoorClose2(void) {
unsigned char *spr;
byte *spr;
script_byte_vars.zone_index = (script_byte_vars.zone_index == 9) ? 95 : 103;
LoadZone();
@ -1497,11 +1497,11 @@ void DrawTheWallDoors(void) {
/*
Superimpose source sprite data over target sprite data
*/
void MergeSpritesData(unsigned char *target, unsigned int pitch, unsigned char *source, unsigned int w, unsigned int h) {
unsigned int x;
void MergeSpritesData(byte *target, uint16 pitch, byte *source, uint16 w, uint16 h) {
uint16 x;
while (h--) {
for (x = 0; x < w; x++) {
unsigned char m = *source++;
byte m = *source++;
*target++ &= m;
*target &= m;
*target++ |= *source++;
@ -1514,12 +1514,12 @@ void MergeSpritesData(unsigned char *target, unsigned int pitch, unsigned char *
/*
Superimpose horizontally-flipped source sprite data over target sprite data
*/
void MergeSpritesDataFlip(unsigned char *target, unsigned int pitch, unsigned char *source, unsigned int w, unsigned int h) {
unsigned int x;
void MergeSpritesDataFlip(byte *target, uint16 pitch, byte *source, uint16 w, uint16 h) {
uint16 x;
target += w * 2 - 2;
while (h--) {
for (x = 0; x < w; x++) {
unsigned char m = cga_pixel_flip[*source++];
byte m = cga_pixel_flip[*source++];
*target++ &= m;
*target &= m;
*target |= cga_pixel_flip[*source++];
@ -1534,7 +1534,7 @@ void MergeSpritesDataFlip(unsigned char *target, unsigned int pitch, unsigned ch
Save image at the rect to buffer
Return current and next free buffer ptr
*/
unsigned char *BackupSpotImage(spot_t *spot, unsigned char **spotback, unsigned char *buffer) {
byte *BackupSpotImage(spot_t *spot, byte **spotback, byte *buffer) {
*spotback = buffer;
buffer = CGA_BackupImage(backbuffer, CGA_CalcXY_p(spot->sx, spot->sy), spot->ex - spot->sx, spot->ey - spot->sy, buffer);
return buffer;
@ -1545,8 +1545,8 @@ Save zone spot images to sprites list
*/
void BackupSpotsImages(void) {
spot_t *spot = zone_spots;
unsigned char *buffer = scratch_mem1;
int i;
byte *buffer = scratch_mem1;
int16 i;
for (i = 0; i < MAX_SPRITES; i++)
sprites_list[i] = 0;
for (i = 0; spot != zone_spots_end; spot++, i++) { /*TODO: maybe don't advance it if spot is skipped?*/
@ -1559,9 +1559,9 @@ void BackupSpotsImages(void) {
Animate all room's persons, one per call
TODO: rename me
*/
void DrawSpots(unsigned char *target) {
void DrawSpots(byte *target) {
spot_t *spot = zone_spots_cur;
unsigned char spridx = zone_spr_index;
byte spridx = zone_spr_index;
if (spot == zone_spots_end) {
spot = zone_spots;
spridx = 0;
@ -1594,7 +1594,7 @@ void DrawSpots(unsigned char *target) {
Animate room's persons at fixed rate
TODO: rename me
*/
void AnimateSpots(unsigned char *target) {
void AnimateSpots(byte *target) {
if (script_byte_vars.timer_ticks % 32 == 31)
DrawSpots(target);
}
@ -1602,7 +1602,7 @@ void AnimateSpots(unsigned char *target) {
/*
Draw cursor and hints text on screen
*/
void DrawHintsAndCursor(unsigned char *target) {
void DrawHintsAndCursor(byte *target) {
UpdateCursor();
WaitVBlank();
UndrawCursor(target);
@ -1619,20 +1619,20 @@ void DrawHintsAndCursor(unsigned char *target) {
DrawCursor(target);
}
void HideSpot(unsigned char offset) {
void HideSpot(byte offset) {
FindAndSelectSpot(offset);
found_spot->flags &= ~SPOTFLG_80;
}
const unsigned char timed_seq[] = {56, 51, 44, 12, 10, 20, 18, 16, 14, 12, 44, 51};
const unsigned char *timed_seq_ptr = timed_seq;
const byte timed_seq[] = {56, 51, 44, 12, 10, 20, 18, 16, 14, 12, 44, 51};
const byte *timed_seq_ptr = timed_seq;
/*
Protozorq AI 1
TODO: rename this
*/
void UpdateTimedRects1(void) {
unsigned int elapsed;
uint16 elapsed;
if (script_byte_vars.flag_179FB != 0)
return;
@ -1774,7 +1774,7 @@ Protozorq AI 2
TODO: rename this
*/
void UpdateTimedRects2(void) {
unsigned int elapsed = Swap16(script_word_vars.timer_ticks2);
uint16 elapsed = Swap16(script_word_vars.timer_ticks2);
if (elapsed < 60 * 60)
return;
@ -1812,7 +1812,7 @@ void UpdateTimedRects2(void) {
}
void UpdateTimedInventoryItems(void) {
int i;
int16 i;
if (Swap16(script_word_vars.timer_ticks2) - inv_update_time < 180)
return;
inv_update_time = Swap16(script_word_vars.timer_ticks2);
@ -1826,7 +1826,7 @@ void UpdateTimedInventoryItems(void) {
}
void ResetAllPersons(void) {
int i;
int16 i;
for (i = 0; i < PERS_MAX; i++)
pers_list[i].flags &= ~PERSFLG_80;
script_byte_vars.dead_flag = 0;

View File

@ -37,13 +37,13 @@ namespace Chamber {
/*TODO: manipulated from script, do not change*/
#include "common/pack-start.h"
typedef struct spot_t {
unsigned char sx;
unsigned char ex;
unsigned char sy;
unsigned char ey;
unsigned char flags;
unsigned char hint;
unsigned short command;
byte sx;
byte ex;
byte sy;
byte ey;
byte flags;
byte hint;
uint16 command;
} spot_t;
#include "common/pack-end.h"
@ -57,28 +57,28 @@ typedef struct spot_t {
/*TODO: manipulated from script, do not change*/
#include "common/pack-start.h"
typedef struct pers_t {
unsigned char area; /*location*/
unsigned char flags; /*flags in bits 7..4 and room index in bits 3..0*/
unsigned char name; /*name index*/
unsigned char index; /*animations index (in lutins_table) in bits 7..3 , spot index in bits 2..0*/
unsigned char item; /*inventory item index (1-based)*/
byte area; /*location*/
byte flags; /*flags in bits 7..4 and room index in bits 3..0*/
byte name; /*name index*/
byte index; /*animations index (in lutins_table) in bits 7..3 , spot index in bits 2..0*/
byte item; /*inventory item index (1-based)*/
} pers_t;
#include "common/pack-end.h"
#define ANIMFLG_USESPOT 0x80
typedef struct animdesc_t {
unsigned char index; /*flag in bit 7, animation index in bits 6..0*/
byte index; /*flag in bit 7, animation index in bits 6..0*/
union {
struct {
unsigned char x, y;
byte x, y;
} coords;
unsigned short desc;
uint16 desc;
} params;
} animdesc_t;
typedef struct vortanims_t {
unsigned char room;
byte room;
animdesc_t field_1;
animdesc_t field_4;
animdesc_t field_7;
@ -86,36 +86,36 @@ typedef struct vortanims_t {
} vortanims_t;
typedef struct turkeyanims_t {
unsigned char room;
byte room;
animdesc_t field_1;
animdesc_t field_4;
} turkeyanims_t;
extern unsigned char scratch_mem1[8010];
extern unsigned char *scratch_mem2;
extern byte scratch_mem1[8010];
extern byte *scratch_mem2;
extern rect_t room_bounds_rect;
extern unsigned char last_object_hint;
extern unsigned char object_hint;
extern unsigned char command_hint;
extern unsigned char last_command_hint;
extern byte last_object_hint;
extern byte object_hint;
extern byte command_hint;
extern byte last_command_hint;
extern unsigned short next_ticks2;
extern unsigned short next_ticks3;
extern unsigned short next_command3;
extern unsigned short next_ticks4;
extern unsigned short next_command4;
extern uint16 next_ticks2;
extern uint16 next_ticks3;
extern uint16 next_command3;
extern uint16 next_ticks4;
extern uint16 next_command4;
#define MAX_SPRITES 16
extern unsigned char *sprites_list[MAX_SPRITES];
extern byte *sprites_list[MAX_SPRITES];
#define MAX_DOORS 5
extern unsigned char *doors_list[MAX_DOORS];
extern byte *doors_list[MAX_DOORS];
extern unsigned char zone_palette;
extern byte zone_palette;
extern spot_t *zone_spots;
extern spot_t *zone_spots_end;
@ -129,90 +129,90 @@ extern turkeyanims_t *turkeyanims_ptr;
extern pers_t *pers_ptr;
extern spot_t *spot_ptr;
extern spot_t *found_spot;
extern unsigned char **spot_sprite;
extern byte **spot_sprite;
extern unsigned char *lutin_mem;
extern byte *lutin_mem;
extern unsigned char zone_drawn;
extern byte zone_drawn;
extern unsigned char in_de_profundis;
extern byte in_de_profundis;
extern unsigned char zone_name;
extern unsigned char room_hint_bar_width;
extern unsigned char zone_spr_index;
extern unsigned char zone_obj_count;
extern unsigned char room_hint_bar_coords_x;
extern unsigned char room_hint_bar_coords_y;
extern byte zone_name;
extern byte room_hint_bar_width;
extern byte zone_spr_index;
extern byte zone_obj_count;
extern byte room_hint_bar_coords_x;
extern byte room_hint_bar_coords_y;
extern unsigned short inv_update_time;
extern uint16 inv_update_time;
extern const unsigned char timed_seq[];
extern const unsigned char *timed_seq_ptr;
extern const byte timed_seq[];
extern const byte *timed_seq_ptr;
typedef struct thewalldoor_t {
unsigned char height;
unsigned char width;
unsigned int pitch;
unsigned int offs;
unsigned char *pixels;
byte height;
byte width;
uint16 pitch;
uint16 offs;
byte *pixels;
} thewalldoor_t;
extern thewalldoor_t the_wall_doors[2];
int IsInRect(unsigned char x, unsigned char y, rect_t *rect);
int IsCursorInRect(rect_t *rect);
int16 IsInRect(byte x, byte y, rect_t *rect);
int16 IsCursorInRect(rect_t *rect);
void SelectSpotCursor(void);
void CheckHotspots(unsigned char m, unsigned char v);
void CheckHotspots(byte m, byte v);
void AnimateSpot(const animdesc_t *info);
unsigned char *LoadPuzzlToScratch(unsigned char index);
byte *LoadPuzzlToScratch(byte index);
void DrawObjectHint(void);
void ShowObjectHint(unsigned char *target);
void ShowObjectHint(byte *target);
void DrawCommandHint(void);
void ShowCommandHint(unsigned char *target);
void ShowCommandHint(byte *target);
void DrawCharacterSprite(unsigned char spridx, unsigned char x, unsigned char y, unsigned char *target);
char DrawZoneAniSprite(rect_t *rect, unsigned int index, unsigned char *target);
void DrawCharacterSprite(byte spridx, byte x, byte y, byte *target);
char DrawZoneAniSprite(rect_t *rect, uint16 index, byte *target);
void DrawHintsAndCursor(unsigned char *target);
void DrawHintsAndCursor(byte *target);
void DrawTheWallDoors(void);
void MergeSpritesData(unsigned char *target, unsigned int pitch, unsigned char *source, unsigned int w, unsigned int h);
void MergeSpritesDataFlip(unsigned char *target, unsigned int pitch, unsigned char *source, unsigned int w, unsigned int h);
void MergeSpritesData(byte *target, uint16 pitch, byte *source, uint16 w, uint16 h);
void MergeSpritesDataFlip(byte *target, uint16 pitch, byte *source, uint16 w, uint16 h);
void RefreshSpritesData(void);
void BlitSpritesToBackBuffer(void);
void BackupSpotsImages(void);
void SelectPalette(void);
void SelectSpecificPalette(unsigned char index);
void SelectSpecificPalette(byte index);
unsigned char FindSpotByFlags(unsigned char mask, unsigned char value);
unsigned char FindAndSelectSpot(unsigned char offset);
byte FindSpotByFlags(byte mask, byte value);
byte FindAndSelectSpot(byte offset);
void FindPerson(void);
void UpdateZoneSpot(unsigned char index);
void UpdateZoneSpot(byte index);
void DrawRoomItemsIndicator(void);
void DrawRoomStaticObject(unsigned char *aptr, unsigned char *rx, unsigned char *ry, unsigned char *rw, unsigned char *rh);
void DrawRoomStaticObject(byte *aptr, byte *rx, byte *ry, byte *rw, byte *rh);
void DrawRoomStatics(void);
void RedrawRoomStatics(unsigned char index, unsigned char y_step);
void RedrawRoomStatics(byte index, byte y_step);
void DrawZoneObjs(void);
void RefreshZone(void);
void ChangeZone(unsigned char index);
void ChangeZone(byte index);
void DrawSpots(unsigned char *target);
void AnimateSpots(unsigned char *target);
void DrawSpots(byte *target);
void AnimateSpots(byte *target);
unsigned char FindInitialSpot(void);
void AnimRoomDoorOpen(unsigned char index);
void AnimRoomDoorClose(unsigned char index);
byte FindInitialSpot(void);
void AnimRoomDoorOpen(byte index);
void AnimRoomDoorClose(byte index);
unsigned int GetPuzzlSprite(unsigned char index, unsigned char x, unsigned char y, unsigned int *w, unsigned int *h, unsigned int *ofs);
uint16 GetPuzzlSprite(byte index, byte x, byte y, uint16 *w, uint16 *h, uint16 *ofs);
void BounceCurrentItem(unsigned char flags, unsigned char y);
void BounceCurrentItem(byte flags, byte y);
void BackupScreenOfSpecialRoom(void);
void RestoreScreenOfSpecialRoom(void);

View File

@ -68,10 +68,10 @@ void RestartGame(void) {
#define CGA_SAVE_TIMEDSEQ_OFS 0xA7C0
#define SAVEADDR(value, base, nativesize, origsize, origbase) \
((value) ? LE16(((((unsigned char*)(value)) - (unsigned char*)(base)) / nativesize) * origsize + origbase) : 0)
((value) ? LE16(((((byte*)(value)) - (byte*)(base)) / nativesize) * origsize + origbase) : 0)
#define LOADADDR(value, base, nativesize, origsize, origbase) \
((value) ? ((((LE16(value)) - (origbase)) / origsize) * nativesize + (unsigned char*)base) : 0)
((value) ? ((((LE16(value)) - (origbase)) / origsize) * nativesize + (byte*)base) : 0)
#define WRITE(buffer, size) \
wlen = write(f, buffer, size); if(wlen != size) goto error;
@ -79,17 +79,17 @@ void RestartGame(void) {
#define READ(buffer, size) \
rlen = read(f, buffer, size); if(rlen != size) goto error;
int LoadScena(void) {
int16 LoadScena(void) {
warning("STUB: LoadScena()");
return 1;
#if 0
int f;
int rlen;
unsigned short zero = 0;
unsigned char *p;
int i;
int16 f;
int16 rlen;
uint16 zero = 0;
byte *p;
int16 i;
script_byte_vars.game_paused = 1;
@ -107,12 +107,12 @@ int LoadScena(void) {
*/
#define BYTES(buffer, size) READ(buffer, size)
#define UBYTE(variable) { unsigned char temp_v; READ(&temp_v, 1); variable = temp_v; }
#define SBYTE(variable) { signed char temp_v; READ(&temp_v, 1); variable = temp_v; }
#define USHORT(variable) { unsigned short temp_v; READ(&temp_v, 2); variable = temp_v; }
#define SSHORT(variable) { signed short temp_v; READ(&temp_v, 2); variable = temp_v; }
#define UBYTE(variable) { byte temp_v; READ(&temp_v, 1); variable = temp_v; }
#define SBYTE(variable) { int8 temp_v; READ(&temp_v, 1); variable = temp_v; }
#define USHORT(variable) { uint16 temp_v; READ(&temp_v, 2); variable = temp_v; }
#define SSHORT(variable) { int16 temp_v; READ(&temp_v, 2); variable = temp_v; }
#define POINTER(variable, base, nativesize, origsize, origbase) \
{ signed short temp_v; READ(&temp_v, 2); variable = LOADADDR(temp_v, base, nativesize, origsize, origbase); }
{ int16 temp_v; READ(&temp_v, 2); variable = LOADADDR(temp_v, base, nativesize, origsize, origbase); }
/*script_vars pointers*/
POINTER(script_vars[ScrPool0_WordVars0], &script_word_vars, 2, 2, CGA_SAVE_WORD_VARS_OFS);
@ -136,17 +136,17 @@ int LoadScena(void) {
}
/* zone_spots */
POINTER((unsigned char *)zone_spots, zones_data, 1, 1, CGA_SAVE_ZONES_OFS);
POINTER((byte *)zone_spots, zones_data, 1, 1, CGA_SAVE_ZONES_OFS);
/* zone_spots_end */
POINTER((unsigned char *)zone_spots_end, zones_data, 1, 1, CGA_SAVE_ZONES_OFS);
POINTER((byte *)zone_spots_end, zones_data, 1, 1, CGA_SAVE_ZONES_OFS);
/* zone_spots_cur */
POINTER((unsigned char *)zone_spots_cur, zones_data, 1, 1, CGA_SAVE_ZONES_OFS);
POINTER((byte *)zone_spots_cur, zones_data, 1, 1, CGA_SAVE_ZONES_OFS);
/* script_stack_ptr */
/*TODO: FIX ME: original stack works in reverse order (from higher address to lower)*/
POINTER((unsigned char *)script_stack_ptr, script_stack, 1, 1, CGA_SAVE_SCRSTACK_OFS);
POINTER((byte *)script_stack_ptr, script_stack, 1, 1, CGA_SAVE_SCRSTACK_OFS);
/* script_stack */
/*TODO: FIX ME: original stack works in reverse order (from higher address to lower)*/
@ -158,25 +158,25 @@ int LoadScena(void) {
USHORT(zero);
/* pers_vort_ptr */
POINTER((unsigned char *)pers_vort_ptr, pers_list, 1, 1, CGA_SAVE_PERS_OFS);
POINTER((byte *)pers_vort_ptr, pers_list, 1, 1, CGA_SAVE_PERS_OFS);
/* vortanims_ptr */
POINTER((unsigned char *)vortanims_ptr, vortsanim_list, 1, 1, CGA_SAVE_VORTANIMS_OFS);
POINTER((byte *)vortanims_ptr, vortsanim_list, 1, 1, CGA_SAVE_VORTANIMS_OFS);
/* turkeyanims_ptr */
POINTER((unsigned char *)turkeyanims_ptr, turkeyanim_list, 1, 1, CGA_SAVE_TURKEYANIMS_OFS);
POINTER((byte *)turkeyanims_ptr, turkeyanim_list, 1, 1, CGA_SAVE_TURKEYANIMS_OFS);
/* pers_ptr */
POINTER((unsigned char *)pers_ptr, pers_list, 1, 1, CGA_SAVE_PERS_OFS);
POINTER((byte *)pers_ptr, pers_list, 1, 1, CGA_SAVE_PERS_OFS);
/* spot_ptr */
POINTER((unsigned char *)spot_ptr, zones_data, 1, 1, CGA_SAVE_ZONES_OFS);
POINTER((byte *)spot_ptr, zones_data, 1, 1, CGA_SAVE_ZONES_OFS);
/* found_spot */
POINTER((unsigned char *)found_spot, zones_data, 1, 1, CGA_SAVE_ZONES_OFS);
POINTER((byte *)found_spot, zones_data, 1, 1, CGA_SAVE_ZONES_OFS);
/* spot_sprite */
POINTER((unsigned char *)spot_sprite, sprites_list, sizeof(sprites_list[0]), 2, CGA_SAVE_SPRLIST_OFS);
POINTER((byte *)spot_sprite, sprites_list, sizeof(sprites_list[0]), 2, CGA_SAVE_SPRLIST_OFS);
/* timed_seq_ptr */
POINTER(timed_seq_ptr, timed_seq, 1, 1, CGA_SAVE_TIMEDSEQ_OFS);
@ -354,16 +354,16 @@ error:
#endif
}
int SaveScena(void) {
int16 SaveScena(void) {
warning("STUB: SaveScena()");
return 1;
#if 0
int f;
int wlen;
unsigned short zero = 0;
unsigned char *p;
int i;
int16 f;
int16 wlen;
uint16 zero = 0;
byte *p;
int16 i;
script_byte_vars.game_paused = 1;
BlitSpritesToBackBuffer();
@ -375,12 +375,12 @@ int SaveScena(void) {
}
#define BYTES(buffer, size) WRITE(buffer, size)
#define UBYTE(variable) { unsigned char temp_v = variable; WRITE(&temp_v, 1); }
#define SBYTE(variable) { signed char temp_v = variable; WRITE(&temp_v, 1); }
#define USHORT(variable) { unsigned short temp_v = variable; WRITE(&temp_v, 2); }
#define SSHORT(variable) { signed short temp_v = variable; WRITE(&temp_v, 2); }
#define UBYTE(variable) { byte temp_v = variable; WRITE(&temp_v, 1); }
#define SBYTE(variable) { int8 temp_v = variable; WRITE(&temp_v, 1); }
#define USHORT(variable) { uint16 temp_v = variable; WRITE(&temp_v, 2); }
#define SSHORT(variable) { int16 temp_v = variable; WRITE(&temp_v, 2); }
#define POINTER(variable, base, nativesize, origsize, origbase) \
{ signed short temp_v = SAVEADDR(variable, base, nativesize, origsize, origbase); WRITE(&temp_v, 2); }
{ int16 temp_v = SAVEADDR(variable, base, nativesize, origsize, origbase); WRITE(&temp_v, 2); }
/*script_vars pointers*/
POINTER(script_vars[ScrPool0_WordVars0], &script_word_vars, 2, 2, CGA_SAVE_WORD_VARS_OFS);

View File

@ -25,8 +25,8 @@
namespace Chamber {
int LoadScena(void);
int SaveScena(void);
int16 LoadScena(void);
int16 SaveScena(void);
void SaveRestartGame(void);
void RestartGame(void);

File diff suppressed because it is too large Load Diff

View File

@ -43,134 +43,134 @@ enum ScriptPools {
/*Byte-packed, members accessed from script code by hardcoded offsets*/
typedef struct script_byte_vars_t {
unsigned char zone_index; /* 0 */
unsigned char zone_room; /* 1 */
unsigned char byte_179B8; /* 2 */
unsigned char cur_spot_idx; /* 3 */
unsigned char the_wall_phase; /* 4 */
unsigned char prev_zone_index; /* 5 */
unsigned char unused_179BC; /* 6 */
unsigned char unused_179BD; /* 7 */
unsigned char byte_179BE; /* 8 */
unsigned char unused_179BF; /* 9 */
unsigned char unused_179C0; /* A */
unsigned char byte_179C1; /* B */
unsigned char zone_area; /* C */
unsigned char dead_flag; /* D */
volatile unsigned char timer_ticks; /* E */
unsigned char gauss_phase; /* F */
unsigned char unused_179C6; /* 10 */
unsigned char rand_value; /* 11 */
unsigned char load_flag; /* 12 */
unsigned char spot_m; /* 13 */
unsigned char spot_v; /* 14 */
unsigned char unused_179CB; /* 15 */
unsigned char unused_179CC; /* 16 */
unsigned char unused_179CD; /* 17 */
unsigned char unused_179CE; /* 18 */
unsigned char unused_179CF; /* 19 */
unsigned char unused_179D0; /* 1A */
unsigned char unused_179D1; /* 1B */
unsigned char unused_179D2; /* 1C */
unsigned char unused_179D3; /* 1D */
unsigned char unused_179D4; /* 1E */
unsigned char unused_179D5; /* 1F */
unsigned char cur_pers; /* 20 */
unsigned char used_commands; /* 21 */
unsigned char tries_left; /* 22 */
unsigned char inv_item_index; /* 23 */
unsigned char unused_179DA; /* 24 */
unsigned char byte_179DB; /* 25 */
unsigned char byte_179DC; /* 26 */
unsigned char byte_179DD; /* 27 */
unsigned char byte_179DE; /* 28 */
unsigned char byte_179DF; /* 29 */
unsigned char byte_179E0; /* 2A */
unsigned char byte_179E1; /* 2B */ /*TODO: hand height*/
unsigned char check_used_commands; /* 2C */
unsigned char byte_179E3; /* 2D */
unsigned char palette_index; /* 2E */
unsigned char byte_179E5; /* 2F */
unsigned char byte_179E6; /* 30 */
unsigned char room_items; /* 31 */
unsigned char byte_179E8; /* 32 */
unsigned char byte_179E9; /* 33 */
unsigned char byte_179EA; /* 34 */
unsigned char byte_179EB; /* 35 */
unsigned char byte_179EC; /* 36 */
unsigned char byte_179ED; /* 37 */
unsigned char zone_area_copy; /* 38 */
unsigned char byte_179EF; /* 39 */
unsigned char quest_item_ofs; /* 3A */
unsigned char byte_179F1; /* 3B */
unsigned char byte_179F2; /* 3C */
unsigned char byte_179F3; /* 3D */
unsigned char trade_done; /* 3E */
unsigned char byte_179F5; /* 3F */
unsigned char byte_179F6; /* 40 */
unsigned char byte_179F7; /* 41 */
unsigned char byte_179F8; /* 42 */
unsigned char byte_179F9; /* 43 */
unsigned char dirty_rect_kind; /* 44 */
unsigned char flag_179FB; /* 45 */
unsigned char byte_179FC; /* 46 */
unsigned char game_paused; /* 47 */
unsigned char trade_status; /* 48 */
unsigned char cur_spot_flags; /* 49 */
unsigned char byte_17A00; /* 4A */
unsigned char byte_17A01; /* 4B */
unsigned char byte_17A02; /* 4C */
unsigned char byte_17A03; /* 4D */
unsigned char byte_17A04; /* 4E */
unsigned char byte_17A05; /* 4F */
unsigned char byte_17A06; /* 50 */
unsigned char byte_17A07; /* 51 */
unsigned char byte_17A08; /* 52 */
unsigned char byte_17A09; /* 53 */
unsigned char byte_17A0A; /* 54 */
unsigned char byte_17A0B; /* 55 */
unsigned char byte_17A0C; /* 56 */
unsigned char need_draw_spots; /* 57 */
unsigned char byte_17A0E; /* 58 */
unsigned char byte_17A0F; /* 59 */
unsigned char psy_energy; /* 5A */
unsigned char byte_17A11; /* 5B */
unsigned char byte_17A12; /* 5C */
unsigned char byte_17A13; /* 5D */
unsigned char byte_17A14; /* 5E */
unsigned char byte_17A15; /* 5F */
unsigned char byte_17A16; /* 60 */
unsigned char byte_17A17; /* 61 */
unsigned char byte_17A18; /* 62 */
unsigned char byte_17A19; /* 63 */
unsigned char byte_17A1A; /* 64 */
unsigned char byte_17A1B; /* 65 */
unsigned char byte_17A1C; /* 66 */
unsigned char byte_17A1D; /* 67 */
unsigned char zapstik_stolen; /* 68 */
unsigned char byte_17A1F; /* 69 */
unsigned char byte_17A20; /* 6A */
unsigned char byte_17A21; /* 6B */
unsigned char byte_17A22; /* 6C */
unsigned char byte_17A23[4]; /* 6D */
byte zone_index; /* 0 */
byte zone_room; /* 1 */
byte byte_179B8; /* 2 */
byte cur_spot_idx; /* 3 */
byte the_wall_phase; /* 4 */
byte prev_zone_index; /* 5 */
byte unused_179BC; /* 6 */
byte unused_179BD; /* 7 */
byte byte_179BE; /* 8 */
byte unused_179BF; /* 9 */
byte unused_179C0; /* A */
byte byte_179C1; /* B */
byte zone_area; /* C */
byte dead_flag; /* D */
volatile byte timer_ticks; /* E */
byte gauss_phase; /* F */
byte unused_179C6; /* 10 */
byte rand_value; /* 11 */
byte load_flag; /* 12 */
byte spot_m; /* 13 */
byte spot_v; /* 14 */
byte unused_179CB; /* 15 */
byte unused_179CC; /* 16 */
byte unused_179CD; /* 17 */
byte unused_179CE; /* 18 */
byte unused_179CF; /* 19 */
byte unused_179D0; /* 1A */
byte unused_179D1; /* 1B */
byte unused_179D2; /* 1C */
byte unused_179D3; /* 1D */
byte unused_179D4; /* 1E */
byte unused_179D5; /* 1F */
byte cur_pers; /* 20 */
byte used_commands; /* 21 */
byte tries_left; /* 22 */
byte inv_item_index; /* 23 */
byte unused_179DA; /* 24 */
byte byte_179DB; /* 25 */
byte byte_179DC; /* 26 */
byte byte_179DD; /* 27 */
byte byte_179DE; /* 28 */
byte byte_179DF; /* 29 */
byte byte_179E0; /* 2A */
byte byte_179E1; /* 2B */ /*TODO: hand height*/
byte check_used_commands; /* 2C */
byte byte_179E3; /* 2D */
byte palette_index; /* 2E */
byte byte_179E5; /* 2F */
byte byte_179E6; /* 30 */
byte room_items; /* 31 */
byte byte_179E8; /* 32 */
byte byte_179E9; /* 33 */
byte byte_179EA; /* 34 */
byte byte_179EB; /* 35 */
byte byte_179EC; /* 36 */
byte byte_179ED; /* 37 */
byte zone_area_copy; /* 38 */
byte byte_179EF; /* 39 */
byte quest_item_ofs; /* 3A */
byte byte_179F1; /* 3B */
byte byte_179F2; /* 3C */
byte byte_179F3; /* 3D */
byte trade_done; /* 3E */
byte byte_179F5; /* 3F */
byte byte_179F6; /* 40 */
byte byte_179F7; /* 41 */
byte byte_179F8; /* 42 */
byte byte_179F9; /* 43 */
byte dirty_rect_kind; /* 44 */
byte flag_179FB; /* 45 */
byte byte_179FC; /* 46 */
byte game_paused; /* 47 */
byte trade_status; /* 48 */
byte cur_spot_flags; /* 49 */
byte byte_17A00; /* 4A */
byte byte_17A01; /* 4B */
byte byte_17A02; /* 4C */
byte byte_17A03; /* 4D */
byte byte_17A04; /* 4E */
byte byte_17A05; /* 4F */
byte byte_17A06; /* 50 */
byte byte_17A07; /* 51 */
byte byte_17A08; /* 52 */
byte byte_17A09; /* 53 */
byte byte_17A0A; /* 54 */
byte byte_17A0B; /* 55 */
byte byte_17A0C; /* 56 */
byte need_draw_spots; /* 57 */
byte byte_17A0E; /* 58 */
byte byte_17A0F; /* 59 */
byte psy_energy; /* 5A */
byte byte_17A11; /* 5B */
byte byte_17A12; /* 5C */
byte byte_17A13; /* 5D */
byte byte_17A14; /* 5E */
byte byte_17A15; /* 5F */
byte byte_17A16; /* 60 */
byte byte_17A17; /* 61 */
byte byte_17A18; /* 62 */
byte byte_17A19; /* 63 */
byte byte_17A1A; /* 64 */
byte byte_17A1B; /* 65 */
byte byte_17A1C; /* 66 */
byte byte_17A1D; /* 67 */
byte zapstik_stolen; /* 68 */
byte byte_17A1F; /* 69 */
byte byte_17A20; /* 6A */
byte byte_17A21; /* 6B */
byte byte_17A22; /* 6C */
byte byte_17A23[4]; /* 6D */
} script_byte_vars_t;
/*2-byte long vars, in BIG-endian order*/
typedef struct script_word_vars_t {
unsigned short psi_cmds[6]; /* 0 */
unsigned short word_17850; /* C */
unsigned short word_17852; /* E */
unsigned short timer_ticks2; /* 10 */
unsigned short zone_obj_cmds[15 * 5]; /* 12 */
unsigned short next_command1; /* A8 */
unsigned short word_178EE; /* AA */
unsigned short word_178F0; /* AC */
unsigned short word_178F2; /* AE */
unsigned short word_178F4; /* B0 */
unsigned short word_178F6; /* B2 */
unsigned short word_178F8; /* B4 */
unsigned short next_command2; /* B6 */
unsigned short word_178FC; /* B8 */
uint16 psi_cmds[6]; /* 0 */
uint16 word_17850; /* C */
uint16 word_17852; /* E */
uint16 timer_ticks2; /* 10 */
uint16 zone_obj_cmds[15 * 5]; /* 12 */
uint16 next_command1; /* A8 */
uint16 word_178EE; /* AA */
uint16 word_178F0; /* AC */
uint16 word_178F2; /* AE */
uint16 word_178F4; /* B0 */
uint16 word_178F6; /* B2 */
uint16 word_178F8; /* B4 */
uint16 next_command2; /* B6 */
uint16 word_178FC; /* B8 */
} script_word_vars_t;
extern void *script_vars[ScrPools_MAX];
@ -189,11 +189,11 @@ extern script_byte_vars_t script_byte_vars;
/*TODO: manipulated from script, do not change*/
#include "common/pack-start.h"
typedef struct item_t {
unsigned char flags;
unsigned char flags2;
unsigned char sprite; /*item sprite index*/
unsigned char name; /*item name index (relative)*/
unsigned short command; /*TODO: warning! in native format, check if never accessed from scripts*/
byte flags;
byte flags2;
byte sprite; /*item sprite index*/
byte name; /*item name index (relative)*/
uint16 command; /*TODO: warning! in native format, check if never accessed from scripts*/
} item_t;
#include "common/pack-end.h"
@ -203,33 +203,33 @@ extern item_t inventory_items[MAX_INV_ITEMS];
#define PERS_MAX 41
extern pers_t pers_list[PERS_MAX];
extern unsigned char *script_stack[5 * 2];
extern unsigned char **script_stack_ptr;
extern byte *script_stack[5 * 2];
extern byte **script_stack_ptr;
extern pers_t *pers_vort_ptr;
#define SPECIAL_COMMANDS_MAX 20
extern unsigned short menu_commands_12[SPECIAL_COMMANDS_MAX];
extern unsigned short menu_commands_22[SPECIAL_COMMANDS_MAX];
extern unsigned short menu_commands_24[SPECIAL_COMMANDS_MAX];
extern unsigned short menu_commands_23[SPECIAL_COMMANDS_MAX];
extern uint16 menu_commands_12[SPECIAL_COMMANDS_MAX];
extern uint16 menu_commands_22[SPECIAL_COMMANDS_MAX];
extern uint16 menu_commands_24[SPECIAL_COMMANDS_MAX];
extern uint16 menu_commands_23[SPECIAL_COMMANDS_MAX];
extern unsigned short fight_pers_ofs;
extern uint16 fight_pers_ofs;
extern unsigned char wait_delta;
extern byte wait_delta;
extern unsigned char rand_seed;
unsigned char Rand(void);
unsigned int RandW(void);
extern byte rand_seed;
byte Rand(void);
uint16 RandW(void);
extern unsigned short the_command;
extern uint16 the_command;
unsigned char *GetScriptSubroutine(unsigned int index);
byte *GetScriptSubroutine(uint16 index);
unsigned int RunCommand(void);
unsigned int RunCommandKeepSp(void);
uint16 RunCommand(void);
uint16 RunCommandKeepSp(void);
unsigned int Swap16(unsigned int x);
uint16 Swap16(uint16 x);
} // End of namespace Chamber

View File

@ -27,7 +27,7 @@
namespace Chamber {
void PlaySound(unsigned char index) {
void PlaySound(byte index) {
/*TODO*/
}

View File

@ -25,7 +25,7 @@
namespace Chamber {
void PlaySound(unsigned char index);
void PlaySound(byte index);
} // End of namespace Chamber

View File

@ -32,9 +32,9 @@
namespace Chamber {
void AnimateGauss(unsigned char *target) {
unsigned char *sprite;
unsigned char phase = Rand() % 4;
void AnimateGauss(byte *target) {
byte *sprite;
byte phase = Rand() % 4;
if (phase == script_byte_vars.gauss_phase)
phase = (phase + 1) % 4;
script_byte_vars.gauss_phase = phase;