mirror of
https://github.com/ondra-novak/gates_of_skeldal.git
synced 2025-07-19 04:34:51 -04:00
added console and a few commands
This commit is contained in:
parent
e717badc45
commit
73b949fb2e
28 changed files with 807 additions and 87 deletions
|
@ -1,3 +1,4 @@
|
|||
#include <platform/platform.h>
|
||||
#include "types.h"
|
||||
|
||||
|
||||
|
|
|
@ -153,7 +153,7 @@ chr5:
|
|||
ax = charcolors[(al-1)];
|
||||
if (ax == 0xFFFF) goto chr4;
|
||||
if (ax & BGSWITCHBIT) {
|
||||
ax = avg_pixels(*ebx ,ax);
|
||||
ax = avg_pixels(*ebx ,ax) & ~BGSWITCHBIT;
|
||||
}
|
||||
*ebx = ax;
|
||||
goto chr4;
|
||||
|
|
|
@ -352,7 +352,12 @@ void define(int id,int x,int y,int xs,int ys,char align,void (*initproc)(OBJREC
|
|||
o->font=default_font;
|
||||
o->datasize=0;
|
||||
initproc(o);
|
||||
if (o->datasize) o->data=(void *)getmem(o->datasize); else o->data=NULL;
|
||||
if (o->datasize) {
|
||||
o->data=(void *)getmem(o->datasize);
|
||||
memset(o->data,0,o->datasize);
|
||||
}else {
|
||||
o->data=NULL;
|
||||
}
|
||||
va_list vlst;
|
||||
va_start(vlst, initproc);
|
||||
o->call_init(o,vlst);
|
||||
|
|
|
@ -7,10 +7,8 @@
|
|||
#include "mgifmem.h"
|
||||
#include <platform/sound.h>
|
||||
|
||||
static MGIF_HEADER_T *mgif_header;
|
||||
|
||||
static short mgif_accnums[2];
|
||||
static int32_t mgif_writepos;
|
||||
|
||||
|
||||
|
||||
static const word *paleta;
|
||||
|
@ -128,34 +126,31 @@ static void PlayMGFFile(const void *file, MGIF_PROC proc,int ypos,char full)
|
|||
int32_t scr_linelen2 = GetScreenPitch();
|
||||
mgif_install_proc(proc);
|
||||
sound=PrepareVideoSound(22050,256*1024);
|
||||
mgif_accnums[0]=mgif_accnums[1]=0;
|
||||
mgif_writepos=65536;
|
||||
picture=getmem(2*3+320*180*2);
|
||||
picture[0]=320;
|
||||
picture[1]=180;
|
||||
picture[2]=15;
|
||||
memset(picture+3,0,320*180*2);
|
||||
anim_render_buffer=picture+3;
|
||||
mgif_header=(MGIF_HEADER_T *)file;
|
||||
file=open_mgif(file);
|
||||
if (file==NULL) return;
|
||||
while (file)
|
||||
MGIF_HEADER_T *hdr =(MGIF_HEADER_T *)file;
|
||||
hdr->accnums[0] = hdr->accnums[1] = 0;
|
||||
hdr->sound_write_pos = 65536;
|
||||
char f = 1;
|
||||
while (f)
|
||||
{
|
||||
file=mgif_play(file);
|
||||
f=mgif_play(file);
|
||||
StretchImageHQ(picture, GetScreenAdr()+ypos*scr_linelen2, scr_linelen2,full);
|
||||
showview(0,ypos,0,360);
|
||||
if (game_display_is_quit_requested()) {
|
||||
break;
|
||||
} else if (_bios_keybrd(_KEYBRD_READY)==0) {
|
||||
mix_back_sound(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else if (_bios_keybrd(_KEYBRD_READY)) {
|
||||
_bios_keybrd(_KEYBRD_READ);
|
||||
break;
|
||||
}
|
||||
}
|
||||
close_mgif();
|
||||
close_mgif(file);
|
||||
DoneVideoSound(sound);
|
||||
free(picture);
|
||||
}
|
||||
|
@ -169,7 +164,7 @@ void show_full_lfb12e_dx(void *target,void *buff,void *paleta);
|
|||
|
||||
|
||||
|
||||
void BigPlayProc(int act,const void *data,int csize)
|
||||
void BigPlayProc(MGIF_HEADER_T *hdr,int act,const void *data,int csize)
|
||||
{
|
||||
switch (act)
|
||||
{
|
||||
|
@ -178,7 +173,7 @@ void BigPlayProc(int act,const void *data,int csize)
|
|||
case MGIF_DELTA:show_delta_lfb12e(anim_render_buffer,data,paleta);break;
|
||||
case MGIF_PAL:paleta=data;break;
|
||||
case MGIF_SOUND:
|
||||
while (LoadNextVideoFrame(sound,data,csize,mgif_header->ampl_table,mgif_accnums,&mgif_writepos)==0);
|
||||
while (LoadNextVideoFrame(sound,data,csize,hdr->ampl_table,hdr->accnums,&hdr->sound_write_pos)==0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
#define LZW_BUFFER 64000
|
||||
|
||||
MGIF_PROC show_proc;
|
||||
static int mgif_frames;
|
||||
static int cur_frame;
|
||||
|
||||
|
||||
typedef struct double_s
|
||||
|
@ -93,21 +91,29 @@ struct mgif_header load_mgif_header(const char **mgif) {
|
|||
const void *open_mgif(const void *mgif) //vraci ukazatel na prvni frame
|
||||
{
|
||||
const char *c = mgif;
|
||||
struct mgif_header mgh = load_mgif_header(&c);
|
||||
MGIF_HEADER_T hdr = load_mgif_header(&c);
|
||||
|
||||
if (strncmp(mgh.sign,MGIF,4)) return NULL;
|
||||
mgif_frames=mgh.frames;
|
||||
cur_frame=0;
|
||||
if (strncmp(hdr.sign,MGIF,4)) return NULL;
|
||||
MGIF_HEADER_T *ins = getmem(sizeof(MGIF_HEADER_T));
|
||||
*ins = hdr;
|
||||
ins->nx_frame = c;
|
||||
ins->cur_frame = 0;
|
||||
ins->sound_write_pos = 0;
|
||||
ins->accnums[0] = 0;
|
||||
ins->accnums[1] = 0;
|
||||
init_lzw_compressor(8);
|
||||
if (lzw_buffer==NULL) lzw_buffer=getmem(LZW_BUFFER);
|
||||
return c;
|
||||
return ins;
|
||||
}
|
||||
|
||||
void close_mgif(void) //dealokuje buffery pro prehravani
|
||||
void close_mgif(const void *mgif) //dealokuje buffery pro prehravani
|
||||
{
|
||||
done_lzw_compressor();
|
||||
free(lzw_buffer);
|
||||
lzw_buffer=NULL;
|
||||
if (mgif) {
|
||||
done_lzw_compressor();
|
||||
free(lzw_buffer);
|
||||
lzw_buffer=NULL;
|
||||
free((void *)mgif);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -350,8 +356,9 @@ FRAME_HEADER_T read_frame_header(const char **iter) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
const void *mgif_play(const void *mgif) //dekoduje a zobrazi frame
|
||||
char mgif_play(const void *mgif) //dekoduje a zobrazi frame
|
||||
{
|
||||
MGIF_HEADER_T *hdr = (MGIF_HEADER_T *)mgif;
|
||||
const char *pf;
|
||||
const char *pc;
|
||||
char *ff;
|
||||
|
@ -361,7 +368,7 @@ const void *mgif_play(const void *mgif) //dekoduje a zobrazi frame
|
|||
|
||||
|
||||
|
||||
pf=mgif;
|
||||
pf=hdr->nx_frame;
|
||||
FRAME_HEADER_T frame_hdr = read_frame_header(&pf);
|
||||
pc = pf;
|
||||
pf += frame_hdr.size;
|
||||
|
@ -378,14 +385,15 @@ const void *mgif_play(const void *mgif) //dekoduje a zobrazi frame
|
|||
scr_sav = pc;
|
||||
scr_act = chunk_hdr.type;
|
||||
} else {
|
||||
show_proc(chunk_hdr.type,pc,chunk_hdr.size);
|
||||
show_proc(hdr,chunk_hdr.type,pc,chunk_hdr.size);
|
||||
}
|
||||
pc+=chunk_hdr.size;
|
||||
}
|
||||
if (scr_act!=-1) show_proc(scr_act,scr_sav,0);
|
||||
cur_frame+=1;
|
||||
if (cur_frame==mgif_frames) return NULL;
|
||||
return pf;
|
||||
if (scr_act!=-1) show_proc(hdr, scr_act,scr_sav,0);
|
||||
hdr->cur_frame+=1;
|
||||
if (hdr->cur_frame==hdr->frames) return 0;
|
||||
hdr->nx_frame = pf;
|
||||
return 1;
|
||||
}
|
||||
/*
|
||||
acts=*pf++;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//!!!! POZOR, NUTNE LINKOVAT SOUBOR LZWA.ASM
|
||||
#ifndef _MGIFMEM_H
|
||||
|
||||
typedef void (*MGIF_PROC)(int,const void *,int csize); //prvni cislo akce, druhy data akce
|
||||
|
||||
|
||||
#define _MGIFMEM_H
|
||||
#define MGIF "MGIF"
|
||||
|
@ -29,12 +29,17 @@ typedef struct mgif_header
|
|||
word snd_chans;
|
||||
int32_t snd_freq;
|
||||
short ampl_table[256];
|
||||
short reserved[32];
|
||||
const void *nx_frame;
|
||||
int32_t cur_frame;
|
||||
short accnums[2];
|
||||
int32_t sound_write_pos;
|
||||
}MGIF_HEADER_T;
|
||||
|
||||
typedef void (*MGIF_PROC)(MGIF_HEADER_T *hdr, int,const void *,int csize); //prvni cislo akce, druhy data akce
|
||||
|
||||
|
||||
void mgif_install_proc(MGIF_PROC proc);
|
||||
const void *open_mgif(const void *mgif); //vraci ukazatel na prvni frame
|
||||
const void *mgif_play(const void *mgif); //dekoduje a zobrazi frame
|
||||
void close_mgif(void); //dealokuje buffery pro prehravani
|
||||
char mgif_play(const void *mgif); //dekoduje a zobrazi frame
|
||||
void close_mgif(const void *mgif); //dealokuje buffery pro prehravani
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue