1st of a few sequencing changes

rename display_gamewindows() to init_sound_and_display_gamewindows()
(I know that's getting pretty long-named).

move activate_chosen_soundlib() into init_sound_and_display_gamewindows()
from moveloop_preamble().

Also included was a missing break in a switch related to sounds.
This commit is contained in:
nhmall
2023-01-26 17:15:59 -05:00
parent 52a44b3255
commit 446044e1d5
15 changed files with 26 additions and 23 deletions
+6 -5
View File
@@ -1025,11 +1025,11 @@ initoptions() /* read the resource file */
init_nhwindows() /* initialize the window system */ init_nhwindows() /* initialize the window system */
process_options(argc, argv) /* process command line options or equiv */ process_options(argc, argv) /* process command line options or equiv */
if(save file is present) { if(save file is present) {
display_gamewindows() /* create & display the game windows */ init_sound_and_display_gamewindows() /* init sound, create & display */
dorestore() /* restore old game; pline()s are OK */ dorestore() /* restore old game; pline()s are OK */
} else { } else {
player_selection() /* select a player type using a window */ player_selection() /* select a player type using a window */
display_gamewindows() /* create & display the game windows */ init_sound_and_display_gamewindows() /* init sound, create & display */
} }
pline("Hello, welcome..."); pline("Hello, welcome...");
@@ -1044,9 +1044,10 @@ ini_routines have side effects that need to be undone, the old ini_routine (if
any) will be called with an argument of WININIT_UNDO before the new any) will be called with an argument of WININIT_UNDO before the new
ini_routine (if any) is called (with WININIT). ini_routine (if any) is called (with WININIT).
Display_gamewindows() is a common routine that displays the two standard Init_sound_and_display_gamewindows() is a common routine that initializes
game windows (WIN_MESSAGE, WIN_MAP), and the status display. It is normally the soundlib, then displays the standard game windows (WIN_MESSAGE, WIN_MAP,
called just before the "Hello, welcome" message. etc.), and the status display. It is normally called just before the
"Hello, welcome" message.
Process_options() is currently still unique to each port. There may be need Process_options() is currently still unique to each port. There may be need
in the future to make it possible to replace this on a per window-port basis. in the future to make it possible to replace this on a per window-port basis.
+1 -1
View File
@@ -22,7 +22,7 @@ extern void early_init(void);
extern void moveloop_core(void); extern void moveloop_core(void);
extern void moveloop(boolean); extern void moveloop(boolean);
extern void stop_occupation(void); extern void stop_occupation(void);
extern void display_gamewindows(void); extern void init_sound_and_display_gamewindows(void);
extern void newgame(void); extern void newgame(void);
extern void welcome(boolean); extern void welcome(boolean);
extern int argcheck(int, char **, enum earlyarg); extern int argcheck(int, char **, enum earlyarg);
+2 -1
View File
@@ -426,7 +426,8 @@ struct NewScreen NewHackScreen = { 0, 0, WIDTH, SCREENHEIGHT, 3, 0,
* plname is filled either by an option (-u Player or -uPlayer) or * plname is filled either by an option (-u Player or -uPlayer) or
* explicitly (by being the wizard) or by askname. * explicitly (by being the wizard) or by askname.
* It may still contain a suffix denoting pl_character. * It may still contain a suffix denoting pl_character.
* Always called after init_nhwindows() and before display_gamewindows(). * Always called after init_nhwindows() and before
* init_sound_and_display_gamewindows().
*/ */
void void
amii_askname() amii_askname()
+1 -1
View File
@@ -64,7 +64,7 @@ MAIN(int argc, char **argv)
*/ */
vision_init(); vision_init();
display_gamewindows(); init_sound_and_display_gamewindows();
/* /*
* First, try to find and restore a save file for specified character. * First, try to find and restore a save file for specified character.
+1 -1
View File
@@ -65,7 +65,7 @@ main(void)
*/ */
vision_init(); vision_init();
display_gamewindows(); init_sound_and_display_gamewindows();
set_playmode(); /* sets plname to "wizard" for wizard mode */ set_playmode(); /* sets plname to "wizard" for wizard mode */
/* strip role,race,&c suffix; calls askname() if plname[] is empty /* strip role,race,&c suffix; calls askname() if plname[] is empty
+1 -1
View File
@@ -74,7 +74,7 @@ functions:49 _delete_levelfile _delete_savefile _delfloortrap _deliver_by_pline
functions:50 _demonpet _destroy_arm _destroy_drawbridge _destroy_item _destroy_mitem _dev_name _dig functions:50 _demonpet _destroy_arm _destroy_drawbridge _destroy_item _destroy_mitem _dev_name _dig
functions:51 _dig_check _dig_corridor _dig_point _dig_typ _digactualhole _dighole _digit _dipfountain functions:51 _dig_check _dig_corridor _dig_point _dig_typ _digactualhole _dighole _digit _dipfountain
functions:52 _disable_ctrlP _disarm_landmine _disarm_shooting_trap _disarm_squeaky_board _discard_minvent _disclose _discover_object functions:52 _disable_ctrlP _disarm_landmine _disarm_shooting_trap _disarm_squeaky_board _discard_minvent _disclose _discover_object
functions:53 _diseasemu _display_binventory _display_cinventory _display_gamewindows _display_inventory _display_minventory functions:53 _diseasemu _display_binventory _display_cinventory _init_sound_and_display_gamewindows _display_inventory _display_minventory
functions:54 _distant_name _distfleeck _disturb _djinni_from_bottle _dlb_cleanup _dlb_fclose functions:54 _distant_name _distfleeck _disturb _djinni_from_bottle _dlb_cleanup _dlb_fclose
functions:55 _dlb_fgets _dlb_fopen _dlb_fread _dlb_fseek _dlb_ftell _dlb_init _dlord _dmgtype functions:55 _dlb_fgets _dlb_fopen _dlb_fread _dlb_fseek _dlb_ftell _dlb_init _dlord _dmgtype
functions:56 _dmgval _dmonsfree _dmore _dname_to_dnum _do_break_wand _do_clear_area _do_comp _do_dknown_of functions:56 _dmgval _dmonsfree _dmore _dname_to_dnum _do_break_wand _do_clear_area _do_comp _do_dknown_of
+1 -1
View File
@@ -74,7 +74,7 @@ functions:49 _delete_levelfile _delete_savefile _delfloortrap _deliver_by_pline
functions:50 _demonpet _destroy_arm _destroy_drawbridge _destroy_item _destroy_mitem _dev_name _dig functions:50 _demonpet _destroy_arm _destroy_drawbridge _destroy_item _destroy_mitem _dev_name _dig
functions:51 _dig_check _dig_corridor _dig_point _dig_typ _digactualhole _dighole _digit _dipfountain functions:51 _dig_check _dig_corridor _dig_point _dig_typ _digactualhole _dighole _digit _dipfountain
functions:52 _disable_ctrlP _disarm_landmine _disarm_shooting_trap _disarm_squeaky_board _discard_minvent _disclose _discover_object functions:52 _disable_ctrlP _disarm_landmine _disarm_shooting_trap _disarm_squeaky_board _discard_minvent _disclose _discover_object
functions:53 _diseasemu _display_binventory _display_cinventory _display_gamewindows _display_inventory _display_minventory functions:53 _diseasemu _display_binventory _display_cinventory _init_sound_and_display_gamewindows _display_inventory _display_minventory
functions:54 _distant_name _distfleeck _disturb _djinni_from_bottle _dlb_cleanup _dlb_fclose functions:54 _distant_name _distfleeck _disturb _djinni_from_bottle _dlb_cleanup _dlb_fclose
functions:55 _dlb_fgets _dlb_fopen _dlb_fread _dlb_fseek _dlb_ftell _dlb_init _dlord _dmgtype functions:55 _dlb_fgets _dlb_fopen _dlb_fread _dlb_fseek _dlb_ftell _dlb_init _dlord _dmgtype
functions:56 _dmgval _dmonsfree _dmore _dname_to_dnum _do_break_wand _do_clear_area _do_comp _do_dknown_of functions:56 _dmgval _dmonsfree _dmore _dname_to_dnum _do_break_wand _do_clear_area _do_comp _do_dknown_of
+1 -1
View File
@@ -495,7 +495,7 @@ Gem_player_selection()
* plname is filled either by an option (-u Player or -uPlayer) or * plname is filled either by an option (-u Player or -uPlayer) or
* explicitly (by being the wizard) or by askname. * explicitly (by being the wizard) or by askname.
* It may still contain a suffix denoting pl_character. * It may still contain a suffix denoting pl_character.
* Always called after init_nhwindows() and before display_gamewindows(). * Always called after init_nhwindows() and before init_sound_and_display_gamewindows().
*/ */
void void
+5 -5
View File
@@ -58,8 +58,6 @@ moveloop_preamble(boolean resuming)
change_luck(-1); change_luck(-1);
} }
activate_chosen_soundlib();
if (!resuming) { /* new game */ if (!resuming) { /* new game */
gc.context.rndencode = rnd(9000); gc.context.rndencode = rnd(9000);
set_wear((struct obj *) 0); /* for side-effects of starting gear */ set_wear((struct obj *) 0); /* for side-effects of starting gear */
@@ -622,10 +620,12 @@ stop_occupation(void)
} }
void void
display_gamewindows(void) init_sound_and_display_gamewindows(void)
{ {
int menu_behavior = MENU_BEHAVE_STANDARD; int menu_behavior = MENU_BEHAVE_STANDARD;
activate_chosen_soundlib();
WIN_MESSAGE = create_nhwindow(NHW_MESSAGE); WIN_MESSAGE = create_nhwindow(NHW_MESSAGE);
if (VIA_WINDOWPORT()) { if (VIA_WINDOWPORT()) {
status_initialize(0); status_initialize(0);
@@ -646,8 +646,8 @@ display_gamewindows(void)
#ifdef MAC #ifdef MAC
/* This _is_ the right place for this - maybe we will /* This _is_ the right place for this - maybe we will
* have to split display_gamewindows into create_gamewindows * have to split init_sound_and_display_gamewindows into
* and show_gamewindows to get rid of this ifdef... * create_gamewindows and show_gamewindows to get rid of this ifdef...
*/ */
if (!strcmp(windowprocs.name, "mac")) if (!strcmp(windowprocs.name, "mac"))
SanePositions(); SanePositions();
+1 -1
View File
@@ -247,7 +247,7 @@ nhmain(int argc, char *argv[])
*/ */
vision_init(); vision_init();
display_gamewindows(); init_sound_and_display_gamewindows();
/* /*
* First, try to find and restore a save file for specified character. * First, try to find and restore a save file for specified character.
+1 -1
View File
@@ -448,7 +448,7 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
*/ */
vision_init(); vision_init();
display_gamewindows(); init_sound_and_display_gamewindows();
/* /*
* First, try to find and restore a save file for specified character. * First, try to find and restore a save file for specified character.
* We'll return here if new game player_selection() renames the hero. * We'll return here if new game player_selection() renames the hero.
+1 -1
View File
@@ -216,7 +216,7 @@ main(int argc, char *argv[])
*/ */
vision_init(); vision_init();
display_gamewindows(); init_sound_and_display_gamewindows();
/* /*
* First, try to find and restore a save file for specified character. * First, try to find and restore a save file for specified character.
+1 -1
View File
@@ -183,7 +183,7 @@ main(int argc, char *argv[])
*/ */
vision_init(); vision_init();
display_gamewindows(); init_sound_and_display_gamewindows();
/* /*
* First, try to find and restore a save file for specified character. * First, try to find and restore a save file for specified character.
+1 -1
View File
@@ -678,7 +678,7 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
* new game or before a level restore on a saved game. * new game or before a level restore on a saved game.
*/ */
vision_init(); vision_init();
display_gamewindows(); init_sound_and_display_gamewindows();
/* /*
* First, try to find and restore a save file for specified character. * First, try to find and restore a save file for specified character.
* We'll return here if new game player_selection() renames the hero. * We'll return here if new game player_selection() renames the hero.
+2 -1
View File
@@ -586,7 +586,8 @@ tty_player_selection(void)
* gp.plname is filled either by an option (-u Player or -uPlayer) or * gp.plname is filled either by an option (-u Player or -uPlayer) or
* explicitly (by being the wizard) or by askname. * explicitly (by being the wizard) or by askname.
* It may still contain a suffix denoting the role, etc. * It may still contain a suffix denoting the role, etc.
* Always called after init_nhwindows() and before display_gamewindows(). * Always called after init_nhwindows() and before
* init_sound_and_display_gamewindows().
*/ */
void void
tty_askname(void) tty_askname(void)