Author
|
Comment
|
Flaose
Pooper, King of the Slugs
Posts: 1204
(8/13/03 12:48 am)
Reply
|
Keen's Shot Height
How-d all. It's not very often I post a topic.
Anyways, I was wondering if it would be possible, in a mod, to modify the height that Keen shoots his gun. For example, if I were to change Keen's height from 16x24 to 16x16, he shoots the ground instead of in the air. Seems to me that Xky modified the tank robot's shot height in his mod, and I was hoping that the same could be done with Keen.
Help?!
--------------------
Cerebral Cortex 314 - For All of your Commander Keen Needs.
Eat at Joes |
KeenRush
Garg
Posts: 3794
(8/13/03 4:34 am)
Reply
|
Re: Keen's Shot Height
I guess that's possible with some hex editing, but I can't help. I would like to know that myself too.
By the way, how's your mod Ilsoap?
BB - CK - MR. 314 |
XkyRauh2001
Mortimer's Right Hand Man
Posts: 598
(8/13/03 8:25 pm)
Reply
|
hmm...
as far as i can tell, the shot placement is based off of the top of your sprite. like on Keen's sprite, the shot will always originate a certian number of pixels down from the top of his sprite. make his sprite much taller, and the shot comes out higher. make his sprite shorter, and the shot comes out lower (possibly below ground)
i just got lucky with my mod... i re-did the height of the tank robot because i swapped its size with that of a Vorticon (and i made the Vorticons the tanks' old size) and then did my graphics to match the shot placement--and it's still not quite right.
unless you wanna go hex-edit on it (and i don't have a clue where to start) you'll just hafta experiment with it :-( sorry, Flaose!
--Xky
|
Flaose
Pooper, King of the Slugs
Posts: 1206
(8/13/03 9:44 pm)
Reply
|
Re: hmm...
Thanks anyways...I'll just do a messy hack then
--------------------
Cerebral Cortex 314 - For All of your Commander Keen Needs.
Eat at Joes |
XkyRauh2001
Mortimer's Right Hand Man
Posts: 602
(8/14/03 1:29 am)
Reply
|
re: hacking shots
i don't wanna be too anal, but please be sure to document anything you find out about this hack :-) it opens new possibilities for modding!
--Xky
|
KeenRush
Garg
Posts: 3801
(8/14/03 4:04 am)
Reply
|
Re: re: hacking shots
Oh, I didn't understand you were Flaose. I didn't knew you're making a mod.
Yeah, document everything!
BB - CK - MR. 314 |
Ilsoap
Flect
Posts: 718
(8/14/03 6:57 am)
Reply
|
Re: re: hacking shots
Although I was asked a question by mistake, I suppose it's still fair to answer it. The mod's going all right... I haven't done a whole lot of work on it in awhile (besides editing the Vorticon replacement sprite... I REALLY like it). Basically, all I have left to do is make the levels, edit all the text files, make sure that patch works properly, and it will be done! I'll have it done in time to enter the Keen Awards, anyways.
|
KeenRush
Garg
Posts: 3803
(8/14/03 4:25 pm)
Reply
|
Re: re: hacking shots
Sounds good. I bet the level making is fun with the blocks.
BB - CK - MR. 314 |
adurdin
Wormouth
Posts: 824
(8/16/03 12:06 am)
Reply
|
Re: re: hacking shots
It would really be a matter of finding out where the height offset for the sprite is stored (it'd be a hard-coded value). It's not impossible -- I'll have a bit of a look and see what I can find. No guarantess, though!
Andrew
|
adurdin
Wormouth
Posts: 826
(8/16/03 12:35 am)
Reply
|
Re: re: hacking shots
It turns out to be easier than I expected. The height of Keen's shot (relative to the top of his sprite) is stored in the single byte at offset $46DC. The normal value is 9. Patch this single byte, and you can change the height his shot starts at.
Cheers,
Andrew
|
Xtraverse
Stranded Fish
Posts: 2384
(8/16/03 2:52 am)
Reply
|
Re: re: hacking shots
What game and what version are you talking about?
And how the hell do you figure out this stuff so fast?
Never argue with an idiot. He brings you down to his level, then beats you on experience -- Mark Twain
xtravaganza: www.xtraverse.co.nr www.xtraverse.tk |
adurdin
Wormouth
Posts: 827
(8/16/03 7:03 am)
Reply
|
Re: re: hacking shots
Whoops -- that was Keen 1 version 1.31. Now that I know what to look for, I could find the offsets in Keen 2 and 3 quite easily, also. In fact, I'll do that as soon as I finish this message.
As for how I did it: I disassembled the Keen 1 .exe; then I looked up the sprite number of Keen's shots, which was 108 (0x6C) -- this was easiest to do by looking at the sprite pictures that KeenMod extracted.
I then looked through the disassembled Keen 1 source to find instances of the constant 6C, as it was very likely to be used to reference the sprite. This was indeed the case, and there was only one possible candidate (as determined by a brief glance at the code surrounding each location). I modified this byte, then ran Keen to see if the sprite he fired out of his gun changed, and it did.
So next I looked for an addition close by that looked like it would be correct. A bit up above was an addition involving 0x0900; I knew from writing KeenMod that Keen used 8.8 bit fixed point integers for sprite offsets, which would make 0x0900 correspond to 9 pixels. I then grabbed a screenshot of Keen firing a shot, and found that there was indeed 9 pixels between the top of Keen's sprite and the shot sprite. Finally, to confirm that it was correct, I modified this value, and sure enough the shot's start was changed identically.
|
adurdin
Wormouth
Posts: 828
(8/16/03 7:13 am)
Reply
|
Re: re: hacking shots
OK, in Keen 2 v.1.31, the offset is $743B
In Keen 3 v.1.31, the offset is $7CFA
|
Zorath
Vortininja
Posts: 212
(8/16/03 9:54 am)
Reply
|
Re: re: hacking shots
Thanks a lot Andrew, this is awesome!
|
KeenRush
Garg
Posts: 3813
(8/16/03 9:57 am)
Reply
|
Re: re: hacking shots
This is very cool adurdin!
But by the way, how do you change that value? I really don't know anything about that..
BB - CK - MR. 314 |
Flaose
Pooper, King of the Slugs
Posts: 1208
(8/16/03 1:32 pm)
Reply
|
Re: Keen's Shot Height
Thanks a bundle Andrew. Luckily, I saved my old (un-messyhacked) sprites, so I'll just modify that byte and restore them.
Edit: Oh yeah, hopefully I'll get that mod out today. Otherwise it won't be out till the week of the 25th.
--------------------
Cerebral Cortex 314 - For All of your Commander Keen Needs.
Eat at Joes Edited by: Flaose at: 8/16/03 1:33 pm
|
adurdin
Wormouth
Posts: 830
(8/16/03 1:37 pm)
Reply
|
Re: Keen's Shot Height
KeenRush: One word: CKxPatch.
Read its docs -- they'll tell you how to do patches like this.
|
KeenRush
Garg
Posts: 3817
(8/16/03 1:55 pm)
Reply
|
Re: Keen's Shot Height
WOW! Today!
Oh, I know CKpatch and will use that, but I don't know (I am really lame), how to modify byte, like changing that number for example to 5. I don't know the maths or whatever it takes!
BB - CK - MR. 314 |
Flaose
Pooper, King of the Slugs
Posts: 1209
(8/16/03 2:11 pm)
Reply
|
Re: Keen's Shot Height
It's really easy KeenRush. Instead of saying:
%patch $46DC "enter some text string"
You'd type
%patch $46DC ##
So if I wanted to change the byte value to 3, I'd put
%patch $46DC 03
I suppose, if you'd prefer, you could replace $46DC with 0x0046DC.
--------------------
Cerebral Cortex 314 - For All of your Commander Keen Needs.
Eat at Joes |
KeenRush
Garg
Posts: 3818
(8/16/03 2:45 pm)
Reply
|
Re: Keen's Shot Height
Cheers Flaose, that's exactly what I was looking for!
So, it's THAT easy to change that byte thing.. I thought it was more difficult.
BB - CK - MR. 314 |
Xtraverse
Stranded Fish
Posts: 2385
(8/16/03 2:48 pm)
Reply
|
Re: Keen's Shot Height
By dissasembling, do you mean unlzexeing?
Never argue with an idiot. He brings you down to his level, then beats you on experience -- Mark Twain
xtravaganza: www.xtraverse.co.nr www.xtraverse.tk |
(page 2 missing) |