win: winmain, manifest, icon, and some improvements

This commit is contained in:
Ondrej Novak 2025-02-08 12:42:55 +01:00
parent f70b29abab
commit 7bea57e587
23 changed files with 203 additions and 140 deletions

View file

@ -32,7 +32,7 @@ struct tbarva palette[256];
char datapath[]="";
extern struct all_view showtabs;
extern t_points points;
extern t_points viewport_geometry;
void do_events()
{
@ -103,11 +103,11 @@ void draw_it_all_f()
int i,m,y,m2,s;
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;
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);
s=!s;
}
@ -149,11 +149,11 @@ void draw_it_all_c()
int i,m,y,m2,s;
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;
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);
s=!s;
}

View file

@ -1,5 +1,5 @@
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)

View file

@ -1029,7 +1029,7 @@ int draw_sloup_sector(int celx,int cely,int sector)
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));
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;
}
@ -1075,10 +1075,10 @@ void draw_sector(int celx,int cely,int s)
void back_clear(int celx,int color)
{
int x1,y1,x2,y2,xc;
y1=points[0][0][VIEW3D_Z].y+MIDDLE_Y+SCREEN_OFFLINE;
y2=points[0][1][VIEW3D_Z].y+MIDDLE_Y+SCREEN_OFFLINE;
x2=points[0][1][VIEW3D_Z].x+MIDDLE_X;
x1=-points[0][1][VIEW3D_Z].x+MIDDLE_X;
y1=viewport_geometry[0][0][VIEW3D_Z].y+MIDDLE_Y+SCREEN_OFFLINE;
y2=viewport_geometry[0][1][VIEW3D_Z].y+MIDDLE_Y+SCREEN_OFFLINE;
x2=viewport_geometry[0][1][VIEW3D_Z].x+MIDDLE_X;
x1=-viewport_geometry[0][1][VIEW3D_Z].x+MIDDLE_X;
xc=(x2-x1+2)*celx;
x1=x1+xc-1;
x2=x2+xc;

View file

@ -45,10 +45,10 @@ char clk_touch_vyk(int sector,int side,int xr,int yr)
x2=v->xpos+v->xs/2;
y1=320-(v->ypos+v->ys);
y2=320-(v->ypos);
x1+=MIDDLE_X-points[0][1][1].x;
x2+=MIDDLE_X-points[0][1][1].x;
y1+=MIDDLE_Y+points[0][1][1].y;
y2+=MIDDLE_Y+points[0][1][1].y;
x1+=MIDDLE_X-viewport_geometry[0][1][1].x;
x2+=MIDDLE_X-viewport_geometry[0][1][1].x;
y1+=MIDDLE_Y+viewport_geometry[0][1][1].y;
y2+=MIDDLE_Y+viewport_geometry[0][1][1].y;
if (x1<=xr && xr<=x2 && y1<=yr && yr<=y2)
{
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;
y1=y2-y1;
x1=x2-x1;
x1+=MIDDLE_X-points[0][1][1].x;
x2+=MIDDLE_X-points[0][1][1].x;
y1+=MIDDLE_Y+points[0][1][1].y;
y2+=MIDDLE_Y+points[0][1][1].y;
x1+=MIDDLE_X-viewport_geometry[0][1][1].x;
x2+=MIDDLE_X-viewport_geometry[0][1][1].x;
y1+=MIDDLE_Y+viewport_geometry[0][1][1].y;
y2+=MIDDLE_Y+viewport_geometry[0][1][1].y;
ext=1;
}
else if (map_sides[id].sec==0)
{
x1=MIDDLE_X-points[0][0][1].x;
y1=MIDDLE_Y+points[0][1][1].y;
x1=MIDDLE_X-viewport_geometry[0][0][1].x;
y1=MIDDLE_Y+viewport_geometry[0][1][1].y;
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));
}
else return 0;

View file

