- make sure WANTLIB doesn't get passed down to subpackages

- add tremor support and enable it on arm
- pull in fixes for some annoyances from uqm cvs
This commit is contained in:
jolan 2005-11-05 03:48:40 +00:00
parent be79a7b2d3
commit fe54538e4f
11 changed files with 586 additions and 13 deletions

View File

@ -1,4 +1,5 @@
# $OpenBSD: Makefile,v 1.15 2005/09/16 09:51:27 espie Exp $
# $OpenBSD: Makefile,v 1.16 2005/11/05 03:48:40 jolan Exp $
# XXX hardcoded endian list
# 64-bit issues, unaligned memory access
ONLY_FOR_ARCHS= arm i386 powerpc
@ -24,12 +25,12 @@ DISTFILES= ${PDIST} ${CDIST}
SUPDISTFILES= ${MDIST} ${VDIST} ${RM1DIST} ${RM2DIST} ${RM3DIST}
DIST_SUBDIR= uqm
CATEGORIES= games x11
PKGNAME= uqm-${VER}p0
PKGNAME-remix1= uqm-remix1-${VER}
PKGNAME-remix2= uqm-remix2-${VER}
PKGNAME-remix3= uqm-remix3-${VER}
PKGNAME-threedomusic= uqm-threedomusic-${VER}
PKGNAME-voice= uqm-voice-${VER}
PKGNAME= uqm-${VER}p1
PKGNAME-remix1= uqm-remix1-${VER}p0
PKGNAME-remix2= uqm-remix2-${VER}p0
PKGNAME-remix3= uqm-remix3-${VER}p0
PKGNAME-threedomusic= uqm-threedomusic-${VER}p0
PKGNAME-voice= uqm-voice-${VER}p0
EXTRACT_ONLY= ${PDIST}
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=sc2/}
@ -40,10 +41,17 @@ PERMIT_PACKAGE_CDROM= "Unresolved licensing issues"
PERMIT_PACKAGE_FTP= "Unresolved licensing issues"
PERMIT_DISTFILES_CDROM= "Unresolved licensing issues"
PERMIT_DISTFILES_FTP= "Unresolved licensing issues"
WANTLIB= SDL X11 Xext c m ogg pthread usbhid z
LIB_DEPENDS= SDL_image::devel/sdl-image \
vorbis.0,vorbisfile.1::audio/libvorbis
LIB_DEPENDS= SDL_image::devel/sdl-image
WANTLIB= X11 Xext c m pthread usbhid z \
SDL
.if ${MACHINE_ARCH} == "arm"
LIB_DEPENDS+= vorbisidec.1::audio/tremor
.else
LIB_DEPENDS+= vorbis.0,vorbisfile.1::audio/libvorbis
WANTLIB+= ogg
.endif
NO_REGRESS= Yes
USE_GMAKE= Yes
@ -77,6 +85,9 @@ MULTI_PACKAGES+=-voice
SUBPACKAGE?=
.if defined(PACKAGING)
. if !empty(SUBPACKAGE)
WANTLIB=
. endif
. if ${SUBPACKAGE} == "-remix1"
PKG_ARCH= *
RUN_DEPENDS= ::games/uqm
@ -111,10 +122,21 @@ do-configure:
@sed -e "s|@PREFIX@|${PREFIX}|g ; s|@ENDIAN@|define|g" \
${FILESDIR}/config_unix.h > ${WRKSRC}/src/config_unix.h
.endif
.if ${MACHINE_ARCH} == "arm"
@sed -e "s|@CC@|${CC}|g ; s|@CFLAGS@|${CFLAGS}|g ; \
s|@CFLAGS_TREMOR@|-DOVCODEC_TREMOR|g ; \
s|@LOCALBASE@|${LOCALBASE}|g ; s|@PREFIX@|${PREFIX}|g ; \
s|@SOUNDLIB@|-lvorbisidec|g ; \
s|@X11BASE@|${X11BASE}|g" ${FILESDIR}/build.vars \
> ${WRKSRC}/build.vars
.else
@sed -e "s|@CC@|${CC}|g ; s|@CFLAGS@|${CFLAGS}|g ; \
s|@CFLAGS_TREMOR@||g ; \
s|@LOCALBASE@|${LOCALBASE}|g ; s|@PREFIX@|${PREFIX}|g ; \
s|@SOUNDLIB@|-lvorbisfile -lvorbis -logg|g ; \
s|@X11BASE@|${X11BASE}|g" ${FILESDIR}/build.vars \
> ${WRKSRC}/build.vars
.endif
do-build:
cd ${WRKBUILD}; ./build.sh uqm

