Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DEFINE_ACTION_FUNCTION(ADehackedPickup, DetermineType)
- {
- PARAM_SELF_PROLOGUE(AInventory);
- // Look at the actor's current sprite to determine what kind of
- // item to pretend to me.
- int min = 0;
- int max = countof(DehSpriteMappings) - 1;
- while (min <= max)
- {
- int mid = (min + max) / 2;
- int lex = memcmp (DehSpriteMappings[mid].Sprite, sprites[self->sprite].name, 4);
- if (lex == 0)
- {
- ACTION_RETURN_OBJECT(PClass::FindActor(DehSpriteMappings[mid].ClassName));
- }
- else if (lex < 0)
- {
- min = mid + 1;
- }
- else
- {
- max = mid - 1;
- }
- }
- ACTION_RETURN_OBJECT(nullptr);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement