mirror of
https://github.com/ondra-novak/gates_of_skeldal.git
synced 2025-07-25 16:44:46 -04:00
improve communication with editor (windows side)
This commit is contained in:
parent
4ed39ec344
commit
b33fb43d78
11 changed files with 76 additions and 24 deletions
|
@ -756,7 +756,7 @@ void a_touch(int sector,int dir);
|
|||
int do_action(int action_numb,int sector,int direct,int flags,int nosend);
|
||||
void delay_action(int action_numb,int sector,int direct,int flags,int nosend,int delay);
|
||||
//int32_t load_section(FILE *f,void **section, int *sct_type,int32_t *sect_size);
|
||||
uint32_t load_section_mem(TMPFILE_RD *f,const void **section, int *sct_type,uint32_t *sect_size);
|
||||
int32_t load_section_mem(TMPFILE_RD *f,const void **section, int *sct_type,uint32_t *sect_size);
|
||||
TMPFILE_RD *open_ddl_file(const char *name, int group);
|
||||
int prepare_graphics(int *ofs,const char *names,int32_t size,ABLOCK_DECODEPROC decomp,int cls);
|
||||
void show_automap(char full);
|
||||
|
@ -1229,7 +1229,7 @@ typedef struct tma_fireball
|
|||
|
||||
typedef struct tma_loadlev
|
||||
{
|
||||
uint8_t action,flags,eflags; //3+padding
|
||||
uint8_t action,flags,lflags; //3+padding
|
||||
short start_pos; //6
|
||||
char dir; //7
|
||||
char name[13];
|
||||
|
|
|
@ -118,7 +118,7 @@ int32_t load_section(FILE *f,void **section, int *sct_type,int32_t *sect_size)
|
|||
}
|
||||
*/
|
||||
|
||||
uint32_t load_section_mem(TMPFILE_RD *f,const void **section, int *sct_type,uint32_t *sect_size) {
|
||||
int32_t load_section_mem(TMPFILE_RD *f,const void **section, int *sct_type,uint32_t *sect_size) {
|
||||
uint32_t s;
|
||||
char c[20];
|
||||
|
||||
|
@ -284,8 +284,8 @@ int load_map(const char *filename)
|
|||
if (f==NULL) return -1;
|
||||
do
|
||||
{
|
||||
uint32_t r=load_section_mem(f,&temp,§,&size);
|
||||
if (r==size)
|
||||
int32_t r=load_section_mem(f,&temp,§,&size);
|
||||
if (r==(int32_t)size)
|
||||
switch (sect)
|
||||
{
|
||||
case A_SIDEMAP:
|
||||
|
|
|
@ -898,7 +898,7 @@ void init_DDL_manager() {
|
|||
display_error("Can't open resource file (main): %s", ddlfile);
|
||||
abort();
|
||||
}
|
||||
for (size_t i = 0; i <= countof(patch_files); ++i) {
|
||||
for (size_t i = 0; i < countof(patch_files); ++i) {
|
||||
if (patch_files[i]) {
|
||||
if (!add_patch_file(patch_files[i])) {
|
||||
display_error("Can't open resource file (adv_patch): %s", patch_files[i]);
|
||||
|
@ -970,7 +970,12 @@ void sse_listener_watch(EVENT_MSG *msg, void **userdata) {
|
|||
if (msg->msg == E_WATCH) {
|
||||
const char *s = sse_receiver_receive(sse_receiver);
|
||||
if (s) {
|
||||
send_message(E_EXTERNAL_MSG, s);
|
||||
if (strcmp(s,"STOP") == 0) {
|
||||
closemode();
|
||||
exit(0);
|
||||
} else {
|
||||
send_message(E_EXTERNAL_MSG, s);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1072,8 +1077,6 @@ void init_skeldal(const INI_CONFIG *cfg)
|
|||
|
||||
load_shops();
|
||||
memset(&loadlevel,0,sizeof(loadlevel));
|
||||
loadlevel.eflags = 0xFF;
|
||||
|
||||
}
|
||||
|
||||
void wire_main_functs();
|
||||
|
@ -1130,29 +1133,35 @@ extern char running_battle;
|
|||
const char *m = va_arg(msg->data, const char *);
|
||||
char fname[13];
|
||||
int sector;
|
||||
int side;
|
||||
int i;
|
||||
|
||||
if (sscanf(m, "RELOAD %12s %d", fname, §or) == 2) {
|
||||
if (sscanf(m, "RELOAD %12s %d %d", fname, §or, &side) == 3) {
|
||||
|
||||
reload_ddls();
|
||||
strcopy_n(loadlevel.name,fname,sizeof(loadlevel.name));
|
||||
loadlevel.start_pos=sector;
|
||||
loadlevel.start_pos=sector;
|
||||
loadlevel.dir = side;
|
||||
for(i=0;i<POCET_POSTAV;i++) if (postavy[i].used) {
|
||||
postavy[i].sektor=loadlevel.start_pos;
|
||||
postavy[i].direction=loadlevel.dir;
|
||||
postavy[i].groupnum = 1;
|
||||
}
|
||||
SEND_LOG("(WIZARD) Load map '%s' %d",loadlevel.name,loadlevel.start_pos);
|
||||
SEND_LOG("(WIZARD) Load map '%s' %d %d",loadlevel.name,loadlevel.start_pos, loadlevel.dir);
|
||||
unwire_proc();
|
||||
if (battle) konec_kola();
|
||||
battle=0;
|
||||
running_battle=0;
|
||||
doNotLoadMapState=1;
|
||||
hl_ptr=ikon_libs;
|
||||
destroy_fly_map();
|
||||
load_items();
|
||||
zneplatnit_block(H_ENEMY);
|
||||
zneplatnit_block(H_SHOP_PIC);
|
||||
zneplatnit_block(H_DIALOGY_DAT);
|
||||
battle=0;
|
||||
running_battle=0;
|
||||
doNotLoadMapState=1;
|
||||
hl_ptr=ikon_libs;
|
||||
destroy_fly_map();
|
||||
load_items();
|
||||
zneplatnit_block(H_ENEMY);
|
||||
zneplatnit_block(H_SHOP_PIC);
|
||||
zneplatnit_block(H_DIALOGY_DAT);
|
||||
load_shops();
|
||||
autosave_on_enter = 0;
|
||||
game_display_focus();
|
||||
send_message(E_CLOSE_MAP);
|
||||
} else if (strncmp(m, "MESSAGE ", 8) == 0) {
|
||||
bott_disp_text(m+8);
|
||||
|
@ -1182,8 +1191,8 @@ void enter_game(void)
|
|||
|
||||
send_message(E_ADD,E_RELOADMAP,reload_map_handler);
|
||||
{
|
||||
EVENT_MSG *msg = task_wait_event(E_CLOSE_MAP);
|
||||
end = va_arg(msg->data, int);
|
||||
EVENT_MSG *msg = task_wait_event(E_CLOSE_MAP);
|
||||
end = msg != NULL?va_arg(msg->data, int):0;
|
||||
}
|
||||
send_message(E_DONE,E_RELOADMAP,reload_map_handler);
|
||||
|
||||
|
|
|
@ -348,6 +348,15 @@ void reload_ddls(void) {
|
|||
dinfo->nametable = load_file_table(bmf);
|
||||
}
|
||||
}
|
||||
for(i=0;i<BK_MAJOR_HANDLES;i++) if (_handles[i]!=NULL) {
|
||||
p=(THANDLE_DATA *)(_handles[i]);
|
||||
for(j=0;j<BK_MINOR_HANDLES;j++) {
|
||||
THANDLE_DATA *h = p+j;
|
||||
if (h->src_file[0]) {
|
||||
get_file_entry(h->path,h->src_file,h);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ struct TaskInfo {
|
|||
bool exited = false;
|
||||
|
||||
TaskInfo(int id):id(id) {}
|
||||
~TaskInfo();
|
||||
};
|
||||
|
||||
using TaskList = std::unordered_map<int, std::unique_ptr<TaskInfo> >;
|
||||
|
@ -212,3 +213,11 @@ void task_sleep_for(unsigned int time_ms) {
|
|||
}
|
||||
}
|
||||
|
||||
TaskInfo::~TaskInfo() {
|
||||
|
||||
//destructor is called only when task is already in cleanup state
|
||||
if (!exited) {
|
||||
thr.detach();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -281,3 +281,9 @@ void game_display_disable_crt_effect_temporary(char disable) {
|
|||
auto &sdl = get_sdl_global_context();
|
||||
sdl.disable_crt_effect_temprary(disable?true:false);
|
||||
}
|
||||
|
||||
void game_display_focus()
|
||||
{
|
||||
auto &sdl = get_sdl_global_context();
|
||||
sdl.raise_window();
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ void game_display_hide_sprite(int sprite_id);
|
|||
///unload sprite and free index
|
||||
void game_display_unload_sprite(int sprite);
|
||||
void game_display_disable_crt_effect_temporary(char disable);
|
||||
void game_display_focus();
|
||||
|
||||
void *DxPrepareWalk(int ypos);
|
||||
void DxZoomWalk(void *handle, int ypos, int *points,float phase, void *lodka);
|
||||
|
|
|
@ -1354,3 +1354,12 @@ SDLContext::JoystickButton SDLContext::button_from_string(std::string_view s) {
|
|||
void SDLContext::disable_crt_effect_temprary(bool disable) {
|
||||
_disable_crt_tmp = disable;
|
||||
}
|
||||
|
||||
void SDLContext::raise_window() const
|
||||
{
|
||||
SDL_RaiseWindow(_window.get());
|
||||
SDL_SetWindowAlwaysOnTop(_window.get(),SDL_TRUE);
|
||||
SDL_Delay(100); // malá pauza (volitelné)
|
||||
SDL_SetWindowAlwaysOnTop(_window.get(),SDL_FALSE);
|
||||
|
||||
}
|
||||
|
|
|
@ -163,6 +163,8 @@ public:
|
|||
bool is_joystick_used() const;
|
||||
bool is_joystick_enabled() const;
|
||||
void disable_crt_effect_temprary(bool disable);
|
||||
|
||||
void raise_window() const;
|
||||
protected:
|
||||
|
||||
struct SDL_Deleter {
|
||||
|
|
|
@ -252,6 +252,7 @@ void stop_play_music() {
|
|||
if (music_source) {
|
||||
fade_music();
|
||||
stop_music();
|
||||
current_music.reset();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ static void set_nonblocking(sock_t sock) {
|
|||
static int connect_and_handshake(SSE_RECEIVER *sse) {
|
||||
struct addrinfo hints = {0}, *res = NULL;
|
||||
|
||||
hints.ai_family = AF_INET;
|
||||
hints.ai_family = AF_UNSPEC;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
|
||||
if (getaddrinfo(sse->host, sse->port, &hints, &res) != 0) {
|
||||
|
@ -128,6 +128,12 @@ const char *sse_receiver_receive(SSE_RECEIVER *sse) {
|
|||
if (strncmp(r,"data:",5) == 0) {
|
||||
r+=5;
|
||||
while (*r && isspace(*r)) ++r;
|
||||
char *s = strchr(r, 0)-1;
|
||||
while (s > r && isspace(*s)) {
|
||||
*s = 0;
|
||||
--s;
|
||||
}
|
||||
|
||||
if (*r) {
|
||||
return r;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue