6 |
|
|
7 |
|
#include "Daodan_Utility.h" |
8 |
|
#include "BFW_Utility.h" |
9 |
+ |
#include "Oni.h" |
10 |
|
|
11 |
|
const double fps = 60.0; |
12 |
|
|
80 |
|
// |
81 |
|
// if (!QueryPerformanceFrequency(&Frequency)) |
82 |
|
return 1000.0; |
83 |
< |
|
83 |
> |
|
84 |
|
// return Frequency.QuadPart; |
85 |
|
} |
86 |
+ |
|
87 |
+ |
void ONICALL DDrWeapon2Message(int* weapon, void* output_ptr) { |
88 |
+ |
char buffer[128] = {0}; |
89 |
+ |
char* weapon_string = (char*)(*(weapon + 1)+0x5C); |
90 |
+ |
int16_t ammo = *(int16_t *)((int)weapon + 0x56); |
91 |
+ |
int16_t maxammo = *(int16_t *)(*(weapon + 1)+0xC0); |
92 |
+ |
float ratio = (float)ammo / (float)maxammo; |
93 |
+ |
char ammocolor = ' '; |
94 |
+ |
if(ratio >= .9) ammocolor = 'g'; |
95 |
+ |
else if (ratio >= .5) ammocolor = 'y'; |
96 |
+ |
else if (ratio >= .2) ammocolor = 'o'; |
97 |
+ |
else ammocolor = 'r'; |
98 |
+ |
DDrMake_Weapon_Message( weapon_string, buffer); //gets the name of the weapon and formats it...probably doesn't need to be in seperate func. |
99 |
+ |
sprintf(SSrMessage_Find("autoprompt_weapon"), "%s |[%s.%i/%i]|", buffer, &ammocolor, ammo, maxammo); //copies the new string to ONGS |
100 |
+ |
ONiGameState_FindAutoPromptMessage("weapon", output_ptr); //does what the code i replaced does. Basically tells the game to show the msg. |
101 |
+ |
} |
102 |
+ |
|
103 |
+ |
|
104 |
+ |
void ONICALL DDrMake_Weapon_Message(char* weapon_string, char* output_ptr) { |
105 |
+ |
char* weapon_msg = NULL; //The normal "You have recieved X" message. |
106 |
+ |
char weapon_name[64] = {'\0'}; //The stripped weapon name |
107 |
+ |
//TODO, someday: dynamically detect different keybindings. |
108 |
+ |
char default_msg[] = "Press [c.Q] to pick up weapon."; //default return |
109 |
+ |
|
110 |
+ |
//Find the recieved message string |
111 |
+ |
weapon_msg = SSrMessage_Find(weapon_string); |
112 |
+ |
//this probably could be reorganized |
113 |
+ |
if(weapon_msg) { //SSrMsgblah returns NULL if it can't find the message key |
114 |
+ |
memcpy(weapon_name, weapon_msg, (strstr(weapon_msg," received.") - weapon_msg )); //strips uneeded characters |
115 |
+ |
sprintf(output_ptr, "Press [c.Q] to pick up %s", weapon_name); |
116 |
+ |
} |
117 |
+ |
else { |
118 |
+ |
memcpy(output_ptr, default_msg, sizeof(default_msg)); |
119 |
+ |
} |
120 |
+ |
|
121 |
+ |
} |