source: Daodan/src/Daodan_Character.c @ 455

Last change on this file since 455 was 446, checked in by gumby, 14 years ago
File size: 2.3 KB
Line 
1#include <stdlib.h>
2#include "Daodan_Character.h"
3#include "Oni_Character.h"
4#include "BFW_Utility.h"
5#include "Oni.h"
6
7int DDr_TeamToTeamID(const char* team_string) //Already something like this in the engine, but I'm reimplementing it...
8{
9        if (!strcmp(team_string, "Konoko"))                  return team_konoko;
10        else if (!strcmp(team_string, "TCTF"))               return team_tctf;
11        else if (!strcmp(team_string, "Syndicate"))          return team_syndicate;
12        else if (!strcmp(team_string, "Neutral"))            return team_neutral;
13        else if (!strcmp(team_string, "SecurityGuard"))      return team_securityguard;
14        else if (!strcmp(team_string, "RougeKonoko"))        return team_rougekonoko;
15        else if (!strcmp(team_string, "Switzerland"))        return team_switzerland;
16        else if (!strcmp(team_string, "SyndicateAccessory")) return team_syndicateaccessory;
17        return team_neutral; //if you enter a bad teamname, return Neutral.....
18}
19
20uint32_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        }
31return -1;                                                                                                      //not found :(
32}
33
34OniRectangle TestRect;
35void CHARTest()
36{
37       
38        CharacterObject* TestCHAR = malloc(sizeof(CharacterObject));
39        memset(TestCHAR, 0, sizeof(CharacterObject));
40       
41        int type = 0x43484152;
42        TestCHAR->Header.Type = type;
43        memcpy(TestCHAR->OSD.Name, "Gumby", 6);
44        memcpy(TestCHAR->OSD.Class, "striker_easy_1", 15);
45        memcpy(TestCHAR->OSD.ScriptSpawn, "dmsg", 20); 
46        //TestCHAR->OSD.Options = chr_unkillable;
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;
53       
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;
60}
Note: See TracBrowser for help on using the repository browser.