View File

@ -1,4 +1,4 @@
# $OpenBSD: build.vars,v 1.4 2005/06/23 00:50:17 jolan Exp $
# $OpenBSD: build.vars,v 1.5 2005/11/05 03:48:41 jolan Exp $
# Variables for the build procedure
# Copyright (c) 2002 Serge van den Boom
#
@ -23,8 +23,8 @@ MKDEPEND='@CC@ -MM'
MAKE='gmake'
ECHON='echo -n'
SED='sed'
uqm_CFLAGS='@CFLAGS@ -I@LOCALBASE@/include/SDL -D_REENTRANT -DGFXMODULE_SDL -DSOUNDMODULE_SDL -I@LOCALBASE@/include -DHAVE_ZIP=1 -I "."'
uqm_LDFLAGS="-L@LOCALBASE@/lib -L@X11BASE@/lib -lSDL -pthread -lX11 -lXext -lusbhid -lSDL_image -lvorbisfile -lvorbis -lm -logg -lz"
uqm_CFLAGS='@CFLAGS@ -I@LOCALBASE@/include/SDL -D_REENTRANT -DGFXMODULE_SDL -DSOUNDMODULE_SDL @CFLAGS_TREMOR@ -I@LOCALBASE@/include -DHAVE_ZIP=1 -I "."'
uqm_LDFLAGS="-L@LOCALBASE@/lib -L@X11BASE@/lib -lSDL -pthread -lX11 -lXext -lusbhid -lSDL_image @SOUNDLIB@ -lm -lz"
uqm_INSTALL_BINDIR='@PREFIX@/bin/'
uqm_INSTALL_LIBDIR='@PREFIX@/lib/'
uqm_INSTALL_SHAREDIR='@PREFIX@/share/'

View File

