2017-04-17 10:27:19 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
2018-11-24 09:47:42 +00:00
|
|
|
// Copyright 2018 Christoph Oelckers
|
2017-04-17 10:27:19 +00:00
|
|
|
//
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program. If not, see http://www.gnu.org/licenses/
|
|
|
|
//
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
|
2016-03-01 15:47:10 +00:00
|
|
|
#include "info.h"
|
|
|
|
#include "a_pickups.h"
|
|
|
|
#include "p_local.h"
|
|
|
|
#include "gi.h"
|
|
|
|
#include "a_sharedglobal.h"
|
|
|
|
#include "sbar.h"
|
|
|
|
#include "a_morph.h"
|
|
|
|
#include "doomstat.h"
|
2016-09-19 13:07:53 +00:00
|
|
|
#include "serializer.h"
|
2016-03-01 15:47:10 +00:00
|
|
|
#include "p_enemy.h"
|
|
|
|
#include "d_player.h"
|
2016-09-19 13:07:53 +00:00
|
|
|
#include "r_data/sprites.h"
|
2017-01-08 17:45:30 +00:00
|
|
|
#include "g_levellocals.h"
|
2017-04-12 23:12:04 +00:00
|
|
|
#include "vm.h"
|
2016-03-01 15:47:10 +00:00
|
|
|
|
|
|
|
static FRandom pr_morphmonst ("MorphMonster");
|
|
|
|
|
2018-11-24 07:17:30 +00:00
|
|
|
|
2018-11-24 08:33:03 +00:00
|
|
|
bool P_MorphActor(AActor *activator, AActor *victim, PClassActor *ptype, PClassActor *mtype, int duration, int style, PClassActor *enter_flash, PClassActor *exit_flash)
|
2018-11-24 07:17:30 +00:00
|
|
|
{
|
2018-11-24 08:33:03 +00:00
|
|
|
IFVIRTUALPTR(victim, AActor, Morph)
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
2018-11-24 08:33:03 +00:00
|
|
|
VMValue params[] = { victim, activator, ptype, mtype, duration, style, enter_flash, exit_flash };
|
2018-11-24 07:39:35 +00:00
|
|
|
int retval;
|
|
|
|
VMReturn ret(&retval);
|
|
|
|
VMCall(func, params, countof(params), &ret, 1);
|
|
|
|
return !!retval;
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
2018-11-24 07:39:35 +00:00
|
|
|
return false;
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
|
2018-11-24 09:47:42 +00:00
|
|
|
bool P_UnmorphActor(AActor *activator, AActor *morphed, int flags, bool force)
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
2018-11-24 09:47:42 +00:00
|
|
|
IFVIRTUALPTR(morphed, AActor, UnMorph)
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
2018-11-24 09:47:42 +00:00
|
|
|
VMValue params[] = { morphed, activator, flags, force };
|
2018-11-24 07:39:35 +00:00
|
|
|
int retval;
|
|
|
|
VMReturn ret(&retval);
|
|
|
|
VMCall(func, params, countof(params), &ret, 1);
|
|
|
|
return !!retval;
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
2018-11-24 07:39:35 +00:00
|
|
|
return false;
|
2016-11-25 17:41:00 +00:00
|
|
|
}
|
|
|
|
|
2017-02-26 20:20:47 +00:00
|
|
|
|