diff --git a/sc2/ChangeLog b/sc2/ChangeLog index 3dbac952f..8b40e5c56 100644 --- a/sc2/ChangeLog +++ b/sc2/ChangeLog @@ -1,4 +1,5 @@ Changes towards version 0.7: +- Cleaned up FRAME, CONTEXT, and FONT abstraction layers - Michael - Added Input Frames to pause code to stop infinite loops - Michael - Added more netplay debug code - SvdB - Added uio_fprintf() and uio_vfprintf() - SvdB diff --git a/sc2/src/sc2code/libs/gfxlib.h b/sc2/src/sc2code/libs/gfxlib.h index 2d13f4f6d..97cde814a 100644 --- a/sc2/src/sc2code/libs/gfxlib.h +++ b/sc2/src/sc2code/libs/gfxlib.h @@ -21,9 +21,13 @@ #include "memlib.h" -#define CONTEXT PVOID -#define FRAME PVOID -#define FONT PVOID +typedef struct context_desc CONTEXT_DESC; +typedef struct frame_desc FRAME_DESC; +typedef struct font_desc FONT_DESC; + +typedef CONTEXT_DESC *CONTEXT; +typedef FRAME_DESC *FRAME; +typedef FONT_DESC *FONT; typedef CONTEXT *PCONTEXT; typedef FRAME *PFRAME; @@ -183,12 +187,6 @@ enum FadeSomeToColor }; -#endif /* _GFXLIB_H */ - - -#ifndef _GFX_PROTOS -#define _GFX_PROTOS - extern BOOLEAN InitGraphics (int argc, char *argv[], COUNT KbytesRequired); extern void UninitGraphics (void); @@ -278,5 +276,4 @@ extern void FlushColorXForms (void); void SetSystemRect (PRECT pRect); void ClearSystemRect (void); -#endif /* _GFX_PROTOS */ - +#endif /* _GFXLIB_H */ diff --git a/sc2/src/sc2code/libs/graphics/context.c b/sc2/src/sc2code/libs/graphics/context.c index 931a1dac5..2c30da5dc 100644 --- a/sc2/src/sc2code/libs/graphics/context.c +++ b/sc2/src/sc2code/libs/graphics/context.c @@ -20,18 +20,18 @@ #include "gfxother.h" GRAPHICS_STATUS _GraphicsStatusFlags; -CONTEXTPTR _pCurContext; +CONTEXT _pCurContext; PRIMITIVE _locPrim; -FONTPTR _CurFontPtr; +FONT _CurFontPtr; CONTEXT SetContext (CONTEXT Context) { CONTEXT LastContext; - LastContext = (CONTEXT)_pCurContext; + LastContext = _pCurContext; if (Context != LastContext) { if (LastContext) @@ -47,7 +47,7 @@ SetContext (CONTEXT Context) DeactivateContext (); } - _pCurContext = (CONTEXTPTR)Context; + _pCurContext = Context; if (_pCurContext) { ActivateContext (); @@ -57,8 +57,8 @@ SetContext (CONTEXT Context) SetPrimColor (&_locPrim, _get_context_fg_color ()); - _CurFramePtr = (FRAMEPTR)_get_context_fg_frame (); - _CurFontPtr = (FONTPTR)_get_context_font (); + _CurFramePtr = _get_context_fg_frame (); + _CurFontPtr = _get_context_font (); } } @@ -103,21 +103,18 @@ DestroyContext (CONTEXT_REF ContextRef) CONTEXT CaptureContext (CONTEXT_REF ContextRef) { - CONTEXTPTR ContextPtr; + CONTEXT ContextPtr; ContextPtr = LockContext (ContextRef); if (ContextPtr) ContextPtr->ContextRef = ContextRef; - return ((CONTEXT)ContextPtr); + return (ContextPtr); } CONTEXT_REF -ReleaseContext (CONTEXT Context) +ReleaseContext (CONTEXT ContextPtr) { - CONTEXTPTR ContextPtr; - - ContextPtr = (CONTEXTPTR)Context; if (ContextPtr) { CONTEXT_REF ContextRef; @@ -261,7 +258,7 @@ FixContextFontEffect (void) img = TFB_DrawImage_CreateForScreen (w, h, TRUE); if (_get_context_fbk_flags () & FBK_IMAGE) { // image pattern backing - FRAMEPTR EffectFrame = (FRAMEPTR)_get_context_fonteff (); + FRAME EffectFrame = _get_context_fonteff (); TFB_DrawImage_Image (EffectFrame->image, -EffectFrame->HotSpot.x, -EffectFrame->HotSpot.y, diff --git a/sc2/src/sc2code/libs/graphics/context.h b/sc2/src/sc2code/libs/graphics/context.h index 0ea1d6301..458540e5e 100644 --- a/sc2/src/sc2code/libs/graphics/context.h +++ b/sc2/src/sc2code/libs/graphics/context.h @@ -25,7 +25,7 @@ typedef UWORD FBK_FLAGS; #define FBK_DIRTY (1 << 0) #define FBK_IMAGE (1 << 1) -typedef struct +struct context_desc { CONTEXT_REF ContextRef; UWORD Flags; @@ -40,21 +40,18 @@ typedef struct TFB_Image *FontBacking; FBK_FLAGS BackingFlags; -} CONTEXT_DESC; -typedef CONTEXT_DESC *PCONTEXT_DESC; +}; #define CONTEXT_PRIORITY DEFAULT_MEM_PRIORITY -#define CONTEXTPTR PCONTEXT_DESC - #define AllocContext() \ (CONTEXT_REF)mem_allocate ((MEM_SIZE)sizeof (CONTEXT_DESC), \ MEM_ZEROINIT | MEM_PRIMARY, CONTEXT_PRIORITY, MEM_SIMPLE) -#define LockContext (CONTEXTPTR)mem_lock +#define LockContext (CONTEXT)mem_lock #define UnlockContext mem_unlock #define FreeContext mem_release -extern CONTEXTPTR _pCurContext; +extern CONTEXT _pCurContext; extern PRIMITIVE _locPrim; #define _get_context_fg_color() (_pCurContext->ForeGroundColor) diff --git a/sc2/src/sc2code/libs/graphics/display.h b/sc2/src/sc2code/libs/graphics/display.h index 2f0a970ca..be110da02 100644 --- a/sc2/src/sc2code/libs/graphics/display.h +++ b/sc2/src/sc2code/libs/graphics/display.h @@ -29,7 +29,7 @@ typedef struct DRAWABLE (*alloc_image) (COUNT NumFrames, DRAWABLE_TYPE DrawableType, CREATE_FLAGS flags, SIZE width, SIZE height); - void (*read_display) (PRECT pRect, FRAMEPTR DstFramePtr); + void (*read_display) (PRECT pRect, FRAME DstFramePtr); } DISPLAY_INTERFACE; typedef DISPLAY_INTERFACE *PDISPLAY_INTERFACE; diff --git a/sc2/src/sc2code/libs/graphics/drawable.c b/sc2/src/sc2code/libs/graphics/drawable.c index 812bf9ec4..baed4a25e 100644 --- a/sc2/src/sc2code/libs/graphics/drawable.c +++ b/sc2/src/sc2code/libs/graphics/drawable.c @@ -23,7 +23,7 @@ #include "libs/mathlib.h" #include "gfxother.h" -FRAMEPTR _CurFramePtr; +FRAME _CurFramePtr; FRAME SetContextFGFrame (FRAME Frame) @@ -35,7 +35,7 @@ SetContextFGFrame (FRAME Frame) if (LastFrame) DeactivateDrawable (); - _CurFramePtr = (FRAMEPTR)Frame; + _CurFramePtr = Frame; if (_CurFramePtr) ActivateDrawable (); @@ -61,7 +61,7 @@ CreateDisplay (CREATE_FLAGS CreateFlags, PSIZE pwidth, PSIZE pheight) GetDisplayWidth (), GetDisplayHeight ()); if (Drawable) { - FRAMEPTR F; + FRAME F; if ((F = CaptureDrawable (Drawable)) == 0) DestroyDrawable (Drawable); @@ -91,11 +91,11 @@ AllocDrawable (COUNT n) DRAWABLEPTR DrawablePtr; int i; DrawablePtr = LockDrawable (Drawable); - DrawablePtr->Frame = (FRAMEPTR)HMalloc ((MEM_SIZE)(sizeof (FRAME_DESC) * n)); + DrawablePtr->Frame = (FRAME)HMalloc ((MEM_SIZE)(sizeof (FRAME_DESC) * n)); /* Zero out the newly allocated frames, since HMalloc doesn't have MEM_ZEROINIT. */ for (i = 0; i < n; i++) { - FRAMEPTR F; + FRAME F; F = &DrawablePtr->Frame[i]; F->parent = DrawablePtr; F->Type = 0; @@ -125,7 +125,7 @@ CreateDrawable (CREATE_FLAGS CreateFlags, SIZE width, SIZE height, COUNT width, height); if (Drawable) { - FRAMEPTR F; + FRAME F; F = CaptureDrawable (Drawable); if (F) @@ -160,7 +160,7 @@ DestroyDrawable (DRAWABLE Drawable) } BOOLEAN -GetFrameRect (FRAMEPTR FramePtr, PRECT pRect) +GetFrameRect (FRAME FramePtr, PRECT pRect) { if (FramePtr) { @@ -176,7 +176,7 @@ GetFrameRect (FRAMEPTR FramePtr, PRECT pRect) } HOT_SPOT -SetFrameHot (FRAMEPTR FramePtr, HOT_SPOT HotSpot) +SetFrameHot (FRAME FramePtr, HOT_SPOT HotSpot) { if (FramePtr) { @@ -192,7 +192,7 @@ SetFrameHot (FRAMEPTR FramePtr, HOT_SPOT HotSpot) } HOT_SPOT -GetFrameHot (FRAMEPTR FramePtr) +GetFrameHot (FRAME FramePtr) { if (FramePtr) { @@ -203,10 +203,10 @@ GetFrameHot (FRAMEPTR FramePtr) } DRAWABLE -RotateFrame (FRAMEPTR Frame, COUNT angle) +RotateFrame (FRAME Frame, COUNT angle) { DRAWABLE Drawable; - FRAMEPTR RotFramePtr; + FRAME RotFramePtr; SIZE dx, dy; SIZE d; COUNT organg; @@ -245,7 +245,7 @@ RotateFrame (FRAMEPTR Frame, COUNT angle) } void -SetFrameTransparentColor (FRAMEPTR Frame, COLOR c32k) +SetFrameTransparentColor (FRAME Frame, COLOR c32k) { TFB_Palette color; diff --git a/sc2/src/sc2code/libs/graphics/drawable.h b/sc2/src/sc2code/libs/graphics/drawable.h index f47ca506c..1d8de350b 100644 --- a/sc2/src/sc2code/libs/graphics/drawable.h +++ b/sc2/src/sc2code/libs/graphics/drawable.h @@ -39,7 +39,7 @@ typedef UWORD DRAWABLE_TYPE; #define RAM_DRAWABLE 1 #define SCREEN_DRAWABLE 2 -typedef struct frame_desc +struct frame_desc { DRAWABLE_TYPE Type; UWORD Index; @@ -47,8 +47,7 @@ typedef struct frame_desc EXTENT Bounds; TFB_Image *image; struct drawable_desc *parent; -} FRAME_DESC; -typedef FRAME_DESC *PFRAME_DESC; +}; typedef struct drawable_desc { @@ -60,16 +59,15 @@ typedef struct drawable_desc } DRAWABLE_DESC; typedef DRAWABLE_DESC *PDRAWABLE_DESC; -#define GetFrameWidth(f) (((PFRAME_DESC)(f))->Bounds.width) -#define GetFrameHeight(f) (((PFRAME_DESC)(f))->Bounds.height) +#define GetFrameWidth(f) ((f)->Bounds.width) +#define GetFrameHeight(f) ((f)->Bounds.height) #define SetFrameBounds(f,w,h) \ - (((PFRAME_DESC)(f))->Bounds.width=(w), \ - ((PFRAME_DESC)(f))->Bounds.height=(h)) + ((f)->Bounds.width=(w), \ + ((f))->Bounds.height=(h)) #define DRAWABLE_PRIORITY DEFAULT_MEM_PRIORITY #define DRAWABLEPTR PDRAWABLE_DESC -#define FRAMEPTR PFRAME_DESC #define COUNTPTR PCOUNT extern DRAWABLE AllocDrawable (COUNT num_frames); @@ -90,7 +88,7 @@ extern DRAWABLE AllocDrawable (COUNT num_frames); typedef struct { RECT Box; - FRAMEPTR FramePtr; + FRAME FramePtr; } IMAGE_BOX; typedef IMAGE_BOX *PIMAGE_BOX; @@ -109,7 +107,7 @@ typedef PSTAMP STAMPPTR; typedef PTEXT TEXTPTR; extern STAMP _save_stamp; -extern FRAMEPTR _CurFramePtr; +extern FRAME _CurFramePtr; extern void _rect_blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr); extern void _text_blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr); diff --git a/sc2/src/sc2code/libs/graphics/font.c b/sc2/src/sc2code/libs/graphics/font.c index b0b945fd6..78403b78e 100644 --- a/sc2/src/sc2code/libs/graphics/font.c +++ b/sc2/src/sc2code/libs/graphics/font.c @@ -33,8 +33,8 @@ SetContextFont (FONT Font) { FONT LastFont; - LastFont = (FONT)_CurFontPtr; - _CurFontPtr = (FONTPTR)Font; + LastFont = _CurFontPtr; + _CurFontPtr = Font; if (ContextActive ()) SwitchContextFont (Font); @@ -56,21 +56,21 @@ DestroyFont (FONT_REF FontRef) FONT CaptureFont (FONT_REF FontRef) { - FONTPTR FontPtr; + FONT FontPtr; FontPtr = LockFont (FontRef); if (FontPtr) FontPtr->FontRef = FontRef; - return ((FONT)FontPtr); + return FontPtr; } FONT_REF ReleaseFont (FONT Font) { - FONTPTR FontPtr; + FONT FontPtr; - FontPtr = (FONTPTR)Font; + FontPtr = Font; if (FontPtr) { FONT_REF FontRef; @@ -122,7 +122,7 @@ GetContextFontLeadingWidth (PSIZE pwidth) BOOLEAN TextRect (PTEXT lpText, PRECT pRect, PBYTE pdelta) { - FONTPTR FontPtr; + FONT FontPtr; FontPtr = _CurFontPtr; if (FontPtr != 0 && lpText->CharCount != 0) @@ -237,7 +237,7 @@ TextRect (PTEXT lpText, PRECT pRect, PBYTE pdelta) void _text_blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr) { - FONTPTR FontPtr; + FONT FontPtr; COUNT num_chars; wchar_t next_ch; diff --git a/sc2/src/sc2code/libs/graphics/font.h b/sc2/src/sc2code/libs/graphics/font.h index 3260f296c..bc5bf2309 100644 --- a/sc2/src/sc2code/libs/graphics/font.h +++ b/sc2/src/sc2code/libs/graphics/font.h @@ -47,17 +47,15 @@ FreeFontPage (FONT_PAGE *page) HFree (page); } -typedef struct +struct font_desc { FONT_REF FontRef; UWORD Leading; UWORD LeadingWidth; FONT_PAGE *fontPages; -} FONT_DESC; -typedef FONT_DESC *PFONT_DESC; +}; -#define FONTPTR PFONT_DESC #define CHAR_DESCPTR PCHAR_DESC #define FONT_PRIORITY DEFAULT_MEM_PRIORITY @@ -65,13 +63,13 @@ typedef FONT_DESC *PFONT_DESC; #define AllocFont(size) \ (FONT_REF)mem_allocate ((MEM_SIZE)(sizeof (FONT_DESC) + (size)), \ MEM_ZEROINIT | MEM_GRAPHICS, FONT_PRIORITY, MEM_SIMPLE) -#define LockFont(h) (FONTPTR)mem_lock (h) +#define LockFont(h) (FONT)mem_lock (h) #define UnlockFont(h) mem_unlock (h) #define FreeFont _ReleaseFontData -#define NULL_FONT (FONTPTR)NULL_PTR +#define NULL_FONT (FONT)NULL_PTR -extern FONTPTR _CurFontPtr; +extern FONT _CurFontPtr; extern MEM_HANDLE _GetFontData (uio_Stream *fp, DWORD length); extern BOOLEAN _ReleaseFontData (MEM_HANDLE handle); diff --git a/sc2/src/sc2code/libs/graphics/gfxintrn.h b/sc2/src/sc2code/libs/graphics/gfxintrn.h index 19e2fe9c9..276274c65 100644 --- a/sc2/src/sc2code/libs/graphics/gfxintrn.h +++ b/sc2/src/sc2code/libs/graphics/gfxintrn.h @@ -22,7 +22,6 @@ #include #include -#define _GFX_PROTOS #include "gfxlib.h" #include "reslib.h" #include "context.h" @@ -30,14 +29,5 @@ #include "font.h" #include "display.h" -#undef CONTEXT -#define CONTEXT CONTEXTPTR -#undef FRAME -#define FRAME FRAMEPTR -#undef FONT -#define FONT FONTPTR -#undef _GFX_PROTOS -#include "gfxlib.h" - #endif /* _GFXINTRN_H */ diff --git a/sc2/src/sc2code/libs/graphics/intersec.c b/sc2/src/sc2code/libs/graphics/intersec.c index 1fe890c02..1dcdd1e3c 100644 --- a/sc2/src/sc2code/libs/graphics/intersec.c +++ b/sc2/src/sc2code/libs/graphics/intersec.c @@ -235,7 +235,7 @@ DrawablesIntersect (PINTERSECT_CONTROL pControl0, SIZE dy; SIZE time_y_0, time_y_1; RECT r0, r1; - FRAMEPTR FramePtr0, FramePtr1; + FRAME FramePtr0, FramePtr1; if (!ContextActive () || max_time_val == 0) return ((TIME_VALUE)0); @@ -252,13 +252,13 @@ DrawablesIntersect (PINTERSECT_CONTROL pControl0, r1.extent.width = pControl1->EndPoint.x - r1.corner.x; r1.extent.height = pControl1->EndPoint.y - r1.corner.y; - FramePtr0 = (FRAMEPTR)pControl0->IntersectStamp.frame; + FramePtr0 = pControl0->IntersectStamp.frame; if (FramePtr0 == 0) return(0); r0.corner.x -= FramePtr0->HotSpot.x; r0.corner.y -= FramePtr0->HotSpot.y; - FramePtr1 = (FRAMEPTR)pControl1->IntersectStamp.frame; + FramePtr1 = pControl1->IntersectStamp.frame; if (FramePtr1 == 0) return(0); r1.corner.x -= FramePtr1->HotSpot.x; @@ -393,10 +393,10 @@ DrawablesIntersect (PINTERSECT_CONTROL pControl0, pControl0, &r0, pControl1, &r1, (TIME_VALUE)time_y_0, (TIME_VALUE)time_y_1))) { - FramePtr0 = (FRAMEPTR)pControl0->IntersectStamp.frame; + FramePtr0 = pControl0->IntersectStamp.frame; pControl0->EndPoint.x = r0.corner.x + FramePtr0->HotSpot.x; pControl0->EndPoint.y = r0.corner.y + FramePtr0->HotSpot.y; - FramePtr1 = (FRAMEPTR)pControl1->IntersectStamp.frame; + FramePtr1 = pControl1->IntersectStamp.frame; pControl1->EndPoint.x = r1.corner.x + FramePtr1->HotSpot.x; pControl1->EndPoint.y = r1.corner.y + FramePtr1->HotSpot.y; diff --git a/sc2/src/sc2code/libs/graphics/loaddisp.c b/sc2/src/sc2code/libs/graphics/loaddisp.c index 69004a6c4..d0c35ec94 100644 --- a/sc2/src/sc2code/libs/graphics/loaddisp.c +++ b/sc2/src/sc2code/libs/graphics/loaddisp.c @@ -50,7 +50,7 @@ LoadDisplayPixmap (PRECT area, FRAME frame) ) { frame = CaptureDrawable (buffer); - ReadDisplay (area, (FRAMEPTR)frame); + ReadDisplay (area, frame); ReleaseDrawable (frame); } diff --git a/sc2/src/sc2code/libs/graphics/pixmap.c b/sc2/src/sc2code/libs/graphics/pixmap.c index a3a482453..b85dc7281 100644 --- a/sc2/src/sc2code/libs/graphics/pixmap.c +++ b/sc2/src/sc2code/libs/graphics/pixmap.c @@ -29,14 +29,14 @@ CaptureDrawable (DRAWABLE Drawable) COUNT FrameIndex; FrameIndex = GetDrawableIndex (Drawable); - return ((FRAME)&DrawablePtr->Frame[FrameIndex]); + return &DrawablePtr->Frame[FrameIndex]; } return (0); } DRAWABLE -ReleaseDrawable (FRAMEPTR FramePtr) +ReleaseDrawable (FRAME FramePtr) { if (FramePtr != 0) { @@ -54,7 +54,7 @@ ReleaseDrawable (FRAMEPTR FramePtr) } MEM_HANDLE -GetFrameHandle (FRAMEPTR FramePtr) +GetFrameHandle (FRAME FramePtr) { DRAWABLEPTR DrawablePtr; @@ -66,7 +66,7 @@ GetFrameHandle (FRAMEPTR FramePtr) } COUNT -GetFrameCount (FRAMEPTR FramePtr) +GetFrameCount (FRAME FramePtr) { DRAWABLEPTR DrawablePtr; @@ -78,7 +78,7 @@ GetFrameCount (FRAMEPTR FramePtr) } COUNT -GetFrameIndex (FRAMEPTR FramePtr) +GetFrameIndex (FRAME FramePtr) { if (FramePtr == 0) return (0); @@ -87,7 +87,7 @@ GetFrameIndex (FRAMEPTR FramePtr) } FRAME -SetAbsFrameIndex (FRAMEPTR FramePtr, COUNT FrameIndex) +SetAbsFrameIndex (FRAME FramePtr, COUNT FrameIndex) { if (FramePtr != 0) { @@ -96,14 +96,14 @@ SetAbsFrameIndex (FRAMEPTR FramePtr, COUNT FrameIndex) DrawablePtr = GetFrameParentDrawable (FramePtr); FrameIndex = FrameIndex % (DrawablePtr->MaxIndex + 1); - FramePtr = (FRAMEPTR)&DrawablePtr->Frame[FrameIndex]; + FramePtr = &DrawablePtr->Frame[FrameIndex]; } - return ((FRAME)FramePtr); + return FramePtr; } FRAME -SetRelFrameIndex (FRAMEPTR FramePtr, SIZE FrameOffs) +SetRelFrameIndex (FRAME FramePtr, SIZE FrameOffs) { if (FramePtr != 0) { @@ -119,14 +119,14 @@ SetRelFrameIndex (FRAMEPTR FramePtr, SIZE FrameOffs) } FrameOffs = ((SWORD)FramePtr->Index + FrameOffs) % num_frames; - FramePtr = (FRAMEPTR)&DrawablePtr->Frame[FrameOffs]; + FramePtr = &DrawablePtr->Frame[FrameOffs]; } - return ((FRAME)FramePtr); + return FramePtr; } FRAME -SetEquFrameIndex (FRAMEPTR DstFramePtr, FRAMEPTR SrcFramePtr) +SetEquFrameIndex (FRAME DstFramePtr, FRAME SrcFramePtr) { if (DstFramePtr && SrcFramePtr) return ((FRAME)( @@ -139,7 +139,7 @@ SetEquFrameIndex (FRAMEPTR DstFramePtr, FRAMEPTR SrcFramePtr) } FRAME -IncFrameIndex (FRAMEPTR FramePtr) +IncFrameIndex (FRAME FramePtr) { DRAWABLEPTR DrawablePtr; @@ -148,24 +148,24 @@ IncFrameIndex (FRAMEPTR FramePtr) DrawablePtr = GetFrameParentDrawable (FramePtr); if (FramePtr->Index < DrawablePtr->MaxIndex) - return ((FRAME)++FramePtr); + return ++FramePtr; else - return ((FRAME)DrawablePtr->Frame); + return DrawablePtr->Frame; } FRAME -DecFrameIndex (FRAMEPTR FramePtr) +DecFrameIndex (FRAME FramePtr) { if (FramePtr == 0) return (0); if (FramePtr->Index > 0) - return ((FRAME)--FramePtr); + return --FramePtr; else { DRAWABLEPTR DrawablePtr; DrawablePtr = GetFrameParentDrawable (FramePtr); - return ((FRAME)&DrawablePtr->Frame[DrawablePtr->MaxIndex]); + return &DrawablePtr->Frame[DrawablePtr->MaxIndex]; } } diff --git a/sc2/src/sc2code/libs/graphics/sdl/3do_blt.c b/sc2/src/sc2code/libs/graphics/sdl/3do_blt.c index ff9399c42..3df6dca2a 100644 --- a/sc2/src/sc2code/libs/graphics/sdl/3do_blt.c +++ b/sc2/src/sc2code/libs/graphics/sdl/3do_blt.c @@ -37,7 +37,7 @@ GetGraphicScale () } static void -read_screen (PRECT lpRect, FRAMEPTR DstFramePtr) +read_screen (PRECT lpRect, FRAME DstFramePtr) { if (_CurFramePtr->Type != SCREEN_DRAWABLE || DstFramePtr->Type == SCREEN_DRAWABLE diff --git a/sc2/src/sc2code/libs/graphics/sdl/3do_getbody.c b/sc2/src/sc2code/libs/graphics/sdl/3do_getbody.c index deff2164a..8867dff34 100644 --- a/sc2/src/sc2code/libs/graphics/sdl/3do_getbody.c +++ b/sc2/src/sc2code/libs/graphics/sdl/3do_getbody.c @@ -44,7 +44,7 @@ typedef struct anidata static void -process_image (FRAMEPTR FramePtr, SDL_Surface *img[], AniData *ani, int cel_ct) +process_image (FRAME FramePtr, SDL_Surface *img[], AniData *ani, int cel_ct) { TFB_Image *tfbimg; int hx, hy; @@ -185,9 +185,9 @@ processFontChar (TFB_Char* CharPtr, SDL_Surface *surf) // create a new frame of size neww x newh, and blit a scaled version FramePtr // into it. // destroy the old frame if 'destroy' is 1 -FRAMEPTR stretch_frame (FRAMEPTR FramePtr, int neww, int newh, int destroy) +FRAME stretch_frame (FRAME FramePtr, int neww, int newh, int destroy) { - FRAMEPTR NewFrame; + FRAME NewFrame; CREATE_FLAGS flags; TFB_Image *tfbImg; TFB_Canvas src, dst; @@ -209,7 +209,7 @@ FRAMEPTR stretch_frame (FRAMEPTR FramePtr, int neww, int newh, int destroy) return (NewFrame); } -void process_rgb_bmp (FRAMEPTR FramePtr, Uint32 *rgba, int maxx, int maxy) +void process_rgb_bmp (FRAME FramePtr, Uint32 *rgba, int maxx, int maxy) { int x, y; TFB_Image *tfbImg; @@ -230,7 +230,7 @@ void process_rgb_bmp (FRAMEPTR FramePtr, Uint32 *rgba, int maxx, int maxy) UnlockMutex (tfbImg->mutex); } -void fill_frame_rgb (FRAMEPTR FramePtr, Uint32 color, int x0, int y0, +void fill_frame_rgb (FRAME FramePtr, Uint32 color, int x0, int y0, int x, int y) { SDL_Surface *img; @@ -255,7 +255,7 @@ void fill_frame_rgb (FRAMEPTR FramePtr, Uint32 color, int x0, int y0, UnlockMutex (tfbImg->mutex); } -void arith_frame_blit (FRAMEPTR srcFrame, RECT *rsrc, FRAMEPTR dstFrame, +void arith_frame_blit (FRAME srcFrame, RECT *rsrc, FRAME dstFrame, RECT *rdst, int num, int denom) { TFB_Image *srcImg, *dstImg; @@ -312,7 +312,7 @@ void arith_frame_blit (FRAMEPTR srcFrame, RECT *rsrc, FRAMEPTR dstFrame, // bits 8-15 : blue // bits 0-7 : alpha // The 8bpp pixel format is 1 index per pixel -void getpixelarray (void *map, int Bpp, FRAMEPTR FramePtr, +void getpixelarray (void *map, int Bpp, FRAME FramePtr, int width, int height) { Uint8 r,g,b,a; @@ -367,7 +367,7 @@ void getpixelarray (void *map, int Bpp, FRAMEPTR FramePtr, // Generate a pixel (in the correct format to be applied to FramePtr) from the // r,g,b,a values supplied -Uint32 frame_mapRGBA (FRAMEPTR FramePtr,Uint8 r, Uint8 g, Uint8 b, Uint8 a) +Uint32 frame_mapRGBA (FRAME FramePtr,Uint8 r, Uint8 g, Uint8 b, Uint8 a) { SDL_Surface *img= (SDL_Surface *)FramePtr->image->NormalImg; return (SDL_MapRGBA (img->format, r, g, b, a)); @@ -450,7 +450,7 @@ _GetCelData (uio_Stream *fp, DWORD length) } else { - FRAMEPTR FramePtr; + FRAME FramePtr; DrawablePtr->hDrawable = GetDrawableHandle (Drawable); DrawablePtr->Flags = WANT_PIXMAP; @@ -475,7 +475,7 @@ _ReleaseCelData (MEM_HANDLE handle) { DRAWABLEPTR DrawablePtr; int cel_ct; - FRAMEPTR FramePtr = NULL; + FRAME FramePtr = NULL; if ((DrawablePtr = LockDrawable (handle)) == 0) return (FALSE); @@ -530,7 +530,7 @@ _GetFontData (uio_Stream *fp, DWORD length) size_t numBCDs = 0; int dirEntryI; uio_DirHandle *fontDirHandle = NULL; - FONTPTR fontPtr; + FONT fontPtr; if (_cur_resfile_name == 0) goto err; @@ -691,7 +691,7 @@ err: BOOLEAN _ReleaseFontData (MEM_HANDLE handle) { - FONTPTR font = LockFont (handle); + FONT font = LockFont (handle); if (font == NULL) return FALSE; @@ -748,7 +748,7 @@ _request_drawable (COUNT NumFrames, DRAWABLE_TYPE DrawableType, else { int imgw, imgh; - FRAMEPTR FramePtr; + FRAME FramePtr; DrawablePtr->hDrawable = GetDrawableHandle (Drawable); DrawablePtr->Flags = flags; diff --git a/sc2/src/sc2code/libs/graphics/sdl/rndzoom.c b/sc2/src/sc2code/libs/graphics/sdl/rndzoom.c index 02acff6ce..75ee565a8 100644 --- a/sc2/src/sc2code/libs/graphics/sdl/rndzoom.c +++ b/sc2/src/sc2code/libs/graphics/sdl/rndzoom.c @@ -531,7 +531,7 @@ void random16xZoomSurfaceRGBA (SDL_Surface *src, SDL_Surface *dst) blurSurface32 (dst); } -FRAMEPTR scale16xRandomizeFrame (FRAMEPTR NewFrame, FRAMEPTR FramePtr) +FRAME scale16xRandomizeFrame (FRAME NewFrame, FRAME FramePtr) { TFB_Image *origImg, *newImg; CREATE_FLAGS flags; diff --git a/sc2/src/sc2code/libs/graphics/tfb_prim.c b/sc2/src/sc2code/libs/graphics/tfb_prim.c index 69f337f9f..0cfca65ea 100644 --- a/sc2/src/sc2code/libs/graphics/tfb_prim.c +++ b/sc2/src/sc2code/libs/graphics/tfb_prim.c @@ -118,12 +118,12 @@ void TFB_Prim_Stamp (PSTAMP stmp) { int x, y; - PFRAME_DESC SrcFramePtr; + FRAME SrcFramePtr; TFB_Image *img; TFB_ColorMap *cmap = NULL; int gscale; - SrcFramePtr = (PFRAME_DESC)stmp->frame; + SrcFramePtr = stmp->frame; if (!SrcFramePtr) { log_add (log_Warning, "TFB_Prim_Stamp: Tried to draw a NULL frame" @@ -167,12 +167,12 @@ void TFB_Prim_StampFill (PSTAMP stmp, TFB_Palette *color) { int x, y; - PFRAME_DESC SrcFramePtr; + FRAME SrcFramePtr; TFB_Image *img; int r, g, b; int gscale; - SrcFramePtr = (PFRAME_DESC)stmp->frame; + SrcFramePtr = stmp->frame; if (!SrcFramePtr) { log_add (log_Warning, "TFB_Prim_StampFill: Tried to draw a NULL frame" diff --git a/sc2/src/sc2code/oscill.c b/sc2/src/sc2code/oscill.c index 9c594adce..21d237c83 100644 --- a/sc2/src/sc2code/oscill.c +++ b/sc2/src/sc2code/oscill.c @@ -24,7 +24,7 @@ #include "libs/sound/trackplayer.h" -static FRAMEPTR scope_frame; +static FRAME scope_frame; static int scope_init = 0; static TFB_Image *scope_bg = NULL; static TFB_Image *scope_surf = NULL; diff --git a/sc2/src/sc2code/planets/plangen.c b/sc2/src/sc2code/planets/plangen.c index 9996feb88..2d1ad7013 100644 --- a/sc2/src/sc2code/planets/plangen.c +++ b/sc2/src/sc2code/planets/plangen.c @@ -50,7 +50,7 @@ extern void fill_frame_rgb (FRAME FramePtr, DWORD color, int x0, int y0, int x, int y); extern void arith_frame_blit (FRAME srcFrame, RECT *rsrc, FRAME dstFrame, RECT *rdst, int num, int denom); -extern void getpixelarray (void *map, int Bpp, FRAMEPTR FramePtr, +extern void getpixelarray (void *map, int Bpp, FRAME FramePtr, int width, int height); diff --git a/sc2/src/sc2code/process.c b/sc2/src/sc2code/process.c index 5559b1f9b..56fc0ac3f 100644 --- a/sc2/src/sc2code/process.c +++ b/sc2/src/sc2code/process.c @@ -938,7 +938,7 @@ PostProcessQueue (VIEW_STATE view_state, SIZE scroll_x, // (smaller) zoom level image as mipmap, // needed for trilinear scaling - PFRAME_DESC frame = + FRAME frame = SetAbsFrameIndex ( ElementPtr->next.image.farray [index + 1], @@ -949,7 +949,7 @@ PostProcessQueue (VIEW_STATE view_state, SIZE scroll_x, TFB_DrawCommand DC; TFB_Image *mmimg = frame->image; DC.Type = TFB_DRAWCOMMANDTYPE_SETMIPMAP; - DC.data.setmipmap.image = ((PFRAME_DESC)ElementPtr->next.image.frame)->image; + DC.data.setmipmap.image = (ElementPtr->next.image.frame)->image; DC.data.setmipmap.hotx = frame->HotSpot.x; DC.data.setmipmap.hoty = frame->HotSpot.y; LockMutex (mmimg->mutex);