port_out(0x3c4,0xf02);
I SO WANT TO EQUATE 0x3C4 TO THE VGA SEQUENCER INDEX REGISTER BUT I CAN'T
okay I've fixed OSDEV:
https://wiki.osdev.org/Game_port
They had the introduction of the gameport listed as "the PCjr" (it's from 1981, the PCjr came out in 1984... and didn't even have this gameport connector!) but more importantly, they had the order of the joystick axises wrong.
god. Duke Nukem 1 has so much copy-pasted code.
Like, there's a ton of hint dialog boxes like "You need the key to open this door!" or "you get more points if you catch the balloon"
you'd think they'd just have ShowMessage() and pass it a different string, but nope. it's a different function.
interesting. there's 12 hint-variables which are used to make sure you don't get hinted for something you've used before.
One of them is still maintained, but not used. So there must have been another hintable thing that got dropped
like, it has a function that loops through all 16 color indices and sets them to black. it takes one parameters, which tells it how long to wait between each color is set, so it'll fade slowly to black, instead of being instant.
there's also an identical function that does the same, but sets it to white, instead.
the only difference between the "draw proton"/"draw duke" functions is what base address they draw from.
YOU CAN PASS ADDRESSES TO FUNCTIONS, TODD
Nope! it's known, it's just slightly mis-documented and tricky to pull off.
If you press the fire button (not alt!) and release F6 on the main menu, after launching the game with "dn1 asp", you can play the demo level
so why in the fuck does the game save your position in the level and the camera position?
You'll always be in the hallway! you can't be anywhere else!
yep. you can have it load you right into a level. you can't save a game there, but you can restore one.
weird.
@foone
Try to determine where in memory stored loaded rooms when they are more then one. I suppose there’s dummy save logic when we’re dumping mem as POD just to file. I've seen this more than once.
Just guessing.
god. Duke Nukem 1 has so much copy-pasted code. Like, there's a ton of hint dialog boxes like "You need the key to open this door!" or "you get more points if you catch the balloon" you'd think they'd just have ShowMessage() and pass it a different string, but nope. it's a different function.
@adamrofer Also you can just play it as map 1 of episode 2.
although interestingly, it's not exactly the same: apparently they made some changes after recording the demo for the shareware version!
@foone There are languages/formalisms where you can only pass one parameter to a function.
Maybe they were working in a language where you can't pass *any* parameters to a function?
I'm sure there's some mathematician that's managed it. Somewhere.

@poeschel @foone At this point, I'm talking out of my arse (I'm not really an x86 person), but it's duplicating a significant amount of code to avoid passing a single (possibly-)far pointer where it could avoid the duplication at the cost of passing one far pointer? Seems like a significant mis-optimisation on the part of the compiler.
Maybe a segment change is massively more expensive than I think it is, but I hope it isn't that bad.
I suspect this is a pragmatic decision done out of discomfort with passing pointers through the stack instead of treating it as a subroutine(which, as I recall, was a problem at the time - there was that one C book where the author did not understand how it worked and gave bad advice) - and it also allows for a top-down-ish "design once" approach of creating the whole sequence with placeholder stubs, and then finishing it with copy-paste-modify.