- Timestamp:
- Jul 20, 2009, 4:06:23 AM (15 years ago)
- Location:
- Daodan/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
Daodan/src/BFW_Utility.h
r437 r446 14 14 void ONICALL UUrPlatform_Terminate(); 15 15 16 typedef struct { 17 int16_t Top; 18 int16_t Left; 19 int16_t Right; 20 int16_t Bottom; 21 } OniRectangle; 22 23 24 void* TestContext; 16 25 void ONICALL COrTextArea_Print(uint32_t area, uint32_t priority, uint32_t textshade, uint32_t textshadowshade, const char* text, uint32_t unk_alwaws_0, uint32_t fadetime); 26 int16_t ONICALL TSrContext_DrawText(uint32_t TSrContext, char* Text, int alpha, uint32_t usuallyzero, OniRectangle* pRect); 27 int16_t ONICALL TSrContext_New( void* FontInstance, int size, int hthsik1,int hthsik2,int hthsik3, void* TSrContext); //int16_t TSrContext_New( TSFF*, size 7, ??? 1, ??? 1, ??? 0, TSrContext*); 28 int16_t ONICALL TMrInstance_GetDataPtr(int, char*, void*); //int TMrInstance_GetDataPtr( Type 'TSFF', char* "Tahoma", ptr); 17 29 18 30 int __cdecl AUrMessageBox(int Buttons, char *Message, ...); -
Daodan/src/Daodan_BSL.c
r445 r446 10 10 #include "Oni_Character.h" 11 11 #include "dSFMT\dSFMT.h" 12 #include "Daodan_Character.h" 12 13 13 14 uint16_t ONICALL bsl_int32mul(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], void* dontuse1, void* dontuse2, sl_arg* ret) … … 92 93 int index; 93 94 if (numargs == 0) index = 0; 95 else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].value_str32); 94 96 else index = args[0].value_int32; 95 97 int* killcount = ONgGameState + index * 0x16A0 + 0x1260 + 0x1670; … … 103 105 int index; 104 106 if (numargs == 0) index = 0; 107 else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].value_str32); 105 108 else index = args[0].value_int32; 106 109 int* killcount = ONgGameState + index * 0x16A0 + 0x1260 + 0x1674; 107 110 ret->value_int32 = *killcount; 108 111 ret->type = sl_int32; 112 return 0; 113 } 114 115 uint16_t ONICALL bsl_powerup(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], void* dontuse1, void* dontuse2, sl_arg* ret) 116 { 117 char powerup_list[7][16] = {"ammo", "cell", "hypo", "shield", "invis" , "lsi", "bossshield"}; 118 int powerup_offset[7] = { 0xE, 0x12, 0x10, 0x24, 0x26, 0x20, -1}; 119 char powerup_type[16] = "\0"; 120 int index; 121 if (numargs < 2 || args[1].type != sl_str32) return 1; 122 else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].value_str32); 123 else index = args[0].value_int32; 124 int i; 125 126 for(i = 0; i < 6; i++) 127 { 128 if(!strcmp(args[1].value_str32,powerup_list[i])) 129 { 130 sprintf(powerup_type,"%s",powerup_list[i]); 131 break; 132 } 133 } 134 135 //todo, add setting 136 137 if (powerup_type[0] == 0) return 1; 138 Character* Chr = ONgGameState + 0x1260; 139 void* returnval = &(Chr[index]) + 0x194 + powerup_offset[i]; 140 //*returnval = (int)Inv 141 if (numargs >= 2) 142 { 143 //*health = args[1].value_int32; 144 } 145 ret->value_int32 = (int)*(uint16_t*)returnval; 146 ret->type = sl_int32; 147 return 0; 148 } 149 150 uint16_t ONICALL bsl_health(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], void* dontuse1, void* dontuse2, sl_arg* ret) 151 { 152 int index; 153 if (numargs == 0) index = 0; 154 else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].value_str32); 155 else index = args[0].value_int32; 156 Character* Chr = ONgGameState + 0x1260 ; 157 int* health = &Chr[index].Health; 158 159 ret->value_int32 = *health; 160 ret->type = sl_int32; 161 162 if (numargs >= 2) { 163 *health = args[1].value_int32; 164 } 165 ret->value_int32 = *health; 166 ret->type = sl_int32; 167 return 0; 168 } 169 170 uint16_t ONICALL bsl_maxhealth(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], void* dontuse1, void* dontuse2, sl_arg* ret) 171 { 172 int index; 173 if (numargs == 0) index = 0; 174 else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].value_str32); 175 else index = args[0].value_int32; 176 Character* Chr = ONgGameState + 0x1260 ; 177 int* maxhealth = &Chr[index].MaxHealth; 178 int oldmaxhealth = Chr[index].MaxHealth; 179 int oldhealth = Chr->Health; 180 if (numargs >= 2) { 181 *maxhealth = args[1].value_int32; 182 } 183 if (numargs >= 3 && args[2].value_bool) { 184 Chr->Health = (int)(((float)args[1].value_int32 / (float)oldmaxhealth) * (float)oldhealth); 185 } 186 ret->value_int32 = oldmaxhealth; 187 ret->type = sl_int32; 188 return 0; 189 } 190 191 uint16_t ONICALL bsl_getattacker(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], void* dontuse1, void* dontuse2, sl_arg* ret) 192 { 193 //broken...not only does it sometimes blam, but it returns a string when i want an int so i can study it :< 194 int index; 195 if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].value_str32); 196 else index = args[0].value_int32; 197 198 199 if(ONrGetActiveCharacter(ONgGameState + 0x1260 + index * 0x16A0)) return 1; 200 201 int attacker= (int)(ONrGetActiveCharacter(ONgGameState + 0x1260 + index * 0x16A0) + 0x120); 202 ret->type = sl_int32; 203 ret->value_int32 = attacker; 204 return 0; 205 } 206 207 208 uint16_t ONICALL bsl_chrname(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], void* dontuse1, void* dontuse2, sl_arg* ret) 209 { 210 int index; 211 if (numargs == 0) index = 0; 212 else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].value_str32); 213 else index = args[0].value_int32; 214 if (index == -1) { 215 ret->type = sl_str32; 216 ret->value_str32 = "NULL"; 217 return 0; 218 } 219 char* name = ONgGameState + 0x1260 + index * 0x16A0 + 0x14; 220 if (numargs == 2) { 221 strncpy(name, (char*)args[1].value_str32, 31); 222 } 223 224 ret->type = sl_str32; 225 ret->value_str32 = name; 226 227 return 0; 228 } 229 230 231 uint16_t ONICALL bsl_count(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], void* dontuse1, void* dontuse2, sl_arg* ret) 232 { 233 //testing numargs... 234 ret->type = sl_int32; 235 ret->value_int32 = numargs; 236 return 0; 237 } 238 239 uint16_t ONICALL bsl_dprintcolored(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], void* dontuse1, void* dontuse2, sl_arg* ret) 240 { 241 //TODO: figure out why our implementation of dprint shows after dev mode is turned off 242 RGBA color; 243 RGBA shade; 244 245 if(numargs == 0) return 0; 246 if(numargs > 1 ) color.R = (char)args[1].value_int32; 247 else color.R = 255; 248 if(numargs > 2 ) color.G = (char)args[2].value_int32; 249 else color.G = 255; 250 if(numargs > 3 ) color.B = (char)args[3].value_int32; 251 else color.B = 255; 252 color.A = 0; 253 if(numargs > 5 ) shade.R = (char)args[5].value_int32; 254 else shade.R = 0x3F; 255 if(numargs > 6 ) shade.G = (char)args[6].value_int32; 256 else shade.G = 0x3F; 257 if(numargs > 7 ) shade.B = (char)args[7].value_int32; 258 else shade.B = 0x3F; 259 shade.A = 0; 260 261 DDrConsole_PrintColored(args[0].value_str32, 1, color, shade); 262 return 0; 263 } 264 265 266 uint16_t ONICALL bsl_nametoindex(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], void* dontuse1, void* dontuse2, sl_arg* ret) 267 { 268 ret->type = sl_int32; 269 ret->value_int32 = DDrGetCharacterIndexFromName(args[0].value_str32); 109 270 return 0; 110 271 } … … 193 354 SLrScript_Command_Register_ReturnType("int32rand", "Returns a pseudo-random number between two numbers (inclusive).", "start:int end:int", sl_int32, bsl_int32rand); 194 355 195 SLrScript_Command_Register_ReturnType("chr_getkills","Gets the number of kills a character has", "[chrindex:int]", sl_int32, bsl_getkills); 196 SLrScript_Command_Register_ReturnType("chr_getdamage","Gets the amount of damage a character has caused", "[chrindex:int]", sl_int32, bsl_getdamage); 356 SLrScript_Command_Register_ReturnType("d_getkills","Gets the number of kills a character has", "[ai_name:str | script_id:int]", sl_int32, bsl_getkills); 357 SLrScript_Command_Register_ReturnType("d_getdamage","Gets the amount of damage a character has caused", "[ai_name:string | script_id:int]", sl_int32, bsl_getdamage); 358 SLrScript_Command_Register_ReturnType("d_name","Gets or sets a character's name", "[ai_name:str | script_id:int] [newname:string]", sl_str32, bsl_chrname); 359 SLrScript_Command_Register_ReturnType("d_getindex","Converts a character's name to its index", "script_id:int", sl_int32, bsl_nametoindex); 360 SLrScript_Command_Register_ReturnType("d_health","Gets or sets a character's health", "[ai_name:str | script_id:int] [newhealth:int]", sl_str32, bsl_health); 361 SLrScript_Command_Register_ReturnType("d_maxhealth","Gets or sets a character's maximum health", "[ai_name:str | script_id:int] [newmaxhealth:int] [scalehealth:bool]", sl_str32, bsl_maxhealth); 362 SLrScript_Command_Register_ReturnType("d_powerup","Gets or sets a character's powerups", "ai_name:str|script_id:int powerup:str", sl_int32, bsl_powerup); 363 //broken. sometimes crashes, and sometimes returns a string... : / 364 SLrScript_Command_Register_ReturnType("d_getattacker","Gets the last person to hurt a character", "[ai_name:string | script_id:int]", sl_int32, bsl_chrname); 197 365 198 366 SLrScript_Command_Register_ReturnType("sprintf", "C-style sprintf.", "format:string arg1 arg2 ...", sl_str32, bsl_sprintf); 199 } 367 368 SLrScript_Command_Register_ReturnType("dprintcolor", "prints to console in color", "text:string [color: r b g] [color: r b g]", sl_void, bsl_dprintcolored); 369 } -
Daodan/src/Daodan_Character.c
r434 r446 2 2 #include "Daodan_Character.h" 3 3 #include "Oni_Character.h" 4 #include "BFW_Utility.h" 5 #include "Oni.h" 4 6 5 7 int DDr_TeamToTeamID(const char* team_string) //Already something like this in the engine, but I'm reimplementing it... … … 16 18 } 17 19 20 uint32_t DDrGetCharacterIndexFromName(char* input) { 21 Character **characterlist; //pointer to array of Character pointers 22 characterlist = ONgGameState + 0x00167500; //Character List 23 int* total_characters = ONgGameState + 0x00167700; //Max number of characters 24 int i; 25 for(i = 0; i < *total_characters; i++) { 26 if (characterlist[i] != 0) //anti Blam! 27 if (!strcmp(characterlist[i]->Name, input)) { //checks for the same name 28 return characterlist[i]->Number; 29 } 30 } 31 return -1; //not found :( 32 } 33 34 OniRectangle TestRect; 18 35 void CHARTest() 19 36 { 37 20 38 CharacterObject* TestCHAR = malloc(sizeof(CharacterObject)); 21 39 memset(TestCHAR, 0, sizeof(CharacterObject)); … … 25 43 memcpy(TestCHAR->OSD.Name, "Gumby", 6); 26 44 memcpy(TestCHAR->OSD.Class, "striker_easy_1", 15); 27 memcpy(TestCHAR->OSD.ScriptSpawn, "dmsg", 20); 28 TestCHAR->OSD.Options = chr_unkillable;45 memcpy(TestCHAR->OSD.ScriptSpawn, "dmsg", 20); 46 //TestCHAR->OSD.Options = chr_unkillable; 29 47 TestCHAR->OSD.TeamID = team_syndicate; 48 //int* ptr = 0x005ECE70; 49 TestRect.Top = 10; 50 TestRect.Left = 10; 51 TestRect.Right = 100; 52 TestRect.Bottom = 100; 30 53 31 32 ONrGameState_NewCharacter(TestCHAR, NULL, NULL, NULL); 54 char str[5] = "hi"; 55 str[2] = '\0'; 56 AUrMessageBox(0, "%8x", &TestRect); 57 int16_t a = TSrContext_DrawText(TestContext, str, 0xFF, &TestRect, &TestRect); 58 //ONrGameState_NewCharacter(TestCHAR, NULL, NULL, NULL); 59 return; 33 60 } -
Daodan/src/Daodan_Character.h
r429 r446 8 8 int DDr_TeamToTeamID(const char* team_string); 9 9 void CHARTest(); 10 10 uint32_t DDrGetCharacterIndexFromName(char* ); 11 11 #endif -
Daodan/src/Daodan_Console.c
r437 r446 9 9 { 10 10 COrTextArea_Print(COgConsoleLines, 1, COgDefaultTextShade, COgDefaultTextShadow, text, 0, COgFadeTimeValue); 11 } 12 13 void DDrConsole_PrintColored(const char* text, int priority, RGBA color, RGBA shade) 14 { 15 int* intcolor = (int*)&color; 16 int* intshade = (int*)&shade; 17 COrTextArea_Print(COgConsoleLines, 1, *intcolor, *intshade, text, 0, COgFadeTimeValue); 11 18 } 12 19 -
Daodan/src/Daodan_Console.h
r437 r446 7 7 #include "Daodan.h" 8 8 9 typedef struct { 10 char B; 11 char G; 12 char R; 13 char A; 14 } RGBA; 15 9 16 void DDrConsole_Print(const char* text); 17 void DDrConsole_PrintColored(const char* text, int priority, RGBA color, RGBA shade); 10 18 void DDrConsole_PrintF(const char* fmt, ...); 11 19 -
Daodan/src/Oni_Character.h
r441 r446 211 211 int16_t ShieldUsed; //Bullet shield given for the char to use 212 212 int16_t CloakUsed; //Phase Cloak given for the char to use 213 int 16_t field_28; //probably bullet shield dropped214 int 16_t DoorKeys; //Lol. We can use this later for other sorts of items.213 int32_t field_28; //probably bullet shield dropped 214 int32_t DoorKeys; //Lol. We can use this later for other sorts of items. 215 215 } Inventory; 216 216 … … 432 432 } ActiveCharacter; 433 433 434 434 //This struct is good. 435 435 typedef struct { //Character 436 int16_t Number; 436 char Number; 437 char field_2; 437 438 int16_t ActiveCharacterIndex; 438 439 int32_t Flags; 439 int 16_t field_8;440 int32_t field_8; 440 441 int32_t ONCC; //change type to ONCC when we get that far... 441 int 32_t field_10;442 int16_t field_10; 442 443 int16_t Team; 443 444 char Name[32]; … … 471 472 Vector3 Velocity; 472 473 int32_t field_1D0; 473 int32_t field_1D4;474 int32_t Recoil; 474 475 int32_t field_1D8; 475 476 int32_t field_1DC; 476 int32_t field_1E0;477 int32_t LastNotIdleGameTime; 477 478 int32_t IdleDelay; 478 int32_t field_1E8;479 int32_t field_1E zC;479 int32_t Type; 480 int32_t field_1EC; 480 481 int32_t CombatFlags; 481 482 int32_t JobId; … … 484 485 int32_t field_200; 485 486 int32_t field_204; 486 int32_t field_208[ 107]; //its all undocumented through here487 int32_t field_208[428]; //208-8B8 487 488 int32_t CombatState; //I think.... 488 int32_t field_8B B;489 int32_t field_8BC; 489 490 int32_t PatrolPathOSD[10]; //actually another struct. Not needed atm. 490 491 int32_t PatrolPathPoints[5][64]; //64 of another struct … … 509 510 int32_t PursuitWeakHigh; 510 511 int32_t Pursuit5; 511 int32_t field_FC8[ 16];512 int32_t field_FC8[4]; 512 513 int32_t AlarmGroups; //a bitset 513 int32_t field_FDC[16]; //FDC-F68 514 int32_t field_F68; 514 int32_t field_FDC[17]; //FDC-1020 515 515 int32_t DazeTimer; 516 int32_t field_1024[1 6]; //1024-1064516 int32_t field_1024[17]; //1024-1068 517 517 int32_t MeleePtr; //probably MELE. Looks somewhat important. 518 518 int32_t field_106C[270]; //106C-14A4 skipping lots of junk and a little pathfinding stuff that we might want later. 519 int32_t MovementMode; 520 int32_t field_14A8; 521 int32_t field_14AC; 519 522 int32_t MovementModifiers; //hopefully sprinting, pistol, rifle, etc. 520 523 int32_t field_14B4[101]; //14B4-1648 Glossing over a few other things we don't need having to do with AI direction. 524 BoundingBox BoundingBox_; 525 int32_t field_1660; 521 526 int32_t BossShieldPower; //a multiplier? or just a flag? who knows 522 527 int32_t field_1668[6]; 523 528 int32_t CurrentConsoleActionMarker; //not sure. 524 int32_t field_1684[7]; // done. hopefully i didnt screw this up somewhere.529 int32_t field_1684[7]; 525 530 } Character; 526 531 … … 552 557 }; // 553 558 int16_t ONICALL ONrGameState_NewCharacter(CharacterObject* CHAR, void* AISA, void* flag, int* list_location); 559 int32_t* ONICALL ONrGetActiveCharacter(void* CharacterPtr); 554 560 //int16_t ONICALL ONrGameState_GetPlayerCharacter(); 555 561
Note:
See TracChangeset
for help on using the changeset viewer.