diff --git a/source/games/blood/all.cpp b/source/games/blood/all.cpp index 614475060..4d987c715 100644 --- a/source/games/blood/all.cpp +++ b/source/games/blood/all.cpp @@ -65,5 +65,6 @@ #include "src/weapon.cpp" // This includes the VM so it is last +#include "src/vmexports.cpp" #include "src/d_menu.cpp" diff --git a/source/games/blood/src/bloodactor.h b/source/games/blood/src/bloodactor.h index a260dde36..8cc3bed64 100644 --- a/source/games/blood/src/bloodactor.h +++ b/source/games/blood/src/bloodactor.h @@ -140,6 +140,18 @@ public: return true; } } + + void ChangeType(PClass* newtype) + { + if (newtype->IsDescendantOf(RUNTIME_CLASS(DBloodActor)) && newtype->Size == RUNTIME_CLASS(DBloodActor)->Size && GetClass()->Size == RUNTIME_CLASS(DBloodActor)->Size) + { + // It sucks having to do this but the game heavily depends on being able to swap out the class type and often uses this to manage actor state. + // We'll allow this only for classes that do not add their own data, though. + SetClass(newtype); + //spr.setspritetexture(GetDefaultByType(newtype)->spr.spritetexture()); + } + } + int GetType() const { return spr.type; diff --git a/source/games/blood/src/sound.h b/source/games/blood/src/sound.h index c843fad3c..527806c2a 100644 --- a/source/games/blood/src/sound.h +++ b/source/games/blood/src/sound.h @@ -1,25 +1,3 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2010-2019 EDuke32 developers and contributors -Copyright (C) 2019 Nuke.YKT - -This file is part of NBlood. - -NBlood is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -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, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ -//------------------------------------------------------------------------- #pragma once #include "misc.h" diff --git a/source/games/blood/src/vmexports.cpp b/source/games/blood/src/vmexports.cpp new file mode 100644 index 000000000..53d5c31ce --- /dev/null +++ b/source/games/blood/src/vmexports.cpp @@ -0,0 +1,42 @@ +//------------------------------------------------------------------------- +/* +Copyright (C) 2020-2023 - Christoph Oelckers + +This file is part of Raze + +This 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 2 +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. + +*/ +//------------------------------------------------------------------------- + +#include "vm.h" +#include "ns.h" +#include "buildtiles.h" +#include "blood.h" +BEGIN_BLD_NS + + + +void Blood_ChangeType(DBloodActor* self, PClassActor* type) +{ + self->ChangeType(type); +} + +DEFINE_ACTION_FUNCTION_NATIVE(DBloodActor, ChangeType, Blood_ChangeType) +{ + PARAM_SELF_PROLOGUE(DBloodActor); + PARAM_POINTER(type, PClassActor); + self->ChangeType(type); + return 0; +} + +END_BLD_NS diff --git a/wadsrc/static/zscript.txt b/wadsrc/static/zscript.txt index df9a2ddc4..d0dc0adbd 100644 --- a/wadsrc/static/zscript.txt +++ b/wadsrc/static/zscript.txt @@ -30,14 +30,14 @@ version "4.10" #include "zscript/constants.zs" -#include "zscript/razebase.zs" +#include "zscript/games/razebase.zs" #include "zscript/summary.zs" -#include "zscript/statusbar.zs" -#include "zscript/usermapmenu.zs" -#include "zscript/maptypes.zs" -#include "zscript/coreactor.zs" +#include "zscript/games/statusbar.zs" +#include "zscript/games/usermapmenu.zs" +#include "zscript/games/maptypes.zs" +#include "zscript/games/coreactor.zs" #include "zscript/level_postprocessor.zs" -#include "zscript/level_compatibility.zs" +#include "zscript/games/level_compatibility.zs" #include "zscript/alt_hud.zs" #include "zscript/games/duke/dukeactor.zs" #include "zscript/games/blood/bloodactor.zs" diff --git a/wadsrc/static/zscript/games/blood/bloodactor.zs b/wadsrc/static/zscript/games/blood/bloodactor.zs index ec7541d81..a6b14c67a 100644 --- a/wadsrc/static/zscript/games/blood/bloodactor.zs +++ b/wadsrc/static/zscript/games/blood/bloodactor.zs @@ -1,3 +1,5 @@ class BloodActor : CoreActor native { + native void ChangeType(class newtype); + } diff --git a/wadsrc/static/zscript/coreactor.zs b/wadsrc/static/zscript/games/coreactor.zs similarity index 100% rename from wadsrc/static/zscript/coreactor.zs rename to wadsrc/static/zscript/games/coreactor.zs diff --git a/wadsrc/static/zscript/level_compatibility.zs b/wadsrc/static/zscript/games/level_compatibility.zs similarity index 100% rename from wadsrc/static/zscript/level_compatibility.zs rename to wadsrc/static/zscript/games/level_compatibility.zs diff --git a/wadsrc/static/zscript/maptypes.zs b/wadsrc/static/zscript/games/maptypes.zs similarity index 100% rename from wadsrc/static/zscript/maptypes.zs rename to wadsrc/static/zscript/games/maptypes.zs diff --git a/wadsrc/static/zscript/razebase.zs b/wadsrc/static/zscript/games/razebase.zs similarity index 100% rename from wadsrc/static/zscript/razebase.zs rename to wadsrc/static/zscript/games/razebase.zs diff --git a/wadsrc/static/zscript/statusbar.zs b/wadsrc/static/zscript/games/statusbar.zs similarity index 100% rename from wadsrc/static/zscript/statusbar.zs rename to wadsrc/static/zscript/games/statusbar.zs diff --git a/wadsrc/static/zscript/usermapmenu.zs b/wadsrc/static/zscript/games/usermapmenu.zs similarity index 100% rename from wadsrc/static/zscript/usermapmenu.zs rename to wadsrc/static/zscript/games/usermapmenu.zs diff --git a/wadsrc/static/zscript/gamescreen.zs b/wadsrc/static/zscript/gamescreen.zs deleted file mode 100644 index 143f228a0..000000000 --- a/wadsrc/static/zscript/gamescreen.zs +++ /dev/null @@ -1,18 +0,0 @@ - -// Base class for game screens. -class GameScreen : Object ui -{ - virtual bool OnEvent(InputEvent ev) - { - return false; - } - - virtual bool Tick(int framenum) - { - return false; - } - - virtual void Draw() - { - } -} diff --git a/wadsrc/static/zscript/zscript_license.txt b/wadsrc/static/zscript/zscript_license.txt new file mode 100644 index 000000000..c9e5b20f1 --- /dev/null +++ b/wadsrc/static/zscript/zscript_license.txt @@ -0,0 +1,127 @@ +Unless noted differently in the file, the following license applies to all ZScript sources *outside* the 'engine' folder: + +//----------------------------------------------------------------------------- +// +// Copyright 1993-2023 Christoph Oelckers et.al. +// +// 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 2 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/ +// +//----------------------------------------------------------------------------- +// + +Unless noted differently in the file, the following license applies to all ZScript sources *inside* the 'engine' folder: + +/* +** +**--------------------------------------------------------------------------- +** Copyright 2005-2023 Randy Heit, Christoph Oelckers et.al. +** All rights reserved. +** +** Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions +** are met: +** +** 1. Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** 2. Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in the +** documentation and/or other materials provided with the distribution. +** 3. The name of the author may not be used to endorse or promote products +** derived from this software without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +**--------------------------------------------------------------------------- +** +*/ + +Unless noted differently in the file, the following license applies to all ZScript sources *inside* the 'games/duke' folder: +Unless noted differently in the file, all scripted code for Duke Nukem 3D/Redneck Rampage that has not been newly written originates from: +* EDuke 2.0 for Duke Nukem 3D +* DukeGDX for the World Tour extensions +* Redneck Reconstructed for Redneck Rampage + +//------------------------------------------------------------------------- +/* +Copyright (C) 1996, 2003 - 3D Realms Entertainment +Copyright (C) 2000, 2003 - Matt Saettler (EDuke Enhancements) +Copyright (C) 2017-2019 Nuke.YKT +Copyright (C) 2020-2023 - Christoph Oelckers + +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 2 +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. + +*/ +//------------------------------------------------------------------------- + +Unless noted differently in the file, the following license applies to all ZScript sources *inside* the 'games/blood' folder: +Unless noted differently in the file, all scripted code for Blood that has not been newly written originates from Blood-RE: + +//------------------------------------------------------------------------- +/* +Copyright (C) 2018, 2022 nukeykt +Copyright (C) 2020-2022 Christoph Oelckers + +This file is part of Raze + +Raze is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License version 2 +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. + +*/ +//------------------------------------------------------------------------- + +Unless noted differently in the file, the following license applies to all ZScript sources *inside* the 'games/sw' folder: + +//------------------------------------------------------------------------- +/* +Copyright (C) 1997, 2005 - 3D Realms Entertainment +Copyright (C) 2020-2022 Christoph Oelckers + +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 2 +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. + +*/ +//------------------------------------------------------------------------- +