Skip to content

Commit

Permalink
add NG/NG+ selection
Browse files Browse the repository at this point in the history
  • Loading branch information
rr- committed Mar 8, 2021
1 parent 2429d10 commit 77e547e
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 3 deletions.
52 changes: 51 additions & 1 deletion src/game/option.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,29 @@
static TEXTSTRING *PassportText1;
static int32_t PassportMode;

#ifdef T1M_FEAT_GAMEPLAY
static char NewGameStrings[][20] = {
{ "New Game" },
{ "New Game+" },
};

static REQUEST_INFO NewGameRequester = {
2, // items
0, // requested
2, // vis_lines
0, // line_offset
0, // line_old_offset
162, // pix_width
TEXT_HEIGHT + 7, // line_height
0, // x
200, // y
0, // z
"Select Mode", // item_heading
NewGameStrings, // item_texts
20, // item_text_len
};
#endif

// original name: do_inventory_options
void DoInventoryOptions(INVENTORY_ITEM *inv_item)
{
Expand Down Expand Up @@ -138,7 +161,23 @@ void DoPassportOption(INVENTORY_ITEM *inv_item)
break;

case 1:
if (PassportMode == 1) {
#ifdef T1M_FEAT_GAMEPLAY
if (PassportMode == 2) {
int32_t select = DisplayRequester(&NewGameRequester);
if (select) {
if (select > 0) {
PassportMode = 0;
InventoryExtraData[1] = select - 1;
} else {
PassportMode = 0;
}
} else {
Input = 0;
InputDB = 0;
}
} else
#endif
if (PassportMode == 1) {
int32_t select = DisplayRequester(&LoadGameRequester);
if (select) {
if (select > 0) {
Expand Down Expand Up @@ -172,7 +211,18 @@ void DoPassportOption(INVENTORY_ITEM *inv_item)
}
if (CHK_ANY(InputDB, IN_SELECT) || InventoryMode == INV_SAVE_MODE) {
if (InventoryMode == INV_TITLE_MODE || !CurrentLevel) {
#ifdef T1M_FEAT_GAMEPLAY
T_RemovePrint(InvRingText);
InvRingText = NULL;
T_RemovePrint(InvItemText[IT_NAME]);
InvItemText[IT_NAME] = NULL;
InitRequester(&NewGameRequester);
PassportMode = 2;
Input = 0;
InputDB = 0;
#else
InventoryExtraData[1] = CurrentLevel;
#endif
} else {
T_RemovePrint(InvRingText);
InvRingText = NULL;
Expand Down
4 changes: 2 additions & 2 deletions src/game/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -1404,8 +1404,8 @@ typedef struct {
/* 000E */ int16_t x;
/* 0010 */ int16_t y;
/* 0012 */ int16_t z;
/* 0014 */ int32_t item_heading;
/* 0018 */ char *item_texts;
/* 0014 */ char *item_heading;
/* 0018 */ char **item_texts;
/* 001C */ int16_t item_text_len;
/* 001E */ TEXTSTRING *heading;
/* 0022 */ TEXTSTRING *background;
Expand Down
4 changes: 4 additions & 0 deletions src/specific/shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ void GameMain()
if (InventoryExtraData[0]) {
if (InventoryExtraData[0] == 1) {
InitialiseStartInfo();
#ifdef T1M_FEAT_GAMEPLAY
SaveGame[0].bonus_flag = InventoryExtraData[1];
ModifyStartInfo(LV_FIRSTLEVEL);
#endif
gf_option = GF_STARTGAME | LV_FIRSTLEVEL;
} else {
gf_option = GF_EXITGAME;
Expand Down

0 comments on commit 77e547e

Please sign in to comment.