| 18 |
|
|
| 19 |
|
uint16_t ONICALL bsl_int32mul(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret) |
| 20 |
|
{ |
| 21 |
< |
ret->value_int32 = args[0].value_int32 * args[1].value_int32; |
| 21 |
> |
ret->val.value_int32 = args[0].val.value_int32 * args[1].val.value_int32; |
| 22 |
|
ret->type = sl_int32; |
| 23 |
|
return 0; |
| 24 |
|
} |
| 29 |
|
double val2; |
| 30 |
|
|
| 31 |
|
if (args[0].type == sl_int32) |
| 32 |
< |
val1 = args[0].value_int32; |
| 32 |
> |
val1 = args[0].val.value_int32; |
| 33 |
|
else |
| 34 |
< |
val1 = args[0].value_float; |
| 34 |
> |
val1 = args[0].val.value_float; |
| 35 |
|
|
| 36 |
|
if (args[1].type == sl_int32) |
| 37 |
< |
val2 = args[1].value_int32; |
| 37 |
> |
val2 = args[1].val.value_int32; |
| 38 |
|
else |
| 39 |
< |
val2 = args[1].value_float; |
| 39 |
> |
val2 = args[1].val.value_float; |
| 40 |
|
|
| 41 |
< |
ret->value_float = (float)(val1 * val2); |
| 41 |
> |
ret->val.value_float = (float)(val1 * val2); |
| 42 |
|
ret->type = sl_float; |
| 43 |
|
return 0; |
| 44 |
|
} |
| 45 |
|
|
| 46 |
|
uint16_t ONICALL bsl_int32div(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret) |
| 47 |
|
{ |
| 48 |
< |
ret->value_int32 = args[0].value_int32 / args[1].value_int32; |
| 48 |
> |
ret->val.value_int32 = args[0].val.value_int32 / args[1].val.value_int32; |
| 49 |
|
ret->type = sl_int32; |
| 50 |
|
return 0; |
| 51 |
|
} |
| 55 |
|
double val2; |
| 56 |
|
|
| 57 |
|
if (args[0].type == sl_int32) |
| 58 |
< |
val1 = args[0].value_int32; |
| 58 |
> |
val1 = args[0].val.value_int32; |
| 59 |
|
else |
| 60 |
< |
val1 = args[0].value_float; |
| 60 |
> |
val1 = args[0].val.value_float; |
| 61 |
|
|
| 62 |
|
if (args[1].type == sl_int32) |
| 63 |
< |
val2 = args[1].value_int32; |
| 63 |
> |
val2 = args[1].val.value_int32; |
| 64 |
|
else |
| 65 |
< |
val2 = args[1].value_float; |
| 65 |
> |
val2 = args[1].val.value_float; |
| 66 |
|
|
| 67 |
< |
ret->value_float = (float)(val1 / val2); |
| 67 |
> |
ret->val.value_float = (float)(val1 / val2); |
| 68 |
|
ret->type = sl_float; |
| 69 |
|
return 0; |
| 70 |
|
} |
| 74 |
|
int32_t start = 0; |
| 75 |
|
int32_t end = 0; |
| 76 |
|
|
| 77 |
< |
if (args[0].value_int32 == args[1].value_int32) |
| 77 |
> |
if (args[0].val.value_int32 == args[1].val.value_int32) |
| 78 |
|
return 1; |
| 79 |
< |
else if (args[0].value_int32 > args[1].value_int32) |
| 79 |
> |
else if (args[0].val.value_int32 > args[1].val.value_int32) |
| 80 |
|
{ |
| 81 |
< |
start = args[1].value_int32; |
| 82 |
< |
end = args[0].value_int32; |
| 81 |
> |
start = args[1].val.value_int32; |
| 82 |
> |
end = args[0].val.value_int32; |
| 83 |
|
} |
| 84 |
|
else |
| 85 |
|
{ |
| 86 |
< |
start = args[0].value_int32; |
| 87 |
< |
end = args[1].value_int32; |
| 86 |
> |
start = args[0].val.value_int32; |
| 87 |
> |
end = args[1].val.value_int32; |
| 88 |
|
} |
| 89 |
|
|
| 90 |
< |
ret->value_int32 = start + (rand() % (uint32_t)(end - start + 1)); |
| 90 |
> |
ret->val.value_int32 = start + (rand() % (uint32_t)(end - start + 1)); |
| 91 |
|
ret->type = sl_int32; |
| 92 |
|
return 0; |
| 93 |
|
} |
| 96 |
|
{ |
| 97 |
|
int index; |
| 98 |
|
if (numargs == 0) index = 0; |
| 99 |
< |
else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].value_str32); |
| 100 |
< |
else index = args[0].value_int32; |
| 99 |
> |
else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val.value_str32); |
| 100 |
> |
else index = args[0].val.value_int32; |
| 101 |
|
//killcount = ONgGameState->CharacterStorage[index].Kills; |
| 102 |
|
//ONgGameState + index * 0x16A0 + 0x1260 + 0x1670; |
| 103 |
< |
ret->value_int32 = ONgGameState->CharacterStorage[index].Kills; |
| 103 |
> |
ret->val.value_int32 = ONgGameState->CharacterStorage[index].Kills; |
| 104 |
|
ret->type = sl_int32; |
| 105 |
|
return 0; |
| 106 |
|
} |
| 109 |
|
{ |
| 110 |
|
int index; |
| 111 |
|
if (numargs == 0) index = 0; |
| 112 |
< |
else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].value_str32); |
| 113 |
< |
else index = args[0].value_int32; |
| 114 |
< |
ret->value_int32 = ONgGameState->CharacterStorage[index].Damage; |
| 112 |
> |
else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val.value_str32); |
| 113 |
> |
else index = args[0].val.value_int32; |
| 114 |
> |
ret->val.value_int32 = ONgGameState->CharacterStorage[index].Damage; |
| 115 |
|
ret->type = sl_int32; |
| 116 |
|
return 0; |
| 117 |
|
} |
| 126 |
|
Character* Chr = ONgGameState->CharacterStorage; |
| 127 |
|
|
| 128 |
|
if (numargs < 2 || args[1].type != sl_str32) return 1; |
| 129 |
< |
else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].value_str32); |
| 130 |
< |
else index = args[0].value_int32; |
| 129 |
> |
else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val.value_str32); |
| 130 |
> |
else index = args[0].val.value_int32; |
| 131 |
|
|
| 132 |
|
|
| 133 |
|
|
| 134 |
< |
if(!strcmp(args[1].value_str32,"ammo")) |
| 134 |
> |
if(!strcmp(args[1].val.value_str32,"ammo")) |
| 135 |
|
{ |
| 136 |
|
returnval = &(Chr[index].Inventory.AmmoUsed); |
| 137 |
|
} |
| 138 |
< |
else if(!strcmp(args[1].value_str32,"hypo")) |
| 138 |
> |
else if(!strcmp(args[1].val.value_str32,"hypo")) |
| 139 |
|
{ |
| 140 |
|
returnval = &(Chr[index].Inventory.HypoUsed); |
| 141 |
|
} |
| 142 |
< |
else if(!strcmp(args[1].value_str32,"cells")) |
| 142 |
> |
else if(!strcmp(args[1].val.value_str32,"cells")) |
| 143 |
|
{ |
| 144 |
|
returnval = &(Chr[index].Inventory.CellsUsed); |
| 145 |
|
} |
| 146 |
< |
else if(!strcmp(args[1].value_str32,"invis")) |
| 146 |
> |
else if(!strcmp(args[1].val.value_str32,"invis")) |
| 147 |
|
{ |
| 148 |
|
returnval = &(Chr[index].Inventory.CloakUsed); |
| 149 |
|
} |
| 150 |
< |
else if(!strcmp(args[1].value_str32,"shield")) |
| 150 |
> |
else if(!strcmp(args[1].val.value_str32,"shield")) |
| 151 |
|
{ |
| 152 |
|
returnval = &(Chr[index].Inventory.ShieldUsed); |
| 153 |
|
} |
| 154 |
< |
else if(!strcmp(args[1].value_str32,"lsi")) |
| 154 |
> |
else if(!strcmp(args[1].val.value_str32,"lsi")) |
| 155 |
|
{ |
| 156 |
|
returnval = &(Chr[index].Inventory.hasLSI); |
| 157 |
|
is_lsi = 1; |
| 169 |
|
else return 1; |
| 170 |
|
//todo, add setting |
| 171 |
|
|
| 172 |
< |
if(is_lsi) ret->value_int32 = (int)*(bool*)returnval; |
| 173 |
< |
else ret->value_int32 = *(int*)returnval; |
| 172 |
> |
if(is_lsi) ret->val.value_int32 = (int)*(bool*)returnval; |
| 173 |
> |
else ret->val.value_int32 = *(int*)returnval; |
| 174 |
|
ret->type = sl_int32; |
| 175 |
|
|
| 176 |
|
if (numargs >= 3) |
| 177 |
|
{ |
| 178 |
< |
if(is_lsi) *(bool*)returnval = args[2].value_int32; |
| 179 |
< |
else *(int*)returnval = args[2].value_int32; |
| 178 |
> |
if(is_lsi) *(bool*)returnval = args[2].val.value_int32; |
| 179 |
> |
else *(int*)returnval = args[2].val.value_int32; |
| 180 |
|
} |
| 181 |
|
|
| 182 |
|
|
| 189 |
|
Character* Chr; |
| 190 |
|
int* health; |
| 191 |
|
if (numargs == 0) index = 0; |
| 192 |
< |
else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].value_str32); |
| 193 |
< |
else index = args[0].value_int32; |
| 192 |
> |
else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val.value_str32); |
| 193 |
> |
else index = args[0].val.value_int32; |
| 194 |
|
Chr = ONgGameState->CharacterStorage; |
| 195 |
|
health = &Chr[index].Health; |
| 196 |
|
|
| 197 |
< |
ret->value_int32 = *health; |
| 197 |
> |
ret->val.value_int32 = *health; |
| 198 |
|
ret->type = sl_int32; |
| 199 |
|
|
| 200 |
< |
if (args[1].value_int32) { |
| 201 |
< |
*health = args[1].value_int32; |
| 200 |
> |
if (args[1].val.value_int32) { |
| 201 |
> |
*health = args[1].val.value_int32; |
| 202 |
|
} |
| 203 |
< |
ret->value_int32 = *health; |
| 203 |
> |
ret->val.value_int32 = *health; |
| 204 |
|
ret->type = sl_int32; |
| 205 |
|
return 0; |
| 206 |
|
} |
| 210 |
|
int index; |
| 211 |
|
Character* Chr; |
| 212 |
|
if (numargs == 0) index = 0; |
| 213 |
< |
else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].value_str32); |
| 214 |
< |
else index = args[0].value_int32; |
| 213 |
> |
else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val.value_str32); |
| 214 |
> |
else index = args[0].val.value_int32; |
| 215 |
|
Chr = ONgGameState->CharacterStorage ; |
| 216 |
|
|
| 217 |
|
|
| 226 |
|
DDrConsole_PrintF("NoAmmo %s", Chr[index].ScriptNoAmmo); |
| 227 |
|
DDrConsole_PrintF("NoPath %s", Chr[index].ScriptNoPath); |
| 228 |
|
*/ |
| 229 |
< |
ret->value_int32 = Chr[index].RegenHax; |
| 229 |
> |
ret->val.value_int32 = Chr[index].RegenHax; |
| 230 |
|
ret->type = sl_int32; |
| 231 |
|
|
| 232 |
|
if (numargs >= 2) { |
| 233 |
< |
Chr[index].RegenHax = args[1].value_int32; |
| 233 |
> |
Chr[index].RegenHax = args[1].val.value_int32; |
| 234 |
|
} |
| 235 |
|
return 0; |
| 236 |
|
} |
| 245 |
|
|
| 246 |
|
if (numargs < 2) return 1; |
| 247 |
|
|
| 248 |
< |
if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].value_str32); |
| 249 |
< |
else index = args[0].value_int32; |
| 250 |
< |
if (index == -1) index = args[0].value_int32; |
| 251 |
< |
|
| 252 |
< |
if (args[1].type == sl_str32) index2 = DDrGetCharacterIndexFromName(args[1].value_str32); |
| 253 |
< |
else index2 = args[1].value_int32; |
| 254 |
< |
if (index2 == -1) index2 = args[1].value_int32; |
| 248 |
> |
if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val.value_str32); |
| 249 |
> |
else index = args[0].val.value_int32; |
| 250 |
> |
if (index == -1) index = args[0].val.value_int32; |
| 251 |
> |
|
| 252 |
> |
if (args[1].type == sl_str32) index2 = DDrGetCharacterIndexFromName(args[1].val.value_str32); |
| 253 |
> |
else index2 = args[1].val.value_int32; |
| 254 |
> |
if (index2 == -1) index2 = args[1].val.value_int32; |
| 255 |
|
Char1 = &Chr[index]; |
| 256 |
|
Char2 = &Chr[index2]; |
| 257 |
|
|
| 258 |
|
|
| 259 |
< |
ret->value_float = sqrt( pow((Char1->Location.X - Char2->Location.X), 2) + pow((Char1->Location.Y - Char2->Location.Y), 2) + pow((Char1->Location.Z - Char2->Location.Z),2)); |
| 259 |
> |
ret->val.value_float = sqrt( pow((Char1->Location.X - Char2->Location.X), 2) + pow((Char1->Location.Y - Char2->Location.Y), 2) + pow((Char1->Location.Z - Char2->Location.Z),2)); |
| 260 |
|
ret->type = sl_float; |
| 261 |
|
return 0; |
| 262 |
|
} |
| 272 |
|
|
| 273 |
|
|
| 274 |
|
if (numargs < 2) return 1; |
| 275 |
< |
if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].value_str32); |
| 276 |
< |
else index = args[0].value_int32; |
| 277 |
< |
if (index == -1) index = args[0].value_int32; |
| 275 |
> |
if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val.value_str32); |
| 276 |
> |
else index = args[0].val.value_int32; |
| 277 |
> |
if (index == -1) index = args[0].val.value_int32; |
| 278 |
|
Chr = ONgGameState->CharacterStorage; |
| 279 |
|
if(numargs == 3) |
| 280 |
|
{ |
| 281 |
< |
if (!strcmp(args[1].value_str32,"X") || !strcmp(args[1].value_str32,"x")) |
| 281 |
> |
if (!strcmp(args[1].val.value_str32,"X") || !strcmp(args[1].val.value_str32,"x")) |
| 282 |
|
loc = &(Chr[index].Position.X); |
| 283 |
< |
else if (!strcmp(args[1].value_str32,"Y") || !strcmp(args[1].value_str32,"y")) |
| 283 |
> |
else if (!strcmp(args[1].val.value_str32,"Y") || !strcmp(args[1].val.value_str32,"y")) |
| 284 |
|
loc = &(Chr[index].Position.Y); |
| 285 |
< |
else if (!strcmp(args[1].value_str32,"Z") || !strcmp(args[1].value_str32,"z")) |
| 285 |
> |
else if (!strcmp(args[1].val.value_str32,"Z") || !strcmp(args[1].val.value_str32,"z")) |
| 286 |
|
loc = &(Chr[index].Position.Z); |
| 287 |
|
} |
| 288 |
|
else if (numargs == 4) { |
| 289 |
|
ActiveCharacter* Active = (ActiveCharacter*)ONrGetActiveCharacter(&Chr[index]); |
| 290 |
< |
Chr[index].Location.X = args[1].value_float; |
| 291 |
< |
Chr[index].Location.Y = args[2].value_float; |
| 292 |
< |
Chr[index].Location.Z = args[3].value_float; |
| 290 |
> |
Chr[index].Location.X = args[1].val.value_float; |
| 291 |
> |
Chr[index].Location.Y = args[2].val.value_float; |
| 292 |
> |
Chr[index].Location.Z = args[3].val.value_float; |
| 293 |
|
if(Active) |
| 294 |
|
{ |
| 295 |
|
Active->PhyContext->Position = Chr[index].Location; |
| 296 |
|
} |
| 297 |
< |
ret->value_float = 1; |
| 297 |
> |
ret->val.value_float = 1; |
| 298 |
|
ret->type = sl_float; |
| 299 |
|
return 0; |
| 300 |
|
} |
| 301 |
|
else return 1; |
| 302 |
|
|
| 303 |
< |
ret->value_float = *loc; |
| 303 |
> |
ret->val.value_float = *loc; |
| 304 |
|
ret->type = sl_float; |
| 305 |
|
|
| 306 |
|
if(numargs == 3) { |
| 307 |
|
//currently broken, does nothing. |
| 308 |
< |
*loc = args[2].value_float; |
| 308 |
> |
*loc = args[2].val.value_float; |
| 309 |
|
} |
| 310 |
|
return 0; |
| 311 |
|
} |
| 314 |
|
{ |
| 315 |
|
int index; |
| 316 |
|
if (numargs == 0) index = 0; |
| 317 |
< |
else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].value_str32); |
| 318 |
< |
else index = args[0].value_int32; |
| 317 |
> |
else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val.value_str32); |
| 318 |
> |
else index = args[0].val.value_int32; |
| 319 |
|
if(1) { |
| 320 |
|
Character* Chr = ONgGameState->CharacterStorage ; |
| 321 |
|
int* maxhealth = &Chr[index].MaxHealth; |
| 322 |
|
int oldmaxhealth = Chr[index].MaxHealth; |
| 323 |
|
int oldhealth = Chr->Health; |
| 324 |
|
if (numargs >= 2) { |
| 325 |
< |
*maxhealth = args[1].value_int32; |
| 325 |
> |
*maxhealth = args[1].val.value_int32; |
| 326 |
|
} |
| 327 |
< |
if (numargs >= 3 && args[2].value_bool) { |
| 328 |
< |
Chr->Health = (int)(((float)args[1].value_int32 / (float)oldmaxhealth) * (float)oldhealth); |
| 327 |
> |
if (numargs >= 3 && args[2].val.value_bool) { |
| 328 |
> |
Chr->Health = (int)(((float)args[1].val.value_int32 / (float)oldmaxhealth) * (float)oldhealth); |
| 329 |
|
} |
| 330 |
< |
ret->value_int32 = oldmaxhealth; |
| 330 |
> |
ret->val.value_int32 = oldmaxhealth; |
| 331 |
|
ret->type = sl_int32; |
| 332 |
|
return 0; |
| 333 |
|
} |
| 339 |
|
|
| 340 |
|
int index; |
| 341 |
|
if (numargs == 0) index = 0; |
| 342 |
< |
else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].value_str32); |
| 343 |
< |
else index = args[0].value_int32; |
| 342 |
> |
else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val.value_str32); |
| 343 |
> |
else index = args[0].val.value_int32; |
| 344 |
|
if(1) { |
| 345 |
|
Character* Chr = ONgGameState->CharacterStorage; |
| 346 |
|
ActiveCharacter* Active = (ActiveCharacter*)ONrGetActiveCharacter(&Chr[index]); |
| 347 |
|
if (!Active) return 1; |
| 348 |
< |
// ret->value_int32 = Active->LastDamageSourceCharacter; |
| 348 |
> |
// ret->val.value_int32 = Active->LastDamageSourceCharacter; |
| 349 |
|
ret->type = sl_int32; |
| 350 |
|
return 0; |
| 351 |
|
} |
| 359 |
|
char* name; |
| 360 |
|
|
| 361 |
|
if (numargs == 0) index = 0; |
| 362 |
< |
else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].value_str32); |
| 363 |
< |
else index = args[0].value_int32; |
| 362 |
> |
else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val.value_str32); |
| 363 |
> |
else index = args[0].val.value_int32; |
| 364 |
|
if (index == -1) { |
| 365 |
|
ret->type = sl_str32; |
| 366 |
< |
ret->value_str32 = "NULL"; |
| 366 |
> |
ret->val.value_str32 = "NULL"; |
| 367 |
|
return 0; |
| 368 |
|
} |
| 369 |
|
name = &ONgGameState->CharacterStorage[index].Name; |
| 370 |
|
if (numargs == 2) { |
| 371 |
< |
strncpy(name, (char*)args[1].value_str32, 31); |
| 371 |
> |
strncpy(name, (char*)args[1].val.value_str32, 31); |
| 372 |
|
} |
| 373 |
|
|
| 374 |
|
ret->type = sl_str32; |
| 375 |
< |
ret->value_str32 = name; |
| 375 |
> |
ret->val.value_str32 = name; |
| 376 |
|
|
| 377 |
|
return 0; |
| 378 |
|
} |
| 382 |
|
{ |
| 383 |
|
//testing numargs... |
| 384 |
|
ret->type = sl_int32; |
| 385 |
< |
ret->value_int32 = numargs; |
| 385 |
> |
ret->val.value_int32 = numargs; |
| 386 |
|
return 0; |
| 387 |
|
} |
| 388 |
|
|
| 398 |
|
numargs++; |
| 399 |
|
} |
| 400 |
|
if(numargs == 0) return 0; |
| 401 |
< |
if(numargs > 1 ) color.R = (char)args[1].value_int32; |
| 401 |
> |
if(numargs > 1 ) color.R = (char)args[1].val.value_int32; |
| 402 |
|
else color.R = 255; |
| 403 |
< |
if(numargs > 2 ) color.G = (char)args[2].value_int32; |
| 403 |
> |
if(numargs > 2 ) color.G = (char)args[2].val.value_int32; |
| 404 |
|
else color.G = 255; |
| 405 |
< |
if(numargs > 3 ) color.B = (char)args[3].value_int32; |
| 405 |
> |
if(numargs > 3 ) color.B = (char)args[3].val.value_int32; |
| 406 |
|
else color.B = 255; |
| 407 |
|
color.A = 0; |
| 408 |
< |
if(numargs > 5 ) shade.R = (char)args[5].value_int32; |
| 408 |
> |
if(numargs > 5 ) shade.R = (char)args[5].val.value_int32; |
| 409 |
|
else shade.R = 0x3F; |
| 410 |
< |
if(numargs > 6 ) shade.G = (char)args[6].value_int32; |
| 410 |
> |
if(numargs > 6 ) shade.G = (char)args[6].val.value_int32; |
| 411 |
|
else shade.G = 0x3F; |
| 412 |
< |
if(numargs > 7 ) shade.B = (char)args[7].value_int32; |
| 412 |
> |
if(numargs > 7 ) shade.B = (char)args[7].val.value_int32; |
| 413 |
|
else shade.B = 0x3F; |
| 414 |
|
shade.A = 0; |
| 415 |
|
|
| 416 |
< |
DDrConsole_PrintColored(args[0].value_str32, 1, color, shade); |
| 416 |
> |
DDrConsole_PrintColored(args[0].val.value_str32, 1, color, shade); |
| 417 |
|
return 0; |
| 418 |
|
} |
| 419 |
|
|
| 422 |
|
{ |
| 423 |
|
|
| 424 |
|
ret->type = sl_int32; |
| 425 |
< |
ret->value_int32 = DDrGetCharacterIndexFromName(args[0].value_str32); |
| 425 |
> |
ret->val.value_int32 = DDrGetCharacterIndexFromName(args[0].val.value_str32); |
| 426 |
|
|
| 427 |
|
return 0; |
| 428 |
|
} |
| 487 |
|
int Input2 = 0; |
| 488 |
|
Character* Chr; |
| 489 |
|
ActiveCharacter* Active; |
| 490 |
< |
if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].value_str32); |
| 491 |
< |
else index = args[0].value_int32; |
| 490 |
> |
if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val.value_str32); |
| 491 |
> |
else index = args[0].val.value_int32; |
| 492 |
|
|
| 493 |
|
Chr = &(ONgGameState->CharacterStorage[index]); |
| 494 |
|
Active = ONrGetActiveCharacter(Chr); |
| 496 |
|
|
| 497 |
|
for(i = 1; i < numargs - 1; i++) { |
| 498 |
|
for(j = 0; j < 32; j++) { |
| 499 |
< |
if(!strcmp(args[i].value_str32, Actions1[j].Name)) { |
| 499 |
> |
if(!strcmp(args[i].val.value_str32, Actions1[j].Name)) { |
| 500 |
|
Input1 = Input1 | Actions1[j].Bit; |
| 501 |
|
} |
| 502 |
|
} |
| 503 |
|
for(j = 0; j < 9; j++) { |
| 504 |
< |
if(!strcmp(args[i].value_str32, Actions2[j].Name)) { |
| 504 |
> |
if(!strcmp(args[i].val.value_str32, Actions2[j].Name)) { |
| 505 |
|
Input2 = Input2 | Actions2[j].Bit; |
| 506 |
|
} |
| 507 |
|
} |
| 512 |
|
DDrConsole_PrintF("Func \"%s\", File \"%s\", Line %d: semantic error, \"%s\": No valid keys given.", callinfo->name, callinfo->calllocation, callinfo->linenumber, callinfo->name); |
| 513 |
|
return 0; |
| 514 |
|
} |
| 515 |
< |
if ( args[numargs - 1].value_int32 <= 0) { |
| 515 |
> |
if ( args[numargs - 1].val.value_int32 <= 0) { |
| 516 |
|
return 0; |
| 517 |
|
} |
| 518 |
|
else { |
| 519 |
< |
args[numargs - 1].value_int32 -= 1; |
| 519 |
> |
args[numargs - 1].val.value_int32 -= 1; |
| 520 |
|
*dontuse2 = 1; |
| 521 |
|
*dontuse1 = 1; |
| 522 |
|
} |
| 527 |
|
{ |
| 528 |
|
// int index; |
| 529 |
|
// if (numargs < 4) index = 0; |
| 530 |
< |
// else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].value_str32); |
| 531 |
< |
// else index = args[0].value_int32; |
| 530 |
> |
// else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val.value_str32); |
| 531 |
> |
// else index = args[0].val.value_int32; |
| 532 |
|
|
| 533 |
|
// Character* Chr = ONgGameState->CharacterStorage; |
| 534 |
|
// ActiveCharacter* Active = (ActiveCharacter*)ONrGetActiveCharacter(&Chr[index]); |
| 539 |
|
int Input2 = 0; |
| 540 |
|
for(i = 0; i < numargs; i++) { |
| 541 |
|
for(j = 0; j < 32; j++) { |
| 542 |
< |
//DDrConsole_PrintF("Testing %s against %s 0x%x", args[i].value_str32, Actions1[j].Name, Actions1[j].Bit); |
| 543 |
< |
if(!strcmp(args[i].value_str32, Actions1[j].Name)) { |
| 542 |
> |
//DDrConsole_PrintF("Testing %s against %s 0x%x", args[i].val.value_str32, Actions1[j].Name, Actions1[j].Bit); |
| 543 |
> |
if(!strcmp(args[i].val.value_str32, Actions1[j].Name)) { |
| 544 |
|
Input1 = Input1 | Actions1[j].Bit; |
| 545 |
|
//DDrConsole_PrintF("Success!"); |
| 546 |
|
} |
| 547 |
|
|
| 548 |
|
} |
| 549 |
|
for(j = 0; j < 9; j++) { |
| 550 |
< |
if(!strcmp(args[i].value_str32, Actions2[j].Name)) Input2 = Input2 | Actions2[j].Bit; |
| 550 |
> |
if(!strcmp(args[i].val.value_str32, Actions2[j].Name)) Input2 = Input2 | Actions2[j].Bit; |
| 551 |
|
|
| 552 |
|
} |
| 553 |
|
} |
| 554 |
|
//DDrConsole_PrintF("Testing: 0x%x Input: 0x%x",Input1, *(int*)(ONgGameState + 0xB8 + 0x10)); |
| 555 |
< |
ret->value_int32 = 0; |
| 555 |
> |
ret->val.value_int32 = 0; |
| 556 |
|
ret->type = sl_int32; |
| 557 |
< |
if ( (ONgGameState->Input.Current.Actions1 == Input1) && (ONgGameState->Input.Current.Actions2 == Input2)) ret->value_int32 = 1; |
| 557 |
> |
if ( (ONgGameState->Input.Current.Actions1 == Input1) && (ONgGameState->Input.Current.Actions2 == Input2)) ret->val.value_int32 = 1; |
| 558 |
|
return 0; |
| 559 |
|
} |
| 560 |
|
|
| 562 |
|
{ |
| 563 |
|
// int index; |
| 564 |
|
// if (numargs < 4) index = 0; |
| 565 |
< |
// else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].value_str32); |
| 566 |
< |
// else index = args[0].value_int32; |
| 565 |
> |
// else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val.value_str32); |
| 566 |
> |
// else index = args[0].val.value_int32; |
| 567 |
|
|
| 568 |
|
// Character* Chr = ONgGameState->CharacterStorage; |
| 569 |
|
// ActiveCharacter* Active = (ActiveCharacter*)ONrGetActiveCharacter(&Chr[index]); |
| 581 |
|
numargs++; |
| 582 |
|
|
| 583 |
|
} |
| 584 |
< |
if(numargs < 1 || args[0].value == 0) return; |
| 584 |
> |
if(numargs < 1 || args[0].val.value == 0) return; |
| 585 |
|
//for(i = 0; i < numargs; i++) { |
| 586 |
|
*/ |
| 587 |
|
i = 0; |
| 588 |
|
for(j = 0; j < 32; j++) { |
| 589 |
< |
//DDrConsole_PrintF("Testing %s against %s 0x%x", args[i].value_str32, Actions1[j].Name, Actions1[j].Bit); |
| 590 |
< |
if(!strcmp(args[i].value_str32, Actions1[j].Name)) { |
| 589 |
> |
//DDrConsole_PrintF("Testing %s against %s 0x%x", args[i].val.value_str32, Actions1[j].Name, Actions1[j].Bit); |
| 590 |
> |
if(!strcmp(args[i].val.value_str32, Actions1[j].Name)) { |
| 591 |
|
Input1 = Input1 | Actions1[j].Bit; |
| 592 |
|
//DDrConsole_PrintF("Success!"); |
| 593 |
|
} |
| 594 |
|
|
| 595 |
|
} |
| 596 |
|
for(j = 0; j < 9; j++) { |
| 597 |
< |
if(!strcmp(args[i].value_str32, Actions2[j].Name)) Input2 = Input2 | Actions2[j].Bit; |
| 597 |
> |
if(!strcmp(args[i].val.value_str32, Actions2[j].Name)) Input2 = Input2 | Actions2[j].Bit; |
| 598 |
|
|
| 599 |
|
} |
| 600 |
|
// } |
| 621 |
|
char buffer[1024]; |
| 622 |
|
int i; |
| 623 |
|
char* placeinoutput = output; |
| 624 |
< |
char* placeininput = args[0].value_str32; |
| 624 |
> |
char* placeininput = args[0].val.value_str32; |
| 625 |
|
int formatnum = 0; |
| 626 |
|
//fix the broken bsl numargs... |
| 627 |
|
numargs = 0; |
| 669 |
|
for(i = 1; i < numargs; i++) { |
| 670 |
|
//sprintf(output, output, args[i].value_str32); |
| 671 |
|
memcpy(buffer, output, 1024); |
| 672 |
< |
if(args[i].value == 0) break; |
| 672 |
> |
if(args[i].val.value == 0) break; |
| 673 |
|
switch(args[i].type) |
| 674 |
|
{ |
| 675 |
|
case sl_bool: |
| 676 |
|
case sl_int32: |
| 677 |
< |
sprintf(output, buffer, args[i].value_int32); |
| 677 |
> |
sprintf(output, buffer, args[i].val.value_int32); |
| 678 |
|
break; |
| 679 |
|
case sl_float: |
| 680 |
|
//crashes oni, why? |
| 681 |
< |
// sprintf(output, output, args[i].value_float); |
| 681 |
> |
// sprintf(output, output, args[i].val.value_float); |
| 682 |
|
break; |
| 683 |
|
case sl_str32: |
| 684 |
< |
sprintf(output, buffer, args[i].value_str32); |
| 684 |
> |
sprintf(output, buffer, args[i].val.value_str32); |
| 685 |
|
break; |
| 686 |
|
case sl_void: |
| 687 |
|
default: |
| 689 |
|
} |
| 690 |
|
} |
| 691 |
|
//output[32] = 0; |
| 692 |
< |
ret->value_str32 = output; |
| 692 |
> |
ret->val.value_str32 = output; |
| 693 |
|
ret->type = sl_str32; |
| 694 |
|
return 0; |
| 695 |
|
} |
| 765 |
|
// Widescreen patch for talking heads. |
| 766 |
|
uint16_t ONICALL cinematic_start_patch(sl_callinfo* callinfo, unsigned int numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret) |
| 767 |
|
{ |
| 768 |
< |
args[1].value_int32 = (double)args[1].value_int32 / (double)(gl_eng->DisplayMode.Width) * (4.0 / 3.0 * (double)(gl_eng->DisplayMode.Height)); |
| 768 |
> |
args[1].val.value_int32 = (double)args[1].val.value_int32 / (double)(gl_eng->DisplayMode.Width) * (4.0 / 3.0 * (double)(gl_eng->DisplayMode.Height)); |
| 769 |
|
return ((sl_func)(OniExe + 0x000f3830))(callinfo, numargs, args, dontuse1, dontuse2, ret); |
| 770 |
|
} |
| 771 |
|
|