@ -0,0 +1,176 @@
$OpenBSD: patch-src_sc2code_comm_c,v 1.1 2005/11/05 03:48:41 jolan Exp $
--- src/sc2code/comm.c.orig Fri Nov 4 19:29:18 2005
+++ src/sc2code/comm.c Fri Nov 4 19:29:56 2005
@@ -41,7 +41,19 @@
#include <ctype.h>
+// Maximum ambient animation frame rate (actual execution rate)
+// A gfx frame is not always produced during an execution frame,
+// and several animations are combined into one gfx frame.
+// The rate was originally 120fps which allowed for more animation
+// precision which is ultimately wasted on the human eye anyway.
+// The highest known stable animation rate is 40fps, so that's what we use.
+#define AMBIENT_ANIM_RATE 40
+// Oscilloscope frame rate
+// Should be <= AMBIENT_ANIM_RATE
+// XXX: was 32 picked experimentally?
+#define OSCILLOSCOPE_RATE 32
+
static void init_xform_control (void);
static void uninit_xform_control (void);
static void xform_complete (void);
@@ -126,8 +138,10 @@ static int subtitle_state = DONE_SUBTITL
static Mutex subtitle_mutex;
static const UNICODE * volatile last_subtitle;
-static TFB_Image *subtitle_cache;
+CONTEXT TextCacheContext;
+FRAME TextCacheFrame;
+
/* _count_lines - sees how many lines a given input string would take to
* display given the line wrapping information
*/
@@ -166,28 +180,29 @@ add_text (int status, PTEXT pTextIn)
int num_lines = 0;
static COORD last_baseline;
BOOLEAN eol;
+ CONTEXT OldContext;
BatchGraphics ();
maxchars = (COUNT)~0;
if (status == 1)
{
- RECT r;
- GetContextClipRect (&r);
-
if (last_subtitle == pTextIn->pStr)
{
// draws cached subtitle
- TFB_DrawScreen_Image (subtitle_cache, r.corner.x, r.corner.y, 0, 0, TFB_SCREEN_MAIN);
+ STAMP s;
+
+ s.origin.x = s.origin.y = 0;
+ s.frame = TextCacheFrame;
+ DrawStamp (&s);
UnbatchGraphics ();
return last_baseline;
}
else
{
- // saves background to extra screen
- TFB_DrawScreen_Copy (&r, TFB_SCREEN_MAIN, TFB_SCREEN_EXTRA);
- // fills screen with transparent color
- TFB_DrawScreen_Rect (&r, 0, 0, 128, TFB_SCREEN_MAIN);
+ // draw to subtitle cache; prepare first
+ OldContext = SetContext (TextCacheContext);
+ ClearDrawable ();
last_subtitle = pTextIn->pStr;
}
@@ -302,16 +317,13 @@ add_text (int status, PTEXT pTextIn)
if (status == 1)
{
- RECT r;
- GetContextClipRect (&r);
+ STAMP s;
- // copies subtitle to cache
- TFB_DrawScreen_CopyToImage (subtitle_cache, &r, TFB_SCREEN_MAIN);
- // restores background
- TFB_DrawScreen_Copy (&r, TFB_SCREEN_EXTRA, TFB_SCREEN_MAIN);
- // draws cached subtitle
- TFB_DrawScreen_Image (subtitle_cache, r.corner.x, r.corner.y, 0, 0,
- TFB_SCREEN_MAIN);
+ // we were drawing to cache -- flush to screen
+ SetContext (OldContext);
+ s.origin.x = s.origin.y = 0;
+ s.frame = TextCacheFrame;
+ DrawStamp (&s);
last_baseline = pText->baseline.y;
}
@@ -547,15 +559,8 @@ xform_complete (void)
void
init_communication (void)
{
- TFB_Canvas canvas;
-
subtitle_mutex = CreateMutex ("Subtitle Lock", SYNC_CLASS_TOPLEVEL | SYNC_CLASS_VIDEO);
init_xform_control ();
-
- canvas = TFB_DrawCanvas_New_TrueColor (SIS_SCREEN_WIDTH,
- SIS_SCREEN_HEIGHT - SLIDER_Y - SLIDER_HEIGHT + 2, FALSE);
- subtitle_cache = TFB_DrawImage_New (canvas);
- TFB_DrawCanvas_SetTransparentColor (subtitle_cache->NormalImg, 0, 0, 128, TRUE);
}
void
@@ -563,8 +568,6 @@ uninit_communication (void)
{
DestroyMutex (subtitle_mutex);
uninit_xform_control ();
- TFB_DrawImage_Delete (subtitle_cache);
- subtitle_cache = NULL;
}
static volatile BOOLEAN ColorChange;
@@ -893,7 +896,7 @@ ambient_anim_task (void *data)
BOOLEAN Change, CanTalk;
DWORD CurTime, ElapsedTicks;
- SleepThreadUntil (LastTime + ONE_SECOND / 120);
+ SleepThreadUntil (LastTime + ONE_SECOND / AMBIENT_ANIM_RATE);
LockMutex (GraphicsLock);
BatchGraphics ();
@@ -1275,7 +1278,7 @@ ambient_anim_task (void *data)
SetContext (OldContext);
}
- if (LastOscillTime + (ONE_SECOND / 32) < CurTime)
+ if (LastOscillTime + (ONE_SECOND / OSCILLOSCOPE_RATE) < CurTime)
{
LastOscillTime = CurTime;
UpdateSpeechGraphics (FALSE);
@@ -1967,6 +1970,7 @@ HailAlien (void)
ENCOUNTER_STATE ES;
FONT PlayerFont, OldFont;
MUSIC_REF SongRef = 0;
+ COLOR TextBack;
pCurInputState = &ES;
memset (pCurInputState, 0, sizeof (*pCurInputState));
@@ -1997,6 +2001,18 @@ HailAlien (void)
LoadStringTableInstance ((RESOURCE)CommData.ConversationPhrases)
);
+ // init subtitle cache context
+ TextCacheContext = CaptureContext (CreateContext ());
+ TextCacheFrame = CaptureDrawable (CreateDrawable (WANT_PIXMAP | WANT_MASK,
+ SIS_SCREEN_WIDTH, SIS_SCREEN_HEIGHT - SLIDER_Y - SLIDER_HEIGHT + 2,
+ 1));
+ SetContext (TextCacheContext);
+ SetContextFGFrame (TextCacheFrame);
+ TextBack = BUILD_COLOR (MAKE_RGB15 (0, 0, 0x10), 1);
+ SetContextBackGroundColor (TextBack);
+ ClearDrawable ();
+ SetFrameTransparentColor (TextCacheFrame, TextBack);
+
ES.phrase_buf_index = 1;
ES.phrase_buf[0] = '\0';
@@ -2069,6 +2085,9 @@ HailAlien (void)
DestroyColorMap (ReleaseColorMap (CommData.AlienColorMap));
DestroyFont (ReleaseFont (CommData.AlienFont));
DestroyDrawable (ReleaseDrawable (CommData.AlienFrame));
+
+ DestroyContext (ReleaseContext (TextCacheContext));
+ DestroyDrawable (ReleaseDrawable (TextCacheFrame));
SetContext (SpaceContext);
SetContextFont (OldFont);

View File

@ -0,0 +1,37 @@
$OpenBSD: patch-src_sc2code_intro_c,v 1.1 2005/11/05 03:48:41 jolan Exp $
--- src/sc2code/intro.c.orig Tue May 3 23:25:53 2005
+++ src/sc2code/intro.c Fri Nov 4 19:30:52 2005
@@ -196,6 +196,7 @@ Present_GenerateSIS (PRESENTATION_INPUT_
HOT_SPOT hs;
int slot;
COUNT piece;
+ COLOR SisBack;
LockMutex (GraphicsLock);
OldContext = SetContext (OffScreenContext);
@@ -213,8 +214,11 @@ Present_GenerateSIS (PRESENTATION_INPUT_
WANT_PIXMAP, r.extent.width, r.extent.height, 1
));
SetContextFGFrame (SisFrame);
- SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (1, 1, 1), 7));
- DrawFilledRectangle (&r);
+ SetContextClipRect (NULL_PTR);
+ SisBack = BUILD_COLOR (MAKE_RGB15 (1, 1, 1), 7);
+ SetContextBackGroundColor (SisBack);
+ ClearDrawable ();
+ SetFrameTransparentColor (SisFrame, SisBack);
s.frame = SetAbsFrameIndex (SkelFrame, 0);
s.origin.x = 0;
@@ -264,11 +268,6 @@ Present_GenerateSIS (PRESENTATION_INPUT_
hs.x = r.extent.width / 2;
hs.y = r.extent.height / 2;
SetFrameHot (SisFrame, hs);
-
- /* TODO: this is a hack to get it to work
- * anyone know how to do this better? */
- TFB_DrawCanvas_SetTransparentColor (
- ((PFRAME_DESC)SisFrame)->image->NormalImg, 8, 8, 8, TRUE);
SetContext (OldContext);
FlushGraphics ();

View File

@ -0,0 +1,11 @@
$OpenBSD: patch-src_sc2code_libs_gfxlib_h,v 1.1 2005/11/05 03:48:41 jolan Exp $
--- src/sc2code/libs/gfxlib.h.orig Wed Jan 26 17:55:47 2005
+++ src/sc2code/libs/gfxlib.h Fri Nov 4 19:32:43 2005
@@ -246,6 +246,7 @@ extern FRAME SetEquFrameIndex (FRAME Dst
extern FRAME IncFrameIndex (FRAME Frame);
extern FRAME DecFrameIndex (FRAME Frame);
extern DRAWABLE RotateFrame (FRAME Frame, COUNT angle);
+extern void SetFrameTransparentColor (FRAME Frame, COLOR c32k);
extern FRAME CaptureDrawable (DRAWABLE Drawable);
extern DRAWABLE ReleaseDrawable (FRAME Frame);

View File

@ -0,0 +1,26 @@
$OpenBSD: patch-src_sc2code_libs_graphics_drawable_c,v 1.1 2005/11/05 03:48:41 jolan Exp $
--- src/sc2code/libs/graphics/drawable.c.orig Wed Jan 26 17:55:47 2005
+++ src/sc2code/libs/graphics/drawable.c Fri Nov 4 19:37:56 2005
@@ -21,6 +21,7 @@
#include "tfb_draw.h"
#include "units.h"
#include "libs/mathlib.h"
+#include "gfxother.h"
FRAMEPTR _CurFramePtr;
@@ -244,4 +245,14 @@ RotateFrame (FRAMEPTR Frame, COUNT angle
ReleaseDrawable (RotFramePtr);
return Drawable;
+}
+
+void
+SetFrameTransparentColor (FRAMEPTR Frame, COLOR c32k)
+{
+ TFB_Palette color;
+
+ COLORtoPalette (c32k, &color);
+ TFB_DrawCanvas_SetTransparentColor (Frame->image->NormalImg,
+ color.r, color.g, color.b, TRUE);
}

View File

@ -0,0 +1,25 @@
$OpenBSD: patch-src_sc2code_libs_graphics_font_c,v 1.1 2005/11/05 03:48:41 jolan Exp $
--- src/sc2code/libs/graphics/font.c.orig Thu Apr 21 20:56:51 2005
+++ src/sc2code/libs/graphics/font.c Fri Nov 4 19:37:56 2005
@@ -18,6 +18,7 @@
#include "gfxintrn.h"
#include "tfb_prim.h"
+#include "gfxother.h"
extern FRAME Build_Font_Effect (FRAME FramePtr, DWORD from, DWORD to,
@@ -258,12 +259,7 @@ _text_blt (PRECT pClipRect, PRIMITIVEPTR
if (FontPtr == NULL)
return;
- {
- DWORD c32k = _get_context_fg_color () >> 8;
- color.r = (UBYTE)((c32k >> (10 - (8 - 5))) & 0xF8);
- color.g = (UBYTE)((c32k >> (5 - (8 - 5))) & 0xF8);
- color.b = (UBYTE)((c32k << (8 - 5)) & 0xF8);
- }
+ COLORtoPalette (_get_context_fg_color (), &color);
TextPtr = &PrimPtr->Object.Text;
s.origin.x = _save_stamp.origin.x;

View File

@ -0,0 +1,160 @@
$OpenBSD: patch-src_sc2code_libs_graphics_frame_c,v 1.1 2005/11/05 03:48:41 jolan Exp $
--- src/sc2code/libs/graphics/frame.c.orig Wed Mar 16 06:50:16 2005
+++ src/sc2code/libs/graphics/frame.c Fri Nov 4 19:37:56 2005
@@ -21,6 +21,7 @@
#include "gfx_common.h"
#include "tfb_draw.h"
#include "tfb_prim.h"
+#include "gfxother.h"
HOT_SPOT
MAKE_HOT_SPOT (COORD x, COORD y)
@@ -88,12 +89,8 @@ void
ClearBackGround (PRECT pClipRect)
{
TFB_Palette color;
- DWORD c32k;
- c32k = _get_context_bg_color () >> 8; //shift out color index
- color.r = (UBYTE)((c32k >> (10 - (8 - 5))) & 0xF8);
- color.g = (UBYTE)((c32k >> (5 - (8 - 5))) & 0xF8);
- color.b = (UBYTE)((c32k << (8 - 5)) & 0xF8);
+ COLORtoPalette (_get_context_bg_color (), &color);
TFB_Prim_FillRect (pClipRect, &color);
}
@@ -144,7 +141,6 @@ DrawBatch (PPRIMITIVE lpBasePrim, PRIM_L
PPRIMITIVE lpWorkPrim;
RECT ClipRect;
TFB_Palette color;
- DWORD c32k;
lpPrim = &lpBasePrim[CurIndex];
PrimType = GetPrimType (lpPrim);
@@ -156,29 +152,18 @@ DrawBatch (PPRIMITIVE lpBasePrim, PRIM_L
switch (PrimType)
{
case POINT_PRIM:
- c32k = GetPrimColor (lpWorkPrim) >> 8; //shift out color index
- color.r = (UBYTE)((c32k >> (10 - (8 - 5))) & 0xF8);
- color.g = (UBYTE)((c32k >> (5 - (8 - 5))) & 0xF8);
- color.b = (UBYTE)((c32k << (8 - 5)) & 0xF8);
-
+ COLORtoPalette (GetPrimColor (lpWorkPrim), &color);
TFB_Prim_Point (&lpWorkPrim->Object.Point, &color);
break;
case STAMP_PRIM:
TFB_Prim_Stamp (&lpWorkPrim->Object.Stamp);
break;
case STAMPFILL_PRIM:
- c32k = GetPrimColor (lpWorkPrim) >> 8; //shift out color index
- color.r = (UBYTE)((c32k >> (10 - (8 - 5))) & 0xF8);
- color.g = (UBYTE)((c32k >> (5 - (8 - 5))) & 0xF8);
- color.b = (UBYTE)((c32k << (8 - 5)) & 0xF8);
+ COLORtoPalette (GetPrimColor (lpWorkPrim), &color);
TFB_Prim_StampFill (&lpWorkPrim->Object.Stamp, &color);
break;
case LINE_PRIM:
- c32k = GetPrimColor (lpWorkPrim) >> 8; //shift out color index
- color.r = (UBYTE)((c32k >> (10 - (8 - 5))) & 0xF8);
- color.g = (UBYTE)((c32k >> (5 - (8 - 5))) & 0xF8);
- color.b = (UBYTE)((c32k << (8 - 5)) & 0xF8);
-
+ COLORtoPalette (GetPrimColor (lpWorkPrim), &color);
TFB_Prim_Line (&lpWorkPrim->Object.Line, &color);
break;
case TEXT_PRIM:
@@ -191,16 +176,11 @@ DrawBatch (PPRIMITIVE lpBasePrim, PRIM_L
_text_blt (&ClipRect, lpWorkPrim);
break;
case RECT_PRIM:
- c32k = GetPrimColor (lpWorkPrim) >> 8; //shift out color index
- color.r = (UBYTE)((c32k >> (10 - (8 - 5))) & 0xF8);
- color.g = (UBYTE)((c32k >> (5 - (8 - 5))) & 0xF8);
- color.b = (UBYTE)((c32k << (8 - 5)) & 0xF8);
+ COLORtoPalette (GetPrimColor (lpWorkPrim), &color);
TFB_Prim_Rect (&lpWorkPrim->Object.Rect, &color);
+ break;
case RECTFILL_PRIM:
- c32k = GetPrimColor (lpWorkPrim) >> 8; //shift out color index
- color.r = (UBYTE)((c32k >> (10 - (8 - 5))) & 0xF8);
- color.g = (UBYTE)((c32k >> (5 - (8 - 5))) & 0xF8);
- color.b = (UBYTE)((c32k << (8 - 5)) & 0xF8);
+ COLORtoPalette (GetPrimColor (lpWorkPrim), &color);
TFB_Prim_FillRect (&lpWorkPrim->Object.Rect, &color);
break;
}
@@ -243,13 +223,8 @@ DrawPoint (PPOINT lpPoint)
if (GraphicsSystemActive () && GetFrameValidRect (&ValidRect, &OldHot))
{
TFB_Palette color;
- DWORD c32k;
- c32k = GetPrimColor (&_locPrim) >> 8; //shift out color index
- color.r = (UBYTE)((c32k >> (10 - (8 - 5))) & 0xF8);
- color.g = (UBYTE)((c32k >> (5 - (8 - 5))) & 0xF8);
- color.b = (UBYTE)((c32k << (8 - 5)) & 0xF8);
-
+ COLORtoPalette (GetPrimColor (&_locPrim), &color);
TFB_Prim_Point (lpPoint, &color);
_CurFramePtr->HotSpot = OldHot;
}
@@ -264,13 +239,8 @@ DrawRectangle (PRECT lpRect)
if (GraphicsSystemActive () && GetFrameValidRect (&ValidRect, &OldHot))
{
TFB_Palette color;
- DWORD c32k;
- c32k = GetPrimColor (&_locPrim) >> 8; //shift out color index
- color.r = (UBYTE)((c32k >> (10 - (8 - 5))) & 0xF8);
- color.g = (UBYTE)((c32k >> (5 - (8 - 5))) & 0xF8);
- color.b = (UBYTE)((c32k << (8 - 5)) & 0xF8);
-
+ COLORtoPalette (GetPrimColor (&_locPrim), &color);
TFB_Prim_Rect (lpRect, &color);
_CurFramePtr->HotSpot = OldHot;
}
@@ -285,13 +255,8 @@ DrawFilledRectangle (PRECT lpRect)
if (GraphicsSystemActive () && GetFrameValidRect (&ValidRect, &OldHot))
{
TFB_Palette color;
- DWORD c32k;
- c32k = GetPrimColor (&_locPrim) >> 8; //shift out color index
- color.r = (UBYTE)((c32k >> (10 - (8 - 5))) & 0xF8);
- color.g = (UBYTE)((c32k >> (5 - (8 - 5))) & 0xF8);
- color.b = (UBYTE)((c32k << (8 - 5)) & 0xF8);
-
+ COLORtoPalette (GetPrimColor (&_locPrim), &color);
TFB_Prim_FillRect (lpRect, &color);
_CurFramePtr->HotSpot = OldHot;
}
@@ -306,13 +271,8 @@ DrawLine (PLINE lpLine)
if (GraphicsSystemActive () && GetFrameValidRect (&ValidRect, &OldHot))
{
TFB_Palette color;
- DWORD c32k;
- c32k = GetPrimColor (&_locPrim) >> 8; //shift out color index
- color.r = (UBYTE)((c32k >> (10 - (8 - 5))) & 0xF8);
- color.g = (UBYTE)((c32k >> (5 - (8 - 5))) & 0xF8);
- color.b = (UBYTE)((c32k << (8 - 5)) & 0xF8);
-
+ COLORtoPalette (GetPrimColor (&_locPrim), &color);
TFB_Prim_Line (lpLine, &color);
_CurFramePtr->HotSpot = OldHot;
}
@@ -340,12 +300,8 @@ DrawFilledStamp (PSTAMP stmp)
if (GraphicsSystemActive () && GetFrameValidRect (&ValidRect, &OldHot))
{
TFB_Palette color;
- DWORD c32k;
- c32k = GetPrimColor (&_locPrim) >> 8; //shift out color index
- color.r = (UBYTE)((c32k >> (10 - (8 - 5))) & 0xF8);
- color.g = (UBYTE)((c32k >> (5 - (8 - 5))) & 0xF8);
- color.b = (UBYTE)((c32k << (8 - 5)) & 0xF8);
+ COLORtoPalette (GetPrimColor (&_locPrim), &color);
TFB_Prim_StampFill (stmp, &color);
_CurFramePtr->HotSpot = OldHot;
}

View File

@ -0,0 +1,36 @@
$OpenBSD: patch-src_sc2code_libs_graphics_gfxother_h,v 1.1 2005/11/05 03:48:41 jolan Exp $
--- src/sc2code/libs/graphics/gfxother.h.orig Fri Nov 4 19:37:39 2005
+++ src/sc2code/libs/graphics/gfxother.h Fri Nov 4 19:37:56 2005
@@ -0,0 +1,32 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef GFXOTHER_H
+#define GFXOTHER_H
+
+#include "gfxintrn.h"
+#include "tfb_draw.h"
+
+static inline void
+COLORtoPalette (DWORD c32k, TFB_Palette* color)
+{
+ c32k >>= 8; // shift out color index
+ color->r = (UBYTE)((c32k >> (10 - (8 - 5))) & 0xF8);
+ color->g = (UBYTE)((c32k >> (5 - (8 - 5))) & 0xF8);
+ color->b = (UBYTE)((c32k << (8 - 5)) & 0xF8);
+}
+
+#endif /* GFXOTHER */

View File

@ -0,0 +1,59 @@
$OpenBSD: patch-src_sc2code_libs_sound_decoders_oggaud_c,v 1.1 2005/11/05 03:48:41 jolan Exp $
--- src/sc2code/libs/sound/decoders/oggaud.c.orig Fri Nov 4 15:45:15 2005
+++ src/sc2code/libs/sound/decoders/oggaud.c Fri Nov 4 15:45:24 2005
@@ -25,8 +25,13 @@
#include "types.h"
#include "uio.h"
#include "decoder.h"
-#include <vorbis/codec.h>
-#include <vorbis/vorbisfile.h>
+#ifdef OVCODEC_TREMOR
+# include <tremor/ivorbiscodec.h>
+# include <tremor/ivorbisfile.h>
+#else
+# include <vorbis/codec.h>
+# include <vorbis/vorbisfile.h>
+#endif /* OVCODEC_TREMOR */
#include "oggaud.h"
@@ -194,8 +199,14 @@ ova_Open (THIS_PTR, uio_DirHandle *dir,
}
This->frequency = vinfo->rate;
+#ifdef OVCODEC_TREMOR
+ // With tremor ov_time_total returns an integer, in milliseconds.
+ This->length = ((float) ov_time_total (&ova->vf, -1)) / 1000.0f;
+#else
+ // With libvorbis ov_time_total returns a double, in seconds.
This->length = (float) ov_time_total (&ova->vf, -1);
-
+#endif /* OVCODEC_TREMOR */
+
if (vinfo->channels == 1)
This->format = ova_formats->mono16;
else
@@ -221,8 +232,12 @@ ova_Decode (THIS_PTR, void* buf, sint32
long rc;
int bitstream;
+#ifdef OVCODEC_TREMOR
+ rc = ov_read (&ova->vf, buf, bufsize, &bitstream);
+#else
rc = ov_read (&ova->vf, buf, bufsize, ova_formats->want_big_endian,
2, 1, &bitstream);
+#endif /* OVCODEC_TREMOR */
if (rc < 0)
ova->last_error = rc;
@@ -254,5 +269,10 @@ ova_GetFrame (THIS_PTR)
TFB_OggSoundDecoder* ova = (TFB_OggSoundDecoder*) This;
// this is the closest to a frame there is in ogg vorbis stream
// doesn't seem to be a func to retrive it
+#ifdef OVCODEC_TREMOR
+ return ova->vf.os->pageno;
+#else
return ova->vf.os.pageno;
+#endif /* OVCODEC_TREMOR */
}
+

View File

@ -0,0 +1,21 @@
$OpenBSD: patch-src_sc2code_libs_threads_sdl_sdlthreads_c,v 1.1 2005/11/05 03:48:41 jolan Exp $
--- src/sc2code/libs/threads/sdl/sdlthreads.c.orig Wed Jun 9 23:49:02 2004
+++ src/sc2code/libs/threads/sdl/sdlthreads.c Fri Nov 4 19:34:04 2005
@@ -547,7 +547,7 @@ LockRecursiveMutex_SDL (RecursiveMutex v
{
RecM *mtx = (RecM *)val;
Uint32 thread_id = SDL_ThreadID();
- if (mtx->thread_id != thread_id)
+ if (!mtx->locks || mtx->thread_id != thread_id)
{
#ifdef TRACK_CONTENTION
if (mtx->thread_id && (mtx->syncClass & TRACK_CONTENTION_CLASSES))
@@ -567,7 +567,7 @@ UnlockRecursiveMutex_SDL (RecursiveMutex
{
RecM *mtx = (RecM *)val;
Uint32 thread_id = SDL_ThreadID();
- if (mtx->thread_id != thread_id)
+ if (!mtx->locks || mtx->thread_id != thread_id)
{
#ifdef NAMED_SYNCHRO
fprintf (stderr, "'%s' attempted to unlock %s when it didn't hold it\n", MyThreadName (), mtx->name);