mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 21:59:17 +00:00
CGE: Implement ForceExt and RCrypt. Little style cleanup.
This commit is contained in:
parent
d5fdd09429
commit
a06a75b9a4
@ -194,18 +194,18 @@ BMP_PTR BITMAP::Code(void) {
|
||||
int bpl;
|
||||
|
||||
if (V) { // 2nd pass - fill the hide table
|
||||
for (i = 0; i < H; i ++) {
|
||||
for (i = 0; i < H; i++) {
|
||||
B[i].skip = 0xFFFF;
|
||||
B[i].hide = 0x0000;
|
||||
}
|
||||
}
|
||||
for (bpl = 0; bpl < 4; bpl ++) { // once per each bitplane
|
||||
for (bpl = 0; bpl < 4; bpl++) { // once per each bitplane
|
||||
uint8 *bm = M;
|
||||
bool skip = (bm[bpl] == TRANS);
|
||||
uint16 j;
|
||||
|
||||
cnt = 0;
|
||||
for (i = 0; i < H; i ++) { // once per each line
|
||||
for (i = 0; i < H; i++) { // once per each line
|
||||
uint8 pix;
|
||||
for (j = bpl; j < W; j += 4) {
|
||||
pix = bm[j];
|
||||
@ -274,7 +274,7 @@ BMP_PTR BITMAP::Code(void) {
|
||||
B = (HideDesc *)(V + sizV);
|
||||
}
|
||||
cnt = 0;
|
||||
for (i = 0; i < H; i ++) {
|
||||
for (i = 0; i < H; i++) {
|
||||
if (B[i].skip == 0xFFFF) { // whole line is skipped
|
||||
B[i].skip = (cnt + SCR_WID) >> 2;
|
||||
cnt = 0;
|
||||
@ -326,7 +326,7 @@ bool BITMAP::SolidAt(int x, int y) {
|
||||
while (true) {
|
||||
uint16 w, t;
|
||||
|
||||
w = * (uint16 *) m;
|
||||
w = *(uint16 *) m;
|
||||
m += 2;
|
||||
t = w & 0xC000;
|
||||
w &= 0x3FFF;
|
||||
|
@ -42,7 +42,7 @@ namespace CGE {
|
||||
|
||||
BTFILE::BTFILE(const char *name, IOMODE mode, CRYPT *crpt)
|
||||
: IOHAND(name, mode, crpt) {
|
||||
for (int i = 0; i < BT_LEVELS; i ++) {
|
||||
for (int i = 0; i < BT_LEVELS; i++) {
|
||||
Buff[i].Page = new BT_PAGE;
|
||||
Buff[i].PgNo = BT_NONE;
|
||||
Buff[i].Indx = -1;
|
||||
@ -54,7 +54,7 @@ BTFILE::BTFILE(const char *name, IOMODE mode, CRYPT *crpt)
|
||||
|
||||
|
||||
BTFILE::~BTFILE(void) {
|
||||
for (int i = 0; i < BT_LEVELS; i ++) {
|
||||
for (int i = 0; i < BT_LEVELS; i++) {
|
||||
PutPage(i);
|
||||
delete Buff[i].Page;
|
||||
}
|
||||
@ -101,7 +101,7 @@ BT_KEYPACK *BTFILE::Find(const char *key) {
|
||||
// search
|
||||
if (pg->Hea.Down != BT_NONE) {
|
||||
int i;
|
||||
for (i = 0; i < pg->Hea.Count; i ++) {
|
||||
for (i = 0; i < pg->Hea.Count; i++) {
|
||||
if (memicmp(key, pg->Inn[i].Key, BT_KEYLEN) < 0)
|
||||
break;
|
||||
}
|
||||
@ -110,7 +110,7 @@ BT_KEYPACK *BTFILE::Find(const char *key) {
|
||||
++ lev;
|
||||
} else {
|
||||
int i;
|
||||
for (i = 0; i < pg->Hea.Count - 1; i ++)
|
||||
for (i = 0; i < pg->Hea.Count - 1; i++)
|
||||
if (scumm_stricmp((const char *)key, (const char *)pg->Lea[i].Key) <= 0)
|
||||
break;
|
||||
Buff[lev].Indx = i;
|
||||
@ -136,15 +136,15 @@ void BTFILE::Make(BT_KEYPACK *keypack, uint16 count) {
|
||||
*Leaf = GetPage(1, n);
|
||||
Root->Hea.Down = n;
|
||||
PutPage(0, true);
|
||||
while (count --) {
|
||||
while (count--) {
|
||||
if (Leaf->Hea.Count >= ArrayCount(Leaf->Lea)) {
|
||||
PutPage(1, true); // save filled page
|
||||
Leaf = GetPage(1, ++n); // take empty page
|
||||
memcpy(Root->Inn[Root->Hea.Count].Key, keypack->Key, BT_KEYLEN);
|
||||
Root->Inn[Root->Hea.Count ++].Down = n;
|
||||
Root->Inn[Root->Hea.Count++].Down = n;
|
||||
Buff[0].Updt = true;
|
||||
}
|
||||
Leaf->Lea[Leaf->Hea.Count ++] = * (keypack ++);
|
||||
Leaf->Lea[Leaf->Hea.Count++] = *(keypack++);
|
||||
Buff[1].Updt = true;
|
||||
}
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ uint16 IOBUF::Read(uint8 *buf) {
|
||||
Ptr += n;
|
||||
if (eol) {
|
||||
++ Ptr;
|
||||
* (buf ++) = '\n';
|
||||
*(buf++) = '\n';
|
||||
++ total;
|
||||
if (Ptr >= Lim)
|
||||
ReadBuff();
|
||||
@ -186,14 +186,14 @@ int IOBUF::Read(void) {
|
||||
if (Lim == 0)
|
||||
return -1;
|
||||
}
|
||||
return Buff[Ptr ++];
|
||||
return Buff[Ptr++];
|
||||
}
|
||||
|
||||
|
||||
void IOBUF::Write(uint8 b) {
|
||||
if (Lim >= IOBUF_SIZE)
|
||||
WriteBuff();
|
||||
Buff[Lim ++] = b;
|
||||
Buff[Lim++] = b;
|
||||
}
|
||||
|
||||
|
||||
|
@ -253,7 +253,7 @@ static void LoadGame(XFILE &file, bool tiny = false) {
|
||||
SPRITE *spr;
|
||||
int i;
|
||||
|
||||
for (st = SavTab; st->Ptr; st ++) {
|
||||
for (st = SavTab; st->Ptr; st++) {
|
||||
if (file.Error)
|
||||
error("Bad SVG");
|
||||
file.Read((uint8 *)((tiny || st->Flg) ? st->Ptr : &i), st->Len);
|
||||
@ -289,7 +289,7 @@ static void LoadGame(XFILE &file, bool tiny = false) {
|
||||
Vga->SpareQ->Append(spr);
|
||||
}
|
||||
|
||||
for (i = 0; i < POCKET_NX; i ++) {
|
||||
for (i = 0; i < POCKET_NX; i++) {
|
||||
register int r = pocref[i];
|
||||
Pocket[i] = (r < 0) ? NULL : Vga->SpareQ->Locate(r);
|
||||
}
|
||||
@ -308,7 +308,7 @@ static void SaveGame(XFILE &file) {
|
||||
SPRITE *spr;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < POCKET_NX; i ++) {
|
||||
for (i = 0; i < POCKET_NX; i++) {
|
||||
register SPRITE *s = Pocket[i];
|
||||
pocref[i] = (s) ? s->Ref : -1;
|
||||
}
|
||||
@ -316,7 +316,7 @@ static void SaveGame(XFILE &file) {
|
||||
volume[0] = SNDDrvInfo.VOL2.D;
|
||||
volume[1] = SNDDrvInfo.VOL2.M;
|
||||
|
||||
for (st = SavTab; st->Ptr; st ++) {
|
||||
for (st = SavTab; st->Ptr; st++) {
|
||||
if (file.Error)
|
||||
error("Bad SVG");
|
||||
file.Write((uint8 *) st->Ptr, st->Len);
|
||||
@ -450,7 +450,7 @@ int WALK::Distance(SPRITE *spr) {
|
||||
dz = - dz;
|
||||
|
||||
dx = dx * dx + dz * dz;
|
||||
for (dz = 1; dz * dz < dx; dz ++)
|
||||
for (dz = 1; dz * dz < dx; dz++)
|
||||
;
|
||||
|
||||
return dz - 1;
|
||||
@ -485,7 +485,7 @@ void WALK::FindWay(CLUSTER c) {
|
||||
extern uint16 Target;
|
||||
|
||||
if (c != Here) {
|
||||
for (FindLevel = 1; FindLevel <= MAX_FIND_LEVEL; FindLevel ++) {
|
||||
for (FindLevel = 1; FindLevel <= MAX_FIND_LEVEL; FindLevel++) {
|
||||
signed char x, z;
|
||||
Here.Split(x, z);
|
||||
Target = (z << 8) | x;
|
||||
@ -653,7 +653,7 @@ static void PostMiniStep(int stp) {
|
||||
void SYSTEM::SetPal(void) {
|
||||
int i;
|
||||
DAC *p = SysPal + 256 - ArrayCount(StdPal);
|
||||
for (i = 0; i < ArrayCount(StdPal); i ++) {
|
||||
for (i = 0; i < ArrayCount(StdPal); i++) {
|
||||
p[i].R = StdPal[i].R >> 2;
|
||||
p[i].G = StdPal[i].G >> 2;
|
||||
p[i].B = StdPal[i].B >> 2;
|
||||
@ -1084,9 +1084,9 @@ static void TakeName(void) {
|
||||
static void SwitchMapping(void) {
|
||||
if (HorzLine->Flags.Hide) {
|
||||
int i;
|
||||
for (i = 0; i < MAP_ZCNT; i ++) {
|
||||
for (i = 0; i < MAP_ZCNT; i++) {
|
||||
int j;
|
||||
for (j = 0; j < MAP_XCNT; j ++) {
|
||||
for (j = 0; j < MAP_XCNT; j++) {
|
||||
if (CLUSTER::Map[i][j])
|
||||
SetMapBrick(j, i);
|
||||
}
|
||||
@ -1311,7 +1311,7 @@ void SPRITE::Touch(uint16 mask, int x, int y) {
|
||||
if ((mask & L_UP) && Snail->Idle()) {
|
||||
if (Flags.Kept) {
|
||||
int n;
|
||||
for (n = 0; n < POCKET_NX; n ++) {
|
||||
for (n = 0; n < POCKET_NX; n++) {
|
||||
if (Pocket[n] == this) {
|
||||
SelectPocket(n);
|
||||
break;
|
||||
@ -1436,7 +1436,7 @@ static void LoadSprite(const char *fname, int ref, int cav, int col = 0, int row
|
||||
l->By = 13;
|
||||
l->Cx = 300;
|
||||
l->Cy = 500;
|
||||
* (long *) &l->Dx = 0; // movex * cnt
|
||||
*(long *) &l->Dx = 0; // movex * cnt
|
||||
l->Goto(col, row);
|
||||
}
|
||||
Sprite = l;
|
||||
|
@ -161,7 +161,7 @@ void SelectSound(void) {
|
||||
SNPOST_(SNKILL, -1, 0, VMENU::Addr);
|
||||
Inf(Text->getText(STYPE_TEXT));
|
||||
Talk->Goto(Talk->X, FONT_HIG / 2);
|
||||
for (i = 0; i < ArrayCount(DevName); i ++)
|
||||
for (i = 0; i < ArrayCount(DevName); i++)
|
||||
DevMenu[i].Text = Text->getText(DevName[i]);
|
||||
(new VMENU(DevMenu, SCR_WID / 2, Talk->Y + Talk->H + TEXT_VM + FONT_HIG))->SetName(Text->getText(MENU_TEXT));
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ SaveStateList CGEMetaEngine::listSaves(const char *target) const {
|
||||
|
||||
SaveStateList saveList;
|
||||
int slotNum = 0;
|
||||
for (Common::StringArray::const_iterator filename = filenames.begin(); filename != filenames.end(); ++filename) {
|
||||
for (Common::StringArray::const_iterator filename = filenames.begin(); filename != filenames.end(); filename++) {
|
||||
// Obtain the last 3 digits of the filename, since they correspond to the save slot
|
||||
slotNum = atoi(filename->c_str() + filename->size() - 3);
|
||||
|
||||
|
@ -142,8 +142,8 @@ EMS *EMM::Alloc(uint16 siz) {
|
||||
if (cnt > 4)
|
||||
{
|
||||
top = (top + PAGE_MASK) & 0xFFFFC000L;
|
||||
++ pgn;
|
||||
-- cnt;
|
||||
pgn++;
|
||||
cnt--;
|
||||
}
|
||||
|
||||
if (size <= Lim - top)
|
||||
|
@ -35,7 +35,7 @@ uint8 *Glass(DAC *pal, uint8 r, uint8 g, uint8 b) {
|
||||
uint8 *x = new uint8[256];
|
||||
if (x) {
|
||||
uint16 i;
|
||||
for (i = 0; i < 256; i ++) {
|
||||
for (i = 0; i < 256; i++) {
|
||||
x[i] = Closest(pal, MkDAC(((uint16)(pal[i].R) * r) / 255,
|
||||
((uint16)(pal[i].G) * g) / 255,
|
||||
((uint16)(pal[i].B) * b) / 255));
|
||||
@ -50,7 +50,7 @@ uint8 *Mark(DAC *pal) {
|
||||
uint8 *x = new uint8[256];
|
||||
if (x) {
|
||||
uint16 i;
|
||||
for (i = 0; i < 256; i ++) {
|
||||
for (i = 0; i < 256; i++) {
|
||||
x[i] = Closest(pal, MkDAC(f(pal[i].R),
|
||||
f(pal[i].G),
|
||||
f(pal[i].B)));
|
||||
|
@ -127,7 +127,13 @@ char *ForceExt(char *buf, const char *nam, const char *ext) {
|
||||
// fnsplit(nam, dr, di, na, ex);
|
||||
// fnmerge(buf, dr, di, na, ext);
|
||||
// return buf;
|
||||
warning("STUB: ForceExt");
|
||||
warning("ForceExt");
|
||||
strcpy(buf, nam);
|
||||
char *dot = strrchr(buf, '.');
|
||||
if (dot)
|
||||
*dot = '\0';
|
||||
strcat(buf, ext);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
@ -143,24 +149,23 @@ unsigned FastRand(unsigned s) {
|
||||
}
|
||||
|
||||
uint16 RCrypt(void *buf, uint16 siz, uint16 seed) {
|
||||
/*
|
||||
if (buf && siz) {
|
||||
uint8 * q = BUF + (siz-1);
|
||||
seed = FastRand(seed);
|
||||
* (BUF ++) ^= seed;
|
||||
while (buf < q) * (BUF ++) ^= FastRand();
|
||||
if (buf == q) * BUF ^= (seed = FastRand());
|
||||
}
|
||||
return seed;
|
||||
*/
|
||||
warning("STUB: RCrypt");
|
||||
return 0;
|
||||
if (buf && siz) {
|
||||
byte *b = static_cast<byte *>(buf);
|
||||
byte *q = b + (siz - 1);
|
||||
seed = FastRand(seed);
|
||||
*b++ ^= seed;
|
||||
while (buf < q)
|
||||
*b++ ^= FastRand();
|
||||
if (buf == q)
|
||||
*b ^= (seed = FastRand());
|
||||
}
|
||||
return seed;
|
||||
}
|
||||
|
||||
uint16 XCrypt(void *buf, uint16 siz, uint16 seed) {
|
||||
byte *b = static_cast<byte *>(buf);
|
||||
|
||||
for (uint16 i = 0; i < siz; i ++)
|
||||
for (uint16 i = 0; i < siz; i++)
|
||||
*b++ ^= seed;
|
||||
|
||||
return seed;
|
||||
@ -170,7 +175,7 @@ uint16 atow(const char *a) {
|
||||
uint16 w = 0;
|
||||
if (a)
|
||||
while (IsDigit(*a))
|
||||
w = (10 * w) + (*(a ++) & 0xF);
|
||||
w = (10 * w) + (*(a++) & 0xF);
|
||||
return w;
|
||||
}
|
||||
|
||||
@ -178,7 +183,7 @@ uint16 xtow(const char *x) {
|
||||
uint16 w = 0;
|
||||
if (x) {
|
||||
while (IsHxDig(*x)) {
|
||||
register uint16 d = * (x ++);
|
||||
register uint16 d = *(x++);
|
||||
if (d > '9')
|
||||
d -= 'A' - ('9' + 1);
|
||||
w = (w << 4) | (d & 0xF);
|
||||
@ -327,7 +332,7 @@ DATACK *LoadWave(XFILE *file, EMM *emm) {
|
||||
int TakeEnum(const char **tab, const char *txt) {
|
||||
const char **e;
|
||||
if (txt) {
|
||||
for (e = tab; *e; e ++) {
|
||||
for (e = tab; *e; e++) {
|
||||
if (scumm_stricmp(txt, *e) == 0) {
|
||||
return e - tab;
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ void GET_TEXT::Touch(uint16 mask, int x, int y) {
|
||||
case Enter :
|
||||
Buff[Len] = '\0';
|
||||
strcpy(Text, Buff);
|
||||
for (p = Text; *p; p ++) {
|
||||
for (p = Text; *p; p++) {
|
||||
char *q = strchr(ogon, *p);
|
||||
if (q)
|
||||
*p = bezo[q - ogon];
|
||||
@ -110,7 +110,7 @@ void GET_TEXT::Touch(uint16 mask, int x, int y) {
|
||||
if (Len < Size && 2 * TEXT_HM + Font->Width(Buff) + Font->Wid[x] <= W) {
|
||||
Buff[Len + 2] = Buff[Len + 1];
|
||||
Buff[Len + 1] = Buff[Len];
|
||||
Buff[Len ++] = x;
|
||||
Buff[Len++] = x;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -57,7 +57,7 @@ namespace CGE {
|
||||
#define IsHxDig(c) (IsDigit(c) || ((c) >= 'A' && (c) <= 'F') || ((c) >= 'a' && (c) <= 'f'))
|
||||
|
||||
#define farnew(t,n) ((t *) malloc(sizeof(t) * (n)))
|
||||
#define ArrayCount(a) (sizeof(a)/sizeof((a)[0]))
|
||||
#define ArrayCount(a) (sizeof(a) / sizeof((a)[0]))
|
||||
#define MAX_TIMER 0x1800B0L
|
||||
|
||||
typedef void (MouseFunType)(void);
|
||||
@ -66,8 +66,8 @@ typedef void (MouseFunType)(void);
|
||||
#define Hi(d) (((int *) &d)[1])
|
||||
#define LoWord(d) ((uint16) Lo(d))
|
||||
#define HiWord(d) ((uint16) Hi(d))
|
||||
#define K(n) (1024*(n))
|
||||
#define MASK(n) ((1<<n)-1)
|
||||
#define K(n) (1024 * (n))
|
||||
#define MASK(n) ((1 << n) - 1)
|
||||
|
||||
typedef enum {
|
||||
NoKey = 0, CtrlA, CtrlB, CtrlC, CtrlD, CtrlE, CtrlF, CtrlG, CtrlH,
|
||||
@ -135,10 +135,10 @@ struct KeyStatStruct {
|
||||
#define CGA_Cursor 0x0607
|
||||
#define OFF_Cursor 0x2000
|
||||
|
||||
#define TimerCount (* ((volatile long *) ((void _seg *) 0x40 + (void *) 0x6C)))
|
||||
#define KeyStat (* ((volatile struct KeyStatStruct *) ((void _seg *) 0x40 + (void *) 0x17)))
|
||||
#define BreakFlag (* ((volatile uint8 *) ((void _seg *) 0x40 + (void *) 0x71)))
|
||||
#define PostFlag (* ((volatile uint16 *) ((void _seg *) 0x40 + (void *) 0x72)))
|
||||
#define TimerCount (*((volatile long *) ((void _seg *) 0x40 + (void *) 0x6C)))
|
||||
#define KeyStat (*((volatile struct KeyStatStruct *) ((void _seg *) 0x40 + (void *) 0x17)))
|
||||
#define BreakFlag (*((volatile uint8 *) ((void _seg *) 0x40 + (void *) 0x71)))
|
||||
#define PostFlag (*((volatile uint16 *) ((void _seg *) 0x40 + (void *) 0x72)))
|
||||
#define POST ((void (*)(void)) ((void _seg *) 0xF000 + (void *) 0xFFF0))
|
||||
|
||||
#ifdef DEMO
|
||||
|
@ -55,7 +55,7 @@ MIXER::MIXER(int x, int y) : SPRITE(NULL), Fall(MIX_FALL) {
|
||||
// slaves
|
||||
|
||||
int i;
|
||||
for (i = 0; i < MIX_MAX; i ++) {
|
||||
for (i = 0; i < MIX_MAX; i++) {
|
||||
static char fn[] = "V00";
|
||||
wtom(i, fn + 1, 10, 2);
|
||||
lb[i] = new BITMAP(fn);
|
||||
@ -64,7 +64,7 @@ MIXER::MIXER(int x, int y) : SPRITE(NULL), Fall(MIX_FALL) {
|
||||
}
|
||||
lb[i] = NULL;
|
||||
|
||||
for (i = 0; i < ArrayCount(Led); i ++) {
|
||||
for (i = 0; i < ArrayCount(Led); i++) {
|
||||
register SPRITE *spr = new SPRITE(lb);
|
||||
spr->SetSeq(ls);
|
||||
spr->Goto(x + 2 + 12 * i, y + 8);
|
||||
@ -77,7 +77,7 @@ MIXER::MIXER(int x, int y) : SPRITE(NULL), Fall(MIX_FALL) {
|
||||
Led[ArrayCount(Led) - 1]->Flags.BDel = true;
|
||||
|
||||
Vga->ShowQ->Insert(this);
|
||||
for (i = 0; i < ArrayCount(Led); i ++)
|
||||
for (i = 0; i < ArrayCount(Led); i++)
|
||||
Vga->ShowQ->Insert(Led[i]);
|
||||
|
||||
//--- reset balance
|
||||
@ -124,7 +124,7 @@ void MIXER::Tick(void) {
|
||||
if (Fall)
|
||||
--Fall;
|
||||
else {
|
||||
for (int i = 0; i < ArrayCount(Led); i ++)
|
||||
for (int i = 0; i < ArrayCount(Led); i++)
|
||||
SNPOST_(SNKILL, -1, 0, Led[i]);
|
||||
SNPOST_(SNKILL, -1, 0, this);
|
||||
}
|
||||
|
@ -288,7 +288,7 @@ void ContractSprite(SPRITE *spr) {
|
||||
}
|
||||
|
||||
int FindPocket(SPRITE *spr) {
|
||||
for (int i = 0; i < POCKET_NX; i ++)
|
||||
for (int i = 0; i < POCKET_NX; i++)
|
||||
if (Pocket[i] == spr)
|
||||
return i;
|
||||
return -1;
|
||||
@ -346,7 +346,7 @@ void FeedSnail(SPRITE *spr, SNLIST snq) {
|
||||
|
||||
if (FindPocket(NULL) < 0) { // no empty pockets?
|
||||
SNAIL::COM *p;
|
||||
for (p = c; p->Com != SNNEXT; p ++) { // find KEEP command
|
||||
for (p = c; p->Com != SNNEXT; p++) { // find KEEP command
|
||||
if (p->Com == SNKEEP) {
|
||||
PocFul();
|
||||
return;
|
||||
@ -439,7 +439,7 @@ SNAIL::~SNAIL(void) {
|
||||
|
||||
void SNAIL::AddCom(SNCOM com, int ref, int val, void *ptr) {
|
||||
_disable();
|
||||
COM *snc = &SNList[Head ++];
|
||||
COM *snc = &SNList[Head++];
|
||||
snc->Com = com;
|
||||
snc->Ref = ref;
|
||||
snc->Val = val;
|
||||
@ -850,7 +850,7 @@ void SNFlash(bool on) {
|
||||
DAC *pal = farnew(DAC, PAL_CNT);
|
||||
if (pal) {
|
||||
memcpy(pal, SysPal, PAL_SIZ);
|
||||
for (int i = 0; i < PAL_CNT; i ++) {
|
||||
for (int i = 0; i < PAL_CNT; i++) {
|
||||
register int c;
|
||||
c = pal[i].R << 1;
|
||||
pal[i].R = (c < 64) ? c : 63;
|
||||
|
@ -82,7 +82,7 @@ void SOUND::Stop(void) {
|
||||
|
||||
FX::FX(int size) : Emm(0L), Current(NULL) {
|
||||
Cache = new HAN[size];
|
||||
for (Size = 0; Size < size; Size ++) {
|
||||
for (Size = 0; Size < size; Size++) {
|
||||
Cache[Size].Ref = 0;
|
||||
Cache[Size].Wav = NULL;
|
||||
}
|
||||
@ -97,7 +97,7 @@ FX::~FX(void) {
|
||||
|
||||
void FX::Clear(void) {
|
||||
HAN *p, * q;
|
||||
for (p = Cache, q = p + Size; p < q; p ++) {
|
||||
for (p = Cache, q = p + Size; p < q; p++) {
|
||||
if (p->Ref) {
|
||||
p->Ref = 0;
|
||||
delete p->Wav;
|
||||
@ -112,7 +112,7 @@ void FX::Clear(void) {
|
||||
int FX::Find(int ref) {
|
||||
HAN *p, * q;
|
||||
int i = 0;
|
||||
for (p = Cache, q = p + Size; p < q; p ++) {
|
||||
for (p = Cache, q = p + Size; p < q; p++) {
|
||||
if (p->Ref == ref)
|
||||
break;
|
||||
else
|
||||
@ -126,7 +126,7 @@ void FX::Preload(int ref0) {
|
||||
HAN *CacheLim = Cache + Size;
|
||||
int ref;
|
||||
|
||||
for (ref = ref0; ref < ref0 + 10; ref ++) {
|
||||
for (ref = ref0; ref < ref0 + 10; ref++) {
|
||||
static char fname[] = "FX00000.WAV";
|
||||
wtom(ref, fname + 2, 10, 5);
|
||||
INI_FILE file = INI_FILE(fname);
|
||||
|
@ -66,7 +66,7 @@ void FONT::Load(void) {
|
||||
f.Read(Wid, WID_SIZ);
|
||||
if (! f.Error) {
|
||||
uint16 i, p = 0;
|
||||
for (i = 0; i < POS_SIZ; i ++) {
|
||||
for (i = 0; i < POS_SIZ; i++) {
|
||||
Pos[i] = p;
|
||||
p += Wid[i];
|
||||
}
|
||||
@ -80,7 +80,7 @@ uint16 FONT::Width(const char *text) {
|
||||
uint16 w = 0;
|
||||
if (text)
|
||||
while (* text)
|
||||
w += Wid[*(text ++)];
|
||||
w += Wid[*(text++)];
|
||||
return w;
|
||||
}
|
||||
|
||||
@ -91,7 +91,7 @@ void FONT::Save(void) {
|
||||
if (! f.Error) {
|
||||
f.Write(Wid, WID_SIZ);
|
||||
if (! f.Error)
|
||||
f.Write(Map, Pos[POS_SIZ-1] + Wid[WID_SIZ-1]);
|
||||
f.Write(Map, Pos[POS_SIZ - 1] + Wid[WID_SIZ - 1]);
|
||||
}
|
||||
}
|
||||
*/
|
||||
@ -115,7 +115,7 @@ TALK::TALK(void)
|
||||
|
||||
/*
|
||||
TALK::~TALK (void) {
|
||||
for (uint16 i = 0; i < ShpCnt; i ++) {
|
||||
for (uint16 i = 0; i < ShpCnt; i++) {
|
||||
if (FP_SEG(ShpList[i]) != _DS) { // small model: always false
|
||||
delete ShpList[i];
|
||||
ShpList[i] = NULL;
|
||||
@ -135,7 +135,7 @@ void TALK::Update(const char *tx) {
|
||||
if (!TS[0]) {
|
||||
uint16 k = 2 * hmarg;
|
||||
mh = 2 * vmarg + FONT_HIG;
|
||||
for (p = tx; *p; p ++) {
|
||||
for (p = tx; *p; p++) {
|
||||
if (*p == '|' || *p == '\n') {
|
||||
mh += FONT_HIG + TEXT_LS;
|
||||
if (k > mw)
|
||||
@ -203,9 +203,9 @@ BITMAP *TALK::Box(uint16 w, uint16 h) {
|
||||
*p = LGRAY;
|
||||
}
|
||||
p = b;
|
||||
for (int i = 0; i < r; i ++) {
|
||||
for (int i = 0; i < r; i++) {
|
||||
int j;
|
||||
for (j = 0; j < r - i; j ++) {
|
||||
for (j = 0; j < r - i; j++) {
|
||||
p[j] = TRANS;
|
||||
p[w - j - 1] = TRANS;
|
||||
q[j] = TRANS;
|
||||
@ -256,10 +256,10 @@ void TALK::PutLine(int line, const char *text) {
|
||||
uint16 cw = Font->Wid[*text], i;
|
||||
uint8 *fp = Font->Map + Font->Pos[*text];
|
||||
|
||||
for (i = 0; i < cw; i ++) {
|
||||
for (i = 0; i < cw; i++) {
|
||||
register uint16 b = fp[i];
|
||||
uint16 n;
|
||||
for (n = 0; n < FONT_HIG; n ++) {
|
||||
for (n = 0; n < FONT_HIG; n++) {
|
||||
if (b & 1)
|
||||
*p = TEXT_FG;
|
||||
b >>= 1;
|
||||
@ -293,7 +293,7 @@ void INFO_LINE::Update(const char *tx) {
|
||||
// claer whole rectangle
|
||||
memset(v + 2, TEXT_BG, dsiz); // data bytes
|
||||
memcpy(v + lsiz, v, psiz - lsiz); // tricky replicate lines
|
||||
* (uint16 *)(v + psiz - 2) = EOI; // plane trailer uint16
|
||||
*(uint16 *)(v + psiz - 2) = EOI; // plane trailer uint16
|
||||
memcpy(v + psiz, v, 3 * psiz); // tricky replicate planes
|
||||
|
||||
// paint text line
|
||||
@ -306,7 +306,7 @@ void INFO_LINE::Update(const char *tx) {
|
||||
|
||||
for (uint16 i = 0; i < cw; i++) {
|
||||
register uint16 b = fp[i];
|
||||
for (uint16 n = 0; n < FONT_HIG; n ++) {
|
||||
for (uint16 n = 0; n < FONT_HIG; n++) {
|
||||
if (b & 1)
|
||||
*p = TEXT_FG;
|
||||
b >>= 1;
|
||||
|
@ -48,7 +48,7 @@ TEXT::TEXT(const char *fname, int size) {
|
||||
if (!INI_FILE::Exist(FileName))
|
||||
error("No talk (%s)\n", FileName);
|
||||
|
||||
for (Size = 0; Size < size; Size ++) {
|
||||
for (Size = 0; Size < size; Size++) {
|
||||
Cache[Size].Ref = 0;
|
||||
Cache[Size].Txt = NULL;
|
||||
}
|
||||
@ -63,7 +63,7 @@ TEXT::~TEXT(void) {
|
||||
|
||||
void TEXT::Clear(int from, int upto) {
|
||||
HAN *p, * q;
|
||||
for (p = Cache, q = p + Size; p < q; p ++) {
|
||||
for (p = Cache, q = p + Size; p < q; p++) {
|
||||
if (p->Ref && p->Ref >= from && p->Ref < upto) {
|
||||
p->Ref = 0;
|
||||
delete p->Txt;
|
||||
@ -76,7 +76,7 @@ void TEXT::Clear(int from, int upto) {
|
||||
int TEXT::Find(int ref) {
|
||||
HAN *p, * q;
|
||||
int i = 0;
|
||||
for (p = Cache, q = p + Size; p < q; p ++) {
|
||||
for (p = Cache, q = p + Size; p < q; p++) {
|
||||
if (p->Ref == ref)
|
||||
break;
|
||||
else
|
||||
|
@ -233,14 +233,16 @@ extern "C" void TimerProc (void)
|
||||
|
||||
// decrement external timer uint16
|
||||
if (Heart->XTimer)
|
||||
if (*Heart->XTimer) -- *Heart->XTimer;
|
||||
else Heart->XTimer = NULL;
|
||||
if (*Heart->XTimer)
|
||||
*Heart->XTimer--;
|
||||
else
|
||||
Heart->XTimer = NULL;
|
||||
|
||||
if (! run && Heart->Enable) // check overrun flag
|
||||
{
|
||||
static uint16 oldSP, oldSS;
|
||||
|
||||
++ run; // disable 2nd call until current lasts
|
||||
run++; // disable 2nd call until current lasts
|
||||
asm mov ax,ds
|
||||
asm mov oldSS,ss
|
||||
asm mov oldSP,sp
|
||||
@ -256,7 +258,7 @@ extern "C" void TimerProc (void)
|
||||
}
|
||||
asm mov ss,oldSS
|
||||
asm mov sp,oldSP
|
||||
-- run;
|
||||
run--;
|
||||
}
|
||||
}
|
||||
*/
|
||||
@ -297,14 +299,16 @@ void ENGINE::NewTimer(...) {
|
||||
|
||||
// decrement external timer uint16
|
||||
if (Heart->XTimer)
|
||||
if (*Heart->XTimer) -- *Heart->XTimer;
|
||||
else Heart->XTimer = NULL;
|
||||
if (*Heart->XTimer)
|
||||
*Heart->XTimer--;
|
||||
else
|
||||
Heart->XTimer = NULL;
|
||||
|
||||
if (! run && Heart->Enable) // check overrun flag
|
||||
{
|
||||
static uint16 oldSP, oldSS;
|
||||
|
||||
++ run; // disable 2nd call until current lasts
|
||||
run++; // disable 2nd call until current lasts
|
||||
asm mov ax,ds
|
||||
asm mov oldSS,ss
|
||||
asm mov oldSP,sp
|
||||
@ -320,7 +324,7 @@ void ENGINE::NewTimer(...) {
|
||||
}
|
||||
asm mov ss,oldSS
|
||||
asm mov sp,oldSP
|
||||
-- run;
|
||||
run--;
|
||||
}
|
||||
|
||||
*/
|
||||
@ -402,7 +406,7 @@ BMP_PTR *SPRITE::SetShapeList(BMP_PTR *shp) {
|
||||
|
||||
void SPRITE::MoveShapes(uint8 *buf) {
|
||||
BMP_PTR *p;
|
||||
for (p = Ext->ShpList; *p; p ++) {
|
||||
for (p = Ext->ShpList; *p; p++) {
|
||||
buf += (*p)->MoveVmap(buf);
|
||||
}
|
||||
}
|
||||
@ -507,14 +511,14 @@ SPRITE *SPRITE::Expand(void) {
|
||||
break;
|
||||
}
|
||||
case 1 : { // Phase
|
||||
shplist[shpcnt ++] = new BITMAP(strtok(NULL, " \t,;/"));
|
||||
shplist[shpcnt++] = new BITMAP(strtok(NULL, " \t,;/"));
|
||||
break;
|
||||
}
|
||||
case 2 : { // Seq
|
||||
seq = (SEQ *) realloc(seq, (seqcnt + 1) * sizeof(*seq));
|
||||
if (seq == NULL)
|
||||
error("No core [%s]", fname);
|
||||
SEQ *s = &seq[seqcnt ++];
|
||||
SEQ *s = &seq[seqcnt++];
|
||||
s->Now = atoi(strtok(NULL, " \t,;/"));
|
||||
if (s->Now > maxnow)
|
||||
maxnow = s->Now;
|
||||
@ -540,7 +544,7 @@ SPRITE *SPRITE::Expand(void) {
|
||||
if (nea == NULL)
|
||||
error("No core [%s]", fname);
|
||||
else {
|
||||
SNAIL::COM *c = &nea[neacnt ++];
|
||||
SNAIL::COM *c = &nea[neacnt++];
|
||||
if ((c->Com = (SNCOM) TakeEnum(SNAIL::ComTxt, strtok(NULL, " \t,;/"))) < 0)
|
||||
error("%s [%s]", NumStr("Bad NEAR in ######", lcnt), fname);
|
||||
c->Ref = atoi(strtok(NULL, " \t,;/"));
|
||||
@ -556,7 +560,7 @@ SPRITE *SPRITE::Expand(void) {
|
||||
if (tak == NULL)
|
||||
error("No core [%s]", fname);
|
||||
else {
|
||||
SNAIL::COM *c = &tak[takcnt ++];
|
||||
SNAIL::COM *c = &tak[takcnt++];
|
||||
if ((c->Com = (SNCOM) TakeEnum(SNAIL::ComTxt, strtok(NULL, " \t,;/"))) < 0)
|
||||
error("%s [%s]", NumStr("Bad NEAR in ######", lcnt), fname);
|
||||
c->Ref = atoi(strtok(NULL, " \t,;/"));
|
||||
@ -569,7 +573,7 @@ SPRITE *SPRITE::Expand(void) {
|
||||
}
|
||||
}
|
||||
} else { // no sprite description: try to read immediately from .BMP
|
||||
shplist[shpcnt ++] = new BITMAP(File);
|
||||
shplist[shpcnt++] = new BITMAP(File);
|
||||
}
|
||||
shplist[shpcnt] = NULL;
|
||||
if (seq) {
|
||||
@ -606,7 +610,7 @@ SPRITE *SPRITE::Contract(void) {
|
||||
delete[] e->Name;
|
||||
if (Flags.BDel && e->ShpList) {
|
||||
int i;
|
||||
for (i = 0; e->ShpList[i]; i ++)
|
||||
for (i = 0; e->ShpList[i]; i++)
|
||||
delete e->ShpList[i];
|
||||
if (MemType(e->ShpList) == NEAR_MEM)
|
||||
delete[] e->ShpList;
|
||||
@ -662,7 +666,7 @@ void SPRITE::MakeXlat(uint8 *x) {
|
||||
|
||||
if (Flags.Xlat)
|
||||
KillXlat();
|
||||
for (b = Ext->ShpList; *b; b ++)
|
||||
for (b = Ext->ShpList; *b; b++)
|
||||
(*b)->M = x;
|
||||
Flags.Xlat = true;
|
||||
}
|
||||
@ -682,7 +686,7 @@ void SPRITE::KillXlat(void) {
|
||||
free(m);
|
||||
break;
|
||||
}
|
||||
for (b = Ext->ShpList; *b; b ++)
|
||||
for (b = Ext->ShpList; *b; b++)
|
||||
(*b)->M = NULL;
|
||||
Flags.Xlat = false;
|
||||
}
|
||||
@ -908,7 +912,7 @@ VGA::VGA(int mode)
|
||||
|
||||
bool std = true;
|
||||
int i;
|
||||
for (i = 10; i < 20; i ++) {
|
||||
for (i = 10; i < 20; i++) {
|
||||
char *txt = Text->getText(i);
|
||||
if (txt) {
|
||||
// puts(txt);
|
||||
@ -1293,9 +1297,9 @@ void BITMAP::XShow(int x, int y) {
|
||||
/*
|
||||
uint8 rmsk = x % 4,
|
||||
mask = 1 << rmsk,
|
||||
* scr = VGA::Page[1] + y * (SCR_WID / 4) + x / 4;
|
||||
uint8 * m = (char *) M;
|
||||
uint8 * v = V;
|
||||
*scr = VGA::Page[1] + y * (SCR_WID / 4) + x / 4;
|
||||
uint8 *m = (char *) M;
|
||||
uint8 *v = V;
|
||||
|
||||
asm push bx
|
||||
asm push si
|
||||
@ -1374,8 +1378,8 @@ void BITMAP::XShow(int x, int y) {
|
||||
void BITMAP::Show(int x, int y) {
|
||||
/*
|
||||
uint8 mask = 1 << (x & 3),
|
||||
* scr = VGA::Page[1] + y * (SCR_WID >> 2) + (x >> 2);
|
||||
uint8 * v = V;
|
||||
*scr = VGA::Page[1] + y * (SCR_WID >> 2) + (x >> 2);
|
||||
uint8 *v = V;
|
||||
|
||||
asm push ds // preserve DS
|
||||
|
||||
@ -1443,9 +1447,9 @@ void BITMAP::Show(int x, int y) {
|
||||
|
||||
void BITMAP::Hide(int x, int y) {
|
||||
/*
|
||||
uint8 * scr = VGA::Page[1] + y * (SCR_WID / 4) + x / 4;
|
||||
uint8 *scr = VGA::Page[1] + y * (SCR_WID / 4) + x / 4;
|
||||
uint16 d = FP_OFF(VGA::Page[2]) - FP_OFF(VGA::Page[1]);
|
||||
HideDesc * b = B;
|
||||
HideDesc *b = B;
|
||||
uint16 extra = ((x & 3) != 0);
|
||||
uint16 h = H;
|
||||
|
||||
|
@ -294,7 +294,7 @@ uint8 Closest(CBLK *pal, CBLK x) {
|
||||
if (!L)
|
||||
++L;
|
||||
uint16 R = f(x.R, L), G = f(x.G, L), B = f(x.B, L);
|
||||
for (i = 0; i < 256; i ++) {
|
||||
for (i = 0; i < 256; i++) {
|
||||
uint16 l = pal[i].R + pal[i].G + pal[i].B;
|
||||
if (! l)
|
||||
++l;
|
||||
|
@ -54,7 +54,7 @@ MENU_BAR::MENU_BAR(uint16 w) {
|
||||
memset(p + i - w, MB_RB, w);
|
||||
p1 = p;
|
||||
p2 = p + i - 1;
|
||||
for (i = 0; i < h; i ++) {
|
||||
for (i = 0; i < h; i++) {
|
||||
*p1 = MB_LT;
|
||||
*p2 = MB_RB;
|
||||
p1 += w;
|
||||
@ -76,14 +76,14 @@ char *VMGather(CHOICE *list) {
|
||||
CHOICE *cp;
|
||||
int len = 0, h = 0;
|
||||
|
||||
for (cp = list; cp->Text; cp ++) {
|
||||
for (cp = list; cp->Text; cp++) {
|
||||
len += strlen(cp->Text);
|
||||
++h;
|
||||
}
|
||||
vmgt = new char[len + h];
|
||||
if (vmgt) {
|
||||
*vmgt = '\0';
|
||||
for (cp = list; cp->Text; cp ++) {
|
||||
for (cp = list; cp->Text; cp++) {
|
||||
if (*vmgt)
|
||||
strcat(vmgt, "|");
|
||||
strcat(vmgt, cp->Text);
|
||||
@ -105,7 +105,7 @@ VMENU::VMENU(CHOICE *list, int x, int y)
|
||||
Addr = this;
|
||||
delete[] vmgt;
|
||||
Items = 0;
|
||||
for (cp = list; cp->Text; cp ++)
|
||||
for (cp = list; cp->Text; cp++)
|
||||
++Items;
|
||||
Flags.BDel = true;
|
||||
Flags.Kill = true;
|
||||
|
Loading…
Reference in New Issue
Block a user