X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Finit.c;h=965706fed1c51d46e25e5f60856ef691c318bfe3;hp=cf83e5043229b5cef9326927bf2ddd34db6e83f6;hb=5449f78b713cb033281266bbb9f46a1de4b8f89e;hpb=3f5f1e9af1b0c10a0b0486c579c55c5e6947807d diff --git a/src/init.c b/src/init.c index cf83e504..965706fe 100644 --- a/src/init.c +++ b/src/init.c @@ -552,13 +552,9 @@ void InitFontGraphicInfo() font_bitmap_info[font_bitmap_id].height = graphic_info[graphic].height; font_bitmap_info[font_bitmap_id].offset_x = - (graphic_info[graphic].offset_x != 0 ? - graphic_info[graphic].offset_x : - graphic_info[graphic].width); + graphic_info[graphic].offset_x; font_bitmap_info[font_bitmap_id].offset_y = - (graphic_info[graphic].offset_y != 0 ? - graphic_info[graphic].offset_y : - graphic_info[graphic].height); + graphic_info[graphic].offset_y; font_bitmap_info[font_bitmap_id].draw_xoffset = graphic_info[graphic].draw_xoffset; @@ -1293,6 +1289,8 @@ static void set_graphic_parameters_ext(int graphic, int *parameter, g->post_delay_random = 0; g->init_event = ANIM_EVENT_DEFAULT; g->anim_event = ANIM_EVENT_DEFAULT; + g->init_event_action = -1; + g->anim_event_action = -1; g->draw_masked = FALSE; g->draw_order = 0; g->fade_mode = FADE_MODE_DEFAULT; @@ -1515,6 +1513,10 @@ static void set_graphic_parameters_ext(int graphic, int *parameter, g->init_event = parameter[GFX_ARG_INIT_EVENT]; if (parameter[GFX_ARG_ANIM_EVENT] != ARG_UNDEFINED_VALUE) g->anim_event = parameter[GFX_ARG_ANIM_EVENT]; + if (parameter[GFX_ARG_INIT_EVENT_ACTION] != ARG_UNDEFINED_VALUE) + g->init_event_action = parameter[GFX_ARG_INIT_EVENT_ACTION]; + if (parameter[GFX_ARG_ANIM_EVENT_ACTION] != ARG_UNDEFINED_VALUE) + g->anim_event_action = parameter[GFX_ARG_ANIM_EVENT_ACTION]; /* used for toon animations and global animations */ g->step_offset = parameter[GFX_ARG_STEP_OFFSET]; @@ -5049,6 +5051,9 @@ void Execute_Command(char *command) { Error(ERR_EXIT_HELP, "unrecognized command '%s'", command); } + + /* disable networking if any valid command was recognized */ + options.network = setup.network_mode = FALSE; } static void InitSetup() @@ -5068,6 +5073,7 @@ static void InitSetup() static void InitGameInfo() { game.restart_level = FALSE; + game.restart_game_message = NULL; } static void InitPlayerInfo() @@ -5078,9 +5084,12 @@ static void InitPlayerInfo() local_player = &stored_player[0]; for (i = 0; i < MAX_PLAYERS; i++) - stored_player[i].connected = FALSE; + { + stored_player[i].connected_locally = FALSE; + stored_player[i].connected_network = FALSE; + } - local_player->connected = TRUE; + local_player->connected_locally = TRUE; } static void InitArtworkInfo() @@ -5127,6 +5136,10 @@ static void InitArtworkConfig() { "name", "sort_priority", + "program_title", + "program_copyright", + "program_company", + NULL }; static char **ignore_image_tokens; @@ -5232,6 +5245,17 @@ static void InitMixer() StartMixer(); } +static void InitVideoOverlay() +{ + // if virtual buttons are not loaded from setup file, repeat initializing + // virtual buttons grid with default values now that video is initialized + if (!setup.touch.grid_initialized) + InitSetup(); + + InitTileCursorInfo(); + InitOverlayInfo(); +} + void InitGfxBuffers() { static int win_xsize_last = -1; @@ -5431,6 +5455,7 @@ void InitGfx() InitGfxDrawBusyAnimFunction(DrawInitAnim); InitGfxDrawGlobalAnimFunction(DrawGlobalAnimations); InitGfxDrawGlobalBorderFunction(DrawMaskedBorderToTarget); + InitGfxDrawTileCursorFunction(DrawTileCursor); gfx.fade_border_source_status = global.border_status; gfx.fade_border_target_status = global.border_status; @@ -5582,27 +5607,39 @@ static void InitArtworkDone() InitGlobalAnimations(); } -void InitNetworkServer() +void InitNetworkSettings() { -#if defined(NETWORK_AVALIABLE) - int nr_wanted; -#endif + InitNetworkInfo(options.network || setup.network_mode, + FALSE, + options.serveronly, + options.server_host, + options.server_port); +} - if (!options.network) +void InitNetworkServer() +{ + if (!network.enabled || network.connected) return; -#if defined(NETWORK_AVALIABLE) - nr_wanted = Request("Choose player", REQ_PLAYER | REQ_STAY_CLOSED); + LimitScreenUpdates(FALSE); - if (!ConnectToServer(options.server_host, options.server_port)) - Error(ERR_EXIT, "cannot connect to network game server"); + if (!ConnectToServer(network.server_host, network.server_port)) + { + network.enabled = FALSE; - SendToServer_PlayerName(setup.player_name); - SendToServer_ProtocolVersion(); + setup.network_mode = FALSE; + } + else + { + SendToServer_PlayerName(setup.player_name); + SendToServer_ProtocolVersion(); + SendToServer_NrWanted(setup.network_player_nr + 1); - if (nr_wanted) - SendToServer_NrWanted(nr_wanted); -#endif + network.connected = TRUE; + } + + /* short time to recognize result of network initialization */ + Delay_WithScreenUpdates(1000); } static boolean CheckArtworkConfigForCustomElements(char *filename) @@ -5975,10 +6012,12 @@ void OpenAll() if (options.execute_command) Execute_Command(options.execute_command); - if (options.serveronly) + InitNetworkSettings(); + + if (network.serveronly) { #if defined(PLATFORM_UNIX) - NetworkServer(options.server_port, options.serveronly); + NetworkServer(network.server_port, TRUE); #else Error(ERR_WARN, "networking only supported in Unix version"); #endif @@ -6007,8 +6046,7 @@ void OpenAll() InitVideoDefaults(); InitVideoDisplay(); InitVideoBuffer(WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH, setup.fullscreen); - - InitOverlayInfo(); + InitVideoOverlay(); print_timestamp_time("[init video stuff]"); @@ -6064,6 +6102,8 @@ void OpenAll() return; } + InitNetworkServer(); + SetGameStatus(GAME_MODE_MAIN); FadeSetEnterScreen(); @@ -6076,8 +6116,6 @@ void OpenAll() DrawMainMenu(); - InitNetworkServer(); - #if 0 Error(ERR_DEBUG, "::: SDL_GetBasePath() == '%s'", SDL_GetBasePath());