112 Commits

Author SHA1 Message Date
Johannes Schickel
f9f2cd2dbe - started to rework static resource loading
- made some function parameters const (to work with new static res code)

svn-id: r21365
2006-03-18 14:43:18 +00:00
Oystein Eftevaag
0f21db8c8e Fixes the color of the quitting dialog text after drinking a potion
svn-id: r21358
2006-03-18 11:22:18 +00:00
Oystein Eftevaag
05ee5cf2bd Extends seq_drinkPotionAnim() so that the color of the flask Brandon
drinks will be correct. Also fixes a bug where an animation
(Brandon ringing the bells) would play too quickly.

svn-id: r21354
2006-03-18 04:41:34 +00:00
Johannes Schickel
0ebebb1176 Fixes animations when brandon turns inivisible/visible.
svn-id: r21348
2006-03-17 20:49:12 +00:00
Johannes Schickel
41b4a6aa7c Fixes bug #1401337 ("KYRA: Platform with pegasi graphics glitch")
svn-id: r21347
2006-03-17 19:39:46 +00:00
Johannes Schickel
bbd1725598 - Fixes bug #1401432 ("KYRA: Brandon graphics glitch when exiting castle catacombs")
- Fixes some sprite redraw bugs introduced with my last commits
- Fixes wsa drawing bug in the cave too

svn-id: r21346
2006-03-17 14:19:18 +00:00
Torbjörn Andersson
4df16b71b8 Oops, I never meant to remove *that* line! Put it back again. (This fixes the
flute sound, and probably other regressions as well.)

svn-id: r21345
2006-03-17 13:13:31 +00:00
Torbjörn Andersson
e36edb1b35 The opcode functions are not allowed to modify their own channel.dataptr
directly. If they want a new data pointer, they have to use the dataptr
parameter. This fixes a subtle bug that would cause the wrong music to play
when getting the quill in Kyra 1.

svn-id: r21344
2006-03-17 12:03:24 +00:00
Torbjörn Andersson
05e0542452 More cleanups and renamings: _sfxSecondByteOfSong -> _sfxPriority
Added some comments on the strange but probably harmless things going on in
playSoundEffect()

svn-id: r21340
2006-03-16 23:22:23 +00:00
Torbjörn Andersson
1d8e206333 Went through callbacks 51, 52 and 53, comparing them to LordHoto's annotated
disassembly. I think they're correct now, and a bit easier to read. My old
comments were wrong, too.

I think they are for manipulating the Adlib rhythm section volumes. I'm not
sure the Kyra music ever uses the Adlib rhythm section.

svn-id: r21339
2006-03-16 20:52:36 +00:00
Torbjörn Andersson
99c34b0377 We have several functions where we need to find the pointer to a program or an
instrument. These are found using the lookup tables in _soundData on offsets 0
and 500 respectively. Added helper functions for that, which makes the code a
lot tidier. Particularly in update_setupRhythmSection(), where it's now much
clearer where it's getting all those "unk" values from.

Use the checkValue() function (which limits the "total level" to its valid
range) for the calculateOpLevel1() and 2() functions as well.

Renamed updateCallback16() to update_waitForEndOfProgram().

svn-id: r21337
2006-03-16 18:53:02 +00:00
Torbjörn Andersson
0182b46679 More renamings:
callbackOutput()   -> setupPrograms()
callbackProcess()  -> executePrograms()
updateCallback3()  -> update_setupProgram()

_unk4              -> _rhythmSection
updateCallback48() -> update_setupRhythmSection()
updateCallback49() -> update_playRhythmSection()
updateCallback50() -> update_removeRhythmSection()

svn-id: r21336
2006-03-16 18:01:14 +00:00
Torbjörn Andersson
8fcb38648d I don't know if it's our bug, or a bug in the original Kyra music driver, but
updateCallback3() would call unkOutput2(9) in at least one case. This is
obviously wrong because it a) reads outside _regOffsets[], and b) writes to
invalid Adlib registers.

Now unkOutput2() has the same safeguards as noteOff() already had, making
callbackOutput() and updateCallback3() even more similar.

svn-id: r21335
2006-03-16 17:39:23 +00:00
Johannes Schickel
fa38b770af Oops. removes some unneeded shifts and fixes now the feather bug.
svn-id: r21334
2006-03-16 17:37:34 +00:00
Torbjörn Andersson
f040ea1e82 Fixed some comments and made a couple of cleanups to make it a bit more clear
just how similar callbackOutput() and updateCallback3() are.

svn-id: r21333
2006-03-16 17:27:52 +00:00
Johannes Schickel
f1c9cd5726 - Fixes some gfx glitches (the falling feather and the falling leaf now have correct restored background)
- Fixes brandon width value after loading (removes gfx glitch while talking with the tree)

svn-id: r21332
2006-03-16 16:35:46 +00:00
Johannes Schickel
b46236ed71 - removes a wrong space in debugC calls in screen.cpp
- implements cmd_brandonToStoneSequence and cmd_pauseMusicSeconds

