void G_InitActions(void)
{
    dmemset(AllActions, 0, NUM_ACTIONS);
    KeyActions = AllActions + KEY_ACTIONPOS;
    MouseActions = AllActions + MOUSE_ACTIONPOS;
    Mouse2Actions = AllActions + MOUSE2_ACTIONPOS;
    
    dmemset(CurrentActions, 0, MAX_CURRENTACTIONS*sizeof(alist_t *));

    G_AddCommand("alias", CMD_Alias, 0);
    G_AddCommand("unbind", CMD_Unbind, 0);
    G_AddCommand("unbindall", CMD_UnbindAll, 0);
}
Exemple #2
0
void G_PlayerFinishLevel(int player) {
    player_t*   p;

    p = &players[player];

    dmemset(p->powers, 0, sizeof(p->powers));
    dmemset(p->cards, 0, sizeof(p->cards));
    p->mo->flags &= ~MF_SHADOW;     // cancel invisibility
    p->damagecount = 0;         // no palette changes
    p->bonuscount = 0;
    p->bfgcount = 0;

    P_ClearUserCamera(p);
}
Exemple #3
0
vtxlist_t *DL_AddVertexList(drawlist_t * dl)
{
	vtxlist_t *list;

	list = &dl->list[dl->index];

	if (list == &dl->list[dl->max - 1]) {
		// add a new list to the array
		dl->max++;

		// allocate array
		dl->list =
		    (vtxlist_t *) Z_Realloc(dl->list,
					    dl->max * sizeof(vtxlist_t),
					    PU_LEVEL, NULL);

		dmemset(&dl->list[dl->max - 1], 0, sizeof(vtxlist_t));

		list = &dl->list[dl->index];
	}

	list->flags = 0;
	list->texid = 0;
	list->params = 0;

	return &dl->list[dl->index++];
}
Exemple #4
0
void G_Init(void) {
    G_ReloadDefaults();
    G_InitActions();

    dmemset(playeringame, 0, sizeof(playeringame));
    G_ClearInput();

    G_AddCommand("+fire", CMD_Button, PCKEY_ATTACK);
    G_AddCommand("-fire", CMD_Button, PCKEY_ATTACK|PCKF_UP);
    G_AddCommand("+strafe", CMD_Button, PCKEY_STRAFE);
    G_AddCommand("-strafe", CMD_Button, PCKEY_STRAFE|PCKF_UP);
    G_AddCommand("+use", CMD_Button, PCKEY_USE);
    G_AddCommand("-use", CMD_Button, PCKEY_USE|PCKF_UP);
    G_AddCommand("+run", CMD_Button, PCKEY_RUN);
    G_AddCommand("-run", CMD_Button, PCKEY_RUN|PCKF_UP);
    G_AddCommand("+jump", CMD_Button, PCKEY_JUMP);
    G_AddCommand("-jump", CMD_Button, PCKEY_JUMP|PCKF_UP);
    G_AddCommand("weapon", CMD_Weapon, 0);
    G_AddCommand("nextweap", CMD_NextWeapon, 0);
    G_AddCommand("prevweap", CMD_PrevWeapon, 0);
    G_AddCommand("+forward", CMD_Button, PCKEY_FORWARD);
    G_AddCommand("-forward", CMD_Button, PCKEY_FORWARD|PCKF_UP);
    G_AddCommand("+back", CMD_Button, PCKEY_BACK);
    G_AddCommand("-back", CMD_Button, PCKEY_BACK|PCKF_UP);
    G_AddCommand("+left", CMD_Button, PCKEY_LEFT);
    G_AddCommand("-left", CMD_Button, PCKEY_LEFT|PCKF_UP);
    G_AddCommand("+right", CMD_Button, PCKEY_RIGHT);
    G_AddCommand("-right", CMD_Button, PCKEY_RIGHT|PCKF_UP);
    G_AddCommand("+lookup", CMD_Button, PCKEY_LOOKUP);
    G_AddCommand("-lookup", CMD_Button, PCKEY_LOOKUP|PCKF_UP);
    G_AddCommand("+lookdown", CMD_Button, PCKEY_LOOKDOWN);
    G_AddCommand("-lookdown", CMD_Button, PCKEY_LOOKDOWN|PCKF_UP);
    G_AddCommand("+center",  CMD_Button, PCKEY_CENTER);
    G_AddCommand("-center",  CMD_Button, PCKEY_CENTER|PCKF_UP);
    G_AddCommand("autorun",  CMD_Autorun, 0);
    G_AddCommand("+strafeleft", CMD_Button, PCKEY_STRAFELEFT);
    G_AddCommand("-strafeleft", CMD_Button, PCKEY_STRAFELEFT|PCKF_UP);
    G_AddCommand("+straferight", CMD_Button, PCKEY_STRAFERIGHT);
    G_AddCommand("-straferight", CMD_Button, PCKEY_STRAFERIGHT|PCKF_UP);
    G_AddCommand("bind", CMD_Bind, 0);
    G_AddCommand("seta", CMD_Seta, 0);
    G_AddCommand("quit", CMD_Quit, 0);
    G_AddCommand("exec", CMD_Exec, 0);
    G_AddCommand("listcmd", CMD_List, 0);
    G_AddCommand("god",  CMD_Cheat, 0);
    G_AddCommand("noclip", CMD_Cheat, 1);
    G_AddCommand("give", CMD_Cheat, 2);
    G_AddCommand("killall", CMD_Cheat, 3);
    G_AddCommand("mapall", CMD_Cheat, 4);
    G_AddCommand("pause", CMD_Pause, 0);
    G_AddCommand("spawnthing", CMD_SpawnThing, 0);
    G_AddCommand("exitlevel", CMD_ExitLevel, 0);
    G_AddCommand("trigger", CMD_TriggerSpecial, 0);
    G_AddCommand("setcamerastatic", CMD_PlayerCamera, 0);
    G_AddCommand("setcamerachase", CMD_PlayerCamera, 1);
    G_AddCommand("enddemo", CMD_EndDemo, 0);
}
Exemple #5
0
void Z_Init(void) {
    dmemset(allocated_blocks, 0, sizeof(allocated_blocks));

#ifdef ZONEFILE
    atexit(Z_CloseLogFile); // exit handler
    Z_OpenLogFile();

    Z_LogPrintf("* Z_Init\n");
#endif
}
Exemple #6
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;
}
Exemple #7
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;
}
Exemple #8
0
static void M_CheatWarp(player_t * player, char dat[4])
{
	int map;
	map = datoi(dat);

	if (map < 1)
		return;

	if (map > 33)
		return;

	// So be it.
	gameaction = ga_warpquick;
	gameskill = (int)sv_skill.value;
	gamemap = nextmap = map;
	dmemset(passwordData, 0xff, 16);
}
Exemple #9
0
static CMD(TriggerSpecial) {
    line_t junk;

    if(gamestate != GS_LEVEL) {
        return;
    }

    if(!param[0]) {
        return;
    }

    dmemset(&junk, 0, sizeof(line_t));
    junk.special = datoi(param[0]);
    junk.tag = datoi(param[1]);

    P_DoSpecialLine(players[consoleplayer].mo, &junk, 0);
}
Exemple #10
0
void CON_CvarAutoComplete(char *partial)
{
    cvar_t*     cvar;
    int         len;
    char*       name = NULL;
    int         spacinglength;
    dboolean    match = false;
    char*       spacing = NULL;
    
    dstrlwr(partial);
    
    len = dstrlen(partial);
    
    if(!len)
        return;
    
    // check functions
    for(cvar = cvarcap; cvar; cvar = cvar->next)
    {
        if(!dstrncmp(partial, cvar->name, len))
        {
            if(!match)
            {
                match = true;
                CON_Printf(0, "\n");
            }

            name = cvar->name;

            // setup spacing
            spacinglength = 24 - dstrlen(cvar->name);
            spacing = Z_Malloc(spacinglength + 1, PU_STATIC, NULL);
            dmemset(spacing, 0x20, spacinglength);
            spacing[spacinglength] = 0;

            // print all matching cvars
            CON_Printf(AQUA, "%s%s= %s (%s)\n", name, spacing, cvar->string, cvar->defvalue);

            Z_Free(spacing);

            CONCLEARINPUT();
            sprintf(console_inputbuffer+1, "%s ", name);
            console_inputlength = dstrlen(console_inputbuffer);
        }
    }
}
Exemple #11
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;
}
Exemple #12
0
void G_BuildTiccmd(ticcmd_t* cmd) {
    int                 i;
    int                 speed;
    int                 forward;
    int                 side;
    playercontrols_t    *pc;

    pc = &Controls;
    dmemset(cmd, 0, sizeof(ticcmd_t));

    cmd->consistency = consistency[consoleplayer][maketic % BACKUPTICS];

    if(pc->key[PCKEY_RUN]) {
        speed = 1;
    }
    else {
        speed=0;
    }

    if(p_autorun.value) {
        speed = !speed;
    }

    forward = side = 0;

    // use two stage accelerative turning
    // on the keyboard and joystick
    if(pc->key[PCKEY_LEFT] || pc->key[PCKEY_RIGHT]) {
        turnheld += ticdup;
    }
    else {
        turnheld = 0;
    }

    if(turnheld >= SLOWTURNTICS) {
        turnheld = SLOWTURNTICS-1;
    }

    if(pc->key[PCKEY_LOOKUP] || pc->key[PCKEY_LOOKDOWN]) {
        lookheld += ticdup;
    }
    else {
        lookheld = 0;
    }

    if(lookheld >= SLOWTURNTICS) {
        lookheld = SLOWTURNTICS-1;
    }

    if(pc->key[PCKEY_STRAFE]) {
        if(pc->key[PCKEY_RIGHT]) {
            side += sidemove[speed];
        }
        if(pc->key[PCKEY_LEFT]) {
            side -= sidemove[speed];
        }
        side += sidemove[1] * pc->mousex * 2;
    }
    else {
        if(pc->key[PCKEY_RIGHT]) {
            cmd->angleturn -= angleturn[turnheld + (speed ? SLOWTURNTICS : 0)] << 2;
        }

        if(pc->key[PCKEY_LEFT]) {
            cmd->angleturn += angleturn[turnheld + (speed ? SLOWTURNTICS : 0)] << 2;
        }

        if(pc->key[PCKEY_LOOKUP]) {
            cmd->pitch += angleturn[lookheld + (speed ? SLOWTURNTICS : 0)] << 2;
        }

        if(pc->key[PCKEY_LOOKDOWN]) {
            cmd->pitch -= angleturn[lookheld + (speed ? SLOWTURNTICS : 0)] << 2;
        }

        cmd->angleturn -= pc->mousex * 0x8;

        if(forcefreelook != 2) {
            if((int)v_mlook.value || forcefreelook) {
                cmd->pitch -= (int)v_mlookinvert.value ? pc->mousey * 0x8 : -(pc->mousey * 0x8);
            }
        }
    }

    if((int)v_yaxismove.value) {
        forward += pc->mousey;
    }

    if(pc->key[PCKEY_CENTER]) {
        cmd->buttons2 |= BT2_CENTER;
    }

    if(pc->key[PCKEY_FORWARD]) {
        forward += forwardmove[speed];
    }

    //
    // forward/side movement with joystick
    //
    if(pc->flags & PCF_GAMEPAD) {
        forward += pc->joyy;
        side += pc->joyx;
    }

    if(pc->key[PCKEY_BACK]) {
        forward -= forwardmove[speed];
    }

    if(pc->key[PCKEY_STRAFERIGHT]) {
        side += sidemove[speed];
    }

    if(pc->key[PCKEY_STRAFELEFT]) {
        side -= sidemove[speed];
    }

    pc->mousex = pc->mousey = 0;
    pc->joyx = pc->joyy = 0;

    cmd->chatchar = ST_DequeueChatChar();

    if(pc->key[PCKEY_ATTACK]) {
        cmd->buttons |= BT_ATTACK;
    }

    if(pc->key[PCKEY_USE]) {
        cmd->buttons |= BT_USE;
        // clear double clicks if hit use button
        pc->flags &= ~(PCF_FDCLICK2|PCF_SDCLICK2);
    }

    if(forcejump != 2) {
        if(gameflags & GF_ALLOWJUMP || forcejump) {
            if(pc->key[PCKEY_JUMP]) {
                cmd->buttons2 |= BT2_JUMP;
            }
        }
    }

    if(pc->flags & PCF_NEXTWEAPON) {
        cmd->buttons |= BT_CHANGE;
        cmd->buttons2 |= BT2_NEXTWEAP;
        pc->flags &= ~PCF_NEXTWEAPON;
    }
    else if(pc->flags & PCF_PREVWEAPON) {
        cmd->buttons |= BT_CHANGE;
        cmd->buttons2 |= BT2_PREVWEAP;
        pc->flags &= ~PCF_PREVWEAPON;
    }
    else if(pc->nextweapon != wp_nochange) {
        cmd->buttons |= BT_CHANGE;
        cmd->buttons |= pc->nextweapon << BT_WEAPONSHIFT;
        pc->nextweapon = wp_nochange;
    }

    //doubleclick use
    i=pc->flags & PCF_FDCLICK;
    if(pc->key[PCKEY_FORWARD] & PCKF_DOUBLEUSE) {
        i ^= PCF_FDCLICK;
    }

    if(i) {
        pc->flags ^= PCF_FDCLICK;
        if(pc->key[PCKEY_FORWARD] & PCKF_DOUBLEUSE) {
            if(pc->flags & PCF_FDCLICK2) {
                if(p_fdoubleclick.value) {
                    cmd->buttons |= BT_USE;
                }

                pc->flags &= ~PCF_FDCLICK2;
            }
            else {
                pc->flags |= PCF_FDCLICK2;
            }
        }
        pc->fdclicktime = 0;
    }
    else if(pc->fdclicktime >= 0) {
        pc->fdclicktime += ticdup;
        if(pc->fdclicktime > DCLICK_TIME) {
            pc->flags &= ~PCF_FDCLICK2;
            pc->fdclicktime = -1;
        }
    }

    i = pc->flags & PCF_SDCLICK;
    if(pc->key[PCKEY_STRAFE] & PCKF_DOUBLEUSE) {
        i ^= PCF_SDCLICK;
    }

    if(i) {
        pc->flags ^= PCF_SDCLICK;
        if(pc->key[PCKEY_STRAFE] & PCKF_DOUBLEUSE) {
            if(pc->flags & PCF_SDCLICK2) {
                if(p_sdoubleclick.value) {
                    cmd->buttons |= BT_USE;
                }

                pc->flags &= ~PCF_SDCLICK2;
            }
            else {
                pc->flags |= PCF_SDCLICK2;
            }
        }
        pc->sdclicktime = 0;
    }
    else if(pc->sdclicktime >= 0) {
        pc->sdclicktime += ticdup;
        if(pc->sdclicktime > DCLICK_TIME) {
            pc->flags &= ~PCF_SDCLICK2;
            pc->sdclicktime = -1;
        }
    }


    if(forward > MAXPLMOVE) {
        forward = MAXPLMOVE;
    }
    else if(forward < -MAXPLMOVE) {
        forward = -MAXPLMOVE;
    }

    if(side > MAXPLMOVE) {
        side = MAXPLMOVE;
    }
    else if(side < -MAXPLMOVE) {
        side = -MAXPLMOVE;
    }

    cmd->forwardmove += forward;
    cmd->sidemove += side;

    // special buttons
    if(sendpause) {
        sendpause = false;
        cmd->buttons = BT_SPECIAL | BTS_PAUSE;
    }

    if(sendsave) {
        sendsave = false;
        cmd->buttons = BT_SPECIAL | BTS_SAVEGAME | (savegameslot << BTS_SAVESHIFT);
    }
}
Exemple #13
0
void G_PlayerReborn(int player) {
    player_t    *p;
    int         i;
    int         frags[MAXPLAYERS];
    int         killcount;
    int         itemcount;
    int         secretcount;
    dboolean    cards[NUMCARDS];
    dboolean    wpns[NUMWEAPONS];
    int         pammo[NUMAMMO];
    int         pmaxammo[NUMAMMO];
    int         artifacts;
    dboolean    backpack;

    dmemcpy(frags, players[player].frags, sizeof(frags));
    dmemcpy(cards, players[player].cards, sizeof(dboolean)*NUMCARDS);
    dmemcpy(wpns, players[player].weaponowned, sizeof(dboolean)*NUMWEAPONS);
    dmemcpy(pammo, players[player].ammo, sizeof(int)*NUMAMMO);
    dmemcpy(pmaxammo, players[player].maxammo, sizeof(int)*NUMAMMO);

    backpack = players[player].backpack;
    artifacts = players[player].artifacts;
    killcount = players[player].killcount;
    itemcount = players[player].itemcount;
    secretcount = players[player].secretcount;

    quakeviewx = 0;
    quakeviewy = 0;
    infraredFactor = 0;
    R_RefreshBrightness();

    p = &players[player];
    dmemset(p, 0, sizeof(*p));

    dmemcpy(players[player].frags, frags, sizeof(players[player].frags));
    players[player].killcount = killcount;
    players[player].itemcount = itemcount;
    players[player].secretcount = secretcount;

    p->usedown = p->attackdown = p->jumpdown = true;  // don't do anything immediately
    p->playerstate = PST_LIVE;
    p->health = MAXHEALTH;
    p->readyweapon = p->pendingweapon = wp_pistol;
    p->weaponowned[wp_fist] = true;
    p->weaponowned[wp_pistol] = true;
    p->ammo[am_clip] = 50;
    p->recoilpitch = 0;

    for(i = 0; i < NUMAMMO; i++) {
        p->maxammo[i] = maxammo[i];
    }

    if(netgame) {
        for(i = 0; i < NUMCARDS; i++) {
            players[player].cards[i] = cards[i];
        }

        if(gameflags & GF_KEEPITEMS) {
            p->artifacts = artifacts;
            p->backpack = backpack;

            for(i = 0; i < NUMAMMO; i++) {
                p->ammo[i] = pammo[i];
                p->maxammo[i] = pmaxammo[i];
            }

            for(i = 0; i < NUMWEAPONS; i++) {
                p->weaponowned[i] = wpns[i];
            }
        }
    }
}
Exemple #14
0
void *(Z_Calloc)(int n1, int tag, void *user, const char *file, int line) {
#ifdef ZONEFILE
    Z_LogPrintf("* Z_Calloc(file=%s:%d)\n", file, line);
#endif
    return dmemset((Z_Malloc)(n1, tag, user, file, line), 0, n1);
}
Exemple #15
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);
	}
}