mirror of
https://github.com/nzp-team/glquake.git
synced 2024-11-10 06:31:35 +00:00
Finish all builtins
This commit is contained in:
parent
063d9d6ed6
commit
f60a8717d4
8 changed files with 1917 additions and 7 deletions
BIN
nzportable.3dsx
BIN
nzportable.3dsx
Binary file not shown.
BIN
nzportable.elf
BIN
nzportable.elf
Binary file not shown.
|
@ -830,6 +830,10 @@ void CL_ParseServerMessage (void)
|
|||
case svc_centerprint:
|
||||
SCR_CenterPrint (MSG_ReadString ());
|
||||
break;
|
||||
|
||||
case svc_useprint:
|
||||
SCR_UsePrint (MSG_ReadByte (),MSG_ReadShort (),MSG_ReadByte ());
|
||||
break;
|
||||
|
||||
case svc_stufftext:
|
||||
Cbuf_AddText (MSG_ReadString ());
|
||||
|
|
|
@ -223,6 +223,268 @@ void SCR_CheckDrawCenterString (void)
|
|||
SCR_DrawCenterString ();
|
||||
}
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
||||
Press somthing printing
|
||||
|
||||
===============================================================================
|
||||
*/
|
||||
|
||||
char scr_usestring[1024];
|
||||
float scr_usetime_off = 0.0f;
|
||||
int button_pic_x;
|
||||
extern qpic_t *b_circle;
|
||||
extern qpic_t *b_square;
|
||||
extern qpic_t *b_cross;
|
||||
extern qpic_t *b_triangle;
|
||||
extern qpic_t *b_left;
|
||||
extern qpic_t *b_right;
|
||||
extern qpic_t *b_up;
|
||||
extern qpic_t *b_down;
|
||||
extern qpic_t *b_lt;
|
||||
extern qpic_t *b_rt;
|
||||
extern qpic_t *b_start;
|
||||
extern qpic_t *b_select;
|
||||
extern qpic_t *b_home;
|
||||
|
||||
/*
|
||||
==============
|
||||
SCR_UsePrint
|
||||
|
||||
Similiar to above, but will also print the current button for the action.
|
||||
==============
|
||||
*/
|
||||
|
||||
qpic_t *GetButtonIcon (char *buttonname)
|
||||
{
|
||||
int j;
|
||||
int l;
|
||||
char *b;
|
||||
l = strlen(buttonname);
|
||||
|
||||
for (j=0 ; j<256 ; j++)
|
||||
{
|
||||
b = keybindings[j];
|
||||
if (!b)
|
||||
continue;
|
||||
if (!strncmp (b, buttonname, l) )
|
||||
{
|
||||
if (!strcmp(Key_KeynumToString(j), "UPARROW"))
|
||||
return b_up;
|
||||
else if (!strcmp(Key_KeynumToString(j), "DOWNARROW"))
|
||||
return b_down;
|
||||
else if (!strcmp(Key_KeynumToString(j), "LEFTARROW"))
|
||||
return b_left;
|
||||
else if (!strcmp(Key_KeynumToString(j), "RIGHTARROW"))
|
||||
return b_right;
|
||||
else if (!strcmp(Key_KeynumToString(j), "SELECT"))
|
||||
return b_select;
|
||||
else if (!strcmp(Key_KeynumToString(j), "HOME"))
|
||||
return b_home;
|
||||
else if (!strcmp(Key_KeynumToString(j), "TRIANGLE"))
|
||||
return b_triangle;
|
||||
else if (!strcmp(Key_KeynumToString(j), "CIRCLE"))
|
||||
return b_circle;
|
||||
else if (!strcmp(Key_KeynumToString(j), "CROSS"))
|
||||
return b_cross;
|
||||
else if (!strcmp(Key_KeynumToString(j), "SQUARE"))
|
||||
return b_square;
|
||||
else if (!strcmp(Key_KeynumToString(j), "LTRIGGER"))
|
||||
return b_lt;
|
||||
else if (!strcmp(Key_KeynumToString(j), "RTRIGGER"))
|
||||
return b_rt;
|
||||
}
|
||||
}
|
||||
return b_cross;
|
||||
}
|
||||
|
||||
char *GetUseButtonL ()
|
||||
{
|
||||
int j;
|
||||
int l;
|
||||
char *b;
|
||||
l = strlen("+use");
|
||||
|
||||
for (j=0 ; j<256 ; j++)
|
||||
{
|
||||
b = keybindings[j];
|
||||
if (!b)
|
||||
continue;
|
||||
if (!strncmp (b, "+use", l) )
|
||||
{
|
||||
if (!strcmp(Key_KeynumToString(j), "SELECT") ||
|
||||
!strcmp(Key_KeynumToString(j), "LTRIGGER") ||
|
||||
!strcmp(Key_KeynumToString(j), "RTRIGGER") ||
|
||||
!strcmp(Key_KeynumToString(j), "HOME"))
|
||||
return " ";
|
||||
else
|
||||
return " ";
|
||||
}
|
||||
}
|
||||
return " ";
|
||||
}
|
||||
|
||||
char *GetPerkName (int perk)
|
||||
{
|
||||
switch (perk)
|
||||
{
|
||||
case 1:
|
||||
return "Quick Revive";
|
||||
case 2:
|
||||
return "Juggernog";
|
||||
case 3:
|
||||
return "Speed Cola";
|
||||
case 4:
|
||||
return "Double Tap";
|
||||
case 5:
|
||||
return "Stamin-Up";
|
||||
case 6:
|
||||
return "PhD Flopper";
|
||||
case 7:
|
||||
return "Deadshot Daiquiri";
|
||||
case 8:
|
||||
return "Mule Kick";
|
||||
default:
|
||||
return "NULL";
|
||||
}
|
||||
}
|
||||
|
||||
void SCR_UsePrint (int type, int cost, int weapon)
|
||||
{
|
||||
//naievil -- fixme
|
||||
/*
|
||||
char s[128];
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case 0://clear
|
||||
strcpy(s, "");
|
||||
break;
|
||||
case 1://door
|
||||
strcpy(s, va("Hold %s to open Door [Cost:%i]\n", GetUseButtonL(), cost));
|
||||
button_pic_x = 5;
|
||||
break;
|
||||
case 2://debris
|
||||
strcpy(s, va("Hold %s to remove Debris [Cost:%i]\n", GetUseButtonL(), cost));
|
||||
button_pic_x = 5;
|
||||
break;
|
||||
case 3://ammo
|
||||
strcpy(s, va("Hold %s to buy Ammo for %s [Cost:%i]\n", GetUseButtonL(), pr_strings+sv_player->v.Weapon_Name_Touch, cost));
|
||||
button_pic_x = 5;
|
||||
break;
|
||||
case 4://weapon
|
||||
strcpy(s, va("Hold %s to buy %s [Cost:%i]\n", GetUseButtonL(), pr_strings+sv_player->v.Weapon_Name_Touch, cost));
|
||||
button_pic_x = 5;
|
||||
break;
|
||||
case 5://window
|
||||
strcpy(s, va("Hold %s to Rebuild Barrier\n", GetUseButtonL()));
|
||||
button_pic_x = 5;
|
||||
break;
|
||||
case 6://box
|
||||
strcpy(s, va("Hold %s to buy a Random Weapon [cost:%i]\n", GetUseButtonL(), cost));
|
||||
button_pic_x = 5;
|
||||
break;
|
||||
case 7://box take
|
||||
strcpy(s, va("Press %s to take Weapon\n", GetUseButtonL()));
|
||||
button_pic_x = 6;
|
||||
break;
|
||||
case 8://power
|
||||
strcpy(s, "The Power must be Activated first\n");
|
||||
button_pic_x = 100;
|
||||
break;
|
||||
case 9://perk
|
||||
strcpy(s, va("Hold %s to buy %s [Cost:%i]\n", GetUseButtonL(), GetPerkName(weapon), cost));
|
||||
button_pic_x = 5;
|
||||
break;
|
||||
case 10://turn on power
|
||||
strcpy(s, va("Hold %s to Turn On the Power\n", GetUseButtonL()));
|
||||
button_pic_x = 5;
|
||||
break;
|
||||
case 11://turn on trap
|
||||
strcpy(s, va("Hold %s to Activate the Trap [Cost:%i]\n", GetUseButtonL(), cost));
|
||||
button_pic_x = 5;
|
||||
break;
|
||||
case 12://PAP
|
||||
strcpy(s, va("Hold %s to Pack-a-Punch [Cost:%i]\n", GetUseButtonL(), cost));
|
||||
button_pic_x = 5;
|
||||
break;
|
||||
case 13://revive
|
||||
strcpy(s, va("Hold %s to Fix your Code.. :)\n", GetUseButtonL()));
|
||||
button_pic_x = 5;
|
||||
break;
|
||||
case 14://use teleporter (free)
|
||||
strcpy(s, va("Hold %s to use Teleporter\n", GetUseButtonL()));
|
||||
button_pic_x = 5;
|
||||
break;
|
||||
case 15://use teleporter (cost)
|
||||
strcpy(s, va("Hold %s to use Teleporter [Cost:%i]\n", GetUseButtonL(), cost));
|
||||
button_pic_x = 5;
|
||||
break;
|
||||
case 16://tp cooldown
|
||||
strcpy(s, "Teleporter is cooling down\n");
|
||||
button_pic_x = 100;
|
||||
break;
|
||||
case 17://link
|
||||
strcpy(s, va("Hold %s to initiate link to pad\n", GetUseButtonL()));
|
||||
button_pic_x = 5;
|
||||
break;
|
||||
case 18://no link
|
||||
strcpy(s, "Link not active\n");
|
||||
button_pic_x = 100;
|
||||
break;
|
||||
case 19://finish link
|
||||
strcpy(s, va("Hold %s to link pad with core\n", GetUseButtonL()));
|
||||
button_pic_x = 5;
|
||||
break;
|
||||
case 20://buyable ending
|
||||
strcpy(s, va("Hold %s to End the Game [Cost:%i]\n", GetUseButtonL(), cost));
|
||||
button_pic_x = 5;
|
||||
break;
|
||||
default:
|
||||
Con_Printf ("No type defined in engine for useprint\n");
|
||||
break;
|
||||
}
|
||||
|
||||
strncpy (scr_usestring, va(s), sizeof(scr_usestring)-1);
|
||||
scr_usetime_off = 0.1;
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
void SCR_DrawUseString (void)
|
||||
{
|
||||
int l;
|
||||
int x, y;
|
||||
|
||||
if (cl.stats[STAT_HEALTH] < 0)
|
||||
return;
|
||||
// the finale prints the characters one at a time
|
||||
|
||||
y = vid.height*0.70;
|
||||
l = strlen (scr_usestring);
|
||||
x = (vid.width - l*8)/2;
|
||||
|
||||
Draw_String (x, y, scr_usestring);
|
||||
Draw_Pic (x + button_pic_x*8, y, GetButtonIcon("+use"));
|
||||
}
|
||||
|
||||
void SCR_CheckDrawUseString (void)
|
||||
{
|
||||
scr_copytop = 1;
|
||||
|
||||
scr_usetime_off -= host_frametime;
|
||||
|
||||
if (scr_usetime_off <= 0 && !cl.intermission)
|
||||
return;
|
||||
if (key_dest != key_game)
|
||||
return;
|
||||
if (cl.stats[STAT_HEALTH] <= 0)
|
||||
return;
|
||||
|
||||
SCR_DrawUseString ();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
/*
|
||||
|
|
1476
source/pr_cmds.c
1476
source/pr_cmds.c
File diff suppressed because it is too large
Load diff
|
@ -338,6 +338,35 @@ void Chase_Init (void);
|
|||
void Chase_Reset (void);
|
||||
void Chase_Update (void);
|
||||
|
||||
//ZOMBIE AI STUFF
|
||||
#define MAX_WAYPOINTS 256 //max waypoints
|
||||
typedef struct
|
||||
{
|
||||
int pathlist [MAX_WAYPOINTS];
|
||||
int zombienum;
|
||||
} zombie_ai;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
vec3_t origin;
|
||||
int id;
|
||||
float g_score, f_score;
|
||||
int open; // Determine if the waypoint is "open" a.k.a avaible
|
||||
int target_id [8]; // Targets array number
|
||||
char special[64]; //special tag is required for the closed waypoints
|
||||
int target [8]; //Each waypoint can have up to 8 targets
|
||||
float dist [8]; // Distance to the next waypoints
|
||||
int came_from; // Used for pathfinding store where we got here to this
|
||||
qboolean used; //if the waypoint is in use
|
||||
} waypoint_ai;
|
||||
|
||||
extern waypoint_ai waypoints[MAX_WAYPOINTS];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define VERTEXARRAYSIZE 18360
|
||||
extern float gVertexBuffer[VERTEXARRAYSIZE];
|
||||
extern float gColorBuffer[VERTEXARRAYSIZE];
|
||||
|
|
|
@ -28,6 +28,7 @@ void SCR_SizeUp (void);
|
|||
void SCR_SizeDown (void);
|
||||
void SCR_BringDownConsole (void);
|
||||
void SCR_CenterPrint (char *str);
|
||||
void SCR_UsePrint (int type, int cost, int weapon);
|
||||
|
||||
void SCR_BeginLoadingPlaque (void);
|
||||
void SCR_EndLoadingPlaque (void);
|
||||
|
|
152
source/sv_main.c
152
source/sv_main.c
|
@ -1198,3 +1198,155 @@ void SV_SpawnServer (char *server)
|
|||
Con_DPrintf ("Server spawned.\n");
|
||||
}
|
||||
|
||||
//ZOMBIE AI THINGS BELOVE THIS!!!
|
||||
#define W_MAX_TEMPSTRING 2048
|
||||
char *w_string_temp;
|
||||
|
||||
waypoint_ai waypoints[MAX_WAYPOINTS];
|
||||
void Load_Waypoint ()
|
||||
{
|
||||
char temp[64];
|
||||
int i, p, s;
|
||||
vec3_t d;
|
||||
int h = 0;
|
||||
|
||||
h = W_fopen();
|
||||
|
||||
w_string_temp = Z_Malloc(128);
|
||||
if (h == -1)
|
||||
{
|
||||
Con_DPrintf("No waypoint file (%s/maps/%s.way) found\n", com_gamedir, sv.name);
|
||||
return;
|
||||
}
|
||||
for (i = 1; i < MAX_WAYPOINTS; i++)
|
||||
{
|
||||
waypoints[i].used = 0;
|
||||
}
|
||||
|
||||
i = 1;
|
||||
Con_DPrintf("Loading waypoints\n");
|
||||
while (1)
|
||||
{
|
||||
if (strncmp(W_fgets (h), "Waypoint", 8))
|
||||
{
|
||||
Con_DPrintf("Last waypoint\n");
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (i == MAX_WAYPOINTS)
|
||||
Sys_Error ("Maximum waypoints loaded {%i)\n", MAX_WAYPOINTS);
|
||||
W_fgets (h);
|
||||
|
||||
W_stov (W_substring (W_fgets (h), 9, 20), d);
|
||||
|
||||
strcpy(temp, W_substring (W_fgets (h), 5, 20));
|
||||
|
||||
i = atoi (temp);
|
||||
waypoints[i].id = atoi (temp);
|
||||
VectorCopy (d, waypoints[i].origin);
|
||||
|
||||
strcpy(waypoints[i].special, W_substring (W_fgets (h), 10, 20));
|
||||
|
||||
if (waypoints[i].special[0])
|
||||
waypoints[i].open = 0;
|
||||
else
|
||||
waypoints[i].open = 1;
|
||||
|
||||
strcpy(temp, W_substring (W_fgets (h), 9, 20));
|
||||
waypoints[i].target[0] = atoi (temp);
|
||||
|
||||
strcpy(temp, W_substring (W_fgets (h), 10, 20));
|
||||
waypoints[i].target[1] = atoi (temp);
|
||||
|
||||
|
||||
strcpy(temp, W_substring (W_fgets (h), 10, 20));
|
||||
waypoints[i].target[2] = atoi (temp);
|
||||
|
||||
|
||||
strcpy(temp, W_substring (W_fgets (h), 10, 20));
|
||||
waypoints[i].target[3] = atoi (temp);
|
||||
|
||||
|
||||
strcpy(temp, W_substring (W_fgets (h), 10, 20));
|
||||
waypoints[i].target[4] = atoi (temp);
|
||||
|
||||
|
||||
strcpy(temp, W_substring (W_fgets (h), 10, 20));
|
||||
waypoints[i].target[5] = atoi (temp);
|
||||
|
||||
|
||||
strcpy(temp, W_substring (W_fgets (h), 10, 20));
|
||||
waypoints[i].target[6] = atoi (temp);
|
||||
|
||||
|
||||
strcpy(temp, W_substring (W_fgets (h), 10, 20));
|
||||
waypoints[i].target[7] = atoi (temp);
|
||||
|
||||
W_fgets (h);
|
||||
W_fgets (h);
|
||||
waypoints[i].used = 1;
|
||||
|
||||
|
||||
Con_DPrintf("Waypoint (%i) id: %i, tag: %s, open: %i, target: %i, target2: %i, target3: %i, target4: %i, target5: %i, target6: %i, target7: %i, target8: %i\n",
|
||||
i,
|
||||
waypoints[i].id,
|
||||
waypoints[i].special,
|
||||
waypoints[i].open,
|
||||
waypoints[i].target[0],
|
||||
waypoints[i].target[1],
|
||||
waypoints[i].target[2],
|
||||
waypoints[i].target[3],
|
||||
waypoints[i].target[4],
|
||||
waypoints[i].target[5],
|
||||
waypoints[i].target[6],
|
||||
waypoints[i].target[7]);
|
||||
}
|
||||
}
|
||||
Con_DPrintf("Total waypoints: %i\n", i);
|
||||
for (i = 1;i < MAX_WAYPOINTS; i++) //for sake of saving time later we are now going to save each targets array position and distace to each waypoint
|
||||
{
|
||||
for (p = 0;waypoints[i].target[p]; p++)
|
||||
{
|
||||
for (s = 1; s < MAX_WAYPOINTS; s++)
|
||||
{
|
||||
if (s == MAX_WAYPOINTS)
|
||||
Sys_Error ("Waypoint (%i) without a target!\n", s);
|
||||
if (waypoints[i].target[p] == waypoints[s].id)
|
||||
{
|
||||
waypoints[i].dist[p] = VecLength2(waypoints[s].origin, waypoints[i].origin);
|
||||
waypoints[i].target_id[p] = s;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Con_DPrintf("Waypoint (%i)target: %i (%i, %f), target2: %i (%i, %f), target3: %i (%i, %f), target4: %i (%i, %f), target5: %i (%i, %f), target6: %i (%i, %f), target7: %i (%i, %f), target8: %i (%i, %f)\n",
|
||||
waypoints[i].id,
|
||||
waypoints[i].target[0],
|
||||
waypoints[i].target_id[0],
|
||||
waypoints[i].dist[0],
|
||||
waypoints[i].target[1],
|
||||
waypoints[i].target_id[1],
|
||||
waypoints[i].dist[1],
|
||||
waypoints[i].target[2],
|
||||
waypoints[i].target_id[2],
|
||||
waypoints[i].dist[2],
|
||||
waypoints[i].target[3],
|
||||
waypoints[i].target_id[3],
|
||||
waypoints[i].dist[3],
|
||||
waypoints[i].target[4],
|
||||
waypoints[i].target_id[4],
|
||||
waypoints[i].dist[4],
|
||||
waypoints[i].target[5],
|
||||
waypoints[i].target_id[5],
|
||||
waypoints[i].dist[5],
|
||||
waypoints[i].target[6],
|
||||
waypoints[i].target_id[6],
|
||||
waypoints[i].dist[6],
|
||||
waypoints[i].target[7],
|
||||
waypoints[i].target_id[7],
|
||||
waypoints[i].dist[7]);
|
||||
}
|
||||
W_fclose(h);
|
||||
//Z_Free (w_string_temp);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue