- Backported the classnames-are-names changes from the FP code.

SVN r97 (trunk)
This commit is contained in:
Randy Heit 2006-05-10 02:40:43 +00:00
parent 632e03fa7e
commit d878c2e7d6
108 changed files with 1477 additions and 1054 deletions

View file

@ -136,67 +136,307 @@ else
done done
${COMPILER} "autostart.cpp a.nas blocks.nas misc.nas tmap.nas tmap2.nas tmap3.nas \ ${COMPILER} "autostart.cpp \
am_map.cpp b_bot.cpp b_func.cpp b_game.cpp b_move.cpp b_think.cpp bbannouncer.cpp \ a.nas \
c_bind.cpp c_cmds.cpp c_console.cpp c_cvars.cpp c_dispatch.cpp c_expr.cpp \ blocks.nas \
cmdlib.cpp colormatcher.cpp configfile.cpp ct_chat.cpp d_dehacked.cpp d_main.cpp \ misc.nas \
d_net.cpp d_netinfo.cpp d_protocol.cpp decallib.cpp decorations.cpp dobject.cpp \ tmap.nas \
doomdef.cpp doomstat.cpp dsectoreffect.cpp dthinker.cpp empty.cpp f_finale.cpp \ tmap2.nas \
f_wipe.cpp farchive.cpp files.cpp g_game.cpp g_hub.cpp g_level.cpp gameconfigfile.cpp \ tmap3.nas \
gi.cpp hu_scores.cpp info.cpp infodefaults.cpp lumpconfigfile.cpp m_alloc.cpp \ am_map.cpp \
m_argv.cpp m_bbox.cpp m_cheat.cpp m_fixed.cpp m_menu.cpp m_misc.cpp m_options.cpp \ b_bot.cpp \
m_png.cpp m_random.cpp mus2midi.cpp nodebuild.cpp nodebuild_events.cpp \ b_func.cpp \
nodebuild_extract.cpp nodebuild_gl.cpp nodebuild_utility.cpp p_acs.cpp \ b_game.cpp \
p_buildmap.cpp p_ceiling.cpp p_conversation.cpp p_doors.cpp p_effect.cpp \ b_move.cpp \
p_enemy.cpp p_floor.cpp p_interaction.cpp p_lights.cpp p_lnspec.cpp p_map.cpp \ b_think.cpp \
p_maputl.cpp p_mobj.cpp p_pillar.cpp p_plats.cpp p_pspr.cpp p_saveg.cpp \ bbannouncer.cpp \
p_sectors.cpp p_setup.cpp p_sight.cpp p_spec.cpp p_switch.cpp p_teleport.cpp \ c_bind.cpp \
p_terrain.cpp p_things.cpp p_tick.cpp p_trace.cpp p_user.cpp p_writemap.cpp \ c_cmds.cpp \
p_xlat.cpp po_man.cpp r_bsp.cpp r_data.cpp r_draw.cpp r_drawt.cpp r_main.cpp \ c_console.cpp \
r_plane.cpp r_segs.cpp r_sky.cpp r_things.cpp r_polymost.cpp s_advsound.cpp \ c_cvars.cpp \
s_environment.cpp s_playlist.cpp s_sndseq.cpp s_sound.cpp sc_man.cpp skins.cpp \ c_dispatch.cpp \
st_stuff.cpp stats.cpp stringtable.cpp tables.cpp tempfiles.cpp thingdef.cpp thingdef_codeptr.cpp thingdef_exp.cpp \ c_expr.cpp \
v_collection.cpp v_draw.cpp v_font.cpp v_palette.cpp v_pfx.cpp v_text.cpp \ cmdlib.cpp \
v_video.cpp vectors.cpp name.cpp zstring.cpp zstringpool.cpp zstrformat.cpp \ colormatcher.cpp \
w_wad.cpp wi_stuff.cpp a_arachnotron.cpp a_archvile.cpp a_bossbrain.cpp \ configfile.cpp \
a_bruiser.cpp a_cacodemon.cpp a_cyberdemon.cpp a_demon.cpp \ ct_chat.cpp \
a_doomartifacts.cpp a_doomhealth.cpp \ d_dehacked.cpp \
a_doomimp.cpp a_doommisc.cpp a_doomplayer.cpp a_doomweaps.cpp \ d_main.cpp \
a_fatso.cpp a_keen.cpp a_lostsoul.cpp a_painelemental.cpp a_possessed.cpp \ d_net.cpp \
a_revenant.cpp a_scriptedmarine.cpp a_spidermaster.cpp doom_sbar.cpp a_beast.cpp \ d_netinfo.cpp \
a_chicken.cpp a_clink.cpp a_dsparil.cpp \ d_protocol.cpp \
a_hereticartifacts.cpp a_hereticimp.cpp a_heretickeys.cpp \ decallib.cpp \
a_hereticmisc.cpp a_hereticplayer.cpp a_hereticweaps.cpp a_ironlich.cpp \ decorations.cpp \
a_knight.cpp a_mummy.cpp a_snake.cpp a_wizard.cpp heretic_sbar.cpp a_bats.cpp \ dobject.cpp \
a_bishop.cpp a_blastradius.cpp a_boostarmor.cpp a_centaur.cpp a_clericboss.cpp \ dobjtype.cpp \
a_clericflame.cpp a_clericholy.cpp a_clericmace.cpp a_clericplayer.cpp \ doomdef.cpp \
a_clericstaff.cpp a_demons.cpp a_dragon.cpp a_ettin.cpp a_fighteraxe.cpp \ doomstat.cpp \
a_fighterboss.cpp a_fighterhammer.cpp a_fighterplayer.cpp a_fighterquietus.cpp \ dsectoreffect.cpp \
a_firedemon.cpp a_flechette.cpp a_fog.cpp a_healingradius.cpp \ dthinker.cpp \
empty.cpp \
f_finale.cpp \
f_wipe.cpp \
farchive.cpp \
files.cpp \
g_game.cpp \
g_hub.cpp \
g_level.cpp \
gameconfigfile.cpp \
gi.cpp \
hu_scores.cpp \
info.cpp \
infodefaults.cpp \
lumpconfigfile.cpp \
m_alloc.cpp \
m_argv.cpp \
m_bbox.cpp \
m_cheat.cpp \
m_fixed.cpp \
m_menu.cpp \
m_misc.cpp \
m_options.cpp \
m_png.cpp \
m_random.cpp \
mus2midi.cpp \
nodebuild.cpp \
nodebuild_events.cpp \
nodebuild_extract.cpp \
nodebuild_gl.cpp \
nodebuild_utility.cpp \
p_acs.cpp \
p_buildmap.cpp \
p_ceiling.cpp \
p_conversation.cpp \
p_doors.cpp \
p_effect.cpp \
p_enemy.cpp \
p_floor.cpp \
p_interaction.cpp \
p_lights.cpp \
p_lnspec.cpp \
p_map.cpp \
p_maputl.cpp \
p_mobj.cpp \
p_pillar.cpp \
p_plats.cpp \
p_pspr.cpp \
p_saveg.cpp \
p_sectors.cpp \
p_setup.cpp \
p_sight.cpp \
p_spec.cpp \
p_switch.cpp \
p_teleport.cpp \
p_terrain.cpp \
p_things.cpp \
p_tick.cpp \
p_trace.cpp \
p_user.cpp \
p_writemap.cpp \
p_xlat.cpp \
po_man.cpp \
r_bsp.cpp \
r_data.cpp \
r_draw.cpp \
r_drawt.cpp \
r_main.cpp \
r_plane.cpp \
r_segs.cpp \
r_sky.cpp \
r_things.cpp \
r_polymost.cpp \
s_advsound.cpp \
s_environment.cpp \
s_playlist.cpp \
s_sndseq.cpp \
s_sound.cpp \
sc_man.cpp \
skins.cpp \
st_stuff.cpp \
stats.cpp \
stringtable.cpp \
tables.cpp \
tempfiles.cpp \
thingdef.cpp \
thingdef_codeptr.cpp \
thingdef_exp.cpp \
v_collection.cpp \
v_draw.cpp \
v_font.cpp \
v_palette.cpp \
v_pfx.cpp \
v_text.cpp \
v_video.cpp \
vectors.cpp \
name.cpp \
zstring.cpp \
zstringpool.cpp \
zstrformat.cpp \
w_wad.cpp \
wi_stuff.cpp \
a_arachnotron.cpp \
a_archvile.cpp \
a_bossbrain.cpp \
a_bruiser.cpp \
a_cacodemon.cpp \
a_cyberdemon.cpp \
a_demon.cpp \
a_doomartifacts.cpp \
a_doomhealth.cpp \
a_doomimp.cpp \
a_doommisc.cpp \
a_doomplayer.cpp \
a_doomweaps.cpp \
a_fatso.cpp \
a_keen.cpp \
a_lostsoul.cpp \
a_painelemental.cpp \
a_possessed.cpp \
a_revenant.cpp \
a_scriptedmarine.cpp \
a_spidermaster.cpp \
doom_sbar.cpp \
a_beast.cpp \
a_chicken.cpp \
a_clink.cpp \
a_dsparil.cpp \
a_hereticartifacts.cpp \
a_hereticimp.cpp \
a_heretickeys.cpp \
a_hereticmisc.cpp \
a_hereticplayer.cpp \
a_hereticweaps.cpp \
a_ironlich.cpp \
a_knight.cpp \
a_mummy.cpp \
a_snake.cpp \
a_wizard.cpp \
heretic_sbar.cpp \
a_bats.cpp \
a_bishop.cpp \
a_blastradius.cpp \
a_boostarmor.cpp \
a_centaur.cpp \
a_clericboss.cpp \
a_clericflame.cpp \
a_clericholy.cpp \
a_clericmace.cpp \
a_clericplayer.cpp \
a_clericstaff.cpp \
a_demons.cpp \
a_dragon.cpp \
a_ettin.cpp \
a_fighteraxe.cpp \
a_fighterboss.cpp \
a_fighterhammer.cpp \
a_fighterplayer.cpp \
a_fighterquietus.cpp \
a_firedemon.cpp \
a_flechette.cpp \
a_fog.cpp \
a_healingradius.cpp \
a_heresiarch.cpp \ a_heresiarch.cpp \
a_hexenspecialdecs.cpp a_iceguy.cpp a_korax.cpp a_mageboss.cpp a_magecone.cpp \ a_hexenspecialdecs.cpp \
a_magelightning.cpp a_mageplayer.cpp a_magestaff.cpp a_magewand.cpp a_mana.cpp \ a_iceguy.cpp \
a_pig.cpp a_puzzleitems.cpp a_serpent.cpp \ a_korax.cpp \
a_spike.cpp a_summon.cpp a_teleportother.cpp a_weaponpieces.cpp a_wraith.cpp \ a_mageboss.cpp \
hexen_sbar.cpp a_artiegg.cpp a_artitele.cpp a_minotaur.cpp a_ravenambient.cpp \ a_magecone.cpp \
a_acolyte.cpp a_alienspectres.cpp \ a_magelightning.cpp \
a_coin.cpp a_crusader.cpp a_entityboss.cpp a_inquisitor.cpp \ a_mageplayer.cpp \
a_loremaster.cpp a_macil.cpp a_oracle.cpp \ a_magestaff.cpp \
a_programmer.cpp a_reaver.cpp a_rebels.cpp \ a_magewand.cpp \
a_sentinel.cpp a_spectral.cpp a_stalker.cpp a_strifeammo.cpp \ a_mana.cpp \
a_strifebishop.cpp a_strifeitems.cpp a_strifeplayer.cpp \ a_pig.cpp \
a_strifestuff.cpp a_strifeweapons.cpp a_templar.cpp a_thingstoblowup.cpp \ a_puzzleitems.cpp \
strife_sbar.cpp a_action.cpp a_artifacts.cpp a_bridge.cpp \ a_serpent.cpp \
a_camera.cpp a_debris.cpp a_decals.cpp a_flashfader.cpp a_fountain.cpp \ a_spike.cpp \
a_hatetarget.cpp a_keys.cpp a_lightning.cpp a_movingcamera.cpp a_pickups.cpp \ a_summon.cpp \
a_quake.cpp a_secrettrigger.cpp a_sectoraction.cpp a_sharedmisc.cpp a_skies.cpp \ a_teleportother.cpp \
a_soundenvironment.cpp a_soundsequence.cpp a_spark.cpp a_waterzone.cpp a_weaponpiece.cpp a_weapons.cpp \ a_weaponpieces.cpp \
hudmessages.cpp shared_sbar.cpp fmopl.cpp mlkernel.cpp mlopl.cpp mlopl_io.cpp \ a_wraith.cpp \
opl_mus_player.cpp fmodsound.cpp i_music.cpp i_sound.cpp music_cd.cpp \ hexen_sbar.cpp \
music_flac.cpp music_midi_midiout.cpp music_midi_stream.cpp music_midi_timidity.cpp \ a_artiegg.cpp \
music_mod.cpp music_mus_midiout.cpp music_mus_opl.cpp music_stream.cpp \ a_artitele.cpp \
sample_flac.cpp crashcatcher.c i_input.cpp i_net.cpp i_cd.cpp i_main.cpp \ a_minotaur.cpp \
i_system.cpp hardware.cpp i_movie.cpp sdlvideo.cpp autozend.cpp" a_ravenambient.cpp \
a_acolyte.cpp \
a_alienspectres.cpp \
a_coin.cpp \
a_crusader.cpp \
a_entityboss.cpp \
a_inquisitor.cpp \
a_loremaster.cpp \
a_macil.cpp \
a_oracle.cpp \
a_programmer.cpp \
a_reaver.cpp \
a_rebels.cpp \
a_sentinel.cpp \
a_spectral.cpp \
a_stalker.cpp \
a_strifeammo.cpp \
a_strifebishop.cpp \
a_strifeitems.cpp \
a_strifeplayer.cpp \
a_strifestuff.cpp \
a_strifeweapons.cpp \
a_templar.cpp \
a_thingstoblowup.cpp \
strife_sbar.cpp \
a_action.cpp \
a_artifacts.cpp \
a_bridge.cpp \
a_camera.cpp \
a_debris.cpp \
a_decals.cpp \
a_flashfader.cpp \
a_fountain.cpp \
a_hatetarget.cpp \
a_keys.cpp \
a_lightning.cpp \
a_movingcamera.cpp \
a_pickups.cpp \
a_quake.cpp \
a_secrettrigger.cpp \
a_sectoraction.cpp \
a_sharedmisc.cpp \
a_skies.cpp \
a_soundenvironment.cpp \
a_soundsequence.cpp \
a_spark.cpp \
a_waterzone.cpp \
a_weaponpiece.cpp \
a_weapons.cpp \
hudmessages.cpp \
shared_sbar.cpp \
fmopl.cpp \
mlkernel.cpp \
mlopl.cpp \
mlopl_io.cpp \
opl_mus_player.cpp \
fmodsound.cpp \
i_music.cpp \
i_sound.cpp \
music_cd.cpp \
music_flac.cpp \
music_midi_midiout.cpp \
music_midi_stream.cpp \
music_midi_timidity.cpp \
music_mod.cpp \
music_mus_midiout.cpp \
music_mus_opl.cpp \
music_stream.cpp \
sample_flac.cpp \
crashcatcher.c \
i_input.cpp \
i_net.cpp \
i_cd.cpp \
i_main.cpp \
i_system.cpp \
hardware.cpp \
i_movie.cpp \
sdlvideo.cpp \
autozend.cpp"
${LINK} "${TARGET}" ${LINK} "${TARGET}"

View file

@ -1,4 +1,5 @@
May 9, 2006 May 9, 2006
- Backported the classnames-are-names changes from the FP code.
- Backported the improved hierarchical dumpclasses command from the FP code. - Backported the improved hierarchical dumpclasses command from the FP code.
- Updated Jim's Makefile.linux. - Updated Jim's Makefile.linux.
- Added support for wrapping midtextures vertically. - Added support for wrapping midtextures vertically.

View file

@ -370,18 +370,18 @@ class AInventory;
inline AActor *GetDefaultByName (const char *name) inline AActor *GetDefaultByName (const char *name)
{ {
return (AActor *)(TypeInfo::FindType (name)->ActorInfo->Defaults); return (AActor *)(PClass::FindClass(name)->Defaults);
} }
inline AActor *GetDefaultByType (const TypeInfo *type) inline AActor *GetDefaultByType (const PClass *type)
{ {
return (AActor *)(type->ActorInfo->Defaults); return (AActor *)(type->Defaults);
} }
template<class T> template<class T>
inline T *GetDefault () inline T *GetDefault ()
{ {
return (T *)(RUNTIME_CLASS(T)->ActorInfo->Defaults); return (T *)(RUNTIME_CLASS(T)->Defaults);
} }
struct secplane_t; struct secplane_t;
@ -417,11 +417,11 @@ public:
void Serialize (FArchive &arc); void Serialize (FArchive &arc);
static AActor *StaticSpawn (const TypeInfo *type, fixed_t x, fixed_t y, fixed_t z); static AActor *StaticSpawn (const PClass *type, fixed_t x, fixed_t y, fixed_t z);
inline AActor *GetDefault () const inline AActor *GetDefault () const
{ {
return (AActor *)(RUNTIME_TYPE(this)->ActorInfo->Defaults); return (AActor *)(RUNTIME_TYPE(this)->Defaults);
} }
// BeginPlay: Called just after the actor is created // BeginPlay: Called just after the actor is created
@ -533,20 +533,20 @@ public:
bool CheckLocalView (int playernum) const; bool CheckLocalView (int playernum) const;
// Finds the first item of a particular type. // Finds the first item of a particular type.
AInventory *FindInventory (const TypeInfo *type) const; AInventory *FindInventory (const PClass *type) const;
template<class T> T *FindInventory () const template<class T> T *FindInventory () const
{ {
return static_cast<T *> (FindInventory (RUNTIME_CLASS(T))); return static_cast<T *> (FindInventory (RUNTIME_CLASS(T)));
} }
// Adds one item of a particular type. Returns NULL if it could not be added. // Adds one item of a particular type. Returns NULL if it could not be added.
AInventory *GiveInventoryType (const TypeInfo *type); AInventory *GiveInventoryType (const PClass *type);
// Returns the first item held with IF_INVBAR set. // Returns the first item held with IF_INVBAR set.
AInventory *FirstInv () const; AInventory *FirstInv () const;
// Tries to give the actor some ammo. // Tries to give the actor some ammo.
bool GiveAmmo (const TypeInfo *type, int amount); bool GiveAmmo (const PClass *type, int amount);
// Set the alphacolor field properly // Set the alphacolor field properly
void SetShade (DWORD rgb); void SetShade (DWORD rgb);
@ -574,7 +574,7 @@ public:
bool IsHostile (AActor *other); bool IsHostile (AActor *other);
// What species am I? // What species am I?
virtual const TypeInfo *GetSpecies(); virtual const PClass *GetSpecies();
// Check for monsters that count as kill but excludes all friendlies. // Check for monsters that count as kill but excludes all friendlies.
bool CountsAsKill() const bool CountsAsKill() const
@ -786,14 +786,14 @@ public:
} }
}; };
inline AActor *Spawn (const TypeInfo *type, fixed_t x, fixed_t y, fixed_t z) inline AActor *Spawn (const PClass *type, fixed_t x, fixed_t y, fixed_t z)
{ {
return AActor::StaticSpawn (type, x, y, z); return AActor::StaticSpawn (type, x, y, z);
} }
inline AActor *Spawn (const char *type, fixed_t x, fixed_t y, fixed_t z) inline AActor *Spawn (const char *type, fixed_t x, fixed_t y, fixed_t z)
{ {
return AActor::StaticSpawn (TypeInfo::FindType (type), x, y, z); return AActor::StaticSpawn (PClass::FindClass(type), x, y, z);
} }
template<class T> template<class T>

View file

@ -37,7 +37,7 @@
** that way can require a lot of extra space, which is why I'm doing things ** that way can require a lot of extra space, which is why I'm doing things
** this way. ** this way.
** **
** In the case of TypeInfo lists (section creg), I orginally used the ** In the case of PClass lists (section creg), I orginally used the
** constructor to do just that, and the code for that still exists if you ** constructor to do just that, and the code for that still exists if you
** compile with something other than Visual C++ or GCC. ** compile with something other than Visual C++ or GCC.
*/ */

View file

@ -123,7 +123,7 @@ void DCajunMaster::ThinkForMove (AActor *actor, ticcmd_t *cmd)
//Check if it's more important to get an item than fight. //Check if it's more important to get an item than fight.
if (b->dest && (b->dest->flags&MF_SPECIAL)) //Must be an item, that is close enough. if (b->dest && (b->dest->flags&MF_SPECIAL)) //Must be an item, that is close enough.
{ {
#define is(x) b->dest->IsKindOf (TypeInfo::FindType (#x)) #define is(x) b->dest->IsKindOf (PClass::FindClass (#x))
if ( if (
( (
(actor->health < b->skill.isp && (actor->health < b->skill.isp &&
@ -321,7 +321,7 @@ void DCajunMaster::WhatToGet (AActor *actor, AActor *item)
return; return;
} }
#define typeis(x) item->IsKindOf (TypeInfo::FindType (#x)) #define typeis(x) item->IsKindOf (PClass::FindClass (#x))
if ((item->renderflags & RF_INVISIBLE) //Under respawn and away. if ((item->renderflags & RF_INVISIBLE) //Under respawn and away.
|| item == b->prev) || item == b->prev)
{ {
@ -353,7 +353,7 @@ void DCajunMaster::WhatToGet (AActor *actor, AActor *item)
else if (item->IsKindOf (RUNTIME_CLASS(AAmmo))) else if (item->IsKindOf (RUNTIME_CLASS(AAmmo)))
{ {
AAmmo *ammo = static_cast<AAmmo *> (item); AAmmo *ammo = static_cast<AAmmo *> (item);
const TypeInfo *parent = ammo->GetParentAmmo (); const PClass *parent = ammo->GetParentAmmo ();
AInventory *holdingammo = b->mo->FindInventory (parent); AInventory *holdingammo = b->mo->FindInventory (parent);
if (holdingammo != NULL && holdingammo->Amount >= holdingammo->MaxAmount) if (holdingammo != NULL && holdingammo->Amount >= holdingammo->MaxAmount)

View file

@ -713,7 +713,10 @@ CCMD(linetarget)
P_AimLineAttack(players[consoleplayer].mo,players[consoleplayer].mo->angle,MISSILERANGE, 0); P_AimLineAttack(players[consoleplayer].mo,players[consoleplayer].mo->angle,MISSILERANGE, 0);
if (linetarget) if (linetarget)
{ {
Printf("Target=%s, Health=%d, Spawnhealth=%d\n",linetarget->GetClass()->Name+1,linetarget->health,linetarget->GetDefault()->health); Printf("Target=%s, Health=%d, Spawnhealth=%d\n",
linetarget->GetClass()->TypeName.GetChars(),
linetarget->health,
linetarget->GetDefault()->health);
} }
else Printf("No target found\n"); else Printf("No target found\n");
} }
@ -734,7 +737,9 @@ CCMD(monster)
{ {
if (mo->flags3&MF3_ISMONSTER && !(mo->flags&MF_CORPSE) && !(mo->flags&MF_FRIENDLY)) if (mo->flags3&MF3_ISMONSTER && !(mo->flags&MF_CORPSE) && !(mo->flags&MF_FRIENDLY))
{ {
Printf ("%s at (%ld,%ld,%ld)\n", mo->GetClass()->Name+1, mo->x>>16, mo->y>>16, mo->z>>16); Printf ("%s at (%ld,%ld,%ld)\n",
mo->GetClass()->TypeName.GetChars(),
mo->x >> FRACBITS, mo->y >> FRACBITS, mo->z >> FRACBITS);
} }
} }
} }
@ -755,7 +760,9 @@ CCMD(items)
{ {
if (mo->IsKindOf(RUNTIME_CLASS(AInventory)) && mo->flags&MF_SPECIAL) if (mo->IsKindOf(RUNTIME_CLASS(AInventory)) && mo->flags&MF_SPECIAL)
{ {
Printf ("%s at (%ld,%ld,%ld)\n",mo->GetClass()->Name+1,mo->x>>16,mo->y>>16,mo->z>>16); Printf ("%s at (%ld,%ld,%ld)\n",
mo->GetClass()->TypeName.GetChars(),
mo->x >> FRACBITS, mo->y >> FRACBITS, mo->z >> FRACBITS);
} }
} }
} }

View file

@ -371,7 +371,7 @@ static bool DoSubstitution (char *out, const char *in)
} }
else else
{ {
out += sprintf (out, "%s", weapon->GetClass()->Name+1); out += sprintf (out, "%s", weapon->GetClass()->TypeName.GetChars());
} }
} }
} }
@ -412,10 +412,10 @@ static bool DoSubstitution (char *out, const char *in)
} }
else else
{ {
out += sprintf (out, "%s", weapon->Ammo1->GetClass()->Name+1); out += sprintf (out, "%s", weapon->Ammo1->GetClass()->TypeName.GetChars());
if (weapon->Ammo2 != NULL) if (weapon->Ammo2 != NULL)
{ {
out += sprintf (out, "/%s", weapon->Ammo2->GetClass()->Name+1); out += sprintf (out, "/%s", weapon->Ammo2->GetClass()->TypeName.GetChars());
} }
} }
} }

View file

