X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Finit.c;h=3a2f9f318d4fe0ce098344cfaf029a7d47803d76;hp=b0043d4911cf53fc19117049ce321ed7fdebb3ad;hb=62b17f905b02a37a044d8aa85ca1afaf95ff360b;hpb=72b5ebcb15f3d2c9a30733c4fafffd7b0e7a1d9c diff --git a/src/init.c b/src/init.c index b0043d49..3a2f9f31 100644 --- a/src/init.c +++ b/src/init.c @@ -1289,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; @@ -1511,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]; @@ -3654,12 +3660,8 @@ void InitElementPropertiesStatic() EL_INVISIBLE_WALL_ACTIVE, EL_SWITCHGATE_SWITCH_UP, EL_SWITCHGATE_SWITCH_DOWN, - EL_DC_SWITCHGATE_SWITCH_UP, - EL_DC_SWITCHGATE_SWITCH_DOWN, EL_TIMEGATE_SWITCH, EL_TIMEGATE_SWITCH_ACTIVE, - EL_DC_TIMEGATE_SWITCH, - EL_DC_TIMEGATE_SWITCH_ACTIVE, EL_EMC_WALL_1, EL_EMC_WALL_2, EL_EMC_WALL_3, @@ -3728,6 +3730,12 @@ void InitElementPropertiesStatic() EL_SIGN_FRANKIE, EL_STEEL_EXIT_CLOSED, EL_STEEL_EXIT_OPEN, + EL_STEEL_EXIT_OPENING, + EL_STEEL_EXIT_CLOSING, + EL_EM_STEEL_EXIT_CLOSED, + EL_EM_STEEL_EXIT_OPEN, + EL_EM_STEEL_EXIT_OPENING, + EL_EM_STEEL_EXIT_CLOSING, EL_DC_STEELWALL_1_LEFT, EL_DC_STEELWALL_1_RIGHT, EL_DC_STEELWALL_1_TOP, @@ -3780,14 +3788,34 @@ void InitElementPropertiesStatic() EL_EM_GATE_2_GRAY_ACTIVE, EL_EM_GATE_3_GRAY_ACTIVE, EL_EM_GATE_4_GRAY_ACTIVE, + EL_EMC_GATE_5, + EL_EMC_GATE_6, + EL_EMC_GATE_7, + EL_EMC_GATE_8, + EL_EMC_GATE_5_GRAY, + EL_EMC_GATE_6_GRAY, + EL_EMC_GATE_7_GRAY, + EL_EMC_GATE_8_GRAY, + EL_EMC_GATE_5_GRAY_ACTIVE, + EL_EMC_GATE_6_GRAY_ACTIVE, + EL_EMC_GATE_7_GRAY_ACTIVE, + EL_EMC_GATE_8_GRAY_ACTIVE, + EL_DC_GATE_WHITE, + EL_DC_GATE_WHITE_GRAY, + EL_DC_GATE_WHITE_GRAY_ACTIVE, + EL_DC_GATE_FAKE_GRAY, EL_SWITCHGATE_OPEN, EL_SWITCHGATE_OPENING, EL_SWITCHGATE_CLOSED, EL_SWITCHGATE_CLOSING, + EL_DC_SWITCHGATE_SWITCH_UP, + EL_DC_SWITCHGATE_SWITCH_DOWN, EL_TIMEGATE_OPEN, EL_TIMEGATE_OPENING, EL_TIMEGATE_CLOSED, EL_TIMEGATE_CLOSING, + EL_DC_TIMEGATE_SWITCH, + EL_DC_TIMEGATE_SWITCH_ACTIVE, EL_TUBE_ANY, EL_TUBE_VERTICAL, EL_TUBE_HORIZONTAL, @@ -3799,6 +3827,9 @@ void InitElementPropertiesStatic() EL_TUBE_LEFT_DOWN, EL_TUBE_RIGHT_UP, EL_TUBE_RIGHT_DOWN, + EL_EXPANDABLE_STEELWALL_HORIZONTAL, + EL_EXPANDABLE_STEELWALL_VERTICAL, + EL_EXPANDABLE_STEELWALL_ANY, -1 }; @@ -4539,8 +4570,8 @@ void InitElementPropertiesEngine(int engine_version) if (IS_HISTORIC_SOLID(i) || i == EL_EXPLOSION) SET_PROPERTY(i, EP_DRAGONFIRE_PROOF, TRUE); else - SET_PROPERTY(i, EP_DRAGONFIRE_PROOF, (IS_CUSTOM_ELEMENT(i) && - IS_INDESTRUCTIBLE(i))); + SET_PROPERTY(i, EP_DRAGONFIRE_PROOF, (IS_INDESTRUCTIBLE(i) && + i != EL_ACID)); /* ---------- EXPLOSION_PROOF ------------------------------------------ */ if (i == EL_FLAMES) @@ -5045,6 +5076,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() @@ -5064,6 +5098,7 @@ static void InitSetup() static void InitGameInfo() { game.restart_level = FALSE; + game.restart_game_message = NULL; } static void InitPlayerInfo() @@ -5074,9 +5109,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() @@ -5123,6 +5161,10 @@ static void InitArtworkConfig() { "name", "sort_priority", + "program_title", + "program_copyright", + "program_company", + NULL }; static char **ignore_image_tokens; @@ -5228,6 +5270,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; @@ -5427,6 +5480,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; @@ -5460,6 +5514,8 @@ static void InitLevelInfo() if (leveldir_current == NULL) leveldir_current = getFirstValidTreeInfoEntry(leveldir_first); } + + SetLevelSetInfo(leveldir_current->identifier, level_nr); } static void InitLevelArtworkInfo() @@ -5578,27 +5634,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(network.server_host, network.server_port)) + { + network.enabled = FALSE; - if (!ConnectToServer(options.server_host, options.server_port)) - Error(ERR_EXIT, "cannot connect to network game server"); + setup.network_mode = FALSE; + } + else + { + SendToServer_ProtocolVersion(); + SendToServer_PlayerName(setup.player_name); + SendToServer_NrWanted(setup.network_player_nr + 1); - SendToServer_PlayerName(setup.player_name); - SendToServer_ProtocolVersion(); + network.connected = TRUE; + } - if (nr_wanted) - SendToServer_NrWanted(nr_wanted); -#endif + /* short time to recognize result of network initialization */ + Delay_WithScreenUpdates(1000); } static boolean CheckArtworkConfigForCustomElements(char *filename) @@ -5971,10 +6039,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 @@ -6003,8 +6073,7 @@ void OpenAll() InitVideoDefaults(); InitVideoDisplay(); InitVideoBuffer(WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH, setup.fullscreen); - - InitOverlayInfo(); + InitVideoOverlay(); print_timestamp_time("[init video stuff]"); @@ -6060,6 +6129,8 @@ void OpenAll() return; } + InitNetworkServer(); + SetGameStatus(GAME_MODE_MAIN); FadeSetEnterScreen(); @@ -6072,8 +6143,6 @@ void OpenAll() DrawMainMenu(); - InitNetworkServer(); - #if 0 Error(ERR_DEBUG, "::: SDL_GetBasePath() == '%s'", SDL_GetBasePath());