mirror of
https://github.com/ondra-novak/gates_of_skeldal.git
synced 2025-07-19 12:44:55 -04:00
compile and run in windows (improvements needed)
This commit is contained in:
parent
f55f92a88b
commit
f70b29abab
83 changed files with 415 additions and 3747 deletions
|
@ -21,3 +21,4 @@ SET(files basicobj.c
|
|||
|
||||
add_library(skeldal_libs ${files})
|
||||
|
||||
set_property(TARGET skeldal_libs PROPERTY CXX_STANDARD 20)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#pragma once
|
||||
#include <iterator>
|
||||
#include <string_view>
|
||||
|
||||
|
||||
class base64_t {
|
||||
|
|
|
@ -241,16 +241,16 @@ void draw_status_line(char *c)
|
|||
showview(0,y-2,SCR_WIDTH_X-1,ysize+5);
|
||||
}
|
||||
|
||||
void *status_mem_info(EVENT_MSG *msg)
|
||||
void status_mem_info(EVENT_MSG *msg)
|
||||
{
|
||||
return NULL;
|
||||
|
||||
}
|
||||
|
||||
void *status_idle(EVENT_MSG *msg)
|
||||
void status_idle(EVENT_MSG *msg)
|
||||
{
|
||||
if (msg->msg==E_INIT) return &status_idle;
|
||||
if (msg->msg==E_INIT) return;
|
||||
send_message(E_STATUS_LINE,msg->msg);
|
||||
return NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
static int enter_event_msg_to(EVENT_MSG *msg, void *ctx) {
|
||||
|
@ -299,29 +299,29 @@ void status_line(EVENT_MSG *msg, T_EVENT_ROOT **user_data) {
|
|||
return;
|
||||
}
|
||||
|
||||
void *mouse_xy(EVENT_MSG *msg)
|
||||
void mouse_xy(EVENT_MSG *msg)
|
||||
{
|
||||
char **c = va_arg(msg->data, char **);
|
||||
|
||||
if (msg->msg==E_INIT) return &mouse_xy;
|
||||
if (msg->msg==E_INIT) return;
|
||||
sprintf(*c," X: %d Y: %d",ms_last_event.x,ms_last_event.y);
|
||||
*c=strchr(*c,'\0');
|
||||
return NULL;
|
||||
return ;
|
||||
}
|
||||
|
||||
void *show_time(EVENT_MSG *msg)
|
||||
void show_time(EVENT_MSG *msg)
|
||||
{
|
||||
char **c = va_arg(msg->data, char **);
|
||||
time_t t;
|
||||
struct tm cas;
|
||||
|
||||
if (msg->msg==E_INIT) return &show_time;
|
||||
if (msg->msg==E_INIT) return;
|
||||
t=time(NULL);
|
||||
cas=*localtime(&t);
|
||||
|
||||
sprintf(*c,"%02d:%02d:%02d ",cas.tm_hour,cas.tm_min,cas.tm_sec);
|
||||
*c=strchr(*c,'\0');
|
||||
return NULL;
|
||||
return ;
|
||||
}
|
||||
//------------------------------------------
|
||||
|
||||
|
@ -684,7 +684,7 @@ void input_line_init(OBJREC *o,va_list len)
|
|||
|
||||
void input_line_draw(int x1,int y1, int x2, int y2, OBJREC *o)
|
||||
{
|
||||
char d[2]=" \0";
|
||||
char d[2]=" ";
|
||||
int x;
|
||||
char *c;
|
||||
int len;
|
||||
|
|
|
@ -13,9 +13,9 @@ void xor_rectangle(int x,int y,int xs,int ys);
|
|||
|
||||
// status lines
|
||||
void status_line(EVENT_MSG *msg,T_EVENT_ROOT **user_data);
|
||||
void *status_mem_info(EVENT_MSG *msg);
|
||||
void *mouse_xy(EVENT_MSG *msg);
|
||||
void *show_time(EVENT_MSG *msg);
|
||||
void status_mem_info(EVENT_MSG *msg);
|
||||
void mouse_xy(EVENT_MSG *msg);
|
||||
void show_time(EVENT_MSG *msg);
|
||||
|
||||
// objects
|
||||
//void sample(OBJREC *o);
|
||||
|
|
|
@ -293,9 +293,11 @@ void deinstall_event(T_EVENT_ROOT **tree,int32_t ev_num,EV_PROC proc,void *procd
|
|||
if (!p->calls) force_delete_curr(tree,r,p);
|
||||
}
|
||||
|
||||
typedef void (*initproc)();
|
||||
|
||||
void tree_basics(T_EVENT_ROOT **ev_tree,EVENT_MSG *msg)
|
||||
{
|
||||
void (*q)();
|
||||
initproc q;
|
||||
|
||||
if (msg->msg==E_ADD || msg->msg==E_ADDEND)
|
||||
{
|
||||
|
@ -308,9 +310,10 @@ void tree_basics(T_EVENT_ROOT **ev_tree,EVENT_MSG *msg)
|
|||
install_event(ev_tree,msg,proc,msg->msg==E_ADDEND);
|
||||
return;
|
||||
}
|
||||
|
||||
if (msg->msg==E_INIT)
|
||||
{
|
||||
q = va_arg(msg->data, void (*)());
|
||||
{
|
||||
q = va_arg(msg->data, initproc);
|
||||
q();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ main(int argc,char **argv)
|
|||
|
||||
if (argc==3) help();
|
||||
init_manager(argv[1],NULL);
|
||||
z=afile(strupr(argv[2]),read_group(0),&s);
|
||||
z=afile(strupper(argv[2]),read_group(0),&s);
|
||||
if (z==NULL)
|
||||
{
|
||||
puts("File not found");
|
||||
|
|
25
libs/gui.c
25
libs/gui.c
|
@ -26,7 +26,7 @@ word desktop_y_size;
|
|||
char force_redraw_desktop=0;
|
||||
static char change_flag=0,f_cancel_event=0;
|
||||
const word *default_font;
|
||||
void empty()
|
||||
void empty(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -339,7 +339,7 @@ void define(int id,int x,int y,int xs,int ys,char align,void (*initproc)(OBJREC
|
|||
o->call_done=empty1;
|
||||
o->autoresizex=0;
|
||||
o->autoresizey=0;
|
||||
o->on_event=empty;
|
||||
o->on_event=empty3;
|
||||
o->on_enter=empty;
|
||||
o->on_exit=empty;
|
||||
o->on_change=empty;
|
||||
|
@ -767,16 +767,16 @@ void uninstall_gui(void)
|
|||
//send_message(E_GUI,cislo,E_UDALOST,data....)
|
||||
|
||||
|
||||
void on_control_change(void (*proc)())
|
||||
void on_control_change(void (*proc)(void))
|
||||
{
|
||||
o_end->on_change=proc;
|
||||
}
|
||||
|
||||
void on_control_enter(void (*proc)())
|
||||
void on_control_enter(void (*proc)(void))
|
||||
{
|
||||
o_end->on_enter=proc;
|
||||
}
|
||||
void on_control_exit(void (*proc)())
|
||||
void on_control_exit(void (*proc)(void))
|
||||
{
|
||||
o_end->on_exit=proc;
|
||||
}
|
||||
|
@ -920,28 +920,29 @@ void close_current()
|
|||
close_window(waktual);
|
||||
}
|
||||
|
||||
typedef void (*PROG)(void);
|
||||
|
||||
void background_runner(EVENT_MSG *msg,void **prog)
|
||||
{
|
||||
void (*p)();
|
||||
PROG *prog_ptr = (PROG *)(prog);
|
||||
|
||||
|
||||
if (msg->msg==E_INIT)
|
||||
{
|
||||
*prog = va_arg(msg->data, void (*)());
|
||||
*prog_ptr = va_arg(msg->data, PROG);
|
||||
return;
|
||||
}
|
||||
if (msg->msg==E_DONE)
|
||||
{
|
||||
*prog=NULL;
|
||||
*prog_ptr=NULL;
|
||||
return;
|
||||
}
|
||||
p=*prog;
|
||||
p();
|
||||
}
|
||||
(*prog_ptr)();
|
||||
|
||||
msg->msg=-2;
|
||||
}
|
||||
|
||||
void run_background(void (*p)())
|
||||
void run_background(PROG p)
|
||||
{
|
||||
send_message(E_ADD,E_IDLE,background_runner,p);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
#define DPMI_INT 0x31
|
||||
#define LOAD_BUFFER 4096
|
||||
|
@ -42,7 +42,7 @@ void standard_mem_error(size_t size)
|
|||
{
|
||||
char buff[256];
|
||||
SEND_LOG("(ERROR) Memory allocation error detected, %lu bytes missing",size);
|
||||
sprintf(buff,"Memory allocation error\n Application can't allocate %lu bytes of memory (%xh)\n",size,memman_handle);
|
||||
sprintf(buff,"Memory allocation error\n Application can't allocate %lu bytes of memory (%xh)\n",(unsigned long)size,memman_handle);
|
||||
display_error(buff);
|
||||
exit(1);
|
||||
}
|
||||
|
@ -271,7 +271,7 @@ THANDLE_DATA *zneplatnit_block(int handle)
|
|||
return h;
|
||||
}
|
||||
|
||||
static void heap_error() {
|
||||
static void heap_error(size_t s) {
|
||||
display_error("out of memory");
|
||||
abort();
|
||||
}
|
||||
|
@ -315,7 +315,7 @@ void *load_swaped_block(THANDLE_DATA *h)
|
|||
}
|
||||
|
||||
|
||||
int find_same(const char *name,void *decomp)
|
||||
int find_same(const char *name,ABLOCK_DECODEPROC decomp)
|
||||
{
|
||||
THANDLE_DATA *p;
|
||||
int i,j;
|
||||
|
@ -332,7 +332,7 @@ int find_same(const char *name,void *decomp)
|
|||
return -1;
|
||||
}
|
||||
|
||||
int find_handle(const char *name,void *decomp)
|
||||
int find_handle(const char *name,ABLOCK_DECODEPROC decomp)
|
||||
{
|
||||
return find_same(name,decomp);
|
||||
}
|
||||
|
@ -364,7 +364,7 @@ THANDLE_DATA *def_handle(int handle,const char *filename,ABLOCK_DECODEPROC decom
|
|||
}
|
||||
memcpy(h->src_file,filename,12);
|
||||
h->seekpos=0;
|
||||
strupr(h->src_file);
|
||||
strupper(h->src_file);
|
||||
h->loadproc=decompress;
|
||||
if (filename[0])
|
||||
h->seekpos=get_file_entry(path,h->src_file);
|
||||
|
@ -385,7 +385,7 @@ const void *afile(char *filename,int group,int32_t *blocksize)
|
|||
|
||||
d=alloca(strlen(filename)+1);
|
||||
strcpy(d,filename);
|
||||
strupr(d);
|
||||
strupper(d);
|
||||
if (mman_patch && test_file_exist_DOS(group,d)) entr=0;
|
||||
else entr=get_file_entry(group,d);
|
||||
if (entr!=0)
|
||||
|
@ -669,7 +669,7 @@ void display_status()
|
|||
if (h->src_file[0]) strncpy(nname,h->src_file,12);else strcpy(nname,"<local>");
|
||||
printf("%04Xh ... %12s %s %s %08lXh %6d %10d %6d \n",i*BK_MINOR_HANDLES+j,
|
||||
nname,names[h->status-1],
|
||||
copys,(uintptr_t)h->blockdata,h->size,h->counter,h->lockcount);
|
||||
copys,(unsigned long)h->blockdata,h->size,h->counter,h->lockcount);
|
||||
ln++;
|
||||
total_data+=h->size;
|
||||
if(h->status==BK_PRESENT)total_mem+=h->size;
|
||||
|
|
|
@ -96,7 +96,7 @@ void close_manager(void); //uzavre manager a uvolni veskerou pam
|
|||
void undef_handle(int handle); //uvolni hadle k dalsimu pouziti
|
||||
THANDLE_DATA *zneplatnit_block(int handle); //zneplatni data bloku
|
||||
THANDLE_DATA *get_handle(int handle); //vraci informace o rukojeti
|
||||
int find_handle(const char *name,void *decomp); //hleda mezi rukojeti stejnou definici
|
||||
int find_handle(const char *name,ABLOCK_DECODEPROC decomp); //hleda mezi rukojeti stejnou definici
|
||||
int test_file_exist(int group,char *filename); //testuje zda soubor existuje v ramci mmanageru
|
||||
const void *afile(char *filename,int group,int32_t *blocksize); //nahraje do pameti soubor registrovany v ramci mmanageru
|
||||
void *afile_copy(char *filename,int group,int32_t *blocksize); //nahraje do pameti soubor registrovany v ramci mmanageru
|
||||
|
|
|
@ -335,7 +335,7 @@ static void done_mgif_player()
|
|||
free(f);
|
||||
free(temp);
|
||||
mix_back_sound(3);
|
||||
change_music("?");
|
||||
change_music(NULL);
|
||||
}
|
||||
|
||||
static void init_load_buffer(int size)
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#include <string_view>
|
||||
|
||||
#include "music.h"
|
||||
#include <platform/platform.h>
|
||||
|
||||
|
|
|
@ -5,7 +5,9 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct music_stream_t {} TMUSIC_STREAM;
|
||||
typedef struct music_stream_t {
|
||||
char dummy;
|
||||
} TMUSIC_STREAM;
|
||||
|
||||
typedef struct music_stream_info_t {
|
||||
int freq;
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
#ifndef _WAV_H
|
||||
|
||||
#define _WAV_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define WAV_RIFF "RIFF"
|
||||
#define WAV_WAVE "WAVE"
|
||||
#define WAV_FMT "fmt "
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue