[Scummvm-cvs-logs] CVS: scummvm/scumm costume.cpp,1.174,1.175 player_nes.cpp,2.2,2.3 player_nes.h,2.1,2.2 script_v2.cpp,2.270,2.271 script_v5.cpp,1.279,1.280
Eugene Sandulenko
sev at users.sourceforge.net
Thu Apr 7 14:13:24 CEST 2005
- Previous message: [Scummvm-cvs-logs] CVS: residual driver.h,1.9,1.10 driver_gl.cpp,1.47,1.48 driver_gl.h,1.22,1.23 driver_tinygl.cpp,1.16,1.17 driver_tinygl.h,1.9,1.10 lua.cpp,1.120,1.121
- Next message: [Scummvm-cvs-logs] CVS: scummvm/scumm script_v72he.cpp,2.237,2.238 scumm.cpp,1.410,1.411
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1309
Modified Files:
costume.cpp player_nes.cpp player_nes.h script_v2.cpp
script_v5.cpp
Log Message:
Patch from Quietust:
1. properly handle costume colors in dark rooms (verified against disasm)
2. optimize NES audio generation a little bit - instead of calling a function ~80 times to get one audio sample, it calls it once and just loops ~80 times internally
3. NES audio now obeys the volume control
4. in MM NES, o2_setObjPreposition is a no-op
5. o2_lights uses new-style light values (i.e. bitfields) in MM NES
6. o2_delay, use ssPaused identifier rather than a literal '1'
7. in MM NES, o5_saveLoadGame only explicitly checks for type '1' (load), defaulting to save for any other value
Index: costume.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/costume.cpp,v
retrieving revision 1.174
retrieving revision 1.175
diff -u -d -r1.174 -r1.175
--- costume.cpp 1 Apr 2005 21:35:44 -0000 1.174
+++ costume.cpp 7 Apr 2005 21:13:01 -0000 1.175
@@ -642,7 +642,7 @@
if (cost.curpos[limb] == 0xFFFF)
return 0;
- if (_vm->VAR(_vm->VAR_CURRENT_LIGHTS) & LIGHTMODE_actor_color)
+ if (_vm->VAR(_vm->VAR_CURRENT_LIGHTS) & LIGHTMODE_actor_base)
palette = _vm->_NESPalette[1];
else
palette = darkpalette;
Index: player_nes.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/player_nes.cpp,v
retrieving revision 2.2
retrieving revision 2.3
diff -u -d -r2.2 -r2.3
--- player_nes.cpp 7 Apr 2005 07:36:54 -0000 2.2
+++ player_nes.cpp 7 Apr 2005 21:13:01 -0000 2.3
@@ -579,32 +579,27 @@
Frame.Cycles = 1;
}
-int16 sample_pos = 0;
-bool sample_ok = false;
+int16 APU_GetSample(void) {
+ int sampcycles = 0, samppos = 0;
+ int NewBufPos = APU.BufPos;
+ while (NewBufPos == APU.BufPos) {
+ NewBufPos = APU.SampleRate * ++APU.Cycles / 1789773;
+ if (APU.Cycles == 1789773) // we've generated 1 second, so we can reset our counters now
+ APU.Cycles = NewBufPos = 0;
-void APU_Run(void) {
- static int sampcycles = 0, samppos = 0;
- int NewBufPos = APU.SampleRate * ++APU.Cycles / 1789773;
+ Frame_Run();
+ Square0_Run();
+ Square1_Run();
+ Triangle_Run();
+ Noise_Run();
- if (NewBufPos == APU.SampleRate) /* we've generated 1 second, so we can reset our counters now */
- APU.Cycles = NewBufPos = 0;
+ samppos += Square0.Pos + Square1.Pos + Triangle.Pos + Noise.Pos;
+ sampcycles++;
+ }
- Frame_Run();
- Square0_Run();
- Square1_Run();
- Triangle_Run();
- Noise_Run();
+ APU.BufPos = NewBufPos;
- samppos += Square0.Pos + Square1.Pos + Triangle.Pos + Noise.Pos;
- sampcycles++;
-
- if (NewBufPos != APU.BufPos) {
- APU.BufPos = NewBufPos;
- samppos = (samppos << 6) / sampcycles;
- sample_pos = samppos;
- sample_ok = true;
- samppos = sampcycles = 0;
- }
+ return (samppos << 6) / sampcycles;
}
}
@@ -652,15 +647,12 @@
}
void Player_NES::setMusicVolume (int vol) {
+ _maxvol = vol;
}
int Player_NES::readBuffer(int16 *buffer, const int numSamples) {
for (int n = 0; n < numSamples; n++) {
- while (!APUe::sample_ok)
- APUe::APU_Run();
-
- APUe::sample_ok = false;
- buffer[n] = APUe::sample_pos;
+ buffer[n] = APUe::APU_GetSample() * _maxvol / 255;
_current_sample++;
if (_current_sample == _samples_per_frame) {
Index: player_nes.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/player_nes.h,v
retrieving revision 2.1
retrieving revision 2.2
diff -u -d -r2.1 -r2.2
--- player_nes.h 7 Apr 2005 07:29:19 -0000 2.1
+++ player_nes.h 7 Apr 2005 21:13:01 -0000 2.2
@@ -73,6 +73,7 @@
int _sample_rate;
int _samples_per_frame;
int _current_sample;
+ int _maxvol;
static const int MAXVOLUME = 0x7F;
static const int NUMSLOTS = 3;
Index: script_v2.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v2.cpp,v
retrieving revision 2.270
retrieving revision 2.271
diff -u -d -r2.270 -r2.271
--- script_v2.cpp 1 Apr 2005 01:41:19 -0000 2.270
+++ script_v2.cpp 7 Apr 2005 21:13:01 -0000 2.271
@@ -519,6 +519,9 @@
void ScummEngine_v2::o2_setObjPreposition() {
int obj = getVarOrDirectWord(PARAM_1);
int unk = fetchScriptByte();
+
+ if (_features & GF_NES)
+ return;
if (whereIsObject(obj) != WIO_NOT_FOUND) {
// FIXME: this might not work properly the moment we save and restore the game.
@@ -1280,16 +1283,15 @@
c = fetchScriptByte();
if (c == 0) {
- if (_gameId == GID_MANIAC && _version == 1) {
+ if (_gameId == GID_MANIAC && _version == 1 && !(_features & GF_NES)) {
// Convert older light mode values into
// equivalent values.of later games
// 0 Darkness
// 1 Flashlight
// 2 Lighted area
- // 11 and 12 are used by NES version
- if (a == 2 || a == 11)
+ if (a == 2)
VAR(VAR_CURRENT_LIGHTS) = 11;
- else if (a == 1 || a == 12)
+ else if (a == 1)
VAR(VAR_CURRENT_LIGHTS) = 4;
else
VAR(VAR_CURRENT_LIGHTS) = 0;
@@ -1353,7 +1355,7 @@
delay = 0xFFFFFF - delay;
vm.slot[_currentScript].delay = delay;
- vm.slot[_currentScript].status = 1;
+ vm.slot[_currentScript].status = ssPaused;
o5_breakHere();
}
Index: script_v5.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v5.cpp,v
retrieving revision 1.279
retrieving revision 1.280
diff -u -d -r1.279 -r1.280
--- script_v5.cpp 6 Apr 2005 17:31:09 -0000 1.279
+++ script_v5.cpp 7 Apr 2005 21:13:01 -0000 1.280
@@ -1136,7 +1136,7 @@
slot = 1;
if (a == 1)
_opcode = 0x40;
- else if (a == 2)
+ else if ((a == 2) || (_features & GF_NES))
_opcode = 0x80;
} else {
_opcode = a & 0xE0;
- Previous message: [Scummvm-cvs-logs] CVS: residual driver.h,1.9,1.10 driver_gl.cpp,1.47,1.48 driver_gl.h,1.22,1.23 driver_tinygl.cpp,1.16,1.17 driver_tinygl.h,1.9,1.10 lua.cpp,1.120,1.121
- Next message: [Scummvm-cvs-logs] CVS: scummvm/scumm script_v72he.cpp,2.237,2.238 scumm.cpp,1.410,1.411
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list