Skip to content

Commit

Permalink
Added 'Dead' to label's name when actor is a corpse #257
Browse files Browse the repository at this point in the history
Former-commit-id: 4e54c03
  • Loading branch information
mwydmuch committed Oct 19, 2017
1 parent 3db2e5f commit 89e4b15
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/lib/ViZDoomSharedMemory.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#define SM_REGION_COUNT 6

#define MAX_LABELS 256
#define MAX_LABEL_NAME_LEN 64
#define MAX_LABEL_NAME_LEN 128

namespace vizdoom {

Expand Down
9 changes: 8 additions & 1 deletion src/vizdoom/src/viz_game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ EXTERN_CVAR (Float, timelimit)

VIZGameState *vizGameStateSM = NULL;


/* Helper functions */
/*--------------------------------------------------------------------------------------------------------------------*/

Expand Down Expand Up @@ -126,6 +127,7 @@ int VIZ_CheckSlotWeapons(unsigned int slot){
return inSlot;
}


/* Main functions */
/*--------------------------------------------------------------------------------------------------------------------*/

Expand Down Expand Up @@ -287,7 +289,12 @@ void VIZ_GameStateUpdateLabels(){
for(auto i = vizLabels->sprites.begin(); i != vizLabels->sprites.end(); ++i){
if(i->labeled){
vizGameStateSM->LABEL[labelCount].objectId = i->actorId;
strncpy(vizGameStateSM->LABEL[labelCount].objectName, i->actor->GetClass()->TypeName.GetChars(), VIZ_MAX_LABEL_NAME_LEN);
//if(i->actor->health <= 0 || (i->actor->flags & MF_CORPSE) || (i->actor->flags6 & MF6_KILLED)) {
if((i->actor->flags & MF_CORPSE) || (i->actor->flags6 & MF6_KILLED)) {
strncpy(vizGameStateSM->LABEL[labelCount].objectName, "Dead", VIZ_MAX_LABEL_NAME_LEN);
strncpy(vizGameStateSM->LABEL[labelCount].objectName + 4, i->actor->GetClass()->TypeName.GetChars(), VIZ_MAX_LABEL_NAME_LEN - 4);
}
else strncpy(vizGameStateSM->LABEL[labelCount].objectName, i->actor->GetClass()->TypeName.GetChars(), VIZ_MAX_LABEL_NAME_LEN);
vizGameStateSM->LABEL[labelCount].value = i->label;
vizGameStateSM->LABEL[labelCount].objectPosition[0] = VIZ_FixedToDouble(i->position.x);
vizGameStateSM->LABEL[labelCount].objectPosition[1] = VIZ_FixedToDouble(i->position.y);
Expand Down
2 changes: 1 addition & 1 deletion src/vizdoom/src/viz_labels.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
#endif

#define VIZ_MAX_LABELS 256
#define VIZ_MAX_LABEL_NAME_LEN 64
#define VIZ_MAX_LABEL_NAME_LEN 128

struct VIZLabel{
unsigned int objectId;
Expand Down

0 comments on commit 89e4b15

Please sign in to comment.