Some cleanups

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2461 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
meep-eep
2006-10-26 22:02:34 +00:00
parent eee3791e1c
commit 734ea17e21
2 changed files with 51 additions and 48 deletions
+43 -43
View File
@@ -46,31 +46,30 @@ load_ship (STARSHIPPTR StarShipPtr, BOOLEAN LoadBattleData)
CodeRef = CaptureCodeRes (LoadCodeRes (INITIAL_CODE_RES), CodeRef = CaptureCodeRes (LoadCodeRes (INITIAL_CODE_RES),
(PVOID)&GlobData, (PVOID)&StarShipPtr->RaceDescPtr); (PVOID)&GlobData, (PVOID)&StarShipPtr->RaceDescPtr);
if (CodeRef == 0) if (CodeRef == 0)
goto BadLoad; goto BadLoad;
StarShipPtr->RaceDescPtr->CodeRef = CodeRef; StarShipPtr->RaceDescPtr->CodeRef = CodeRef;
if ((StarShipPtr->RaceDescPtr->ship_info.icons = StarShipPtr->RaceDescPtr->ship_info.icons =
CaptureDrawable (LoadGraphic ( CaptureDrawable (LoadGraphic (
(RESOURCE)StarShipPtr->RaceDescPtr->ship_info.icons (RESOURCE)StarShipPtr->RaceDescPtr->ship_info.icons));
))) == 0) if (StarShipPtr->RaceDescPtr->ship_info.icons == 0)
{ {
/* goto BadLoad */ /* goto BadLoad */
} }
if ((StarShipPtr->RaceDescPtr->ship_info.melee_icon = StarShipPtr->RaceDescPtr->ship_info.melee_icon =
CaptureDrawable (LoadGraphic ( CaptureDrawable (LoadGraphic (
(RESOURCE)StarShipPtr->RaceDescPtr->ship_info.melee_icon (RESOURCE)StarShipPtr->RaceDescPtr->ship_info.melee_icon));
))) == 0) if (StarShipPtr->RaceDescPtr->ship_info.melee_icon == 0)
{ {
/* goto BadLoad */ /* goto BadLoad */
} }
if ((StarShipPtr->RaceDescPtr->ship_info.race_strings = StarShipPtr->RaceDescPtr->ship_info.race_strings =
CaptureStringTable (LoadStringTable ( CaptureStringTable (LoadStringTable (
(RESOURCE)StarShipPtr->RaceDescPtr->ship_info.race_strings (RESOURCE)StarShipPtr->RaceDescPtr->ship_info.race_strings));
))) == 0) if (StarShipPtr->RaceDescPtr->ship_info.race_strings == 0)
{ {
/* goto BadLoad */ /* goto BadLoad */
} }
@@ -107,31 +106,34 @@ load_ship (STARSHIPPTR StarShipPtr, BOOLEAN LoadBattleData)
goto BadLoad; goto BadLoad;
} }
if (RawPtr->captain_control.background if (RawPtr->captain_control.background != 0)
&& (RawPtr->captain_control.background = {
RawPtr->captain_control.background =
CaptureDrawable (LoadGraphic ( CaptureDrawable (LoadGraphic (
(RESOURCE)RawPtr->captain_control.background (RESOURCE)RawPtr->captain_control.background));
))) == 0) if (RawPtr->captain_control.background == 0)
goto BadLoad; goto BadLoad;
}
if (RawPtr->victory_ditty if (RawPtr->victory_ditty != 0)
&& (RawPtr->victory_ditty = {
LoadMusic ( RawPtr->victory_ditty =
(RESOURCE)RawPtr->victory_ditty LoadMusic ((RESOURCE)RawPtr->victory_ditty);
)) == 0) if (RawPtr->victory_ditty == 0)
goto BadLoad; goto BadLoad;
}
if (RawPtr->ship_sounds if (RawPtr->ship_sounds != 0)
&& (RawPtr->ship_sounds = {
CaptureSound (LoadSound ( RawPtr->ship_sounds = CaptureSound (
(RESOURCE)RawPtr->ship_sounds LoadSound ((RESOURCE)RawPtr->ship_sounds));
))) == 0) if (RawPtr->ship_sounds == 0)
goto BadLoad; goto BadLoad;
}
if (StarShipPtr->RaceDescPtr->ship_info.icons) if (StarShipPtr->RaceDescPtr->ship_info.icons)
StarShipPtr->silhouette = IncFrameIndex ( StarShipPtr->silhouette = IncFrameIndex (
StarShipPtr->RaceDescPtr->ship_info.icons StarShipPtr->RaceDescPtr->ship_info.icons);
);
} }
retval = TRUE; retval = TRUE;
@@ -146,31 +148,29 @@ BadLoad:
void void
free_ship (STARSHIPPTR StarShipPtr, BOOLEAN FreeBattleData) free_ship (STARSHIPPTR StarShipPtr, BOOLEAN FreeBattleData)
{ {
RACE_DESCPTR raceDescPtr = StarShipPtr->RaceDescPtr;
SHIP_INFO *shipInfo = &raceDescPtr->ship_info;
if (FreeBattleData) if (FreeBattleData)
{ {
free_image (StarShipPtr->RaceDescPtr->ship_data.special); DATA_STUFF *shipData = &raceDescPtr->ship_data;
free_image (StarShipPtr->RaceDescPtr->ship_data.weapon);
free_image (StarShipPtr->RaceDescPtr->ship_data.ship);
DestroyDrawable (ReleaseDrawable ( free_image (shipData->special);
StarShipPtr->RaceDescPtr->ship_data.captain_control.background)); free_image (shipData->weapon);
free_image (shipData->ship);
DestroyMusic ((MUSIC_REF)StarShipPtr->RaceDescPtr->ship_data.victory_ditty); DestroyDrawable (
ReleaseDrawable (shipData->captain_control.background));
DestroySound (ReleaseSound ( DestroyMusic ((MUSIC_REF)shipData->victory_ditty);
StarShipPtr->RaceDescPtr->ship_data.ship_sounds)); DestroySound (ReleaseSound (shipData->ship_sounds));
} }
DestroyDrawable (ReleaseDrawable ( DestroyDrawable (ReleaseDrawable (shipInfo->melee_icon));
StarShipPtr->RaceDescPtr->ship_info.melee_icon)); DestroyDrawable (ReleaseDrawable (shipInfo->icons));
DestroyStringTable (ReleaseStringTable (shipInfo->race_strings));
DestroyDrawable (ReleaseDrawable ( DestroyCodeRes (ReleaseCodeRes (raceDescPtr->CodeRef));
StarShipPtr->RaceDescPtr->ship_info.icons));
DestroyStringTable (ReleaseStringTable (
StarShipPtr->RaceDescPtr->ship_info.race_strings));
DestroyCodeRes (ReleaseCodeRes (StarShipPtr->RaceDescPtr->CodeRef));
StarShipPtr->RaceDescPtr = 0; StarShipPtr->RaceDescPtr = 0;
} }
+4 -1
View File
@@ -818,7 +818,10 @@ PostProcessQueue (VIEW_STATE view_state, SIZE scroll_x,
ElementPtr->state_flags &= ~COLLISION; ElementPtr->state_flags &= ~COLLISION;
if (state_flags & POST_PROCESS) if (state_flags & POST_PROCESS)
delta.x = delta.y = 0; {
delta.x = 0;
delta.y = 0;
}
else else
{ {
delta.x = scroll_x; delta.x = scroll_x;