diff options
Diffstat (limited to 'engines/tinsel')
-rw-r--r-- | engines/tinsel/actors.cpp | 4 | ||||
-rw-r--r-- | engines/tinsel/bg.cpp | 2 | ||||
-rw-r--r-- | engines/tinsel/effect.cpp | 2 | ||||
-rw-r--r-- | engines/tinsel/events.cpp | 6 | ||||
-rw-r--r-- | engines/tinsel/faders.cpp | 6 | ||||
-rw-r--r-- | engines/tinsel/inventory.cpp | 4 | ||||
-rw-r--r-- | engines/tinsel/object.cpp | 4 | ||||
-rw-r--r-- | engines/tinsel/palette.cpp | 38 | ||||
-rw-r--r-- | engines/tinsel/palette.h | 25 | ||||
-rw-r--r-- | engines/tinsel/play.cpp | 6 | ||||
-rw-r--r-- | engines/tinsel/rince.cpp | 2 | ||||
-rw-r--r-- | engines/tinsel/scene.cpp | 14 | ||||
-rw-r--r-- | engines/tinsel/sched.cpp | 2 | ||||
-rw-r--r-- | engines/tinsel/sched.h | 2 | ||||
-rw-r--r-- | engines/tinsel/tinsel.cpp | 14 |
15 files changed, 67 insertions, 64 deletions
diff --git a/engines/tinsel/actors.cpp b/engines/tinsel/actors.cpp index a385c26f6f..7ea2da28f6 100644 --- a/engines/tinsel/actors.cpp +++ b/engines/tinsel/actors.cpp @@ -230,7 +230,7 @@ static void ActorRestoredProcess(CORO_PARAM) { void RestoreActorProcess(int id, PINT_CONTEXT pic) { RATP_INIT r = { pic, id }; - CoroutineInstall(PID_TCODE, ActorRestoredProcess, &r, sizeof(r)); + ProcessCreate(PID_TCODE, ActorRestoredProcess, &r, sizeof(r)); } /** @@ -247,7 +247,7 @@ void actorEvent(int ano, USER_EVENT event, BUTEVENT be) { atp.id = ano; atp.event = event; atp.bev = be; - CoroutineInstall(PID_TCODE, ActorTinselProcess, &atp, sizeof(atp)); + ProcessCreate(PID_TCODE, ActorTinselProcess, &atp, sizeof(atp)); } } diff --git a/engines/tinsel/bg.cpp b/engines/tinsel/bg.cpp index cf7e18dc08..833c2fe37f 100644 --- a/engines/tinsel/bg.cpp +++ b/engines/tinsel/bg.cpp @@ -176,7 +176,7 @@ void startupBackground(SCNHANDLE bfilm) { // Start display process for each reel in the film assert(FROM_LE_32(pfilm->numreels) == 1); // Multi-reeled backgrounds withdrawn - CoroutineInstall(PID_REEL, BGmainProcess, &pfilm->reels[0], sizeof(FREEL)); + ProcessCreate(PID_REEL, BGmainProcess, &pfilm->reels[0], sizeof(FREEL)); } /** diff --git a/engines/tinsel/effect.cpp b/engines/tinsel/effect.cpp index 825825ccec..b75e186c74 100644 --- a/engines/tinsel/effect.cpp +++ b/engines/tinsel/effect.cpp @@ -102,7 +102,7 @@ static void FettleEffectPolys(int x, int y, int index, PMACTOR pActor) { epi.hEpoly = hPoly; epi.pActor = pActor; epi.index = index; - CoroutineInstall(PID_TCODE, EffectProcess, &epi, sizeof(epi)); + ProcessCreate(PID_TCODE, EffectProcess, &epi, sizeof(epi)); } } } diff --git a/engines/tinsel/events.cpp b/engines/tinsel/events.cpp index 8064bdd3f3..311f1c0906 100644 --- a/engines/tinsel/events.cpp +++ b/engines/tinsel/events.cpp @@ -184,13 +184,13 @@ static void PolyTinselProcess(CORO_PARAM) { void RunPolyTinselCode(HPOLYGON hPoly, USER_EVENT event, BUTEVENT be, bool tc) { TP_INIT to = { hPoly, event, be, tc, 0 }; - CoroutineInstall(PID_TCODE, PolyTinselProcess, &to, sizeof(to)); + ProcessCreate(PID_TCODE, PolyTinselProcess, &to, sizeof(to)); } void effRunPolyTinselCode(HPOLYGON hPoly, USER_EVENT event, int actor) { TP_INIT to = { hPoly, event, BE_NONE, false, actor }; - CoroutineInstall(PID_TCODE, PolyTinselProcess, &to, sizeof(to)); + ProcessCreate(PID_TCODE, PolyTinselProcess, &to, sizeof(to)); } //----------------------------------------------------------------------- @@ -233,7 +233,7 @@ static void WalkProcess(CORO_PARAM) { void walkto(int x, int y) { WP_INIT to = { x, y }; - CoroutineInstall(PID_TCODE, WalkProcess, &to, sizeof(to)); + ProcessCreate(PID_TCODE, WalkProcess, &to, sizeof(to)); } /** diff --git a/engines/tinsel/faders.cpp b/engines/tinsel/faders.cpp index 9ac742800f..3b3940fa9c 100644 --- a/engines/tinsel/faders.cpp +++ b/engines/tinsel/faders.cpp @@ -35,7 +35,7 @@ namespace Tinsel { /** structure used by the "FadeProcess" process */ struct FADE { const long *pColourMultTable; // list of fixed point colour multipliers - terminated with negative entry - PPALQ pPalQ; // palette queue entry to fade + PALQ *pPalQ; // palette queue entry to fade }; // fixed point fade multiplier tables @@ -120,7 +120,7 @@ static void FadeProcess(CORO_PARAM) { * @param noFadeTable List of palettes not to fade */ static void Fader(const long multTable[], SCNHANDLE noFadeTable[]) { - PPALQ pPal; // palette manager iterator + PALQ *pPal; // palette manager iterator // create a process for each palette in the palette queue for (pPal = GetNextPalette(NULL); pPal != NULL; pPal = GetNextPalette(pPal)) { @@ -149,7 +149,7 @@ static void Fader(const long multTable[], SCNHANDLE noFadeTable[]) { fade.pPalQ = pPal; // create a fader process for this palette - CoroutineInstall(PID_FADER, FadeProcess, (void *)&fade, sizeof(FADE)); + ProcessCreate(PID_FADER, FadeProcess, (void *)&fade, sizeof(FADE)); } } } diff --git a/engines/tinsel/inventory.cpp b/engines/tinsel/inventory.cpp index 96ee01edf6..9c07748ab3 100644 --- a/engines/tinsel/inventory.cpp +++ b/engines/tinsel/inventory.cpp @@ -980,7 +980,7 @@ void RunInvTinselCode(PINV_OBJECT pinvo, USER_EVENT event, BUTEVENT be, int inde return; GlitterIndex = index; - CoroutineInstall(PID_TCODE, InvTinselProcess, &to, sizeof(to)); + ProcessCreate(PID_TCODE, InvTinselProcess, &to, sizeof(to)); } /**************************************************************************/ @@ -3938,7 +3938,7 @@ void InvPickup(int index) { else if (!(invObj->attribute & IO_ONLYINV1 && ino !=INV_1) && !(invObj->attribute & IO_ONLYINV2 && ino !=INV_2)) - CoroutineInstall(PID_TCODE, InvPdProcess, &index, sizeof(index)); + ProcessCreate(PID_TCODE, InvPdProcess, &index, sizeof(index)); } } } diff --git a/engines/tinsel/object.cpp b/engines/tinsel/object.cpp index 6996cff64e..a708cd36d7 100644 --- a/engines/tinsel/object.cpp +++ b/engines/tinsel/object.cpp @@ -365,7 +365,7 @@ OBJECT *InitObject(const OBJ_INIT *pInitTbl) { // get pointer to image if (pInitTbl->hObjImg) { int aniX, aniY; // objects animation offsets - PPALQ pPalQ; // palette queue pointer + PALQ *pPalQ; // palette queue pointer const IMAGE *pImg = (const IMAGE *)LockMem(pInitTbl->hObjImg); // handle to image // allocate a palette for this object @@ -477,7 +477,7 @@ void AnimateObject(OBJECT *pAniObj, SCNHANDLE hNewImg) { OBJECT *RectangleObject(SCNHANDLE hPal, int colour, int width, int height) { // template for initialising the rectangle object static const OBJ_INIT rectObj = {0, DMA_CONST, OID_EFFECTS, 0, 0, 0}; - PPALQ pPalQ; // palette queue pointer + PALQ *pPalQ; // palette queue pointer // allocate and init a new object OBJECT *pRect = InitObject(&rectObj); diff --git a/engines/tinsel/palette.cpp b/engines/tinsel/palette.cpp index 50a908afe3..130e58ec5f 100644 --- a/engines/tinsel/palette.cpp +++ b/engines/tinsel/palette.cpp @@ -34,6 +34,22 @@ namespace Tinsel { +//----------------- LOCAL DEFINES -------------------- + +/** video DAC transfer Q structure */ +struct VIDEO_DAC_Q { + union { + SCNHANDLE hRGBarray; //!< handle of palette or + COLORREF *pRGBarray; //!< list of palette colours + } pal; + bool bHandle; //!< when set - use handle of palette + int destDACindex; //!< start index of palette in video DAC + int numColours; //!< number of colours in "hRGBarray" +}; + + +//----------------- LOCAL GLOBAL DATA -------------------- + /** background colour */ static COLORREF bgndColour = BLACK; @@ -67,8 +83,8 @@ static int maxDACQ = 0; * Transfer palettes in the palette Q to Video DAC. */ void PalettesToVideoDAC(void) { - PPALQ pPalQ; // palette Q iterator - PVIDEO_DAC_Q pDACtail = vidDACdata; // set tail pointer + PALQ *pPalQ; // palette Q iterator + VIDEO_DAC_Q *pDACtail = vidDACdata; // set tail pointer bool needUpdate = false; // while Q is not empty @@ -198,10 +214,10 @@ void UpdateDACqueue(int posInDAC, int numColours, COLORREF *pColours) { * Allocate a palette. * @param hNewPal Palette to allocate */ -PPALQ AllocPalette(SCNHANDLE hNewPal) { - PPALQ pPrev, p; // walks palAllocData +PALQ *AllocPalette(SCNHANDLE hNewPal) { + PALQ *pPrev, *p; // walks palAllocData int iDAC; // colour index in video DAC - PPALQ pNxtPal; // next PALQ struct in palette allocator + PALQ *pNxtPal; // next PALQ struct in palette allocator PALETTE *pNewPal; // get pointer to new palette @@ -274,7 +290,7 @@ PPALQ AllocPalette(SCNHANDLE hNewPal) { * Free a palette allocated with "AllocPalette". * @param pFreePal Palette queue entry to free */ -void FreePalette(PPALQ pFreePal) { +void FreePalette(PALQ *pFreePal) { // validate palette Q pointer assert(pFreePal >= palAllocData && pFreePal <= palAllocData + NUM_PALETTES - 1); @@ -299,8 +315,8 @@ void FreePalette(PPALQ pFreePal) { * Find the specified palette. * @param hSrchPal Hardware palette to search for */ -PPALQ FindPalette(SCNHANDLE hSrchPal) { - PPALQ pPal; // palette allocator iterator +PALQ *FindPalette(SCNHANDLE hSrchPal) { + PALQ *pPal; // palette allocator iterator // search all structs in palette allocator for (pPal = palAllocData; pPal < palAllocData + NUM_PALETTES; pPal++) { @@ -318,7 +334,7 @@ PPALQ FindPalette(SCNHANDLE hSrchPal) { * @param pPalQ Palette queue position * @param hNewPal New palette */ -void SwapPalette(PPALQ pPalQ, SCNHANDLE hNewPal) { +void SwapPalette(PALQ *pPalQ, SCNHANDLE hNewPal) { // convert handle to palette pointer PALETTE *pNewPal = (PALETTE *)LockMem(hNewPal); @@ -336,7 +352,7 @@ void SwapPalette(PPALQ pPalQ, SCNHANDLE hNewPal) { } else { // # colours are different - will have to update all following palette entries - PPALQ pNxtPalQ; // next palette queue position + PALQ *pNxtPalQ; // next palette queue position for (pNxtPalQ = pPalQ + 1; pNxtPalQ < palAllocData + NUM_PALETTES; pNxtPalQ++) { if (pNxtPalQ->posInDAC >= pPalQ->posInDAC + pPalQ->numColours) @@ -362,7 +378,7 @@ void SwapPalette(PPALQ pPalQ, SCNHANDLE hNewPal) { * Statless palette iterator. Returns the next palette in the list * @param pStrtPal Palette to start from - when NULL will start from beginning of list */ -PPALQ GetNextPalette(PPALQ pStrtPal) { +PALQ *GetNextPalette(PALQ *pStrtPal) { if (pStrtPal == NULL) { // start of palette iteration - return 1st palette return (palAllocData[0].objCount) ? palAllocData : NULL; diff --git a/engines/tinsel/palette.h b/engines/tinsel/palette.h index ed648950fd..fdc4826dbd 100644 --- a/engines/tinsel/palette.h +++ b/engines/tinsel/palette.h @@ -67,18 +67,6 @@ enum { #define CYAN (RGB(0, MAX_INTENSITY, MAX_INTENSITY)) -/** video DAC transfer Q structure */ -struct VIDEO_DAC_Q { - union { - SCNHANDLE hRGBarray; //!< handle of palette or - COLORREF *pRGBarray; //!< list of palette colours - } pal; - bool bHandle; //!< when set - use handle of palette - int destDACindex; //!< start index of palette in video DAC - int numColours; //!< number of colours in "hRGBarray" -}; -typedef VIDEO_DAC_Q *PVIDEO_DAC_Q; - #include "common/pack-start.h" // START STRUCT PACKING /** hardware palette structure */ @@ -97,7 +85,6 @@ struct PALQ { int posInDAC; //!< palette position in the video DAC int numColours; //!< number of colours in the palette }; -typedef PALQ *PPALQ; #define PALETTE_MOVED 0x8000 // when this bit is set in the "posInDAC" @@ -129,21 +116,21 @@ void UpdateDACqueue( // places a palette in the video DAC queue int numColours, // number of colours in palette COLORREF *pColours); // list of RGB tripples -PPALQ AllocPalette( // allocate a new palette +PALQ *AllocPalette( // allocate a new palette SCNHANDLE hNewPal); // palette to allocate void FreePalette( // free a palette allocated with "AllocPalette" - PPALQ pFreePal); // palette queue entry to free + PALQ *pFreePal); // palette queue entry to free -PPALQ FindPalette( // find a palette in the palette queue +PALQ *FindPalette( // find a palette in the palette queue SCNHANDLE hSrchPal); // palette to search for void SwapPalette( // swaps palettes at the specified palette queue position - PPALQ pPalQ, // palette queue position + PALQ *pPalQ, // palette queue position SCNHANDLE hNewPal); // new palette -PPALQ GetNextPalette( // returns the next palette in the queue - PPALQ pStrtPal); // queue position to start from - when NULL will start from beginning of queue +PALQ *GetNextPalette( // returns the next palette in the queue + PALQ *pStrtPal); // queue position to start from - when NULL will start from beginning of queue COLORREF GetBgndColour(void); // returns current background colour diff --git a/engines/tinsel/play.cpp b/engines/tinsel/play.cpp index 6daf851fd2..9b355a6da9 100644 --- a/engines/tinsel/play.cpp +++ b/engines/tinsel/play.cpp @@ -417,7 +417,7 @@ void playFilm(SCNHANDLE film, int x, int y, int actorid, bool splay, int sfact, newestFilm(film, &pfilm->reels[i]); ppi.column = i; - CoroutineInstall(PID_REEL, playProcess, &ppi, sizeof(ppi)); + ProcessCreate(PID_REEL, playProcess, &ppi, sizeof(ppi)); } } @@ -459,7 +459,7 @@ void playFilmc(CORO_PARAM, SCNHANDLE film, int x, int y, int actorid, bool splay newestFilm(film, &pfilm->reels[i]); _ctx->ppi.column = i; - CoroutineInstall(PID_REEL, playProcess, &_ctx->ppi, sizeof(PPINIT)); + ProcessCreate(PID_REEL, playProcess, &_ctx->ppi, sizeof(PPINIT)); } newestFilm(film, &pfilm->reels[0]); @@ -501,7 +501,7 @@ void playThisReel(SCNHANDLE film, short reelnum, short z, int x, int y) { newestFilm(film, &pfilm->reels[reelnum]); // Start display process for the reel - CoroutineInstall(PID_REEL, playProcess, &ppi, sizeof(ppi)); + ProcessCreate(PID_REEL, playProcess, &ppi, sizeof(ppi)); } } // end of namespace Tinsel diff --git a/engines/tinsel/rince.cpp b/engines/tinsel/rince.cpp index 1ecf43f821..fbae8bc6b0 100644 --- a/engines/tinsel/rince.cpp +++ b/engines/tinsel/rince.cpp @@ -633,7 +633,7 @@ void MActorProcess(CORO_PARAM) { void MActorProcessCreate(int X, int Y, int id, PMACTOR pActor) { MActorProcessHelper(X, Y, id, pActor); - pActor->pProc = CoroutineInstall(PID_MACTOR, MActorProcess, &pActor, sizeof(PMACTOR)); + pActor->pProc = ProcessCreate(PID_MACTOR, MActorProcess, &pActor, sizeof(PMACTOR)); } diff --git a/engines/tinsel/scene.cpp b/engines/tinsel/scene.cpp index fd4dfcacea..a7d48e2406 100644 --- a/engines/tinsel/scene.cpp +++ b/engines/tinsel/scene.cpp @@ -154,7 +154,7 @@ static void LoadScene(SCNHANDLE scene, int entry) { for (i = 0; i < FROM_LE_32(ss->numEntrance); i++, es++) { if (FROM_LE_32(es->eNumber) == (uint)entry) { if (es->hScript) - CoroutineInstall(PID_TCODE, SceneTinselProcess, &es->hScript, sizeof(es->hScript)); + ProcessCreate(PID_TCODE, SceneTinselProcess, &es->hScript, sizeof(es->hScript)); break; } } @@ -163,7 +163,7 @@ static void LoadScene(SCNHANDLE scene, int entry) { error("Non-existant scene entry number"); if (ss->hSceneScript) - CoroutineInstall(PID_TCODE, SceneTinselProcess, &ss->hSceneScript, sizeof(ss->hSceneScript)); + ProcessCreate(PID_TCODE, SceneTinselProcess, &ss->hSceneScript, sizeof(ss->hSceneScript)); } // Default refer type @@ -257,16 +257,16 @@ void PrimeScene(void) { RestartCursor(); // Restart the cursor EnableTags(); // Next scene with tags enabled - CoroutineInstall(PID_SCROLL, ScrollProcess, NULL, 0); - CoroutineInstall(PID_SCROLL, EffectPolyProcess, NULL, 0); + ProcessCreate(PID_SCROLL, ScrollProcess, NULL, 0); + ProcessCreate(PID_SCROLL, EffectPolyProcess, NULL, 0); #ifdef DEBUG if (ShowPosition) - CoroutineInstall(PID_POSITION, CursorPositionProcess, NULL, 0); + ProcessCreate(PID_POSITION, CursorPositionProcess, NULL, 0); #endif - CoroutineInstall(PID_TAG, TagProcess, NULL, 0); - CoroutineInstall(PID_TAG, PointProcess, NULL, 0); + ProcessCreate(PID_TAG, TagProcess, NULL, 0); + ProcessCreate(PID_TAG, PointProcess, NULL, 0); // init the current background PrimeBackground(); diff --git a/engines/tinsel/sched.cpp b/engines/tinsel/sched.cpp index 9391805040..0371449eb1 100644 --- a/engines/tinsel/sched.cpp +++ b/engines/tinsel/sched.cpp @@ -147,7 +147,7 @@ void Scheduler(void) { * @param pParam process specific info * @param sizeParam size of process specific info */ -PROCESS *CoroutineInstall(int pid, CORO_ADDR coroAddr, const void *pParam, int sizeParam) { +PROCESS *ProcessCreate(int pid, CORO_ADDR coroAddr, const void *pParam, int sizeParam) { PROCESS *pProc; // get a free process diff --git a/engines/tinsel/sched.h b/engines/tinsel/sched.h index 6b89a60891..51074b5c7d 100644 --- a/engines/tinsel/sched.h +++ b/engines/tinsel/sched.h @@ -69,7 +69,7 @@ void ProcessStats(void); // Shows the maximum number of process used at once void Scheduler(void); // called to start process dispatching -PROCESS *CoroutineInstall(int pid, CORO_ADDR coroAddr, const void *pParam, int sizeParam); +PROCESS *ProcessCreate(int pid, CORO_ADDR coroAddr, const void *pParam, int sizeParam); void ProcessKill( // kill a process PROCESS *pKillProc); // which process to kill (must be different from current one) diff --git a/engines/tinsel/tinsel.cpp b/engines/tinsel/tinsel.cpp index ec16e73294..8139e9f55d 100644 --- a/engines/tinsel/tinsel.cpp +++ b/engines/tinsel/tinsel.cpp @@ -386,8 +386,8 @@ void MouseProcess(CORO_PARAM) { void EventsInstall(void) { lastLeftClick = lastRightClick = DwGetCurrentTime(); - pMouseProcess = CoroutineInstall(PID_MOUSE, MouseProcess, NULL, 0); - pKeyboardProcess = CoroutineInstall(PID_KEYBOARD, KeyboardProcess, NULL, 0); + pMouseProcess = ProcessCreate(PID_MOUSE, MouseProcess, NULL, 0); + pKeyboardProcess = ProcessCreate(PID_KEYBOARD, KeyboardProcess, NULL, 0); } /** @@ -498,11 +498,11 @@ static void RestoredProcess(CORO_PARAM) { } void RestoreProcess(PINT_CONTEXT pic) { - CoroutineInstall(PID_TCODE, RestoredProcess, &pic, sizeof(pic)); + ProcessCreate(PID_TCODE, RestoredProcess, &pic, sizeof(pic)); } void RestoreMasterProcess(PINT_CONTEXT pic) { - CoroutineInstall(PID_MASTER_SCR, RestoredProcess, &pic, sizeof(pic)); + ProcessCreate(PID_MASTER_SCR, RestoredProcess, &pic, sizeof(pic)); } // FIXME: CountOut is used by ChangeScene @@ -868,11 +868,11 @@ bool TinselEngine::pollEvent() { void TinselEngine::CreateConstProcesses(void) { // Process to run the master script - CoroutineInstall(PID_MASTER_SCR, MasterScriptProcess, NULL, 0); + ProcessCreate(PID_MASTER_SCR, MasterScriptProcess, NULL, 0); // Processes to run the cursor and inventory, - CoroutineInstall(PID_CURSOR, CursorProcess, NULL, 0); - CoroutineInstall(PID_INVENTORY, InventoryProcess, NULL, 0); + ProcessCreate(PID_CURSOR, CursorProcess, NULL, 0); + ProcessCreate(PID_INVENTORY, InventoryProcess, NULL, 0); } /** |