by FDARI » Wed May 22, 2013 11:39 pm
Since the retrieved "viewheight" is a dynamic value (factoring other things than direct assignment) it isn't really a good candidate for an assignment counterpart.
Viewheight really returns "current viewheight", and your counterpart assignment function appears to set current viewheight as well. With your function, if you set the viewheight of a crouching player, the player will be a lot taller when standing up again.
I recommend SetActorBaseViewHeight and GetActorBaseViewHeight to have a pair of functions that act on the stored value without caring about crouching.
You can't assign to the return value of GetMetaFixed. That function just returns a number, it does not map to the place where it found that value, and therefore it cannot place your args[1] value anywhere. There may be such a function as SetMetaFixed, but I doubt it, and more importantly, it belongs to the actor class, so you shouldn't change it at all (because you would modify the entire class/every actor of that class, and because class definitions are part of the wad and not part of the saved game, so it would not persist).
It seems that a monster's camera height cannot be changed in this way. (Not without adding a property to the actor definition so that all actors can set their own viewheight anyway).
This leads to SetPlayerViewHeight and GetPlayerViewHeight setting and getting actor->player->mo->ViewHeight, and doing nothing/returning 0 for monsters. (The set function should probably return 0 in this case, to indicate that it could not perform the requested action)
NB: This is based on the code you put here, not on my own research of zdoom source.
Since the retrieved "viewheight" is a dynamic value (factoring other things than direct assignment) it isn't really a good candidate for an assignment counterpart.
Viewheight really returns "current viewheight", and your counterpart assignment function appears to set current viewheight as well. With your function, if you set the viewheight of a crouching player, the player will be a lot taller when standing up again.
I recommend SetActorBaseViewHeight and GetActorBaseViewHeight to have a pair of functions that act on the stored value without caring about crouching.
You can't assign to the return value of GetMetaFixed. That function just returns a number, it does not map to the place where it found that value, and therefore it cannot place your args[1] value anywhere. There may be such a function as SetMetaFixed, but I doubt it, and more importantly, it belongs to the actor class, so you shouldn't change it at all (because you would modify the entire class/every actor of that class, and because class definitions are part of the wad and not part of the saved game, so it would not persist).
It seems that a monster's camera height cannot be changed in this way. (Not without adding a property to the actor definition so that all actors can set their own viewheight anyway).
This leads to SetPlayerViewHeight and GetPlayerViewHeight setting and getting actor->player->mo->ViewHeight, and doing nothing/returning 0 for monsters. (The set function should probably return 0 in this case, to indicate that it could not perform the requested action)
NB: This is based on the code you put here, not on my own research of zdoom source.