News:

Don't forget to visit the main site! There's lots of helpful docs, patches, and more!

Main Menu

Enemies blocking damage less than two

Started by RealRed, December 17, 2014, 02:13:37 AM

Previous topic - Next topic

RealRed

If I set powerbeam to deal 1 damage, enemies will block the shot entirely- Even if I set for them to take double damage!

Why is this happening? Can I fix it? (and if so, how?)

MetroidMst

The solution is to set the Beam damage to 2. The game does not like 1 as a damage value, but it will handle 2 just fine.

DSO

Actually you've probably set for 'quadruple' damage in a sense... you know how in vulnerabilities, a setting of 2 equals normal damage? It's because projectile damage is halved and then multiplied by the vulnerability to get the final damage. When you halve (or LSR) with a value of 1, it becomes 0. And 0 times 2 is still 0, hence, shot is blocked.

I don't know why they did it this way. I believe this code is the culprit.

$A0/A74A AD 7A 18    LDA $187A  [$A3:187A]   A:8000 X:EC48 Y:0100 ;used for projectile damage at this time
$A0/A74D 4A          LSR A                   A:0014 X:EC48 Y:0100 ;your problem here, 1 becomes 0 after this command
$A0/A74E 85 26       STA $26    [$00:0026]   A:000A X:EC48 Y:0100 ;temp ram
$A0/A750 AD 32 0E    LDA $0E32  [$A3:0E32]   A:000A X:EC48 Y:0100 ;used for enemy vulnerability at this time
$A0/A753 85 28       STA $28    [$00:0028]   A:0002 X:EC48 Y:0100 ;moartemp ram
$A0/A755 22 FF B6 A0 JSL $A0B6FF[$A0:B6FF]   A:0002 X:EC48 Y:0100


You could try NOPing out that LSR and setting all the enemy vulnerabilities down to 1 to match properly. I haven't tested it myself, so it could result in bugs. (Presuming there was a reason they did damage this way in the first place...)

RealRed

#3
Or actually, since I'm making all of the enemy vulnerabilities from scratch, I can just make Normal 01 in each instance, since (2/1)*1=1. Thanks DSO!

Quietus

Yeah, that's thrown me a few times.  I was trying to calculate the best combinations of missiles to defeat Phantoon, as I was sure he took 4x damage from supers, but the sums weren't adding up, then I came across info about this halving / doubling thing, and it all clicked together. :eyeroll:

Cpt.Glitch

Hmm. I've set bomb value to 01 and it still damages the enemy just fine...

JAM

Quote from: DSO on December 17, 2014, 07:07:57 AM
It's because projectile damage is halved and then multiplied by the vulnerability to get the final damage. When you halve (or LSR) with a value of 1, it becomes 0. And 0 times 2 is still 0, hence, shot is blocked.
That's right. But sometimes you still can get the 1 back. When you perform LSR, the A becames zero, but the shifted bit is not erased, it moves to carry. And you still can get a one from ASL, if there is not so much operations.


LDA #$0001
LSR ; A = 0, c
ASL ; A = 1


c is carry.

But in our case this single bit moves to carry, which is not saved anywhere. So, at time we perform ASL, carry flag is already clear.


LDA #$0001
LSR ; A = 0, c
... ; A = 0
ASL ; A = 0