Merge branch 'master' of github.com:Warzone2100/warzone2100
* 'master' of github.com:Warzone2100/warzone2100: Try to fix the cross compile. Fix releaseBranch script to handle netplay.cpp instead of netplay.c. Simplify targetting projectiles. Fix WZ_DECL_CONST -> WZ_DECL_PURE on src/vector.h. Clean up some weird invalid PROJECTILE * -> BASE_OBJECT * casts. Make structures rectangular instead of circular for the purposes of projectile collision detection. Remove SPACETIME C wrapper around Spacetime. Remove redundant memset()s in loadGame. Use default constructors instead of memset for W_INIT (widget init) derivatives. Fix game saving/loading. Reset constructor upgrade between games. Remove ORDER_LIST_MAX and the corresponding 10 order limit to droid order queues. Use --debug=memory to see sizeof(...) for the various object types.master
commit
012029622d
|
@ -78,9 +78,12 @@ DWORD GetModuleBase(DWORD dwAddress)
|
|||
#ifdef HAVE_BFD
|
||||
|
||||
#include <bfd.h>
|
||||
extern "C"
|
||||
{
|
||||
#include "include/demangle.h"
|
||||
#include "include/coff/internal.h"
|
||||
#include "include/libcoff.h"
|
||||
}
|
||||
|
||||
// Read in the symbol table.
|
||||
static bfd_boolean
|
||||
|
@ -593,20 +596,20 @@ BOOL WINAPI IntelStackWalk(
|
|||
StackFrame->AddrFrame.Offset = ContextRecord->Ebp;
|
||||
|
||||
StackFrame->AddrReturn.Mode = AddrModeFlat;
|
||||
if(!ReadMemoryRoutine((HANDLE)hProcess, (DWORD) (StackFrame->AddrFrame.Offset + sizeof(DWORD)), (void *)&StackFrame->AddrReturn.Offset, sizeof(DWORD), NULL))
|
||||
if(!ReadMemoryRoutine((HANDLE)hProcess, (void *) (StackFrame->AddrFrame.Offset + sizeof(DWORD)), (void *)&StackFrame->AddrReturn.Offset, sizeof(DWORD), NULL))
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
StackFrame->AddrPC.Offset = StackFrame->AddrReturn.Offset;
|
||||
//AddrStack = AddrFrame + 2*sizeof(DWORD);
|
||||
if(!ReadMemoryRoutine((HANDLE)hProcess, (DWORD) StackFrame->AddrFrame.Offset, (void *)&StackFrame->AddrFrame.Offset, sizeof(DWORD), NULL))
|
||||
if(!ReadMemoryRoutine((HANDLE)hProcess, (void *) StackFrame->AddrFrame.Offset, (void *)&StackFrame->AddrFrame.Offset, sizeof(DWORD), NULL))
|
||||
return FALSE;
|
||||
if(!ReadMemoryRoutine((HANDLE)hProcess, (DWORD) (StackFrame->AddrFrame.Offset + sizeof(DWORD)), (void *)&StackFrame->AddrReturn.Offset, sizeof(DWORD), NULL))
|
||||
if(!ReadMemoryRoutine((HANDLE)hProcess, (void *) (StackFrame->AddrFrame.Offset + sizeof(DWORD)), (void *)&StackFrame->AddrReturn.Offset, sizeof(DWORD), NULL))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
ReadMemoryRoutine((HANDLE)hProcess, (DWORD) (StackFrame->AddrFrame.Offset + 2*sizeof(DWORD)), (void *)StackFrame->Params, sizeof(StackFrame->Params), NULL);
|
||||
ReadMemoryRoutine((HANDLE)hProcess, (void *) (StackFrame->AddrFrame.Offset + 2*sizeof(DWORD)), (void *)StackFrame->Params, sizeof(StackFrame->Params), NULL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -70,61 +70,61 @@ struct Rotation
|
|||
typedef Vector3i Position; ///< Map position in world coordinates
|
||||
|
||||
// removeZ(3d_vector) -> 2d_vector
|
||||
static inline WZ_DECL_CONST Vector2i removeZ(Vector3i const &a) { return Vector2i(a.x, a.y); }
|
||||
static inline WZ_DECL_CONST Vector2f removeZ(Vector3f const &a) { return Vector2f(a.x, a.y); }
|
||||
static inline WZ_DECL_PURE Vector2i removeZ(Vector3i const &a) { return Vector2i(a.x, a.y); }
|
||||
static inline WZ_DECL_PURE Vector2f removeZ(Vector3f const &a) { return Vector2f(a.x, a.y); }
|
||||
|
||||
|
||||
// vector == vector -> bool
|
||||
static inline WZ_DECL_CONST bool operator ==(Vector2i const &a, Vector2i const &b) { return a.x == b.x && a.y == b.y; }
|
||||
static inline WZ_DECL_CONST bool operator ==(Vector2f const &a, Vector2f const &b) { return a.x == b.x && a.y == b.y; }
|
||||
static inline WZ_DECL_CONST bool operator ==(Vector3i const &a, Vector3i const &b) { return a.x == b.x && a.y == b.y && a.z == b.z; }
|
||||
static inline WZ_DECL_CONST bool operator ==(Vector3f const &a, Vector3f const &b) { return a.x == b.x && a.y == b.y && a.z == b.z; }
|
||||
static inline WZ_DECL_CONST bool operator ==(Rotation const &a, Rotation const &b) { return a.direction == b.direction && a.pitch == b.pitch && a.roll == b.roll; }
|
||||
static inline WZ_DECL_PURE bool operator ==(Vector2i const &a, Vector2i const &b) { return a.x == b.x && a.y == b.y; }
|
||||
static inline WZ_DECL_PURE bool operator ==(Vector2f const &a, Vector2f const &b) { return a.x == b.x && a.y == b.y; }
|
||||
static inline WZ_DECL_PURE bool operator ==(Vector3i const &a, Vector3i const &b) { return a.x == b.x && a.y == b.y && a.z == b.z; }
|
||||
static inline WZ_DECL_PURE bool operator ==(Vector3f const &a, Vector3f const &b) { return a.x == b.x && a.y == b.y && a.z == b.z; }
|
||||
static inline WZ_DECL_PURE bool operator ==(Rotation const &a, Rotation const &b) { return a.direction == b.direction && a.pitch == b.pitch && a.roll == b.roll; }
|
||||
|
||||
// vector != vector -> bool
|
||||
static inline WZ_DECL_CONST bool operator !=(Vector2i const &a, Vector2i const &b) { return a.x != b.x || a.y != b.y; }
|
||||
static inline WZ_DECL_CONST bool operator !=(Vector2f const &a, Vector2f const &b) { return a.x != b.x || a.y != b.y; }
|
||||
static inline WZ_DECL_CONST bool operator !=(Vector3i const &a, Vector3i const &b) { return a.x != b.x || a.y != b.y || a.z != b.z; }
|
||||
static inline WZ_DECL_CONST bool operator !=(Vector3f const &a, Vector3f const &b) { return a.x != b.x || a.y != b.y || a.z != b.z; }
|
||||
static inline WZ_DECL_CONST bool operator !=(Rotation const &a, Rotation const &b) { return a.direction != b.direction || a.pitch != b.pitch || a.roll != b.roll; }
|
||||
static inline WZ_DECL_PURE bool operator !=(Vector2i const &a, Vector2i const &b) { return a.x != b.x || a.y != b.y; }
|
||||
static inline WZ_DECL_PURE bool operator !=(Vector2f const &a, Vector2f const &b) { return a.x != b.x || a.y != b.y; }
|
||||
static inline WZ_DECL_PURE bool operator !=(Vector3i const &a, Vector3i const &b) { return a.x != b.x || a.y != b.y || a.z != b.z; }
|
||||
static inline WZ_DECL_PURE bool operator !=(Vector3f const &a, Vector3f const &b) { return a.x != b.x || a.y != b.y || a.z != b.z; }
|
||||
static inline WZ_DECL_PURE bool operator !=(Rotation const &a, Rotation const &b) { return a.direction != b.direction || a.pitch != b.pitch || a.roll != b.roll; }
|
||||
|
||||
// vector + vector -> vector
|
||||
static inline WZ_DECL_CONST Vector2i operator +(Vector2i const &a, Vector2i const &b) { return Vector2i(a.x + b.x, a.y + b.y); }
|
||||
static inline WZ_DECL_CONST Vector2f operator +(Vector2f const &a, Vector2f const &b) { return Vector2f(a.x + b.x, a.y + b.y); }
|
||||
static inline WZ_DECL_CONST Vector3i operator +(Vector3i const &a, Vector3i const &b) { return Vector3i(a.x + b.x, a.y + b.y, a.z + b.z); }
|
||||
static inline WZ_DECL_CONST Vector3f operator +(Vector3f const &a, Vector3f const &b) { return Vector3f(a.x + b.x, a.y + b.y, a.z + b.z); }
|
||||
//static inline WZ_DECL_CONST Rotation operator +(Rotation const &a, Rotation const &b) { return Rotation((int16_t)a.direction + (int16_t)b.direction, (int16_t)a.pitch + (int16_t)b.pitch, (int16_t)a.roll + (int16_t)b.roll); }
|
||||
static inline WZ_DECL_PURE Vector2i operator +(Vector2i const &a, Vector2i const &b) { return Vector2i(a.x + b.x, a.y + b.y); }
|
||||
static inline WZ_DECL_PURE Vector2f operator +(Vector2f const &a, Vector2f const &b) { return Vector2f(a.x + b.x, a.y + b.y); }
|
||||
static inline WZ_DECL_PURE Vector3i operator +(Vector3i const &a, Vector3i const &b) { return Vector3i(a.x + b.x, a.y + b.y, a.z + b.z); }
|
||||
static inline WZ_DECL_PURE Vector3f operator +(Vector3f const &a, Vector3f const &b) { return Vector3f(a.x + b.x, a.y + b.y, a.z + b.z); }
|
||||
//static inline WZ_DECL_PURE Rotation operator +(Rotation const &a, Rotation const &b) { return Rotation((int16_t)a.direction + (int16_t)b.direction, (int16_t)a.pitch + (int16_t)b.pitch, (int16_t)a.roll + (int16_t)b.roll); }
|
||||
|
||||
// vector - vector -> vector
|
||||
static inline WZ_DECL_CONST Vector2i operator -(Vector2i const &a, Vector2i const &b) { return Vector2i(a.x - b.x, a.y - b.y); }
|
||||
static inline WZ_DECL_CONST Vector2f operator -(Vector2f const &a, Vector2f const &b) { return Vector2f(a.x - b.x, a.y - b.y); }
|
||||
static inline WZ_DECL_CONST Vector3i operator -(Vector3i const &a, Vector3i const &b) { return Vector3i(a.x - b.x, a.y - b.y, a.z - b.z); }
|
||||
static inline WZ_DECL_CONST Vector3f operator -(Vector3f const &a, Vector3f const &b) { return Vector3f(a.x - b.x, a.y - b.y, a.z - b.z); }
|
||||
//static inline WZ_DECL_CONST Rotation operator -(Rotation const &a, Rotation const &b) { return Rotation((int16_t)a.direction - (int16_t)b.direction, (int16_t)a.pitch - (int16_t)b.pitch, (int16_t)a.roll - (int16_t)b.roll); }
|
||||
static inline WZ_DECL_PURE Vector2i operator -(Vector2i const &a, Vector2i const &b) { return Vector2i(a.x - b.x, a.y - b.y); }
|
||||
static inline WZ_DECL_PURE Vector2f operator -(Vector2f const &a, Vector2f const &b) { return Vector2f(a.x - b.x, a.y - b.y); }
|
||||
static inline WZ_DECL_PURE Vector3i operator -(Vector3i const &a, Vector3i const &b) { return Vector3i(a.x - b.x, a.y - b.y, a.z - b.z); }
|
||||
static inline WZ_DECL_PURE Vector3f operator -(Vector3f const &a, Vector3f const &b) { return Vector3f(a.x - b.x, a.y - b.y, a.z - b.z); }
|
||||
//static inline WZ_DECL_PURE Rotation operator -(Rotation const &a, Rotation const &b) { return Rotation((int16_t)a.direction - (int16_t)b.direction, (int16_t)a.pitch - (int16_t)b.pitch, (int16_t)a.roll - (int16_t)b.roll); }
|
||||
|
||||
// vector * scalar -> vector
|
||||
static inline WZ_DECL_CONST Vector2i operator *(Vector2i const &a, int s) { return Vector2i(a.x*s, a.y*s); }
|
||||
static inline WZ_DECL_CONST Vector2f operator *(Vector2f const &a, float s) { return Vector2f(a.x*s, a.y*s); }
|
||||
static inline WZ_DECL_CONST Vector3i operator *(Vector3i const &a, int s) { return Vector3i(a.x*s, a.y*s, a.z*s); }
|
||||
static inline WZ_DECL_CONST Vector3f operator *(Vector3f const &a, float s) { return Vector3f(a.x*s, a.y*s, a.z*s); }
|
||||
//static inline WZ_DECL_CONST Rotation operator *(Rotation const &a, int s) { return Rotation((int16_t)a.direction*s, (int16_t)a.pitch*s, (int16_t)a.roll*s); }
|
||||
static inline WZ_DECL_PURE Vector2i operator *(Vector2i const &a, int s) { return Vector2i(a.x*s, a.y*s); }
|
||||
static inline WZ_DECL_PURE Vector2f operator *(Vector2f const &a, float s) { return Vector2f(a.x*s, a.y*s); }
|
||||
static inline WZ_DECL_PURE Vector3i operator *(Vector3i const &a, int s) { return Vector3i(a.x*s, a.y*s, a.z*s); }
|
||||
static inline WZ_DECL_PURE Vector3f operator *(Vector3f const &a, float s) { return Vector3f(a.x*s, a.y*s, a.z*s); }
|
||||
//static inline WZ_DECL_PURE Rotation operator *(Rotation const &a, int s) { return Rotation((int16_t)a.direction*s, (int16_t)a.pitch*s, (int16_t)a.roll*s); }
|
||||
|
||||
// vector / scalar -> vector
|
||||
static inline WZ_DECL_CONST Vector2i operator /(Vector2i const &a, int s) { return Vector2i(a.x/s, a.y/s); }
|
||||
static inline WZ_DECL_CONST Vector2f operator /(Vector2f const &a, float s) { return Vector2f(a.x/s, a.y/s); }
|
||||
static inline WZ_DECL_CONST Vector3i operator /(Vector3i const &a, int s) { return Vector3i(a.x/s, a.y/s, a.z/s); }
|
||||
static inline WZ_DECL_CONST Vector3f operator /(Vector3f const &a, float s) { return Vector3f(a.x/s, a.y/s, a.z/s); }
|
||||
//static inline WZ_DECL_CONST Rotation operator /(Rotation const &a, int s) { return Rotation((int16_t)a.direction/s, (int16_t)a.pitch/s, (int16_t)a.roll/s); }
|
||||
static inline WZ_DECL_PURE Vector2i operator /(Vector2i const &a, int s) { return Vector2i(a.x/s, a.y/s); }
|
||||
static inline WZ_DECL_PURE Vector2f operator /(Vector2f const &a, float s) { return Vector2f(a.x/s, a.y/s); }
|
||||
static inline WZ_DECL_PURE Vector3i operator /(Vector3i const &a, int s) { return Vector3i(a.x/s, a.y/s, a.z/s); }
|
||||
static inline WZ_DECL_PURE Vector3f operator /(Vector3f const &a, float s) { return Vector3f(a.x/s, a.y/s, a.z/s); }
|
||||
//static inline WZ_DECL_PURE Rotation operator /(Rotation const &a, int s) { return Rotation((int16_t)a.direction/s, (int16_t)a.pitch/s, (int16_t)a.roll/s); }
|
||||
|
||||
// vector * vector -> scalar
|
||||
static inline WZ_DECL_CONST int operator *(Vector2i const &a, Vector2i const &b) { return a.x*b.x + a.y*b.y; }
|
||||
static inline WZ_DECL_CONST float operator *(Vector2f const &a, Vector2f const &b) { return a.x*b.x + a.y*b.y; }
|
||||
static inline WZ_DECL_CONST int operator *(Vector3i const &a, Vector3i const &b) { return a.x*b.x + a.y*b.y + a.z*b.z; }
|
||||
static inline WZ_DECL_CONST float operator *(Vector3f const &a, Vector3f const &b) { return a.x*b.x + a.y*b.y + a.z*b.z; }
|
||||
static inline WZ_DECL_PURE int operator *(Vector2i const &a, Vector2i const &b) { return a.x*b.x + a.y*b.y; }
|
||||
static inline WZ_DECL_PURE float operator *(Vector2f const &a, Vector2f const &b) { return a.x*b.x + a.y*b.y; }
|
||||
static inline WZ_DECL_PURE int operator *(Vector3i const &a, Vector3i const &b) { return a.x*b.x + a.y*b.y + a.z*b.z; }
|
||||
static inline WZ_DECL_PURE float operator *(Vector3f const &a, Vector3f const &b) { return a.x*b.x + a.y*b.y + a.z*b.z; }
|
||||
|
||||
// normalise(vector) -> scalar
|
||||
static inline WZ_DECL_CONST Vector2f normalise(Vector2f const &a) { float sq = a*a; if (sq == 0.0f) return Vector2f(0.0f, 0.0f); return a / sqrtf(sq); }
|
||||
static inline WZ_DECL_CONST Vector3f normalise(Vector3f const &a) { float sq = a*a; if (sq == 0.0f) return Vector3f(0.0f, 0.0f, 0.0f); return a / sqrtf(sq); }
|
||||
static inline WZ_DECL_PURE Vector2f normalise(Vector2f const &a) { float sq = a*a; if (sq == 0.0f) return Vector2f(0.0f, 0.0f); return a / sqrtf(sq); }
|
||||
static inline WZ_DECL_PURE Vector3f normalise(Vector3f const &a) { float sq = a*a; if (sq == 0.0f) return Vector3f(0.0f, 0.0f, 0.0f); return a / sqrtf(sq); }
|
||||
|
||||
// iSinCosR(angle, scalar) -> 2d_vector
|
||||
static inline WZ_DECL_PURE Vector2i iSinCosR(uint16_t a, int32_t r) { return Vector2i(iSinR(a, r), iCosR(a, r)); }
|
||||
|
@ -141,9 +141,14 @@ static inline WZ_DECL_PURE Vector3i swapYZ(Vector3i a) { return Vector3i(a.x, a.
|
|||
static inline WZ_DECL_PURE Vector3f swapYZ(Vector3f a) { return Vector3f(a.x, a.z, a.y); }
|
||||
|
||||
// vector × vector -> scalar
|
||||
static inline WZ_DECL_CONST Vector3i crossProduct(Vector3i const &a, Vector3i const &b) { return Vector3i(a.y*b.z - a.z*b.y, a.z*b.x - a.x*b.z, a.x*b.y - a.y*b.x); }
|
||||
static inline WZ_DECL_CONST Vector3f crossProduct(Vector3f const &a, Vector3f const &b) { return Vector3f(a.y*b.z - a.z*b.y, a.z*b.x - a.x*b.z, a.x*b.y - a.y*b.x); }
|
||||
static inline WZ_DECL_PURE Vector3i crossProduct(Vector3i const &a, Vector3i const &b) { return Vector3i(a.y*b.z - a.z*b.y, a.z*b.x - a.x*b.z, a.x*b.y - a.y*b.x); }
|
||||
static inline WZ_DECL_PURE Vector3f crossProduct(Vector3f const &a, Vector3f const &b) { return Vector3f(a.y*b.z - a.z*b.y, a.z*b.x - a.x*b.z, a.x*b.y - a.y*b.x); }
|
||||
|
||||
// vector += vector
|
||||
static inline Vector2i const &operator +=(Vector2i &a, Vector2i const &b) { return a = a + b; }
|
||||
static inline Vector2f const &operator +=(Vector2f &a, Vector2f const &b) { return a = a + b; }
|
||||
static inline Vector3i const &operator +=(Vector3i &a, Vector3i const &b) { return a = a + b; }
|
||||
static inline Vector3f const &operator +=(Vector3f &a, Vector3f const &b) { return a = a + b; }
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -164,7 +169,7 @@ static inline WZ_DECL_CONST Vector2i Vector2f_To2i(const Vector2f v)
|
|||
* \param degrees the amount of degrees to rotate in counterclockwise direction
|
||||
* \return Result
|
||||
*/
|
||||
static inline WZ_DECL_CONST Vector2f Vector2f_Rotate2f(Vector2f v, float degrees)
|
||||
static inline WZ_DECL_PURE Vector2f Vector2f_Rotate2f(Vector2f v, float degrees)
|
||||
{
|
||||
Vector2f result;
|
||||
int angle = (int)((degrees*65536 + 180)/360);
|
||||
|
|
|
@ -26,11 +26,12 @@
|
|||
|
||||
#include "lib/framework/vector.h"
|
||||
|
||||
void audio_GetObjectPos( void *psObj, SDWORD *piX, SDWORD *piY,
|
||||
SDWORD *piZ );
|
||||
struct SIMPLE_OBJECT;
|
||||
|
||||
void audio_GetObjectPos(SIMPLE_OBJECT *psObj, SDWORD *piX, SDWORD *piY, SDWORD *piZ);
|
||||
void audio_GetStaticPos( SDWORD iWorldX, SDWORD iWorldY,
|
||||
SDWORD *piX, SDWORD *piY, SDWORD *piZ );
|
||||
BOOL audio_ObjectDead( void * psObj );
|
||||
bool audio_ObjectDead(SIMPLE_OBJECT *psObj);
|
||||
Vector3f audio_GetPlayerPos(void);
|
||||
void audio_Get3DPlayerRotAboutVerticalAxis(float *angle);
|
||||
|
||||
|
|
|
@ -693,7 +693,7 @@ static BOOL audio_CheckSame3DTracksPlaying( SDWORD iTrack, SDWORD iX, SDWORD iY,
|
|||
// =======================================================================================================================
|
||||
// =======================================================================================================================
|
||||
//
|
||||
static BOOL audio_Play3DTrack( SDWORD iX, SDWORD iY, SDWORD iZ, int iTrack, void *psObj, AUDIO_CALLBACK pUserCallback )
|
||||
static BOOL audio_Play3DTrack( SDWORD iX, SDWORD iY, SDWORD iZ, int iTrack, SIMPLE_OBJECT *psObj, AUDIO_CALLBACK pUserCallback )
|
||||
{
|
||||
//~~~~~~~~~~~~~~~~~~~~~~
|
||||
AUDIO_SAMPLE *psSample;
|
||||
|
@ -802,7 +802,7 @@ BOOL audio_PlayStaticTrack( SDWORD iMapX, SDWORD iMapY, int iTrack )
|
|||
// =======================================================================================================================
|
||||
// =======================================================================================================================
|
||||
//
|
||||
BOOL audio_PlayObjStaticTrack( void *psObj, int iTrack )
|
||||
bool audio_PlayObjStaticTrack(SIMPLE_OBJECT *psObj, int iTrack )
|
||||
{
|
||||
//~~~~~~~~~~~~~~~
|
||||
SDWORD iX, iY, iZ;
|
||||
|
@ -822,7 +822,7 @@ BOOL audio_PlayObjStaticTrack( void *psObj, int iTrack )
|
|||
// =======================================================================================================================
|
||||
// =======================================================================================================================
|
||||
//
|
||||
BOOL audio_PlayObjStaticTrackCallback( void *psObj, int iTrack, AUDIO_CALLBACK pUserCallback )
|
||||
bool audio_PlayObjStaticTrackCallback(SIMPLE_OBJECT *psObj, int iTrack, AUDIO_CALLBACK pUserCallback )
|
||||
{
|
||||
//~~~~~~~~~~~~~~~
|
||||
SDWORD iX, iY, iZ;
|
||||
|
@ -842,7 +842,7 @@ BOOL audio_PlayObjStaticTrackCallback( void *psObj, int iTrack, AUDIO_CALLBACK p
|
|||
// =======================================================================================================================
|
||||
// =======================================================================================================================
|
||||
//
|
||||
BOOL audio_PlayObjDynamicTrack( void *psObj, int iTrack, AUDIO_CALLBACK pUserCallback )
|
||||
bool audio_PlayObjDynamicTrack(SIMPLE_OBJECT *psObj, int iTrack, AUDIO_CALLBACK pUserCallback )
|
||||
{
|
||||
//~~~~~~~~~~~~~~~
|
||||
SDWORD iX, iY, iZ;
|
||||
|
@ -911,7 +911,7 @@ AUDIO_STREAM* audio_PlayStream(const char* fileName, float volume, void (*onFini
|
|||
// =======================================================================================================================
|
||||
// =======================================================================================================================
|
||||
//
|
||||
void audio_StopObjTrack( void *psObj, int iTrack )
|
||||
void audio_StopObjTrack(SIMPLE_OBJECT *psObj, int iTrack)
|
||||
{
|
||||
//~~~~~~~~~~~~~~~~~~~~~~
|
||||
AUDIO_SAMPLE *psSample;
|
||||
|
@ -1115,7 +1115,7 @@ SDWORD audio_GetTrackID( const char *fileName )
|
|||
* \param psObj pointer to the object for which we must destroy all of its
|
||||
* outstanding audio samples.
|
||||
*/
|
||||
void audio_RemoveObj(const void* psObj)
|
||||
void audio_RemoveObj(SIMPLE_OBJECT const *psObj)
|
||||
{
|
||||
unsigned int count = 0;
|
||||
|
||||
|
|
|
@ -32,14 +32,10 @@ extern BOOL audio_LoadTrackFromFile( char szFileName[] );
|
|||
extern unsigned int audio_SetTrackVals(const char* fileName, BOOL loop, unsigned int volume, unsigned int audibleRadius);
|
||||
|
||||
extern BOOL audio_PlayStaticTrack( SDWORD iX, SDWORD iY, int iTrack );
|
||||
extern BOOL audio_PlayObjStaticTrack( void * psObj, int iTrack );
|
||||
extern BOOL audio_PlayObjStaticTrackCallback( void * psObj, int iTrack,
|
||||
AUDIO_CALLBACK pUserCallback );
|
||||
extern BOOL audio_PlayObjDynamicTrack( void * psObj, int iTrack,
|
||||
AUDIO_CALLBACK pUserCallback );
|
||||
extern BOOL audio_PlayClusterDynamicTrack( void * psClusterObj,
|
||||
int iTrack, AUDIO_CALLBACK pUserCallback );
|
||||
extern void audio_StopObjTrack( void * psObj, int iTrack );
|
||||
bool audio_PlayObjStaticTrack(SIMPLE_OBJECT *psObj, int iTrack);
|
||||
bool audio_PlayObjStaticTrackCallback(SIMPLE_OBJECT *psObj, int iTrack, AUDIO_CALLBACK pUserCallback);
|
||||
bool audio_PlayObjDynamicTrack(SIMPLE_OBJECT *psObj, int iTrack, AUDIO_CALLBACK pUserCallback );
|
||||
void audio_StopObjTrack(SIMPLE_OBJECT *psObj, int iTrack);
|
||||
extern void audio_PlayTrack( int iTrack );
|
||||
extern void audio_PlayCallbackTrack( int iTrack,
|
||||
AUDIO_CALLBACK pUserCallback );
|
||||
|
@ -61,7 +57,7 @@ extern void audio_ResumeAll( void );
|
|||
extern void audio_StopAll( void );
|
||||
|
||||
extern SDWORD audio_GetTrackID( const char *fileName );
|
||||
extern void audio_RemoveObj(const void* psObj);
|
||||
void audio_RemoveObj(SIMPLE_OBJECT const *psObj);
|
||||
extern unsigned int audio_GetSampleQueueCount(void);
|
||||
extern unsigned int audio_GetSampleListCount(void);
|
||||
extern unsigned int sound_GetActiveSamplesCount(void);
|
||||
|
|
|
@ -48,6 +48,8 @@ typedef struct __audio_stream AUDIO_STREAM;
|
|||
|
||||
/* structs */
|
||||
|
||||
struct SIMPLE_OBJECT;
|
||||
|
||||
typedef struct AUDIO_SAMPLE
|
||||
{
|
||||
SDWORD iTrack; // ID number identifying a specific sound; currently (r1182) mapped in audio_id.c
|
||||
|
@ -63,7 +65,7 @@ typedef struct AUDIO_SAMPLE
|
|||
float fVol; // computed volume of sample
|
||||
BOOL bFinishedPlaying;
|
||||
AUDIO_CALLBACK pCallback;
|
||||
void *psObj;
|
||||
SIMPLE_OBJECT * psObj;
|
||||
struct AUDIO_SAMPLE *psPrev;
|
||||
struct AUDIO_SAMPLE *psNext;
|
||||
} AUDIO_SAMPLE;
|
||||
|
|
|
@ -30,6 +30,21 @@
|
|||
#include "lib/ivis_common/pieblitfunc.h"
|
||||
#include "lib/ivis_common/piepalette.h"
|
||||
|
||||
W_BARINIT::W_BARINIT()
|
||||
: orientation(WBAR_LEFT)
|
||||
, size(0)
|
||||
, minorSize(0)
|
||||
, iRange(100)
|
||||
, denominator(1)
|
||||
, precision(0)
|
||||
//sCol
|
||||
//sMinorCol
|
||||
, pTip(NULL)
|
||||
{
|
||||
sCol.rgba = 0;
|
||||
sMinorCol.rgba = 0;
|
||||
}
|
||||
|
||||
W_BARGRAPH::W_BARGRAPH(W_BARINIT const *init)
|
||||
: WIDGET(init, WIDG_BARGRAPH)
|
||||
, barPos(init->orientation)
|
||||
|
|
|
@ -30,7 +30,7 @@ struct W_BARGRAPH : public WIDGET
|
|||
{
|
||||
W_BARGRAPH(W_BARINIT const *init);
|
||||
|
||||
UWORD barPos; // Orientation of the bar on the widget
|
||||
WBAR_ORIENTATION barPos; // Orientation of the bar on the widget
|
||||
UWORD majorSize; // Percentage of the main bar that is filled
|
||||
UWORD minorSize; // Percentage of the minor bar if there is one
|
||||
UWORD iRange; // Maximum range
|
||||
|
|
|
@ -38,6 +38,12 @@ BOOL buttonStartUp(void)
|
|||
return true;
|
||||
}
|
||||
|
||||
W_BUTINIT::W_BUTINIT()
|
||||
: pText(NULL)
|
||||
, pTip(NULL)
|
||||
, FontID(font_regular)
|
||||
{}
|
||||
|
||||
W_BUTTON::W_BUTTON(W_BUTINIT const *init)
|
||||
: WIDGET(init, WIDG_BUTTON)
|
||||
, pText(init->pText)
|
||||
|
|
|
@ -53,6 +53,13 @@
|
|||
#define WEDB_CHARJUMP 6
|
||||
|
||||
|
||||
W_EDBINIT::W_EDBINIT()
|
||||
: pText(NULL)
|
||||
, FontID(font_regular)
|
||||
, pBoxDisplay(NULL)
|
||||
, pFontDisplay(NULL)
|
||||
{}
|
||||
|
||||
W_EDITBOX::W_EDITBOX(W_EDBINIT const *init)
|
||||
: WIDGET(init, WIDG_EDITBOX)
|
||||
, FontID(init->FontID)
|
||||
|
|
|
@ -46,6 +46,33 @@ struct TAB_POS
|
|||
SDWORD TabMultiplier; //Added to keep track of tab scroll
|
||||
};
|
||||
|
||||
W_FORMINIT::W_FORMINIT()
|
||||
: disableChildren(false)
|
||||
, majorPos(0), minorPos(0)
|
||||
, majorSize(0), minorSize(0)
|
||||
, majorOffset(0), minorOffset(0)
|
||||
, tabVertOffset(0)
|
||||
, tabHorzOffset(0)
|
||||
, tabMajorThickness(0)
|
||||
, tabMinorThickness(0)
|
||||
, tabMajorGap(0)
|
||||
, tabMinorGap(0)
|
||||
, numStats(0)
|
||||
, numButtons(0)
|
||||
, numMajor(0)
|
||||
// aNumMinors
|
||||
, TabMultiplier(0)
|
||||
, pTip(NULL)
|
||||
// apMajorTips
|
||||
// apMinorTips
|
||||
, pTabDisplay(NULL)
|
||||
, pFormDisplay(NULL)
|
||||
{
|
||||
memset(aNumMinors, 0, sizeof(aNumMinors));
|
||||
memset(apMajorTips, 0, sizeof(apMajorTips));
|
||||
memset(apMinorTips, 0, sizeof(apMinorTips));
|
||||
}
|
||||
|
||||
W_FORM::W_FORM(W_FORMINIT const *init)
|
||||
: WIDGET(init, WIDG_FORM)
|
||||
, disableChildren(init->disableChildren)
|
||||
|
|
|
@ -30,6 +30,12 @@
|
|||
// FIXME Direct iVis implementation include!
|
||||
#include "lib/ivis_common/textdraw.h"
|
||||
|
||||
W_LABINIT::W_LABINIT()
|
||||
: pText(NULL)
|
||||
, pTip(NULL)
|
||||
, FontID(font_regular)
|
||||
{}
|
||||
|
||||
W_LABEL::W_LABEL(W_LABINIT const *init)
|
||||
: WIDGET(init, WIDG_LABEL)
|
||||
, FontID(init->FontID)
|
||||
|
|
|
@ -34,6 +34,14 @@ void sliderEnableDrag(BOOL Enable)
|
|||
DragEnabled = Enable;
|
||||
}
|
||||
|
||||
W_SLDINIT::W_SLDINIT()
|
||||
: orientation(WSLD_LEFT)
|
||||
, numStops(0)
|
||||
, barSize(0)
|
||||
, pos(0)
|
||||
, pTip(NULL)
|
||||
{}
|
||||
|
||||
W_SLIDER::W_SLIDER(W_SLDINIT const *init)
|
||||
: WIDGET(init, WIDG_SLIDER)
|
||||
, orientation(init->orientation)
|
||||
|
|
|
@ -40,7 +40,7 @@ struct W_SLIDER : public WIDGET
|
|||
|
||||
void clicked(W_CONTEXT *context, WIDGET_KEY) { sliderClicked(this, context); }
|
||||
|
||||
UWORD orientation; // The orientation of the slider
|
||||
WSLD_ORIENTATION orientation; // The orientation of the slider
|
||||
UWORD numStops; // Number of stop positions on the slider
|
||||
UWORD barSize; // Thickness of slider bar
|
||||
UWORD pos; // Current stop position of the slider
|
||||
|
|
|
@ -82,6 +82,19 @@ void widgShutDown(void)
|
|||
}
|
||||
|
||||
|
||||
W_INIT::W_INIT()
|
||||
: formID(0)
|
||||
, majorID(0), minorID(0)
|
||||
, id(0)
|
||||
, style(0)
|
||||
, x(0), y(0)
|
||||
, width(0), height(0)
|
||||
, pDisplay(NULL)
|
||||
, pCallback(NULL)
|
||||
, pUserData(NULL)
|
||||
, UserData(0)
|
||||
{}
|
||||
|
||||
WIDGET::WIDGET(W_INIT const *init, WIDGET_TYPE type)
|
||||
: formID(init->formID)
|
||||
, id(init->id)
|
||||
|
@ -113,9 +126,6 @@ void CheckpsMouseOverWidget( void *psWidget )
|
|||
/* Create an empty widget screen */
|
||||
W_SCREEN* widgCreateScreen()
|
||||
{
|
||||
W_FORM *psForm;
|
||||
W_FORMINIT sInit;
|
||||
|
||||
W_SCREEN *psScreen = new W_SCREEN;
|
||||
if (psScreen == NULL)
|
||||
{
|
||||
|
@ -124,7 +134,7 @@ W_SCREEN* widgCreateScreen()
|
|||
return NULL;
|
||||
}
|
||||
|
||||
memset(&sInit, 0, sizeof(W_FORMINIT));
|
||||
W_FORMINIT sInit;
|
||||
sInit.id = 0;
|
||||
sInit.style = WFORM_PLAIN | WFORM_INVISIBLE;
|
||||
sInit.x = 0;
|
||||
|
@ -132,7 +142,7 @@ W_SCREEN* widgCreateScreen()
|
|||
sInit.width = (UWORD)(screenWidth - 1);
|
||||
sInit.height = (UWORD)(screenHeight - 1);
|
||||
|
||||
psForm = formCreate(&sInit);
|
||||
W_FORM *psForm = formCreate(&sInit);
|
||||
if (psForm == NULL)
|
||||
{
|
||||
delete psScreen;
|
||||
|
|
|
@ -100,6 +100,8 @@
|
|||
/** The basic initialisation structure */
|
||||
struct W_INIT
|
||||
{
|
||||
W_INIT();
|
||||
|
||||
UDWORD formID; ///< ID number of form to put widget on. ID == 0 specifies the default form for the screen
|
||||
UWORD majorID, minorID; ///< Which major and minor tab to put the widget on for a tabbed form
|
||||
UDWORD id; ///< Unique id number (chosen by user)
|
||||
|
@ -147,8 +149,10 @@ typedef void (*FONT_DISPLAY)(UDWORD x, UDWORD y, char *String);
|
|||
/** Form initialisation structure */
|
||||
struct W_FORMINIT : public W_INIT
|
||||
{
|
||||
W_FORMINIT();
|
||||
|
||||
/* Data for a tabbed form */
|
||||
BOOL disableChildren;
|
||||
bool disableChildren;
|
||||
UWORD majorPos, minorPos; // Position of the tabs on the form
|
||||
UWORD majorSize, minorSize; // Size of the tabs (in pixels)
|
||||
SWORD majorOffset, minorOffset; // Tab start offset.
|
||||
|
@ -173,6 +177,8 @@ struct W_FORMINIT : public W_INIT
|
|||
/** Label initialisation structure */
|
||||
struct W_LABINIT : public W_INIT
|
||||
{
|
||||
W_LABINIT();
|
||||
|
||||
const char *pText; ///< label text
|
||||
const char *pTip; ///< Tool tip for the label.
|
||||
enum iV_fonts FontID; ///< ID of the IVIS font to use for this widget.
|
||||
|
@ -181,6 +187,8 @@ struct W_LABINIT : public W_INIT
|
|||
/** Button initialisation structure */
|
||||
struct W_BUTINIT : public W_INIT
|
||||
{
|
||||
W_BUTINIT();
|
||||
|
||||
const char *pText; ///< Button text
|
||||
const char *pTip; ///< Tool tip text
|
||||
enum iV_fonts FontID; //< ID of the IVIS font to use for this widget.
|
||||
|
@ -189,6 +197,8 @@ struct W_BUTINIT : public W_INIT
|
|||
/** Edit box initialisation structure */
|
||||
struct W_EDBINIT : public W_INIT
|
||||
{
|
||||
W_EDBINIT();
|
||||
|
||||
const char *pText; ///< initial contents of the edit box
|
||||
enum iV_fonts FontID; ///< ID of the IVIS font to use for this widget.
|
||||
WIDGET_DISPLAY pBoxDisplay; ///< Optional callback to display the form.
|
||||
|
@ -196,15 +206,20 @@ struct W_EDBINIT : public W_INIT
|
|||
};
|
||||
|
||||
/* Orientation flags for the bar graph */
|
||||
#define WBAR_LEFT 0x0001 ///< Bar graph fills from left to right
|
||||
#define WBAR_RIGHT 0x0002 ///< Bar graph fills from right to left
|
||||
#define WBAR_TOP 0x0003 ///< Bar graph fills from top to bottom
|
||||
#define WBAR_BOTTOM 0x0004 ///< Bar graph fills from bottom to top
|
||||
enum WBAR_ORIENTATION
|
||||
{
|
||||
WBAR_LEFT = 1, ///< Bar graph fills from left to right
|
||||
WBAR_RIGHT, ///< Bar graph fills from right to left
|
||||
WBAR_TOP, ///< Bar graph fills from top to bottom
|
||||
WBAR_BOTTOM, ///< Bar graph fills from bottom to top
|
||||
};
|
||||
|
||||
/** Bar Graph initialisation structure */
|
||||
struct W_BARINIT : public W_INIT
|
||||
{
|
||||
UWORD orientation; ///< Orientation of the bar on the widget
|
||||
W_BARINIT();
|
||||
|
||||
WBAR_ORIENTATION orientation; ///< Orientation of the bar on the widget
|
||||
UWORD size; ///< Initial percentage of the graph that is filled
|
||||
UWORD minorSize; ///< Percentage of second bar graph if there is one
|
||||
UWORD iRange; ///< Maximum range
|
||||
|
@ -217,15 +232,20 @@ struct W_BARINIT : public W_INIT
|
|||
|
||||
|
||||
/* Orientation of the slider */
|
||||
#define WSLD_LEFT 0x0001 ///< Slider is horizontal and starts at left
|
||||
#define WSLD_RIGHT 0x0002 ///< Slider is horizontal and starts at the right
|
||||
#define WSLD_TOP 0x0003 ///< Slider is vertical and starts at the top
|
||||
#define WSLD_BOTTOM 0x0004 ///< Slider is vertical and starts at the bottom
|
||||
enum WSLD_ORIENTATION
|
||||
{
|
||||
WSLD_LEFT = 1, ///< Slider is horizontal and starts at left
|
||||
WSLD_RIGHT, ///< Slider is horizontal and starts at the right
|
||||
WSLD_TOP, ///< Slider is vertical and starts at the top
|
||||
WSLD_BOTTOM, ///< Slider is vertical and starts at the bottom
|
||||
};
|
||||
|
||||
/** Slider initialisation structure */
|
||||
struct W_SLDINIT : public W_INIT
|
||||
{
|
||||
UWORD orientation; ///< Orientation of the slider
|
||||
W_SLDINIT();
|
||||
|
||||
WSLD_ORIENTATION orientation; ///< Orientation of the slider
|
||||
UWORD numStops; ///< Number of stops on the slider
|
||||
UWORD barSize; ///< Size of the bar
|
||||
UWORD pos; ///< Initial position of the slider bar
|
||||
|
|
|
@ -79,7 +79,7 @@ sed -i 's/\(AC_INIT(\[Warzone 2100\],\[\)'"${BASE}"'\(\],\[http:\/\/wz2100.net\/
|
|||
' "${GITROOT}"configure.ac
|
||||
sed -i 's/\(char VersionString\[VersionStringSize\] = "\).*\(";\)/\1'"${FULLVERSTR}"'\2/;
|
||||
s/\(static int NETCODE_VERSION_MINOR = \)[0-9]*\(;\)/\1'"${DATENUM}"'\2/
|
||||
' "${GITROOT}"lib/netplay/netplay.c
|
||||
' "${GITROOT}"lib/netplay/netplay.c*
|
||||
sed -i 's/\(VALUE "FileVersion", "\)'"${BASE}"'\("\)/\1'"${FULLVERSTR}"'\2/;
|
||||
s/\(VALUE "ProductVersion", "\)'"${BASE}"'\("\)/\1'"${FULLVERSTR}"'\2/;
|
||||
' "${GITROOT}"win32/warzone2100.rc "${GITROOT}"win32/warzone2100.vs2k5.rc "${GITROOT}"win32/warzone2100.vs2k8.rc
|
||||
|
|
18
src/aud.cpp
18
src/aud.cpp
|
@ -30,10 +30,8 @@
|
|||
#include "display3d.h"
|
||||
#include "map.h"
|
||||
|
||||
BOOL audio_ObjectDead(void * psObj)
|
||||
bool audio_ObjectDead(SIMPLE_OBJECT *psSimpleObj)
|
||||
{
|
||||
SIMPLE_OBJECT * const psSimpleObj = (SIMPLE_OBJECT *) psObj;
|
||||
|
||||
/* check is valid simple object pointer */
|
||||
if (psSimpleObj == NULL)
|
||||
{
|
||||
|
@ -42,18 +40,14 @@ BOOL audio_ObjectDead(void * psObj)
|
|||
}
|
||||
|
||||
/* check projectiles */
|
||||
if (psSimpleObj->type == OBJ_PROJECTILE)
|
||||
if (isProjectile(psSimpleObj))
|
||||
{
|
||||
PROJECTILE * const psProj = (PROJECTILE *) psSimpleObj;
|
||||
|
||||
return (psProj->state == PROJ_POSTIMPACT);
|
||||
return castProjectile(psSimpleObj)->state == PROJ_POSTIMPACT;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* check base object */
|
||||
BASE_OBJECT *psBaseObj = (BASE_OBJECT *) psObj;
|
||||
|
||||
return psBaseObj->died;
|
||||
return psSimpleObj->died;
|
||||
}
|
||||
}
|
||||
// @FIXME we don't need to do this, since we are not using qsound.
|
||||
|
@ -95,10 +89,8 @@ void audio_GetStaticPos(SDWORD iWorldX, SDWORD iWorldY, SDWORD *piX, SDWORD *piY
|
|||
}
|
||||
|
||||
// @FIXME we don't need to do this, since we are not using qsound.
|
||||
void audio_GetObjectPos(void *psObj, SDWORD *piX, SDWORD *piY, SDWORD *piZ)
|
||||
void audio_GetObjectPos(SIMPLE_OBJECT *psBaseObj, SDWORD *piX, SDWORD *piY, SDWORD *piZ)
|
||||
{
|
||||
BASE_OBJECT *psBaseObj = (BASE_OBJECT *) psObj;
|
||||
|
||||
/* check is valid pointer */
|
||||
ASSERT( psBaseObj != NULL,
|
||||
"audio_GetObjectPos: game object pointer invalid" );
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
//the died flag for a droid is set to this when it gets added to the non-current list
|
||||
#define NOT_CURRENT_LIST 1
|
||||
|
||||
typedef enum _object_type
|
||||
enum OBJECT_TYPE
|
||||
{
|
||||
OBJ_DROID, ///< Droids
|
||||
OBJ_STRUCTURE, ///< All Buildings
|
||||
|
@ -39,7 +39,7 @@ typedef enum _object_type
|
|||
OBJ_PROJECTILE, ///< Comes out of guns, stupid :-)
|
||||
OBJ_TARGET, ///< for the camera tracking
|
||||
OBJ_NUM_TYPES, ///< number of object types - MUST BE LAST
|
||||
} OBJECT_TYPE;
|
||||
};
|
||||
|
||||
typedef struct _tilePos
|
||||
{
|
||||
|
@ -115,11 +115,11 @@ struct BASE_OBJECT : public SIMPLE_OBJECT
|
|||
NEXTOBJ psNextFunc; ///< Pointer to the next object in the function list
|
||||
};
|
||||
|
||||
/// Space-time coordinate.
|
||||
struct SpaceTime
|
||||
/// Space-time coordinate, including orientation.
|
||||
struct Spacetime
|
||||
{
|
||||
SpaceTime() {}
|
||||
SpaceTime(Position pos_, Rotation rot_, uint32_t time_) : time(time_), pos(pos_), rot(rot_) {}
|
||||
Spacetime() {}
|
||||
Spacetime(Position pos_, Rotation rot_, uint32_t time_) : time(time_), pos(pos_), rot(rot_) {}
|
||||
|
||||
uint32_t time; ///< Game time
|
||||
|
||||
|
@ -127,15 +127,8 @@ struct SpaceTime
|
|||
Rotation rot; ///< Rotation of the object
|
||||
};
|
||||
|
||||
typedef SpaceTime SPACETIME;
|
||||
|
||||
static inline SpaceTime constructSpacetime(Position pos, Rotation rot, uint32_t time)
|
||||
{
|
||||
return SpaceTime(pos, rot, time);
|
||||
}
|
||||
|
||||
#define GET_SPACETIME(psObj) constructSpacetime(psObj->pos, psObj->rot, psObj->time)
|
||||
#define SET_SPACETIME(psObj, st) do { psObj->pos = st.pos; psObj->rot = st.rot; psObj->time = st.time; } while(0)
|
||||
static inline Spacetime getSpacetime(SIMPLE_OBJECT const *psObj) { return Spacetime(psObj->pos, psObj->rot, psObj->time); }
|
||||
static inline void setSpacetime(SIMPLE_OBJECT *psObj, Spacetime const &st) { psObj->pos = st.pos; psObj->rot = st.rot; psObj->time = st.time; }
|
||||
|
||||
static inline bool isDead(const BASE_OBJECT* psObj)
|
||||
{
|
||||
|
@ -150,6 +143,14 @@ static inline int objPosDiffSq(Position pos1, Position pos2)
|
|||
return (xdiff * xdiff + ydiff * ydiff);
|
||||
}
|
||||
|
||||
|
||||
// True iff object is a droid, structure or feature (not a projectile). Will incorrectly return true if passed a nonsense object of type OBJ_TARGET or OBJ_NUM_TYPES.
|
||||
static inline bool isBaseObject(SIMPLE_OBJECT const *psObject) { return psObject->type != OBJ_PROJECTILE; }
|
||||
// Returns BASE_OBJECT * if base_object or NULL if not.
|
||||
static inline BASE_OBJECT *castBaseObject(SIMPLE_OBJECT *psObject) { return isBaseObject(psObject)? (BASE_OBJECT *)psObject : (BASE_OBJECT *)NULL; }
|
||||
// Returns BASE_OBJECT const * if base_object or NULL if not.
|
||||
static inline BASE_OBJECT const *castBaseObject(SIMPLE_OBJECT const *psObject) { return isBaseObject(psObject)? (BASE_OBJECT const *)psObject : (BASE_OBJECT const *)NULL; }
|
||||
|
||||
// Must be #included __AFTER__ the definition of BASE_OBJECT
|
||||
#include "baseobject.h"
|
||||
|
||||
|
|
|
@ -46,21 +46,21 @@ Rotation interpolateRot(Rotation v1, Rotation v2, uint32_t t1, uint32_t t2, uint
|
|||
);
|
||||
}
|
||||
|
||||
static SPACETIME interpolateSpacetime(SPACETIME st1, SPACETIME st2, uint32_t t)
|
||||
static Spacetime interpolateSpacetime(Spacetime st1, Spacetime st2, uint32_t t)
|
||||
{
|
||||
return constructSpacetime(interpolatePos(st1.pos, st2.pos, st1.time, st2.time, t), interpolateRot(st1.rot, st2.rot, st1.time, st2.time, t), t);
|
||||
return Spacetime(interpolatePos(st1.pos, st2.pos, st1.time, st2.time, t), interpolateRot(st1.rot, st2.rot, st1.time, st2.time, t), t);
|
||||
}
|
||||
|
||||
SPACETIME interpolateObjectSpacetime(const SIMPLE_OBJECT *obj, uint32_t t)
|
||||
Spacetime interpolateObjectSpacetime(const SIMPLE_OBJECT *obj, uint32_t t)
|
||||
{
|
||||
switch (obj->type)
|
||||
{
|
||||
default:
|
||||
return GET_SPACETIME(obj);
|
||||
return getSpacetime(obj);
|
||||
case OBJ_DROID:
|
||||
return interpolateSpacetime(((DROID *)obj)->prevSpacetime, GET_SPACETIME(obj), t);
|
||||
return interpolateSpacetime(castDroid(obj)->prevSpacetime, getSpacetime(obj), t);
|
||||
case OBJ_PROJECTILE:
|
||||
return interpolateSpacetime(((PROJECTILE *)obj)->prevSpacetime, GET_SPACETIME(obj), t);
|
||||
return interpolateSpacetime(castProjectile(obj)->prevSpacetime, getSpacetime(obj), t);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,8 +82,13 @@ SIMPLE_OBJECT::~SIMPLE_OBJECT()
|
|||
|
||||
BASE_OBJECT::BASE_OBJECT(OBJECT_TYPE type, uint32_t id, unsigned player)
|
||||
: SIMPLE_OBJECT(type, id, player)
|
||||
, selected(false)
|
||||
, cluster(0)
|
||||
, numWatchedTiles(0)
|
||||
, lastEmission(0)
|
||||
, lastHitWeapon(WSC_NUM_WEAPON_SUBCLASSES) // No such weapon.
|
||||
, timeLastHit(UDWORD_MAX)
|
||||
, bTargetted(false)
|
||||
, watchedTiles(NULL)
|
||||
{}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ static const unsigned int max_check_object_recursion = 4;
|
|||
/// Get interpolated direction at time t.
|
||||
Rotation interpolateRot(Rotation v1, Rotation v2, uint32_t t1, uint32_t t2, uint32_t t);
|
||||
/// Get interpolated object spacetime at time t.
|
||||
SPACETIME interpolateObjectSpacetime(const SIMPLE_OBJECT *obj, uint32_t t);
|
||||
Spacetime interpolateObjectSpacetime(const SIMPLE_OBJECT *obj, uint32_t t);
|
||||
|
||||
void checkObject(const BASE_OBJECT* psObject, const char * const location_description, const char * function, const int recurse);
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ static SDWORD bucketCalculateZ(RENDER_TYPE objectType, void* pObject)
|
|||
SIMPLE_OBJECT *psSimpObj;
|
||||
COMPONENT_OBJECT *psCompObj;
|
||||
const iIMDShape *pImd;
|
||||
SPACETIME spacetime;
|
||||
Spacetime spacetime;
|
||||
|
||||
pie_MatBegin();
|
||||
|
||||
|
|
|
@ -121,9 +121,6 @@ bool addChallenges()
|
|||
{
|
||||
char sPath[PATH_MAX];
|
||||
const char *sSearchPath = "challenges";
|
||||
W_FORMINIT sFormInit;
|
||||
W_BUTINIT sButInit;
|
||||
W_LABINIT sLabInit;
|
||||
UDWORD slotCount;
|
||||
static char sSlotCaps[totalslots][totalslotspace];
|
||||
static char sSlotTips[totalslots][totalslotspace];
|
||||
|
@ -136,7 +133,7 @@ bool addChallenges()
|
|||
widgSetTipFont(psRequestScreen, font_regular);
|
||||
|
||||
/* add a form to place the tabbed form on */
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
W_FORMINIT sFormInit;
|
||||
sFormInit.formID = 0; //this adds the blue background, and the "box" behind the buttons -Q
|
||||
sFormInit.id = CHALLENGE_FORM;
|
||||
sFormInit.style = WFORM_PLAIN;
|
||||
|
@ -163,7 +160,7 @@ bool addChallenges()
|
|||
widgAddForm(psRequestScreen, &sFormInit);
|
||||
|
||||
// Add Banner Label
|
||||
memset(&sLabInit, 0, sizeof(W_LABINIT));
|
||||
W_LABINIT sLabInit;
|
||||
sLabInit.formID = CHALLENGE_BANNER;
|
||||
sLabInit.id = CHALLENGE_LABEL;
|
||||
sLabInit.style = WLAB_ALIGNCENTRE;
|
||||
|
@ -172,11 +169,10 @@ bool addChallenges()
|
|||
sLabInit.width = CHALLENGE_W - (2 * CHALLENGE_HGAP); //CHALLENGE_W;
|
||||
sLabInit.height = CHALLENGE_BANNER_DEPTH; //This looks right -Q
|
||||
sLabInit.pText = "Challenge";
|
||||
sLabInit.FontID = font_regular;
|
||||
widgAddLabel(psRequestScreen, &sLabInit);
|
||||
|
||||
// add cancel.
|
||||
memset(&sButInit, 0, sizeof(W_BUTINIT));
|
||||
W_BUTINIT sButInit;
|
||||
sButInit.formID = CHALLENGE_BANNER;
|
||||
sButInit.x = 8;
|
||||
sButInit.y = 8;
|
||||
|
@ -185,20 +181,16 @@ bool addChallenges()
|
|||
sButInit.UserData = PACKDWORD_TRI(0, IMAGE_NRUTER , IMAGE_NRUTER);
|
||||
|
||||
sButInit.id = CHALLENGE_CANCEL;
|
||||
sButInit.style = WBUT_PLAIN;
|
||||
sButInit.pTip = _("Close");
|
||||
sButInit.FontID = font_regular;
|
||||
sButInit.pDisplay = intDisplayImageHilight;
|
||||
widgAddButton(psRequestScreen, &sButInit);
|
||||
|
||||
// add slots
|
||||
memset(&sButInit, 0, sizeof(W_BUTINIT));
|
||||
sButInit = W_BUTINIT();
|
||||
sButInit.formID = CHALLENGE_FORM;
|
||||
sButInit.style = WBUT_PLAIN;
|
||||
sButInit.width = CHALLENGE_ENTRY_W;
|
||||
sButInit.height = CHALLENGE_ENTRY_H;
|
||||
sButInit.pDisplay = displayLoadSlot;
|
||||
sButInit.FontID = font_regular;
|
||||
|
||||
for (slotCount = 0; slotCount < totalslots; slotCount++)
|
||||
{
|
||||
|
|
119
src/combat.cpp
119
src/combat.cpp
|
@ -39,37 +39,15 @@
|
|||
// maximum random pause for firing
|
||||
#define RANDOM_PAUSE 500
|
||||
|
||||
/* direction array for missed bullets */
|
||||
typedef struct _bul_dir
|
||||
{
|
||||
SDWORD x,y;
|
||||
} BUL_DIR;
|
||||
#define BUL_MAXSCATTERDIR 8
|
||||
static BUL_DIR aScatterDir[BUL_MAXSCATTERDIR] =
|
||||
{
|
||||
{ 0,-1 },
|
||||
{ 1,-1 },
|
||||
{ 1,0 },
|
||||
{ 1,1 },
|
||||
{ 0,1 },
|
||||
{ -1,1 },
|
||||
{ -1,0 },
|
||||
{ -1,-1 },
|
||||
};
|
||||
|
||||
// Watermelon:real projectile
|
||||
/* Fire a weapon at something */
|
||||
void combFire(WEAPON *psWeap, BASE_OBJECT *psAttacker, BASE_OBJECT *psTarget, int weapon_slot)
|
||||
{
|
||||
WEAPON_STATS *psStats;
|
||||
SDWORD xDiff, yDiff, distSquared;
|
||||
UDWORD dice, damLevel;
|
||||
SDWORD resultHitChance=0,baseHitChance=0,fireChance;
|
||||
UDWORD damLevel;
|
||||
UDWORD firePause;
|
||||
SDWORD longRange;
|
||||
DROID *psDroid = NULL;
|
||||
int minOffset = 5;
|
||||
SDWORD dist;
|
||||
int compIndex;
|
||||
|
||||
CHECK_OBJECT(psAttacker);
|
||||
|
@ -140,7 +118,7 @@ void combFire(WEAPON *psWeap, BASE_OBJECT *psAttacker, BASE_OBJECT *psTarget, in
|
|||
// add a random delay to the fire
|
||||
// With logical updates, a good graphics gard no longer gives a better ROF.
|
||||
// TODO Should still replace this with something saner, such as a ±1% random deviation in reload time.
|
||||
fireChance = gameTime - (psWeap->lastFired + firePause);
|
||||
int fireChance = gameTime - (psWeap->lastFired + firePause);
|
||||
if (gameRand(RANDOM_PAUSE) > fireChance)
|
||||
{
|
||||
return;
|
||||
|
@ -190,10 +168,12 @@ void combFire(WEAPON *psWeap, BASE_OBJECT *psAttacker, BASE_OBJECT *psTarget, in
|
|||
}
|
||||
}
|
||||
|
||||
Vector3i deltaPos = psTarget->pos - psAttacker->pos;
|
||||
|
||||
// if the turret doesn't turn, check if the attacker is in alignment with the target
|
||||
if (psAttacker->type == OBJ_DROID && !psStats->rotate)
|
||||
{
|
||||
uint16_t targetDir = calcDirection(psAttacker->pos.x, psAttacker->pos.y, psTarget->pos.x, psTarget->pos.y);
|
||||
uint16_t targetDir = iAtan2(removeZ(deltaPos));
|
||||
int dirDiff = abs(angleDelta(targetDir - psAttacker->rot.direction));
|
||||
if (dirDiff > FIXED_TURRET_DIR)
|
||||
{
|
||||
|
@ -202,12 +182,10 @@ void combFire(WEAPON *psWeap, BASE_OBJECT *psAttacker, BASE_OBJECT *psTarget, in
|
|||
}
|
||||
|
||||
/* Now see if the target is in range - also check not too near */
|
||||
xDiff = psAttacker->pos.x - psTarget->pos.x;
|
||||
yDiff = psAttacker->pos.y - psTarget->pos.y;
|
||||
distSquared = xDiff*xDiff + yDiff*yDiff;
|
||||
dist = iSqrt(distSquared);
|
||||
int dist = iHypot(removeZ(deltaPos));
|
||||
longRange = proj_GetLongRange(psStats);
|
||||
|
||||
int baseHitChance = 0;
|
||||
if ((dist <= psStats->shortRange) && (dist >= psStats->minRange))
|
||||
{
|
||||
// get weapon chance to hit in the short range
|
||||
|
@ -230,7 +208,7 @@ void combFire(WEAPON *psWeap, BASE_OBJECT *psAttacker, BASE_OBJECT *psTarget, in
|
|||
|
||||
// apply experience accuracy modifiers to the base
|
||||
//hit chance, not to the final hit chance
|
||||
resultHitChance = baseHitChance;
|
||||
int resultHitChance = baseHitChance;
|
||||
|
||||
// add the attacker's experience
|
||||
if (psAttacker->type == OBJ_DROID)
|
||||
|
@ -291,21 +269,15 @@ void combFire(WEAPON *psWeap, BASE_OBJECT *psAttacker, BASE_OBJECT *psTarget, in
|
|||
resultHitChance = INVISIBLE_ACCURACY_PENALTY * resultHitChance / 100;
|
||||
}
|
||||
|
||||
dice = gameRand(100);
|
||||
|
||||
// see if we were lucky to hit the target
|
||||
if (dice <= resultHitChance)
|
||||
{
|
||||
//Watermelon:predicted X,Y offset per sec
|
||||
Vector3i predict;
|
||||
Vector3i predict = psTarget->pos;
|
||||
|
||||
/* Kerrrbaaang !!!!! a hit */
|
||||
//Watermelon:Target prediction
|
||||
if (psTarget->type == OBJ_DROID)
|
||||
if (isDroid(psTarget))
|
||||
{
|
||||
int32_t flightTime;
|
||||
SDWORD empTime = 0;
|
||||
DROID *psDroid = castDroid(psTarget);
|
||||
|
||||
int32_t flightTime;
|
||||
if (proj_Direct(psStats) || dist <= psStats->minRange)
|
||||
{
|
||||
flightTime = dist / psStats->flightSpeed;
|
||||
|
@ -313,14 +285,14 @@ void combFire(WEAPON *psWeap, BASE_OBJECT *psAttacker, BASE_OBJECT *psTarget, in
|
|||
else
|
||||
{
|
||||
int32_t vXY, vZ; // Unused, we just want the flight time.
|
||||
flightTime = projCalcIndirectVelocities(dist, psTarget->pos.z - psAttacker->pos.z, psStats->flightSpeed, &vXY, &vZ);
|
||||
flightTime = projCalcIndirectVelocities(dist, deltaPos.z, psStats->flightSpeed, &vXY, &vZ);
|
||||
}
|
||||
|
||||
if (psTarget->lastHitWeapon == WSC_EMP)
|
||||
{
|
||||
empTime = EMP_DISABLE_TIME - (gameTime - psTarget->timeLastHit);
|
||||
int empTime = EMP_DISABLE_TIME - (gameTime - psTarget->timeLastHit);
|
||||
CLIP(empTime, 0, EMP_DISABLE_TIME);
|
||||
if (empTime >= EMP_DISABLE_TIME * 0.9)
|
||||
if (empTime >= EMP_DISABLE_TIME * 9/10)
|
||||
{
|
||||
flightTime = 0; /* Just hit. Assume they'll get hit again */
|
||||
}
|
||||
|
@ -330,43 +302,40 @@ void combFire(WEAPON *psWeap, BASE_OBJECT *psAttacker, BASE_OBJECT *psTarget, in
|
|||
}
|
||||
}
|
||||
|
||||
predict.x = iSinR(((DROID *)psTarget)->sMove.moveDir, ((DROID *)psTarget)->sMove.speed*flightTime / GAME_TICKS_PER_SEC);
|
||||
predict.x += psTarget->pos.x;
|
||||
predict.y = iCosR(((DROID *)psTarget)->sMove.moveDir, ((DROID *)psTarget)->sMove.speed*flightTime / GAME_TICKS_PER_SEC);
|
||||
predict.y += psTarget->pos.y;
|
||||
predict += Vector3i(iSinCosR(psDroid->sMove.moveDir, psDroid->sMove.speed*flightTime / GAME_TICKS_PER_SEC), 0);
|
||||
}
|
||||
|
||||
/* Fire off the bullet to the miss location. The miss is only visible if the player owns the target. (Why? - Per) */
|
||||
// What bVisible really does is to make the projectile audible even if it misses you. Since the target is NULL, proj_SendProjectile can't check if it was fired at you.
|
||||
bool bVisibleAnyway = psTarget->player == selectedPlayer;
|
||||
|
||||
// see if we were lucky to hit the target
|
||||
bool isHit = gameRand(100) <= resultHitChance;
|
||||
if (isHit)
|
||||
{
|
||||
/* Kerrrbaaang !!!!! a hit */
|
||||
objTrace(psAttacker->id, "combFire: [%s]->%u: resultHitChance=%d, visibility=%hhu : ", psStats->pName, psTarget->id, resultHitChance, psTarget->visible[psAttacker->player]);
|
||||
syncDebug("hit=(%d,%d,%d)", predict.x, predict.y, predict.z);
|
||||
}
|
||||
else /* Deal with a missed shot */
|
||||
{
|
||||
const int minOffset = 5;
|
||||
|
||||
int missDist = 2 * (100 - resultHitChance) + minOffset;
|
||||
Vector3i miss = Vector3i(iSinCosR(gameRand(DEG(360)), missDist), 0);
|
||||
predict += miss;
|
||||
|
||||
psTarget = NULL; // Missed the target, so don't expect to hit it.
|
||||
|
||||
objTrace(psAttacker->id, "combFire: Missed shot by (%4d,%4d)", miss.x, miss.y);
|
||||
syncDebug("miss=(%d,%d,%d)", predict.x, predict.y, predict.z);
|
||||
}
|
||||
|
||||
// Make sure we don't pass any negative or out of bounds numbers to proj_SendProjectile
|
||||
CLIP(predict.x, 0, world_coord(mapWidth - 1));
|
||||
CLIP(predict.y, 0, world_coord(mapHeight - 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
predict.x = psTarget->pos.x;
|
||||
predict.y = psTarget->pos.y;
|
||||
}
|
||||
predict.z = psTarget->pos.z;
|
||||
|
||||
objTrace(psAttacker->id, "combFire: [%s]->%u: resultHitChance=%d, visibility=%hhu : ",
|
||||
psStats->pName, psTarget->id, resultHitChance, psTarget->visible[psAttacker->player]);
|
||||
|
||||
if (!proj_SendProjectile(psWeap, psAttacker, psAttacker->player, predict, psTarget, false, weapon_slot))
|
||||
{
|
||||
/* Out of memory - we can safely ignore this */
|
||||
debug(LOG_ERROR, "Out of memory");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else /* Deal with a missed shot */
|
||||
{
|
||||
int missDir = gameRand(BUL_MAXSCATTERDIR), missDist = 2 * (100 - resultHitChance) + minOffset;
|
||||
Vector3i miss = Vector3i(aScatterDir[missDir].x, aScatterDir[missDir].y, 0)*missDist + psTarget->pos;
|
||||
|
||||
objTrace(psAttacker->id, "combFire: Missed shot (%d) ended up at (%4d,%4d)", dice, miss.x, miss.y);
|
||||
|
||||
/* Fire off the bullet to the miss location. The miss is only visible if the player owns the target. (Why? - Per) */
|
||||
proj_SendProjectile(psWeap, psAttacker, psAttacker->player, miss, NULL, psTarget->player == selectedPlayer, weapon_slot);
|
||||
}
|
||||
return;
|
||||
proj_SendProjectile(psWeap, psAttacker, psAttacker->player, predict, psTarget, bVisibleAnyway, weapon_slot);
|
||||
}
|
||||
|
||||
/*checks through the target players list of structures and droids to see
|
||||
|
|
|
@ -887,7 +887,7 @@ static void displayCompObj(DROID *psDroid, BOOL bButton)
|
|||
if ((psDroid->droidType == DROID_REPAIR || psDroid->droidType == DROID_CYBORG_REPAIR) &&
|
||||
psShape->nconnectors && psDroid->action == DACTION_DROIDREPAIR)
|
||||
{
|
||||
SPACETIME st = interpolateObjectSpacetime((SIMPLE_OBJECT *)psDroid, graphicsTime);
|
||||
Spacetime st = interpolateObjectSpacetime(psDroid, graphicsTime);
|
||||
Rotation rot = getInterpolatedWeaponRotation(psDroid, 0, graphicsTime);
|
||||
|
||||
pie_TRANSLATE( psShape->connectors[0].x,
|
||||
|
@ -955,37 +955,21 @@ static void displayCompObj(DROID *psDroid, BOOL bButton)
|
|||
//
|
||||
void displayComponentButtonTemplate(DROID_TEMPLATE *psTemplate, Vector3i *Rotation, Vector3i *Position, BOOL RotXYZ, SDWORD scale)
|
||||
{
|
||||
static DROID Droid(0, 0); // Made static to reduce stack usage.
|
||||
SDWORD difference;
|
||||
|
||||
/* init to NULL */
|
||||
memset( &Droid, 0, sizeof(DROID) );
|
||||
|
||||
setMatrix(Position, Rotation, RotXYZ);
|
||||
pie_MatScale(scale / 100.f);
|
||||
|
||||
// Decide how to sort it.
|
||||
|
||||
difference = Rotation->y%360;
|
||||
|
||||
if((difference>0 && difference <180) || difference<-180)
|
||||
{
|
||||
leftFirst = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
leftFirst = true;
|
||||
}
|
||||
// Decide how to sort it.
|
||||
leftFirst = angleDelta(DEG(Rotation->y)) < 0;
|
||||
|
||||
DROID Droid(0, selectedPlayer);
|
||||
memset(Droid.asBits, 0, sizeof(Droid.asBits));
|
||||
droidSetBits(psTemplate,&Droid);
|
||||
Droid.player = (UBYTE)selectedPlayer;
|
||||
|
||||
Droid.pos.x = Droid.pos.y = Droid.pos.z = 0;
|
||||
Droid.pos = Vector3i(0, 0, 0);
|
||||
|
||||
//draw multi component object as a button object
|
||||
displayCompObj(&Droid, true);
|
||||
|
||||
|
||||
unsetMatrix();
|
||||
}
|
||||
|
||||
|
@ -1023,7 +1007,7 @@ void displayComponentObject(DROID *psDroid)
|
|||
PROPULSION_STATS *psPropStats;
|
||||
UDWORD tileX,tileY;
|
||||
MAPTILE *psTile;
|
||||
SPACETIME st = interpolateObjectSpacetime((SIMPLE_OBJECT *)psDroid, graphicsTime);
|
||||
Spacetime st = interpolateObjectSpacetime(psDroid, graphicsTime);
|
||||
|
||||
psPropStats = asPropulsionStats + psDroid->asBits[COMP_PROPULSION].nStat;
|
||||
|
||||
|
|
129
src/design.cpp
129
src/design.cpp
|
@ -425,12 +425,6 @@ static BOOL _intAddDesign( BOOL bShowCentreScreen )
|
|||
//initialise flags
|
||||
newTemplate = false;
|
||||
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
memset(&sLabInit, 0, sizeof(W_LABINIT));
|
||||
memset(&sEdInit, 0, sizeof(W_EDBINIT));
|
||||
memset(&sButInit, 0, sizeof(W_BUTINIT));
|
||||
memset(&sBarInit, 0, sizeof(W_BARINIT));
|
||||
|
||||
/* Add the main design form */
|
||||
sFormInit.formID = 0;
|
||||
sFormInit.id = IDDES_FORM;
|
||||
|
@ -448,13 +442,11 @@ static BOOL _intAddDesign( BOOL bShowCentreScreen )
|
|||
/* add the edit name box */
|
||||
sEdInit.formID = IDDES_FORM;
|
||||
sEdInit.id = IDDES_NAMEBOX;
|
||||
sEdInit.style = WEDB_PLAIN;
|
||||
sEdInit.x = DES_NAMEBOXX;
|
||||
sEdInit.y = DES_NAMEBOXY;
|
||||
sEdInit.width = DES_NAMEBOXWIDTH;
|
||||
sEdInit.height = DES_NAMEBOXHEIGHT;
|
||||
sEdInit.pText = _("New Vehicle");
|
||||
sEdInit.FontID = font_regular;
|
||||
sEdInit.pBoxDisplay = intDisplayEditBox;
|
||||
if (!widgAddEditBox(psWScreen, &sEdInit))
|
||||
{
|
||||
|
@ -466,13 +458,13 @@ static BOOL _intAddDesign( BOOL bShowCentreScreen )
|
|||
/* Initialise the current design */
|
||||
if (psCurrTemplate != NULL)
|
||||
{
|
||||
memcpy(&sCurrDesign, psCurrTemplate, sizeof(DROID_TEMPLATE));
|
||||
sCurrDesign = *psCurrTemplate;
|
||||
sstrcpy(aCurrName, getStatName(psCurrTemplate));
|
||||
sstrcpy(sCurrDesign.aName, aCurrName);
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(&sCurrDesign, &sDefaultDesignTemplate, sizeof(DROID_TEMPLATE));
|
||||
sCurrDesign = sDefaultDesignTemplate;
|
||||
sCurrDesign.pName = NULL;
|
||||
sstrcpy(aCurrName, _("New Vehicle"));
|
||||
sstrcpy(sCurrDesign.aName, aCurrName);
|
||||
|
@ -516,13 +508,11 @@ static BOOL _intAddDesign( BOOL bShowCentreScreen )
|
|||
// add the body part button
|
||||
sButInit.formID = IDDES_PARTFORM;
|
||||
sButInit.id = IDDES_BODYBUTTON;
|
||||
sButInit.style = WBUT_PLAIN;
|
||||
sButInit.x = DES_PARTSEPARATIONX;
|
||||
sButInit.y = DES_PARTSEPARATIONY;
|
||||
sButInit.width = iV_GetImageWidth(IntImages, IMAGE_DES_BODY);
|
||||
sButInit.height = iV_GetImageHeight(IntImages, IMAGE_DES_BODY);
|
||||
sButInit.pTip = _("Vehicle Body");
|
||||
sButInit.FontID = font_regular;
|
||||
#ifdef FLASH_BUTTONS
|
||||
sButInit.pDisplay = intDisplayButtonFlash;
|
||||
#else
|
||||
|
@ -537,14 +527,12 @@ static BOOL _intAddDesign( BOOL bShowCentreScreen )
|
|||
// add the propulsion part button
|
||||
sButInit.formID = IDDES_PARTFORM;
|
||||
sButInit.id = IDDES_PROPBUTTON;
|
||||
sButInit.style = WBUT_PLAIN;
|
||||
sButInit.x = DES_PARTSEPARATIONX;
|
||||
sButInit.y = (UWORD)(iV_GetImageHeight(IntImages, IMAGE_DES_PROPULSION) +
|
||||
2 * DES_PARTSEPARATIONY);
|
||||
sButInit.width = iV_GetImageWidth(IntImages, IMAGE_DES_PROPULSION);
|
||||
sButInit.height = iV_GetImageHeight(IntImages, IMAGE_DES_PROPULSION);
|
||||
sButInit.pTip = _("Vehicle Propulsion");
|
||||
sButInit.FontID = font_regular;
|
||||
#ifdef FLASH_BUTTONS
|
||||
sButInit.pDisplay = intDisplayButtonFlash;
|
||||
#else
|
||||
|
@ -559,7 +547,6 @@ static BOOL _intAddDesign( BOOL bShowCentreScreen )
|
|||
// add the turret part button
|
||||
sButInit.formID = IDDES_PARTFORM;
|
||||
sButInit.id = IDDES_SYSTEMBUTTON;
|
||||
sButInit.style = WBUT_PLAIN;
|
||||
sButInit.x = DES_PARTSEPARATIONX;
|
||||
sButInit.y = (UWORD)(iV_GetImageHeight(IntImages, IMAGE_DES_PROPULSION) +
|
||||
iV_GetImageHeight(IntImages, IMAGE_DES_BODY) +
|
||||
|
@ -567,7 +554,6 @@ static BOOL _intAddDesign( BOOL bShowCentreScreen )
|
|||
sButInit.width = iV_GetImageWidth(IntImages, IMAGE_DES_TURRET);
|
||||
sButInit.height = iV_GetImageHeight(IntImages, IMAGE_DES_TURRET);
|
||||
sButInit.pTip = _("Vehicle Turret");
|
||||
sButInit.FontID = font_regular;
|
||||
#ifdef FLASH_BUTTONS
|
||||
sButInit.pDisplay = intDisplayButtonFlash;
|
||||
#else
|
||||
|
@ -582,7 +568,6 @@ static BOOL _intAddDesign( BOOL bShowCentreScreen )
|
|||
// add the turret_a button
|
||||
sButInit.formID = IDDES_PARTFORM;
|
||||
sButInit.id = IDDES_WPABUTTON;
|
||||
sButInit.style = WBUT_PLAIN;
|
||||
sButInit.x = DES_PARTSEPARATIONX;
|
||||
// use BODY height for now
|
||||
sButInit.y = (UWORD)(iV_GetImageHeight(IntImages, IMAGE_DES_PROPULSION) +
|
||||
|
@ -592,7 +577,6 @@ static BOOL _intAddDesign( BOOL bShowCentreScreen )
|
|||
sButInit.width = iV_GetImageWidth(IntImages, IMAGE_DES_TURRET);
|
||||
sButInit.height = iV_GetImageHeight(IntImages, IMAGE_DES_TURRET);
|
||||
sButInit.pTip = _("Vehicle Turret");
|
||||
sButInit.FontID = font_regular;
|
||||
#ifdef FLASH_BUTTONS
|
||||
sButInit.pDisplay = intDisplayButtonFlash;
|
||||
#else
|
||||
|
@ -607,7 +591,6 @@ static BOOL _intAddDesign( BOOL bShowCentreScreen )
|
|||
// add the turret_b button
|
||||
sButInit.formID = IDDES_PARTFORM;
|
||||
sButInit.id = IDDES_WPBBUTTON;
|
||||
sButInit.style = WBUT_PLAIN;
|
||||
sButInit.x = DES_PARTSEPARATIONX;
|
||||
//use body height for now
|
||||
sButInit.y = (UWORD)(iV_GetImageHeight(IntImages, IMAGE_DES_PROPULSION) +
|
||||
|
@ -618,7 +601,6 @@ static BOOL _intAddDesign( BOOL bShowCentreScreen )
|
|||
sButInit.width = iV_GetImageWidth(IntImages, IMAGE_DES_TURRET);
|
||||
sButInit.height = iV_GetImageHeight(IntImages, IMAGE_DES_TURRET);
|
||||
sButInit.pTip = _("Vehicle Turret");
|
||||
sButInit.FontID = font_regular;
|
||||
#ifdef FLASH_BUTTONS
|
||||
sButInit.pDisplay = intDisplayButtonFlash;
|
||||
#else
|
||||
|
@ -633,13 +615,11 @@ static BOOL _intAddDesign( BOOL bShowCentreScreen )
|
|||
/* add the delete button */
|
||||
sButInit.formID = IDDES_PARTFORM;
|
||||
sButInit.id = IDDES_BIN;
|
||||
sButInit.style = WBUT_PLAIN;
|
||||
sButInit.width = iV_GetImageWidth(IntImages, IMAGE_DES_BIN);
|
||||
sButInit.height = iV_GetImageHeight(IntImages, IMAGE_DES_BIN);
|
||||
sButInit.x = DES_PARTSEPARATIONX;
|
||||
sButInit.y = (UWORD)(DES_PARTFORMHEIGHT - sButInit.height - DES_PARTSEPARATIONY);
|
||||
sButInit.pTip = _("Delete Design");
|
||||
sButInit.FontID = font_regular;
|
||||
sButInit.pDisplay = intDisplayButtonHilight;
|
||||
sButInit.UserData = PACKDWORD_TRI(0,IMAGE_DES_BINH, IMAGE_DES_BIN);
|
||||
if (!widgAddButton(psWScreen, &sButInit))
|
||||
|
@ -678,8 +658,6 @@ static BOOL _intAddDesign( BOOL bShowCentreScreen )
|
|||
/* Add the graphs for the Body */
|
||||
sBarInit.formID = IDDES_BODYFORM;
|
||||
sBarInit.id = IDDES_BODYARMOUR_K;
|
||||
sBarInit.style = WBAR_PLAIN;
|
||||
sBarInit.orientation = WBAR_LEFT;
|
||||
sBarInit.x = DES_CLICKBARX;
|
||||
sBarInit.y = DES_STATBAR_Y1; //DES_CLICKBARY;
|
||||
sBarInit.width = DES_CLICKBARWIDTH;
|
||||
|
@ -735,13 +713,11 @@ static BOOL _intAddDesign( BOOL bShowCentreScreen )
|
|||
/* Add the labels for the Body */
|
||||
sLabInit.formID = IDDES_BODYFORM;
|
||||
sLabInit.id = IDDES_BODYARMOURKLAB;
|
||||
sLabInit.style = WLAB_PLAIN;
|
||||
sLabInit.x = DES_CLICKBARNAMEX;
|
||||
sLabInit.y = DES_CLICKBARY - DES_CLICKBARHEIGHT/3;
|
||||
sLabInit.width = DES_CLICKBARNAMEWIDTH;
|
||||
sLabInit.height = DES_CLICKBARHEIGHT;
|
||||
sLabInit.pTip = _("Kinetic Armour");
|
||||
sLabInit.FontID = font_regular;
|
||||
sLabInit.pDisplay = intDisplayImage;
|
||||
//just to confuse things even more - the graphics were named incorrectly!
|
||||
sLabInit.UserData = IMAGE_DES_ARMOUR_EXPLOSIVE;//IMAGE_DES_ARMOUR_KINETIC;
|
||||
|
@ -789,7 +765,7 @@ static BOOL _intAddDesign( BOOL bShowCentreScreen )
|
|||
}
|
||||
|
||||
/* add power/points bar subform */
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
sFormInit = W_FORMINIT();
|
||||
sFormInit.formID = IDDES_FORM;
|
||||
sFormInit.id = IDDES_POWERFORM;
|
||||
sFormInit.style = WFORM_PLAIN;
|
||||
|
@ -819,11 +795,9 @@ static BOOL _intAddDesign( BOOL bShowCentreScreen )
|
|||
return true;
|
||||
}
|
||||
|
||||
memset(&sBarInit, 0, sizeof(W_BARINIT));
|
||||
sBarInit = W_BARINIT();
|
||||
sBarInit.formID = IDDES_POWERFORM;
|
||||
sBarInit.id = IDDES_POWERBAR;
|
||||
sBarInit.style = WBAR_PLAIN;
|
||||
sBarInit.orientation = WBAR_LEFT;
|
||||
sBarInit.x = (SWORD)(DES_POWERX + DES_POWERSEPARATIONX +
|
||||
iV_GetImageWidth(IntImages,IMAGE_DES_BODYPOINTS));
|
||||
sBarInit.y = DES_POWERY;
|
||||
|
@ -852,11 +826,9 @@ static BOOL _intAddDesign( BOOL bShowCentreScreen )
|
|||
return true;
|
||||
}
|
||||
|
||||
memset(&sBarInit, 0, sizeof(W_BARINIT));
|
||||
sBarInit = W_BARINIT();
|
||||
sBarInit.formID = IDDES_POWERFORM;
|
||||
sBarInit.id = IDDES_BODYPOINTS;
|
||||
sBarInit.style = WBAR_PLAIN;
|
||||
sBarInit.orientation = WBAR_LEFT;
|
||||
sBarInit.x = (SWORD)(DES_POWERX + DES_POWERSEPARATIONX +
|
||||
iV_GetImageWidth(IntImages,IMAGE_DES_BODYPOINTS));
|
||||
sBarInit.y = (SWORD)(DES_POWERY + DES_POWERSEPARATIONY + 4 +
|
||||
|
@ -927,7 +899,6 @@ void desSetupDesignTemplates(void)
|
|||
/* Add the design template form */
|
||||
static BOOL _intAddTemplateForm(DROID_TEMPLATE *psSelected)
|
||||
{
|
||||
W_FORMINIT sFormInit;
|
||||
UDWORD numButtons, butPerForm;
|
||||
UDWORD i;
|
||||
|
||||
|
@ -949,7 +920,7 @@ static BOOL _intAddTemplateForm(DROID_TEMPLATE *psSelected)
|
|||
(DES_TABBUTHEIGHT + DES_TABBUTGAP));
|
||||
|
||||
/* add a form to place the tabbed form on */
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
W_FORMINIT sFormInit;
|
||||
sFormInit.formID = 0;
|
||||
sFormInit.id = IDDES_TEMPLBASE;
|
||||
sFormInit.style = WFORM_PLAIN;
|
||||
|
@ -964,7 +935,7 @@ static BOOL _intAddTemplateForm(DROID_TEMPLATE *psSelected)
|
|||
}
|
||||
|
||||
/* Add the design templates form */
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
sFormInit = W_FORMINIT();
|
||||
sFormInit.formID = IDDES_TEMPLBASE; //IDDES_FORM;
|
||||
sFormInit.id = IDDES_TEMPLFORM;
|
||||
sFormInit.style = WFORM_TABBED;
|
||||
|
@ -1022,8 +993,6 @@ BOOL intAddTemplateButtons(UDWORD formID, UDWORD formWidth, UDWORD formHeight,
|
|||
UDWORD butWidth, UDWORD butHeight, UDWORD gap,
|
||||
DROID_TEMPLATE *psSelected)
|
||||
{
|
||||
W_FORMINIT sButInit;
|
||||
W_BARINIT sBarInit;
|
||||
DROID_TEMPLATE *psTempl = NULL;
|
||||
char aButText[DES_COMPBUTMAXCHAR + 1];
|
||||
SDWORD BufferID;
|
||||
|
@ -1034,9 +1003,9 @@ BOOL intAddTemplateButtons(UDWORD formID, UDWORD formWidth, UDWORD formHeight,
|
|||
ClearStatBuffers();
|
||||
|
||||
memset(aButText, 0, DES_COMPBUTMAXCHAR + 1);
|
||||
memset(&sButInit, 0, sizeof(W_BUTINIT));
|
||||
|
||||
/* Set up the button struct */
|
||||
W_FORMINIT sButInit;
|
||||
sButInit.formID = formID;
|
||||
sButInit.id = IDDES_TEMPLSTART;
|
||||
sButInit.style = WFORM_CLICKABLE;
|
||||
|
@ -1046,10 +1015,8 @@ BOOL intAddTemplateButtons(UDWORD formID, UDWORD formWidth, UDWORD formHeight,
|
|||
sButInit.height = OBJ_BUTHEIGHT; //DES_TABBUTHEIGHT;
|
||||
|
||||
/* Add each button */
|
||||
memset(&sBarInit, 0, sizeof(W_BARINIT));
|
||||
W_BARINIT sBarInit;
|
||||
sBarInit.id = IDDES_BARSTART;
|
||||
sBarInit.style = WBAR_PLAIN;
|
||||
sBarInit.orientation = WBAR_LEFT;
|
||||
sBarInit.x = STAT_TIMEBARX;
|
||||
sBarInit.y = STAT_TIMEBARY;
|
||||
sBarInit.width = STAT_PROGBARWIDTH;
|
||||
|
@ -1448,15 +1415,8 @@ static void intSetDesignStats( DROID_TEMPLATE *psTemplate )
|
|||
/* Set up the system clickable form of the design screen given a set of stats */
|
||||
static BOOL _intSetSystemForm(COMPONENT_STATS *psStats)
|
||||
{
|
||||
W_FORMINIT sFormInit;
|
||||
W_BARINIT sBarInit;
|
||||
W_LABINIT sLabInit;
|
||||
DES_SYSMODE newSysMode=(DES_SYSMODE)0;
|
||||
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
memset(&sLabInit, 0, sizeof(W_LABINIT));
|
||||
memset(&sBarInit, 0, sizeof(W_BARINIT));
|
||||
|
||||
/* Figure out what the new mode should be */
|
||||
switch (statType(psStats->ref))
|
||||
{
|
||||
|
@ -1498,6 +1458,7 @@ static BOOL _intSetSystemForm(COMPONENT_STATS *psStats)
|
|||
desSysMode = newSysMode;
|
||||
|
||||
/* Add the system form */
|
||||
W_FORMINIT sFormInit;
|
||||
sFormInit.formID = IDDES_STATSFORM;
|
||||
sFormInit.id = IDDES_SYSTEMFORM;
|
||||
sFormInit.style = (WFORM_CLICKABLE | WFORM_NOCLICKMOVE);
|
||||
|
@ -1514,9 +1475,9 @@ static BOOL _intSetSystemForm(COMPONENT_STATS *psStats)
|
|||
}
|
||||
|
||||
/* Initialise the bargraph struct */
|
||||
W_BARINIT sBarInit;
|
||||
sBarInit.formID = IDDES_SYSTEMFORM;
|
||||
sBarInit.style = WBAR_PLAIN;//WBAR_DOUBLE;
|
||||
sBarInit.orientation = WBAR_LEFT;
|
||||
//sBarInit.style = WBAR_DOUBLE;
|
||||
sBarInit.x = DES_CLICKBARX;
|
||||
sBarInit.y = DES_STATBAR_Y1; //DES_CLICKBARY;
|
||||
sBarInit.width = DES_CLICKBARWIDTH;
|
||||
|
@ -1530,13 +1491,13 @@ static BOOL _intSetSystemForm(COMPONENT_STATS *psStats)
|
|||
sBarInit.pDisplay = intDisplayStatsBar;
|
||||
|
||||
/* Initialise the label struct */
|
||||
W_LABINIT sLabInit;
|
||||
sLabInit.formID = IDDES_SYSTEMFORM;
|
||||
sLabInit.style = WLAB_PLAIN;
|
||||
sLabInit.x = DES_CLICKBARNAMEX;
|
||||
sLabInit.y = DES_CLICKBARY - DES_CLICKBARHEIGHT/3;
|
||||
sLabInit.width = DES_CLICKBARNAMEWIDTH;
|
||||
sLabInit.height = DES_CLICKBARHEIGHT;
|
||||
sLabInit.FontID = font_regular;
|
||||
sLabInit.pDisplay = intDisplayImage;
|
||||
|
||||
/* See what type of system stats we've got */
|
||||
if (psStats->ref >= REF_SENSOR_START &&
|
||||
|
@ -1574,7 +1535,6 @@ static BOOL _intSetSystemForm(COMPONENT_STATS *psStats)
|
|||
/* Add the labels */
|
||||
sLabInit.id = IDDES_SENSORRANGELAB;
|
||||
sLabInit.pTip = _("Sensor Range");
|
||||
sLabInit.pDisplay = intDisplayImage;
|
||||
sLabInit.UserData = IMAGE_DES_RANGE;
|
||||
if (!widgAddLabel(psWScreen, &sLabInit))
|
||||
{
|
||||
|
@ -1583,7 +1543,6 @@ static BOOL _intSetSystemForm(COMPONENT_STATS *psStats)
|
|||
sLabInit.id = IDDES_SENSORPOWERLAB;
|
||||
sLabInit.y += DES_CLICKBARHEIGHT + DES_CLICKGAP;
|
||||
sLabInit.pTip = _("Sensor Power");
|
||||
sLabInit.pDisplay = intDisplayImage;
|
||||
sLabInit.UserData = IMAGE_DES_POWER;
|
||||
if (!widgAddLabel(psWScreen, &sLabInit))
|
||||
{
|
||||
|
@ -1592,7 +1551,6 @@ static BOOL _intSetSystemForm(COMPONENT_STATS *psStats)
|
|||
sLabInit.id = IDDES_SENSORWEIGHTLAB;
|
||||
sLabInit.y += DES_CLICKBARHEIGHT + DES_CLICKGAP;
|
||||
sLabInit.pTip = _("Weight");
|
||||
sLabInit.pDisplay = intDisplayImage;
|
||||
sLabInit.UserData = IMAGE_DES_WEIGHT;
|
||||
if (!widgAddLabel(psWScreen, &sLabInit))
|
||||
{
|
||||
|
@ -1622,7 +1580,6 @@ static BOOL _intSetSystemForm(COMPONENT_STATS *psStats)
|
|||
/* Add the labels */
|
||||
sLabInit.id = IDDES_ECMPOWERLAB;
|
||||
sLabInit.pTip = _("ECM Power");
|
||||
sLabInit.pDisplay = intDisplayImage;
|
||||
sLabInit.UserData = IMAGE_DES_POWER;
|
||||
if (!widgAddLabel(psWScreen, &sLabInit))
|
||||
{
|
||||
|
@ -1631,7 +1588,6 @@ static BOOL _intSetSystemForm(COMPONENT_STATS *psStats)
|
|||
sLabInit.id = IDDES_ECMWEIGHTLAB;
|
||||
sLabInit.y += DES_CLICKBARHEIGHT + DES_CLICKGAP;
|
||||
sLabInit.pTip = _("Weight");
|
||||
sLabInit.pDisplay = intDisplayImage;
|
||||
sLabInit.UserData = IMAGE_DES_WEIGHT;
|
||||
if (!widgAddLabel(psWScreen, &sLabInit))
|
||||
{
|
||||
|
@ -1661,7 +1617,6 @@ static BOOL _intSetSystemForm(COMPONENT_STATS *psStats)
|
|||
/* Add the labels */
|
||||
sLabInit.id = IDDES_CONSTPOINTSLAB;
|
||||
sLabInit.pTip = _("Build Points");
|
||||
sLabInit.pDisplay = intDisplayImage;
|
||||
sLabInit.UserData = IMAGE_DES_BUILDRATE;
|
||||
if (!widgAddLabel(psWScreen, &sLabInit))
|
||||
{
|
||||
|
@ -1670,7 +1625,6 @@ static BOOL _intSetSystemForm(COMPONENT_STATS *psStats)
|
|||
sLabInit.id = IDDES_CONSTWEIGHTLAB;
|
||||
sLabInit.y += DES_CLICKBARHEIGHT + DES_CLICKGAP;
|
||||
sLabInit.pTip = _("Weight");
|
||||
sLabInit.pDisplay = intDisplayImage;
|
||||
sLabInit.UserData = IMAGE_DES_WEIGHT;
|
||||
if (!widgAddLabel(psWScreen, &sLabInit))
|
||||
{
|
||||
|
@ -1700,7 +1654,6 @@ static BOOL _intSetSystemForm(COMPONENT_STATS *psStats)
|
|||
/* Add the labels */
|
||||
sLabInit.id = IDDES_REPAIRPTLAB;
|
||||
sLabInit.pTip = _("Build Points");
|
||||
sLabInit.pDisplay = intDisplayImage;
|
||||
sLabInit.UserData = IMAGE_DES_BUILDRATE;
|
||||
if (!widgAddLabel(psWScreen, &sLabInit))
|
||||
{
|
||||
|
@ -1709,7 +1662,6 @@ static BOOL _intSetSystemForm(COMPONENT_STATS *psStats)
|
|||
sLabInit.id = IDDES_REPAIRWGTLAB;
|
||||
sLabInit.y += DES_CLICKBARHEIGHT + DES_CLICKGAP;
|
||||
sLabInit.pTip = _("Weight");
|
||||
sLabInit.pDisplay = intDisplayImage;
|
||||
sLabInit.UserData = IMAGE_DES_WEIGHT;
|
||||
if (!widgAddLabel(psWScreen, &sLabInit))
|
||||
{
|
||||
|
@ -1729,7 +1681,7 @@ static BOOL _intSetSystemForm(COMPONENT_STATS *psStats)
|
|||
{
|
||||
return false;
|
||||
}
|
||||
sBarInit.denominator = 0;
|
||||
sBarInit.denominator = 1;
|
||||
sBarInit.precision = 0;
|
||||
sBarInit.id = IDDES_WEAPDAMAGE;
|
||||
sBarInit.y = DES_STATBAR_Y2; //+= DES_CLICKBARHEIGHT + DES_CLICKGAP;
|
||||
|
@ -1759,7 +1711,6 @@ static BOOL _intSetSystemForm(COMPONENT_STATS *psStats)
|
|||
/* Add the labels */
|
||||
sLabInit.id = IDDES_WEAPRANGELAB;
|
||||
sLabInit.pTip = _("Range");
|
||||
sLabInit.pDisplay = intDisplayImage;
|
||||
sLabInit.UserData = IMAGE_DES_RANGE;
|
||||
if (!widgAddLabel(psWScreen, &sLabInit))
|
||||
{
|
||||
|
@ -1768,7 +1719,6 @@ static BOOL _intSetSystemForm(COMPONENT_STATS *psStats)
|
|||
sLabInit.id = IDDES_WEAPDAMAGELAB;
|
||||
sLabInit.y += DES_CLICKBARHEIGHT + DES_CLICKGAP;
|
||||
sLabInit.pTip = _("Damage");
|
||||
sLabInit.pDisplay = intDisplayImage;
|
||||
sLabInit.UserData = IMAGE_DES_DAMAGE;
|
||||
if (!widgAddLabel(psWScreen, &sLabInit))
|
||||
{
|
||||
|
@ -1777,7 +1727,6 @@ static BOOL _intSetSystemForm(COMPONENT_STATS *psStats)
|
|||
sLabInit.id = IDDES_WEAPROFLAB;
|
||||
sLabInit.y += DES_CLICKBARHEIGHT + DES_CLICKGAP;
|
||||
sLabInit.pTip = _("Rate-of-Fire");
|
||||
sLabInit.pDisplay = intDisplayImage;
|
||||
sLabInit.UserData = IMAGE_DES_FIRERATE;
|
||||
if (!widgAddLabel(psWScreen, &sLabInit))
|
||||
{
|
||||
|
@ -1786,7 +1735,6 @@ static BOOL _intSetSystemForm(COMPONENT_STATS *psStats)
|
|||
sLabInit.id = IDDES_WEAPWEIGHTLAB;
|
||||
sLabInit.y += DES_CLICKBARHEIGHT + DES_CLICKGAP;
|
||||
sLabInit.pTip = _("Weight");
|
||||
sLabInit.pDisplay = intDisplayImage;
|
||||
sLabInit.UserData = IMAGE_DES_WEIGHT;
|
||||
if (!widgAddLabel(psWScreen, &sLabInit))
|
||||
{
|
||||
|
@ -1827,17 +1775,10 @@ static BOOL _intSetSystemForm(COMPONENT_STATS *psStats)
|
|||
/* Set up the propulsion clickable form of the design screen given a set of stats */
|
||||
static BOOL intSetPropulsionForm(PROPULSION_STATS *psStats)
|
||||
{
|
||||
W_FORMINIT sFormInit;
|
||||
W_BARINIT sBarInit;
|
||||
W_LABINIT sLabInit;
|
||||
DES_PROPMODE newPropMode=(DES_PROPMODE)0;
|
||||
|
||||
ASSERT_OR_RETURN(false, psStats != NULL, "Invalid propulsion stats pointer");
|
||||
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
memset(&sLabInit, 0, sizeof(W_LABINIT));
|
||||
memset(&sBarInit, 0, sizeof(W_BARINIT));
|
||||
|
||||
/* figure out what the new mode should be */
|
||||
switch (asPropulsionTypes[psStats->propulsionType].travel)
|
||||
{
|
||||
|
@ -1866,6 +1807,7 @@ static BOOL intSetPropulsionForm(PROPULSION_STATS *psStats)
|
|||
desPropMode = newPropMode;
|
||||
|
||||
/* Add the propulsion form */
|
||||
W_FORMINIT sFormInit;
|
||||
sFormInit.formID = IDDES_STATSFORM;
|
||||
sFormInit.id = IDDES_PROPFORM;
|
||||
sFormInit.style = WFORM_CLICKABLE | WFORM_NOCLICKMOVE;
|
||||
|
@ -1881,9 +1823,9 @@ static BOOL intSetPropulsionForm(PROPULSION_STATS *psStats)
|
|||
}
|
||||
|
||||
/* Initialise the bargraph struct */
|
||||
W_BARINIT sBarInit;
|
||||
sBarInit.formID = IDDES_PROPFORM;
|
||||
sBarInit.style = WBAR_PLAIN;//WBAR_DOUBLE;
|
||||
sBarInit.orientation = WBAR_LEFT;
|
||||
//sBarInit.style = WBAR_DOUBLE;
|
||||
sBarInit.x = DES_CLICKBARX;
|
||||
sBarInit.y = DES_STATBAR_Y1; //DES_CLICKBARY;
|
||||
sBarInit.width = DES_CLICKBARWIDTH;
|
||||
|
@ -1897,13 +1839,13 @@ static BOOL intSetPropulsionForm(PROPULSION_STATS *psStats)
|
|||
sBarInit.pDisplay = intDisplayStatsBar;
|
||||
|
||||
/* Initialise the label struct */
|
||||
W_LABINIT sLabInit;
|
||||
sLabInit.formID = IDDES_PROPFORM;
|
||||
sLabInit.style = WLAB_PLAIN;
|
||||
sLabInit.x = DES_CLICKBARNAMEX;
|
||||
sLabInit.y = DES_CLICKBARY - DES_CLICKBARHEIGHT/3;
|
||||
sLabInit.width = DES_CLICKBARNAMEWIDTH;
|
||||
sLabInit.height = DES_CLICKBARNAMEHEIGHT; //DES_CLICKBARHEIGHT;
|
||||
sLabInit.FontID = font_regular;
|
||||
sLabInit.pDisplay = intDisplayImage;
|
||||
|
||||
/* See what type of propulsion we've got */
|
||||
switch (desPropMode)
|
||||
|
@ -1919,7 +1861,7 @@ static BOOL intSetPropulsionForm(PROPULSION_STATS *psStats)
|
|||
{
|
||||
return false;
|
||||
}
|
||||
sBarInit.denominator = 0;
|
||||
sBarInit.denominator = 1;
|
||||
sBarInit.precision = 0;
|
||||
sBarInit.id = IDDES_PROPWEIGHT;
|
||||
sBarInit.y = DES_STATBAR_Y2; //+= DES_CLICKBARHEIGHT + DES_CLICKGAP;
|
||||
|
@ -1933,7 +1875,6 @@ static BOOL intSetPropulsionForm(PROPULSION_STATS *psStats)
|
|||
/* Add the labels */
|
||||
sLabInit.id = IDDES_PROPAIRLAB;
|
||||
sLabInit.pTip = _("Air Speed");
|
||||
sLabInit.pDisplay = intDisplayImage;
|
||||
sLabInit.UserData = IMAGE_DES_HOVER;
|
||||
if (!widgAddLabel(psWScreen, &sLabInit))
|
||||
{
|
||||
|
@ -1942,7 +1883,6 @@ static BOOL intSetPropulsionForm(PROPULSION_STATS *psStats)
|
|||
sLabInit.id = IDDES_PROPWEIGHTLAB;
|
||||
sLabInit.y += DES_CLICKBARHEIGHT + DES_CLICKGAP;
|
||||
sLabInit.pTip = _("Weight");
|
||||
sLabInit.pDisplay = intDisplayImage;
|
||||
sLabInit.UserData = IMAGE_DES_WEIGHT;
|
||||
if (!widgAddLabel(psWScreen, &sLabInit))
|
||||
{
|
||||
|
@ -1976,7 +1916,7 @@ static BOOL intSetPropulsionForm(PROPULSION_STATS *psStats)
|
|||
{
|
||||
return false;
|
||||
}
|
||||
sBarInit.denominator = 0;
|
||||
sBarInit.denominator = 1;
|
||||
sBarInit.precision = 0;
|
||||
sBarInit.id = IDDES_PROPWEIGHT;
|
||||
sBarInit.y = DES_STATBAR_Y4; //+= DES_CLICKBARHEIGHT + DES_CLICKGAP;
|
||||
|
@ -1990,7 +1930,6 @@ static BOOL intSetPropulsionForm(PROPULSION_STATS *psStats)
|
|||
/* Add the labels */
|
||||
sLabInit.id = IDDES_PROPROADLAB;
|
||||
sLabInit.pTip = _("Road Speed");
|
||||
sLabInit.pDisplay = intDisplayImage;
|
||||
sLabInit.UserData = IMAGE_DES_ROAD;
|
||||
if (!widgAddLabel(psWScreen, &sLabInit))
|
||||
{
|
||||
|
@ -1999,7 +1938,6 @@ static BOOL intSetPropulsionForm(PROPULSION_STATS *psStats)
|
|||
sLabInit.id = IDDES_PROPCOUNTRYLAB;
|
||||
sLabInit.y += DES_CLICKBARHEIGHT + DES_CLICKGAP;
|
||||
sLabInit.pTip = _("Off-Road Speed");
|
||||
sLabInit.pDisplay = intDisplayImage;
|
||||
sLabInit.UserData = IMAGE_DES_CROSSCOUNTRY;
|
||||
if (!widgAddLabel(psWScreen, &sLabInit))
|
||||
{
|
||||
|
@ -2008,7 +1946,6 @@ static BOOL intSetPropulsionForm(PROPULSION_STATS *psStats)
|
|||
sLabInit.id = IDDES_PROPWATERLAB;
|
||||
sLabInit.y += DES_CLICKBARHEIGHT + DES_CLICKGAP;
|
||||
sLabInit.pTip = _("Water Speed");
|
||||
sLabInit.pDisplay = intDisplayImage;
|
||||
sLabInit.UserData = IMAGE_DES_HOVER; //WATER;
|
||||
if (!widgAddLabel(psWScreen, &sLabInit))
|
||||
{
|
||||
|
@ -2017,7 +1954,6 @@ static BOOL intSetPropulsionForm(PROPULSION_STATS *psStats)
|
|||
sLabInit.id = IDDES_PROPWEIGHTLAB;
|
||||
sLabInit.y += DES_CLICKBARHEIGHT + DES_CLICKGAP;
|
||||
sLabInit.pTip = _("Weight");
|
||||
sLabInit.pDisplay = intDisplayImage;
|
||||
sLabInit.UserData = IMAGE_DES_WEIGHT;
|
||||
if (!widgAddLabel(psWScreen, &sLabInit))
|
||||
{
|
||||
|
@ -2068,14 +2004,12 @@ static UDWORD intNumAvailable(UBYTE *aAvailable, UDWORD numEntries,
|
|||
/* Add the component tab form to the design screen */
|
||||
static BOOL intAddComponentForm(UDWORD numButtons)
|
||||
{
|
||||
W_FORMINIT sFormInit;
|
||||
UDWORD i, butPerForm, numFrm;
|
||||
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
butPerForm = DES_BUTSPERFORM;
|
||||
|
||||
/* add a form to place the tabbed form on */
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
W_FORMINIT sFormInit;
|
||||
sFormInit.formID = 0;
|
||||
sFormInit.id = IDDES_RIGHTBASE;
|
||||
sFormInit.style = WFORM_PLAIN;
|
||||
|
@ -2090,7 +2024,7 @@ static BOOL intAddComponentForm(UDWORD numButtons)
|
|||
}
|
||||
|
||||
//now a single form
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
sFormInit = W_FORMINIT();
|
||||
sFormInit.formID = IDDES_RIGHTBASE;
|
||||
sFormInit.id = IDDES_COMPFORM;
|
||||
sFormInit.style = WFORM_TABBED;
|
||||
|
@ -2129,20 +2063,15 @@ static BOOL intAddComponentForm(UDWORD numButtons)
|
|||
/* Add the system buttons (weapons, command droid, etc) to the design screen */
|
||||
static BOOL intAddSystemButtons(DES_COMPMODE mode)
|
||||
{
|
||||
W_BUTINIT sButInit;
|
||||
|
||||
memset(&sButInit, 0, sizeof(W_BUTINIT));
|
||||
|
||||
// add the weapon button
|
||||
W_BUTINIT sButInit;
|
||||
sButInit.formID = IDDES_RIGHTBASE;
|
||||
sButInit.id = IDDES_WEAPONS;
|
||||
sButInit.style = WBUT_PLAIN;
|
||||
sButInit.x = DES_WEAPONBUTTON_X;
|
||||
sButInit.y = DES_SYSTEMBUTTON_Y;
|
||||
sButInit.width = iV_GetImageWidth(IntImages, IMAGE_DES_WEAPONS);
|
||||
sButInit.height = iV_GetImageHeight(IntImages, IMAGE_DES_WEAPONS);
|
||||
sButInit.pTip = _("Weapons");
|
||||
sButInit.FontID = font_regular;
|
||||
sButInit.pDisplay = intDisplayButtonHilight;
|
||||
sButInit.UserData = PACKDWORD_TRI(0,IMAGE_DES_EXTRAHI , IMAGE_DES_WEAPONS);
|
||||
if (!widgAddButton(psWScreen, &sButInit))
|
||||
|
@ -2158,13 +2087,11 @@ static BOOL intAddSystemButtons(DES_COMPMODE mode)
|
|||
// add the system button
|
||||
sButInit.formID = IDDES_RIGHTBASE;
|
||||
sButInit.id = IDDES_SYSTEMS;
|
||||
sButInit.style = WBUT_PLAIN;
|
||||
sButInit.x = DES_SYSTEMBUTTON_X;
|
||||
sButInit.y = DES_SYSTEMBUTTON_Y;
|
||||
sButInit.width = iV_GetImageWidth(IntImages, IMAGE_DES_SYSTEMS);
|
||||
sButInit.height = iV_GetImageHeight(IntImages, IMAGE_DES_SYSTEMS);
|
||||
sButInit.pTip = _("Systems");
|
||||
sButInit.FontID = font_regular;
|
||||
sButInit.pDisplay = intDisplayButtonHilight;
|
||||
sButInit.UserData = PACKDWORD_TRI(0,IMAGE_DES_EXTRAHI , IMAGE_DES_SYSTEMS);
|
||||
if (!widgAddButton(psWScreen, &sButInit))
|
||||
|
@ -2201,7 +2128,6 @@ static BOOL intAddComponentButtons(COMPONENT_STATS *psStats, UDWORD size,
|
|||
UBYTE *aAvailable, UDWORD numEntries,
|
||||
UDWORD compID,UDWORD WhichTab)
|
||||
{
|
||||
W_FORMINIT sButInit;
|
||||
W_TABFORM *psTabForm;
|
||||
UDWORD i, maxComponents;
|
||||
COMPONENT_STATS *psCurrStats;
|
||||
|
@ -2214,9 +2140,9 @@ static BOOL intAddComponentButtons(COMPONENT_STATS *psStats, UDWORD size,
|
|||
ClearObjectBuffers();
|
||||
|
||||
memset(aButText, 0, DES_COMPBUTMAXCHAR + 1);
|
||||
memset(&sButInit, 0, sizeof(W_BUTINIT));
|
||||
|
||||
/* Set up the button struct */
|
||||
W_FORMINIT sButInit;
|
||||
sButInit.formID = IDDES_COMPFORM;
|
||||
sButInit.majorID = IDES_MAINTAB;
|
||||
sButInit.minorID = 0;
|
||||
|
@ -2413,7 +2339,6 @@ static BOOL intAddExtraSystemButtons(UDWORD sensorIndex, UDWORD ecmIndex,
|
|||
UDWORD constIndex, UDWORD repairIndex,
|
||||
UDWORD brainIndex)
|
||||
{
|
||||
W_FORMINIT sButInit;
|
||||
UDWORD i, buttonType, size=0;
|
||||
UDWORD compIndex=0, numStats=0;
|
||||
COMPONENT_STATS *psCurrStats=0;
|
||||
|
@ -2422,9 +2347,9 @@ static BOOL intAddExtraSystemButtons(UDWORD sensorIndex, UDWORD ecmIndex,
|
|||
SDWORD BufferID;
|
||||
|
||||
memset(aButText, 0, DES_COMPBUTMAXCHAR + 1);
|
||||
memset(&sButInit, 0, sizeof(W_BUTINIT));
|
||||
|
||||
// Set up the button struct
|
||||
W_FORMINIT sButInit;
|
||||
sButInit.formID = IDDES_COMPFORM;
|
||||
sButInit.majorID = 0;
|
||||
sButInit.minorID = 0;
|
||||
|
|
|
@ -508,8 +508,6 @@ static void NetworkDisplayImage(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset
|
|||
|
||||
static void setupConnectionStatusForm(void)
|
||||
{
|
||||
static W_FORMINIT sFormInit;
|
||||
static W_BUTINIT sButInit;
|
||||
static unsigned prevStatusMask = 0;
|
||||
|
||||
const int separation = 3;
|
||||
|
@ -545,7 +543,7 @@ static void setupConnectionStatusForm(void)
|
|||
{
|
||||
unsigned n = 0;
|
||||
// Create the basic form
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
W_FORMINIT sFormInit;
|
||||
sFormInit.formID = 0;
|
||||
sFormInit.id = NETWORK_FORM_ID;
|
||||
sFormInit.style = WFORM_PLAIN;
|
||||
|
@ -568,12 +566,11 @@ static void setupConnectionStatusForm(void)
|
|||
}
|
||||
|
||||
//set up default button data
|
||||
memset(&sButInit, 0, sizeof(W_BUTINIT));
|
||||
W_BUTINIT sButInit;
|
||||
sButInit.formID = NETWORK_FORM_ID;
|
||||
sButInit.id = NETWORK_BUT_ID + i;
|
||||
sButInit.width = 36;
|
||||
sButInit.height = 24;
|
||||
sButInit.FontID = font_regular;
|
||||
|
||||
//add button
|
||||
sButInit.style = WBUT_PLAIN;
|
||||
|
@ -1220,7 +1217,7 @@ void renderProjectile(PROJECTILE *psCurr)
|
|||
Vector3i dv;
|
||||
iIMDShape *pIMD;
|
||||
SDWORD rx, rz;
|
||||
SPACETIME st;
|
||||
Spacetime st;
|
||||
|
||||
psStats = psCurr->psWStats;
|
||||
/* Reject flame or command since they have interim drawn fx */
|
||||
|
@ -1234,7 +1231,7 @@ void renderProjectile(PROJECTILE *psCurr)
|
|||
return;
|
||||
}
|
||||
|
||||
st = interpolateObjectSpacetime((SIMPLE_OBJECT *)psCurr, graphicsTime);
|
||||
st = interpolateObjectSpacetime(psCurr, graphicsTime);
|
||||
|
||||
//the weapon stats holds the reference to which graphic to use
|
||||
/*Need to draw the graphic depending on what the projectile is doing - hitting target,
|
||||
|
@ -1290,7 +1287,7 @@ void renderProjectile(PROJECTILE *psCurr)
|
|||
void renderAnimComponent( const COMPONENT_OBJECT *psObj )
|
||||
{
|
||||
BASE_OBJECT *psParentObj = (BASE_OBJECT*)psObj->psParent;
|
||||
SPACETIME spacetime = interpolateObjectSpacetime((SIMPLE_OBJECT *)psParentObj, graphicsTime);
|
||||
Spacetime spacetime = interpolateObjectSpacetime(psParentObj, graphicsTime);
|
||||
const SDWORD posX = spacetime.pos.x + psObj->position.x,
|
||||
posY = spacetime.pos.y + psObj->position.y;
|
||||
SWORD rx, rz;
|
||||
|
@ -1450,14 +1447,14 @@ void displayStaticObjects( void )
|
|||
displayAnimation( psAnimObj, false );
|
||||
if(selectedPlayer == psStructure->player)
|
||||
{
|
||||
audio_PlayObjStaticTrack( (void *) psStructure, ID_SOUND_OIL_PUMP_2 );
|
||||
audio_PlayObjStaticTrack(psStructure, ID_SOUND_OIL_PUMP_2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* hold anim on first frame */
|
||||
displayAnimation( psAnimObj, true );
|
||||
audio_StopObjTrack( (void *) psStructure, ID_SOUND_OIL_PUMP_2 );
|
||||
audio_StopObjTrack(psStructure, ID_SOUND_OIL_PUMP_2);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1643,9 +1640,9 @@ void displayBlueprints(void)
|
|||
{
|
||||
renderBuildOrder(psDroid->order, psDroid->psTarStats, psDroid->orderX, psDroid->orderY, psDroid->orderX2, psDroid->orderY2, psDroid->orderDirection, SS_BLUEPRINT_PLANNED);
|
||||
//now look thru' the list of orders to see if more building sites
|
||||
for (order = psDroid->listPendingBegin; order < psDroid->listPendingEnd; order++)
|
||||
for (order = psDroid->listPendingBegin; order < (int)psDroid->asOrderList.size(); order++)
|
||||
{
|
||||
ORDER_LIST const *o = &psDroid->asOrderList[order];
|
||||
OrderListEntry const *o = &psDroid->asOrderList[order];
|
||||
renderBuildOrder(o->order, (BASE_STATS *)o->psOrderTarget, o->x, o->y, o->x2, o->y2, o->direction, SS_BLUEPRINT_PLANNED);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -289,10 +289,20 @@ DROID::DROID(uint32_t id, unsigned player)
|
|||
, droidType(DROID_ANY)
|
||||
, psGroup(NULL)
|
||||
, psGrpNext(NULL)
|
||||
, order(DORDER_NONE)
|
||||
, orderX(0), orderY(0)
|
||||
, orderX2(0), orderY2(0)
|
||||
, orderDirection(0)
|
||||
, psTarget(NULL)
|
||||
, psTarStats(NULL)
|
||||
, secondaryOrder(DSS_ARANGE_DEFAULT | DSS_REPLEV_NEVER | DSS_ALEV_ALWAYS | DSS_HALT_GUARD)
|
||||
, action(DACTION_NONE)
|
||||
, actionX(0), actionY(0)
|
||||
, psCurAnim(NULL)
|
||||
, gameCheckDroid(NULL)
|
||||
{
|
||||
sMove.asPath = NULL;
|
||||
sMove.Status = MOVEINACTIVE;
|
||||
}
|
||||
|
||||
/* DROID::~DROID: release all resources associated with a droid -
|
||||
|
@ -741,7 +751,7 @@ void droidUpdate(DROID *psDroid)
|
|||
syncDebugDroid(psDroid, '<');
|
||||
|
||||
// Save old droid position, update time.
|
||||
psDroid->prevSpacetime = GET_SPACETIME(psDroid);
|
||||
psDroid->prevSpacetime = getSpacetime(psDroid);
|
||||
psDroid->time = gameTime;
|
||||
for (i = 0; i < MAX(1, psDroid->numWeaps); ++i)
|
||||
{
|
||||
|
@ -2467,38 +2477,10 @@ DROID *reallyBuildDroid(DROID_TEMPLATE *pTemplate, UDWORD x, UDWORD y, UDWORD pl
|
|||
grpJoin(psGrp, psDroid);
|
||||
}
|
||||
|
||||
psDroid->order = DORDER_NONE;
|
||||
psDroid->orderX = 0;
|
||||
psDroid->orderY = 0;
|
||||
psDroid->orderX2 = 0;
|
||||
psDroid->orderY2 = 0;
|
||||
psDroid->secondaryOrder = DSS_ARANGE_DEFAULT | DSS_REPLEV_NEVER | DSS_ALEV_ALWAYS | DSS_HALT_GUARD;
|
||||
psDroid->action = DACTION_NONE;
|
||||
psDroid->actionX = 0;
|
||||
psDroid->actionY = 0;
|
||||
psDroid->psTarStats = NULL;
|
||||
psDroid->psTarget = NULL;
|
||||
psDroid->lastFrustratedTime = -UINT16_MAX; // make sure we do not start the game frustrated
|
||||
|
||||
// Is setting asWeaps here needed? The first numWeaps entries are set in droidSetBits, too.)
|
||||
for(i = 0;i < DROID_MAXWEAPS;i++)
|
||||
{
|
||||
psDroid->psActionTarget[i] = NULL;
|
||||
psDroid->asWeaps[i].lastFired = 0;
|
||||
psDroid->asWeaps[i].shotsFired = 0;
|
||||
psDroid->asWeaps[i].nStat = 0;
|
||||
psDroid->asWeaps[i].ammo = 0;
|
||||
psDroid->asWeaps[i].recoilValue = 0;
|
||||
psDroid->asWeaps[i].rot.direction = 0;
|
||||
psDroid->asWeaps[i].rot.roll = 0;
|
||||
psDroid->asWeaps[i].rot.pitch = 0;
|
||||
psDroid->asWeaps[i].prevRot = psDroid->asWeaps[i].rot;
|
||||
}
|
||||
|
||||
psDroid->listSize = 0;
|
||||
memset(psDroid->asOrderList, 0, sizeof(ORDER_LIST)*ORDER_LIST_MAX);
|
||||
psDroid->listPendingBegin = 0;
|
||||
psDroid->listPendingEnd = 0;
|
||||
|
||||
psDroid->iAudioID = NO_SOUND;
|
||||
psDroid->psCurAnim = NULL;
|
||||
|
@ -2543,12 +2525,6 @@ DROID *reallyBuildDroid(DROID_TEMPLATE *pTemplate, UDWORD x, UDWORD y, UDWORD pl
|
|||
|
||||
initDroidMovement(psDroid);
|
||||
|
||||
psDroid->selected = false;
|
||||
psDroid->lastEmission = 0;
|
||||
psDroid->bTargetted = false;
|
||||
psDroid->timeLastHit = UDWORD_MAX;
|
||||
psDroid->lastHitWeapon = WSC_NUM_WEAPON_SUBCLASSES; // no such weapon
|
||||
|
||||
// it was never drawn before
|
||||
psDroid->sDisplay.frameNumber = 0;
|
||||
|
||||
|
@ -2659,8 +2635,6 @@ void initDroidMovement(DROID *psDroid)
|
|||
// Set the asBits in a DROID structure given it's template.
|
||||
void droidSetBits(DROID_TEMPLATE *pTemplate,DROID *psDroid)
|
||||
{
|
||||
UDWORD inc;
|
||||
|
||||
psDroid->droidType = droidTemplateType(pTemplate);
|
||||
psDroid->rot.direction = 0;
|
||||
psDroid->rot.pitch = 0;
|
||||
|
@ -2673,26 +2647,25 @@ void droidSetBits(DROID_TEMPLATE *pTemplate,DROID *psDroid)
|
|||
psDroid->prevSpacetime.time = psDroid->time - 1; // -1 for interpolation.
|
||||
|
||||
//create the droids weapons
|
||||
if (pTemplate->numWeaps > 0)
|
||||
{
|
||||
for (inc=0; inc < pTemplate->numWeaps; inc++)
|
||||
for (int inc = 0; inc < DROID_MAXWEAPS; inc++)
|
||||
{
|
||||
psDroid->psActionTarget[inc] = NULL;
|
||||
psDroid->asWeaps[inc].lastFired=0;
|
||||
psDroid->asWeaps[inc].shotsFired=0;
|
||||
psDroid->asWeaps[inc].nStat = pTemplate->asWeaps[inc];
|
||||
// no weapon (could be a construction droid for example)
|
||||
// this is also used to check if a droid has a weapon, so zero it
|
||||
psDroid->asWeaps[inc].nStat = 0;
|
||||
psDroid->asWeaps[inc].recoilValue = 0;
|
||||
psDroid->asWeaps[inc].ammo = (asWeaponStats + psDroid->asWeaps[inc].nStat)->numRounds;
|
||||
psDroid->asWeaps[inc].ammo = 0;
|
||||
psDroid->asWeaps[inc].rot.direction = 0;
|
||||
psDroid->asWeaps[inc].rot.pitch = 0;
|
||||
psDroid->asWeaps[inc].rot.roll = 0;
|
||||
psDroid->asWeaps[inc].prevRot = psDroid->asWeaps[inc].rot;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (inc < pTemplate->numWeaps)
|
||||
{
|
||||
// no weapon (could be a construction droid for example)
|
||||
// this is also used to check if a droid has a weapon, so zero it
|
||||
psDroid->asWeaps[0].nStat = 0;
|
||||
psDroid->asWeaps[inc].nStat = pTemplate->asWeaps[inc];
|
||||
psDroid->asWeaps[inc].ammo = (asWeaponStats + psDroid->asWeaps[inc].nStat)->numRounds;
|
||||
}
|
||||
}
|
||||
//allocate the components hit points
|
||||
psDroid->asBits[COMP_BODY].nStat = (UBYTE)pTemplate->asParts[COMP_BODY];
|
||||
|
@ -4784,7 +4757,7 @@ void checkDroid(const DROID *droid, const char *const location, const char *func
|
|||
ASSERT_HELPER(droid != NULL, location, function, "CHECK_DROID: NULL pointer");
|
||||
ASSERT_HELPER(droid->type == OBJ_DROID, location, function, "CHECK_DROID: Not droid (type %d)", (int)droid->type);
|
||||
ASSERT_HELPER(droid->numWeaps <= DROID_MAXWEAPS, location, function, "CHECK_DROID: Bad number of droid weapons %d", (int)droid->numWeaps);
|
||||
ASSERT_HELPER(droid->listSize <= ORDER_LIST_MAX && droid->listPendingBegin <= ORDER_LIST_MAX && droid->listPendingEnd <= ORDER_LIST_MAX && droid->listSize <= droid->listPendingEnd, location, function, "CHECK_DROID: Bad number of droid orders %d %d %d", (int)droid->listSize, (int)droid->listPendingBegin, (int)droid->listPendingEnd);
|
||||
ASSERT_HELPER((unsigned)droid->listSize <= droid->asOrderList.size() && (unsigned)droid->listPendingBegin <= droid->asOrderList.size(), location, function, "CHECK_DROID: Bad number of droid orders %d %d %d", (int)droid->listSize, (int)droid->listPendingBegin, (int)droid->asOrderList.size());
|
||||
ASSERT_HELPER(droid->player < MAX_PLAYERS, location, function, "CHECK_DROID: Bad droid owner %d", (int)droid->player);
|
||||
ASSERT_HELPER(droidOnMap(droid), location, function, "CHECK_DROID: Droid off map");
|
||||
ASSERT_HELPER(droid->body <= droid->originalBody, location, function, "CHECK_DROID: More body points (%u) than original body points (%u).", (unsigned)droid->body, (unsigned)droid->originalBody);
|
||||
|
|
|
@ -564,11 +564,11 @@ void _syncDebugDroid(const char *function, DROID *psDroid, char ch);
|
|||
|
||||
|
||||
// True iff object is a droid.
|
||||
static inline bool isDroid(BASE_OBJECT const *psObject) { return psObject->type == OBJ_DROID; }
|
||||
static inline bool isDroid(SIMPLE_OBJECT const *psObject) { return psObject->type == OBJ_DROID; }
|
||||
// Returns DROID * if droid or NULL if not.
|
||||
static inline DROID *castDroid(BASE_OBJECT *psObject) { return isDroid(psObject)? (DROID *)psObject : (DROID *)NULL; }
|
||||
static inline DROID *castDroid(SIMPLE_OBJECT *psObject) { return isDroid(psObject)? (DROID *)psObject : (DROID *)NULL; }
|
||||
// Returns DROID const * if droid or NULL if not.
|
||||
static inline DROID const *castDroid(BASE_OBJECT const *psObject) { return isDroid(psObject)? (DROID const *)psObject : (DROID const *)NULL; }
|
||||
static inline DROID const *castDroid(SIMPLE_OBJECT const *psObject) { return isDroid(psObject)? (DROID const *)psObject : (DROID const *)NULL; }
|
||||
|
||||
|
||||
#endif // __INCLUDED_SRC_DROID_H__
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#ifndef __INCLUDED_DROIDDEF_H__
|
||||
#define __INCLUDED_DROIDDEF_H__
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "lib/gamelib/animobj.h"
|
||||
|
||||
#include "stringdef.h"
|
||||
|
@ -58,7 +60,7 @@
|
|||
/* The different types of droid */
|
||||
// NOTE, if you add to, or change this list then you'll need
|
||||
// to update the DroidSelectionWeights lookup table in Display.c
|
||||
typedef enum _droid_type
|
||||
enum DROID_TYPE
|
||||
{
|
||||
DROID_WEAPON, ///< Weapon droid
|
||||
DROID_SENSOR, ///< Sensor droid
|
||||
|
@ -74,23 +76,21 @@ typedef enum _droid_type
|
|||
DROID_CYBORG_REPAIR, ///< cyborg repair droid - new for update 28/5/99
|
||||
DROID_CYBORG_SUPER, ///< cyborg repair droid - new for update 7/6/99
|
||||
DROID_ANY, ///< Any droid. Only used as a parameter for intGotoNextDroidType(DROID_TYPE).
|
||||
} DROID_TYPE;
|
||||
};
|
||||
|
||||
typedef struct _component
|
||||
struct COMPONENT
|
||||
{
|
||||
UBYTE nStat; ///< Allowing a maximum of 255 stats per file
|
||||
} COMPONENT;
|
||||
};
|
||||
|
||||
// maximum number of queued orders
|
||||
#define ORDER_LIST_MAX 10
|
||||
|
||||
typedef struct _order_list
|
||||
struct OrderListEntry
|
||||
{
|
||||
DROID_ORDER order;
|
||||
void* psOrderTarget; ///< this needs to cope with objects and stats
|
||||
UWORD x, y, x2, y2; ///< line build requires two sets of coords
|
||||
uint16_t direction; ///< Needed to align structures with viewport.
|
||||
} ORDER_LIST;
|
||||
void* psOrderTarget; ///< this needs to cope with objects and stats
|
||||
};
|
||||
typedef std::vector<OrderListEntry> OrderList;
|
||||
|
||||
struct DROID_TEMPLATE : public BASE_STATS
|
||||
{
|
||||
|
@ -166,10 +166,9 @@ struct DROID : public BASE_OBJECT
|
|||
struct DROID* psGrpNext;
|
||||
struct STRUCTURE *psBaseStruct; ///< a structure that this droid might be associated with. For VTOLs this is the rearming pad
|
||||
// queued orders
|
||||
SDWORD listSize;
|
||||
ORDER_LIST asOrderList[ORDER_LIST_MAX]; ///< The range [0; listSize - 1] corresponds to synchronised orders, and the range [listPendingBegin; listPendingEnd - 1] corresponds to the orders that will remain, once all orders are synchronised.
|
||||
SDWORD listSize; ///< Gives the number of synchronised orders. Orders from listSize to the real end of the list may not affect game state.
|
||||
OrderList asOrderList; ///< The range [0; listSize - 1] corresponds to synchronised orders, and the range [listPendingBegin; listPendingEnd - 1] corresponds to the orders that will remain, once all orders are synchronised.
|
||||
unsigned listPendingBegin; ///< Index of first order which will not be erased by a pending order. After all messages are processed, the orders in the range [listPendingBegin; listPendingEnd - 1] will remain.
|
||||
unsigned listPendingEnd; ///< Index of last order which might not yet have been synchronised, plus one.
|
||||
|
||||
/* Order data */
|
||||
DROID_ORDER order;
|
||||
|
@ -206,7 +205,7 @@ struct DROID : public BASE_OBJECT
|
|||
|
||||
/* Movement control data */
|
||||
MOVE_CONTROL sMove;
|
||||
SPACETIME prevSpacetime; ///< Location of droid in previous tick.
|
||||
Spacetime prevSpacetime; ///< Location of droid in previous tick.
|
||||
uint8_t blockedBits; ///< Bit set telling which tiles block this type of droid (TODO)
|
||||
|
||||
/* anim data */
|
||||
|
|
|
@ -2528,7 +2528,7 @@ static void effectStructureUpdates(void)
|
|||
|
||||
if (selectedPlayer == psStructure->player)
|
||||
{
|
||||
audio_PlayObjStaticTrack((void*)psStructure, ID_SOUND_POWER_SPARK);
|
||||
audio_PlayObjStaticTrack(psStructure, ID_SOUND_POWER_SPARK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -327,13 +327,9 @@ FEATURE * buildFeature(FEATURE_STATS *psStats, UDWORD x, UDWORD y,BOOL FromSave)
|
|||
{
|
||||
psFeature->rot.direction = 0;
|
||||
}
|
||||
psFeature->selected = false;
|
||||
psFeature->body = psStats->body;
|
||||
objSensorCache((BASE_OBJECT *)psFeature, NULL);
|
||||
objEcmCache((BASE_OBJECT *)psFeature, NULL);
|
||||
psFeature->bTargetted = false;
|
||||
psFeature->timeLastHit = 0;
|
||||
psFeature->lastHitWeapon = WSC_NUM_WEAPON_SUBCLASSES; // no such weapon
|
||||
|
||||
// it has never been drawn
|
||||
psFeature->sDisplay.frameNumber = 0;
|
||||
|
|
|
@ -65,4 +65,12 @@ extern void featureInitVars(void);
|
|||
#define syncDebugFeature(psFeature, ch) _syncDebugFeature(__FUNCTION__, psFeature, ch)
|
||||
void _syncDebugFeature(const char *function, FEATURE *psFeature, char ch);
|
||||
|
||||
|
||||
// True iff object is a feature.
|
||||
static inline bool isFeature(SIMPLE_OBJECT const *psObject) { return psObject->type == OBJ_FEATURE; }
|
||||
// Returns FEATURE * if feature or NULL if not.
|
||||
static inline FEATURE *castFeature(SIMPLE_OBJECT *psObject) { return isFeature(psObject)? (FEATURE *)psObject : (FEATURE *)NULL; }
|
||||
// Returns FEATURE const * if feature or NULL if not.
|
||||
static inline FEATURE const *castFeature(SIMPLE_OBJECT const *psObject) { return isFeature(psObject)? (FEATURE const *)psObject : (FEATURE const *)NULL; }
|
||||
|
||||
#endif // __INCLUDED_SRC_FEATURE_H__
|
||||
|
|
|
@ -1496,9 +1496,7 @@ void displayTextOption(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, WZ_DECL
|
|||
|
||||
void addBackdrop(void)
|
||||
{
|
||||
W_FORMINIT sFormInit;
|
||||
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT)); // Backdrop
|
||||
W_FORMINIT sFormInit; // Backdrop
|
||||
sFormInit.formID = 0;
|
||||
sFormInit.id = FRONTEND_BACKDROP;
|
||||
sFormInit.style = WFORM_PLAIN;
|
||||
|
@ -1515,8 +1513,6 @@ void addTopForm(void)
|
|||
{
|
||||
W_FORMINIT sFormInit;
|
||||
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
|
||||
sFormInit.formID = FRONTEND_BACKDROP;
|
||||
sFormInit.id = FRONTEND_TOPFORM;
|
||||
sFormInit.style = WFORM_PLAIN;
|
||||
|
@ -1553,7 +1549,6 @@ void addTopForm(void)
|
|||
void addBottomForm(void)
|
||||
{
|
||||
W_FORMINIT sFormInit;
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
|
||||
sFormInit.formID = FRONTEND_BACKDROP;
|
||||
sFormInit.id = FRONTEND_BOTFORM;
|
||||
|
@ -1573,18 +1568,15 @@ void addBottomForm(void)
|
|||
void addTextHint(UDWORD id, UDWORD PosX, UDWORD PosY, const char *txt)
|
||||
{
|
||||
W_LABINIT sLabInit;
|
||||
memset(&sLabInit, 0, sizeof(W_LABINIT));
|
||||
|
||||
sLabInit.formID = FRONTEND_BOTFORM;
|
||||
sLabInit.id = id;
|
||||
sLabInit.x = (short)PosX;
|
||||
sLabInit.y = (short)PosY;
|
||||
sLabInit.style = WLAB_PLAIN;
|
||||
|
||||
sLabInit.width = MULTIOP_READY_WIDTH;
|
||||
sLabInit.height = FRONTEND_BUTHEIGHT;
|
||||
sLabInit.pDisplay = displayText;
|
||||
sLabInit.FontID = font_regular;
|
||||
sLabInit.pText = txt;
|
||||
widgAddLabel(psWScreen, &sLabInit);
|
||||
}
|
||||
|
@ -1593,13 +1585,12 @@ void addTextHint(UDWORD id, UDWORD PosX, UDWORD PosY, const char *txt)
|
|||
void addText(UDWORD id, UDWORD PosX, UDWORD PosY, const char *txt, UDWORD formID)
|
||||
{
|
||||
W_LABINIT sLabInit;
|
||||
memset(&sLabInit, 0, sizeof(W_LABINIT));
|
||||
|
||||
sLabInit.formID = formID;
|
||||
sLabInit.id = id;
|
||||
sLabInit.x = (short)PosX;
|
||||
sLabInit.y = (short)PosY;
|
||||
sLabInit.style = (WLAB_PLAIN | WLAB_ALIGNCENTRE);
|
||||
sLabInit.style = WLAB_ALIGNCENTRE;
|
||||
|
||||
// Align
|
||||
sLabInit.width = MULTIOP_READY_WIDTH;
|
||||
|
@ -1616,11 +1607,9 @@ void addText(UDWORD id, UDWORD PosX, UDWORD PosY, const char *txt, UDWORD formID
|
|||
void addSideText(UDWORD id, UDWORD PosX, UDWORD PosY, const char *txt)
|
||||
{
|
||||
W_LABINIT sLabInit;
|
||||
memset(&sLabInit, 0, sizeof(W_LABINIT));
|
||||
|
||||
sLabInit.formID = FRONTEND_BACKDROP;
|
||||
sLabInit.id = id;
|
||||
sLabInit.style = WLAB_PLAIN;
|
||||
sLabInit.x = (short) PosX;
|
||||
sLabInit.y = (short) PosY;
|
||||
sLabInit.width = 30;
|
||||
|
@ -1637,13 +1626,11 @@ void addSideText(UDWORD id, UDWORD PosX, UDWORD PosY, const char *txt)
|
|||
void addTextButton(UDWORD id, UDWORD PosX, UDWORD PosY, const char *txt, unsigned int style)
|
||||
{
|
||||
W_BUTINIT sButInit;
|
||||
memset(&sButInit, 0, sizeof(W_BUTINIT));
|
||||
|
||||
sButInit.formID = FRONTEND_BOTFORM;
|
||||
sButInit.id = id;
|
||||
sButInit.x = (short)PosX;
|
||||
sButInit.y = (short)PosY;
|
||||
sButInit.style = WBUT_PLAIN;
|
||||
|
||||
// Align
|
||||
if ( !(style & WBUT_TXTCENTRE) )
|
||||
|
@ -1682,16 +1669,12 @@ void addTextButton(UDWORD id, UDWORD PosX, UDWORD PosY, const char *txt, unsign
|
|||
void addFESlider(UDWORD id, UDWORD parent, UDWORD x, UDWORD y, UDWORD stops, UDWORD pos)
|
||||
{
|
||||
W_SLDINIT sSldInit;
|
||||
|
||||
memset(&sSldInit, 0, sizeof(W_SLDINIT));
|
||||
sSldInit.formID = parent;
|
||||
sSldInit.id = id;
|
||||
sSldInit.style = WSLD_PLAIN;
|
||||
sSldInit.x = (short)x;
|
||||
sSldInit.y = (short)y;
|
||||
sSldInit.width = iV_GetImageWidth(IntImages,IMAGE_SLIDER_BIG);
|
||||
sSldInit.height = iV_GetImageHeight(IntImages,IMAGE_SLIDER_BIG);
|
||||
sSldInit.orientation= WSLD_LEFT;
|
||||
sSldInit.numStops = (UBYTE) stops;
|
||||
sSldInit.barSize = iV_GetImageHeight(IntImages,IMAGE_SLIDER_BIG);
|
||||
sSldInit.pos = (UBYTE) pos;
|
||||
|
@ -1703,16 +1686,12 @@ void addFESlider(UDWORD id, UDWORD parent, UDWORD x, UDWORD y, UDWORD stops, UDW
|
|||
void addFEAISlider(UDWORD id, UDWORD parent, UDWORD x, UDWORD y, UDWORD stops, UDWORD pos)
|
||||
{
|
||||
W_SLDINIT sSldInit;
|
||||
|
||||
memset(&sSldInit, 0, sizeof(W_SLDINIT));
|
||||
sSldInit.formID = parent;
|
||||
sSldInit.id = id;
|
||||
sSldInit.style = WSLD_PLAIN;
|
||||
sSldInit.x = (short)x;
|
||||
sSldInit.y = (short)y;
|
||||
sSldInit.width = iV_GetImageWidth(IntImages,IMAGE_SLIDER_BIG);
|
||||
sSldInit.height = iV_GetImageHeight(IntImages,IMAGE_SLIDER_BIG);
|
||||
sSldInit.orientation= WSLD_LEFT;
|
||||
sSldInit.numStops = (UBYTE) stops;
|
||||
sSldInit.barSize = iV_GetImageHeight(IntImages,IMAGE_SLIDER_BIG);
|
||||
sSldInit.pos = (UBYTE) pos;
|
||||
|
|
18
src/game.cpp
18
src/game.cpp
|
@ -2425,20 +2425,10 @@ BOOL loadGame(const char *pGameToLoad, BOOL keepObjects, BOOL freeMem, BOOL User
|
|||
//JPS 25 feb
|
||||
//initialise upgrades
|
||||
//initialise the structure upgrade arrays
|
||||
memset(asStructureUpgrade, 0, sizeof(asStructureUpgrade));
|
||||
memset(asWallDefenceUpgrade, 0, sizeof(asWallDefenceUpgrade));
|
||||
memset(asResearchUpgrade, 0, sizeof(asResearchUpgrade));
|
||||
memset(asPowerUpgrade, 0, sizeof(asPowerUpgrade));
|
||||
memset(asRepairFacUpgrade, 0, sizeof(asRepairFacUpgrade));
|
||||
memset(asProductionUpgrade, 0, sizeof(asProductionUpgrade));
|
||||
memset(asReArmUpgrade, 0, sizeof(asReArmUpgrade));
|
||||
// *Duplicate code to loadStructureStats() removed.*
|
||||
|
||||
//initialise the upgrade structures
|
||||
memset(asWeaponUpgrade, 0, sizeof(asWeaponUpgrade));
|
||||
memset(asSensorUpgrade, 0, sizeof(asSensorUpgrade));
|
||||
memset(asECMUpgrade, 0, sizeof(asECMUpgrade));
|
||||
memset(asRepairUpgrade, 0, sizeof(asRepairUpgrade));
|
||||
memset(asBodyUpgrade, 0, sizeof(asBodyUpgrade));
|
||||
// *Duplicate and buggy code to statsInitVars() removed.*
|
||||
//JPS 25 feb
|
||||
}
|
||||
|
||||
|
@ -7472,7 +7462,7 @@ BOOL loadSaveStructureV19(char *pFileData, UDWORD filesize, UDWORD numStructures
|
|||
checkForResExtractors(psStructure);
|
||||
if(selectedPlayer == psStructure->player)
|
||||
{
|
||||
audio_PlayObjStaticTrack( (void *) psStructure, ID_SOUND_POWER_HUM );
|
||||
audio_PlayObjStaticTrack(psStructure, ID_SOUND_POWER_HUM);
|
||||
}
|
||||
break;
|
||||
case REF_RESOURCE_EXTRACTOR:
|
||||
|
@ -7879,7 +7869,7 @@ BOOL loadSaveStructureV(char *pFileData, UDWORD filesize, UDWORD numStructures,
|
|||
checkForResExtractors(psStructure);
|
||||
if(selectedPlayer == psStructure->player)
|
||||
{
|
||||
audio_PlayObjStaticTrack( (void *) psStructure, ID_SOUND_POWER_HUM );
|
||||
audio_PlayObjStaticTrack(psStructure, ID_SOUND_POWER_HUM);
|
||||
}
|
||||
break;
|
||||
case REF_RESOURCE_EXTRACTOR:
|
||||
|
|
170
src/hci.cpp
170
src/hci.cpp
|
@ -917,10 +917,6 @@ static BOOL intAddEdit(void)
|
|||
W_LABINIT sLabInit;
|
||||
W_BUTINIT sButInit;
|
||||
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
memset(&sLabInit, 0, sizeof(W_LABINIT));
|
||||
memset(&sButInit, 0, sizeof(W_BUTINIT));
|
||||
|
||||
/* Add the edit form */
|
||||
sFormInit.formID = 0;
|
||||
sFormInit.id = IDED_FORM;
|
||||
|
@ -937,13 +933,11 @@ static BOOL intAddEdit(void)
|
|||
/* Add the Option screen label */
|
||||
sLabInit.formID = IDED_FORM;
|
||||
sLabInit.id = IDED_LABEL;
|
||||
sLabInit.style = WLAB_PLAIN;
|
||||
sLabInit.x = ED_GAP;
|
||||
sLabInit.y = ED_GAP;
|
||||
sLabInit.width = ED_WIDTH;
|
||||
sLabInit.height = ED_BUTHEIGHT;
|
||||
sLabInit.pText = "Edit";
|
||||
sLabInit.FontID = font_regular;
|
||||
if (!widgAddLabel(psWScreen, &sLabInit))
|
||||
{
|
||||
return false;
|
||||
|
@ -952,12 +946,10 @@ static BOOL intAddEdit(void)
|
|||
/* Add the close box */
|
||||
sButInit.formID = IDED_FORM;
|
||||
sButInit.id = IDED_CLOSE;
|
||||
sButInit.style = WBUT_PLAIN;
|
||||
sButInit.x = ED_WIDTH - ED_GAP - CLOSE_SIZE;
|
||||
sButInit.y = ED_GAP;
|
||||
sButInit.width = CLOSE_SIZE;
|
||||
sButInit.height = CLOSE_SIZE;
|
||||
sButInit.FontID = font_regular;
|
||||
sButInit.pText = pCloseText;
|
||||
sButInit.pTip = _("Close");
|
||||
if (!widgAddButton(psWScreen, &sButInit))
|
||||
|
@ -3425,13 +3417,12 @@ UWORD numForms(UDWORD total, UDWORD perForm)
|
|||
/* Add the reticule widgets to the widget screen */
|
||||
BOOL intAddReticule(void)
|
||||
{
|
||||
if(ReticuleUp == false) {
|
||||
W_FORMINIT sFormInit;
|
||||
W_BUTINIT sButInit;
|
||||
if (!ReticuleUp)
|
||||
{
|
||||
|
||||
/* Create the basic form */
|
||||
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
W_FORMINIT sFormInit;
|
||||
sFormInit.formID = 0;
|
||||
sFormInit.id = IDRET_FORM;
|
||||
sFormInit.style = WFORM_PLAIN;
|
||||
|
@ -3448,18 +3439,17 @@ BOOL intAddReticule(void)
|
|||
/* Now add the buttons */
|
||||
|
||||
//set up default button data
|
||||
memset(&sButInit, 0, sizeof(W_BUTINIT));
|
||||
W_BUTINIT sButInit;
|
||||
sButInit.formID = IDRET_FORM;
|
||||
sButInit.id = IDRET_COMMAND;
|
||||
sButInit.width = RET_BUTWIDTH;
|
||||
sButInit.height = RET_BUTHEIGHT;
|
||||
sButInit.FontID = font_regular;
|
||||
|
||||
//add buttons as required...
|
||||
|
||||
//options button
|
||||
sButInit.style = WBUT_PLAIN;
|
||||
SetReticuleButPos(RETBUT_COMMAND,&sButInit);
|
||||
sButInit.style = WBUT_PLAIN;
|
||||
sButInit.pTip = _("Commanders (F6)");
|
||||
sButInit.pDisplay = intDisplayReticuleButton;
|
||||
sButInit.UserData = IMAGE_COMMANDDROID_UP;
|
||||
|
@ -3470,7 +3460,7 @@ BOOL intAddReticule(void)
|
|||
}
|
||||
|
||||
/* Intelligence Map button - this needs to respond to RMB as well*/
|
||||
sButInit.style = WBUT_PLAIN | WFORM_SECONDARY;
|
||||
sButInit.style = WBUT_SECONDARY;
|
||||
sButInit.id = IDRET_INTEL_MAP;
|
||||
SetReticuleButPos(RETBUT_INTELMAP,&sButInit);
|
||||
sButInit.pTip = _("Intelligence Display (F5)");
|
||||
|
@ -3583,14 +3573,11 @@ BOOL intAddPower(void)
|
|||
{
|
||||
W_BARINIT sBarInit;
|
||||
|
||||
memset(&sBarInit, 0, sizeof(W_BARINIT));
|
||||
|
||||
/* Add the trough bar */
|
||||
sBarInit.formID = 0; //IDPOW_FORM;
|
||||
sBarInit.id = IDPOW_POWERBAR_T;
|
||||
//start the power bar off in view (default)
|
||||
sBarInit.style = WBAR_TROUGH;
|
||||
sBarInit.orientation = WBAR_LEFT;
|
||||
sBarInit.x = (SWORD)POW_X;
|
||||
sBarInit.y = (SWORD)POW_Y;
|
||||
sBarInit.width = POW_BARWIDTH;
|
||||
|
@ -3628,11 +3615,6 @@ BOOL intAddOptions(void)
|
|||
UDWORD player;
|
||||
char aText[WIDG_MAXSTR];
|
||||
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
memset(&sLabInit, 0, sizeof(W_LABINIT));
|
||||
memset(&sButInit, 0, sizeof(W_BUTINIT));
|
||||
memset(&sEdInit, 0, sizeof(W_EDBINIT));
|
||||
|
||||
/* Add the option form */
|
||||
|
||||
sFormInit.formID = 0;
|
||||
|
@ -3653,13 +3635,11 @@ BOOL intAddOptions(void)
|
|||
/* Add the Option screen label */
|
||||
sLabInit.formID = IDOPT_FORM;
|
||||
sLabInit.id = IDOPT_LABEL;
|
||||
sLabInit.style = WLAB_PLAIN;
|
||||
sLabInit.x = OPT_GAP;
|
||||
sLabInit.y = OPT_GAP;
|
||||
sLabInit.width = OPT_BUTWIDTH;
|
||||
sLabInit.height = OPT_BUTHEIGHT;
|
||||
sLabInit.pText = _("Options");
|
||||
sLabInit.FontID = font_regular;
|
||||
if (!widgAddLabel(psWScreen, &sLabInit))
|
||||
{
|
||||
return false;
|
||||
|
@ -3668,12 +3648,10 @@ BOOL intAddOptions(void)
|
|||
/* Add the close box */
|
||||
sButInit.formID = IDOPT_FORM;
|
||||
sButInit.id = IDOPT_CLOSE;
|
||||
sButInit.style = WBUT_PLAIN;
|
||||
sButInit.x = OPT_WIDTH - OPT_GAP - CLOSE_SIZE;
|
||||
sButInit.y = OPT_GAP;
|
||||
sButInit.width = CLOSE_SIZE;
|
||||
sButInit.height = CLOSE_SIZE;
|
||||
sButInit.FontID = font_regular;
|
||||
sButInit.pText = pCloseText;
|
||||
sButInit.pTip = _("Close");
|
||||
if (!widgAddButton(psWScreen, &sButInit))
|
||||
|
@ -3697,11 +3675,9 @@ BOOL intAddOptions(void)
|
|||
/* Add the map label */
|
||||
sLabInit.formID = IDOPT_MAPFORM;
|
||||
sLabInit.id = IDOPT_MAPLABEL;
|
||||
sLabInit.style = WLAB_PLAIN;
|
||||
sLabInit.x = OPT_GAP;
|
||||
sLabInit.y = OPT_GAP;
|
||||
sLabInit.pText = _("Map:");
|
||||
sLabInit.FontID = font_regular;
|
||||
if (!widgAddLabel(psWScreen, &sLabInit))
|
||||
{
|
||||
return false;
|
||||
|
@ -3743,14 +3719,12 @@ BOOL intAddOptions(void)
|
|||
newMapHeight = mapHeight;
|
||||
sEdInit.formID = IDOPT_MAPFORM;
|
||||
sEdInit.id = IDOPT_MAPWIDTH;
|
||||
sEdInit.style = WEDB_PLAIN;
|
||||
sEdInit.x = OPT_GAP*2 + OPT_BUTWIDTH;
|
||||
sEdInit.y = OPT_GAP*2 + OPT_BUTHEIGHT;
|
||||
sEdInit.width = OPT_BUTWIDTH;
|
||||
sEdInit.height = OPT_BUTHEIGHT;
|
||||
sEdInit.pText = aText;
|
||||
sprintf(aText, "%d", mapWidth);
|
||||
sEdInit.FontID = font_regular;
|
||||
if (!widgAddEditBox(psWScreen, &sEdInit))
|
||||
{
|
||||
return false;
|
||||
|
@ -3872,11 +3846,9 @@ BOOL intAddOptions(void)
|
|||
/* Add the player label */
|
||||
sLabInit.formID = IDOPT_PLAYERFORM;
|
||||
sLabInit.id = IDOPT_PLAYERLABEL;
|
||||
sLabInit.style = WLAB_PLAIN;
|
||||
sLabInit.x = OPT_GAP;
|
||||
sLabInit.y = OPT_GAP;
|
||||
sLabInit.pText = _("Current Player:");
|
||||
sLabInit.FontID = font_regular;
|
||||
if (!widgAddLabel(psWScreen, &sLabInit))
|
||||
{
|
||||
return false;
|
||||
|
@ -3885,12 +3857,10 @@ BOOL intAddOptions(void)
|
|||
/* Add the player buttons */
|
||||
sButInit.formID = IDOPT_PLAYERFORM;
|
||||
sButInit.id = IDOPT_PLAYERSTART;
|
||||
sButInit.style = WBUT_PLAIN;
|
||||
sButInit.x = OPT_GAP;
|
||||
sButInit.y = OPT_BUTHEIGHT + OPT_GAP*2;
|
||||
sButInit.width = OPT_BUTWIDTH;
|
||||
sButInit.height = OPT_BUTHEIGHT;
|
||||
sButInit.FontID = font_regular;
|
||||
for(player = 0; player < MAX_PLAYERS; player++)
|
||||
{
|
||||
sButInit.pText = apPlayerText[player];
|
||||
|
@ -3926,11 +3896,9 @@ BOOL intAddOptions(void)
|
|||
/* Add iViS label */
|
||||
sLabInit.formID = IDOPT_IVISFORM;
|
||||
sLabInit.id = IDOPT_IVISLABEL;
|
||||
sLabInit.style = WLAB_PLAIN;
|
||||
sLabInit.x = OPT_GAP;
|
||||
sLabInit.y = OPT_GAP;
|
||||
sLabInit.pText = "iViS:";
|
||||
sLabInit.FontID = font_regular;
|
||||
if (!widgAddLabel(psWScreen, &sLabInit))
|
||||
{
|
||||
return false;
|
||||
|
@ -3943,7 +3911,6 @@ BOOL intAddOptions(void)
|
|||
sButInit.y = OPT_GAP;
|
||||
sButInit.width = OPT_BUTWIDTH;
|
||||
sButInit.height = OPT_BUTHEIGHT;
|
||||
sButInit.FontID = font_regular;
|
||||
sButInit.pText = "Lighting";
|
||||
sButInit.pTip = "Toggles lighting On/Off.";
|
||||
if (!widgAddButton(psWScreen, &sButInit))
|
||||
|
@ -3970,11 +3937,6 @@ BOOL intAddOptions(void)
|
|||
*/
|
||||
static BOOL intAddObjectWindow(BASE_OBJECT *psObjects, BASE_OBJECT *psSelected,BOOL bForceStats)
|
||||
{
|
||||
W_FORMINIT sFormInit;
|
||||
W_FORMINIT sBFormInit,sBFormInit2;
|
||||
W_BARINIT sBarInit;
|
||||
W_BARINIT sBarInit2;
|
||||
W_BUTINIT sButInit;
|
||||
UDWORD displayForm;
|
||||
UDWORD i, statID=0;
|
||||
SDWORD objLoop;
|
||||
|
@ -3983,11 +3945,6 @@ static BOOL intAddObjectWindow(BASE_OBJECT *psObjects, BASE_OBJECT *psSelected,B
|
|||
SDWORD BufferID;
|
||||
DROID *Droid;
|
||||
STRUCTURE *Structure;
|
||||
W_LABINIT sLabInit;
|
||||
W_LABINIT sLabIntObjText;
|
||||
W_LABINIT sLabInitCmdExp;
|
||||
W_LABINIT sLabInitCmdFac;
|
||||
W_LABINIT sLabInitCmdFac2;
|
||||
BOOL IsFactory;
|
||||
BOOL Animate = true;
|
||||
UWORD FormX,FormY;
|
||||
|
@ -4009,11 +3966,6 @@ static BOOL intAddObjectWindow(BASE_OBJECT *psObjects, BASE_OBJECT *psSelected,B
|
|||
ClearObjectBuffers();
|
||||
ClearTopicBuffers();
|
||||
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
memset(&sBFormInit, 0, sizeof(W_FORMINIT));
|
||||
memset(&sBFormInit2, 0, sizeof(W_FORMINIT));
|
||||
memset(&sBarInit, 0, sizeof(W_BARINIT));
|
||||
|
||||
/* See how many objects the player has */
|
||||
numObjects = 0;
|
||||
psFirst = NULL;
|
||||
|
@ -4134,6 +4086,7 @@ static BOOL intAddObjectWindow(BASE_OBJECT *psObjects, BASE_OBJECT *psSelected,B
|
|||
|
||||
/* Create the basic form */
|
||||
|
||||
W_FORMINIT sFormInit;
|
||||
sFormInit.formID = 0;
|
||||
sFormInit.id = IDOBJ_FORM;
|
||||
sFormInit.style = WFORM_PLAIN;
|
||||
|
@ -4157,16 +4110,14 @@ static BOOL intAddObjectWindow(BASE_OBJECT *psObjects, BASE_OBJECT *psSelected,B
|
|||
}
|
||||
|
||||
/* Add the close button */
|
||||
memset(&sButInit, 0, sizeof(W_BUTINIT));
|
||||
W_BUTINIT sButInit;
|
||||
sButInit.formID = IDOBJ_FORM;
|
||||
sButInit.id = IDOBJ_CLOSE;
|
||||
sButInit.style = WBUT_PLAIN;
|
||||
sButInit.x = OBJ_BACKWIDTH - CLOSE_WIDTH;
|
||||
sButInit.y = 0;
|
||||
sButInit.width = CLOSE_WIDTH;
|
||||
sButInit.height = CLOSE_HEIGHT;
|
||||
sButInit.pTip = _("Close");
|
||||
sButInit.FontID = font_regular;
|
||||
sButInit.pDisplay = intDisplayImageHilight;
|
||||
sButInit.UserData = PACKDWORD_TRI(0,IMAGE_CLOSEHILIGHT , IMAGE_CLOSE);
|
||||
if (!widgAddButton(psWScreen, &sButInit))
|
||||
|
@ -4176,7 +4127,7 @@ static BOOL intAddObjectWindow(BASE_OBJECT *psObjects, BASE_OBJECT *psSelected,B
|
|||
|
||||
|
||||
/*add the tabbed form */
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
sFormInit = W_FORMINIT();
|
||||
sFormInit.formID = IDOBJ_FORM;
|
||||
sFormInit.id = IDOBJ_TABFORM;
|
||||
sFormInit.style = WFORM_TABBED;
|
||||
|
@ -4219,6 +4170,7 @@ static BOOL intAddObjectWindow(BASE_OBJECT *psObjects, BASE_OBJECT *psSelected,B
|
|||
objNumTabs = sFormInit.numMajor;
|
||||
|
||||
/* Add the object and stats buttons */
|
||||
W_FORMINIT sBFormInit;
|
||||
sBFormInit.formID = IDOBJ_TABFORM;
|
||||
sBFormInit.id = IDOBJ_OBJSTART;
|
||||
sBFormInit.majorID = 0;
|
||||
|
@ -4228,17 +4180,17 @@ static BOOL intAddObjectWindow(BASE_OBJECT *psObjects, BASE_OBJECT *psSelected,B
|
|||
sBFormInit.y = OBJ_STARTY;
|
||||
sBFormInit.width = OBJ_BUTWIDTH;
|
||||
sBFormInit.height = OBJ_BUTHEIGHT;
|
||||
memcpy(&sBFormInit2,&sBFormInit,sizeof(W_FORMINIT));
|
||||
W_FORMINIT sBFormInit2 = sBFormInit;
|
||||
sBFormInit2.id = IDOBJ_STATSTART;
|
||||
sBFormInit2.y = OBJ_STATSTARTY;
|
||||
//right click on a Template will put the production on hold
|
||||
sBFormInit2.style = WFORM_CLICKABLE | WFORM_SECONDARY;
|
||||
|
||||
// Action progress bar.
|
||||
W_BARINIT sBarInit;
|
||||
sBarInit.formID = IDOBJ_OBJSTART;
|
||||
sBarInit.id = IDOBJ_PROGBARSTART;
|
||||
sBarInit.style = WBAR_TROUGH | WIDG_HIDDEN;
|
||||
sBarInit.orientation = WBAR_LEFT;
|
||||
sBarInit.x = STAT_PROGBARX;
|
||||
sBarInit.y = STAT_PROGBARY;
|
||||
sBarInit.width = STAT_PROGBARWIDTH;
|
||||
|
@ -4249,7 +4201,7 @@ static BOOL intAddObjectWindow(BASE_OBJECT *psObjects, BASE_OBJECT *psSelected,B
|
|||
sBarInit.pTip = _("Progress Bar");
|
||||
|
||||
// object output bar ie manuf power o/p, research power o/p
|
||||
memcpy(&sBarInit2,&sBarInit,sizeof(W_BARINIT));
|
||||
W_BARINIT sBarInit2 = sBarInit;
|
||||
sBarInit2.id = IDOBJ_POWERBARSTART;
|
||||
sBarInit2.style = WBAR_PLAIN;
|
||||
sBarInit2.x = STAT_POWERBARX;
|
||||
|
@ -4258,55 +4210,50 @@ static BOOL intAddObjectWindow(BASE_OBJECT *psObjects, BASE_OBJECT *psSelected,B
|
|||
// don't set the tip cos we haven't got a suitable text string at this point - 2/2/99
|
||||
sBarInit2.pTip = NULL;
|
||||
|
||||
memset(&sLabInit,0,sizeof(W_LABINIT));
|
||||
W_LABINIT sLabInit;
|
||||
sLabInit.id = IDOBJ_COUNTSTART;
|
||||
sLabInit.style = WLAB_PLAIN | WIDG_HIDDEN;
|
||||
sLabInit.style = WIDG_HIDDEN;
|
||||
sLabInit.x = OBJ_TEXTX;
|
||||
sLabInit.y = OBJ_T1TEXTY;
|
||||
sLabInit.width = 16;
|
||||
sLabInit.height = 16;
|
||||
sLabInit.pText = "BUG! (a)";
|
||||
sLabInit.FontID = font_regular;
|
||||
|
||||
memset(&sLabInitCmdFac,0,sizeof(W_LABINIT));
|
||||
W_LABINIT sLabInitCmdFac;
|
||||
sLabInitCmdFac.id = IDOBJ_CMDFACSTART;
|
||||
sLabInitCmdFac.style = WLAB_PLAIN | WIDG_HIDDEN;
|
||||
sLabInitCmdFac.style = WIDG_HIDDEN;
|
||||
sLabInitCmdFac.x = OBJ_TEXTX;
|
||||
sLabInitCmdFac.y = OBJ_T2TEXTY;
|
||||
sLabInitCmdFac.width = 16;
|
||||
sLabInitCmdFac.height = 16;
|
||||
sLabInitCmdFac.pText = "BUG! (b)";
|
||||
sLabInitCmdFac.FontID = font_regular;
|
||||
|
||||
memset(&sLabInitCmdFac2,0,sizeof(W_LABINIT));
|
||||
W_LABINIT sLabInitCmdFac2;
|
||||
sLabInitCmdFac2.id = IDOBJ_CMDVTOLFACSTART;
|
||||
sLabInitCmdFac2.style = WLAB_PLAIN | WIDG_HIDDEN;
|
||||
sLabInitCmdFac2.style = WIDG_HIDDEN;
|
||||
sLabInitCmdFac2.x = OBJ_TEXTX;
|
||||
sLabInitCmdFac2.y = OBJ_T3TEXTY;
|
||||
sLabInitCmdFac2.width = 16;
|
||||
sLabInitCmdFac2.height = 16;
|
||||
sLabInitCmdFac2.pText = "BUG! (c)";
|
||||
sLabInitCmdFac2.FontID = font_regular;
|
||||
|
||||
memset(&sLabIntObjText,0,sizeof(W_LABINIT));
|
||||
W_LABINIT sLabIntObjText;
|
||||
sLabIntObjText.id = IDOBJ_FACTORYSTART;
|
||||
sLabIntObjText.style = WLAB_PLAIN | WIDG_HIDDEN;
|
||||
sLabIntObjText.style = WIDG_HIDDEN;
|
||||
sLabIntObjText.x = OBJ_TEXTX;
|
||||
sLabIntObjText.y = OBJ_B1TEXTY;
|
||||
sLabIntObjText.width = 16;
|
||||
sLabIntObjText.height = 16;
|
||||
sLabIntObjText.pText = "xxx/xxx - overrun";
|
||||
sLabIntObjText.FontID = font_regular;
|
||||
|
||||
memset(&sLabInitCmdExp,0,sizeof(W_LABINIT));
|
||||
W_LABINIT sLabInitCmdExp;
|
||||
sLabInitCmdExp.id = IDOBJ_CMDEXPSTART;
|
||||
sLabInitCmdExp.style = WLAB_PLAIN | WIDG_HIDDEN;
|
||||
sLabInitCmdExp.style = WIDG_HIDDEN;
|
||||
sLabInitCmdExp.x = STAT_POWERBARX;
|
||||
sLabInitCmdExp.y = STAT_POWERBARY;
|
||||
sLabInitCmdExp.width = 16;
|
||||
sLabInitCmdExp.height = 16;
|
||||
sLabInitCmdExp.pText = "@@@@@ - overrun";
|
||||
sLabInitCmdExp.FontID = font_regular;
|
||||
|
||||
displayForm = 0;
|
||||
for(i=0; i<(UDWORD)numObjects; i++)
|
||||
|
@ -4929,9 +4876,6 @@ static BASE_OBJECT *intGetObject(UDWORD id)
|
|||
/* Reset the stats button for an object */
|
||||
static void intSetStats(UDWORD id, BASE_STATS *psStats)
|
||||
{
|
||||
W_FORMINIT sFormInit;
|
||||
W_BARINIT sBarInit;
|
||||
W_LABINIT sLabInit;
|
||||
UDWORD butPerForm, butPos;
|
||||
SDWORD BufferID;
|
||||
BASE_OBJECT *psObj;
|
||||
|
@ -4939,9 +4883,7 @@ static void intSetStats(UDWORD id, BASE_STATS *psStats)
|
|||
/* Update the button on the object screen */
|
||||
widgDelete(psWScreen, id);
|
||||
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
memset(&sBarInit, 0, sizeof(W_BARINIT));
|
||||
|
||||
W_FORMINIT sFormInit;
|
||||
sFormInit.formID = IDOBJ_TABFORM;
|
||||
butPerForm = (OBJ_WIDTH - OBJ_GAP) / (OBJ_BUTWIDTH + OBJ_GAP);
|
||||
sFormInit.majorID = (UWORD)((id - IDOBJ_STATSTART) / butPerForm);
|
||||
|
@ -4955,10 +4897,10 @@ static void intSetStats(UDWORD id, BASE_STATS *psStats)
|
|||
sFormInit.height = OBJ_BUTHEIGHT;
|
||||
|
||||
// Action progress bar.
|
||||
W_BARINIT sBarInit;
|
||||
sBarInit.formID = id;
|
||||
sBarInit.id = (id - IDOBJ_STATSTART) + IDOBJ_PROGBARSTART;
|
||||
sBarInit.style = WBAR_TROUGH;
|
||||
sBarInit.orientation = WBAR_LEFT;
|
||||
sBarInit.x = STAT_PROGBARX;
|
||||
sBarInit.y = STAT_PROGBARY;
|
||||
sBarInit.width = STAT_PROGBARWIDTH;
|
||||
|
@ -4971,16 +4913,15 @@ static void intSetStats(UDWORD id, BASE_STATS *psStats)
|
|||
sBarInit.pCallback = intUpdateProgressBar;
|
||||
sBarInit.pUserData = intGetObject(id);
|
||||
|
||||
memset(&sLabInit,0,sizeof(W_LABINIT));
|
||||
W_LABINIT sLabInit;
|
||||
sLabInit.formID = id;
|
||||
sLabInit.id = (id - IDOBJ_STATSTART) + IDOBJ_COUNTSTART;
|
||||
sLabInit.style = WLAB_PLAIN | WIDG_HIDDEN;
|
||||
sLabInit.style = WIDG_HIDDEN;
|
||||
sLabInit.x = OBJ_TEXTX;
|
||||
sLabInit.y = OBJ_T1TEXTY;
|
||||
sLabInit.width = 16;
|
||||
sLabInit.height = 16;
|
||||
sLabInit.pText = "BUG! (d)";
|
||||
sLabInit.FontID = font_regular;
|
||||
|
||||
if (psStats)
|
||||
{
|
||||
|
@ -5047,15 +4988,10 @@ static void intSetStats(UDWORD id, BASE_STATS *psStats)
|
|||
static BOOL intAddStats(BASE_STATS **ppsStatsList, UDWORD numStats,
|
||||
BASE_STATS *psSelected, BASE_OBJECT *psOwner)
|
||||
{
|
||||
W_FORMINIT sFormInit;
|
||||
W_BUTINIT sButInit;
|
||||
W_FORMINIT sBFormInit;
|
||||
W_BARINIT sBarInit;
|
||||
UDWORD i, butPerForm, statForm;
|
||||
SDWORD BufferID;
|
||||
BASE_STATS *Stat;
|
||||
BOOL Animate = true;
|
||||
W_LABINIT sLabInit;
|
||||
FACTORY *psFactory;
|
||||
|
||||
// should this ever be called with psOwner == NULL?
|
||||
|
@ -5092,7 +5028,7 @@ static BOOL intAddStats(BASE_STATS **ppsStatsList, UDWORD numStats,
|
|||
|
||||
/* Create the basic form */
|
||||
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
W_FORMINIT sFormInit;
|
||||
sFormInit.formID = 0;
|
||||
sFormInit.id = IDSTAT_FORM;
|
||||
sFormInit.style = WFORM_PLAIN;
|
||||
|
@ -5114,20 +5050,21 @@ static BOOL intAddStats(BASE_STATS **ppsStatsList, UDWORD numStats,
|
|||
return false;
|
||||
}
|
||||
|
||||
W_LABINIT sLabInit;
|
||||
|
||||
// Add the quantity slider ( if it's a factory ).
|
||||
if(objMode == IOBJ_MANUFACTURE)
|
||||
{
|
||||
//add the Factory DP button
|
||||
memset(&sButInit, 0, sizeof(W_BUTINIT));
|
||||
W_BUTINIT sButInit;
|
||||
sButInit.formID = IDSTAT_FORM;
|
||||
sButInit.id = IDSTAT_DP_BUTTON;
|
||||
sButInit.style = WBUT_PLAIN | WFORM_SECONDARY;
|
||||
sButInit.style = WBUT_SECONDARY;
|
||||
sButInit.x = 4;
|
||||
sButInit.y = STAT_SLDY;
|
||||
sButInit.width = iV_GetImageWidth(IntImages,IMAGE_FDP_DOWN);
|
||||
sButInit.height = iV_GetImageHeight(IntImages,IMAGE_FDP_DOWN);
|
||||
sButInit.pTip = _("Factory Delivery Point");
|
||||
sButInit.FontID = font_regular;
|
||||
sButInit.pDisplay = intDisplayDPButton;
|
||||
sButInit.pUserData = psOwner;
|
||||
|
||||
|
@ -5137,16 +5074,15 @@ static BOOL intAddStats(BASE_STATS **ppsStatsList, UDWORD numStats,
|
|||
}
|
||||
|
||||
//add the Factory Loop button!
|
||||
memset(&sButInit, 0, sizeof(W_BUTINIT));
|
||||
sButInit = W_BUTINIT();
|
||||
sButInit.formID = IDSTAT_FORM;
|
||||
sButInit.id = IDSTAT_LOOP_BUTTON;
|
||||
sButInit.style = WBUT_PLAIN | WFORM_SECONDARY;
|
||||
sButInit.style = WBUT_SECONDARY;
|
||||
sButInit.x = STAT_SLDX + STAT_SLDWIDTH + 2;
|
||||
sButInit.y = STAT_SLDY;
|
||||
sButInit.width = iV_GetImageWidth(IntImages,IMAGE_LOOP_DOWN);
|
||||
sButInit.height = iV_GetImageHeight(IntImages,IMAGE_LOOP_DOWN);
|
||||
sButInit.pTip = _("Loop Production");
|
||||
sButInit.FontID = font_regular;
|
||||
sButInit.pDisplay = intDisplayButtonPressed;
|
||||
sButInit.UserData = PACKDWORD_TRI(IMAGE_LOOP_DOWN, IMAGE_LOOP_HI, IMAGE_LOOP_UP);
|
||||
|
||||
|
@ -5165,15 +5101,13 @@ static BOOL intAddStats(BASE_STATS **ppsStatsList, UDWORD numStats,
|
|||
}
|
||||
|
||||
// create a text label for the loop quantity.
|
||||
memset(&sLabInit,0,sizeof(W_LABINIT));
|
||||
sLabInit.formID = IDSTAT_FORM;
|
||||
sLabInit.id = IDSTAT_LOOP_LABEL;
|
||||
sLabInit.style = WLAB_PLAIN | WIDG_HIDDEN;
|
||||
sLabInit.style = WIDG_HIDDEN;
|
||||
sLabInit.x = (UWORD)(sButInit.x - 15);
|
||||
sLabInit.y = sButInit.y;
|
||||
sLabInit.width = 12;
|
||||
sLabInit.height = 15;
|
||||
sLabInit.FontID = font_regular;
|
||||
sLabInit.pUserData = psOwner;
|
||||
sLabInit.pCallback = intAddLoopQuantity;
|
||||
if (!widgAddLabel(psWScreen, &sLabInit))
|
||||
|
@ -5184,31 +5118,28 @@ static BOOL intAddStats(BASE_STATS **ppsStatsList, UDWORD numStats,
|
|||
|
||||
/* store the common values for the text labels for the quantity
|
||||
to produce (on each button).*/
|
||||
memset(&sLabInit,0,sizeof(W_LABINIT));
|
||||
sLabInit = W_LABINIT();
|
||||
sLabInit.id = IDSTAT_PRODSTART;
|
||||
sLabInit.style = WLAB_PLAIN | WIDG_HIDDEN;
|
||||
sLabInit.style = WIDG_HIDDEN;
|
||||
|
||||
sLabInit.x = STAT_BUTWIDTH-12;
|
||||
sLabInit.y = 2;
|
||||
|
||||
sLabInit.width = 12;
|
||||
sLabInit.height = 15;
|
||||
sLabInit.FontID = font_regular;
|
||||
sLabInit.pCallback = intAddProdQuantity;
|
||||
|
||||
}
|
||||
|
||||
/* Add the close button */
|
||||
memset(&sButInit, 0, sizeof(W_BUTINIT));
|
||||
W_BUTINIT sButInit;
|
||||
sButInit.formID = IDSTAT_FORM;
|
||||
sButInit.id = IDSTAT_CLOSE;
|
||||
sButInit.style = WBUT_PLAIN;
|
||||
sButInit.x = STAT_WIDTH - CLOSE_WIDTH;
|
||||
sButInit.y = 0;
|
||||
sButInit.width = CLOSE_WIDTH;
|
||||
sButInit.height = CLOSE_HEIGHT;
|
||||
sButInit.pTip = _("Close");
|
||||
sButInit.FontID = font_regular;
|
||||
sButInit.pDisplay = intDisplayImageHilight;
|
||||
sButInit.UserData = PACKDWORD_TRI(0,IMAGE_CLOSEHILIGHT , IMAGE_CLOSE);
|
||||
if (!widgAddButton(psWScreen, &sButInit))
|
||||
|
@ -5224,16 +5155,14 @@ static BOOL intAddStats(BASE_STATS **ppsStatsList, UDWORD numStats,
|
|||
if (numForms(numStats, butPerForm)> MAX_TAB_SMALL_SHOWN) //only want these buttons when tab count >8
|
||||
{
|
||||
// Add the left tab scroll button
|
||||
memset(&sButInit, 0, sizeof(W_BUTINIT));
|
||||
sButInit = W_BUTINIT();
|
||||
sButInit.formID = IDSTAT_FORM;
|
||||
sButInit.id = IDSTAT_TABSCRL_LEFT;
|
||||
sButInit.style = WBUT_PLAIN;
|
||||
sButInit.x = STAT_TABFORMX + 4;
|
||||
sButInit.y = STAT_TABFORMY;
|
||||
sButInit.width = TABSCRL_WIDTH;
|
||||
sButInit.height = TABSCRL_HEIGHT;
|
||||
sButInit.pTip = _("Tab Scroll left");
|
||||
sButInit.FontID = font_regular;
|
||||
sButInit.pDisplay = intDisplayImageHilight;
|
||||
sButInit.UserData = PACKDWORD_TRI(0, IMAGE_LFTTABD, IMAGE_LFTTAB);
|
||||
if (!widgAddButton(psWScreen, &sButInit))
|
||||
|
@ -5241,16 +5170,14 @@ static BOOL intAddStats(BASE_STATS **ppsStatsList, UDWORD numStats,
|
|||
return false;
|
||||
}
|
||||
// Add the right tab scroll button
|
||||
memset(&sButInit, 0, sizeof(W_BUTINIT));
|
||||
sButInit = W_BUTINIT();
|
||||
sButInit.formID = IDSTAT_FORM;
|
||||
sButInit.id = IDSTAT_TABSCRL_RIGHT;
|
||||
sButInit.style = WBUT_PLAIN;
|
||||
sButInit.x = STAT_WIDTH - 14;
|
||||
sButInit.y = STAT_TABFORMY;
|
||||
sButInit.width = TABSCRL_WIDTH;
|
||||
sButInit.height = TABSCRL_HEIGHT;
|
||||
sButInit.pTip = _("Tab Scroll right");
|
||||
sButInit.FontID = font_regular;
|
||||
sButInit.pDisplay = intDisplayImageHilight;
|
||||
sButInit.UserData = PACKDWORD_TRI(0, IMAGE_RGTTABD, IMAGE_RGTTAB);
|
||||
if (!widgAddButton(psWScreen, &sButInit))
|
||||
|
@ -5260,7 +5187,7 @@ static BOOL intAddStats(BASE_STATS **ppsStatsList, UDWORD numStats,
|
|||
}
|
||||
//==============buttons before tabbed form!==========================
|
||||
// Add the tabbed form
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
sFormInit = W_FORMINIT();
|
||||
sFormInit.formID = IDSTAT_FORM;
|
||||
sFormInit.id = IDSTAT_TABFORM;
|
||||
sFormInit.style = WFORM_TABBED;
|
||||
|
@ -5304,7 +5231,7 @@ static BOOL intAddStats(BASE_STATS **ppsStatsList, UDWORD numStats,
|
|||
}
|
||||
|
||||
/* Add the stat buttons */
|
||||
memset(&sBFormInit, 0, sizeof(W_FORMINIT));
|
||||
W_FORMINIT sBFormInit;
|
||||
sBFormInit.formID = IDSTAT_TABFORM;
|
||||
sBFormInit.majorID = 0;
|
||||
sBFormInit.minorID = 0;
|
||||
|
@ -5315,10 +5242,8 @@ static BOOL intAddStats(BASE_STATS **ppsStatsList, UDWORD numStats,
|
|||
sBFormInit.width = STAT_BUTWIDTH;
|
||||
sBFormInit.height = STAT_BUTHEIGHT;
|
||||
|
||||
memset(&sBarInit, 0, sizeof(W_BARINIT));
|
||||
W_BARINIT sBarInit;
|
||||
sBarInit.id = IDSTAT_TIMEBARSTART;
|
||||
sBarInit.style = WBAR_PLAIN;
|
||||
sBarInit.orientation = WBAR_LEFT;
|
||||
sBarInit.x = STAT_TIMEBARX;
|
||||
sBarInit.y = STAT_TIMEBARY;
|
||||
sBarInit.width = STAT_PROGBARWIDTH;
|
||||
|
@ -5413,10 +5338,9 @@ static BOOL intAddStats(BASE_STATS **ppsStatsList, UDWORD numStats,
|
|||
Stat->ref < REF_RESEARCH_START + REF_RANGE) // It's a Research topic.
|
||||
{
|
||||
//new icon in for groups - AB 12/01/99
|
||||
memset(&sLabInit,0,sizeof(W_LABINIT));
|
||||
sLabInit = W_LABINIT();
|
||||
sLabInit.formID = sBFormInit.id ;
|
||||
sLabInit.id = IDSTAT_RESICONSTART+(sBFormInit.id - IDSTAT_START);
|
||||
sLabInit.style = WLAB_PLAIN;
|
||||
|
||||
sLabInit.x = STAT_BUTWIDTH - 16;
|
||||
sLabInit.y = 3;
|
||||
|
@ -5453,10 +5377,9 @@ static BOOL intAddStats(BASE_STATS **ppsStatsList, UDWORD numStats,
|
|||
)
|
||||
{
|
||||
// add a label.
|
||||
memset(&sLabInit,0,sizeof(W_LABINIT));
|
||||
sLabInit = W_LABINIT();
|
||||
sLabInit.formID = sBFormInit.id ;
|
||||
sLabInit.id = IDSTAT_ALLYSTART+(sBFormInit.id - IDSTAT_START);
|
||||
sLabInit.style = WLAB_PLAIN;
|
||||
sLabInit.x = STAT_BUTWIDTH - 19;
|
||||
sLabInit.y = STAT_BUTHEIGHT - 19;
|
||||
sLabInit.width = 12;
|
||||
|
@ -6214,11 +6137,10 @@ void forceHidePowerBar(void)
|
|||
/* Add the Proximity message buttons */
|
||||
BOOL intAddProximityButton(PROXIMITY_DISPLAY *psProxDisp, UDWORD inc)
|
||||
{
|
||||
W_FORMINIT sBFormInit;
|
||||
PROXIMITY_DISPLAY *psProxDisp2;
|
||||
UDWORD cnt;
|
||||
|
||||
memset(&sBFormInit, 0, sizeof(W_FORMINIT));
|
||||
W_FORMINIT sBFormInit;
|
||||
sBFormInit.formID = 0;
|
||||
sBFormInit.id = IDPROX_START + inc;
|
||||
//store the ID so we can detect which one has been clicked on
|
||||
|
|
|
@ -64,8 +64,6 @@ static BOOL addIGTextButton(UDWORD id, UWORD y, UWORD width, const char *string,
|
|||
{
|
||||
W_BUTINIT sButInit;
|
||||
|
||||
memset( &sButInit, 0, sizeof(W_BUTINIT) );
|
||||
|
||||
//resume
|
||||
sButInit.formID = INTINGAMEOP;
|
||||
sButInit.id = id;
|
||||
|
@ -77,7 +75,6 @@ static BOOL addIGTextButton(UDWORD id, UWORD y, UWORD width, const char *string,
|
|||
sButInit.width = width;
|
||||
sButInit.height = INTINGAMEOP_OP_H;
|
||||
|
||||
sButInit.FontID = font_regular;
|
||||
sButInit.pDisplay = displayTextOption;
|
||||
sButInit.pText = string;
|
||||
widgAddButton(psWScreen, &sButInit);
|
||||
|
@ -87,9 +84,6 @@ static BOOL addIGTextButton(UDWORD id, UWORD y, UWORD width, const char *string,
|
|||
|
||||
static BOOL addQuitOptions(void)
|
||||
{
|
||||
W_FORMINIT sFormInit;
|
||||
W_BUTINIT sButInit;
|
||||
|
||||
if (widgGetFromID(psWScreen,INTINGAMEOP))
|
||||
{
|
||||
widgDelete(psWScreen, INTINGAMEOP); // get rid of the old stuff.
|
||||
|
@ -100,7 +94,7 @@ static BOOL addQuitOptions(void)
|
|||
widgDelete(psWScreen, INTINGAMEPOPUP); // get rid of the old stuff.
|
||||
}
|
||||
|
||||
memset(&sFormInit,0, sizeof(W_FORMINIT));
|
||||
W_FORMINIT sFormInit;
|
||||
// add form
|
||||
sFormInit.formID = 0;
|
||||
sFormInit.id = INTINGAMEOP;
|
||||
|
@ -127,10 +121,9 @@ static BOOL addQuitOptions(void)
|
|||
|
||||
widgAddForm(psWScreen, &sFormInit);
|
||||
|
||||
memset( &sButInit, 0, sizeof(W_BUTINIT) );
|
||||
W_BUTINIT sButInit;
|
||||
|
||||
sButInit.formID = INTINGAMEPOPUP;
|
||||
sButInit.FontID = font_regular;
|
||||
sButInit.style = OPALIGN;
|
||||
sButInit.width = 600;
|
||||
sButInit.height = 10;
|
||||
|
@ -149,14 +142,12 @@ static BOOL addQuitOptions(void)
|
|||
|
||||
static BOOL addSlideOptions(void)
|
||||
{
|
||||
W_FORMINIT sFormInit;
|
||||
|
||||
if (widgGetFromID(psWScreen,INTINGAMEOP))
|
||||
{
|
||||
widgDelete(psWScreen, INTINGAMEOP); // get rid of the old stuff.
|
||||
}
|
||||
|
||||
memset(&sFormInit,0, sizeof(W_FORMINIT));
|
||||
W_FORMINIT sFormInit;
|
||||
|
||||
// add form
|
||||
sFormInit.formID = 0;
|
||||
|
@ -209,10 +200,6 @@ static BOOL addSlideOptions(void)
|
|||
|
||||
static BOOL _intAddInGameOptions(void)
|
||||
{
|
||||
// UWORD WindowWidth;
|
||||
W_FORMINIT sFormInit;
|
||||
|
||||
|
||||
audio_StopAll();
|
||||
|
||||
//clear out any mission widgets - timers etc that may be on the screen
|
||||
|
@ -237,11 +224,7 @@ static BOOL _intAddInGameOptions(void)
|
|||
kf_TogglePauseMode();
|
||||
}
|
||||
|
||||
|
||||
memset(&sFormInit,0, sizeof(W_FORMINIT));
|
||||
|
||||
|
||||
|
||||
W_FORMINIT sFormInit;
|
||||
sFormInit.width = INTINGAMEOP_W;
|
||||
|
||||
// add form
|
||||
|
@ -316,9 +299,6 @@ BOOL intAddInGameOptions(void)
|
|||
//
|
||||
void intAddInGamePopup(void)
|
||||
{
|
||||
W_FORMINIT sFormInit;
|
||||
W_BUTINIT sButInit;
|
||||
|
||||
//clear out any mission widgets - timers etc that may be on the screen
|
||||
clearMissionWidgets();
|
||||
setWidgetsStatus(true);
|
||||
|
@ -333,7 +313,7 @@ void intAddInGamePopup(void)
|
|||
kf_TogglePauseMode(); // Pause the game.
|
||||
}
|
||||
|
||||
memset(&sFormInit,0, sizeof(W_FORMINIT));
|
||||
W_FORMINIT sFormInit;
|
||||
|
||||
sFormInit.formID = 0;
|
||||
sFormInit.id = INTINGAMEPOPUP;
|
||||
|
@ -348,7 +328,7 @@ void intAddInGamePopup(void)
|
|||
widgAddForm(psWScreen, &sFormInit);
|
||||
|
||||
// add the text "buttons" now
|
||||
memset( &sButInit, 0, sizeof(W_BUTINIT) );
|
||||
W_BUTINIT sButInit;
|
||||
|
||||
sButInit.formID = INTINGAMEPOPUP;
|
||||
sButInit.style = OPALIGN;
|
||||
|
|
|
@ -205,8 +205,6 @@ TEXT_DISPLAY currentTextDisplay;
|
|||
/* Add the Intelligence Map widgets to the widget screen */
|
||||
BOOL intAddIntelMap(void)
|
||||
{
|
||||
W_FORMINIT sFormInit;
|
||||
W_LABINIT sLabInit;
|
||||
BOOL Animate = true;
|
||||
|
||||
//check playCurrent with psCurrentMsg
|
||||
|
@ -237,16 +235,14 @@ BOOL intAddIntelMap(void)
|
|||
{
|
||||
if(widgGetFromID(psWScreen,IDINTMAP_PAUSELABEL) == NULL)
|
||||
{
|
||||
memset(&sLabInit,0,sizeof(W_LABINIT));
|
||||
W_LABINIT sLabInit;
|
||||
sLabInit.id = IDINTMAP_PAUSELABEL;
|
||||
sLabInit.formID = 0;
|
||||
sLabInit.style = WLAB_PLAIN;
|
||||
sLabInit.x = INTMAP_LABELX;
|
||||
sLabInit.y = INTMAP_LABELY+PAUSEMESSAGE_YOFFSET;
|
||||
sLabInit.width = INTMAP_LABELWIDTH;
|
||||
sLabInit.height = INTMAP_LABELHEIGHT;
|
||||
sLabInit.pText = _("PAUSED");
|
||||
sLabInit.FontID = font_regular;
|
||||
if (!widgAddLabel(psWScreen, &sLabInit))
|
||||
{
|
||||
return false;
|
||||
|
@ -257,7 +253,7 @@ BOOL intAddIntelMap(void)
|
|||
//set pause states before putting the interface up
|
||||
setIntelligencePauseState();
|
||||
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
W_FORMINIT sFormInit;
|
||||
|
||||
// Add the main Intelligence Map form
|
||||
|
||||
|
@ -303,15 +299,13 @@ BOOL intAddIntelMap(void)
|
|||
/* Add the Message sub form */
|
||||
static BOOL intAddMessageForm(BOOL playCurrent)
|
||||
{
|
||||
W_FORMINIT sFormInit;
|
||||
W_FORMINIT sBFormInit;
|
||||
UDWORD numButtons, i;
|
||||
MESSAGE *psMessage;
|
||||
RESEARCH *psResearch;
|
||||
SDWORD BufferID;
|
||||
|
||||
/* Add the Message form */
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
W_FORMINIT sFormInit;
|
||||
sFormInit.formID = IDINTMAP_FORM;
|
||||
sFormInit.id = IDINTMAP_MSGFORM;
|
||||
sFormInit.style = WFORM_TABBED;
|
||||
|
@ -370,7 +364,7 @@ static BOOL intAddMessageForm(BOOL playCurrent)
|
|||
|
||||
|
||||
/* Add the message buttons */
|
||||
memset(&sBFormInit, 0, sizeof(W_FORMINIT));
|
||||
W_FORMINIT sBFormInit;
|
||||
sBFormInit.formID = IDINTMAP_MSGFORM;
|
||||
sBFormInit.id = IDINTMAP_MSGSTART;
|
||||
sBFormInit.majorID = 0;
|
||||
|
@ -487,9 +481,6 @@ static BOOL intAddMessageForm(BOOL playCurrent)
|
|||
/*Add the 3D world view for the particular message (only research nmessages now) */
|
||||
BOOL intAddMessageView(MESSAGE * psMessage)
|
||||
{
|
||||
W_FORMINIT sFormInit;
|
||||
W_BUTINIT sButInit;
|
||||
W_LABINIT sLabInit;
|
||||
BOOL Animate = true;
|
||||
RESEARCH *psResearch;
|
||||
|
||||
|
@ -505,7 +496,7 @@ BOOL intAddMessageView(MESSAGE * psMessage)
|
|||
}
|
||||
|
||||
/* Add the base form */
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
W_FORMINIT sFormInit;
|
||||
sFormInit.formID = 0;
|
||||
sFormInit.id = IDINTMAP_MSGVIEW;
|
||||
sFormInit.style = WFORM_PLAIN;
|
||||
|
@ -533,10 +524,9 @@ BOOL intAddMessageView(MESSAGE * psMessage)
|
|||
}
|
||||
|
||||
/* Add the close box */
|
||||
memset(&sButInit, 0, sizeof(W_BUTINIT));
|
||||
W_BUTINIT sButInit;
|
||||
sButInit.formID = IDINTMAP_MSGVIEW;
|
||||
sButInit.id = IDINTMAP_CLOSE;
|
||||
sButInit.style = WBUT_PLAIN;
|
||||
sButInit.x = (SWORD)(sFormInit.width - OPT_GAP - CLOSE_SIZE);
|
||||
sButInit.y = OPT_GAP;
|
||||
sButInit.width = CLOSE_SIZE;
|
||||
|
@ -552,14 +542,13 @@ BOOL intAddMessageView(MESSAGE * psMessage)
|
|||
if (psMessage->type != MSG_RESEARCH &&
|
||||
((VIEWDATA*)psMessage->pViewData)->type == VIEW_RPL)
|
||||
{
|
||||
W_FORMINIT sTabForm;
|
||||
VIEW_REPLAY *psViewReplay;
|
||||
size_t i, cur_seq, cur_seqpage;
|
||||
|
||||
psViewReplay = (VIEW_REPLAY *)((VIEWDATA *)psMessage->pViewData)->pData;
|
||||
|
||||
/* Add a big tabbed text box for the subtitle text */
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
sFormInit = W_FORMINIT();
|
||||
|
||||
sFormInit.id = IDINTMAP_SEQTEXT;
|
||||
sFormInit.formID = IDINTMAP_MSGVIEW;
|
||||
|
@ -595,7 +584,7 @@ BOOL intAddMessageView(MESSAGE * psMessage)
|
|||
return false;
|
||||
}
|
||||
|
||||
memset(&sTabForm, 0, sizeof(W_FORMINIT));
|
||||
W_FORMINIT sTabForm;
|
||||
sTabForm.formID = IDINTMAP_SEQTEXT;
|
||||
sTabForm.id = IDINTMAP_SEQTEXTSTART;
|
||||
sTabForm.majorID = 0;
|
||||
|
@ -622,10 +611,9 @@ BOOL intAddMessageView(MESSAGE * psMessage)
|
|||
}
|
||||
|
||||
/*add the Label for the title box*/
|
||||
memset(&sLabInit,0,sizeof(W_LABINIT));
|
||||
W_LABINIT sLabInit;
|
||||
sLabInit.id = IDINTMAP_TITLELABEL;
|
||||
sLabInit.formID = IDINTMAP_MSGVIEW;
|
||||
sLabInit.style = WLAB_PLAIN;
|
||||
sLabInit.x = INTMAP_TITLEX + TEXT_XINDENT;
|
||||
sLabInit.y = INTMAP_TITLEY + TEXT_YINDENT;
|
||||
sLabInit.width = INTMAP_TITLEWIDTH;
|
||||
|
@ -649,7 +637,7 @@ BOOL intAddMessageView(MESSAGE * psMessage)
|
|||
|
||||
/*Add the PIE box*/
|
||||
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
sFormInit = W_FORMINIT();
|
||||
sFormInit.formID = IDINTMAP_MSGVIEW;
|
||||
sFormInit.id = IDINITMAP_PIEVIEW;
|
||||
sFormInit.style = WFORM_PLAIN;
|
||||
|
@ -666,7 +654,7 @@ BOOL intAddMessageView(MESSAGE * psMessage)
|
|||
|
||||
#ifndef NO_VIDEO
|
||||
/*Add the Flic box */
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
sFormInit = W_FORMINIT();
|
||||
sFormInit.formID = IDINTMAP_MSGVIEW;
|
||||
sFormInit.id = IDINTMAP_FLICVIEW;
|
||||
sFormInit.style = WFORM_PLAIN;
|
||||
|
@ -683,7 +671,7 @@ BOOL intAddMessageView(MESSAGE * psMessage)
|
|||
#endif
|
||||
|
||||
/*Add the text box*/
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
sFormInit = W_FORMINIT();
|
||||
|
||||
sFormInit.formID = IDINTMAP_MSGVIEW;
|
||||
|
||||
|
|
|
@ -643,8 +643,6 @@ static UDWORD GetImageHeight(IMAGEFILE *ImageFile,UDWORD ImageID)
|
|||
//changed to a BASE_OBJECT to accomodate the factories - AB 21/04/99
|
||||
BOOL intAddOrder(BASE_OBJECT *psObj)
|
||||
{
|
||||
W_FORMINIT sFormInit;
|
||||
W_BUTINIT sButInit;
|
||||
BOOL Animate = true;
|
||||
SECONDARY_STATE State;
|
||||
UWORD i,j;//,k;
|
||||
|
@ -747,7 +745,7 @@ BOOL intAddOrder(BASE_OBJECT *psObj)
|
|||
|
||||
/* Create the basic form */
|
||||
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
W_FORMINIT sFormInit;
|
||||
sFormInit.formID = 0;
|
||||
sFormInit.id = IDORDER_FORM;
|
||||
sFormInit.style = WFORM_PLAIN;
|
||||
|
@ -771,16 +769,14 @@ BOOL intAddOrder(BASE_OBJECT *psObj)
|
|||
|
||||
|
||||
// Add the close button.
|
||||
memset(&sButInit, 0, sizeof(W_BUTINIT));
|
||||
W_BUTINIT sButInit;
|
||||
sButInit.formID = IDORDER_FORM;
|
||||
sButInit.id = IDORDER_CLOSE;
|
||||
sButInit.style = WBUT_PLAIN;
|
||||
sButInit.x = ORDER_WIDTH - CLOSE_WIDTH;
|
||||
sButInit.y = 0;
|
||||
sButInit.width = CLOSE_WIDTH;
|
||||
sButInit.height = CLOSE_HEIGHT;
|
||||
sButInit.pTip = _("Close");
|
||||
sButInit.FontID = font_regular;
|
||||
sButInit.pDisplay = intDisplayImageHilight;
|
||||
sButInit.UserData = PACKDWORD_TRI(0,IMAGE_CLOSEHILIGHT , IMAGE_CLOSE);
|
||||
if (!widgAddButton(psWScreen, &sButInit))
|
||||
|
@ -789,12 +785,10 @@ BOOL intAddOrder(BASE_OBJECT *psObj)
|
|||
}
|
||||
|
||||
|
||||
memset(&sButInit, 0, sizeof(W_BUTINIT));
|
||||
sButInit = W_BUTINIT();
|
||||
sButInit.formID = IDORDER_FORM;
|
||||
sButInit.id = IDORDER_CLOSE+1;
|
||||
sButInit.style = WBUT_PLAIN;
|
||||
sButInit.pDisplay = intDisplayButtonHilight;
|
||||
sButInit.FontID = font_regular;
|
||||
sButInit.y = ORDER_BUTY;
|
||||
|
||||
Height = 0;
|
||||
|
|
|
@ -340,8 +340,6 @@ static void displayKeyMap(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, WZ_D
|
|||
// ////////////////////////////////////////////////////////////////////////////
|
||||
BOOL startKeyMapEditor(BOOL first)
|
||||
{
|
||||
W_BUTINIT sButInit;
|
||||
W_FORMINIT sFormInit;
|
||||
KEY_MAPPING *psMapping;
|
||||
UDWORD i,mapcount =0;
|
||||
UDWORD bubbleCount;
|
||||
|
@ -355,7 +353,7 @@ BOOL startKeyMapEditor(BOOL first)
|
|||
{
|
||||
loadKeyMap(); // get the current mappings.
|
||||
}
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT)); // draw blue form...
|
||||
W_FORMINIT sFormInit;
|
||||
sFormInit.formID = FRONTEND_BACKDROP;
|
||||
sFormInit.id = KM_FORM;
|
||||
sFormInit.style = WFORM_PLAIN;
|
||||
|
@ -400,7 +398,7 @@ BOOL startKeyMapEditor(BOOL first)
|
|||
}
|
||||
|
||||
// add tab form..
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
sFormInit = W_FORMINIT();
|
||||
sFormInit.formID = KM_FORM;
|
||||
sFormInit.id = KM_FORM_TABS;
|
||||
sFormInit.style = WFORM_TABBED;
|
||||
|
@ -426,9 +424,8 @@ BOOL startKeyMapEditor(BOOL first)
|
|||
widgAddForm(psWScreen, &sFormInit);
|
||||
|
||||
//Put the buttons on it
|
||||
memset(&sButInit, 0, sizeof(W_BUTINIT));
|
||||
W_BUTINIT sButInit;
|
||||
sButInit.formID = KM_FORM_TABS;
|
||||
sButInit.style = WFORM_PLAIN;
|
||||
sButInit.width = KM_ENTRYW;
|
||||
sButInit.height = KM_ENTRYH;
|
||||
sButInit.pDisplay = displayKeyMap;
|
||||
|
|
|
@ -151,9 +151,6 @@ BOOL bLoad;
|
|||
//*****************************************************************************************
|
||||
static BOOL _addLoadSave(BOOL bLoad, const char *sSearchPath, const char *sExtension, const char *title)
|
||||
{
|
||||
W_FORMINIT sFormInit;
|
||||
W_BUTINIT sButInit;
|
||||
W_LABINIT sLabInit;
|
||||
UDWORD slotCount;
|
||||
// removed hardcoded values! change with the defines above! -Q
|
||||
static char sSlotCaps[totalslots][totalslotspace];
|
||||
|
@ -202,7 +199,7 @@ static BOOL _addLoadSave(BOOL bLoad, const char *sSearchPath, const char *sExten
|
|||
widgSetTipFont(psRequestScreen,font_regular);
|
||||
|
||||
/* add a form to place the tabbed form on */
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
W_FORMINIT sFormInit;
|
||||
sFormInit.formID = 0; //this adds the blue background, and the "box" behind the buttons -Q
|
||||
sFormInit.id = LOADSAVE_FORM;
|
||||
sFormInit.style = WFORM_PLAIN;
|
||||
|
@ -230,7 +227,7 @@ static BOOL _addLoadSave(BOOL bLoad, const char *sSearchPath, const char *sExten
|
|||
|
||||
|
||||
// Add Banner Label
|
||||
memset(&sLabInit, 0, sizeof(W_LABINIT));
|
||||
W_LABINIT sLabInit;
|
||||
sLabInit.formID = LOADSAVE_BANNER;
|
||||
sLabInit.id = LOADSAVE_LABEL;
|
||||
sLabInit.style = WLAB_ALIGNCENTRE;
|
||||
|
@ -239,12 +236,11 @@ static BOOL _addLoadSave(BOOL bLoad, const char *sSearchPath, const char *sExten
|
|||
sLabInit.width = LOADSAVE_W-(2*LOADSAVE_HGAP); //LOADSAVE_W;
|
||||
sLabInit.height = LOADSAVE_BANNER_DEPTH; //This looks right -Q
|
||||
sLabInit.pText = title;
|
||||
sLabInit.FontID = font_regular;
|
||||
widgAddLabel(psRequestScreen, &sLabInit);
|
||||
|
||||
|
||||
// add cancel.
|
||||
memset(&sButInit, 0, sizeof(W_BUTINIT));
|
||||
W_BUTINIT sButInit;
|
||||
sButInit.formID = LOADSAVE_BANNER;
|
||||
sButInit.x = 8;
|
||||
sButInit.y = 8;
|
||||
|
@ -255,18 +251,16 @@ static BOOL _addLoadSave(BOOL bLoad, const char *sSearchPath, const char *sExten
|
|||
sButInit.id = LOADSAVE_CANCEL;
|
||||
sButInit.style = WBUT_PLAIN;
|
||||
sButInit.pTip = _("Close");
|
||||
sButInit.FontID = font_regular;
|
||||
sButInit.pDisplay = intDisplayImageHilight;
|
||||
widgAddButton(psRequestScreen, &sButInit);
|
||||
|
||||
// add slots
|
||||
memset(&sButInit, 0, sizeof(W_BUTINIT));
|
||||
sButInit = W_BUTINIT();
|
||||
sButInit.formID = LOADSAVE_FORM;
|
||||
sButInit.style = WBUT_PLAIN;
|
||||
sButInit.width = LOADENTRY_W;
|
||||
sButInit.height = LOADENTRY_H;
|
||||
sButInit.pDisplay = displayLoadSlot;
|
||||
sButInit.FontID = font_regular;
|
||||
|
||||
for(slotCount = 0; slotCount< totalslots; slotCount++)
|
||||
{
|
||||
|
@ -432,7 +426,6 @@ void deleteSaveGame(char* saveGameName)
|
|||
BOOL runLoadSave(BOOL bResetMissionWidgets)
|
||||
{
|
||||
UDWORD id=0;
|
||||
W_EDBINIT sEdInit;
|
||||
static char sDelete[PATH_MAX];
|
||||
UDWORD i, campaign;
|
||||
W_CONTEXT context;
|
||||
|
@ -470,16 +463,14 @@ BOOL runLoadSave(BOOL bResetMissionWidgets)
|
|||
if( ! widgGetFromID(psRequestScreen,SAVEENTRY_EDIT))
|
||||
{
|
||||
// add blank box.
|
||||
memset(&sEdInit, 0, sizeof(W_EDBINIT));
|
||||
W_EDBINIT sEdInit;
|
||||
sEdInit.formID= LOADSAVE_FORM;
|
||||
sEdInit.id = SAVEENTRY_EDIT;
|
||||
sEdInit.style = WEDB_PLAIN;
|
||||
sEdInit.x = widgGetFromID(psRequestScreen,id)->x;
|
||||
sEdInit.y = widgGetFromID(psRequestScreen,id)->y;
|
||||
sEdInit.width = widgGetFromID(psRequestScreen,id)->width;
|
||||
sEdInit.height= widgGetFromID(psRequestScreen,id)->height;
|
||||
sEdInit.pText = ((W_BUTTON *)widgGetFromID(psRequestScreen,id))->pText;
|
||||
sEdInit.FontID= font_regular;
|
||||
sEdInit.pBoxDisplay = displayLoadSaveEdit;
|
||||
widgAddEditBox(psRequestScreen, &sEdInit);
|
||||
|
||||
|
|
|
@ -1183,6 +1183,9 @@ int main(int argc, char *argv[])
|
|||
|
||||
debug(LOG_WZ, "Using language: %s", getLanguage());
|
||||
|
||||
debug(LOG_MEMORY, "sizeof: SIMPLE_OBJECT=%ld, BASE_OBJECT=%ld, DROID=%ld, STRUCTURE=%ld, FEATURE=%ld, PROJECTILE=%ld",
|
||||
(long)sizeof(SIMPLE_OBJECT), (long)sizeof(BASE_OBJECT), (long)sizeof(DROID), (long)sizeof(STRUCTURE), (long)sizeof(FEATURE), (long)sizeof(PROJECTILE));
|
||||
|
||||
/* Initialize the write/config directory for PhysicsFS.
|
||||
* This needs to be done __after__ the early commandline parsing,
|
||||
* because the user might tell us to use an alternative configuration
|
||||
|
|
|
@ -1210,7 +1210,7 @@ extern int32_t map_Height(int x, int y)
|
|||
}
|
||||
|
||||
/* returns true if object is above ground */
|
||||
extern BOOL mapObjIsAboveGround( BASE_OBJECT *psObj )
|
||||
bool mapObjIsAboveGround(SIMPLE_OBJECT *psObj)
|
||||
{
|
||||
// min is used to make sure we don't go over array bounds!
|
||||
// TODO Using the corner of the map instead doesn't make sense. Fix this...
|
||||
|
|
|
@ -517,7 +517,7 @@ extern int32_t map_Height(int x, int y);
|
|||
static inline int32_t map_Height(Vector2i const &v) { return map_Height(v.x, v.y); }
|
||||
|
||||
/* returns true if object is above ground */
|
||||
extern BOOL mapObjIsAboveGround( BASE_OBJECT *psObj );
|
||||
bool mapObjIsAboveGround(SIMPLE_OBJECT *psObj);
|
||||
|
||||
/* returns the max and min height of a tile by looking at the four corners
|
||||
in tile coords */
|
||||
|
|
|
@ -2008,9 +2008,6 @@ void missionMoveTransporterOffWorld( DROID *psTransporter )
|
|||
//add the Mission timer into the top right hand corner of the screen
|
||||
BOOL intAddMissionTimer(void)
|
||||
{
|
||||
W_FORMINIT sFormInit;
|
||||
W_LABINIT sLabInit;
|
||||
|
||||
//check to see if it exists already
|
||||
if (widgGetFromID(psWScreen,IDTIMER_FORM) != NULL)
|
||||
{
|
||||
|
@ -2018,7 +2015,7 @@ BOOL intAddMissionTimer(void)
|
|||
}
|
||||
|
||||
// Add the background
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
W_FORMINIT sFormInit;
|
||||
|
||||
sFormInit.formID = 0;
|
||||
sFormInit.id = IDTIMER_FORM;
|
||||
|
@ -2037,7 +2034,7 @@ BOOL intAddMissionTimer(void)
|
|||
}
|
||||
|
||||
//add labels for the time display
|
||||
memset(&sLabInit,0,sizeof(W_LABINIT));
|
||||
W_LABINIT sLabInit;
|
||||
sLabInit.formID = IDTIMER_FORM;
|
||||
sLabInit.id = IDTIMER_DISPLAY;
|
||||
sLabInit.style = WLAB_PLAIN | WIDG_HIDDEN;
|
||||
|
@ -2046,7 +2043,6 @@ BOOL intAddMissionTimer(void)
|
|||
sLabInit.width = sFormInit.width;//TIMER_WIDTH;
|
||||
sLabInit.height = sFormInit.height;//TIMER_HEIGHT;
|
||||
sLabInit.pText = "00:00:00";
|
||||
sLabInit.FontID = font_regular;
|
||||
sLabInit.pCallback = intUpdateMissionTimer;
|
||||
|
||||
if (!widgAddLabel(psWScreen, &sLabInit))
|
||||
|
@ -2060,10 +2056,6 @@ BOOL intAddMissionTimer(void)
|
|||
//add the Transporter timer into the top left hand corner of the screen
|
||||
BOOL intAddTransporterTimer(void)
|
||||
{
|
||||
|
||||
W_FORMINIT sFormInit;
|
||||
W_LABINIT sLabInit;
|
||||
|
||||
// Make sure that Transporter Launch button isn't up as well
|
||||
intRemoveTransporterLaunch();
|
||||
|
||||
|
@ -2074,7 +2066,7 @@ BOOL intAddTransporterTimer(void)
|
|||
}
|
||||
|
||||
// Add the button form - clickable
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
W_FORMINIT sFormInit;
|
||||
sFormInit.formID = 0;
|
||||
sFormInit.id = IDTRANTIMER_BUTTON;
|
||||
sFormInit.style = WFORM_CLICKABLE | WFORM_NOCLICKMOVE;
|
||||
|
@ -2092,15 +2084,14 @@ BOOL intAddTransporterTimer(void)
|
|||
}
|
||||
|
||||
//add labels for the time display
|
||||
memset(&sLabInit,0,sizeof(W_LABINIT));
|
||||
W_LABINIT sLabInit;
|
||||
sLabInit.formID = IDTRANTIMER_BUTTON;
|
||||
sLabInit.id = IDTRANTIMER_DISPLAY;
|
||||
sLabInit.style = WLAB_PLAIN | WIDG_HIDDEN;
|
||||
sLabInit.style = WIDG_HIDDEN;
|
||||
sLabInit.x = TRAN_TIMER_X;
|
||||
sLabInit.y = TRAN_TIMER_Y;
|
||||
sLabInit.width = TRAN_TIMER_WIDTH;
|
||||
sLabInit.height = sFormInit.height;
|
||||
sLabInit.FontID = font_regular;
|
||||
sLabInit.pCallback = intUpdateTransporterTimer;
|
||||
if (!widgAddLabel(psWScreen, &sLabInit))
|
||||
{
|
||||
|
@ -2108,16 +2099,14 @@ BOOL intAddTransporterTimer(void)
|
|||
}
|
||||
|
||||
//add the capacity label
|
||||
memset(&sLabInit,0,sizeof(W_LABINIT));
|
||||
sLabInit = W_LABINIT();
|
||||
sLabInit.formID = IDTRANTIMER_BUTTON;
|
||||
sLabInit.id = IDTRANS_CAPACITY;
|
||||
sLabInit.style = WLAB_PLAIN;
|
||||
sLabInit.x = 65;
|
||||
sLabInit.y = 1;
|
||||
sLabInit.width = 16;
|
||||
sLabInit.height = 16;
|
||||
sLabInit.pText = "00/10";
|
||||
sLabInit.FontID = font_regular;
|
||||
sLabInit.pCallback = intUpdateTransCapacity;
|
||||
if (!widgAddLabel(psWScreen, &sLabInit))
|
||||
{
|
||||
|
@ -2402,13 +2391,9 @@ static void missionResetInGameState( void )
|
|||
|
||||
static BOOL _intAddMissionResult(BOOL result, BOOL bPlaySuccess)
|
||||
{
|
||||
W_FORMINIT sFormInit;
|
||||
W_LABINIT sLabInit;
|
||||
W_BUTINIT sButInit;
|
||||
|
||||
missionResetInGameState();
|
||||
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
W_FORMINIT sFormInit;
|
||||
|
||||
// add some funky beats
|
||||
cdAudio_PlayTrack(SONG_FRONTEND);
|
||||
|
@ -2462,10 +2447,10 @@ static BOOL _intAddMissionResult(BOOL result, BOOL bPlaySuccess)
|
|||
}
|
||||
|
||||
// description of success/fail
|
||||
memset(&sLabInit,0,sizeof(W_LABINIT));
|
||||
W_LABINIT sLabInit;
|
||||
sLabInit.formID = IDMISSIONRES_TITLE;
|
||||
sLabInit.id = IDMISSIONRES_TXT;
|
||||
sLabInit.style = WLAB_PLAIN | WLAB_ALIGNCENTRE;
|
||||
sLabInit.style = WLAB_ALIGNCENTRE;
|
||||
sLabInit.x = 0;
|
||||
sLabInit.y = 12;
|
||||
sLabInit.width = MISSIONRES_TITLE_W;
|
||||
|
@ -2490,12 +2475,11 @@ static BOOL _intAddMissionResult(BOOL result, BOOL bPlaySuccess)
|
|||
return false;
|
||||
}
|
||||
// options.
|
||||
memset(&sButInit,0,sizeof(W_BUTINIT));
|
||||
W_BUTINIT sButInit;
|
||||
sButInit.formID = IDMISSIONRES_FORM;
|
||||
sButInit.style = WBUT_PLAIN | WBUT_TXTCENTRE;
|
||||
sButInit.style = WBUT_TXTCENTRE;
|
||||
sButInit.width = MISSION_TEXT_W;
|
||||
sButInit.height = MISSION_TEXT_H;
|
||||
sButInit.FontID = font_regular;
|
||||
sButInit.pTip = NULL;
|
||||
sButInit.pDisplay = displayTextOption;
|
||||
// If won or in debug mode
|
||||
|
@ -2641,8 +2625,6 @@ static void missionContineButtonPressed( void )
|
|||
|
||||
void intProcessMissionResult(UDWORD id)
|
||||
{
|
||||
W_BUTINIT sButInit;
|
||||
|
||||
switch(id)
|
||||
{
|
||||
case IDMISSIONRES_LOAD:
|
||||
|
@ -2655,13 +2637,11 @@ void intProcessMissionResult(UDWORD id)
|
|||
if (widgGetFromID(psWScreen, IDMISSIONRES_QUIT) == NULL)
|
||||
{
|
||||
//Add Quit Button now save has been pressed
|
||||
memset(&sButInit,0,sizeof(W_BUTINIT));
|
||||
W_BUTINIT sButInit;
|
||||
sButInit.formID = IDMISSIONRES_FORM;
|
||||
sButInit.style = WBUT_PLAIN | WBUT_TXTCENTRE;
|
||||
sButInit.style = WBUT_TXTCENTRE;
|
||||
sButInit.width = MISSION_TEXT_W;
|
||||
sButInit.height = MISSION_TEXT_H;
|
||||
sButInit.FontID = font_regular;
|
||||
sButInit.pTip = NULL;
|
||||
sButInit.pDisplay = displayTextOption;
|
||||
sButInit.id = IDMISSIONRES_QUIT;
|
||||
sButInit.x = MISSION_3_X;
|
||||
|
|
|
@ -624,7 +624,7 @@ bool sendDroidInfo(DROID *psDroid, DROID_ORDER order, uint32_t x, uint32_t y, co
|
|||
DROID_ORDER_DATA sOrder = infoToOrderData(info, psStats);
|
||||
if (!add)
|
||||
{
|
||||
psDroid->listPendingBegin = psDroid->listPendingEnd;
|
||||
psDroid->listPendingBegin = psDroid->asOrderList.size();
|
||||
}
|
||||
orderDroidAddPending(psDroid, &sOrder);
|
||||
|
||||
|
|
|
@ -406,15 +406,10 @@ static void decideWRF(void)
|
|||
|
||||
static BOOL OptionsInet(void) //internet options
|
||||
{
|
||||
W_EDBINIT sEdInit;
|
||||
W_FORMINIT sFormInit;
|
||||
W_LABINIT sLabInit;
|
||||
W_CONTEXT sContext;
|
||||
|
||||
psConScreen = widgCreateScreen();
|
||||
widgSetTipFont(psConScreen,font_regular);
|
||||
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT)); //Connection Settings
|
||||
W_FORMINIT sFormInit; //Connection Settings
|
||||
sFormInit.formID = 0;
|
||||
sFormInit.id = CON_SETTINGS;
|
||||
sFormInit.style = WFORM_PLAIN;
|
||||
|
@ -431,7 +426,7 @@ static BOOL OptionsInet(void) //internet options
|
|||
_("Cancel"),IMAGE_NO,IMAGE_NO,true);
|
||||
|
||||
//label.
|
||||
memset(&sLabInit, 0, sizeof(W_LABINIT));
|
||||
W_LABINIT sLabInit;
|
||||
sLabInit.formID = CON_SETTINGS;
|
||||
sLabInit.id = CON_SETTINGS_LABEL;
|
||||
sLabInit.style = WLAB_ALIGNCENTRE;
|
||||
|
@ -440,20 +435,17 @@ static BOOL OptionsInet(void) //internet options
|
|||
sLabInit.width = CON_SETTINGSWIDTH;
|
||||
sLabInit.height = 20;
|
||||
sLabInit.pText = _("IP Address or Machine Name");
|
||||
sLabInit.FontID = font_regular;
|
||||
widgAddLabel(psConScreen, &sLabInit);
|
||||
|
||||
|
||||
memset(&sEdInit, 0, sizeof(W_EDBINIT)); // address
|
||||
W_EDBINIT sEdInit; // address
|
||||
sEdInit.formID = CON_SETTINGS;
|
||||
sEdInit.id = CON_IP;
|
||||
sEdInit.style = WEDB_PLAIN;
|
||||
sEdInit.x = CON_IPX;
|
||||
sEdInit.y = CON_IPY;
|
||||
sEdInit.width = CON_NAMEBOXWIDTH;
|
||||
sEdInit.height = CON_NAMEBOXHEIGHT;
|
||||
sEdInit.pText = ""; //_("IP Address or Machine Name");
|
||||
sEdInit.FontID = font_regular;
|
||||
// sEdInit.pUserData = (void*)PACKDWORD_TRI(0,IMAGE_DES_EDITBOXLEFTH , IMAGE_DES_EDITBOXLEFT);
|
||||
// sEdInit.pBoxDisplay = intDisplayButtonHilight;
|
||||
sEdInit.pBoxDisplay = intDisplayEditBox;
|
||||
|
@ -462,6 +454,7 @@ static BOOL OptionsInet(void) //internet options
|
|||
return false;
|
||||
}
|
||||
// auto click in the text box
|
||||
W_CONTEXT sContext;
|
||||
sContext.psScreen = psConScreen;
|
||||
sContext.psForm = (W_FORM *)psConScreen->psForm;
|
||||
sContext.xOffset = 0;
|
||||
|
@ -597,7 +590,6 @@ void setLobbyError (LOBBY_ERROR_TYPES error_type)
|
|||
static void addGames(void)
|
||||
{
|
||||
UDWORD i,gcount=0;
|
||||
W_BUTINIT sButInit;
|
||||
static const char *wrongVersionTip = "Your version of Warzone is incompatible with this game.";
|
||||
static const char *badModTip = "Your loaded mods are incompatible with this game. (Check mods/autoload/?)";
|
||||
|
||||
|
@ -609,12 +601,10 @@ static void addGames(void)
|
|||
gcount++;
|
||||
}
|
||||
}
|
||||
memset(&sButInit, 0, sizeof(W_BUTINIT));
|
||||
W_BUTINIT sButInit;
|
||||
sButInit.formID = FRONTEND_BOTFORM;
|
||||
sButInit.style = WBUT_PLAIN;
|
||||
sButInit.width = GAMES_GAMEWIDTH;
|
||||
sButInit.height = GAMES_GAMEHEIGHT;
|
||||
sButInit.FontID = font_regular;
|
||||
sButInit.pDisplay = displayRemoteGame;
|
||||
|
||||
// we want the old games deleted, and only list games when we should
|
||||
|
@ -723,12 +713,12 @@ static void addGames(void)
|
|||
// delete old widget if necessary
|
||||
widgDelete(psWScreen,FRONTEND_NOGAMESAVAILABLE);
|
||||
|
||||
memset(&sButInit, 0, sizeof(W_BUTINIT));
|
||||
sButInit = W_BUTINIT();
|
||||
sButInit.formID = FRONTEND_BOTFORM;
|
||||
sButInit.id = FRONTEND_NOGAMESAVAILABLE;
|
||||
sButInit.x = 70;
|
||||
sButInit.y = 50;
|
||||
sButInit.style = WBUT_PLAIN | WBUT_TXTCENTRE;
|
||||
sButInit.style = WBUT_TXTCENTRE;
|
||||
sButInit.width = FRONTEND_BUTWIDTH;
|
||||
sButInit.UserData = 0; // store disable state
|
||||
sButInit.height = FRONTEND_BUTHEIGHT;
|
||||
|
@ -901,14 +891,10 @@ static void showPasswordLabel( WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset,
|
|||
// This is what starts the lobby screen
|
||||
void startGameFind(void)
|
||||
{
|
||||
W_FORMINIT sFormInit;
|
||||
W_EDBINIT sEdInit;
|
||||
W_LABINIT sLabInit;
|
||||
|
||||
addBackdrop(); //background image
|
||||
|
||||
// draws the background of the games listed
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
W_FORMINIT sFormInit;
|
||||
sFormInit.formID = FRONTEND_BACKDROP;
|
||||
sFormInit.id = FRONTEND_BOTFORM;
|
||||
sFormInit.style = WFORM_PLAIN;
|
||||
|
@ -941,7 +927,7 @@ void startGameFind(void)
|
|||
// Password stuff. Hidden by default.
|
||||
|
||||
// password label.
|
||||
memset(&sLabInit, 0, sizeof(W_LABINIT));
|
||||
W_LABINIT sLabInit;
|
||||
sLabInit.formID = FRONTEND_BACKDROP;
|
||||
sLabInit.id = CON_PASSWORD_LABEL;
|
||||
sLabInit.style = WLAB_ALIGNCENTRE;
|
||||
|
@ -950,21 +936,18 @@ void startGameFind(void)
|
|||
sLabInit.width = CON_SETTINGSWIDTH;
|
||||
sLabInit.height = 20;
|
||||
sLabInit.pText = _("Enter Password:");
|
||||
sLabInit.FontID = font_regular;
|
||||
sLabInit.pDisplay = showPasswordLabel;
|
||||
widgAddLabel(psWScreen, &sLabInit);
|
||||
|
||||
// and finally draw the password entry box
|
||||
memset(&sEdInit, 0, sizeof(W_EDBINIT));
|
||||
W_EDBINIT sEdInit;
|
||||
sEdInit.formID = FRONTEND_BACKDROP;
|
||||
sEdInit.id = CON_PASSWORD;
|
||||
sEdInit.style = WEDB_PLAIN;
|
||||
sEdInit.x = 180;
|
||||
sEdInit.y = 200;
|
||||
sEdInit.width = 280;
|
||||
sEdInit.height = 20;
|
||||
sEdInit.pText = "";
|
||||
sEdInit.FontID = font_regular;
|
||||
sEdInit.pBoxDisplay = displayPasswordEditBox;
|
||||
|
||||
widgAddEditBox(psWScreen, &sEdInit);
|
||||
|
@ -975,7 +958,7 @@ void startGameFind(void)
|
|||
_("Cancel"),IMAGE_NO,IMAGE_NO,true);
|
||||
|
||||
// draws the background of the password box
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
sFormInit = W_FORMINIT();
|
||||
sFormInit.formID = FRONTEND_BACKDROP;
|
||||
sFormInit.id = FRONTEND_PASSWORDFORM;
|
||||
sFormInit.style = WFORM_PLAIN;
|
||||
|
@ -1051,10 +1034,7 @@ static void showPasswordForm(void)
|
|||
|
||||
static void addBlueForm(UDWORD parent,UDWORD id, const char *txt,UDWORD x,UDWORD y,UDWORD w,UDWORD h)
|
||||
{
|
||||
W_FORMINIT sFormInit;
|
||||
W_LABINIT sLabInit;
|
||||
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT)); // draw options box.
|
||||
W_FORMINIT sFormInit; // draw options box.
|
||||
sFormInit.formID= parent;
|
||||
sFormInit.id = id;
|
||||
sFormInit.x =(UWORD) x;
|
||||
|
@ -1067,17 +1047,15 @@ static void addBlueForm(UDWORD parent,UDWORD id, const char *txt,UDWORD x,UDWORD
|
|||
|
||||
if(strlen(txt)>0)
|
||||
{
|
||||
memset(&sLabInit, 0, sizeof(W_LABINIT));
|
||||
W_LABINIT sLabInit;
|
||||
sLabInit.formID = id;
|
||||
sLabInit.id = id+1;
|
||||
sLabInit.style = WLAB_PLAIN;
|
||||
sLabInit.x = 3;
|
||||
sLabInit.y = 4;
|
||||
sLabInit.width = 80;
|
||||
sLabInit.height = 20;
|
||||
sLabInit.pText = txt;
|
||||
// sLabInit.pDisplay = displayFeText;
|
||||
sLabInit.FontID = font_regular;
|
||||
widgAddLabel(psWScreen, &sLabInit);
|
||||
}
|
||||
return;
|
||||
|
@ -1121,14 +1099,12 @@ void updateLimitFlags()
|
|||
// need to check for side effects.
|
||||
static void addGameOptions(BOOL bRedo)
|
||||
{
|
||||
W_FORMINIT sFormInit;
|
||||
|
||||
widgDelete(psWScreen,MULTIOP_OPTIONS); // clear options list
|
||||
widgDelete(psWScreen,FRONTEND_SIDETEXT3); // del text..
|
||||
|
||||
iV_SetFont(font_regular);
|
||||
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT)); // draw options box.
|
||||
W_FORMINIT sFormInit; // draw options box.
|
||||
sFormInit.formID = FRONTEND_BACKDROP;
|
||||
sFormInit.id = MULTIOP_OPTIONS;
|
||||
sFormInit.x = MULTIOP_OPTIONSX;
|
||||
|
@ -1884,8 +1860,6 @@ static bool canChooseTeamFor(int i)
|
|||
|
||||
UDWORD addPlayerBox(BOOL players)
|
||||
{
|
||||
W_FORMINIT sFormInit;
|
||||
W_BUTINIT sButInit;
|
||||
UDWORD i=0;
|
||||
|
||||
// if background isn't there, then return since were not ready to draw the box yet!
|
||||
|
@ -1897,7 +1871,7 @@ UDWORD addPlayerBox(BOOL players)
|
|||
widgDelete(psWScreen,MULTIOP_PLAYERS); // del player window
|
||||
widgDelete(psWScreen,FRONTEND_SIDETEXT2); // del text too,
|
||||
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT)); // draw player window
|
||||
W_FORMINIT sFormInit; // draw player window
|
||||
sFormInit.formID = FRONTEND_BACKDROP;
|
||||
sFormInit.id = MULTIOP_PLAYERS;
|
||||
sFormInit.x = MULTIOP_PLAYERSX;
|
||||
|
@ -1952,10 +1926,9 @@ UDWORD addPlayerBox(BOOL players)
|
|||
if(ingame.localOptionsReceived)
|
||||
{
|
||||
//add team chooser
|
||||
memset(&sButInit, 0, sizeof(W_BUTINIT));
|
||||
W_BUTINIT sButInit;
|
||||
sButInit.formID = MULTIOP_PLAYERS;
|
||||
sButInit.id = MULTIOP_TEAMS_START+i;
|
||||
sButInit.style = WBUT_PLAIN;
|
||||
sButInit.x = 7;
|
||||
sButInit.y = (UWORD)(( (MULTIOP_TEAMSHEIGHT+5)*NetPlay.players[i].position)+4);
|
||||
sButInit.width = MULTIOP_TEAMSWIDTH;
|
||||
|
@ -1968,7 +1941,6 @@ UDWORD addPlayerBox(BOOL players)
|
|||
{
|
||||
sButInit.pTip = NULL;
|
||||
}
|
||||
sButInit.FontID = font_regular;
|
||||
sButInit.pDisplay = displayTeamChooser;
|
||||
sButInit.UserData = i;
|
||||
|
||||
|
@ -1992,10 +1964,9 @@ UDWORD addPlayerBox(BOOL players)
|
|||
}
|
||||
|
||||
// draw player info box
|
||||
memset(&sButInit, 0, sizeof(W_BUTINIT));
|
||||
W_BUTINIT sButInit;
|
||||
sButInit.formID = MULTIOP_PLAYERS;
|
||||
sButInit.id = MULTIOP_PLAYER_START+i;
|
||||
sButInit.style = WBUT_PLAIN;
|
||||
sButInit.x = 7 + MULTIOP_TEAMSWIDTH;
|
||||
sButInit.y = (UWORD)(( (MULTIOP_PLAYERHEIGHT+5)*NetPlay.players[i].position)+4);
|
||||
sButInit.width = MULTIOP_PLAYERWIDTH - MULTIOP_TEAMSWIDTH - MULTIOP_READY_WIDTH;
|
||||
|
@ -2008,7 +1979,6 @@ UDWORD addPlayerBox(BOOL players)
|
|||
{
|
||||
sButInit.pTip = NULL;
|
||||
}
|
||||
sButInit.FontID = font_regular;
|
||||
sButInit.pDisplay = displayPlayer;
|
||||
sButInit.UserData = i;
|
||||
|
||||
|
@ -2023,7 +1993,7 @@ UDWORD addPlayerBox(BOOL players)
|
|||
}
|
||||
else // AI player
|
||||
{
|
||||
memset(&sFormInit, 0, sizeof(W_BUTINIT));
|
||||
sFormInit = W_FORMINIT(); // This used to be an buggy memset using sizeof(W_BUTINIT)...
|
||||
sFormInit.formID = MULTIOP_PLAYERS;
|
||||
sFormInit.id = MULTIOP_PLAYER_START+i;
|
||||
sFormInit.style = WBUT_PLAIN;
|
||||
|
@ -2086,9 +2056,6 @@ void kickPlayer(uint32_t player_id, const char *reason, LOBBY_ERROR_TYPES type)
|
|||
|
||||
static void addChatBox(void)
|
||||
{
|
||||
W_FORMINIT sFormInit;
|
||||
W_EDBINIT sEdInit;
|
||||
|
||||
if(widgGetFromID(psWScreen,FRONTEND_TOPFORM))
|
||||
{
|
||||
widgDelete(psWScreen,FRONTEND_TOPFORM);
|
||||
|
@ -2099,7 +2066,7 @@ static void addChatBox(void)
|
|||
return;
|
||||
}
|
||||
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
W_FORMINIT sFormInit;
|
||||
|
||||
sFormInit.formID = FRONTEND_BACKDROP; // add the form
|
||||
sFormInit.id = MULTIOP_CHATBOX;
|
||||
|
@ -2123,15 +2090,13 @@ static void addChatBox(void)
|
|||
setConsolePermanence(true,true);
|
||||
setConsoleLineInfo(5); // use x lines on chat window
|
||||
|
||||
memset(&sEdInit, 0, sizeof(W_EDBINIT)); // add the edit box
|
||||
W_EDBINIT sEdInit; // add the edit box
|
||||
sEdInit.formID = MULTIOP_CHATBOX;
|
||||
sEdInit.id = MULTIOP_CHATEDIT;
|
||||
sEdInit.x = MULTIOP_CHATEDITX;
|
||||
sEdInit.y = MULTIOP_CHATEDITY;
|
||||
sEdInit.style = WEDB_PLAIN;
|
||||
sEdInit.width = MULTIOP_CHATEDITW;
|
||||
sEdInit.height = MULTIOP_CHATEDITH;
|
||||
sEdInit.FontID = font_regular;
|
||||
|
||||
sEdInit.pUserData = NULL;
|
||||
sEdInit.pBoxDisplay = displayChatEdit;
|
||||
|
@ -3929,18 +3894,14 @@ void displayMultiBut(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIELIGHT
|
|||
|
||||
static BOOL addMultiEditBox(UDWORD formid, UDWORD id, UDWORD x, UDWORD y, char const *tip, char const *tipres, UDWORD icon, UDWORD iconhi, UDWORD iconid)
|
||||
{
|
||||
W_EDBINIT sEdInit;
|
||||
|
||||
memset(&sEdInit, 0, sizeof(W_EDBINIT)); // editbox
|
||||
W_EDBINIT sEdInit; // editbox
|
||||
sEdInit.formID = formid;
|
||||
sEdInit.id = id;
|
||||
sEdInit.style = WEDB_PLAIN;
|
||||
sEdInit.x = (short)x;
|
||||
sEdInit.y = (short)y;
|
||||
sEdInit.width = MULTIOP_EDITBOXW;
|
||||
sEdInit.height = MULTIOP_EDITBOXH;
|
||||
sEdInit.pText = tipres;
|
||||
sEdInit.FontID = font_regular;
|
||||
sEdInit.pBoxDisplay = displayMultiEditBox;
|
||||
if (!widgAddEditBox(psWScreen, &sEdInit))
|
||||
{
|
||||
|
@ -3956,17 +3917,13 @@ static BOOL addMultiEditBox(UDWORD formid, UDWORD id, UDWORD x, UDWORD y, char c
|
|||
BOOL addMultiBut(W_SCREEN *screen, UDWORD formid, UDWORD id, UDWORD x, UDWORD y, UDWORD width, UDWORD height, const char* tipres, UDWORD norm, UDWORD down, UDWORD hi)
|
||||
{
|
||||
W_BUTINIT sButInit;
|
||||
|
||||
memset(&sButInit, 0, sizeof(W_BUTINIT));
|
||||
sButInit.formID = formid;
|
||||
sButInit.id = id;
|
||||
sButInit.style = WFORM_PLAIN;
|
||||
sButInit.x = (short) x;
|
||||
sButInit.y = (short) y;
|
||||
sButInit.width = (unsigned short) width;
|
||||
sButInit.height= (unsigned short) height;
|
||||
sButInit.pTip = tipres;
|
||||
sButInit.FontID = font_regular;
|
||||
sButInit.pDisplay = displayMultiBut;
|
||||
sButInit.UserData = PACKDWORD_TRI(norm, down, hi);
|
||||
|
||||
|
|
|
@ -114,8 +114,6 @@ static inline void freeLimitSet(void)
|
|||
// ////////////////////////////////////////////////////////////////////////////
|
||||
BOOL startLimitScreen(void)
|
||||
{
|
||||
W_FORMINIT sButInit;
|
||||
W_FORMINIT sFormInit;
|
||||
UDWORD numButtons = 0;
|
||||
UDWORD i;
|
||||
|
||||
|
@ -166,7 +164,7 @@ BOOL startLimitScreen(void)
|
|||
|
||||
addSideText(FRONTEND_SIDETEXT1,LIMITSX-2,LIMITSY,"LIMITS"); // draw sidetext...
|
||||
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT)); // draw blue form...
|
||||
W_FORMINIT sFormInit;
|
||||
sFormInit.formID = FRONTEND_BACKDROP;
|
||||
sFormInit.id = IDLIMITS;
|
||||
sFormInit.style = WFORM_PLAIN;
|
||||
|
@ -205,7 +203,7 @@ BOOL startLimitScreen(void)
|
|||
if(numButtons >(4*BUTPERFORM)) numButtons =(4*BUTPERFORM);
|
||||
|
||||
// add tab form..
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
sFormInit = W_FORMINIT();
|
||||
sFormInit.formID = IDLIMITS;
|
||||
sFormInit.id = IDLIMITS_TABS;
|
||||
sFormInit.style = WFORM_TABBED;
|
||||
|
@ -231,7 +229,7 @@ BOOL startLimitScreen(void)
|
|||
widgAddForm(psWScreen, &sFormInit);
|
||||
|
||||
//Put the buttons on it
|
||||
memset(&sButInit, 0, sizeof(W_BUTINIT));
|
||||
W_FORMINIT sButInit;
|
||||
sButInit.formID = IDLIMITS_TABS;//IDLIMITS;
|
||||
sButInit.style = WFORM_PLAIN;
|
||||
sButInit.width = BARWIDTH;
|
||||
|
|
|
@ -360,8 +360,6 @@ static unsigned int check_tip_index(unsigned int i) {
|
|||
*/
|
||||
void addMultiRequest(const char* searchDir, const char* fileExtension, UDWORD mode, UBYTE mapCam, UBYTE numPlayers)
|
||||
{
|
||||
W_FORMINIT sFormInit;
|
||||
W_BUTINIT sButInit;
|
||||
UDWORD players;
|
||||
char** fileList;
|
||||
char** currFile;
|
||||
|
@ -424,7 +422,7 @@ void addMultiRequest(const char* searchDir, const char* fileExtension, UDWORD mo
|
|||
(R_BUT_H+ 4));
|
||||
|
||||
/* add a form to place the tabbed form on */
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
W_FORMINIT sFormInit;
|
||||
sFormInit.formID = 0;
|
||||
sFormInit.id = M_REQUEST;
|
||||
sFormInit.style = WFORM_PLAIN;
|
||||
|
@ -437,7 +435,7 @@ void addMultiRequest(const char* searchDir, const char* fileExtension, UDWORD mo
|
|||
widgAddForm(psRScreen, &sFormInit);
|
||||
|
||||
/* Add the tabs */
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
sFormInit = W_FORMINIT();
|
||||
sFormInit.formID = M_REQUEST;
|
||||
sFormInit.id = M_REQUEST_TAB;
|
||||
sFormInit.style = WFORM_TABBED;
|
||||
|
@ -474,32 +472,28 @@ void addMultiRequest(const char* searchDir, const char* fileExtension, UDWORD mo
|
|||
widgAddForm(psRScreen, &sFormInit);
|
||||
|
||||
// Add the close button.
|
||||
memset(&sButInit, 0, sizeof(W_BUTINIT));
|
||||
W_BUTINIT sButInit;
|
||||
sButInit.formID = M_REQUEST;
|
||||
sButInit.id = M_REQUEST_CLOSE;
|
||||
sButInit.style = WBUT_PLAIN;
|
||||
sButInit.x = M_REQUEST_W - CLOSE_WIDTH - 3;
|
||||
sButInit.y = 0;
|
||||
sButInit.width = CLOSE_WIDTH;
|
||||
sButInit.height = CLOSE_HEIGHT;
|
||||
sButInit.pTip = _("Close");
|
||||
sButInit.FontID = font_regular;
|
||||
sButInit.pDisplay = intDisplayImageHilight;
|
||||
sButInit.UserData = PACKDWORD_TRI(0,IMAGE_CLOSEHILIGHT , IMAGE_CLOSE);
|
||||
widgAddButton(psRScreen, &sButInit);
|
||||
|
||||
/* Put the buttons on it *//* Set up the button struct */
|
||||
memset(&sButInit, 0, sizeof(W_BUTINIT));
|
||||
sButInit = W_BUTINIT();
|
||||
sButInit.formID = M_REQUEST_TAB;
|
||||
sButInit.id = M_REQUEST_BUT;
|
||||
sButInit.style = WBUT_PLAIN;
|
||||
sButInit.x = buttonsX;
|
||||
sButInit.y = 4;
|
||||
sButInit.width = R_BUT_W;
|
||||
sButInit.height = R_BUT_H;
|
||||
sButInit.pUserData = NULL;
|
||||
sButInit.pDisplay = displayRequestOption;
|
||||
sButInit.FontID = font_regular;
|
||||
|
||||
for (currFile = fileList, count = 0; *currFile != NULL && count < (butPerForm * 4); ++currFile)
|
||||
{
|
||||
|
@ -602,16 +596,14 @@ void addMultiRequest(const char* searchDir, const char* fileExtension, UDWORD mo
|
|||
// if it's map select then add the cam style buttons.
|
||||
if(mode == MULTIOP_MAP)
|
||||
{
|
||||
memset(&sButInit, 0, sizeof(W_BUTINIT));
|
||||
sButInit = W_BUTINIT();
|
||||
sButInit.formID = M_REQUEST_TAB;
|
||||
sButInit.id = M_REQUEST_C1;
|
||||
sButInit.style = WBUT_PLAIN;
|
||||
sButInit.x = 1;
|
||||
sButInit.y = 252;
|
||||
sButInit.width = 17;
|
||||
sButInit.height = 17;
|
||||
sButInit.UserData = 1;
|
||||
sButInit.FontID = font_regular;
|
||||
sButInit.pTip = _("Technology level 1");
|
||||
sButInit.pDisplay = displayCamTypeBut;
|
||||
|
||||
|
@ -1146,13 +1138,11 @@ static void displayChannelState(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset
|
|||
static void addMultiPlayer(UDWORD player,UDWORD pos)
|
||||
{
|
||||
UDWORD y,id;
|
||||
W_BUTINIT sButInit;
|
||||
W_FORMINIT sFormInit;
|
||||
y = MULTIMENU_PLAYER_H*(pos+1); // this is the top of the pos.
|
||||
id = MULTIMENU_PLAYER+player;
|
||||
|
||||
// add the whole thing.
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
W_FORMINIT sFormInit;
|
||||
sFormInit.formID = MULTIMENU_FORM;
|
||||
sFormInit.id = id;
|
||||
sFormInit.style = WFORM_PLAIN;
|
||||
|
@ -1170,17 +1160,16 @@ static void addMultiPlayer(UDWORD player,UDWORD pos)
|
|||
//ping
|
||||
//ALL DONE IN THE DISPLAY FUNC.
|
||||
|
||||
W_BUTINIT sButInit;
|
||||
|
||||
// add channel opener.
|
||||
if(player != selectedPlayer)
|
||||
{
|
||||
memset(&sButInit, 0, sizeof(W_BUTINIT));
|
||||
sButInit.formID = id;
|
||||
sButInit.style = WBUT_PLAIN;
|
||||
sButInit.x = MULTIMENU_C0;
|
||||
sButInit.y = 5;
|
||||
sButInit.width = 35;
|
||||
sButInit.height = 24;
|
||||
sButInit.FontID = font_regular;
|
||||
sButInit.id = MULTIMENU_CHANNEL + player;
|
||||
sButInit.pTip = _("Channel");
|
||||
sButInit.pDisplay = displayChannelState;
|
||||
|
@ -1195,7 +1184,6 @@ static void addMultiPlayer(UDWORD player,UDWORD pos)
|
|||
sButInit.y = 5;
|
||||
sButInit.width = 35;
|
||||
sButInit.height = 24;
|
||||
sButInit.FontID = font_regular;
|
||||
sButInit.id = MULTIMENU_ALLIANCE_BASE + player;
|
||||
sButInit.pTip = _("Toggle Alliance State");
|
||||
sButInit.pDisplay = displayAllianceState;
|
||||
|
@ -1278,7 +1266,6 @@ void intCloseDebugMenuNoAnim(void)
|
|||
*/
|
||||
BOOL addDebugMenu(BOOL bAdd)
|
||||
{
|
||||
W_FORMINIT sFormInit;
|
||||
UDWORD i,pos = 0,formHeight=0;
|
||||
|
||||
/* Close */
|
||||
|
@ -1299,7 +1286,7 @@ BOOL addDebugMenu(BOOL bAdd)
|
|||
}
|
||||
|
||||
// add form
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
W_FORMINIT sFormInit;
|
||||
sFormInit.formID = 0;
|
||||
sFormInit.id = DEBUGMENU;
|
||||
sFormInit.style = WFORM_PLAIN;
|
||||
|
@ -1322,7 +1309,7 @@ BOOL addDebugMenu(BOOL bAdd)
|
|||
if(strcmp(debugMenuEntry[i],""))
|
||||
{
|
||||
// add form
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
sFormInit = W_FORMINIT();
|
||||
sFormInit.formID = DEBUGMENU;
|
||||
sFormInit.id = DEBUGMENU_CLOSE + pos + 1;
|
||||
sFormInit.style = WFORM_PLAIN;
|
||||
|
@ -1339,7 +1326,7 @@ BOOL addDebugMenu(BOOL bAdd)
|
|||
}
|
||||
|
||||
// Add the close button.
|
||||
/* memset(&sButInit, 0, sizeof(W_BUTINIT));
|
||||
/*
|
||||
sButInit.formID = DEBUGMENU;
|
||||
sButInit.id = DEBUGMENU_CLOSE;
|
||||
sButInit.style = WBUT_PLAIN;
|
||||
|
@ -1363,8 +1350,6 @@ BOOL addDebugMenu(BOOL bAdd)
|
|||
|
||||
BOOL intAddMultiMenu(void)
|
||||
{
|
||||
W_FORMINIT sFormInit;
|
||||
W_BUTINIT sButInit;
|
||||
UDWORD i;
|
||||
|
||||
//check for already open.
|
||||
|
@ -1380,7 +1365,7 @@ BOOL intAddMultiMenu(void)
|
|||
}
|
||||
|
||||
// add form
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
W_FORMINIT sFormInit;
|
||||
sFormInit.formID = 0;
|
||||
sFormInit.id = MULTIMENU_FORM;
|
||||
sFormInit.style = WFORM_PLAIN;
|
||||
|
@ -1406,16 +1391,14 @@ BOOL intAddMultiMenu(void)
|
|||
}
|
||||
|
||||
// Add the close button.
|
||||
memset(&sButInit, 0, sizeof(W_BUTINIT));
|
||||
W_BUTINIT sButInit;
|
||||
sButInit.formID = MULTIMENU_FORM;
|
||||
sButInit.id = MULTIMENU_CLOSE;
|
||||
sButInit.style = WBUT_PLAIN;
|
||||
sButInit.x = MULTIMENU_FORM_W - CLOSE_WIDTH;
|
||||
sButInit.y = 0;
|
||||
sButInit.width = CLOSE_WIDTH;
|
||||
sButInit.height = CLOSE_HEIGHT;
|
||||
sButInit.pTip = _("Close");
|
||||
sButInit.FontID = font_regular;
|
||||
sButInit.pDisplay = intDisplayImageHilight;
|
||||
sButInit.UserData = PACKDWORD_TRI(0,IMAGE_CLOSEHILIGHT , IMAGE_CLOSE);
|
||||
if (!widgAddButton(psWScreen, &sButInit))
|
||||
|
|
|
@ -47,7 +47,7 @@ void reverseObjectList(BASE_OBJECT **ppsList);
|
|||
template <typename OBJECT>
|
||||
void reverseObjectList(OBJECT **ppsList)
|
||||
{
|
||||
BASE_OBJECT *baseList;
|
||||
BASE_OBJECT *baseList = *ppsList;
|
||||
reverseObjectList(&baseList);
|
||||
*ppsList = static_cast<OBJECT *>(baseList);
|
||||
}
|
||||
|
|
|
@ -2425,9 +2425,9 @@ BOOL orderStateStatsLoc(DROID *psDroid, DROID_ORDER order, BASE_STATS **ppsStats
|
|||
return false;
|
||||
}
|
||||
|
||||
static ORDER_LIST orderDataToOrderList(DROID_ORDER_DATA const *psOrder)
|
||||
static OrderListEntry orderDataToOrderList(DROID_ORDER_DATA const *psOrder)
|
||||
{
|
||||
ORDER_LIST list;
|
||||
OrderListEntry list;
|
||||
bool useStats = psOrder->order == DORDER_BUILD || psOrder->order == DORDER_LINEBUILD;
|
||||
|
||||
list.order = psOrder->order;
|
||||
|
@ -2445,14 +2445,7 @@ void orderDroidAddPending(DROID *psDroid, DROID_ORDER_DATA *psOrder)
|
|||
{
|
||||
ASSERT(psDroid != NULL, "Invalid unit pointer");
|
||||
|
||||
if (psDroid->listPendingEnd >= ORDER_LIST_MAX)
|
||||
{
|
||||
// no room to store the order, quit
|
||||
return;
|
||||
}
|
||||
|
||||
psDroid->asOrderList[psDroid->listPendingEnd] = orderDataToOrderList(psOrder);
|
||||
++psDroid->listPendingEnd;
|
||||
psDroid->asOrderList.push_back(orderDataToOrderList(psOrder));
|
||||
|
||||
//don't display the arrow-effects with build orders since unnecessary
|
||||
if (!bOrderEffectDisplayed && (psOrder->order != DORDER_BUILD || psOrder->order != DORDER_LINEBUILD || psOrder->order != DORDER_BUILDMODULE || psOrder->order != DORDER_HELPBUILD))
|
||||
|
@ -2475,15 +2468,14 @@ void orderDroidAdd(DROID *psDroid, DROID_ORDER_DATA *psOrder)
|
|||
{
|
||||
ASSERT(psDroid != NULL, "Invalid unit pointer");
|
||||
|
||||
if (psDroid->listSize >= ORDER_LIST_MAX)
|
||||
if (psDroid->listSize >= psDroid->asOrderList.size())
|
||||
{
|
||||
// no room to store the order, quit
|
||||
return;
|
||||
// Make more room to store the order.
|
||||
psDroid->asOrderList.push_back(OrderListEntry());
|
||||
}
|
||||
|
||||
psDroid->asOrderList[psDroid->listSize] = orderDataToOrderList(psOrder);
|
||||
psDroid->listSize += 1;
|
||||
psDroid->listPendingEnd = MAX(psDroid->listPendingEnd, psDroid->listSize); // Does nothing, unless there wasn't room to store the pending orders.
|
||||
|
||||
// if not doing anything - do it immediately
|
||||
if (psDroid->listSize <= 1 &&
|
||||
|
@ -2556,17 +2548,16 @@ BOOL orderDroidList(DROID *psDroid)
|
|||
|
||||
void orderDroidListEraseRange(DROID *psDroid, unsigned indexBegin, unsigned indexEnd)
|
||||
{
|
||||
// move the rest of the list down
|
||||
indexEnd = MIN(indexEnd, psDroid->listPendingEnd); // Do nothing if trying to pop an empty list.
|
||||
memmove(psDroid->asOrderList + indexBegin, psDroid->asOrderList + indexEnd, (psDroid->listPendingEnd - indexEnd) * sizeof(ORDER_LIST));
|
||||
memset(psDroid->asOrderList + psDroid->listPendingEnd - (indexEnd - indexBegin), 0, (indexEnd - indexBegin) * sizeof(ORDER_LIST));
|
||||
// Erase elements
|
||||
indexEnd = MIN(indexEnd, psDroid->asOrderList.size()); // Do nothing if trying to pop an empty list.
|
||||
psDroid->asOrderList.erase(psDroid->asOrderList.begin() + indexBegin, psDroid->asOrderList.begin() + indexEnd);
|
||||
|
||||
// Update indices into list.
|
||||
psDroid->listSize -= MIN(indexEnd, psDroid->listSize) - MIN(indexBegin, psDroid->listSize);
|
||||
psDroid->listPendingBegin -= MIN(indexEnd, psDroid->listPendingBegin) - MIN(indexBegin, psDroid->listPendingBegin);
|
||||
psDroid->listPendingEnd -= MIN(indexEnd, psDroid->listPendingEnd) - MIN(indexBegin, psDroid->listPendingEnd);
|
||||
}
|
||||
|
||||
// clear all the orders from the list
|
||||
// clear all the synchronised orders from the list
|
||||
void orderClearDroidList(DROID *psDroid)
|
||||
{
|
||||
syncDebug("droid%d list cleared", psDroid->id);
|
||||
|
@ -2575,8 +2566,7 @@ void orderClearDroidList(DROID *psDroid)
|
|||
|
||||
void orderClearTargetFromDroidList(DROID *psDroid, BASE_OBJECT *psTarget)
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < psDroid->listPendingEnd; i++)
|
||||
for (unsigned i = 0; i < psDroid->asOrderList.size(); ++i)
|
||||
{
|
||||
if (psDroid->asOrderList[i].psOrderTarget == psTarget)
|
||||
{
|
||||
|
@ -2585,7 +2575,7 @@ void orderClearTargetFromDroidList(DROID *psDroid, BASE_OBJECT *psTarget)
|
|||
syncDebug("droid%d list erase%d", psDroid->id, psTarget->id);
|
||||
}
|
||||
orderDroidListEraseRange(psDroid, i, i + 1);
|
||||
--i;
|
||||
--i; // If this underflows, the ++i will overflow it back.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2593,45 +2583,32 @@ void orderClearTargetFromDroidList(DROID *psDroid, BASE_OBJECT *psTarget)
|
|||
// check all the orders in the list for died objects
|
||||
void orderCheckList(DROID *psDroid)
|
||||
{
|
||||
SDWORD i;
|
||||
|
||||
i=0;
|
||||
while (i<psDroid->listSize)
|
||||
for (unsigned i = 0; i < psDroid->asOrderList.size(); ++i)
|
||||
{
|
||||
//if (psDroid->asOrderList[i].psObj &&
|
||||
// (psDroid->asOrderList[i].psObj)->died)
|
||||
|
||||
DROID_ORDER order = psDroid->asOrderList[i].order;
|
||||
//if order requires an object
|
||||
if (psDroid->asOrderList[i].order == DORDER_ATTACK ||
|
||||
psDroid->asOrderList[i].order == DORDER_REPAIR ||
|
||||
psDroid->asOrderList[i].order == DORDER_OBSERVE ||
|
||||
psDroid->asOrderList[i].order == DORDER_DROIDREPAIR ||
|
||||
psDroid->asOrderList[i].order == DORDER_FIRESUPPORT ||
|
||||
psDroid->asOrderList[i].order == DORDER_CLEARWRECK ||
|
||||
psDroid->asOrderList[i].order == DORDER_DEMOLISH ||
|
||||
psDroid->asOrderList[i].order == DORDER_HELPBUILD ||
|
||||
psDroid->asOrderList[i].order == DORDER_BUILDMODULE)
|
||||
if (order == DORDER_ATTACK ||
|
||||
order == DORDER_REPAIR ||
|
||||
order == DORDER_OBSERVE ||
|
||||
order == DORDER_DROIDREPAIR ||
|
||||
order == DORDER_FIRESUPPORT ||
|
||||
order == DORDER_CLEARWRECK ||
|
||||
order == DORDER_DEMOLISH ||
|
||||
order == DORDER_HELPBUILD ||
|
||||
order == DORDER_BUILDMODULE)
|
||||
{
|
||||
if ((BASE_OBJECT *)psDroid->asOrderList[i].psOrderTarget &&
|
||||
((BASE_OBJECT *)psDroid->asOrderList[i].psOrderTarget)->died)
|
||||
BASE_OBJECT *psTarget = (BASE_OBJECT *)psDroid->asOrderList[i].psOrderTarget;
|
||||
if (psTarget != NULL && psTarget->died)
|
||||
{
|
||||
// copy any other orders down the stack
|
||||
psDroid->listSize -= 1;
|
||||
memmove(psDroid->asOrderList + i, psDroid->asOrderList + i + 1,
|
||||
(psDroid->listSize - i) * sizeof(ORDER_LIST));
|
||||
memset(psDroid->asOrderList + psDroid->listSize, 0, sizeof(ORDER_LIST));
|
||||
}
|
||||
else
|
||||
if (i < psDroid->listSize)
|
||||
{
|
||||
i++;
|
||||
syncDebug("droid%d list erase dead droid%d", psDroid->id, psTarget->id);
|
||||
}
|
||||
orderDroidListEraseRange(psDroid, i, i + 1);
|
||||
--i; // If this underflows, the ++i will overflow it back.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
i ++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -89,7 +89,19 @@ BASE_OBJECT *g_pProjLastAttacker;
|
|||
|
||||
/***************************************************************************/
|
||||
|
||||
static UDWORD establishTargetRadius( BASE_OBJECT *psTarget );
|
||||
struct ObjectShape
|
||||
{
|
||||
ObjectShape() {}
|
||||
ObjectShape(int radius) : isRectangular(false), size(radius, radius) {}
|
||||
ObjectShape(int width, int breadth) : isRectangular(true), size(width, breadth) {}
|
||||
ObjectShape(Vector2i widthBreadth) : isRectangular(true), size(widthBreadth) {}
|
||||
int radius() const { return size.x; }
|
||||
|
||||
bool isRectangular; ///< True if rectangular, false if circular.
|
||||
Vector2i size; ///< x == y if circular.
|
||||
};
|
||||
|
||||
static ObjectShape establishTargetShape(BASE_OBJECT *psTarget);
|
||||
static UDWORD establishTargetHeight( BASE_OBJECT *psTarget );
|
||||
static void proj_ImpactFunc( PROJECTILE *psObj );
|
||||
static void proj_PostImpactFunc( PROJECTILE *psObj );
|
||||
|
@ -99,11 +111,6 @@ static int32_t objectDamage(BASE_OBJECT *psObj, UDWORD damage, WEAPON_CLASS weap
|
|||
static HIT_SIDE getHitSide (PROJECTILE *psObj, BASE_OBJECT *psTarget);
|
||||
|
||||
|
||||
/*static inline bool isDead(BASE_OBJECT *psObj)
|
||||
{
|
||||
return psObj->died != 0;
|
||||
}*/
|
||||
|
||||
static inline void setProjectileDestination(PROJECTILE *psProj, BASE_OBJECT *psObj)
|
||||
{
|
||||
aiObjectAddExpectedDamage(psProj->psDest, -psProj->expectedDamageCaused); // The old target shouldn't be expecting any more damage from this projectile.
|
||||
|
@ -360,11 +367,9 @@ int32_t projCalcIndirectVelocities(const int32_t dx, const int32_t dz, int32_t v
|
|||
return t;
|
||||
}
|
||||
|
||||
BOOL proj_SendProjectile(WEAPON *psWeap, BASE_OBJECT *psAttacker, int player, Vector3i target, BASE_OBJECT *psTarget, BOOL bVisible, int weapon_slot)
|
||||
bool proj_SendProjectile(WEAPON *psWeap, SIMPLE_OBJECT *psAttacker, int player, Vector3i target, BASE_OBJECT *psTarget, BOOL bVisible, int weapon_slot)
|
||||
{
|
||||
PROJECTILE * psProj = new PROJECTILE(ProjectileTrackerID |(gameTime2 >>4), player);
|
||||
int32_t dx, dy, dz;
|
||||
uint32_t dxy;
|
||||
WEAPON_STATS *psStats = &asWeaponStats[psWeap->nStat];
|
||||
|
||||
ASSERT_OR_RETURN( false, psWeap->nStat < numWeaponStats, "Invalid range referenced for numWeaponStats, %d > %d", psWeap->nStat, numWeaponStats);
|
||||
|
@ -447,28 +452,26 @@ BOOL proj_SendProjectile(WEAPON *psWeap, BASE_OBJECT *psAttacker, int player, Ve
|
|||
scoreUpdateVar(WD_SHOTS_OFF_TARGET);
|
||||
}
|
||||
|
||||
dx = psProj->dst.x - psProj->src.x;
|
||||
dy = psProj->dst.y - psProj->src.y;
|
||||
dz = psProj->dst.z - psProj->src.z;
|
||||
Vector3i deltaPos = psProj->dst - psProj->src;
|
||||
|
||||
/* roll never set */
|
||||
psProj->rot.roll = 0;
|
||||
|
||||
psProj->rot.direction = iAtan2(dx, dy);
|
||||
psProj->rot.direction = iAtan2(removeZ(deltaPos));
|
||||
|
||||
|
||||
/* get target distance */
|
||||
dxy = iHypot(dx, dy);
|
||||
// Get target distance, horizontal distance only.
|
||||
uint32_t dist = iHypot(removeZ(deltaPos));
|
||||
|
||||
if (proj_Direct(psStats) || (!proj_Direct(psStats) && dxy <= psStats->minRange))
|
||||
if (proj_Direct(psStats) || (!proj_Direct(psStats) && dist <= psStats->minRange))
|
||||
{
|
||||
psProj->rot.pitch = iAtan2(dz, dxy);
|
||||
psProj->rot.pitch = iAtan2(deltaPos.z, dist);
|
||||
psProj->state = PROJ_INFLIGHTDIRECT;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* indirect */
|
||||
projCalcIndirectVelocities(dxy, dz, psStats->flightSpeed, &psProj->vXY, &psProj->vZ);
|
||||
projCalcIndirectVelocities(dist, deltaPos.z, psStats->flightSpeed, &psProj->vXY, &psProj->vZ);
|
||||
psProj->rot.pitch = iAtan2(psProj->vZ, psProj->vXY);
|
||||
psProj->state = PROJ_INFLIGHTINDIRECT;
|
||||
}
|
||||
|
@ -503,13 +506,11 @@ BOOL proj_SendProjectile(WEAPON *psWeap, BASE_OBJECT *psAttacker, int player, Ve
|
|||
if ( psProj->psSource )
|
||||
{
|
||||
/* firing sound emitted from source */
|
||||
audio_PlayObjDynamicTrack( (BASE_OBJECT *) psProj->psSource,
|
||||
psStats->iAudioFireID, NULL );
|
||||
audio_PlayObjDynamicTrack(psProj->psSource, psStats->iAudioFireID, NULL);
|
||||
/* GJ HACK: move howitzer sound with shell */
|
||||
if ( psStats->weaponSubClass == WSC_HOWITZERS )
|
||||
{
|
||||
audio_PlayObjDynamicTrack( (BASE_OBJECT *) psProj,
|
||||
ID_SOUND_HOWITZ_FLIGHT, NULL );
|
||||
audio_PlayObjDynamicTrack(psProj, ID_SOUND_HOWITZ_FLIGHT, NULL);
|
||||
}
|
||||
}
|
||||
//don't play the sound for a LasSat in multiPlayer
|
||||
|
@ -520,10 +521,10 @@ BOOL proj_SendProjectile(WEAPON *psWeap, BASE_OBJECT *psAttacker, int player, Ve
|
|||
}
|
||||
}
|
||||
|
||||
if ((psAttacker != NULL) && !proj_Direct(psStats))
|
||||
if (psAttacker != NULL && !proj_Direct(psStats))
|
||||
{
|
||||
//check for Counter Battery Sensor in range of target
|
||||
counterBatteryFire(psAttacker, psTarget);
|
||||
counterBatteryFire(castBaseObject(psAttacker), psTarget);
|
||||
}
|
||||
|
||||
syncDebugProjectile(psProj, '*');
|
||||
|
@ -601,12 +602,24 @@ static INTERVAL collisionXY(int32_t x1, int32_t y1, int32_t x2, int32_t y2, int3
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int32_t collisionXYZ(Vector3i v1, Vector3i v2, int32_t radius, int32_t height)
|
||||
static int32_t collisionXYZ(Vector3i v1, Vector3i v2, ObjectShape shape, int32_t height)
|
||||
{
|
||||
INTERVAL iz = collisionZ(v1.z, v2.z, height);
|
||||
if (!intervalEmpty(iz)) // Don't bother checking x and y unless z passes.
|
||||
INTERVAL i = collisionZ(v1.z, v2.z, height);
|
||||
if (!intervalEmpty(i)) // Don't bother checking x and y unless z passes.
|
||||
{
|
||||
INTERVAL i = intervalIntersection(iz, collisionXY(v1.x, v1.y, v2.x, v2.y, radius));
|
||||
if (shape.isRectangular)
|
||||
{
|
||||
i = intervalIntersection(i, collisionZ(v1.x, v2.x, shape.size.x));
|
||||
if (!intervalEmpty(i)) // Don't bother checking y unless x and z pass.
|
||||
{
|
||||
i = intervalIntersection(i, collisionZ(v1.y, v2.y, shape.size.y));
|
||||
}
|
||||
}
|
||||
else // Else is circular.
|
||||
{
|
||||
i = intervalIntersection(i, collisionXY(v1.x, v1.y, v2.x, v2.y, shape.radius()));
|
||||
}
|
||||
|
||||
if (!intervalEmpty(i))
|
||||
{
|
||||
return MAX(0, i.begin);
|
||||
|
@ -630,8 +643,8 @@ static void proj_InFlightFunc(PROJECTILE *psProj, bool bIndirect)
|
|||
Vector3i nextPos;
|
||||
int32_t targetDistance, currentDistance;
|
||||
BASE_OBJECT *psTempObj, *closestCollisionObject = NULL;
|
||||
SPACETIME closestCollisionSpacetime;
|
||||
memset(&closestCollisionSpacetime, 0, sizeof(SPACETIME)); // Squelch uninitialised warning.
|
||||
Spacetime closestCollisionSpacetime;
|
||||
memset(&closestCollisionSpacetime, 0, sizeof(Spacetime)); // Squelch uninitialised warning.
|
||||
|
||||
CHECK_PROJECTILE(psProj);
|
||||
|
||||
|
@ -822,8 +835,8 @@ static void proj_InFlightFunc(PROJECTILE *psProj, bool bIndirect)
|
|||
const Vector3i diff = psProj->pos - psTempObj->pos;
|
||||
const Vector3i prevDiff = psProj->prevSpacetime.pos - psTempObjPrevPos;
|
||||
const unsigned int targetHeight = establishTargetHeight(psTempObj);
|
||||
const unsigned int targetRadius = establishTargetRadius(psTempObj);
|
||||
const int32_t collision = collisionXYZ(prevDiff, diff, targetRadius, targetHeight);
|
||||
const ObjectShape targetShape = establishTargetShape(psTempObj);
|
||||
const int32_t collision = collisionXYZ(prevDiff, diff, targetShape, targetHeight);
|
||||
const uint32_t collisionTime = psProj->prevSpacetime.time + (psProj->time - psProj->prevSpacetime.time)*collision/1024;
|
||||
|
||||
if (collision >= 0 && collisionTime < closestCollisionSpacetime.time)
|
||||
|
@ -839,7 +852,7 @@ static void proj_InFlightFunc(PROJECTILE *psProj, bool bIndirect)
|
|||
if (closestCollisionObject != NULL)
|
||||
{
|
||||
// We hit!
|
||||
SET_SPACETIME(psProj, closestCollisionSpacetime);
|
||||
setSpacetime(psProj, closestCollisionSpacetime);
|
||||
if(psProj->time == psProj->prevSpacetime.time)
|
||||
{
|
||||
--psProj->prevSpacetime.time;
|
||||
|
@ -852,7 +865,6 @@ static void proj_InFlightFunc(PROJECTILE *psProj, bool bIndirect)
|
|||
WEAPON asWeap;
|
||||
// Determine position to fire a missile at
|
||||
Vector3i newDest = psProj->src + move * distanceExtensionFactor/100;
|
||||
memset(&asWeap, 0, sizeof(asWeap));
|
||||
asWeap.nStat = psStats - asWeaponStats;
|
||||
|
||||
ASSERT(distanceExtensionFactor != 0, "Unitialized variable used! distanceExtensionFactor is not initialized.");
|
||||
|
@ -860,7 +872,7 @@ static void proj_InFlightFunc(PROJECTILE *psProj, bool bIndirect)
|
|||
// Assume we damaged the chosen target
|
||||
psProj->psDamaged.push_back(closestCollisionObject);
|
||||
|
||||
proj_SendProjectile(&asWeap, (BASE_OBJECT*)psProj, psProj->player, newDest, NULL, true, -1);
|
||||
proj_SendProjectile(&asWeap, psProj, psProj->player, newDest, NULL, true, -1);
|
||||
}
|
||||
|
||||
psProj->state = PROJ_IMPACT;
|
||||
|
@ -871,7 +883,7 @@ static void proj_InFlightFunc(PROJECTILE *psProj, bool bIndirect)
|
|||
ASSERT(distanceExtensionFactor != 0, "Unitialized variable used! distanceExtensionFactor is not initialized.");
|
||||
|
||||
if (distancePercent >= distanceExtensionFactor || /* We've traveled our maximum range */
|
||||
!mapObjIsAboveGround((BASE_OBJECT*)psProj)) /* trying to travel through terrain */
|
||||
!mapObjIsAboveGround(psProj)) /* trying to travel through terrain */
|
||||
{
|
||||
/* Miss due to range or height */
|
||||
psProj->state = PROJ_IMPACT;
|
||||
|
@ -886,7 +898,7 @@ static void proj_InFlightFunc(PROJECTILE *psProj, bool bIndirect)
|
|||
// TODO Should probably give effectTime as an extra parameter to addEffect, or make an effectGiveAuxTime parameter, with yet another 'this is naughty' comment.
|
||||
for (effectTime = ((psProj->prevSpacetime.time + 15) & ~15); effectTime < psProj->time; effectTime += 16)
|
||||
{
|
||||
SPACETIME st = interpolateObjectSpacetime(psProj, effectTime);
|
||||
Spacetime st = interpolateObjectSpacetime(psProj, effectTime);
|
||||
Vector3i posFlip = swapYZ(st.pos);
|
||||
switch (psStats->weaponSubClass)
|
||||
{
|
||||
|
@ -1343,7 +1355,7 @@ void PROJECTILE::update()
|
|||
|
||||
syncDebugProjectile(psObj, '<');
|
||||
|
||||
psObj->prevSpacetime = GET_SPACETIME(psObj);
|
||||
psObj->prevSpacetime = getSpacetime(psObj);
|
||||
|
||||
/* See if any of the stored objects have died
|
||||
* since the projectile was created
|
||||
|
@ -1519,19 +1531,14 @@ SDWORD proj_GetLongRange(const WEAPON_STATS* psStats)
|
|||
|
||||
|
||||
/***************************************************************************/
|
||||
static UDWORD establishTargetRadius(BASE_OBJECT *psTarget)
|
||||
static ObjectShape establishTargetShape(BASE_OBJECT *psTarget)
|
||||
{
|
||||
UDWORD radius;
|
||||
STRUCTURE *psStructure;
|
||||
FEATURE *psFeat;
|
||||
|
||||
CHECK_OBJECT(psTarget);
|
||||
radius = 0;
|
||||
|
||||
switch(psTarget->type)
|
||||
switch (psTarget->type)
|
||||
{
|
||||
case OBJ_DROID:
|
||||
switch(((DROID *)psTarget)->droidType)
|
||||
case OBJ_DROID: // Circular.
|
||||
switch (castDroid(psTarget)->droidType)
|
||||
{
|
||||
case DROID_WEAPON:
|
||||
case DROID_SENSOR:
|
||||
|
@ -1545,31 +1552,25 @@ static UDWORD establishTargetRadius(BASE_OBJECT *psTarget)
|
|||
case DROID_CYBORG_REPAIR:
|
||||
case DROID_CYBORG_SUPER:
|
||||
//Watermelon:'hitbox' size is now based on imd size
|
||||
radius = abs(psTarget->sDisplay.imd->radius) * 2;
|
||||
break;
|
||||
return abs(psTarget->sDisplay.imd->radius) * 2;
|
||||
case DROID_DEFAULT:
|
||||
case DROID_TRANSPORTER:
|
||||
default:
|
||||
radius = TILE_UNITS/4; // how will we arrive at this?
|
||||
return TILE_UNITS/4; // how will we arrive at this?
|
||||
}
|
||||
break;
|
||||
case OBJ_STRUCTURE:
|
||||
psStructure = (STRUCTURE*)psTarget;
|
||||
radius = (MAX(psStructure->pStructureType->baseBreadth, psStructure->pStructureType->baseWidth) * TILE_UNITS) / 2;
|
||||
break;
|
||||
case OBJ_FEATURE:
|
||||
// radius = TILE_UNITS/4; // how will we arrive at this?
|
||||
psFeat = (FEATURE *)psTarget;
|
||||
radius = (MAX(psFeat->psStats->baseBreadth,psFeat->psStats->baseWidth) * TILE_UNITS) / 2;
|
||||
break;
|
||||
case OBJ_PROJECTILE:
|
||||
case OBJ_STRUCTURE: // Rectangular.
|
||||
return getStructureSize(castStructure(psTarget)) * TILE_UNITS/2;
|
||||
case OBJ_FEATURE: // Rectangular.
|
||||
return Vector2i(castFeature(psTarget)->psStats->baseWidth, castFeature(psTarget)->psStats->baseBreadth) * TILE_UNITS/2;
|
||||
case OBJ_PROJECTILE: // Circular, but can't happen since a PROJECTILE isn't a BASE_OBJECT.
|
||||
//Watermelon 1/2 radius of a droid?
|
||||
radius = TILE_UNITS/8;
|
||||
return TILE_UNITS/8;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return(radius);
|
||||
return 0; // Huh?
|
||||
}
|
||||
/***************************************************************************/
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ void proj_FreeAllProjectiles(void); ///< Free all projectiles in the list.
|
|||
int32_t projCalcIndirectVelocities(const int32_t dx, const int32_t dz, int32_t v, int32_t *vx, int32_t *vz);
|
||||
|
||||
/** Send a single projectile against the given target. */
|
||||
BOOL proj_SendProjectile(WEAPON *psWeap, BASE_OBJECT *psAttacker, int player, Vector3i target, BASE_OBJECT *psTarget, BOOL bVisible, int weapon_slot);
|
||||
bool proj_SendProjectile(WEAPON *psWeap, SIMPLE_OBJECT *psAttacker, int player, Vector3i target, BASE_OBJECT *psTarget, BOOL bVisible, int weapon_slot);
|
||||
|
||||
/** Return whether a weapon is direct or indirect. */
|
||||
bool proj_Direct(const WEAPON_STATS* psStats);
|
||||
|
@ -72,25 +72,25 @@ extern BOOL gfxVisible(PROJECTILE *psObj);
|
|||
|
||||
extern void objectShimmy ( BASE_OBJECT *psObj );
|
||||
|
||||
static inline void setProjectileSource(PROJECTILE *psProj, BASE_OBJECT *psObj)
|
||||
static inline void setProjectileSource(PROJECTILE *psProj, SIMPLE_OBJECT *psObj)
|
||||
{
|
||||
// use the source of the source of psProj if psAttacker is a projectile
|
||||
if (psObj && psObj->type == OBJ_PROJECTILE)
|
||||
psProj->psSource = NULL;
|
||||
if (psObj == NULL)
|
||||
{
|
||||
PROJECTILE *psPrevProj = (PROJECTILE*)psObj;
|
||||
}
|
||||
else if (isProjectile(psObj))
|
||||
{
|
||||
PROJECTILE *psPrevProj = castProjectile(psObj);
|
||||
|
||||
if (psPrevProj->psSource && !psPrevProj->psSource->died)
|
||||
{
|
||||
psProj->psSource = psPrevProj->psSource;
|
||||
}
|
||||
else
|
||||
{
|
||||
psProj->psSource = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
psProj->psSource = psObj;
|
||||
psProj->psSource = castBaseObject(psObj);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -55,10 +55,18 @@ struct PROJECTILE : public SIMPLE_OBJECT
|
|||
Vector3i src; ///< Where projectile started
|
||||
Vector3i dst; ///< The target coordinates
|
||||
SDWORD vXY, vZ; ///< axis velocities
|
||||
SPACETIME prevSpacetime; ///< Location of projectile in previous tick.
|
||||
Spacetime prevSpacetime; ///< Location of projectile in previous tick.
|
||||
UDWORD expectedDamageCaused; ///< Expected damage that this projectile will cause to the target.
|
||||
};
|
||||
|
||||
typedef std::vector<PROJECTILE *>::const_iterator ProjectileIterator;
|
||||
|
||||
|
||||
/// True iff object is a projectile.
|
||||
static inline bool isProjectile(SIMPLE_OBJECT const *psObject) { return psObject->type == OBJ_PROJECTILE; }
|
||||
/// Returns PROJECTILE * if projectile or NULL if not.
|
||||
static inline PROJECTILE *castProjectile(SIMPLE_OBJECT *psObject) { return isProjectile(psObject)? (PROJECTILE *)psObject : (PROJECTILE *)NULL; }
|
||||
/// Returns PROJECTILE const * if projectile or NULL if not.
|
||||
static inline PROJECTILE const *castProjectile(SIMPLE_OBJECT const *psObject) { return isProjectile(psObject)? (PROJECTILE const *)psObject : (PROJECTILE const *)NULL; }
|
||||
|
||||
#endif // __INCLUDED_PROJECTILEDEF_H__
|
||||
|
|
|
@ -167,6 +167,7 @@ void statsInitVars(void)
|
|||
memset(asSensorUpgrade, 0, sizeof(asSensorUpgrade));
|
||||
memset(asECMUpgrade, 0, sizeof(asECMUpgrade));
|
||||
memset(asRepairUpgrade, 0, sizeof(asRepairUpgrade));
|
||||
memset(asConstUpgrade, 0, sizeof(asConstUpgrade));
|
||||
memset(asBodyUpgrade, 0, sizeof(asBodyUpgrade));
|
||||
|
||||
// init the max values
|
||||
|
|
|
@ -1805,21 +1805,14 @@ STRUCTURE* buildStructureDir(STRUCTURE_STATS *pStructureType, UDWORD x, UDWORD y
|
|||
psBuilding->psTarget[i] = NULL;
|
||||
psBuilding->targetOrigin[i] = ORIGIN_UNKNOWN;
|
||||
}
|
||||
psBuilding->bTargetted = false;
|
||||
|
||||
psBuilding->lastEmission = 0;
|
||||
psBuilding->timeLastHit = 0;
|
||||
psBuilding->lastHitWeapon = WSC_NUM_WEAPON_SUBCLASSES; // no such weapon
|
||||
|
||||
psBuilding->inFire = 0;
|
||||
psBuilding->burnStart = 0;
|
||||
psBuilding->burnDamage = 0;
|
||||
|
||||
psBuilding->selected = false;
|
||||
psBuilding->status = SS_BEING_BUILT;
|
||||
psBuilding->currentBuildPts = 0;
|
||||
psBuilding->currentPowerAccrued = 0;
|
||||
psBuilding->cluster = 0;
|
||||
|
||||
alignStructure(psBuilding);
|
||||
|
||||
|
@ -2162,9 +2155,6 @@ STRUCTURE *buildBlueprint(STRUCTURE_STATS *psStats, int32_t x, int32_t y, uint16
|
|||
blueprint->rot.roll = 0;
|
||||
blueprint->selected = false;
|
||||
|
||||
blueprint->timeLastHit = 0;
|
||||
blueprint->lastHitWeapon = WSC_NUM_WEAPON_SUBCLASSES; // Noone attacked the blueprint. Do not render special effects.
|
||||
|
||||
blueprint->numWeaps = 0;
|
||||
blueprint->asWeaps[0].nStat = 0;
|
||||
|
||||
|
@ -4669,14 +4659,10 @@ bool validLocation(BASE_STATS *psStats, unsigned x, unsigned y, uint16_t directi
|
|||
//if setting up a build queue need to check against future sites as well - AB 4/5/99
|
||||
if (ctrlShiftDown() && player == selectedPlayer && bCheckBuildQueue)
|
||||
{
|
||||
DROID *psDroid;
|
||||
SDWORD order,left,right,up,down,size;
|
||||
BOOL validCombi;
|
||||
|
||||
//defense and missile silo's can be built next to anything so don't need to check
|
||||
if (!(psBuilding->type == REF_DEFENSE || psBuilding->type == REF_MISSILE_SILO || psBuilding->type == REF_REARM_PAD))
|
||||
{
|
||||
for (psDroid = apsDroidLists[player]; psDroid; psDroid = psDroid->psNext)
|
||||
for (DROID *psDroid = apsDroidLists[player]; psDroid; psDroid = psDroid->psNext)
|
||||
{
|
||||
//once its invalid stop checking
|
||||
if (valid == false)
|
||||
|
@ -4687,17 +4673,15 @@ bool validLocation(BASE_STATS *psStats, unsigned x, unsigned y, uint16_t directi
|
|||
psDroid->droidType == DROID_CYBORG_CONSTRUCT)
|
||||
{
|
||||
//look thru' the list of orders to see if more building sites
|
||||
for (order = psDroid->listPendingBegin; order < psDroid->listPendingEnd; order++)
|
||||
for (unsigned order = psDroid->listPendingBegin; order < psDroid->asOrderList.size(); order++)
|
||||
{
|
||||
if (psDroid->asOrderList[order].order == DORDER_BUILD)
|
||||
{
|
||||
STRUCTURE_STATS *orderTarget = (STRUCTURE_STATS *)psDroid->asOrderList[order].psOrderTarget;
|
||||
|
||||
validCombi = false;
|
||||
if (((STRUCTURE_STATS *)psDroid->asOrderList[order].
|
||||
psOrderTarget)->type == REF_DEFENSE ||
|
||||
((STRUCTURE_STATS *)psDroid->asOrderList[order].
|
||||
psOrderTarget)->type == REF_MISSILE_SILO)
|
||||
bool validCombi = false;
|
||||
if (orderTarget->type == REF_DEFENSE ||
|
||||
orderTarget->type == REF_MISSILE_SILO)
|
||||
{
|
||||
validCombi = true;
|
||||
}
|
||||
|
@ -4714,12 +4698,11 @@ bool validLocation(BASE_STATS *psStats, unsigned x, unsigned y, uint16_t directi
|
|||
//check if any corner is within the build site
|
||||
STRUCTURE_STATS *target = (STRUCTURE_STATS *)psDroid->asOrderList[order].psOrderTarget;
|
||||
uint16_t dir = psDroid->asOrderList[order].direction;
|
||||
size = getStructureStatsWidth(target, dir);
|
||||
left = map_coord(psDroid->asOrderList[order].x) - size/2;
|
||||
right = left + size;
|
||||
size = getStructureStatsBreadth(target, dir);
|
||||
up = map_coord(psDroid->asOrderList[order].y) - size/2;
|
||||
down = up + size;
|
||||
Vector2i size = getStructureStatsSize(target, dir);
|
||||
int left = map_coord(psDroid->asOrderList[order].x) - size.x/2;
|
||||
int right = left + size.x;
|
||||
int up = map_coord(psDroid->asOrderList[order].y) - size.y/2;
|
||||
int down = up + size.y;
|
||||
if (((left > site.xTL-1 && left <= site.xBR+1) &&
|
||||
(up > site.yTL-1 && up <= site.yBR+1)) ||
|
||||
((right > site.xTL-1 && right <= site.xBR+1) &&
|
||||
|
@ -6032,7 +6015,7 @@ void buildingComplete(STRUCTURE *psBuilding)
|
|||
|
||||
if(selectedPlayer == psBuilding->player)
|
||||
{
|
||||
audio_PlayObjStaticTrack( (void *) psBuilding, ID_SOUND_POWER_HUM );
|
||||
audio_PlayObjStaticTrack(psBuilding, ID_SOUND_POWER_HUM);
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -8201,38 +8184,22 @@ void cbNewDroid(STRUCTURE *psFactory, DROID *psDroid)
|
|||
psScrCBNewDroidFact = NULL;
|
||||
}
|
||||
|
||||
unsigned getStructureWidth(const STRUCTURE *psBuilding)
|
||||
Vector2i getStructureSize(STRUCTURE const *psBuilding)
|
||||
{
|
||||
return getStructureStatsWidth(psBuilding->pStructureType, psBuilding->rot.direction);
|
||||
return getStructureStatsSize(psBuilding->pStructureType, psBuilding->rot.direction);
|
||||
}
|
||||
|
||||
unsigned getStructureBreadth(const STRUCTURE *psBuilding)
|
||||
{
|
||||
return getStructureStatsBreadth(psBuilding->pStructureType, psBuilding->rot.direction);
|
||||
}
|
||||
|
||||
unsigned getStructureStatsWidth(const STRUCTURE_STATS *pStructureType, uint16_t direction)
|
||||
Vector2i getStructureStatsSize(STRUCTURE_STATS const *pStructureType, uint16_t direction)
|
||||
{
|
||||
Vector2i size(pStructureType->baseWidth, pStructureType->baseBreadth);
|
||||
if (((direction + 0x2000) & 0x4000) != 0)
|
||||
{
|
||||
// Building is rotated left or right by 90°, swap width and height.
|
||||
return pStructureType->baseBreadth;
|
||||
std::swap(size.x, size.y);
|
||||
}
|
||||
|
||||
// Building has normal orientation (or upsidedown).
|
||||
return pStructureType->baseWidth;
|
||||
}
|
||||
|
||||
unsigned getStructureStatsBreadth(const STRUCTURE_STATS *pStructureType, uint16_t direction)
|
||||
{
|
||||
if (((direction + 0x2000) & 0x4000) != 0)
|
||||
{
|
||||
// Building is rotated left or right by 90°, swap width and height.
|
||||
return pStructureType->baseWidth;
|
||||
}
|
||||
|
||||
// Building has normal orientation (or upsidedown).
|
||||
return pStructureType->baseBreadth;
|
||||
return size;
|
||||
}
|
||||
|
||||
// Check that psVictimStruct is not referred to by any other object in the game
|
||||
|
|
|
@ -408,10 +408,13 @@ BOOL structureCheckReferences(STRUCTURE *psVictimStruct);
|
|||
|
||||
void cbNewDroid(STRUCTURE *psFactory, DROID *psDroid);
|
||||
|
||||
unsigned getStructureWidth(const STRUCTURE *psBuilding);
|
||||
unsigned getStructureBreadth(const STRUCTURE *psBuilding);
|
||||
unsigned getStructureStatsWidth(const STRUCTURE_STATS *pStructureType, uint16_t direction);
|
||||
unsigned getStructureStatsBreadth(const STRUCTURE_STATS *pStructureType, uint16_t direction);
|
||||
WZ_DECL_PURE Vector2i getStructureSize(STRUCTURE const *psBuilding);
|
||||
WZ_DECL_PURE Vector2i getStructureStatsSize(STRUCTURE_STATS const *pStructureType, uint16_t direction);
|
||||
|
||||
static inline unsigned getStructureWidth(const STRUCTURE *psBuilding) { return getStructureSize(psBuilding).x; }
|
||||
static inline unsigned getStructureBreadth(const STRUCTURE *psBuilding) { return getStructureSize(psBuilding).y; }
|
||||
static inline WZ_DECL_PURE unsigned getStructureStatsWidth(const STRUCTURE_STATS *pStructureType, uint16_t direction) { return getStructureStatsSize(pStructureType, direction).x; }
|
||||
static inline WZ_DECL_PURE unsigned getStructureStatsBreadth(const STRUCTURE_STATS *pStructureType, uint16_t direction) { return getStructureStatsSize(pStructureType, direction).y; }
|
||||
|
||||
static inline int structSensorRange(const STRUCTURE* psObj)
|
||||
{
|
||||
|
@ -471,11 +474,11 @@ void _syncDebugStructure(const char *function, STRUCTURE *psStruct, char ch);
|
|||
|
||||
|
||||
// True iff object is a structure.
|
||||
static inline bool isStructure(BASE_OBJECT const *psObject) { return psObject->type == OBJ_STRUCTURE; }
|
||||
static inline bool isStructure(SIMPLE_OBJECT const *psObject) { return psObject->type == OBJ_STRUCTURE; }
|
||||
// Returns STRUCTURE * if structure or NULL if not.
|
||||
static inline STRUCTURE *castStructure(BASE_OBJECT *psObject) { return isStructure(psObject)? (STRUCTURE *)psObject : (STRUCTURE *)NULL; }
|
||||
static inline STRUCTURE *castStructure(SIMPLE_OBJECT *psObject) { return isStructure(psObject)? (STRUCTURE *)psObject : (STRUCTURE *)NULL; }
|
||||
// Returns STRUCTURE const * if structure or NULL if not.
|
||||
static inline STRUCTURE const *castStructure(BASE_OBJECT const *psObject) { return isStructure(psObject)? (STRUCTURE const *)psObject : (STRUCTURE const *)NULL; }
|
||||
static inline STRUCTURE const *castStructure(SIMPLE_OBJECT const *psObject) { return isStructure(psObject)? (STRUCTURE const *)psObject : (STRUCTURE const *)NULL; }
|
||||
|
||||
|
||||
#endif // __INCLUDED_SRC_STRUCTURE_H__
|
||||
|
|
|
@ -212,8 +212,6 @@ BOOL intAddTransporter(DROID *psSelected, BOOL offWorld)
|
|||
/*Add the Transporter Interface*/
|
||||
static BOOL _intAddTransporter(DROID *psSelected, BOOL offWorld)
|
||||
{
|
||||
W_FORMINIT sFormInit;
|
||||
W_BUTINIT sButInit;
|
||||
BOOL Animate = true;
|
||||
|
||||
onMission = offWorld;
|
||||
|
@ -243,10 +241,7 @@ static BOOL _intAddTransporter(DROID *psSelected, BOOL offWorld)
|
|||
Animate = false;
|
||||
}
|
||||
|
||||
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
|
||||
|
||||
W_FORMINIT sFormInit;
|
||||
sFormInit.formID = 0;
|
||||
sFormInit.id = IDTRANS_FORM;
|
||||
sFormInit.style = WFORM_PLAIN;
|
||||
|
@ -272,16 +267,14 @@ static BOOL _intAddTransporter(DROID *psSelected, BOOL offWorld)
|
|||
}
|
||||
|
||||
/* Add the close button */
|
||||
memset(&sButInit, 0, sizeof(W_BUTINIT));
|
||||
W_BUTINIT sButInit;
|
||||
sButInit.formID = IDTRANS_FORM;
|
||||
sButInit.id = IDTRANS_CLOSE;
|
||||
sButInit.style = WBUT_PLAIN;
|
||||
sButInit.x = TRANS_WIDTH - CLOSE_WIDTH;
|
||||
sButInit.y = 0;
|
||||
sButInit.width = CLOSE_WIDTH;
|
||||
sButInit.height = CLOSE_HEIGHT;
|
||||
sButInit.pTip = _("Close");
|
||||
sButInit.FontID = font_regular;
|
||||
sButInit.pDisplay = intDisplayImageHilight;
|
||||
sButInit.UserData = PACKDWORD_TRI(0,IMAGE_CLOSEHILIGHT , IMAGE_CLOSE);
|
||||
if (!widgAddButton(psWScreen, &sButInit))
|
||||
|
@ -316,10 +309,6 @@ static BOOL _intAddTransporter(DROID *psSelected, BOOL offWorld)
|
|||
// Add the main Transporter Contents Interface
|
||||
BOOL intAddTransporterContents(void)
|
||||
{
|
||||
W_FORMINIT sFormInit;
|
||||
W_BUTINIT sButInit;
|
||||
W_FORMINIT sButFInit;
|
||||
W_LABINIT sLabInit;
|
||||
BOOL Animate = true;
|
||||
BOOL AlreadyUp = false;
|
||||
|
||||
|
@ -335,8 +324,7 @@ BOOL intAddTransporterContents(void)
|
|||
Animate = false;
|
||||
}
|
||||
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
|
||||
W_FORMINIT sFormInit;
|
||||
sFormInit.formID = 0;
|
||||
sFormInit.id = IDTRANS_CONTENTFORM;
|
||||
sFormInit.style = WFORM_PLAIN;
|
||||
|
@ -362,16 +350,14 @@ BOOL intAddTransporterContents(void)
|
|||
}
|
||||
|
||||
/* Add the close button */
|
||||
memset(&sButInit, 0, sizeof(W_BUTINIT));
|
||||
W_BUTINIT sButInit;
|
||||
sButInit.formID = IDTRANS_CONTENTFORM;
|
||||
sButInit.id = IDTRANS_CONTCLOSE;
|
||||
sButInit.style = WBUT_PLAIN;
|
||||
sButInit.x = STAT_WIDTH - CLOSE_WIDTH;
|
||||
sButInit.y = 0;
|
||||
sButInit.width = CLOSE_WIDTH;
|
||||
sButInit.height = CLOSE_HEIGHT;
|
||||
sButInit.pTip = _("Close");
|
||||
sButInit.FontID = font_regular;
|
||||
sButInit.pDisplay = intDisplayImageHilight;
|
||||
sButInit.UserData = PACKDWORD_TRI(0,IMAGE_CLOSEHILIGHT , IMAGE_CLOSE);
|
||||
if (!widgAddButton(psWScreen, &sButInit))
|
||||
|
@ -381,16 +367,14 @@ BOOL intAddTransporterContents(void)
|
|||
if (bMultiPlayer)
|
||||
{
|
||||
//add the capacity label
|
||||
memset(&sLabInit,0,sizeof(W_LABINIT));
|
||||
W_LABINIT sLabInit;
|
||||
sLabInit.formID = IDTRANS_CONTENTFORM;
|
||||
sLabInit.id = IDTRANS_CAPACITY;
|
||||
sLabInit.style = WLAB_PLAIN;
|
||||
sLabInit.x = (SWORD)sButInit.x -40;
|
||||
sLabInit.y = 0;
|
||||
sLabInit.width = 16;
|
||||
sLabInit.height = 16;
|
||||
sLabInit.pText = "00/10";
|
||||
sLabInit.FontID = font_regular;
|
||||
sLabInit.pCallback = intUpdateTransCapacity;
|
||||
if (!widgAddLabel(psWScreen, &sLabInit))
|
||||
{
|
||||
|
@ -400,7 +384,7 @@ BOOL intAddTransporterContents(void)
|
|||
//add the Launch button if on a mission
|
||||
if (onMission)
|
||||
{
|
||||
memset(&sButFInit, 0, sizeof(W_FORMINIT));
|
||||
W_FORMINIT sButFInit;
|
||||
sButFInit.formID = IDTRANS_CONTENTFORM;
|
||||
sButFInit.id = IDTRANS_LAUNCH;
|
||||
sButFInit.style = WFORM_CLICKABLE | WFORM_NOCLICKMOVE;
|
||||
|
@ -412,7 +396,6 @@ BOOL intAddTransporterContents(void)
|
|||
sButFInit.height = iV_GetImageHeight(IntImages,IMAGE_LAUNCHUP);
|
||||
sButFInit.pTip = _("Launch Transport");
|
||||
//sButInit.pText = "Launch";
|
||||
// sButFInit.FontID = font_regular;
|
||||
sButFInit.pDisplay = intDisplayImageHilight;
|
||||
|
||||
sButFInit.UserData = PACKDWORD_TRI(0,IMAGE_LAUNCHDOWN,IMAGE_LAUNCHUP);
|
||||
|
@ -434,10 +417,6 @@ BOOL intAddTransporterContents(void)
|
|||
/*This is used to display the transporter button and capacity when at the home base ONLY*/
|
||||
BOOL intAddTransporterLaunch(DROID *psDroid)
|
||||
{
|
||||
|
||||
//W_BUTINIT sButInit;
|
||||
W_FORMINIT sButInit; //needs to be a clickable form now
|
||||
W_LABINIT sLabInit;
|
||||
UDWORD capacity;
|
||||
DROID *psCurr, *psNext;
|
||||
|
||||
|
@ -456,7 +435,7 @@ BOOL intAddTransporterLaunch(DROID *psDroid)
|
|||
return true;
|
||||
}
|
||||
|
||||
memset(&sButInit, 0, sizeof(W_FORMINIT));
|
||||
W_FORMINIT sButInit; //needs to be a clickable form now
|
||||
sButInit.formID = 0;
|
||||
sButInit.id = IDTRANS_LAUNCH;
|
||||
sButInit.style = WFORM_CLICKABLE | WFORM_NOCLICKMOVE;
|
||||
|
@ -473,16 +452,14 @@ BOOL intAddTransporterLaunch(DROID *psDroid)
|
|||
}
|
||||
|
||||
//add the capacity label
|
||||
memset(&sLabInit,0,sizeof(W_LABINIT));
|
||||
W_LABINIT sLabInit;
|
||||
sLabInit.formID = IDTRANS_LAUNCH;
|
||||
sLabInit.id = IDTRANS_CAPACITY;
|
||||
sLabInit.style = WLAB_PLAIN;
|
||||
sLabInit.x = (SWORD)(sButInit.x + 20);
|
||||
sLabInit.y = 0;
|
||||
sLabInit.width = 16;
|
||||
sLabInit.height = 16;
|
||||
sLabInit.pText = "00/10";
|
||||
sLabInit.FontID = font_regular;
|
||||
sLabInit.pCallback = intUpdateTransCapacity;
|
||||
if (!widgAddLabel(psWScreen, &sLabInit))
|
||||
{
|
||||
|
@ -525,14 +502,12 @@ void intRemoveTransporterLaunch(void)
|
|||
/* Add the Transporter Button form */
|
||||
BOOL intAddTransButtonForm(void)
|
||||
{
|
||||
W_FORMINIT sFormInit;
|
||||
W_FORMINIT sBFormInit, sBFormInit2;
|
||||
UDWORD numButtons, i;
|
||||
SDWORD BufferID;
|
||||
DROID *psDroid;
|
||||
|
||||
/* Add the button form */
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
W_FORMINIT sFormInit;
|
||||
sFormInit.formID = IDTRANS_FORM;
|
||||
sFormInit.id = IDTRANS_TABFORM;
|
||||
sFormInit.style = WFORM_TABBED;
|
||||
|
@ -591,8 +566,7 @@ BOOL intAddTransButtonForm(void)
|
|||
|
||||
|
||||
/* Add the transporter and status buttons */
|
||||
memset(&sBFormInit, 0, sizeof(W_FORMINIT));
|
||||
memset(&sBFormInit2, 0, sizeof(W_FORMINIT));
|
||||
W_FORMINIT sBFormInit;
|
||||
sBFormInit.formID = IDTRANS_TABFORM;
|
||||
sBFormInit.id = IDTRANS_START;
|
||||
sBFormInit.majorID = 0;
|
||||
|
@ -603,7 +577,7 @@ BOOL intAddTransButtonForm(void)
|
|||
sBFormInit.width = OBJ_BUTWIDTH;
|
||||
sBFormInit.height = OBJ_BUTHEIGHT;
|
||||
|
||||
memcpy(&sBFormInit2,&sBFormInit,sizeof(W_FORMINIT));
|
||||
W_FORMINIT sBFormInit2 = sBFormInit;
|
||||
sBFormInit2.id = IDTRANS_STATSTART;
|
||||
sBFormInit2.y = OBJ_STATSTARTY;
|
||||
|
||||
|
@ -685,14 +659,12 @@ BOOL intAddTransButtonForm(void)
|
|||
/* Add the Transporter Contents form */
|
||||
BOOL intAddTransContentsForm(void)
|
||||
{
|
||||
W_FORMINIT sFormInit;
|
||||
W_FORMINIT sBFormInit;
|
||||
UDWORD numButtons, i;
|
||||
SDWORD BufferID;
|
||||
DROID *psDroid, *psNext;
|
||||
|
||||
/* Add the contents form */
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
W_FORMINIT sFormInit;
|
||||
sFormInit.formID = IDTRANS_CONTENTFORM;
|
||||
sFormInit.id = IDTRANS_CONTABFORM;
|
||||
sFormInit.style = WFORM_TABBED;
|
||||
|
@ -734,7 +706,7 @@ BOOL intAddTransContentsForm(void)
|
|||
|
||||
|
||||
/* Add the transporter contents buttons */
|
||||
memset(&sBFormInit, 0, sizeof(W_FORMINIT));
|
||||
W_FORMINIT sBFormInit;
|
||||
sBFormInit.formID = IDTRANS_CONTABFORM;
|
||||
sBFormInit.id = IDTRANS_CONTSTART;
|
||||
sBFormInit.majorID = 0;
|
||||
|
@ -792,10 +764,6 @@ BOOL intAddTransContentsForm(void)
|
|||
/* Add the Droids back at home form */
|
||||
BOOL intAddDroidsAvailForm(void)
|
||||
{
|
||||
W_FORMINIT sFormInit;
|
||||
W_BUTINIT sButInit;
|
||||
W_FORMINIT sBFormInit;
|
||||
W_BARINIT sBarInit;
|
||||
UDWORD numButtons, i, butPerForm;
|
||||
SDWORD BufferID;
|
||||
DROID *psDroid;
|
||||
|
@ -815,7 +783,7 @@ BOOL intAddDroidsAvailForm(void)
|
|||
|
||||
|
||||
/* Add the droids available form */
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
W_FORMINIT sFormInit;
|
||||
sFormInit.formID = 0;
|
||||
sFormInit.id = IDTRANS_DROIDS;
|
||||
sFormInit.style = WFORM_PLAIN;
|
||||
|
@ -842,19 +810,15 @@ BOOL intAddDroidsAvailForm(void)
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* Add the close button */
|
||||
memset(&sButInit, 0, sizeof(W_BUTINIT));
|
||||
W_BUTINIT sButInit;
|
||||
sButInit.formID = IDTRANS_DROIDS;
|
||||
sButInit.id = IDTRANS_DROIDCLOSE;
|
||||
sButInit.style = WBUT_PLAIN;
|
||||
sButInit.x = TRANSDROID_WIDTH - CLOSE_WIDTH;
|
||||
sButInit.y = 0;
|
||||
sButInit.width = CLOSE_WIDTH;
|
||||
sButInit.height = CLOSE_HEIGHT;
|
||||
sButInit.pTip = _("Close");
|
||||
sButInit.FontID = font_regular;
|
||||
sButInit.pDisplay = intDisplayImageHilight;
|
||||
sButInit.UserData = PACKDWORD_TRI(0,IMAGE_CLOSEHILIGHT , IMAGE_CLOSE);
|
||||
if (!widgAddButton(psWScreen, &sButInit))
|
||||
|
@ -864,7 +828,7 @@ BOOL intAddDroidsAvailForm(void)
|
|||
|
||||
|
||||
//now add the tabbed droids available form
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
sFormInit = W_FORMINIT();
|
||||
sFormInit.formID = IDTRANS_DROIDS;
|
||||
sFormInit.id = IDTRANS_DROIDTAB;
|
||||
sFormInit.style = WFORM_TABBED;
|
||||
|
@ -930,7 +894,7 @@ BOOL intAddDroidsAvailForm(void)
|
|||
|
||||
|
||||
/* Add the droids available buttons */
|
||||
memset(&sBFormInit, 0, sizeof(W_FORMINIT));
|
||||
W_FORMINIT sBFormInit;
|
||||
sBFormInit.formID = IDTRANS_DROIDTAB;
|
||||
sBFormInit.id = IDTRANS_DROIDSTART;
|
||||
sBFormInit.majorID = 0;
|
||||
|
@ -944,10 +908,8 @@ BOOL intAddDroidsAvailForm(void)
|
|||
ClearSystem0Buffers();
|
||||
|
||||
/* Add the state of repair bar for each droid*/
|
||||
memset(&sBarInit, 0, sizeof(W_BARINIT));
|
||||
W_BARINIT sBarInit;
|
||||
sBarInit.id = IDTRANS_REPAIRBARSTART;
|
||||
sBarInit.style = WBAR_PLAIN;
|
||||
sBarInit.orientation = WBAR_LEFT;
|
||||
sBarInit.x = STAT_TIMEBARX;
|
||||
sBarInit.y = STAT_TIMEBARY;
|
||||
sBarInit.width = STAT_PROGBARWIDTH;
|
||||
|
|
Loading…
Reference in New Issue