1 // --------------------------------------------------------------------------
\r
2 // BEGIN REQUIRED CSQC FUNCTIONS
\r
4 // CSQC_Init : Called every time the CSQC code is initialized (essentially at map load)
\r
5 // Useful for precaching things
\r
9 // CSQC_Shutdown : Called every time the CSQC code is shutdown (changing maps, quitting, etc)
\r
10 void CSQC_Shutdown(void)
\r
13 // CSQC_ConsoleCommand : Used to parse commands in the console that have been registered with the "registercmd" function
\r
14 // Return value should be 1 if CSQC handled the command, otherwise return 0 to have the engine handle it.
\r
15 float CSQC_ConsoleCommand(string strMessage)
\r
17 local float nReturn;
\r
23 tokenize(strMessage);
\r
26 local string strCmd;
\r
30 if (strCmd == "+forward")
\r
38 // CSQC_InputEvent : Used to perform actions based on any key pressed, key released and mouse on the client.
\r
39 // Return value should be 1 if CSQC handled the input, otherwise return 0 to have the input passed to the engine.
\r
40 // All keys are in ascii.
\r
41 // bInputType = 0 is key pressed, 1 is key released, 2 is mouse input.
\r
42 // In the case of keyboard input, nPrimary is the ascii code, and nSecondary is 0.
\r
43 // In the case of mouse input, nPrimary is xdelta, nSecondary is ydelta.
\r
44 float CSQC_InputEvent(float bInputType, float nPrimary, float nSecondary)
\r
46 local float bSkipKey;
\r
51 // END REQUIRED CSQC FUNCTIONS
\r
52 // --------------------------------------------------------------------------
\r
54 // --------------------------------------------------------------------------
\r
55 // BEGIN OPTIONAL CSQC FUNCTIONS
\r
57 // CSQC_Ent_Update : Called every frame that the server has indicated an update to the SSQC / CSQC entity has occured.
\r
58 // The only parameter reflects if the entity is "new" to the client, meaning it just came into the client's PVS.
\r
59 void(float bIsNewEntity) CSQC_Ent_Update =
\r
61 self.enttype = ReadByte();
\r
63 if (self.enttype == ENT_CLIENT)
\r
65 setmodelindex(self, ReadShort());
\r
66 self.origin_x = ReadCoord();
\r
67 self.origin_y = ReadCoord();
\r
68 self.origin_z = ReadCoord();
\r
69 self.angles_x = ReadCoord();
\r
70 self.angles_y = ReadCoord();
\r
71 self.angles_z = ReadCoord();
\r
72 self.sv_entnum = ReadShort();
\r
73 setorigin(self, self.origin); // relink
\r
76 setsize(self, '0 0 0', '0 0 0');
\r
77 self.drawmask = MASK_NORMAL;
\r
78 self.think = Client_Think;
\r
79 self.nextthink = time;
\r
83 error("unknown entity type in CSQC_Ent_Update\n");
\r
86 // CSQC_Ent_Remove : Called when the server requests a SSQC / CSQC entity to be removed. Essentially call remove(self) as well.
\r
87 void CSQC_Ent_Remove()
\r
91 // CSQC_Parse_StuffCmd : Provides the stuffcmd string in the first parameter that the server provided. To execute standard behavior, simply execute localcmd with the string.
\r
92 void CSQC_Parse_StuffCmd(string strMessage)
\r
94 localcmd(strMessage);
\r
96 // CSQC_Parse_Print : Provides the print string in the first parameter that the server provided. To execute standard behavior, simply execute print with the string.
\r
97 void CSQC_Parse_Print(string strMessage)
\r
101 // CSQC_Parse_CenterPrint : Provides the centerprint string in the first parameter that the server provided. To execute standard behavior, simply execute cprint with the string.
\r
102 void CSQC_Parse_CenterPrint(string strMessage)
\r
104 cprint(strMessage);
\r
106 // CSQC_Parse_TempEntity : Handles all temporary entity network data in the CSQC layer.
\r
107 // You must ALWAYS first acquire the temporary ID, which is sent as a byte.
\r
108 // Return value should be 1 if CSQC handled the temporary entity, otherwise return 0 to have the engine process the event.
\r
109 float CSQC_Parse_TempEntity()
\r
111 local float bHandled;
\r
115 nTEID = ReadByte();
\r
120 // Do something cool with TE_GUNSHOT!
\r
123 // No special logic for this temporary entity; return 0 so the engine can handle it
\r