svn-id: r21320
2006-03-15 21:59:07 +00:00
Torbjörn Andersson
dc2143e6cf This is a bit of a hack: Before showing the mouse cursor, take care of any
pending events so that the it won't have to do a little dance, catching up,
every time you enter a room.

svn-id: r21316
2006-03-15 15:37:42 +00:00
Torbjörn Andersson
5d0ac7d57c On second thought, that comment is probably not necessary.
svn-id: r21315
2006-03-15 15:35:52 +00:00
Torbjörn Andersson
286434c88d Added mouse wheel scrolling to save/restore dialogs.
svn-id: r21314
2006-03-15 13:32:35 +00:00
Torbjörn Andersson
c473ded022 Revert previous change. I'm told some backends don't draw the mouse cursor
automatically, for some reason.

svn-id: r21312
2006-03-15 12:44:41 +00:00
Torbjörn Andersson
52b3c957fe The backend handled cursor drawing -- no need to update the screen manually.
svn-id: r21311
2006-03-15 12:32:07 +00:00
Torbjörn Andersson
1f603fdd98 Cleanup.
svn-id: r21304
2006-03-14 23:39:42 +00:00
Torbjörn Andersson
408b9a41ee Gave the loadBitmap debug message its old debug level back. (I.e. made it less
noisy.)

svn-id: r21303
2006-03-14 23:29:29 +00:00
Torbjörn Andersson
839b5d3e86 Added workaround in FMOPL for the pathological case where a note was turned off
while still at the very beginning of the "attack" phase. This is the very
lowest point on the attack curve, yet it would continue from the beginning of
the release curve, i.e. its very highest point. This is what caused Kyra to
often play low-frequency notes at the very beginning of a new song. (That, and
a truly bizarre function for initialising the channels.)

The proper fix would be to locate the correct point on the release curve and
continue from there. For now, though, only handle the trivial case.

svn-id: r21302
2006-03-14 23:01:44 +00:00
Johannes Schickel
c12a5a35be - Deletes wrong spaces in debugC calls in resource.cpp
- Adds support for amiga .pak files (and a filelist)

svn-id: r21299
2006-03-14 19:48:08 +00:00
Torbjörn Andersson
ee6f7626bf Fix typo in comment.
svn-id: r21298
2006-03-14 19:08:09 +00:00
Johannes Schickel
fa4471fae4 - Fixes a bug in update_primaryEffect (wrong sound from the birds outside brandons home is fixed with this)
- Changes _tempo, tempo, position, unk41, unk32, unk18, unk19, _unkValue3 to unsigned (should be correct this time)

