Duke4.net Forums: [Mutator] Turn dead player view towards monster - Duke4.net Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[Mutator] Turn dead player view towards monster  "Restoration of original behavior"

User is offline   Darkus 

#1

I don't know if this deserves its own thread (or put this in problems/bugs thread), but in original game, when a monster kills you, the player's view turn towards the one who gave you the lethal attack. Maybe it's a bug or it was disabled on purpose, but it's been some time EDuke don't do this.

I made a mutator that restores this behavior, to use it, just copy/paste the following code in a text file, and launch EDuke with command line '-mx yourfile.txt'. It should also be compatible with the most of mods.

gamevar MUTWACK_TEMP1 0 0
gamevar MUTWACK_TEMP2 0 0
gamevar MUTWACK_ANG 0 1

defstate mutturndeadplayer
  ifvarn player[THISACTOR].wackedbyactor -1
  { ifvarvare player[THISACTOR].wackedbyactor player[THISACTOR].i
      break
    getactor[player[THISACTOR].wackedbyactor].x MUTWACK_TEMP1
    getactor[player[THISACTOR].wackedbyactor].y MUTWACK_TEMP2
    subvarvar MUTWACK_TEMP1 player[THISACTOR].posx
    subvarvar MUTWACK_TEMP2 player[THISACTOR].posy
    getangle MUTWACK_ANG MUTWACK_TEMP1 MUTWACK_TEMP2

    getincangle MUTWACK_TEMP1 player[THISACTOR].ang MUTWACK_ANG

    ifvarg MUTWACK_TEMP1 64 setvar MUTWACK_TEMP1 64
    else ifvarl MUTWACK_TEMP1 -64 setvar MUTWACK_TEMP1 -64

    else
    { setplayer[THISACTOR].ang MUTWACK_ANG
      setvar MUTWACK_TEMP1 0
    }

    ifvare MUTWACK_TEMP1 0
      break

    getplayer[THISACTOR].ang MUTWACK_ANG
    addvarvar MUTWACK_ANG MUTWACK_TEMP1
    setplayer[THISACTOR].ang MUTWACK_ANG
  }
ends

onevent EVENT_GAME
  ifactor APLAYER
  { ifp pdead
    { ifaction PFROZEN
        break
      state mutturndeadplayer
    }
    else ifvarn player[THISACTOR].wackedbyactor -1
      setplayer[THISACTOR].wackedbyactor -1
  }
endevent

2

User is offline   Danukem 

  • Duke Plus Developer

#2

For bonus credit you could also make the .horiz turn up/down to the enemy -- would look better if you got killed by RECON or some other enemy above you.
0

User is offline   RPD Guy 

#3

View PostTrooper Dan, on 25 March 2020 - 12:21 PM, said:

For bonus credit you could also make the .horiz turn up/down to the enemy -- would look better if you got killed by RECON or some other enemy above you.


I was thinking the same here, good idea...
Also I would like to thank you Darkus for your contribution with the community. ;)
0

User is offline   Darkus 

#4

View PostTrooper Dan, on 25 March 2020 - 12:21 PM, said:

For bonus credit you could also make the .horiz turn up/down to the enemy -- would look better if you got killed by RECON or some other enemy above you.


Here it is, an alternate version that also view up/down. I got little trouble for getting correct aiming according to tile/sprite sizes, but I think I got it right. Be careful to not use in addition with the version above, just choose one or the other.

EDIT: For some reason, in the code I posted, there's one line that is not displayed correctly, the .ysize MUTWACK_TEMP1 is one line below, making it non working. It should be in the line above like:

gettiledata[sprite[player[THISACTOR].wackedbyactor].picnum].ysize MUTWACK_TEMP1

gamevar MUTWACK_TEMP1 0 0
gamevar MUTWACK_TEMP2 0 0
gamevar MUTWACK_ANG 0 1
gamevar MUTWACK_ZANG 0 1

defstate mutverticaldeadplayer
  getactor[player[THISACTOR].wackedbyactor].z MUTWACK_TEMP2
  gettiledata[sprite[player[THISACTOR].wackedbyactor].picnum]
.ysize MUTWACK_TEMP1
  ifvarg MUTWACK_TEMP1 0
  { mulvar MUTWACK_TEMP1 256
    mulvarvar MUTWACK_TEMP1 sprite[player[THISACTOR].wackedbyactor].yrepeat
    divvar MUTWACK_TEMP1 100
  }
  subvarvar MUTWACK_TEMP2 MUTWACK_TEMP1

  ldist MUTWACK_TEMP1 THISACTOR player[THISACTOR].wackedbyactor
  getplayer[THISACTOR].posz MUTWACK_ZANG

  subvarvar MUTWACK_ZANG MUTWACK_TEMP2
  divvar MUTWACK_TEMP1 8
  ifvarg MUTWACK_TEMP1 0
    divvarvar MUTWACK_ZANG MUTWACK_TEMP1
  addvar MUTWACK_ZANG 100
  setplayer[THISACTOR].horiz MUTWACK_ZANG
ends

defstate mutturndeadplayer
  ifvarn player[THISACTOR].wackedbyactor -1
  { ifvarvare player[THISACTOR].wackedbyactor player[THISACTOR].i
      break

    state mutverticaldeadplayer

    getactor[player[THISACTOR].wackedbyactor].x MUTWACK_TEMP1
    getactor[player[THISACTOR].wackedbyactor].y MUTWACK_TEMP2
    subvarvar MUTWACK_TEMP1 player[THISACTOR].posx
    subvarvar MUTWACK_TEMP2 player[THISACTOR].posy
    getangle MUTWACK_ANG MUTWACK_TEMP1 MUTWACK_TEMP2

    getincangle MUTWACK_TEMP1 player[THISACTOR].ang MUTWACK_ANG

    ifvarg MUTWACK_TEMP1 64 setvar MUTWACK_TEMP1 64
    else ifvarl MUTWACK_TEMP1 -64 setvar MUTWACK_TEMP1 -64

    else
    { setplayer[THISACTOR].ang MUTWACK_ANG
      setvar MUTWACK_TEMP1 0
    }

    ifvare MUTWACK_TEMP1 0
      break

    getplayer[THISACTOR].ang MUTWACK_ANG
    addvarvar MUTWACK_ANG MUTWACK_TEMP1
    setplayer[THISACTOR].ang MUTWACK_ANG
  }
ends

onevent EVENT_GAME
  ifactor APLAYER
  { ifp pdead
    { ifaction PFROZEN
        break
      state mutturndeadplayer
    }
    else ifvarn player[THISACTOR].wackedbyactor -1
      setplayer[THISACTOR].wackedbyactor -1
  }
endevent


This post has been edited by Darkus: 26 March 2020 - 04:59 AM

0

User is offline   Darkus 

#5

Sorry double post! But I decided to upload the files, for more convenience.

Also changed one line (ifaction PFROZEN to ifvare sprite[THISACTOR].pal 1) to increase compatibility with mods. There should be no more updates, unless I missed something. The two versions and instructions are included.

Attached File  wackedview.zip (1.66K)
Number of downloads: 89
0

User is offline   LeoD 

  • Duke4.net topic/3513

#6

Bisected to r6725 as the culprit.
1

User is offline   TerminX 

  • el fundador

  #7

Thanks, will look into this one soon.
0

User is offline   TerminX 

  • el fundador

  #8

Fixed.
1

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic


All copyrights and trademarks not owned by Voidpoint, LLC are the sole property of their respective owners. Play Ion Fury! ;) © Voidpoint, LLC

Enter your sign in name and password


Sign in options