| 1157 | } |
| 1158 | |
| 1159 | void PM_ChangeLightOff(int pnum) |
| 1160 | { |
| 1161 | int x, y; |
| 1162 | int xmul, ymul; |
| 1163 | int lx, ly; |
| 1164 | int offx, offy; |
| 1165 | const LightListStruct *l; |
| 1166 | |
| 1167 | if ((DWORD)pnum >= MAX_PLRS) { |
| 1168 | app_fatal("PM_ChangeLightOff: illegal player %d", pnum); |
| 1169 | } |
| 1170 | |
| 1171 | // check if issue is upstream |
| 1172 | if(plr[pnum]._plid == -1) |
| 1173 | return; |
| 1174 | |
| 1175 | l = &LightList[plr[pnum]._plid]; |
| 1176 | x = 2 * plr[pnum]._pyoff + plr[pnum]._pxoff; |
| 1177 | y = 2 * plr[pnum]._pyoff - plr[pnum]._pxoff; |
| 1178 | if (x < 0) { |
| 1179 | xmul = -1; |
| 1180 | x = -x; |
| 1181 | } else { |
| 1182 | xmul = 1; |
| 1183 | } |
| 1184 | if (y < 0) { |
| 1185 | ymul = -1; |
| 1186 | y = -y; |
| 1187 | } else { |
| 1188 | ymul = 1; |
| 1189 | } |
| 1190 | |
| 1191 | x = (x >> 3) * xmul; |
| 1192 | y = (y >> 3) * ymul; |
| 1193 | lx = x + (l->_lx << 3); |
| 1194 | ly = y + (l->_ly << 3); |
| 1195 | offx = l->_xoff + (l->_lx << 3); |
| 1196 | offy = l->_yoff + (l->_ly << 3); |
| 1197 | |
| 1198 | if (abs(lx - offx) < 3 && abs(ly - offy) < 3) |
| 1199 | return; |
| 1200 | |
| 1201 | ChangeLightOff(plr[pnum]._plid, x, y); |
| 1202 | } |
| 1203 | |
| 1204 | void PM_ChangeOffset(int pnum) |
| 1205 | { |
no test coverage detected