UFO: Alien Invasion
Loading...
Searching...
No Matches
e_event_actorreactionfirechange.cpp
Go to the documentation of this file.
1
4
5/*
6Copyright (C) 2002-2025 UFO: Alien Invasion.
7
8This program is free software; you can redistribute it and/or
9modify it under the terms of the GNU General Public License
10as published by the Free Software Foundation; either version 2
11of the License, or (at your option) any later version.
12
13This program is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
17See the GNU General Public License for more details.
18
19You should have received a copy of the GNU General Public License
20along with this program; if not, write to the Free Software
21Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22
23*/
24
25#include "../../../../client.h"
27#include "../../../cl_actor.h"
28#include "../../../cl_hud.h"
31
40{
41 actorHands_t hand;
42 int entnum, fmIdx, odIdx;
43
44 NET_ReadFormat(msg, self->formatString, &entnum, &fmIdx, &hand, &odIdx);
45
46 const le_t* le = LE_Get(entnum);
47 if (!le)
48 LE_NotFoundError(entnum);
49
50 character_t* chr = CL_ActorGetChr(le);
51 if (!chr)
52 return;
53
54 const objDef_t* od = INVSH_GetItemByIDX(odIdx);
55 chr->RFmode.set(hand, fmIdx, od);
56
57 UI_ExecuteConfunc("reactionfire_updated");
58}
character_t * CL_ActorGetChr(const le_t *le)
Returns the character information for an actor in the teamlist.
Definition cl_actor.cpp:155
HUD related routines.
le_t * LE_Get(int entnum)
Searches all local entities for the one with the searched entnum.
#define LE_NotFoundError(entnum)
void set(const actorHands_t hand, const fireDefIndex_t fmIdx, const objDef_t *weapon)
Definition chr_shared.h:173
Primary header for client.
void CL_ActorReactionFireChange(const eventRegister_t *self, dbuffer *msg)
Network event function for reaction fire mode changes. Responsible for updating the HUD with the info...
const objDef_t * INVSH_GetItemByIDX(int index)
Returns the item that belongs to the given index or nullptr if the index is invalid.
actorHands_t
Definition inv_shared.h:626
void NET_ReadFormat(dbuffer *buf, const char *format,...)
The user-friendly version of NET_ReadFormat that reads variable arguments from a buffer according to ...
Definition netpack.cpp:533
Describes a character with all its attributes.
Definition chr_shared.h:388
FiremodeSettings RFmode
Definition chr_shared.h:416
Struct that defines one particular event with all its callbacks and data.
Definition e_main.h:42
const char * formatString
The format string that is used to write and parse this event.
Definition e_main.h:54
a local entity
Defines all attributes of objects used in the inventory.
Definition inv_shared.h:264
void UI_ExecuteConfunc(const char *fmt,...)
Executes confunc - just to identify those confuncs in the code - in this frame.
Definition ui_main.cpp:110