mirror of
https://github.com/ondra-novak/gates_of_skeldal.git
synced 2025-07-20 05:04:53 -04:00
return to 555, it is more native for this game and SDL supports it
This commit is contained in:
parent
f8a1501289
commit
e717badc45
12 changed files with 67 additions and 76 deletions
|
@ -120,6 +120,10 @@ void line_32(int x,int y,int xs,int ys)
|
|||
}
|
||||
}
|
||||
|
||||
static inline word avg_pixels(word a, word b) {
|
||||
return ((a & 0x7BDE)+(b & 0x7BDE)) >> 1;
|
||||
}
|
||||
|
||||
|
||||
void char_32(word *posit,const word *font,char znak)
|
||||
//#pragma aux char_32 parm [edi] [esi] [eax] modify [eax ebx ecx edx]
|
||||
|
@ -149,7 +153,7 @@ chr5:
|
|||
ax = charcolors[(al-1)];
|
||||
if (ax == 0xFFFF) goto chr4;
|
||||
if (ax & BGSWITCHBIT) {
|
||||
ax = ((*ebx & 0xF7DF) + (ax & 0xF7DF)) >> 1;
|
||||
ax = avg_pixels(*ebx ,ax);
|
||||
}
|
||||
*ebx = ax;
|
||||
goto chr4;
|
||||
|
@ -339,7 +343,8 @@ void put_picture(word x,word y,const void *p)
|
|||
for (i=0;i<yss;i++,adr+=scr_linelen2,data+=(xs-xss))
|
||||
for (j=0;j<xss;j++)
|
||||
{
|
||||
adr[j]=((*data & ~0x1f)<<1) | (*data & 0x1f);
|
||||
// adr[j]=((*data & ~0x1f)<<1) | (*data & 0x1f);
|
||||
adr[j]=*data;
|
||||
data++;
|
||||
}
|
||||
}
|
||||
|
@ -400,7 +405,7 @@ void get_picture(word x,word y,word xs,word ys,void *p)
|
|||
|
||||
data[0]=xss;
|
||||
data[1]=yss;
|
||||
data[2]=16;
|
||||
data[2]=15;
|
||||
data+=3;
|
||||
{
|
||||
int i;
|
||||
|
@ -644,7 +649,7 @@ ptb_skip2:
|
|||
}
|
||||
}
|
||||
*/
|
||||
#define MIXTRANSP(a,b) ((((a) & 0xF7DE)+((b) & 0xF7DE))>>1)
|
||||
#define MIXTRANSP(a,b) ((((a) & 0x7BDE)+((b) & 0x7BDE))>>1)
|
||||
|
||||
void trans_bar(int x,int y,int xs,int ys,int barva)
|
||||
{
|
||||
|
|
|
@ -13,14 +13,14 @@ static short mgif_accnums[2];
|
|||
static int32_t mgif_writepos;
|
||||
|
||||
|
||||
static word *paleta;
|
||||
static const word *paleta;
|
||||
|
||||
static word *picture;
|
||||
static word *anim_render_buffer;
|
||||
static void *sound;
|
||||
|
||||
static inline word avg_pixels(word a, word b) {
|
||||
return ((a & 0xF7DE)+(a & 0xF7DE)) >> 1;
|
||||
return ((a & 0x7BDE)+(b & 0x7BDE)) >> 1;
|
||||
}
|
||||
|
||||
static void StretchImageHQ(word *src, word *trg, int32_t linelen, char full)
|
||||
|
@ -86,7 +86,7 @@ static void StretchImageHQ(word *src, word *trg, int32_t linelen, char full)
|
|||
word n5 = avg_pixels(n1, n2);
|
||||
word n6 = avg_pixels(n3, n4);
|
||||
word n7 = avg_pixels(n5, n6);
|
||||
trg_row[x+linelen] = n7;
|
||||
trg_row[x+linelen] = avg_pixels(n7,0);
|
||||
}
|
||||
trg_row += 2*linelen;
|
||||
}
|
||||
|
@ -167,13 +167,7 @@ void show_delta_lfb12e_dx(void *target,void *buff,void *paleta);
|
|||
void show_full_lfb12e_dx(void *target,void *buff,void *paleta);
|
||||
|
||||
|
||||
word * load_mgf_palette(const word *pal) {
|
||||
static word paleta[256];
|
||||
for (int i = 0; i < 256; ++i) {
|
||||
paleta[i] = pal[i]+(pal[i]&0x7fe0);
|
||||
}
|
||||
return paleta;
|
||||
}
|
||||
|
||||
|
||||
void BigPlayProc(int act,const void *data,int csize)
|
||||
{
|
||||
|
@ -182,7 +176,7 @@ void BigPlayProc(int act,const void *data,int csize)
|
|||
case MGIF_LZW:
|
||||
case MGIF_COPY:show_full_lfb12e(anim_render_buffer,data,paleta);break;
|
||||
case MGIF_DELTA:show_delta_lfb12e(anim_render_buffer,data,paleta);break;
|
||||
case MGIF_PAL:paleta=load_mgf_palette(data);break;
|
||||
case MGIF_PAL:paleta=data;break;
|
||||
case MGIF_SOUND:
|
||||
while (LoadNextVideoFrame(sound,data,csize,mgif_header->ampl_table,mgif_accnums,&mgif_writepos)==0);
|
||||
}
|
||||
|
|
|
@ -24,9 +24,8 @@ public:
|
|||
iter += 4;
|
||||
blocks = read_int();
|
||||
iter += 8;
|
||||
std::memcpy(btable,iter,sizeof(btable));
|
||||
iter += sizeof(btable);
|
||||
btable[0] = -31767;
|
||||
btable = reinterpret_cast<const short *>(iter);
|
||||
iter += 512;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,7 +64,7 @@ protected:
|
|||
std::int16_t chans;
|
||||
std::int32_t freq;
|
||||
std::int32_t blocks;
|
||||
short btable[256];
|
||||
const short *btable;
|
||||
const uint8_t *iter;
|
||||
std::vector<int16_t> outbuff;
|
||||
std::string_view unprocessed_buffer;
|
||||
|
@ -96,12 +95,10 @@ protected:
|
|||
uint8_t p = *iter++;
|
||||
short val=accum[c]+btable[p];
|
||||
accum[c]=val;
|
||||
/*
|
||||
if (p==0) //pridano jako provizorni reseni pro korekci chyby komprimacniho programu
|
||||
if (p==0) //a bug in compression algorithm
|
||||
{
|
||||
val-=31767;
|
||||
}
|
||||
*/
|
||||
c = (c + 1) % chans;
|
||||
outbuff.push_back(val);
|
||||
}
|
||||
|
|
14
libs/pcx.c
14
libs/pcx.c
|
@ -68,7 +68,7 @@ void palette_shadow(const char *pal1,unsigned short pal2[][256],int tr,int tg,in
|
|||
r=(tr+(*(bt++)-tr)*(3*SHADE_STEPS-3*j-1)/(3*SHADE_STEPS-1))>>3;
|
||||
g=(tg+(*(bt++)-tg)*(3*SHADE_STEPS-3*j-1)/(3*SHADE_STEPS-1))>>3;
|
||||
b=(tb+(*(bt++)-tb)*(3*SHADE_STEPS-3*j-1)/(3*SHADE_STEPS-1))>>3;
|
||||
hi=(r<<11)+(g<<6)+b;
|
||||
hi=RGB555(r,g,b);
|
||||
pal2[j][i]=hi;
|
||||
}
|
||||
while (++i & 0xff);
|
||||
|
@ -82,7 +82,7 @@ void palette_shadow(const char *pal1,unsigned short pal2[][256],int tr,int tg,in
|
|||
r=((*(bt++))*(SHADE_STEPS-j)/SHADE_STEPS)>>3;
|
||||
g=((*(bt++))*(SHADE_STEPS-j)/SHADE_STEPS)>>3;
|
||||
b=((*(bt++))*(SHADE_STEPS-j)/SHADE_STEPS)>>3;
|
||||
hi=(r<<11)+(g<<6)+b;
|
||||
hi=RGB555(r,g,b);
|
||||
pal2[j+SHADE_STEPS][i]=hi;
|
||||
}
|
||||
while (++i & 0xff);
|
||||
|
@ -111,10 +111,12 @@ int load_pcx(const char *pcx,int32_t fsize,int conv_type,char **buffer, ... )
|
|||
memcpy(get_palette_ptr,ptr1,768);
|
||||
for (i=0;i<256;i++)
|
||||
{
|
||||
*ptr2=*(ptr1++)>>3;
|
||||
*ptr2=(*ptr2<<5)+(*(ptr1++)>>3);
|
||||
*ptr2=(*ptr2<<6)+(*(ptr1++)>>3);
|
||||
ptr2++;
|
||||
int r = ptr1[0];
|
||||
int g = ptr1[1];
|
||||
int b = ptr1[2];
|
||||
*ptr2 = RGB888(r,g,b);
|
||||
++ptr2;
|
||||
ptr1+=3;
|
||||
}
|
||||
|
||||
memcpy(&pcxdata,pcx,sizeof(pcxdata));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue