diff options
Diffstat (limited to 'engines/cge/mixer.cpp')
-rw-r--r-- | engines/cge/mixer.cpp | 203 |
1 files changed, 93 insertions, 110 deletions
diff --git a/engines/cge/mixer.cpp b/engines/cge/mixer.cpp index 385634d4b8..47a6e17fc9 100644 --- a/engines/cge/mixer.cpp +++ b/engines/cge/mixer.cpp @@ -25,136 +25,119 @@ * Copyright (c) 1994-1995 Janus B. Wisniewski and L.K. Avalon */ -#include "cge/mixer.h" -#include "cge/text.h" -#include "cge/snail.h" -#include "cge/mouse.h" -#include "cge/snddrv.h" -#include <string.h> -//#include <alloc.h> +#include "cge/mixer.h" +#include "cge/text.h" +#include "cge/snail.h" +#include "cge/mouse.h" +#include "cge/snddrv.h" +#include <string.h> namespace CGE { -extern MOUSE Mouse; - - bool MIXER::Appear = false; - - - -MIXER::MIXER (int x, int y) -: SPRITE(NULL), Fall(MIX_FALL) -{ - int i; - Appear = true; - mb[0] = new BITMAP("VOLUME"); - mb[1] = NULL; - SetShapeList(mb); - SetName(Text[MIX_NAME]); - Flags.Syst = true; - Flags.Kill = true; - Flags.BDel = true; - Goto(x, y); - Z = MIX_Z; - - // slaves - - for (i = 0; i < MIX_MAX; i ++) - { - static char fn[] = "V00"; - wtom(i, fn+1, 10, 2); - lb[i] = new BITMAP(fn); - ls[i].Now = ls[i].Next = i; - ls[i].Dx = ls[i].Dy = ls[i].Dly = 0; - } - lb[i] = NULL; - - for (i = 0; i < ArrayCount(Led); i ++) - { - register SPRITE * spr = new SPRITE(lb); - spr->SetSeq(ls); - spr->Goto(x+2+12*i, y+8); - spr->Flags.Tran = true; - spr->Flags.Kill = true; - spr->Flags.BDel = false; - spr->Z = MIX_Z; - Led[i] = spr; - } - Led[ArrayCount(Led)-1]->Flags.BDel = true; - - VGA::ShowQ.Insert(this); - for (i = 0; i < ArrayCount(Led); i ++) VGA::ShowQ.Insert(Led[i]); - - //--- reset balance - i = (SNDDrvInfo.VOL4.ML + SNDDrvInfo.VOL4.MR) / 2; - SNDDrvInfo.VOL4.ML = i; - SNDDrvInfo.VOL4.MR = i; - i = (SNDDrvInfo.VOL4.DL + SNDDrvInfo.VOL4.DR) / 2; - SNDDrvInfo.VOL4.DL = i; - SNDDrvInfo.VOL4.DR = i; - Update(); - Time = MIX_DELAY; -} +extern MOUSE Mouse; + +bool MIXER::Appear = false; +MIXER::MIXER(int x, int y) : SPRITE(NULL), Fall(MIX_FALL) { + Appear = true; + mb[0] = new BITMAP("VOLUME"); + mb[1] = NULL; + SetShapeList(mb); + SetName(Text[MIX_NAME]); + Flags.Syst = true; + Flags.Kill = true; + Flags.BDel = true; + Goto(x, y); + Z = MIX_Z; + // slaves -MIXER::~MIXER (void) -{ - Appear = false; + int i; + for (i = 0; i < MIX_MAX; i ++) { + static char fn[] = "V00"; + wtom(i, fn + 1, 10, 2); + lb[i] = new BITMAP(fn); + ls[i].Now = ls[i].Next = i; + ls[i].Dx = ls[i].Dy = ls[i].Dly = 0; + } + lb[i] = NULL; + + for (i = 0; i < ArrayCount(Led); i ++) { + register SPRITE *spr = new SPRITE(lb); + spr->SetSeq(ls); + spr->Goto(x + 2 + 12 * i, y + 8); + spr->Flags.Tran = true; + spr->Flags.Kill = true; + spr->Flags.BDel = false; + spr->Z = MIX_Z; + Led[i] = spr; + } + Led[ArrayCount(Led) - 1]->Flags.BDel = true; + + VGA::ShowQ.Insert(this); + for (i = 0; i < ArrayCount(Led); i ++) + VGA::ShowQ.Insert(Led[i]); + + //--- reset balance + i = (SNDDrvInfo.VOL4.ML + SNDDrvInfo.VOL4.MR) / 2; + SNDDrvInfo.VOL4.ML = i; + SNDDrvInfo.VOL4.MR = i; + i = (SNDDrvInfo.VOL4.DL + SNDDrvInfo.VOL4.DR) / 2; + SNDDrvInfo.VOL4.DL = i; + SNDDrvInfo.VOL4.DR = i; + Update(); + Time = MIX_DELAY; } +MIXER::~MIXER(void) { + Appear = false; +} #pragma argsused -void MIXER::Touch (uint16 mask, int x, int y) -{ - SPRITE::Touch(mask, x, y); - if (mask & L_UP) - { - uint8 * vol = (&SNDDrvInfo.VOL2.D) + (x < W/2); - if (y < MIX_BHIG) { if (*vol < 0xFF) *vol += 0x11; } - else if (y >= H-MIX_BHIG) { if (*vol > 0x00) *vol -= 0x11; } - Update(); - } +void MIXER::Touch(uint16 mask, int x, int y) { + SPRITE::Touch(mask, x, y); + if (mask & L_UP) { + uint8 *vol = (&SNDDrvInfo.VOL2.D) + (x < W / 2); + if (y < MIX_BHIG) { + if (*vol < 0xFF) + *vol += 0x11; + } else if (y >= H - MIX_BHIG) { + if (*vol > 0x00) + *vol -= 0x11; + } + Update(); + } } - -void MIXER::Tick (void) -{ - int x = Mouse.X, y = Mouse.Y; - if (SpriteAt(x, y) == this) - { - Fall = MIX_FALL; - if (Flags.Hold) Touch(L_UP, x-X, y-Y); - } - else - { - if (Fall) -- Fall; - else - { - int i; - for (i = 0; i < ArrayCount(Led); i ++) - { - SNPOST_(SNKILL, -1, 0, Led[i]); - } - SNPOST_(SNKILL, -1, 0, this); +void MIXER::Tick(void) { + int x = Mouse.X, y = Mouse.Y; + if (SpriteAt(x, y) == this) { + Fall = MIX_FALL; + if (Flags.Hold) + Touch(L_UP, x - X, y - Y); + } else { + if (Fall) + --Fall; + else { + for (int i = 0; i < ArrayCount(Led); i ++) + SNPOST_(SNKILL, -1, 0, Led[i]); + SNPOST_(SNKILL, -1, 0, this); + } } - } - Time = MIX_DELAY; + Time = MIX_DELAY; } +void MIXER::Update(void) { + Led[0]->Step(SNDDrvInfo.VOL4.ML); + Led[1]->Step(SNDDrvInfo.VOL4.DL); - -void MIXER::Update (void) -{ - Led[0]->Step(SNDDrvInfo.VOL4.ML); - Led[1]->Step(SNDDrvInfo.VOL4.DL); - - //TODO Change the SNPOST message send to a special way to send function pointer - //SNPOST_(SNEXEC, -1, 0, (void*)&SNDSetVolume); - warning("FIXME: MIXER::Update"); + //TODO Change the SNPOST message send to a special way to send function pointer + //SNPOST_(SNEXEC, -1, 0, (void*)&SNDSetVolume); + warning("STUB: MIXER::Update"); } } // End of namespace CGE |