Help editing damage

Feb 3, 2009 at 2:58 AM
Hoxtilicious
"Life begins and ends with Nu."
Join Date: Dec 30, 2005
Location: Germany
Posts: 3218
Age: 32
Damage is a signed variable itself, actually you can really heal enemies.
Health is a unsigned variable it seems though.
 
Feb 3, 2009 at 4:47 AM
Junior Member
"It's dangerous to go alone!"
Join Date: Jan 3, 2009
Location:
Posts: 36
SeriousFace said:
Worked like a charm, thank you very very much.
I tried searching for the same string but 0F instead of 0A hoping this would take me to the outerwall sand croc, but "string not found" ... ;__;

That's because in the Sand Zone crocs, the pointer to the object structure was in EDX, but in the Outer Wall, the object structure happened to be in ECX (this is just an arbitrary decision made by the compiler, it works exactly the same way). Try "C781" instead of "C782".

Why not get yourself a copy of OllyDbg, a copy of Gameshock, and an 8086 assembly manual? It is not as complicated as it looks. Computers are really stupid and every instruction has very simple rules that it follows. It's things like, "put 3 in register EAX". Ok, now "add 1 to EAX". If you don't know what registers are, they're sort of like special memory locations inside the processor. Imagine the processor has around 8 index cards in front of it, and it uses them for scratch paper to do all the operations you ask it to (because it's so stupid remember, it needs index cards just to remember how to add 1).

Cave Story was compiled with optimizations turned off in the compiler, so the assembly is very easy to follow. (Ikachan, on the other hand, had -O2 specified and the code looks like scrambled eggs. I wonder if it was an oversight that optimizations were disabled for Cave Story).
 
Feb 3, 2009 at 3:40 PM
In front of a computer
"Man, if only I had an apple..."
Join Date: Mar 1, 2008
Location: Grasstown
Posts: 1435
SeriousFace said:
Make the damage on something FF FF 00 00 and get hit. You go into hit invincibility and a hurt bounce like normal, you see a huge red -X life, and your weapon levels down to minimum. But you heal 1hp, even above your max. Making your weapons to strong also messes things up. Above a certain points you heal entities (again above max hp is possible), and it'll even say +X. Keep making your weapons stronger and eventually they won't even hit entities.
The hex value FFFF is equivalent to -1 when it represents a signed integer, or 65535 when it represents an unsigned integer.

I don't think the 0000 is part of the damage...
 
Feb 3, 2009 at 8:57 PM
Been here way too long...
"Life begins and ends with Nu."
Join Date: Jan 4, 2008
Location: Lingerie, but also, like, fancy curtains
Posts: 3054
What's the difference between a signed and unsigned char?
(stupid question I know, but I gotta learn these things somehow)
 
Feb 3, 2009 at 11:12 PM
Been here way too long...
"..."
Join Date: Jan 21, 2006
Location:
Posts: 369
Sshsigi you are hella awesome. I'm going to get those programs and try to find the tile spikes for myself. Editing first post with answers to sand croc damage.
 
Feb 4, 2009 at 1:24 AM
Hoxtilicious
"Life begins and ends with Nu."
Join Date: Dec 30, 2005
Location: Germany
Posts: 3218
Age: 32
Celtic Minstrel said:
The hex value FFFF is equivalent to -1 when it represents a signed integer, or 65535 when it represents an unsigned integer.

I don't think the 0000 is part of the damage...

No, 0xFFFF is actually euivalent to -32768.

Most significant bit is for making it negative (If it's a signed value).

Lace said:
What's the difference between a signed and unsigned char?
(stupid question I know, but I gotta learn these things somehow)

Unsigned = Negative and positive values
Signed = Only positive values
 
Feb 4, 2009 at 2:15 AM
In front of a computer
"Man, if only I had an apple..."
Join Date: Mar 1, 2008
Location: Grasstown
Posts: 1435
Lace said:
What's the difference between a signed and unsigned char?
(stupid question I know, but I gotta learn these things somehow)
A signed char can represent negative numbers and positive numbers, but its maximum value is halved as a result of this. An unsigned char can only represent positive numbers. If you're using the variable to store an ASCII character, the difference is meaningless because it's always treated as an unsigned char. But if you use it to store a number, the difference is meaningful.

S. P. Gardebiter said:
No, 0xFFFF is actually euivalent to -32768.

Most significant bit is for making it negative (If it's a signed value).
No, you're wrong. You're getting confused with sign-magnitude representation, where the most significant bit is the sign and the remaining bits are the number. This is rarely used, because it includes two separate representations of zero: positive zero, and negative zero. Because of this, its minimum value would be -32767, not -32768.

The representation that's normally used is two's complement representation. In that representation, all bits set is -1. The number -32768 has all bits except for the most significant bit set. Basically the way it works is that it counts up to the max value, then starts from the min value and works back up toward zero. So, a three-bit two's complement would be as follows:
Code:
Binary Decimal
000    0
001    1
010    2
011    3
100    -4
101    -3
110    -2
111    -1

Note that it does have the property that the most significant bit is always 1 for a signed value, but that unsetting the most significant bit is not equivalent to multiplying by -1.
 
Feb 4, 2009 at 4:01 AM
Junior Member
"It's dangerous to go alone!"
Join Date: Jan 3, 2009
Location:
Posts: 36
FFFF IS -1 as Celtic Minstrel said. However one should also add that that is only if the variable is a short (16 bits). An int is 32-bits and so FFFF is 65535. If you want -1 you need to say FFFFFFFF.

The "00 00" is an important part of the damage; it's the 2 most significant bytes of the 4-byte int. Remember that Intel architecture is little endian so stores the bytes right-to-left. The value is actually 0000FFFF. BUT being an int if you were to increment one of the places with zeroes in it, the second 00 would be worth 65536 per click and the first is worth I think 16,777,216 just for changing it from 0 to 1 (and just think there's 254 more times left you can do that!). Since nothing even comes remotely close to doing that much damage that's why they will always be zeroes.
 
Top