Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Release Forum » [CODE] SCAnnouncement class definition
[CODE] SCAnnouncement class definition [message #465569] Thu, 05 April 2012 08:52 Go to previous message
iRANian is currently offline  iRANian
Messages: 4299
Registered: April 2011
Karma:
General (4 Stars)
This is what the engine uses to send out radio commands to players after a player sends a radio command to the server. If an invalid player ID (e.g. ID = -1) is used, the radio command will be shown as if it were an announcement, which basically means that 'AnnouncementID' (an ID from strings.tdb) will be shown in a white colour and if it has a sound ID it will be played, the same as with normal radio commands, but with a white colour and with no player name prepended to it.

IconID needs to be between 0 or 1 and 30 or 31 or the radio command won't be sent.

PlayerType is the team of the player, this appears to be ignored.

AnnouncementType seems to be ignored too, no idea what it's for.

AnnouncementID is an ID from strings.tdb, it's the string ID to be displayed and if the strings.tdb ID has a sound ID attached it'll also play a sound (not for all strings, probably because the sound file is missing).

ID is the player ID of the player sending the message.

.h

class SCAnnouncement : public NetworkObjectClass
{
public:	

	int PlayerType;
	int ID;
	int AnnouncementID;
	int IconId;
	uint8 AnnouncementType;

	SCAnnouncement* Constructor();

	void Init(int PlayerType, int ID, int AnnouncementID, uint8 AnnouncementType, int IconId );
	void Act();	
};


.cpp (without the header #includes)

void* HookupAT3x(void* a, void* b, void* c, void* patch_start, void* patch_end, int (*version_selector)())
{
	return HookupAT3(a,b,c,patch_start,patch_end,version_selector);
}

RENEGADE_FUNCTION
uint Send_Object_Update(NetworkObjectClass* object, int remoteHostId)
AT2(0x00461820,0x004612F0);

RENEGADE_FUNCTION
SCAnnouncement* __thiscall  SCAnnouncement::Constructor() 
AT2(0x004B38B0, 0x004B38B0);

RENEGADE_FUNCTION
void SCAnnouncement::Init(int PlayerType, int ID, int AnnouncementID, uint8 AnnouncementType, int IconId )
AT2(0x004B3930, 0x004B3930);

RENEGADE_FUNCTION
void SCAnnouncement::Act()
AT2(0x004B3D10, 0x004B3D10);


Example usage:

Code emulating PlayerID sending the ALT+3 (move out) radio command:
			SCAnnouncement* RadioObj = (SCAnnouncement*)operator new(sizeof(SCAnnouncement));
			RadioObj = RadioObj->Constructor();
			RadioObj->Init(Get_Team(PlayerID), PlayerID, 8547, 1, 12);


Show a white coloured message "You have been banned from Westwood Online." for one player:
			SCAnnouncement* RadioObj = (SCAnnouncement*)operator new(sizeof(SCAnnouncement));
			RadioObj = RadioObj->Constructor();

			RadioObj->PlayerType = 0; // Doesn't seem to be checked
			RadioObj->ID = -1; // Invalid player ID, which will cause the radio command to be shown in white without a sender
			RadioObj->IconId = 12; // IconId is the same as for the ALT+3 ("Move out.") radio command.
			RadioObj->AnnouncementType = 1; // Doesn't seem to be used
			RadioObj->AnnouncementID = 9757; // strings.tdb ID for "You have been banned from Westwood Online."

			// Sends the radio command only to PlayerID.
			RadioObj->Set_Object_Dirty_Bits(PlayerID, NetworkObjectClass::BIT_CREATION); // Netcode stuff
			Send_Object_Update(RadioObj, PlayerID); // Send an object update for only this player

			RadioObj->Set_Delete_Pending();
			delete RadioObj;


Long time and well respected Renegade community member, programmer, modder and tester.

Scripts 4.0 private beta tester since May 2011.

My Renegade server plugins releases

[Updated on: Fri, 06 April 2012 05:37]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: [CODE] cScTextObj class definition
Next Topic: [Map]C&C_aLittleMapv2.1
Goto Forum:
  


Current Time: Mon Apr 29 06:40:35 MST 2024

Total time taken to generate the page: 0.00629 seconds