-
Notifications
You must be signed in to change notification settings - Fork 351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor idGameEdit #369
base: master
Are you sure you want to change the base?
Refactor idGameEdit #369
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -239,8 +239,87 @@ class idProgram; | |
class idInterpreter; | ||
typedef struct prstack_s prstack_t; | ||
|
||
// FIXME: this interface needs to be reworked but it properly separates code for the time being | ||
class idGameEdit { | ||
|
||
class idGameEditBase { | ||
public: | ||
virtual ~idGameEditBase( void ) {} | ||
|
||
// These are the canonical idDict to parameter parsing routines used by both the game and tools. | ||
virtual void ParseSpawnArgsToRenderLight( const idDict *args, renderLight_t *renderLight ) = 0; | ||
virtual void ParseSpawnArgsToRenderEntity( const idDict *args, renderEntity_t *renderEntity ) = 0; | ||
virtual void ParseSpawnArgsToRefSound( const idDict *args, refSound_t *refSound ) = 0; | ||
|
||
// Animation system calls for non-game based skeletal rendering. | ||
virtual idRenderModel * ANIM_GetModelFromEntityDef( const char *classname ) = 0; | ||
virtual const idVec3 &ANIM_GetModelOffsetFromEntityDef( const char *classname ) = 0; | ||
virtual idRenderModel * ANIM_GetModelFromEntityDef( const idDict *args ) = 0; | ||
virtual idRenderModel * ANIM_GetModelFromName( const char *modelName ) = 0; | ||
virtual const idMD5Anim * ANIM_GetAnimFromEntityDef( const char *classname, const char *animname ) = 0; | ||
virtual int ANIM_GetNumAnimsFromEntityDef( const idDict *args ) = 0; | ||
virtual const char * ANIM_GetAnimNameFromEntityDef( const idDict *args, int animNum ) = 0; | ||
virtual const idMD5Anim * ANIM_GetAnim( const char *fileName ) = 0; | ||
virtual int ANIM_GetLength( const idMD5Anim *anim ) = 0; | ||
virtual int ANIM_GetNumFrames( const idMD5Anim *anim ) = 0; | ||
virtual void ANIM_CreateAnimFrame( const idRenderModel *model, const idMD5Anim *anim, int numJoints, idJointMat *frame, int time, const idVec3 &offset, bool remove_origin_offset ) = 0; | ||
virtual idRenderModel * ANIM_CreateMeshForAnim( idRenderModel *model, const char *classname, const char *animname, int frame, bool remove_origin_offset ) = 0; | ||
|
||
// Articulated Figure calls for AF editor and Radiant. | ||
virtual bool AF_SpawnEntity( const char *fileName ) = 0; | ||
virtual void AF_UpdateEntities( const char *fileName ) = 0; | ||
virtual void AF_UndoChanges( void ) = 0; | ||
virtual idRenderModel * AF_CreateMesh( const idDict &args, idVec3 &meshOrigin, idMat3 &meshAxis, bool &poseIsSet ) = 0; | ||
|
||
|
||
// Entity selection. | ||
virtual void ClearEntitySelection( void ) = 0; | ||
virtual int GetSelectedEntities( idEntity *list[], int max ) = 0; | ||
virtual void AddSelectedEntity( idEntity *ent ) = 0; | ||
|
||
// Selection methods | ||
virtual void TriggerSelected() = 0; | ||
|
||
// Entity defs and spawning. | ||
virtual const idDict * FindEntityDefDict( const char *name, bool makeDefault = true ) const = 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See my comment on line 311. |
||
virtual void SpawnEntityDef( const idDict &args, idEntity **ent ) = 0; | ||
virtual idEntity * FindEntity( const char *name ) const = 0; | ||
virtual const char * GetUniqueEntityName( const char *classname ) const = 0; | ||
|
||
// Entity methods. | ||
virtual void EntityGetOrigin( idEntity *ent, idVec3 &org ) const = 0; | ||
virtual void EntityGetAxis( idEntity *ent, idMat3 &axis ) const = 0; | ||
virtual void EntitySetOrigin( idEntity *ent, const idVec3 &org ) = 0; | ||
virtual void EntitySetAxis( idEntity *ent, const idMat3 &axis ) = 0; | ||
virtual void EntityTranslate( idEntity *ent, const idVec3 &org ) = 0; | ||
virtual const idDict * EntityGetSpawnArgs( idEntity *ent ) const = 0; | ||
virtual void EntityUpdateChangeableSpawnArgs( idEntity *ent, const idDict *dict ) = 0; | ||
virtual void EntityChangeSpawnArgs( idEntity *ent, const idDict *newArgs ) = 0; | ||
virtual void EntityUpdateVisuals( idEntity *ent ) = 0; | ||
virtual void EntitySetModel( idEntity *ent, const char *val ) = 0; | ||
virtual void EntityStopSound( idEntity *ent ) = 0; | ||
virtual void EntityDelete( idEntity *ent ) = 0; | ||
virtual void EntitySetColor( idEntity *ent, const idVec3 color ) = 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Second parameter is copied. |
||
|
||
// Player methods. | ||
virtual bool PlayerIsValid() const = 0; | ||
virtual void PlayerGetOrigin( idVec3 &org ) const = 0; | ||
virtual void PlayerGetAxis( idMat3 &axis ) const = 0; | ||
virtual void PlayerGetViewAngles( idAngles &angles ) const = 0; | ||
virtual void PlayerGetEyePosition( idVec3 &org ) const = 0; | ||
|
||
// In game map editing support. | ||
virtual const idDict * MapGetEntityDict( const char *name ) const = 0; | ||
virtual void MapSave( const char *path = NULL ) const = 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚑 |
||
virtual void MapSetEntityKeyVal( const char *name, const char *key, const char *val ) const = 0; | ||
virtual void MapCopyDictToEntity( const char *name, const idDict *dict ) const = 0; | ||
virtual int MapGetUniqueMatchingKeyVals( const char *key, const char *list[], const int max ) const = 0; | ||
virtual void MapAddEntity( const idDict *dict ) const = 0; | ||
virtual int MapGetEntitiesMatchingClassWithString( const char *classname, const char *match, const char *list[], const int max ) const = 0; | ||
virtual void MapRemoveEntity( const char *name ) const = 0; | ||
virtual void MapEntityTranslate( const char *name, const idVec3 &v ) const = 0; | ||
}; | ||
|
||
|
||
class idGameEdit : public idGameEditBase { | ||
public: | ||
virtual ~idGameEdit( void ) {} | ||
|
||
|
@@ -318,7 +397,7 @@ class idGameEdit { | |
virtual void MapEntityTranslate( const char *name, const idVec3 &v ) const; | ||
}; | ||
|
||
extern idGameEdit * gameEdit; | ||
extern idGameEditBase * gameEdit; | ||
|
||
// In game script Debugging Support | ||
class idGameEditExt : public idGameEdit { | ||
|
@@ -388,7 +467,7 @@ typedef struct { | |
|
||
int version; // API version | ||
idGame * game; // interface to run the game | ||
idGameEdit * gameEdit; // interface for in-game editing | ||
idGameEditBase * gameEdit; // interface for in-game editing | ||
|
||
} gameExport_t; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would expect
const
getters.