mirror of
https://github.com/ondra-novak/gates_of_skeldal.git
synced 2025-07-05 14:10:27 -04:00
win: winmain, manifest, icon, and some improvements
This commit is contained in:
parent
f70b29abab
commit
7bea57e587
23 changed files with 203 additions and 140 deletions
|
@ -32,7 +32,7 @@ struct tbarva palette[256];
|
||||||
|
|
||||||
char datapath[]="";
|
char datapath[]="";
|
||||||
extern struct all_view showtabs;
|
extern struct all_view showtabs;
|
||||||
extern t_points points;
|
extern t_points viewport_geometry;
|
||||||
|
|
||||||
void do_events()
|
void do_events()
|
||||||
{
|
{
|
||||||
|
@ -103,11 +103,11 @@ void draw_it_all_f()
|
||||||
int i,m,y,m2,s;
|
int i,m,y,m2,s;
|
||||||
|
|
||||||
y=0;s=0;
|
y=0;s=0;
|
||||||
m2=(360-MIDDLE_Y)-points[0][0][VIEW3D_Z].y;
|
m2=(360-MIDDLE_Y)-viewport_geometry[0][0][VIEW3D_Z].y;
|
||||||
shadow_max=m2;
|
shadow_max=m2;
|
||||||
for (i=0;i<VIEW3D_Z;i++)
|
for (i=0;i<VIEW3D_Z;i++)
|
||||||
{
|
{
|
||||||
m=points[0][0][i].y-points[0][0][i+1].y;
|
m=viewport_geometry[0][0][i].y-viewport_geometry[0][0][i+1].y;
|
||||||
while (draw_one_line_f(y++,m,s) && y<m2);
|
while (draw_one_line_f(y++,m,s) && y<m2);
|
||||||
s=!s;
|
s=!s;
|
||||||
}
|
}
|
||||||
|
@ -149,11 +149,11 @@ void draw_it_all_c()
|
||||||
int i,m,y,m2,s;
|
int i,m,y,m2,s;
|
||||||
|
|
||||||
y=0;s=0;
|
y=0;s=0;
|
||||||
m2=MIDDLE_Y+points[0][1][VIEW3D_Z].y;
|
m2=MIDDLE_Y+viewport_geometry[0][1][VIEW3D_Z].y;
|
||||||
shadow_max=m2;
|
shadow_max=m2;
|
||||||
for (i=0;i<VIEW3D_Z;i++)
|
for (i=0;i<VIEW3D_Z;i++)
|
||||||
{
|
{
|
||||||
m=points[0][1][i+1].y-points[0][1][i].y;
|
m=viewport_geometry[0][1][i+1].y-viewport_geometry[0][1][i].y;
|
||||||
while (draw_one_line_c(y++,m,s) && y<m2);
|
while (draw_one_line_c(y++,m,s) && y<m2);
|
||||||
s=!s;
|
s=!s;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/default_font.base64
|
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/default_font.base64
|
||||||
COMMAND base64 ${CMAKE_CURRENT_LIST_DIR}/boldcz.fon -w 0 > ${CMAKE_BINARY_DIR}/default_font.base64
|
COMMAND file_to_base64 ${CMAKE_CURRENT_LIST_DIR}/boldcz.fon > ${CMAKE_BINARY_DIR}/default_font.base64
|
||||||
DEPENDS ${CMAKE_CURRENT_LIST_DIR}/boldcz.fon)
|
DEPENDS ${CMAKE_CURRENT_LIST_DIR}/boldcz.fon)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1029,7 +1029,7 @@ int draw_sloup_sector(int celx,int cely,int sector)
|
||||||
if (q->flags & SD_SPEC)
|
if (q->flags & SD_SPEC)
|
||||||
show_cel2(celx,cely-1,ablock(num_ofsets[MAIN_NUM]+q->sec+(q->sec_anim>>4)),0,0,2, ghost_walls| (q->flags & tmask));
|
show_cel2(celx,cely-1,ablock(num_ofsets[MAIN_NUM]+q->sec+(q->sec_anim>>4)),0,0,2, ghost_walls| (q->flags & tmask));
|
||||||
else
|
else
|
||||||
show_cel2(celx,cely-1,ablock(num_ofsets[MAIN_NUM]+q->sec+(q->sec_anim>>4)),(q->xsec<<1)+celx*(points[0][0][cely].x-points[0][0][cely-1].x)/2,q->ysec<<1,0, ghost_walls| (q->flags & tmask));
|
show_cel2(celx,cely-1,ablock(num_ofsets[MAIN_NUM]+q->sec+(q->sec_anim>>4)),(q->xsec<<1)+celx*(viewport_geometry[0][0][cely].x-viewport_geometry[0][0][cely-1].x)/2,q->ysec<<1,0, ghost_walls| (q->flags & tmask));
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1075,10 +1075,10 @@ void draw_sector(int celx,int cely,int s)
|
||||||
void back_clear(int celx,int color)
|
void back_clear(int celx,int color)
|
||||||
{
|
{
|
||||||
int x1,y1,x2,y2,xc;
|
int x1,y1,x2,y2,xc;
|
||||||
y1=points[0][0][VIEW3D_Z].y+MIDDLE_Y+SCREEN_OFFLINE;
|
y1=viewport_geometry[0][0][VIEW3D_Z].y+MIDDLE_Y+SCREEN_OFFLINE;
|
||||||
y2=points[0][1][VIEW3D_Z].y+MIDDLE_Y+SCREEN_OFFLINE;
|
y2=viewport_geometry[0][1][VIEW3D_Z].y+MIDDLE_Y+SCREEN_OFFLINE;
|
||||||
x2=points[0][1][VIEW3D_Z].x+MIDDLE_X;
|
x2=viewport_geometry[0][1][VIEW3D_Z].x+MIDDLE_X;
|
||||||
x1=-points[0][1][VIEW3D_Z].x+MIDDLE_X;
|
x1=-viewport_geometry[0][1][VIEW3D_Z].x+MIDDLE_X;
|
||||||
xc=(x2-x1+2)*celx;
|
xc=(x2-x1+2)*celx;
|
||||||
x1=x1+xc-1;
|
x1=x1+xc-1;
|
||||||
x2=x2+xc;
|
x2=x2+xc;
|
||||||
|
|
|
@ -45,10 +45,10 @@ char clk_touch_vyk(int sector,int side,int xr,int yr)
|
||||||
x2=v->xpos+v->xs/2;
|
x2=v->xpos+v->xs/2;
|
||||||
y1=320-(v->ypos+v->ys);
|
y1=320-(v->ypos+v->ys);
|
||||||
y2=320-(v->ypos);
|
y2=320-(v->ypos);
|
||||||
x1+=MIDDLE_X-points[0][1][1].x;
|
x1+=MIDDLE_X-viewport_geometry[0][1][1].x;
|
||||||
x2+=MIDDLE_X-points[0][1][1].x;
|
x2+=MIDDLE_X-viewport_geometry[0][1][1].x;
|
||||||
y1+=MIDDLE_Y+points[0][1][1].y;
|
y1+=MIDDLE_Y+viewport_geometry[0][1][1].y;
|
||||||
y2+=MIDDLE_Y+points[0][1][1].y;
|
y2+=MIDDLE_Y+viewport_geometry[0][1][1].y;
|
||||||
if (x1<=xr && xr<=x2 && y1<=yr && yr<=y2)
|
if (x1<=xr && xr<=x2 && y1<=yr && yr<=y2)
|
||||||
{
|
{
|
||||||
if (picked_item==NULL)
|
if (picked_item==NULL)
|
||||||
|
@ -113,18 +113,18 @@ char clk_touch(int id,int xa,int ya,int xr,int yr)
|
||||||
y2=ya+y1/2;
|
y2=ya+y1/2;
|
||||||
y1=y2-y1;
|
y1=y2-y1;
|
||||||
x1=x2-x1;
|
x1=x2-x1;
|
||||||
x1+=MIDDLE_X-points[0][1][1].x;
|
x1+=MIDDLE_X-viewport_geometry[0][1][1].x;
|
||||||
x2+=MIDDLE_X-points[0][1][1].x;
|
x2+=MIDDLE_X-viewport_geometry[0][1][1].x;
|
||||||
y1+=MIDDLE_Y+points[0][1][1].y;
|
y1+=MIDDLE_Y+viewport_geometry[0][1][1].y;
|
||||||
y2+=MIDDLE_Y+points[0][1][1].y;
|
y2+=MIDDLE_Y+viewport_geometry[0][1][1].y;
|
||||||
ext=1;
|
ext=1;
|
||||||
}
|
}
|
||||||
else if (map_sides[id].sec==0)
|
else if (map_sides[id].sec==0)
|
||||||
{
|
{
|
||||||
x1=MIDDLE_X-points[0][0][1].x;
|
x1=MIDDLE_X-viewport_geometry[0][0][1].x;
|
||||||
y1=MIDDLE_Y+points[0][1][1].y;
|
y1=MIDDLE_Y+viewport_geometry[0][1][1].y;
|
||||||
x2=640-x1;
|
x2=640-x1;
|
||||||
y2=MIDDLE_Y+points[0][0][1].y;
|
y2=MIDDLE_Y+viewport_geometry[0][0][1].y;
|
||||||
ext=((map_sides[id].flags & SD_THING_IMPS) && !(map_sides[id].oblouk & SD_ITPUSH));
|
ext=((map_sides[id].flags & SD_THING_IMPS) && !(map_sides[id].oblouk & SD_ITPUSH));
|
||||||
}
|
}
|
||||||
else return 0;
|
else return 0;
|
||||||
|
|
143
game/engine1.c
143
game/engine1.c
|
@ -16,16 +16,16 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#define CTVR 128
|
#define CTVR 128
|
||||||
|
|
||||||
t_points points;
|
t_points viewport_geometry;
|
||||||
struct all_view showtabs;
|
struct all_view showtabs;
|
||||||
static char backgrnd_mode=0;
|
static char backgrnd_mode=0;
|
||||||
|
|
||||||
static int lclip,rclip;
|
static int lclip,rclip;
|
||||||
|
|
||||||
ZOOMINFO zoom;
|
ZOOMINFO zoom;
|
||||||
char zooming_xtable[ZOOM_PHASES][VIEW_SIZE_X];
|
static char zooming_xtable[ZOOM_PHASES][VIEW_SIZE_X];
|
||||||
short zooming_ytable[ZOOM_PHASES][VIEW_SIZE_Y];
|
static short zooming_ytable[ZOOM_PHASES][VIEW_SIZE_Y];
|
||||||
short zooming_points[ZOOM_PHASES][4]
|
static short zooming_points[ZOOM_PHASES][4]
|
||||||
={
|
={
|
||||||
{620,349,10,3},
|
{620,349,10,3},
|
||||||
{600,338,20,7},
|
{600,338,20,7},
|
||||||
|
@ -37,9 +37,9 @@ short zooming_points[ZOOM_PHASES][4]
|
||||||
{480,271,80,28},
|
{480,271,80,28},
|
||||||
{460,259,90,31}
|
{460,259,90,31}
|
||||||
};
|
};
|
||||||
int zooming_step=2;
|
static int zooming_step=2;
|
||||||
int rot_phases=2;
|
static int rot_phases=1;
|
||||||
int yreq;
|
//int yreq;
|
||||||
int last_scale;
|
int last_scale;
|
||||||
char secnd_shade=1;
|
char secnd_shade=1;
|
||||||
|
|
||||||
|
@ -100,11 +100,11 @@ void lodka64b(void *source,void *target,void *background,void *xlat,int32_t xysi
|
||||||
//#pragma aux lodka64b parm [ESI][EDI][EAX][EBX][ECX] modify [EAX EDX]
|
//#pragma aux lodka64b parm [ESI][EDI][EAX][EBX][ECX] modify [EAX EDX]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void *p,*p2,*pozadi,*podlaha,*strop,*sit;int i;
|
//void *p,*p2,*pozadi,*podlaha,*strop,*sit;int i;
|
||||||
void (*zooming)(void *source,int32_t target,word *background,void *xlat,int32_t xysize);
|
//void (*zooming)(void *source,int32_t target,word *background,void *xlat,int32_t xysize);
|
||||||
void (*turn)(int32_t lbuf,void *src1,void *src2,int size1);
|
//void (*turn)(int32_t lbuf,void *src1,void *src2,int size1);
|
||||||
word *GetBuffer2nd();
|
//word *GetBuffer2nd();
|
||||||
word *background;
|
//word *background;
|
||||||
char nofloors=0,show_names=0,show_lives=0;
|
char nofloors=0,show_names=0,show_lives=0;
|
||||||
|
|
||||||
|
|
||||||
|
@ -232,10 +232,10 @@ void calc_points(void)
|
||||||
x2=START_X2+2*START_X1*j;y2=START_Y2;
|
x2=START_X2+2*START_X1*j;y2=START_Y2;
|
||||||
for (i=0;i<VIEW3D_Z+1;i++)
|
for (i=0;i<VIEW3D_Z+1;i++)
|
||||||
{
|
{
|
||||||
points[j][0][i].x=x1;
|
viewport_geometry[j][0][i].x=x1;
|
||||||
points[j][0][i].y=y1;
|
viewport_geometry[j][0][i].y=y1;
|
||||||
points[j][1][i].x=x2;
|
viewport_geometry[j][1][i].x=x2;
|
||||||
points[j][1][i].y=y2;
|
viewport_geometry[j][1][i].y=y2;
|
||||||
x2=(int)(x2-x2/FACTOR_3D);
|
x2=(int)(x2-x2/FACTOR_3D);
|
||||||
y2=(int)(y2-y2/FACTOR_3D);
|
y2=(int)(y2-y2/FACTOR_3D);
|
||||||
x1=(int)(x1-x1/FACTOR_3D);
|
x1=(int)(x1-x1/FACTOR_3D);
|
||||||
|
@ -286,9 +286,9 @@ void create_tables(void)
|
||||||
|
|
||||||
for (y=0;y<VIEW3D_Z+1;y++)
|
for (y=0;y<VIEW3D_Z+1;y++)
|
||||||
{
|
{
|
||||||
showtabs.y_table[y].vert_size=points[1][0][y].y-points[1][1][y].y;
|
showtabs.y_table[y].vert_size=viewport_geometry[1][0][y].y-viewport_geometry[1][1][y].y;
|
||||||
showtabs.y_table[y].vert_total=(points[1][0][y].y+MIDDLE_Y);
|
showtabs.y_table[y].vert_total=(viewport_geometry[1][0][y].y+MIDDLE_Y);
|
||||||
showtabs.y_table[y].drawline=((points[1][0][y].y+MIDDLE_Y));
|
showtabs.y_table[y].drawline=((viewport_geometry[1][0][y].y+MIDDLE_Y));
|
||||||
calc_y_buffer(showtabs.y_table[y].zoom_table,TXT_SIZE_Y,showtabs.y_table[y].vert_size,TAB_SIZE_Y);
|
calc_y_buffer(showtabs.y_table[y].zoom_table,TXT_SIZE_Y,showtabs.y_table[y].vert_size,TAB_SIZE_Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,21 +297,21 @@ void create_tables(void)
|
||||||
{
|
{
|
||||||
int rozdil1,rozdil2,rozdil3;
|
int rozdil1,rozdil2,rozdil3;
|
||||||
|
|
||||||
if (points[x][0][y+1].x>MIDDLE_X) showtabs.z_table[x][y].used=0;
|
if (viewport_geometry[x][0][y+1].x>MIDDLE_X) showtabs.z_table[x][y].used=0;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
showtabs.z_table[x][y].used=1;
|
showtabs.z_table[x][y].used=1;
|
||||||
rozdil1=points[x][0][y].x-points[x][0][y+1].x;
|
rozdil1=viewport_geometry[x][0][y].x-viewport_geometry[x][0][y+1].x;
|
||||||
rozdil2=rozdil1-MIDDLE_X+points[x][0][y+1].x;
|
rozdil2=rozdil1-MIDDLE_X+viewport_geometry[x][0][y+1].x;
|
||||||
rozdil3=points[0][0][y].x-points[0][0][y+1].x;
|
rozdil3=viewport_geometry[0][0][y].x-viewport_geometry[0][0][y+1].x;
|
||||||
if (rozdil2<0)
|
if (rozdil2<0)
|
||||||
{
|
{
|
||||||
showtabs.z_table[x][y].xpos=MIDDLE_X-points[x][0][y].x;
|
showtabs.z_table[x][y].xpos=MIDDLE_X-viewport_geometry[x][0][y].x;
|
||||||
showtabs.z_table[x][y].txtoffset=0;
|
showtabs.z_table[x][y].txtoffset=0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
showtabs.z_table[x][y].xpos=MIDDLE_X-points[x][0][y].x;
|
showtabs.z_table[x][y].xpos=MIDDLE_X-viewport_geometry[x][0][y].x;
|
||||||
showtabs.z_table[x][y].txtoffset=(TXT_SIZE_X_3D*rozdil2/rozdil1);
|
showtabs.z_table[x][y].txtoffset=(TXT_SIZE_X_3D*rozdil2/rozdil1);
|
||||||
}
|
}
|
||||||
showtabs.z_table[x][y].point_total=rozdil1;
|
showtabs.z_table[x][y].point_total=rozdil1;
|
||||||
|
@ -325,23 +325,23 @@ void create_tables(void)
|
||||||
{
|
{
|
||||||
int rozdil1,rozdil2;
|
int rozdil1,rozdil2;
|
||||||
|
|
||||||
if (x && points[x-1][0][y].x>TXT_SIZE_X) showtabs.z_table[x][y].used=0;
|
if (x && viewport_geometry[x-1][0][y].x>TXT_SIZE_X) showtabs.z_table[x][y].used=0;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
showtabs.x_table[x][y].used=1;
|
showtabs.x_table[x][y].used=1;
|
||||||
rozdil1=points[1][0][y+1].x-points[0][0][y+1].x;
|
rozdil1=viewport_geometry[1][0][y+1].x-viewport_geometry[0][0][y+1].x;
|
||||||
rozdil2=-MIDDLE_X+points[x][0][y+1].x;
|
rozdil2=-MIDDLE_X+viewport_geometry[x][0][y+1].x;
|
||||||
if (rozdil2<0)
|
if (rozdil2<0)
|
||||||
{
|
{
|
||||||
showtabs.x_table[x][y].xpos=MIDDLE_X-points[x][0][y+1].x;
|
showtabs.x_table[x][y].xpos=MIDDLE_X-viewport_geometry[x][0][y+1].x;
|
||||||
showtabs.x_table[x][y].txtoffset=0;
|
showtabs.x_table[x][y].txtoffset=0;
|
||||||
showtabs.x_table[x][y].max_x=rozdil1;
|
showtabs.x_table[x][y].max_x=rozdil1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
showtabs.x_table[x][y].xpos=MIDDLE_X-points[x][0][y+1].x;
|
showtabs.x_table[x][y].xpos=MIDDLE_X-viewport_geometry[x][0][y+1].x;
|
||||||
showtabs.x_table[x][y].txtoffset=(TXT_SIZE_X*rozdil2/rozdil1);
|
showtabs.x_table[x][y].txtoffset=(TXT_SIZE_X*rozdil2/rozdil1);
|
||||||
showtabs.x_table[x][y].max_x=MIDDLE_X-points[x-1][0][y+1].x;
|
showtabs.x_table[x][y].max_x=MIDDLE_X-viewport_geometry[x-1][0][y+1].x;
|
||||||
}
|
}
|
||||||
if (x!=0)showtabs.x_table[x][y].xpos2=VIEW_SIZE_X-(showtabs.x_table[x][y].xpos+rozdil1);
|
if (x!=0)showtabs.x_table[x][y].xpos2=VIEW_SIZE_X-(showtabs.x_table[x][y].xpos+rozdil1);
|
||||||
showtabs.x_table[x][y].point_total=rozdil1;
|
showtabs.x_table[x][y].point_total=rozdil1;
|
||||||
|
@ -357,32 +357,32 @@ void create_tables(void)
|
||||||
|
|
||||||
strd=CF_XMAP_SIZE>>1;
|
strd=CF_XMAP_SIZE>>1;
|
||||||
y1=(VIEW_SIZE_Y-y)-MIDDLE_Y;
|
y1=(VIEW_SIZE_Y-y)-MIDDLE_Y;
|
||||||
yp=1;while (points[0][0][yp].y>y1) yp++;
|
yp=1;while (viewport_geometry[0][0][yp].y>y1) yp++;
|
||||||
if (x<strd)
|
if (x<strd)
|
||||||
{
|
{
|
||||||
xl=-points[strd-x][0][0].x;xr=-points[strd-x-1][0][0].x;
|
xl=-viewport_geometry[strd-x][0][0].x;xr=-viewport_geometry[strd-x-1][0][0].x;
|
||||||
}
|
}
|
||||||
else if (x==strd)
|
else if (x==strd)
|
||||||
{
|
{
|
||||||
xl=-points[0][0][0].x;xr=+points[0][0][0].x;
|
xl=-viewport_geometry[0][0][0].x;xr=+viewport_geometry[0][0][0].x;
|
||||||
}
|
}
|
||||||
else if (x>strd)
|
else if (x>strd)
|
||||||
{
|
{
|
||||||
xl=+points[x-strd-1][0][0].x;xr=+points[x-strd][0][0].x;
|
xl=+viewport_geometry[x-strd-1][0][0].x;xr=+viewport_geometry[x-strd][0][0].x;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
y1=(VIEW_SIZE_Y-y)-MIDDLE_Y;
|
y1=(VIEW_SIZE_Y-y)-MIDDLE_Y;
|
||||||
xl=xl*(y1+1)/points[0][0][0].y+MIDDLE_X;
|
xl=xl*(y1+1)/viewport_geometry[0][0][0].y+MIDDLE_X;
|
||||||
xr=xr*(y1+1)/points[0][0][0].y+MIDDLE_X;
|
xr=xr*(y1+1)/viewport_geometry[0][0][0].y+MIDDLE_X;
|
||||||
if (xl<0) xl=0;
|
if (xl<0) xl=0;
|
||||||
if (xr<0) xr=0;
|
if (xr<0) xr=0;
|
||||||
if (xl>639) xl=639;
|
if (xl>639) xl=639;
|
||||||
if (xr>639) xr=639;
|
if (xr>639) xr=639;
|
||||||
showtabs.f_table[x][y].lineofs=(y1+MIDDLE_Y)*2*scr_linelen2+xl*2;
|
showtabs.f_table[x][y].lineofs=(y1+MIDDLE_Y)*2*scr_linelen2+xl*2;
|
||||||
showtabs.f_table[x][y].linesize=xr-xl+(xl!=xr);
|
showtabs.f_table[x][y].linesize=xr-xl+(xl!=xr);
|
||||||
showtabs.f_table[x][y].counter=(y1-points[0][0][yp].y);
|
showtabs.f_table[x][y].counter=(y1-viewport_geometry[0][0][yp].y);
|
||||||
showtabs.f_table[x][y].txtrofs=(y1+MIDDLE_Y-VIEW_SIZE_Y+F_YMAP_SIZE)*1280+xl*2;
|
showtabs.f_table[x][y].txtrofs=(y1+MIDDLE_Y-VIEW_SIZE_Y+F_YMAP_SIZE)*1280+xl*2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -393,31 +393,31 @@ void create_tables(void)
|
||||||
|
|
||||||
strd=CF_XMAP_SIZE>>1;
|
strd=CF_XMAP_SIZE>>1;
|
||||||
y1=y-MIDDLE_Y;
|
y1=y-MIDDLE_Y;
|
||||||
yp=1;while (points[0][1][yp].y<y1) yp++;
|
yp=1;while (viewport_geometry[0][1][yp].y<y1) yp++;
|
||||||
if (x<strd)
|
if (x<strd)
|
||||||
{
|
{
|
||||||
xl=-points[strd-x][1][0].x;xr=-points[strd-x-1][1][0].x;
|
xl=-viewport_geometry[strd-x][1][0].x;xr=-viewport_geometry[strd-x-1][1][0].x;
|
||||||
}
|
}
|
||||||
else if (x==strd)
|
else if (x==strd)
|
||||||
{
|
{
|
||||||
xl=-points[0][1][0].x;xr=+points[0][1][0].x;
|
xl=-viewport_geometry[0][1][0].x;xr=+viewport_geometry[0][1][0].x;
|
||||||
}
|
}
|
||||||
else if (x>strd)
|
else if (x>strd)
|
||||||
{
|
{
|
||||||
xl=+points[x-strd-1][1][0].x;xr=+points[x-strd][1][0].x;
|
xl=+viewport_geometry[x-strd-1][1][0].x;xr=+viewport_geometry[x-strd][1][0].x;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
xl=xl*(y1-2)/points[0][1][0].y+MIDDLE_X;
|
xl=xl*(y1-2)/viewport_geometry[0][1][0].y+MIDDLE_X;
|
||||||
xr=xr*(y1-2)/points[0][1][0].y+MIDDLE_X;
|
xr=xr*(y1-2)/viewport_geometry[0][1][0].y+MIDDLE_X;
|
||||||
if (xl<0) xl=0;
|
if (xl<0) xl=0;
|
||||||
if (xr<0) xr=0;
|
if (xr<0) xr=0;
|
||||||
if (xl>639) xl=639;
|
if (xl>639) xl=639;
|
||||||
if (xr>639) xr=639;
|
if (xr>639) xr=639;
|
||||||
showtabs.c_table[x][y].lineofs=(y1+MIDDLE_Y)*2*scr_linelen2+xl*2;
|
showtabs.c_table[x][y].lineofs=(y1+MIDDLE_Y)*2*scr_linelen2+xl*2;
|
||||||
showtabs.c_table[x][y].linesize=xr-xl+(xl!=xr);
|
showtabs.c_table[x][y].linesize=xr-xl+(xl!=xr);
|
||||||
showtabs.c_table[x][y].counter=points[0][1][yp].y-y1;
|
showtabs.c_table[x][y].counter=viewport_geometry[0][1][yp].y-y1;
|
||||||
showtabs.c_table[x][y].txtrofs=(y1+MIDDLE_Y)*1280+xl*2;
|
showtabs.c_table[x][y].txtrofs=(y1+MIDDLE_Y)*1280+xl*2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -604,8 +604,8 @@ void show_cel(int celx,int cely,const void *stena,int xofs,int yofs,char rev, in
|
||||||
xofs-=(txtsx>>1)*TXT_SIZE_X/TXT_SIZE_X_3D;yofs-=txtsy>>1;
|
xofs-=(txtsx>>1)*TXT_SIZE_X/TXT_SIZE_X_3D;yofs-=txtsy>>1;
|
||||||
}
|
}
|
||||||
rev&=1;
|
rev&=1;
|
||||||
yss=(points[0][0][cely].y-points[0][0][cely+1].y)*xofs/TXT_SIZE_X;
|
yss=(viewport_geometry[0][0][cely].y-viewport_geometry[0][0][cely+1].y)*xofs/TXT_SIZE_X;
|
||||||
ysd=(points[0][1][cely].y-points[0][1][cely+1].y)*xofs/TXT_SIZE_X;
|
ysd=(viewport_geometry[0][1][cely].y-viewport_geometry[0][1][cely+1].y)*xofs/TXT_SIZE_X;
|
||||||
yofs=yofs*(yd->vert_size-yss+ysd)/TXT_SIZE_Y+yss;
|
yofs=yofs*(yd->vert_size-yss+ysd)/TXT_SIZE_Y+yss;
|
||||||
xofs=xofs*x3d->point_total/TXT_SIZE_X;
|
xofs=xofs*x3d->point_total/TXT_SIZE_X;
|
||||||
if (txtsx>x3d->point_total && celx)
|
if (txtsx>x3d->point_total && celx)
|
||||||
|
@ -627,7 +627,7 @@ void show_cel(int celx,int cely,const void *stena,int xofs,int yofs,char rev, in
|
||||||
if (x+realsx>640) realsx=640-x;
|
if (x+realsx>640) realsx=640-x;
|
||||||
if (realsx<=0) return;
|
if (realsx<=0) return;
|
||||||
yofs=yd->drawline-yofs;
|
yofs=yd->drawline-yofs;
|
||||||
yofs+=(plac==1)?(-yp->vert_size+points[0][0][cely+1].y-points[0][0][cely].y):((plac==2)?(yd->vert_size):0);
|
yofs+=(plac==1)?(-yp->vert_size+viewport_geometry[0][0][cely+1].y-viewport_geometry[0][0][cely].y):((plac==2)?(yd->vert_size):0);
|
||||||
if (yofs>360)
|
if (yofs>360)
|
||||||
{
|
{
|
||||||
int r=yofs-360,ui;
|
int r=yofs-360,ui;
|
||||||
|
@ -738,7 +738,7 @@ void draw_floor_ceil(int celx,int cely,char f_c,const void *txtr)
|
||||||
txtr=(void *)((word *)txtr+3);
|
txtr=(void *)((word *)txtr+3);
|
||||||
if (f_c==0) //podlaha
|
if (f_c==0) //podlaha
|
||||||
{
|
{
|
||||||
y=(VIEW_SIZE_Y-MIDDLE_Y)-points[0][0][cely].y+1;
|
y=(VIEW_SIZE_Y-MIDDLE_Y)-viewport_geometry[0][0][cely].y+1;
|
||||||
if (y<1) y=1;
|
if (y<1) y=1;
|
||||||
txtr=(void *)((word *)txtr);
|
txtr=(void *)((word *)txtr);
|
||||||
fcdraw(txtr,GetBuffer2nd()+SCREEN_OFFSET,&showtabs.f_table[celx+3][y]);
|
fcdraw(txtr,GetBuffer2nd()+SCREEN_OFFSET,&showtabs.f_table[celx+3][y]);
|
||||||
|
@ -750,7 +750,7 @@ void draw_floor_ceil(int celx,int cely,char f_c,const void *txtr)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
y=points[0][1][cely].y+MIDDLE_Y+1;
|
y=viewport_geometry[0][1][cely].y+MIDDLE_Y+1;
|
||||||
if (y<0) y=0;
|
if (y<0) y=0;
|
||||||
fcdraw(txtr,GetBuffer2nd()+SCREEN_OFFSET,&showtabs.c_table[celx+3][y]);
|
fcdraw(txtr,GetBuffer2nd()+SCREEN_OFFSET,&showtabs.c_table[celx+3][y]);
|
||||||
/* if (debug)
|
/* if (debug)
|
||||||
|
@ -942,7 +942,7 @@ void clear_buff(word *background,word backcolor,int lines)
|
||||||
|
|
||||||
if (background!=NULL) put_picture(0,SCREEN_OFFLINE,background);else lines=0;
|
if (background!=NULL) put_picture(0,SCREEN_OFFLINE,background);else lines=0;
|
||||||
if (lines!=360)
|
if (lines!=360)
|
||||||
for (i=lines;i<360;i++)
|
for (int i=lines;i<360;i++)
|
||||||
clear_color(GetBuffer2nd()+SCREEN_OFFSET+scr_linelen2*i,640,backcolor);
|
clear_color(GetBuffer2nd()+SCREEN_OFFSET+scr_linelen2*i,640,backcolor);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -951,7 +951,7 @@ void clear_screen(word *screen, word color)
|
||||||
{
|
{
|
||||||
int32_t scr_linelen2 = GetScreenPitch();
|
int32_t scr_linelen2 = GetScreenPitch();
|
||||||
|
|
||||||
for (i=0;i<480;i++) clear_color(screen+scr_linelen2*i,640,color);
|
for (int i=0;i<480;i++) clear_color(screen+scr_linelen2*i,640,color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void general_engine_init()
|
void general_engine_init()
|
||||||
|
@ -974,12 +974,12 @@ void map_pos(int celx,int cely,int posx,int posy,int posz,int *x,int *y)
|
||||||
posx=CTVR-posx;
|
posx=CTVR-posx;
|
||||||
celx=-celx;
|
celx=-celx;
|
||||||
}
|
}
|
||||||
p1=(points[0][0][cely].y-points[0][1][cely].y);
|
p1=(viewport_geometry[0][0][cely].y-viewport_geometry[0][1][cely].y);
|
||||||
p2=(points[0][0][cely+1].y-points[0][1][cely+1].y);
|
p2=(viewport_geometry[0][0][cely+1].y-viewport_geometry[0][1][cely+1].y);
|
||||||
last_scale=p=posy*(p2-p1)/CTVR+p1;
|
last_scale=p=posy*(p2-p1)/CTVR+p1;
|
||||||
*y=points[0][0][cely].y-(posy*(points[0][0][cely].y-points[0][0][cely+1].y)/CTVR)-p*posz/CTVR;
|
*y=viewport_geometry[0][0][cely].y-(posy*(viewport_geometry[0][0][cely].y-viewport_geometry[0][0][cely+1].y)/CTVR)-p*posz/CTVR;
|
||||||
xr=points[celx][0][cely].x-(posy*(points[celx][0][cely].x-points[celx][0][cely+1].x)/CTVR);
|
xr=viewport_geometry[celx][0][cely].x-(posy*(viewport_geometry[celx][0][cely].x-viewport_geometry[celx][0][cely+1].x)/CTVR);
|
||||||
if (celx) xl=points[celx-1][0][cely].x-(posy*(points[celx-1][0][cely].x-points[celx-1][0][cely+1].x)/CTVR);
|
if (celx) xl=viewport_geometry[celx-1][0][cely].x-(posy*(viewport_geometry[celx-1][0][cely].x-viewport_geometry[celx-1][0][cely+1].x)/CTVR);
|
||||||
else xl=-xr;
|
else xl=-xr;
|
||||||
*x=xl+((xr-xl)*posx/CTVR);
|
*x=xl+((xr-xl)*posx/CTVR);
|
||||||
if (negate2) *x=-*x;
|
if (negate2) *x=-*x;
|
||||||
|
@ -1201,14 +1201,14 @@ void set_lclip_rclip(int celx,int cely,int lc,int rc)
|
||||||
{
|
{
|
||||||
if (rc)
|
if (rc)
|
||||||
{
|
{
|
||||||
x=points[celx][0][cely].x+MIDDLE_X;
|
x=viewport_geometry[celx][0][cely].x+MIDDLE_X;
|
||||||
xs=points[celx][0][cely].x-points[celx][0][cely+1].x;
|
xs=viewport_geometry[celx][0][cely].x-viewport_geometry[celx][0][cely+1].x;
|
||||||
rclip=x-rc*xs/TXT_SIZE_X_3D;
|
rclip=x-rc*xs/TXT_SIZE_X_3D;
|
||||||
if (rclip>640) rclip=640;
|
if (rclip>640) rclip=640;
|
||||||
}
|
}
|
||||||
if (celx>0 && lc)
|
if (celx>0 && lc)
|
||||||
{
|
{
|
||||||
lclip=points[celx-1][0][cely].x+MIDDLE_X;
|
lclip=viewport_geometry[celx-1][0][cely].x+MIDDLE_X;
|
||||||
if (lclip>rclip) lclip=rclip;
|
if (lclip>rclip) lclip=rclip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1218,14 +1218,14 @@ void set_lclip_rclip(int celx,int cely,int lc,int rc)
|
||||||
if (lc)
|
if (lc)
|
||||||
{
|
{
|
||||||
int cc=-celx;
|
int cc=-celx;
|
||||||
x=-points[cc][0][cely].x+MIDDLE_X;
|
x=-viewport_geometry[cc][0][cely].x+MIDDLE_X;
|
||||||
xs=points[cc][0][cely].x-points[cc][0][cely+1].x;
|
xs=viewport_geometry[cc][0][cely].x-viewport_geometry[cc][0][cely+1].x;
|
||||||
lclip=x+lc*xs/TXT_SIZE_X_3D;
|
lclip=x+lc*xs/TXT_SIZE_X_3D;
|
||||||
if (lclip<0) lclip=0;
|
if (lclip<0) lclip=0;
|
||||||
}
|
}
|
||||||
if (celx<0 && rc)
|
if (celx<0 && rc)
|
||||||
{
|
{
|
||||||
rclip=-points[(-celx)-1][0][cely].x+MIDDLE_X;
|
rclip=-viewport_geometry[(-celx)-1][0][cely].x+MIDDLE_X;
|
||||||
if (rclip<lclip) rclip=lclip;
|
if (rclip<lclip) rclip=lclip;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1381,8 +1381,8 @@ void draw_item2(int celx,int cely,int xpos,int ypos, const void *txtr,int index
|
||||||
celx--;
|
celx--;
|
||||||
asc=(celx<0);
|
asc=(celx<0);
|
||||||
abc=abs(celx);if (asc) abc--;
|
abc=abs(celx);if (asc) abc--;
|
||||||
x=points[abc][0][cely+1].x;
|
x=viewport_geometry[abc][0][cely+1].x;
|
||||||
y=points[abc][0][cely+1].y;
|
y=viewport_geometry[abc][0][cely+1].y;
|
||||||
xs=showtabs.x_table[0][cely].max_x;
|
xs=showtabs.x_table[0][cely].max_x;
|
||||||
ys=showtabs.y_table[cely+1].vert_size;
|
ys=showtabs.y_table[cely+1].vert_size;
|
||||||
xpos+=indextab[7-index][0];
|
xpos+=indextab[7-index][0];
|
||||||
|
@ -1434,14 +1434,9 @@ int zoom_speed(int zoomspeed)
|
||||||
switch (zoomspeed)
|
switch (zoomspeed)
|
||||||
{
|
{
|
||||||
case 0:zooming_step=0;break;
|
case 0:zooming_step=0;break;
|
||||||
case 1:zooming_step=2;break;
|
case 1:zooming_step=1;break;
|
||||||
case 2:zooming_step=1;break;
|
case 2:zooming_step=2;break;
|
||||||
case -1: switch (zooming_step)
|
case -1: return zooming_step;
|
||||||
{
|
|
||||||
case 0:return 0;
|
|
||||||
case 1:return 2;
|
|
||||||
case 2:return 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return zoomspeed;
|
return zoomspeed;
|
||||||
}
|
}
|
||||||
|
@ -1456,7 +1451,7 @@ int turn_speed(int turnspeed)
|
||||||
case 2:rot_phases=2;break;
|
case 2:rot_phases=2;break;
|
||||||
case -1: return rot_phases;
|
case -1: return rot_phases;
|
||||||
}
|
}
|
||||||
return rot_phases;
|
return turnspeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_backgrnd_mode(int mode)
|
void set_backgrnd_mode(int mode)
|
||||||
|
|
|
@ -110,10 +110,7 @@ typedef struct t_point
|
||||||
|
|
||||||
typedef T_POINT t_points[VIEW3D_X+1][2][VIEW3D_Z+1];
|
typedef T_POINT t_points[VIEW3D_X+1][2][VIEW3D_Z+1];
|
||||||
extern word *background;
|
extern word *background;
|
||||||
extern t_points points;
|
extern t_points viewport_geometry;
|
||||||
extern int zooming_step;
|
|
||||||
extern int rot_phases;
|
|
||||||
extern int rot_step;
|
|
||||||
extern word *buffer_2nd;
|
extern word *buffer_2nd;
|
||||||
extern char show_names;
|
extern char show_names;
|
||||||
extern char show_lives;
|
extern char show_lives;
|
||||||
|
|
|
@ -763,7 +763,7 @@ void a_touch(int sector,int dir);
|
||||||
int do_action(int action_numb,int sector,int direct,int flags,int nosend);
|
int do_action(int action_numb,int sector,int direct,int flags,int nosend);
|
||||||
void delay_action(int action_numb,int sector,int direct,int flags,int nosend,int delay);
|
void delay_action(int action_numb,int sector,int direct,int flags,int nosend,int delay);
|
||||||
int32_t load_section(FILE *f,void **section, int *sct_type,int32_t *sect_size);
|
int32_t load_section(FILE *f,void **section, int *sct_type,int32_t *sect_size);
|
||||||
void prepare_graphics(int *ofs,char *names,int32_t size,void *decomp,int class);
|
void prepare_graphics(int *ofs,char *names,int32_t size,ABLOCK_DECODEPROC decomp,int class);
|
||||||
void show_automap(char full);
|
void show_automap(char full);
|
||||||
void draw_medium_map(void);
|
void draw_medium_map(void);
|
||||||
void anim_sipky(int h,int mode);
|
void anim_sipky(int h,int mode);
|
||||||
|
|
|
@ -11,14 +11,15 @@ SET(files basicobj.c
|
||||||
mgifmem.c
|
mgifmem.c
|
||||||
mgifplaya.c
|
mgifplaya.c
|
||||||
pcx.c
|
pcx.c
|
||||||
strlite.c
|
|
||||||
wav_mem.c
|
wav_mem.c
|
||||||
strlists.c
|
strlists.c
|
||||||
cztable.c
|
cztable.c
|
||||||
music.cpp
|
music.cpp
|
||||||
string_table.cpp
|
string_table.cpp )
|
||||||
swaper.c )
|
|
||||||
|
|
||||||
add_library(skeldal_libs ${files})
|
add_library(skeldal_libs ${files})
|
||||||
|
|
||||||
|
add_executable(file_to_base64 file_to_base64.cpp)
|
||||||
|
|
||||||
set_property(TARGET skeldal_libs PROPERTY CXX_STANDARD 20)
|
set_property(TARGET skeldal_libs PROPERTY CXX_STANDARD 20)
|
||||||
|
set_property(TARGET file_to_base64 PROPERTY CXX_STANDARD 20)
|
||||||
|
|
|
@ -8,7 +8,7 @@ public:
|
||||||
|
|
||||||
constexpr base64_t(const char *charset, char terminator):_terminator(terminator) {
|
constexpr base64_t(const char *charset, char terminator):_terminator(terminator) {
|
||||||
for (int i = 0; i < 64; ++i) _charset[i] = charset[i];
|
for (int i = 0; i < 64; ++i) _charset[i] = charset[i];
|
||||||
for (char &c: _charmap) c=-1;
|
for (char &c: _charmap) c=static_cast<char>(-1);
|
||||||
for (unsigned int i = 0; i < 64;++i) {
|
for (unsigned int i = 0; i < 64;++i) {
|
||||||
int c = _charset[i]-32;
|
int c = _charset[i]-32;
|
||||||
_charmap[c] = static_cast<char>(i);
|
_charmap[c] = static_cast<char>(i);
|
||||||
|
|
|
@ -352,7 +352,7 @@ inline bool CSVReader<Source>::readRow(const CSVFieldIndexMapping<T> &mapping,T
|
||||||
} else {
|
} else {
|
||||||
static_assert(std::is_same_v<TVal, bool>);
|
static_assert(std::is_same_v<TVal, bool>);
|
||||||
CSVState st = read(buff);
|
CSVState st = read(buff);
|
||||||
std::transform(buff.begin(), buff.end(), buff.begin(), [](char c) { return std::tolower(c); });
|
std::transform(buff.begin(), buff.end(), buff.begin(), [](char c) -> char { return std::tolower(c); });
|
||||||
if (buff == "y" || buff == "t" || buff =="true" || buff == "yes" || buff == "on") {
|
if (buff == "y" || buff == "t" || buff =="true" || buff == "yes" || buff == "on") {
|
||||||
target.*ptr = true;
|
target.*ptr = true;
|
||||||
} else if (buff == "n" || buff == "f" || buff =="false" || buff == "no" || buff == "off") {
|
} else if (buff == "n" || buff == "f" || buff =="false" || buff == "no" || buff == "off") {
|
||||||
|
|
|
@ -55,7 +55,7 @@ static char prepare=1;
|
||||||
static void PrepareTabs()
|
static void PrepareTabs()
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
for (i=0;i<256;i++) {xlatkm2win[i]=i;xlatwin2km[i]=i;}
|
for (i=0;i<256;i++) {xlatkm2win[i]=(char)i;xlatwin2km[i]=(char)i;}
|
||||||
for (i=0;i<sizeof(czxlattab)/sizeof(czxlattab[0]);i++)
|
for (i=0;i<sizeof(czxlattab)/sizeof(czxlattab[0]);i++)
|
||||||
{
|
{
|
||||||
xlatkm2win[czxlattab[i].kamenik]=czxlattab[i].windows;
|
xlatkm2win[czxlattab[i].kamenik]=czxlattab[i].windows;
|
||||||
|
@ -68,14 +68,14 @@ static void PrepareTabs()
|
||||||
void windows2kamenik(const char *src, int size, char *trg)
|
void windows2kamenik(const char *src, int size, char *trg)
|
||||||
{
|
{
|
||||||
if (prepare) PrepareTabs();
|
if (prepare) PrepareTabs();
|
||||||
if (size<0) size=strlen(src)+1;
|
if (size<0) size=(int)strlen(src)+1;
|
||||||
for (int i=0;i<size;i++) *trg++=xlatwin2km[(unsigned char)*src++];
|
for (int i=0;i<size;i++) *trg++=xlatwin2km[(unsigned char)*src++];
|
||||||
}
|
}
|
||||||
|
|
||||||
void kamenik2windows(const char *src, int size, char *trg)
|
void kamenik2windows(const char *src, int size, char *trg)
|
||||||
{
|
{
|
||||||
if (prepare) PrepareTabs();
|
if (prepare) PrepareTabs();
|
||||||
if (size<0) size=strlen(src)+1;
|
if (size<0) size=(int)strlen(src)+1;
|
||||||
for (int i=0;i<size;i++) *trg++=xlatkm2win[(unsigned char)*src++];
|
for (int i=0;i<size;i++) *trg++=xlatkm2win[(unsigned char)*src++];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
20
libs/file_to_base64.cpp
Normal file
20
libs/file_to_base64.cpp
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
#include "base64.h"
|
||||||
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
if (argc != 2) {
|
||||||
|
std::cerr << "Requires name of the file" << std::endl;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::ifstream input(argv[1], std::ios::in|std::ios::binary);
|
||||||
|
if (!input) {
|
||||||
|
std::cerr << "Failed to open:" << argv[1] << std::endl;
|
||||||
|
}
|
||||||
|
auto in_iter = std::istream_iterator<char>(input);
|
||||||
|
auto in_end = std::istream_iterator<char>();
|
||||||
|
auto out_iter = std::ostream_iterator<char>(std::cout);
|
||||||
|
base64.encode(in_iter, in_end, out_iter);
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -362,7 +362,7 @@ THANDLE_DATA *def_handle(int handle,const char *filename,ABLOCK_DECODEPROC decom
|
||||||
h->seekpos=i;
|
h->seekpos=i;
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
memcpy(h->src_file,filename,12);
|
strncpy(h->src_file,filename,sizeof(h->src_file));
|
||||||
h->seekpos=0;
|
h->seekpos=0;
|
||||||
strupper(h->src_file);
|
strupper(h->src_file);
|
||||||
h->loadproc=decompress;
|
h->loadproc=decompress;
|
||||||
|
@ -669,7 +669,7 @@ void display_status()
|
||||||
if (h->src_file[0]) strncpy(nname,h->src_file,12);else strcpy(nname,"<local>");
|
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,
|
printf("%04Xh ... %12s %s %s %08lXh %6d %10d %6d \n",i*BK_MINOR_HANDLES+j,
|
||||||
nname,names[h->status-1],
|
nname,names[h->status-1],
|
||||||
copys,(unsigned long)h->blockdata,h->size,h->counter,h->lockcount);
|
copys,(unsigned long)(uintptr_t)h->blockdata,h->size,h->counter,h->lockcount);
|
||||||
ln++;
|
ln++;
|
||||||
total_data+=h->size;
|
total_data+=h->size;
|
||||||
if(h->status==BK_PRESENT)total_mem+=h->size;
|
if(h->status==BK_PRESENT)total_mem+=h->size;
|
||||||
|
|
|
@ -42,7 +42,7 @@ typedef struct meminfo {
|
||||||
|
|
||||||
typedef struct thandle_data
|
typedef struct thandle_data
|
||||||
{
|
{
|
||||||
char src_file[12]; //12
|
char src_file[16]; //12
|
||||||
int32_t seekpos; //16
|
int32_t seekpos; //16
|
||||||
const void *blockdata; //20
|
const void *blockdata; //20
|
||||||
char flags; //21
|
char flags; //21
|
||||||
|
|
|
@ -49,7 +49,7 @@ void string_list_init(OBJREC *o,va_list params)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void string_list_change()
|
void string_list_change(void)
|
||||||
{
|
{
|
||||||
OBJREC *o1,*o2;
|
OBJREC *o1,*o2;
|
||||||
STRING_LIST_DATA *p;
|
STRING_LIST_DATA *p;
|
||||||
|
@ -93,7 +93,7 @@ void string_list_draw(int x1,int y1,int x2,int y2,OBJREC *o)
|
||||||
STRING_LIST_DATA *p;
|
STRING_LIST_DATA *p;
|
||||||
int y;
|
int y;
|
||||||
char savech[]=" ";
|
char savech[]=" ";
|
||||||
int znh,i,j,max;
|
int znh,i,j,max = 1;
|
||||||
TSTR_LIST ls;
|
TSTR_LIST ls;
|
||||||
int savcolor=curcolor;
|
int savcolor=curcolor;
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ struct tbarva palette[256];
|
||||||
|
|
||||||
char datapath[]="";
|
char datapath[]="";
|
||||||
extern struct all_view showtabs;
|
extern struct all_view showtabs;
|
||||||
extern t_points points;
|
extern t_points viewport_geometry;
|
||||||
|
|
||||||
void do_events()
|
void do_events()
|
||||||
{
|
{
|
||||||
|
@ -110,11 +110,11 @@ void draw_it_all_f(int genMlhu)
|
||||||
int i,m,y,m2,s;
|
int i,m,y,m2,s;
|
||||||
|
|
||||||
y=0;s=0;
|
y=0;s=0;
|
||||||
m2=(360-MIDDLE_Y)-points[0][0][VIEW3D_Z].y;
|
m2=(360-MIDDLE_Y)-viewport_geometry[0][0][VIEW3D_Z].y;
|
||||||
shadow_max=m2;
|
shadow_max=m2;
|
||||||
for (i=0;i<VIEW3D_Z;i++)
|
for (i=0;i<VIEW3D_Z;i++)
|
||||||
{
|
{
|
||||||
m=points[0][0][i].y-points[0][0][i+1].y;
|
m=viewport_geometry[0][0][i].y-viewport_geometry[0][0][i+1].y;
|
||||||
while (draw_one_line_f(y++,m,s,genMlhu) && y<m2);
|
while (draw_one_line_f(y++,m,s,genMlhu) && y<m2);
|
||||||
s=!s;
|
s=!s;
|
||||||
}
|
}
|
||||||
|
@ -160,11 +160,11 @@ void draw_it_all_c(int genMlhu)
|
||||||
int i,m,y,m2,s;
|
int i,m,y,m2,s;
|
||||||
|
|
||||||
y=0;s=0;
|
y=0;s=0;
|
||||||
m2=MIDDLE_Y+points[0][1][VIEW3D_Z].y;
|
m2=MIDDLE_Y+viewport_geometry[0][1][VIEW3D_Z].y;
|
||||||
shadow_max=m2;
|
shadow_max=m2;
|
||||||
for (i=0;i<VIEW3D_Z;i++)
|
for (i=0;i<VIEW3D_Z;i++)
|
||||||
{
|
{
|
||||||
m=points[0][1][i+1].y-points[0][1][i].y;
|
m=viewport_geometry[0][1][i+1].y-viewport_geometry[0][1][i].y;
|
||||||
while (draw_one_line_c(y++,m,s,genMlhu) && y<m2);
|
while (draw_one_line_c(y++,m,s,genMlhu) && y<m2);
|
||||||
s=!s;
|
s=!s;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ SET(files error.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(skeldal_platform STATIC)
|
add_library(skeldal_platform STATIC)
|
||||||
add_executable(skeldal)
|
|
||||||
|
|
||||||
target_sources(skeldal_platform PRIVATE
|
target_sources(skeldal_platform PRIVATE
|
||||||
legacy_coroutines.cpp
|
legacy_coroutines.cpp
|
||||||
|
@ -21,8 +20,11 @@ if(WIN32)
|
||||||
windows/save_folder.cpp
|
windows/save_folder.cpp
|
||||||
windows/map_file.cpp
|
windows/map_file.cpp
|
||||||
)
|
)
|
||||||
|
add_executable(skeldal WIN32)
|
||||||
target_sources(skeldal PRIVATE
|
target_sources(skeldal PRIVATE
|
||||||
windows/app_start.cpp
|
windows/app_start.cpp
|
||||||
|
windows/skeldal.manifest
|
||||||
|
windows/skeldal.rc
|
||||||
)
|
)
|
||||||
target_compile_definitions(skeldal_platform PRIVATE PLATFORM_WINDOWS)
|
target_compile_definitions(skeldal_platform PRIVATE PLATFORM_WINDOWS)
|
||||||
message(STATUS "Building for Windows")
|
message(STATUS "Building for Windows")
|
||||||
|
@ -33,16 +35,18 @@ elseif(UNIX AND NOT APPLE)
|
||||||
linux/save_folder.cpp
|
linux/save_folder.cpp
|
||||||
linux/map_file.cpp
|
linux/map_file.cpp
|
||||||
)
|
)
|
||||||
|
add_executable(skeldal)
|
||||||
target_sources(skeldal PRIVATE
|
target_sources(skeldal PRIVATE
|
||||||
linux/app_start.cpp
|
linux/app_start.cpp
|
||||||
)
|
)
|
||||||
target_compile_definitions(skeldal_platform PRIVATE PLATFORM_LINUX)
|
target_compile_definitions(skeldal_platform PRIVATE PLATFORM_LINUX)
|
||||||
message(STATUS "Building for Linux")
|
message(STATUS "Building for Linux")
|
||||||
|
|
||||||
elseif(APPLE)
|
elseif(APPLE)
|
||||||
target_sources(skeldal_platform PRIVATE
|
target_sources(skeldal_platform PRIVATE
|
||||||
mac_os/save_folder.cpp
|
mac_os/save_folder.cpp
|
||||||
)
|
)
|
||||||
|
add_executable(skeldal)
|
||||||
target_sources(skeldal PRIVATE
|
target_sources(skeldal PRIVATE
|
||||||
linux/app_start.cpp
|
linux/app_start.cpp
|
||||||
)
|
)
|
||||||
|
|
|
@ -17,7 +17,7 @@ void show_help(const char *arg0) {
|
||||||
|
|
||||||
printf("-f <file> path to configuration file\n"
|
printf("-f <file> path to configuration file\n"
|
||||||
"-a <adv> path for adventure file (.adv)\n"
|
"-a <adv> path for adventure file (.adv)\n"
|
||||||
"-l <lang> set language (cz|en)"
|
"-l <lang> set language (cz|en)\n"
|
||||||
"-s <directory> generate string-tables (for localization) and exit\n"
|
"-s <directory> generate string-tables (for localization) and exit\n"
|
||||||
"-h this help\n");
|
"-h this help\n");
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
#pragma warning(disable: 4267)
|
#pragma warning(disable: 4267)
|
||||||
#pragma warning(disable: 4100)
|
#pragma warning(disable: 4100)
|
||||||
#pragma warning(disable: 4456)
|
#pragma warning(disable: 4456)
|
||||||
|
#pragma warning(disable: 4457)
|
||||||
|
#pragma warning(disable: 4702)
|
||||||
#define CASE_FALLTHROUGH
|
#define CASE_FALLTHROUGH
|
||||||
#else
|
#else
|
||||||
#define CASE_FALLTHROUGH [[fallthrough]]
|
#define CASE_FALLTHROUGH [[fallthrough]]
|
||||||
|
|
|
@ -3,28 +3,30 @@
|
||||||
#include "../platform.h"
|
#include "../platform.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <sstream>
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#include <windows.h>
|
||||||
|
#include <wchar.h>
|
||||||
|
#include <shellapi.h>
|
||||||
|
|
||||||
void show_help(const char *arg0) {
|
void show_help(std::ostream &out, const char *arg0) {
|
||||||
printf(
|
out <<
|
||||||
"Brany Skeldalu (Gates of Skeldal) portable game player\n"
|
"Brany Skeldalu (Gates of Skeldal) portable game player\n"
|
||||||
"Copyright (c) 2025 Ondrej Novak. All rights reserved.\n\n"
|
"Copyright (c) 2025 Ondrej Novak. All rights reserved.\n\n"
|
||||||
"This work is licensed under the terms of the MIT license.\n"
|
"This work is licensed under the terms of the MIT license.\n"
|
||||||
"For a copy, see <https://opensource.org/licenses/MIT>.\n"
|
"For a copy, see <https://opensource.org/licenses/MIT>.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Usage:"
|
"Usage:";
|
||||||
);
|
out << arg0 << " [-f <file>] [-a <file>] [-l <lang>] [-s <dir>] [-h]\n\n";
|
||||||
printf("%s [-f <file>] [-a <file>] [-l <lang>] [-s <dir>] [-h]\n\n", arg0);
|
out << "-f <file> path to configuration file\n"
|
||||||
|
|
||||||
printf("-f <file> path to configuration file\n"
|
|
||||||
"-a <adv> path for adventure file (.adv)\n"
|
"-a <adv> path for adventure file (.adv)\n"
|
||||||
"-l <lang> set language (cz|en)"
|
"-l <lang> set language (cz|en)\n"
|
||||||
"-s <directory> generate string-tables (for localization) and exit\n"
|
"-s <directory> generate string-tables (for localization) and exit\n"
|
||||||
"-h this help\n");
|
"-h this help\n";
|
||||||
exit(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void show_help_short() {
|
void show_help_short(std::ostream &out) {
|
||||||
printf("Use -h for help\n");
|
out << "Use -h for help\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,26 +35,43 @@ int main(int argc, char **argv) {
|
||||||
std::string adv_config_file;
|
std::string adv_config_file;
|
||||||
std::string gen_stringtable_path;
|
std::string gen_stringtable_path;
|
||||||
std::string lang;
|
std::string lang;
|
||||||
|
std::ostringstream console;
|
||||||
for (int optchr = -1; (optchr = getopt(argc, argv, "hf:a:s:l:")) != -1; ) {
|
for (int optchr = -1; (optchr = getopt(argc, argv, "hf:a:s:l:")) != -1; ) {
|
||||||
switch (optchr) {
|
switch (optchr) {
|
||||||
case 'f': config_name = optarg;break;
|
case 'f': config_name = optarg;break;
|
||||||
case 'a': adv_config_file = optarg;break;
|
case 'a': adv_config_file = optarg;break;
|
||||||
case 'h': show_help(argv[0]);break;
|
case 'h': show_help(console, argv[0]);break;
|
||||||
case 'l': lang = optarg;break;
|
case 'l': lang = optarg;break;
|
||||||
case 's': gen_stringtable_path = optarg;break;
|
case 's': gen_stringtable_path = optarg;break;
|
||||||
default: show_help_short();
|
default: show_help_short(console);break;
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!check_file_exists(config_name.c_str())) {
|
||||||
|
console << "ERROR: A configuration file was not found:\n\n" << config_name << "\n\n";
|
||||||
|
show_help(console, argv[0]);
|
||||||
|
}
|
||||||
|
|
||||||
SKELDAL_CONFIG cfg;
|
SKELDAL_CONFIG cfg;
|
||||||
cfg.short_help = show_help_short;
|
cfg.short_help = []{};
|
||||||
cfg.show_error = [](const char *txt) {
|
cfg.show_error = [](const char *txt) {
|
||||||
std::cerr << "ERROR: " << txt << std::endl;
|
char buff[MAX_PATH];
|
||||||
|
GetModuleFileNameA(NULL,buff,MAX_PATH);
|
||||||
|
MessageBoxA(NULL,txt,buff, MB_OK|MB_ICONEXCLAMATION|MB_SYSTEMMODAL|MB_APPLMODAL);
|
||||||
|
ExitProcess(1);
|
||||||
};
|
};
|
||||||
cfg.adventure_path = adv_config_file.empty()?NULL:adv_config_file.c_str();
|
cfg.adventure_path = adv_config_file.empty()?NULL:adv_config_file.c_str();
|
||||||
cfg.config_path = config_name.c_str();
|
cfg.config_path = config_name.c_str();
|
||||||
cfg.lang_path = lang.empty()?NULL:lang.c_str();
|
cfg.lang_path = lang.empty()?NULL:lang.c_str();
|
||||||
|
|
||||||
|
{
|
||||||
|
std::string msg = console.str();
|
||||||
|
if (!msg.empty()) {
|
||||||
|
cfg.show_error(msg.c_str());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if (!gen_stringtable_path.empty()) {
|
if (!gen_stringtable_path.empty()) {
|
||||||
|
@ -63,7 +82,7 @@ int main(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (const std::exception &e) {
|
} catch (const std::exception &e) {
|
||||||
std::cerr << "ERROR: " << e.what() << std::endl;
|
cfg.show_error(e.what());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,3 +90,19 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int WinMain(HINSTANCE,HINSTANCE ,LPSTR, INT) {
|
||||||
|
|
||||||
|
int argc;
|
||||||
|
LPWSTR *szArglist = CommandLineToArgvW(GetCommandLineW(), &argc);
|
||||||
|
|
||||||
|
char **argv = (char **)alloca(sizeof(char *) * argc);
|
||||||
|
for (int i = 0; i < argc; ++i) {
|
||||||
|
DWORD need = WideCharToMultiByte(CP_UTF8,0,szArglist[i],wcslen(szArglist[i]),NULL,NULL,NULL,FALSE)+1;
|
||||||
|
argv[i] = (char *)alloca(sizeof(char) * need);
|
||||||
|
WideCharToMultiByte(CP_UTF8,0,szArglist[i],wcslen(szArglist[i]),argv[i],need,NULL,FALSE);
|
||||||
|
argv[i][need-1] = 0;
|
||||||
|
}
|
||||||
|
GlobalFree(szArglist);
|
||||||
|
return main(argc, argv);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
BIN
platform/windows/icon.ico
Normal file
BIN
platform/windows/icon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.6 KiB |
8
platform/windows/skeldal.manifest
Normal file
8
platform/windows/skeldal.manifest
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
<application>
|
||||||
|
<windowsSettings>
|
||||||
|
<activeCodePage xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings">UTF-8</activeCodePage>
|
||||||
|
</windowsSettings>
|
||||||
|
</application>
|
||||||
|
</assembly>
|
1
platform/windows/skeldal.rc
Normal file
1
platform/windows/skeldal.rc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
IDI_ICON1 ICON DISCARDABLE "icon.ico"
|
Loading…
Add table
Add a link
Reference in a new issue