From 35f2a40d9cb78de227e30141e5c7779c60f54a0f Mon Sep 17 00:00:00 2001 From: Meep-Eep Date: Sat, 22 Sep 2007 19:55:47 +0000 Subject: [PATCH] Cleanups, comments. git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2858 8092fc87-c524-0410-9efc-e669fe64eaf9 --- sc2/src/sc2code/commanim.c | 4 ++-- sc2/src/sc2code/commanim.h | 5 +++++ sc2/src/sc2code/globdata.c | 5 +++-- sc2/src/sc2code/globdata.h | 21 ++++++++++----------- sc2/src/sc2code/load.c | 3 ++- 5 files changed, 22 insertions(+), 16 deletions(-) diff --git a/sc2/src/sc2code/commanim.c b/sc2/src/sc2code/commanim.c index 772531413..2e38d4d13 100644 --- a/sc2/src/sc2code/commanim.c +++ b/sc2/src/sc2code/commanim.c @@ -140,10 +140,10 @@ ambient_anim_task (void *data) memset (AnimFrame, 0, sizeof (AnimFrame)); for (i = 0; i < CommData.NumAnimations; i++) if (CommData.AlienAmbientArray[i].AnimFlags & YOYO_ANIM) - AnimFrame[i] = SetAbsFrameIndex (CommFrame, + AnimFrame[i] = SetAbsFrameIndex (CommFrame, CommData.AlienAmbientArray[i].StartIndex); else - AnimFrame[i] = SetAbsFrameIndex (CommFrame, + AnimFrame[i] = SetAbsFrameIndex (CommFrame, (COUNT)(CommData.AlienAmbientArray[i].StartIndex + CommData.AlienAmbientArray[i].NumFrames - 1)); diff --git a/sc2/src/sc2code/commanim.h b/sc2/src/sc2code/commanim.h index 9019e83a2..ec84bdfe2 100644 --- a/sc2/src/sc2code/commanim.h +++ b/sc2/src/sc2code/commanim.h @@ -25,16 +25,21 @@ typedef enum { UP_DIR, + // Animation indices are increasing DOWN_DIR, + // Animation indices are decreasing NO_DIR } ANIM_DIR; typedef enum { PICTURE_ANIM, + // Parts of a picture are replaced COLOR_ANIM + // Colormap tricks on a picture } ANIM_TYPE; +// Describes an active animation. struct SEQUENCE { COUNT Alarm; diff --git a/sc2/src/sc2code/globdata.c b/sc2/src/sc2code/globdata.c index daf68db00..ebed72220 100644 --- a/sc2/src/sc2code/globdata.c +++ b/sc2/src/sc2code/globdata.c @@ -280,7 +280,7 @@ InitSIS (void) InitPlanetInfo (); InitGroupInfo (TRUE); - GLOBAL (glob_flags) = NUM_READ_SPEEDS >> 1; + GLOBAL (glob_flags) = 0; GLOBAL (ElementWorth[COMMON]) = 1; GLOBAL_SIS (ElementAmounts[COMMON]) = 0; @@ -352,7 +352,8 @@ InitSIS (void) GLOBAL_SIS (log_x) = UNIVERSE_TO_LOGX (SOL_X); GLOBAL_SIS (log_y) = UNIVERSE_TO_LOGY (SOL_Y); CurStarDescPtr = 0; - GLOBAL (autopilot.x) = GLOBAL (autopilot.y) = ~0; + GLOBAL (autopilot.x) = ~0; + GLOBAL (autopilot.y) = ~0; /* In case the program is exited before the full game is terminated, * make sure that the temporary files are deleted. diff --git a/sc2/src/sc2code/globdata.h b/sc2/src/sc2code/globdata.h index 2a5e5eb23..087548f1c 100644 --- a/sc2/src/sc2code/globdata.h +++ b/sc2/src/sc2code/globdata.h @@ -25,13 +25,17 @@ #include "velocity.h" +// XXX: the following should be moved to commanim.h // Animation types: #define RANDOM_ANIM (1 << 0) - // Next index is randomly chose + // The next index is randomly chosen. #define CIRCULAR_ANIM (1 << 1) - // + // After the last index has been reached, the animation starts over. #define YOYO_ANIM (1 << 2) + // After the last index has been reached, the order that the + // animation frames are used is reversed. #define ANIM_MASK (RANDOM_ANIM | CIRCULAR_ANIM | YOYO_ANIM) + // Mask of all animation types. #define WAIT_TALKING (1 << 3) #define PAUSE_TALKING (1 << 4) @@ -48,7 +52,7 @@ typedef struct // Index of the first image (for image animation) or // index of the first color map (for palette animation) BYTE NumFrames; - // number of frames + // Number of frames in the animation. BYTE AnimFlags; // One of RANDOM_ANIM, CIRCULAR_ANIM, or YOYO_ANIM @@ -886,12 +890,10 @@ START_GAME_STATE ADD_GAME_STATE (ORZ_STACK1, 1) END_GAME_STATE -#define READ_SPEED_MASK ((1 << 3) - 1) -#define NUM_READ_SPEEDS 5 +// Values for GAME_STATE.glob_flags: #define COMBAT_SPEED_SHIFT 6 #define COMBAT_SPEED_MASK (((1 << 2) - 1) << COMBAT_SPEED_SHIFT) #define NUM_COMBAT_SPEEDS 4 - #define MUSIC_DISABLED (1 << 3) #define SOUND_DISABLED (1 << 4) #define CYBORG_ENABLED (1 << 5) @@ -923,8 +925,8 @@ typedef UWORD ACTIVITY; typedef struct { - // XXX: cur_state is obsolete now and was replaced by process.c:zoom_out - BYTE cur_state, glob_flags; + BYTE glob_flags; + // See above for the meaning of the bits. BYTE CrewCost, FuelCost; BYTE ModuleCost[NUM_MODULES]; @@ -1011,9 +1013,6 @@ extern void setGameState32 (int startBit, DWORD val extern CONTEXT RadarContext; -extern void DiscardStarMap (void *CodeRef); -extern void RetrieveStarMap (void); - extern void FreeSC2Data (void); extern BOOLEAN LoadSC2Data (void); diff --git a/sc2/src/sc2code/load.c b/sc2/src/sc2code/load.c index 50a2b8eb6..ec2e9035f 100644 --- a/sc2/src/sc2code/load.c +++ b/sc2/src/sc2code/load.c @@ -379,9 +379,10 @@ LoadClockState (CLOCK_STATE *ClockPtr, DECODE_REF fh) static void LoadGameState (GAME_STATE *GSPtr, DECODE_REF fh) { + BYTE dummy8; DWORD tmpd; - cread_8 (fh, &GSPtr->cur_state); /* obsolete */ + cread_8 (fh, &dummy8); /* obsolete */ cread_8 (fh, &GSPtr->glob_flags); cread_8 (fh, &GSPtr->CrewCost); cread_8 (fh, &GSPtr->FuelCost);