@ -169,7 +169,7 @@ public:
void PlayPickupSound (AActor *toucher); void PlayPickupSound (AActor *toucher);
void DoPickupSpecial (AActor *toucher); void DoPickupSpecial (AActor *toucher);
private: private:
const TypeInfo *DetermineType (); const PClass *DetermineType ();
AInventory *RealPickup; AInventory *RealPickup;
}; };
@ -186,8 +186,8 @@ FState ADehackedPickup::States[] =
BEGIN_DEFAULTS (ADehackedPickup, Any, -1, 0) BEGIN_DEFAULTS (ADehackedPickup, Any, -1, 0)
END_DEFAULTS END_DEFAULTS
TArray<TypeInfo *> DehackedPickups; TArray<PClass *> DehackedPickups;
TArray<TypeInfo *> TouchedActors; TArray<PClass *> TouchedActors;
char *UnchangedSpriteNames; char *UnchangedSpriteNames;
int NumUnchangedSprites; int NumUnchangedSprites;
@ -299,7 +299,7 @@ struct StateMapper
{ {
FState *State; FState *State;
int StateSpan; int StateSpan;
const TypeInfo *Owner; const PClass *Owner;
bool OwnerIsPickup; bool OwnerIsPickup;
}; };
@ -477,7 +477,7 @@ static FState *FindState (int statenum)
{ {
if (StateMap[i].OwnerIsPickup) if (StateMap[i].OwnerIsPickup)
{ {
TouchedActors.Push (const_cast<TypeInfo *>(StateMap[i].Owner)); TouchedActors.Push (const_cast<PClass *>(StateMap[i].Owner));
} }
return StateMap[i].State + statenum - stateacc; return StateMap[i].State + statenum - stateacc;
} }
@ -713,7 +713,7 @@ static int PatchThing (int thingy)
bool hadTranslucency = false; bool hadTranslucency = false;
bool hadStyle = false; bool hadStyle = false;
int oldflags; int oldflags;
const TypeInfo *type; const PClass *type;
SWORD *ednum, dummyed; SWORD *ednum, dummyed;
type = NULL; type = NULL;
@ -728,7 +728,7 @@ static int PatchThing (int thingy)
DPrintf ("Thing %d\n", thingy); DPrintf ("Thing %d\n", thingy);
if (thingy > 0) if (thingy > 0)
{ {
type = TypeInfo::FindType (GetName (InfoNames[thingy - 1])); type = PClass::FindClass (GetName (InfoNames[thingy - 1]));
if (type == NULL) if (type == NULL)
{ {
info = &dummy; info = &dummy;
@ -1052,7 +1052,7 @@ static int PatchThing (int thingy)
if (info->flags & MF_SPECIAL) if (info->flags & MF_SPECIAL)
{ {
TouchedActors.Push (const_cast<TypeInfo *>(type)); TouchedActors.Push (const_cast<PClass *>(type));
} }
// Make MF3_ISMONSTER match MF_COUNTKILL // Make MF3_ISMONSTER match MF_COUNTKILL
@ -1293,7 +1293,7 @@ static int PatchSprite (int sprNum)
static int PatchAmmo (int ammoNum) static int PatchAmmo (int ammoNum)
{ {
const TypeInfo *ammoType; const PClass *ammoType;
AAmmo *defaultAmmo; AAmmo *defaultAmmo;
int result; int result;
int *max; int *max;
@ -1304,7 +1304,7 @@ static int PatchAmmo (int ammoNum)
if (ammoNum >= 0 && ammoNum < 4) if (ammoNum >= 0 && ammoNum < 4)
{ {
DPrintf ("Ammo %d.\n", ammoNum); DPrintf ("Ammo %d.\n", ammoNum);
ammoType = TypeInfo::FindType (AmmoNames[ammoNum]); ammoType = PClass::FindClass (AmmoNames[ammoNum]);
defaultAmmo = (AAmmo *)GetDefaultByType (ammoType); defaultAmmo = (AAmmo *)GetDefaultByType (ammoType);
max = &defaultAmmo->MaxAmount; max = &defaultAmmo->MaxAmount;
per = &defaultAmmo->Amount; per = &defaultAmmo->Amount;
@ -1336,9 +1336,9 @@ static int PatchAmmo (int ammoNum)
// Fix per-ammo/max-ammo amounts for descendants of the base ammo class // Fix per-ammo/max-ammo amounts for descendants of the base ammo class
if (oldclip != *per) if (oldclip != *per)
{ {
for (int i = 0; i < TypeInfo::m_Types.Size(); ++i) for (int i = 0; i < PClass::m_Types.Size(); ++i)
{ {
TypeInfo *type = TypeInfo::m_Types[i]; PClass *type = PClass::m_Types[i];
if (type == ammoType) if (type == ammoType)
continue; continue;
@ -1411,7 +1411,7 @@ static int PatchWeapon (int weapNum)
{ {
val = 5; val = 5;
} }
info->AmmoType1 = TypeInfo::FindType (AmmoNames[val]); info->AmmoType1 = PClass::FindClass (AmmoNames[val]);
if (info->AmmoType1 != NULL) if (info->AmmoType1 != NULL)
{ {
info->AmmoGive1 = ((AAmmo*)GetDefaultByType (info->AmmoType1))->Amount * 2; info->AmmoGive1 = ((AAmmo*)GetDefaultByType (info->AmmoType1))->Amount * 2;
@ -1574,7 +1574,7 @@ static int PatchMisc (int dummy)
"Minotaur", "Minotaur",
NULL NULL
}; };
static const TypeInfo * const types[] = static const PClass * const types[] =
{ {
RUNTIME_CLASS(APowerInvulnerable), RUNTIME_CLASS(APowerInvulnerable),
RUNTIME_CLASS(APowerStrength), RUNTIME_CLASS(APowerStrength),
@ -2431,7 +2431,7 @@ static bool LoadDehSupp ()
for (i = 0; i < NumStateMaps; i++) for (i = 0; i < NumStateMaps; i++)
{ {
const char *name = GetName (GetWord (supp + 6 + i*4)); const char *name = GetName (GetWord (supp + 6 + i*4));
const TypeInfo *type = TypeInfo::FindType (name); const PClass *type = PClass::FindClass (name);
if (type == NULL) if (type == NULL)
{ {
Printf ("Can't find type %s\n", name); Printf ("Can't find type %s\n", name);
@ -2520,7 +2520,7 @@ void FinishDehPatch ()
for (touchedIndex = 0; touchedIndex < TouchedActors.Size(); ++touchedIndex) for (touchedIndex = 0; touchedIndex < TouchedActors.Size(); ++touchedIndex)
{ {
TypeInfo *type = TouchedActors[touchedIndex]; PClass *type = TouchedActors[touchedIndex];
AActor *defaults1 = GetDefaultByType (type); AActor *defaults1 = GetDefaultByType (type);
if (!(defaults1->flags & MF_SPECIAL)) if (!(defaults1->flags & MF_SPECIAL))
{ // We only need to do this for pickups { // We only need to do this for pickups
@ -2529,8 +2529,8 @@ void FinishDehPatch ()
// Create a new class that will serve as the actual pickup // Create a new class that will serve as the actual pickup
char typeNameBuilder[32]; char typeNameBuilder[32];
sprintf (typeNameBuilder, "ADehackedPickup%d", touchedIndex); sprintf (typeNameBuilder, "DehackedPickup%d", touchedIndex);
TypeInfo *subclass = RUNTIME_CLASS(ADehackedPickup)->CreateDerivedClass PClass *subclass = RUNTIME_CLASS(ADehackedPickup)->CreateDerivedClass
(copystring(typeNameBuilder), sizeof(ADehackedPickup)); (copystring(typeNameBuilder), sizeof(ADehackedPickup));
AActor *defaults2 = GetDefaultByType (subclass); AActor *defaults2 = GetDefaultByType (subclass);
memcpy (defaults2, defaults1, sizeof(AActor)); memcpy (defaults2, defaults1, sizeof(AActor));
@ -2548,7 +2548,7 @@ void FinishDehPatch ()
type->ActorInfo->SpawnID = 0; type->ActorInfo->SpawnID = 0;
type->ActorInfo->DoomEdNum = -1; type->ActorInfo->DoomEdNum = -1;
DPrintf ("%s replaces %s\n", subclass->Name, type->Name); DPrintf ("%s replaces %s\n", subclass->TypeName.GetChars(), type->TypeName.GetChars());
} }
// Since deh.MaxHealth was used incorrectly this can only be set // Since deh.MaxHealth was used incorrectly this can only be set
@ -2565,7 +2565,7 @@ void HandleNoSector()
for (touchedIndex = 0; touchedIndex < TouchedActors.Size(); ++touchedIndex) for (touchedIndex = 0; touchedIndex < TouchedActors.Size(); ++touchedIndex)
{ {
TypeInfo *ti = TouchedActors[touchedIndex]; PClass *ti = TouchedActors[touchedIndex];
if (ti!=NULL && ti->ActorInfo!=NULL && !ti->IsDescendantOf(RUNTIME_CLASS(ATeleportDest))) if (ti!=NULL && ti->ActorInfo!=NULL && !ti->IsDescendantOf(RUNTIME_CLASS(ATeleportDest)))
{ {
@ -2580,7 +2580,7 @@ void HandleNoSector()
} }
// The BossEye must be handled even without any Dehacked interference // The BossEye must be handled even without any Dehacked interference
// because otherwise it would not react to sound. // because otherwise it would not react to sound.
const TypeInfo * ti = TypeInfo::FindType("BossEye"); const PClass * ti = PClass::FindClass("BossEye");
if (ti!=NULL) if (ti!=NULL)
{ {
AActor * def = GetDefaultByType(ti); AActor * def = GetDefaultByType(ti);
@ -2618,7 +2618,7 @@ void A_SpawnDehackedPickup (AActor *actor)
bool ADehackedPickup::TryPickup (AActor *toucher) bool ADehackedPickup::TryPickup (AActor *toucher)
{ {
const TypeInfo *type = DetermineType (); const PClass *type = DetermineType ();
if (type == NULL) if (type == NULL)
{ {
return false; return false;
@ -2687,7 +2687,7 @@ void ADehackedPickup::Destroy ()
Super::Destroy (); Super::Destroy ();
} }
const TypeInfo *ADehackedPickup::DetermineType () const PClass *ADehackedPickup::DetermineType ()
{ {
// Look at the actor's current sprite to determine what kind of // Look at the actor's current sprite to determine what kind of
// item to pretend to me. // item to pretend to me.
@ -2700,7 +2700,7 @@ const TypeInfo *ADehackedPickup::DetermineType ()
int lex = memcmp (DehSpriteMappings[mid].Sprite, sprites[sprite].name, 4); int lex = memcmp (DehSpriteMappings[mid].Sprite, sprites[sprite].name, 4);
if (lex == 0) if (lex == 0)
{ {
return TypeInfo::FindType (DehSpriteMappings[mid].ClassName); return PClass::FindClass (DehSpriteMappings[mid].ClassName);
} }
else if (lex < 0) else if (lex < 0)
{ {

View file

@ -1905,7 +1905,7 @@ void D_DoomMain (void)
file[PATH_MAX-1] = 0; file[PATH_MAX-1] = 0;
#if defined(_MSC_VER) || defined(__GNUC__) #if defined(_MSC_VER) || defined(__GNUC__)
TypeInfo::StaticInit (); PClass::StaticInit ();
#endif #endif
atterm (DObject::StaticShutdown); atterm (DObject::StaticShutdown);

View file

@ -2104,10 +2104,10 @@ void Net_DoCommand (int type, byte **stream, int player)
case DEM_SUMMON: case DEM_SUMMON:
case DEM_SUMMONFRIEND: case DEM_SUMMONFRIEND:
{ {
const TypeInfo *typeinfo; const PClass *typeinfo;
s = ReadString (stream); s = ReadString (stream);
typeinfo = TypeInfo::FindType (s); typeinfo = PClass::FindClass (s);
if (typeinfo != NULL && typeinfo->ActorInfo != NULL) if (typeinfo != NULL && typeinfo->ActorInfo != NULL)
{ {
AActor *source = players[player].mo; AActor *source = players[player].mo;

View file

@ -69,8 +69,8 @@ public:
virtual bool DoHealingRadius (APlayerPawn *other); virtual bool DoHealingRadius (APlayerPawn *other);
virtual void MorphPlayerThink (); virtual void MorphPlayerThink ();
virtual void ActivateMorphWeapon (); virtual void ActivateMorphWeapon ();
virtual AWeapon *PickNewWeapon (const TypeInfo *ammotype); virtual AWeapon *PickNewWeapon (const PClass *ammotype);
virtual AWeapon *BestWeapon (const TypeInfo *ammotype); virtual AWeapon *BestWeapon (const PClass *ammotype);
enum EInvulState enum EInvulState
{ {
@ -165,7 +165,7 @@ public:
userinfo_t userinfo; // [RH] who is this? userinfo_t userinfo; // [RH] who is this?
const TypeInfo *cls; // class of associated PlayerPawn const PClass *cls; // class of associated PlayerPawn
float DesiredFOV; // desired field of vision float DesiredFOV; // desired field of vision
float FOV; // current field of vision float FOV; // current field of vision

View file

@ -349,9 +349,9 @@ void FDecalLib::ReadAllDecals ()
SC_Close (); SC_Close ();
} }
// Supporting code to allow specifying decals directly in the DECORATE lump // Supporting code to allow specifying decals directly in the DECORATE lump
for (i = 0; i < TypeInfo::m_RuntimeActors.Size(); i++) for (i = 0; i < PClass::m_RuntimeActors.Size(); i++)
{ {
AActor *def = (AActor*)GetDefaultByType (TypeInfo::m_RuntimeActors[i]); AActor *def = (AActor*)GetDefaultByType (PClass::m_RuntimeActors[i]);
intptr_t v = (intptr_t)def->DecalGenerator; intptr_t v = (intptr_t)def->DecalGenerator;
if (v > 0 && v <= (intptr_t)DecalNames.Size()) if (v > 0 && v <= (intptr_t)DecalNames.Size())
@ -585,26 +585,18 @@ void FDecalLib::ParseDecalGroup ()
void FDecalLib::ParseGenerator () void FDecalLib::ParseGenerator ()
{ {
const TypeInfo *type; const PClass *type;
FDecalBase *decal; FDecalBase *decal;
AActor *actor; AActor *actor;
// Get name of generator (actor) // Get name of generator (actor)
SC_MustGetString (); SC_MustGetString ();
type = TypeInfo::FindType (sc_String); type = PClass::FindClass (sc_String);
if (type == NULL || type->ActorInfo == NULL) if (type == NULL || type->ActorInfo == NULL)
{ {
if (type == NULL)
{
type = TypeInfo::IFindType (sc_String);
if (type != NULL)
{
SC_ScriptError ("%s is not an actor. Did you mean %s?", sc_String, type->Name + 1);
}
}
SC_ScriptError ("%s is not an actor.", sc_String); SC_ScriptError ("%s is not an actor.", sc_String);
} }
actor = (AActor *)type->ActorInfo->Defaults; actor = (AActor *)type->Defaults;
// Get name of generated decal // Get name of generated decal
SC_MustGetString (); SC_MustGetString ();
@ -894,7 +886,7 @@ void FDecalLib::AddDecal (FDecalBase *decal)
// Fix references to the old decal so that they use the new one instead. // Fix references to the old decal so that they use the new one instead.
for (unsigned int i = 0; i < node->Users.Size(); ++i) for (unsigned int i = 0; i < node->Users.Size(); ++i)
{ {
((AActor *)node->Users[i]->ActorInfo->Defaults)->DecalGenerator = decal; ((AActor *)node->Users[i]->Defaults)->DecalGenerator = decal;
} }
decal->Users = node->Users; decal->Users = node->Users;
delete node; delete node;

View file

@ -43,7 +43,7 @@
class AActor; class AActor;
class FDecalTemplate; class FDecalTemplate;
struct FDecalAnimator; struct FDecalAnimator;
struct TypeInfo; struct PClass;
class DBaseDecal; class DBaseDecal;
struct side_s; struct side_s;
@ -60,7 +60,7 @@ protected:
FDecalBase *Left, *Right; FDecalBase *Left, *Right;
FName Name; FName Name;
BYTE SpawnID; BYTE SpawnID;
TArray<const TypeInfo *> Users; // Which actors generate this decal TArray<const PClass *> Users; // Which actors generate this decal
}; };
class FDecalTemplate : public FDecalBase class FDecalTemplate : public FDecalBase

View file

@ -323,11 +323,11 @@ static void ParseDecorate (void (*process)(FState *, int))
{ {
TArray<FState> states; TArray<FState> states;
FExtraInfo extra; FExtraInfo extra;
TypeInfo *type; PClass *type;
TypeInfo *parent; PClass *parent;
EDefinitionType def; EDefinitionType def;
FActorInfo *info; FActorInfo *info;
char *typeName; FName typeName;
int recursion=0; int recursion=0;
// Get actor class name. The A prefix is added automatically. // Get actor class name. The A prefix is added automatically.
@ -384,11 +384,8 @@ static void ParseDecorate (void (*process)(FState *, int))
def = DEF_Decoration; def = DEF_Decoration;
} }
typeName = new char[strlen(sc_String)+2]; typeName = FName(sc_String);
typeName[0] = 'A'; type = parent->CreateDerivedClass (typeName, parent->Size);
strcpy (&typeName[1], sc_String);
type = parent->CreateDerivedClass (typeName, parent->SizeOf);
info = type->ActorInfo; info = type->ActorInfo;
info->GameFilter = 0x80; info->GameFilter = 0x80;
Decorations.Push (info); Decorations.Push (info);
@ -437,20 +434,20 @@ static void ParseDecorate (void (*process)(FState *, int))
states.Clear (); states.Clear ();
memset (&extra, 0, sizeof(extra)); memset (&extra, 0, sizeof(extra));
ParseInsideDecoration (info, (AActor *)(info->Defaults), states, extra, def); ParseInsideDecoration (info, (AActor *)(type->Defaults), states, extra, def);
info->NumOwnedStates = states.Size(); info->NumOwnedStates = states.Size();
if (info->NumOwnedStates == 0) if (info->NumOwnedStates == 0)
{ {
SC_ScriptError ("%s does not define any animation frames", typeName + 1); SC_ScriptError ("%s does not define any animation frames", typeName );
} }
else if (extra.SpawnEnd == 0) else if (extra.SpawnEnd == 0)
{ {
SC_ScriptError ("%s does not have a Frames definition", typeName + 1); SC_ScriptError ("%s does not have a Frames definition", typeName );
} }
else if (def == DEF_BreakableDecoration && extra.DeathEnd == 0) else if (def == DEF_BreakableDecoration && extra.DeathEnd == 0)
{ {
SC_ScriptError ("%s does not have a DeathFrames definition", typeName + 1); SC_ScriptError ("%s does not have a DeathFrames definition", typeName );
} }
else if (extra.IceDeathEnd != 0 && extra.bGenericIceDeath) else if (extra.IceDeathEnd != 0 && extra.bGenericIceDeath)
{ {
@ -526,10 +523,10 @@ static void ParseDecorate (void (*process)(FState *, int))
info->OwnedStates[extra.DeathStart].Action = A_ScreamAndUnblock; info->OwnedStates[extra.DeathStart].Action = A_ScreamAndUnblock;
} }
if (extra.DeathHeight == 0) extra.DeathHeight = ((AActor*)(info->Defaults))->height; if (extra.DeathHeight == 0) extra.DeathHeight = ((AActor*)(type->Defaults))->height;
info->Class->Meta.SetMetaFixed (AMETA_DeathHeight, extra.DeathHeight); info->Class->Meta.SetMetaFixed (AMETA_DeathHeight, extra.DeathHeight);
} }
((AActor *)(info->Defaults))->DeathState = &info->OwnedStates[extra.DeathStart]; ((AActor *)(type->Defaults))->DeathState = &info->OwnedStates[extra.DeathStart];
} }
// Burn states are the same as death states, except they can optionally terminate // Burn states are the same as death states, except they can optionally terminate
@ -565,10 +562,10 @@ static void ParseDecorate (void (*process)(FState *, int))
info->OwnedStates[extra.FireDeathStart].Action = A_ActiveAndUnblock; info->OwnedStates[extra.FireDeathStart].Action = A_ActiveAndUnblock;
} }
if (extra.BurnHeight == 0) extra.BurnHeight = ((AActor*)(info->Defaults))->height; if (extra.BurnHeight == 0) extra.BurnHeight = ((AActor*)(type->Defaults))->height;
info->Class->Meta.SetMetaFixed (AMETA_BurnHeight, extra.BurnHeight); type->Meta.SetMetaFixed (AMETA_BurnHeight, extra.BurnHeight);
((AActor *)(info->Defaults))->BDeathState = &info->OwnedStates[extra.FireDeathStart]; ((AActor *)(type->Defaults))->BDeathState = &info->OwnedStates[extra.FireDeathStart];
} }
// Ice states are similar to burn and death, except their final frame enters // Ice states are similar to burn and death, except their final frame enters
@ -589,31 +586,31 @@ static void ParseDecorate (void (*process)(FState *, int))
info->OwnedStates[i].Tics = 2; info->OwnedStates[i].Tics = 2;
info->OwnedStates[i].Misc1 = 0; info->OwnedStates[i].Misc1 = 0;
info->OwnedStates[i].Action = A_FreezeDeathChunks; info->OwnedStates[i].Action = A_FreezeDeathChunks;
((AActor *)(info->Defaults))->IDeathState = &info->OwnedStates[extra.IceDeathStart]; ((AActor *)(type->Defaults))->IDeathState = &info->OwnedStates[extra.IceDeathStart];
} }
else if (extra.bGenericIceDeath) else if (extra.bGenericIceDeath)
{ {
((AActor *)(info->Defaults))->IDeathState = &AActor::States[AActor::S_GENERICFREEZEDEATH]; ((AActor *)(type->Defaults))->IDeathState = &AActor::States[AActor::S_GENERICFREEZEDEATH];
} }
} }
if (def == DEF_BreakableDecoration) if (def == DEF_BreakableDecoration)
{ {
((AActor *)(info->Defaults))->flags |= MF_SHOOTABLE; ((AActor *)(type->Defaults))->flags |= MF_SHOOTABLE;
} }
if (def == DEF_Projectile) if (def == DEF_Projectile)
{ {
if (extra.ExplosionRadius > 0) if (extra.ExplosionRadius > 0)
{ {
((ASimpleProjectile *)(info->Defaults))->ExplosionRadius = ((ASimpleProjectile *)(type->Defaults))->ExplosionRadius =
extra.ExplosionRadius; extra.ExplosionRadius;
((ASimpleProjectile *)(info->Defaults))->ExplosionDamage = ((ASimpleProjectile *)(type->Defaults))->ExplosionDamage =
extra.ExplosionDamage > 0 ? extra.ExplosionDamage : extra.ExplosionRadius; extra.ExplosionDamage > 0 ? extra.ExplosionDamage : extra.ExplosionRadius;
((ASimpleProjectile *)(info->Defaults))->HurtShooter = ((ASimpleProjectile *)(type->Defaults))->HurtShooter =
!extra.ExplosionShooterImmune; !extra.ExplosionShooterImmune;
} }
((AActor *)(info->Defaults))->flags |= MF_DROPOFF|MF_MISSILE; ((AActor *)(type->Defaults))->flags |= MF_DROPOFF|MF_MISSILE;
} }
((AActor *)(info->Defaults))->SpawnState = &info->OwnedStates[extra.SpawnStart]; ((AActor *)(type->Defaults))->SpawnState = &info->OwnedStates[extra.SpawnStart];
process (info->OwnedStates, info->NumOwnedStates); process (info->OwnedStates, info->NumOwnedStates);
} }
} }

View file

@ -47,296 +47,23 @@
#include "r_state.h" #include "r_state.h"
#include "stats.h" #include "stats.h"
TArray<TypeInfo *> TypeInfo::m_RuntimeActors;
TArray<TypeInfo *> TypeInfo::m_Types (256);
unsigned int TypeInfo::TypeHash[TypeInfo::HASH_SIZE]; // Why can't I use TypeInfo::HASH_SIZE?
#if defined(_MSC_VER) || defined(__GNUC__)
#include "autosegs.h" #include "autosegs.h"
TypeInfo DObject::_StaticType = PClass DObject::_StaticType;
ClassReg DObject::RegistrationInfo =
{ {
"DObject", &DObject::_StaticType, // MyClass
NULL, "DObject", // Name
sizeof(DObject), NULL, // ParentType
sizeof(DObject), // SizeOf
NULL, // Pointers
&DObject::InPlaceConstructor // ConstructNative
}; };
_DECLARE_TI(DObject)
void TypeInfo::StaticInit ()
{
TAutoSegIterator<TypeInfo *, &CRegHead, &CRegTail> probe;
while (++probe != NULL)
{
probe->RegisterType ();
}
}
#else
TypeInfo DObject::_StaticType(NULL, "DObject", NULL, sizeof(DObject));
#endif
static cycle_t StaleCycles; static cycle_t StaleCycles;
static int StaleCount; static int StaleCount;
// A harmless non_NULL FlatPointer for classes without pointers.
static const size_t TheEnd = ~0;
static struct TypeInfoDataFreeer
{
~TypeInfoDataFreeer()
{
TArray<size_t *> uniqueFPs(64);
unsigned int i, j;
for (i = 0; i < TypeInfo::m_Types.Size(); ++i)
{
TypeInfo *type = TypeInfo::m_Types[i];
if (type->FlatPointers != &TheEnd && type->FlatPointers != type->Pointers)
{
// FlatPointers are shared by many classes, so we must check for
// duplicates and only delete those that are unique.
for (j = 0; j < uniqueFPs.Size(); ++j)
{
if (type->FlatPointers == uniqueFPs[j])
{
break;
}
}
if (j == uniqueFPs.Size())
{
uniqueFPs.Push(const_cast<size_t *>(type->FlatPointers));
}
}
// For runtime classes, this call will also delete the TypeInfo.
TypeInfo::StaticFreeData (type);
}
for (i = 0; i < uniqueFPs.Size(); ++i)
{
delete[] uniqueFPs[i];
}
}
} FreeTypeInfoData;
void TypeInfo::StaticFreeData (TypeInfo *type)
{
if (type->ActorInfo != NULL)
{
if (type->ActorInfo->Defaults != NULL)
{
delete[] type->ActorInfo->Defaults;
type->ActorInfo->Defaults = NULL;
}
}
if (type->bRuntimeClass)
{
if (type->Name != NULL)
{
delete[] type->Name;
}
type->Name = NULL;
if (type->ActorInfo != NULL)
{
if (type->ActorInfo->OwnedStates != NULL)
{
delete[] type->ActorInfo->OwnedStates;
type->ActorInfo->OwnedStates = NULL;
}
delete type->ActorInfo;
type->ActorInfo = NULL;
}
delete type;
}
}
void TypeInfo::RegisterType ()
{
// Add type to list
TypeIndex = m_Types.Push (this);
// Add type to hash table. Types are inserted into each bucket
// lexicographically, and the prefix character is ignored.
unsigned int bucket = MakeKey (Name+1) % HASH_SIZE;
unsigned int *hashpos = &TypeHash[bucket];
while (*hashpos != 0)
{
int lexx = strcmp (Name+1, m_Types[*hashpos-1]->Name+1);
// (The Lexx is the most powerful weapon of destruction
// in the two universes.)
if (lexx > 0)
{ // This type should come later in the chain
hashpos = &m_Types[*hashpos-1]->HashNext;
}
else if (lexx == 0)
{ // This type has already been inserted
I_FatalError ("Class %s already registered", Name);
}
else
{ // Type comes right here
break;
}
}
HashNext = *hashpos;
*hashpos = TypeIndex + 1;
}
// Case-sensitive search (preferred)
const TypeInfo *TypeInfo::FindType (const char *name)
{
if (name != NULL)
{
unsigned int index = TypeHash[MakeKey (name) % HASH_SIZE];
while (index != 0)
{
int lexx = strcmp (name, m_Types[index-1]->Name + 1);
if (lexx > 0)
{
index = m_Types[index-1]->HashNext;
}
else if (lexx == 0)
{
return m_Types[index-1];
}
else
{
break;
}
}
}
return NULL;
}
// Case-insensitive search
const TypeInfo *TypeInfo::IFindType (const char *name)
{
if (name != NULL)
{
for (int i = 0; i < TypeInfo::m_Types.Size(); i++)
{
if (stricmp (TypeInfo::m_Types[i]->Name + 1, name) == 0)
return TypeInfo::m_Types[i];
}
}
return NULL;
}
// Create a new object that this type represents
DObject *TypeInfo::CreateNew () const
{
BYTE *mem = (BYTE *)M_Malloc (SizeOf);
ConstructNative (mem);
((DObject *)mem)->SetClass (const_cast<TypeInfo *>(this));
// If this is a scripted extension of a class but not an actor,
// initialize any extended space to zero. Actors have defaults, so
// we can initialize them better
if (ActorInfo != NULL)
{
AActor *actor = (AActor *)mem;
memcpy (&(actor->x), &(((AActor *)ActorInfo->Defaults)->x), SizeOf - ((BYTE *)&actor->x - (BYTE *)actor));
}
else if (ParentType != 0 &&
ConstructNative == ParentType->ConstructNative &&
SizeOf > ParentType->SizeOf)
{
memset (mem + ParentType->SizeOf, 0, SizeOf - ParentType->SizeOf);
}
return (DObject *)mem;
}
// Create a new type based on an existing type
TypeInfo *TypeInfo::CreateDerivedClass (char *name, unsigned int size)
{
TypeInfo *type = new TypeInfo;
type->Name = name;
type->ParentType = this;
type->SizeOf = size;
type->Pointers = NULL;
type->ConstructNative = ConstructNative;
type->RegisterType();
type->Meta = Meta;
type->FlatPointers = NULL;
type->bRuntimeClass = true;
// If this class has an actor info, then any classes derived from it
// also need an actor info.
if (this->ActorInfo != NULL)
{
FActorInfo *info = type->ActorInfo = new FActorInfo;
info->Class = type;
info->Defaults = new BYTE[size];
info->GameFilter = GAME_Any;
info->SpawnID = 0;
info->DoomEdNum = -1;
info->OwnedStates = NULL;
info->NumOwnedStates = 0;
memcpy (info->Defaults, ActorInfo->Defaults, SizeOf);
if (size > SizeOf)
{
memset (info->Defaults + SizeOf, 0, size - SizeOf);
}
m_RuntimeActors.Push (type);
}
else
{
type->ActorInfo = NULL;
}
return type;
}
// Create the FlatPointers array, if it doesn't exist already.
// It comprises all the Pointers from superclasses plus this class's own Pointers.
// If this class does not define any new Pointers, then FlatPointers will be set
// to the same array as the super class's.
void TypeInfo::BuildFlatPointers ()
{
if (FlatPointers != NULL)
{ // Already built: Do nothing.
return;
}
else if (ParentType == NULL)
{ // No parent: FlatPointers is the same as Pointers.
if (Pointers == NULL)
{ // No pointers: Make FlatPointers a harmless non-NULL.
FlatPointers = &TheEnd;
}
else
{
FlatPointers = Pointers;
}
}
else
{
ParentType->BuildFlatPointers ();
if (Pointers == NULL)
{ // No new pointers: Just use the same FlatPointers as the parent.
FlatPointers = ParentType->FlatPointers;
}
else
{ // New pointers: Create a new FlatPointers array and add them.
int numPointers, numSuperPointers;
// Count pointers defined by this class.
for (numPointers = 0; Pointers[numPointers] != ~(size_t)0; numPointers++)
{ }
// Count pointers defined by superclasses.
for (numSuperPointers = 0; ParentType->FlatPointers[numSuperPointers] != ~(size_t)0; numSuperPointers++)
{ }
// Concatenate them into a new array
size_t *flat = new size_t[numPointers + numSuperPointers + 1];
if (numSuperPointers > 0)
{
memcpy (flat, ParentType->FlatPointers, sizeof(size_t)*numSuperPointers);
}
memcpy (flat + numSuperPointers, Pointers, sizeof(size_t)*(numPointers+1));
FlatPointers = flat;
}
}
}
FMetaTable::~FMetaTable () FMetaTable::~FMetaTable ()
{ {
FreeMeta (); FreeMeta ();
@ -467,14 +194,116 @@ const char *FMetaTable::GetMetaString (DWORD id) const
CCMD (dumpclasses) CCMD (dumpclasses)
{ {
const TypeInfo *root; // This is by no means speed-optimized. But it's an informational console
// command that will be executed infrequently, so I don't mind.
struct DumpInfo
{
const PClass *Type;
DumpInfo *Next;
DumpInfo *Children;
static DumpInfo *FindType (DumpInfo *root, const PClass *type)
{
if (root == NULL)
{
return root;
}
if (root->Type == type)
{
return root;
}
if (root->Next != NULL)
{
return FindType (root->Next, type);
}
if (root->Children != NULL)
{
return FindType (root->Children, type);
}
return NULL;
}
static DumpInfo *AddType (DumpInfo **root, const PClass *type)
{
DumpInfo *info, *parentInfo;
if (*root == NULL)
{
info = new DumpInfo;
info->Type = type;
info->Next = NULL;
info->Children = *root;
*root = info;
return info;
}
if (type->ParentClass == (*root)->Type)
{
parentInfo = *root;
}
else if (type == (*root)->Type)
{
return *root;
}
else
{
parentInfo = FindType (*root, type->ParentClass);
if (parentInfo == NULL)
{
parentInfo = AddType (root, type->ParentClass);
}
}
// Has this type already been added?
for (info = parentInfo->Children; info != NULL; info = info->Next)
{
if (info->Type == type)
{
return info;
}
}
info = new DumpInfo;
info->Type = type;
info->Next = parentInfo->Children;
info->Children = NULL;
parentInfo->Children = info;
return info;
}
static void PrintTree (DumpInfo *root, int level)
{
Printf ("%*c%s\n", level, ' ', root->Type->TypeName.GetChars());
if (root->Children != NULL)
{
PrintTree (root->Children, level + 2);
}
if (root->Next != NULL)
{
PrintTree (root->Next, level);
}
}
static void FreeTree (DumpInfo *root)
{
if (root->Children != NULL)
{
FreeTree (root->Children);
}
if (root->Next != NULL)
{
FreeTree (root->Next);
}
delete root;
}
};
int i; int i;
int shown, omitted; int shown, omitted;
DumpInfo *tree = NULL;
const PClass *root = NULL;
bool showall = true; bool showall = true;
if (argv.argc() > 1) if (argv.argc() > 1)
{ {
root = TypeInfo::IFindType (argv[1]); root = PClass::FindClass (argv[1]);
if (root == NULL) if (root == NULL)
{ {
Printf ("Class '%s' not found\n", argv[1]); Printf ("Class '%s' not found\n", argv[1]);
@ -488,20 +317,19 @@ CCMD (dumpclasses)
} }
} }
} }
else
{
root = NULL;
}
shown = omitted = 0; shown = omitted = 0;
for (i = 0; i < TypeInfo::m_Types.Size(); i++) DumpInfo::AddType (&tree, root != NULL ? root : RUNTIME_CLASS(DObject));
for (i = 0; i < PClass::m_Types.Size(); i++)
{ {
PClass *cls = PClass::m_Types[i];
if (root == NULL || if (root == NULL ||
(TypeInfo::m_Types[i]->IsDescendantOf (root) && (cls->IsDescendantOf (root) &&
(showall || TypeInfo::m_Types[i] == root || (showall || cls == root ||
TypeInfo::m_Types[i]->ActorInfo != root->ActorInfo))) cls->ActorInfo != root->ActorInfo)))
{ {
Printf (" %s\n", TypeInfo::m_Types[i]->Name + 1); DumpInfo::AddType (&tree, cls);
// Printf (" %s\n", PClass::m_Types[i]->Name + 1);
shown++; shown++;
} }
else else
@ -509,6 +337,8 @@ CCMD (dumpclasses)
omitted++; omitted++;
} }
} }
DumpInfo::PrintTree (tree, 2);
DumpInfo::FreeTree (tree);
Printf ("%d classes shown, %d omitted\n", shown, omitted); Printf ("%d classes shown, %d omitted\n", shown, omitted);
} }
@ -517,20 +347,25 @@ TArray<size_t> DObject::FreeIndices (TArray<size_t>::NoInit);
TArray<DObject *> DObject::ToDestroy (TArray<DObject *>::NoInit); TArray<DObject *> DObject::ToDestroy (TArray<DObject *>::NoInit);
bool DObject::Inactive; bool DObject::Inactive;
void DObject::InPlaceConstructor (void *mem)
{
new ((EInPlace *)mem) DObject;
}
DObject::DObject () DObject::DObject ()
: ObjectFlags(0), Class(0) : ObjectFlags(0), Class(0)
{ {
if (FreeIndices.Pop (Index)) if (FreeIndices.Pop (Index))
Objects[(unsigned int)Index] = this; Objects[Index] = this;
else else
Index = Objects.Push (this); Index = Objects.Push (this);
} }
DObject::DObject (TypeInfo *inClass) DObject::DObject (PClass *inClass)
: ObjectFlags(0), Class(inClass) : ObjectFlags(0), Class(inClass)
{ {
if (FreeIndices.Pop (Index)) if (FreeIndices.Pop (Index))
Objects[(unsigned int)Index] = this; Objects[Index] = this;
else else
Index = Objects.Push (this); Index = Objects.Push (this);
} }
@ -616,7 +451,7 @@ void DObject::RemoveFromArray ()
} }
else if (Objects.Size() > Index) else if (Objects.Size() > Index)
{ {
Objects[(unsigned int)Index] = NULL; Objects[Index] = NULL;
FreeIndices.Push (Index); FreeIndices.Push (Index);
} }
} }
@ -631,11 +466,11 @@ void DObject::PointerSubstitution (DObject *old, DObject *notOld)
DObject *current = i < highest ? Objects[i] : &bglobal; DObject *current = i < highest ? Objects[i] : &bglobal;
if (current) if (current)
{ {
const TypeInfo *info = current->GetClass(); const PClass *info = current->GetClass();
const size_t *offsets = info->FlatPointers; const size_t *offsets = info->FlatPointers;
if (offsets == NULL) if (offsets == NULL)
{ {
const_cast<TypeInfo *>(info)->BuildFlatPointers(); const_cast<PClass *>(info)->BuildFlatPointers();
offsets = info->FlatPointers; offsets = info->FlatPointers;
} }
while (*offsets != ~(size_t)0) while (*offsets != ~(size_t)0)
@ -699,11 +534,11 @@ void DObject::DestroyScan ()
DObject *current = i < highest ? Objects[i] : &bglobal; DObject *current = i < highest ? Objects[i] : &bglobal;
if (current) if (current)
{ {
const TypeInfo *info = current->GetClass(); const PClass *info = current->GetClass();
const size_t *offsets = info->FlatPointers; const size_t *offsets = info->FlatPointers;
if (offsets == NULL) if (offsets == NULL)
{ {
const_cast<TypeInfo *>(info)->BuildFlatPointers(); const_cast<PClass *>(info)->BuildFlatPointers();
offsets = info->FlatPointers; offsets = info->FlatPointers;
} }
while (*offsets != ~(size_t)0) while (*offsets != ~(size_t)0)
@ -778,7 +613,7 @@ void DObject::CheckIfSerialized () const
"BUG: %s::Serialize\n" "BUG: %s::Serialize\n"
"(or one of its superclasses) needs to call\n" "(or one of its superclasses) needs to call\n"
"Super::Serialize\n", "Super::Serialize\n",
StaticType ()->Name); StaticType()->TypeName.GetChars());
} }
} }

View file

@ -38,7 +38,7 @@
#include "tarray.h" #include "tarray.h"
#include "doomtype.h" #include "doomtype.h"
class TypeInfo; struct PClass;
class FArchive; class FArchive;
@ -133,15 +133,16 @@ private:
}; };
#define RUNTIME_TYPE(object) (object->GetClass()) // Passed an object, returns the type of that object #define RUNTIME_TYPE(object) (object->GetClass()) // Passed an object, returns the type of that object
#define RUNTIME_CLASS(cls) (&cls::_StaticType) // Passed a class name, returns a TypeInfo representing that class #define RUNTIME_CLASS(cls) (&cls::_StaticType) // Passed a class name, returns a PClass representing that class
#define NATIVE_TYPE(object) (object->StaticType()) // Passed an object, returns the type of the C++ class representing the object
struct ClassReg struct ClassReg
{ {
TypeInfo *MyClass; PClass *MyClass;
const char *Name; const char *Name;
TypeInfo *ParentType; PClass *ParentType;
unsigned int SizeOf; unsigned int SizeOf;
POINTY_TYPE(DObject) *Pointers; const size_t *Pointers;
void (*ConstructNative)(void *); void (*ConstructNative)(void *);
void RegisterClass(); void RegisterClass();
@ -151,8 +152,9 @@ enum EInPlace { EC_InPlace };
#define DECLARE_ABSTRACT_CLASS(cls,parent) \ #define DECLARE_ABSTRACT_CLASS(cls,parent) \
public: \ public: \
static TypeInfo _StaticType; \ static PClass _StaticType; \
virtual TypeInfo *StaticType() const { return RUNTIME_CLASS(cls); } \ virtual PClass *StaticType() const { return &_StaticType; } \
static ClassReg RegistrationInfo, *RegistrationInfoPtr; \
private: \ private: \
typedef parent Super; \ typedef parent Super; \
typedef cls ThisClass; typedef cls ThisClass;
@ -169,44 +171,39 @@ private: \
#define DECLARE_POINTER(field) (size_t)&((ThisClass*)1)->field - 1, #define DECLARE_POINTER(field) (size_t)&((ThisClass*)1)->field - 1,
#define END_POINTERS ~0 }; #define END_POINTERS ~0 };
#if !defined(_MSC_VER) && !defined(__GNUC__) #if defined(_MSC_VER)
# define _IMP_TYPEINFO(cls,ptr,create) \ # pragma data_seg(".creg$u")
TypeInfo cls::_StaticType (ptr, #cls, RUNTIME_CLASS(cls::Super), sizeof(cls), create); # pragma data_seg()
# define _DECLARE_TI(cls) __declspec(allocate(".creg$u")) ClassReg *cls::RegistrationInfoPtr = &cls::RegistrationInfo;
#else #else
# define _DECLARE_TI(cls) ClassReg *cls::RegistrationInfoPtr __attribute__((section("creg"))) = &cls::RegistartionInfo;
# if defined(_MSC_VER)
# pragma data_seg(".creg$u")
# pragma data_seg()
# define _DECLARE_TI(cls) __declspec(allocate(".creg$u")) TypeInfo *_##cls##AddType = &cls::_StaticType;
# else
# define _DECLARE_TI(cls) TypeInfo *_##cls##AddType __attribute__((section("creg"))) = &cls::_StaticType;
# endif
# define _IMP_TYPEINFO(cls,ptrs,create) \
TypeInfo cls::_StaticType = { \
#cls, \
RUNTIME_CLASS(cls::Super), \
sizeof(cls), \
ptrs, \
create, }; \
_DECLARE_TI(cls)
#endif #endif
#define _IMP_PCLASS(cls,ptrs,create) \
PClass cls::_StaticType; \
ClassReg cls::RegistrationInfo = {\
RUNTIME_CLASS(cls), \
#cls, \
RUNTIME_CLASS(cls::Super), \
sizeof(cls), \
ptrs, \
create }; \
_DECLARE_TI(cls)
#define _IMP_CREATE_OBJ(cls) \ #define _IMP_CREATE_OBJ(cls) \
void cls::InPlaceConstructor(void *mem) { new((EInPlace *)mem) cls; } void cls::InPlaceConstructor(void *mem) { new((EInPlace *)mem) cls; }
#define IMPLEMENT_POINTY_CLASS(cls) \ #define IMPLEMENT_POINTY_CLASS(cls) \
_IMP_CREATE_OBJ(cls) \ _IMP_CREATE_OBJ(cls) \
_IMP_TYPEINFO(cls,cls::PointerOffsets,cls::InPlaceConstructor) \ _IMP_PCLASS(cls,cls::PointerOffsets,cls::InPlaceConstructor) \
const size_t cls::PointerOffsets[] = { const size_t cls::PointerOffsets[] = {
#define IMPLEMENT_CLASS(cls) \ #define IMPLEMENT_CLASS(cls) \
_IMP_CREATE_OBJ(cls) \ _IMP_CREATE_OBJ(cls) \
_IMP_TYPEINFO(cls,NULL,cls::InPlaceConstructor) _IMP_PCLASS(cls,NULL,cls::InPlaceConstructor)
#define IMPLEMENT_ABSTRACT_CLASS(cls) \ #define IMPLEMENT_ABSTRACT_CLASS(cls) \
_IMP_TYPEINFO(cls,NULL,NULL) _IMP_PCLASS(cls,NULL,NULL)
enum EObjectFlags enum EObjectFlags
{ {
@ -218,27 +215,28 @@ enum EObjectFlags
class DObject class DObject
{ {
public: \ public:
static TypeInfo _StaticType; \ static PClass _StaticType;
virtual TypeInfo *StaticType() const { return &_StaticType; } \ virtual PClass *StaticType() const { return &_StaticType; }
static ClassReg RegistrationInfo; static ClassReg RegistrationInfo, *RegistrationInfoPtr;
static void InPlaceConstructor (void *mem); static void InPlaceConstructor (void *mem);
private: \ private:
typedef DObject ThisClass; typedef DObject ThisClass;
// Per-instance variables. There are three. // Per-instance variables. There are three.
public: public:
DWORD ObjectFlags; // Flags for this object DWORD ObjectFlags; // Flags for this object
private: private:
TypeInfo *Class; // This object's type PClass *Class; // This object's type
size_t Index; // This object's index in the global object table unsigned int Index; // This object's index in the global object table
public:
DObject (); DObject ();
DObject (TypeInfo *inClass); DObject (PClass *inClass);
virtual ~DObject (); virtual ~DObject ();
inline bool IsKindOf (const TypeInfo *base) const; inline bool IsKindOf (const PClass *base) const;
inline bool IsA (const TypeInfo *type) const; inline bool IsA (const PClass *type) const;
virtual void Serialize (FArchive &arc); virtual void Serialize (FArchive &arc);
@ -258,7 +256,7 @@ private:
static void STACK_ARGS StaticShutdown (); static void STACK_ARGS StaticShutdown ();
TypeInfo *GetClass() const PClass *GetClass() const
{ {
if (Class == NULL) if (Class == NULL)
{ {
@ -269,7 +267,7 @@ private:
return Class; return Class;
} }
void SetClass (TypeInfo *inClass) void SetClass (PClass *inClass)
{ {
Class = inClass; Class = inClass;
} }
@ -285,7 +283,7 @@ private:
} }
protected: protected:
// This form of placement new and delete is for use *only* by TypeInfo's // This form of placement new and delete is for use *only* by PClass's
// CreateNew() method. Do not use them for some other purpose. // CreateNew() method. Do not use them for some other purpose.
void *operator new(size_t len, EInPlace *mem) void *operator new(size_t len, EInPlace *mem)
{ {
@ -312,12 +310,12 @@ private:
#include "dobjtype.h" #include "dobjtype.h"
inline bool DObject::IsKindOf (const TypeInfo *base) const inline bool DObject::IsKindOf (const PClass *base) const
{ {
return base->IsAncestorOf (GetClass ()); return base->IsAncestorOf (GetClass ());
} }
inline bool DObject::IsA (const TypeInfo *type) const inline bool DObject::IsA (const PClass *type) const
{ {
return (type == GetClass()); return (type == GetClass());
} }

268
src/dobjtype.cpp Normal file
View file

@ -0,0 +1,268 @@
#include "dobject.h"
#include "i_system.h"
#include "actor.h"
#include "autosegs.h"
TArray<PClass *> PClass::m_RuntimeActors;
TArray<PClass *> PClass::m_Types;
PClass *PClass::TypeHash[PClass::HASH_SIZE];
// A harmless non_NULL FlatPointer for classes without pointers.
static const size_t TheEnd = ~0;
static struct TypeInfoDataFreeer
{
~TypeInfoDataFreeer()
{
TArray<size_t *> uniqueFPs(64);
unsigned int i, j;
for (i = 0; i < PClass::m_Types.Size(); ++i)
{
PClass *type = PClass::m_Types[i];
PClass::m_Types[i] = NULL;
if (type->FlatPointers != &TheEnd && type->FlatPointers != type->Pointers)
{
// FlatPointers are shared by many classes, so we must check for
// duplicates and only delete those that are unique.
for (j = 0; j < uniqueFPs.Size(); ++j)
{
if (type->FlatPointers == uniqueFPs[j])
{
break;
}
}
if (j == uniqueFPs.Size())
{
uniqueFPs.Push(const_cast<size_t *>(type->FlatPointers));
}
}
// For runtime classes, this call will also delete the PClass.
PClass::StaticFreeData (type);
}
for (i = 0; i < uniqueFPs.Size(); ++i)
{
delete[] uniqueFPs[i];
}
}
} FreeTypeInfoData;
void PClass::StaticFreeData (PClass *type)
{
if (type->Defaults != NULL)
{
delete[] type->Defaults;
type->Defaults = NULL;
}
if (type->bRuntimeClass)
{
if (type->ActorInfo != NULL)
{
if (type->ActorInfo->OwnedStates != NULL)
{
delete[] type->ActorInfo->OwnedStates;
type->ActorInfo->OwnedStates = NULL;
}
delete type->ActorInfo;
type->ActorInfo = NULL;
}
delete type;
}
}
void PClass::StaticInit ()
{
TAutoSegIterator<ClassReg *, &CRegHead, &CRegTail> probe;
while (++probe != NULL)
{
probe->RegisterClass ();
}
}
void ClassReg::RegisterClass ()
{
assert (MyClass != NULL);
// Add type to list
MyClass->ClassIndex = PClass::m_Types.Push (MyClass);
MyClass->TypeName = FName(Name+1);
MyClass->ParentClass = ParentType;
MyClass->Size = SizeOf;
MyClass->Pointers = Pointers;
MyClass->ConstructNative = ConstructNative;
MyClass->InsertIntoHash ();
}
void PClass::InsertIntoHash ()
{
// Add class to hash table. Classes are inserted into each bucket
// in ascending order by name index.
unsigned int bucket = TypeName % HASH_SIZE;
PClass **hashpos = &TypeHash[bucket];
while (*hashpos != NULL)
{
int lexx = int(TypeName) - int((*hashpos)->TypeName);
if (lexx > 0)
{ // This type should come later in the chain
hashpos = &((*hashpos)->HashNext);
}
else if (lexx == 0)
{ // This type has already been inserted
I_FatalError ("Tried to register class '%s' more than once.", TypeName.GetChars());
}
else
{ // Type comes right here
break;
}
}
HashNext = *hashpos;
*hashpos = this;
}
// Find a type, passed the name as a string
const PClass *PClass::FindClass (const char *zaname)
{
FName namename (zaname, true);
if (namename == NAME_None)
{
return NULL;
}
return FindClass (namename);
}
// Find a type, passed the name as a name
const PClass *PClass::FindClass (FName zaname)
{
PClass *cls = TypeHash[zaname % HASH_SIZE];
while (cls != 0)
{
int lexx = int(zaname) - int(cls->TypeName);
if (lexx > 0)
{
cls = cls->HashNext;
}
else if (lexx == 0)
{
return cls;
}
else
{
break;
}
}
return NULL;
}
// Create a new object that this class represents
DObject *PClass::CreateNew () const
{
BYTE *mem = (BYTE *)M_Malloc (Size);
// Set this object's defaults before constructing it.
memcpy (mem, Defaults, Size);
ConstructNative (mem);
((DObject *)mem)->SetClass (const_cast<PClass *>(this));
return (DObject *)mem;
}
// Create a new class based on an existing class
PClass *PClass::CreateDerivedClass (FName name, unsigned int size)
{
assert (size >= Size);
PClass *type = new PClass;
type->TypeName = name;
type->ParentClass = this;
type->Size = size;
type->Pointers = NULL;
type->ConstructNative = ConstructNative;
type->ClassIndex = m_Types.Push (type);
type->InsertIntoHash();
type->Meta = Meta;
type->Defaults = new BYTE[size];
memcpy (type->Defaults, Defaults, Size);
if (size > Size)
{
memset (type->Defaults + Size, 0, size - Size);
}
type->FlatPointers = NULL;
type->bRuntimeClass = true;
// If this class has an actor info, then any classes derived from it
// also need an actor info.
if (this->ActorInfo != NULL)
{
FActorInfo *info = type->ActorInfo = new FActorInfo;
info->Class = type;
info->GameFilter = GAME_Any;
info->SpawnID = 0;
info->DoomEdNum = -1;
info->OwnedStates = NULL;
info->NumOwnedStates = 0;
m_RuntimeActors.Push (type);
}
else
{
type->ActorInfo = NULL;
}
return type;
}
// Create the FlatPointers array, if it doesn't exist already.
// It comprises all the Pointers from superclasses plus this class's own Pointers.
// If this class does not define any new Pointers, then FlatPointers will be set
// to the same array as the super class's.
void PClass::BuildFlatPointers ()
{
if (FlatPointers != NULL)
{ // Already built: Do nothing.
return;
}
else if (ParentClass == NULL)
{ // No parent: FlatPointers is the same as Pointers.
if (Pointers == NULL)
{ // No pointers: Make FlatPointers a harmless non-NULL.
FlatPointers = &TheEnd;
}
else
{
FlatPointers = Pointers;
}
}
else
{
ParentClass->BuildFlatPointers ();
if (Pointers == NULL)
{ // No new pointers: Just use the same FlatPointers as the parent.
FlatPointers = ParentClass->FlatPointers;
}
else
{ // New pointers: Create a new FlatPointers array and add them.
int numPointers, numSuperPointers;
// Count pointers defined by this class.
for (numPointers = 0; Pointers[numPointers] != ~(size_t)0; numPointers++)
{ }
// Count pointers defined by superclasses.
for (numSuperPointers = 0; ParentClass->FlatPointers[numSuperPointers] != ~(size_t)0; numSuperPointers++)
{ }
// Concatenate them into a new array
size_t *flat = new size_t[numPointers + numSuperPointers + 1];
if (numSuperPointers > 0)
{
memcpy (flat, ParentClass->FlatPointers, sizeof(size_t)*numSuperPointers);
}
memcpy (flat + numSuperPointers, Pointers, sizeof(size_t)*(numPointers+1));
FlatPointers = flat;
}
}
}

60
src/dobjtype.h Normal file
View file

@ -0,0 +1,60 @@
#ifndef DOBJTYPE_H
#define DOBJTYPE_H
#ifndef __DOBJECT_H__
#error You must #include "dobject.h" to get dobjtype.h
#endif
struct PClass
{
static void StaticInit ();
static void StaticFreeData (PClass *type);
// Per-class information -------------------------------------
FName TypeName; // this class's name
unsigned int Size; // this class's size
PClass *ParentClass; // the class this class derives from
const size_t *Pointers; // object pointers defined by this class *only*
const size_t *FlatPointers; // object pointers defined by this class and all its superclasses; not initialized by default
FActorInfo *ActorInfo;
PClass *HashNext;
FMetaTable Meta;
BYTE *Defaults;
bool bRuntimeClass; // class was defined at run-time, not compile-time
unsigned short ClassIndex;
void (*ConstructNative)(void *);
// The rest are all functions and static data ----------------
void InsertIntoHash ();
DObject *CreateNew () const;
PClass *CreateDerivedClass (FName name, unsigned int size);
void BuildFlatPointers ();
// Returns true if this type is an ancestor of (or same as) the passed type.
bool IsAncestorOf (const PClass *ti) const
{
while (ti)
{
if (this == ti)
return true;
ti = ti->ParentClass;
}
return false;
}
inline bool IsDescendantOf (const PClass *ti) const
{
return ti->IsAncestorOf (this);
}
static const PClass *FindClass (const char *name);
static const PClass *FindClass (FName name);
static TArray<PClass *> m_Types;
static TArray<PClass *> m_RuntimeActors;
enum { HASH_SIZE = 256 };
static PClass *TypeHash[HASH_SIZE];
};
#endif

View file

@ -38,6 +38,7 @@
#include <limits.h> #include <limits.h>
#include "zstring.h" #include "zstring.h"
#include "name.h"
#ifndef __BYTEBOOL__ #ifndef __BYTEBOOL__
#define __BYTEBOOL__ #define __BYTEBOOL__

View file

@ -336,7 +336,7 @@ void DThinker::Tick ()
{ {
} }
FThinkerIterator::FThinkerIterator (const TypeInfo *type, int statnum) FThinkerIterator::FThinkerIterator (const PClass *type, int statnum)
{ {
if ((unsigned)statnum > MAX_STATNUM) if ((unsigned)statnum > MAX_STATNUM)
{ {
@ -353,7 +353,7 @@ FThinkerIterator::FThinkerIterator (const TypeInfo *type, int statnum)
m_SearchingFresh = false; m_SearchingFresh = false;
} }
FThinkerIterator::FThinkerIterator (const TypeInfo *type, int statnum, DThinker *prev) FThinkerIterator::FThinkerIterator (const PClass *type, int statnum, DThinker *prev)
{ {
if ((unsigned)statnum > MAX_STATNUM) if ((unsigned)statnum > MAX_STATNUM)
{ {

View file

@ -87,15 +87,15 @@ private:
class FThinkerIterator class FThinkerIterator
{ {
private: private:
const TypeInfo *m_ParentType; const PClass *m_ParentType;
Node *m_CurrThinker; Node *m_CurrThinker;
BYTE m_Stat; BYTE m_Stat;
bool m_SearchStats; bool m_SearchStats;
bool m_SearchingFresh; bool m_SearchingFresh;
public: public:
FThinkerIterator (const TypeInfo *type, int statnum=MAX_STATNUM+1); FThinkerIterator (const PClass *type, int statnum=MAX_STATNUM+1);
FThinkerIterator (const TypeInfo *type, int statnum, DThinker *prev); FThinkerIterator (const PClass *type, int statnum, DThinker *prev);
DThinker *Next (); DThinker *Next ();
void Reinit (); void Reinit ();
}; };

View file

@ -536,13 +536,13 @@ extern gamestate_t wipegamestate;
void F_StartCast (void) void F_StartCast (void)
{ {
const TypeInfo *type; const PClass *type;
int i; int i;
// [RH] Set the names and defaults for the cast // [RH] Set the names and defaults for the cast
for (i = 0; castorder[i].type; i++) for (i = 0; castorder[i].type; i++)
{ {
type = TypeInfo::FindType (castorder[i].type); type = PClass::FindClass (castorder[i].type);
if (type == NULL) if (type == NULL)
castorder[i].info = GetDefault<AActor>(); castorder[i].info = GetDefault<AActor>();
else else
@ -551,13 +551,13 @@ void F_StartCast (void)
for (i = 0; atkstates[i].type; i++) for (i = 0; atkstates[i].type; i++)
{ {
type = TypeInfo::FindType (atkstates[i].type); type = PClass::FindClass (atkstates[i].type);
if (type != NULL) if (type != NULL)
{ {
if (atkstates[i].melee) if (atkstates[i].melee)
atkstates[i].match = ((AActor *)(type->ActorInfo->Defaults))->MeleeState + atkstates[i].ofs; atkstates[i].match = ((AActor *)(type->Defaults))->MeleeState + atkstates[i].ofs;
else else
atkstates[i].match = ((AActor *)(type->ActorInfo->Defaults))->MissileState + atkstates[i].ofs; atkstates[i].match = ((AActor *)(type->Defaults))->MissileState + atkstates[i].ofs;
} }
else else
{ {
@ -565,9 +565,9 @@ void F_StartCast (void)
} }
} }
type = TypeInfo::FindType ("DoomPlayer"); type = PClass::FindClass (NAME_DoomPlayer);
if (type != NULL) if (type != NULL)
advplayerstate = ((AActor *)(type->ActorInfo->Defaults))->MissileState; advplayerstate = ((AActor *)(type->Defaults))->MissileState;
wipegamestate = GS_FORCEWIPE; wipegamestate = GS_FORCEWIPE;
castnum = 0; castnum = 0;

View file

@ -636,8 +636,8 @@ void FArchive::AttachToFile (FFile &file)
} }
m_Persistent = file.IsPersistent(); m_Persistent = file.IsPersistent();
m_TypeMap = NULL; m_TypeMap = NULL;
m_TypeMap = new TypeMap[TypeInfo::m_Types.Size()]; m_TypeMap = new TypeMap[PClass::m_Types.Size()];
for (i = 0; i < TypeInfo::m_Types.Size(); i++) for (i = 0; i < PClass::m_Types.Size(); i++)
{ {
m_TypeMap[i].toArchive = TypeMap::NO_INDEX; m_TypeMap[i].toArchive = TypeMap::NO_INDEX;
m_TypeMap[i].toCurrent = NULL; m_TypeMap[i].toCurrent = NULL;
@ -963,7 +963,7 @@ FArchive &FArchive::SerializePointer (void *ptrbase, BYTE **ptr, DWORD elemSize)
return *this; return *this;
} }
FArchive &FArchive::SerializeObject (DObject *&object, TypeInfo *type) FArchive &FArchive::SerializeObject (DObject *&object, PClass *type)
{ {
if (IsStoring ()) if (IsStoring ())
return WriteObject (object); return WriteObject (object);
@ -988,7 +988,7 @@ FArchive &FArchive::WriteObject (DObject *obj)
} }
else else
{ {
const TypeInfo *type = RUNTIME_TYPE(obj); const PClass *type = RUNTIME_TYPE(obj);
if (type == RUNTIME_CLASS(DObject)) if (type == RUNTIME_CLASS(DObject))
{ {
@ -997,7 +997,7 @@ FArchive &FArchive::WriteObject (DObject *obj)
id[0] = NULL_OBJ; id[0] = NULL_OBJ;
Write (id, 1); Write (id, 1);
} }
else if (m_TypeMap[type->TypeIndex].toArchive == TypeMap::NO_INDEX) else if (m_TypeMap[type->ClassIndex].toArchive == TypeMap::NO_INDEX)
{ {
// No instances of this class have been written out yet. // No instances of this class have been written out yet.
// Write out the class, then write out the object. If this // Write out the class, then write out the object. If this
@ -1047,7 +1047,7 @@ FArchive &FArchive::WriteObject (DObject *obj)
id[0] = NEW_OBJ; id[0] = NEW_OBJ;
Write (id, 1); Write (id, 1);
} }
WriteCount (m_TypeMap[type->TypeIndex].toArchive); WriteCount (m_TypeMap[type->ClassIndex].toArchive);
// Printf ("Reuse class %s (%u)\n", type->Name, m_File->Tell()); // Printf ("Reuse class %s (%u)\n", type->Name, m_File->Tell());
MapObject (obj); MapObject (obj);
obj->Serialize (*this); obj->Serialize (*this);
@ -1064,10 +1064,10 @@ FArchive &FArchive::WriteObject (DObject *obj)
return *this; return *this;
} }
FArchive &FArchive::ReadObject (DObject* &obj, TypeInfo *wanttype) FArchive &FArchive::ReadObject (DObject* &obj, PClass *wanttype)
{ {
BYTE objHead; BYTE objHead;
const TypeInfo *type; const PClass *type;
BYTE playerNum; BYTE playerNum;
DWORD index; DWORD index;
@ -1289,24 +1289,24 @@ DWORD FArchive::FindName (const char *name, unsigned int bucket) const
return (DWORD)map; return (DWORD)map;
} }
DWORD FArchive::WriteClass (const TypeInfo *info) DWORD FArchive::WriteClass (const PClass *info)
{ {
if (m_ClassCount >= TypeInfo::m_Types.Size()) if (m_ClassCount >= PClass::m_Types.Size())
{ {
I_Error ("Too many unique classes have been written.\nOnly %u were registered\n", I_Error ("Too many unique classes have been written.\nOnly %u were registered\n",
TypeInfo::m_Types.Size()); PClass::m_Types.Size());
} }
if (m_TypeMap[info->TypeIndex].toArchive != TypeMap::NO_INDEX) if (m_TypeMap[info->ClassIndex].toArchive != TypeMap::NO_INDEX)
{ {
I_Error ("Attempt to write '%s' twice.\n", info->Name); I_Error ("Attempt to write '%s' twice.\n", info->TypeName.GetChars());
} }
m_TypeMap[info->TypeIndex].toArchive = m_ClassCount; m_TypeMap[info->ClassIndex].toArchive = m_ClassCount;
m_TypeMap[m_ClassCount].toCurrent = info; m_TypeMap[m_ClassCount].toCurrent = info;
WriteString (info->Name); WriteString (info->TypeName.GetChars());
return m_ClassCount++; return m_ClassCount++;
} }
const TypeInfo *FArchive::ReadClass () const PClass *FArchive::ReadClass ()
{ {
struct String { struct String {
String() { val = NULL; } String() { val = NULL; }
@ -1315,51 +1315,55 @@ const TypeInfo *FArchive::ReadClass ()
} typeName; } typeName;
int i; int i;
if (m_ClassCount >= TypeInfo::m_Types.Size()) if (m_ClassCount >= PClass::m_Types.Size())
{ {
I_Error ("Too many unique classes have been read.\nOnly %u were registered\n", I_Error ("Too many unique classes have been read.\nOnly %u were registered\n",
TypeInfo::m_Types.Size()); PClass::m_Types.Size());
} }
operator<< (typeName.val); operator<< (typeName.val);
for (i = 0; i < TypeInfo::m_Types.Size(); i++) FName zaname(typeName.val, true);
if (zaname != NAME_None)
{ {
if (!strcmp (TypeInfo::m_Types[i]->Name, typeName.val)) for (i = 0; i < PClass::m_Types.Size(); i++)
{ {
m_TypeMap[i].toArchive = m_ClassCount; if (PClass::m_Types[i]->TypeName == zaname)
m_TypeMap[m_ClassCount].toCurrent = TypeInfo::m_Types[i]; {
m_ClassCount++; m_TypeMap[i].toArchive = m_ClassCount;
return TypeInfo::m_Types[i]; m_TypeMap[m_ClassCount].toCurrent = PClass::m_Types[i];
m_ClassCount++;
return PClass::m_Types[i];
}
} }
} }
I_Error ("Unknown class '%s'\n", typeName.val); I_Error ("Unknown class '%s'\n", typeName.val);
return NULL; return NULL;
} }
const TypeInfo *FArchive::ReadClass (const TypeInfo *wanttype) const PClass *FArchive::ReadClass (const PClass *wanttype)
{ {
const TypeInfo *type = ReadClass (); const PClass *type = ReadClass ();
if (!type->IsDescendantOf (wanttype)) if (!type->IsDescendantOf (wanttype))
{ {
I_Error ("Expected to extract an object of type '%s'.\n" I_Error ("Expected to extract an object of type '%s'.\n"
"Found one of type '%s' instead.\n", "Found one of type '%s' instead.\n",
wanttype->Name, type->Name); wanttype->TypeName.GetChars(), type->TypeName.GetChars());
} }
return type; return type;
} }
const TypeInfo *FArchive::ReadStoredClass (const TypeInfo *wanttype) const PClass *FArchive::ReadStoredClass (const PClass *wanttype)
{ {
DWORD index = ReadCount (); DWORD index = ReadCount ();
if (index >= m_ClassCount) if (index >= m_ClassCount)
{ {
I_Error ("Class reference too high (%lu; max is %lu)\n", index, m_ClassCount); I_Error ("Class reference too high (%lu; max is %lu)\n", index, m_ClassCount);
} }
const TypeInfo *type = m_TypeMap[index].toCurrent; const PClass *type = m_TypeMap[index].toCurrent;
if (!type->IsDescendantOf (wanttype)) if (!type->IsDescendantOf (wanttype))
{ {
I_Error ("Expected to extract an object of type '%s'.\n" I_Error ("Expected to extract an object of type '%s'.\n"
"Found one of type '%s' instead.\n", "Found one of type '%s' instead.\n",
wanttype->Name, type->Name); wanttype->TypeName.GetChars(), type->TypeName.GetChars());
} }
return type; return type;
} }
@ -1404,7 +1408,7 @@ DWORD FArchive::FindObjectIndex (const DObject *obj) const
return (DWORD)index; return (DWORD)index;
} }
void FArchive::UserWriteClass (const TypeInfo *type) void FArchive::UserWriteClass (const PClass *type)
{ {
BYTE id; BYTE id;
@ -1415,7 +1419,7 @@ void FArchive::UserWriteClass (const TypeInfo *type)
} }
else else
{ {
if (m_TypeMap[type->TypeIndex].toArchive == TypeMap::NO_INDEX) if (m_TypeMap[type->ClassIndex].toArchive == TypeMap::NO_INDEX)
{ {
id = 1; id = 1;
Write (&id, 1); Write (&id, 1);
@ -1425,12 +1429,12 @@ void FArchive::UserWriteClass (const TypeInfo *type)
{ {
id = 0; id = 0;
Write (&id, 1); Write (&id, 1);
WriteCount (m_TypeMap[type->TypeIndex].toArchive); WriteCount (m_TypeMap[type->ClassIndex].toArchive);
} }
} }
} }
void FArchive::UserReadClass (const TypeInfo *&type) void FArchive::UserReadClass (const PClass *&type)
{ {
BYTE newclass; BYTE newclass;
@ -1452,7 +1456,7 @@ void FArchive::UserReadClass (const TypeInfo *&type)
} }
} }
FArchive &operator<< (FArchive &arc, const TypeInfo * &info) FArchive &operator<< (FArchive &arc, const PClass * &info)
{ {
if (arc.IsStoring ()) if (arc.IsStoring ())
{ {

View file

@ -168,8 +168,8 @@ virtual void Read (void *mem, unsigned int len);
void WriteCount (DWORD count); void WriteCount (DWORD count);
DWORD ReadCount (); DWORD ReadCount ();
void UserWriteClass (const TypeInfo *info); void UserWriteClass (const PClass *info);
void UserReadClass (const TypeInfo *&info); void UserReadClass (const PClass *&info);
FArchive& operator<< (BYTE &c); FArchive& operator<< (BYTE &c);
FArchive& operator<< (WORD &s); FArchive& operator<< (WORD &s);
@ -180,9 +180,9 @@ virtual void Read (void *mem, unsigned int len);
FArchive& operator<< (char *&str); FArchive& operator<< (char *&str);
FArchive& operator<< (FName &n); FArchive& operator<< (FName &n);
FArchive& SerializePointer (void *ptrbase, BYTE **ptr, DWORD elemSize); FArchive& SerializePointer (void *ptrbase, BYTE **ptr, DWORD elemSize);
FArchive& SerializeObject (DObject *&object, TypeInfo *type); FArchive& SerializeObject (DObject *&object, PClass *type);
FArchive& WriteObject (DObject *obj); FArchive& WriteObject (DObject *obj);
FArchive& ReadObject (DObject *&obj, TypeInfo *wanttype); FArchive& ReadObject (DObject *&obj, PClass *wanttype);
void WriteName (const char *name); void WriteName (const char *name);
const char *ReadName (); // The returned name disappears with the archive, unlike strings const char *ReadName (); // The returned name disappears with the archive, unlike strings
@ -207,10 +207,10 @@ protected:
DWORD FindObjectIndex (const DObject *obj) const; DWORD FindObjectIndex (const DObject *obj) const;
DWORD MapObject (const DObject *obj); DWORD MapObject (const DObject *obj);
DWORD WriteClass (const TypeInfo *info); DWORD WriteClass (const PClass *info);
const TypeInfo *ReadClass (); const PClass *ReadClass ();
const TypeInfo *ReadClass (const TypeInfo *wanttype); const PClass *ReadClass (const PClass *wanttype);
const TypeInfo *ReadStoredClass (const TypeInfo *wanttype); const PClass *ReadStoredClass (const PClass *wanttype);
DWORD HashObject (const DObject *obj) const; DWORD HashObject (const DObject *obj) const;
DWORD AddName (const char *name); DWORD AddName (const char *name);
DWORD AddName (unsigned int start); // Name has already been added to storage DWORD AddName (unsigned int start); // Name has already been added to storage
@ -228,7 +228,7 @@ protected:
struct TypeMap struct TypeMap
{ {
const TypeInfo *toCurrent; // maps archive type index to execution type index const PClass *toCurrent; // maps archive type index to execution type index
DWORD toArchive; // maps execution type index to archive type index DWORD toArchive; // maps execution type index to archive type index
enum { NO_INDEX = 0xffffffff }; enum { NO_INDEX = 0xffffffff };
@ -285,7 +285,7 @@ inline FArchive &operator<< (FArchive &arc, T* &object)
return arc.SerializeObject ((DObject*&)object, RUNTIME_CLASS(T)); return arc.SerializeObject ((DObject*&)object, RUNTIME_CLASS(T));
} }
FArchive &operator<< (FArchive &arc, const TypeInfo * &info); FArchive &operator<< (FArchive &arc, const PClass * &info);
template<class T> template<class T>
inline FArchive &operator<< (FArchive &arc, TArray<T> &self) inline FArchive &operator<< (FArchive &arc, TArray<T> &self)

View file

@ -67,7 +67,7 @@ public:
P_GiveBody (Owner, 100); P_GiveBody (Owner, 100);
if (Super::Use (pickup)) if (Super::Use (pickup))
{ {
const TypeInfo *fistType = TypeInfo::FindType ("Fist"); const PClass *fistType = PClass::FindClass ("Fist");
if (Owner->player->ReadyWeapon == NULL || if (Owner->player->ReadyWeapon == NULL ||
Owner->player->ReadyWeapon->GetClass() != fistType) Owner->player->ReadyWeapon->GetClass() != fistType)
{ {

View file

@ -84,7 +84,7 @@ public:
void BeginPlay (); void BeginPlay ();
void Tick (); void Tick ();
void SetWeapon (EMarineWeapon); void SetWeapon (EMarineWeapon);
void SetSprite (const TypeInfo *source); void SetSprite (const PClass *source);
void Serialize (FArchive &arc); void Serialize (FArchive &arc);
protected: protected:

View file

@ -101,10 +101,10 @@ void ADoomPlayer::GiveDefaultInventory ()
player->health = deh.StartHealth; // [RH] Used to be MAXHEALTH player->health = deh.StartHealth; // [RH] Used to be MAXHEALTH
health = deh.StartHealth; health = deh.StartHealth;
fist = player->mo->GiveInventoryType (TypeInfo::FindType ("Fist")); fist = player->mo->GiveInventoryType (PClass::FindClass ("Fist"));
pistol = player->mo->GiveInventoryType (TypeInfo::FindType ("Pistol")); pistol = player->mo->GiveInventoryType (PClass::FindClass ("Pistol"));
// Adding the pistol automatically adds bullets // Adding the pistol automatically adds bullets
bullets = player->mo->FindInventory (TypeInfo::FindType ("Clip")); bullets = player->mo->FindInventory (PClass::FindClass ("Clip"));
if (bullets != NULL) if (bullets != NULL)
{ {
bullets->Amount = deh.StartBullets; // [RH] Used to be 50 bullets->Amount = deh.StartBullets; // [RH] Used to be 50

View file

@ -1349,14 +1349,14 @@ void A_BFGSpray (AActor *mo)
int damage; int damage;
angle_t an; angle_t an;
AActor *thingToHit; AActor *thingToHit;
const TypeInfo *spraytype = NULL; const PClass *spraytype = NULL;
int numrays = 40; int numrays = 40;
int damagecnt = 15; int damagecnt = 15;
int index = CheckIndex (3, NULL); int index = CheckIndex (3, NULL);
if (index >= 0) if (index >= 0)
{ {
spraytype = TypeInfo::FindType ((const char *)StateParameters[index]); spraytype = PClass::FindClass ((const char *)StateParameters[index]);
numrays = EvalExpressionI (StateParameters[index+1], mo); numrays = EvalExpressionI (StateParameters[index+1], mo);
if (numrays <= 0) if (numrays <= 0)
numrays = 40; numrays = 40;

View file

@ -171,9 +171,9 @@ void A_FatAttack1 (AActor *self)
if (!self->target) if (!self->target)
return; return;
const TypeInfo *spawntype = NULL; const PClass *spawntype = NULL;
int index = CheckIndex (1, NULL); int index = CheckIndex (1, NULL);
if (index >= 0) spawntype = TypeInfo::FindType ((const char *)StateParameters[index]); if (index >= 0) spawntype = PClass::FindClass ((const char *)StateParameters[index]);
if (spawntype == NULL) spawntype = RUNTIME_CLASS(AFatShot); if (spawntype == NULL) spawntype = RUNTIME_CLASS(AFatShot);
A_FaceTarget (self); A_FaceTarget (self);
@ -199,9 +199,9 @@ void A_FatAttack2 (AActor *self)
if (!self->target) if (!self->target)
return; return;
const TypeInfo *spawntype = NULL; const PClass *spawntype = NULL;
int index = CheckIndex (1, NULL); int index = CheckIndex (1, NULL);
if (index >= 0) spawntype = TypeInfo::FindType ((const char *)StateParameters[index]); if (index >= 0) spawntype = PClass::FindClass ((const char *)StateParameters[index]);
if (spawntype == NULL) spawntype = RUNTIME_CLASS(AFatShot); if (spawntype == NULL) spawntype = RUNTIME_CLASS(AFatShot);
A_FaceTarget (self); A_FaceTarget (self);
@ -227,9 +227,9 @@ void A_FatAttack3 (AActor *self)
if (!self->target) if (!self->target)
return; return;
const TypeInfo *spawntype = NULL; const PClass *spawntype = NULL;
int index = CheckIndex (1, NULL); int index = CheckIndex (1, NULL);
if (index >= 0) spawntype = TypeInfo::FindType ((const char *)StateParameters[index]); if (index >= 0) spawntype = PClass::FindClass ((const char *)StateParameters[index]);
if (spawntype == NULL) spawntype = RUNTIME_CLASS(AFatShot); if (spawntype == NULL) spawntype = RUNTIME_CLASS(AFatShot);
A_FaceTarget (self); A_FaceTarget (self);
@ -262,11 +262,11 @@ void A_Mushroom (AActor *actor)
{ {
int i, j, n = actor->damage; int i, j, n = actor->damage;
const TypeInfo *spawntype = NULL; const PClass *spawntype = NULL;
int index = CheckIndex (1, NULL); int index = CheckIndex (1, NULL);
if (index >= 0) if (index >= 0)
{ {
spawntype = TypeInfo::FindType((const char *)StateParameters[index]); spawntype = PClass::FindClass((const char *)StateParameters[index]);
n = EvalExpressionI (StateParameters[index+1], actor); n = EvalExpressionI (StateParameters[index+1], actor);
if (n == 0) if (n == 0)
n = actor->damage; n = actor->damage;

View file

@ -65,7 +65,7 @@ void A_KeenDie (AActor *self)
// scan the remaining thinkers to see if all Keens are dead // scan the remaining thinkers to see if all Keens are dead
AActor *other; AActor *other;
TThinkerIterator<AActor> iterator; TThinkerIterator<AActor> iterator;
const TypeInfo *matchClass = self->GetClass (); const PClass *matchClass = self->GetClass ();
while ( (other = iterator.Next ()) ) while ( (other = iterator.Next ()) )
{ {

View file

@ -110,12 +110,12 @@ void A_PainShootSkull (AActor *self, angle_t angle)
angle_t an; angle_t an;
int prestep; int prestep;
const TypeInfo *spawntype = NULL; const PClass *spawntype = NULL;
int index=CheckIndex(1, NULL); int index=CheckIndex(1, NULL);
if (index>=0) if (index>=0)
{ {
spawntype = TypeInfo::FindType((const char *)StateParameters[index]); spawntype = PClass::FindClass((const char *)StateParameters[index]);
} }
if (spawntype == NULL) spawntype = RUNTIME_CLASS(ALostSoul); if (spawntype == NULL) spawntype = RUNTIME_CLASS(ALostSoul);

View file

@ -497,7 +497,7 @@ void A_M_BerserkPunch (AActor *self)
// //
//============================================================================ //============================================================================
void P_GunShot2 (AActor *mo, bool accurate, int pitch, const TypeInfo *pufftype) void P_GunShot2 (AActor *mo, bool accurate, int pitch, const PClass *pufftype)
{ {
angle_t angle; angle_t angle;
int damage; int damage;
@ -964,7 +964,7 @@ void AScriptedMarine::SetWeapon (EMarineWeapon type)
} }
} }
void AScriptedMarine::SetSprite (const TypeInfo *source) void AScriptedMarine::SetSprite (const PClass *source)
{ {
if (source == NULL || source->ActorInfo == NULL) if (source == NULL || source->ActorInfo == NULL)
{ // A valid actor class wasn't passed, so use the standard sprite { // A valid actor class wasn't passed, so use the standard sprite

View file

@ -332,7 +332,7 @@ private:
{ {
for (j = 0; j < MAX_WEAPONS_PER_SLOT; j++) for (j = 0; j < MAX_WEAPONS_PER_SLOT; j++)
{ {
const TypeInfo *weap = LocalWeapons.Slots[i+2].GetWeapon (j); const PClass *weap = LocalWeapons.Slots[i+2].GetWeapon (j);
if (weap != NULL && CPlayer->mo->FindInventory (weap) != NULL) if (weap != NULL && CPlayer->mo->FindInventory (weap) != NULL)
{ {
arms[i] = 1; arms[i] = 1;
@ -387,12 +387,12 @@ private:
void DrawAmmoStats () void DrawAmmoStats ()
{ {
static const char *const ammoTypes[4] = static const ENamedName ammoTypes[4] =
{ {
"Clip", NAME_Clip,
"Shell", NAME_Shell,
"RocketAmmo", NAME_RocketAmmo,
"Cell" NAME_Cell
}; };
int ammo[4], maxammo[4]; int ammo[4], maxammo[4];
int i; int i;
@ -400,7 +400,7 @@ private:
// Catalog the player's ammo // Catalog the player's ammo
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
{ {
const TypeInfo *type = TypeInfo::FindType (ammoTypes[i]); const PClass *type = PClass::FindClass (ammoTypes[i]);
AInventory *item = CPlayer->mo->FindInventory (type); AInventory *item = CPlayer->mo->FindInventory (type);
if (item != NULL) if (item != NULL)
{ {

View file

@ -373,7 +373,7 @@ CCMD (use)
{ {
if (argv.argc() > 1 && m_Instigator != NULL) if (argv.argc() > 1 && m_Instigator != NULL)
{ {
SendItemUse = m_Instigator->FindInventory (TypeInfo::IFindType (argv[1])); SendItemUse = m_Instigator->FindInventory (PClass::FindClass (argv[1]));
} }
} }
@ -386,17 +386,17 @@ CCMD (drop)
{ {
if (argv.argc() > 1 && m_Instigator != NULL) if (argv.argc() > 1 && m_Instigator != NULL)
{ {
SendItemDrop = m_Instigator->FindInventory (TypeInfo::IFindType (argv[1])); SendItemDrop = m_Instigator->FindInventory (PClass::FindClass (argv[1]));
} }
} }
CCMD (useflechette) CCMD (useflechette)
{ // Select from one of arti_poisonbag1-3, whichever the player has { // Select from one of arti_poisonbag1-3, whichever the player has
static const char *bagnames[3] = static const ENamedName bagnames[3] =
{ {
"ArtiPoisonBag1", NAME_ArtiPoisonBag1,
"ArtiPoisonBag2", NAME_ArtiPoisonBag2,
"ArtiPoisonBag3" NAME_ArtiPoisonBag3
}; };
int i, j; int i, j;
@ -407,7 +407,7 @@ CCMD (useflechette)
for (j = 0; j < 3; ++j) for (j = 0; j < 3; ++j)
{ {
const TypeInfo *type = TypeInfo::FindType (bagnames[(i+j)%3]); const PClass *type = PClass::FindClass (bagnames[(i+j)%3]);
AInventory *item; AInventory *item;
if (type != NULL && (item = m_Instigator->FindInventory (type))) if (type != NULL && (item = m_Instigator->FindInventory (type)))
{ {
@ -421,7 +421,7 @@ CCMD (select)
{ {
if (argv.argc() > 1) if (argv.argc() > 1)
{ {
AInventory *item = m_Instigator->FindInventory (TypeInfo::FindType (argv[1])); AInventory *item = m_Instigator->FindInventory (PClass::FindClass (argv[1]));
if (item != NULL) if (item != NULL)
{ {
m_Instigator->player->InvSel = item; m_Instigator->player->InvSel = item;
@ -1109,7 +1109,7 @@ void G_PlayerReborn (int player)
userinfo_t userinfo; // [RH] Save userinfo userinfo_t userinfo; // [RH] Save userinfo
botskill_t b_skill;//Added by MC: botskill_t b_skill;//Added by MC:
APlayerPawn *actor; APlayerPawn *actor;
const TypeInfo *cls; const PClass *cls;
char *log; char *log;
p = &players[player]; p = &players[player];

View file

@ -135,10 +135,10 @@ void AHereticPlayer::GiveDefaultInventory ()
AInventory *wand, *ammo; AInventory *wand, *ammo;
player->health = GetDefault()->health; player->health = GetDefault()->health;
player->mo->GiveInventoryType (TypeInfo::FindType ("Staff")); player->mo->GiveInventoryType (PClass::FindClass ("Staff"));
wand = player->mo->GiveInventoryType (TypeInfo::FindType ("GoldWand")); wand = player->mo->GiveInventoryType (PClass::FindClass ("GoldWand"));
// Adding the gold wand automatically adds its ammo // Adding the gold wand automatically adds its ammo
ammo = player->mo->FindInventory (TypeInfo::FindType ("GoldWandAmmo")); ammo = player->mo->FindInventory (PClass::FindClass ("GoldWandAmmo"));
ammo->Amount = 50; ammo->Amount = 50;
player->ReadyWeapon = player->PendingWeapon = static_cast<AWeapon *> (wand); player->ReadyWeapon = player->PendingWeapon = static_cast<AWeapon *> (wand);
} }

View file

@ -1794,7 +1794,7 @@ void A_GauntletAttack (AActor *actor)
int randVal; int randVal;
fixed_t dist; fixed_t dist;
player_t *player; player_t *player;
const TypeInfo *pufftype; const PClass *pufftype;
AInventory *power; AInventory *power;
if (NULL == (player = actor->player)) if (NULL == (player = actor->player))
@ -2056,7 +2056,7 @@ END_DEFAULTS
int ABlasterFX1::DoSpecialDamage (AActor *target, int damage) int ABlasterFX1::DoSpecialDamage (AActor *target, int damage)
{ {
if (target->IsKindOf (TypeInfo::FindType ("Ironlich"))) if (target->IsKindOf (PClass::FindClass ("Ironlich")))
{ // Less damage to Ironlich bosses { // Less damage to Ironlich bosses
damage = pr_bfx1() & 1; damage = pr_bfx1() & 1;
if (!damage) if (!damage)
@ -2133,7 +2133,7 @@ END_DEFAULTS
int ARipper::DoSpecialDamage (AActor *target, int damage) int ARipper::DoSpecialDamage (AActor *target, int damage)
{ {
if (target->IsKindOf (TypeInfo::FindType ("Ironlich"))) if (target->IsKindOf (PClass::FindClass ("Ironlich")))
{ // Less damage to Ironlich bosses { // Less damage to Ironlich bosses
damage = pr_ripd() & 1; damage = pr_ripd() & 1;
if (!damage) if (!damage)

View file

@ -701,7 +701,7 @@ private:
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void FlashItem (const TypeInfo *itemtype) void FlashItem (const PClass *itemtype)
{ {
ArtifactFlash = 4; ArtifactFlash = 4;
} }

View file

@ -297,7 +297,7 @@ void A_CentaurAttack2 (AActor *actor)
void A_CentaurDropStuff (AActor *actor) void A_CentaurDropStuff (AActor *actor)
{ {
const TypeInfo *const DropTypes[] = const PClass *const DropTypes[] =
{ {
RUNTIME_CLASS(ACentaurSword), RUNTIME_CLASS(ACentaurSword),
RUNTIME_CLASS(ACentaurShield) RUNTIME_CLASS(ACentaurShield)

View file

@ -892,7 +892,7 @@ void AClericWeaponPiece::BeginPlay ()
void A_DropWraithvergePieces (AActor *actor) void A_DropWraithvergePieces (AActor *actor)
{ {
static const TypeInfo *pieces[3] = static const PClass *pieces[3] =
{ {
RUNTIME_CLASS(ACWeaponPiece1), RUNTIME_CLASS(ACWeaponPiece1),
RUNTIME_CLASS(ACWeaponPiece2), RUNTIME_CLASS(ACWeaponPiece2),

View file

@ -125,7 +125,7 @@ void AClericPlayer::GiveDefaultInventory ()
{ {
player->health = GetDefault()->health; player->health = GetDefault()->health;
player->ReadyWeapon = player->PendingWeapon = static_cast<AWeapon *> player->ReadyWeapon = player->PendingWeapon = static_cast<AWeapon *>
(GiveInventoryType (TypeInfo::FindType ("CWeapMace"))); (GiveInventoryType (PClass::FindClass ("CWeapMace")));
GiveInventoryType (RUNTIME_CLASS(AHexenArmor)); GiveInventoryType (RUNTIME_CLASS(AHexenArmor));
AHexenArmor *armor = FindInventory<AHexenArmor>(); AHexenArmor *armor = FindInventory<AHexenArmor>();

View file

@ -19,7 +19,7 @@ void A_DemonAttack2_2 (AActor *);
void A_DemonDeath (AActor *); void A_DemonDeath (AActor *);
void A_Demon2Death (AActor *); void A_Demon2Death (AActor *);
static void TossChunks (AActor *, const TypeInfo *const chunks[]); static void TossChunks (AActor *, const PClass *const chunks[]);
// Demon, type 1 (green, like D'Sparil's) ----------------------------------- // Demon, type 1 (green, like D'Sparil's) -----------------------------------
@ -605,7 +605,7 @@ void A_DemonAttack2_2 (AActor *actor)
void A_DemonDeath (AActor *actor) void A_DemonDeath (AActor *actor)
{ {
const TypeInfo *const ChunkTypes[] = const PClass *const ChunkTypes[] =
{ {
RUNTIME_CLASS(ADemon1Chunk5), RUNTIME_CLASS(ADemon1Chunk5),
RUNTIME_CLASS(ADemon1Chunk4), RUNTIME_CLASS(ADemon1Chunk4),
@ -625,7 +625,7 @@ void A_DemonDeath (AActor *actor)
void A_Demon2Death (AActor *actor) void A_Demon2Death (AActor *actor)
{ {
const TypeInfo *const ChunkTypes[] = const PClass *const ChunkTypes[] =
{ {
RUNTIME_CLASS(ADemon2Chunk5), RUNTIME_CLASS(ADemon2Chunk5),
RUNTIME_CLASS(ADemon2Chunk4), RUNTIME_CLASS(ADemon2Chunk4),
@ -637,7 +637,7 @@ void A_Demon2Death (AActor *actor)
TossChunks (actor, ChunkTypes); TossChunks (actor, ChunkTypes);
} }
static void TossChunks (AActor *actor, const TypeInfo *const chunks[]) static void TossChunks (AActor *actor, const PClass *const chunks[])
{ {
AActor *mo; AActor *mo;
angle_t angle; angle_t angle;

View file

@ -361,7 +361,7 @@ void A_FAxeAttack (AActor *actor)
int useMana; int useMana;
player_t *player; player_t *player;
AWeapon *weapon; AWeapon *weapon;
const TypeInfo *pufftype; const PClass *pufftype;
if (NULL == (player = actor->player)) if (NULL == (player = actor->player))
{ {

View file

@ -123,7 +123,7 @@ void AFighterPlayer::GiveDefaultInventory ()
{ {
player->health = GetDefault()->health; player->health = GetDefault()->health;
player->ReadyWeapon = player->PendingWeapon = static_cast<AWeapon *> player->ReadyWeapon = player->PendingWeapon = static_cast<AWeapon *>
(GiveInventoryType (TypeInfo::FindType ("FWeapFist"))); (GiveInventoryType (PClass::FindClass ("FWeapFist")));
GiveInventoryType (RUNTIME_CLASS(AHexenArmor)); GiveInventoryType (RUNTIME_CLASS(AHexenArmor));
AHexenArmor *armor = FindInventory<AHexenArmor>(); AHexenArmor *armor = FindInventory<AHexenArmor>();
@ -269,7 +269,7 @@ void A_FPunchAttack (AActor *actor)
fixed_t power; fixed_t power;
int i; int i;
player_t *player; player_t *player;
const TypeInfo *pufftype; const PClass *pufftype;
if (NULL == (player = actor->player)) if (NULL == (player = actor->player))
{ {

View file

@ -367,7 +367,7 @@ void A_FSwordFlames (AActor *actor)
void A_DropQuietusPieces (AActor *actor) void A_DropQuietusPieces (AActor *actor)
{ {
static const TypeInfo *pieces[3] = static const PClass *pieces[3] =
{ {
RUNTIME_CLASS(AFWeaponPiece1), RUNTIME_CLASS(AFWeaponPiece1),
RUNTIME_CLASS(AFWeaponPiece2), RUNTIME_CLASS(AFWeaponPiece2),

View file

@ -348,7 +348,7 @@ void A_FiredSpawnRock (AActor *actor)
{ {
AActor *mo; AActor *mo;
int x,y,z; int x,y,z;
const TypeInfo *rtype; const PClass *rtype;
switch (pr_firedemonrock() % 5) switch (pr_firedemonrock() % 5)
{ {

View file

@ -325,7 +325,7 @@ AInventory *AArtiPoisonBag::CreateCopy (AActor *other)
} }
AInventory *copy; AInventory *copy;
const TypeInfo *spawntype; const PClass *spawntype;
if (other->IsKindOf (RUNTIME_CLASS(AClericPlayer))) if (other->IsKindOf (RUNTIME_CLASS(AClericPlayer)))
{ {

View file

@ -151,7 +151,7 @@ END_DEFAULTS
void A_FogSpawn (AActor *actor) void A_FogSpawn (AActor *actor)
{ {
static const TypeInfo *fogs[3] = static const PClass *fogs[3] =
{ {
RUNTIME_CLASS(AFogPatchSmall), RUNTIME_CLASS(AFogPatchSmall),
RUNTIME_CLASS(AFogPatchMedium), RUNTIME_CLASS(AFogPatchMedium),

View file

@ -710,7 +710,7 @@ void A_SorcBallOrbit(AActor *ball)
if (!ball->IsKindOf (RUNTIME_CLASS(ASorcBall))) if (!ball->IsKindOf (RUNTIME_CLASS(ASorcBall)))
{ {
I_Error ("Corrupted sorcerer:\nTried to use a %s", RUNTIME_TYPE(ball)->Name+1); I_Error ("Corrupted sorcerer:\nTried to use a %s", RUNTIME_TYPE(ball)->TypeName.GetChars());
} }
actor = static_cast<ASorcBall *> (ball); actor = static_cast<ASorcBall *> (ball);

View file

@ -30,7 +30,7 @@ class AHeresiarch : public AActor
{ {
DECLARE_ACTOR (AHeresiarch, AActor) DECLARE_ACTOR (AHeresiarch, AActor)
public: public:
const TypeInfo *StopBall; const PClass *StopBall;
void Serialize (FArchive &arc); void Serialize (FArchive &arc);
void Die (AActor *source, AActor *inflictor); void Die (AActor *source, AActor *inflictor);
@ -72,7 +72,7 @@ public:
protected: protected:
virtual bool MatchPlayerClass (AActor *toucher); virtual bool MatchPlayerClass (AActor *toucher);
virtual const char *PieceMessage (); virtual const char *PieceMessage ();
const TypeInfo *FourthWeaponClass; const PClass *FourthWeaponClass;
int PieceValue; int PieceValue;
AInventory *TempFourthWeapon; AInventory *TempFourthWeapon;
bool PrivateShouldStay (); bool PrivateShouldStay ();

View file

@ -263,7 +263,7 @@ END_DEFAULTS
// Wisp types, for randomness below ----------------------------------------- // Wisp types, for randomness below -----------------------------------------
static const TypeInfo *const WispTypes[2] = static const PClass *const WispTypes[2] =
{ {
RUNTIME_CLASS(AIceGuyWisp1), RUNTIME_CLASS(AIceGuyWisp1),
RUNTIME_CLASS(AIceGuyWisp2) RUNTIME_CLASS(AIceGuyWisp2)

View file

@ -71,10 +71,10 @@ void A_KSpiritRoam (AActor *);
void A_KBolt (AActor *); void A_KBolt (AActor *);
void A_KBoltRaise (AActor *); void A_KBoltRaise (AActor *);
void KoraxFire (AActor *actor, const TypeInfo *type, int arm); void KoraxFire (AActor *actor, const PClass *type, int arm);
void KSpiritInit (AActor *spirit, AActor *korax); void KSpiritInit (AActor *spirit, AActor *korax);
AActor *P_SpawnKoraxMissile (fixed_t x, fixed_t y, fixed_t z, AActor *P_SpawnKoraxMissile (fixed_t x, fixed_t y, fixed_t z,
AActor *source, AActor *dest, const TypeInfo *type); AActor *source, AActor *dest, const PClass *type);
extern void SpawnSpiritTail (AActor *spirit); extern void SpawnSpiritTail (AActor *spirit);
@ -395,11 +395,11 @@ void A_KoraxMissile (AActor *actor)
int type = pr_koraxmissile()%6; int type = pr_koraxmissile()%6;
int i; int i;
const TypeInfo *info; const PClass *info;
S_Sound (actor, CHAN_VOICE, "KoraxAttack", 1, ATTN_NORM); S_Sound (actor, CHAN_VOICE, "KoraxAttack", 1, ATTN_NORM);
info = TypeInfo::FindType (choices[type].type); info = PClass::FindClass (choices[type].type);
if (info == NULL) if (info == NULL)
{ {
I_Error ("Unknown Korax missile: %s\n", choices[type].type); I_Error ("Unknown Korax missile: %s\n", choices[type].type);
@ -464,7 +464,7 @@ void A_KoraxCommand (AActor *actor)
// //
//============================================================================ //============================================================================
void KoraxFire (AActor *actor, const TypeInfo *type, int arm) void KoraxFire (AActor *actor, const PClass *type, int arm)
{ {
static const int extension[6] = static const int extension[6] =
{ {
@ -675,7 +675,7 @@ void A_KBoltRaise (AActor *actor)
//============================================================================ //============================================================================
AActor *P_SpawnKoraxMissile (fixed_t x, fixed_t y, fixed_t z, AActor *P_SpawnKoraxMissile (fixed_t x, fixed_t y, fixed_t z,
AActor *source, AActor *dest, const TypeInfo *type) AActor *source, AActor *dest, const PClass *type)
{ {
AActor *th; AActor *th;
angle_t an; angle_t an;

View file

@ -122,7 +122,7 @@ void AMagePlayer::GiveDefaultInventory ()
{ {
player->health = GetDefault()->health; player->health = GetDefault()->health;
player->ReadyWeapon = player->PendingWeapon = static_cast<AWeapon *> player->ReadyWeapon = player->PendingWeapon = static_cast<AWeapon *>
(GiveInventoryType (TypeInfo::FindType ("MWeapWand"))); (GiveInventoryType (PClass::FindClass ("MWeapWand")));
GiveInventoryType (RUNTIME_CLASS(AHexenArmor)); GiveInventoryType (RUNTIME_CLASS(AHexenArmor));
AHexenArmor *armor = FindInventory<AHexenArmor>(); AHexenArmor *armor = FindInventory<AHexenArmor>();

View file

@ -486,7 +486,7 @@ void A_MStaffTrack (AActor *actor)
void A_DropBloodscourgePieces (AActor *actor) void A_DropBloodscourgePieces (AActor *actor)
{ {
static const TypeInfo *pieces[3] = static const PClass *pieces[3] =
{ {
RUNTIME_CLASS(AMWeaponPiece1), RUNTIME_CLASS(AMWeaponPiece1),
RUNTIME_CLASS(AMWeaponPiece2), RUNTIME_CLASS(AMWeaponPiece2),

View file

@ -100,7 +100,7 @@ protected:
{ {
return GStrings("TXT_MANA_BOTH"); return GStrings("TXT_MANA_BOTH");
} }
bool GiveMana (AActor *other, const TypeInfo *type) bool GiveMana (AActor *other, const PClass *type)
{ {
AInventory *mana = other->FindInventory (type); AInventory *mana = other->FindInventory (type);
if (mana == NULL) if (mana == NULL)
@ -164,7 +164,7 @@ public:
bool Use (bool pickup); bool Use (bool pickup);
const char *PickupMessage (); const char *PickupMessage ();
protected: protected:
bool FillMana (const TypeInfo *type); bool FillMana (const PClass *type);
}; };
FState AArtiBoostMana::States[] = FState AArtiBoostMana::States[] =
@ -191,7 +191,7 @@ bool AArtiBoostMana::Use (bool pickup)
return success; return success;
} }
bool AArtiBoostMana::FillMana (const TypeInfo *type) bool AArtiBoostMana::FillMana (const PClass *type)
{ {
AInventory *mana = Owner->FindInventory (type); AInventory *mana = Owner->FindInventory (type);
if (mana == NULL) if (mana == NULL)

View file

@ -619,7 +619,7 @@ void A_SerpentHeadPop (AActor *actor)
void A_SerpentSpawnGibs (AActor *actor) void A_SerpentSpawnGibs (AActor *actor)
{ {
AActor *mo; AActor *mo;
static const TypeInfo *const GibTypes[] = static const PClass *const GibTypes[] =
{ {
RUNTIME_CLASS(ASerpentGib3), RUNTIME_CLASS(ASerpentGib3),
RUNTIME_CLASS(ASerpentGib2), RUNTIME_CLASS(ASerpentGib2),

View file

@ -165,7 +165,7 @@ IMPLEMENT_STATELESS_ACTOR (ATelOtherFX5, Any, -1, 0)
PROP_SpawnState (S_TELO_FX5) PROP_SpawnState (S_TELO_FX5)
END_DEFAULTS END_DEFAULTS
static void TeloSpawn (AActor *source, const TypeInfo *type) static void TeloSpawn (AActor *source, const PClass *type)
{ {
AActor *fx; AActor *fx;

View file

@ -25,7 +25,7 @@ public:
void Unload (); void Unload ();
bool CheckModified (); bool CheckModified ();
void SetVial (FTexture *pic, AActor *actor, const TypeInfo *manaType); void SetVial (FTexture *pic, AActor *actor, const PClass *manaType);
protected: protected:
BYTE Pixels[5*24]; BYTE Pixels[5*24];
@ -89,7 +89,7 @@ const BYTE *FManaBar::GetPixels ()
return Pixels; return Pixels;
} }
void FManaBar::SetVial (FTexture *pic, AActor *actor, const TypeInfo *manaType) void FManaBar::SetVial (FTexture *pic, AActor *actor, const PClass *manaType)
{ {
int level; int level;
AInventory *ammo; AInventory *ammo;
@ -1035,7 +1035,7 @@ private:
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void FlashItem (const TypeInfo *itemtype) void FlashItem (const PClass *itemtype)
{ {
ArtifactFlash = 4; ArtifactFlash = 4;
} }

View file

@ -772,7 +772,7 @@ static void ParseMapInfoLower (MapInfoHandler *handlers,
case MITYPE_REDIRECT: case MITYPE_REDIRECT:
SC_MustGetString (); SC_MustGetString ();
levelinfo->RedirectType = TypeInfo::IFindType (sc_String); levelinfo->RedirectType = PClass::FindClass (sc_String);
if (levelinfo->RedirectType == NULL || if (levelinfo->RedirectType == NULL ||
!(levelinfo->RedirectType->IsDescendantOf (RUNTIME_CLASS(AInventory)))) !(levelinfo->RedirectType->IsDescendantOf (RUNTIME_CLASS(AInventory))))
{ {

View file

@ -148,7 +148,7 @@ struct level_info_s
// Redirection: If any player is carrying the specified item, then // Redirection: If any player is carrying the specified item, then
// you go to the RedirectMap instead of this one. // you go to the RedirectMap instead of this one.
const TypeInfo *RedirectType; const PClass *RedirectType;
char RedirectMap[9]; char RedirectMap[9];
char enterpic[9]; char enterpic[9];

View file

@ -21,7 +21,7 @@ static FRandom pr_morphmonst ("MorphMonster");
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
bool P_MorphPlayer (player_t *p, const TypeInfo *spawntype) bool P_MorphPlayer (player_t *p, const PClass *spawntype)
{ {
AInventory *item; AInventory *item;
APlayerPawn *morphed; APlayerPawn *morphed;
@ -193,7 +193,7 @@ bool P_UndoPlayerMorph (player_t *player, bool force)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
bool P_MorphMonster (AActor *actor, const TypeInfo *spawntype) bool P_MorphMonster (AActor *actor, const PClass *spawntype)
{ {
AActor *morphed; AActor *morphed;
@ -329,11 +329,11 @@ int AEggFX::DoSpecialDamage (AActor *target, int damage)
{ {
if (target->player) if (target->player)
{ {
P_MorphPlayer (target->player, TypeInfo::FindType ("ChickenPlayer")); P_MorphPlayer (target->player, PClass::FindClass (NAME_ChickenPlayer));
} }
else else
{ {
P_MorphMonster (target, TypeInfo::FindType ("Chicken")); P_MorphMonster (target, PClass::FindClass (NAME_Chicken));
} }
return -1; return -1;
} }
@ -422,11 +422,11 @@ int APorkFX::DoSpecialDamage (AActor *target, int damage)
{ {
if (target->player) if (target->player)
{ {
P_MorphPlayer (target->player, TypeInfo::FindType ("PigPlayer")); P_MorphPlayer (target->player, PClass::FindClass (NAME_PigPlayer));
} }
else else
{ {
P_MorphMonster (target, TypeInfo::FindType ("Pig")); P_MorphMonster (target, PClass::FindClass (NAME_Pig));
} }
return -1; return -1;
} }

View file

@ -588,15 +588,15 @@ void A_MinotaurCharge (AActor *actor)
if (actor->special1 > 0) if (actor->special1 > 0)
{ {
const TypeInfo *type; const PClass *type;
if (gameinfo.gametype == GAME_Heretic) if (gameinfo.gametype == GAME_Heretic)
{ {
type = TypeInfo::FindType ("PhoenixPuff"); type = PClass::FindClass ("PhoenixPuff");
} }
else else
{ {
type = TypeInfo::FindType ("PunchPuff"); type = PClass::FindClass ("PunchPuff");
} }
puff = Spawn (type, actor->x, actor->y, actor->z); puff = Spawn (type, actor->x, actor->y, actor->z);
puff->momz = 2*FRACUNIT; puff->momz = 2*FRACUNIT;

View file

@ -7,7 +7,7 @@ class player_s;
bool P_MorphPlayer (player_s *player); bool P_MorphPlayer (player_s *player);
bool P_UndoPlayerMorph (player_s *player, bool force); bool P_UndoPlayerMorph (player_s *player, bool force);
bool P_MorphMonster (AActor *actor, const TypeInfo *morphClass); bool P_MorphMonster (AActor *actor, const PClass *morphClass);
bool P_UpdateMorphedMonster (AActor *actor, int tics); bool P_UpdateMorphedMonster (AActor *actor, int tics);
class AMinotaur : public AActor class AMinotaur : public AActor

View file

@ -50,7 +50,7 @@ public:
virtual bool Use (bool pickup); virtual bool Use (bool pickup);
virtual void Serialize (FArchive &arc); virtual void Serialize (FArchive &arc);
const TypeInfo *PowerupType; const PClass *PowerupType;
int EffectTics; // Non-0 to override the powerup's default tics int EffectTics; // Non-0 to override the powerup's default tics
PalEntry BlendColor; // Non-0 to override the powerup's default blend PalEntry BlendColor; // Non-0 to override the powerup's default blend
}; };

View file

@ -31,7 +31,7 @@ IMPLEMENT_ABSTRACT_ACTOR(AGlassShard)
void P_SpawnDirt (AActor *actor, fixed_t radius) void P_SpawnDirt (AActor *actor, fixed_t radius)
{ {
fixed_t x,y,z; fixed_t x,y,z;
const TypeInfo *dtype = NULL; const PClass *dtype = NULL;
AActor *mo; AActor *mo;
angle_t angle; angle_t angle;
@ -42,7 +42,7 @@ void P_SpawnDirt (AActor *actor, fixed_t radius)
char fmt[8]; char fmt[8];
sprintf(fmt, "Dirt%d", 1 + pr_dirt()%6); sprintf(fmt, "Dirt%d", 1 + pr_dirt()%6);
dtype = TypeInfo::FindType(fmt); dtype = PClass::FindClass(fmt);
if (dtype) if (dtype)
{ {
mo = Spawn (dtype, x, y, z); mo = Spawn (dtype, x, y, z);

View file

@ -13,7 +13,7 @@
struct OneKey struct OneKey
{ {
const TypeInfo * key; const PClass * key;
int count; int count;
bool check(AActor * owner) bool check(AActor * owner)
@ -109,7 +109,7 @@ static const char * keywords_lock[]={
// //
//=========================================================================== //===========================================================================
static void AddOneKey(Keygroup * keygroup, const TypeInfo * mi) static void AddOneKey(Keygroup * keygroup, const PClass * mi)
{ {
if (mi) if (mi)
{ {
@ -149,14 +149,14 @@ static void AddOneKey(Keygroup * keygroup, const TypeInfo * mi)
static Keygroup * ParseKeygroup() static Keygroup * ParseKeygroup()
{ {
Keygroup * keygroup; Keygroup * keygroup;
const TypeInfo * mi; const PClass * mi;
SC_MustGetStringName("{"); SC_MustGetStringName("{");
keygroup=new Keygroup; keygroup=new Keygroup;
while (!SC_CheckString("}")) while (!SC_CheckString("}"))
{ {
SC_MustGetString(); SC_MustGetString();
mi=TypeInfo::FindType(sc_String); mi=PClass::FindClass(sc_String);
AddOneKey(keygroup, mi); AddOneKey(keygroup, mi);
} }
if (keygroup->anykeylist.Size()==0) if (keygroup->anykeylist.Size()==0)
@ -213,7 +213,7 @@ static void ParseLock()
Lock sink; Lock sink;
Lock * lock=&sink; Lock * lock=&sink;
Keygroup * keygroup; Keygroup * keygroup;
const TypeInfo * mi; const PClass * mi;
SC_MustGetNumber(); SC_MustGetNumber();
keynum=sc_Number; keynum=sc_Number;
@ -288,7 +288,7 @@ static void ParseLock()
break; break;
default: default:
mi=TypeInfo::FindType(sc_String); mi=PClass::FindClass(sc_String);
if (mi) if (mi)
{ {
keygroup=new Keygroup; keygroup=new Keygroup;
@ -318,12 +318,11 @@ static void ParseLock()
static void ClearLocks() static void ClearLocks()
{ {
int i; int i;
for(i=0;i<TypeInfo::m_Types.Size();i++) for(i=0;i<PClass::m_Types.Size();i++)
{ {
if (TypeInfo::m_Types[i]->IsDescendantOf(RUNTIME_CLASS(AKey))) if (PClass::m_Types[i]->IsDescendantOf(RUNTIME_CLASS(AKey)))
{ {
if (TypeInfo::m_Types[i]->ActorInfo != NULL) static_cast<AKey*>(GetDefaultByType(PClass::m_Types[i]))->KeyNumber=0;
static_cast<AKey*>(GetDefaultByType(TypeInfo::m_Types[i]))->KeyNumber=0;
} }
} }
for(i=0;i<256;i++) for(i=0;i<256;i++)

View file

@ -49,13 +49,13 @@ void AAmmo::Serialize (FArchive &arc)
// //
//=========================================================================== //===========================================================================
const TypeInfo *AAmmo::GetParentAmmo () const const PClass *AAmmo::GetParentAmmo () const
{ {
const TypeInfo *type = GetClass (); const PClass *type = GetClass ();
while (type->ParentType != RUNTIME_CLASS(AAmmo)) while (type->ParentClass != RUNTIME_CLASS(AAmmo))
{ {
type = type->ParentType; type = type->ParentClass;
} }
return type; return type;
} }
@ -140,9 +140,9 @@ AInventory *AAmmo::CreateCopy (AActor *other)
amount += amount >> 1; amount += amount >> 1;
} }
if (GetClass()->ParentType != RUNTIME_CLASS(AAmmo)) if (GetClass()->ParentClass != RUNTIME_CLASS(AAmmo))
{ {
const TypeInfo *type = GetParentAmmo(); const PClass *type = GetParentAmmo();
if (!GoAway ()) if (!GoAway ())
{ {
Destroy (); Destroy ();
@ -1208,7 +1208,9 @@ CCMD (printinv)
} }
for (item = players[consoleplayer].mo->Inventory; item != NULL; item = item->Inventory) for (item = players[consoleplayer].mo->Inventory; item != NULL; item = item->Inventory)
{ {
Printf ("%s #%lu (%d/%d)\n", item->GetClass()->Name+1, item->InventoryID, item->Amount, item->MaxAmount); Printf ("%s #%lu (%d/%d)\n", item->GetClass()->TypeName.GetChars(),
item->InventoryID,
item->Amount, item->MaxAmount);
} }
} }
@ -1912,11 +1914,11 @@ AInventory *ABackpack::CreateCopy (AActor *other)
{ {
// Find every unique type of ammo. Give it to the player if // Find every unique type of ammo. Give it to the player if
// he doesn't have it already, and double it's maximum capacity. // he doesn't have it already, and double it's maximum capacity.
for (unsigned int i = 0; i < TypeInfo::m_Types.Size(); ++i) for (unsigned int i = 0; i < PClass::m_Types.Size(); ++i)
{ {
const TypeInfo *type = TypeInfo::m_Types[i]; const PClass *type = PClass::m_Types[i];
if (type->ParentType == RUNTIME_CLASS(AAmmo) && if (type->ParentClass == RUNTIME_CLASS(AAmmo) &&
((AAmmo *)GetDefaultByType (type))->BackpackAmount > 0) ((AAmmo *)GetDefaultByType (type))->BackpackAmount > 0)
{ {
AAmmo *ammo = static_cast<AAmmo *>(other->FindInventory (type)); AAmmo *ammo = static_cast<AAmmo *>(other->FindInventory (type));
@ -1959,13 +1961,13 @@ bool ABackpack::HandlePickup (AInventory *item)
{ {
// Since you already have a backpack, that means you already have every // Since you already have a backpack, that means you already have every
// kind of ammo in your inventory, so we don't need to look at the // kind of ammo in your inventory, so we don't need to look at the
// entire TypeInfo list to discover what kinds of ammo exist, and we don't // entire PClass list to discover what kinds of ammo exist, and we don't
// have to alter the MaxAmount either. // have to alter the MaxAmount either.
if (item->IsKindOf (RUNTIME_CLASS(ABackpack))) if (item->IsKindOf (RUNTIME_CLASS(ABackpack)))
{ {
for (AInventory *probe = Owner->Inventory; probe != NULL; probe = probe->Inventory) for (AInventory *probe = Owner->Inventory; probe != NULL; probe = probe->Inventory)
{ {
if (probe->GetClass()->ParentType == RUNTIME_CLASS(AAmmo)) if (probe->GetClass()->ParentClass == RUNTIME_CLASS(AAmmo))
{ {
if (probe->Amount < probe->MaxAmount) if (probe->Amount < probe->MaxAmount)
{ {
@ -2020,7 +2022,7 @@ void ABackpack::DetachFromOwner ()
for (item = Owner->Inventory; item != NULL; item = item->Inventory) for (item = Owner->Inventory; item != NULL; item = item->Inventory)
{ {
if (item->GetClass()->ParentType == RUNTIME_CLASS(AAmmo) && if (item->GetClass()->ParentClass == RUNTIME_CLASS(AAmmo) &&
item->MaxAmount == static_cast<AAmmo*>(item)->BackpackMaxAmount) item->MaxAmount == static_cast<AAmmo*>(item)->BackpackMaxAmount)
{ {
item->MaxAmount = static_cast<AInventory*>(item->GetDefault())->MaxAmount; item->MaxAmount = static_cast<AInventory*>(item->GetDefault())->MaxAmount;

View file

@ -20,11 +20,11 @@ public:
FWeaponSlot (); FWeaponSlot ();
void Clear (); void Clear ();
bool AddWeapon (const char *type); bool AddWeapon (const char *type);
bool AddWeapon (const TypeInfo *type); bool AddWeapon (const PClass *type);
AWeapon *PickWeapon (player_s *player); AWeapon *PickWeapon (player_s *player);
int CountWeapons (); int CountWeapons ();
inline const TypeInfo *GetWeapon (int index) const inline const PClass *GetWeapon (int index) const
{ {
return Weapons[index]; return Weapons[index];
} }
@ -35,7 +35,7 @@ public:
friend struct FWeaponSlots; friend struct FWeaponSlots;
private: private:
const TypeInfo *Weapons[MAX_WEAPONS_PER_SLOT]; const PClass *Weapons[MAX_WEAPONS_PER_SLOT];
}; };
// FWeaponSlots::AddDefaultWeapon return codes // FWeaponSlots::AddDefaultWeapon return codes
@ -51,8 +51,8 @@ struct FWeaponSlots
FWeaponSlot Slots[NUM_WEAPON_SLOTS]; FWeaponSlot Slots[NUM_WEAPON_SLOTS];
void Clear (); void Clear ();
bool LocateWeapon (const TypeInfo *type, int *const slot, int *const index); bool LocateWeapon (const PClass *type, int *const slot, int *const index);
ESlotDef AddDefaultWeapon (int slot, const TypeInfo *type); ESlotDef AddDefaultWeapon (int slot, const PClass *type);
int RestoreSlots (FConfigFile &config); int RestoreSlots (FConfigFile &config);
void SaveSlots (FConfigFile &config); void SaveSlots (FConfigFile &config);
}; };
@ -178,7 +178,7 @@ public:
void Serialize (FArchive &arc); void Serialize (FArchive &arc);
AInventory *CreateCopy (AActor *other); AInventory *CreateCopy (AActor *other);
bool HandlePickup (AInventory *item); bool HandlePickup (AInventory *item);
const TypeInfo *GetParentAmmo () const; const PClass *GetParentAmmo () const;
int BackpackAmount, BackpackMaxAmount; int BackpackAmount, BackpackMaxAmount;
}; };
@ -190,16 +190,16 @@ class AWeapon : public AInventory
HAS_OBJECT_POINTERS HAS_OBJECT_POINTERS
public: public:
DWORD WeaponFlags; DWORD WeaponFlags;
const TypeInfo *AmmoType1, *AmmoType2; // Types of ammo used by this weapon const PClass *AmmoType1, *AmmoType2; // Types of ammo used by this weapon
int AmmoGive1, AmmoGive2; // Amount of each ammo to get when picking up weapon int AmmoGive1, AmmoGive2; // Amount of each ammo to get when picking up weapon
int MinAmmo1, MinAmmo2; // Minimum ammo needed to switch to this weapon int MinAmmo1, MinAmmo2; // Minimum ammo needed to switch to this weapon
int AmmoUse1, AmmoUse2; // How much ammo to use with each shot int AmmoUse1, AmmoUse2; // How much ammo to use with each shot
int Kickback; int Kickback;
fixed_t YAdjust; // For viewing the weapon fullscreen fixed_t YAdjust; // For viewing the weapon fullscreen
WORD UpSound, ReadySound; // Sounds when coming up and idle WORD UpSound, ReadySound; // Sounds when coming up and idle
const TypeInfo *SisterWeaponType; // Another weapon to pick up with this one const PClass *SisterWeaponType; // Another weapon to pick up with this one
const TypeInfo *ProjectileType; // Projectile used by primary attack const PClass *ProjectileType; // Projectile used by primary attack
const TypeInfo *AltProjectileType; // Projectile used by alternate attack const PClass *AltProjectileType; // Projectile used by alternate attack
int SelectionOrder; // Lower-numbered weapons get picked first int SelectionOrder; // Lower-numbered weapons get picked first
fixed_t MoveCombatDist; // Used by bots, but do they *really* need it? fixed_t MoveCombatDist; // Used by bots, but do they *really* need it?
@ -245,9 +245,9 @@ public:
bool DepleteAmmo (bool altFire, bool checkEnough=true); bool DepleteAmmo (bool altFire, bool checkEnough=true);
protected: protected:
static AAmmo *AddAmmo (AActor *other, const TypeInfo *ammotype, int amount); static AAmmo *AddAmmo (AActor *other, const PClass *ammotype, int amount);
static bool AddExistingAmmo (AAmmo *ammo, int amount); static bool AddExistingAmmo (AAmmo *ammo, int amount);
AWeapon *AddWeapon (const TypeInfo *weapon); AWeapon *AddWeapon (const PClass *weapon);
}; };
enum enum

View file

@ -11,7 +11,7 @@ class AWeaponHolder : public AInventory
public: public:
int PieceMask; int PieceMask;
const TypeInfo * PieceWeapon; const PClass * PieceWeapon;
void Serialize (FArchive &arc) void Serialize (FArchive &arc)
{ {

View file

@ -12,6 +12,6 @@ public:
virtual void PlayPickupSound (AActor *toucher); virtual void PlayPickupSound (AActor *toucher);
int PieceValue; int PieceValue;
const TypeInfo * WeaponClass; const PClass * WeaponClass;
AWeapon * FullWeapon; AWeapon * FullWeapon;
}; };

View file

@ -242,7 +242,7 @@ void AWeapon::AttachToOwner (AActor *other)
// //
//=========================================================================== //===========================================================================
AAmmo *AWeapon::AddAmmo (AActor *other, const TypeInfo *ammotype, int amount) AAmmo *AWeapon::AddAmmo (AActor *other, const PClass *ammotype, int amount)
{ {
AAmmo *ammo; AAmmo *ammo;
@ -298,7 +298,7 @@ bool AWeapon::AddExistingAmmo (AAmmo *ammo, int amount)
// //
//=========================================================================== //===========================================================================
AWeapon *AWeapon::AddWeapon (const TypeInfo *weapontype) AWeapon *AWeapon::AddWeapon (const PClass *weapontype)
{ {
AWeapon *weap; AWeapon *weap;
@ -555,10 +555,10 @@ void FWeaponSlot::Clear ()
bool FWeaponSlot::AddWeapon (const char *type) bool FWeaponSlot::AddWeapon (const char *type)
{ {
return AddWeapon (TypeInfo::IFindType (type)); return AddWeapon (PClass::FindClass (type));
} }
bool FWeaponSlot::AddWeapon (const TypeInfo *type) bool FWeaponSlot::AddWeapon (const PClass *type)
{ {
int i; int i;
@ -628,7 +628,7 @@ void FWeaponSlots::Clear ()
// then add it to the specified slot. False is returned if the weapon was // then add it to the specified slot. False is returned if the weapon was
// not in a slot and could not be added. True is returned otherwise. // not in a slot and could not be added. True is returned otherwise.
ESlotDef FWeaponSlots::AddDefaultWeapon (int slot, const TypeInfo *type) ESlotDef FWeaponSlots::AddDefaultWeapon (int slot, const PClass *type)
{ {
int currSlot, index; int currSlot, index;
@ -644,7 +644,7 @@ ESlotDef FWeaponSlots::AddDefaultWeapon (int slot, const TypeInfo *type)
return SLOTDEF_Exists; return SLOTDEF_Exists;
} }
bool FWeaponSlots::LocateWeapon (const TypeInfo *type, int *const slot, int *const index) bool FWeaponSlots::LocateWeapon (const PClass *type, int *const slot, int *const index)
{ {
int i, j; int i, j;
@ -724,7 +724,7 @@ AWeapon *PickNextWeapon (player_s *player)
{ {
int slot = (unsigned)((start + i) / MAX_WEAPONS_PER_SLOT) % NUM_WEAPON_SLOTS; int slot = (unsigned)((start + i) / MAX_WEAPONS_PER_SLOT) % NUM_WEAPON_SLOTS;
int index = (unsigned)(start + i) % MAX_WEAPONS_PER_SLOT; int index = (unsigned)(start + i) % MAX_WEAPONS_PER_SLOT;
const TypeInfo *type = LocalWeapons.Slots[slot].Weapons[index]; const PClass *type = LocalWeapons.Slots[slot].Weapons[index];
AWeapon *weap = static_cast<AWeapon *> (player->mo->FindInventory (type)); AWeapon *weap = static_cast<AWeapon *> (player->mo->FindInventory (type));
if (weap != NULL && weap->CheckAmmo (AWeapon::EitherFire, false)) if (weap != NULL && weap->CheckAmmo (AWeapon::EitherFire, false))
@ -759,7 +759,7 @@ AWeapon *PickPrevWeapon (player_s *player)
slot += NUM_WEAPON_SLOTS * MAX_WEAPONS_PER_SLOT; slot += NUM_WEAPON_SLOTS * MAX_WEAPONS_PER_SLOT;
int index = slot % MAX_WEAPONS_PER_SLOT; int index = slot % MAX_WEAPONS_PER_SLOT;
slot /= MAX_WEAPONS_PER_SLOT; slot /= MAX_WEAPONS_PER_SLOT;
const TypeInfo *type = LocalWeapons.Slots[slot].Weapons[index]; const PClass *type = LocalWeapons.Slots[slot].Weapons[index];
AWeapon *weap = static_cast<AWeapon *> (player->mo->FindInventory (type)); AWeapon *weap = static_cast<AWeapon *> (player->mo->FindInventory (type));
if (weap != NULL && weap->CheckAmmo (AWeapon::EitherFire, false)) if (weap != NULL && weap->CheckAmmo (AWeapon::EitherFire, false))
@ -791,7 +791,7 @@ CCMD (setslot)
i < MAX_WEAPONS_PER_SLOT && LocalWeapons.Slots[slot].GetWeapon(i) != NULL; i < MAX_WEAPONS_PER_SLOT && LocalWeapons.Slots[slot].GetWeapon(i) != NULL;
++i) ++i)
{ {
Printf (" %s", LocalWeapons.Slots[slot].GetWeapon(i)->Name+1); Printf (" %s", LocalWeapons.Slots[slot].GetWeapon(i)->TypeName.GetChars());
} }
Printf ("\n"); Printf ("\n");
} }
@ -881,7 +881,7 @@ CCMD (weaponsection)
CCMD (addslotdefault) CCMD (addslotdefault)
{ {
const TypeInfo *type; const PClass *type;
unsigned int slot; unsigned int slot;
if (argv.argc() != 3 || (slot = atoi (argv[1])) >= NUM_WEAPON_SLOTS) if (argv.argc() != 3 || (slot = atoi (argv[1])) >= NUM_WEAPON_SLOTS)
@ -896,7 +896,7 @@ CCMD (addslotdefault)
return; return;
} }
type = TypeInfo::IFindType (argv[2]); type = PClass::FindClass (argv[2]);
if (type == NULL || !type->IsDescendantOf (RUNTIME_CLASS(AWeapon))) if (type == NULL || !type->IsDescendantOf (RUNTIME_CLASS(AWeapon)))
{ {
Printf ("%s is not a weapon\n", argv[2]); Printf ("%s is not a weapon\n", argv[2]);
@ -975,7 +975,7 @@ void FWeaponSlots::SaveSlots (FConfigFile &config)
{ {
buff[index++] = ' '; buff[index++] = ' ';
} }
const char *name = Slots[i].Weapons[j]->Name+1; const char *name = Slots[i].Weapons[j]->TypeName.GetChars();
strcpy (buff+index, name); strcpy (buff+index, name);
index += (int)strlen (name); index += (int)strlen (name);
} }

View file

@ -182,7 +182,7 @@ public:
virtual void Tick (); virtual void Tick ();
virtual void Draw (EHudState state); virtual void Draw (EHudState state);
void DrawTopStuff (EHudState state); void DrawTopStuff (EHudState state);
virtual void FlashItem (const TypeInfo *itemtype); virtual void FlashItem (const PClass *itemtype);
virtual void AttachToPlayer (player_s *player); virtual void AttachToPlayer (player_s *player);
virtual void FlashCrosshair (); virtual void FlashCrosshair ();
virtual void BlendView (float blend[4]); virtual void BlendView (float blend[4]);

View file

@ -1427,7 +1427,7 @@ void FBaseStatusBar::DrawConsistancy () const
} }
} }
void FBaseStatusBar::FlashItem (const TypeInfo *itemtype) void FBaseStatusBar::FlashItem (const PClass *itemtype)
{ {
} }

View file

@ -26,7 +26,7 @@ void A_AlienSpectreDeath (AActor *);
void A_AlertMonsters (AActor *); void A_AlertMonsters (AActor *);
void A_Tracer2 (AActor *); void A_Tracer2 (AActor *);
AActor *P_SpawnSubMissile (AActor *source, TypeInfo *type, AActor *target); AActor *P_SpawnSubMissile (AActor *source, PClass *type, AActor *target);
// Alien Spectre 1 ----------------------------------------------------------- // Alien Spectre 1 -----------------------------------------------------------
@ -340,7 +340,7 @@ END_DEFAULTS
//============================================================================ //============================================================================
static void GenericSpectreSpawn (AActor *actor, const TypeInfo *type) static void GenericSpectreSpawn (AActor *actor, const PClass *type)
{ {
AActor *spectre = Spawn (type, actor->x, actor->y, actor->z); AActor *spectre = Spawn (type, actor->x, actor->y, actor->z);
if (spectre != NULL) if (spectre != NULL)

View file

@ -108,7 +108,7 @@ public:
int NumPieces, DownPieces; int NumPieces, DownPieces;
}; };
extern const TypeInfo *QuestItemClasses[31]; extern const PClass *QuestItemClasses[31];
// Sigil/Spectral projectiles ----------------------------------------------- // Sigil/Spectral projectiles -----------------------------------------------

View file

@ -137,7 +137,7 @@ void AStrifePlayer::GiveDefaultInventory ()
AWeapon *weapon; AWeapon *weapon;
player->health = GetDefault()->health; player->health = GetDefault()->health;
weapon = static_cast<AWeapon *>(player->mo->GiveInventoryType (TypeInfo::FindType ("PunchDagger"))); weapon = static_cast<AWeapon *>(player->mo->GiveInventoryType (PClass::FindClass ("PunchDagger")));
player->ReadyWeapon = player->PendingWeapon = weapon; player->ReadyWeapon = player->PendingWeapon = weapon;
} }

View file

@ -767,7 +767,7 @@ END_DEFAULTS
void A_TossGib (AActor *self) void A_TossGib (AActor *self)
{ {
const TypeInfo *gibtype = (self->flags & MF_NOBLOOD) ? RUNTIME_CLASS(AJunk) : RUNTIME_CLASS(AMeat); const PClass *gibtype = (self->flags & MF_NOBLOOD) ? RUNTIME_CLASS(AJunk) : RUNTIME_CLASS(AMeat);
AActor *gib = Spawn (gibtype, self->x, self->y, self->z + 24*FRACUNIT); AActor *gib = Spawn (gibtype, self->x, self->y, self->z + 24*FRACUNIT);
angle_t an; angle_t an;
int speed; int speed;

View file

@ -1419,7 +1419,7 @@ void A_FireMauler2 (AActor *self)
// //
//============================================================================ //============================================================================
AActor *P_SpawnSubMissile (AActor *source, TypeInfo *type, AActor *target); AActor *P_SpawnSubMissile (AActor *source, PClass *type, AActor *target);
void A_MaulerTorpedoWave (AActor *self) void A_MaulerTorpedoWave (AActor *self)
{ {
@ -1441,7 +1441,7 @@ void A_MaulerTorpedoWave (AActor *self)
self->z = savedz; self->z = savedz;
} }
AActor *P_SpawnSubMissile (AActor *source, TypeInfo *type, AActor *target) AActor *P_SpawnSubMissile (AActor *source, PClass *type, AActor *target)
{ {
AActor *other = Spawn (type, source->x, source->y, source->z); AActor *other = Spawn (type, source->x, source->y, source->z);
@ -1812,7 +1812,7 @@ END_DEFAULTS
void A_FireGrenade (AActor *self) void A_FireGrenade (AActor *self)
{ {
TypeInfo *grenadetype; PClass *grenadetype;
player_t *player = self->player; player_t *player = self->player;
AActor *grenade; AActor *grenade;
angle_t an; angle_t an;
@ -2458,7 +2458,7 @@ int ASigil::GiveSigilPiece (AActor *receiver)
else if (sigil->NumPieces < 5) else if (sigil->NumPieces < 5)
{ {
++sigil->NumPieces; ++sigil->NumPieces;
static const TypeInfo *const sigils[5] = static const PClass *const sigils[5] =
{ {
RUNTIME_CLASS(ASigil1), RUNTIME_CLASS(ASigil1),
RUNTIME_CLASS(ASigil2), RUNTIME_CLASS(ASigil2),

View file

@ -9,7 +9,7 @@
static FRandom pr_bang4cloud ("Bang4Cloud"); static FRandom pr_bang4cloud ("Bang4Cloud");
static FRandom pr_lightout ("LightOut"); static FRandom pr_lightout ("LightOut");
extern const TypeInfo *QuestItemClasses[31]; extern const PClass *QuestItemClasses[31];
void A_TossGib (AActor *); void A_TossGib (AActor *);
void A_LoopActiveSound (AActor *); void A_LoopActiveSound (AActor *);

View file

@ -358,7 +358,7 @@ private:
} }
} }
void FlashItem (const TypeInfo *itemtype) void FlashItem (const PClass *itemtype)
{ {
ItemFlash = FRACUNIT*3/4; ItemFlash = FRACUNIT*3/4;
} }
@ -628,7 +628,7 @@ private:
label = item->GetClass()->Meta.GetMetaString (AMETA_StrifeName); label = item->GetClass()->Meta.GetMetaString (AMETA_StrifeName);
if (label == NULL) if (label == NULL)
{ {
label = item->GetClass()->Name + 1; label = item->GetClass()->TypeName.GetChars();
} }
int colnum = ((i-pos) / 5) & (KeyPopScroll > 0 ? 3 : 1); int colnum = ((i-pos) / 5) & (KeyPopScroll > 0 ? 3 : 1);
@ -685,7 +685,7 @@ private:
// How much ammo does the player have? // How much ammo does the player have?
static const struct static const struct
{ {
const TypeInfo *AmmoType; const PClass *AmmoType;
int Y; int Y;
} AmmoList[7] = } AmmoList[7] =
{ {
@ -717,20 +717,20 @@ private:
// What weapons does the player have? // What weapons does the player have?
static const struct static const struct
{ {
const char *TypeName; ENamedName TypeName;
int X, Y; int X, Y;
} WeaponList[6] = } WeaponList[6] =
{ {
{ "StrifeCrossbow", 23, 19 }, { NAME_StrifeCrossbow, 23, 19 },
{ "AssaultGun", 21, 41 }, { NAME_AssaultGun, 21, 41 },
{ "FlameThrower", 57, 50 }, { NAME_FlameThrower, 57, 50 },
{ "MiniMissileLauncher", 20, 64 }, { NAME_MiniMissileLauncher, 20, 64 },
{ "StrifeGrenadeLauncher", 55, 20 }, { NAME_StrifeGrenadeLauncher, 55, 20 },
{ "Mauler", 52, 75 }, { NAME_Mauler, 52, 75 },
}; };
for (i = 0; i < 6; ++i) for (i = 0; i < 6; ++i)
{ {
item = CPlayer->mo->FindInventory (TypeInfo::FindType (WeaponList[i].TypeName)); item = CPlayer->mo->FindInventory (PClass::FindClass (WeaponList[i].TypeName));
if (item != NULL) if (item != NULL)
{ {

View file

@ -66,7 +66,7 @@ extern void LoadDecorations (void (*process)(FState *, int));
FArchive &operator<< (FArchive &arc, FState *&state) FArchive &operator<< (FArchive &arc, FState *&state)
{ {
const TypeInfo *info; const PClass *info;
if (arc.IsStoring ()) if (arc.IsStoring ())
{ {
@ -91,7 +91,7 @@ FArchive &operator<< (FArchive &arc, FState *&state)
} }
else else
{ {
const TypeInfo *info; const PClass *info;
DWORD ofs; DWORD ofs;
arc.UserReadClass (info); arc.UserReadClass (info);
@ -113,7 +113,7 @@ FArchive &operator<< (FArchive &arc, FState *&state)
} }
// Find the actor that a state belongs to. // Find the actor that a state belongs to.
const TypeInfo *FState::StaticFindStateOwner (const FState *state) const PClass *FState::StaticFindStateOwner (const FState *state)
{ {
const FActorInfo *info = RUNTIME_CLASS(AActor)->ActorInfo; const FActorInfo *info = RUNTIME_CLASS(AActor)->ActorInfo;
@ -133,9 +133,9 @@ const TypeInfo *FState::StaticFindStateOwner (const FState *state)
} }
} }
for (unsigned int i = 0; i < TypeInfo::m_RuntimeActors.Size(); ++i) for (unsigned int i = 0; i < PClass::m_RuntimeActors.Size(); ++i)
{ {
info = TypeInfo::m_RuntimeActors[i]->ActorInfo; info = PClass::m_RuntimeActors[i]->ActorInfo;
if (state >= info->OwnedStates && if (state >= info->OwnedStates &&
state < info->OwnedStates + info->NumOwnedStates) state < info->OwnedStates + info->NumOwnedStates)
{ {
@ -148,7 +148,7 @@ const TypeInfo *FState::StaticFindStateOwner (const FState *state)
// Find the actor that a state belongs to, but restrict the search to // Find the actor that a state belongs to, but restrict the search to
// the specified type and its ancestors. // the specified type and its ancestors.
const TypeInfo *FState::StaticFindStateOwner (const FState *state, const FActorInfo *info) const PClass *FState::StaticFindStateOwner (const FState *state, const FActorInfo *info)
{ {
while (info != NULL) while (info != NULL)
{ {
@ -157,7 +157,7 @@ const TypeInfo *FState::StaticFindStateOwner (const FState *state, const FActorI
{ {
return info->Class; return info->Class;
} }
info = info->Class->ParentType->ActorInfo; info = info->Class->ParentClass->ActorInfo;
} }
return NULL; return NULL;
} }
@ -218,7 +218,7 @@ void FActorInfo::StaticInit ()
sprites.Push (temp); sprites.Push (temp);
} }
// Attach FActorInfo structures to every actor's TypeInfo // Attach FActorInfo structures to every actor's PClass
while (++reg != NULL) while (++reg != NULL)
{ {
reg->Class->ActorInfo = reg; reg->Class->ActorInfo = reg;
@ -226,7 +226,7 @@ void FActorInfo::StaticInit ()
(unsigned)reg->OwnedStates->sprite.index < sprites.Size ()) (unsigned)reg->OwnedStates->sprite.index < sprites.Size ())
{ {
Printf ("\x1c+%s is stateless. Fix its default list.\n", Printf ("\x1c+%s is stateless. Fix its default list.\n",
reg->Class->Name + 1); reg->Class->TypeName.GetChars());
} }
ProcessStates (reg->OwnedStates, reg->NumOwnedStates); ProcessStates (reg->OwnedStates, reg->NumOwnedStates);
} }
@ -266,9 +266,9 @@ void FActorInfo::StaticSetActorNums ()
reg->RegisterIDs (); reg->RegisterIDs ();
} }
for (unsigned int i = 0; i < TypeInfo::m_RuntimeActors.Size(); ++i) for (unsigned int i = 0; i < PClass::m_RuntimeActors.Size(); ++i)
{ {
TypeInfo::m_RuntimeActors[i]->ActorInfo->RegisterIDs (); PClass::m_RuntimeActors[i]->ActorInfo->RegisterIDs ();
} }
} }
@ -308,7 +308,7 @@ FDoomEdMap::~FDoomEdMap()
Empty(); Empty();
} }
void FDoomEdMap::AddType (int doomednum, const TypeInfo *type) void FDoomEdMap::AddType (int doomednum, const PClass *type)
{ {
unsigned int hash = (unsigned int)doomednum % DOOMED_HASHSIZE; unsigned int hash = (unsigned int)doomednum % DOOMED_HASHSIZE;
FDoomEdEntry *entry = DoomEdHash[hash]; FDoomEdEntry *entry = DoomEdHash[hash];
@ -326,7 +326,7 @@ void FDoomEdMap::AddType (int doomednum, const TypeInfo *type)
else else
{ {
Printf (PRINT_BOLD, "Warning: %s and %s both have doomednum %d.\n", Printf (PRINT_BOLD, "Warning: %s and %s both have doomednum %d.\n",
type->Name+1, entry->Type->Name+1, doomednum); type->TypeName.GetChars(), entry->Type->TypeName.GetChars(), doomednum);
} }
entry->Type = type; entry->Type = type;
} }
@ -366,7 +366,7 @@ void FDoomEdMap::Empty ()
} }
} }
const TypeInfo *FDoomEdMap::FindType (int doomednum) const const PClass *FDoomEdMap::FindType (int doomednum) const
{ {
unsigned int hash = (unsigned int)doomednum % DOOMED_HASHSIZE; unsigned int hash = (unsigned int)doomednum % DOOMED_HASHSIZE;
FDoomEdEntry *entry = DoomEdHash[hash]; FDoomEdEntry *entry = DoomEdHash[hash];
@ -377,7 +377,7 @@ const TypeInfo *FDoomEdMap::FindType (int doomednum) const
struct EdSorting struct EdSorting
{ {
const TypeInfo *Type; const PClass *Type;
int DoomEdNum; int DoomEdNum;
}; };
@ -389,7 +389,7 @@ static int STACK_ARGS sortnums (const void *a, const void *b)
void FDoomEdMap::DumpMapThings () void FDoomEdMap::DumpMapThings ()
{ {
TArray<EdSorting> infos (TypeInfo::m_Types.Size()); TArray<EdSorting> infos (PClass::m_Types.Size());
int i; int i;
for (i = 0; i < DOOMED_HASHSIZE; ++i) for (i = 0; i < DOOMED_HASHSIZE; ++i)
@ -415,7 +415,7 @@ void FDoomEdMap::DumpMapThings ()
for (i = 0; i < (int)infos.Size (); ++i) for (i = 0; i < (int)infos.Size (); ++i)
{ {
Printf ("%6d %s\n", Printf ("%6d %s\n",
infos[i].DoomEdNum, infos[i].Type->Name + 1); infos[i].DoomEdNum, infos[i].Type->TypeName.GetChars());
} }
} }
} }
@ -434,15 +434,14 @@ CCMD (summon)
if (argv.argc() > 1) if (argv.argc() > 1)
{ {
// Don't use FindType, because we want a case-insensitive search const PClass *type = PClass::FindClass (argv[1]);
const TypeInfo *type = TypeInfo::IFindType (argv[1]);
if (type == NULL) if (type == NULL)
{ {
Printf ("Unknown class '%s'\n", argv[1]); Printf ("Unknown class '%s'\n", argv[1]);
return; return;
} }
Net_WriteByte (DEM_SUMMON); Net_WriteByte (DEM_SUMMON);
Net_WriteString (type->Name + 1); Net_WriteString (type->TypeName.GetChars());
} }
} }
@ -453,14 +452,13 @@ CCMD (summonfriend)
if (argv.argc() > 1) if (argv.argc() > 1)
{ {
// Don't use FindType, because we want a case-insensitive search const PClass *type = PClass::FindClass (argv[1]);
const TypeInfo *type = TypeInfo::IFindType (argv[1]);
if (type == NULL) if (type == NULL)
{ {
Printf ("Unknown class '%s'\n", argv[1]); Printf ("Unknown class '%s'\n", argv[1]);
return; return;
} }
Net_WriteByte (DEM_SUMMONFRIEND); Net_WriteByte (DEM_SUMMONFRIEND);
Net_WriteString (type->Name + 1); Net_WriteString (type->TypeName.GetChars());
} }
} }

View file

@ -162,8 +162,8 @@ struct FState
Frame = (Frame & (SF_FULLBRIGHT|SF_BIGTIC)) | (frame-'A'); Frame = (Frame & (SF_FULLBRIGHT|SF_BIGTIC)) | (frame-'A');
} }
static const TypeInfo *StaticFindStateOwner (const FState *state); static const PClass *StaticFindStateOwner (const FState *state);
static const TypeInfo *StaticFindStateOwner (const FState *state, const FActorInfo *info); static const PClass *StaticFindStateOwner (const FState *state, const FActorInfo *info);
}; };
// A truly awful hack to get to the state that called an action function // A truly awful hack to get to the state that called an action function
@ -369,9 +369,8 @@ struct FActorInfo
void ApplyDefaults (BYTE *defaults); void ApplyDefaults (BYTE *defaults);
void RegisterIDs (); void RegisterIDs ();
TypeInfo *Class; PClass *Class;
FState *OwnedStates; FState *OwnedStates;
BYTE *Defaults;
int NumOwnedStates; int NumOwnedStates;
BYTE GameFilter; BYTE GameFilter;
BYTE SpawnID; BYTE SpawnID;
@ -395,8 +394,8 @@ class FDoomEdMap
public: public:
~FDoomEdMap(); ~FDoomEdMap();
const TypeInfo *FindType (int doomednum) const; const PClass *FindType (int doomednum) const;
void AddType (int doomednum, const TypeInfo *type); void AddType (int doomednum, const PClass *type);
void DelType (int doomednum); void DelType (int doomednum);
void Empty (); void Empty ();
@ -408,7 +407,7 @@ private:
struct FDoomEdEntry struct FDoomEdEntry
{ {
FDoomEdEntry *HashNext; FDoomEdEntry *HashNext;
const TypeInfo *Type; const PClass *Type;
int DoomEdNum; int DoomEdNum;
}; };

View file

@ -48,37 +48,37 @@
void FActorInfo::BuildDefaults () void FActorInfo::BuildDefaults ()
{ {
if (Defaults == NULL) if (Class->Defaults == NULL)
{ {
Defaults = new BYTE[Class->SizeOf]; Class->Defaults = new BYTE[Class->Size];
if (Class == RUNTIME_CLASS(AActor)) if (Class == RUNTIME_CLASS(AActor))
{ {
memset (Defaults, 0, Class->SizeOf); memset (Class->Defaults, 0, Class->Size);
} }
else else
{ {
TypeInfo *parent; PClass *parent;
parent = Class->ParentType; parent = Class->ParentClass;
parent->ActorInfo->BuildDefaults (); parent->ActorInfo->BuildDefaults ();
assert (Class->SizeOf >= parent->SizeOf); assert (Class->Size >= parent->Size);
memcpy (Defaults, parent->ActorInfo->Defaults, parent->SizeOf); memcpy (Class->Defaults, parent->Defaults, parent->Size);
if (Class->SizeOf > parent->SizeOf) if (Class->Size > parent->Size)
{ {
memset (Defaults + parent->SizeOf, 0, Class->SizeOf - parent->SizeOf); memset (Class->Defaults + parent->Size, 0, Class->Size - parent->Size);
} }
if (parent == RUNTIME_CLASS(AActor) && OwnedStates == NULL) if (parent == RUNTIME_CLASS(AActor) && OwnedStates == NULL)
{ // Stateless actors that are direct subclasses of AActor { // Stateless actors that are direct subclasses of AActor
// have their spawnstate default to something that won't // have their spawnstate default to something that won't
// immediately destroy them. // immediately destroy them.
((AActor *)(Defaults))->SpawnState = &AActor::States[0]; ((AActor *)(Class->Defaults))->SpawnState = &AActor::States[0];
} }
} }
ApplyDefaults (Defaults); ApplyDefaults (Class->Defaults);
} }
} }
static FState *DefaultStates (TypeInfo *type) static FState *DefaultStates (PClass *type)
{ {
FState *states = type->ActorInfo->OwnedStates; FState *states = type->ActorInfo->OwnedStates;
@ -86,21 +86,21 @@ static FState *DefaultStates (TypeInfo *type)
{ {
do do
{ {
type = type->ParentType; type = type->ParentClass;
states = type->ActorInfo->OwnedStates; states = type->ActorInfo->OwnedStates;
} while (states == NULL && type != RUNTIME_CLASS(AActor)); } while (states == NULL && type != RUNTIME_CLASS(AActor));
} }
return states; return states;
} }
static TypeInfo *sgClass; static PClass *sgClass;
static BYTE *sgDefaults; static BYTE *sgDefaults;
static void ApplyActorDefault (int defnum, const char *datastr, int dataint) static void ApplyActorDefault (int defnum, const char *datastr, int dataint)
{ {
int datasound = 0; int datasound = 0;
FState *datastate = NULL; FState *datastate = NULL;
const TypeInfo *datatype; const PClass *datatype;
if (defnum <= ADEF_LastString) if (defnum <= ADEF_LastString)
{ {
@ -134,10 +134,10 @@ static void ApplyActorDefault (int defnum, const char *datastr, int dataint)
case ADEF_Weapon_SisterType: case ADEF_Weapon_SisterType:
case ADEF_Weapon_ProjectileType: case ADEF_Weapon_ProjectileType:
case ADEF_PowerupGiver_Powerup: case ADEF_PowerupGiver_Powerup:
datatype = TypeInfo::FindType (datastr); datatype = PClass::FindClass (datastr);
if (datatype == NULL) if (datatype == NULL)
{ {
I_FatalError ("Unknown class %s in %s's default list", datastr, sgClass->Name+1); I_FatalError ("Unknown class %s in %s's default list", datastr, sgClass->TypeName.GetChars());
} }
break; break;

View file

@ -173,12 +173,12 @@ public:
#define BEGIN_DEFAULTS(actor,game,ednum,spawnid) \ #define BEGIN_DEFAULTS(actor,game,ednum,spawnid) \
BEGIN_DEFAULTS_PRE(actor) \ BEGIN_DEFAULTS_PRE(actor) \
RUNTIME_CLASS(actor), &actor::States[0], NULL, countof(actor::States), \ RUNTIME_CLASS(actor), &actor::States[0], countof(actor::States), \
BEGIN_DEFAULTS_POST(actor,game,ednum,spawnid) BEGIN_DEFAULTS_POST(actor,game,ednum,spawnid)
#define BEGIN_STATELESS_DEFAULTS(actor,game,ednum,spawnid) \ #define BEGIN_STATELESS_DEFAULTS(actor,game,ednum,spawnid) \
BEGIN_DEFAULTS_PRE(actor) \ BEGIN_DEFAULTS_PRE(actor) \
RUNTIME_CLASS(actor), NULL, NULL, 0, \ RUNTIME_CLASS(actor), NULL, 0, \
BEGIN_DEFAULTS_POST(actor,game,ednum,spawnid) BEGIN_DEFAULTS_POST(actor,game,ednum,spawnid)
// IMPLEMENT_ACTOR combines IMPLEMENT_CLASS and BEGIN_DEFAULTS // IMPLEMENT_ACTOR combines IMPLEMENT_CLASS and BEGIN_DEFAULTS

View file

@ -48,7 +48,7 @@
void cht_DoCheat (player_t *player, int cheat) void cht_DoCheat (player_t *player, int cheat)
{ {
static const TypeInfo *BeholdPowers[9] = static const PClass *BeholdPowers[9] =
{ {
RUNTIME_CLASS(APowerInvulnerable), RUNTIME_CLASS(APowerInvulnerable),
RUNTIME_CLASS(APowerStrength), RUNTIME_CLASS(APowerStrength),
@ -60,7 +60,7 @@ void cht_DoCheat (player_t *player, int cheat)
RUNTIME_CLASS(APowerMask), RUNTIME_CLASS(APowerMask),
RUNTIME_CLASS(APowerTargeter) RUNTIME_CLASS(APowerTargeter)
}; };
const TypeInfo *type; const PClass *type;
AInventory *item; AInventory *item;
const char *msg = ""; const char *msg = "";
char msgbuild[32]; char msgbuild[32];
@ -130,7 +130,7 @@ void cht_DoCheat (player_t *player, int cheat)
} }
} }
else if (P_MorphPlayer (player, else if (P_MorphPlayer (player,
TypeInfo::FindType (gameinfo.gametype==GAME_Heretic?"ChickenPlayer":"PigPlayer"))) PClass::FindClass (gameinfo.gametype == GAME_Heretic ? NAME_ChickenPlayer : NAME_PigPlayer)))
{ {
msg = "You feel strange..."; msg = "You feel strange...";
} }
@ -164,7 +164,7 @@ void cht_DoCheat (player_t *player, int cheat)
case CHT_CHAINSAW: case CHT_CHAINSAW:
if (player->mo != NULL) if (player->mo != NULL)
{ {
type = TypeInfo::FindType ("Chainsaw"); type = PClass::FindClass ("Chainsaw");
if (player->mo->FindInventory (type) == NULL) if (player->mo->FindInventory (type) == NULL)
{ {
player->mo->GiveInventoryType (type); player->mo->GiveInventoryType (type);
@ -409,7 +409,7 @@ void cht_DoCheat (player_t *player, int cheat)
Printf ("%s is a cheater: %s\n", player->userinfo.netname, msg); Printf ("%s is a cheater: %s\n", player->userinfo.netname, msg);
} }
void GiveSpawner (player_t *player, const TypeInfo *type, int amount) void GiveSpawner (player_t *player, const PClass *type, int amount)
{ {
AInventory *item = static_cast<AInventory *> AInventory *item = static_cast<AInventory *>
(Spawn (type, player->mo->x, player->mo->y, player->mo->z)); (Spawn (type, player->mo->x, player->mo->y, player->mo->z));
@ -448,7 +448,7 @@ void cht_Give (player_t *player, char *name, int amount)
{ {
BOOL giveall; BOOL giveall;
int i; int i;
const TypeInfo *type; const PClass *type;
if (player != &players[consoleplayer]) if (player != &players[consoleplayer])
Printf ("%s is a cheater: give %s\n", player->userinfo.netname, name); Printf ("%s is a cheater: give %s\n", player->userinfo.netname, name);
@ -491,15 +491,15 @@ void cht_Give (player_t *player, char *name, int amount)
// Select the correct type of backpack based on the game // Select the correct type of backpack based on the game
if (gameinfo.gametype == GAME_Heretic) if (gameinfo.gametype == GAME_Heretic)
{ {
type = TypeInfo::FindType ("BagOfHolding"); type = PClass::FindClass ("BagOfHolding");
} }
else if (gameinfo.gametype == GAME_Strife) else if (gameinfo.gametype == GAME_Strife)
{ {
type = TypeInfo::FindType ("AmmoSatchel"); type = PClass::FindClass ("AmmoSatchel");
} }
else if (gameinfo.gametype == GAME_Doom) else if (gameinfo.gametype == GAME_Doom)
{ {
type = TypeInfo::FindType ("Backpack"); type = PClass::FindClass ("Backpack");
} }
else else
{ // Hexen doesn't have a backpack, foo! { // Hexen doesn't have a backpack, foo!
@ -518,11 +518,11 @@ void cht_Give (player_t *player, char *name, int amount)
{ {
// Find every unique type of ammo. Give it to the player if // Find every unique type of ammo. Give it to the player if
// he doesn't have it already, and set each to its maximum. // he doesn't have it already, and set each to its maximum.
for (unsigned int i = 0; i < TypeInfo::m_Types.Size(); ++i) for (unsigned int i = 0; i < PClass::m_Types.Size(); ++i)
{ {
const TypeInfo *type = TypeInfo::m_Types[i]; const PClass *type = PClass::m_Types[i];
if (type->ParentType == RUNTIME_CLASS(AAmmo)) if (type->ParentClass == RUNTIME_CLASS(AAmmo))
{ {
AInventory *ammo = player->mo->FindInventory (type); AInventory *ammo = player->mo->FindInventory (type);
if (ammo == NULL) if (ammo == NULL)
@ -574,14 +574,14 @@ void cht_Give (player_t *player, char *name, int amount)
if (giveall || stricmp (name, "keys") == 0) if (giveall || stricmp (name, "keys") == 0)
{ {
for (unsigned int i = 0; i < TypeInfo::m_Types.Size(); ++i) for (unsigned int i = 0; i < PClass::m_Types.Size(); ++i)
{ {
if (TypeInfo::m_Types[i]->IsDescendantOf (RUNTIME_CLASS(AKey))) if (PClass::m_Types[i]->IsDescendantOf (RUNTIME_CLASS(AKey)))
{ {
AKey *key = (AKey *)GetDefaultByType (TypeInfo::m_Types[i]); AKey *key = (AKey *)GetDefaultByType (PClass::m_Types[i]);
if (key->KeyNumber != 0) if (key->KeyNumber != 0)
{ {
key = static_cast<AKey *>(Spawn (TypeInfo::m_Types[i], 0,0,0)); key = static_cast<AKey *>(Spawn (PClass::m_Types[i], 0,0,0));
if (!key->TryPickup (player->mo)) if (!key->TryPickup (player->mo))
{ {
key->Destroy (); key->Destroy ();
@ -596,9 +596,9 @@ void cht_Give (player_t *player, char *name, int amount)
if (giveall || stricmp (name, "weapons") == 0) if (giveall || stricmp (name, "weapons") == 0)
{ {
AWeapon *savedpending = player->PendingWeapon; AWeapon *savedpending = player->PendingWeapon;
for (unsigned int i = 0; i < TypeInfo::m_Types.Size(); ++i) for (unsigned int i = 0; i < PClass::m_Types.Size(); ++i)
{ {
type = TypeInfo::m_Types[i]; type = PClass::m_Types[i];
if (type != RUNTIME_CLASS(AWeapon) && if (type != RUNTIME_CLASS(AWeapon) &&
type->IsDescendantOf (RUNTIME_CLASS(AWeapon))) type->IsDescendantOf (RUNTIME_CLASS(AWeapon)))
{ {
@ -617,9 +617,9 @@ void cht_Give (player_t *player, char *name, int amount)
if (giveall || stricmp (name, "artifacts") == 0) if (giveall || stricmp (name, "artifacts") == 0)
{ {
for (unsigned int i = 0; i < TypeInfo::m_Types.Size(); ++i) for (unsigned int i = 0; i < PClass::m_Types.Size(); ++i)
{ {
type = TypeInfo::m_Types[i]; type = PClass::m_Types[i];
if (type->IsDescendantOf (RUNTIME_CLASS(AInventory))) if (type->IsDescendantOf (RUNTIME_CLASS(AInventory)))
{ {
AInventory *def = (AInventory*)GetDefaultByType (type); AInventory *def = (AInventory*)GetDefaultByType (type);
@ -638,9 +638,9 @@ void cht_Give (player_t *player, char *name, int amount)
if (giveall || stricmp (name, "puzzlepieces") == 0) if (giveall || stricmp (name, "puzzlepieces") == 0)
{ {
for (unsigned int i = 0; i < TypeInfo::m_Types.Size(); ++i) for (unsigned int i = 0; i < PClass::m_Types.Size(); ++i)
{ {
type = TypeInfo::m_Types[i]; type = PClass::m_Types[i];
if (type->IsDescendantOf (RUNTIME_CLASS(APuzzleItem))) if (type->IsDescendantOf (RUNTIME_CLASS(APuzzleItem)))
{ {
AInventory *def = (AInventory*)GetDefaultByType (type); AInventory *def = (AInventory*)GetDefaultByType (type);
@ -657,7 +657,7 @@ void cht_Give (player_t *player, char *name, int amount)
if (giveall) if (giveall)
return; return;
type = TypeInfo::IFindType (name); type = PClass::FindClass (name);
if (type == NULL || !type->IsDescendantOf (RUNTIME_CLASS(AInventory))) if (type == NULL || !type->IsDescendantOf (RUNTIME_CLASS(AInventory)))
{ {
if (player == &players[consoleplayer]) if (player == &players[consoleplayer])

View file

@ -217,7 +217,7 @@ static DCanvas *FireScreen;
static byte FireRemap[256]; static byte FireRemap[256];
static char *genders[3] = { "male", "female", "other" }; static char *genders[3] = { "male", "female", "other" };
static const TypeInfo *PlayerClass; static const PClass *PlayerClass;
static FState *PlayerState; static FState *PlayerState;
static int PlayerTics; static int PlayerTics;
static int PlayerRotation; static int PlayerRotation;
@ -1803,7 +1803,7 @@ static void M_PlayerSetupTicker (void)
// Based on code in f_finale.c // Based on code in f_finale.c
if (gameinfo.gametype == GAME_Hexen) if (gameinfo.gametype == GAME_Hexen)
{ {
const TypeInfo *oldclass = PlayerClass; const PClass *oldclass = PlayerClass;
PickPlayerClass (); PickPlayerClass ();
if (PlayerClass != oldclass) if (PlayerClass != oldclass)
@ -3192,15 +3192,15 @@ static void PickPlayerClass ()
{ {
if (gameinfo.gametype & (GAME_Doom|GAME_Strife)) if (gameinfo.gametype & (GAME_Doom|GAME_Strife))
{ {
PlayerClass = TypeInfo::FindType ("DoomPlayer"); PlayerClass = PClass::FindClass (NAME_DoomPlayer);
} }
else if (gameinfo.gametype == GAME_Heretic) else if (gameinfo.gametype == GAME_Heretic)
{ {
PlayerClass = TypeInfo::FindType ("HereticPlayer"); PlayerClass = PClass::FindClass (NAME_HereticPlayer);
} }
else else
{ {
static const char *classnames[3] = { "FighterPlayer", "ClericPlayer", "MagePlayer" }; static const ENamedName classnames[3] = { NAME_FighterPlayer, NAME_ClericPlayer, NAME_MagePlayer };
int nowtype = players[consoleplayer].userinfo.PlayerClass; int nowtype = players[consoleplayer].userinfo.PlayerClass;
@ -3209,6 +3209,6 @@ static void PickPlayerClass ()
nowtype = (MenuTime>>7) % 3; nowtype = (MenuTime>>7) % 3;
} }
PlayerClass = TypeInfo::FindType (classnames[nowtype]); PlayerClass = PClass::FindClass (classnames[nowtype]);
} }
} }

View file

@ -99,8 +99,8 @@ int FName::NameManager::FindName (const char *text, bool noCreate)
return 0; return 0;
} }
DWORD hash = MakeKey (text); unsigned int hash = MakeKey (text);
DWORD bucket = hash % HASH_SIZE; unsigned int bucket = hash % HASH_SIZE;
int scanner = Buckets[bucket]; int scanner = Buckets[bucket];
// See if the name already exists. // See if the name already exists.
@ -150,7 +150,7 @@ void FName::NameManager::InitBuckets ()
// //
//========================================================================== //==========================================================================
int FName::NameManager::AddName (const char *text, DWORD hash, DWORD bucket) int FName::NameManager::AddName (const char *text, unsigned int hash, unsigned int bucket)
{ {
char *textstore; char *textstore;
NameBlock *block = Blocks; NameBlock *block = Blocks;

View file

@ -88,7 +88,7 @@ private:
struct NameEntry struct NameEntry
{ {
char *Text; char *Text;
DWORD Hash; unsigned int Hash;
int NextHash; int NextHash;
}; };
@ -108,7 +108,7 @@ private:
int Buckets[HASH_SIZE]; int Buckets[HASH_SIZE];
int FindName (const char *text, bool noCreate); int FindName (const char *text, bool noCreate);
int AddName (const char *text, DWORD hash, DWORD bucket); int AddName (const char *text, unsigned int hash, unsigned int bucket);
NameBlock *AddBlock (size_t len); NameBlock *AddBlock (size_t len);
void InitBuckets (); void InitBuckets ();
bool Inited; bool Inited;

View file

@ -1,6 +1,9 @@
// 'None' must always be the first name. // 'None' must always be the first name.
xx(None) xx(None)
xx(Super)
xx(Object)
// Hexen sound sequence names // Hexen sound sequence names
xx(Platform) xx(Platform)
xx(PlatformMetal) xx(PlatformMetal)
@ -17,10 +20,6 @@ xx(DoorCreak)
xx(DoorMetal2) xx(DoorMetal2)
xx(Wind) xx(Wind)
#if 0
xx(Super)
xx(Object)
// Special bosses A_BossDeath knows about // Special bosses A_BossDeath knows about
xx(Fatso) xx(Fatso)
xx(Arachnotron) xx(Arachnotron)
@ -31,6 +30,11 @@ xx(Ironlich)
xx(Minotaur) xx(Minotaur)
xx(Sorcerer2) xx(Sorcerer2)
// P_SpawnMapThing checks for these as health items (I smell a FIXME)
xx(Berserk)
xx(Soulsphere)
xx(Megasphere) // also counts as armor for P_SpawnMapThing
// Standard player classes // Standard player classes
xx(DoomPlayer) xx(DoomPlayer)
xx(HereticPlayer) xx(HereticPlayer)
@ -38,6 +42,31 @@ xx(StrifePlayer)
xx(FighterPlayer) xx(FighterPlayer)
xx(ClericPlayer) xx(ClericPlayer)
xx(MagePlayer) xx(MagePlayer)
xx(ChickenPlayer)
xx(PigPlayer)
// Flechette names for the different Hexen player classes
xx(ArtiPoisonBag1)
xx(ArtiPoisonBag2)
xx(ArtiPoisonBag3)
// Strife quests
xx(QuestItem)
// Auto-usable health items
xx(ArtiHealth)
xx(ArtiSuperHealth)
xx(MedicalKit)
xx(MedPatch)
// The Wings of Wrath
xx(ArtiFly)
// Doom ammo types
xx(Clip)
xx(Shell)
xx(RocketAmmo)
xx(Cell)
// Weapon names for the Strife status bar // Weapon names for the Strife status bar
xx(StrifeCrossbow) xx(StrifeCrossbow)
@ -47,15 +76,10 @@ xx(MiniMissileLauncher)
xx(StrifeGrenadeLauncher) xx(StrifeGrenadeLauncher)
xx(Mauler) xx(Mauler)
// Flechette names for the different Hexen player classes xx(Chicken)
xx(ArtiPoisonBag1) xx(Pig)
xx(ArtiPoisonBag2)
xx(ArtiPoisonBag3)
// P_SpawnMapThing checks for these as health items (I smell a FIXME) #if 0
xx(Berserk)
xx(Soulsphere)
xx(Megasphere) // also counts as armor for P_SpawnMapThing
// Standard animator names. // Standard animator names.
xx(Spawn) xx(Spawn)

View file

@ -167,7 +167,7 @@ static void ClearInventory (AActor *activator)
// //
//============================================================================ //============================================================================
static void DoGiveInv (AActor *actor, const TypeInfo *info, int amount) static void DoGiveInv (AActor *actor, const PClass *info, int amount)
{ {
AWeapon *savedPendingWeap = actor->player != NULL AWeapon *savedPendingWeap = actor->player != NULL
? actor->player->PendingWeapon : NULL; ? actor->player->PendingWeapon : NULL;
@ -222,17 +222,17 @@ static void DoGiveInv (AActor *actor, const TypeInfo *info, int amount)
static void GiveInventory (AActor *activator, const char *type, int amount) static void GiveInventory (AActor *activator, const char *type, int amount)
{ {
const TypeInfo *info; const PClass *info;
if (amount <= 0 || type == NULL) if (amount <= 0 || type == NULL)
{ {
return; return;
} }
if (strcmp (type, "Armor") == 0) if (stricmp (type, "Armor") == 0)
{ {
type = "BasicArmorPickup"; type = "BasicArmorPickup";
} }
info = TypeInfo::FindType (type); info = PClass::FindClass (type);
if (info == NULL) if (info == NULL)
{ {
Printf ("ACS: I don't know what %s is.\n", type); Printf ("ACS: I don't know what %s is.\n", type);
@ -263,7 +263,7 @@ static void GiveInventory (AActor *activator, const char *type, int amount)
// //
//============================================================================ //============================================================================
static void DoTakeInv (AActor *actor, const TypeInfo *info, int amount) static void DoTakeInv (AActor *actor, const PClass *info, int amount)
{ {
AInventory *item = actor->FindInventory (info); AInventory *item = actor->FindInventory (info);
if (item != NULL) if (item != NULL)
@ -274,7 +274,7 @@ static void DoTakeInv (AActor *actor, const TypeInfo *info, int amount)
// If it's not ammo, destroy it. Ammo needs to stick around, even // If it's not ammo, destroy it. Ammo needs to stick around, even
// when it's zero for the benefit of the weapons that use it and // when it's zero for the benefit of the weapons that use it and
// to maintain the maximum ammo amounts a backpack might have given. // to maintain the maximum ammo amounts a backpack might have given.
if (item->GetClass()->ParentType != RUNTIME_CLASS(AAmmo)) if (item->GetClass()->ParentClass != RUNTIME_CLASS(AAmmo))
{ {
item->Destroy (); item->Destroy ();
} }
@ -296,7 +296,7 @@ static void DoTakeInv (AActor *actor, const TypeInfo *info, int amount)
static void TakeInventory (AActor *activator, const char *type, int amount) static void TakeInventory (AActor *activator, const char *type, int amount)
{ {
const TypeInfo *info; const PClass *info;
if (type == NULL) if (type == NULL)
{ {
@ -310,7 +310,7 @@ static void TakeInventory (AActor *activator, const char *type, int amount)
{ {
return; return;
} }
info = TypeInfo::FindType (type); info = PClass::FindClass (type);
if (info == NULL) if (info == NULL)
{ {
return; return;
@ -342,16 +342,16 @@ static int CheckInventory (AActor *activator, const char *type)
if (activator == NULL || type == NULL) if (activator == NULL || type == NULL)
return 0; return 0;
if (strcmp (type, "Armor") == 0) if (stricmp (type, "Armor") == 0)
{ {
type = "BasicArmor"; type = "BasicArmor";
} }
else if (strcmp (type, "Health") == 0) else if (stricmp (type, "Health") == 0)
{ {
return activator->health; return activator->health;
} }
const TypeInfo *info = TypeInfo::FindType (type); const PClass *info = PClass::FindClass (type);
AInventory *item = activator->FindInventory (info); AInventory *item = activator->FindInventory (info);
return item ? item->Amount : 0; return item ? item->Amount : 0;
} }
@ -1599,7 +1599,7 @@ int DLevelScript::Random (int min, int max)
int DLevelScript::ThingCount (int type, int tid) int DLevelScript::ThingCount (int type, int tid)
{ {
AActor *actor; AActor *actor;
const TypeInfo *kind; const PClass *kind;
int count = 0; int count = 0;
if (type >= MAX_SPAWNABLES) if (type >= MAX_SPAWNABLES)
@ -1732,7 +1732,7 @@ void DLevelScript::SetLineTexture (int lineid, int side, int position, int name)
int DLevelScript::DoSpawn (int type, fixed_t x, fixed_t y, fixed_t z, int tid, int angle) int DLevelScript::DoSpawn (int type, fixed_t x, fixed_t y, fixed_t z, int tid, int angle)
{ {
const TypeInfo *info = TypeInfo::FindType (FBehavior::StaticLookupString (type)); const PClass *info = PClass::FindClass (FBehavior::StaticLookupString (type));
AActor *actor = NULL; AActor *actor = NULL;
if (info != NULL) if (info != NULL)
@ -3225,7 +3225,7 @@ int DLevelScript::RunScript ()
} }
else if (activator) else if (activator)
{ {
workwhere += sprintf (workwhere, "%s", RUNTIME_TYPE(activator)->Name+1); workwhere += sprintf (workwhere, "%s", RUNTIME_TYPE(activator)->TypeName.GetChars());
} }
else else
{ {
@ -3740,10 +3740,10 @@ int DLevelScript::RunScript ()
case PCD_GETAMMOCAPACITY: case PCD_GETAMMOCAPACITY:
if (activator != NULL) if (activator != NULL)
{ {
const TypeInfo *type = TypeInfo::FindType (FBehavior::StaticLookupString (STACK(1))); const PClass *type = PClass::FindClass (FBehavior::StaticLookupString (STACK(1)));
AInventory *item; AInventory *item;
if (type != NULL && type->ParentType == RUNTIME_CLASS(AAmmo)) if (type != NULL && type->ParentClass == RUNTIME_CLASS(AAmmo))
{ {
item = activator->FindInventory (type); item = activator->FindInventory (type);
if (item != NULL) if (item != NULL)
@ -3769,10 +3769,10 @@ int DLevelScript::RunScript ()
case PCD_SETAMMOCAPACITY: case PCD_SETAMMOCAPACITY:
if (activator != NULL) if (activator != NULL)
{ {
const TypeInfo *type = TypeInfo::FindType (FBehavior::StaticLookupString (STACK(2))); const PClass *type = PClass::FindClass (FBehavior::StaticLookupString (STACK(2)));
AInventory *item; AInventory *item;
if (type != NULL && type->ParentType == RUNTIME_CLASS(AAmmo)) if (type != NULL && type->ParentClass == RUNTIME_CLASS(AAmmo))
{ {
item = activator->FindInventory (type); item = activator->FindInventory (type);
if (item != NULL) if (item != NULL)
@ -4075,7 +4075,7 @@ int DLevelScript::RunScript ()
else else
{ {
STACK(1) = 0 == strcmp (FBehavior::StaticLookupString (STACK(1)), STACK(1) = 0 == strcmp (FBehavior::StaticLookupString (STACK(1)),
activator->player->ReadyWeapon->GetClass()->Name+1); activator->player->ReadyWeapon->GetClass()->TypeName.GetChars());
} }
break; break;
@ -4086,7 +4086,7 @@ int DLevelScript::RunScript ()
} }
else else
{ {
AInventory *item = activator->FindInventory (TypeInfo::FindType ( AInventory *item = activator->FindInventory (PClass::FindClass (
FBehavior::StaticLookupString (STACK(1)))); FBehavior::StaticLookupString (STACK(1))));
if (item == NULL || !item->IsKindOf (RUNTIME_CLASS(AWeapon))) if (item == NULL || !item->IsKindOf (RUNTIME_CLASS(AWeapon)))
@ -4142,7 +4142,7 @@ int DLevelScript::RunScript ()
case PCD_SETMARINESPRITE: case PCD_SETMARINESPRITE:
{ {
const TypeInfo *type = TypeInfo::FindType (FBehavior::StaticLookupString (STACK(1))); const PClass *type = PClass::FindClass (FBehavior::StaticLookupString (STACK(1)));
if (type != NULL) if (type != NULL)
{ {

View file

@ -56,7 +56,7 @@ struct TeaserSpeech
static FRandom pr_randomspeech("RandomSpeech"); static FRandom pr_randomspeech("RandomSpeech");
void GiveSpawner (player_t *player, const TypeInfo *type); void GiveSpawner (player_t *player, const PClass *type);
TArray<FStrifeDialogueNode *> StrifeDialogues; TArray<FStrifeDialogueNode *> StrifeDialogues;
@ -64,7 +64,7 @@ TArray<FStrifeDialogueNode *> StrifeDialogues;
// to their index in the mobjinfo table. This table indexes all // to their index in the mobjinfo table. This table indexes all
// the Strife actor types in the order Strife had them and is // the Strife actor types in the order Strife had them and is
// initialized as part of the actor's setup in infodefaults.cpp. // initialized as part of the actor's setup in infodefaults.cpp.
const TypeInfo *StrifeTypes[344]; const PClass *StrifeTypes[344];
static menu_t ConversationMenu; static menu_t ConversationMenu;
static TArray<menuitem_t> ConversationItems; static TArray<menuitem_t> ConversationItems;
@ -172,11 +172,11 @@ static const char *const RandomLines[NUM_RANDOM_TALKERS][NUM_RANDOM_LINES+1] =
// //
// GetStrifeType // GetStrifeType
// //
// Given an item type number, returns the corresponding TypeInfo. // Given an item type number, returns the corresponding PClass.
// //
//============================================================================ //============================================================================
static const TypeInfo *GetStrifeType (int typenum) static const PClass *GetStrifeType (int typenum)
{ {
if (typenum > 0 && typenum < 344) if (typenum > 0 && typenum < 344)
{ {
@ -322,7 +322,7 @@ static FStrifeDialogueNode *ReadRetailNode (FWadLump *lump, DWORD &prevSpeakerTy
FStrifeDialogueNode *node; FStrifeDialogueNode *node;
Speech speech; Speech speech;
char fullsound[16]; char fullsound[16];
const TypeInfo *type; const PClass *type;
int j; int j;
node = new FStrifeDialogueNode; node = new FStrifeDialogueNode;
@ -392,7 +392,7 @@ static FStrifeDialogueNode *ReadTeaserNode (FWadLump *lump, DWORD &prevSpeakerTy
FStrifeDialogueNode *node; FStrifeDialogueNode *node;
TeaserSpeech speech; TeaserSpeech speech;
char fullsound[16]; char fullsound[16];
const TypeInfo *type; const PClass *type;
int j; int j;
node = new FStrifeDialogueNode; node = new FStrifeDialogueNode;
@ -614,7 +614,7 @@ static int FindNode (const FStrifeDialogueNode *node)
// //
//============================================================================ //============================================================================
static bool CheckStrifeItem (const TypeInfo *itemtype, int amount=-1) static bool CheckStrifeItem (const PClass *itemtype, int amount=-1)
{ {
AInventory *item; AInventory *item;
@ -637,13 +637,13 @@ static bool CheckStrifeItem (const TypeInfo *itemtype, int amount=-1)
// //
//============================================================================ //============================================================================
static void TakeStrifeItem (const TypeInfo *itemtype, int amount) static void TakeStrifeItem (const PClass *itemtype, int amount)
{ {
if (itemtype == NULL || amount == 0) if (itemtype == NULL || amount == 0)
return; return;
// Don't take quest items. // Don't take quest items.
if (itemtype->IsDescendantOf (TypeInfo::FindType("QuestItem"))) if (itemtype->IsDescendantOf (PClass::FindClass(NAME_QuestItem)))
return; return;
// Don't take keys // Don't take keys
@ -1001,7 +1001,7 @@ static void PickConversationReply ()
{ {
// Trying to give a non-inventory item. // Trying to give a non-inventory item.
takestuff = false; takestuff = false;
Printf("Attempting to give non-inventory item %s\n", reply->GiveType->Name+1); Printf("Attempting to give non-inventory item %s\n", reply->GiveType->TypeName.GetChars());
} }
} }

View file

@ -16,11 +16,11 @@ struct brokenlines_t;
struct FStrifeDialogueNode struct FStrifeDialogueNode
{ {
~FStrifeDialogueNode (); ~FStrifeDialogueNode ();
const TypeInfo *DropType; const PClass *DropType;
const TypeInfo *ItemCheck[3]; const PClass *ItemCheck[3];
int ItemCheckNode; // index into StrifeDialogues int ItemCheckNode; // index into StrifeDialogues
const TypeInfo *SpeakerType; const PClass *SpeakerType;
char *SpeakerName; char *SpeakerName;
int SpeakerVoice; int SpeakerVoice;
int Backdrop; int Backdrop;
@ -35,8 +35,8 @@ struct FStrifeDialogueReply
~FStrifeDialogueReply (); ~FStrifeDialogueReply ();
FStrifeDialogueReply *Next; FStrifeDialogueReply *Next;
const TypeInfo *GiveType; const PClass *GiveType;
const TypeInfo *ItemCheck[3]; const PClass *ItemCheck[3];
int ItemCheckAmount[3]; int ItemCheckAmount[3];
char *Reply; char *Reply;
char *QuickYes; char *QuickYes;
@ -54,7 +54,7 @@ extern TArray<FStrifeDialogueNode *> StrifeDialogues;
// to their index in the mobjinfo table. This table indexes all // to their index in the mobjinfo table. This table indexes all
// the Strife actor types in the order Strife had them and is // the Strife actor types in the order Strife had them and is
// initialized as part of the actor's setup in infodefaults.cpp. // initialized as part of the actor's setup in infodefaults.cpp.
extern const TypeInfo *StrifeTypes[344]; extern const PClass *StrifeTypes[344];
void P_LoadStrifeConversations (const char *mapname); void P_LoadStrifeConversations (const char *mapname);
void P_FreeStrifeConversations (); void P_FreeStrifeConversations ();

View file

@ -2161,7 +2161,7 @@ void A_XXScream (AActor *actor)
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
CVAR(Int, sv_dropstyle, 0, CVAR_SERVERINFO | CVAR_ARCHIVE); CVAR(Int, sv_dropstyle, 0, CVAR_SERVERINFO | CVAR_ARCHIVE);
AInventory *P_DropItem (AActor *source, const TypeInfo *type, int special, int chance) AInventory *P_DropItem (AActor *source, const PClass *type, int special, int chance)
{ {
if (type != NULL && pr_dropitem() <= chance) if (type != NULL && pr_dropitem() <= chance)
{ {
@ -2367,7 +2367,7 @@ void A_BossDeath (AActor *actor)
FSpecialAction *sa = level.info->specialactions; FSpecialAction *sa = level.info->specialactions;
while (sa) while (sa)
{ {
if (FName(actor->GetClass()->Name+1) == sa->Type) if (FName(actor->GetClass()->TypeName.GetChars()) == sa->Type)
{ {
if (!checked && !CheckBossDeath(actor)) if (!checked && !CheckBossDeath(actor))
{ {
@ -2393,24 +2393,19 @@ void A_BossDeath (AActor *actor)
LEVEL_SORCERER2SPECIAL)) == 0) LEVEL_SORCERER2SPECIAL)) == 0)
return; return;
if (strcmp (RUNTIME_TYPE(actor)->Name+1, "Fatso") == 0) const PClass *actorType = actor->GetClass();
type = MT_FATSO; switch (actorType->TypeName)
else if (strcmp (RUNTIME_TYPE(actor)->Name+1, "Arachnotron") == 0) {
type = MT_BABY; case NAME_Fatso: type = MT_FATSO; break;
else if (strcmp (RUNTIME_TYPE(actor)->Name+1, "BaronOfHell") == 0) case NAME_Arachnotron: type = MT_BABY; break;
type = MT_BRUISER; case NAME_BaronOfHell: type = MT_BRUISER; break;
else if (strcmp (RUNTIME_TYPE(actor)->Name+1, "Cyberdemon") == 0) case NAME_Cyberdemon: type = MT_CYBORG; break;
type = MT_CYBORG; case NAME_SpiderMastermind: type = MT_SPIDER; break;
else if (strcmp (RUNTIME_TYPE(actor)->Name+1, "SpiderMastermind") == 0) case NAME_Ironlich: type = MT_HEAD; break;
type = MT_SPIDER; case NAME_Minotaur: type = MT_MINOTAUR; break;
else if (strcmp (RUNTIME_TYPE(actor)->Name+1, "Ironlich") == 0) case NAME_Sorcerer2: type = MT_SORCERER2; break;
type = MT_HEAD; default: return;
else if (strcmp (RUNTIME_TYPE(actor)->Name+1, "Minotaur") == 0) }
type = MT_MINOTAUR;
else if (strcmp (RUNTIME_TYPE(actor)->Name+1, "Sorcerer2") == 0)
type = MT_SORCERER2;
else
return;
if ( if (
((level.flags & LEVEL_MAP07SPECIAL) && (type == MT_FATSO || type == MT_BABY)) || ((level.flags & LEVEL_MAP07SPECIAL) && (type == MT_FATSO || type == MT_BABY)) ||

View file

@ -26,10 +26,10 @@ BOOL P_Move (AActor *actor);
BOOL P_TryWalk (AActor *actor); BOOL P_TryWalk (AActor *actor);
void P_NewChaseDir (AActor *actor); void P_NewChaseDir (AActor *actor);
BOOL P_LookForPlayers (AActor *actor, BOOL allaround); BOOL P_LookForPlayers (AActor *actor, BOOL allaround);
AInventory *P_DropItem (AActor *source, const TypeInfo *type, int special, int chance); AInventory *P_DropItem (AActor *source, const PClass *type, int special, int chance);
inline AInventory *P_DropItem (AActor *source, const char *type, int special, int chance) inline AInventory *P_DropItem (AActor *source, const char *type, int special, int chance)
{ {
return P_DropItem (source, TypeInfo::FindType (type), special, chance); return P_DropItem (source, PClass::FindClass (type), special, chance);
} }
void P_TossItem (AActor *item); void P_TossItem (AActor *item);

View file

@ -702,8 +702,8 @@ void P_AutoUseHealth(player_t *player, int saveHealth)
{ {
int i; int i;
int count; int count;
const TypeInfo *normalType = TypeInfo::FindType ("ArtiHealth"); const PClass *normalType = PClass::FindClass (NAME_ArtiHealth);
const TypeInfo *superType = TypeInfo::FindType ("ArtiSuperHealth"); const PClass *superType = PClass::FindClass (NAME_ArtiSuperHealth);
AInventory *normalItem = player->mo->FindInventory (normalType); AInventory *normalItem = player->mo->FindInventory (normalType);
AInventory *superItem = player->mo->FindInventory (superType); AInventory *superItem = player->mo->FindInventory (superType);
int normalAmount, superAmount; int normalAmount, superAmount;
@ -773,11 +773,11 @@ void P_AutoUseHealth(player_t *player, int saveHealth)
void P_AutoUseStrifeHealth (player_t *player) void P_AutoUseStrifeHealth (player_t *player)
{ {
static const char *healthnames[2] = { "MedicalKit", "MedPatch" }; static const ENamedName healthnames[2] = { NAME_MedicalKit, NAME_MedPatch };
for (int i = 0; i < 2; ++i) for (int i = 0; i < 2; ++i)
{ {
const TypeInfo *type = TypeInfo::FindType (healthnames[i]); const PClass *type = PClass::FindClass (healthnames[i]);
while (player->health < 50) while (player->health < 50)
{ {

View file

@ -2117,7 +2117,7 @@ FUNC(LS_SetPlayerProperty)
// Add or remove a power // Add or remove a power
if (arg2 >= PROP_INVULNERABILITY && arg2 <= PROP_SPEED) if (arg2 >= PROP_INVULNERABILITY && arg2 <= PROP_SPEED)
{ {
static const TypeInfo *powers[11] = static const PClass *powers[11] =
{ {
RUNTIME_CLASS(APowerInvulnerable), RUNTIME_CLASS(APowerInvulnerable),
RUNTIME_CLASS(APowerStrength), RUNTIME_CLASS(APowerStrength),

View file

@ -96,7 +96,7 @@ void P_ThrustMobj (AActor *mo, angle_t angle, fixed_t move);
int P_FaceMobj (AActor *source, AActor *target, angle_t *delta); int P_FaceMobj (AActor *source, AActor *target, angle_t *delta);
bool P_SeekerMissile (AActor *actor, angle_t thresh, angle_t turnMax); bool P_SeekerMissile (AActor *actor, angle_t thresh, angle_t turnMax);
AActor *P_SpawnPuff (const TypeInfo *pufftype, fixed_t x, fixed_t y, fixed_t z, angle_t dir, int updown, bool hit=false); AActor *P_SpawnPuff (const PClass *pufftype, fixed_t x, fixed_t y, fixed_t z, angle_t dir, int updown, bool hit=false);
void P_SpawnBlood (fixed_t x, fixed_t y, fixed_t z, angle_t dir, int damage, AActor *originator); void P_SpawnBlood (fixed_t x, fixed_t y, fixed_t z, angle_t dir, int damage, AActor *originator);
void P_BloodSplatter (fixed_t x, fixed_t y, fixed_t z, AActor *originator); void P_BloodSplatter (fixed_t x, fixed_t y, fixed_t z, AActor *originator);
void P_BloodSplatter2 (fixed_t x, fixed_t y, fixed_t z, AActor *originator); void P_BloodSplatter2 (fixed_t x, fixed_t y, fixed_t z, AActor *originator);
@ -104,18 +104,18 @@ void P_RipperBlood (AActor *mo, AActor *bleeder);
int P_GetThingFloorType (AActor *thing); int P_GetThingFloorType (AActor *thing);
void P_ExplodeMissile (AActor *missile, line_t *explodeline); void P_ExplodeMissile (AActor *missile, line_t *explodeline);
AActor *P_SpawnMissile (AActor* source, AActor* dest, const TypeInfo *type); AActor *P_SpawnMissile (AActor* source, AActor* dest, const PClass *type);
AActor *P_SpawnMissileZ (AActor* source, fixed_t z, AActor* dest, const TypeInfo *type); AActor *P_SpawnMissileZ (AActor* source, fixed_t z, AActor* dest, const PClass *type);
AActor *P_SpawnMissileXYZ (fixed_t x, fixed_t y, fixed_t z, AActor *source, AActor *dest, const TypeInfo *type); AActor *P_SpawnMissileXYZ (fixed_t x, fixed_t y, fixed_t z, AActor *source, AActor *dest, const PClass *type);
AActor *P_SpawnMissileAngle (AActor *source, const TypeInfo *type, angle_t angle, fixed_t momz); AActor *P_SpawnMissileAngle (AActor *source, const PClass *type, angle_t angle, fixed_t momz);
AActor *P_SpawnMissileAngleSpeed (AActor *source, const TypeInfo *type, angle_t angle, fixed_t momz, fixed_t speed); AActor *P_SpawnMissileAngleSpeed (AActor *source, const PClass *type, angle_t angle, fixed_t momz, fixed_t speed);
AActor *P_SpawnMissileAngleZ (AActor *source, fixed_t z, const TypeInfo *type, angle_t angle, fixed_t momz); AActor *P_SpawnMissileAngleZ (AActor *source, fixed_t z, const PClass *type, angle_t angle, fixed_t momz);
AActor *P_SpawnMissileAngleZSpeed (AActor *source, fixed_t z, const TypeInfo *type, angle_t angle, fixed_t momz, fixed_t speed, AActor *owner=NULL); AActor *P_SpawnMissileAngleZSpeed (AActor *source, fixed_t z, const PClass *type, angle_t angle, fixed_t momz, fixed_t speed, AActor *owner=NULL);
AActor *P_SpawnMissileZAimed (AActor *source, fixed_t z, AActor *dest, const TypeInfo *type); AActor *P_SpawnMissileZAimed (AActor *source, fixed_t z, AActor *dest, const PClass *type);
AActor *P_SpawnPlayerMissile (AActor* source, const TypeInfo *type); AActor *P_SpawnPlayerMissile (AActor* source, const PClass *type);
AActor *P_SpawnPlayerMissile (AActor *source, const TypeInfo *type, angle_t angle); AActor *P_SpawnPlayerMissile (AActor *source, const PClass *type, angle_t angle);
AActor *P_SpawnPlayerMissile (AActor *source, fixed_t x, fixed_t y, fixed_t z, const TypeInfo *type, angle_t angle); AActor *P_SpawnPlayerMissile (AActor *source, fixed_t x, fixed_t y, fixed_t z, const PClass *type, angle_t angle);
void P_CheckFakeFloorTriggers (AActor *mo, fixed_t oldz); void P_CheckFakeFloorTriggers (AActor *mo, fixed_t oldz);
@ -123,7 +123,7 @@ void P_CheckFakeFloorTriggers (AActor *mo, fixed_t oldz);
// [RH] P_THINGS // [RH] P_THINGS
// //
#define MAX_SPAWNABLES (256) #define MAX_SPAWNABLES (256)
extern const TypeInfo *SpawnableThings[MAX_SPAWNABLES]; extern const PClass *SpawnableThings[MAX_SPAWNABLES];
bool P_Thing_Spawn (int tid, int type, angle_t angle, bool fog, int newtid); bool P_Thing_Spawn (int tid, int type, angle_t angle, bool fog, int newtid);
bool P_Thing_Projectile (int tid, int type, angle_t angle, bool P_Thing_Projectile (int tid, int type, angle_t angle,
@ -298,7 +298,7 @@ extern AActor* linetarget; // who got hit (or NULL)
extern AActor *PuffSpawned; // points to last puff spawned extern AActor *PuffSpawned; // points to last puff spawned
fixed_t P_AimLineAttack (AActor *t1, angle_t angle, fixed_t distance, fixed_t vrange=0); fixed_t P_AimLineAttack (AActor *t1, angle_t angle, fixed_t distance, fixed_t vrange=0);
void P_LineAttack (AActor *t1, angle_t angle, fixed_t distance, int pitch, int damage, int damageType, const TypeInfo *pufftype); void P_LineAttack (AActor *t1, angle_t angle, fixed_t distance, int pitch, int damage, int damageType, const PClass *pufftype);
void P_TraceBleed (int damage, fixed_t x, fixed_t y, fixed_t z, AActor *target, angle_t angle, int pitch); void P_TraceBleed (int damage, fixed_t x, fixed_t y, fixed_t z, AActor *target, angle_t angle, int pitch);
void P_TraceBleed (int damage, AActor *target, angle_t angle, int pitch); void P_TraceBleed (int damage, AActor *target, angle_t angle, int pitch);
void P_TraceBleed (int damage, AActor *target, AActor *missile); // missile version void P_TraceBleed (int damage, AActor *target, AActor *missile); // missile version
@ -347,7 +347,7 @@ void P_TouchSpecialThing (AActor *special, AActor *toucher);
void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, int mod, int flags=0); void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, int mod, int flags=0);
bool P_GiveBody (AActor *actor, int num); bool P_GiveBody (AActor *actor, int num);
bool P_MorphPlayer (player_t *player, const TypeInfo *morphClass); bool P_MorphPlayer (player_t *player, const PClass *morphClass);
void P_PoisonPlayer (player_t *player, AActor *poisoner, AActor *source, int poison); void P_PoisonPlayer (player_t *player, AActor *poisoner, AActor *source, int poison);
void P_PoisonDamage (player_t *player, AActor *source, int damage, bool playPainSound); void P_PoisonDamage (player_t *player, AActor *source, int damage, bool playPainSound);

View file

@ -2674,7 +2674,7 @@ static bool CheckForSpectral (FTraceResults &res)
} }
void P_LineAttack (AActor *t1, angle_t angle, fixed_t distance, void P_LineAttack (AActor *t1, angle_t angle, fixed_t distance,
int pitch, int damage, int damageType, const TypeInfo *pufftype) int pitch, int damage, int damageType, const PClass *pufftype)
{ {
fixed_t vx, vy, vz, shootz; fixed_t vx, vy, vz, shootz;
FTraceResults trace; FTraceResults trace;
@ -4313,7 +4313,7 @@ msecnode_t *P_AddSecnode (sector_t *s, AActor *thing, msecnode_t *nextnode)
if (s == 0) if (s == 0)
{ {
I_FatalError ("AddSecnode of 0 for %s\n", thing->_StaticType.Name); I_FatalError ("AddSecnode of 0 for %s\n", thing->_StaticType.TypeName.GetChars());
} }
node = nextnode; node = nextnode;

View file

@ -551,7 +551,7 @@ sector_t *AActor::LinkToWorldForMapThing ()
if (num >= 0 && num <= den) if (num >= 0 && num <= den)
{ {
DPrintf ("%s at (%ld,%ld) lies directly on line %d\n", DPrintf ("%s at (%ld,%ld) lies directly on line %d\n",
this->GetClass()->Name+1, x>>FRACBITS, y>>FRACBITS, ldef-lines); this->GetClass()->TypeName.GetChars(), x>>FRACBITS, y>>FRACBITS, ldef-lines);
angle_t finean = R_PointToAngle2 (0, 0, ldef->dx, ldef->dy); angle_t finean = R_PointToAngle2 (0, 0, ldef->dx, ldef->dy);
if (ldef->backsector != NULL && ldef->backsector == ssec->sector) if (ldef->backsector != NULL && ldef->backsector == ssec->sector)
{ {

View file

@ -416,7 +416,6 @@ void MapThing::Serialize (FArchive &arc)
AActor::AActor () throw() AActor::AActor () throw()
{ {
memset (&x, 0, (byte *)&this[1] - (byte *)&x);
} }
AActor::AActor (const AActor &other) throw() AActor::AActor (const AActor &other) throw()
@ -765,7 +764,7 @@ AInventory *AActor::DropInventory (AInventory *item)
// //
//============================================================================ //============================================================================
AInventory *AActor::FindInventory (const TypeInfo *type) const AInventory *AActor::FindInventory (const PClass *type) const
{ {
AInventory *item; AInventory *item;
@ -785,7 +784,7 @@ AInventory *AActor::FindInventory (const TypeInfo *type) const
// //
//============================================================================ //============================================================================
AInventory *AActor::GiveInventoryType (const TypeInfo *type) AInventory *AActor::GiveInventoryType (const PClass *type)
{ {
AInventory *item; AInventory *item;
@ -806,7 +805,7 @@ AInventory *AActor::GiveInventoryType (const TypeInfo *type)
// //
//============================================================================ //============================================================================
bool AActor::GiveAmmo (const TypeInfo *type, int amount) bool AActor::GiveAmmo (const PClass *type, int amount)
{ {
AInventory *item = static_cast<AInventory *>(Spawn (type, 0, 0, 0)); AInventory *item = static_cast<AInventory *>(Spawn (type, 0, 0, 0));
item->Amount = amount; item->Amount = amount;
@ -2992,7 +2991,7 @@ END_DEFAULTS
// //
//========================================================================== //==========================================================================
AActor *AActor::StaticSpawn (const TypeInfo *type, fixed_t ix, fixed_t iy, fixed_t iz) AActor *AActor::StaticSpawn (const PClass *type, fixed_t ix, fixed_t iy, fixed_t iz)
{ {
if (type == NULL) if (type == NULL)
{ {
@ -3001,12 +3000,12 @@ AActor *AActor::StaticSpawn (const TypeInfo *type, fixed_t ix, fixed_t iy, fixed
if (type->ActorInfo == NULL) if (type->ActorInfo == NULL)
{ {
I_Error ("%s is not an actor\n", type->Name); I_Error ("%s is not an actor\n", type->TypeName.GetChars());
} }
AActor *actor; AActor *actor;
actor = static_cast<AActor *>(const_cast<TypeInfo *>(type)->CreateNew ()); actor = static_cast<AActor *>(const_cast<PClass *>(type)->CreateNew ());
actor->x = actor->PrevX = ix; actor->x = actor->PrevX = ix;
actor->y = actor->PrevY = iy; actor->y = actor->PrevY = iy;
@ -3323,19 +3322,19 @@ void P_SpawnPlayer (mapthing2_t *mthing)
p->CurrentPlayerClass = 0; p->CurrentPlayerClass = 0;
if (gameinfo.gametype == GAME_Doom) if (gameinfo.gametype == GAME_Doom)
{ {
p->cls = TypeInfo::FindType ("DoomPlayer"); p->cls = PClass::FindClass (NAME_DoomPlayer);
} }
else if (gameinfo.gametype == GAME_Heretic) else if (gameinfo.gametype == GAME_Heretic)
{ {
p->cls = TypeInfo::FindType ("HereticPlayer"); p->cls = PClass::FindClass (NAME_HereticPlayer);
} }
else if (gameinfo.gametype == GAME_Strife) else if (gameinfo.gametype == GAME_Strife)
{ {
p->cls = TypeInfo::FindType ("StrifePlayer"); p->cls = PClass::FindClass (NAME_StrifePlayer);
} }
else else
{ {
static const char *classes[3] = { "FighterPlayer", "ClericPlayer", "MagePlayer" }; static const ENamedName classes[3] = { NAME_FighterPlayer, NAME_ClericPlayer, NAME_MagePlayer };
int type; int type;
if (!deathmatch || !multiplayer) if (!deathmatch || !multiplayer)
@ -3351,7 +3350,7 @@ void P_SpawnPlayer (mapthing2_t *mthing)
} }
} }
p->CurrentPlayerClass = type; p->CurrentPlayerClass = type;
p->cls = TypeInfo::FindType (classes[type]); p->cls = PClass::FindClass (classes[type]);
} }
} }
@ -3429,14 +3428,14 @@ void P_SpawnPlayer (mapthing2_t *mthing)
// give all cards in death match mode // give all cards in death match mode
if (deathmatch) if (deathmatch)
{ {
for (i = 0; i < TypeInfo::m_Types.Size(); ++i) for (i = 0; i < PClass::m_Types.Size(); ++i)
{ {
if (TypeInfo::m_Types[i]->IsDescendantOf (RUNTIME_CLASS(AKey))) if (PClass::m_Types[i]->IsDescendantOf (RUNTIME_CLASS(AKey)))
{ {
AKey *key = (AKey *)GetDefaultByType (TypeInfo::m_Types[i]); AKey *key = (AKey *)GetDefaultByType (PClass::m_Types[i]);
if (key->KeyNumber != 0) if (key->KeyNumber != 0)
{ {
key = static_cast<AKey *>(Spawn (TypeInfo::m_Types[i], 0,0,0)); key = static_cast<AKey *>(Spawn (PClass::m_Types[i], 0,0,0));
if (!key->TryPickup (p->mo)) if (!key->TryPickup (p->mo))
{ {
key->Destroy (); key->Destroy ();
@ -3490,7 +3489,7 @@ void P_SpawnPlayer (mapthing2_t *mthing)
// [RH] position is used to weed out unwanted start spots // [RH] position is used to weed out unwanted start spots
void P_SpawnMapThing (mapthing2_t *mthing, int position) void P_SpawnMapThing (mapthing2_t *mthing, int position)
{ {
const TypeInfo *i; const PClass *i;
int mask; int mask;
AActor *mobj; AActor *mobj;
fixed_t x, y, z; fixed_t x, y, z;
@ -3709,7 +3708,7 @@ void P_SpawnMapThing (mapthing2_t *mthing, int position)
sprites[defaults->SpawnState->sprite.index].numframes == 0) sprites[defaults->SpawnState->sprite.index].numframes == 0)
{ {
Printf ("%s at (%i, %i) has no frames\n", Printf ("%s at (%i, %i) has no frames\n",
i->Name+1, mthing->x, mthing->y); i->TypeName.GetChars(), mthing->x, mthing->y);
i = RUNTIME_CLASS(AUnknown); i = RUNTIME_CLASS(AUnknown);
} }
} }
@ -3743,11 +3742,11 @@ void P_SpawnMapThing (mapthing2_t *mthing, int position)
{ {
if (i->IsDescendantOf (RUNTIME_CLASS(AHealth))) if (i->IsDescendantOf (RUNTIME_CLASS(AHealth)))
return; return;
if (strcmp (i->Name, "Berserk") == 0) if (i->TypeName == NAME_Berserk)
return; return;
if (strcmp (i->Name, "Soulsphere") == 0) if (i->TypeName == NAME_Soulsphere)
return; return;
if (strcmp (i->Name, "Megasphere") == 0) if (i->TypeName == NAME_Megasphere)
return; return;
} }
if (dmflags & DF_NO_ITEMS) if (dmflags & DF_NO_ITEMS)
@ -3759,7 +3758,7 @@ void P_SpawnMapThing (mapthing2_t *mthing, int position)
{ {
if (i->IsDescendantOf (RUNTIME_CLASS(AArmor))) if (i->IsDescendantOf (RUNTIME_CLASS(AArmor)))
return; return;
if (strcmp (i->Name, "Megasphere") == 0) if (i->TypeName == NAME_Megasphere)
return; return;
} }
} }
@ -3818,7 +3817,7 @@ void P_SpawnMapThing (mapthing2_t *mthing, int position)
// P_SpawnPuff // P_SpawnPuff
// //
AActor *P_SpawnPuff (const TypeInfo *pufftype, fixed_t x, fixed_t y, fixed_t z, angle_t dir, int updown, bool hitthing) AActor *P_SpawnPuff (const PClass *pufftype, fixed_t x, fixed_t y, fixed_t z, angle_t dir, int updown, bool hitthing)
{ {
AActor *puff; AActor *puff;
@ -4226,19 +4225,19 @@ bool P_CheckMissileSpawn (AActor* th)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
AActor *P_SpawnMissile (AActor *source, AActor *dest, const TypeInfo *type) AActor *P_SpawnMissile (AActor *source, AActor *dest, const PClass *type)
{ {
return P_SpawnMissileXYZ (source->x, source->y, source->z + 32*FRACUNIT, return P_SpawnMissileXYZ (source->x, source->y, source->z + 32*FRACUNIT,
source, dest, type); source, dest, type);
} }
AActor *P_SpawnMissileZ (AActor *source, fixed_t z, AActor *dest, const TypeInfo *type) AActor *P_SpawnMissileZ (AActor *source, fixed_t z, AActor *dest, const PClass *type)
{ {
return P_SpawnMissileXYZ (source->x, source->y, z, source, dest, type); return P_SpawnMissileXYZ (source->x, source->y, z, source, dest, type);
} }
AActor *P_SpawnMissileXYZ (fixed_t x, fixed_t y, fixed_t z, AActor *P_SpawnMissileXYZ (fixed_t x, fixed_t y, fixed_t z,
AActor *source, AActor *dest, const TypeInfo *type) AActor *source, AActor *dest, const PClass *type)
{ {
int defflags3 = GetDefaultByType (type)->flags3; int defflags3 = GetDefaultByType (type)->flags3;
@ -4315,7 +4314,7 @@ AActor *P_SpawnMissileXYZ (fixed_t x, fixed_t y, fixed_t z,
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
AActor *P_SpawnMissileAngle (AActor *source, const TypeInfo *type, AActor *P_SpawnMissileAngle (AActor *source, const PClass *type,
angle_t angle, fixed_t momz) angle_t angle, fixed_t momz)
{ {
return P_SpawnMissileAngleZSpeed (source, source->z + 32*FRACUNIT, return P_SpawnMissileAngleZSpeed (source, source->z + 32*FRACUNIT,
@ -4323,13 +4322,13 @@ AActor *P_SpawnMissileAngle (AActor *source, const TypeInfo *type,
} }
AActor *P_SpawnMissileAngleZ (AActor *source, fixed_t z, AActor *P_SpawnMissileAngleZ (AActor *source, fixed_t z,
const TypeInfo *type, angle_t angle, fixed_t momz) const PClass *type, angle_t angle, fixed_t momz)
{ {
return P_SpawnMissileAngleZSpeed (source, z, type, angle, momz, return P_SpawnMissileAngleZSpeed (source, z, type, angle, momz,
GetDefaultByType (type)->Speed); GetDefaultByType (type)->Speed);
} }
AActor *P_SpawnMissileZAimed (AActor *source, fixed_t z, AActor *dest, const TypeInfo *type) AActor *P_SpawnMissileZAimed (AActor *source, fixed_t z, AActor *dest, const PClass *type)
{ {
angle_t an; angle_t an;
fixed_t dist; fixed_t dist;
@ -4358,7 +4357,7 @@ AActor *P_SpawnMissileZAimed (AActor *source, fixed_t z, AActor *dest, const Typ
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
AActor *P_SpawnMissileAngleSpeed (AActor *source, const TypeInfo *type, AActor *P_SpawnMissileAngleSpeed (AActor *source, const PClass *type,
angle_t angle, fixed_t momz, fixed_t speed) angle_t angle, fixed_t momz, fixed_t speed)
{ {
return P_SpawnMissileAngleZSpeed (source, source->z + 32*FRACUNIT, return P_SpawnMissileAngleZSpeed (source, source->z + 32*FRACUNIT,
@ -4366,7 +4365,7 @@ AActor *P_SpawnMissileAngleSpeed (AActor *source, const TypeInfo *type,
} }
AActor *P_SpawnMissileAngleZSpeed (AActor *source, fixed_t z, AActor *P_SpawnMissileAngleZSpeed (AActor *source, fixed_t z,
const TypeInfo *type, angle_t angle, fixed_t momz, fixed_t speed, AActor *owner) const PClass *type, angle_t angle, fixed_t momz, fixed_t speed, AActor *owner)
{ {
AActor *mo; AActor *mo;
int defflags3 = GetDefaultByType (type)->flags3; int defflags3 = GetDefaultByType (type)->flags3;
@ -4406,18 +4405,18 @@ AActor *P_SpawnMissileAngleZSpeed (AActor *source, fixed_t z,
================ ================
*/ */
AActor *P_SpawnPlayerMissile (AActor *source, const TypeInfo *type) AActor *P_SpawnPlayerMissile (AActor *source, const PClass *type)
{ {
return P_SpawnPlayerMissile (source, source->x, source->y, source->z, type, source->angle); return P_SpawnPlayerMissile (source, source->x, source->y, source->z, type, source->angle);
} }
AActor *P_SpawnPlayerMissile (AActor *source, const TypeInfo *type, angle_t angle) AActor *P_SpawnPlayerMissile (AActor *source, const PClass *type, angle_t angle)
{ {
return P_SpawnPlayerMissile (source, source->x, source->y, source->z, type, angle); return P_SpawnPlayerMissile (source, source->x, source->y, source->z, type, angle);
} }
AActor *P_SpawnPlayerMissile (AActor *source, fixed_t x, fixed_t y, fixed_t z, AActor *P_SpawnPlayerMissile (AActor *source, fixed_t x, fixed_t y, fixed_t z,
const TypeInfo *type, angle_t angle) const PClass *type, angle_t angle)
{ {
static const int angdiff[3] = { -1<<26, 1<<26, 0 }; static const int angdiff[3] = { -1<<26, 1<<26, 0 };
int i; int i;
@ -4509,16 +4508,16 @@ bool AActor::IsTeammate (AActor *other)
// //
//========================================================================== //==========================================================================
const TypeInfo *AActor::GetSpecies() const PClass *AActor::GetSpecies()
{ {
const TypeInfo *thistype = GetClass(); const PClass *thistype = GetClass();
if (GetDefaultByType(thistype)->flags3 & MF3_ISMONSTER) if (GetDefaultByType(thistype)->flags3 & MF3_ISMONSTER)
{ {
while (thistype->ParentType) while (thistype->ParentClass)
{ {
if (GetDefaultByType(thistype->ParentType)->flags3 & MF3_ISMONSTER) if (GetDefaultByType(thistype->ParentClass)->flags3 & MF3_ISMONSTER)
thistype = thistype->ParentType; thistype = thistype->ParentClass;
else else
break; break;
} }

View file

@ -703,7 +703,7 @@ void P_BulletSlope (AActor *mo)
// //
// P_GunShot // P_GunShot
// //
void P_GunShot (AActor *mo, BOOL accurate, const TypeInfo *pufftype) void P_GunShot (AActor *mo, BOOL accurate, const PClass *pufftype)
{ {
angle_t angle; angle_t angle;
int damage; int damage;

Some files were not shown because too many files have changed in this diff Show more