Baron of Hell
Register | User Profile | Member List | F.A.Q | Privacy Policy | New Blog | Search Forums | Forums Home
Doomworld Forums : Powered by vBulletin version 2.2.5 Doomworld Forums > Classic Doom > Source Ports > Reversed precise behavior of Heretic 1.0 mace spots
 
Author
All times are GMT. The time now is 19:34. Post New Thread    Post A Reply
Quasar
Moderator


Posts: 4484
Registered: 08-00


A while back some people asked me to reverse-engineer the precise behavior of the mace spots as they functioned in Heretic 1.0, and I completed that tonight during some spare time.

code:
int MaceTypes[] = { 0, // unused, bumps array up by 1 for gameepisode MT_WIZARD, // episode 1 MT_BEAST, // episode 2 MT_SNAKE, // episode 3 }; void P_CloseWeapons(void) { int spot, i; if(!MaceSpotCount) return; spot = P_Random() % MaceSpotCount; if(!deathmatch && P_Random() < 64) spot = -1; for(i = 0; i < MaceSpotCount; ++i) { if(i == spot) P_SpawnMobj(MaceSpots[i].x, MaceSpots[i].y, ONFLOORZ, MT_MACE); else if(!nomonsters) { P_SpawnMobj(MaceSpots[i].x, MaceSpots[i].y, ONFLOORZ, MaceTypes[gameepisode]); ++totalkills; } } }

Note that the array used by this routine is only 4 integers in length. This means that when playing E4M1, the array is accessed out of bounds. The next item in memory is a dummy ambient sound sequence called AmbSndSeqInit, which contains a single command, afxcmd_end, with the value 0x05. 5 as an mobj type number is the Shadowsphere.

The other routines involved in mace spot tracking were mostly identical, except that P_RepositionMace is missing calls to P_(Un)SetThingPosition, meaning that it effectively corrupts the blockmap by leaving dangling links to the object in an incorrect cell. I do not know what version of Heretic that was fixed in for certain.

Note: Anyone can use this code in a Heretic port, but please give explicit credit to me in a comment along with it :)

Last edited by Quasar on 11-01-09 at 04:33

Old Post 11-01-09 04:27 #
Quasar is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
Gez
Why don't I have a custom title by now?!


Posts: 6458
Registered: 07-07


This should be on the Doom wiki.

Old Post 11-01-09 09:47 #
Gez is online now Profile || Blog || PM || Search || Add Buddy IP || Edit/Delete || Quote
Quasar
Moderator


Posts: 4484
Registered: 08-00


Actually the behavior description already on the wiki matches what I found in the binary more or less exactly, except that it assumes through lack of information that the spawning of Shadowspheres on episode 4 maps is an intentional feature, when it's actually the result of undefined behavior :)

There weren't any real surprises here other than that, though.

Old Post 11-01-09 16:48 #
Quasar is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
All times are GMT. The time now is 19:34. Post New Thread    Post A Reply
 
Doomworld Forums : Powered by vBulletin version 2.2.5 Doomworld Forums > Classic Doom > Source Ports > Reversed precise behavior of Heretic 1.0 mace spots

Show Printable Version | Email this Page | Subscribe to this Thread

 

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are OFF
[IMG] code is ON
 

< Contact Us - Doomworld >

Powered by: vBulletin Version 2.2.5
Copyright ©2000, 2001, Jelsoft Enterprises Limited.

Forums Directory