source: Daodan/src/Daodan_Character.c@ 478

Last change on this file since 478 was 468, checked in by rossy, 15 years ago
File size: 2.3 KB
RevLine 
[427]1#include <stdlib.h>
[428]2#include "Daodan_Character.h"
[427]3#include "Oni_Character.h"
[446]4#include "BFW_Utility.h"
5#include "Oni.h"
[427]6
[428]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.....
[427]18}
19
[446]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}
[468]33/*
[446]34OniRectangle TestRect;
[428]35void CHARTest()
36{
[446]37
[433]38 CharacterObject* TestCHAR = malloc(sizeof(CharacterObject));
39 memset(TestCHAR, 0, sizeof(CharacterObject));
[428]40
[433]41 int type = 0x43484152;
42 TestCHAR->Header.Type = type;
43 memcpy(TestCHAR->OSD.Name, "Gumby", 6);
[434]44 memcpy(TestCHAR->OSD.Class, "striker_easy_1", 15);
[446]45 memcpy(TestCHAR->OSD.ScriptSpawn, "dmsg", 20);
46 //TestCHAR->OSD.Options = chr_unkillable;
[433]47 TestCHAR->OSD.TeamID = team_syndicate;
[446]48 //int* ptr = 0x005ECE70;
49 TestRect.Top = 10;
50 TestRect.Left = 10;
51 TestRect.Right = 100;
52 TestRect.Bottom = 100;
[428]53
[446]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;
[428]60}
[468]61*/
Note: See TracBrowser for help on using the repository browser.