compile and run in windows (improvements needed)

This commit is contained in:
Ondrej Novak 2025-02-08 09:19:55 +01:00
parent f55f92a88b
commit f70b29abab
83 changed files with 415 additions and 3747 deletions

1
.gitignore vendored
View file

@ -9,4 +9,5 @@ _UpgradeReport_Files
/.cproject /.cproject
/.project /.project
/.settings /.settings
/.vscode
/skeldal.local.ini /skeldal.local.ini

View file

@ -78,7 +78,7 @@ int DlgDialogy::GetDialogID(const char *name)
char dialog[40]; char dialog[40];
if (fscanf(f," %40[^\r\n\t (] ( %d )",dialog,&id)==2) if (fscanf(f," %40[^\r\n\t (] ( %d )",dialog,&id)==2)
{ {
if (stricmp(dialog,"DIALOG")==0) if (istrcmp(dialog,"DIALOG")==0)
{ {
fclose(f); fclose(f);
return id; return id;
@ -204,13 +204,13 @@ int DlgDialogy::CompareItems(int item1, int item2)
{ {
CString a=wList.GetItemText(item1,0); CString a=wList.GetItemText(item1,0);
CString b=wList.GetItemText(item2,0); CString b=wList.GetItemText(item2,0);
return stricmp(a,b); return istrcmp(a,b);
} }
case 1: case 1:
{ {
CString a=wList.GetItemText(item1,1); CString a=wList.GetItemText(item1,1);
CString b=wList.GetItemText(item2,1); CString b=wList.GetItemText(item2,1);
return stricmp(a,b); return istrcmp(a,b);
} }
case 2: case 2:
{ {

View file

@ -24,10 +24,10 @@
enum PathNameNullEnum {PathNull}; enum PathNameNullEnum {PathNull};
#define PathNameCompare(op) bool operator op (const Pathname &other) const \ #define PathNameCompare(op) bool operator op (const Pathname &other) const \
{if (IsNull() || other.IsNull()) return false;else return stricmp(_fullpath,other._fullpath) op 0;}\ {if (IsNull() || other.IsNull()) return false;else return istrcmp(_fullpath,other._fullpath) op 0;}\
bool operator op (const char *other) const \ bool operator op (const char *other) const \
{ASSERT(other[0]!=0);\ {ASSERT(other[0]!=0);\
if (IsNull() || other==NULL) return false;else return stricmp(_fullpath,other) op 0;} if (IsNull() || other==NULL) return false;else return istrcmp(_fullpath,other) op 0;}
#ifndef _UNICODE #ifndef _UNICODE

View file

@ -1,14 +1,14 @@
cmake_minimum_required(VERSION 3.28) cmake_minimum_required(VERSION 3.24)
project(skeldal) project(skeldal)
# Najít SDL2 knihovnu # Najít SDL2 knihovnu
find_package(SDL2 REQUIRED) find_package(SDL2 REQUIRED)
if (MSVC) if (MSVC)
add_compile_options(/W4 /EHsc /DNOMINMAX) add_compile_options(/W4 /EHsc /DNOMINMAX /J)
set(STANDARD_LIBRARIES "") set(STANDARD_LIBRARIES "")
else() else()
add_compile_options(-Wall -Wextra -Werror -Wno-unused-parameter -Wno-unused-value -Wno-extern-c-compat) add_compile_options(-Wall -Wextra -Werror -Wno-unused-parameter -Wno-unused-value -Wno-extern-c-compat -funsigned-char)
set(STANDARD_LIBRARIES "pthread") set(STANDARD_LIBRARIES "pthread")
endif() endif()
@ -19,7 +19,6 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/)
include_directories( ${SDL2_INCLUDE_DIRS}) include_directories( ${SDL2_INCLUDE_DIRS})
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -funsigned-char")
enable_testing() enable_testing()
add_subdirectory(libs) add_subdirectory(libs)
add_subdirectory(platform) add_subdirectory(platform)

View file

@ -929,7 +929,7 @@ static void start_install()
char error=0,autostart; char error=0,autostart;
get_value(0,60,target_path); get_value(0,60,target_path);
if (find_object(waktual,70)!=NULL) autostart=f_get_value(0,70); else autostart=1; if (find_object(waktual,70)!=NULL) autostart=f_get_value(0,70); else autostart=1;
strupr(target_path); strupper(target_path);
if (validate_path(target_path)==0) if (validate_path(target_path)==0)
{ {
msg_box("Cesta je <20>patn<74>",'\x1',"Cesta s c<>lov<6F>m adres<65><73>em je chybn<62> zad<61>na. Nepou<6F><75>vejte dlouh<75> n<>zvy z WINDOWS 95!","OK",NULL); msg_box("Cesta je <20>patn<74>",'\x1',"Cesta s c<>lov<6F>m adres<65><73>em je chybn<62> zad<61>na. Nepou<6F><75>vejte dlouh<75> n<>zvy z WINDOWS 95!","OK",NULL);

View file

@ -200,7 +200,7 @@ long check_size(int gr)
for(i=0;i<pocet;i++) if (script[i]!=NULL) for(i=0;i<pocet;i++) if (script[i]!=NULL)
{ {
if (sscanf(script[i],"%d %s %s",&group,prikaz,work_buff)<1) group=gr+1; if (sscanf(script[i],"%d %s %s",&group,prikaz,work_buff)<1) group=gr+1;
strupr(prikaz); strupper(prikaz);
if (!strcmp(prikaz,COPY) && group==gr) if (!strcmp(prikaz,COPY) && group==gr)
{ {
struct find_t ft; struct find_t ft;
@ -494,7 +494,7 @@ char cascade_delete(char ignore_sav)
if (c!=NULL) if (c!=NULL)
{ {
strupr(c); strupper(c);
if (!ignore_sav || strncmp(c,".SAV",4)) remove(f.name); if (!ignore_sav || strncmp(c,".SAV",4)) remove(f.name);
} }
else remove(f.name); else remove(f.name);

272
LZWC.C
View file

@ -1,272 +0,0 @@
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include <string.h>
#define getmem(s) malloc(s)
#define New(typ) (typ *)getmem(sizeof(typ))
#define NewArr(typ,pocet) (typ *)getmem(sizeof(typ)*pocet);
#define ClrArr(p,typ,pocet) memset(p,0,sizeof(typ)*pocet);
#define LZW_MAX_CODES 4096
typedef struct double_s
{
short group,chr,first,next;
}DOUBLE_S;
typedef DOUBLE_S CODE_TABLE[LZW_MAX_CODES];
DOUBLE_S *compress_dic;
int clear_code;
int end_code;
int free_code;
int nextgroup;
int bitsize,init_bitsize;
unsigned char old_value=0;
void do_clear_code() //funkce maze slovni (clear code)
{
int i;
old_value=0;
nextgroup=free_code;
bitsize=init_bitsize;
for(i=0;i<clear_code;i++)
{
DOUBLE_S *p;
p=&compress_dic[i];
p->group=i;p->chr=-1;p->next=-1;p->first=-1;
}
}
void reinit_lzw()
{
do_clear_code();
}
char init_lzw_compressor(int dic_size)
//dic size je velikost slovniku(bitova)
//pro 8 bitove hodnoty zde vloz 8.
{
compress_dic=(DOUBLE_S *)getmem(sizeof(CODE_TABLE));
if (compress_dic==NULL) return -1;
clear_code=1<<dic_size;
end_code=clear_code+1;
free_code=end_code+1;
nextgroup=free_code;
init_bitsize=bitsize=dic_size+1;
do_clear_code();
return 0;
}
void done_lzw_compressor()
{
free(compress_dic);
}
/*
long output_code(void *target,long bitepos,int bitsize,int data);
#pragma aux output_code parm [edi][edx][ebx][eax]=\
"mov ecx,edx"\
"shr ecx,3"\
"add edi,ecx"\
"mov ecx,edx"\
"and cl,7h"\
"shl eax,cl"\
"or [edi],eax"\
"add edx,ebx"\
value[edx] modify [ecx];
*/
long output_code_c(void *target,long bitepos,int bitesize,int data)
{
unsigned char *c;
c=target;
c+=bitepos>>3;
data<<=bitepos & 7;
c[0]|=data;
c[1]=data>>8;
c[2]=data>>16;
return bitepos+bitesize;
}
/*int input_code(void *source,long *bitepos,int bitsize,int mask);
#pragma aux input_code parm [esi][edi][ebx][edx]=\
"mov ecx,[edi]"\
"mov eax,ecx"\
"shr eax,3"\
"mov eax,[esi+eax]"\
"and cl,7"\
"shr eax,cl"\
"and eax,edx"\
"add [edi],ebx"\
value[eax] modify [ecx];
*/
int input_code_c(unsigned char *source,long *bitepos,int bitsize,int mask)
{
unsigned char *c;int x;
c=source;
c+=*bitepos>>3;
x=c[0]+(c[1]<<8)+(c[2]<<16);
x>>=*bitepos & 7;
x &= mask;
*bitepos=*bitepos+bitsize;
return x;
}
int find_code(DOUBLE_S *p)
//hleda skupinu ve slovniku. Pokud neexistuje vraci -1;
{
int ps;
ps=p->group;
ps=compress_dic[ps].first;
while (ps!=-1)
{
if (compress_dic[ps].chr==p->chr) return ps;
ps=compress_dic[ps].next;
}
return -1;
}
void add_code(DOUBLE_S *p)
//vklada novou dvojici
{
p->first=-1;p->next=compress_dic[p->group].first;
memcpy(&compress_dic[nextgroup],p,sizeof(DOUBLE_S));
compress_dic[p->group].first=nextgroup;
nextgroup++;
}
long lzw_encode(unsigned char *source,void *target,int size)
//Encode LZW. zdroj, cil a velikost dat. Vraci velikost komprimovano.
{
long bitpos=0;
long maxbpos=size*8;
DOUBLE_S p;
int f;
clear:
old_value=(unsigned char)(p.group=*source++);size--;
while (size-->0)
{
if (bitpos>maxbpos) return -1;
p.chr=(int)((unsigned char)(*source++));old_value+=p.chr;
f=find_code(&p);
if (f<0)
{
bitpos=output_code_c(target,bitpos,bitsize,p.group);
add_code(&p);
if (nextgroup==(1<<bitsize)) bitsize++;
p.group=p.chr;
if (nextgroup>=LZW_MAX_CODES)
{
bitpos=output_code_c(target,bitpos,bitsize,p.group);
bitpos=output_code_c(target,bitpos,bitsize,clear_code);
do_clear_code();
goto clear;
}
}
else
p.group=f;
}
bitpos=output_code_c(target,bitpos,bitsize,p.group);
bitpos=output_code_c(target,bitpos,bitsize,end_code);
if (bitpos>maxbpos) return -1;
return (bitpos+8)>>3;
}
void de_add_code(DOUBLE_S *p,int *mask)
{
DOUBLE_S *q;
q=&compress_dic[nextgroup];q->group=p->group;q->chr=p->chr;q->first=compress_dic[p->group].first+1;
nextgroup++;
if (nextgroup==*mask)
{
*mask=(*mask<<1)+1;
bitsize++;
}
}
int expand_code(int code,unsigned char **target)
{
static int first;
if (code>end_code)
{
assert(compress_dic[code].group<code);
expand_code(compress_dic[code].group,target);
**target=old_value=(unsigned char)compress_dic[code].chr;
(*target)++;
}
else
{
**target=old_value=code;
(*target)++;
first=code;
}
return first;
}
/*
char fast_expand_code(int code,char **target);
#pragma aux fast_expand_code parm[eax][edi] modify [esi ecx] value [bl]
*/
long lzw_decode(void *source,unsigned char *target)
//dekomprimuje lzw. Nevraci velikost, tu si musi program zajistit sam.
{
long bitpos=0;
unsigned char *pp;
int code,old,i;
DOUBLE_S p;
int old_first;
int mask=0xff;
pp=target;
for(i=0;i<LZW_MAX_CODES;i++) compress_dic[i].first=0;
clear:
old_value=0;
nextgroup=free_code;
bitsize=init_bitsize;
mask=(1<<bitsize)-1;
code=input_code_c(source,&bitpos,bitsize,mask);
old_first=expand_code(code,&target);
old=code;
while ((code=input_code_c(source,&bitpos,bitsize,mask))!=end_code)
{
if (code==clear_code)
{
goto clear;
}
else if (code<nextgroup)
{
old_first=expand_code(code,&target);
p.group=old;
p.chr=old_first;
de_add_code(&p,&mask);
old=code;
}
else
{
p.group=old;
p.chr=old_first;
de_add_code(&p,&mask);
old_first=expand_code(code,&target);
old=code;
}
}
return target-pp;
}

56
LZWC.H
View file

@ -1,56 +0,0 @@
/****************************************************************
* LL ZZZZZ WW WW *
* LL ZZ WW WW Autor: Ondrej Novak *
* LL ZZ WW WW Rok vzniku: 1998 *
* LL ZZ WW WW WW Prava: Public Domain *
* LL ZZ WW WW *
* LLLLLL ZZZZZ WW WW *
****************************************************************
Knihovna LZWC je komprimacni a dekomprimacni knihovna metodou LZW upravenou
rozdilovym kodovanim. Jeji ovladani je jednoduche.
*/
char init_lzw_compressor(int dic_size);
/*
Inicializuje knihovnu. Inicializovat je nutne pred kazdym dalsim pouzitim.
"dic_size" je pocatecni velikost slovniku a zaroven tak udava bitovou
hloubku komprimovanych (dekomprimovanych dat). Tato verze MUSI tuto hodnotu
nastavovat na 8. Jina hodnota neni pripustna. Vyuziti se predpoklada
v budoucnu, kdy bude mozne komprimovat i jinou bitovou hloubku.
Vraci -1 pokud neco selhalo.
*/
void done_lzw_compressor();
/*
Ukoncuje praci s knihovnou, maze slovniky, uvolnuje pamet.
*/
long lzw_encode(unsigned char *source,void *target,int size);
/*
Komprimuje data, jejichz ukazatel je ulozen v "source"
(pretypujte na unsigned char). Tyto data maji velikost "size"
Dale je nutne rezervovat pamet "target" ktera by mela mit velikost aspon
o 16 bytu vetsi nez size. Pamet "target" je nutne predtim VYNULOVAT!!!
Funkce vraci velikost zakomprimovanych dat, nebo -1 pokud se nepodarilo
data z komprimovat. I v tomto pripade je nutne vzit na vedomi
ze komprese probehla, byt neuspesne.
*/
long lzw_decode(void *source,unsigned char *target);
/*
Dekomprimuje data, jejichz ukazatel je ulozen v "source".
Dale rezervujte dostatecne mnozstvi pameti v "target"
Funkce vraci velikost dekomprimovanych dat, nebo -1 pokud volani selhalo.
*/
void reinit_lzw();
/*
Funkce maze slovniky, ale bez nutnosti knihovnu znovu inicializovat
*/
/*
DULEZITA POZNAMKA!!!
Po kazdem volani decode a encode je nutne knihovnu reinicializovat
(popripade ukoncit)
Nejvetsi komprimovatelna velikost je 0x10000000 bytes
*/

View file

@ -473,7 +473,7 @@ void item_sound_call(TITEM *it)
char s[200]; char s[200];
int z; int z;
get_value(0,20,s); get_value(0,20,s);
strupr(s); strupper(s);
z=it->sound; z=it->sound;
if (s[0])it->sound=add_sound_to_table(s);else it->sound=0; if (s[0])it->sound=add_sound_to_table(s);else it->sound=0;
delete_unused_sound(z); delete_unused_sound(z);

View file

@ -874,7 +874,7 @@ int main(int argc,char *argv[])
puts("...nemohu najit WSKELDAL.INI\n"); puts("...nemohu najit WSKELDAL.INI\n");
return 1; return 1;
} }
if (strlen(filename)>3 && stricmp(filename+strlen(filename)-3,"adv")==0) if (strlen(filename)>3 && istrcmp(filename+strlen(filename)-3,"adv")==0)
{ {
TSTR_LIST adv_cfg=read_config(filename); TSTR_LIST adv_cfg=read_config(filename);
config_file=merge_configs(config_file,adv_cfg); config_file=merge_configs(config_file,adv_cfg);

View file

@ -460,7 +460,7 @@ void check_mobs_name()
for(i=0;i<6 && s[i];i++) if (s[i]==32) s[i]='_'; for(i=0;i<6 && s[i];i++) if (s[i]==32) s[i]='_';
for(;i<6;i++) s[i]='_'; for(;i<6;i++) s[i]='_';
s[i]=0; s[i]=0;
strupr(s); strupper(s);
set_value(0,100,s); set_value(0,100,s);
c_set_value(0,180,0); c_set_value(0,180,0);
c_set_value(0,185,0); c_set_value(0,185,0);
@ -674,7 +674,7 @@ void mob_sound_call(int mob)
for(j=0;j<MOB_SOUNDS-1;j++) for(j=0;j<MOB_SOUNDS-1;j++)
{ {
get_value(0,20+j,s); get_value(0,20+j,s);
strupr(s); strupper(s);
if (s[0]) moblist[i].sounds[j]=add_mob_sound(s)+1;else moblist[i].sounds[j]=0; if (s[0]) moblist[i].sounds[j]=add_mob_sound(s)+1;else moblist[i].sounds[j]=0;
} }
moblist[i].vlajky&=~0x40; moblist[i].vlajky&=~0x40;

View file

@ -940,7 +940,7 @@ LRESULT WINAPI BrowserDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
if (sel!=-1) mode=ComboBox_GetItemData(list,sel); if (sel!=-1) mode=ComboBox_GetItemData(list,sel);
if (mode==0) if (mode==0)
{ {
if (strlen(name)<5 || stricmp(name+strlen(name)-4,".map")!=0) strcat(name,".map"); if (strlen(name)<5 || istrcmp(name+strlen(name)-4,".map")!=0) strcat(name,".map");
if (strlen(name)>12) if (strlen(name)>12)
{ {
MessageBox(hDlg,"Jmeno mapy je prilis dlouhe (max 8 znaku bez pripony nebo 12 znaku s priponou)",0,MB_OK|MB_ICONEXCLAMATION); MessageBox(hDlg,"Jmeno mapy je prilis dlouhe (max 8 znaku bez pripony nebo 12 znaku s priponou)",0,MB_OK|MB_ICONEXCLAMATION);

View file

@ -1,58 +0,0 @@
/*
* Nahodi SVGA
*/
#include <dos.h>
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <string.h>
#define SCREEN_AREA 0xa000
#define SCREEN_LIN_ADDR ((SCREEN_AREA) << 4)
#define SCREEN_SIZE 65537
unsigned char pomoc[256];
void main()
{
unsigned short *pscreen;
unsigned int sizegran;
int i,err;
int col;
int g;
union REGPACK regs;
//-------------------------------------------------------------
//pomoc = (unsigned char *)malloc(512);
memset( &regs, 0, sizeof(union REGPACK) );
regs.w.ax = 0x4f02;
regs.w.bx = 0x0111;
intr( 0x10, &regs);//nastaveni videomodu
//regs.w.ax = 0x4f01;
//regs.w.cx = 0x0101;
//regs.w.es = FP_SEG (pomoc);
//regs.w.di = FP_OFF (pomoc);
//intr( 0x10, &regs);//zjisteni granularity v KB
//err = regs.w.ax;
//sizegran = pomoc[4];
//sizegran = sizegran*1024;
//if (sizegran<=65536)
//----------------------------
for( col = 0; col < 100; col++ ) {
trace:if (!(inp( 0x03da )&8 )) goto trace;// cekani na raytrace
for( g = 0; g < 10; g++ ) {
regs.w.ax = 0x4f05;
regs.w.bx = 0;
regs.w.dx = g;
intr( 0x10, &regs);//prepnuti videostranky
pscreen = (unsigned short *)SCREEN_LIN_ADDR;
for( i = 0; i < SCREEN_SIZE; i+=sizeof(*pscreen) ) {
*pscreen = i+col*g;
pscreen+=1;
}
}
}
regs.w.ax = 0x0003;
intr (0x10,&regs);
//for( g = 0; g < 15; g++ ) printf("%X...%X\n",g,pomoc[g]*1024);
//free (pomoc);
//printf("err %X\n",err);
}

View file

@ -1,43 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MapEdit", "mapedit\MapEdit.vcproj", "{F2CA5BB1-C021-4708-AED7-7290F7255537}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Skeldal", "Skeldal.vcproj", "{AE3E864A-642C-4280-93EC-77A551CF495C}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Lex_Lib", "mapedit\Lex_Lib\Lex_Lib.vcproj", "{E8075868-DD7C-4F22-8751-4847A3F33F55}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CSpells", "mapedit\CSpells\CSpells.vcproj", "{9C3ABECA-90BA-4D59-BE93-BABE53117B89}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CDialogy", "mapedit\CDialogy\CDialogy.vcproj", "{CA0202C1-2629-45BC-ACBF-1063EA1F4285}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F2CA5BB1-C021-4708-AED7-7290F7255537}.Debug|Win32.ActiveCfg = Debug|Win32
{F2CA5BB1-C021-4708-AED7-7290F7255537}.Debug|Win32.Build.0 = Debug|Win32
{F2CA5BB1-C021-4708-AED7-7290F7255537}.Release|Win32.ActiveCfg = Release|Win32
{F2CA5BB1-C021-4708-AED7-7290F7255537}.Release|Win32.Build.0 = Release|Win32
{AE3E864A-642C-4280-93EC-77A551CF495C}.Debug|Win32.ActiveCfg = Debug|Win32
{AE3E864A-642C-4280-93EC-77A551CF495C}.Debug|Win32.Build.0 = Debug|Win32
{AE3E864A-642C-4280-93EC-77A551CF495C}.Release|Win32.ActiveCfg = Release|Win32
{AE3E864A-642C-4280-93EC-77A551CF495C}.Release|Win32.Build.0 = Release|Win32
{E8075868-DD7C-4F22-8751-4847A3F33F55}.Debug|Win32.ActiveCfg = Debug|Win32
{E8075868-DD7C-4F22-8751-4847A3F33F55}.Debug|Win32.Build.0 = Debug|Win32
{E8075868-DD7C-4F22-8751-4847A3F33F55}.Release|Win32.ActiveCfg = Release|Win32
{E8075868-DD7C-4F22-8751-4847A3F33F55}.Release|Win32.Build.0 = Release|Win32
{9C3ABECA-90BA-4D59-BE93-BABE53117B89}.Debug|Win32.ActiveCfg = Debug|Win32
{9C3ABECA-90BA-4D59-BE93-BABE53117B89}.Debug|Win32.Build.0 = Debug|Win32
{9C3ABECA-90BA-4D59-BE93-BABE53117B89}.Release|Win32.ActiveCfg = Release|Win32
{9C3ABECA-90BA-4D59-BE93-BABE53117B89}.Release|Win32.Build.0 = Release|Win32
{CA0202C1-2629-45BC-ACBF-1063EA1F4285}.Debug|Win32.ActiveCfg = Debug|Win32
{CA0202C1-2629-45BC-ACBF-1063EA1F4285}.Debug|Win32.Build.0 = Debug|Win32
{CA0202C1-2629-45BC-ACBF-1063EA1F4285}.Release|Win32.ActiveCfg = Release|Win32
{CA0202C1-2629-45BC-ACBF-1063EA1F4285}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

Binary file not shown.

File diff suppressed because it is too large Load diff

View file

@ -1,8 +0,0 @@
// stdafx.cpp : source file that includes just the standard includes
// mapedit.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file

View file

@ -1,19 +0,0 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__A63322C2_6786_488F_BB36_15C84AEB5478__INCLUDED_)
#define AFX_STDAFX_H__A63322C2_6786_488F_BB36_15C84AEB5478__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// TODO: reference additional headers your program requires here
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__A63322C2_6786_488F_BB36_15C84AEB5478__INCLUDED_)

View file

@ -419,7 +419,7 @@ void interpret_line(FILE *f)
c++; c++;
sscanf(c,"%23s",command);c=strchr(c,32); sscanf(c,"%23s",command);c=strchr(c,32);
strupr(command); strupper(command);
if (!strcmp(command,"ID")) if (!strcmp(command,"ID"))
{ {
get_num(c,num); get_num(c,num);

View file

@ -450,7 +450,7 @@ static void change_dir()
c_set_value(0,9,0); c_set_value(0,9,0);
send_message(E_GUI,9,E_CONTROL,2); send_message(E_GUI,9,E_CONTROL,2);
i=strlen(last_path); i=strlen(last_path);
strupr(last_path); strupper(last_path);
if (i!=0 && last_path[i-1]!='\\') if (i!=0 && last_path[i-1]!='\\')
{ {
strcat(last_path,"\\"); strcat(last_path,"\\");

View file

@ -676,7 +676,7 @@ char *get_pcx_name(char *name,int x)
sprintf(s,"%s%05d.pcx",s,x); sprintf(s,"%s%05d.pcx",s,x);
} }
else sprintf(s,"%s%04d.pcx",s,x); else sprintf(s,"%s%04d.pcx",s,x);
strupr(s); strupper(s);
} }
else else
{ {
@ -805,7 +805,7 @@ void script_compress(char *script_name)
int j=lowq; int j=lowq;
ungetc(i,scr); ungetc(i,scr);
i=fscanf(scr,"%s %d %d %d %d",s,&j,&min_fr,&max_fr,&colorq); i=fscanf(scr,"%s %d %d %d %d",s,&j,&min_fr,&max_fr,&colorq);
strupr(s); strupper(s);
if (!strcmp(s,"FRAMESTEP")) frame_step=j; if (!strcmp(s,"FRAMESTEP")) frame_step=j;
else else
if (!strcmp(s,"STATIC")) statpic=j; if (!strcmp(s,"STATIC")) statpic=j;

View file

@ -722,7 +722,7 @@ void change_music(const char *mus_filename)
else else
{ {
const char *c=strrchr(mus_filename,'.'); const char *c=strrchr(mus_filename,'.');
if (c!=0 && stricmp(c,".mus")==0) if (c!=0 && istrcmp(c,".mus")==0)
GCurrentDecoder=&GMusDecoder; GCurrentDecoder=&GMusDecoder;
else else
GCurrentDecoder=&GWinAmpPlayer; GCurrentDecoder=&GWinAmpPlayer;

Binary file not shown.

View file

@ -1,276 +0,0 @@
#define WINVER 0x0500
#include <windows.h>
#include <stdio.h>
#include <malloc.h>
#include <stdlib.h>
#ifndef __specstrings
#define __specstrings
#define PSTR char *
#define PCSTR const char *
#define PULONG_PTR DWORD *
#define ULONG_PTR DWORD
#define __in
#define __out
#define __inout
#define __in_opt
#define __out_opt
#define __inout_opt
#define __in_ecount(x)
#define __out_ecount(x)
#define __inout_ecount(x)
#define __in_bcount(x)
#define __out_bcount(x)
#define __inout_bcount(x)
#define __deref_opt_out
#define __deref_out
#define __out_xcount(x)
#endif
#include <DbgHelp.h>
typedef BOOL (WINAPI *MiniDumpWriteDump_Type)(
HANDLE hProcess,
DWORD ProcessId,
HANDLE hFile,
MINIDUMP_TYPE DumpType,
PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,
PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,
PMINIDUMP_CALLBACK_INFORMATION CallbackParam
);
static MiniDumpWriteDump_Type MiniDumpWriteDumpFn;
static DWORD WINAPI SafeMsgBox(LPVOID text)
{
MessageBox(NULL,(LPCTSTR)text,NULL,MB_OK|MB_SYSTEMMODAL);
return 0;
}
static bool GenerateMinidump(MINIDUMP_EXCEPTION_INFORMATION *ExceptionInfo, MINIDUMP_TYPE flags,const char *sufix)
{
char buff[MAX_PATH+50];
HANDLE hFile;
GetModuleFileName(NULL,buff,MAX_PATH);
strcat(buff,sufix);
hFile=CreateFile(buff,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,0,NULL);
if (hFile==NULL)
{
char *text=(char *)alloca(strlen(buff)+200);
sprintf(text,"Nemohu vytvorit soubor zaznamu '%s', zkontroluje prava zapisu do adresare hry",buff);
MessageBox(0,text,0,MB_SYSTEMMODAL);
return false;
}
else
{
if (MiniDumpWriteDumpFn(GetCurrentProcess(),GetCurrentProcessId(),hFile,flags,ExceptionInfo,NULL,NULL)!=TRUE)
{
char *text=(char *)alloca(strlen(buff)+200);
sprintf(text,"Selhalo volani MiniDumpWriteDump. Nelze vygenerovat zaznam do souboru '%s'",buff);
MessageBox(0,text,0,MB_SYSTEMMODAL);
return false;
}
CloseHandle(hFile);
}
return true;
}
static BOOL WINAPI CloseOneWindow(HWND hWnd, LPARAM lParam)
{
CloseWindow(hWnd);
return TRUE;
}
static void CloseAllWindows()
{
EnumThreadWindows(GetCurrentThreadId(),CloseOneWindow,NULL);
}
extern "C" { int GetExeVersion();}
static DWORD WINAPI PostError(LPVOID p)
{
char buff[MAX_PATH+50];
char dmp[MAX_PATH+50];
char product[MAX_PATH];
char *tmp;
GetModuleFileName(NULL,buff,MAX_PATH);
tmp=strrchr(buff,'\\');
if (tmp==0) tmp=buff;else tmp++;
strcpy(product,tmp);
strcpy(dmp,buff);
strcpy(strrchr(buff,'\\')+1,"poslichybu.html");
strcat(dmp,".short.dmp");
DeleteFile(buff);
HANDLE h=CreateFile(buff,GENERIC_WRITE,0,0,CREATE_ALWAYS,0,0);
if (h!=INVALID_HANDLE_VALUE)
{
DWORD wrt;
DWORD rd;
const char *form1=
"<?xml version=\"1.0\" encoding=\"Windows-1250\"?>"
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">"
"<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"cs\" lang=\"cs\">"
"<head>"
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1250\" />"
"<title>Br<42>ny Skeldalu - formul<75><6C> k odesl<73>n<EFBFBD> chyby</title>"
"<style type=\"text/css\">\n"
"@import url(\"http://skeldal.jinak.cz/style.css\");\n"
"</style>"
"</head>"
"<body>"
"<div style=\"float: left; width: 155px;\"><img src=\"http://skeldal.jinak.cz/logo.jpg\" alt=\"logo\" width=\"150\" height=\"82\"/></div>"
"<div style=\"margin-left: 180px;margin-right: 50px;\">"
"<h1>Br<42>ny Skeldalu - formul<75><6C> k odesl<73>n<EFBFBD> chyby</h1>"
"<p>Autor programu se omlouv<75> za chybu a pros<6F> V<>s, abyste pomohl p<>i odhalov<6F>n<EFBFBD> chyb.<br />"
"Sta<EFBFBD><EFBFBD> kdy<64> pravdiv<69> vypln<6C>te ode<64>lete n<>sleduj<75>c<EFBFBD> formul<75><6C>.<br />"
"Pokuste se pros<6F>m napsat co nejv<6A>ce informac<61>.<br />"
"<b>K formul<75><6C>i je p<>ilo<6C>en soubor obsahuj<75>c<EFBFBD> z<>znam o chyb<79>.</b><br /><br />"
"D<EFBFBD>kujeme za spolupr<70>ci</p>"
"<hr />"
"<form enctype=\"multipart/form-data\" action=\"http://skeldal.jinak.cz/bugreport.php\" method=\"post\"><div>"
"<div>V<> e-mail pro p<><70>pad, <20>e bysme v<>s cht<68>li kontaktovat: (nepovinn<6E>)</div>"
"<input type=\"text\" name=\"email\" value=\"\" size=\"50\"/>"
"<div>Napi<70>te pros<6F>m dal<61><6C> informace o tom, za jak<61>ch podm<64>nek chyba vznikla, pop<6F><70>pad<61> jak chybu znovu vyvolat</div>"
"<textarea cols=\"50\" rows=\"10\" name=\"popis\" style=\"width:100%\"></textarea>"
"<div>P<><50>padn<64> p<>ilo<6C>te ulo<6C>enou pozici nebo jin<69> soubory souvisej<65>c<EFBFBD> s chybou</div>"
"<input name=\"userfile\" type=\"file\" size=\"50\" />"
"<hr /><div>"
"Pozor: Formul<75><6C> tak<61> obsahuje informace o posledn<64> chyb<79>.<br />"
"Nepou<EFBFBD><EFBFBD>vejte tento formul<75><6C> k odesl<73>n<EFBFBD> jin<69>ch chybov<6F>ch hl<68>en<65>.</div>"
"<p><a href=\"http://skeldal.jinak.cz/main.php?page=soukrom<6F>\">Prohl<68>en<65> o ochran<61> soukrom<6F>ch <20>daj<61></a></p>"
"<hr />"
"<input type=\"submit\" value=\"Odeslat z<>znam o chyb<79>\" /><br />"
"<input type=\"hidden\" name=\"data\" value=\"";
WriteFile(h,(void *)(form1),strlen(form1),&wrt,0);
HANDLE v=CreateFile(dmp,GENERIC_READ,0,0,OPEN_EXISTING,0,0);
if (v==INVALID_HANDLE_VALUE)
{
MessageBox(0,"Nebylo mozne otevrit soubor se zaznamem o chybe. Soubor je nepristupny",0,MB_OK|MB_SYSTEMMODAL);
return 0;
}
unsigned char buff[256];
do
{
ReadFile(v,buff,128,&rd,0);
for (int i=127;i>=0;i--)
{
char tmp[3];
sprintf(tmp,"%02X",buff[i]);
buff[i*2]=tmp[0];
buff[i*2+1]=tmp[1];
}
WriteFile(h,buff,rd*2,&wrt,0);
}while (rd);
CloseHandle(v);
const char *form2="\" /><input type=\"hidden\" name=\"version\" value=\"";
WriteFile(h,(void *)(form2),strlen(form2),&wrt,0);
wsprintf((char *)buff,"%d",GetExeVersion());
WriteFile(h,buff,strlen((char *)buff),&wrt,0);
const char *form3="\" /><input type=\"hidden\" name=\"product\" value=\"";
WriteFile(h,(void *)(form3),strlen(form3),&wrt,0);
WriteFile(h,(void *)(product),strlen(product),&wrt,0);
const char *form4="\" /></div></form> <p>"
"<img "
"src=\"http://www.w3.org/Icons/valid-xhtml10\" "
"alt=\"Valid XHTML 1.0!\" height=\"31\" width=\"88\" /></p></div></body></html>";
WriteFile(h,(void *)(form4),strlen(form4),&wrt,0);
CloseHandle(h);
}
int i=MessageBox(NULL,"Zaznam o chybe dokoncen. Soubory se zaznamy byly ulozeny do slozky hry. "
"Prosim nemazte tyto soubory, je mozne, ze budou potrebne k hlubsi analyze chyby. "
"Hlaseni o chybe je nyni mozne odeslat po internetu k dalsimu prozkoumani. "
"Pokud neni pocitac pripojen k internetu trvale, bude nutne jej pripojit nyni.\r\n\r\n"
"Chcete zaznam o chybe odeslat?",0,MB_YESNO|MB_SYSTEMMODAL);
if (i==IDYES)
{
if (h==INVALID_HANDLE_VALUE || (UINT)ShellExecute(0,0,buff,0,0,SW_NORMAL)<32)
MessageBox(0,"Nastala chyba pri otevirani formulare. Formular prosim otevrete rucne - soubor 'poslichybu.html'",0,MB_OK|MB_SYSTEMMODAL);
}
else
{
MessageBox(0,"Informace o chybe lze odeslat pozdeji pomoci formulare 'poslichybu.html', jenz byl vytvoren ve slozce hry",0,MB_OK|MB_SYSTEMMODAL);
}
return 0;
}
static DWORD WINAPI CrashReportGenerateThread(LPVOID data)
{
MINIDUMP_EXCEPTION_INFORMATION *ExceptionInfo=(MINIDUMP_EXCEPTION_INFORMATION *)data;
HWND hwnd;
int res;
if (MiniDumpWriteDumpFn!=NULL)
{
hwnd=CreateWindowEx(WS_EX_TOPMOST,"STATIC","V programu nastala chyba\r\n\r\nSystem Windows nyni sbira informace o chybe a generuje potrebne soubory.\r\nProsim cekejte, tato operace muze trvat trochu dele...",WS_POPUP|
WS_DLGFRAME|WS_VISIBLE|SS_CENTER,0,0,640,80,NULL,NULL,GetModuleHandle(NULL),NULL);
UpdateWindow(hwnd);
if (GenerateMinidump(ExceptionInfo,MiniDumpNormal,".short.dmp")==false) return 0;
GenerateMinidump(ExceptionInfo,MiniDumpWithDataSegs,".int32_t.dmp");
GenerateMinidump(ExceptionInfo,MiniDumpWithFullMemory,".full.dmp");
PostError(0);
DestroyWindow(hwnd);
}
else
{
res=MessageBox(0,"V programu nastala chyba. Bohuzel neni pritomen soubor DbgHelp.dll v adresari hry, "
"neni tedy mozne vytvorit zaznam o chybe. Ze stranek http://skeldal.jinak.cz je mozne"
"tento soubor stahnout a tim pomoci autorovi odhalit a opravit tyto zaludne pady.\r\n\r\n"
"Chcete prejit na stranky obsahujici posledni verze potrebnych souboru?",0,MB_YESNO|MB_SYSTEMMODAL);
if (res==IDYES)
ShellExecute(0,0,"http://skeldal.jinak.cz/main.php?page=download",0,0,SW_NORMAL);
}
return 0;
}
static LONG WINAPI CrashReportGenerate(EXCEPTION_POINTERS *ExceptionInfo)
{
HANDLE msg;
MINIDUMP_EXCEPTION_INFORMATION nfo;
nfo.ThreadId=GetCurrentThreadId();
nfo.ExceptionPointers=ExceptionInfo;
nfo.ClientPointers=FALSE;
// CloseAllWindows();
msg=CreateThread(NULL,0,CrashReportGenerateThread,(void *)&nfo,0,NULL);
WaitForSingleObject(msg,INFINITE);
ExitProcess(1);
return 0;
}
extern "C"
{
void CrashReportOnBuffOverrun()
{
__try
{
RaiseException(EXCEPTION_ARRAY_BOUNDS_EXCEEDED,EXCEPTION_NONCONTINUABLE,0,0);
}
__except(CrashReportGenerate(GetExceptionInformation()))
{
}
}
extern char __report_gsfailure();
void InitCrashDump()
{
char *p=(char *)(&__report_gsfailure);
DWORD oldProtect;
::VirtualProtect(p,150,PAGE_EXECUTE_WRITECOPY,&oldProtect);
*p=0xCC;
::VirtualProtect(p,150,PAGE_EXECUTE_READ,&oldProtect);
SetUnhandledExceptionFilter(CrashReportGenerate);
HMODULE lib=LoadLibrary("DbgHelp.dll");
MiniDumpWriteDumpFn=(MiniDumpWriteDump_Type)GetProcAddress(lib,"MiniDumpWriteDump");
}
}

View file

@ -1 +0,0 @@
void InitCrashDump();

View file

@ -41,3 +41,4 @@ ${CMAKE_BINARY_DIR}/default_font.cpp
) )
add_library(skeldal_main ${files}) add_library(skeldal_main ${files})
set_property(TARGET skeldal_main PROPERTY CXX_STANDARD 20)

View file

@ -2,7 +2,7 @@
#include "advconfig.h" #include "advconfig.h"
#include <alloca.h> #include <malloc.h>
#include <string.h> #include <string.h>
@ -17,25 +17,25 @@ static void process_row(INI_CONFIG_SECTION *sec, const char *row) {
const char *value = sep+1; const char *value = sep+1;
if (stricmp(key,"CESTA_GRAFIKA") == 0) { if (istrcmp(key,"CESTA_GRAFIKA") == 0) {
ini_replace_key(sec, "graphics", value); ini_replace_key(sec, "graphics", value);
} else if (stricmp(key, "CESTA_ZVUKY") == 0) { } else if (istrcmp(key, "CESTA_ZVUKY") == 0) {
ini_replace_key(sec, "sounds", value); ini_replace_key(sec, "sounds", value);
} else if (stricmp(key, "CESTA_FONTY") == 0) { } else if (istrcmp(key, "CESTA_FONTY") == 0) {
ini_replace_key(sec, "fonts", value); ini_replace_key(sec, "fonts", value);
} else if (stricmp(key, "CESTA_MAPY") == 0) { } else if (istrcmp(key, "CESTA_MAPY") == 0) {
ini_replace_key(sec, "maps", value); ini_replace_key(sec, "maps", value);
} else if (stricmp(key, "CESTA_MUSIC") == 0) { } else if (istrcmp(key, "CESTA_MUSIC") == 0) {
ini_replace_key(sec, "music_adv", value); ini_replace_key(sec, "music_adv", value);
} else if (stricmp(key, "CESTA_BGRAFIKA") == 0) { } else if (istrcmp(key, "CESTA_BGRAFIKA") == 0) {
ini_replace_key(sec, "gui", value); ini_replace_key(sec, "gui", value);
} else if (stricmp(key, "CESTA_ITEMY") == 0) { } else if (istrcmp(key, "CESTA_ITEMY") == 0) {
ini_replace_key(sec, "items", value); ini_replace_key(sec, "items", value);
} else if (stricmp(key, "CESTA_ENEMY") == 0) { } else if (istrcmp(key, "CESTA_ENEMY") == 0) {
ini_replace_key(sec, "enemy", value); ini_replace_key(sec, "enemy", value);
} else if (stricmp(key, "CESTA_VIDEO") == 0) { } else if (istrcmp(key, "CESTA_VIDEO") == 0) {
ini_replace_key(sec, "video", value); ini_replace_key(sec, "video", value);
} else if (stricmp(key, "CESTA_DIALOGY") == 0) { } else if (istrcmp(key, "CESTA_DIALOGY") == 0) {
ini_replace_key(sec, "dialogs", value); ini_replace_key(sec, "dialogs", value);
} }
} }

View file

@ -254,7 +254,7 @@ void psani_poznamek_event(EVENT_MSG *msg,void **data)
{ {
case 8:if (index) index--; text[index]=0;break; case 8:if (index) index--; text[index]=0;break;
case 27:strcpy(text,save); case 27:strcpy(text,save);
[[fallthrough]]; CASE_FALLTHROUGH;
case 13:save_text_to_map(x,y,cur_depth,text); case 13:save_text_to_map(x,y,cur_depth,text);
send_message(E_DONE,E_MOUSE,psani_poznamek_event); send_message(E_DONE,E_MOUSE,psani_poznamek_event);
msg->msg=-2; msg->msg=-2;

View file

@ -1329,7 +1329,7 @@ void redraw_scene()
send_message(E_KOUZLO_ANM); send_message(E_KOUZLO_ANM);
} }
void refresh_scene() void refresh_scene(THE_TIMER *t)
{ {
redraw_scene(); redraw_scene();
if (!cancel_render && !norefresh) if (!cancel_render && !norefresh)

View file

@ -695,7 +695,7 @@ static char validate_character(THUMAN *h)
return 1; return 1;
} }
*/ */
static void empty_proc() static void empty_proc(void)
{ {
} }

View file

@ -177,7 +177,7 @@ static char purge_map()
_dos_findclose(&rc);*/ _dos_findclose(&rc);*/
wzprintf("\r\n Zadej jmeno tempu (all - vse):");gets(buffer); wzprintf("\r\n Zadej jmeno tempu (all - vse):");gets(buffer);
if (buffer[0]==0) return 0; if (buffer[0]==0) return 0;
strupr(buffer); strupper(buffer);
concat(c,pathtable[SR_TEMP],buffer); concat(c,pathtable[SR_TEMP],buffer);
if (strcmp(buffer,ALL) && check_file_exists_ex(c)) if (strcmp(buffer,ALL) && check_file_exists_ex(c))
{ {
@ -461,7 +461,7 @@ static int add_file_to_console(const char *name, LIST_FILE_TYPE _, size_t __, vo
for (int i = 0; i < 19; ++i) buff[i] = ' '; for (int i = 0; i < 19; ++i) buff[i] = ' ';
buff[19] = 0; buff[19] = 0;
int l = strlen(name); int l = strlen(name);
if (l > 3 && stricmp(name+l-4,".MAP") == 0) { if (l > 3 && istrcmp(name+l-4,".MAP") == 0) {
if (l>19) l = 19; if (l>19) l = 19;
memcpy(buff, name, l); memcpy(buff, name, l);
wzprintf("%s", buff); wzprintf("%s", buff);
@ -475,51 +475,51 @@ static int add_file_to_console(const char *name, LIST_FILE_TYPE _, size_t __, vo
} }
static int process_on_off_command(const char *cmd, char on) { static int process_on_off_command(const char *cmd, char on) {
if (stricmp(cmd, "inner-eye") == 0) { if (istrcmp(cmd, "inner-eye") == 0) {
show_debug = on; show_debug = on;
return 1; return 1;
} }
if (stricmp(cmd, "hunter-instinct") == 0) { if (istrcmp(cmd, "hunter-instinct") == 0) {
show_lives = on; show_lives = on;
return 1; return 1;
} }
if (stricmp(cmd, "no-hassle") == 0) { if (istrcmp(cmd, "no-hassle") == 0) {
nohassle=on; nohassle=on;
return 1; return 1;
} }
if (stricmp(cmd, "iron-skin") == 0) { if (istrcmp(cmd, "iron-skin") == 0) {
immortality=on; immortality=on;
return 1; return 1;
} }
if (stricmp(cmd, "spirit-wander") == 0) { if (istrcmp(cmd, "spirit-wander") == 0) {
cur_group=on?10:postavy[0].groupnum; cur_group=on?10:postavy[0].groupnum;
return 1; return 1;
} }
if (stricmp(cmd, "ghost-walls") == 0) { if (istrcmp(cmd, "ghost-walls") == 0) {
ghost_walls = on; ghost_walls = on;
return 1; return 1;
} }
if (stricmp(cmd, "true-seeing") == 0) { if (istrcmp(cmd, "true-seeing") == 0) {
true_seeing = on; true_seeing = on;
return 1; return 1;
} }
if (stricmp(cmd, "walking-in-air") == 0) { if (istrcmp(cmd, "walking-in-air") == 0) {
nofloors = on; nofloors = on;
return 1; return 1;
} }
if (stricmp(cmd, "enemy-insight") == 0) { if (istrcmp(cmd, "enemy-insight") == 0) {
show_mob_info = on; show_mob_info = on;
return 1; return 1;
} }
if (stricmp(cmd, "enemy-walk-diagonal") == 0) { if (istrcmp(cmd, "enemy-walk-diagonal") == 0) {
game_extras = on?(game_extras | EX_WALKDIAGONAL):(game_extras & ~EX_WALKDIAGONAL); game_extras = on?(game_extras | EX_WALKDIAGONAL):(game_extras & ~EX_WALKDIAGONAL);
return 1; return 1;
} }
if (stricmp(cmd, "ghost-form") == 0) { if (istrcmp(cmd, "ghost-form") == 0) {
pass_all_mobs = on; pass_all_mobs = on;
return 1; return 1;
} }
if (stricmp(cmd, "dead-food") == 0) { if (istrcmp(cmd, "dead-food") == 0) {
dead_food = on; dead_food = on;
return 1; return 1;
} }
@ -529,41 +529,41 @@ static int process_on_off_command(const char *cmd, char on) {
void postavy_teleport_effect(int sector,int dir,int postava,char effect); void postavy_teleport_effect(int sector,int dir,int postava,char effect);
static int process_actions(const char *command) { static int process_actions(const char *command) {
if (stricmp(command, "flute") == 0) { if (istrcmp(command, "flute") == 0) {
bott_draw_fletna(); bott_draw_fletna();
return 1; return 1;
} }
if (stricmp(command, "global-map") == 0) { if (istrcmp(command, "global-map") == 0) {
wire_global_map(); wire_global_map();
return 1; return 1;
} }
if (stricmp(command, "status") == 0) { if (istrcmp(command, "status") == 0) {
display_game_status(); display_game_status();
return 1; return 1;
} }
if (stricmp(command, "offlers-blessing") == 0) { if (istrcmp(command, "offlers-blessing") == 0) {
money=150000; money=150000;
play_fx_at(FX_MONEY); play_fx_at(FX_MONEY);
return 1; return 1;
} }
if (stricmp(command, "i-require-gold") == 0) { if (istrcmp(command, "i-require-gold") == 0) {
money+=1; money+=1;
play_fx_at(FX_MONEY); play_fx_at(FX_MONEY);
return 1; return 1;
} }
if (stricmp(command, "to-the-moon") == 0) { if (istrcmp(command, "to-the-moon") == 0) {
money+=100000; money+=100000;
play_fx_at(FX_MONEY); play_fx_at(FX_MONEY);
return 1; return 1;
} }
if (stricmp(command, "echo-location") == 0) { if (istrcmp(command, "echo-location") == 0) {
for (int i = 1; i < mapsize; ++i) { for (int i = 1; i < mapsize; ++i) {
map_coord[i].flags |= MC_AUTOMAP; map_coord[i].flags |= MC_AUTOMAP;
} }
play_fx_at(FX_MAP); play_fx_at(FX_MAP);
return 1; return 1;
} }
if (stricmp(command, "rise-and-shine") == 0) { if (istrcmp(command, "rise-and-shine") == 0) {
int r = 0; int r = 0;
for (int i = 0; i < POCET_POSTAV; ++i) { for (int i = 0; i < POCET_POSTAV; ++i) {
THUMAN *p = postavy+i; THUMAN *p = postavy+i;
@ -579,7 +579,7 @@ static int process_actions(const char *command) {
return r; return r;
} }
if (stricmp(command, "ascent") == 0) { if (istrcmp(command, "ascent") == 0) {
int lev = postavy[0].exp; int lev = postavy[0].exp;
for (int i = 0; i < POCET_POSTAV; ++i) { for (int i = 0; i < POCET_POSTAV; ++i) {
THUMAN *p = postavy+i; THUMAN *p = postavy+i;
@ -592,18 +592,18 @@ static int process_actions(const char *command) {
} }
return 1; return 1;
} }
if (stricmp(command, "by-the-power-of-grayskull") == 0) { if (istrcmp(command, "by-the-power-of-grayskull") == 0) {
memset(runes,0xFF, sizeof(runes)); memset(runes,0xFF, sizeof(runes));
play_fx_at(FX_MAGIC); play_fx_at(FX_MAGIC);
return 1; return 1;
} }
if (stricmp(command, "world-list") == 0) { if (istrcmp(command, "world-list") == 0) {
int cnt = 0; int cnt = 0;
list_files(gpathtable[SR_MAP], file_type_normal|file_type_just_name, add_file_to_console, &cnt); list_files(gpathtable[SR_MAP], file_type_normal|file_type_just_name, add_file_to_console, &cnt);
printf("\n"); printf("\n");
return 1; return 1;
} }
if (stricmp(command, "beam-me-up") == 0) { if (istrcmp(command, "beam-me-up") == 0) {
for (int i = 1; i < mapsize; ++i) { for (int i = 1; i < mapsize; ++i) {
map_coord[i].flags |= MC_AUTOMAP; map_coord[i].flags |= MC_AUTOMAP;
} }
@ -652,14 +652,14 @@ static void wiz_find_monster(const char *name) {
} }
static int process_with_params(const char *cmd, const char *args) { static int process_with_params(const char *cmd, const char *args) {
if (stricmp(cmd, "locate") == 0) { if (istrcmp(cmd, "locate") == 0) {
if (args[0] == 0) return 0; if (args[0] == 0) return 0;
wiz_find_item(args); wiz_find_item(args);
wiz_find_monster(args); wiz_find_monster(args);
console_add_line(""); console_add_line("");
return 1; return 1;
} }
if (stricmp(cmd, "summon") == 0) { if (istrcmp(cmd, "summon") == 0) {
if (args[0] == 'i') { if (args[0] == 'i') {
char *end; char *end;
unsigned long id = strtoul(args+1, &end, 10); unsigned long id = strtoul(args+1, &end, 10);
@ -673,16 +673,16 @@ static int process_with_params(const char *cmd, const char *args) {
} }
return 0; return 0;
} }
if (stricmp(cmd, "say") == 0) { if (istrcmp(cmd, "say") == 0) {
console_add_line(args); console_add_line(args);
return 1; return 1;
} }
if (stricmp(cmd, "speed") == 0) { if (istrcmp(cmd, "speed") == 0) {
long v = strtol(args, NULL, 10); long v = strtol(args, NULL, 10);
if (v > 0) timerspeed_val = v; if (v > 0) timerspeed_val = v;
return v > 0; return v > 0;
} }
if (stricmp(cmd, "portal-jump") == 0) { if (istrcmp(cmd, "portal-jump") == 0) {
if (check_file_exists(build_pathname(2,gpathtable[SR_MAP], args))) { if (check_file_exists(build_pathname(2,gpathtable[SR_MAP], args))) {
TMA_LOADLEV lev; TMA_LOADLEV lev;
strncpy(lev.name,args,12); strncpy(lev.name,args,12);
@ -702,8 +702,8 @@ static int process_command(PARSED_COMMAND cmd) {
} }
int onoff = -1; int onoff = -1;
if (cmd.args) { if (cmd.args) {
if (stricmp(cmd.args, "on") == 0) onoff = 1; if (istrcmp(cmd.args, "on") == 0) onoff = 1;
else if (stricmp(cmd.args, "off") == 0) onoff = 0; else if (istrcmp(cmd.args, "off") == 0) onoff = 0;
} else { } else {
return process_actions(cmd.command); return process_actions(cmd.command);
} }

View file

@ -731,7 +731,7 @@ void wire_dialog_drw()
ukaz_mysku(); ukaz_mysku();
showview(0,0,0,0); showview(0,0,0,0);
} }
void unwire_dialog() void unwire_dialog(void)
{ {
send_message(E_DONE,E_KEYBOARD,key_check); send_message(E_DONE,E_KEYBOARD,key_check);
disable_click_map(); disable_click_map();
@ -1230,7 +1230,7 @@ static void cast_spell(int spell)
add_spell(spell,cil,cil,1); add_spell(spell,cil,cil,1);
} }
static void free_dialog_stringtable() { static void free_dialog_stringtable(void) {
stringtable_free(dialogy_strtable); stringtable_free(dialogy_strtable);
} }

View file

@ -191,7 +191,7 @@ void proved_d(char *code,char *text)
if (*code!=0xff)fscanf(dlg,"%[^\n]",text); if (*code!=0xff)fscanf(dlg,"%[^\n]",text);
if (*code==0) if (*code==0)
{ {
strupr(text); strupper(text);
if (!strncmp(text,"GOTO",4)) if (!strncmp(text,"GOTO",4))
{ {
int n; int n;

View file

@ -2,6 +2,7 @@
#include <libs/types.h> #include <libs/types.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <malloc.h>
#include <libs/memman.h> #include <libs/memman.h>

View file

@ -839,7 +839,7 @@ typedef struct load_specific_file_callback_data_t {
static ENUM_ALL_STATUS_CALLBACK_RESULT load_specific_file_callback(FILE *f, const char *name, size_t datasize, void *ctx) { static ENUM_ALL_STATUS_CALLBACK_RESULT load_specific_file_callback(FILE *f, const char *name, size_t datasize, void *ctx) {
LOAD_SPECIFIC_FILE_CALLBACK_DATA *me = ctx; LOAD_SPECIFIC_FILE_CALLBACK_DATA *me = ctx;
if (stricmp(name, me->name) == 0) { if (istrcmp(name, me->name) == 0) {
void *d = getmem(datasize); void *d = getmem(datasize);
if (fread(d, 1, datasize, f) != datasize) { if (fread(d, 1, datasize, f) != datasize) {
free(d); free(d);
@ -1377,7 +1377,7 @@ static void saveload_keyboard(EVENT_MSG *msg,void **_)
} }
} }
void unwire_save_load() void unwire_save_load(void)
{ {
term_task_wait(clk_ask_name[0].id); term_task_wait(clk_ask_name[0].id);
if (back_texture!=NULL) free(back_texture); if (back_texture!=NULL) free(back_texture);

View file

@ -58,7 +58,7 @@ void cti_texty(void);
static int convert_map_strings_1(const char *source_name, LIST_FILE_TYPE type, size_t sz, void *context) { static int convert_map_strings_1(const char *source_name, LIST_FILE_TYPE type, size_t sz, void *context) {
int l = strlen(source_name); int l = strlen(source_name);
if (stricmp(source_name+l-4,".map")) return 0; if (istrcmp(source_name+l-4,".map")) return 0;
source_name = set_file_extension(source_name, ".txt"); source_name = set_file_extension(source_name, ".txt");
const char *target_name = set_file_extension(concat2("map_", source_name),".csv"); const char *target_name = set_file_extension(concat2("map_", source_name),".csv");
const char *target_path = *(const char **)context; const char *target_path = *(const char **)context;

View file

@ -6,6 +6,7 @@
#include <string.h> #include <string.h>
#include <stdint.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <malloc.h>
#include <libs/memman.h> #include <libs/memman.h>
#define POCET_POSTAV 6 #define POCET_POSTAV 6
@ -645,11 +646,11 @@ extern char marker; //tato promenna je 0, jen v pripade ze je 1 probehne assert
//builder - skeldal //builder - skeldal
void *game_keyboard(EVENT_MSG *msg,void **usr); void game_keyboard(EVENT_MSG *msg,void **usr);
void calc_animations(void); void calc_animations(void);
int load_map(char *filename); int load_map(char *filename);
void other_draw(void); void other_draw(void);
void refresh_scene(void); void refresh_scene(THE_TIMER *t);
const void *pcx_fade_decomp(const void *p, int32_t *s); const void *pcx_fade_decomp(const void *p, int32_t *s);
const void *pcx_15bit_decomp(const void *p, int32_t *s); const void *pcx_15bit_decomp(const void *p, int32_t *s);
const void *pcx_15bit_autofade(const void *p, int32_t *s); const void *pcx_15bit_autofade(const void *p, int32_t *s);
@ -663,10 +664,11 @@ const void *load_mob_legacy_format(const void *p, int32_t *s);
const void *load_spells_legacy_format(const void *p, int32_t *s); const void *load_spells_legacy_format(const void *p, int32_t *s);
void wire_main_functs(void); void wire_main_functs(void);
void ukaz_kompas(char mode); void ukaz_kompas(char mode);
void *timming(EVENT_MSG *msg,void **data); void timming(EVENT_MSG *msg,void **data);
void do_timer(void); void do_timer(void);
void hold_timer(int id,char hld); void hold_timer(int id,char hld);
THE_TIMER *add_to_timer(int id,int delay,int maxcall,void *proc); typedef void (*TIMER_PROC)(THE_TIMER *t);
THE_TIMER *add_to_timer(int id,int delay,int maxcall,TIMER_PROC proc);
void delete_from_timer(int id); void delete_from_timer(int id);
THE_TIMER *find_timer(int id); THE_TIMER *find_timer(int id);
void objekty_mimo(void); void objekty_mimo(void);
@ -999,7 +1001,7 @@ int count_items_inside(short *place);
int count_items_total(short *place); int count_items_total(short *place);
char put_item_to_inv(THUMAN *p,short *picked_items); //funkce vklada predmet(y) do batohu postavy char put_item_to_inv(THUMAN *p,short *picked_items); //funkce vklada predmet(y) do batohu postavy
void pick_set_cursor(void); //nastavuje kurzor podle vlozeneho predmetu; void pick_set_cursor(void); //nastavuje kurzor podle vlozeneho predmetu;
void calc_fly(void); void calc_fly(THE_TIMER *t);
void zmen_skupinu(THUMAN *p); void zmen_skupinu(THUMAN *p);
void add_to_group(int num); void add_to_group(int num);
void group_all(void); void group_all(void);

View file

@ -19,7 +19,6 @@
#include "globals.h" #include "globals.h"
#include <string.h> #include <string.h>
#include <unistd.h>
#define GLOBMAP "GLOBMAP.DAT" #define GLOBMAP "GLOBMAP.DAT"
#define ODDELOVACE ";:=,\n\r{}" #define ODDELOVACE ";:=,\n\r{}"

View file

@ -25,7 +25,7 @@
#include "globals.h" #include "globals.h"
#include "engine1.h" #include "engine1.h"
#include <stdarg.h> #include <stdarg.h>
#include <unistd.h>
#define MES_MAXSIZE 500 #define MES_MAXSIZE 500
#define CHECK_BOX_ANIM 6 #define CHECK_BOX_ANIM 6
@ -1555,7 +1555,7 @@ void show_jrc_logo(char *filename)
word palette[256],*palw; word palette[256],*palw;
int cntr,cdiff,cpalf,ccc; int cntr,cdiff,cpalf,ccc;
change_music("?"); change_music(NULL);
curcolor=0;bar32(0,0,639,479); curcolor=0;bar32(0,0,639,479);
showview(0,0,0,0);sleep_ms(1000); showview(0,0,0,0);sleep_ms(1000);
const char *s = build_pathname(2, gpathtable[SR_VIDEO],filename); const char *s = build_pathname(2, gpathtable[SR_VIDEO],filename);

View file

@ -303,8 +303,8 @@ static char read_set(TMPFILE_RD *txt,char *var,char *set)
} }
} }
*cc=0; *cc=0;
strupr(set); strupper(set);
strupr(var); strupper(var);
return c; return c;
} }
@ -370,7 +370,7 @@ static char read_tag(TMPFILE_RD *txt)
i=temp_storage_scanf(txt,"%[^> ] %c",var,&c); i=temp_storage_scanf(txt,"%[^> ] %c",var,&c);
while(c<33 && i!=EOF) c=i=temp_storage_getc(txt); while(c<33 && i!=EOF) c=i=temp_storage_getc(txt);
if (c!='>') temp_storage_ungetc(txt); if (c!='>') temp_storage_ungetc(txt);
strupr(var); strupper(var);
if (!strcmp(var,PARAGRAPH)) if (!strcmp(var,PARAGRAPH))
{ {
break_line(); break_line();

View file

@ -1023,7 +1023,7 @@ void spell_teleport_sector(int cil,int owner)
if (TelepLocation.map) if (TelepLocation.map)
{ {
destroy_player_map(); destroy_player_map();
if (stricmp(TelepLocation.map,level_fname)!=0) if (istrcmp(TelepLocation.map,level_fname)!=0)
{ {

View file

@ -368,8 +368,8 @@ int enter_menu(char open)
} }
static const char *end_titles_path(const char *fname) { static const char *end_titles_path(const char *fname) {
if (stricmp(fname,"TITULKY.TXT") == 0) fname = "end_titles.txt"; if (istrcmp(fname,"TITULKY.TXT") == 0) fname = "end_titles.txt";
else if (stricmp(fname,"ENDTEXT.TXT") == 0) fname = "epilog.txt"; else if (istrcmp(fname,"ENDTEXT.TXT") == 0) fname = "epilog.txt";
return lang_replace_path_if_exists(fname); return lang_replace_path_if_exists(fname);
} }
@ -430,7 +430,7 @@ static int insert_next_line(int ztrata)
if (title_mode!=TITLE_KONEC) c=get_next_title(0,NULL);else c[0]=0; if (title_mode!=TITLE_KONEC) c=get_next_title(0,NULL);else c[0]=0;
if (c[0]=='*') if (c[0]=='*')
{ {
strupr(c); strupper(c);
if (!strcmp(c+1,"HEAD")) if (!strcmp(c+1,"HEAD"))
{ {
title_mode=TITLE_HEAD; title_mode=TITLE_HEAD;
@ -633,7 +633,7 @@ void konec_hry()
task_id=add_task(8196,titles,0,"TITULKY.TXT"); task_id=add_task(8196,titles,0,"TITULKY.TXT");
task_wait_event(E_KEYBOARD); task_wait_event(E_KEYBOARD);
if (is_running(task_id)) term_task(task_id); if (is_running(task_id)) term_task(task_id);
change_music("?"); change_music(NULL);
curcolor=0; curcolor=0;
bar32(0,0,639,479); bar32(0,0,639,479);
ukaz_mysku(); ukaz_mysku();

View file

@ -114,7 +114,7 @@ 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)
{ {
char *p,*end; char *p,*end;
@ -210,7 +210,7 @@ int load_map(char *filename)
level_fname=(char *)getmem(strlen(filename)+1); level_fname=(char *)getmem(strlen(filename)+1);
strcpy(level_fname,filename); strcpy(level_fname,filename);
SEND_LOG("(GAME) Loading map: '%s'",level_fname); SEND_LOG("(GAME) Loading map: '%s'",level_fname);
strupr(level_fname); strupper(level_fname);
mob_template=NULL; mob_template=NULL;
mob_size=0; mob_size=0;
if (f==NULL) return -1; if (f==NULL) return -1;
@ -406,7 +406,7 @@ void leave_current_map()
destroy_fly_map(); destroy_fly_map();
p=letici_veci; p=letici_veci;
while (p!=NULL) {stop_fly(p,0);p=p->next;} while (p!=NULL) {stop_fly(p,0);p=p->next;}
calc_fly(); calc_fly(0);
save_map=1; save_map=1;
free(map_sides); free(map_sides);
free(map_sectors); free(map_sectors);
@ -560,7 +560,7 @@ TFLY *duplic_fly(TFLY *p)
return q; return q;
} }
void calc_fly() void calc_fly(THE_TIMER *t)
{ {
LETICI_VEC *p,*q; LETICI_VEC *p,*q;
short ss; short ss;
@ -1393,7 +1393,7 @@ void sector0(void)
} }
} }
static void tele_redraw() static void tele_redraw(THE_TIMER *_)
{ {
if (!running_anm) return; if (!running_anm) return;
redraw_scene(); redraw_scene();
@ -1442,7 +1442,7 @@ void postavy_teleport_effect(int sector,int dir,int postava,char effect)
if (zavora) return; if (zavora) return;
if (effect) if (effect)
{ {
void *c; void (*c)(void);
zavora=1; zavora=1;
c=wire_proc; c=wire_proc;
@ -1851,13 +1851,13 @@ void sleep_players(va_list args)
} }
void *game_keyboard(EVENT_MSG *msg,void **usr) void game_keyboard(EVENT_MSG *msg,void **usr)
{ {
int c; int c;
usr; usr;
if (pass_zavora) return NULL; if (pass_zavora) return ;
if (cur_mode==MD_END_GAME) return NULL; if (cur_mode==MD_END_GAME) return ;
if (msg->msg==E_KEYBOARD) if (msg->msg==E_KEYBOARD)
{ {
c=quit_request_as_escape(va_arg(msg->data, int)); c=quit_request_as_escape(va_arg(msg->data, int));
@ -1917,7 +1917,6 @@ void *game_keyboard(EVENT_MSG *msg,void **usr)
}*/ }*/
} }
} }
return &game_keyboard;
} }

View file

@ -28,7 +28,7 @@ char q_runsetup(char *parm)
char c[6]; char c[6];
strncpy(c,parm,6); strncpy(c,parm,6);
strupr(c); strupper(c);
return !strncmp(c,"/SETUP",6); return !strncmp(c,"/SETUP",6);
} }
@ -46,7 +46,7 @@ static void checkbox_animator(THE_TIMER *t)
static int effects[]={SND_GVOLUME,SND_MUSIC,SND_GFX,SND_TREBL,SND_BASS,SND_XBASS}; static int effects[]={SND_GVOLUME,SND_MUSIC,SND_GFX,SND_TREBL,SND_BASS,SND_XBASS};
static void do_setup_change() static void do_setup_change(void)
{ {
char c; char c;
@ -59,7 +59,7 @@ static void do_setup_change()
} }
} }
static void change_zoom() static void change_zoom(void)
{ {
int id=o_aktual->id; int id=o_aktual->id;
int i; int i;
@ -68,7 +68,7 @@ static void change_zoom()
zoom_speed((id-30)/10); zoom_speed((id-30)/10);
} }
static void change_turn() static void change_turn(void)
{ {
int id=o_aktual->id; int id=o_aktual->id;
int i; int i;
@ -77,7 +77,7 @@ static void change_turn()
turn_speed((id-60)/10); turn_speed((id-60)/10);
} }
static void unwire_setup(); static void unwire_setup(void);
static void setup_keyboard(EVENT_MSG *msg,void **_) static void setup_keyboard(EVENT_MSG *msg,void **_)
{ {
@ -91,7 +91,7 @@ static void setup_keyboard(EVENT_MSG *msg,void **_)
} }
} }
static void wire_setup() static void wire_setup(void)
{ {
unwire_proc(); unwire_proc();
unwire_proc=unwire_setup; unwire_proc=unwire_setup;
@ -101,7 +101,7 @@ static void wire_setup()
SEND_LOG("(GAME) Starting setup"); SEND_LOG("(GAME) Starting setup");
} }
static void unwire_setup() static void unwire_setup(void)
{ {
show_names=f_get_value(0,90) & 1; show_names=f_get_value(0,90) & 1;
enable_sort=f_get_value(0,100) & 1; enable_sort=f_get_value(0,100) & 1;
@ -200,7 +200,7 @@ void new_setup()
add_to_timer(TM_CHECKBOX,4,-1,checkbox_animator); add_to_timer(TM_CHECKBOX,4,-1,checkbox_animator);
} }
void game_setup_() void game_setup_(void)
{ {
wire_setup(); wire_setup();
new_setup(); new_setup();

View file

@ -524,13 +524,13 @@ void back_music(void)
puts("\x7"); puts("\x7");
} }
*/ */
void *timming(EVENT_MSG *msg,void **data) void timming(EVENT_MSG *msg,void **data)
{ {
THE_TIMER *p,*q; THE_TIMER *p,*q;
int i,j; int i,j;
data; data;
if (msg->msg==E_INIT) return &timming; if (msg->msg==E_INIT) return ;
*otevri_zavoru=1; *otevri_zavoru=1;
j=va_arg(msg->data,int); j=va_arg(msg->data,int);
for (i=0;i<j;i++) for (i=0;i<j;i++)
@ -582,7 +582,7 @@ void *timming(EVENT_MSG *msg,void **data)
q=p; q=p;
} }
} }
return NULL; return ;
} }
void delete_from_timer(int id) void delete_from_timer(int id)

View file

@ -11,7 +11,7 @@
#include <libs/strlite.h> #include <libs/strlite.h>
#include <string.h> #include <string.h>
#include <unistd.h>
#define PL_RANDOM 1 #define PL_RANDOM 1
#define PL_FORWARD 2 #define PL_FORWARD 2
#define PL_FIRST 3 #define PL_FIRST 3
@ -463,7 +463,7 @@ void create_playlist(char *playlist)
c=playlist; c=playlist;
while (*c && *c==32) c++; while (*c && *c==32) c++;
sscanf(c,"%s",mode); sscanf(c,"%s",mode);
strupr(mode); strupper(mode);
shift=1; shift=1;
if (!strcmp(mode,"RANDOM")) play_list_mode=PL_RANDOM; if (!strcmp(mode,"RANDOM")) play_list_mode=PL_RANDOM;
else if (!strcmp(mode,"FORWARD")) play_list_mode=PL_FORWARD; else if (!strcmp(mode,"FORWARD")) play_list_mode=PL_FORWARD;

View file

@ -114,10 +114,10 @@ void (*after_spell_wire)();
short *poradi=NULL; short *poradi=NULL;
short *prave_hraje; short *prave_hraje;
void wire_programming(); void wire_programming(void);
void unwire_programming(); void unwire_programming(void);
void wire_jadro_souboje(); void wire_jadro_souboje(void);
void unwire_jadro_souboje(); void unwire_jadro_souboje(void);
uint8_t sel_zivel=0; uint8_t sel_zivel=0;
static char prekvapeni=0; static char prekvapeni=0;
@ -443,7 +443,7 @@ void rozhodni_o_poradi()
*r++=0; *r++=0;
prave_hraje=poradi; prave_hraje=poradi;
} }
void hrat_souboj() void hrat_souboj(THE_TIMER *_)
{ {
static int counter=0; static int counter=0;
char cond=ms_last_event.y>378 && ms_last_event.x>510 && cur_mode!=MD_PRESUN; char cond=ms_last_event.y>378 && ms_last_event.x>510 && cur_mode!=MD_PRESUN;
@ -459,7 +459,7 @@ void hrat_souboj()
} }
showview(0,0,0,0); showview(0,0,0,0);
if (neco_v_pohybu==2) neco_v_pohybu=0; else neco_v_pohybu=2; if (neco_v_pohybu==2) neco_v_pohybu=0; else neco_v_pohybu=2;
calc_fly();mob_animuj(); calc_fly(NULL);mob_animuj();
if (d_action!=NULL) do_delay_actions(); if (d_action!=NULL) do_delay_actions();
} }
if (cond) ukaz_mysku(); if (cond) ukaz_mysku();
@ -768,8 +768,8 @@ void konec_presunu(EVENT_MSG *msg,void **unused)
} }
} }
void wire_presun_postavy(); void wire_presun_postavy(void);
void unwire_presun_postavy() void unwire_presun_postavy(void)
{ {
disable_click_map(); disable_click_map();
send_message(E_DONE,E_KEYBOARD,game_keyboard); send_message(E_DONE,E_KEYBOARD,game_keyboard);
@ -782,7 +782,7 @@ void unwire_presun_postavy()
hromadny_utek=0; hromadny_utek=0;
} }
void wire_presun_postavy() void wire_presun_postavy(void)
{ {
unwire_proc(); unwire_proc();
@ -1370,7 +1370,7 @@ void jadro_souboje(EVENT_MSG *msg,void **unused) //!!!! Jadro souboje
} }
} }
void wire_jadro_souboje() void wire_jadro_souboje(void)
{ {
int battlespeed=gamespeed-gamespeed*gamespeedbattle/5; int battlespeed=gamespeed-gamespeed*gamespeedbattle/5;
recalc_volumes(viewsector,viewdir); recalc_volumes(viewsector,viewdir);
@ -1383,7 +1383,7 @@ void wire_jadro_souboje()
pgm_help=10; pgm_help=10;
} }
void unwire_jadro_souboje() void unwire_jadro_souboje(void)
{ {
delete_from_timer(TM_SCENE); delete_from_timer(TM_SCENE);
send_message(E_DONE,E_IDLE,jadro_souboje); send_message(E_DONE,E_IDLE,jadro_souboje);
@ -1411,7 +1411,7 @@ void fill_rune(char *d,int i)
static void *runebar; static void *runebar;
static char *rune_name=NULL; static char *rune_name=NULL;
void display_rune_bar() void display_rune_bar(THE_TIMER *_)
{ {
short coords[][2]={{3,26},{32,26},{61,26},{90,26},{18,64},{47,64},{76,64}}; short coords[][2]={{3,26},{32,26},{61,26},{90,26},{18,64},{47,64},{76,64}};
char c; char c;
@ -1437,14 +1437,14 @@ void display_rune_bar()
void rune_bar_redrawing() void rune_bar_redrawing(THE_TIMER *_)
{ {
redraw_scene(); redraw_scene();
if (!norefresh && !cancel_render) if (!norefresh && !cancel_render)
{ {
schovej_mysku(); schovej_mysku();
program_draw(); program_draw();
display_rune_bar(); display_rune_bar(NULL);
ukaz_mysku(); ukaz_mysku();
showview(0,0,0,0); showview(0,0,0,0);
} }
@ -1471,9 +1471,9 @@ void display_power_bar_tm(THE_TIMER *tm)
display_power_bar(1); display_power_bar(1);
} }
void wire_select_rune(); void wire_select_rune(void);
void unwire_select_rune(); void unwire_select_rune(void);
void wire_select_power(); void wire_select_power(void);
char cancel_power(int id,int xa,int ya,int xr,int yr) char cancel_power(int id,int xa,int ya,int xr,int yr)
{ {
@ -1598,7 +1598,7 @@ char runes_mask(int id,int xa,int ya,int xr,int yr)
} }
if (cc<0) rune_name=NULL; if (cc<0) rune_name=NULL;
free(runebar);runebar=NULL; free(runebar);runebar=NULL;
display_rune_bar(); display_rune_bar(NULL);
return 1; return 1;
} }
@ -1614,7 +1614,7 @@ char cancel_runes(int id,int xa,int ya,int xr,int yr)
return 1; return 1;
} }
void unwire_select_rune() void unwire_select_rune(void)
{ {
wire_proc=wire_select_rune; wire_proc=wire_select_rune;
delete_from_timer(TM_DELAIER); delete_from_timer(TM_DELAIER);
@ -1623,7 +1623,7 @@ void unwire_select_rune()
free(runebar);runebar=NULL; free(runebar);runebar=NULL;
} }
void wire_select_rune() void wire_select_rune(void)
{ {
THUMAN *p; THUMAN *p;
HUM_ACTION *c; HUM_ACTION *c;
@ -1653,13 +1653,13 @@ void wire_select_rune_fly()
cancel_render=1; cancel_render=1;
} }
void unwire_select_power() void unwire_select_power(void)
{ {
rune_name=NULL; rune_name=NULL;
delete_from_timer(TM_DELAIER); delete_from_timer(TM_DELAIER);
} }
void wire_select_power() void wire_select_power(void)
{ {
THUMAN *p; THUMAN *p;
int i; int i;
@ -1727,7 +1727,7 @@ void program_draw()
} }
void souboje_redrawing() void souboje_redrawing(THE_TIMER *_)
{ {
if (neco_v_pohybu) calc_mobs(); if (neco_v_pohybu) calc_mobs();
calc_animations(); calc_animations();
@ -1926,7 +1926,7 @@ char mask_click(int id,int xa,int ya,int xr,int yr)
switch(d) switch(d)
{ {
case AC_RUN: postavy[select_player].utek=5+postavy[select_player].actions; case AC_RUN: postavy[select_player].utek=5+postavy[select_player].actions;
[[fallthrough]]; CASE_FALLTHROUGH;
case AC_ATTACK: case AC_ATTACK:
case AC_STAND: case AC_STAND:
case AC_ARMOR: case AC_ARMOR:
@ -2042,7 +2042,7 @@ void programming_keyboard(EVENT_MSG *msg,void **unused)
} }
void unwire_programming() void unwire_programming(void)
{ {
disable_click_map(); disable_click_map();
send_message(E_DONE,E_KEYBOARD,programming_keyboard); send_message(E_DONE,E_KEYBOARD,programming_keyboard);
@ -2053,7 +2053,7 @@ void unwire_programming()
void wire_programming() void wire_programming(void)
{ {
schovej_mysku(); schovej_mysku();
after_spell_wire=wire_programming; after_spell_wire=wire_programming;
@ -2080,7 +2080,7 @@ void wait_to_stop(EVENT_MSG *msg,void **unused)
unwire_proc(); unwire_proc();
calc_mobs(); calc_mobs();
mouse_set_default(H_MS_DEFAULT); mouse_set_default(H_MS_DEFAULT);
refresh_scene(); refresh_scene(0);
cancel_render=1; cancel_render=1;
if (prekvapeni) zahajit_kolo(1);else wire_programming(); if (prekvapeni) zahajit_kolo(1);else wire_programming();
msg->msg=-2; msg->msg=-2;

View file

@ -44,7 +44,6 @@ void temp_storage_store(const char *name, const void *data, int32_t size) {
v[size] = 0; v[size] = 0;
v.resize(size); v.resize(size);
std::copy(b,e, v.begin()); std::copy(b,e, v.begin());
v[size] = 0;
} }
int32_t temp_storage_find(const char *name) { int32_t temp_storage_find(const char *name) {

View file

@ -27,6 +27,10 @@ void temp_storage_write(const void *data, uint32_t size, TMPFILE_WR *f);
uint32_t temp_storage_read(void *data, uint32_t size, TMPFILE_RD *f); uint32_t temp_storage_read(void *data, uint32_t size, TMPFILE_RD *f);
void temp_storage_skip(TMPFILE_RD *f, int bytes); void temp_storage_skip(TMPFILE_RD *f, int bytes);
#ifdef _MSC_VER
#define __attribute__(__VA_ARG__)
#endif
int *temp_storage_internal_skip_ptr(TMPFILE_RD *f); int *temp_storage_internal_skip_ptr(TMPFILE_RD *f);
int temp_storage_internal_begin_scanf(TMPFILE_RD *f, const char *format, ... ) __attribute__((format(scanf, 2, 3))); int temp_storage_internal_begin_scanf(TMPFILE_RD *f, const char *format, ... ) __attribute__((format(scanf, 2, 3)));
int temp_storage_internal_end_scanf(TMPFILE_RD *f, int r); int temp_storage_internal_end_scanf(TMPFILE_RD *f, int r);

View file

@ -217,7 +217,7 @@ static char purge_map()
_dos_findclose(&rc);*/ _dos_findclose(&rc);*/
wzprintf("\r\n Zadej jmeno tempu (all - vse):");gets(buffer); wzprintf("\r\n Zadej jmeno tempu (all - vse):");gets(buffer);
if (buffer[0]==0) return 0; if (buffer[0]==0) return 0;
strupr(buffer); strupper(buffer);
concat(c,pathtable[SR_TEMP],buffer); concat(c,pathtable[SR_TEMP],buffer);
if (strcmp(buffer,ALL) && check_file_exists_ex(c)) if (strcmp(buffer,ALL) && check_file_exists_ex(c))
{ {

View file

@ -1 +0,0 @@
test

View file

@ -956,7 +956,7 @@ static void start_install()
char error=0,autostart; char error=0,autostart;
get_value(0,60,target_path); get_value(0,60,target_path);
if (find_object(waktual,70)!=NULL) autostart=f_get_value(0,70); else autostart=1; if (find_object(waktual,70)!=NULL) autostart=f_get_value(0,70); else autostart=1;
strupr(target_path); strupper(target_path);
if (validate_path(target_path)==0) if (validate_path(target_path)==0)
{ {
msg_box("Incorrect path",'\x1',"The path is incorrect. Don't use long filenames!","OK",NULL); msg_box("Incorrect path",'\x1',"The path is incorrect. Don't use long filenames!","OK",NULL);

View file

@ -200,7 +200,7 @@ long check_size(int gr)
for(i=0;i<pocet;i++) if (script[i]!=NULL) for(i=0;i<pocet;i++) if (script[i]!=NULL)
{ {
if (sscanf(script[i],"%d %s %s",&group,prikaz,work_buff)<1) group=gr+1; if (sscanf(script[i],"%d %s %s",&group,prikaz,work_buff)<1) group=gr+1;
strupr(prikaz); strupper(prikaz);
if (!strcmp(prikaz,COPY) && group==gr) if (!strcmp(prikaz,COPY) && group==gr)
{ {
struct find_t ft; struct find_t ft;
@ -494,7 +494,7 @@ char cascade_delete(char ignore_sav)
if (c!=NULL) if (c!=NULL)
{ {
strupr(c); strupper(c);
if (!ignore_sav || strncmp(c,".SAV",4)) remove(f.name); if (!ignore_sav || strncmp(c,".SAV",4)) remove(f.name);
} }
else remove(f.name); else remove(f.name);

View file

@ -21,3 +21,4 @@ SET(files basicobj.c
add_library(skeldal_libs ${files}) add_library(skeldal_libs ${files})
set_property(TARGET skeldal_libs PROPERTY CXX_STANDARD 20)

View file

@ -1,5 +1,6 @@
#pragma once #pragma once
#include <iterator> #include <iterator>
#include <string_view>
class base64_t { class base64_t {

View file

@ -241,16 +241,16 @@ void draw_status_line(char *c)
showview(0,y-2,SCR_WIDTH_X-1,ysize+5); showview(0,y-2,SCR_WIDTH_X-1,ysize+5);
} }
void *status_mem_info(EVENT_MSG *msg) void status_mem_info(EVENT_MSG *msg)
{ {
return NULL;
} }
void *status_idle(EVENT_MSG *msg) void status_idle(EVENT_MSG *msg)
{ {
if (msg->msg==E_INIT) return &status_idle; if (msg->msg==E_INIT) return;
send_message(E_STATUS_LINE,msg->msg); send_message(E_STATUS_LINE,msg->msg);
return NULL; return;
} }
static int enter_event_msg_to(EVENT_MSG *msg, void *ctx) { static int enter_event_msg_to(EVENT_MSG *msg, void *ctx) {
@ -299,29 +299,29 @@ void status_line(EVENT_MSG *msg, T_EVENT_ROOT **user_data) {
return; return;
} }
void *mouse_xy(EVENT_MSG *msg) void mouse_xy(EVENT_MSG *msg)
{ {
char **c = va_arg(msg->data, char **); char **c = va_arg(msg->data, char **);
if (msg->msg==E_INIT) return &mouse_xy; if (msg->msg==E_INIT) return;
sprintf(*c," X: %d Y: %d",ms_last_event.x,ms_last_event.y); sprintf(*c," X: %d Y: %d",ms_last_event.x,ms_last_event.y);
*c=strchr(*c,'\0'); *c=strchr(*c,'\0');
return NULL; return ;
} }
void *show_time(EVENT_MSG *msg) void show_time(EVENT_MSG *msg)
{ {
char **c = va_arg(msg->data, char **); char **c = va_arg(msg->data, char **);
time_t t; time_t t;
struct tm cas; struct tm cas;
if (msg->msg==E_INIT) return &show_time; if (msg->msg==E_INIT) return;
t=time(NULL); t=time(NULL);
cas=*localtime(&t); cas=*localtime(&t);
sprintf(*c,"%02d:%02d:%02d ",cas.tm_hour,cas.tm_min,cas.tm_sec); sprintf(*c,"%02d:%02d:%02d ",cas.tm_hour,cas.tm_min,cas.tm_sec);
*c=strchr(*c,'\0'); *c=strchr(*c,'\0');
return NULL; return ;
} }
//------------------------------------------ //------------------------------------------
@ -684,7 +684,7 @@ void input_line_init(OBJREC *o,va_list len)
void input_line_draw(int x1,int y1, int x2, int y2, OBJREC *o) void input_line_draw(int x1,int y1, int x2, int y2, OBJREC *o)
{ {
char d[2]=" \0"; char d[2]=" ";
int x; int x;
char *c; char *c;
int len; int len;

View file

@ -13,9 +13,9 @@ void xor_rectangle(int x,int y,int xs,int ys);
// status lines // status lines
void status_line(EVENT_MSG *msg,T_EVENT_ROOT **user_data); void status_line(EVENT_MSG *msg,T_EVENT_ROOT **user_data);
void *status_mem_info(EVENT_MSG *msg); void status_mem_info(EVENT_MSG *msg);
void *mouse_xy(EVENT_MSG *msg); void mouse_xy(EVENT_MSG *msg);
void *show_time(EVENT_MSG *msg); void show_time(EVENT_MSG *msg);
// objects // objects
//void sample(OBJREC *o); //void sample(OBJREC *o);

View file

@ -293,9 +293,11 @@ void deinstall_event(T_EVENT_ROOT **tree,int32_t ev_num,EV_PROC proc,void *procd
if (!p->calls) force_delete_curr(tree,r,p); if (!p->calls) force_delete_curr(tree,r,p);
} }
typedef void (*initproc)();
void tree_basics(T_EVENT_ROOT **ev_tree,EVENT_MSG *msg) void tree_basics(T_EVENT_ROOT **ev_tree,EVENT_MSG *msg)
{ {
void (*q)(); initproc q;
if (msg->msg==E_ADD || msg->msg==E_ADDEND) if (msg->msg==E_ADD || msg->msg==E_ADDEND)
{ {
@ -308,9 +310,10 @@ void tree_basics(T_EVENT_ROOT **ev_tree,EVENT_MSG *msg)
install_event(ev_tree,msg,proc,msg->msg==E_ADDEND); install_event(ev_tree,msg,proc,msg->msg==E_ADDEND);
return; return;
} }
if (msg->msg==E_INIT) if (msg->msg==E_INIT)
{ {
q = va_arg(msg->data, void (*)()); q = va_arg(msg->data, initproc);
q(); q();
return; return;
} }

View file

@ -16,7 +16,7 @@ main(int argc,char **argv)
if (argc==3) help(); if (argc==3) help();
init_manager(argv[1],NULL); init_manager(argv[1],NULL);
z=afile(strupr(argv[2]),read_group(0),&s); z=afile(strupper(argv[2]),read_group(0),&s);
if (z==NULL) if (z==NULL)
{ {
puts("File not found"); puts("File not found");

View file

@ -26,7 +26,7 @@ word desktop_y_size;
char force_redraw_desktop=0; char force_redraw_desktop=0;
static char change_flag=0,f_cancel_event=0; static char change_flag=0,f_cancel_event=0;
const word *default_font; const word *default_font;
void empty() void empty(void)
{ {
} }
@ -339,7 +339,7 @@ void define(int id,int x,int y,int xs,int ys,char align,void (*initproc)(OBJREC
o->call_done=empty1; o->call_done=empty1;
o->autoresizex=0; o->autoresizex=0;
o->autoresizey=0; o->autoresizey=0;
o->on_event=empty; o->on_event=empty3;
o->on_enter=empty; o->on_enter=empty;
o->on_exit=empty; o->on_exit=empty;
o->on_change=empty; o->on_change=empty;
@ -767,16 +767,16 @@ void uninstall_gui(void)
//send_message(E_GUI,cislo,E_UDALOST,data....) //send_message(E_GUI,cislo,E_UDALOST,data....)
void on_control_change(void (*proc)()) void on_control_change(void (*proc)(void))
{ {
o_end->on_change=proc; o_end->on_change=proc;
} }
void on_control_enter(void (*proc)()) void on_control_enter(void (*proc)(void))
{ {
o_end->on_enter=proc; o_end->on_enter=proc;
} }
void on_control_exit(void (*proc)()) void on_control_exit(void (*proc)(void))
{ {
o_end->on_exit=proc; o_end->on_exit=proc;
} }
@ -920,28 +920,29 @@ void close_current()
close_window(waktual); close_window(waktual);
} }
typedef void (*PROG)(void);
void background_runner(EVENT_MSG *msg,void **prog) void background_runner(EVENT_MSG *msg,void **prog)
{ {
void (*p)(); PROG *prog_ptr = (PROG *)(prog);
if (msg->msg==E_INIT) if (msg->msg==E_INIT)
{ {
*prog = va_arg(msg->data, void (*)()); *prog_ptr = va_arg(msg->data, PROG);
return; return;
} }
if (msg->msg==E_DONE) if (msg->msg==E_DONE)
{ {
*prog=NULL; *prog_ptr=NULL;
return; return;
} }
p=*prog; (*prog_ptr)();
p();
msg->msg=-2; msg->msg=-2;
} }
void run_background(void (*p)()) void run_background(PROG p)
{ {
send_message(E_ADD,E_IDLE,background_runner,p); send_message(E_ADD,E_IDLE,background_runner,p);
} }

View file

@ -10,7 +10,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <string.h> #include <string.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h>
#define DPMI_INT 0x31 #define DPMI_INT 0x31
#define LOAD_BUFFER 4096 #define LOAD_BUFFER 4096
@ -42,7 +42,7 @@ void standard_mem_error(size_t size)
{ {
char buff[256]; char buff[256];
SEND_LOG("(ERROR) Memory allocation error detected, %lu bytes missing",size); SEND_LOG("(ERROR) Memory allocation error detected, %lu bytes missing",size);
sprintf(buff,"Memory allocation error\n Application can't allocate %lu bytes of memory (%xh)\n",size,memman_handle); sprintf(buff,"Memory allocation error\n Application can't allocate %lu bytes of memory (%xh)\n",(unsigned long)size,memman_handle);
display_error(buff); display_error(buff);
exit(1); exit(1);
} }
@ -271,7 +271,7 @@ THANDLE_DATA *zneplatnit_block(int handle)
return h; return h;
} }
static void heap_error() { static void heap_error(size_t s) {
display_error("out of memory"); display_error("out of memory");
abort(); abort();
} }
@ -315,7 +315,7 @@ void *load_swaped_block(THANDLE_DATA *h)
} }
int find_same(const char *name,void *decomp) int find_same(const char *name,ABLOCK_DECODEPROC decomp)
{ {
THANDLE_DATA *p; THANDLE_DATA *p;
int i,j; int i,j;
@ -332,7 +332,7 @@ int find_same(const char *name,void *decomp)
return -1; return -1;
} }
int find_handle(const char *name,void *decomp) int find_handle(const char *name,ABLOCK_DECODEPROC decomp)
{ {
return find_same(name,decomp); return find_same(name,decomp);
} }
@ -364,7 +364,7 @@ THANDLE_DATA *def_handle(int handle,const char *filename,ABLOCK_DECODEPROC decom
} }
memcpy(h->src_file,filename,12); memcpy(h->src_file,filename,12);
h->seekpos=0; h->seekpos=0;
strupr(h->src_file); strupper(h->src_file);
h->loadproc=decompress; h->loadproc=decompress;
if (filename[0]) if (filename[0])
h->seekpos=get_file_entry(path,h->src_file); h->seekpos=get_file_entry(path,h->src_file);
@ -385,7 +385,7 @@ const void *afile(char *filename,int group,int32_t *blocksize)
d=alloca(strlen(filename)+1); d=alloca(strlen(filename)+1);
strcpy(d,filename); strcpy(d,filename);
strupr(d); strupper(d);
if (mman_patch && test_file_exist_DOS(group,d)) entr=0; if (mman_patch && test_file_exist_DOS(group,d)) entr=0;
else entr=get_file_entry(group,d); else entr=get_file_entry(group,d);
if (entr!=0) if (entr!=0)
@ -669,7 +669,7 @@ void display_status()
if (h->src_file[0]) strncpy(nname,h->src_file,12);else strcpy(nname,"<local>"); 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,(uintptr_t)h->blockdata,h->size,h->counter,h->lockcount); copys,(unsigned long)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;

View file

@ -96,7 +96,7 @@ void close_manager(void); //uzavre manager a uvolni veskerou pam
void undef_handle(int handle); //uvolni hadle k dalsimu pouziti void undef_handle(int handle); //uvolni hadle k dalsimu pouziti
THANDLE_DATA *zneplatnit_block(int handle); //zneplatni data bloku THANDLE_DATA *zneplatnit_block(int handle); //zneplatni data bloku
THANDLE_DATA *get_handle(int handle); //vraci informace o rukojeti THANDLE_DATA *get_handle(int handle); //vraci informace o rukojeti
int find_handle(const char *name,void *decomp); //hleda mezi rukojeti stejnou definici int find_handle(const char *name,ABLOCK_DECODEPROC decomp); //hleda mezi rukojeti stejnou definici
int test_file_exist(int group,char *filename); //testuje zda soubor existuje v ramci mmanageru int test_file_exist(int group,char *filename); //testuje zda soubor existuje v ramci mmanageru
const void *afile(char *filename,int group,int32_t *blocksize); //nahraje do pameti soubor registrovany v ramci mmanageru const void *afile(char *filename,int group,int32_t *blocksize); //nahraje do pameti soubor registrovany v ramci mmanageru
void *afile_copy(char *filename,int group,int32_t *blocksize); //nahraje do pameti soubor registrovany v ramci mmanageru void *afile_copy(char *filename,int group,int32_t *blocksize); //nahraje do pameti soubor registrovany v ramci mmanageru

View file

@ -335,7 +335,7 @@ static void done_mgif_player()
free(f); free(f);
free(temp); free(temp);
mix_back_sound(3); mix_back_sound(3);
change_music("?"); change_music(NULL);
} }
static void init_load_buffer(int size) static void init_load_buffer(int size)

View file

@ -1,3 +1,5 @@
#include <string_view>
#include "music.h" #include "music.h"
#include <platform/platform.h> #include <platform/platform.h>

View file

@ -5,7 +5,9 @@
extern "C" { extern "C" {
#endif #endif
typedef struct music_stream_t {} TMUSIC_STREAM; typedef struct music_stream_t {
char dummy;
} TMUSIC_STREAM;
typedef struct music_stream_info_t { typedef struct music_stream_info_t {
int freq; int freq;

View file

@ -1,6 +1,9 @@
#ifndef _WAV_H #ifndef _WAV_H
#define _WAV_H #define _WAV_H
#include <stdint.h>
#define WAV_RIFF "RIFF" #define WAV_RIFF "RIFF"
#define WAV_WAVE "WAVE" #define WAV_WAVE "WAVE"
#define WAV_FMT "fmt " #define WAV_FMT "fmt "

View file

@ -1,10 +0,0 @@
// mapedit.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
int main(int argc, char* argv[])
{
return 0;
}

View file

@ -1,852 +0,0 @@
<?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="mapedit"
SccProjectName="&quot;$/Skeldal&quot;, RYCAAAAA"
SccAuxPath=""
SccLocalPath="."
SccProvider="MSSCCI:Microsoft Visual SourceSafe">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\mapedit_Debug"
IntermediateDirectory=".\mapedit_Debug"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".\,LIBS\,WINDOWS\"
PreprocessorDefinitions="_DEBUG;WIN32;_CONSOLE;_WIN32_WINNT=0x400"
BasicRuntimeChecks="3"
RuntimeLibrary="5"
StructMemberAlignment="1"
DefaultCharIsUnsigned="TRUE"
UsePrecompiledHeader="3"
PrecompiledHeaderThrough="skeldal_win.h"
PrecompiledHeaderFile=".\mapedit_Debug/mapedit.pch"
AssemblerListingLocation=".\mapedit_Debug/"
ObjectFile=".\mapedit_Debug/"
ProgramDataBaseFileName=".\mapedit_Debug/"
BrowseInformation="1"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="d3d9.lib comctl32.lib dsound.lib"
OutputFile=".\mapedit_Debug/mapedit.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\mapedit_Debug/mapedit.pdb"
SubSystem="1"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\mapedit_Debug/mapedit.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1029"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory=".\mapedit_Release"
IntermediateDirectory=".\mapedit_Release"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories=".\,LIBS\,WINDOWS\"
PreprocessorDefinitions="NDEBUG;WIN32;_CONSOLE;_WIN32_WINNT=0x400"
StringPooling="TRUE"
RuntimeLibrary="4"
StructMemberAlignment="1"
EnableFunctionLevelLinking="TRUE"
DefaultCharIsUnsigned="TRUE"
UsePrecompiledHeader="3"
PrecompiledHeaderThrough="skeldal_win.h"
PrecompiledHeaderFile=".\mapedit_Release/mapedit.pch"
AssemblerListingLocation=".\mapedit_Release/"
ObjectFile=".\mapedit_Release/"
ProgramDataBaseFileName=".\mapedit_Release/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="3"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="d3d9.lib comctl32.lib dsound.lib"
OutputFile=".\mapedit_Release/mapedit.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\mapedit_Release/mapedit.pdb"
SubSystem="1"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\mapedit_Release/mapedit.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1029"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath="LIBS\BASICOBJ.C">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="LIBS\BGRAPH2.C">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="LIBS\bgraph2a.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="Windows\BGraph2Dx.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
UsePrecompiledHeader="0"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
UsePrecompiledHeader="0"/>
</FileConfiguration>
</File>
<File
RelativePath="LIBS\BMOUSE.C">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="mapedit\cztable.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
UsePrecompiledHeader="0"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
UsePrecompiledHeader="0"/>
</FileConfiguration>
</File>
<File
RelativePath="LIBS\DEVICES.C">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="GAME\DUMP.C">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="MAPS\EDIT_MAP.C">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="mapedit\editor.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
UsePrecompiledHeader="0"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
UsePrecompiledHeader="0"/>
</FileConfiguration>
</File>
<File
RelativePath="LIBS\EVENT.C">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="Windows\FCS_Tasker.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="LIBS\GUI.C">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="MAPS\ITEMS2.C">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="MAPS\MAPEDIT.C">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="mapedit\mapedit.rc">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions=""
AdditionalIncludeDirectories="mapedit"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions=""
AdditionalIncludeDirectories="mapedit"/>
</FileConfiguration>
</File>
<File
RelativePath="MAPS\MAPY.C">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="LIBS\MEMMAN.C">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="MAPS\MOB_EDIT.C">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="PCX\PCX.C">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="MAPS\PCXVIEW.C">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="MAPS\SAVE_MAP.C">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="Windows\skeldal_win.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
UsePrecompiledHeader="1"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
UsePrecompiledHeader="1"/>
</FileConfiguration>
</File>
<File
RelativePath="MAPS\STENY.C">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="LIBS\STRLISTS.C">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="LIBS\WAV.C">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="MAPS\WIZ_TOOL.C">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="LIBS\zvuk_dx.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
UsePrecompiledHeader="0"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
UsePrecompiledHeader="0"/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl">
<File
RelativePath="LIBS\BASICOBJ.H">
</File>
<File
RelativePath="LIBS\BGRAPH.H">
</File>
<File
RelativePath="Windows\BGraph2Dx.h">
</File>
<File
RelativePath="Windows\bios.h">
</File>
<File
RelativePath="LIBS\BMOUSE.H">
</File>
<File
RelativePath="mapedit\cztable.h">
</File>
<File
RelativePath="LIBS\DEVICES.H">
</File>
<File
RelativePath="MAPS\DUMP.H">
</File>
<File
RelativePath="MAPS\EDIT_MAP.H">
</File>
<File
RelativePath="mapedit\editor.h">
</File>
<File
RelativePath="LIBS\EVENT.H">
</File>
<File
RelativePath="Windows\FCS_Tasker.h">
</File>
<File
RelativePath="MAPS\GLOBALS.H">
</File>
<File
RelativePath="LIBS\GUI.H">
</File>
<File
RelativePath="MAPS\MAPY.H">
</File>
<File
RelativePath="LIBS\MEMMAN.H">
</File>
<File
RelativePath="MAPS\MOB_EDIT.H">
</File>
<File
RelativePath="PCX\PCX.H">
</File>
<File
RelativePath="MAPS\SAVE_MAP.H">
</File>
<File
RelativePath="StdAfx.h">
</File>
<File
RelativePath="MAPS\STENY.H">
</File>
<File
RelativePath="LIBS\STRLISTS.H">
</File>
<File
RelativePath="LIBS\WAV.H">
</File>
<File
RelativePath="MAPS\WIZ_TOOL.H">
</File>
<File
RelativePath="LIBS\ZVUK.H">
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
</Filter>
<File
RelativePath="mapedit\BOLDCZ.FON">
</File>
<File
RelativePath="mapedit\ikony.fon">
</File>
<File
RelativePath="FONT\ikony.fon">
</File>
<File
RelativePath="mapedit\MAPEDIT.HI">
</File>
<File
RelativePath="ReadMe.txt">
</File>
<File
RelativePath="mapedit\SIPKA.HI">
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -19,6 +19,10 @@ target_sources(skeldal_platform PRIVATE
if(WIN32) if(WIN32)
target_sources(skeldal_platform PRIVATE target_sources(skeldal_platform PRIVATE
windows/save_folder.cpp windows/save_folder.cpp
windows/map_file.cpp
)
target_sources(skeldal PRIVATE
windows/app_start.cpp
) )
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")
@ -57,4 +61,5 @@ target_link_libraries(skeldal
skeldal_platform skeldal_platform
skeldal_sdl skeldal_sdl
skeldal_libs skeldal_libs
${SDL2_LIBRARIES} pthread) ${SDL2_LIBRARIES}
${STANDARD_LIBRARIES})

View file

@ -121,15 +121,15 @@ double ini_get_value_double(const char *value, int *conv_ok) {
int ini_get_value_boolean(const char *value) { int ini_get_value_boolean(const char *value) {
int r = -1; int r = -1;
if (value != NULL) { if (value != NULL) {
if (stricmp(value, "true") == 0 if (istrcmp(value, "true") == 0
|| stricmp(value, "1") == 0 || istrcmp(value, "1") == 0
|| stricmp(value, "on") == 0 || istrcmp(value, "on") == 0
|| stricmp(value, "yes") == 0) { || istrcmp(value, "yes") == 0) {
r = 1; r = 1;
} else if (stricmp(value, "false") == 0 } else if (istrcmp(value, "false") == 0
|| stricmp(value, "0") == 0 || istrcmp(value, "0") == 0
|| stricmp(value, "off") == 0 || istrcmp(value, "off") == 0
|| stricmp(value, "no") == 0) { || istrcmp(value, "no") == 0) {
r = 0; r = 0;
} else { } else {
r = -1; r = -1;

View file

@ -1,5 +1,6 @@
#include "platform.h" #include "platform.h"
#include <string.h>
#include <wchar.h>
#include <cstdarg> #include <cstdarg>
#include <filesystem> #include <filesystem>
#include "../libs/logfile.h" #include "../libs/logfile.h"
@ -8,11 +9,15 @@
std::filesystem::path break_and_compose_path(const std::string_view &pathname, char sep) { std::filesystem::path break_and_compose_path(const std::string_view &pathname, char sep) {
auto p = pathname.rfind(sep); auto p = pathname.rfind(sep);
if (p == pathname.npos) { if (p == pathname.npos) {
if (pathname == "." || pathname == "..") return std::filesystem::canonical("."); if (pathname == "." || pathname == "..") {
else if (pathname.empty()) return std::filesystem::current_path().root_path(); return std::filesystem::canonical(".");
else if (pathname == std::filesystem::current_path().root_name()) } else if (pathname.empty()) {
return pathname; return std::filesystem::current_path().root_path();
else return std::filesystem::current_path()/pathname; } else if (pathname == std::filesystem::current_path().root_name()) {
return std::filesystem::current_path().root_path();
} else {
return std::filesystem::current_path()/pathname;
}
} }
return break_and_compose_path(pathname.substr(0,p), sep) / pathname.substr(p+1); return break_and_compose_path(pathname.substr(0,p), sep) / pathname.substr(p+1);
@ -44,7 +49,11 @@ std::filesystem::path try_to_find_file(const std::filesystem::path &p) {
while (iter != end) { while (iter != end) {
const std::filesystem::directory_entry &e = *iter; const std::filesystem::directory_entry &e = *iter;
auto fn = e.path().filename(); auto fn = e.path().filename();
if (stricmp(n.c_str(), fn.c_str()) == 0) { #ifdef _WIN32
if (_wcsicmp(n.c_str(), fn.c_str()) == 0) {
#else
if (istrcmp(n.c_str(), fn.c_str()) == 0) {
#endif
return e.path(); return e.path();
} }
++iter; ++iter;
@ -65,13 +74,13 @@ char check_file_exists(const char *pathname) {
const char *file_icase_find(const char *pathname) { const char *file_icase_find(const char *pathname) {
static std::string p; static std::string p;
std::filesystem::path path = try_to_find_file(convert_pathname_to_path(pathname)); std::filesystem::path path = try_to_find_file(convert_pathname_to_path(pathname));
p = path; p = path.string();
return p.c_str(); return p.c_str();
} }
FILE *fopen_icase(const char *pathname, const char *mode) { FILE *fopen_icase(const char *pathname, const char *mode) {
std::filesystem::path path = try_to_find_file(convert_pathname_to_path(pathname)); std::filesystem::path path = try_to_find_file(convert_pathname_to_path(pathname));
return fopen(path.c_str(), mode); return fopen(path.string().c_str(), mode);
} }
static thread_local std::string build_pathname_buffer; static thread_local std::string build_pathname_buffer;
@ -86,7 +95,7 @@ const char * build_pathname(size_t nparts, const char *part1, ...) {
for (size_t i = 1; i < nparts; ++i) { for (size_t i = 1; i < nparts; ++i) {
p = p / va_arg(lst, const char *); p = p / va_arg(lst, const char *);
} }
build_pathname_buffer = p; build_pathname_buffer = p.string();
SEND_LOG("(BUILD_PATHNAME) %s", build_pathname_buffer.c_str()); SEND_LOG("(BUILD_PATHNAME) %s", build_pathname_buffer.c_str());
return build_pathname_buffer.c_str(); return build_pathname_buffer.c_str();
} }
@ -112,8 +121,13 @@ int list_files(const char *directory, int type, LIST_FILES_CALLBACK cb, void *ct
int r = 0; int r = 0;
const auto &entry = *iter; const auto &entry = *iter;
const char *name; const char *name;
if (type & file_type_just_name) name = entry.path().filename().c_str(); std::string tmp;
else name = entry.path().filename().c_str(); if (type & file_type_just_name) {
tmp = entry.path().filename().string();
} else {
tmp = entry.path().string();
}
name = tmp.c_str();
if (entry.is_regular_file(ec) && (type & file_type_normal)) { if (entry.is_regular_file(ec) && (type & file_type_normal)) {
r = cb(name, file_type_normal, entry.file_size(ec), ctx); r = cb(name, file_type_normal, entry.file_size(ec), ctx);
} else if (entry.is_directory(ec)) { } else if (entry.is_directory(ec)) {

View file

@ -1,7 +1,7 @@
#include "platform.h" #include "platform.h"
#include <ctype.h> #include <ctype.h>
int stricmp(const char *a, const char *b) { int istrcmp(const char *a, const char *b) {
while (*a && *b) { while (*a && *b) {
char ca = toupper(*a); char ca = toupper(*a);
char cb = toupper(*b); char cb = toupper(*b);
@ -15,7 +15,7 @@ int stricmp(const char *a, const char *b) {
return 0; return 0;
} }
void strupr(char *c) { void strupper(char *c) {
while (*c) { while (*c) {
*c = toupper(*c); *c = toupper(*c);
++c; ++c;

View file

@ -7,6 +7,18 @@
#define BGSWITCHBIT 0x8000 #define BGSWITCHBIT 0x8000
#ifdef _MSC_VER
#pragma warning(disable: 4244)
#pragma warning(disable: 4996)
#pragma warning(disable: 4459)
#pragma warning(disable: 4267)
#pragma warning(disable: 4100)
#pragma warning(disable: 4456)
#define CASE_FALLTHROUGH
#else
#define CASE_FALLTHROUGH [[fallthrough]]
#endif
#define SKELDALINI "skeldal.ini" #define SKELDALINI "skeldal.ini"
@ -72,11 +84,11 @@ char check_file_exists(const char *pathname);
FILE *fopen_icase(const char *pathname, const char *mode); FILE *fopen_icase(const char *pathname, const char *mode);
const char *file_icase_find(const char *pathname); const char *file_icase_find(const char *pathname);
int stricmp(const char *a, const char *b); int istrcmp(const char *a, const char *b);
int imatch(const char *haystack, const char *needle); int imatch(const char *haystack, const char *needle);
#define MIN(a, b) ((a)<(b)?(a):(b)) #define MIN(a, b) ((a)<(b)?(a):(b))
#define MAX(a, b) ((a)>(b)?(a):(b)) #define MAX(a, b) ((a)>(b)?(a):(b))
void strupr(char *c); void strupper(char *c);
const char * int2ascii(int i, char *c, int radix); const char * int2ascii(int i, char *c, int radix);
int get_timer_value(void); int get_timer_value(void);

View file

@ -4,7 +4,7 @@
extern "C" { extern "C" {
#endif #endif
#define SAVEGAME_FOLDERNAME "Skeldal"; #define SAVEGAME_FOLDERNAME "Skeldal"
const char *get_default_savegame_directory(void); const char *get_default_savegame_directory(void);

View file

@ -21,9 +21,9 @@ char game_display_init(const INI_CONFIG_SECTION *display_section, const char *ti
} }
cfg.fullscreen = ini_get_boolean(display_section, "fullscreen", 1) == 1; cfg.fullscreen = ini_get_boolean(display_section, "fullscreen", 1) == 1;
const char *comp = ini_get_string(display_section, "composer", "auto"); const char *comp = ini_get_string(display_section, "composer", "auto");
if (stricmp(comp, "hardware") == 0 || stricmp(comp, "hw") == 0) { if (istrcmp(comp, "hardware") == 0 || istrcmp(comp, "hw") == 0) {
cfg.composer = SDL_RENDERER_ACCELERATED; cfg.composer = SDL_RENDERER_ACCELERATED;
} else if (stricmp(comp, "software") == 0 || stricmp(comp, "sw") == 0) { } else if (istrcmp(comp, "software") == 0 || istrcmp(comp, "sw") == 0) {
cfg.composer = SDL_RENDERER_SOFTWARE; cfg.composer = SDL_RENDERER_SOFTWARE;
} else { } else {
cfg.composer = 0; cfg.composer = 0;
@ -33,11 +33,11 @@ char game_display_init(const INI_CONFIG_SECTION *display_section, const char *ti
cfg.window_width = ini_get_int(display_section, "window_width", 640); cfg.window_width = ini_get_int(display_section, "window_width", 640);
const char *filter = ini_get_string(display_section, "crt_filter", "auto"); const char *filter = ini_get_string(display_section, "crt_filter", "auto");
if (stricmp(filter,"none") == 0) cfg.crt_filter = SDLContext::CrtFilterType::none; if (istrcmp(filter,"none") == 0) cfg.crt_filter = SDLContext::CrtFilterType::none;
else if (stricmp(filter,"scanlines") == 0) cfg.crt_filter = SDLContext::CrtFilterType::scanlines; else if (istrcmp(filter,"scanlines") == 0) cfg.crt_filter = SDLContext::CrtFilterType::scanlines;
else if (stricmp(filter,"scanlines_2") == 0) cfg.crt_filter = SDLContext::CrtFilterType::scanlines_2; else if (istrcmp(filter,"scanlines_2") == 0) cfg.crt_filter = SDLContext::CrtFilterType::scanlines_2;
else if (stricmp(filter,"rgbmatrix_2") == 0) cfg.crt_filter = SDLContext::CrtFilterType::rgb_matrix_2; else if (istrcmp(filter,"rgbmatrix_2") == 0) cfg.crt_filter = SDLContext::CrtFilterType::rgb_matrix_2;
else if (stricmp(filter,"rgbmatrix_3") == 0) cfg.crt_filter = SDLContext::CrtFilterType::rgb_matrix_3; else if (istrcmp(filter,"rgbmatrix_3") == 0) cfg.crt_filter = SDLContext::CrtFilterType::rgb_matrix_3;
else cfg.crt_filter = SDLContext::CrtFilterType::autoselect; else cfg.crt_filter = SDLContext::CrtFilterType::autoselect;

View file

@ -1,4 +1,4 @@
add_subdirectory(tests) #add_subdirectory(tests)
add_library(skeldal_sdl add_library(skeldal_sdl
sdl_context.cpp sdl_context.cpp

View file

@ -184,7 +184,7 @@ void SDLContext::init_video(const VideoConfig &config, const char *title) {
SDL_RendererInfo rinfo; SDL_RendererInfo rinfo;
SDL_GetRendererInfo(renderer, &rinfo); SDL_GetRendererInfo(renderer, &rinfo);
if (stricmp(config.scale_quality, "auto") == 0) { if (istrcmp(config.scale_quality, "auto") == 0) {
if (rinfo.flags & SDL_RENDERER_ACCELERATED) { if (rinfo.flags & SDL_RENDERER_ACCELERATED) {
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "best"); SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "best");
} }

View file

@ -2,8 +2,9 @@
#include <memory> #include <memory>
#include <optional> #include <optional>
#include <SDL2/SDL.h> #include <SDL.h>
#include <thread> #include <thread>
#include <mutex>
#include <vector> #include <vector>
#include <libs/mouse.h> #include <libs/mouse.h>
#include <functional> #include <functional>

View file

@ -7,7 +7,7 @@
#include <cstring> #include <cstring>
#include <iostream> #include <iostream>
#include <array>
#include <thread> #include <thread>
#define countof(array) (sizeof(array)/sizeof(array[0])) #define countof(array) (sizeof(array)/sizeof(array[0]))
@ -96,7 +96,7 @@ void set_channel_volume(int channel,int left,int right) {
vp.left = l; vp.left = l;
vp.right = r; vp.right = r;
sound_mixer.visit_track(channel, [&](WaveMixer<2> &mx){ sound_mixer.visit_track(channel, [&](WaveMixer<2> &mx){
mx.set_channel_volumes_fade(make_channel_volume(vp.left, vp.right), {2e-4,2e-4}); mx.set_channel_volumes_fade(make_channel_volume(vp.left, vp.right), {2e-4f,2e-4f});
}); });
} }

View file

@ -0,0 +1,73 @@
#include "../../game/skeldal.h"
#include "../getopt.h"
#include "../platform.h"
#include <iostream>
#include <string>
void show_help(const char *arg0) {
printf(
"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"
"-a <adv> path for adventure file (.adv)\n"
"-l <lang> set language (cz|en)"
"-s <directory> generate string-tables (for localization) and exit\n"
"-h this help\n");
exit(0);
}
void show_help_short() {
printf("Use -h for help\n");
}
int main(int argc, char **argv) {
std::string config_name = SKELDALINI;
std::string adv_config_file;
std::string gen_stringtable_path;
std::string lang;
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 'l': lang = optarg;break;
case 's': gen_stringtable_path = optarg;break;
default: show_help_short();
return 1;
}
}
SKELDAL_CONFIG cfg;
cfg.short_help = show_help_short;
cfg.show_error = [](const char *txt) {
std::cerr << "ERROR: " << txt << std::endl;
};
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();
try {
if (!gen_stringtable_path.empty()) {
skeldal_gen_string_table_entry_point(&cfg, gen_stringtable_path.c_str());
return 0;
} else {
return skeldal_entry_point(&cfg);
}
} catch (const std::exception &e) {
std::cerr << "ERROR: " << e.what() << std::endl;
return 1;
}
return 0;
}

View file

@ -0,0 +1,55 @@
extern "C" {
#include "map_file.h"
}
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <stdexcept>
// Funkce pro mapování souboru do paměti
void* map_file_to_memory_cpp(const char *name, size_t *sz) {
if (!name || !sz) {
return NULL;
}
HANDLE h = CreateFileA(name, GENERIC_READ, FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
if (h == INVALID_HANDLE_VALUE) throw std::runtime_error(std::string("Failed to open file for mapping: ").append(name));
LARGE_INTEGER fsize;
if (!GetFileSizeEx(h, &fsize)) {
CloseHandle(h);
throw std::runtime_error(std::string("failed to get size of file:").append(name));
}
HANDLE hMapping = CreateFileMapping(h,NULL,PAGE_READONLY,0,0,NULL);
if (hMapping == NULL || hMapping == INVALID_HANDLE_VALUE) {
CloseHandle(h);
throw std::runtime_error(std::string("Failed to create mapping of file:").append(name));
}
void *mappedData = MapViewOfFile(hMapping,FILE_MAP_READ,0,0,0);
CloseHandle(h);
CloseHandle(hMapping);
if (mappedData == NULL) {
throw std::runtime_error(std::string("Failed to map file:").append(name));
}
*sz = fsize.LowPart;
return mappedData;
}
void* map_file_to_memory(const char *name, size_t *sz) {
return map_file_to_memory_cpp(name, sz);
}
// Funkce pro zrušení mapování
void unmap_file(void *ptr, size_t) {
UnmapViewOfFile(ptr);
}

View file

@ -0,0 +1,4 @@
#include <stddef.h>
#include <stdint.h>
void *map_file_to_memory(const char *name, size_t *sz);
void unmap_file(void *ptr, size_t sz);

View file

@ -1,23 +1,22 @@
#include "../platform.h"
#include "../save_folder.h" #include "../save_folder.h"
#include "../error.h" #include "../error.h"
#include <iostream> #include <iostream>
#include <filesystem> #include <filesystem>
#include <windows.h> #include <windows.h>
#include <ShlObj.h>
#pragma comment(lib, "shell32.lib") #pragma comment(lib, "shell32.lib")
#pragma comment(lib, "ole32.lib") #pragma comment(lib, "ole32.lib")
// Pro získání uživatelské složky
namespace fs = std::filesystem; namespace fs = std::filesystem;
// Funkce pro získání složky "Saved Games"
std::string getSavedGamesDirectory() { std::string getSavedGamesDirectory() {
PWSTR path = nullptr; PWSTR path = nullptr;
// Použití identifikátoru složky FOLDERID_SavedGames if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_SavedGames, 0, NULL, &path))) {
if (SUCCEEDED(SHGetKnownFolderPathA(FOLDERID_SavedGames, 0, NULL, &path))) {
fs::path savedGamesPath(path); fs::path savedGamesPath(path);
CoTaskMemFree(path); // Uvolnění paměti CoTaskMemFree(path);
return savedGamesPath / SAVEGAME_FOLDERNAME return (savedGamesPath / SAVEGAME_FOLDERNAME).string();
} else { } else {
display_error("Failed to retrieve FOLDEROD_SavedGames"); display_error("Failed to retrieve FOLDEROD_SavedGames");
abort(); abort();
@ -25,7 +24,7 @@ std::string getSavedGamesDirectory() {
} }
const char *get_default_savegame_directory() { const char *get_default_savegame_directory() {
static std::string dir = get_default_savgetSavedGamesDirectoryegame_dir(); static std::string dir = getSavedGamesDirectory();
return dir.c_str(); return dir.c_str();
} }