@ -16,16 +16,16 @@
#include <string.h>
#define CTVR 128
t_points points;
t_points viewport_geometry;
struct all_view showtabs;
static char backgrnd_mode=0;
static int lclip,rclip;
ZOOMINFO zoom;
char zooming_xtable[ZOOM_PHASES][VIEW_SIZE_X];
short zooming_ytable[ZOOM_PHASES][VIEW_SIZE_Y];
short zooming_points[ZOOM_PHASES][4]
static char zooming_xtable[ZOOM_PHASES][VIEW_SIZE_X];
static short zooming_ytable[ZOOM_PHASES][VIEW_SIZE_Y];
static short zooming_points[ZOOM_PHASES][4]
={
{620,349,10,3},
{600,338,20,7},
@ -37,9 +37,9 @@ short zooming_points[ZOOM_PHASES][4]
{480,271,80,28},
{460,259,90,31}
};
int zooming_step=2;
int rot_phases=2;
int yreq;
static int zooming_step=2;
static int rot_phases=1;
//int yreq;
int last_scale;
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]
*/
void *p,*p2,*pozadi,*podlaha,*strop,*sit;int i;
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);
word *GetBuffer2nd();
word *background;
//void *p,*p2,*pozadi,*podlaha,*strop,*sit;int i;
//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);
//word *GetBuffer2nd();
//word *background;
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;
for (i=0;i<VIEW3D_Z+1;i++)
{
points[j][0][i].x=x1;
points[j][0][i].y=y1;
points[j][1][i].x=x2;
points[j][1][i].y=y2;
viewport_geometry[j][0][i].x=x1;
viewport_geometry[j][0][i].y=y1;
viewport_geometry[j][1][i].x=x2;
viewport_geometry[j][1][i].y=y2;
x2=(int)(x2-x2/FACTOR_3D);
y2=(int)(y2-y2/FACTOR_3D);
x1=(int)(x1-x1/FACTOR_3D);
@ -286,9 +286,9 @@ void create_tables(void)
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_total=(points[1][0][y].y+MIDDLE_Y);
showtabs.y_table[y].drawline=((points[1][0][y].y+MIDDLE_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=(viewport_geometry[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);
}
@ -297,21 +297,21 @@ void create_tables(void)
{
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
{
showtabs.z_table[x][y].used=1;
rozdil1=points[x][0][y].x-points[x][0][y+1].x;
rozdil2=rozdil1-MIDDLE_X+points[x][0][y+1].x;
rozdil3=points[0][0][y].x-points[0][0][y+1].x;
rozdil1=viewport_geometry[x][0][y].x-viewport_geometry[x][0][y+1].x;
rozdil2=rozdil1-MIDDLE_X+viewport_geometry[x][0][y+1].x;
rozdil3=viewport_geometry[0][0][y].x-viewport_geometry[0][0][y+1].x;
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;
}
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].point_total=rozdil1;
@ -325,23 +325,23 @@ void create_tables(void)
{
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
{
showtabs.x_table[x][y].used=1;
rozdil1=points[1][0][y+1].x-points[0][0][y+1].x;
rozdil2=-MIDDLE_X+points[x][0][y+1].x;
rozdil1=viewport_geometry[1][0][y+1].x-viewport_geometry[0][0][y+1].x;
rozdil2=-MIDDLE_X+viewport_geometry[x][0][y+1].x;
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].max_x=rozdil1;
}
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].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);
showtabs.x_table[x][y].point_total=rozdil1;
@ -357,32 +357,32 @@ void create_tables(void)
strd=CF_XMAP_SIZE>>1;
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)
{
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)
{
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)
{
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 {
continue;
}
y1=(VIEW_SIZE_Y-y)-MIDDLE_Y;
xl=xl*(y1+1)/points[0][0][0].y+MIDDLE_X;
xr=xr*(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)/viewport_geometry[0][0][0].y+MIDDLE_X;
if (xl<0) xl=0;
if (xr<0) xr=0;
if (xl>639) xl=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].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;
}
@ -393,31 +393,31 @@ void create_tables(void)
strd=CF_XMAP_SIZE>>1;
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)
{
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)
{
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)
{
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 {
continue;
}
xl=xl*(y1-2)/points[0][1][0].y+MIDDLE_X;
xr=xr*(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)/viewport_geometry[0][1][0].y+MIDDLE_X;
if (xl<0) xl=0;
if (xr<0) xr=0;
if (xl>639) xl=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].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;
}
@ -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;
}
rev&=1;
yss=(points[0][0][cely].y-points[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;
yss=(viewport_geometry[0][0][cely].y-viewport_geometry[0][0][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;
xofs=xofs*x3d->point_total/TXT_SIZE_X;
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 (realsx<=0) return;
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)
{
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);
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;
txtr=(void *)((word *)txtr);
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
{
y=points[0][1][cely].y+MIDDLE_Y+1;
y=viewport_geometry[0][1][cely].y+MIDDLE_Y+1;
if (y<0) y=0;
fcdraw(txtr,GetBuffer2nd()+SCREEN_OFFSET,&showtabs.c_table[celx+3][y]);
/* 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 (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);
}
@ -951,7 +951,7 @@ void clear_screen(word *screen, word color)
{
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()
@ -974,12 +974,12 @@ void map_pos(int celx,int cely,int posx,int posy,int posz,int *x,int *y)
posx=CTVR-posx;
celx=-celx;
}
p1=(points[0][0][cely].y-points[0][1][cely].y);
p2=(points[0][0][cely+1].y-points[0][1][cely+1].y);
p1=(viewport_geometry[0][0][cely].y-viewport_geometry[0][1][cely].y);
p2=(viewport_geometry[0][0][cely+1].y-viewport_geometry[0][1][cely+1].y);
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;
xr=points[celx][0][cely].x-(posy*(points[celx][0][cely].x-points[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);
*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=viewport_geometry[celx][0][cely].x-(posy*(viewport_geometry[celx][0][cely].x-viewport_geometry[celx][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;
*x=xl+((xr-xl)*posx/CTVR);
if (negate2) *x=-*x;
@ -1201,14 +1201,14 @@ void set_lclip_rclip(int celx,int cely,int lc,int rc)
{
if (rc)
{
x=points[celx][0][cely].x+MIDDLE_X;
xs=points[celx][0][cely].x-points[celx][0][cely+1].x;
x=viewport_geometry[celx][0][cely].x+MIDDLE_X;
xs=viewport_geometry[celx][0][cely].x-viewport_geometry[celx][0][cely+1].x;
rclip=x-rc*xs/TXT_SIZE_X_3D;
if (rclip>640) rclip=640;
}
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;
}
@ -1218,14 +1218,14 @@ void set_lclip_rclip(int celx,int cely,int lc,int rc)
if (lc)
{
int cc=-celx;
x=-points[cc][0][cely].x+MIDDLE_X;
xs=points[cc][0][cely].x-points[cc][0][cely+1].x;
x=-viewport_geometry[cc][0][cely].x+MIDDLE_X;
xs=viewport_geometry[cc][0][cely].x-viewport_geometry[cc][0][cely+1].x;
lclip=x+lc*xs/TXT_SIZE_X_3D;
if (lclip<0) lclip=0;
}
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;
}
}
@ -1381,8 +1381,8 @@ void draw_item2(int celx,int cely,int xpos,int ypos, const void *txtr,int index
celx--;
asc=(celx<0);
abc=abs(celx);if (asc) abc--;
x=points[abc][0][cely+1].x;
y=points[abc][0][cely+1].y;
x=viewport_geometry[abc][0][cely+1].x;
y=viewport_geometry[abc][0][cely+1].y;
xs=showtabs.x_table[0][cely].max_x;
ys=showtabs.y_table[cely+1].vert_size;
xpos+=indextab[7-index][0];
@ -1434,14 +1434,9 @@ int zoom_speed(int zoomspeed)
switch (zoomspeed)
{
case 0:zooming_step=0;break;
case 1:zooming_step=2;break;
case 2:zooming_step=1;break;
case -1: switch (zooming_step)
{
case 0:return 0;
case 1:return 2;
case 2:return 1;
}
case 1:zooming_step=1;break;
case 2:zooming_step=2;break;
case -1: return zooming_step;
}
return zoomspeed;
}
@ -1456,7 +1451,7 @@ int turn_speed(int turnspeed)
case 2:rot_phases=2;break;
case -1: return rot_phases;
}
return rot_phases;
return turnspeed;
}
void set_backgrnd_mode(int mode)

View file

@ -110,10 +110,7 @@ typedef struct t_point
typedef T_POINT t_points[VIEW3D_X+1][2][VIEW3D_Z+1];
extern word *background;
extern t_points points;
extern int zooming_step;
extern int rot_phases;
extern int rot_step;
extern t_points viewport_geometry;
extern word *buffer_2nd;
extern char show_names;
extern char show_lives;

View file

@ -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);
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);
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 draw_medium_map(void);
void anim_sipky(int h,int mode);

View file

@ -11,14 +11,15 @@ SET(files basicobj.c
mgifmem.c
mgifplaya.c
pcx.c
strlite.c
wav_mem.c
strlists.c
cztable.c
music.cpp
string_table.cpp
swaper.c )
string_table.cpp )
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 file_to_base64 PROPERTY CXX_STANDARD 20)

View file

@ -8,7 +8,7 @@ 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 (char &c: _charmap) c=static_cast<char>(-1);
for (unsigned int i = 0; i < 64;++i) {
int c = _charset[i]-32;
_charmap[c] = static_cast<char>(i);

View file

@ -352,7 +352,7 @@ inline bool CSVReader<Source>::readRow(const CSVFieldIndexMapping<T> &mapping,T
} else {
static_assert(std::is_same_v<TVal, bool>);
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") {
target.*ptr = true;
} else if (buff == "n" || buff == "f" || buff =="false" || buff == "no" || buff == "off") {

View file

@ -55,7 +55,7 @@ static char prepare=1;
static void PrepareTabs()
{
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++)
{
xlatkm2win[czxlattab[i].kamenik]=czxlattab[i].windows;
@ -68,14 +68,14 @@ static void PrepareTabs()
void windows2kamenik(const char *src, int size, char *trg)
{
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++];
}
void kamenik2windows(const char *src, int size, char *trg)
{
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++];
}

20
libs/file_to_base64.cpp Normal file
View 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;
}

View file

@ -362,7 +362,7 @@ THANDLE_DATA *def_handle(int handle,const char *filename,ABLOCK_DECODEPROC decom
h->seekpos=i;
return h;
}
memcpy(h->src_file,filename,12);
strncpy(h->src_file,filename,sizeof(h->src_file));
h->seekpos=0;
strupper(h->src_file);
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>");
printf("%04Xh ... %12s %s %s %08lXh %6d %10d %6d \n",i*BK_MINOR_HANDLES+j,
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++;
total_data+=h->size;
if(h->status==BK_PRESENT)total_mem+=h->size;

View file

@ -42,7 +42,7 @@ typedef struct meminfo {
typedef struct thandle_data
{
char src_file[12]; //12
char src_file[16]; //12
int32_t seekpos; //16
const void *blockdata; //20
char flags; //21

View file

@ -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;
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;
int y;
char savech[]=" ";
int znh,i,j,max;
int znh,i,j,max = 1;
TSTR_LIST ls;
int savcolor=curcolor;

View file

@ -33,7 +33,7 @@ struct tbarva palette[256];
char datapath[]="";
extern struct all_view showtabs;
extern t_points points;
extern t_points viewport_geometry;
void do_events()
{
@ -110,11 +110,11 @@ void draw_it_all_f(int genMlhu)
int i,m,y,m2,s;
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;
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);
s=!s;
}
@ -160,11 +160,11 @@ void draw_it_all_c(int genMlhu)
int i,m,y,m2,s;
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;
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);
s=!s;
}

View file

@ -2,7 +2,6 @@ SET(files error.cpp
)
add_library(skeldal_platform STATIC)
add_executable(skeldal)
target_sources(skeldal_platform PRIVATE
legacy_coroutines.cpp
@ -21,8 +20,11 @@ if(WIN32)
windows/save_folder.cpp
windows/map_file.cpp
)
add_executable(skeldal WIN32)
target_sources(skeldal PRIVATE
windows/app_start.cpp
windows/skeldal.manifest
windows/skeldal.rc
)
target_compile_definitions(skeldal_platform PRIVATE PLATFORM_WINDOWS)
message(STATUS "Building for Windows")
@ -33,6 +35,7 @@ elseif(UNIX AND NOT APPLE)
linux/save_folder.cpp
linux/map_file.cpp
)
add_executable(skeldal)
target_sources(skeldal PRIVATE
linux/app_start.cpp
)
@ -43,6 +46,7 @@ elseif(APPLE)
target_sources(skeldal_platform PRIVATE
mac_os/save_folder.cpp
)
add_executable(skeldal)
target_sources(skeldal PRIVATE
linux/app_start.cpp
)

View file

@ -17,7 +17,7 @@ void show_help(const char *arg0) {
printf("-f <file> path to configuration file\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"
"-h this help\n");
exit(0);

View file

@ -14,6 +14,8 @@
#pragma warning(disable: 4267)
#pragma warning(disable: 4100)
#pragma warning(disable: 4456)
#pragma warning(disable: 4457)
#pragma warning(disable: 4702)
#define CASE_FALLTHROUGH
#else
#define CASE_FALLTHROUGH [[fallthrough]]

View file

@ -3,28 +3,30 @@
#include "../platform.h"
#include <iostream>
#include <string>
#include <sstream>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <wchar.h>
#include <shellapi.h>
void show_help(const char *arg0) {
printf(
void show_help(std::ostream &out, const char *arg0) {
out <<
"Brany Skeldalu (Gates of Skeldal) portable game player\n"
"Copyright (c) 2025 Ondrej Novak. All rights reserved.\n\n"
"This work is licensed under the terms of the MIT license.\n"
"For a copy, see <https://opensource.org/licenses/MIT>.\n"
"\n"
"Usage:"
);
printf("%s [-f <file>] [-a <file>] [-l <lang>] [-s <dir>] [-h]\n\n", arg0);
printf("-f <file> path to configuration file\n"
"Usage:";
out << arg0 << " [-f <file>] [-a <file>] [-l <lang>] [-s <dir>] [-h]\n\n";
out << "-f <file> path to configuration file\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"
"-h this help\n");
exit(0);
"-h this help\n";
}
void show_help_short() {
printf("Use -h for help\n");
void show_help_short(std::ostream &out) {
out << "Use -h for help\n";
}
@ -33,26 +35,43 @@ int main(int argc, char **argv) {
std::string adv_config_file;
std::string gen_stringtable_path;
std::string lang;
std::ostringstream console;
for (int optchr = -1; (optchr = getopt(argc, argv, "hf:a:s:l:")) != -1; ) {
switch (optchr) {
case 'f': config_name = 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 's': gen_stringtable_path = optarg;break;
default: show_help_short();
return 1;
default: show_help_short(console);break;
}
}
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;
cfg.short_help = show_help_short;
cfg.short_help = []{};
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.config_path = config_name.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 {
if (!gen_stringtable_path.empty()) {
@ -63,7 +82,7 @@ int main(int argc, char **argv) {
}
} catch (const std::exception &e) {
std::cerr << "ERROR: " << e.what() << std::endl;
cfg.show_error(e.what());
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

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View 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>

View file

@ -0,0 +1 @@
IDI_ICON1 ICON DISCARDABLE "icon.ico"