123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- //******************************************************************************************
- //
- // Radio.h -- File contains the Radio Definition
- //
- // MechCommander 2
- //
- //---------------------------------------------------------------------------//
- // Copyright (C) Microsoft Corporation. All rights reserved. //
- //===========================================================================//
- #ifndef RADIO_H
- #define RADIO_H
- //------------------------------------------------------------------------------------------
- // Include Files
- #ifndef MCLIB_H
- #include "mclib.h"
- #endif
- #ifndef DRADIO_H
- #include "dradio.h"
- #endif
- #ifndef DWARRIOR_H
- #include "dwarrior.h"
- #endif
- #ifndef DGAMEOBJ_H
- #include "dgameobj.h"
- #endif
- //------------------------------------------------------------------------------------------
- #define MAX_FRAGMENTS 16
- #define MAX_RADIOS 256
- struct RadioData
- {
- unsigned long msgId;
- unsigned long msgType;
- unsigned long noiseId;
- long numFragments;
- MemoryPtr data[MAX_FRAGMENTS];
- long dataSize[MAX_FRAGMENTS];
- MemoryPtr noise[MAX_FRAGMENTS];
- long noiseSize[MAX_FRAGMENTS];
- UserHeapPtr msgHeap;
- unsigned long turnQueued;
- byte priority;
- byte movieCode;
- float expirationDate;
- MechWarriorPtr pilot;
- };
- struct RadioMessageInfo
- {
- byte priority;
- float shelfLife;
- char movieCode;
- byte styleCount;
- byte styleChance[3];
- DWORD messageMapping;
- bool pilotIdentifiesSelf;
- bool kludgeStyle;
- };
- //------------------------------------------------------------------------------------------
- class Radio
- {
- //Data Members
- //-------------
- protected:
-
- MechWarriorPtr owner;
- bool enabled;
- bool ammoOutPlayed;
- long radioID;
- public:
- static PacketFilePtr noiseFile;
- static RadioPtr radioList[MAX_RADIOS]; //Warriors no longer delete their radios. We do when the
- //SoundSystem Shutdown occurs.
- static PacketFilePtr messagesFile[MAX_RADIOS]; //Do these when the shutdown occurs too to avoid leaks
-
- static bool messageInfoLoaded;
- static bool radioListGo;
- static long currentRadio;
- static UserHeapPtr radioHeap; //Only one Heap Per Game!!!
-
- //Member Functions
- //-----------------
- public:
-
- void * operator new (size_t mySize);
- void operator delete (void * us);
- void init (void)
- {
- enabled = TRUE;
- ammoOutPlayed = false;
- radioID = -1;
- }
- void destroy (void)
- {
- }
- Radio (void)
- {
- init();
- }
-
- ~Radio (void)
- {
- destroy();
- }
-
- long init (char *fileName, unsigned long heapSize, char *movie);
- void setOwner (MechWarriorPtr _owner)
- {
- owner = _owner;
- }
-
- long playMessage (RadioMessageType msgId);
- void cancelMessage (RadioMessageType msgId);
-
- void turnOn (void) {
- enabled = TRUE;
- }
- void turnOff (void) {
- enabled = FALSE;
- }
-
- long loadMessageInfo(void);
- void resetAmmoMessage (void)
- {
- ammoOutPlayed = false;
- }
- };
- //------------------------------------------------------------------------------------------
- #endif
|