Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Screen shakes are missing. #131

Closed
OpenDUNE opened this Issue Dec 3, 2012 · 7 comments

Comments

Projects
None yet
4 participants
@ghost

ghost commented Dec 3, 2012

http://bugs.opendune.org/view.php?id=131

dsw wrote:
In the original game, the screen would shake vertically when the Map_06F7_08DD function was called (e.g. structure destroyed). However, due to a mistake in r1706, it has evolved into the current Explosion_NoOperation function. The shaking effect is performed by the f__22A6_1200_007B_0356 function, as described below:

emu_cx is number of times to repeat (always 1)
emu_dx is address of VGA base address [0x3D4]
it adds 0x6 to get the CRTC input status register [0x3DA] to test vertical retrace
(bit 3 == 0 means video information is being displayed
bit 3 == 1 means vertical retrace interval in progress)
does two blocking loops to wait for vertical retrace to start, then end

subtracts 0x6 to get port 3D4h
disables interrupts
puts 0x1 into Start Address High register
puts 0x40 into Start Address Low register
enable interrupts

add 0x5 to get address to test vertical retrace again [0x3DA]
does four blocking loops for two rounds of vertical retrace

disables interrupts
puts 0x0, 0x0 into Start Address High, Low registers
enable interrupts

decrements emu_cx and loops again if necessary
done

@ghost ghost closed this Dec 3, 2012

@TrueBrain TrueBrain added a commit that referenced this issue Dec 4, 2012

@TrueBrain TrueBrain -Codechange: rename Explosion_NoOperation to Explosion_ScreenShake
It is a start to fix #131. We refactored out too much code, leading to
believe this function was a NoOp, while it in fact did something very
real.
3043b9c
Owner

TrueBrain commented Dec 14, 2012

I haven't checked r1706, I leave that for a later moment.

Screen shakes in general are not implemented. Dune2 uses a DMA function for it, which mass-moves memory around, which makes the screen appear to shake while in reality your screen is just moving like a maniac :P (pixels from the right also leak to the left, but due to the speed, you won't notice).
That DMA function is never implemented and in the few cases used even removed. I guess we could use SDLs MoveRect, but we have to refind all places it was used and reimplement it there. I am not sure if we left enough comments to retrace those places ... something to examine :)

@TrueBrain TrueBrain reopened this Dec 14, 2012

Owner

TrueBrain commented Dec 14, 2012

We indeed refactored out too much code. I now renamed the function back to its former glory, leaving the function itself not implemented yet. At least we now have breadcrumbs to implement it at a later stage.

Owner

TrueBrain commented Jan 14, 2013

Although @wangds his commit depends on A5, the idea of the patch is very good. We can just set a global which simulates screen shakes (by moving around the buffer, or the pointer to it) on draw.

I really like that idea; implementation should be trivial.

Contributor

miniupnp commented Feb 11, 2016

would it be possible to get SVN history, to dig in what was the code of the Map_06F7_08DD() function ?

Owner

Xaroth commented Feb 11, 2016

The entire SVN history was imported as separate commits on github, so it should be findable in the repo log... I doubt there's anything available repo-wise that's not imported into github

Contributor

miniupnp commented Feb 11, 2016

OK, I got it.

void f__22A6_1200_007B_0356()

It's difficult to search :)

Contributor

miniupnp commented Feb 11, 2016

I think I have a working implementation :
https://github.com/miniupnp/OpenDUNE/tree/screen_shake

@miniupnp miniupnp closed this in 46eeb21 Feb 18, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment