MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / SetPolymodelProperties

Function SetPolymodelProperties

model/polymodel.cpp:1003–1228  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1001}
1002
1003void SetPolymodelProperties(bsp_info *subobj, char *props) {
1004 // first, extract the command
1005
1006 int len, i;
1007 char command[200], data[200];
1008
1009 len = strlen(props);
1010
1011 if (len < 3)
1012 return; // nothing to set!
1013
1014 for (i = 0; i < len; i++) {
1015 command[i] = props[i];
1016 if (command[i] == '=') {
1017 i++;
1018 break; // we've found some data!
1019 }
1020 }
1021
1022 command[i] = 0;
1023
1024 if (len != i) {
1025 int datastart = i;
1026
1027 for (; i < len; i++) {
1028 data[i - datastart] = props[i];
1029 }
1030 data[i - datastart] = 0;
1031 }
1032
1033 // now act on the command/data pair
1034
1035 if (!stricmp(command, "$rotate=")) {
1036 // constant rotation for a subobject
1037 float spinrate = atof(data);
1038
1039 if (spinrate <= 0 || spinrate > 20)
1040 return; // bad data
1041
1042 subobj->flags |= SOF_ROTATE;
1043 subobj->rps = 1.0f / spinrate;
1044
1045 return;
1046 }
1047
1048 if (!strnicmp(command, "$jitter", 7)) {
1049 // this subobject is a jittery object
1050 subobj->flags |= SOF_JITTER;
1051
1052 return;
1053 }
1054
1055 if (!strnicmp(command, "$shell", 6)) {
1056 // this subobject is a door shell
1057
1058 subobj->flags |= SOF_SHELL;
1059
1060 return;

Callers 1

ReadNewModelFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected