Sent debug output to stderr. Some cleaning up.

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@68 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
meep-eep
2002-09-22 19:37:46 +00:00
parent 39a726785f
commit 92ca2146ca
37 changed files with 451 additions and 419 deletions
+1 -1
View File
@@ -222,7 +222,7 @@ SetGameClockRate (COUNT seconds_per_day)
{ {
SIZE new_day_in_ticks, new_tick_count; SIZE new_day_in_ticks, new_tick_count;
//if (GLOBAL (GameClock.clock_sem)) printf ("%u\n", GLOBAL (GameClock.clock_sem)); //if (GLOBAL (GameClock.clock_sem)) fprintf (stderr, "%u\n", GLOBAL (GameClock.clock_sem));
SetSemaphore (GLOBAL (GameClock.clock_sem)); SetSemaphore (GLOBAL (GameClock.clock_sem));
new_day_in_ticks = (SIZE)(seconds_per_day * (ONE_SECOND / 5)); new_day_in_ticks = (SIZE)(seconds_per_day * (ONE_SECOND / 5));
if (GLOBAL (GameClock.day_in_ticks) == 0) if (GLOBAL (GameClock.day_in_ticks) == 0)
+11 -11
View File
@@ -56,11 +56,11 @@ collide (ELEMENTPTR ElementPtr0, ELEMENTPTR ElementPtr1)
} }
#ifdef DEBUG #ifdef DEBUG
printf ("Centers: <%d, %d> <%d, %d>\n", fprintf (stderr, "Centers: <%d, %d> <%d, %d>\n",
ElementPtr0->next.location.x, ElementPtr0->next.location.y, ElementPtr0->next.location.x, ElementPtr0->next.location.y,
ElementPtr1->next.location.x, ElementPtr1->next.location.y); ElementPtr1->next.location.x, ElementPtr1->next.location.y);
printf ("RelTravelAngle : %d, ImpactAngles <%d, %d>\n", fprintf (stderr, "RelTravelAngle : %d, ImpactAngles <%d, %d>\n",
RelTravelAngle, ImpactAngle0, ImpactAngle1); RelTravelAngle, ImpactAngle0, ImpactAngle1);
#endif /* DEBUG */ #endif /* DEBUG */
if (ElementPtr0->next.location.x == ElementPtr0->current.location.x if (ElementPtr0->next.location.x == ElementPtr0->current.location.x
@@ -78,8 +78,8 @@ RelTravelAngle, ImpactAngle0, ImpactAngle1);
ElementPtr0->state_flags |= (DEFY_PHYSICS | COLLISION); ElementPtr0->state_flags |= (DEFY_PHYSICS | COLLISION);
ElementPtr1->state_flags |= (DEFY_PHYSICS | COLLISION); ElementPtr1->state_flags |= (DEFY_PHYSICS | COLLISION);
#ifdef DEBUG #ifdef DEBUG
printf ("No movement before collision -- <(%d, %d) = %d, (%d, %d) = %d>\n", fprintf (stderr, "No movement before collision -- <(%d, %d) = %d, (%d, %d) = %d>\n",
dx0, dy0, ImpactAngle0 - OCTANT, dx1, dy1, ImpactAngle1 - OCTANT); dx0, dy0, ImpactAngle0 - OCTANT, dx1, dy1, ImpactAngle1 - OCTANT);
#endif /* DEBUG */ #endif /* DEBUG */
} }
@@ -165,10 +165,10 @@ dx0, dy0, ImpactAngle0 - OCTANT, dx1, dy1, ImpactAngle1 - OCTANT);
WORLD_TO_VELOCITY (SCALED_ONE) - 1)); WORLD_TO_VELOCITY (SCALED_ONE) - 1));
} }
#ifdef DEBUG #ifdef DEBUG
GetCurrentVelocityComponents (&ElementPtr0->velocity, &dx0, &dy0); GetCurrentVelocityComponents (&ElementPtr0->velocity, &dx0, &dy0);
GetCurrentVelocityComponents (&ElementPtr1->velocity, &dx1, &dy1); GetCurrentVelocityComponents (&ElementPtr1->velocity, &dx1, &dy1);
printf ("After: <%d, %d> <%d, %d>\n\n", fprintf (stderr, "After: <%d, %d> <%d, %d>\n\n",
dx0, dy0, dx1, dy1); dx0, dy0, dx1, dy1);
#endif /* DEBUG */ #endif /* DEBUG */
} }
} }
+3 -3
View File
@@ -378,9 +378,9 @@ ZoqFotIntro (RESPONSE_REF R)
DISABLE_PHRASE (what_look_like); DISABLE_PHRASE (what_look_like);
} }
// printf ("yr = 0x%x wf = 0x%x\n", alien_text[your_race][0], alien_text[where_from][0]); // fprintf (stderr, "yr = 0x%x wf = 0x%x\n", alien_text[your_race][0], alien_text[where_from][0]);
// printf ("we = 0x%x tl = 0x%x\n", alien_text[what_emergency][0], alien_text[tough_luck][0]); // fprintf (stderr, "we = 0x%x tl = 0x%x\n", alien_text[what_emergency][0], alien_text[tough_luck][0]);
// printf ("wll = 0x%x\n", what_look_like); // fprintf (stderr, "wll = 0x%x\n", what_look_like);
if (PHRASE_ENABLED (your_race) if (PHRASE_ENABLED (your_race)
|| PHRASE_ENABLED (where_from) || PHRASE_ENABLED (where_from)
|| PHRASE_ENABLED (what_emergency)) || PHRASE_ENABLED (what_emergency))
+10 -12
View File
@@ -289,7 +289,7 @@ InitCyborg (STARSHIPPTR StarShipPtr)
COUNT Index, Divisor; COUNT Index, Divisor;
#ifdef DEBUG #ifdef DEBUG
//turn_counter[which_ship] = 0; //turn_counter[which_ship] = 0;
#endif /* DEBUG */ #endif /* DEBUG */
Index = StarShipPtr->RaceDescPtr->characteristics.max_thrust Index = StarShipPtr->RaceDescPtr->characteristics.max_thrust
@@ -300,21 +300,19 @@ InitCyborg (STARSHIPPTR StarShipPtr)
else else
Index >>= 1; Index >>= 1;
#ifdef PRINT_MI #ifdef PRINT_MI
{ {
char buf[40]; char buf[40];
GetStringContents (StarShipPtr->RaceDescPtr->ship_data.race_strings, buf, FALSE); GetStringContents (StarShipPtr->RaceDescPtr->ship_data.race_strings, buf, FALSE);
printf ("MI(%s) -- <%u:%u> = %u\n", fprintf (stderr, "MI(%s) -- <%u:%u> = %u\n", buf,
buf, StarShipPtr->RaceDescPtr->characteristics.max_thrust *
StarShipPtr->RaceDescPtr->characteristics.max_thrust * StarShipPtr->RaceDescPtr->characteristics.thrust_increment,
StarShipPtr->RaceDescPtr->characteristics.thrust_increment, Divisor, Index);
Divisor, }
Index);
}
#endif /* PRINT_MI */ #endif /* PRINT_MI */
StarShipPtr->RaceDescPtr->cyborg_control.ManeuverabilityIndex = Index; StarShipPtr->RaceDescPtr->cyborg_control.ManeuverabilityIndex = Index;
#ifdef DEBUG #ifdef DEBUG
//turn_counter[which_ship] = 0; //turn_counter[which_ship] = 0;
#endif /* DEBUG */ #endif /* DEBUG */
} }
+3 -3
View File
@@ -28,7 +28,7 @@ InitQueue (PQUEUE pq, COUNT num_elements, OBJ_SIZE size)
return (TRUE); return (TRUE);
#else /* QUEUE_TABLE */ #else /* QUEUE_TABLE */
SetFreeList (pq, NULL_HANDLE); SetFreeList (pq, NULL_HANDLE);
// printf ("num_elements = %d (%d)\n", num_elements, (BYTE)num_elements); // fprintf (stderr, "num_elements = %d (%d)\n", num_elements, (BYTE)num_elements);
if (AllocQueueTab (pq, num_elements) && LockQueueTab (pq)) if (AllocQueueTab (pq, num_elements) && LockQueueTab (pq))
{ {
do do
@@ -105,8 +105,8 @@ AllocLink (PQUEUE pq)
UnlockLink (pq, hLink); UnlockLink (pq, hLink);
} }
/* /*
else else
printf ("No more elements\n"); fprintf (stderr, "No more elements\n");
*/ */
return (hLink); return (hLink);
} }
+1 -1
View File
@@ -228,7 +228,7 @@ InitGalaxy (void)
PPOINT ppt; PPOINT ppt;
PRIM_LINKS Links; PRIM_LINKS Links;
// printf ("transition_width = %d transition_height = %d\n", TRANSITION_WIDTH, TRANSITION_HEIGHT); // fprintf (stderr, "transition_width = %d transition_height = %d\n", TRANSITION_WIDTH, TRANSITION_HEIGHT);
Links = MakeLinks (END_OF_LIST, END_OF_LIST); Links = MakeLinks (END_OF_LIST, END_OF_LIST);
factor = ONE_SHIFT + MAX_REDUCTION + (BACKGROUND_SHIFT - 3); factor = ONE_SHIFT + MAX_REDUCTION + (BACKGROUND_SHIFT - 3);
+12 -12
View File
@@ -57,25 +57,25 @@ CalculateGravity (PELEMENT ElementPtr)
- TestElementPtr->next.location.y; - TestElementPtr->next.location.y;
} }
#if 0 //def DEBUG #if 0 //def DEBUG
if (TestElementPtr->state_flags & PLAYER_SHIP) if (TestElementPtr->state_flags & PLAYER_SHIP)
{ {
printf ("CalculateGravity:\n"); fprintf (stderr, "CalculateGravity:\n");
printf ("\tdx = %d, dy = %d\n", dx, dy); fprintf (stderr, "\tdx = %d, dy = %d\n", dx, dy);
} }
#endif /* DEBUG */ #endif /* DEBUG */
dx = WRAP_DELTA_X (dx); dx = WRAP_DELTA_X (dx);
dy = WRAP_DELTA_Y (dy); dy = WRAP_DELTA_Y (dy);
#if 0 //def DEBUG #if 0 //def DEBUG
if (TestElementPtr->state_flags & PLAYER_SHIP) if (TestElementPtr->state_flags & PLAYER_SHIP)
printf ("\twrap_dx = %d, wrap_dy = %d\n", dx, dy); fprintf (stderr, "\twrap_dx = %d, wrap_dy = %d\n", dx, dy);
#endif /* DEBUG */ #endif /* DEBUG */
abs_dx = dx >= 0 ? dx : -dx; abs_dx = dx >= 0 ? dx : -dx;
abs_dy = dy >= 0 ? dy : -dy; abs_dy = dy >= 0 ? dy : -dy;
abs_dx = WORLD_TO_DISPLAY (abs_dx); abs_dx = WORLD_TO_DISPLAY (abs_dx);
abs_dy = WORLD_TO_DISPLAY (abs_dy); abs_dy = WORLD_TO_DISPLAY (abs_dy);
#if 0 //def DEBUG #if 0 //def DEBUG
if (TestElementPtr->state_flags & PLAYER_SHIP) if (TestElementPtr->state_flags & PLAYER_SHIP)
printf ("\tdisplay_dx = %d, display_dy = %d\n", abs_dx, abs_dy); fprintf (stderr, "\tdisplay_dx = %d, display_dy = %d\n", abs_dx, abs_dy);
#endif /* DEBUG */ #endif /* DEBUG */
if (abs_dx <= GRAVITY_THRESHOLD if (abs_dx <= GRAVITY_THRESHOLD
&& abs_dy <= GRAVITY_THRESHOLD) && abs_dy <= GRAVITY_THRESHOLD)
@@ -101,12 +101,12 @@ printf ("\tdisplay_dx = %d, display_dy = %d\n", abs_dx, abs_dy);
#define MAX_MAGNITUDE 6 #define MAX_MAGNITUDE 6
else if (magnitude > MAX_MAGNITUDE) else if (magnitude > MAX_MAGNITUDE)
magnitude = MAX_MAGNITUDE; magnitude = MAX_MAGNITUDE;
printf ("magnitude = %u ", magnitude); fprintf (stderr, "magnitude = %u ", magnitude);
#endif /* NEVER */ #endif /* NEVER */
#if 0 //def DEBUG #if 0 //def DEBUG
if (TestElementPtr->state_flags & PLAYER_SHIP) if (TestElementPtr->state_flags & PLAYER_SHIP)
printf ("dist_squared = %lu\n", dist_squared); fprintf (stderr, "dist_squared = %lu\n", dist_squared);
#endif /* DEBUG */ #endif /* DEBUG */
if (TestHasGravity) if (TestHasGravity)
{ {
+36 -35
View File
@@ -290,8 +290,8 @@ FlushGroupInfo (GROUP_HEADER *pGH, DWORD offset, BYTE which_group, PVOID
SeekResFile (fp, offset, SEEK_SET); SeekResFile (fp, offset, SEEK_SET);
WriteResFile (pGH, sizeof (*pGH), 1, fp); WriteResFile (pGH, sizeof (*pGH), 1, fp);
#ifdef DEBUG #ifdef DEBUG
printf ("1)FlushGroupInfo(%lu): WG = %u(%lu), NG = %u, SI = %u\n", fprintf (stderr, "1)FlushGroupInfo(%lu): WG = %u(%lu), NG = %u, SI = %u\n",
offset, which_group, pGH->GroupOffset[which_group], pGH->NumGroups, pGH->star_index); offset, which_group, pGH->GroupOffset[which_group], pGH->NumGroups, pGH->star_index);
#endif /* DEBUG */ #endif /* DEBUG */
NumShips = (BYTE)CountLinks (&GLOBAL (npc_built_ship_q)); NumShips = (BYTE)CountLinks (&GLOBAL (npc_built_ship_q));
@@ -322,14 +322,14 @@ offset, which_group, pGH->GroupOffset[which_group], pGH->NumGroups, pGH->star_in
WriteResFile ((PBYTE)&RaceType, sizeof (RaceType), 1, fp); WriteResFile ((PBYTE)&RaceType, sizeof (RaceType), 1, fp);
#ifdef DEBUG #ifdef DEBUG
if (which_group == 0) if (which_group == 0)
printf ("F) type %u, loc %u<%d, %d>, task 0x%02x:%u\n", fprintf (stderr, "F) type %u, loc %u<%d, %d>, task 0x%02x:%u\n",
RaceType, RaceType,
GET_GROUP_LOC (FragPtr), GET_GROUP_LOC (FragPtr),
FragPtr->ShipInfo.loc.x, FragPtr->ShipInfo.loc.x,
FragPtr->ShipInfo.loc.y, FragPtr->ShipInfo.loc.y,
GET_GROUP_MISSION (FragPtr), GET_GROUP_MISSION (FragPtr),
GET_GROUP_DEST (FragPtr)); GET_GROUP_DEST (FragPtr));
#endif /* DEBUG */ #endif /* DEBUG */
Ptr = (PBYTE)&FragPtr->RaceDescPtr; Ptr = (PBYTE)&FragPtr->RaceDescPtr;
WriteResFile ((PBYTE)Ptr, WriteResFile ((PBYTE)Ptr,
@@ -361,7 +361,7 @@ GetGroupInfo (DWORD offset, BYTE which_group)
SeekResFile (fp, offset, SEEK_SET); SeekResFile (fp, offset, SEEK_SET);
ReadResFile (&GH, sizeof (GH), 1, fp); ReadResFile (&GH, sizeof (GH), 1, fp);
#ifdef DEBUG #ifdef DEBUG
printf ("GetGroupInfo(%lu): %u(%lu) out of %u\n", offset, which_group, GH.GroupOffset[which_group], GH.NumGroups); fprintf (stderr, "GetGroupInfo(%lu): %u(%lu) out of %u\n", offset, which_group, GH.GroupOffset[which_group], GH.NumGroups);
#endif /* DEBUG */ #endif /* DEBUG */
if (which_group == (BYTE)~0) if (which_group == (BYTE)~0)
{ {
@@ -369,7 +369,7 @@ printf ("GetGroupInfo(%lu): %u(%lu) out of %u\n", offset, which_group, GH.GroupO
ReinitQueue (&GLOBAL (npc_built_ship_q)); ReinitQueue (&GLOBAL (npc_built_ship_q));
#ifdef DEBUG #ifdef DEBUG
printf ("%u == %u\n", GH.star_index, (COUNT)(CurStarDescPtr - star_array)); fprintf (stderr, "%u == %u\n", GH.star_index, (COUNT)(CurStarDescPtr - star_array));
#endif /* DEBUG */ #endif /* DEBUG */
day_index = GH.day_index; day_index = GH.day_index;
month_index = GH.month_index; month_index = GH.month_index;
@@ -382,9 +382,9 @@ printf ("%u == %u\n", GH.star_index, (COUNT)(CurStarDescPtr - star_array));
CloseResFile (fp); CloseResFile (fp);
#ifdef DEBUG #ifdef DEBUG
if (GH.star_index == (COUNT)(CurStarDescPtr - star_array)) if (GH.star_index == (COUNT)(CurStarDescPtr - star_array))
printf ("GetGroupInfo: battle groups out of date %u/%u/%u!\n", fprintf (stderr, "GetGroupInfo: battle groups out of date %u/%u/%u!\n",
month_index, day_index, year_index); month_index, day_index, year_index);
#endif /* DEBUG */ #endif /* DEBUG */
fp = OpenResFile (RANDGRPINFO_FILE, "wb"); fp = OpenResFile (RANDGRPINFO_FILE, "wb");
GH.NumGroups = 0; GH.NumGroups = 0;
@@ -471,15 +471,16 @@ month_index, day_index, year_index);
SET_GROUP_LOC (FragPtr, group_loc); SET_GROUP_LOC (FragPtr, group_loc);
#ifdef DEBUG #ifdef DEBUG
printf ("battle group %u(0x%04x) strength %u, type %u, loc %u<%d, %d>, task %u\n", fprintf (stderr, "battle group %u(0x%04x) strength %u, "
which_group, "type %u, loc %u<%d, %d>, task %u\n",
hStarShip, which_group,
NumShips, hStarShip,
RaceType, NumShips,
group_loc, RaceType,
FragPtr->ShipInfo.loc.x, group_loc,
FragPtr->ShipInfo.loc.y, FragPtr->ShipInfo.loc.x,
task); FragPtr->ShipInfo.loc.y,
task);
#endif /* DEBUG */ #endif /* DEBUG */
UnlockStarShip ( UnlockStarShip (
&GLOBAL (npc_built_ship_q), hStarShip &GLOBAL (npc_built_ship_q), hStarShip
@@ -551,21 +552,21 @@ task);
1, fp); 1, fp);
#ifdef DEBUG #ifdef DEBUG
if (which_group == 0) if (which_group == 0)
printf ("G) type %u, loc %u<%d, %d>, task 0x%02x:%u\n", fprintf (stderr, "G) type %u, loc %u<%d, %d>, task 0x%02x:%u\n",
RaceType, RaceType,
GET_GROUP_LOC (FragPtr), GET_GROUP_LOC (FragPtr),
FragPtr->ShipInfo.loc.x, FragPtr->ShipInfo.loc.x,
FragPtr->ShipInfo.loc.y, FragPtr->ShipInfo.loc.y,
GET_GROUP_MISSION (FragPtr), GET_GROUP_MISSION (FragPtr),
GET_GROUP_DEST (FragPtr)); GET_GROUP_DEST (FragPtr));
#endif /* DEBUG */ #endif /* DEBUG */
if (GET_GROUP_ID (FragPtr) != BaseGroup if (GET_GROUP_ID (FragPtr) != BaseGroup
|| which_group || which_group
|| ShipsLeft) || ShipsLeft)
{ {
#ifdef DEBUG #ifdef DEBUG
printf ("\n"); fprintf (stderr, "\n");
#endif /* DEBUG */ #endif /* DEBUG */
if (RaceType == SHOFIXTI_SHIP if (RaceType == SHOFIXTI_SHIP
&& which_group && which_group
@@ -588,7 +589,7 @@ printf ("\n");
else else
{ {
#ifdef DEBUG #ifdef DEBUG
printf (" -- REMOVING\n"); fprintf (stderr, " -- REMOVING\n");
#endif /* DEBUG */ #endif /* DEBUG */
UnlockStarShip ( UnlockStarShip (
&GLOBAL (npc_built_ship_q), hStarShip &GLOBAL (npc_built_ship_q), hStarShip
@@ -659,7 +660,7 @@ PutGroupInfo (DWORD offset, BYTE which_group)
} }
GH.star_index = CurStarDescPtr - star_array; GH.star_index = CurStarDescPtr - star_array;
#ifdef DEBUG #ifdef DEBUG
printf ("PutGroupInfo(%lu): %u out of %u -- %u/%u/%u\n", fprintf (stderr, "PutGroupInfo(%lu): %u out of %u -- %u/%u/%u\n",
offset, which_group, GH.NumGroups, offset, which_group, GH.NumGroups,
GH.month_index, GH.day_index, GH.year_index); GH.month_index, GH.day_index, GH.year_index);
#endif /* DEBUG */ #endif /* DEBUG */
+1 -1
View File
@@ -230,7 +230,7 @@ percent = 0;
GetStringContents (SetAbsStringTableIndex ( GetStringContents (SetAbsStringTableIndex (
TemplatePtr->ShipInfo.race_strings, 1 TemplatePtr->ShipInfo.race_strings, 1
), (STRINGPTR)buf, FALSE); ), (STRINGPTR)buf, FALSE);
// printf ("%s encounter\n", buf); // fprintf (stderr, "%s encounter\n", buf);
#endif /* DEBUG */ #endif /* DEBUG */
hEncounter = AllocEncounter (); hEncounter = AllocEncounter ();
if (hEncounter) if (hEncounter)
+2 -2
View File
@@ -36,9 +36,9 @@ PBYTE _Stream;
UWORD _workbuf; UWORD _workbuf;
BYTE _workbuflen; BYTE _workbuflen;
/* get one bit */
static SWORD static SWORD
GetBit (/* get one bit */ GetBit (void)
void)
{ {
SWORD i; SWORD i;
+3 -3
View File
@@ -58,7 +58,7 @@ int TFB_GetColorMapType ()
void TFB_ReleaseColorMap () void TFB_ReleaseColorMap ()
{ {
//printf("TFB_ReleaseColorMap()\n"); //fprintf (stderr, "TFB_ReleaseColorMap()\n");
has_colormap = FALSE; has_colormap = FALSE;
} }
@@ -168,7 +168,7 @@ SetColorMap (COLORMAPPTR map, int type)
TFB_ColorMapToRGB (vp); TFB_ColorMapToRGB (vp);
has_colormap = TRUE; has_colormap = TRUE;
//printf("SetColorMap(): vp %x map %x bytes %d, start %d end %d\n",vp, map, bytes, start, end); //fprintf (stderr, "SetColorMap(): vp %x map %x bytes %d, start %d end %d\n",vp, map, bytes, start, end);
return TRUE; return TRUE;
} }
@@ -198,7 +198,7 @@ int xform_clut_task (void *data)
TDelta = TTotal; TDelta = TTotal;
cur += (end - cur) * TDelta / TTotal; cur += (end - cur) * TDelta / TTotal;
//printf("xform_clut_task cur %d\n", cur); //fprintf (stderr, "xform_clut_task cur %d\n", cur);
} while (TTotal -= TDelta && (!Task_ReadState (task, TASK_EXIT))); } while (TTotal -= TDelta && (!Task_ReadState (task, TASK_EXIT)));
} }
+7 -7
View File
@@ -332,12 +332,12 @@ DrawablesIntersect (PINTERSECT_CONTROL pControl0,
++time_x_1; ++time_x_1;
#ifdef DEBUG #ifdef DEBUG
printf ("FramePtr0<%d, %d> --> <%d, %d>\nFramePtr1<%d, %d> --> <%d, %d>\n", fprintf (stderr, "FramePtr0<%d, %d> --> <%d, %d>\nFramePtr1<%d, %d> --> <%d, %d>\n",
GetFrameWidth (FramePtr0), GetFrameHeight (FramePtr0), GetFrameWidth (FramePtr0), GetFrameHeight (FramePtr0),
r0.corner.x, r0.corner.y, r0.corner.x, r0.corner.y,
GetFrameWidth (FramePtr1), GetFrameHeight (FramePtr1), GetFrameWidth (FramePtr1), GetFrameHeight (FramePtr1),
r1.corner.x, r1.corner.y); r1.corner.x, r1.corner.y);
printf ("time_x(%d, %d)-%d, time_y(%d, %d)-%d\n", time_x_0, time_x_1, dx, time_y_0, time_y_1, dy); fprintf (stderr, "time_x(%d, %d)-%d, time_y(%d, %d)-%d\n", time_x_0, time_x_1, dx, time_y_0, time_y_1, dy);
#endif /* DEBUG */ #endif /* DEBUG */
if (dx == 0) if (dx == 0)
{ {
@@ -380,7 +380,7 @@ printf ("time_x(%d, %d)-%d, time_y(%d, %d)-%d\n", time_x_0, time_x_1, dx, time_y
} }
#ifdef DEBUG #ifdef DEBUG
printf ("start_time = %d, end_time = %d\n", time_y_0, time_y_1); fprintf (stderr, "start_time = %d, end_time = %d\n", time_y_0, time_y_1);
#endif /* DEBUG */ #endif /* DEBUG */
if (time_y_0 <= time_y_1 if (time_y_0 <= time_y_1
&& (intersect_time = frame_intersect ( && (intersect_time = frame_intersect (
+5 -5
View File
@@ -33,7 +33,7 @@ blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr)
SrcFramePtr = (PFRAME_DESC)PrimPtr->Object.Stamp.frame; SrcFramePtr = (PFRAME_DESC)PrimPtr->Object.Stamp.frame;
if (SrcFramePtr->DataOffs == 0) if (SrcFramePtr->DataOffs == 0)
{ {
printf ("Non-existent image to blt()\n"); fprintf (stderr, "Non-existent image to blt()\n");
return; return;
} }
@@ -97,7 +97,7 @@ blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr)
} }
else else
{ {
printf("blt(): TFB_DisplayFormatAlpha failed\n"); fprintf (stderr, "blt(): TFB_DisplayFormatAlpha failed\n");
img->ScaledImg = new_surf; img->ScaledImg = new_surf;
} }
} }
@@ -114,7 +114,7 @@ blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr)
} }
else else
{ {
printf("blt(): zoomSurface failed\n"); fprintf (stderr, "blt(): zoomSurface failed\n");
} }
} }
} }
@@ -262,7 +262,7 @@ fillrect_blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr)
static void static void
cmap_blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr) cmap_blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr)
{ {
printf ("Unimplemented function activated: cmap_blt()\n"); fprintf (stderr, "Unimplemented function activated: cmap_blt()\n");
} }
static void static void
@@ -313,7 +313,7 @@ read_screen (PRECT lpRect, FRAMEPTR DstFramePtr)
->FlagsAndIndex) ->FlagsAndIndex)
& ((DWORD) MAPPED_TO_DISPLAY << FTYPE_SHIFT))) & ((DWORD) MAPPED_TO_DISPLAY << FTYPE_SHIFT)))
{ {
printf("Unimplemented function activated: read_screen()\n"); fprintf (stderr, "Unimplemented function activated: read_screen()\n");
} }
else else
{ {
+10 -10
View File
@@ -91,14 +91,14 @@ void
SetGraphicStrength (int numerator, int denominator) SetGraphicStrength (int numerator, int denominator)
// I just hope numerator always = denominator... // I just hope numerator always = denominator...
{ {
//printf("Unimplemented function activated: SetGraphicsStrength(), %d %d\n",numerator,denominator); //fprintf (stderr, "Unimplemented function activated: SetGraphicsStrength(), %d %d\n",numerator,denominator);
} }
//Status: Unimplemented //Status: Unimplemented
void void
ScreenTransition (int TransType, PRECT pRect) //TransType==3 ScreenTransition (int TransType, PRECT pRect) //TransType==3
{ {
//printf ("Unimplemented function activated: ScreenTransition()\n"); //fprintf (stderr, "Unimplemented function activated: ScreenTransition()\n");
} }
void void
@@ -139,7 +139,7 @@ LoadIntoExtraScreen (PRECT r)
r = &locRect; r = &locRect;
} }
// printf ("LoadIntoExtraScreen (%d, %d, {%d, %d})\n", r->corner.x, r->corner.y, r->extent.width, r->extent.height); // fprintf (stderr, "LoadIntoExtraScreen (%d, %d, {%d, %d})\n", r->corner.x, r->corner.y, r->extent.width, r->extent.height);
// DC = HMalloc (sizeof (TFB_DrawCommand)); // DC = HMalloc (sizeof (TFB_DrawCommand));
DC.Type = TFB_DRAWCOMMANDTYPE_COPYBACKBUFFERTOOTHERBUFFER; DC.Type = TFB_DRAWCOMMANDTYPE_COPYBACKBUFFERTOOTHERBUFFER;
@@ -158,7 +158,7 @@ InitVideo (BOOLEAN useCDROM) //useCDROM doesn't really apply to us...
{ {
BOOLEAN ret; BOOLEAN ret;
// printf("Unimplemented function activated: InitVideo()\n"); // fprintf (stderr, "Unimplemented function activated: InitVideo()\n");
ret = TRUE; ret = TRUE;
return (ret); return (ret);
} }
@@ -167,14 +167,14 @@ InitVideo (BOOLEAN useCDROM) //useCDROM doesn't really apply to us...
void void
UninitVideo () //empty UninitVideo () //empty
{ {
// printf("Unimplemented function activated: UninitVideo()\n"); // fprintf (stderr, "Unimplemented function activated: UninitVideo()\n");
} }
//Status: Unimplemented //Status: Unimplemented
void void
VidStop() // At least this one makes sense. VidStop() // At least this one makes sense.
{ {
// printf ("Unimplemented function activated: VidStop()\n"); // fprintf (stderr, "Unimplemented function activated: VidStop()\n");
} }
//Status: Unimplemented //Status: Unimplemented
@@ -183,7 +183,7 @@ VidPlaying() // Easy enough.
{ {
MEM_HANDLE ret; MEM_HANDLE ret;
//printf("Unimplemented function activated: VidPlaying()\n"); //fprintf (stderr, "Unimplemented function activated: VidPlaying()\n");
ret = 0; ret = 0;
return (ret); return (ret);
} }
@@ -196,7 +196,7 @@ VidPlay (VIDEO_REF VidRef, char *loopname, BOOLEAN uninit)
VIDEO_TYPE ret; VIDEO_TYPE ret;
ret = 0; ret = 0;
// printf("Unimplemented function activated: VidPlay()\n"); // fprintf (stderr, "Unimplemented function activated: VidPlay()\n");
return (ret); return (ret);
} }
@@ -205,7 +205,7 @@ _init_video_file(PVOID pStr)
{ {
VIDEO_REF ret; VIDEO_REF ret;
printf ("Unimplemented function activated: _init_video_file()\n"); fprintf (stderr, "Unimplemented function activated: _init_video_file()\n");
ret = 0; ret = 0;
return (ret); return (ret);
} }
@@ -217,7 +217,7 @@ _image_intersect (PIMAGE_BOX box1, PIMAGE_BOX box2, PRECT rect)
{ {
BOOLEAN ret; BOOLEAN ret;
// printf ("Unimplemented function activated: _image_intersect()\n"); // fprintf (stderr, "Unimplemented function activated: _image_intersect()\n");
ret = TRUE; ret = TRUE;
return (ret); return (ret);
} }
@@ -208,12 +208,10 @@ process_image (FRAMEPTR FramePtr, SDL_Surface *img[], int cel_ct, BOOLEAN is_fon
SetFrameBounds (FramePtr, img[cel_ct]->clip_rect.w, img[cel_ct]->clip_rect.h); SetFrameBounds (FramePtr, img[cel_ct]->clip_rect.w, img[cel_ct]->clip_rect.h);
#if 0 #if 0
printf ("\thot[%d, %d], rect[%d, %d, %d, %d]\n", fprintf (stderr, "\thot[%d, %d], rect[%d, %d, %d, %d]\n",
hx, hy, hx, hy,
img[cel_ct]->clip_rect.x, img[cel_ct]->clip_rect.x, img[cel_ct]->clip_rect.y,
img[cel_ct]->clip_rect.y, img[cel_ct]->clip_rect.w, img[cel_ct]->clip_rect.h);
img[cel_ct]->clip_rect.w,
img[cel_ct]->clip_rect.h);
#endif #endif
} }
@@ -257,7 +255,7 @@ _GetCelData (FILE *fp, DWORD length)
{ {
/*char fnamestr[1000]; /*char fnamestr[1000];
sscanf(CurrentLine, "%s", fnamestr); sscanf(CurrentLine, "%s", fnamestr);
printf("imgload %s\n",fnamestr);*/ fprintf (stderr, "imgload %s\n",fnamestr);*/
if if
( (
@@ -269,7 +267,7 @@ _GetCelData (FILE *fp, DWORD length)
) )
++cel_ct; ++cel_ct;
else if (img[cel_ct]) else if (img[cel_ct])
printf("_GetCelData: Bad file!\n"), fprintf (stderr, "_GetCelData: Bad file!\n"),
SDL_FreeSurface (img[cel_ct]); SDL_FreeSurface (img[cel_ct]);
@@ -311,8 +309,9 @@ printf("_GetCelData: Bad file!\n"),
} }
} }
if (Drawable == 0) if (Drawable == 0)
printf ("Couldn't get cel data for '%s'\n", _cur_resfile_name); fprintf (stderr, "Couldn't get cel data for '%s'\n",
_cur_resfile_name);
return (GetDrawableHandle (Drawable)); return (GetDrawableHandle (Drawable));
} }
+5 -5
View File
@@ -51,7 +51,7 @@ Lock_DCQ (void)
DCQ_locking_thread = current_thread; DCQ_locking_thread = current_thread;
} }
++DCQ_locking_depth; ++DCQ_locking_depth;
// printf("DCQ_sem locking depth: %i\n", DCQ_locking_depth); // fprintf (stderr, "DCQ_sem locking depth: %i\n", DCQ_locking_depth);
} }
void void
@@ -60,12 +60,12 @@ Unlock_DCQ (void)
Uint32 current_thread = SDL_ThreadID (); Uint32 current_thread = SDL_ThreadID ();
if (DCQ_locking_thread != current_thread) if (DCQ_locking_thread != current_thread)
{ {
printf("%8x attempted to unlock the DCQ when it didn't hold it!\n", current_thread); fprintf (stderr, "%8x attempted to unlock the DCQ when it didn't hold it!\n", current_thread);
} }
else else
{ {
--DCQ_locking_depth; --DCQ_locking_depth;
// printf("DCQ_sem locking depth: %i\n", DCQ_locking_depth); // fprintf (stderr, "DCQ_sem locking depth: %i\n", DCQ_locking_depth);
if (!DCQ_locking_depth) if (!DCQ_locking_depth)
{ {
DCQ_locking_thread = 0; DCQ_locking_thread = 0;
@@ -162,7 +162,7 @@ TFB_DrawCommandQueue_Push (TFB_DrawCommandQueue* myQueue,
} }
else else
{ {
printf("DCQ overload. Adjust your livelock deterrence constants!\n"); fprintf (stderr, "DCQ overload. Adjust your livelock deterrence constants!\n");
} }
Unlock_DCQ (); Unlock_DCQ ();
@@ -181,7 +181,7 @@ TFB_DrawCommandQueue_Pop (TFB_DrawCommandQueue *myQueue, TFB_DrawCommand *target
if (myQueue->Front == myQueue->Back && myQueue->Size != DCQ_MAX) if (myQueue->Front == myQueue->Back && myQueue->Size != DCQ_MAX)
{ {
printf("Augh! Assertion failure in DCQ! Front == Back, Size != DCQ_MAX\n"); fprintf (stderr, "Augh! Assertion failure in DCQ! Front == Back, Size != DCQ_MAX\n");
myQueue->Size = 0; myQueue->Size = 0;
Unlock_DCQ (); Unlock_DCQ ();
return (0); return (0);
+14 -14
View File
@@ -35,20 +35,20 @@ TFB_GL_InitGraphics (int driver, int flags, int width, int height, int bpp)
GraphicsDriver = driver; GraphicsDriver = driver;
printf("Initializing SDL (OpenGL).\n"); fprintf (stderr, "Initializing SDL (OpenGL).\n");
if ((SDL_Init (SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) == -1)) if ((SDL_Init (SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) == -1))
{ {
printf("Could not initialize SDL: %s.\n", SDL_GetError()); fprintf (stderr, "Could not initialize SDL: %s.\n", SDL_GetError());
exit(-1); exit(-1);
} }
SDL_VideoDriverName (VideoName, sizeof (VideoName)); SDL_VideoDriverName (VideoName, sizeof (VideoName));
printf("SDL driver used: %s\n", VideoName); fprintf (stderr, "SDL driver used: %s\n", VideoName);
atexit (SDL_Quit); atexit (SDL_Quit);
printf ("SDL initialized.\n"); fprintf (stderr, "SDL initialized.\n");
printf ("Initializing Screen.\n"); fprintf (stderr, "Initializing Screen.\n");
ScreenWidth = 320; ScreenWidth = 320;
ScreenHeight = 240; ScreenHeight = 240;
@@ -57,7 +57,7 @@ TFB_GL_InitGraphics (int driver, int flags, int width, int height, int bpp)
switch(bpp) { switch(bpp) {
case 8: case 8:
printf("bpp of 8 not supported under OpenGL\n"); fprintf (stderr, "bpp of 8 not supported under OpenGL\n");
exit(-1); exit(-1);
case 15: case 15:
@@ -97,19 +97,19 @@ TFB_GL_InitGraphics (int driver, int flags, int width, int height, int bpp)
if (SDL_Video == NULL) if (SDL_Video == NULL)
{ {
printf ("Couldn't set OpenGL %ix%ix%i video mode: %s\n", fprintf (stderr, "Couldn't set OpenGL %ix%ix%i video mode: %s\n",
ScreenWidthActual, ScreenHeightActual, bpp, ScreenWidthActual, ScreenHeightActual, bpp,
SDL_GetError ()); SDL_GetError ());
exit(-1); exit(-1);
} }
else else
{ {
printf ("Set the resolution to: %ix%ix%i\n", fprintf (stderr, "Set the resolution to: %ix%ix%i\n",
SDL_GetVideoSurface()->w, SDL_GetVideoSurface()->h, SDL_GetVideoSurface()->w, SDL_GetVideoSurface()->h,
SDL_GetVideoSurface()->format->BitsPerPixel); SDL_GetVideoSurface()->format->BitsPerPixel);
printf("OpenGL renderer: %s version: %s\n", glGetString(GL_RENDERER), fprintf (stderr, "OpenGL renderer: %s version: %s\n",
glGetString(GL_VERSION)); glGetString(GL_RENDERER), glGetString(GL_VERSION));
} }
SDL_Screen = SDL_CreateRGBSurface(SDL_SWSURFACE, ScreenWidth, ScreenHeight, 32, SDL_Screen = SDL_CreateRGBSurface(SDL_SWSURFACE, ScreenWidth, ScreenHeight, 32,
@@ -117,7 +117,7 @@ TFB_GL_InitGraphics (int driver, int flags, int width, int height, int bpp)
if (SDL_Screen == NULL) if (SDL_Screen == NULL)
{ {
printf("Couldn't create back buffer: %s\n", fprintf (stderr, "Couldn't create back buffer: %s\n",
SDL_GetError()); SDL_GetError());
exit(-1); exit(-1);
} }
@@ -127,7 +127,7 @@ TFB_GL_InitGraphics (int driver, int flags, int width, int height, int bpp)
if (ExtraScreen == NULL) if (ExtraScreen == NULL)
{ {
printf("Couldn't create workspace buffer: %s\n", fprintf (stderr, "Couldn't create workspace buffer: %s\n",
SDL_GetError()); SDL_GetError());
exit(-1); exit(-1);
} }
@@ -137,7 +137,7 @@ TFB_GL_InitGraphics (int driver, int flags, int width, int height, int bpp)
if (format_conv_surf == NULL) if (format_conv_surf == NULL)
{ {
printf("Couldn't create format_conv_surf: %s\n", fprintf (stderr, "Couldn't create format_conv_surf: %s\n",
SDL_GetError()); SDL_GetError());
exit(-1); exit(-1);
} }
@@ -257,7 +257,7 @@ TFB_GL_SwapBuffers ()
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
glEnable(GL_BLEND); glEnable(GL_BLEND);
//printf("fade_amount %d c %f\n",fade_amount, c); //fprintf (stderr, "fade_amount %d c %f\n",fade_amount, c);
TFB_GL_DrawQuad (); TFB_GL_DrawQuad ();
} }
+10 -10
View File
@@ -34,25 +34,25 @@ TFB_Pure_InitGraphics (int driver, int flags, int width, int height, int bpp)
GraphicsDriver = driver; GraphicsDriver = driver;
printf("Initializing SDL (pure).\n"); fprintf (stderr, "Initializing SDL (pure).\n");
if ((SDL_Init (SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) == -1)) if ((SDL_Init (SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) == -1))
{ {
printf("Could not initialize SDL: %s.\n", SDL_GetError()); fprintf (stderr, "Could not initialize SDL: %s.\n", SDL_GetError());
exit(-1); exit(-1);
} }
SDL_VideoDriverName (VideoName, sizeof (VideoName)); SDL_VideoDriverName (VideoName, sizeof (VideoName));
printf("SDL driver used: %s\n", VideoName); fprintf (stderr, "SDL driver used: %s\n", VideoName);
// Set the environment variable SDL_VIDEODRIVER to override // Set the environment variable SDL_VIDEODRIVER to override
// For Linux: x11 (default), dga, fbcon, directfb, svgalib, // For Linux: x11 (default), dga, fbcon, directfb, svgalib,
// ggi, aalib // ggi, aalib
// For Windows: directx (default), windib // For Windows: directx (default), windib
atexit (SDL_Quit); atexit (SDL_Quit);
printf ("SDL initialized.\n"); fprintf (stderr, "SDL initialized.\n");
printf ("Initializing Screen.\n"); fprintf (stderr, "Initializing Screen.\n");
ScreenWidth = 320; ScreenWidth = 320;
ScreenHeight = 240; ScreenHeight = 240;
@@ -71,7 +71,7 @@ TFB_Pure_InitGraphics (int driver, int flags, int width, int height, int bpp)
ScreenHeightActual = 480; ScreenHeightActual = 480;
if (width != 640 || height != 480) if (width != 640 || height != 480)
printf("Screen resolution of %dx%d not supported under pure SDL, using 640x480\n", width, height); fprintf (stderr, "Screen resolution of %dx%d not supported under pure SDL, using 640x480\n", width, height);
} }
videomode_flags |= SDL_ANYFORMAT; videomode_flags |= SDL_ANYFORMAT;
@@ -83,14 +83,14 @@ TFB_Pure_InitGraphics (int driver, int flags, int width, int height, int bpp)
if (SDL_Video == NULL) if (SDL_Video == NULL)
{ {
printf ("Couldn't set %ix%ix%i video mode: %s\n", fprintf (stderr, "Couldn't set %ix%ix%i video mode: %s\n",
ScreenWidthActual, ScreenHeightActual, bpp, ScreenWidthActual, ScreenHeightActual, bpp,
SDL_GetError ()); SDL_GetError ());
exit(-1); exit(-1);
} }
else else
{ {
printf ("Set the resolution to: %ix%ix%i\n", fprintf (stderr, "Set the resolution to: %ix%ix%i\n",
SDL_GetVideoSurface()->w, SDL_GetVideoSurface()->h, SDL_GetVideoSurface()->w, SDL_GetVideoSurface()->h,
SDL_GetVideoSurface()->format->BitsPerPixel); SDL_GetVideoSurface()->format->BitsPerPixel);
@@ -101,7 +101,7 @@ TFB_Pure_InitGraphics (int driver, int flags, int width, int height, int bpp)
if (test_extra == NULL) if (test_extra == NULL)
{ {
printf("Couldn't create back buffer: %s\n", SDL_GetError()); fprintf (stderr, "Couldn't create back buffer: %s\n", SDL_GetError());
exit(-1); exit(-1);
} }
@@ -118,7 +118,7 @@ TFB_Pure_InitGraphics (int driver, int flags, int width, int height, int bpp)
if (SDL_Video->format->BytesPerPixel != SDL_Screen->format->BytesPerPixel) if (SDL_Video->format->BytesPerPixel != SDL_Screen->format->BytesPerPixel)
{ {
printf("Fatal error: SDL_Video and SDL_Screen bpp doesn't match (%d vs. %d)\n", fprintf (stderr, "Fatal error: SDL_Video and SDL_Screen bpp doesn't match (%d vs. %d)\n",
SDL_Video->format->BytesPerPixel,SDL_Screen->format->BytesPerPixel); SDL_Video->format->BytesPerPixel,SDL_Screen->format->BytesPerPixel);
exit(-1); exit(-1);
} }
@@ -45,7 +45,7 @@ TFB_InitGraphics (int driver, int flags, int width, int height, int bpp)
result = TFB_GL_InitGraphics (driver, flags, width, height, bpp); result = TFB_GL_InitGraphics (driver, flags, width, height, bpp);
#else #else
driver = TFB_GFXDRIVER_SDL_PURE; driver = TFB_GFXDRIVER_SDL_PURE;
printf("OpenGL support not compiled in, so using pure sdl driver\n"); fprintf (stderr, "OpenGL support not compiled in, so using pure sdl driver\n");
result = TFB_Pure_InitGraphics (driver, flags, width, height, bpp); result = TFB_Pure_InitGraphics (driver, flags, width, height, bpp);
#endif #endif
} }
@@ -219,7 +219,7 @@ TFB_LoadImage (SDL_Surface *img)
} }
else else
{ {
printf("TFB_LoadImage(): TFB_DisplayFormatAlpha failed\n"); fprintf (stderr, "TFB_LoadImage(): TFB_DisplayFormatAlpha failed\n");
myImage->NormalImg = img; myImage->NormalImg = img;
} }
} }
@@ -285,7 +285,7 @@ TFB_ComputeFPS ()
if (fps_counter > 1000) if (fps_counter > 1000)
{ {
fps_counter = 0; fps_counter = 0;
printf ("fps %.2f\n",1.0 / (delta_time / 1000.0)); fprintf (stderr, "fps %.2f\n",1.0 / (delta_time / 1000.0));
} }
} }
@@ -375,7 +375,7 @@ TFB_FlushGraphics () // Only call from main thread!!
++commands_handled; ++commands_handled;
if (!livelock_deterrence && commands_handled + DrawCommandQueue->Size > DCQ_LIVELOCK_MAX) if (!livelock_deterrence && commands_handled + DrawCommandQueue->Size > DCQ_LIVELOCK_MAX)
{ {
// printf("Initiating livelock deterrence!\n"); // fprintf (stderr, "Initiating livelock deterrence!\n");
livelock_deterrence = TRUE; livelock_deterrence = TRUE;
Lock_DCQ (); Lock_DCQ ();
@@ -395,7 +395,7 @@ TFB_FlushGraphics () // Only call from main thread!!
if (DC_image == 0) if (DC_image == 0)
{ {
printf ("TFB_FlushGraphics(): error, DC_image == 0\n"); fprintf (stderr, "TFB_FlushGraphics(): error, DC_image == 0\n");
break; break;
} }
@@ -526,7 +526,7 @@ TFB_FlushGraphics () // Only call from main thread!!
SDL_FreeSurface (DC_image->NormalImg); SDL_FreeSurface (DC_image->NormalImg);
if (DC_image->ScaledImg) { if (DC_image->ScaledImg) {
//printf("DELETEIMAGE to ScaledImg %x, size %d %d\n",DC_image->ScaledImg,DC_image->ScaledImg->w,DC_image->ScaledImg->h); //fprintf (stderr, "DELETEIMAGE to ScaledImg %x, size %d %d\n",DC_image->ScaledImg,DC_image->ScaledImg->w,DC_image->ScaledImg->h);
SDL_FreeSurface (DC_image->ScaledImg); SDL_FreeSurface (DC_image->ScaledImg);
} }
+33 -33
View File
@@ -50,18 +50,18 @@ TFB_InitInput (int driver, int flags)
if ((SDL_InitSubSystem(SDL_INIT_JOYSTICK)) == -1) if ((SDL_InitSubSystem(SDL_INIT_JOYSTICK)) == -1)
{ {
printf("Couldn't initialize joystick subsystem: %s\n", SDL_GetError()); fprintf (stderr, "Couldn't initialize joystick subsystem: %s\n", SDL_GetError());
exit(-1); exit(-1);
} }
printf ("%i joysticks were found.\n", SDL_NumJoysticks ()); fprintf (stderr, "%i joysticks were found.\n", SDL_NumJoysticks ());
if(SDL_NumJoysticks() > 0) if (SDL_NumJoysticks () > 0)
{ {
printf ("The names of the joysticks are:\n"); fprintf (stderr, "The names of the joysticks are:\n");
for(i = 0; i < SDL_NumJoysticks (); i++) for(i = 0; i < SDL_NumJoysticks (); i++)
{ {
printf(" %s\n", SDL_JoystickName (i)); fprintf (stderr, " %s\n", SDL_JoystickName (i));
} }
SDL_JoystickEventState (SDL_ENABLE); SDL_JoystickEventState (SDL_ENABLE);
Joystick1 = SDL_JoystickOpen (0); Joystick1 = SDL_JoystickOpen (0);
@@ -198,7 +198,7 @@ ProcessJoystickEvent (const SDL_Event* Event)
} }
if (Event->type == SDL_JOYBUTTONDOWN) if (Event->type == SDL_JOYBUTTONDOWN)
{ {
printf("Joystick %i down\n", Event->jbutton.button); fprintf (stderr, "Joystick %i down\n", Event->jbutton.button);
if (Event->jbutton.button % 3 == 0) if (Event->jbutton.button % 3 == 0)
{ {
@@ -278,7 +278,7 @@ UninitInput () // Looks like it'll be empty
{ {
BOOLEAN ret; BOOLEAN ret;
// printf("Unimplemented function activated: UninitInput()\n"); // fprintf (stderr, "Unimplemented function activated: UninitInput()\n");
ret = TRUE; ret = TRUE;
return (ret); return (ret);
} }
@@ -536,7 +536,7 @@ AnyButtonPress (BOOLEAN DetectSpecial)
BOOLEAN BOOLEAN
_joystick_port_active(COUNT port) //SDL handles this nicely. _joystick_port_active(COUNT port) //SDL handles this nicely.
{ {
printf ("Unimplemented function activated: _joystick_port_active()\n"); fprintf (stderr, "Unimplemented function activated: _joystick_port_active()\n");
return (0); return (0);
} }
@@ -639,74 +639,74 @@ INPUT_STATE
_get_joystick_state (INPUT_REF ref, INPUT_STATE InputState) _get_joystick_state (INPUT_REF ref, INPUT_STATE InputState)
// consistant, at least. // consistant, at least.
{ {
// printf ("Half-implemented function activated: _get_joystick_state()\n"); // fprintf (stderr, "Half-implemented function activated: _get_joystick_state()\n");
if (KeyboardStroke[SDLK_LEFT]) if (KeyboardStroke[SDLK_LEFT])
{ {
SetInputXComponent (&InputState, -1); SetInputXComponent (&InputState, -1);
// printf ("LEFT!\n"); // fprintf (stderr, "LEFT!\n");
KeyboardStroke[SDLK_LEFT] = FALSE; KeyboardStroke[SDLK_LEFT] = FALSE;
} }
if (KeyboardStroke[SDLK_RIGHT]) if (KeyboardStroke[SDLK_RIGHT])
{ {
SetInputXComponent (&InputState, 1); SetInputXComponent (&InputState, 1);
// printf ("RIGHT!\n"); // fprintf (stderr, "RIGHT!\n");
KeyboardStroke[SDLK_RIGHT] = FALSE; KeyboardStroke[SDLK_RIGHT] = FALSE;
} }
if (KeyboardStroke[SDLK_UP]) if (KeyboardStroke[SDLK_UP])
{ {
SetInputYComponent (&InputState, -1); SetInputYComponent (&InputState, -1);
// printf ("UP!\n"); // fprintf (stderr, "UP!\n");
KeyboardStroke[SDLK_UP] = FALSE; KeyboardStroke[SDLK_UP] = FALSE;
} }
if (KeyboardStroke[SDLK_DOWN]) if (KeyboardStroke[SDLK_DOWN])
{ {
SetInputYComponent (&InputState, 1); SetInputYComponent (&InputState, 1);
// printf ("DOWN!\n"); // fprintf (stderr, "DOWN!\n");
KeyboardStroke[SDLK_DOWN] = FALSE; KeyboardStroke[SDLK_DOWN] = FALSE;
} }
if (KeyboardStroke[ControlA]) if (KeyboardStroke[ControlA])
{ {
InputState |= DEVICE_BUTTON1; InputState |= DEVICE_BUTTON1;
// printf("BUTTON1!\n"); // fprintf (stderr, "BUTTON1!\n");
KeyboardStroke[ControlA]=FALSE; KeyboardStroke[ControlA]=FALSE;
} }
if (KeyboardStroke[ControlB]) if (KeyboardStroke[ControlB])
{ {
InputState |= DEVICE_BUTTON2; InputState |= DEVICE_BUTTON2;
// printf ("BUTTON2!\n"); // fprintf (stderr, "BUTTON2!\n");
KeyboardStroke[ControlB] = FALSE; KeyboardStroke[ControlB] = FALSE;
} }
if (KeyboardStroke[ControlC]) if (KeyboardStroke[ControlC])
{ {
InputState |= DEVICE_BUTTON3; InputState |= DEVICE_BUTTON3;
// printf ("BUTTON3!\n"); // fprintf (stderr, "BUTTON3!\n");
KeyboardStroke[ControlC] = FALSE; KeyboardStroke[ControlC] = FALSE;
} }
if (KeyboardStroke[ControlX]) if (KeyboardStroke[ControlX])
{ {
InputState |= DEVICE_EXIT; InputState |= DEVICE_EXIT;
// printf ("BUTTONX!\n"); // fprintf (stderr, "BUTTONX!\n");
KeyboardStroke[ControlX] = FALSE; KeyboardStroke[ControlX] = FALSE;
} }
if (KeyboardStroke[ControlStart]) if (KeyboardStroke[ControlStart])
{ {
InputState |= DEVICE_PAUSE; InputState |= DEVICE_PAUSE;
// printf ("CONTROLSTART!\n"); // fprintf (stderr, "CONTROLSTART!\n");
KeyboardStroke[ControlStart] = FALSE; KeyboardStroke[ControlStart] = FALSE;
} }
if (KeyboardStroke[ControlLeftShift]) if (KeyboardStroke[ControlLeftShift])
{ {
InputState |= DEVICE_LEFTSHIFT; InputState |= DEVICE_LEFTSHIFT;
// printf ("LEFTSHIFT!\n"); // fprintf (stderr, "LEFTSHIFT!\n");
KeyboardStroke[ControlLeftShift] = FALSE; KeyboardStroke[ControlLeftShift] = FALSE;
} }
if (KeyboardStroke[ControlRightShift]) if (KeyboardStroke[ControlRightShift])
{ {
InputState |= DEVICE_RIGHTSHIFT; InputState |= DEVICE_RIGHTSHIFT;
// printf ("RIGHTSHIFT!\n"); // fprintf (stderr, "RIGHTSHIFT!\n");
KeyboardStroke[ControlRightShift] = FALSE; KeyboardStroke[ControlRightShift] = FALSE;
} }
@@ -721,69 +721,69 @@ _get_joystick_state (INPUT_REF ref, INPUT_STATE InputState)
#if 0 #if 0
if (ref == JoystickInput[1] && 0) if (ref == JoystickInput[1] && 0)
{ {
//printf ("ref\n"); //fprintf (stderr, "ref\n");
return(0); return(0);
} }
// printf ("Half-implemented function activated: _get_joystick_state()\n"); // fprintf (stderr, "Half-implemented function activated: _get_joystick_state()\n");
if (KeyboardDown[SDLK_LEFT]) if (KeyboardDown[SDLK_LEFT])
{ {
SetInputXComponent (&InputState, -1); SetInputXComponent (&InputState, -1);
//printf ("LEFT!\n"); //fprintf (stderr, "LEFT!\n");
} }
if (KeyboardDown[SDLK_RIGHT]) if (KeyboardDown[SDLK_RIGHT])
{ {
SetInputXComponent (&InputState, 1); SetInputXComponent (&InputState, 1);
//printf ("RIGHT!\n"); //fprintf (stderr, "RIGHT!\n");
} }
if (KeyboardDown[SDLK_UP]) if (KeyboardDown[SDLK_UP])
{ {
SetInputYComponent (&InputState, -1); SetInputYComponent (&InputState, -1);
//printf ("UP!\n"); //fprintf (stderr, "UP!\n");
} }
if (KeyboardDown[SDLK_DOWN]) if (KeyboardDown[SDLK_DOWN])
{ {
SetInputYComponent (&InputState, 1); SetInputYComponent (&InputState, 1);
//printf ("DOWN!\n"); //fprintf (stderr, "DOWN!\n");
} }
if (KeyboardDown[ControlA]) if (KeyboardDown[ControlA])
{ {
InputState |= DEVICE_BUTTON1; InputState |= DEVICE_BUTTON1;
//printf ("BUTTON1!\n"); //fprintf (stderr, "BUTTON1!\n");
} }
if (KeyboardDown[ControlB]) if (KeyboardDown[ControlB])
{ {
InputState |= DEVICE_BUTTON2; InputState |= DEVICE_BUTTON2;
//printf ("BUTTON2!\n"); //fprintf (stderr, "BUTTON2!\n");
} }
if (KeyboardDown[ControlC]) if (KeyboardDown[ControlC])
{ {
InputState |= DEVICE_BUTTON3; InputState |= DEVICE_BUTTON3;
//printf ("BUTTON3!\n"); //fprintf (stderr, "BUTTON3!\n");
} }
if (KeyboardDown[ControlX]) if (KeyboardDown[ControlX])
{ {
InputState |= DEVICE_EXIT; InputState |= DEVICE_EXIT;
//printf ("BUTTONX!\n"); //fprintf (stderr, "BUTTONX!\n");
} }
if (KeyboardDown[ControlStart]) if (KeyboardDown[ControlStart])
{ {
InputState |= DEVICE_PAUSE; InputState |= DEVICE_PAUSE;
//printf ("CONTROLSTART!\n"); //fprintf (stderr, "CONTROLSTART!\n");
} }
if (KeyboardDown[ControlLeftShift]) if (KeyboardDown[ControlLeftShift])
{ {
InputState |= DEVICE_LEFTSHIFT; InputState |= DEVICE_LEFTSHIFT;
//printf ("LEFTSHIFT!\n"); //fprintf (stderr, "LEFTSHIFT!\n");
} }
if (KeyboardDown[ControlRightShift]) if (KeyboardDown[ControlRightShift])
{ {
InputState |= DEVICE_RIGHTSHIFT; InputState |= DEVICE_RIGHTSHIFT;
//printf ("RIGHTSHIFT!\n"); //fprintf (stderr, "RIGHTSHIFT!\n");
} }
#endif #endif
+24 -22
View File
@@ -92,10 +92,10 @@ static void Message(char *fmt, ...)
vsprintf(buffer, fmt, ap); vsprintf(buffer, fmt, ap);
va_end(ap); va_end(ap);
#ifndef FINAL #ifndef FINAL
printf("%s\n", buffer); fprintf (stderr, "%s\n", buffer);
//fflush(stdout); //fflush (stderr);
#endif #endif
#if 0 #if 0
if (GetToolFrame ()) if (GetToolFrame ())
@@ -147,10 +147,10 @@ static int MessageWithRetry(char *fmt, ...)
vsprintf(buffer, fmt, ap); vsprintf(buffer, fmt, ap);
va_end(ap); va_end(ap);
#ifndef FINAL #ifndef FINAL
printf("%s\n", buffer); fprintf (stderr, "%s\n", buffer);
//fflush(stdout); // fflush(stderr);
#endif #endif
#if 0 #if 0
if (GetToolFrame ()) if (GetToolFrame ())
@@ -254,8 +254,8 @@ MallocWithRetry(int bytes, char *diagStr)
if (ptr) if (ptr)
return (ptr); return (ptr);
#ifndef FINAL #ifndef FINAL
printf("Malloc failed for %s. #Bytes %d.\n", diagStr, bytes); fprintf (stderr, "Malloc failed for %s. #Bytes %d.\n", diagStr, bytes);
//fflush(stdout); // fflush (stderr);
#endif #endif
/* The user gets a chance to close other applications and try again. */ /* The user gets a chance to close other applications and try again. */
@@ -265,7 +265,7 @@ printf("Malloc failed for %s. #Bytes %d.\n", diagStr, bytes);
if (MessageWithRetry ("Really OK to stop tfbtool?")) if (MessageWithRetry ("Really OK to stop tfbtool?"))
{ {
/* User says "die". */ /* User says "die". */
printf ("Killed by the user (%s).\n", diagStr); fprintf (stderr, "Killed by the user (%s).\n", diagStr);
exit (0); exit (0);
} }
} }
@@ -299,12 +299,12 @@ mem_allocate (MEM_SIZE coreSize, MEM_FLAGS flags, MEM_PRIORITY priority,
if (flags & MEM_ZEROINIT) if (flags & MEM_ZEROINIT)
memset (node->memory, 0, node->size); memset (node->memory, 0, node->size);
#ifdef LEAK_DEBUG #ifdef LEAK_DEBUG
if (leak_debug) if (leak_debug)
printf ("alloc %d: %08x, %lu\n", (int) node->handle, (int) node->memory, fprintf (stderr, "alloc %d: %08x, %lu\n", (int) node->handle,
node->size); (int) node->memory, node->size);
if (node->handle == leak_idx && node->size == leak_size) if (node->handle == leak_idx && node->size == leak_size)
node = node; node = node;
if (node->size == leak_size) if (node->size == leak_size)
node = node; node = node;
#endif /* LEAK_DEBUG */ #endif /* LEAK_DEBUG */
@@ -431,9 +431,10 @@ mem_uninit(void)
{ {
if (extents[i].handle != -1) if (extents[i].handle != -1)
{ {
printf ("LEAK: unreleased extent %d: %08x, %lu\n", fprintf (stderr, "LEAK: unreleased extent %d: %08x, %lu\n",
extents[i].handle, (unsigned int) extents[i].memory, extents[i].size); extents[i].handle, (unsigned int) extents[i].memory,
fflush (stdout); extents[i].size);
fflush (stderr);
extents[i].handle = -1; extents[i].handle = -1;
if (extents[i].memory) if (extents[i].memory)
{ {
@@ -482,13 +483,14 @@ mem_release(MEM_HANDLE h)
--h; --h;
if (h < 0 || h >= MAX_EXTENTS) if (h < 0 || h >= MAX_EXTENTS)
printf("LEAK: attempt to release invalid extent %d\n", h); fprintf (stderr, "LEAK: attempt to release invalid extent %d\n", h);
else if (extents[h].handle == -1) else if (extents[h].handle == -1)
printf("LEAK: attempt to release unallocated extent %d\n",h); fprintf (stderr, "LEAK: attempt to release unallocated extent %d\n",h);
else if (extents[h].refcount == 0) else if (extents[h].refcount == 0)
{ {
#ifdef LEAK_DEBUG #ifdef LEAK_DEBUG
if (leak_debug) printf ("free %d: %08x\n", if (leak_debug)
fprintf (stderr, "free %d: %08x\n",
extents[h].handle, (unsigned int) extents[h].memory); extents[h].handle, (unsigned int) extents[h].memory);
#endif #endif
if (extents[h].memory) if (extents[h].memory)
+26 -17
View File
@@ -173,12 +173,13 @@ load_package (INDEX_HEADERPTR ResHeaderPtr, RES_PACKAGE res_package)
if ((hList = AllocResourceHandleList ( if ((hList = AllocResourceHandleList (
num_types, num_instances num_types, num_instances
)) == NULL_HANDLE) )) == NULL_HANDLE)
{ {
#ifdef DEBUG #ifdef DEBUG
printf ("Unable to allocate resource handle list <%d, %d>\n", num_types, num_instances); fprintf (stderr, "Unable to allocate resource handle list <%d, %d>\n",
num_types, num_instances);
#endif /* DEBUG */ #endif /* DEBUG */
return (NULL_HANDLE); return (NULL_HANDLE);
} }
LockResourceHandleList (ResHeaderPtr, hList, res_package, LockResourceHandleList (ResHeaderPtr, hList, res_package,
&ResourceHandleListPtr, &TypeEncodePtr, &DataPtr); &ResourceHandleListPtr, &TypeEncodePtr, &DataPtr);
@@ -285,8 +286,10 @@ printf ("Unable to allocate resource handle list <%d, %d>\n", num_types, num_ins
if (hData && IsIndexType (ResHeaderPtr, type)) if (hData && IsIndexType (ResHeaderPtr, type))
DanglingOpen = FALSE; DanglingOpen = FALSE;
#ifdef DEBUG #ifdef DEBUG
if (hData == 0) if (hData == 0)
printf ("fp = 0x%08lx(%d), type = %u, file_offs = %lu, len = %lu\n", fp, DanglingOpen, type, file_offs, data_len); fprintf (stderr, "fp = 0x%08lx(%d), type = %u, "
"file_offs = %lu, len = %lu\n", fp,
DanglingOpen, type, file_offs, data_len);
#endif /* DEBUG */ #endif /* DEBUG */
} }
file_offs += data_len; file_offs += data_len;
@@ -297,15 +300,17 @@ printf ("fp = 0x%08lx(%d), type = %u, file_offs = %lu, len = %lu\n", fp, Danglin
fp = OpenResFile (file_buf, "rb"); fp = OpenResFile (file_buf, "rb");
if (fp == NULL) if (fp == NULL)
{
#if 1 // def DEBUG #if 1 // def DEBUG
printf ("Can't open '%s'\n", file_buf) fprintf (stderr, "Can't open '%s'\n", file_buf);
#endif /* DEBUG */ #endif /* DEBUG */
; }
else else
{ {
data_len = LengthResFile (fp); data_len = LengthResFile (fp);
#ifndef PACKAGING #ifndef PACKAGING
printf ("\t'%s' -- %lu bytes\n", file_buf, data_len); fprintf (stderr, "\t'%s' -- %lu bytes\n", file_buf,
data_len);
#endif /* PACKAGING */ #endif /* PACKAGING */
if (data_len == 0) if (data_len == 0)
hData = NULL_HANDLE; hData = NULL_HANDLE;
@@ -316,7 +321,9 @@ printf ("\t'%s' -- %lu bytes\n", file_buf, data_len);
} }
} }
#ifdef DEBUG #ifdef DEBUG
if (hData == 0) printf ("Can't create data for '%s' <%lu>\n", file_buf, data_len); if (hData == 0)
fprintf (stderr, "Can't create data for '%s' <%lu>\n",
file_buf, data_len);
#endif /* DEBUG */ #endif /* DEBUG */
DataPtr[0] = LOBYTE (hData); DataPtr[0] = LOBYTE (hData);
@@ -340,7 +347,7 @@ if (hData == 0) printf ("Can't create data for '%s' <%lu>\n", file_buf, data_len
if (num_instances == 0) if (num_instances == 0)
{ {
#ifdef DEBUG #ifdef DEBUG
printf ("Nothing in package!\n"); fprintf (stderr, "Nothing in package!\n");
#endif /* DEBUG */ #endif /* DEBUG */
FreeResourceHandleList (hList); FreeResourceHandleList (hList);
hList = NULL_HANDLE; hList = NULL_HANDLE;
@@ -364,12 +371,13 @@ GetResource (RESOURCE res)
ResHeaderPtr = _get_current_index_header (); ResHeaderPtr = _get_current_index_header ();
if (!ValidResource (ResHeaderPtr, res)) if (!ValidResource (ResHeaderPtr, res))
{ {
#ifdef DEBUG #ifdef DEBUG
if (res) printf ("0x%08lx is not a valid resource!\n", res); if (res)
fprintf (stderr, "0x%08lx is not a valid resource!\n", res);
#endif /* DEBUG */ #endif /* DEBUG */
return (NULL_HANDLE); return (NULL_HANDLE);
} }
res_package = GET_PACKAGE (res); res_package = GET_PACKAGE (res);
@@ -380,12 +388,12 @@ if (res) printf ("0x%08lx is not a valid resource!\n", res);
else else
{ {
if ((hList = load_package (ResHeaderPtr, res_package)) == NULL_HANDLE) if ((hList = load_package (ResHeaderPtr, res_package)) == NULL_HANDLE)
{ {
#ifdef DEBUG #ifdef DEBUG
printf ("Unable to load package %u\n", res_package); fprintf (stderr, "Unable to load package %u\n", res_package);
#endif /* DEBUG */ #endif /* DEBUG */
return (NULL_HANDLE); return (NULL_HANDLE);
} }
ResHeaderPtr->PackageList[res_package - 1].flags_and_data_loc = ResHeaderPtr->PackageList[res_package - 1].flags_and_data_loc =
MAKE_DWORD (hList, 0); MAKE_DWORD (hList, 0);
@@ -407,7 +415,8 @@ printf ("Unable to load package %u\n", res_package);
UnlockResourceHandleList (hList); UnlockResourceHandleList (hList);
#ifdef DEBUG #ifdef DEBUG
if (hData == 0) printf ("No data for res 0x%08lx\n", res); if (hData == 0)
fprintf (stderr, "No data for res 0x%08lx\n", res);
#endif /* DEBUG */ #endif /* DEBUG */
return (hData); return (hData);
} }
+7 -7
View File
@@ -320,11 +320,11 @@ CloseResourceIndex (MEM_HANDLE hRH)
ResHeaderPtr = LockResourceHeader (hRH); ResHeaderPtr = LockResourceHeader (hRH);
#ifdef DEBUG #ifdef DEBUG
{ {
COUNT i; COUNT i;
for (i = 0; i < ResHeaderPtr->num_packages; ++i) for (i = 0; i < ResHeaderPtr->num_packages; ++i)
{ {
UWORD hi; UWORD hi;
hi = HIWORD (ResHeaderPtr->PackageList[i].flags_and_data_loc); hi = HIWORD (ResHeaderPtr->PackageList[i].flags_and_data_loc);
@@ -339,12 +339,12 @@ for (i = 0; i < ResHeaderPtr->num_packages; ++i)
ResHeaderPtr->PackageList[i].flags_and_data_loc); ResHeaderPtr->PackageList[i].flags_and_data_loc);
LockResourceHandleList (ResHeaderPtr, hList, i + 1, LockResourceHandleList (ResHeaderPtr, hList, i + 1,
&ResourceHandleListPtr, &TypeEncodePtr, &DataPtr); &ResourceHandleListPtr, &TypeEncodePtr, &DataPtr);
printf ("Package %u has %u instances left\n", fprintf (stderr, "Package %u has %u instances left\n",
i + 1, ResourceHandleListPtr->num_valid_handles); i + 1, ResourceHandleListPtr->num_valid_handles);
UnlockResourceHandleList (hList); UnlockResourceHandleList (hList);
} }
} }
} }
#endif /* DEBUG */ #endif /* DEBUG */
_sub_index_list (hRH); _sub_index_list (hRH);
+1 -1
View File
@@ -78,7 +78,7 @@ _GetSoundBankData (FILE *fp, DWORD length)
} }
else else
{ {
printf("_GetSoundBankData: Bad file!\n"); fprintf (stderr, "_GetSoundBankData: Bad file!\n");
} }
if (ftell (fp) - opos >= length) if (ftell (fp) - opos >= length)
+14 -14
View File
@@ -32,13 +32,13 @@ TFB_InitSound (int driver, int flags, int frequency)
if ((SDL_InitSubSystem(SDL_INIT_AUDIO)) == -1) if ((SDL_InitSubSystem(SDL_INIT_AUDIO)) == -1)
{ {
printf("Couldn't initialize audio subsystem: %s\n", SDL_GetError()); fprintf (stderr, "Couldn't initialize audio subsystem: %s\n", SDL_GetError());
exit(-1); exit(-1);
} }
if (Mix_OpenAudio(frequency, AUDIO_S16, 2, 4096)) if (Mix_OpenAudio(frequency, AUDIO_S16, 2, 4096))
{ {
printf ("Unable to open audio!\n"); fprintf (stderr, "Unable to open audio!\n");
exit (-1); exit (-1);
} }
@@ -47,16 +47,16 @@ TFB_InitSound (int driver, int flags, int frequency)
SDL_AudioDriverName (SoundcardName, sizeof (SoundcardName)); SDL_AudioDriverName (SoundcardName, sizeof (SoundcardName));
Mix_QuerySpec (&audio_rate, &audio_format, &audio_channels); Mix_QuerySpec (&audio_rate, &audio_format, &audio_channels);
printf ("Opened %s at %d Hz %d bit %s, %d bytes audio buffer\n", fprintf (stderr, "Opened %s at %d Hz %d bit %s, %d bytes audio buffer\n",
SoundcardName, audio_rate, audio_format & 0xFF, SoundcardName, audio_rate, audio_format & 0xFF,
audio_channels > 1 ? "stereo" : "mono", 4096); audio_channels > 1 ? "stereo" : "mono", 4096);
MIX_VERSION (&compile_version); MIX_VERSION (&compile_version);
printf ("Compiled with SDL_mixer version: %d.%d.%d\n", fprintf (stderr, "Compiled with SDL_mixer version: %d.%d.%d\n",
compile_version.major, compile_version.major,
compile_version.minor, compile_version.minor,
compile_version.patch); compile_version.patch);
printf ("Running with SDL_mixer version: %d.%d.%d\n", fprintf (stderr, "Running with SDL_mixer version: %d.%d.%d\n",
Mix_Linked_Version()->major, Mix_Linked_Version()->major,
Mix_Linked_Version()->minor, Mix_Linked_Version()->minor,
Mix_Linked_Version()->patch); Mix_Linked_Version()->patch);
@@ -95,7 +95,7 @@ GetSoundData(char* data) //Returns the data size.
{ {
int ret; int ret;
printf("Unimplemented function activated: GetSoundData()\n"); fprintf (stderr, "Unimplemented function activated: GetSoundData()\n");
ret = 0; ret = 0;
return (ret); return (ret);
} }
@@ -107,7 +107,7 @@ GetSoundInfo(int* length, int* offset)
{ {
int ret; int ret;
printf ("Unimplemented function activated: GetSoundInfo()\n"); fprintf (stderr, "Unimplemented function activated: GetSoundInfo()\n");
ret = 0; ret = 0;
return (ret); return (ret);
} }
@@ -117,7 +117,7 @@ BOOLEAN
ChannelPlaying(COUNT WhichChannel) ChannelPlaying(COUNT WhichChannel)
// SDL will have a nice interface for this, I hope. // SDL will have a nice interface for this, I hope.
{ {
// printf("Unimplemented function activated: ChannelPlaying()\n"); // fprintf (stderr, "Unimplemented function activated: ChannelPlaying()\n");
return ((BOOLEAN) Mix_Playing (WhichChannel)); return ((BOOLEAN) Mix_Playing (WhichChannel));
} }
@@ -167,7 +167,7 @@ GetSampleLength (SOUND sound)
Chunk = (Mix_Chunk *) sound; Chunk = (Mix_Chunk *) sound;
ret = 0; // Chunk->alen; ret = 0; // Chunk->alen;
// printf ("Maybe Implemented function activated: GetSampleLength()\n"); // fprintf (stderr, "Maybe Implemented function activated: GetSampleLength()\n");
return(ret); return(ret);
} }
@@ -176,7 +176,7 @@ void
SetChannelRate (COUNT channel, DWORD rate_hz, unsigned char priority) SetChannelRate (COUNT channel, DWORD rate_hz, unsigned char priority)
// in hz // in hz
{ {
// printf ("Unimplemented function activated: SetChannelRate()\n"); // fprintf (stderr, "Unimplemented function activated: SetChannelRate()\n");
} }
// Status: Unimplemented // Status: Unimplemented
@@ -185,7 +185,7 @@ GetSampleRate (SOUND sound)
{ {
COUNT ret; COUNT ret;
// printf("Unimplemented function activated: GetSampleRate()\n"); // fprintf (stderr, "Unimplemented function activated: GetSampleRate()\n");
ret=0; ret=0;
return(ret); return(ret);
} }
@@ -196,7 +196,7 @@ SetChannelVolume (COUNT channel, COUNT volume, BYTE priority)
// I wonder what this whole priority business is... // I wonder what this whole priority business is...
// I can probably ignore it. // I can probably ignore it.
{ {
// printf ("Unimplemented function activated: SetChannelVolume()\n"); // fprintf (stderr, "Unimplemented function activated: SetChannelVolume()\n");
} }
//Status: Ignored //Status: Ignored
@@ -206,7 +206,7 @@ InitSound (int argc, char* argv[])
{ {
BOOLEAN ret; BOOLEAN ret;
// printf("Unimplemented function activated: InitSound()\n"); // fprintf (stderr, "Unimplemented function activated: InitSound()\n");
ret = TRUE; ret = TRUE;
return (ret); return (ret);
} }
@@ -215,7 +215,7 @@ InitSound (int argc, char* argv[])
void void
UninitSound () //Maybe I should call StopSound() first? UninitSound () //Maybe I should call StopSound() first?
{ {
//printf("Unimplemented function activated: UninitSound()\n"); // fprintf (stderr, "Unimplemented function activated: UninitSound()\n");
} }
#endif #endif
+6 -6
View File
@@ -152,7 +152,7 @@ LoadGame (COUNT which_game, SUMMARY_DESC *summary_desc)
cread ((PBYTE)&num_links, sizeof (num_links), 1, fh); cread ((PBYTE)&num_links, sizeof (num_links), 1, fh);
{ {
#ifdef DEBUG #ifdef DEBUG
printf ("EVENTS:\n"); fprintf (stderr, "EVENTS:\n");
#endif /* DEBUG */ #endif /* DEBUG */
while (num_links--) while (num_links--)
{ {
@@ -165,11 +165,11 @@ printf ("EVENTS:\n");
cread ((PBYTE)EventPtr, sizeof (*EventPtr), 1, fh); cread ((PBYTE)EventPtr, sizeof (*EventPtr), 1, fh);
#ifdef DEBUG #ifdef DEBUG
printf ("\t%u/%u/%u -- %u\n", fprintf (stderr, "\t%u/%u/%u -- %u\n",
EventPtr->month_index, EventPtr->month_index,
EventPtr->day_index, EventPtr->day_index,
EventPtr->year_index, EventPtr->year_index,
EventPtr->func_index); EventPtr->func_index);
#endif /* DEBUG */ #endif /* DEBUG */
UnlockEvent (hEvent); UnlockEvent (hEvent);
PutEvent (hEvent); PutEvent (hEvent);
+23 -22
View File
@@ -232,7 +232,7 @@ DoPlanetaryAnalysis (SYSTEM_INFOPTR SysInfoPtr, PPLANET_DESC
CalcSysInfo (SysInfoPtr); CalcSysInfo (SysInfoPtr);
#ifdef DEBUG #ifdef DEBUG
{ {
BYTE ColorClass[6][8] = { BYTE ColorClass[6][8] = {
"Red", "Red",
"Orange", "Orange",
@@ -240,18 +240,19 @@ DoPlanetaryAnalysis (SYSTEM_INFOPTR SysInfoPtr, PPLANET_DESC
"Green", "Green",
"Blue", "Blue",
"White", "White",
} ; };
BYTE SizeName[3][12] = { BYTE SizeName[3][12] = {
"Dwarf", "Dwarf",
"Giant", "Giant",
"Supergiant", "Supergiant",
}; };
printf ("%s %s\n", fprintf (stderr, "%s %s\n",
ColorClass[SysInfoPtr->StarIntensity], ColorClass[SysInfoPtr->StarIntensity],
SizeName[SysInfoPtr->StarSize]); SizeName[SysInfoPtr->StarSize]);
printf ("Stellar Energy: %d (sol = 3)\n", SysInfoPtr->StarEnergy); fprintf (stderr, "Stellar Energy: %d (sol = 3)\n",
} SysInfoPtr->StarEnergy);
}
#endif /* DEBUG */ #endif /* DEBUG */
{ {
@@ -331,62 +332,62 @@ DoPlanetaryAnalysis (SYSTEM_INFOPTR SysInfoPtr, PPLANET_DESC
#ifdef DEBUG #ifdef DEBUG
radius = (SIZE)((DWORD)UNSCALE_RADIUS (radius) * 100 / UNSCALE_RADIUS (EARTH_RADIUS)); radius = (SIZE)((DWORD)UNSCALE_RADIUS (radius) * 100 / UNSCALE_RADIUS (EARTH_RADIUS));
printf ("\tOrbital Distance : %d.%02d AU\n", radius / 100, radius % 100); fprintf (stderr, "\tOrbital Distance : %d.%02d AU\n", radius / 100, radius % 100);
//printf ("\tPlanetary Mass : %d.%02d Earth masses\n", //fprintf (stderr, "\tPlanetary Mass : %d.%02d Earth masses\n",
// SysInfoPtr->PlanetInfo.PlanetMass / 100, // SysInfoPtr->PlanetInfo.PlanetMass / 100,
// SysInfoPtr->PlanetInfo.PlanetMass % 100); // SysInfoPtr->PlanetInfo.PlanetMass % 100);
printf ("\tPlanetary Radius : %d.%02d Earth radii\n", fprintf (stderr, "\tPlanetary Radius : %d.%02d Earth radii\n",
SysInfoPtr->PlanetInfo.PlanetRadius / 100, SysInfoPtr->PlanetInfo.PlanetRadius / 100,
SysInfoPtr->PlanetInfo.PlanetRadius % 100); SysInfoPtr->PlanetInfo.PlanetRadius % 100);
printf ("\tSurface Gravity: %d.%02d gravities\n", fprintf (stderr, "\tSurface Gravity: %d.%02d gravities\n",
SysInfoPtr->PlanetInfo.SurfaceGravity / 100, SysInfoPtr->PlanetInfo.SurfaceGravity / 100,
SysInfoPtr->PlanetInfo.SurfaceGravity % 100); SysInfoPtr->PlanetInfo.SurfaceGravity % 100);
printf ("\tSurface Temperature: %d degrees C\n", fprintf (stderr, "\tSurface Temperature: %d degrees C\n",
SysInfoPtr->PlanetInfo.SurfaceTemperature ); SysInfoPtr->PlanetInfo.SurfaceTemperature );
printf ("\tAxial Tilt : %d degrees\n", fprintf (stderr, "\tAxial Tilt : %d degrees\n",
abs (SysInfoPtr->PlanetInfo.AxialTilt)); abs (SysInfoPtr->PlanetInfo.AxialTilt));
printf ("\tTectonics : Class %u\n", fprintf (stderr, "\tTectonics : Class %u\n",
SysInfoPtr->PlanetInfo.Tectonics + 1); SysInfoPtr->PlanetInfo.Tectonics + 1);
printf ("\tAtmospheric Density: %u.%02u ", fprintf (stderr, "\tAtmospheric Density: %u.%02u ",
SysInfoPtr->PlanetInfo.AtmoDensity / EARTH_ATMOSPHERE, SysInfoPtr->PlanetInfo.AtmoDensity / EARTH_ATMOSPHERE,
(SysInfoPtr->PlanetInfo.AtmoDensity * 100 / EARTH_ATMOSPHERE) % 100); (SysInfoPtr->PlanetInfo.AtmoDensity * 100 / EARTH_ATMOSPHERE) % 100);
if (SysInfoPtr->PlanetInfo.AtmoDensity == 0) if (SysInfoPtr->PlanetInfo.AtmoDensity == 0)
{ {
printf ("(Vacuum)\n"); fprintf (stderr, "(Vacuum)\n");
} }
else if (SysInfoPtr->PlanetInfo.AtmoDensity < THIN_ATMOSPHERE) else if (SysInfoPtr->PlanetInfo.AtmoDensity < THIN_ATMOSPHERE)
{ {
printf ("(Thin)\n"); fprintf (stderr, "(Thin)\n");
} }
else if (SysInfoPtr->PlanetInfo.AtmoDensity < NORMAL_ATMOSPHERE) else if (SysInfoPtr->PlanetInfo.AtmoDensity < NORMAL_ATMOSPHERE)
{ {
printf ("(Normal)\n"); fprintf (stderr, "(Normal)\n");
} }
else if (SysInfoPtr->PlanetInfo.AtmoDensity < THICK_ATMOSPHERE) else if (SysInfoPtr->PlanetInfo.AtmoDensity < THICK_ATMOSPHERE)
{ {
printf ("(Thick)\n"); fprintf (stderr, "(Thick)\n");
} }
else if (SysInfoPtr->PlanetInfo.AtmoDensity < SUPER_THICK_ATMOSPHERE) else if (SysInfoPtr->PlanetInfo.AtmoDensity < SUPER_THICK_ATMOSPHERE)
{ {
printf ("(Super thick)\n"); fprintf (stderr, "(Super thick)\n");
} }
else else
{ {
printf ("(Gas Giant atmosphere)\n"); fprintf (stderr, "(Gas Giant atmosphere)\n");
} }
printf ("\tWeather : Class %u\n", fprintf (stderr, "\tWeather : Class %u\n",
SysInfoPtr->PlanetInfo.Weather + 1); SysInfoPtr->PlanetInfo.Weather + 1);
if (SysInfoPtr->PlanetInfo.RotationPeriod >= 480) if (SysInfoPtr->PlanetInfo.RotationPeriod >= 480)
{ {
printf ("\tLength of day : %d.%d Earth days\n", fprintf (stderr, "\tLength of day : %d.%d Earth days\n",
SysInfoPtr->PlanetInfo.RotationPeriod / 240, SysInfoPtr->PlanetInfo.RotationPeriod / 240,
SysInfoPtr->PlanetInfo.RotationPeriod % 240); SysInfoPtr->PlanetInfo.RotationPeriod % 240);
} }
else else
{ {
printf ("\tLength of day : %d.%d Earth hours\n", fprintf (stderr, "\tLength of day : %d.%d Earth hours\n",
SysInfoPtr->PlanetInfo.RotationPeriod / 10, SysInfoPtr->PlanetInfo.RotationPeriod / 10,
SysInfoPtr->PlanetInfo.RotationPeriod % 10); SysInfoPtr->PlanetInfo.RotationPeriod % 10);
} }
+2 -2
View File
@@ -499,8 +499,8 @@ char scolor[] = {'B', 'G', 'O', 'R', 'W', 'Y'};
} }
#ifdef DEBUG #ifdef DEBUG
GetClusterName (CurStarDescPtr, buf); GetClusterName (CurStarDescPtr, buf);
printf ("cluster name = %s color = %c type = %c\n", buf, fprintf (stderr, "cluster name = %s color = %c type = %c\n", buf,
scolor[STAR_COLOR (CurStarDescPtr->Type)], scolor[STAR_COLOR (CurStarDescPtr->Type)],
stype[STAR_TYPE (CurStarDescPtr->Type)]); stype[STAR_TYPE (CurStarDescPtr->Type)]);
#endif /* DEBUG */ #endif /* DEBUG */
+41 -28
View File
@@ -238,12 +238,12 @@ build_steps ()
ystep[i] = 1; ystep[i] = 1;
#if 0 #if 0
y = 0; y = 0;
for (i = 0; y < (HEIGHT >> 1); i++) for (i = 0; y < (HEIGHT >> 1); i++)
{ {
printf ("ystep[%ld] = %ld\n", i, ystep[i]); fprintf (stderr, "ystep[%ld] = %ld\n", i, ystep[i]);
y += ystep[i]; y += ystep[i];
} }
#endif #endif
} }
@@ -286,9 +286,9 @@ build_tables (int da)
y += h; y += h;
#if 0 #if 0
printf ("%ld: %ld ", i, y); fprintf (stderr, "%ld: %ld ", i, y);
printf ("%ld,%ld -- ", x0[i] >> 16, y0[i] >> 16); fprintf (stderr, "%ld,%ld -- ", x0[i] >> 16, y0[i] >> 16);
printf ("%ld,%ld\n", x1[i] >> 16, y1[i] >> 16); fprintf (stderr, "%ld,%ld\n", x1[i] >> 16, y1[i] >> 16);
#endif #endif
} }
@@ -431,7 +431,7 @@ init_rotate_cels ()
} }
} }
#if 0 #if 0
printf ("using %d cels for rotate\n", cur_ccb - plCCB); fprintf (stderr, "using %d cels for rotate\n", cur_ccb - plCCB);
#endif #endif
} }
#endif #endif
@@ -515,9 +515,11 @@ RotatePlanet (int x, int dx, int dy)
#endif #endif
add_cel (pblack_circ_ccb); add_cel (pblack_circ_ccb);
#ifdef KDEBUG #ifdef KDEBUG
printf ("CLEAR...\n"); fprintf (stderr, "CLEAR...\n");
while (AnyButtonPress (FALSE)); while (AnyButtonPress (FALSE))
while (!AnyButtonPress (FALSE)); ;
while (!AnyButtonPress (FALSE))
;
#endif /* KDEBUG */ #endif /* KDEBUG */
} }
@@ -558,9 +560,11 @@ while (!AnyButtonPress (FALSE));
add_cels (first, cur_ccb - 1); add_cels (first, cur_ccb - 1);
#ifdef KDEBUG #ifdef KDEBUG
printf ("PLANET...\n"); fprintf (stderr, "PLANET...\n");
while (AnyButtonPress (FALSE)); while (AnyButtonPress (FALSE))
while (!AnyButtonPress (FALSE)); ;
while (!AnyButtonPress (FALSE))
;
#endif /* KDEBUG */ #endif /* KDEBUG */
if (pcirc_ccb) if (pcirc_ccb)
{ {
@@ -574,9 +578,11 @@ while (!AnyButtonPress (FALSE));
#endif #endif
add_cel (pcirc_ccb); add_cel (pcirc_ccb);
#ifdef KDEBUG #ifdef KDEBUG
printf ("CLIP...\n"); fprintf (stderr, "CLIP...\n");
while (AnyButtonPress (FALSE)); while (AnyButtonPress (FALSE))
while (!AnyButtonPress (FALSE)); ;
while (!AnyButtonPress (FALSE))
;
#endif /* KDEBUG */ #endif /* KDEBUG */
} }
@@ -592,9 +598,11 @@ while (!AnyButtonPress (FALSE));
#endif #endif
add_cel (pblur_ccb); add_cel (pblur_ccb);
#ifdef KDEBUG #ifdef KDEBUG
printf ("BLUR...\n"); fprintf (stderr, "BLUR...\n");
while (AnyButtonPress (FALSE)); while (AnyButtonPress (FALSE))
while (!AnyButtonPress (FALSE)); ;
while (!AnyButtonPress (FALSE))
;
#endif /* KDEBUG */ #endif /* KDEBUG */
} }
@@ -610,9 +618,11 @@ while (!AnyButtonPress (FALSE));
#endif #endif
add_cel (pshadow_ccb); add_cel (pshadow_ccb);
#ifdef KDEBUG #ifdef KDEBUG
printf ("SHADOW...\n"); fprintf (stderr, "SHADOW...\n");
while (AnyButtonPress (FALSE)); while (AnyButtonPress (FALSE))
while (!AnyButtonPress (FALSE)); ;
while (!AnyButtonPress (FALSE))
;
#endif /* KDEBUG */ #endif /* KDEBUG */
} }
@@ -641,10 +651,13 @@ while (!AnyButtonPress (FALSE));
add_cel (pshield_ccb); add_cel (pshield_ccb);
#ifdef KDEBUG #ifdef KDEBUG
printf ("SHIELD...\n"); fprintf (stderr, "SHIELD...\n");
while (AnyButtonPress (FALSE)); while (AnyButtonPress (FALSE))
while (!AnyButtonPress (FALSE)); ;
while (AnyButtonPress (FALSE)); while (!AnyButtonPress (FALSE))
;
while (AnyButtonPress (FALSE))
;
#endif /* KDEBUG */ #endif /* KDEBUG */
} }
+18 -17
View File
@@ -232,12 +232,13 @@ SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x1F, 0xA, 0xA), 0x0C));
++pscan_block->num_same_scans; ++pscan_block->num_same_scans;
} }
#ifdef DEBUG #ifdef DEBUG
printf ("<%d, %d>-<%d, %d>, %d, %d, %u%s\n", fprintf (stderr, "<%d, %d>-<%d, %d>, %d, %d, %u%s\n",
scan_array->start.x, scan_array->start.y, scan_array->start.x, scan_array->start.y,
scan_array->end.x, scan_array->end.y, scan_array->end.x, scan_array->end.y,
scan_array->xerror, scan_array->yerror, scan_array->xerror, scan_array->yerror,
scan_array->num_dots & ~SAME_SCAN, scan_array->num_dots & ~SAME_SCAN,
(scan_array->num_dots & SAME_SCAN) ? ", SAME SCAN" : ""); (scan_array->num_dots & SAME_SCAN) ?
", SAME SCAN" : "");
#endif /* DEBUG */ #endif /* DEBUG */
++scan_array; ++scan_array;
@@ -274,12 +275,12 @@ DrawPoint (&pt);
++pscan_block->num_same_scans; ++pscan_block->num_same_scans;
} }
#ifdef DEBUG #ifdef DEBUG
printf ("<%d, %d>-<%d, %d>, %d, %d, %u\n", fprintf (stderr, "<%d, %d>-<%d, %d>, %d, %d, %u\n",
scan_array->start.x, scan_array->start.y, scan_array->start.x, scan_array->start.y,
scan_array->end.x, scan_array->end.y, scan_array->end.x, scan_array->end.y,
scan_array->xerror, scan_array->yerror, scan_array->xerror, scan_array->yerror,
scan_array->num_dots & ~SAME_SCAN, scan_array->num_dots & ~SAME_SCAN,
(scan_array->num_dots & SAME_SCAN) ? ", SAME SCAN" : ""); (scan_array->num_dots & SAME_SCAN) ? ", SAME SCAN" : "");
#endif /* DEBUG */ #endif /* DEBUG */
++scan_array; ++scan_array;
} }
@@ -296,12 +297,12 @@ scan_array->num_dots & ~SAME_SCAN,
pscan_block->num_scans = (COUNT)(scan_array - pscan_block->scan_base); pscan_block->num_scans = (COUNT)(scan_array - pscan_block->scan_base);
#ifdef DEBUG #ifdef DEBUG
{ {
extern DWORD AnyButtonPress (BOOLEAN CheckSpecial); extern DWORD AnyButtonPress (BOOLEAN CheckSpecial);
printf ("num_scans = %u\n", pscan_block->num_scans); fprintf (stderr, "num_scans = %u\n", pscan_block->num_scans);
while (!AnyButtonPress (TRUE)) while (!AnyButtonPress (TRUE))
; ;
} }
#endif /* DEBUG */ #endif /* DEBUG */
} }
+12 -11
View File
@@ -389,7 +389,7 @@ CheckIntersect (BOOLEAN just_checking)
{ {
PlanetOffset = pCurDesc - pSolarSysState->PlanetDesc + 1; PlanetOffset = pCurDesc - pSolarSysState->PlanetDesc + 1;
MoonOffset = 1; MoonOffset = 1;
//printf ("0: Planet %d, Moon %d\n", PlanetOffset, MoonOffset); //fprintf (stderr, "0: Planet %d, Moon %d\n", PlanetOffset, MoonOffset);
NewWaitPlanet = MAKE_WORD (PlanetOffset, MoonOffset); NewWaitPlanet = MAKE_WORD (PlanetOffset, MoonOffset);
if (pSolarSysState->WaitIntersect != (COUNT)~0 if (pSolarSysState->WaitIntersect != (COUNT)~0
&& pSolarSysState->WaitIntersect != NewWaitPlanet) && pSolarSysState->WaitIntersect != NewWaitPlanet)
@@ -405,11 +405,11 @@ ShowPlanet:
} }
#ifdef DEBUG #ifdef DEBUG
printf ("Star index = %d, Planet index = %d, <%d, %d>\n", fprintf (stderr, "Star index = %d, Planet index = %d, <%d, %d>\n",
CurStarDescPtr - star_array, CurStarDescPtr - star_array,
pCurDesc - pSolarSysState->PlanetDesc, pCurDesc - pSolarSysState->PlanetDesc,
pSolarSysState->SunDesc[0].location.x, pSolarSysState->SunDesc[0].location.x,
pSolarSysState->SunDesc[0].location.y); pSolarSysState->SunDesc[0].location.y);
#endif /* DEBUG */ #endif /* DEBUG */
return; return;
} }
@@ -441,7 +441,7 @@ pSolarSysState->SunDesc[0].location.y);
if (DrawablesIntersect (&ShipIntersect, if (DrawablesIntersect (&ShipIntersect,
&PlanetIntersect, MAX_TIME_VALUE)) &PlanetIntersect, MAX_TIME_VALUE))
{ {
//printf ("1: Planet %d, Moon %d\n", PlanetOffset, MoonOffset); // fprintf (stderr, "1: Planet %d, Moon %d\n", PlanetOffset, MoonOffset);
NewWaitPlanet = MAKE_WORD (PlanetOffset, MoonOffset); NewWaitPlanet = MAKE_WORD (PlanetOffset, MoonOffset);
if (pSolarSysState->WaitIntersect == (COUNT)~0) if (pSolarSysState->WaitIntersect == (COUNT)~0)
@@ -1543,10 +1543,11 @@ GenerateRandomIP (BYTE control)
case GENERATE_ORBITAL: case GENERATE_ORBITAL:
{ {
#ifdef DEBUG #ifdef DEBUG
if (pSolarSysState->pOrbitalDesc->pPrevDesc == pSolarSysState->SunDesc) if (pSolarSysState->pOrbitalDesc->pPrevDesc ==
printf ("Planet index = %d\n", pSolarSysState->pOrbitalDesc - pSolarSysState->PlanetDesc); pSolarSysState->SunDesc)
else fprintf (stderr, "Planet index = %d\n", pSolarSysState->pOrbitalDesc - pSolarSysState->PlanetDesc);
printf ("Planet index = %d, Moon index = %d\n", else
fprintf (stderr, "Planet index = %d, Moon index = %d\n",
pSolarSysState->pOrbitalDesc->pPrevDesc - pSolarSysState->PlanetDesc, pSolarSysState->pOrbitalDesc->pPrevDesc - pSolarSysState->PlanetDesc,
pSolarSysState->pOrbitalDesc - pSolarSysState->MoonDesc); pSolarSysState->pOrbitalDesc - pSolarSysState->MoonDesc);
#endif /* DEBUG */ #endif /* DEBUG */
+4 -3
View File
@@ -73,7 +73,7 @@ CalcMineralDeposits (SYSTEM_INFOPTR SysInfoPtr, COUNT which_deposit)
); );
SysInfoPtr->PlanetInfo.CurType = eptr->ElementType; SysInfoPtr->PlanetInfo.CurType = eptr->ElementType;
#ifdef DEBUG #ifdef DEBUG
//printf ("\t\t%d units of %Fs\n", //fprintf (stderr, "\t\t%d units of %Fs\n",
// SysInfoPtr->PlanetInfo.CurDensity, // SysInfoPtr->PlanetInfo.CurDensity,
// Elements[eptr->ElementType].name); // Elements[eptr->ElementType].name);
#endif /* DEBUG */ #endif /* DEBUG */
@@ -236,8 +236,9 @@ CalcLifeForms (SYSTEM_INFOPTR SysInfoPtr, COUNT which_life)
} while (--num_types); } while (--num_types);
} }
#ifdef DEBUG #ifdef DEBUG
else else
printf ("It's dead, Jim! (%d >= %d)\n", life_var, SysInfoPtr->PlanetInfo.LifeChance); fprintf (stderr, "It's dead, Jim! (%d >= %d)\n", life_var,
SysInfoPtr->PlanetInfo.LifeChance);
#endif /* DEBUG */ #endif /* DEBUG */
} }
+16 -12
View File
@@ -226,7 +226,7 @@ CalcReduction (SIZE dx, SIZE dy)
#else #else
COUNT next_reduction; COUNT next_reduction;
#ifdef KDEBUG #ifdef KDEBUG
printf ("CalcReduction:\n"); fprintf (stderr, "CalcReduction:\n");
#endif #endif
if (LOBYTE (GLOBAL (CurrentActivity)) > IN_ENCOUNTER) if (LOBYTE (GLOBAL (CurrentActivity)) > IN_ENCOUNTER)
return (1 << ZOOM_SHIFT); return (1 << ZOOM_SHIFT);
@@ -252,7 +252,7 @@ printf ("CalcReduction:\n");
&& LOBYTE (GLOBAL (CurrentActivity)) == IN_LAST_BATTLE) && LOBYTE (GLOBAL (CurrentActivity)) == IN_LAST_BATTLE)
next_reduction = (2 << ZOOM_SHIFT); next_reduction = (2 << ZOOM_SHIFT);
#ifdef KDEBUG #ifdef KDEBUG
printf ("CalcReduction: exit\n"); fprintf (stderr, "CalcReduction: exit\n");
#endif #endif
#endif #endif
@@ -273,7 +273,7 @@ CalcView (PPOINT pNewScrollPt, register SIZE next_reduction,
VIEW_STATE view_state; VIEW_STATE view_state;
#ifdef KDEBUG #ifdef KDEBUG
printf ("CalcView:\n"); fprintf (stderr, "CalcView:\n");
#endif #endif
dx = ((COORD)(LOG_SPACE_WIDTH >> 1) - pNewScrollPt->x); dx = ((COORD)(LOG_SPACE_WIDTH >> 1) - pNewScrollPt->x);
dy = ((COORD)(LOG_SPACE_HEIGHT >> 1) - pNewScrollPt->y); dy = ((COORD)(LOG_SPACE_HEIGHT >> 1) - pNewScrollPt->y);
@@ -339,7 +339,7 @@ printf ("CalcView:\n");
*pdy = dy; *pdy = dy;
#ifdef KDEBUG #ifdef KDEBUG
printf ("CalcView: exit\n"); fprintf (stderr, "CalcView: exit\n");
#endif #endif
return (view_state); return (view_state);
} }
@@ -387,7 +387,8 @@ ProcessCollisions (HELEMENT hSuccElement, register ELEMENTPTR ElementPtr,
&& !((state_flags | test_state_flags) & FINITE_LIFE)) && !((state_flags | test_state_flags) & FINITE_LIFE))
{ {
#ifdef DEBUG #ifdef DEBUG
printf ("BAD NEWS 0x%x <--> 0x%x\n", ElementPtr, TestElementPtr); fprintf (stderr, "BAD NEWS 0x%x <--> 0x%x\n", ElementPtr,
TestElementPtr);
#endif /* DEBUG */ #endif /* DEBUG */
if (state_flags & COLLISION) if (state_flags & COLLISION)
{ {
@@ -508,7 +509,8 @@ printf ("BAD NEWS 0x%x <--> 0x%x\n", ElementPtr, TestElementPtr);
POINT SavePt, TestSavePt; POINT SavePt, TestSavePt;
#ifdef DEBUG #ifdef DEBUG
printf ("0x%x <--> 0x%x at %u\n", ElementPtr, TestElementPtr, time_val); fprintf (stderr, "0x%x <--> 0x%x at %u\n", ElementPtr,
TestElementPtr, time_val);
#endif /* DEBUG */ #endif /* DEBUG */
SavePt = ElementPtr->IntersectControl.EndPoint; SavePt = ElementPtr->IntersectControl.EndPoint;
TestSavePt = TestElementPtr->IntersectControl.EndPoint; TestSavePt = TestElementPtr->IntersectControl.EndPoint;
@@ -529,7 +531,8 @@ printf ("0x%x <--> 0x%x at %u\n", ElementPtr, TestElementPtr, time_val);
test_state_flags = TestElementPtr->state_flags; test_state_flags = TestElementPtr->state_flags;
#ifdef DEBUG #ifdef DEBUG
printf ("PROCESSING 0x%x <--> 0x%x at %u\n", ElementPtr, TestElementPtr, time_val); fprintf (stderr, "PROCESSING 0x%x <--> 0x%x at %u\n",
ElementPtr, TestElementPtr, time_val);
#endif /* DEBUG */ #endif /* DEBUG */
if (test_state_flags & PLAYER_SHIP) if (test_state_flags & PLAYER_SHIP)
{ {
@@ -629,7 +632,7 @@ PreProcessQueue (PSIZE pscroll_x, PSIZE pscroll_y)
COUNT ships_alive; COUNT ships_alive;
#ifdef KDEBUG #ifdef KDEBUG
printf ("PreProcess:\n"); fprintf (stderr, "PreProcess:\n");
#endif #endif
num_ships = (LOBYTE (battle_counter) ? 1 : 0) num_ships = (LOBYTE (battle_counter) ? 1 : 0)
+ (HIBYTE (battle_counter) ? 1 : 0); + (HIBYTE (battle_counter) ? 1 : 0);
@@ -733,7 +736,8 @@ printf ("PreProcess:\n");
#endif #endif
min_reduction = reduction; min_reduction = reduction;
} }
//printf ("dx = %d dy = %d min_red = %d max_red = %d\n", dx, dy, min_reduction, max_reduction); // fprintf (stderr, "dx = %d dy = %d min_red = %d max_red = %d\n",
// dx, dy, min_reduction, max_reduction);
} }
UnlockElement (hElement); UnlockElement (hElement);
@@ -753,7 +757,7 @@ printf ("PreProcess:\n");
#endif #endif
#ifdef KDEBUG #ifdef KDEBUG
printf ("PreProcess: exit\n"); fprintf (stderr, "PreProcess: exit\n");
#endif #endif
return (CalcView (&Origin, min_reduction, pscroll_x, pscroll_y, ships_alive)); return (CalcView (&Origin, min_reduction, pscroll_x, pscroll_y, ships_alive));
} }
@@ -808,7 +812,7 @@ PostProcessQueue (register VIEW_STATE view_state, register SIZE scroll_x,
register HELEMENT hElement; register HELEMENT hElement;
#ifdef KDEBUG #ifdef KDEBUG
printf ("PostProcess:\n"); fprintf (stderr, "PostProcess:\n");
#endif #endif
#ifdef OLD_ZOOM #ifdef OLD_ZOOM
reduction = (BYTE)(GLOBAL (cur_state) + ONE_SHIFT); reduction = (BYTE)(GLOBAL (cur_state) + ONE_SHIFT);
@@ -998,7 +1002,7 @@ printf ("PostProcess:\n");
hElement = hNextElement; hElement = hNextElement;
} }
#ifdef KDEBUG #ifdef KDEBUG
printf ("PostProcess: exit\n"); fprintf (stderr, "PostProcess: exit\n");
#endif #endif
} }
+4 -4
View File
@@ -292,11 +292,11 @@ RetrySave:
mem_release (h); mem_release (h);
FreeSC2Data (); FreeSC2Data ();
//printf ("Insufficient room for save buffers -- RETRYING\n"); // fprintf (stderr, "Insufficient room for save buffers -- RETRYING\n");
goto RetrySave; goto RetrySave;
} }
//else // else
//printf ("Insufficient room for save buffers -- GIVING UP!\n"); // fprintf (stderr, "Insufficient room for save buffers -- GIVING UP!\n");
} }
else else
{ {
@@ -437,7 +437,7 @@ RetrySave:
flen = cclose (fh); flen = cclose (fh);
sprintf (buf, "starcon2.%02u", which_game); sprintf (buf, "starcon2.%02u", which_game);
//printf ("'%s' is %lu bytes long\n", buf, flen + sizeof (*summary_desc)); // fprintf (stderr, "'%s' is %lu bytes long\n", buf, flen + sizeof (*summary_desc));
if (flen && (out_fp = (PVOID)OpenResFile (buf, "wb"))) if (flen && (out_fp = (PVOID)OpenResFile (buf, "wb")))
{ {
PrepareSummary (summary_desc); PrepareSummary (summary_desc);
+12 -10
View File
@@ -880,7 +880,7 @@ while (--ac > 0)
{ {
extern BOOLEAN StartGame (void); extern BOOLEAN StartGame (void);
printf("We've loaded the Kernel\n"); fprintf (stderr, "We've loaded the Kernel\n");
// OpenJournal (); // OpenJournal ();
while (StartGame ()) while (StartGame ())
@@ -936,19 +936,19 @@ sc = _simple_count;
ExploreSolarSys (); ExploreSolarSys ();
#ifdef TESTING #ifdef TESTING
if (!(GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD)) if (!(GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD))
&& GLOBAL_SIS (CrewEnlisted) != (COUNT)~0) && GLOBAL_SIS (CrewEnlisted) != (COUNT)~0)
{ {
if (!(GLOBAL (CurrentActivity) & START_ENCOUNTER) if (!(GLOBAL (CurrentActivity) & START_ENCOUNTER)
&& (CurStarDescPtr = FindStar (NULL_PTR, && (CurStarDescPtr = FindStar (NULL_PTR,
&GLOBAL (autopilot), 0, 0))) &GLOBAL (autopilot), 0, 0)))
{ {
GLOBAL (autopilot.x) = ~0; GLOBAL (autopilot.x) = ~0;
GLOBAL (autopilot.y) = ~0; GLOBAL (autopilot.y) = ~0;
GLOBAL (ShipStamp.frame) = 0; GLOBAL (ShipStamp.frame) = 0;
GLOBAL (CurrentActivity) |= START_INTERPLANETARY; GLOBAL (CurrentActivity) |= START_INTERPLANETARY;
} }
} }
#endif //TESTING #endif //TESTING
} }
else else
@@ -967,7 +967,9 @@ if (!(GLOBAL (CurrentActivity) & START_ENCOUNTER)
Task_SetState (ArilouTask, TASK_EXIT); Task_SetState (ArilouTask, TASK_EXIT);
} }
#ifdef TESTING #ifdef TESTING
if (_simple_count != sc) printf ("%d difference!\n", (int)_simple_count - (int)sc); if (_simple_count != sc)
fprintf (stderr, "%d difference!\n",
(int)_simple_count - (int)sc);
#endif //TESTING #endif //TESTING
SetSemaphore (GraphicsSem); SetSemaphore (GraphicsSem);
@@ -998,7 +1000,7 @@ if (_simple_count != sc) printf ("%d difference!\n", (int)_simple_count - (int)s
} }
else else
{ {
printf("Kernel failed to load!\n"); fprintf (stderr, "Kernel failed to load!\n");
} }
FreeKernel (); FreeKernel ();
+1 -1
View File
@@ -12,7 +12,7 @@ main (int argc, char *argv[])
{ {
COUNT sound_index; COUNT sound_index;
printf ("Sound #: "); fprintf (stderr, "Sound #: ");
if (fscanf (stdin, "%u", &sound_index) != 1) if (fscanf (stdin, "%u", &sound_index) != 1)
break; break;