⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hu_stuff.c

📁 The source code of Doom legacy for windows
💻 C
📖 第 1 页 / 共 3 页
字号:
// Emacs style mode select   -*- C++ -*- //-----------------------------------------------------------------------------//// $Id: hu_stuff.c,v 1.11 2001/04/01 17:35:06 bpereira Exp $//// Copyright (C) 1993-1996 by id Software, Inc.// Portions Copyright (C) 1998-2000 by DooM Legacy Team.//// This program is free software; you can redistribute it and/or// modify it under the terms of the GNU General Public License// as published by the Free Software Foundation; either version 2// of the License, or (at your option) any later version.//// This program is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the// GNU General Public License for more details.////// $Log: hu_stuff.c,v $// Revision 1.11  2001/04/01 17:35:06  bpereira// no message//// Revision 1.10  2001/02/24 13:35:20  bpereira// no message//// Revision 1.9  2001/02/19 17:40:34  hurdler// Fix a bug with "chat on" in hw mode//// Revision 1.8  2001/01/25 22:15:42  bpereira// added heretic support//// Revision 1.7  2000/11/04 16:23:43  bpereira// no message//// Revision 1.6  2000/11/02 17:50:06  stroggonmeth// Big 3Dfloors & FraggleScript commit!!//// Revision 1.5  2000/09/28 20:57:15  bpereira// no message//// Revision 1.4  2000/08/31 14:30:55  bpereira// no message//// Revision 1.3  2000/08/03 17:57:42  bpereira// no message//// Revision 1.2  2000/02/27 00:42:10  hurdler// fix CR+LF problem//// Revision 1.1.1.1  2000/02/22 20:32:33  hurdler// Initial import into CVS (v1.29 pr3)////// DESCRIPTION://      heads up displays, cleaned up (hasta la vista hu_lib)//      because a lot of code was unnecessary now////-----------------------------------------------------------------------------#include "doomdef.h"#include "hu_stuff.h"#include "d_netcmd.h"#include "d_clisrv.h"#include "g_game.h"#include "g_input.h"#include "i_video.h"// Data.#include "dstrings.h"#include "st_stuff.h"   //added:05-02-98: ST_HEIGHT#include "r_local.h"#include "wi_stuff.h"  // for drawranckings#include "p_info.h"#include "keys.h"#include "v_video.h"#include "w_wad.h"#include "z_zone.h"#include "console.h"#include "am_map.h"#ifdef HWRENDER#include "hardware/hw_main.h"#endif// coords are scaled#define HU_INPUTX       0#define HU_INPUTY       0//-------------------------------------------//              heads up font//-------------------------------------------patch_t*                hu_font[HU_FONTSIZE];static player_t*        plr;boolean                 chat_on;static char             w_chat[HU_MAXMSGLEN];static boolean          headsupactive = false;boolean                 hu_showscores;        // draw deathmatch rankingsstatic char             hu_tick;//-------------------------------------------//              misc vars//-------------------------------------------consvar_t*   chat_macros[10];//added:16-02-98: crosshair 0=off, 1=cross, 2=angle, 3=point, see m_menu.cpatch_t*           crosshair[3];     //3 precached crosshair graphics// -------// protos.// -------void   HU_drawDeathmatchRankings (void);void   HU_drawCrosshair (void);static void HU_DrawTip();//======================================================================//                 KEYBOARD LAYOUTS FOR ENTERING TEXT//======================================================================char*     shiftxform;char french_shiftxform[] ={    0,    1, 2, 3, 4, 5, 6, 7, 8, 9, 10,    11, 12, 13, 14, 15, 16, 17, 18, 19, 20,    21, 22, 23, 24, 25, 26, 27, 28, 29, 30,    31,    ' ', '!', '"', '#', '$', '%', '&',    '"', // shift-'    '(', ')', '*', '+',    '?', // shift-,    '_', // shift--    '>', // shift-.    '?', // shift-/    '0', // shift-0    '1', // shift-1    '2', // shift-2    '3', // shift-3    '4', // shift-4    '5', // shift-5    '6', // shift-6    '7', // shift-7    '8', // shift-8    '9', // shift-9    '/',    '.', // shift-;    '<',    '+', // shift-=    '>', '?', '@',    'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',    'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',    '[', // shift-[    '!', // shift-backslash - OH MY GOD DOES WATCOM SUCK    ']', // shift-]    '"', '_',    '\'', // shift-`    'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',    'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',    '{', '|', '}', '~', 127};char english_shiftxform[] ={    0,    1, 2, 3, 4, 5, 6, 7, 8, 9, 10,    11, 12, 13, 14, 15, 16, 17, 18, 19, 20,    21, 22, 23, 24, 25, 26, 27, 28, 29, 30,    31,    ' ', '!', '"', '#', '$', '%', '&',    '"', // shift-'    '(', ')', '*', '+',    '<', // shift-,    '_', // shift--    '>', // shift-.    '?', // shift-/    ')', // shift-0    '!', // shift-1    '@', // shift-2    '#', // shift-3    '$', // shift-4    '%', // shift-5    '^', // shift-6    '&', // shift-7    '*', // shift-8    '(', // shift-9    ':',    ':', // shift-;    '<',    '+', // shift-=    '>', '?', '@',    'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',    'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',    '[', // shift-[    '!', // shift-backslash - OH MY GOD DOES WATCOM SUCK    ']', // shift-]    '"', '_',    '\'', // shift-`    'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',    'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',    '{', '|', '}', '~', 127};char frenchKeyMap[128]={    0,    1,2,3,4,5,6,7,8,9,10,    11,12,13,14,15,16,17,18,19,20,    21,22,23,24,25,26,27,28,29,30,    31,    ' ','!','"','#','$','%','&','%','(',')','*','+',';','-',':','!',    '0','1','2','3','4','5','6','7','8','9',':','M','<','=','>','?',    '@','Q','B','C','D','E','F','G','H','I','J','K','L',',','N','O',    'P','A','R','S','T','U','V','Z','X','Y','W','^','\\','$','^','_',    '@','Q','B','C','D','E','F','G','H','I','J','K','L',',','N','O',    'P','A','R','S','T','U','V','Z','X','Y','W','^','\\','$','^',127};char ForeignTranslation(unsigned char ch){    return ch < 128 ? frenchKeyMap[ch] : ch;}//======================================================================//                          HEADS UP INIT//======================================================================// just aftervoid Command_Say_f (void);void Command_Sayto_f (void);void Command_Sayteam_f (void);void Got_Saycmd(char **p,int playernum);// Initialise Heads up// once at game startup.//void HU_Init(void){    int         i;    int         j;    char        buffer[9];    COM_AddCommand ("say"    , Command_Say_f);    COM_AddCommand ("sayto"  , Command_Sayto_f);    COM_AddCommand ("sayteam", Command_Sayteam_f);    RegisterNetXCmd(XD_SAY,Got_Saycmd);    // set shift translation table    if (language==french)        shiftxform = french_shiftxform;    else        shiftxform = english_shiftxform;    // cache the heads-up font for entire game execution    j = gamemode == heretic ? 1 : HU_FONTSTART;    for (i=0;i<HU_FONTSIZE;i++)    {        if( raven )            sprintf(buffer, "FONTA%.2d", j>59 ? 59 : j);        else            sprintf(buffer, "STCFN%.3d", j);        j++;        hu_font[i] = (patch_t *) W_CachePatchName(buffer, PU_STATIC);    }    // cache the crosshairs, dont bother to know which one is being used,    // just cache them 3 all, they're so small anyway.    for(i=0;i<HU_CROSSHAIRS;i++)    {       sprintf(buffer, "CROSHAI%c", '1'+i);       crosshair[i] = (patch_t *) W_CachePatchName(buffer, PU_STATIC);    }}void HU_Stop(void){    headsupactive = false;}// // Reset Heads up when consoleplayer spawns//void HU_Start(void){    if (headsupactive)        HU_Stop();    plr = &players[consoleplayer];    chat_on = false;    headsupactive = true;}//======================================================================//                            EXECUTION//======================================================================void TeamPlay_OnChange(void){    int i;    char s[50];    // Change the name of the teams    if(cv_teamplay.value==1)    {        // color        for(i=0;i<MAXSKINCOLORS;i++)        {            sprintf(s,"%s team",Color_Names[i]);            strcpy(team_names[i],s);        }    }    else    if(cv_teamplay.value==2)    {        // skins        for(i=0;i<numskins;i++)        {            sprintf(s,"%s team",skins[i].name);            strcpy(team_names[i],s);        }    }}void Command_Say_f (void){    char buf[255];    int i,j;    if((j=COM_Argc())<2)    {        CONS_Printf ("say <message> : send a message\n");        return;    }    buf[0]=0;    strcpy(&buf[1],COM_Argv(1));    for(i=2;i<j;i++)    {        strcat(&buf[1]," ");        strcat(&buf[1],COM_Argv(i));    }    SendNetXCmd(XD_SAY,buf,strlen(buf+1)+2); // +2 because 1 for buf[0] and the other for null terminated string}void Command_Sayto_f (void){    char buf[255];    int i,j;    if((j=COM_Argc())<3)    {        CONS_Printf ("sayto <playername|playernum> <message> : send a message to a player\n");        return;    }    buf[0]=nametonum(COM_Argv(1));    if(buf[0]==-1)        return;    strcpy(&buf[1],COM_Argv(2));    for(i=3;i<j;i++)    {        strcat(&buf[1]," ");        strcat(&buf[1],COM_Argv(i));    }    SendNetXCmd(XD_SAY,buf,strlen(buf+1)+2);}void Command_Sayteam_f (void){    char buf[255];    int i,j;    if((j=COM_Argc())<2)    {        CONS_Printf ("sayteam <message> : send a message to your team\n");        return;    }    buf[0]=-consoleplayer;    strcpy(&buf[1],COM_Argv(1));    for(i=2;i<j;i++)    {        strcat(&buf[1]," ");        strcat(&buf[1],COM_Argv(i));    }    SendNetXCmd(XD_SAY,buf,strlen(buf+1)+2); // +2 because 1 for buf[0] and the other for null terminated string}// netsyntax : to : byte  1->32  player 1 to 32//                        0      all//                       -1->-32 say team -numplayer of the sendervoid Got_Saycmd(char **p,int playernum){    char to;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -