mirror of
https://github.com/ondra-novak/gates_of_skeldal.git
synced 2025-07-13 01:41:59 -04:00
trying to debug, additional rewrites
This commit is contained in:
parent
378b5586ab
commit
42f780a729
87 changed files with 1771 additions and 529 deletions
|
@ -13,7 +13,7 @@ SET(files basicobj.c
|
|||
pcx.c
|
||||
strlite.c
|
||||
wav_mem.c
|
||||
strlists.c
|
||||
strlists.c
|
||||
swaper.c )
|
||||
|
||||
add_library(skeldal_libs ${files})
|
||||
|
|
|
@ -39,7 +39,7 @@ char disk_finder()
|
|||
}
|
||||
|
||||
char find_path(char *path)
|
||||
{
|
||||
{SEPARATOR
|
||||
char *oldpath;
|
||||
unsigned pismeno='C';
|
||||
|
||||
|
|
174
libs/base64.h
Normal file
174
libs/base64.h
Normal file
|
@ -0,0 +1,174 @@
|
|||
#pragma once
|
||||
#include <iterator>
|
||||
|
||||
|
||||
class base64_t {
|
||||
public:
|
||||
|
||||
constexpr base64_t(const char *charset, char terminator):_terminator(terminator) {
|
||||
for (int i = 0; i < 64; ++i) _charset[i] = charset[i];
|
||||
for (char &c: _charmap) c=-1;
|
||||
for (unsigned int i = 0; i < 64;++i) {
|
||||
int c = _charset[i]-32;
|
||||
_charmap[c] = static_cast<char>(i);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename InIter, typename OutIter>
|
||||
constexpr OutIter encode(InIter beg, InIter end, OutIter out) const {
|
||||
unsigned int remain = 0;
|
||||
unsigned int accum = 0;
|
||||
while (beg != end) {
|
||||
accum = static_cast<unsigned char>(*beg);
|
||||
++beg;
|
||||
if (beg == end) {
|
||||
remain = 2;
|
||||
break;
|
||||
}
|
||||
accum = (accum << 8) | static_cast<unsigned char>(*beg);
|
||||
++beg;
|
||||
if (beg == end) {
|
||||
remain = 1;
|
||||
break;
|
||||
}
|
||||
accum = (accum << 8) | static_cast<unsigned char>(*beg);
|
||||
++beg;
|
||||
*out = _charset[accum >> 18];
|
||||
++out;
|
||||
*out = _charset[(accum >> 12) & 0x3F];
|
||||
++out;
|
||||
*out = _charset[(accum >> 6) & 0x3F];
|
||||
++out;
|
||||
*out = _charset[accum & 0x3F];
|
||||
++out;
|
||||
accum = 0;
|
||||
}
|
||||
switch (remain) {
|
||||
case 2: *out = _charset[accum >> 2];
|
||||
++out;
|
||||
*out = _charset[(accum << 4) & 0x3F];
|
||||
++out;
|
||||
if (_terminator) {
|
||||
*out = _terminator;
|
||||
++out;
|
||||
*out = _terminator;
|
||||
++out;
|
||||
}
|
||||
break;
|
||||
case 1: *out = _charset[accum >> 10];
|
||||
++out;
|
||||
*out = _charset[(accum >> 4) & 0x3F];
|
||||
++out;
|
||||
*out = _charset[(accum << 2) & 0x3F];
|
||||
++out;
|
||||
if (_terminator) {
|
||||
*out = _terminator;
|
||||
++out;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
template<typename InIter, typename OutIter>
|
||||
constexpr OutIter decode(InIter beg, InIter end, OutIter out) const {
|
||||
unsigned int accum = 0;
|
||||
unsigned int remain = 0;
|
||||
char c = 0;
|
||||
|
||||
auto load_next = [&]() {
|
||||
do {
|
||||
if (beg == end || *beg == _terminator) return false;
|
||||
auto val = static_cast<unsigned int>(*beg)-32;
|
||||
++beg;
|
||||
if (val < 96) {
|
||||
c = _charmap[val];
|
||||
if (c != -1) return true;
|
||||
}
|
||||
//skip invalid characters
|
||||
} while (true);
|
||||
};
|
||||
|
||||
while (load_next()) {
|
||||
accum = c;
|
||||
if (!load_next()) {
|
||||
remain = 3;
|
||||
break;
|
||||
}
|
||||
accum = (accum << 6) | c;
|
||||
if (!load_next()) {
|
||||
remain = 2;
|
||||
break;
|
||||
}
|
||||
accum = (accum << 6) | c;
|
||||
if (!load_next()) {
|
||||
remain = 1;
|
||||
break;
|
||||
}
|
||||
accum = (accum << 6) | c;
|
||||
*out = static_cast<char>(accum >> 16);
|
||||
++out;
|
||||
*out = static_cast<char>((accum >> 8) & 0xFF);
|
||||
++out;
|
||||
*out = static_cast<char>(accum & 0xFF);
|
||||
++out;
|
||||
}
|
||||
switch (remain) {
|
||||
default: break;
|
||||
case 2: *out = static_cast<char>(accum >> 4);
|
||||
++out;
|
||||
break;
|
||||
case 1:*out = static_cast<char>(accum >> 10);
|
||||
++out;
|
||||
*out = static_cast<char>((accum >> 2) & 0xFF);
|
||||
++out;
|
||||
break;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
char _charset[64] = {};
|
||||
char _charmap[96] = {};
|
||||
char _terminator;
|
||||
|
||||
};
|
||||
|
||||
inline constexpr auto base64 = base64_t{"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",'='};
|
||||
inline constexpr auto base64url = base64_t{"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",'\0'};
|
||||
|
||||
template<std::size_t N>
|
||||
class binary_data {
|
||||
public:
|
||||
|
||||
static constexpr std::size_t buff_size = (N+3)*3/4;
|
||||
|
||||
constexpr binary_data(const char *txt) {
|
||||
auto res =base64.decode(txt, txt+N, data);
|
||||
sz = res - data;
|
||||
}
|
||||
|
||||
constexpr operator std::basic_string_view<unsigned char>() const {
|
||||
return {data, sz};
|
||||
}
|
||||
|
||||
operator std::string_view() const {
|
||||
return {reinterpret_cast<const char *>(data), sz};
|
||||
}
|
||||
|
||||
|
||||
constexpr auto begin() const {return data;}
|
||||
constexpr auto end() const {return data+sz;}
|
||||
constexpr std::size_t size() const {return sz;}
|
||||
|
||||
protected:
|
||||
std::size_t sz = 0;
|
||||
unsigned char data[buff_size]= {};
|
||||
};
|
||||
|
||||
template<std::size_t N>
|
||||
binary_data(const char (&)[N]) -> binary_data<N>;
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#include <skeldal_win.h>
|
||||
#include <platform.h>
|
||||
// toto je include soubor, jenz je pouzit v knihovne GUI.C
|
||||
|
||||
#include "types.h"
|
||||
|
@ -111,7 +111,7 @@ void button_draw(int x1,int y1,int x2,int y2,OBJREC *o)
|
|||
CTL3D x;
|
||||
char w;
|
||||
|
||||
bar(x1,y1,x2,y2);
|
||||
bar32(x1,y1,x2,y2);
|
||||
highlight(&x,o->color);
|
||||
w=*(char *)o->data;
|
||||
x.bsize=2-w;
|
||||
|
@ -126,7 +126,7 @@ void button_draw2(int x1,int y1,int x2,int y2,OBJREC *o)
|
|||
CTL3D x;
|
||||
char w;
|
||||
|
||||
bar(x1,y1,x2,y2);
|
||||
bar32(x1,y1,x2,y2);
|
||||
highlight(&x,o->color);
|
||||
w=*(char *)o->data;
|
||||
x.bsize=1;
|
||||
|
@ -134,8 +134,8 @@ void button_draw2(int x1,int y1,int x2,int y2,OBJREC *o)
|
|||
draw_border(x1+1,y1+1,x2-x1-2,y2-y1-2,&x);
|
||||
if (!w)
|
||||
{
|
||||
curcolor=x.light;hor_line(x1,y1,x2);hor_line(x1,y1+1,x2);
|
||||
curcolor=x.shadow;hor_line(x1,y2,x2);hor_line(x1,y2-1,x2);
|
||||
curcolor=x.light;hor_line32(x1,y1,x2);hor_line32(x1,y1+1,x2);
|
||||
curcolor=x.shadow;hor_line32(x1,y2,x2);hor_line32(x1,y2-1,x2);
|
||||
}
|
||||
set_aligned_position(((x1+x2)>>1)+(w<<1),((y1+y2)>>1)+(w<<1),1,1,(char *)o->userptr);
|
||||
outtext((char *)o->userptr);
|
||||
|
@ -225,7 +225,7 @@ void draw_status_line(char *c)
|
|||
memcpy(&charcolors,&color,sizeof(charcolors));
|
||||
y=SCR_WIDTH_Y-ysize-3;
|
||||
desktop_y_size=y-3;
|
||||
bar(0,y,SCR_WIDTH_X-1,SCR_WIDTH_Y-1);
|
||||
bar32(0,y,SCR_WIDTH_X-1,SCR_WIDTH_Y-1);
|
||||
draw_border(2,y,SCR_WIDTH_X-5,ysize,&ctl);
|
||||
while (text_width(c)>SCR_WIDTH_X)
|
||||
{
|
||||
|
@ -324,7 +324,7 @@ void *show_time(EVENT_MSG *msg)
|
|||
|
||||
void win_label_draw(int x1,int y1,int x2,int y2,OBJREC *o)
|
||||
{
|
||||
bar(x1,y1,x2,y2);
|
||||
bar32(x1,y1,x2,y2);
|
||||
set_aligned_position(x1+5,(y1+y2)/2,0,1,(char *)o->userptr);
|
||||
outtext((char *)o->userptr);
|
||||
}
|
||||
|
@ -450,18 +450,18 @@ void check_box_draw(int x1,int y1, int x2, int y2,OBJREC *o)
|
|||
x1+=1;y1+=1;x2-=1;y2-=1;
|
||||
x3=x1+(y2-y1);
|
||||
draw_border(x1,y1,x3-x1,y2-y1,def_border(4,curcolor));
|
||||
bar(x1,y1,x3,y2);
|
||||
bar32(x1,y1,x3,y2);
|
||||
if (*(char *)o->data & 1)
|
||||
{
|
||||
curcolor=0x0000;
|
||||
line(x1,y1,x3,y2);line(x1+1,y1,x3,y2-1);line(x1,y1+1,x3-1,y2);
|
||||
line(x1,y2,x3,y1);line(x1+1,y2,x3,y1+1);line(x1,y2-1,x3-1,y1);
|
||||
line32(x1,y1,x3,y2);line32(x1+1,y1,x3,y2-1);line32(x1,y1+1,x3-1,y2);
|
||||
line32(x1,y2,x3,y1);line32(x1+1,y2,x3,y1+1);line32(x1,y2-1,x3-1,y1);
|
||||
}
|
||||
if (*(char *)o->data & 0x80)
|
||||
{
|
||||
curcolor=0x0000;
|
||||
hor_line(x1,y1,x3);ver_line(x3,y1,y2);
|
||||
ver_line(x1,y1,y2);hor_line(x1,y2,x3);
|
||||
hor_line32(x1,y1,x3);ver_line32(x3,y1,y2);
|
||||
ver_line32(x1,y1,y2);hor_line32(x1,y2,x3);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -551,7 +551,7 @@ void radio_butts_draw(int x1,int y1,int x2,int y2,OBJREC *o)
|
|||
cr=curcolor;
|
||||
highlight(&ctl,curcolor);
|
||||
params=(int32_t *)o->userptr;
|
||||
if (*params) bar(x1,y1,x2,y2);
|
||||
if (*params) bar32(x1,y1,x2,y2);
|
||||
step=(y2-y1)/(*(params+1));
|
||||
size=(step*9)/10;
|
||||
sizpul=size>>1;
|
||||
|
@ -561,16 +561,16 @@ void radio_butts_draw(int x1,int y1,int x2,int y2,OBJREC *o)
|
|||
{
|
||||
int j;
|
||||
curcolor=ctl.shadow;
|
||||
line(x1+sizpul,y1,x1,y1+sizpul);
|
||||
line(x1,y1+sizpul,x1+sizpul,y1+size-1);
|
||||
line32(x1+sizpul,y1,x1,y1+sizpul);
|
||||
line32(x1,y1+sizpul,x1+sizpul,y1+size-1);
|
||||
curcolor=ctl.light;
|
||||
line(x1+sizpul+1,y1,x1+size,y1+sizpul);
|
||||
line(x1+size,y1+sizpul,x1+sizpul+1,y1+size-1);
|
||||
line32(x1+sizpul+1,y1,x1+size,y1+sizpul);
|
||||
line32(x1+size,y1+sizpul,x1+sizpul+1,y1+size-1);
|
||||
if (*(int32_t *)o->data==i) curcolor=0;else curcolor=cr;
|
||||
for (j=0;j<3;j++)
|
||||
{
|
||||
hor_line(x1+sizpul-j,y1+sizpul-2+j,x1+sizpul+j);
|
||||
hor_line(x1+sizpul-j,y1+sizpul+2-j,x1+sizpul+j);
|
||||
hor_line32(x1+sizpul-j,y1+sizpul-2+j,x1+sizpul+j);
|
||||
hor_line32(x1+sizpul-j,y1+sizpul+2-j,x1+sizpul+j);
|
||||
}
|
||||
if (*params)
|
||||
{
|
||||
|
@ -689,7 +689,7 @@ void input_line_draw(int x1,int y1, int x2, int y2, OBJREC *o)
|
|||
int len;
|
||||
int shift;
|
||||
|
||||
bar(x1,y1,x2,y2);
|
||||
bar32(x1,y1,x2,y2);
|
||||
position(x1,y1);
|
||||
c=(char *)o->data;
|
||||
if (!*c) return;
|
||||
|
@ -868,7 +868,7 @@ void scroll_button_draw(int x1,int y1,int x2,int y2,OBJREC *o)
|
|||
SCR_BUTTON *param;
|
||||
|
||||
param=(SCR_BUTTON *)o->userptr;
|
||||
bar(x1,y1,x2,y2);
|
||||
bar32(x1,y1,x2,y2);
|
||||
highlight(&x,o->color);
|
||||
w=*(char *)o->data;
|
||||
x.bsize=2-w;
|
||||
|
@ -963,7 +963,7 @@ void scroll_bar_v_draw(int x1,int y1,int x2,int y2,OBJREC *o)
|
|||
if (barsize>wsize) barsize=wsize;
|
||||
wsize-=barsize;
|
||||
curcolor=p->bgcolor;
|
||||
bar(x1,y1,x2,y2);
|
||||
bar32(x1,y1,x2,y2);
|
||||
curcolor=o->color;
|
||||
highlight(&ctl,o->color);ctl.bsize=2;ctl.ctldef=0;
|
||||
y=valsize?(*d-p->minvalue)*(wsize+barsize)/valsize:0;
|
||||
|
@ -972,7 +972,7 @@ void scroll_bar_v_draw(int x1,int y1,int x2,int y2,OBJREC *o)
|
|||
if (y<0) y=0;
|
||||
y+=y1;
|
||||
draw_border(x1+2,y+2,(x2-x1)-4,barsize-4,&ctl);
|
||||
if (barsize>4)bar(x1+2,y+2,x2-2,y+barsize-2);
|
||||
if (barsize>4)bar32(x1+2,y+2,x2-2,y+barsize-2);
|
||||
p->barsize=barsize;
|
||||
}
|
||||
|
||||
|
@ -1076,7 +1076,7 @@ void scroll_bar_h_draw(int x1,int y1,int x2,int y2,OBJREC *o)
|
|||
if (barsize>wsize) barsize=wsize;if (barsize<2) barsize=2;
|
||||
wsize-=barsize;
|
||||
curcolor=p->bgcolor;
|
||||
bar(x1,y1,x2,y2);
|
||||
bar32(x1,y1,x2,y2);
|
||||
curcolor=o->color;
|
||||
highlight(&ctl,o->color);ctl.bsize=2;ctl.ctldef=0;
|
||||
x=(*d-p->minvalue)*wsize/valsize;
|
||||
|
@ -1085,7 +1085,7 @@ void scroll_bar_h_draw(int x1,int y1,int x2,int y2,OBJREC *o)
|
|||
if (x<0) x=0;
|
||||
x+=x1;
|
||||
draw_border(x+2,y1+2,barsize-4,(y2-y1)-4,&ctl);
|
||||
if (barsize>4)bar(x+2,y1+2,x+barsize-2,y2-2);
|
||||
if (barsize>4)bar32(x+2,y1+2,x+barsize-2,y2-2);
|
||||
p->barsize=barsize;
|
||||
}
|
||||
|
||||
|
@ -1234,17 +1234,17 @@ void resizer_draw(int x1,int y1,int x2,int y2,OBJREC *o)
|
|||
|
||||
highlight(&ctl,o->color);
|
||||
curcolor=o->color;
|
||||
bar(x1,y1,x2,y2);
|
||||
bar32(x1,y1,x2,y2);
|
||||
curcolor=ctl.light;
|
||||
line(x2-1,y1+1,x1+1,y2-1);
|
||||
line(x2-1,(y1+y2)>>1,(x1+x2)>>1,y2-1);
|
||||
line32(x2-1,y1+1,x1+1,y2-1);
|
||||
line32(x2-1,(y1+y2)>>1,(x1+x2)>>1,y2-1);
|
||||
curcolor=ctl.shadow;
|
||||
line(x2-1,y1+4,x1+4,y2-1);
|
||||
line(x2-1,y1+2,x2-1,y1+4);
|
||||
line(x1+2,y2-1,x1+4,y2-1);
|
||||
line(x2-1,((y1+y2)>>1)+4,((x1+x2)>>1)+4,y2-1);
|
||||
line(x2-1,((y1+y2)>>1)+2,x2-1,((y1+y2)>>1)+4);
|
||||
line(((x1+x2)>>1)+2,y2-1,((x1+x2)>>1)+4,y2-1);
|
||||
line32(x2-1,y1+4,x1+4,y2-1);
|
||||
line32(x2-1,y1+2,x2-1,y1+4);
|
||||
line32(x1+2,y2-1,x1+4,y2-1);
|
||||
line32(x2-1,((y1+y2)>>1)+4,((x1+x2)>>1)+4,y2-1);
|
||||
line32(x2-1,((y1+y2)>>1)+2,x2-1,((y1+y2)>>1)+4);
|
||||
line32(((x1+x2)>>1)+2,y2-1,((x1+x2)>>1)+4,y2-1);
|
||||
}
|
||||
|
||||
void resizer_event(EVENT_MSG *msg,OBJREC *o)
|
||||
|
|
|
@ -1,22 +1,20 @@
|
|||
#include "types.h"
|
||||
#define line line32
|
||||
#define hor_line hor_line32
|
||||
#define ver_line ver_line32
|
||||
#define bar bar32
|
||||
#define point point32
|
||||
|
||||
|
||||
|
||||
|
||||
word *GetScreenAdr();
|
||||
int32_t GetScreenSizeBytes();
|
||||
word *GetBuffer2nd();
|
||||
int32_t GetScreenPitch();
|
||||
int32_t GetBuffer2ndPitch();
|
||||
int32_t GetScreenSizeBytes();
|
||||
|
||||
void RedirectScreen(word *newaddr);
|
||||
void RestoreScreen();
|
||||
void RedirectScreenBufferSecond();
|
||||
|
||||
|
||||
extern word curcolor,charcolors[7];
|
||||
extern int32_t scr_linelen;
|
||||
extern int32_t scr_linelen2;
|
||||
extern int32_t dx_linelen;
|
||||
extern word *curfont,*writepos,writeposx;
|
||||
extern byte fontdsize;
|
||||
extern byte *palmem,*xlatmem;
|
||||
|
@ -29,7 +27,7 @@ extern char no_restore_mode;
|
|||
|
||||
static __inline word *getadr32(longint x,longint y)
|
||||
{
|
||||
return GetScreenAdr()+scr_linelen2*y+x;
|
||||
return GetScreenAdr()+GetScreenPitch()*y+x;
|
||||
}
|
||||
|
||||
static __inline void point32(longint x,longint y, word color)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include <skeldal_win.h>
|
||||
#include <platform.h>
|
||||
#include "types.h"
|
||||
//#include <vesa.h>
|
||||
//#include <dpmi.h>
|
||||
|
@ -13,9 +13,6 @@
|
|||
|
||||
word *screen;
|
||||
word curcolor,charcolors[7] = {0x0000,RGB555(0,31,0),RGB555(0,28,0),RGB555(0,24,0),RGB555(0,20,0),0x0000,0x0000};
|
||||
int32_t scr_linelen;
|
||||
int32_t scr_linelen2;
|
||||
int32_t dx_linelen;
|
||||
word *curfont,*writepos,writeposx;
|
||||
byte fontdsize=0;
|
||||
byte *palmem=NULL,*xlatmem=NULL;
|
||||
|
@ -302,7 +299,6 @@ int initmode_dx(char inwindow, char zoom, char monitor, int refresh)
|
|||
if (!DXInit64(inwindow,zoom,monitor,refresh)) return -1;
|
||||
showview=showview_dx;
|
||||
screenstate=1;
|
||||
scr_linelen2=scr_linelen/2;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -659,10 +655,10 @@ void set_aligned_position(int x,int y,char alignx,char aligny,char *text)
|
|||
void rectangle(int x1,int y1,int x2,int y2,int color)
|
||||
{
|
||||
curcolor=color;
|
||||
hor_line(x1,y1,x2);
|
||||
hor_line(x1,y2,x2);
|
||||
ver_line(x1,y1,y2);
|
||||
ver_line(x2,y1,y2);
|
||||
hor_line32(x1,y1,x2);
|
||||
hor_line32(x1,y2,x2);
|
||||
ver_line32(x1,y1,y2);
|
||||
ver_line32(x2,y1,y2);
|
||||
}
|
||||
|
||||
void *create_special_palette()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include <skeldal_win.h>
|
||||
#include <platform.h>
|
||||
#include "types.h"
|
||||
#include "bgraph.h"
|
||||
|
||||
|
@ -19,6 +19,7 @@ void bar32(int x1,int y1, int x2, int y2)
|
|||
if (y1<0) y1=0;
|
||||
if (x2>mx) x2=mx;
|
||||
if (y2>my) y2=my;
|
||||
int32_t scr_linelen2 = GetScreenPitch();
|
||||
for (i=y1,begline=GetScreenAdr()+scr_linelen2*i;i<=y2;i++,begline+=scr_linelen2)
|
||||
{
|
||||
for (j=x1;j<=x2;j++) begline[j]=curcolor;
|
||||
|
@ -38,6 +39,7 @@ void hor_line32(int x1,int y1,int x2)
|
|||
if (x1>x2) swap_int(x1,x2);
|
||||
if (x1<0) x1=0;
|
||||
if (x2>mx) x2=mx;
|
||||
int32_t scr_linelen2 = GetScreenPitch();
|
||||
begline=GetScreenAdr()+scr_linelen2*y1;
|
||||
for (i=x1;i<x2;i+=2) *(uint32_t *)(begline+i)=curcolor2;
|
||||
if (i==x2) begline[i]=curcolor;
|
||||
|
@ -54,6 +56,7 @@ void ver_line32(int x1,int y1,int y2)
|
|||
if (x1<0 || x1>mx) return;
|
||||
if (y1<0) y1=0;
|
||||
if (y2>my) y2=my;
|
||||
int32_t scr_linelen2 = GetScreenPitch();
|
||||
begline=GetScreenAdr()+scr_linelen2*y1+x1;
|
||||
for (i=y1;i<=y2;i++,begline+=scr_linelen2) *begline=curcolor;
|
||||
}
|
||||
|
@ -71,6 +74,7 @@ void hor_line_xor(int x1,int y1,int x2)
|
|||
if (x1>x2) swap_int(x1,x2);
|
||||
if (x1<0) x1=0;
|
||||
if (x2>mx) x2=mx;
|
||||
int32_t scr_linelen2 = GetScreenPitch();
|
||||
begline=GetScreenAdr()+scr_linelen2*y1;
|
||||
for (i=x1;i<x2;i+=2) *(uint32_t *)(begline+i)^=curcolor2;
|
||||
if (i==x2) begline[i]^=curcolor;
|
||||
|
@ -88,6 +92,7 @@ void ver_line_xor(int x1,int y1,int y2)
|
|||
if (x1<0 || x1>mx) return;
|
||||
if (y1<0) y1=0;
|
||||
if (y2>my) y2=my;
|
||||
int32_t scr_linelen2 = GetScreenPitch();
|
||||
begline=GetScreenAdr()+scr_linelen2*y1+x1;
|
||||
for (i=y1;i<=y2;i++,begline+=scr_linelen2) *begline^=curcolor;
|
||||
}
|
||||
|
@ -119,6 +124,7 @@ void line_32(int x,int y,int xs,int ys)
|
|||
void char_32(word *posit,word *font,char znak)
|
||||
//#pragma aux char_32 parm [edi] [esi] [eax] modify [eax ebx ecx edx]
|
||||
{
|
||||
int32_t scr_linelen2 = GetScreenPitch();
|
||||
|
||||
word *edi = posit;
|
||||
unsigned char *esi = (unsigned char *)font;
|
||||
|
@ -305,6 +311,7 @@ chsend: and eax,0ffffh
|
|||
void put_picture(word x,word y,void *p)
|
||||
//#pragma aux put_picture parm [esi] [eax] [edi] modify [ebx ecx edx]
|
||||
{
|
||||
int32_t scr_linelen2 = GetScreenPitch();
|
||||
word *adr=GetScreenAdr()+scr_linelen2*y+x;
|
||||
word *data=p;
|
||||
word xs=data[0];
|
||||
|
@ -375,6 +382,7 @@ void put_picture(word x,word y,void *p)
|
|||
}
|
||||
void get_picture(word x,word y,word xs,word ys,void *p)
|
||||
{
|
||||
int32_t scr_linelen2 = GetScreenPitch();
|
||||
word *adr=GetScreenAdr()+scr_linelen2*y+x;
|
||||
word *data=p;
|
||||
word xss=xs;
|
||||
|
@ -403,7 +411,7 @@ void get_picture(word x,word y,word xs,word ys,void *p)
|
|||
void put_image(word *image,word *target,int start_line,int sizex,int sizey)
|
||||
//#pragma aux put_image parm [ESI][EDI][EAX][EBX][EDX] modify [ECX]
|
||||
{
|
||||
|
||||
int32_t scr_linelen2 = GetScreenPitch();
|
||||
word *esi = image;
|
||||
word *edi = target;
|
||||
int eax = start_line;
|
||||
|
@ -457,6 +465,7 @@ puti_lp:mov ecx,ebx
|
|||
void put_8bit_clipped(void *src,void *trg,int startline,int velx,int vely)
|
||||
//#pragma aux put_8bit_clipped parm [ESI][EDI][EAX][EBX][EDX] modify [ECX];
|
||||
{
|
||||
int32_t scr_linelen2 = GetScreenPitch();
|
||||
if (src==NULL) return;
|
||||
{
|
||||
word *esi = src;
|
||||
|
@ -529,6 +538,7 @@ void put_textured_bar_(void *src,void *trg,int xsiz,int ysiz,int xofs,int yofs)
|
|||
//#pragma aux put_textured_bar_ parm [EBX][EDI][EDX][ECX][ESI][EAX];
|
||||
{
|
||||
|
||||
int32_t scr_linelen2 = GetScreenPitch();
|
||||
word *imghdr = (word *)src;
|
||||
word cx = imghdr[0];
|
||||
word cy = imghdr[1];
|
||||
|
@ -633,6 +643,7 @@ ptb_skip2:
|
|||
|
||||
void trans_bar(int x,int y,int xs,int ys,int barva)
|
||||
{
|
||||
int32_t scr_linelen2 = GetScreenPitch();
|
||||
word *begline;
|
||||
int x1=x;
|
||||
int y1=y;
|
||||
|
@ -674,6 +685,7 @@ void trans_bar25(int x,int y,int xs,int ys)
|
|||
int y2=y+ys-1;
|
||||
int i,j;
|
||||
|
||||
int32_t scr_linelen2 = GetScreenPitch();
|
||||
int mx = DxGetResX() - 1;
|
||||
int my = DxGetResY() - 1;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include <skeldal_win.h>
|
||||
#include <platform.h>
|
||||
#include "types.h"
|
||||
#include "bgraph.h"
|
||||
#include <debug.h>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include <skeldal_win.h>
|
||||
#include <platform.h>
|
||||
#include "types.h"
|
||||
#include "bgraph.h"
|
||||
#include "event.h"
|
||||
|
|
|
@ -132,7 +132,7 @@ const char *GetLexLibPath()
|
|||
static char c[MAX_PATH];
|
||||
char *z;
|
||||
GetModuleFileName(0,c,MAX_PATH);
|
||||
z=strrchr(c,'\\')+1;
|
||||
z=strrchr(c,PATH_SEPARATOR_CHR)+1;
|
||||
strcpy(z,"lex_lib.exe");
|
||||
return c;
|
||||
}
|
||||
|
@ -149,8 +149,8 @@ main(int argc,char *argv[])
|
|||
exit(0);
|
||||
}
|
||||
puts("");
|
||||
puts("Probˇh kompilace:");
|
||||
puts(" Spouçtˇm program LEX_LIB.EXE\n");
|
||||
puts("Prob<EFBFBD>h<EFBFBD> kompilace:");
|
||||
puts(" Spou<EFBFBD>t<EFBFBD>m program LEX_LIB.EXE\n");
|
||||
putenv("DOS4G=QUIET");
|
||||
z=(char *)malloc(strlen(argv[1])+10);
|
||||
sprintf(z,"\"%s\"",argv[1]);
|
||||
|
@ -162,8 +162,8 @@ main(int argc,char *argv[])
|
|||
puts("Nemohu spustit program lex_lib.exe");
|
||||
exit(1);
|
||||
}
|
||||
puts("Byla kompilov na tato kouzla:");
|
||||
puts("¬ˇslo, zaź tek, jmeno:");
|
||||
puts("Byla kompilov<EFBFBD>na tato kouzla:");
|
||||
puts("<EFBFBD><EFBFBD>slo, za<7A><61>tek, jmeno:");
|
||||
puts("======================");
|
||||
memset(kouzla_tab,0,sizeof(kouzla_tab));
|
||||
init("temp.$$$");
|
||||
|
@ -172,8 +172,8 @@ main(int argc,char *argv[])
|
|||
fclose(source);
|
||||
save_tab("kouzla.dat");
|
||||
remove("temp.$$$");
|
||||
puts("Kompilace ŁspŘçn ...");
|
||||
printf("D‚lka k˘du: %d (+%d)",codesize,sizeof(kouzla_tab));
|
||||
puts("Kompilace <EFBFBD>sp<EFBFBD><EFBFBD>n<EFBFBD>...");
|
||||
printf("D<EFBFBD>lka k<>du: %d (+%d)",codesize,sizeof(kouzla_tab));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include <skeldal_win.h>
|
||||
#include <platform.h>
|
||||
#include "types.h"
|
||||
#include <stdio.h>
|
||||
#include <bios.h>
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include "types.h"
|
||||
#include "event.h"
|
||||
#include "mouse.h"
|
||||
typedef struct tms_basic_info
|
||||
{
|
||||
int mouse_event;
|
||||
|
@ -14,21 +15,8 @@ typedef struct tms_basic_info
|
|||
signed short mouse_di;
|
||||
}TMS_BASIC_INFO;
|
||||
|
||||
typedef struct ms_event
|
||||
{
|
||||
char event;
|
||||
word x,y;
|
||||
char tl1,tl2,tl3;
|
||||
word event_type;
|
||||
}MS_EVENT;
|
||||
|
||||
extern TMS_BASIC_INFO ms_basic_info;
|
||||
extern char ms_fake_mode;
|
||||
|
||||
//int install_mouse_handler();
|
||||
//int deinstall_mouse_handler();
|
||||
//void hranice_mysky(int x1,int y1,int x2,int y2);
|
||||
void get_ms_event(MS_EVENT *event);
|
||||
int lock_region (void *address, unsigned length);
|
||||
void keyboard(EVENT_MSG *msg,void *user_data);
|
||||
char ms_get_keycount();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include <skeldal_win.h>
|
||||
#include <platform.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "types.h"
|
||||
|
|
13
libs/gui.c
13
libs/gui.c
|
@ -1,4 +1,4 @@
|
|||
#include <skeldal_win.h>
|
||||
#include <platform.h>
|
||||
//Gui system - object system + graphic
|
||||
#include "types.h"
|
||||
#include <stdio.h>
|
||||
|
@ -64,11 +64,11 @@ void draw_border(integer x,integer y,integer xs,integer ys,CTL3D *btype)
|
|||
{
|
||||
x--;y--;xs+=2;ys+=2;
|
||||
if (j & 1) curcolor=btype->shadow; else curcolor=btype->light;
|
||||
hor_line(x,y,xs+x);
|
||||
ver_line(x,y,ys+y);
|
||||
hor_line32(x,y,xs+x);
|
||||
ver_line32(x,y,ys+y);
|
||||
if (j & 1) curcolor=btype->light; else curcolor=btype->shadow;
|
||||
hor_line(x,y+ys,xs+x);
|
||||
ver_line(x+xs,y,ys+y);
|
||||
hor_line32(x,y+ys,xs+x);
|
||||
ver_line32(x+xs,y,ys+y);
|
||||
j>>=1;
|
||||
}
|
||||
curcolor=c;
|
||||
|
@ -231,6 +231,7 @@ void absolute_window(WINDOW *w,OBJREC *o, int *x, int *y)
|
|||
{
|
||||
int i,j;
|
||||
word *a;
|
||||
int32_t scr_linelen2 = GetScreenPitch();
|
||||
|
||||
for (i=y;i<=y+ys;i++)
|
||||
{
|
||||
|
@ -434,7 +435,7 @@ void redraw_desktop_call(EVENT_MSG *msg,void **data)
|
|||
if (gui_background==NULL)
|
||||
{
|
||||
curcolor=DESK_TOP_COLOR;
|
||||
bar(0,0,SCR_WIDTH_X,SCR_WIDTH_Y-1);
|
||||
bar32(0,0,SCR_WIDTH_X,SCR_WIDTH_Y-1);
|
||||
}
|
||||
else
|
||||
put_picture(0,0,gui_background);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include <skeldal_win.h>
|
||||
#include <platform.h>
|
||||
#include <stdio.h>
|
||||
#include <malloc.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -104,7 +104,7 @@ void add_field_num(TSTR_LIST *ls,const char *name,int32_t number)
|
|||
{
|
||||
char buff[20];
|
||||
|
||||
itoa(number,buff,10);
|
||||
int2ascii(number,buff,10);
|
||||
add_field_txt(ls,name,buff);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include <skeldal_win.h>
|
||||
#include <platform.h>
|
||||
#include "types.h"
|
||||
#include <mem.h>
|
||||
#include <stdio.h>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include <skeldal_win.h>
|
||||
#include <platform.h>
|
||||
// MOTION GIF - LZW komprimovana animace v rozliseni 320x180 256 barev avsak
|
||||
// upravena pro prehravani v HICOLOR pro konkretni rezim (32768 barev)
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include <skeldal_win.h>
|
||||
#include <platform.h>
|
||||
#include <bgraph.h>
|
||||
#include <stdio.h>
|
||||
#include "types.h"
|
||||
|
@ -53,6 +53,7 @@ static void StretchImageHQ(word *src, word *trg, uint32_t linelen, char full)
|
|||
|
||||
static void PlayMGFFile(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;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include <skeldal_win.h>
|
||||
#include <platform.h>
|
||||
#include <stdio.h>
|
||||
#include "types.h"
|
||||
#include "memman.h"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include <skeldal_win.h>
|
||||
#include <platform.h>
|
||||
#include "types.h"
|
||||
#include <mgfplay.h>
|
||||
#include <bgraph.h>
|
||||
|
|
24
libs/mouse.h
Normal file
24
libs/mouse.h
Normal file
|
@ -0,0 +1,24 @@
|
|||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef __SKELDAL__MOUSE__
|
||||
#define __SKELDAL__MOUSE__
|
||||
typedef struct ms_event
|
||||
{
|
||||
char event;
|
||||
uint16_t x,y;
|
||||
char tl1,tl2,tl3;
|
||||
uint16_t event_type;
|
||||
}MS_EVENT;
|
||||
|
||||
|
||||
void get_ms_event(MS_EVENT *event);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
|
@ -1,4 +1,4 @@
|
|||
#include <skeldal_win.h>
|
||||
#include <platform.h>
|
||||
#include <malloc.h>
|
||||
#include <mem.h>
|
||||
#include <stdio.h>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include <skeldal_win.h>
|
||||
#include <platform.h>
|
||||
#include <stdio.h>
|
||||
#include <mem.h>
|
||||
#include "types.h"
|
||||
|
@ -17,8 +17,8 @@ int bott_line;
|
|||
int base_line;
|
||||
int top_ofs;
|
||||
|
||||
char znaky[]="0123456789A<EFBFBD>BC€D…E<EFBFBD>‰FGHI‹JKLŠœMN¥O•PQRžS›T†U—¦VWXY<EFBFBD>Z’"
|
||||
"a bc‡dƒe‚ˆfghi¡jkl<EFBFBD>Œmn¤o¢pqr©s¨tŸu£–vwxy˜z‘"
|
||||
char znaky[]="0123456789A<EFBFBD>BC<EFBFBD>D<EFBFBD>E<EFBFBD><EFBFBD>FGHI<EFBFBD>JKL<EFBFBD><EFBFBD>MN<EFBFBD>O<EFBFBD>PQR<EFBFBD>S<EFBFBD>T<EFBFBD>U<EFBFBD><EFBFBD>VWXY<EFBFBD>Z<EFBFBD>"
|
||||
"a<EFBFBD>bc<EFBFBD>d<EFBFBD>e<EFBFBD><EFBFBD>fghi<EFBFBD>jkl<EFBFBD><EFBFBD>mn<EFBFBD>o<EFBFBD>pqr<EFBFBD>s<EFBFBD>t<EFBFBD>u<EFBFBD><EFBFBD>vwxy<EFBFBD>z<EFBFBD>"
|
||||
"~!@#$%^&*()_+|-=\\[]{};':,./<>?";
|
||||
|
||||
void load_font_pic(char *filename)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include <skeldal_win.h>
|
||||
#include <platform.h>
|
||||
#include "strlite.c"
|
||||
|
||||
#include "devices.h"
|
||||
|
@ -100,7 +100,7 @@ void string_list_draw(int x1,int y1,int x2,int y2,OBJREC *o)
|
|||
xs=x2-x1;ys=y2-y1;
|
||||
p=o->userptr;
|
||||
ls=p->list;
|
||||
bar(x1,y1,x2,y2);
|
||||
bar32(x1,y1,x2,y2);
|
||||
y=y1;p->maxitems=str_count(ls);
|
||||
for(j=p->maxitems-1;j>=0;j--) if (ls[j]!=NULL) break;
|
||||
j++;
|
||||
|
@ -124,7 +124,7 @@ void string_list_draw(int x1,int y1,int x2,int y2,OBJREC *o)
|
|||
if (i==*(int *)(o->data))
|
||||
{
|
||||
curcolor=p->selcolor;
|
||||
bar(x1,y,x2,y+znh-1);
|
||||
bar32(x1,y,x2,y+znh-1);
|
||||
}
|
||||
position(x1,y);
|
||||
for(j=0,x=x1,savech[0]=c[j];
|
||||
|
@ -145,7 +145,7 @@ void string_list_draw(int x1,int y1,int x2,int y2,OBJREC *o)
|
|||
int dif=y2-(y+znh);
|
||||
p->topline-=(dif*2/3)/znh+1;
|
||||
curcolor=savcolor;
|
||||
bar(x1,y1,x2,y2);
|
||||
bar32(x1,y1,x2,y2);
|
||||
}
|
||||
}
|
||||
while (p->topline && y+2*znh<y2 && znh);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include <skeldal_win.h>
|
||||
#include <platform.h>
|
||||
#include "strlite.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
@ -14,7 +14,7 @@ TSTR_LIST create_list(int count)
|
|||
size_t *s=(size_t *)malloc(count*sizeof(*p)+sizeof(size_t));
|
||||
if (p==NULL) return NULL;
|
||||
*s = count;
|
||||
p = (TSTR_LIST)s;
|
||||
p = (TSTR_LIST)(s+1);
|
||||
for(i=0;i<count;i++) p[i]=NULL;
|
||||
return p;
|
||||
}
|
||||
|
|
11
libs/types.h
11
libs/types.h
|
@ -1,4 +1,13 @@
|
|||
#define byte char
|
||||
#define integer signed short
|
||||
#define word unsigned short
|
||||
#define longint int32_t
|
||||
#define longint int32_t
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
#define PATH_SEPARATOR "\\"
|
||||
#define PATH_SEPARATOR_CHR '\\'
|
||||
#else
|
||||
#define PATH_SEPARATOR "/"
|
||||
#define PATH_SEPARATOR_CHR '/'
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include <skeldal_win.h>
|
||||
#include <platform.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
|
|
@ -2,10 +2,9 @@
|
|||
#include <stdio.h>
|
||||
//#include <i86.h>
|
||||
//#include <dpmi.h>
|
||||
#include <conio.h>
|
||||
|
||||
#include <mem.h>
|
||||
#include <bios.h>
|
||||
#include <dos.h>
|
||||
#include "zvuk.h"
|
||||
//#include "pcspeak.h"
|
||||
|
||||
|
@ -101,7 +100,7 @@ int bxbass=0;
|
|||
static int gfxvol=255;
|
||||
int32_t blength;
|
||||
static char depack[32768];
|
||||
void (__far __interrupt *oldvect)();
|
||||
//void (__far __interrupt *oldvect)();
|
||||
static char swap_chans=0;
|
||||
|
||||
char da_xlat[256]; // Xlat tabulka pro DA a PC Speaker;
|
||||
|
|
|
@ -27,7 +27,6 @@ char start_mixing();
|
|||
void stop_mixing();
|
||||
void play_sample(int channel,void *sample,int32_t size,int32_t lstart,int32_t sfreq,int type);
|
||||
void set_channel_volume(int channel,int left,int right);
|
||||
void init_winamp_plugins(const char *path);
|
||||
void set_end_of_song_callback(const char * (*cb)(void *), void *ctx);
|
||||
|
||||
void fade_music();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#define INITGUID
|
||||
#include <skeldal_win.h>
|
||||
#include <platform.h>
|
||||
#include <malloc.h>
|
||||
#include <debug.h>
|
||||
#include <stdio.h>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue