aboutsummaryrefslogtreecommitdiff
path: root/akos.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'akos.cpp')
-rw-r--r--akos.cpp734
1 files changed, 402 insertions, 332 deletions
diff --git a/akos.cpp b/akos.cpp
index 54db7e3c6e..b5a444bc43 100644
--- a/akos.cpp
+++ b/akos.cpp
@@ -22,16 +22,17 @@
#include "stdafx.h"
#include "scumm.h"
-bool Scumm::akos_hasManyDirections(Actor *a) {
- if (_features & GF_NEW_COSTUMES) {
+bool Scumm::akos_hasManyDirections(Actor * a)
+{
+ if (_features & GF_NEW_COSTUMES) {
byte *akos;
AkosHeader *akhd;
akos = getResourceAddress(rtCostume, a->costume);
assert(akos);
- akhd = (AkosHeader*)findResourceData(MKID('AKHD'), akos);
- return (akhd->flags&2) != 0;
+ akhd = (AkosHeader *) findResourceData(MKID('AKHD'), akos);
+ return (akhd->flags & 2) != 0;
}
return 0;
}
@@ -41,50 +42,50 @@ int Scumm::akos_findManyDirection(int16 ManyDirection, uint16 facing)
int32 direction;
int32 temp;
- temp=many_direction_tab[ManyDirection];
- direction=temp + ManyDirection * 8;
- do{
- if(facing>=many_direction_tab[direction+1])
- {
- if(facing<=many_direction_tab[direction+2])
- {
- return(temp);
+ temp = many_direction_tab[ManyDirection];
+ direction = temp + ManyDirection * 8;
+ do {
+ if (facing >= many_direction_tab[direction + 1]) {
+ if (facing <= many_direction_tab[direction + 2]) {
+ return (temp);
}
}
-
+
--temp;
--direction;
-
- }while(temp);
- return(temp);
+ } while (temp);
+
+ return (temp);
}
-int Scumm::akos_frameToAnim(Actor *a, int frame) {
+int Scumm::akos_frameToAnim(Actor * a, int frame)
+{
bool ManyDirection;
ManyDirection = akos_hasManyDirections(a);
-
- if (ManyDirection){
- frame*=many_direction_tab[ManyDirection];
+
+ if (ManyDirection) {
+ frame *= many_direction_tab[ManyDirection];
return akos_findManyDirection(ManyDirection, a->facing) + frame;
} else {
return newDirToOldDir(a->facing) + frame * 4;
}
}
-void Scumm::akos_decodeData(Actor *a, int frame, uint usemask) {
+void Scumm::akos_decodeData(Actor * a, int frame, uint usemask)
+{
uint anim;
- byte *akos,*r;
+ byte *akos, *r;
AkosHeader *akhd;
uint offs;
int i;
byte code;
- uint16 start,len;
+ uint16 start, len;
uint16 mask;
-
- if (a->costume==0)
+
+ if (a->costume == 0)
return;
anim = akos_frameToAnim(a, frame);
@@ -92,27 +93,27 @@ void Scumm::akos_decodeData(Actor *a, int frame, uint usemask) {
akos = getResourceAddress(rtCostume, a->costume);
assert(akos);
- akhd = (AkosHeader*)findResourceData(MKID('AKHD'), akos);
+ akhd = (AkosHeader *) findResourceData(MKID('AKHD'), akos);
- if (anim>=READ_LE_UINT16(&akhd->num_anims))
+ if (anim >= READ_LE_UINT16(&akhd->num_anims))
return;
r = findResourceData(MKID('AKCH'), akos);
assert(r);
offs = READ_LE_UINT16(r + anim * sizeof(uint16));
- if (offs==0)
+ if (offs == 0)
return;
r += offs;
i = 0;
mask = READ_LE_UINT16(r);
- r+=sizeof(uint16);
+ r += sizeof(uint16);
do {
- if (mask&0x8000) {
+ if (mask & 0x8000) {
code = *r++;
- if (usemask&0x8000) {
- switch(code) {
+ if (usemask & 0x8000) {
+ switch (code) {
case 1:
a->cost.active[i] = 0;
a->cost.frame[i] = frame;
@@ -121,15 +122,15 @@ void Scumm::akos_decodeData(Actor *a, int frame, uint usemask) {
a->cost.curpos[i] = 0;
break;
case 4:
- a->cost.stopped |= 1<<i;
+ a->cost.stopped |= 1 << i;
break;
case 5:
- a->cost.stopped &= ~(1<<i);
+ a->cost.stopped &= ~(1 << i);
break;
default:
start = READ_LE_UINT16(r);
- len = READ_LE_UINT16(r+sizeof(uint16));
- r+=sizeof(uint16)*2;
+ len = READ_LE_UINT16(r + sizeof(uint16));
+ r += sizeof(uint16) * 2;
a->cost.active[i] = code;
a->cost.frame[i] = frame;
@@ -139,17 +140,18 @@ void Scumm::akos_decodeData(Actor *a, int frame, uint usemask) {
break;
}
} else {
- if (code!=1 && code!=4 && code!=5)
- r+=sizeof(uint16)*2;
+ if (code != 1 && code != 4 && code != 5)
+ r += sizeof(uint16) * 2;
}
}
i++;
- mask<<=1;
- usemask<<=1;
+ mask <<= 1;
+ usemask <<= 1;
} while ((uint16)mask);
}
-void Scumm::akos_setPalette(AkosRenderer *ar, byte *palette) {
+void Scumm::akos_setPalette(AkosRenderer * ar, byte *palette)
+{
byte *akpl;
uint size, i;
@@ -159,17 +161,18 @@ void Scumm::akos_setPalette(AkosRenderer *ar, byte *palette) {
if (size > 256)
error("akos_setPalette: %d is too many colors", size);
- for(i=0; i<size; i++) {
- ar->palette[i] = palette[i]!=0xFF ? palette[i] : akpl[i];
+ for (i = 0; i < size; i++) {
+ ar->palette[i] = palette[i] != 0xFF ? palette[i] : akpl[i];
}
}
-void Scumm::akos_setCostume(AkosRenderer *ar, int costume) {
+void Scumm::akos_setCostume(AkosRenderer * ar, int costume)
+{
ar->akos = getResourceAddress(rtCostume, costume);
assert(ar->akos);
- ar->akhd = (AkosHeader*)findResourceData(MKID('AKHD'), ar->akos);
- ar->akof = (AkosOffset*)findResourceData(MKID('AKOF'), ar->akos);
+ ar->akhd = (AkosHeader *) findResourceData(MKID('AKHD'), ar->akos);
+ ar->akof = (AkosOffset *) findResourceData(MKID('AKOF'), ar->akos);
ar->akci = findResourceData(MKID('AKCI'), ar->akos);
ar->aksq = findResourceData(MKID('AKSQ'), ar->akos);
ar->akcd = findResourceData(MKID('AKCD'), ar->akos);
@@ -177,58 +180,63 @@ void Scumm::akos_setCostume(AkosRenderer *ar, int costume) {
ar->codec = READ_LE_UINT16(&ar->akhd->codec);
}
-void Scumm::akos_setFacing(AkosRenderer *ar, Actor *a) {
- ar->mirror = (newDirToOldDir(a->facing)!=0 || ar->akhd->flags&1);
+void Scumm::akos_setFacing(AkosRenderer * ar, Actor * a)
+{
+ ar->mirror = (newDirToOldDir(a->facing) != 0 || ar->akhd->flags & 1);
if (a->flip)
ar->mirror ^= 1;
}
-bool Scumm::akos_drawCostume(AkosRenderer *ar) {
+bool Scumm::akos_drawCostume(AkosRenderer * ar)
+{
int i;
bool result = false;
ar->move_x = ar->move_y = 0;
- for(i=0; i<16; i++)
+ for (i = 0; i < 16; i++)
result |= akos_drawCostumeChannel(ar, i);
return result;
}
-bool Scumm::akos_drawCostumeChannel(AkosRenderer *ar, int chan) {
+bool Scumm::akos_drawCostumeChannel(AkosRenderer * ar, int chan)
+{
uint code;
byte *p;
AkosOffset *off;
AkosCI *akci;
- uint i,extra;
+ uint i, extra;
- if (!ar->cd->active[chan] || ar->cd->stopped&(1<<chan))
+ if (!ar->cd->active[chan] || ar->cd->stopped & (1 << chan))
return false;
p = ar->aksq + ar->cd->curpos[chan];
code = p[0];
- if (code & 0x80) code = (code<<8)|p[1];
+ if (code & 0x80)
+ code = (code << 8) | p[1];
- if (code==AKC_Return)
+ if (code == AKC_Return)
return false;
- if (code!=AKC_ComplexChan) {
+ if (code != AKC_ComplexChan) {
off = ar->akof + (code & 0xFFF);
- assert( (code & 0xFFF)*6 < READ_BE_UINT32_UNALIGNED((byte*)ar->akof - 4)-8 );
+ assert((code & 0xFFF) * 6 <
+ READ_BE_UINT32_UNALIGNED((byte *)ar->akof - 4) - 8);
- assert( (code&0x7000) == 0);
+ assert((code & 0x7000) == 0);
ar->srcptr = ar->akcd + READ_LE_UINT32(&off->akcd);
- akci = (AkosCI*)(ar->akci + READ_LE_UINT16(&off->akci));
+ akci = (AkosCI *) (ar->akci + READ_LE_UINT16(&off->akci));
- ar->move_x_cur = ar->move_x + (int16)READ_LE_UINT16(&akci->rel_x);
- ar->move_y_cur = ar->move_y + (int16)READ_LE_UINT16(&akci->rel_y);
+ ar->move_x_cur = ar->move_x + (int16) READ_LE_UINT16(&akci->rel_x);
+ ar->move_y_cur = ar->move_y + (int16) READ_LE_UINT16(&akci->rel_y);
ar->width = READ_LE_UINT16(&akci->width);
ar->height = READ_LE_UINT16(&akci->height);
- ar->move_x += (int16)READ_LE_UINT16(&akci->move_x);
- ar->move_y -= (int16)READ_LE_UINT16(&akci->move_y);
+ ar->move_x += (int16) READ_LE_UINT16(&akci->move_x);
+ ar->move_y -= (int16) READ_LE_UINT16(&akci->move_y);
- switch(ar->codec) {
+ switch (ar->codec) {
case 1:
akos_codec1(ar);
break;
@@ -243,25 +251,26 @@ bool Scumm::akos_drawCostumeChannel(AkosRenderer *ar, int chan) {
}
} else {
extra = p[2];
- p+=3;
+ p += 3;
- for(i=0; i!=extra; i++) {
+ for (i = 0; i != extra; i++) {
code = p[4];
- if (code&0x80) code = ((code&0xF)<<8)|p[5];
+ if (code & 0x80)
+ code = ((code & 0xF) << 8) | p[5];
off = ar->akof + code;
ar->srcptr = ar->akcd + READ_LE_UINT32(&off->akcd);
- akci = (AkosCI*)(ar->akci + READ_LE_UINT16(&off->akci));
+ akci = (AkosCI *) (ar->akci + READ_LE_UINT16(&off->akci));
- ar->move_x_cur = ar->move_x + (int16)READ_LE_UINT16(p+0);
- ar->move_y_cur = ar->move_y + (int16)READ_LE_UINT16(p+2);
-
- p += (p[4]&0x80) ? 6 : 5;
+ ar->move_x_cur = ar->move_x + (int16) READ_LE_UINT16(p + 0);
+ ar->move_y_cur = ar->move_y + (int16) READ_LE_UINT16(p + 2);
+
+ p += (p[4] & 0x80) ? 6 : 5;
ar->width = READ_LE_UINT16(&akci->width);
ar->height = READ_LE_UINT16(&akci->height);
- switch(ar->codec) {
+ switch (ar->codec) {
case 1:
akos_codec1(ar);
break;
@@ -280,8 +289,9 @@ bool Scumm::akos_drawCostumeChannel(AkosRenderer *ar, int chan) {
return true;
}
-void akos_c1_0y_decode(AkosRenderer *ar) {
- byte len,color;
+void akos_c1_0y_decode(AkosRenderer * ar)
+{
+ byte len, color;
byte *src, *dst;
int height;
uint y;
@@ -295,13 +305,15 @@ void akos_c1_0y_decode(AkosRenderer *ar) {
height = ar->height;
y = ar->v1.y;
- if (len) goto StartPos;
+ if (len)
+ goto StartPos;
do {
len = *src++;
- color = len>>ar->v1.shl;
+ color = len >> ar->v1.shl;
len &= ar->v1.mask;
- if (!len) len = *src++;
+ if (!len)
+ len = *src++;
do {
if (color && y < scrheight) {
@@ -317,15 +329,16 @@ void akos_c1_0y_decode(AkosRenderer *ar) {
height = ar->height;
y = ar->v1.y;
}
-StartPos:;
+ StartPos:;
} while (--len);
} while (1);
}
-void akos_generic_decode(AkosRenderer *ar) {
- byte *src,*dst;
- byte len,height, maskbit;
- uint y, color;
+void akos_generic_decode(AkosRenderer * ar)
+{
+ byte *src, *dst;
+ byte len, height, maskbit;
+ uint y, color;
const byte *scaleytab, *mask;
@@ -338,20 +351,24 @@ void akos_generic_decode(AkosRenderer *ar) {
height = ar->height;
scaleytab = &ar->v1.scaletable[ar->v1.tmp_y];
- maskbit = revBitMask[ar->v1.x&7];
- mask = ar->v1.mask_ptr + (ar->v1.x>>3);
+ maskbit = revBitMask[ar->v1.x & 7];
+ mask = ar->v1.mask_ptr + (ar->v1.x >> 3);
- if (len) goto StartPos;
+ if (len)
+ goto StartPos;
do {
len = *src++;
- color = len>>ar->v1.shl;
+ color = len >> ar->v1.shl;
len &= ar->v1.mask;
- if (!len) len = *src++;
-
+ if (!len)
+ len = *src++;
+
do {
if (*scaleytab++ < ar->scale_y) {
- if (color && y < ar->outheight && (!ar->v1.mask_ptr || !((mask[0]|mask[ar->v1.imgbufoffs]) & maskbit)) ) {
+ if (color && y < ar->outheight
+ && (!ar->v1.mask_ptr
+ || !((mask[0] | mask[ar->v1.imgbufoffs]) & maskbit))) {
*dst = ar->palette[color];
}
mask += 40;
@@ -359,34 +376,35 @@ void akos_generic_decode(AkosRenderer *ar) {
y++;
}
if (!--height) {
- if(!--ar->v1.skip_width)
+ if (!--ar->v1.skip_width)
return;
height = ar->height;
y = ar->v1.y;
scaleytab = &ar->v1.scaletable[ar->v1.tmp_y];
-
+
if (ar->v1.scaletable[ar->v1.tmp_x] < ar->scale_x) {
ar->v1.x += ar->v1.scaleXstep;
- if ((uint)ar->v1.x >= 320)
+ if ((uint) ar->v1.x >= 320)
return;
- maskbit = revBitMask[ar->v1.x&7];
+ maskbit = revBitMask[ar->v1.x & 7];
ar->v1.destptr += ar->v1.scaleXstep;
}
- mask = ar->v1.mask_ptr + (ar->v1.x>>3);
+ mask = ar->v1.mask_ptr + (ar->v1.x >> 3);
ar->v1.tmp_x += ar->v1.scaleXstep;
dst = ar->v1.destptr;
}
-StartPos:;
+ StartPos:;
} while (--len);
- } while(1);
+ } while (1);
}
-void akos_c1_spec1(AkosRenderer *ar) {
- byte *src,*dst;
- byte len,height,pcolor, maskbit;
- uint y, color;
+void akos_c1_spec1(AkosRenderer * ar)
+{
+ byte *src, *dst;
+ byte len, height, pcolor, maskbit;
+ uint y, color;
const byte *scaleytab, *mask;
@@ -399,22 +417,26 @@ void akos_c1_spec1(AkosRenderer *ar) {
height = ar->height;
scaleytab = &ar->v1.scaletable[ar->v1.tmp_y];
- maskbit = revBitMask[ar->v1.x&7];
- mask = ar->v1.mask_ptr + (ar->v1.x>>3);
+ maskbit = revBitMask[ar->v1.x & 7];
+ mask = ar->v1.mask_ptr + (ar->v1.x >> 3);
- if (len) goto StartPos;
+ if (len)
+ goto StartPos;
do {
len = *src++;
- color = len>>ar->v1.shl;
+ color = len >> ar->v1.shl;
len &= ar->v1.mask;
- if (!len) len = *src++;
-
+ if (!len)
+ len = *src++;
+
do {
if (*scaleytab++ < ar->scale_y) {
- if (color && y < ar->outheight && (!ar->v1.mask_ptr || !((mask[0]|mask[ar->v1.imgbufoffs]) & maskbit)) ) {
+ if (color && y < ar->outheight
+ && (!ar->v1.mask_ptr
+ || !((mask[0] | mask[ar->v1.imgbufoffs]) & maskbit))) {
pcolor = ar->palette[color];
- if (pcolor==13)
+ if (pcolor == 13)
pcolor = ar->shadow_table[*dst];
*dst = pcolor;
}
@@ -423,137 +445,138 @@ void akos_c1_spec1(AkosRenderer *ar) {
y++;
}
if (!--height) {
- if(!--ar->v1.skip_width)
+ if (!--ar->v1.skip_width)
return;
height = ar->height;
y = ar->v1.y;
scaleytab = &ar->v1.scaletable[ar->v1.tmp_y];
-
+
if (ar->v1.scaletable[ar->v1.tmp_x] < ar->scale_x) {
ar->v1.x += ar->v1.scaleXstep;
- if ((uint)ar->v1.x >= 320)
+ if ((uint) ar->v1.x >= 320)
return;
- maskbit = revBitMask[ar->v1.x&7];
+ maskbit = revBitMask[ar->v1.x & 7];
ar->v1.destptr += ar->v1.scaleXstep;
}
- mask = ar->v1.mask_ptr + (ar->v1.x>>3);
+ mask = ar->v1.mask_ptr + (ar->v1.x >> 3);
ar->v1.tmp_x += ar->v1.scaleXstep;
dst = ar->v1.destptr;
}
-StartPos:;
+ StartPos:;
} while (--len);
- } while(1);
+ } while (1);
}
const byte default_scale_table[768] = {
-0x00, 0x80, 0x40, 0xC0, 0x20, 0xA0, 0x60, 0xE0,
-0x10, 0x90, 0x50, 0xD0, 0x30, 0xB0, 0x70, 0xF0,
-0x08, 0x88, 0x48, 0xC8, 0x28, 0xA8, 0x68, 0xE8,
-0x18, 0x98, 0x58, 0xD8, 0x38, 0xB8, 0x78, 0xF8,
-0x04, 0x84, 0x44, 0xC4, 0x24, 0xA4, 0x64, 0xE4,
-0x14, 0x94, 0x54, 0xD4, 0x34, 0xB4, 0x74, 0xF4,
-0x0C, 0x8C, 0x4C, 0xCC, 0x2C, 0xAC, 0x6C, 0xEC,
-0x1C, 0x9C, 0x5C, 0xDC, 0x3C, 0xBC, 0x7C, 0xFC,
-0x02, 0x82, 0x42, 0xC2, 0x22, 0xA2, 0x62, 0xE2,
-0x12, 0x92, 0x52, 0xD2, 0x32, 0xB2, 0x72, 0xF2,
-0x0A, 0x8A, 0x4A, 0xCA, 0x2A, 0xAA, 0x6A, 0xEA,
-0x1A, 0x9A, 0x5A, 0xDA, 0x3A, 0xBA, 0x7A, 0xFA,
-0x06, 0x86, 0x46, 0xC6, 0x26, 0xA6, 0x66, 0xE6,
-0x16, 0x96, 0x56, 0xD6, 0x36, 0xB6, 0x76, 0xF6,
-0x0E, 0x8E, 0x4E, 0xCE, 0x2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 0x17, 0x97, 0x57, 0xD7, 0x37, 0xB7, 0x77, 0xF7,
+ 0x0F, 0x8F, 0x4F, 0xCF, 0x2F, 0xAF, 0x6F, 0xEF,
+ 0x1F, 0x9F, 0x5F, 0xDF, 0x3F, 0xBF, 0x7F, 0xFF,
};
-void Scumm::akos_codec1(AkosRenderer *ar) {
+void Scumm::akos_codec1(AkosRenderer * ar)
+{
int num_colors;
bool use_scaling;
- int i,j;
- int x,x_right,x_left,skip=0,tmp_x,tmp_y;
- int y,y_top,y_bottom;
+ int i, j;
+ int x, x_right, x_left, skip = 0, tmp_x, tmp_y;
+ int y, y_top, y_bottom;
bool y_clipping;
bool charsetmask;
bool masking;
@@ -565,23 +588,23 @@ void Scumm::akos_codec1(AkosRenderer *ar) {
/* Setup color decoding variables */
num_colors = getResourceDataSize(ar->akpl);
if (num_colors == 32) {
- ar->v1.mask = (1<<3)-1;
+ ar->v1.mask = (1 << 3) - 1;
ar->v1.shl = 3;
} else if (num_colors == 64) {
- ar->v1.mask = (1<<2)-1;
+ ar->v1.mask = (1 << 2) - 1;
ar->v1.shl = 2;
} else {
- ar->v1.mask = (1<<4)-1;
+ ar->v1.mask = (1 << 4) - 1;
ar->v1.shl = 4;
}
- use_scaling = (ar->scale_x!=0xFF) || (ar->scale_y!=0xFF);
+ use_scaling = (ar->scale_x != 0xFF) || (ar->scale_y != 0xFF);
x = ar->x;
y = ar->y;
if (use_scaling) {
-
+
/* Scale direction */
ar->v1.scaleXstep = -1;
if (ar->move_x_cur < 0) {
@@ -593,7 +616,7 @@ void Scumm::akos_codec1(AkosRenderer *ar) {
/* Adjust X position */
tmp_x = 0x180 - ar->move_x_cur;
j = tmp_x;
- for(i=0; i<ar->move_x_cur; i++) {
+ for (i = 0; i < ar->move_x_cur; i++) {
if (ar->v1.scaletable[j++] < ar->scale_x)
x -= ar->v1.scaleXstep;
}
@@ -601,7 +624,7 @@ void Scumm::akos_codec1(AkosRenderer *ar) {
x_left = x_right = x;
j = tmp_x;
- for(i=0,skip=0; i<ar->width; i++) {
+ for (i = 0, skip = 0; i < ar->width; i++) {
if (x_right < 0) {
skip++;
tmp_x = j;
@@ -614,7 +637,7 @@ void Scumm::akos_codec1(AkosRenderer *ar) {
/* Adjust X position */
tmp_x = 0x180 + ar->move_x_cur;
j = tmp_x;
- for(i=0; i<ar->move_x_cur; i++) {
+ for (i = 0; i < ar->move_x_cur; i++) {
if (ar->v1.scaletable[j++] < ar->scale_x)
x += ar->v1.scaleXstep;
}
@@ -622,18 +645,19 @@ void Scumm::akos_codec1(AkosRenderer *ar) {
x_left = x_right = x;
j = tmp_x;
- for(i=0,skip=0; i<ar->width; i++) {
+ for (i = 0, skip = 0; i < ar->width; i++) {
if (x_left >= (int)ar->outwidth) {
tmp_x = j;
skip++;
-
+
}
if (ar->v1.scaletable[j--] < ar->scale_x)
x_left--;
}
}
- if (skip) skip--;
+ if (skip)
+ skip--;
step = -1;
if (ar->move_y_cur < 0) {
@@ -642,14 +666,14 @@ void Scumm::akos_codec1(AkosRenderer *ar) {
}
tmp_y = 0x180 - ar->move_y_cur;
- for(i=0; i<ar->move_y_cur; i++) {
+ for (i = 0; i < ar->move_y_cur; i++) {
if (ar->v1.scaletable[tmp_y++] < ar->scale_y)
y -= step;
}
-
+
y_top = y_bottom = y;
tmp_y = 0x180 - ar->move_y_cur;
- for(i=0; i<ar->height; i++) {
+ for (i = 0; i < ar->height; i++) {
if (ar->v1.scaletable[tmp_y++] < ar->scale_y)
y_bottom++;
}
@@ -658,7 +682,7 @@ void Scumm::akos_codec1(AkosRenderer *ar) {
} else {
if (!ar->mirror)
ar->move_x_cur = -ar->move_x_cur;
-
+
x += ar->move_x_cur;
y += ar->move_y_cur;
@@ -680,12 +704,12 @@ void Scumm::akos_codec1(AkosRenderer *ar) {
ar->v1.tmp_x = tmp_x;
ar->v1.tmp_y = tmp_y;
ar->v1.skip_width = ar->width;
-
+
ar->v1.scaleXstep = -1;
if (ar->mirror)
ar->v1.scaleXstep = -ar->v1.scaleXstep;
- if ((uint)y_top >= (uint)ar->outheight || y_bottom <= 0)
+ if ((uint) y_top >= (uint) ar->outheight || y_bottom <= 0)
return;
if ((int)x_left >= (int)ar->outwidth || x_right <= 0)
@@ -693,7 +717,7 @@ void Scumm::akos_codec1(AkosRenderer *ar) {
ar->v1.replen = 0;
ar->v1.y_pitch = ar->height * ar->outwidth;
-
+
if (ar->mirror) {
ar->v1.y_pitch--;
if (!use_scaling)
@@ -726,17 +750,17 @@ void Scumm::akos_codec1(AkosRenderer *ar) {
ar->v1.x = x;
ar->v1.y = y;
- if (ar->v1.skip_width <= 0 || ar->height<=0)
+ if (ar->v1.skip_width <= 0 || ar->height <= 0)
return;
- updateDirtyRect(0, x_left, x_right, y_top, y_bottom, 1<<ar->dirty_id);
+ updateDirtyRect(0, x_left, x_right, y_top, y_bottom, 1 << ar->dirty_id);
- y_clipping = ((uint)y_bottom > ar->outheight || y_top < 0);
+ y_clipping = ((uint) y_bottom > ar->outheight || y_top < 0);
- if ( (uint)y_top > (uint)ar->outheight)
+ if ((uint) y_top > (uint) ar->outheight)
y_top = 0;
-
- if ( (uint) y_bottom > (uint)ar->outheight)
+
+ if ((uint) y_bottom > (uint) ar->outheight)
y_bottom = ar->outheight;
if (y_top < ar->draw_top)
@@ -744,7 +768,8 @@ void Scumm::akos_codec1(AkosRenderer *ar) {
if (y_bottom > ar->draw_bottom)
ar->draw_bottom = y_bottom;
- if (x==-1) x=0; /* ?? */
+ if (x == -1)
+ x = 0; /* ?? */
ar->v1.destptr = ar->outptr + x + y * ar->outwidth;
@@ -752,14 +777,17 @@ void Scumm::akos_codec1(AkosRenderer *ar) {
masking = false;
if (ar->clipping) {
masking = isMaskActiveAt(x_left, y_top, x_right, y_bottom,
- getResourceAddress(rtBuffer, 9) + gdi._imgBufOffs[ar->clipping] + _screenStartStrip
- ) != 0;
+ getResourceAddress(rtBuffer,
+ 9) +
+ gdi._imgBufOffs[ar->clipping] +
+ _screenStartStrip) != 0;
}
-
+
ar->v1.mask_ptr = NULL;
if (masking || charsetmask || ar->shadow_mode) {
- ar->v1.mask_ptr = getResourceAddress(rtBuffer, 9) + y*40 + _screenStartStrip;
+ ar->v1.mask_ptr =
+ getResourceAddress(rtBuffer, 9) + y * 40 + _screenStartStrip;
ar->v1.imgbufoffs = gdi._imgBufOffs[ar->clipping];
if (!charsetmask && masking) {
ar->v1.mask_ptr += ar->v1.imgbufoffs;
@@ -767,66 +795,89 @@ void Scumm::akos_codec1(AkosRenderer *ar) {
}
}
- switch(ar->shadow_mode) {
+ switch (ar->shadow_mode) {
case 1:
akos_c1_spec1(ar);
return;
case 2:
-// akos_c1_spec2(ar);
+// akos_c1_spec2(ar);
warning("akos_c1_spec2");
return;
case 3:
-// akos_c1_spec3(ar);
+// akos_c1_spec3(ar);
warning("akos_c1_spec3");
return;
}
akos_generic_decode(ar);
-
-// akos_c1_0y_decode(ar);
+
+// akos_c1_0y_decode(ar);
#if 0
- switch(((byte)y_clipping<<3) | ((byte)use_scaling<<2) | ((byte)masking<<1) | (byte)charsetmask) {
- case 0: akos_c1_0_decode(ar); break;
- case 0+8: akos_c1_0y_decode(ar); break;
+ switch (((byte)y_clipping << 3) | ((byte)use_scaling << 2) |
+ ((byte)masking << 1) | (byte)charsetmask) {
+ case 0:
+ akos_c1_0_decode(ar);
+ break;
+ case 0 + 8:
+ akos_c1_0y_decode(ar);
+ break;
case 2:
- case 1: akos_c1_12_decode(ar); break;
- case 2+8:
- case 1+8: akos_c1_12y_decode(ar); break;
- case 3+8:
- case 3: akos_c1_3_decode(ar); break;
- case 4: akos_c1_4_decode(ar); break;
- case 4+8: akos_c1_4y_decode(ar); break;
+ case 1:
+ akos_c1_12_decode(ar);
+ break;
+ case 2 + 8:
+ case 1 + 8:
+ akos_c1_12y_decode(ar);
+ break;
+ case 3 + 8:
+ case 3:
+ akos_c1_3_decode(ar);
+ break;
+ case 4:
+ akos_c1_4_decode(ar);
+ break;
+ case 4 + 8:
+ akos_c1_4y_decode(ar);
+ break;
case 6:
- case 5: akos_c1_56_decode(ar); break;
- case 6+8:
- case 5+8: akos_c1_56y_decode(ar); break;
+ case 5:
+ akos_c1_56_decode(ar);
+ break;
+ case 6 + 8:
+ case 5 + 8:
+ akos_c1_56y_decode(ar);
+ break;
case 7:
- case 7+8: akos_c1_7_decode(ar); break;
+ case 7 + 8:
+ akos_c1_7_decode(ar);
+ break;
}
#endif
}
-void Scumm::akos_codec1_ignorePakCols(AkosRenderer *ar, int num) {
+void Scumm::akos_codec1_ignorePakCols(AkosRenderer * ar, int num)
+{
int n;
byte repcolor;
byte replen;
byte *src;
n = ar->height;
- if (num>1) n *= num;
+ if (num > 1)
+ n *= num;
src = ar->srcptr;
do {
repcolor = *src++;
replen = repcolor & ar->v1.mask;
- if (replen==0) {
+ if (replen == 0) {
replen = *src++;
}
do {
if (!--n) {
- ar->v1.repcolor = repcolor>>ar->v1.shl;
+ ar->v1.repcolor = repcolor >> ar->v1.shl;
ar->v1.replen = replen;
ar->srcptr = src;
return;
@@ -836,16 +887,19 @@ void Scumm::akos_codec1_ignorePakCols(AkosRenderer *ar, int num) {
}
-void Scumm::akos_codec5(AkosRenderer *ar) {
+void Scumm::akos_codec5(AkosRenderer * ar)
+{
warning("akos_codec5: not implemented");
}
-void Scumm::akos_codec16(AkosRenderer *ar) {
+void Scumm::akos_codec16(AkosRenderer * ar)
+{
warning("akos_codec16: not implemented");
}
-bool Scumm::akos_increaseAnims(byte *akos, Actor *a) {
+bool Scumm::akos_increaseAnims(byte *akos, Actor * a)
+{
byte *aksq, *akfo;
int i;
uint size;
@@ -853,13 +907,13 @@ bool Scumm::akos_increaseAnims(byte *akos, Actor *a) {
aksq = findResourceData(MKID('AKSQ'), akos);
akfo = findResourceData(MKID('AKFO'), akos);
-
- size = getResourceDataSize(akfo)>>1;
-
+
+ size = getResourceDataSize(akfo) >> 1;
+
result = false;
- for(i=0;i!=0x10;i++) {
- if (a->cost.active[i]!=0)
- result|=akos_increaseAnim(a, i, aksq, (uint16*)akfo, size);
+ for (i = 0; i != 0x10; i++) {
+ if (a->cost.active[i] != 0)
+ result |= akos_increaseAnim(a, i, aksq, (uint16 *)akfo, size);
}
return result;
}
@@ -869,12 +923,14 @@ bool Scumm::akos_increaseAnims(byte *akos, Actor *a) {
#define GUW(o) READ_LE_UINT16(aksq+curpos+(o))
#define GB(o) aksq[curpos+(o)]
-bool Scumm::akos_increaseAnim(Actor *a, int chan, byte *aksq, uint16 *akfo, int numakfo) {
+bool Scumm::akos_increaseAnim(Actor * a, int chan, byte *aksq, uint16 *akfo,
+ int numakfo)
+{
byte active;
- uint old_curpos, curpos,end;
+ uint old_curpos, curpos, end;
uint code;
bool flag_value;
- int tmp,tmp2;
+ int tmp, tmp2;
active = a->cost.active[chan];
end = a->cost.end[chan];
@@ -884,11 +940,12 @@ bool Scumm::akos_increaseAnim(Actor *a, int chan, byte *aksq, uint16 *akfo, int
do {
code = aksq[curpos];
- if (code & 0x80) code = (code<<8)|aksq[curpos+1];
+ if (code & 0x80)
+ code = (code << 8) | aksq[curpos + 1];
- switch(active) {
+ switch (active) {
case 6:
- switch(code) {
+ switch (code) {
case AKC_JumpIfSet:
case AKC_AddVar:
case AKC_SetVar:
@@ -938,46 +995,48 @@ bool Scumm::akos_increaseAnim(Actor *a, int chan, byte *aksq, uint16 *akfo, int
break;
case AKC_ComplexChan:
curpos += 3;
- tmp = aksq[curpos-1];
+ tmp = aksq[curpos - 1];
while (--tmp >= 0) {
curpos += 4;
- curpos += (aksq[curpos]&0x80) ? 2 : 1;
+ curpos += (aksq[curpos] & 0x80) ? 2 : 1;
}
break;
default:
- if (code&0xC000)
+ if (code & 0xC000)
error("akos_increaseAnim: invalid code %x", code);
- curpos += (code&0x8000) ? 2 : 1;
+ curpos += (code & 0x8000) ? 2 : 1;
}
break;
case 2:
- curpos += (code&0x8000) ? 2 : 1;
+ curpos += (code & 0x8000) ? 2 : 1;
if (curpos > end)
curpos = a->cost.start[chan];
break;
case 3:
if (curpos != end)
- curpos += (code&0x8000) ? 2 : 1;
+ curpos += (code & 0x8000) ? 2 : 1;
break;
}
code = aksq[curpos];
- if (code & 0x80) code = (code<<8)|aksq[curpos+1];
+ if (code & 0x80)
+ code = (code << 8) | aksq[curpos + 1];
- if (flag_value && code!=AKC_ClearFlag)
+ if (flag_value && code != AKC_ClearFlag)
continue;
- switch(code) {
+ switch (code) {
case AKC_StartAnimInActor:
- akos_queCommand(4,
- derefActorSafe(getAnimVar(a, GB(2)), "akos_increaseAnim:29"),
- getAnimVar(a, GB(3)),
- 0
- );
+ akos_queCommand(4,
+ derefActorSafe(getAnimVar(a, GB(2)),
+ "akos_increaseAnim:29"), getAnimVar(a,
+ GB
+ (3)),
+ 0);
continue;
case AKC_Random:
- setAnimVar(a, GB(6), getRandomNumberRng(GW(2),GW(4)));
+ setAnimVar(a, GB(6), getRandomNumberRng(GW(2), GW(4)));
continue;
case AKC_SkipGE:
case AKC_SkipG:
@@ -985,24 +1044,24 @@ bool Scumm::akos_increaseAnim(Actor *a, int chan, byte *aksq, uint16 *akfo, int
case AKC_SkipL:
case AKC_SkipNE:
case AKC_SkipE:
- if ( !akos_compare(getAnimVar(a, GB(4)),GW(2), code-AKC_SkipStart) )
+ if (!akos_compare(getAnimVar(a, GB(4)), GW(2), code - AKC_SkipStart))
flag_value = true;
continue;
case AKC_IncVar:
- setAnimVar(a, 0, getAnimVar(a, 0)+1);
+ setAnimVar(a, 0, getAnimVar(a, 0) + 1);
continue;
case AKC_SetVar:
setAnimVar(a, GB(4), GW(2));
continue;
case AKC_AddVar:
- setAnimVar(a, GB(4), getAnimVar(a, GB(4)) + GW(2) );
+ setAnimVar(a, GB(4), getAnimVar(a, GB(4)) + GW(2));
continue;
case AKC_Flip:
a->flip = GW(2) != 0;
continue;
case AKC_CmdQue3:
tmp = GB(2);
- if ((uint)tmp < 8)
+ if ((uint) tmp < 8)
akos_queCommand(3, a, a->sound[tmp], 0);
continue;
case AKC_CmdQue3Quick:
@@ -1015,10 +1074,9 @@ bool Scumm::akos_increaseAnim(Actor *a, int chan, byte *aksq, uint16 *akfo, int
akos_queCommand(4, a, getAnimVar(a, GB(2)), 0);
continue;
case AKC_SetVarInActor:
- setAnimVar(
- derefActorSafe(getAnimVar(a, GB(2)),"akos_increaseAnim:9"),
- GB(3), GW(4)
- );
+ setAnimVar(derefActorSafe(getAnimVar(a, GB(2)), "akos_increaseAnim:9"),
+ GB(3), GW(4)
+ );
continue;
case AKC_HideActor:
akos_queCommand(1, a, 0, 0);
@@ -1031,19 +1089,19 @@ bool Scumm::akos_increaseAnim(Actor *a, int chan, byte *aksq, uint16 *akfo, int
if (tmp >= 8)
continue;
tmp2 = GB(4);
- if (tmp2<1 || tmp2>3)
+ if (tmp2 < 1 || tmp2 > 3)
error("akos_increaseAnim:8 invalid code %d", tmp2);
- akos_queCommand(tmp2+6, a, a->sound[tmp], GB(6));
+ akos_queCommand(tmp2 + 6, a, a->sound[tmp], GB(6));
continue;
case AKC_SetDrawOffs:
akos_queCommand(6, a, GW(2), GW(4));
continue;
case AKC_JumpTable:
- if (akfo==NULL)
+ if (akfo == NULL)
error("akos_increaseAnim: no AKFO table");
tmp = getAnimVar(a, GB(2)) - 1;
- if (tmp<0 || tmp >= numakfo-1)
- error("akos_increaseAnim: invalid jump value %d",tmp);
+ if (tmp < 0 || tmp >= numakfo - 1)
+ error("akos_increaseAnim: invalid jump value %d", tmp);
curpos = READ_LE_UINT16(&akfo[tmp]);
break;
case AKC_JumpIfSet:
@@ -1056,7 +1114,7 @@ bool Scumm::akos_increaseAnim(Actor *a, int chan, byte *aksq, uint16 *akfo, int
case AKC_ClearFlag:
flag_value = false;
continue;
-
+
case AKC_Jump:
curpos = GUW(2);
break;
@@ -1069,54 +1127,66 @@ bool Scumm::akos_increaseAnim(Actor *a, int chan, byte *aksq, uint16 *akfo, int
case AKC_Ignore2:
case AKC_Ignore3:
continue;
-
+
case AKC_JumpE:
case AKC_JumpNE:
case AKC_JumpL:
case AKC_JumpLE:
case AKC_JumpG:
case AKC_JumpGE:
- if ( !akos_compare(getAnimVar(a, GB(4)), GW(2), code - AKC_JumpStart) )
+ if (!akos_compare(getAnimVar(a, GB(4)), GW(2), code - AKC_JumpStart))
continue;
curpos = GUW(2);
break;
default:
- if ((code&0xC000)==0xC000)
+ if ((code & 0xC000) == 0xC000)
error("Undefined uSweat token %X", code);
}
break;
- } while(1);
+ } while (1);
int code2 = aksq[curpos];
- if (code2 & 0x80) code2 = (code2<<8)|aksq[curpos+1];
- assert((code2&0xC000)!=0xC000 || code2==AKC_ComplexChan || code2==AKC_Return);
+ if (code2 & 0x80)
+ code2 = (code2 << 8) | aksq[curpos + 1];
+ assert((code2 & 0xC000) != 0xC000 || code2 == AKC_ComplexChan
+ || code2 == AKC_Return);
a->cost.curpos[chan] = curpos;
return curpos != old_curpos;
}
-void Scumm::akos_queCommand(byte cmd, Actor *a, int param_1, int param_2) {
-// warning("akos_queCommand(%d,%d,%d,%d)", cmd, a->number, param_1, param_2);
+void Scumm::akos_queCommand(byte cmd, Actor * a, int param_1, int param_2)
+{
+// warning("akos_queCommand(%d,%d,%d,%d)", cmd, a->number, param_1, param_2);
}
-bool Scumm::akos_compare(int a, int b, byte cmd) {
- switch(cmd) {
- case 0: return a==b;
- case 1: return a!=b;
- case 2: return a<b;
- case 3: return a<=b;
- case 4: return a>b;
- default: return a>=b;
+bool Scumm::akos_compare(int a, int b, byte cmd)
+{
+ switch (cmd) {
+ case 0:
+ return a == b;
+ case 1:
+ return a != b;
+ case 2:
+ return a < b;
+ case 3:
+ return a <= b;
+ case 4:
+ return a > b;
+ default:
+ return a >= b;
}
}
-int Scumm::getAnimVar(Actor *a, byte var) {
+int Scumm::getAnimVar(Actor * a, byte var)
+{
return a->animVariable[var];
}
-void Scumm::setAnimVar(Actor *a, byte var, int value) {
+void Scumm::setAnimVar(Actor * a, byte var, int value)
+{
a->animVariable[var] = value;
}