diff --git a/sc2/src/sc2code/clock.c b/sc2/src/sc2code/clock.c index b4bfd3ba0..2c908fe09 100644 --- a/sc2/src/sc2code/clock.c +++ b/sc2/src/sc2code/clock.c @@ -222,7 +222,7 @@ SetGameClockRate (COUNT seconds_per_day) { 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)); new_day_in_ticks = (SIZE)(seconds_per_day * (ONE_SECOND / 5)); if (GLOBAL (GameClock.day_in_ticks) == 0) diff --git a/sc2/src/sc2code/collide.c b/sc2/src/sc2code/collide.c index f0a0faea6..a247b6f3a 100644 --- a/sc2/src/sc2code/collide.c +++ b/sc2/src/sc2code/collide.c @@ -56,11 +56,11 @@ collide (ELEMENTPTR ElementPtr0, ELEMENTPTR ElementPtr1) } #ifdef DEBUG -printf ("Centers: <%d, %d> <%d, %d>\n", -ElementPtr0->next.location.x, ElementPtr0->next.location.y, -ElementPtr1->next.location.x, ElementPtr1->next.location.y); -printf ("RelTravelAngle : %d, ImpactAngles <%d, %d>\n", -RelTravelAngle, ImpactAngle0, ImpactAngle1); + fprintf (stderr, "Centers: <%d, %d> <%d, %d>\n", + ElementPtr0->next.location.x, ElementPtr0->next.location.y, + ElementPtr1->next.location.x, ElementPtr1->next.location.y); + fprintf (stderr, "RelTravelAngle : %d, ImpactAngles <%d, %d>\n", + RelTravelAngle, ImpactAngle0, ImpactAngle1); #endif /* DEBUG */ if (ElementPtr0->next.location.x == ElementPtr0->current.location.x @@ -78,8 +78,8 @@ RelTravelAngle, ImpactAngle0, ImpactAngle1); ElementPtr0->state_flags |= (DEFY_PHYSICS | COLLISION); ElementPtr1->state_flags |= (DEFY_PHYSICS | COLLISION); #ifdef DEBUG -printf ("No movement before collision -- <(%d, %d) = %d, (%d, %d) = %d>\n", -dx0, dy0, ImpactAngle0 - OCTANT, dx1, dy1, ImpactAngle1 - OCTANT); + fprintf (stderr, "No movement before collision -- <(%d, %d) = %d, (%d, %d) = %d>\n", + dx0, dy0, ImpactAngle0 - OCTANT, dx1, dy1, ImpactAngle1 - OCTANT); #endif /* DEBUG */ } @@ -165,10 +165,10 @@ dx0, dy0, ImpactAngle0 - OCTANT, dx1, dy1, ImpactAngle1 - OCTANT); WORLD_TO_VELOCITY (SCALED_ONE) - 1)); } #ifdef DEBUG -GetCurrentVelocityComponents (&ElementPtr0->velocity, &dx0, &dy0); -GetCurrentVelocityComponents (&ElementPtr1->velocity, &dx1, &dy1); -printf ("After: <%d, %d> <%d, %d>\n\n", -dx0, dy0, dx1, dy1); + GetCurrentVelocityComponents (&ElementPtr0->velocity, &dx0, &dy0); + GetCurrentVelocityComponents (&ElementPtr1->velocity, &dx1, &dy1); + fprintf (stderr, "After: <%d, %d> <%d, %d>\n\n", + dx0, dy0, dx1, dy1); #endif /* DEBUG */ } } diff --git a/sc2/src/sc2code/comm/zoqfot/zoqfotc.c b/sc2/src/sc2code/comm/zoqfot/zoqfotc.c index d8da37a06..0ad0f8c03 100644 --- a/sc2/src/sc2code/comm/zoqfot/zoqfotc.c +++ b/sc2/src/sc2code/comm/zoqfot/zoqfotc.c @@ -378,9 +378,9 @@ ZoqFotIntro (RESPONSE_REF R) DISABLE_PHRASE (what_look_like); } -// printf ("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]); -// printf ("wll = 0x%x\n", what_look_like); +// fprintf (stderr, "yr = 0x%x wf = 0x%x\n", alien_text[your_race][0], alien_text[where_from][0]); +// fprintf (stderr, "we = 0x%x tl = 0x%x\n", alien_text[what_emergency][0], alien_text[tough_luck][0]); +// fprintf (stderr, "wll = 0x%x\n", what_look_like); if (PHRASE_ENABLED (your_race) || PHRASE_ENABLED (where_from) || PHRASE_ENABLED (what_emergency)) diff --git a/sc2/src/sc2code/cyborg.c b/sc2/src/sc2code/cyborg.c index 5693186ef..45ac837e2 100644 --- a/sc2/src/sc2code/cyborg.c +++ b/sc2/src/sc2code/cyborg.c @@ -289,7 +289,7 @@ InitCyborg (STARSHIPPTR StarShipPtr) COUNT Index, Divisor; #ifdef DEBUG -//turn_counter[which_ship] = 0; + //turn_counter[which_ship] = 0; #endif /* DEBUG */ Index = StarShipPtr->RaceDescPtr->characteristics.max_thrust @@ -300,21 +300,19 @@ InitCyborg (STARSHIPPTR StarShipPtr) else Index >>= 1; #ifdef PRINT_MI -{ -char buf[40]; + { + char buf[40]; -GetStringContents (StarShipPtr->RaceDescPtr->ship_data.race_strings, buf, FALSE); -printf ("MI(%s) -- <%u:%u> = %u\n", -buf, -StarShipPtr->RaceDescPtr->characteristics.max_thrust * -StarShipPtr->RaceDescPtr->characteristics.thrust_increment, -Divisor, -Index); -} + GetStringContents (StarShipPtr->RaceDescPtr->ship_data.race_strings, buf, FALSE); + fprintf (stderr, "MI(%s) -- <%u:%u> = %u\n", buf, + StarShipPtr->RaceDescPtr->characteristics.max_thrust * + StarShipPtr->RaceDescPtr->characteristics.thrust_increment, + Divisor, Index); + } #endif /* PRINT_MI */ StarShipPtr->RaceDescPtr->cyborg_control.ManeuverabilityIndex = Index; #ifdef DEBUG -//turn_counter[which_ship] = 0; + //turn_counter[which_ship] = 0; #endif /* DEBUG */ } diff --git a/sc2/src/sc2code/displist.c b/sc2/src/sc2code/displist.c index 5c4ac4224..b0b75e9d5 100644 --- a/sc2/src/sc2code/displist.c +++ b/sc2/src/sc2code/displist.c @@ -28,7 +28,7 @@ InitQueue (PQUEUE pq, COUNT num_elements, OBJ_SIZE size) return (TRUE); #else /* QUEUE_TABLE */ 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)) { do @@ -105,8 +105,8 @@ AllocLink (PQUEUE pq) UnlockLink (pq, hLink); } /* -else -printf ("No more elements\n"); + else + fprintf (stderr, "No more elements\n"); */ return (hLink); } diff --git a/sc2/src/sc2code/galaxy.c b/sc2/src/sc2code/galaxy.c index 38fc6ec79..15e4bbc74 100644 --- a/sc2/src/sc2code/galaxy.c +++ b/sc2/src/sc2code/galaxy.c @@ -228,7 +228,7 @@ InitGalaxy (void) PPOINT ppt; 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); factor = ONE_SHIFT + MAX_REDUCTION + (BACKGROUND_SHIFT - 3); diff --git a/sc2/src/sc2code/gravity.c b/sc2/src/sc2code/gravity.c index 9d976b5c4..d406a0a4b 100644 --- a/sc2/src/sc2code/gravity.c +++ b/sc2/src/sc2code/gravity.c @@ -57,25 +57,25 @@ CalculateGravity (PELEMENT ElementPtr) - TestElementPtr->next.location.y; } #if 0 //def DEBUG -if (TestElementPtr->state_flags & PLAYER_SHIP) -{ -printf ("CalculateGravity:\n"); -printf ("\tdx = %d, dy = %d\n", dx, dy); -} + if (TestElementPtr->state_flags & PLAYER_SHIP) + { + fprintf (stderr, "CalculateGravity:\n"); + fprintf (stderr, "\tdx = %d, dy = %d\n", dx, dy); + } #endif /* DEBUG */ dx = WRAP_DELTA_X (dx); dy = WRAP_DELTA_Y (dy); #if 0 //def DEBUG -if (TestElementPtr->state_flags & PLAYER_SHIP) -printf ("\twrap_dx = %d, wrap_dy = %d\n", dx, dy); + if (TestElementPtr->state_flags & PLAYER_SHIP) + fprintf (stderr, "\twrap_dx = %d, wrap_dy = %d\n", dx, dy); #endif /* DEBUG */ abs_dx = dx >= 0 ? dx : -dx; abs_dy = dy >= 0 ? dy : -dy; abs_dx = WORLD_TO_DISPLAY (abs_dx); abs_dy = WORLD_TO_DISPLAY (abs_dy); #if 0 //def DEBUG -if (TestElementPtr->state_flags & PLAYER_SHIP) -printf ("\tdisplay_dx = %d, display_dy = %d\n", abs_dx, abs_dy); + if (TestElementPtr->state_flags & PLAYER_SHIP) + fprintf (stderr, "\tdisplay_dx = %d, display_dy = %d\n", abs_dx, abs_dy); #endif /* DEBUG */ if (abs_dx <= 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 else if (magnitude > MAX_MAGNITUDE) magnitude = MAX_MAGNITUDE; -printf ("magnitude = %u ", magnitude); + fprintf (stderr, "magnitude = %u ", magnitude); #endif /* NEVER */ #if 0 //def DEBUG -if (TestElementPtr->state_flags & PLAYER_SHIP) -printf ("dist_squared = %lu\n", dist_squared); + if (TestElementPtr->state_flags & PLAYER_SHIP) + fprintf (stderr, "dist_squared = %lu\n", dist_squared); #endif /* DEBUG */ if (TestHasGravity) { diff --git a/sc2/src/sc2code/grpinfo.c b/sc2/src/sc2code/grpinfo.c index 5acc7df57..8e66c32bf 100644 --- a/sc2/src/sc2code/grpinfo.c +++ b/sc2/src/sc2code/grpinfo.c @@ -290,8 +290,8 @@ FlushGroupInfo (GROUP_HEADER *pGH, DWORD offset, BYTE which_group, PVOID SeekResFile (fp, offset, SEEK_SET); WriteResFile (pGH, sizeof (*pGH), 1, fp); #ifdef DEBUG -printf ("1)FlushGroupInfo(%lu): WG = %u(%lu), NG = %u, SI = %u\n", -offset, which_group, pGH->GroupOffset[which_group], pGH->NumGroups, pGH->star_index); + 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); #endif /* DEBUG */ 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); #ifdef DEBUG -if (which_group == 0) -printf ("F) type %u, loc %u<%d, %d>, task 0x%02x:%u\n", -RaceType, -GET_GROUP_LOC (FragPtr), -FragPtr->ShipInfo.loc.x, -FragPtr->ShipInfo.loc.y, -GET_GROUP_MISSION (FragPtr), -GET_GROUP_DEST (FragPtr)); + if (which_group == 0) + fprintf (stderr, "F) type %u, loc %u<%d, %d>, task 0x%02x:%u\n", + RaceType, + GET_GROUP_LOC (FragPtr), + FragPtr->ShipInfo.loc.x, + FragPtr->ShipInfo.loc.y, + GET_GROUP_MISSION (FragPtr), + GET_GROUP_DEST (FragPtr)); #endif /* DEBUG */ Ptr = (PBYTE)&FragPtr->RaceDescPtr; WriteResFile ((PBYTE)Ptr, @@ -361,7 +361,7 @@ GetGroupInfo (DWORD offset, BYTE which_group) SeekResFile (fp, offset, SEEK_SET); ReadResFile (&GH, sizeof (GH), 1, fp); #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 */ 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)); #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 */ day_index = GH.day_index; month_index = GH.month_index; @@ -382,9 +382,9 @@ printf ("%u == %u\n", GH.star_index, (COUNT)(CurStarDescPtr - star_array)); CloseResFile (fp); #ifdef DEBUG -if (GH.star_index == (COUNT)(CurStarDescPtr - star_array)) -printf ("GetGroupInfo: battle groups out of date %u/%u/%u!\n", -month_index, day_index, year_index); + if (GH.star_index == (COUNT)(CurStarDescPtr - star_array)) + fprintf (stderr, "GetGroupInfo: battle groups out of date %u/%u/%u!\n", + month_index, day_index, year_index); #endif /* DEBUG */ fp = OpenResFile (RANDGRPINFO_FILE, "wb"); GH.NumGroups = 0; @@ -471,15 +471,16 @@ month_index, day_index, year_index); SET_GROUP_LOC (FragPtr, group_loc); #ifdef DEBUG -printf ("battle group %u(0x%04x) strength %u, type %u, loc %u<%d, %d>, task %u\n", -which_group, -hStarShip, -NumShips, -RaceType, -group_loc, -FragPtr->ShipInfo.loc.x, -FragPtr->ShipInfo.loc.y, -task); + fprintf (stderr, "battle group %u(0x%04x) strength %u, " + "type %u, loc %u<%d, %d>, task %u\n", + which_group, + hStarShip, + NumShips, + RaceType, + group_loc, + FragPtr->ShipInfo.loc.x, + FragPtr->ShipInfo.loc.y, + task); #endif /* DEBUG */ UnlockStarShip ( &GLOBAL (npc_built_ship_q), hStarShip @@ -551,21 +552,21 @@ task); 1, fp); #ifdef DEBUG -if (which_group == 0) -printf ("G) type %u, loc %u<%d, %d>, task 0x%02x:%u\n", -RaceType, -GET_GROUP_LOC (FragPtr), -FragPtr->ShipInfo.loc.x, -FragPtr->ShipInfo.loc.y, -GET_GROUP_MISSION (FragPtr), -GET_GROUP_DEST (FragPtr)); + if (which_group == 0) + fprintf (stderr, "G) type %u, loc %u<%d, %d>, task 0x%02x:%u\n", + RaceType, + GET_GROUP_LOC (FragPtr), + FragPtr->ShipInfo.loc.x, + FragPtr->ShipInfo.loc.y, + GET_GROUP_MISSION (FragPtr), + GET_GROUP_DEST (FragPtr)); #endif /* DEBUG */ if (GET_GROUP_ID (FragPtr) != BaseGroup || which_group || ShipsLeft) { #ifdef DEBUG -printf ("\n"); + fprintf (stderr, "\n"); #endif /* DEBUG */ if (RaceType == SHOFIXTI_SHIP && which_group @@ -588,7 +589,7 @@ printf ("\n"); else { #ifdef DEBUG -printf (" -- REMOVING\n"); + fprintf (stderr, " -- REMOVING\n"); #endif /* DEBUG */ UnlockStarShip ( &GLOBAL (npc_built_ship_q), hStarShip @@ -659,7 +660,7 @@ PutGroupInfo (DWORD offset, BYTE which_group) } GH.star_index = CurStarDescPtr - star_array; #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, GH.month_index, GH.day_index, GH.year_index); #endif /* DEBUG */ diff --git a/sc2/src/sc2code/hyper.c b/sc2/src/sc2code/hyper.c index 6af264d5d..c7be4c067 100644 --- a/sc2/src/sc2code/hyper.c +++ b/sc2/src/sc2code/hyper.c @@ -230,7 +230,7 @@ percent = 0; GetStringContents (SetAbsStringTableIndex ( TemplatePtr->ShipInfo.race_strings, 1 ), (STRINGPTR)buf, FALSE); -// printf ("%s encounter\n", buf); +// fprintf (stderr, "%s encounter\n", buf); #endif /* DEBUG */ hEncounter = AllocEncounter (); if (hEncounter) diff --git a/sc2/src/sc2code/libs/decomp/lzdecode.c b/sc2/src/sc2code/libs/decomp/lzdecode.c index 5213ce286..0b90282ac 100644 --- a/sc2/src/sc2code/libs/decomp/lzdecode.c +++ b/sc2/src/sc2code/libs/decomp/lzdecode.c @@ -36,9 +36,9 @@ PBYTE _Stream; UWORD _workbuf; BYTE _workbuflen; +/* get one bit */ static SWORD -GetBit (/* get one bit */ - void) +GetBit (void) { SWORD i; diff --git a/sc2/src/sc2code/libs/graphics/cmap.c b/sc2/src/sc2code/libs/graphics/cmap.c index e1bce8903..413261066 100644 --- a/sc2/src/sc2code/libs/graphics/cmap.c +++ b/sc2/src/sc2code/libs/graphics/cmap.c @@ -58,7 +58,7 @@ int TFB_GetColorMapType () void TFB_ReleaseColorMap () { - //printf("TFB_ReleaseColorMap()\n"); + //fprintf (stderr, "TFB_ReleaseColorMap()\n"); has_colormap = FALSE; } @@ -168,7 +168,7 @@ SetColorMap (COLORMAPPTR map, int type) TFB_ColorMapToRGB (vp); 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; } @@ -198,7 +198,7 @@ int xform_clut_task (void *data) 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))); } diff --git a/sc2/src/sc2code/libs/graphics/intersec.c b/sc2/src/sc2code/libs/graphics/intersec.c index 949b44f61..d88908b24 100644 --- a/sc2/src/sc2code/libs/graphics/intersec.c +++ b/sc2/src/sc2code/libs/graphics/intersec.c @@ -332,12 +332,12 @@ DrawablesIntersect (PINTERSECT_CONTROL pControl0, ++time_x_1; #ifdef DEBUG -printf ("FramePtr0<%d, %d> --> <%d, %d>\nFramePtr1<%d, %d> --> <%d, %d>\n", -GetFrameWidth (FramePtr0), GetFrameHeight (FramePtr0), -r0.corner.x, r0.corner.y, -GetFrameWidth (FramePtr1), GetFrameHeight (FramePtr1), -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, "FramePtr0<%d, %d> --> <%d, %d>\nFramePtr1<%d, %d> --> <%d, %d>\n", + GetFrameWidth (FramePtr0), GetFrameHeight (FramePtr0), + r0.corner.x, r0.corner.y, + GetFrameWidth (FramePtr1), GetFrameHeight (FramePtr1), + r1.corner.x, r1.corner.y); + 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 */ 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 -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 */ if (time_y_0 <= time_y_1 && (intersect_time = frame_intersect ( diff --git a/sc2/src/sc2code/libs/graphics/sdl/3do_blt.c b/sc2/src/sc2code/libs/graphics/sdl/3do_blt.c index 17103428d..0aaf93967 100644 --- a/sc2/src/sc2code/libs/graphics/sdl/3do_blt.c +++ b/sc2/src/sc2code/libs/graphics/sdl/3do_blt.c @@ -33,7 +33,7 @@ blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr) SrcFramePtr = (PFRAME_DESC)PrimPtr->Object.Stamp.frame; if (SrcFramePtr->DataOffs == 0) { - printf ("Non-existent image to blt()\n"); + fprintf (stderr, "Non-existent image to blt()\n"); return; } @@ -97,7 +97,7 @@ blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr) } else { - printf("blt(): TFB_DisplayFormatAlpha failed\n"); + fprintf (stderr, "blt(): TFB_DisplayFormatAlpha failed\n"); img->ScaledImg = new_surf; } } @@ -114,7 +114,7 @@ blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr) } else { - printf("blt(): zoomSurface failed\n"); + fprintf (stderr, "blt(): zoomSurface failed\n"); } } } @@ -262,7 +262,7 @@ fillrect_blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr) static void cmap_blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr) { - printf ("Unimplemented function activated: cmap_blt()\n"); + fprintf (stderr, "Unimplemented function activated: cmap_blt()\n"); } static void @@ -313,7 +313,7 @@ read_screen (PRECT lpRect, FRAMEPTR DstFramePtr) ->FlagsAndIndex) & ((DWORD) MAPPED_TO_DISPLAY << FTYPE_SHIFT))) { - printf("Unimplemented function activated: read_screen()\n"); + fprintf (stderr, "Unimplemented function activated: read_screen()\n"); } else { diff --git a/sc2/src/sc2code/libs/graphics/sdl/3do_funcs.c b/sc2/src/sc2code/libs/graphics/sdl/3do_funcs.c index 4afb2f70c..dbd0b7037 100644 --- a/sc2/src/sc2code/libs/graphics/sdl/3do_funcs.c +++ b/sc2/src/sc2code/libs/graphics/sdl/3do_funcs.c @@ -91,14 +91,14 @@ void SetGraphicStrength (int numerator, int 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 void ScreenTransition (int TransType, PRECT pRect) //TransType==3 { - //printf ("Unimplemented function activated: ScreenTransition()\n"); + //fprintf (stderr, "Unimplemented function activated: ScreenTransition()\n"); } void @@ -139,7 +139,7 @@ LoadIntoExtraScreen (PRECT r) 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.Type = TFB_DRAWCOMMANDTYPE_COPYBACKBUFFERTOOTHERBUFFER; @@ -158,7 +158,7 @@ InitVideo (BOOLEAN useCDROM) //useCDROM doesn't really apply to us... { BOOLEAN ret; -// printf("Unimplemented function activated: InitVideo()\n"); +// fprintf (stderr, "Unimplemented function activated: InitVideo()\n"); ret = TRUE; return (ret); } @@ -167,14 +167,14 @@ InitVideo (BOOLEAN useCDROM) //useCDROM doesn't really apply to us... void UninitVideo () //empty { - // printf("Unimplemented function activated: UninitVideo()\n"); + // fprintf (stderr, "Unimplemented function activated: UninitVideo()\n"); } //Status: Unimplemented void VidStop() // At least this one makes sense. { - // printf ("Unimplemented function activated: VidStop()\n"); + // fprintf (stderr, "Unimplemented function activated: VidStop()\n"); } //Status: Unimplemented @@ -183,7 +183,7 @@ VidPlaying() // Easy enough. { MEM_HANDLE ret; - //printf("Unimplemented function activated: VidPlaying()\n"); + //fprintf (stderr, "Unimplemented function activated: VidPlaying()\n"); ret = 0; return (ret); } @@ -196,7 +196,7 @@ VidPlay (VIDEO_REF VidRef, char *loopname, BOOLEAN uninit) VIDEO_TYPE ret; ret = 0; -// printf("Unimplemented function activated: VidPlay()\n"); +// fprintf (stderr, "Unimplemented function activated: VidPlay()\n"); return (ret); } @@ -205,7 +205,7 @@ _init_video_file(PVOID pStr) { VIDEO_REF ret; - printf ("Unimplemented function activated: _init_video_file()\n"); + fprintf (stderr, "Unimplemented function activated: _init_video_file()\n"); ret = 0; return (ret); } @@ -217,7 +217,7 @@ _image_intersect (PIMAGE_BOX box1, PIMAGE_BOX box2, PRECT rect) { BOOLEAN ret; -// printf ("Unimplemented function activated: _image_intersect()\n"); +// fprintf (stderr, "Unimplemented function activated: _image_intersect()\n"); ret = TRUE; return (ret); } diff --git a/sc2/src/sc2code/libs/graphics/sdl/3do_getbody.c b/sc2/src/sc2code/libs/graphics/sdl/3do_getbody.c index 30e5d24dc..a22b76ddb 100644 --- a/sc2/src/sc2code/libs/graphics/sdl/3do_getbody.c +++ b/sc2/src/sc2code/libs/graphics/sdl/3do_getbody.c @@ -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); #if 0 - printf ("\thot[%d, %d], rect[%d, %d, %d, %d]\n", - hx, hy, - img[cel_ct]->clip_rect.x, - img[cel_ct]->clip_rect.y, - img[cel_ct]->clip_rect.w, - img[cel_ct]->clip_rect.h); + fprintf (stderr, "\thot[%d, %d], rect[%d, %d, %d, %d]\n", + hx, hy, + img[cel_ct]->clip_rect.x, img[cel_ct]->clip_rect.y, + img[cel_ct]->clip_rect.w, img[cel_ct]->clip_rect.h); #endif } @@ -257,7 +255,7 @@ _GetCelData (FILE *fp, DWORD length) { /*char fnamestr[1000]; sscanf(CurrentLine, "%s", fnamestr); - printf("imgload %s\n",fnamestr);*/ + fprintf (stderr, "imgload %s\n",fnamestr);*/ if ( @@ -269,8 +267,8 @@ _GetCelData (FILE *fp, DWORD length) ) ++cel_ct; else if (img[cel_ct]) -printf("_GetCelData: Bad file!\n"), - SDL_FreeSurface (img[cel_ct]); + fprintf (stderr, "_GetCelData: Bad file!\n"), + SDL_FreeSurface (img[cel_ct]); @@ -311,8 +309,9 @@ printf("_GetCelData: Bad file!\n"), } } -if (Drawable == 0) - printf ("Couldn't get cel data for '%s'\n", _cur_resfile_name); + if (Drawable == 0) + fprintf (stderr, "Couldn't get cel data for '%s'\n", + _cur_resfile_name); return (GetDrawableHandle (Drawable)); } diff --git a/sc2/src/sc2code/libs/graphics/sdl/dcqueue.c b/sc2/src/sc2code/libs/graphics/sdl/dcqueue.c index 48482ceb2..6e59a32fb 100644 --- a/sc2/src/sc2code/libs/graphics/sdl/dcqueue.c +++ b/sc2/src/sc2code/libs/graphics/sdl/dcqueue.c @@ -51,7 +51,7 @@ Lock_DCQ (void) DCQ_locking_thread = current_thread; } ++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 @@ -60,12 +60,12 @@ Unlock_DCQ (void) Uint32 current_thread = SDL_ThreadID (); 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 { --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) { DCQ_locking_thread = 0; @@ -162,7 +162,7 @@ TFB_DrawCommandQueue_Push (TFB_DrawCommandQueue* myQueue, } else { - printf("DCQ overload. Adjust your livelock deterrence constants!\n"); + fprintf (stderr, "DCQ overload. Adjust your livelock deterrence constants!\n"); } Unlock_DCQ (); @@ -181,7 +181,7 @@ TFB_DrawCommandQueue_Pop (TFB_DrawCommandQueue *myQueue, TFB_DrawCommand *target 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; Unlock_DCQ (); return (0); diff --git a/sc2/src/sc2code/libs/graphics/sdl/opengl.c b/sc2/src/sc2code/libs/graphics/sdl/opengl.c index f0a650930..acea91927 100644 --- a/sc2/src/sc2code/libs/graphics/sdl/opengl.c +++ b/sc2/src/sc2code/libs/graphics/sdl/opengl.c @@ -35,20 +35,20 @@ TFB_GL_InitGraphics (int driver, int flags, int width, int height, int bpp) GraphicsDriver = driver; - printf("Initializing SDL (OpenGL).\n"); + fprintf (stderr, "Initializing SDL (OpenGL).\n"); 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); } SDL_VideoDriverName (VideoName, sizeof (VideoName)); - printf("SDL driver used: %s\n", VideoName); + fprintf (stderr, "SDL driver used: %s\n", VideoName); atexit (SDL_Quit); - printf ("SDL initialized.\n"); - printf ("Initializing Screen.\n"); + fprintf (stderr, "SDL initialized.\n"); + fprintf (stderr, "Initializing Screen.\n"); ScreenWidth = 320; ScreenHeight = 240; @@ -57,7 +57,7 @@ TFB_GL_InitGraphics (int driver, int flags, int width, int height, int bpp) switch(bpp) { case 8: - printf("bpp of 8 not supported under OpenGL\n"); + fprintf (stderr, "bpp of 8 not supported under OpenGL\n"); exit(-1); case 15: @@ -97,19 +97,19 @@ TFB_GL_InitGraphics (int driver, int flags, int width, int height, int bpp) if (SDL_Video == NULL) { - printf ("Couldn't set OpenGL %ix%ix%i video mode: %s\n", - ScreenWidthActual, ScreenHeightActual, bpp, - SDL_GetError ()); + fprintf (stderr, "Couldn't set OpenGL %ix%ix%i video mode: %s\n", + ScreenWidthActual, ScreenHeightActual, bpp, + SDL_GetError ()); exit(-1); } else { - printf ("Set the resolution to: %ix%ix%i\n", - SDL_GetVideoSurface()->w, SDL_GetVideoSurface()->h, - SDL_GetVideoSurface()->format->BitsPerPixel); + fprintf (stderr, "Set the resolution to: %ix%ix%i\n", + SDL_GetVideoSurface()->w, SDL_GetVideoSurface()->h, + SDL_GetVideoSurface()->format->BitsPerPixel); - printf("OpenGL renderer: %s version: %s\n", glGetString(GL_RENDERER), - glGetString(GL_VERSION)); + fprintf (stderr, "OpenGL renderer: %s version: %s\n", + glGetString(GL_RENDERER), glGetString(GL_VERSION)); } SDL_Screen = SDL_CreateRGBSurface(SDL_SWSURFACE, ScreenWidth, ScreenHeight, 32, @@ -117,8 +117,8 @@ TFB_GL_InitGraphics (int driver, int flags, int width, int height, int bpp) if (SDL_Screen == NULL) { - printf("Couldn't create back buffer: %s\n", - SDL_GetError()); + fprintf (stderr, "Couldn't create back buffer: %s\n", + SDL_GetError()); exit(-1); } @@ -127,8 +127,8 @@ TFB_GL_InitGraphics (int driver, int flags, int width, int height, int bpp) if (ExtraScreen == NULL) { - printf("Couldn't create workspace buffer: %s\n", - SDL_GetError()); + fprintf (stderr, "Couldn't create workspace buffer: %s\n", + SDL_GetError()); exit(-1); } @@ -137,8 +137,8 @@ TFB_GL_InitGraphics (int driver, int flags, int width, int height, int bpp) if (format_conv_surf == NULL) { - printf("Couldn't create format_conv_surf: %s\n", - SDL_GetError()); + fprintf (stderr, "Couldn't create format_conv_surf: %s\n", + SDL_GetError()); exit(-1); } @@ -257,7 +257,7 @@ TFB_GL_SwapBuffers () glDisable(GL_TEXTURE_2D); 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 (); } diff --git a/sc2/src/sc2code/libs/graphics/sdl/pure.c b/sc2/src/sc2code/libs/graphics/sdl/pure.c index 7a220441e..302bf8aeb 100644 --- a/sc2/src/sc2code/libs/graphics/sdl/pure.c +++ b/sc2/src/sc2code/libs/graphics/sdl/pure.c @@ -34,25 +34,25 @@ TFB_Pure_InitGraphics (int driver, int flags, int width, int height, int bpp) GraphicsDriver = driver; - printf("Initializing SDL (pure).\n"); + fprintf (stderr, "Initializing SDL (pure).\n"); 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); } 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 // For Linux: x11 (default), dga, fbcon, directfb, svgalib, // ggi, aalib // For Windows: directx (default), windib atexit (SDL_Quit); - printf ("SDL initialized.\n"); + fprintf (stderr, "SDL initialized.\n"); - printf ("Initializing Screen.\n"); + fprintf (stderr, "Initializing Screen.\n"); ScreenWidth = 320; ScreenHeight = 240; @@ -71,7 +71,7 @@ TFB_Pure_InitGraphics (int driver, int flags, int width, int height, int bpp) ScreenHeightActual = 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; @@ -83,14 +83,14 @@ TFB_Pure_InitGraphics (int driver, int flags, int width, int height, int bpp) 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, SDL_GetError ()); exit(-1); } 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()->format->BitsPerPixel); @@ -101,7 +101,7 @@ TFB_Pure_InitGraphics (int driver, int flags, int width, int height, int bpp) 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); } @@ -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) { - 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); exit(-1); } diff --git a/sc2/src/sc2code/libs/graphics/sdl/sdl_common.c b/sc2/src/sc2code/libs/graphics/sdl/sdl_common.c index 393f057fa..ac53a07fb 100644 --- a/sc2/src/sc2code/libs/graphics/sdl/sdl_common.c +++ b/sc2/src/sc2code/libs/graphics/sdl/sdl_common.c @@ -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); #else 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); #endif } @@ -219,7 +219,7 @@ TFB_LoadImage (SDL_Surface *img) } else { - printf("TFB_LoadImage(): TFB_DisplayFormatAlpha failed\n"); + fprintf (stderr, "TFB_LoadImage(): TFB_DisplayFormatAlpha failed\n"); myImage->NormalImg = img; } } @@ -285,7 +285,7 @@ TFB_ComputeFPS () if (fps_counter > 1000) { 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; if (!livelock_deterrence && commands_handled + DrawCommandQueue->Size > DCQ_LIVELOCK_MAX) { - // printf("Initiating livelock deterrence!\n"); + // fprintf (stderr, "Initiating livelock deterrence!\n"); livelock_deterrence = TRUE; Lock_DCQ (); @@ -395,7 +395,7 @@ TFB_FlushGraphics () // Only call from main thread!! if (DC_image == 0) { - printf ("TFB_FlushGraphics(): error, DC_image == 0\n"); + fprintf (stderr, "TFB_FlushGraphics(): error, DC_image == 0\n"); break; } @@ -526,7 +526,7 @@ TFB_FlushGraphics () // Only call from main thread!! SDL_FreeSurface (DC_image->NormalImg); 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); } diff --git a/sc2/src/sc2code/libs/input/sdl/input.c b/sc2/src/sc2code/libs/input/sdl/input.c index 7c7eae37e..c63fa3f54 100644 --- a/sc2/src/sc2code/libs/input/sdl/input.c +++ b/sc2/src/sc2code/libs/input/sdl/input.c @@ -50,18 +50,18 @@ TFB_InitInput (int driver, int flags) 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); } - 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++) { - printf(" %s\n", SDL_JoystickName (i)); + fprintf (stderr, " %s\n", SDL_JoystickName (i)); } SDL_JoystickEventState (SDL_ENABLE); Joystick1 = SDL_JoystickOpen (0); @@ -198,7 +198,7 @@ ProcessJoystickEvent (const SDL_Event* Event) } 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) { @@ -278,7 +278,7 @@ UninitInput () // Looks like it'll be empty { BOOLEAN ret; - // printf("Unimplemented function activated: UninitInput()\n"); + // fprintf (stderr, "Unimplemented function activated: UninitInput()\n"); ret = TRUE; return (ret); } @@ -536,7 +536,7 @@ AnyButtonPress (BOOLEAN DetectSpecial) BOOLEAN _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); } @@ -639,74 +639,74 @@ INPUT_STATE _get_joystick_state (INPUT_REF ref, INPUT_STATE InputState) // 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]) { SetInputXComponent (&InputState, -1); -// printf ("LEFT!\n"); +// fprintf (stderr, "LEFT!\n"); KeyboardStroke[SDLK_LEFT] = FALSE; } if (KeyboardStroke[SDLK_RIGHT]) { SetInputXComponent (&InputState, 1); -// printf ("RIGHT!\n"); +// fprintf (stderr, "RIGHT!\n"); KeyboardStroke[SDLK_RIGHT] = FALSE; } if (KeyboardStroke[SDLK_UP]) { SetInputYComponent (&InputState, -1); -// printf ("UP!\n"); +// fprintf (stderr, "UP!\n"); KeyboardStroke[SDLK_UP] = FALSE; } if (KeyboardStroke[SDLK_DOWN]) { SetInputYComponent (&InputState, 1); -// printf ("DOWN!\n"); +// fprintf (stderr, "DOWN!\n"); KeyboardStroke[SDLK_DOWN] = FALSE; } if (KeyboardStroke[ControlA]) { InputState |= DEVICE_BUTTON1; -// printf("BUTTON1!\n"); +// fprintf (stderr, "BUTTON1!\n"); KeyboardStroke[ControlA]=FALSE; } if (KeyboardStroke[ControlB]) { InputState |= DEVICE_BUTTON2; -// printf ("BUTTON2!\n"); +// fprintf (stderr, "BUTTON2!\n"); KeyboardStroke[ControlB] = FALSE; } if (KeyboardStroke[ControlC]) { InputState |= DEVICE_BUTTON3; -// printf ("BUTTON3!\n"); +// fprintf (stderr, "BUTTON3!\n"); KeyboardStroke[ControlC] = FALSE; } if (KeyboardStroke[ControlX]) { InputState |= DEVICE_EXIT; -// printf ("BUTTONX!\n"); +// fprintf (stderr, "BUTTONX!\n"); KeyboardStroke[ControlX] = FALSE; } if (KeyboardStroke[ControlStart]) { InputState |= DEVICE_PAUSE; -// printf ("CONTROLSTART!\n"); +// fprintf (stderr, "CONTROLSTART!\n"); KeyboardStroke[ControlStart] = FALSE; } if (KeyboardStroke[ControlLeftShift]) { InputState |= DEVICE_LEFTSHIFT; -// printf ("LEFTSHIFT!\n"); +// fprintf (stderr, "LEFTSHIFT!\n"); KeyboardStroke[ControlLeftShift] = FALSE; } if (KeyboardStroke[ControlRightShift]) { InputState |= DEVICE_RIGHTSHIFT; -// printf ("RIGHTSHIFT!\n"); +// fprintf (stderr, "RIGHTSHIFT!\n"); KeyboardStroke[ControlRightShift] = FALSE; } @@ -721,69 +721,69 @@ _get_joystick_state (INPUT_REF ref, INPUT_STATE InputState) #if 0 if (ref == JoystickInput[1] && 0) { - //printf ("ref\n"); + //fprintf (stderr, "ref\n"); 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]) { SetInputXComponent (&InputState, -1); - //printf ("LEFT!\n"); + //fprintf (stderr, "LEFT!\n"); } if (KeyboardDown[SDLK_RIGHT]) { SetInputXComponent (&InputState, 1); - //printf ("RIGHT!\n"); + //fprintf (stderr, "RIGHT!\n"); } if (KeyboardDown[SDLK_UP]) { SetInputYComponent (&InputState, -1); - //printf ("UP!\n"); + //fprintf (stderr, "UP!\n"); } if (KeyboardDown[SDLK_DOWN]) { SetInputYComponent (&InputState, 1); - //printf ("DOWN!\n"); + //fprintf (stderr, "DOWN!\n"); } if (KeyboardDown[ControlA]) { InputState |= DEVICE_BUTTON1; - //printf ("BUTTON1!\n"); + //fprintf (stderr, "BUTTON1!\n"); } if (KeyboardDown[ControlB]) { InputState |= DEVICE_BUTTON2; - //printf ("BUTTON2!\n"); + //fprintf (stderr, "BUTTON2!\n"); } if (KeyboardDown[ControlC]) { InputState |= DEVICE_BUTTON3; - //printf ("BUTTON3!\n"); + //fprintf (stderr, "BUTTON3!\n"); } if (KeyboardDown[ControlX]) { InputState |= DEVICE_EXIT; - //printf ("BUTTONX!\n"); + //fprintf (stderr, "BUTTONX!\n"); } if (KeyboardDown[ControlStart]) { InputState |= DEVICE_PAUSE; - //printf ("CONTROLSTART!\n"); + //fprintf (stderr, "CONTROLSTART!\n"); } if (KeyboardDown[ControlLeftShift]) { InputState |= DEVICE_LEFTSHIFT; - //printf ("LEFTSHIFT!\n"); + //fprintf (stderr, "LEFTSHIFT!\n"); } if (KeyboardDown[ControlRightShift]) { InputState |= DEVICE_RIGHTSHIFT; - //printf ("RIGHTSHIFT!\n"); + //fprintf (stderr, "RIGHTSHIFT!\n"); } #endif diff --git a/sc2/src/sc2code/libs/memory/w_memlib.c b/sc2/src/sc2code/libs/memory/w_memlib.c index e6ab47753..473e520a9 100644 --- a/sc2/src/sc2code/libs/memory/w_memlib.c +++ b/sc2/src/sc2code/libs/memory/w_memlib.c @@ -92,10 +92,10 @@ static void Message(char *fmt, ...) vsprintf(buffer, fmt, ap); va_end(ap); - #ifndef FINAL - printf("%s\n", buffer); - //fflush(stdout); - #endif +#ifndef FINAL + fprintf (stderr, "%s\n", buffer); + //fflush (stderr); +#endif #if 0 if (GetToolFrame ()) @@ -147,10 +147,10 @@ static int MessageWithRetry(char *fmt, ...) vsprintf(buffer, fmt, ap); va_end(ap); - #ifndef FINAL - printf("%s\n", buffer); - //fflush(stdout); - #endif +#ifndef FINAL + fprintf (stderr, "%s\n", buffer); + // fflush(stderr); +#endif #if 0 if (GetToolFrame ()) @@ -254,8 +254,8 @@ MallocWithRetry(int bytes, char *diagStr) if (ptr) return (ptr); #ifndef FINAL -printf("Malloc failed for %s. #Bytes %d.\n", diagStr, bytes); -//fflush(stdout); + fprintf (stderr, "Malloc failed for %s. #Bytes %d.\n", diagStr, bytes); +// fflush (stderr); #endif /* 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?")) { /* User says "die". */ - printf ("Killed by the user (%s).\n", diagStr); + fprintf (stderr, "Killed by the user (%s).\n", diagStr); exit (0); } } @@ -299,13 +299,13 @@ mem_allocate (MEM_SIZE coreSize, MEM_FLAGS flags, MEM_PRIORITY priority, if (flags & MEM_ZEROINIT) memset (node->memory, 0, node->size); #ifdef LEAK_DEBUG -if (leak_debug) - printf ("alloc %d: %08x, %lu\n", (int) node->handle, (int) node->memory, - node->size); -if (node->handle == leak_idx && node->size == leak_size) - node = node; -if (node->size == leak_size) - node = node; + if (leak_debug) + fprintf (stderr, "alloc %d: %08x, %lu\n", (int) node->handle, + (int) node->memory, node->size); + if (node->handle == leak_idx && node->size == leak_size) + node = node; + if (node->size == leak_size) + node = node; #endif /* LEAK_DEBUG */ ClearSemaphore (_MemorySem); @@ -431,9 +431,10 @@ mem_uninit(void) { if (extents[i].handle != -1) { -printf ("LEAK: unreleased extent %d: %08x, %lu\n", - extents[i].handle, (unsigned int) extents[i].memory, extents[i].size); -fflush (stdout); + fprintf (stderr, "LEAK: unreleased extent %d: %08x, %lu\n", + extents[i].handle, (unsigned int) extents[i].memory, + extents[i].size); + fflush (stderr); extents[i].handle = -1; if (extents[i].memory) { @@ -482,14 +483,15 @@ mem_release(MEM_HANDLE h) --h; 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) - 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) { #ifdef LEAK_DEBUG -if (leak_debug) printf ("free %d: %08x\n", - extents[h].handle, (unsigned int) extents[h].memory); + if (leak_debug) + fprintf (stderr, "free %d: %08x\n", + extents[h].handle, (unsigned int) extents[h].memory); #endif if (extents[h].memory) { diff --git a/sc2/src/sc2code/libs/resource/filecntl.c b/sc2/src/sc2code/libs/resource/filecntl.c index abf5dcee6..259247be8 100644 --- a/sc2/src/sc2code/libs/resource/filecntl.c +++ b/sc2/src/sc2code/libs/resource/filecntl.c @@ -133,9 +133,9 @@ if (fp == (FILE *)~0) #else { struct stat sb; - if (fstat(fileno(fp), &sb) == -1) - return 1; - return sb.st_size; + if (fstat(fileno(fp), &sb) == -1) + return 1; + return sb.st_size; } #endif } diff --git a/sc2/src/sc2code/libs/resource/getres.c b/sc2/src/sc2code/libs/resource/getres.c index f0e97dddd..adbe44a23 100644 --- a/sc2/src/sc2code/libs/resource/getres.c +++ b/sc2/src/sc2code/libs/resource/getres.c @@ -173,12 +173,13 @@ load_package (INDEX_HEADERPTR ResHeaderPtr, RES_PACKAGE res_package) if ((hList = AllocResourceHandleList ( num_types, num_instances )) == NULL_HANDLE) -{ + { #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 */ return (NULL_HANDLE); -} + } LockResourceHandleList (ResHeaderPtr, hList, res_package, &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)) DanglingOpen = FALSE; #ifdef DEBUG -if (hData == 0) -printf ("fp = 0x%08lx(%d), type = %u, file_offs = %lu, len = %lu\n", fp, DanglingOpen, type, file_offs, data_len); + if (hData == 0) + fprintf (stderr, "fp = 0x%08lx(%d), type = %u, " + "file_offs = %lu, len = %lu\n", fp, + DanglingOpen, type, file_offs, data_len); #endif /* DEBUG */ } 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"); if (fp == NULL) + { #if 1 // def DEBUG -printf ("Can't open '%s'\n", file_buf) + fprintf (stderr, "Can't open '%s'\n", file_buf); #endif /* DEBUG */ - ; + } else { data_len = LengthResFile (fp); #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 */ if (data_len == 0) hData = NULL_HANDLE; @@ -316,7 +321,9 @@ printf ("\t'%s' -- %lu bytes\n", file_buf, data_len); } } #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 */ 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) { #ifdef DEBUG -printf ("Nothing in package!\n"); + fprintf (stderr, "Nothing in package!\n"); #endif /* DEBUG */ FreeResourceHandleList (hList); hList = NULL_HANDLE; @@ -364,12 +371,13 @@ GetResource (RESOURCE res) ResHeaderPtr = _get_current_index_header (); if (!ValidResource (ResHeaderPtr, res)) -{ + { #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 */ return (NULL_HANDLE); -} + } res_package = GET_PACKAGE (res); @@ -380,12 +388,12 @@ if (res) printf ("0x%08lx is not a valid resource!\n", res); else { if ((hList = load_package (ResHeaderPtr, res_package)) == NULL_HANDLE) -{ + { #ifdef DEBUG -printf ("Unable to load package %u\n", res_package); + fprintf (stderr, "Unable to load package %u\n", res_package); #endif /* DEBUG */ return (NULL_HANDLE); -} + } ResHeaderPtr->PackageList[res_package - 1].flags_and_data_loc = MAKE_DWORD (hList, 0); @@ -407,7 +415,8 @@ printf ("Unable to load package %u\n", res_package); UnlockResourceHandleList (hList); #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 */ return (hData); } diff --git a/sc2/src/sc2code/libs/resource/resinit.c b/sc2/src/sc2code/libs/resource/resinit.c index d2b82bb19..c043551f9 100644 --- a/sc2/src/sc2code/libs/resource/resinit.c +++ b/sc2/src/sc2code/libs/resource/resinit.c @@ -320,31 +320,31 @@ CloseResourceIndex (MEM_HANDLE hRH) ResHeaderPtr = LockResourceHeader (hRH); #ifdef DEBUG -{ -COUNT i; + { + COUNT i; -for (i = 0; i < ResHeaderPtr->num_packages; ++i) -{ - UWORD hi; + for (i = 0; i < ResHeaderPtr->num_packages; ++i) + { + UWORD hi; - hi = HIWORD (ResHeaderPtr->PackageList[i].flags_and_data_loc); - if (HIBYTE (hi) == 0) - { - MEM_HANDLE hList; - RES_HANDLE_LISTPTR ResourceHandleListPtr; - ENCODEPTR TypeEncodePtr; - DATAPTR DataPtr; + hi = HIWORD (ResHeaderPtr->PackageList[i].flags_and_data_loc); + if (HIBYTE (hi) == 0) + { + MEM_HANDLE hList; + RES_HANDLE_LISTPTR ResourceHandleListPtr; + ENCODEPTR TypeEncodePtr; + DATAPTR DataPtr; - hList = (MEM_HANDLE)LOWORD ( - ResHeaderPtr->PackageList[i].flags_and_data_loc); - LockResourceHandleList (ResHeaderPtr, hList, i + 1, - &ResourceHandleListPtr, &TypeEncodePtr, &DataPtr); - printf ("Package %u has %u instances left\n", - i + 1, ResourceHandleListPtr->num_valid_handles); - UnlockResourceHandleList (hList); - } -} -} + hList = (MEM_HANDLE)LOWORD ( + ResHeaderPtr->PackageList[i].flags_and_data_loc); + LockResourceHandleList (ResHeaderPtr, hList, i + 1, + &ResourceHandleListPtr, &TypeEncodePtr, &DataPtr); + fprintf (stderr, "Package %u has %u instances left\n", + i + 1, ResourceHandleListPtr->num_valid_handles); + UnlockResourceHandleList (hList); + } + } + } #endif /* DEBUG */ _sub_index_list (hRH); diff --git a/sc2/src/sc2code/libs/sound/sdl/modfuncs.c b/sc2/src/sc2code/libs/sound/sdl/modfuncs.c index 8b5cb99a0..1e1fe557c 100644 --- a/sc2/src/sc2code/libs/sound/sdl/modfuncs.c +++ b/sc2/src/sc2code/libs/sound/sdl/modfuncs.c @@ -78,7 +78,7 @@ _GetSoundBankData (FILE *fp, DWORD length) } else { - printf("_GetSoundBankData: Bad file!\n"); + fprintf (stderr, "_GetSoundBankData: Bad file!\n"); } if (ftell (fp) - opos >= length) diff --git a/sc2/src/sc2code/libs/sound/sdl/sound.c b/sc2/src/sc2code/libs/sound/sdl/sound.c index 50cfd2c53..bc6dcc5d0 100644 --- a/sc2/src/sc2code/libs/sound/sdl/sound.c +++ b/sc2/src/sc2code/libs/sound/sdl/sound.c @@ -32,13 +32,13 @@ TFB_InitSound (int driver, int flags, int frequency) 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); } if (Mix_OpenAudio(frequency, AUDIO_S16, 2, 4096)) { - printf ("Unable to open audio!\n"); + fprintf (stderr, "Unable to open audio!\n"); exit (-1); } @@ -47,16 +47,16 @@ TFB_InitSound (int driver, int flags, int frequency) SDL_AudioDriverName (SoundcardName, sizeof (SoundcardName)); 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, audio_channels > 1 ? "stereo" : "mono", 4096); 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.minor, 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()->minor, Mix_Linked_Version()->patch); @@ -95,7 +95,7 @@ GetSoundData(char* data) //Returns the data size. { int ret; - printf("Unimplemented function activated: GetSoundData()\n"); + fprintf (stderr, "Unimplemented function activated: GetSoundData()\n"); ret = 0; return (ret); } @@ -107,7 +107,7 @@ GetSoundInfo(int* length, int* offset) { int ret; - printf ("Unimplemented function activated: GetSoundInfo()\n"); + fprintf (stderr, "Unimplemented function activated: GetSoundInfo()\n"); ret = 0; return (ret); } @@ -117,7 +117,7 @@ BOOLEAN ChannelPlaying(COUNT WhichChannel) // 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)); } @@ -167,7 +167,7 @@ GetSampleLength (SOUND sound) Chunk = (Mix_Chunk *) sound; ret = 0; // Chunk->alen; -// printf ("Maybe Implemented function activated: GetSampleLength()\n"); +// fprintf (stderr, "Maybe Implemented function activated: GetSampleLength()\n"); return(ret); } @@ -176,7 +176,7 @@ void SetChannelRate (COUNT channel, DWORD rate_hz, unsigned char priority) // in hz { -// printf ("Unimplemented function activated: SetChannelRate()\n"); +// fprintf (stderr, "Unimplemented function activated: SetChannelRate()\n"); } // Status: Unimplemented @@ -185,7 +185,7 @@ GetSampleRate (SOUND sound) { COUNT ret; -// printf("Unimplemented function activated: GetSampleRate()\n"); +// fprintf (stderr, "Unimplemented function activated: GetSampleRate()\n"); ret=0; return(ret); } @@ -196,7 +196,7 @@ SetChannelVolume (COUNT channel, COUNT volume, BYTE priority) // I wonder what this whole priority business is... // I can probably ignore it. { -// printf ("Unimplemented function activated: SetChannelVolume()\n"); +// fprintf (stderr, "Unimplemented function activated: SetChannelVolume()\n"); } //Status: Ignored @@ -206,7 +206,7 @@ InitSound (int argc, char* argv[]) { BOOLEAN ret; -// printf("Unimplemented function activated: InitSound()\n"); +// fprintf (stderr, "Unimplemented function activated: InitSound()\n"); ret = TRUE; return (ret); } @@ -215,7 +215,7 @@ InitSound (int argc, char* argv[]) void UninitSound () //Maybe I should call StopSound() first? { - //printf("Unimplemented function activated: UninitSound()\n"); +// fprintf (stderr, "Unimplemented function activated: UninitSound()\n"); } #endif diff --git a/sc2/src/sc2code/load.c b/sc2/src/sc2code/load.c index 5bf65f7a4..b8dad0974 100644 --- a/sc2/src/sc2code/load.c +++ b/sc2/src/sc2code/load.c @@ -152,7 +152,7 @@ LoadGame (COUNT which_game, SUMMARY_DESC *summary_desc) cread ((PBYTE)&num_links, sizeof (num_links), 1, fh); { #ifdef DEBUG -printf ("EVENTS:\n"); + fprintf (stderr, "EVENTS:\n"); #endif /* DEBUG */ while (num_links--) { @@ -165,11 +165,11 @@ printf ("EVENTS:\n"); cread ((PBYTE)EventPtr, sizeof (*EventPtr), 1, fh); #ifdef DEBUG -printf ("\t%u/%u/%u -- %u\n", -EventPtr->month_index, -EventPtr->day_index, -EventPtr->year_index, -EventPtr->func_index); + fprintf (stderr, "\t%u/%u/%u -- %u\n", + EventPtr->month_index, + EventPtr->day_index, + EventPtr->year_index, + EventPtr->func_index); #endif /* DEBUG */ UnlockEvent (hEvent); PutEvent (hEvent); diff --git a/sc2/src/sc2code/planets/calc.c b/sc2/src/sc2code/planets/calc.c index eea9aa551..b56a6242e 100644 --- a/sc2/src/sc2code/planets/calc.c +++ b/sc2/src/sc2code/planets/calc.c @@ -232,26 +232,27 @@ DoPlanetaryAnalysis (SYSTEM_INFOPTR SysInfoPtr, PPLANET_DESC CalcSysInfo (SysInfoPtr); #ifdef DEBUG -{ - BYTE ColorClass[6][8] = { - "Red", - "Orange", - "Yellow", - "Green", - "Blue", - "White", - } ; - BYTE SizeName[3][12] = { - "Dwarf", - "Giant", - "Supergiant", - }; + { + BYTE ColorClass[6][8] = { + "Red", + "Orange", + "Yellow", + "Green", + "Blue", + "White", + }; + BYTE SizeName[3][12] = { + "Dwarf", + "Giant", + "Supergiant", + }; - printf ("%s %s\n", + fprintf (stderr, "%s %s\n", ColorClass[SysInfoPtr->StarIntensity], SizeName[SysInfoPtr->StarSize]); - printf ("Stellar Energy: %d (sol = 3)\n", SysInfoPtr->StarEnergy); -} + fprintf (stderr, "Stellar Energy: %d (sol = 3)\n", + SysInfoPtr->StarEnergy); + } #endif /* DEBUG */ { @@ -331,62 +332,62 @@ DoPlanetaryAnalysis (SYSTEM_INFOPTR SysInfoPtr, PPLANET_DESC #ifdef DEBUG radius = (SIZE)((DWORD)UNSCALE_RADIUS (radius) * 100 / UNSCALE_RADIUS (EARTH_RADIUS)); - printf ("\tOrbital Distance : %d.%02d AU\n", radius / 100, radius % 100); - //printf ("\tPlanetary Mass : %d.%02d Earth masses\n", + fprintf (stderr, "\tOrbital Distance : %d.%02d AU\n", radius / 100, radius % 100); + //fprintf (stderr, "\tPlanetary Mass : %d.%02d Earth masses\n", // 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); - printf ("\tSurface Gravity: %d.%02d gravities\n", + fprintf (stderr, "\tSurface Gravity: %d.%02d gravities\n", 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 ); - printf ("\tAxial Tilt : %d degrees\n", + fprintf (stderr, "\tAxial Tilt : %d degrees\n", abs (SysInfoPtr->PlanetInfo.AxialTilt)); - printf ("\tTectonics : Class %u\n", + fprintf (stderr, "\tTectonics : Class %u\n", SysInfoPtr->PlanetInfo.Tectonics + 1); - printf ("\tAtmospheric Density: %u.%02u ", + fprintf (stderr, "\tAtmospheric Density: %u.%02u ", SysInfoPtr->PlanetInfo.AtmoDensity / EARTH_ATMOSPHERE, (SysInfoPtr->PlanetInfo.AtmoDensity * 100 / EARTH_ATMOSPHERE) % 100); if (SysInfoPtr->PlanetInfo.AtmoDensity == 0) { - printf ("(Vacuum)\n"); + fprintf (stderr, "(Vacuum)\n"); } else if (SysInfoPtr->PlanetInfo.AtmoDensity < THIN_ATMOSPHERE) { - printf ("(Thin)\n"); + fprintf (stderr, "(Thin)\n"); } else if (SysInfoPtr->PlanetInfo.AtmoDensity < NORMAL_ATMOSPHERE) { - printf ("(Normal)\n"); + fprintf (stderr, "(Normal)\n"); } else if (SysInfoPtr->PlanetInfo.AtmoDensity < THICK_ATMOSPHERE) { - printf ("(Thick)\n"); + fprintf (stderr, "(Thick)\n"); } else if (SysInfoPtr->PlanetInfo.AtmoDensity < SUPER_THICK_ATMOSPHERE) { - printf ("(Super thick)\n"); + fprintf (stderr, "(Super thick)\n"); } 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); 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); } 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); } diff --git a/sc2/src/sc2code/planets/orbits.c b/sc2/src/sc2code/planets/orbits.c index de9db15a1..0db400631 100644 --- a/sc2/src/sc2code/planets/orbits.c +++ b/sc2/src/sc2code/planets/orbits.c @@ -499,10 +499,10 @@ char scolor[] = {'B', 'G', 'O', 'R', 'W', 'Y'}; } #ifdef DEBUG -GetClusterName (CurStarDescPtr, buf); -printf ("cluster name = %s color = %c type = %c\n", buf, - scolor[STAR_COLOR (CurStarDescPtr->Type)], - stype[STAR_TYPE (CurStarDescPtr->Type)]); + GetClusterName (CurStarDescPtr, buf); + fprintf (stderr, "cluster name = %s color = %c type = %c\n", buf, + scolor[STAR_COLOR (CurStarDescPtr->Type)], + stype[STAR_TYPE (CurStarDescPtr->Type)]); #endif /* DEBUG */ GeneratingMoons = (BOOLEAN) (pBaseDesc == pSolarSysState->MoonDesc); if (GeneratingMoons) diff --git a/sc2/src/sc2code/planets/pl_stuff.c b/sc2/src/sc2code/planets/pl_stuff.c index 1d5c7323b..92d24f1c8 100644 --- a/sc2/src/sc2code/planets/pl_stuff.c +++ b/sc2/src/sc2code/planets/pl_stuff.c @@ -238,12 +238,12 @@ build_steps () ystep[i] = 1; #if 0 -y = 0; -for (i = 0; y < (HEIGHT >> 1); i++) -{ - printf ("ystep[%ld] = %ld\n", i, ystep[i]); - y += ystep[i]; -} + y = 0; + for (i = 0; y < (HEIGHT >> 1); i++) + { + fprintf (stderr, "ystep[%ld] = %ld\n", i, ystep[i]); + y += ystep[i]; + } #endif } @@ -286,9 +286,9 @@ build_tables (int da) y += h; #if 0 -printf ("%ld: %ld ", i, y); -printf ("%ld,%ld -- ", x0[i] >> 16, y0[i] >> 16); -printf ("%ld,%ld\n", x1[i] >> 16, y1[i] >> 16); + fprintf (stderr, "%ld: %ld ", i, y); + fprintf (stderr, "%ld,%ld -- ", x0[i] >> 16, y0[i] >> 16); + fprintf (stderr, "%ld,%ld\n", x1[i] >> 16, y1[i] >> 16); #endif } @@ -431,7 +431,7 @@ init_rotate_cels () } } #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 @@ -515,9 +515,11 @@ RotatePlanet (int x, int dx, int dy) #endif add_cel (pblack_circ_ccb); #ifdef KDEBUG -printf ("CLEAR...\n"); -while (AnyButtonPress (FALSE)); -while (!AnyButtonPress (FALSE)); + fprintf (stderr, "CLEAR...\n"); + while (AnyButtonPress (FALSE)) + ; + while (!AnyButtonPress (FALSE)) + ; #endif /* KDEBUG */ } @@ -558,9 +560,11 @@ while (!AnyButtonPress (FALSE)); add_cels (first, cur_ccb - 1); #ifdef KDEBUG -printf ("PLANET...\n"); -while (AnyButtonPress (FALSE)); -while (!AnyButtonPress (FALSE)); + fprintf (stderr, "PLANET...\n"); + while (AnyButtonPress (FALSE)) + ; + while (!AnyButtonPress (FALSE)) + ; #endif /* KDEBUG */ if (pcirc_ccb) { @@ -574,9 +578,11 @@ while (!AnyButtonPress (FALSE)); #endif add_cel (pcirc_ccb); #ifdef KDEBUG -printf ("CLIP...\n"); -while (AnyButtonPress (FALSE)); -while (!AnyButtonPress (FALSE)); + fprintf (stderr, "CLIP...\n"); + while (AnyButtonPress (FALSE)) + ; + while (!AnyButtonPress (FALSE)) + ; #endif /* KDEBUG */ } @@ -592,9 +598,11 @@ while (!AnyButtonPress (FALSE)); #endif add_cel (pblur_ccb); #ifdef KDEBUG -printf ("BLUR...\n"); -while (AnyButtonPress (FALSE)); -while (!AnyButtonPress (FALSE)); + fprintf (stderr, "BLUR...\n"); + while (AnyButtonPress (FALSE)) + ; + while (!AnyButtonPress (FALSE)) + ; #endif /* KDEBUG */ } @@ -610,9 +618,11 @@ while (!AnyButtonPress (FALSE)); #endif add_cel (pshadow_ccb); #ifdef KDEBUG -printf ("SHADOW...\n"); -while (AnyButtonPress (FALSE)); -while (!AnyButtonPress (FALSE)); + fprintf (stderr, "SHADOW...\n"); + while (AnyButtonPress (FALSE)) + ; + while (!AnyButtonPress (FALSE)) + ; #endif /* KDEBUG */ } @@ -641,10 +651,13 @@ while (!AnyButtonPress (FALSE)); add_cel (pshield_ccb); #ifdef KDEBUG -printf ("SHIELD...\n"); -while (AnyButtonPress (FALSE)); -while (!AnyButtonPress (FALSE)); -while (AnyButtonPress (FALSE)); + fprintf (stderr, "SHIELD...\n"); + while (AnyButtonPress (FALSE)) + ; + while (!AnyButtonPress (FALSE)) + ; + while (AnyButtonPress (FALSE)) + ; #endif /* KDEBUG */ } diff --git a/sc2/src/sc2code/planets/planscan.c b/sc2/src/sc2code/planets/planscan.c index e2d65cf16..cc578a147 100644 --- a/sc2/src/sc2code/planets/planscan.c +++ b/sc2/src/sc2code/planets/planscan.c @@ -232,12 +232,13 @@ SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x1F, 0xA, 0xA), 0x0C)); ++pscan_block->num_same_scans; } #ifdef DEBUG -printf ("<%d, %d>-<%d, %d>, %d, %d, %u%s\n", -scan_array->start.x, scan_array->start.y, -scan_array->end.x, scan_array->end.y, -scan_array->xerror, scan_array->yerror, -scan_array->num_dots & ~SAME_SCAN, -(scan_array->num_dots & SAME_SCAN) ? ", SAME SCAN" : ""); + fprintf (stderr, "<%d, %d>-<%d, %d>, %d, %d, %u%s\n", + scan_array->start.x, scan_array->start.y, + scan_array->end.x, scan_array->end.y, + scan_array->xerror, scan_array->yerror, + scan_array->num_dots & ~SAME_SCAN, + (scan_array->num_dots & SAME_SCAN) ? + ", SAME SCAN" : ""); #endif /* DEBUG */ ++scan_array; @@ -274,12 +275,12 @@ DrawPoint (&pt); ++pscan_block->num_same_scans; } #ifdef DEBUG -printf ("<%d, %d>-<%d, %d>, %d, %d, %u\n", -scan_array->start.x, scan_array->start.y, -scan_array->end.x, scan_array->end.y, -scan_array->xerror, scan_array->yerror, -scan_array->num_dots & ~SAME_SCAN, -(scan_array->num_dots & SAME_SCAN) ? ", SAME SCAN" : ""); + fprintf (stderr, "<%d, %d>-<%d, %d>, %d, %d, %u\n", + scan_array->start.x, scan_array->start.y, + scan_array->end.x, scan_array->end.y, + scan_array->xerror, scan_array->yerror, + scan_array->num_dots & ~SAME_SCAN, + (scan_array->num_dots & SAME_SCAN) ? ", SAME SCAN" : ""); #endif /* DEBUG */ ++scan_array; } @@ -296,12 +297,12 @@ scan_array->num_dots & ~SAME_SCAN, pscan_block->num_scans = (COUNT)(scan_array - pscan_block->scan_base); #ifdef DEBUG -{ -extern DWORD AnyButtonPress (BOOLEAN CheckSpecial); -printf ("num_scans = %u\n", pscan_block->num_scans); -while (!AnyButtonPress (TRUE)) - ; -} + { + extern DWORD AnyButtonPress (BOOLEAN CheckSpecial); + fprintf (stderr, "num_scans = %u\n", pscan_block->num_scans); + while (!AnyButtonPress (TRUE)) + ; + } #endif /* DEBUG */ } diff --git a/sc2/src/sc2code/planets/solarsys.c b/sc2/src/sc2code/planets/solarsys.c index 59ae21515..16ec823bb 100644 --- a/sc2/src/sc2code/planets/solarsys.c +++ b/sc2/src/sc2code/planets/solarsys.c @@ -389,7 +389,7 @@ CheckIntersect (BOOLEAN just_checking) { PlanetOffset = pCurDesc - pSolarSysState->PlanetDesc + 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); if (pSolarSysState->WaitIntersect != (COUNT)~0 && pSolarSysState->WaitIntersect != NewWaitPlanet) @@ -405,11 +405,11 @@ ShowPlanet: } #ifdef DEBUG -printf ("Star index = %d, Planet index = %d, <%d, %d>\n", -CurStarDescPtr - star_array, -pCurDesc - pSolarSysState->PlanetDesc, -pSolarSysState->SunDesc[0].location.x, -pSolarSysState->SunDesc[0].location.y); + fprintf (stderr, "Star index = %d, Planet index = %d, <%d, %d>\n", + CurStarDescPtr - star_array, + pCurDesc - pSolarSysState->PlanetDesc, + pSolarSysState->SunDesc[0].location.x, + pSolarSysState->SunDesc[0].location.y); #endif /* DEBUG */ return; } @@ -441,7 +441,7 @@ pSolarSysState->SunDesc[0].location.y); if (DrawablesIntersect (&ShipIntersect, &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); if (pSolarSysState->WaitIntersect == (COUNT)~0) @@ -1543,12 +1543,13 @@ GenerateRandomIP (BYTE control) case GENERATE_ORBITAL: { #ifdef DEBUG -if (pSolarSysState->pOrbitalDesc->pPrevDesc == pSolarSysState->SunDesc) - printf ("Planet index = %d\n", pSolarSysState->pOrbitalDesc - pSolarSysState->PlanetDesc); -else - printf ("Planet index = %d, Moon index = %d\n", - pSolarSysState->pOrbitalDesc->pPrevDesc - pSolarSysState->PlanetDesc, - pSolarSysState->pOrbitalDesc - pSolarSysState->MoonDesc); + if (pSolarSysState->pOrbitalDesc->pPrevDesc == + pSolarSysState->SunDesc) + fprintf (stderr, "Planet index = %d\n", pSolarSysState->pOrbitalDesc - pSolarSysState->PlanetDesc); + else + fprintf (stderr, "Planet index = %d, Moon index = %d\n", + pSolarSysState->pOrbitalDesc->pPrevDesc - pSolarSysState->PlanetDesc, + pSolarSysState->pOrbitalDesc - pSolarSysState->MoonDesc); #endif /* DEBUG */ rand_val = DoPlanetaryAnalysis ( &pSolarSysState->SysInfo, pSolarSysState->pOrbitalDesc diff --git a/sc2/src/sc2code/planets/surface.c b/sc2/src/sc2code/planets/surface.c index 3ab2cf253..523646a61 100644 --- a/sc2/src/sc2code/planets/surface.c +++ b/sc2/src/sc2code/planets/surface.c @@ -73,7 +73,7 @@ CalcMineralDeposits (SYSTEM_INFOPTR SysInfoPtr, COUNT which_deposit) ); SysInfoPtr->PlanetInfo.CurType = eptr->ElementType; #ifdef DEBUG - //printf ("\t\t%d units of %Fs\n", + //fprintf (stderr, "\t\t%d units of %Fs\n", // SysInfoPtr->PlanetInfo.CurDensity, // Elements[eptr->ElementType].name); #endif /* DEBUG */ @@ -236,8 +236,9 @@ CalcLifeForms (SYSTEM_INFOPTR SysInfoPtr, COUNT which_life) } while (--num_types); } #ifdef DEBUG -else - printf ("It's dead, Jim! (%d >= %d)\n", life_var, SysInfoPtr->PlanetInfo.LifeChance); + else + fprintf (stderr, "It's dead, Jim! (%d >= %d)\n", life_var, + SysInfoPtr->PlanetInfo.LifeChance); #endif /* DEBUG */ } diff --git a/sc2/src/sc2code/process.c b/sc2/src/sc2code/process.c index 8ff3fce4f..49c1cf853 100644 --- a/sc2/src/sc2code/process.c +++ b/sc2/src/sc2code/process.c @@ -226,7 +226,7 @@ CalcReduction (SIZE dx, SIZE dy) #else COUNT next_reduction; #ifdef KDEBUG -printf ("CalcReduction:\n"); + fprintf (stderr, "CalcReduction:\n"); #endif if (LOBYTE (GLOBAL (CurrentActivity)) > IN_ENCOUNTER) return (1 << ZOOM_SHIFT); @@ -252,7 +252,7 @@ printf ("CalcReduction:\n"); && LOBYTE (GLOBAL (CurrentActivity)) == IN_LAST_BATTLE) next_reduction = (2 << ZOOM_SHIFT); #ifdef KDEBUG -printf ("CalcReduction: exit\n"); + fprintf (stderr, "CalcReduction: exit\n"); #endif #endif @@ -273,7 +273,7 @@ CalcView (PPOINT pNewScrollPt, register SIZE next_reduction, VIEW_STATE view_state; #ifdef KDEBUG -printf ("CalcView:\n"); + fprintf (stderr, "CalcView:\n"); #endif dx = ((COORD)(LOG_SPACE_WIDTH >> 1) - pNewScrollPt->x); dy = ((COORD)(LOG_SPACE_HEIGHT >> 1) - pNewScrollPt->y); @@ -339,7 +339,7 @@ printf ("CalcView:\n"); *pdy = dy; #ifdef KDEBUG -printf ("CalcView: exit\n"); + fprintf (stderr, "CalcView: exit\n"); #endif return (view_state); } @@ -387,7 +387,8 @@ ProcessCollisions (HELEMENT hSuccElement, register ELEMENTPTR ElementPtr, && !((state_flags | test_state_flags) & FINITE_LIFE)) { #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 */ if (state_flags & COLLISION) { @@ -508,7 +509,8 @@ printf ("BAD NEWS 0x%x <--> 0x%x\n", ElementPtr, TestElementPtr); POINT SavePt, TestSavePt; #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 */ SavePt = ElementPtr->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; #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 */ if (test_state_flags & PLAYER_SHIP) { @@ -629,7 +632,7 @@ PreProcessQueue (PSIZE pscroll_x, PSIZE pscroll_y) COUNT ships_alive; #ifdef KDEBUG -printf ("PreProcess:\n"); + fprintf (stderr, "PreProcess:\n"); #endif num_ships = (LOBYTE (battle_counter) ? 1 : 0) + (HIBYTE (battle_counter) ? 1 : 0); @@ -733,7 +736,8 @@ printf ("PreProcess:\n"); #endif 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); @@ -753,7 +757,7 @@ printf ("PreProcess:\n"); #endif #ifdef KDEBUG -printf ("PreProcess: exit\n"); + fprintf (stderr, "PreProcess: exit\n"); #endif 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; #ifdef KDEBUG -printf ("PostProcess:\n"); + fprintf (stderr, "PostProcess:\n"); #endif #ifdef OLD_ZOOM reduction = (BYTE)(GLOBAL (cur_state) + ONE_SHIFT); @@ -998,7 +1002,7 @@ printf ("PostProcess:\n"); hElement = hNextElement; } #ifdef KDEBUG -printf ("PostProcess: exit\n"); + fprintf (stderr, "PostProcess: exit\n"); #endif } diff --git a/sc2/src/sc2code/save.c b/sc2/src/sc2code/save.c index 719864584..510064b51 100644 --- a/sc2/src/sc2code/save.c +++ b/sc2/src/sc2code/save.c @@ -292,11 +292,11 @@ RetrySave: mem_release (h); FreeSC2Data (); -//printf ("Insufficient room for save buffers -- RETRYING\n"); +// fprintf (stderr, "Insufficient room for save buffers -- RETRYING\n"); goto RetrySave; } -//else -//printf ("Insufficient room for save buffers -- GIVING UP!\n"); +// else +// fprintf (stderr, "Insufficient room for save buffers -- GIVING UP!\n"); } else { @@ -437,7 +437,7 @@ RetrySave: flen = cclose (fh); 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"))) { PrepareSummary (summary_desc); diff --git a/sc2/src/sc2code/starcon.c b/sc2/src/sc2code/starcon.c index fc76a7358..980846b71 100644 --- a/sc2/src/sc2code/starcon.c +++ b/sc2/src/sc2code/starcon.c @@ -880,7 +880,7 @@ while (--ac > 0) { extern BOOLEAN StartGame (void); - printf("We've loaded the Kernel\n"); + fprintf (stderr, "We've loaded the Kernel\n"); // OpenJournal (); while (StartGame ()) @@ -936,19 +936,19 @@ sc = _simple_count; ExploreSolarSys (); #ifdef TESTING -if (!(GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD)) -&& GLOBAL_SIS (CrewEnlisted) != (COUNT)~0) -{ -if (!(GLOBAL (CurrentActivity) & START_ENCOUNTER) - && (CurStarDescPtr = FindStar (NULL_PTR, - &GLOBAL (autopilot), 0, 0))) -{ - GLOBAL (autopilot.x) = ~0; - GLOBAL (autopilot.y) = ~0; - GLOBAL (ShipStamp.frame) = 0; - GLOBAL (CurrentActivity) |= START_INTERPLANETARY; -} -} + if (!(GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD)) + && GLOBAL_SIS (CrewEnlisted) != (COUNT)~0) + { + if (!(GLOBAL (CurrentActivity) & START_ENCOUNTER) + && (CurStarDescPtr = FindStar (NULL_PTR, + &GLOBAL (autopilot), 0, 0))) + { + GLOBAL (autopilot.x) = ~0; + GLOBAL (autopilot.y) = ~0; + GLOBAL (ShipStamp.frame) = 0; + GLOBAL (CurrentActivity) |= START_INTERPLANETARY; + } + } #endif //TESTING } else @@ -967,7 +967,9 @@ if (!(GLOBAL (CurrentActivity) & START_ENCOUNTER) Task_SetState (ArilouTask, TASK_EXIT); } #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 SetSemaphore (GraphicsSem); @@ -994,14 +996,14 @@ if (_simple_count != sc) printf ("%d difference!\n", (int)_simple_count - (int)s UninitGameClock (); UninitSIS (); } -// CloseJournal (); +// CloseJournal (); + } + else + { + fprintf (stderr, "Kernel failed to load!\n"); } - else - { - printf("Kernel failed to load!\n"); - } FreeKernel (); (void) blah; /* Satisfying compiler (unused parameter) */ - return(0); + return(0); } diff --git a/sc2/src/sc2code/test.c b/sc2/src/sc2code/test.c index 42e9b8ea3..55840f479 100644 --- a/sc2/src/sc2code/test.c +++ b/sc2/src/sc2code/test.c @@ -12,7 +12,7 @@ main (int argc, char *argv[]) { COUNT sound_index; - printf ("Sound #: "); + fprintf (stderr, "Sound #: "); if (fscanf (stdin, "%u", &sound_index) != 1) break;