svn-id: r21293
2006-03-14 15:15:04 +00:00
Johannes Schickel
a68e8c2db9 Fixes wrong sound then showing the death screen.
svn-id: r21290
2006-03-14 14:25:13 +00:00
Johannes Schickel
9673573bec Fixes _unkTables, I made a mistake while extracting those last time it seems.
svn-id: r21287
2006-03-14 13:37:15 +00:00
Torbjörn Andersson
660c23ba3f Updated comment with more circumstantial evidence that the low-frequency note
bug is a bug in our fmopl.cpp. Ken Silverman's Adlib emulator doesn't seem to
exhibit the bug either. (But is apparently less feature complete than MAME's.)

svn-id: r21275
2006-03-14 09:55:41 +00:00
Torbjörn Andersson
784728bf8d Further clarifications to the comment about the "low-frequency notes at
beginning of music" bugs. As an experiment, I tried hooking up ScummVM with the
most recent version of the FMOPL code, and the bug went away.

Unfortunately, I believe we are stuck with the ancient version for license (and
performance?) reasons.

svn-id: r21267
2006-03-13 23:53:15 +00:00
Torbjörn Andersson
221263e275 Cleaned up the comments in unkOutput2(), and added a big note about the bug
where low-frequent noises are playing at the beginning of some new sounds.

svn-id: r21265
2006-03-13 23:05:11 +00:00
Lars Persson
d66d7ff76b Changed type for samplesleft in order for MIN macro to work properly on all platforms
svn-id: r21264
2006-03-13 21:38:20 +00:00
Johannes Schickel
ccd0a09f7a - Fixed regression when moving waitTicks to delay (removes wrongly drawn shapes and wrongly call of the kyragame fading in the outro)
- Removes a new line from a warning in seqplayer.cpp

svn-id: r21263
2006-03-13 17:19:19 +00:00
Torbjörn Andersson
9399a2b58e Things continue to fall into place. In other words, more renamings:
unk3  -> spacing1
unk7  -> spacing2
unk12 -> fractionalSpacing

updateCallback4()  -> update_setNoteSpacing()
updateCallback9()  -> update_stopChannel()
updateCallback15() -> update_stopOtherChannel()
updateCallback17() -> update_setupInstrument()
updateCallback28() -> update_setFractionalNoteSpacing()
updateCallback43() -> update_nop1()
updateCallback47() -> update_nop2()

svn-id: r21261
2006-03-13 13:56:19 +00:00
Torbjörn Andersson
480aee83aa I was going to hold off on this until the "Pool of Sorrow" music had been fixed
but it seems that it drifts out of sync after a few repeats even with the
original interpreter. It's a feature!

This cleanup clears up some of the more confusing break/continues in the
callbackProcess() function, and gets rid of _continueFlag.

svn-id: r21259
2006-03-13 11:57:09 +00:00
Torbjörn Andersson
1d439592dd Until now, we have confusingly used the terms "state" or "table" where we
really mean "channel". Fixed that:

OutputState     -> Channel
_curTable       -> _curChannel
_outputTables[] -> _channels[]

The biggest change was modifying all the "state" and "table" local variables
and function parameters.

Ahd, at no extra charge:

_outputTable[]  -> _regOffset[]

svn-id: r21247
2006-03-12 23:21:01 +00:00
Torbjörn Andersson
2ab85f9ea6 Renamed callback1 to primaryEffect and callback2 to secondaryEffect.
svn-id: r21246
2006-03-12 22:47:51 +00:00
Torbjörn Andersson
9f941a18cf Cleaned up comment and did some more renaming:
unk4 -> position   (measured on a very short ruler :-)
unk5 -> duration

svn-id: r21245
2006-03-12 22:33:24 +00:00
Johannes Schickel
e19d079d2b - Renames some functions:
updateCallback31 -> update_setChannelTempo
updateCallback42 -> update_resetToGlobalTempo
updateCallback55 -> update_setTempoReset
- Renames some vars:
unk1 -> tempo
unk6 -> tempoReset
- Fixes tempo bugs

svn-id: r21244
2006-03-12 21:54:06 +00:00
Johannes Schickel
20095d8e93 - Changes usage of regBx to regAx in primaryEffect2 (seems to be a bug introduced when renaming).
- Changes unk41 and unk32 to signed.
- Fixes wrong sound when dropping items (that was also a little bug in primaryEffect2)

svn-id: r21240
2006-03-12 17:58:04 +00:00
Torbjörn Andersson
63245b8eba Compensate for rounding errors in _samplesPerCallback by having readBuffer()
generate "leap samples". I doubt this will make any noticeable difference, but
at least now we can probably rule out timer inaccuracies from the list of
possible suspects for the remaining bugs.

Also removed unnecessary mutex locking/unlocking from readBuffer(), spotted by
LordHoto.

svn-id: r21239
2006-03-12 17:50:36 +00:00
Johannes Schickel
9d3136fb71 Corrects former commit which deleted sound file loading after the scene with malcolm and kallak.
Also corrects callback50() which seem to improve the sound a bit in the kallak writing scene.

svn-id: r21238
2006-03-12 17:08:46 +00:00
Torbjörn Andersson
72d2ef7221 After several days, telling LordHoto over and over that "no, I don't think the
timer inaccuracies can cause that kind of problems, or we'd have noticed it in
the other game engines as well", guess what? The other game engines do not
necessary use a timer for their Adlib music. So now Kyra doesn't either.

Fortunately for my dignity, the music is still a bit uneven at times, but the
situation does seem to have improved a bit, and the sound effects sound better
to me now.

svn-id: r21237
2006-03-12 17:05:59 +00:00
Johannes Schickel
cb085df0f5 Fixes non looping tracks and a fading bug, which silenced the music, with mt-32.
svn-id: r21236
2006-03-12 15:38:59 +00:00
Johannes Schickel
cd28f28d32 Music in the last two intro scenes plays now again with adlib.
Cleaned up the sound code a bit (removed some unneeded functions).

svn-id: r21234
2006-03-12 14:22:27 +00:00
Torbjörn Andersson
c8347b23b1 Added debug message for the standard "note on" opcodes as well.
svn-id: r21233
2006-03-12 12:55:16 +00:00
Torbjörn Andersson
84af303787 And now, for a change, some more renamings:
update1()          -> setupDuration()
updateAndOutput1() -> setupNote()
setInstrument()    -> setupInstrument()  (just for the symmetry)
updateAndOutput3() -> noteOn()

That made the following two renamings seem natural:

updateCallback10() -> update_playRest()
updateCallback27() -> update_playNote()

I decided to number the secondary effects, even though there's only one:

update_setupSecondaryEffect()  -> update_setupSecondaryEffect1()
update_removeSecondaryEffect() -> update_removeSecondaryEffect1()

And finally, I renamed the effects callbacks:

stateCallback1_1() -> primaryEffect1()
stateCallback1_2() -> primaryEffect2()
stateCallback2_1() -> secondaryEffect1()

svn-id: r21232
2006-03-12 12:40:14 +00:00
Torbjörn Andersson
d57e2e88c0 Added a block of comments about command parsing and timing. Perhaps it will be
of use in tracking down the tempo bugs.

svn-id: r21230
2006-03-12 10:47:20 +00:00