Example #1
0
void G_SecretExitLevel(int map) {
    line_t junk;
    mapdef_t* mapdef;

    mapdef = P_GetMapInfo(gamemap);

    dmemset(&junk, 0, sizeof(line_t));
    junk.tag = mapdef->exitdelay;

    P_SpawnDelayTimer(&junk, G_CompleteLevel);

    nextmap = map;
}
Example #2
0
void G_ExitLevel(void) {
    line_t junk;
    mapdef_t* map;

    map = P_GetMapInfo(gamemap);

    dmemset(&junk, 0, sizeof(line_t));
    junk.tag = map->exitdelay;

    P_SpawnDelayTimer(&junk, G_CompleteLevel);

    nextmap = gamemap + 1;
}
Example #3
0
void G_CompleteLevel(void) {
    mapdef_t* map;
    clusterdef_t* cluster;

    map = P_GetMapInfo(gamemap);

    if(!map->nointermission) {
        gameaction = ga_completed;
    }
    else {
        gameaction = ga_victory;
    }

    cluster = P_GetCluster(nextmap);

    if(cluster && cluster->nointermission) {
        gameaction = ga_victory;
    }
}
Example #4
0
void G_RunTitleMap(void) {
    // villsa 12092013 - abort if map doesn't exist in mapfino
    if(P_GetMapInfo(33) == NULL) {
        return;
    }

    demobuffer = Z_Calloc(0x16000, PU_STATIC, NULL);
    demo_p = demobuffer;
    demobuffer[0x16000-1] = DEMOMARKER;

    G_InitNew(sk_medium, 33);

    precache = true;
    usergame = false;
    demoplayback = true;
    iwadDemo = true;

    rngseed = 0;

    G_DoLoadLevel();
    D_MiniLoop(P_Start, P_Stop, P_Drawer, P_Ticker);
}
Example #5
0
void P_Start(void) {
    int i;
    mapdef_t* map;

    map = P_GetMapInfo(gamemap);

    for(i = 0; i < MAXPLAYERS; i++) {
        // players can't be hurt on title map
        if(map->forcegodmode) {
            players[i].cheats |= CF_GODMODE;
        }
        // turn off godmode on hectic map
        else if(map->clearchts) {
            players[i].cheats &= ~CF_GODMODE;
        }
        else {
            break;
        }
    }

    // turn off/clear some things
    AM_Reset();
    AM_Stop();
    M_ClearRandom();

    // do a nice little fade in effect
    P_FadeInBrightness();

    // autoactivate line specials
    P_ActivateLineByTag(999, players[0].mo);

    // enable menu and set gamestate
    allowmenu = true;
    gamestate = GS_LEVEL;

    S_StartMusic(map->music);
}
Example #6
0
void VBasePlayer::DoClientIntermission(VName NextMap)
{
    guard(VBasePlayer::DoClientIntermission);
    im_t& im = ClGame->im;

    im.Text.Clean();
    im.IMFlags = 0;

    const mapInfo_t& linfo = P_GetMapInfo(Level->XLevel->MapName);
    im.LeaveMap = Level->XLevel->MapName;
    im.LeaveCluster = linfo.Cluster;
    im.LeaveName = linfo.GetName();
    im.LeaveTitlePatch = linfo.TitlePatch;
    im.ExitPic = linfo.ExitPic;
    im.InterMusic = linfo.InterMusic;

    const mapInfo_t& einfo = P_GetMapInfo(NextMap);
    im.EnterMap = NextMap;
    im.EnterCluster = einfo.Cluster;
    im.EnterName = einfo.GetName();
    im.EnterTitlePatch = einfo.TitlePatch;
    im.EnterPic = einfo.EnterPic;

    if (linfo.Cluster != einfo.Cluster)
    {
        if (einfo.Cluster)
        {
            const VClusterDef* CDef = P_GetClusterDef(einfo.Cluster);
            if (CDef->EnterText.Length())
            {
                if (CDef->Flags & CLUSTERF_LookupEnterText)
                {
                    im.Text = GLanguage[*CDef->EnterText];
                }
                else
                {
                    im.Text = CDef->EnterText;
                }
                if (CDef->Flags & CLUSTERF_EnterTextIsLump)
                {
                    im.IMFlags |= im_t::IMF_TextIsLump;
                }
                if (CDef->Flags & CLUSTERF_FinalePic)
                {
                    im.TextFlat = NAME_None;
                    im.TextPic = CDef->Flat;
                }
                else
                {
                    im.TextFlat = CDef->Flat;
                    im.TextPic = NAME_None;
                }
                im.TextMusic = CDef->Music;
                im.TextCDTrack = CDef->CDTrack;
                im.TextCDId = CDef->CDId;
            }
        }
        if (im.Text.Length() == 0 && linfo.Cluster)
        {
            const VClusterDef* CDef = P_GetClusterDef(linfo.Cluster);
            if (CDef->ExitText.Length())
            {
                if (CDef->Flags & CLUSTERF_LookupExitText)
                {
                    im.Text = GLanguage[*CDef->ExitText];
                }
                else
                {
                    im.Text = CDef->ExitText;
                }
                if (CDef->Flags & CLUSTERF_ExitTextIsLump)
                {
                    im.IMFlags |= im_t::IMF_TextIsLump;
                }
                if (CDef->Flags & CLUSTERF_FinalePic)
                {
                    im.TextFlat = NAME_None;
                    im.TextPic = CDef->Flat;
                }
                else
                {
                    im.TextFlat = CDef->Flat;
                    im.TextPic = NAME_None;
                }
                im.TextMusic = CDef->Music;
                im.TextCDTrack = CDef->CDTrack;
                im.TextCDId = CDef->CDId;
            }
        }
    }

    ClGame->intermission = 1;
#ifdef CLIENT
    AM_Stop();
    GAudio->StopAllSequences();
#endif

    ClGame->eventIintermissionStart();
    unguard;
}
Example #7
0
void G_DoLoadLevel(void) {
    int i;
    mapdef_t* map;

    for(i = 0; i < MAXPLAYERS; i++) {
        if(playeringame[i] && players[i].playerstate == PST_DEAD) {
            players[i].playerstate = PST_REBORN;
        }

        dmemset(players[i].frags, 0, sizeof(players[i].frags));
    }

    basetic = gametic;

    // update settings from server cvar
    if(!netgame) {
        gameskill   = (int)sv_skill.value;
        respawnparm = (int)sv_respawn.value;
        respawnitem = (int)sv_respawnitems.value;
        fastparm    = (int)sv_fastmonsters.value;
        nomonsters  = (int)sv_nomonsters.value;
    }

    map = P_GetMapInfo(gamemap);

    if(map == NULL) {
        // boot out to main menu
        gameaction = ga_title;
        return;
    }

    forcecollision  = map->oldcollision;
    forcejump       = map->allowjump;
    forcefreelook   = map->allowfreelook;

    // This was quite messy with SPECIAL and commented parts.
    // Supposedly hacks to make the latest edition work.
    // It might not work properly.

    G_SetFastParms(fastparm || gameskill == sk_nightmare);  // killough 4/10/98

    if(gameskill == sk_nightmare || respawnparm) {
        respawnmonsters = true;
    }
    else {
        respawnmonsters = false;
    }

    if(respawnitem) {
        respawnspecials = true;
    }
    else {
        respawnspecials = false;
    }

    P_SetupLevel(gamemap, 0, gameskill);
    displayplayer = consoleplayer;        // view the guy you are playing
    starttime = I_GetTime();
    gameaction = ga_nothing;

    // clear cmd building stuff
    G_ClearInput();
    sendpause = sendsave = paused = false;
}
Example #8
0
void ST_Drawer(void)
{
	dboolean checkautomap;

	//
	// flash overlay
	//

	if ((st_flashoverlay.value ||
	     gl_max_texture_units <= 2 ||
	     r_texturecombiner.value <= 0) && flashcolor) {
		ST_FlashingScreen(st_flash_r, st_flash_g, st_flash_b,
				  st_flash_a);
	}

	if (iwadDemo)
		return;

	checkautomap = (!automapactive || am_overlay.value);

	//
	// draw hud
	//

	if (checkautomap && st_drawhud.value) {
		//Status graphics
		ST_DrawStatus();

		// original hud layout
		if (st_drawhud.value == 1) {
			//Draw Ammo counter
			if (weaponinfo[plyr->readyweapon].ammo != am_noammo)
				Draw_Number(160, 215,
					    plyr->ammo[weaponinfo
						       [plyr->readyweapon].
						       ammo], 0,
					    REDALPHA(0x7f));

			//Draw Health
			Draw_Number(49, 215, plyr->health, 0, REDALPHA(0x7f));

			//Draw Armor
			Draw_Number(271, 215, plyr->armorpoints, 0,
				    REDALPHA(0x7f));
		}
		// arranged hud layout
		else if (st_drawhud.value >= 2) {
			int wpn;

			if (plyr->pendingweapon == wp_nochange)
				wpn = plyr->readyweapon;
			else
				wpn = plyr->pendingweapon;

			// display ammo sprite
			switch (weaponinfo[wpn].ammo) {
			case am_clip:
				Draw_Sprite2D(SPR_CLIP, 0, 0, 524, 460, 0.5f, 0,
					      WHITEALPHA(0xC0));
				break;
			case am_shell:
				Draw_Sprite2D(SPR_SHEL, 0, 0, 524, 460, 0.5f, 0,
					      WHITEALPHA(0xC0));
				break;
			case am_misl:
				Draw_Sprite2D(SPR_RCKT, 0, 0, 524, 464, 0.5f, 0,
					      WHITEALPHA(0xC0));
				break;
			case am_cell:
				Draw_Sprite2D(SPR_CELL, 0, 0, 524, 464, 0.5f, 0,
					      WHITEALPHA(0xC0));
				break;
			default:
				break;
			}

			// display artifact sprites
			if (plyr->artifacts & (1 << ART_TRIPLE))
				Draw_Sprite2D(SPR_ART3, 0, 0, 260, 872, 0.275f,
					      0, WHITEALPHA(0xC0));

			if (plyr->artifacts & (1 << ART_DOUBLE))
				Draw_Sprite2D(SPR_ART2, 0, 0, 296, 872, 0.275f,
					      0, WHITEALPHA(0xC0));

			if (plyr->artifacts & (1 << ART_FAST))
				Draw_Sprite2D(SPR_ART1, 0, 0, 332, 872, 0.275f,
					      0, WHITEALPHA(0xC0));

			// display medkit/armor
			Draw_Sprite2D(SPR_MEDI, 0, 0, 50, 662, 0.35f, 0,
				      WHITEALPHA(0xC0));
			Draw_Sprite2D(SPR_ARM1, 0, 0, 50, 632, 0.35f, 0,
				      WHITEALPHA(0xC0));

			GL_SetOrthoScale(0.5f);

			//Draw Health
			Draw_Number(96, 448, plyr->health, 2, REDALPHA(0xC0));
			Draw_BigText(104, 450, REDALPHA(0xC0), "%");

			//Draw Armor
			Draw_Number(96, 424, plyr->armorpoints, 2,
				    REDALPHA(0xC0));
			Draw_BigText(104, 426, REDALPHA(0xC0), "%");

			//Draw Ammo counter
			if (weaponinfo[wpn].ammo != am_noammo)
				Draw_Number(550, 448,
					    plyr->ammo[weaponinfo[wpn].ammo], 1,
					    REDALPHA(0xC0));

			GL_SetOrthoScale(1.0f);
		}
	}
	//
	// draw messages
	//

	if (st_hasjmsg && st_regionmsg.value && plyr->messagepic >= 0) {
		ST_DrawJMessage(plyr->messagepic);
	} else if (st_msg && (int)m_messages.value) {
		Draw_Text(20, 20,
			  ST_MSGCOLOR(automapactive ? 0xff : st_msgalpha), 1,
			  false, st_msg);
	} else if (automapactive) {
		char str[128];
		mapdef_t *map = P_GetMapInfo(gamemap);

		if (map) {
			dmemset(&str, 0, 128);

			if (map->type == 2)
				sprintf(str, "%s", map->mapname);
			else
				sprintf(str, "Level %i: %s", gamemap,
					map->mapname);

			Draw_Text(20, 20, ST_MSGCOLOR(0xff), 1, false, str);
		}
	}
	//
	// draw chat text and player names
	//

	if (netgame) {
		ST_DrawChatText();

		if (checkautomap) {
			int i;

			for (i = 0; i < MAXPLAYERS; i++) {
				if (playeringame[i])
					ST_DisplayName(i);
			}
		}
	}
	//
	// draw crosshairs
	//

	if (st_crosshairs && !automapactive) {
		int x = (SCREENWIDTH / 2) - (ST_CROSSHAIRSIZE / 8);
		int y = (SCREENHEIGHT / 2) - (ST_CROSSHAIRSIZE / 8);
		int alpha = (int)st_crosshairopacity.value;

		if (alpha > 0xff)
			alpha = 0xff;

		if (alpha < 0)
			alpha = 0;

		ST_DrawCrosshair(x, y, (int)st_crosshair.value, 2,
				 WHITEALPHA(alpha));
	}
	//
	// use action context
	//

	if (p_usecontext.value) {
		if (P_UseLines(&players[consoleplayer], true)) {
			char usestring[16];
			char contextstring[32];
			float x;

#ifdef _USE_XINPUT		// XINPUT
			if (xgamepad.connected) {
				M_DrawXInputButton(140, 156, XINPUT_GAMEPAD_A);
				Draw_Text(213, 214, WHITEALPHA(0xA0), 0.75,
					  false, "Use");
			} else
#endif
			{
				G_GetActionBindings(usestring, "+use");
				sprintf(contextstring, "(%s)Use", usestring);

				x = (160 / 0.75f) -
				    ((dstrlen(contextstring) * 8) / 2);

				Draw_Text((int)x, 214, WHITEALPHA(0xA0), 0.75f,
					  false, contextstring);
			}
		}
	}
	//
	// damage indicator
	//

	if (p_damageindicator.value)
		ST_DrawDamageMarkers();

	//
	// display pending weapon
	//

	if (st_showpendingweapon.value)
		ST_DrawPendingWeapon();

	//
	// display stats in automap
	//

	if (st_showstats.value && automapactive) {
		Draw_Text(20, 430, WHITE, 0.5f, false,
			  "Monsters:  %i / %i", plyr->killcount, totalkills);
		Draw_Text(20, 440, WHITE, 0.5f, false,
			  "Items:     %i / %i", plyr->itemcount, totalitems);
		Draw_Text(20, 450, WHITE, 0.5f, false,
			  "Secrets:   %i / %i", plyr->secretcount, totalsecret);
		Draw_Text(20, 460, WHITE, 0.5f, false,
			  "Time:      %2.2d:%2.2d", (leveltime / TICRATE) / 60,
			  (leveltime / TICRATE) % 60);
	}
}
Example #9
0
void P_Stop(void) {
    int i = 0;
    int action = gameaction;

    //
    // [d64] stop plasma buzz
    //
    S_StopSound(NULL, sfx_electric);

    for(i = 0; i < MAXPLAYERS; i++) {
        // take away cards and stuff
        if(playeringame[i]) {
            G_PlayerFinishLevel(i);
        }
    }

    // [kex] reset damage indicators
    if(p_damageindicator.value) {
        ST_ClearDamageMarkers();
    }

    // free level tags
    Z_FreeTags(PU_LEVEL, PU_PURGELEVEL-1);

    if(automapactive) {
        AM_Stop();
    }

    // music continues on exit if defined
    if(!P_GetMapInfo(gamemap)->contmusexit) {
        S_StopMusic();
    }

    // end iwad demo playback here
    if(demoplayback && iwadDemo) {
        demoplayback = false;
        iwadDemo = false;
    }

    // do wipe/melt effect
    if(gameaction != ga_loadgame) {
        if(r_wipe.value) {
            if(gameaction != ga_warpquick) {
                WIPE_MeltScreen();
            }
            else {
                S_StopMusic();
                WIPE_FadeScreen(8);
            }
        }
        else {
            if(gameaction == ga_warpquick) {
                S_StopMusic();
            }
        }
    }

    S_ResetSound();

    // action is warpquick only because the user
    // cancelled demo playback...
    // boot the user back to the title screen
    if(gameaction == ga_warpquick && demoplayback) {
        gameaction = ga_title;
        demoplayback = false;
    }
    else {
        gameaction = action;
    }
}