Skip to content

Commit

Permalink
- added a virtual 'used' method that gets called when the player pres…
Browse files Browse the repository at this point in the history
…ses use on an actor. This method will only be called if the actor does not have the USESPECIAL flag - that one will be handled as before.
  • Loading branch information
coelckers committed Feb 14, 2017
1 parent c01289e commit 8d7a64b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/p_map.cpp
Expand Up @@ -5287,6 +5287,14 @@ bool P_UseTraverse(AActor *usething, const DVector2 &start, const DVector2 &end,
if (P_ActivateThingSpecial(in->d.thing, usething))
return true;
}
IFVIRTUALPTR(usething, AActor, Used)
{
VMValue params[] = { usething, in->d.thing };
int ret;
VMReturn vret(&ret);
GlobalVMStack.Call(func, params, 2, &vret, 1);
if (ret) return true;
}
continue;
}

Expand Down
7 changes: 6 additions & 1 deletion wadsrc/static/zscript/actor.txt
Expand Up @@ -329,7 +329,12 @@ class Actor : Thinker native
{
return -1;
}


// Called when the player presses 'use' and an actor is found
virtual bool Used(Actor user)
{
return false;
}

native static class<Actor> GetReplacement(class<Actor> cls);
native static class<Actor> GetReplacee(class<Actor> cls);
Expand Down

0 comments on commit 8d7a64b

Please sign in to comment.