Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print message when discovered a secret #13

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 24 additions & 13 deletions PureDOOM.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,7 @@ void doom_set_getenv(doom_getenv_fn getenv_fn);
void doom_init(int argc, char** argv, int flags);

// Call this every frame
void doom_update(); // This will update at 35 FPS
void doom_force_update(); // This will run a frame everytime it's called, regardless of FPS.
Daivuk marked this conversation as resolved.
Show resolved Hide resolved
void doom_update();

// Channels: 1 = indexed, 3 = RGB, 4 = RGBA
const unsigned char* doom_get_framebuffer(int channels);
Expand Down Expand Up @@ -7566,15 +7565,6 @@ void doom_update()
}


void doom_force_update()
Daivuk marked this conversation as resolved.
Show resolved Hide resolved
{
if (is_wiping_screen)
D_UpdateWipe();
else
D_DoomLoop();
}


const unsigned char* doom_get_framebuffer(int channels)
{
int i, len;
Expand Down Expand Up @@ -15826,7 +15816,6 @@ void I_UpdateSound(void)
register unsigned int sample;
register int dl;
register int dr;

Daivuk marked this conversation as resolved.
Show resolved Hide resolved
// Pointers in global mixbuffer, left, right, end.
signed short* leftout;
signed short* rightout;
Expand Down Expand Up @@ -22600,6 +22589,23 @@ void M_FinishReadThis(int choice)
M_SetupNextMenu(&MainDef);
}

//
// When a secret is found (ColleagueRiley)
Daivuk marked this conversation as resolved.
Show resolved Hide resolved
//
void doom_secretFound(int s) {
static lastTime = 0;
if (lastTime == 0) {
lastTime = I_GetTime();
S_StartSound(0, sfx_getpow);
}

if (I_GetTime() >= lastTime + 20)
lastTime = 0;
else
messageToPrint = 1;

menuactive = 0;
}

//
// M_QuitDOOM
Expand Down Expand Up @@ -23003,8 +23009,10 @@ doom_boolean M_Responder(event_t* ev)
if (messageRoutine)
messageRoutine(ch);

if (menuactive)
S_StartSound(0, sfx_swtchx);

menuactive = false;
S_StartSound(0, sfx_swtchx);
return true;
}

Expand Down Expand Up @@ -34735,6 +34743,9 @@ void P_PlayerInSpecialSector(player_t* player)
case 9:
// SECRET SECTOR
player->secretcount++;
menuactive = false;
M_StartMessage("A secret is revealed!\n", doom_secretFound, false);
menuactive = false;
sector->special = 0;
break;

Expand Down
17 changes: 17 additions & 0 deletions src/DOOM/m_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1418,6 +1418,23 @@ void M_FinishReadThis(int choice)
M_SetupNextMenu(&MainDef);
}

//
// When a secret is found (ColleagueRiley)
//
void doom_secretFound(int s) {
static lastTime = 0;
if (lastTime == 0) {
lastTime = I_GetTime();
S_StartSound(0, sfx_getpow);
}

if (I_GetTime() >= lastTime + 20)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried it and 20 frames (0.57 seconds) is really not long enough. Could we put it for like 50 frames (1.5 sec) maybe? What's the standard in other popular source ports that added this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe. I can check the standard for gzdoom. The only concern about making it longer is that it seems to pause player movement if it's too long.

lastTime = 0;
Daivuk marked this conversation as resolved.
Show resolved Hide resolved
else
messageToPrint = 1;

menuactive = 0;
}

//
// M_QuitDOOM
Expand Down
3 changes: 3 additions & 0 deletions src/DOOM/p_spec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1008,6 +1008,9 @@ void P_PlayerInSpecialSector(player_t* player)
case 9:
// SECRET SECTOR
player->secretcount++;
menuactive = false;
M_StartMessage("A secret is revealed!\n", doom_secretFound, false);
menuactive = false;
Comment on lines +1011 to +1013
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the 2 menuactive?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function changes menu active iirc. I want to ensure it's not marked as active.

sector->special = 0;
break;

Expand Down
Loading