This code fragment does not work as expected:
for(int q = 1; q <= Screen->NumLWeapons(); q++) {
lweapon s = Screen->LoadLWeapon(q);
if(s->ID == LW_SWORD) {
if(s->X + 8 > this->X && s->X < this->X + 56 && s->Y + 8 > this->Y && s->Y < this->Y + 56) {
Screen->D[0] -= s->Damage;
Trace(Screen->D[0]);
Trace(s->Damage);
Screen->D[1] = 15;
Game->PlaySound(SFX_GASP);
if(Screen->D[0] <= 0) {
return true;
}
break;
}
}
}
The idea is this: Find the lweapon on screen which is a sword, and if it intersects with my bounding box, do some damage (Screen->D[0] is HP).
However, the two Trace statements reveal that the HP is not dropping, and that the damage is 0. I would expect it to be whatever is set in the Damage field in the Item Editor for the active sword.