- Timestamp:
- Aug 29, 2010, 9:13:47 PM (14 years ago)
- Location:
- Daodan/MSVC
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
Daodan/MSVC/Daodan.c
r569 r572 53 53 bool patch_bsl = true; 54 54 bool patch_cheater = true; 55 56 // bool patch_newweapon = true; 57 55 bool patch_newweapon = true; 58 56 bool opt_usedaodanbsl = true; 59 57 bool opt_border = true; … … 189 187 190 188 //Test newweap patch 191 //if (patch_newweapon) {189 if (patch_newweapon) { 192 190 193 191 //Makes it always say "Recieved weapon_name." 194 192 //Needs check for loc_4DFC66 195 DDrPatch_NOOP( OniExe + 0x000E4DF8,2);193 //DDrPatch_NOOP( OniExe + 0x000E4DF8,2); 196 194 197 195 //Adds Weapon name and ammo meter to pickup autoprompt … … 203 201 //DDrPatch_Int32( 0x0042E3D5, (int)&DDrDSayColors ); 204 202 //DDrPatch_Int32( 0x0042E3DA, (int)&DDrDSayColors ); 205 //}203 } 206 204 207 205 // Disable loading the vtuneapi.dll … … 286 284 else if (!_stricmp(name, "switch")) 287 285 M3gResolutionSwitch = !_stricmp(inifile_cleanstr(value), "true"); 286 //else if (!_stricmp(name, "devmode")) 287 //turn_dev_mode_on = !_stricmp(inifile_cleanstr(value), "true"); 288 288 else 289 289 DDrStartupMessage("unrecognised option \"%s\"", name); … … 344 344 else if (!_stricmp(name, "cheater")) 345 345 patch_cheater = !_stricmp(inifile_cleanstr(value), "true"); 346 else if (!_stricmp(name, "newweap")) 347 patch_newweapon = !_stricmp(inifile_cleanstr(value), "true"); 346 348 else 347 349 DDrStartupMessage("unrecognised patch \"%s\"", name); … … 465 467 void DDrConfig() 466 468 { 467 /* if (GetFileAttributes("daodan.ini") == INVALID_FILE_ATTRIBUTES) 468 { 469 470 if (GetFileAttributes("daodan.ini") == INVALID_FILE_ATTRIBUTES) 471 { 472 FILE* fp; 469 473 DDrStartupMessage("daodan.ini doesn't exist, creating"); 470 FILE*fp = fopen("daodan.ini", "w");474 fp = fopen("daodan.ini", "w"); 471 475 if (fp) 472 476 { … … 478 482 DDrStartupMessage("parsing daodan.ini..."); 479 483 if (!inifile_read("daodan.ini", DDrIniCallback)) 480 DDrStartupMessage("error reading daodan.ini, check your syntax!"); */484 DDrStartupMessage("error reading daodan.ini, check your syntax!"); 481 485 DDrStartupMessage("finished parsing"); 482 486 } … … 591 595 if (patch_cheatsenabled) 592 596 DDrPatch_MakeJump(ONrPersist_GetWonGame, DDrPersist_GetWonGame); 593 //#if 0 597 594 598 // Windowed mode 595 //if (patch_usedaodangl)599 if (patch_usedaodangl) 596 600 { 597 601 DDrPatch_NOOP((char*)0x004032B7, 6); … … 603 607 DDrPatch_MakeJump(gl_platform_initialize, daodangl_platform_initialize); 604 608 } 605 //#endif606 609 // Hacked windowed mode (for when daodangl isn't working properly) 607 //if (patch_windowhack) 608 609 // DDrWindowHack_Install(); 610 else if (patch_windowhack) 611 DDrWindowHack_Install(); 610 612 611 613 if (patch_daodaninit) -
Daodan/MSVC/Daodan_BSL.c
r569 r572 5 5 #include <math.h> 6 6 #include "inifile.h" 7 7 #include "Flatline.h" 8 8 #include "Daodan_BSL.h" 9 9 #include "Flatline_BSL.h" … … 201 201 ret->type = sl_int32; 202 202 203 if ( numargs >=2) {203 if (args[1].value_int32) { 204 204 *health = args[1].value_int32; 205 205 } … … 265 265 } 266 266 uint16_t ONICALL bsl_location(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret) { 267 int index ;267 int index, i; 268 268 float* loc; 269 269 Character* Chr; 270 numargs = 0; 271 for(i = 0; args[i].type < sl_void; i++) 272 { 273 numargs++; 274 } 275 276 270 277 if (numargs < 2) return 1; 271 278 if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].value_str32); … … 273 280 if (index == -1) index = args[0].value_int32; 274 281 Chr = ONgGameState->CharacterStorage; 275 276 if (!strcmp(args[1].value_str32,"X") || !strcmp(args[1].value_str32,"x")) 277 loc = &(Chr[index].Position.X); 278 else if (!strcmp(args[1].value_str32,"Y") || !strcmp(args[1].value_str32,"y")) 279 loc = &(Chr[index].Position.Y); 280 else if (!strcmp(args[1].value_str32,"Z") || !strcmp(args[1].value_str32,"z")) 281 loc = &(Chr[index].Position.Z); 282 if(numargs == 3) 283 { 284 if (!strcmp(args[1].value_str32,"X") || !strcmp(args[1].value_str32,"x")) 285 loc = &(Chr[index].Position.X); 286 else if (!strcmp(args[1].value_str32,"Y") || !strcmp(args[1].value_str32,"y")) 287 loc = &(Chr[index].Position.Y); 288 else if (!strcmp(args[1].value_str32,"Z") || !strcmp(args[1].value_str32,"z")) 289 loc = &(Chr[index].Position.Z); 290 } 282 291 else if (numargs == 4) { 283 //currently broken. crashes oni. 284 Chr[index].Position.X = args[1].value_float; 285 Chr[index].Position.Y = args[2].value_float; 286 Chr[index].Position.Z = args[3].value_float; 292 ActiveCharacter* Active = (ActiveCharacter*)ONrGetActiveCharacter(&Chr[index]); 293 Chr[index].Location.X = args[1].value_float; 294 Chr[index].Location.Y = args[2].value_float; 295 Chr[index].Location.Z = args[3].value_float; 296 if(Active) 297 { 298 Active->PhyContext->Position = Chr[index].Location; 299 } 287 300 ret->value_float = 1; 288 301 ret->type = sl_float; … … 348 361 int index; 349 362 char* name; 363 350 364 if (numargs == 0) index = 0; 351 365 else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].value_str32); … … 381 395 RGBA color; 382 396 RGBA shade; 383 397 int i; 398 numargs = 0; 399 for(i = 0; args[i].type < sl_void; i++) 400 { 401 numargs++; 402 } 384 403 if(numargs == 0) return 0; 385 404 if(numargs > 1 ) color.R = (char)args[1].value_int32; … … 492 511 } 493 512 Active->Input.Current.Actions1 = Active->Input.Current.Actions1 | Input1; 494 Active->Input.Current.Actions2 = Active->Input.Current.Actions 1| Input2;513 Active->Input.Current.Actions2 = Active->Input.Current.Actions2 | Input2; 495 514 if( Input1 + Input2 == 0 ) { 496 515 DDrConsole_PrintF("Func \"%s\", File \"%s\", Line %d: semantic error, \"%s\": No valid keys given.", callinfo->name, callinfo->calllocation, callinfo->linenumber, callinfo->name); … … 856 875 857 876 } 877 858 878 void* TSrTest = 0; 859 879 uint16_t ONICALL new_text(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret) … … 861 881 void* TSFFTahoma; 862 882 int returnval; 863 TMrInstance_GetDataPtr( 'TSFF', "Tahoma", &TSFFTahoma); 883 884 if(!TSrTest){ 885 TMrInstance_GetDataPtr( 'TSFF', "Tahoma", &TSFFTahoma); 864 886 returnval = TSrContext_New( TSFFTahoma, 7, 1, 1, 0, &TSrTest); 887 } 888 DDrPatch_MakeCall(0x004FBCEA, DDrText_Hook); 889 890 *dontuse2 = 1; 865 891 return 0; 866 892 } … … 883 909 SLrScript_Command_Register_ReturnType("d_getindex","Converts a character's name to its index", "ai_name:string", sl_int32, bsl_nametoindex); 884 910 SLrScript_Command_Register_ReturnType("d_health","Gets or sets a character's health", "[ai_name:string | script_id:int] [newhealth:int]", sl_str32, bsl_health); 885 SLrScript_Command_Register_ReturnType("d_regen","Gets or sets a character's health", "[ai_name:string | script_id:int] [newhealth:int]", sl_str32, bsl_regen);911 SLrScript_Command_Register_ReturnType("d_regen","Gets or sets a character's regeneration abilities", "[ai_name:string | script_id:int] [newhealth:int]", sl_str32, bsl_regen); 886 912 SLrScript_Command_Register_ReturnType("d_maxhealth","Gets or sets a character's maximum health", "[ai_name:string | script_id:int] [newmaxhealth:int] [scalehealth:bool]", sl_str32, bsl_maxhealth); 887 913 SLrScript_Command_Register_ReturnType("d_powerup","Gets or sets a character's powerups", "[ai_name:string | script_id:int] powerup:string", sl_int32, bsl_powerup); … … 889 915 SLrScript_Command_Register_ReturnType("d_holdkey","Makes a character hold a key", "[ai_name:string | script_id:int] frames:int keys:string", sl_int32, bsl_holdkey); 890 916 SLrScript_Command_Register_ReturnType("d_isheld","Checks if player is holding a key", "[ai_name:string | script_id:int] [keys:string]", sl_int32, bsl_isheld); 891 SLrScript_Command_Register_ReturnType("d_location","Returns the X, Y or Z coord of a character", " ai_name:string | script_id:int xyz:string [newlocation:float]", sl_float, bsl_location);917 SLrScript_Command_Register_ReturnType("d_location","Returns the X, Y or Z coord of a character", "", sl_float, bsl_location); 892 918 SLrScript_Command_Register_ReturnType("d_distance","Returns the distance between two characters", "ai_name:string | script_id:int ai_name:string | script_id:int", sl_float, bsl_distance); 893 919 SLrScript_Command_Register_Void("d_waitforkey","Waits for a keypress from the player", "key:string", bsl_waitforkey); … … 900 926 901 927 SLrScript_Command_Register_Void("sprintf", "C-style sprintf.", "", bsl_sprintf); 902 SLrScript_Command_Register_ReturnType("st", "prints to console in color", "text:string color1:int color2:int", sl_void, bsl_dprintcolored); 928 SLrScript_Command_Register_ReturnType("st", "prints to console in color", "", sl_void, bsl_dprintcolored); 929 SLrScript_Command_Register_ReturnType("d_dprint", "prints to console in color", "", sl_void, bsl_dprintcolored); 903 930 904 931 //Flatline -
Daodan/MSVC/Daodan_Cheater.h
r567 r572 46 46 47 47 extern oniCheatCode DDr_CheatTable[]; 48 48 extern int turn_dev_mode_on; 49 49 uint8_t ONICALL DDrCheater(uint32_t cheat); 50 50 void __stdcall FallingFrames(void* Ebp); -
Daodan/MSVC/Daodan_Utility.c
r567 r572 88 88 } 89 89 90 void ONICALL DDrWeapon2Message(int* weapon, void* output_ptr) { 90 void ONICALL DDrWeapon2Message(int* weapon, void* output_ptr) 91 { 91 92 char buffer[128] = {0}; 92 93 char* weapon_string = (char*)(*(weapon + 1)+0x5C); … … 107 108 108 109 109 void ONICALL DDrMake_Weapon_Message(char* weapon_string, char* output_ptr) { 110 void ONICALL DDrMake_Weapon_Message(char* weapon_string, char* output_ptr) 111 { 110 112 char* weapon_msg = NULL; //The normal "You have recieved X" message. 111 113 char weapon_name[64] = {'\0'}; //The stripped weapon name … … 125 127 126 128 } 129 typedef struct 130 { 131 uint16_t x; 132 uint16_t y; 133 134 } IMtPoint2D; 135 IMtPoint2D Point = {256, 250}; 136 extern void* TSrTest; 137 void ONICALL DDrText_Hook() 138 { 139 if(TSrTest) 140 { 141 TSrContext_DrawText(TSrTest, "FINALLY THIS BLOODY TEXT THING WORKS\n Gotta call it at the right point...", 128, 0, &Point); 142 } 143 COrConsole_StatusLine_Display(); 144 145 } -
Daodan/MSVC/Daodan_Utility.h
r567 r572 12 12 void ONICALL DDrMake_Weapon_Message(char* weapon_string, char* output_ptr); 13 13 void ONICALL DDrWeapon2Message(int* weapon, void* output_ptr); 14 void ONICALL DDrText_Hook(); 14 15 #endif -
Daodan/MSVC/Flatline.c
r569 r572 506 506 return -1; 507 507 } 508 508 typedef struct 509 { 510 uint16_t x; 511 uint16_t y; 512 513 } IMtPoint2D; 509 514 static flatline_packet cache_input = {0}; 510 515 extern void* TSrTest; … … 562 567 if( TSrTest ) 563 568 { 564 OniRectangle TextRect = { 20, 20, 50, 50 }; 565 TSrContext_DrawText(TSrTest, "Testing woohoo", 0xFF, 0, &TextRect); 569 // OniRectangle TextRect = { 128, 128, 256, 256 }; 570 IMtPoint2D Point = {50, 50}; 571 //TSrContext_DrawText(TSrTest, "Testing woohoo", 255, 0, &Point); 572 TSrContext_DrawText(TSrTest, "WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW", 255, 0, &Point); 573 566 574 } 567 575 if(!(server_started || client_connected)) return ONgGameState; -
Daodan/MSVC/Oni_Symbols.c
r569 r572 130 130 DefFunc( COrMessage_Print , 0x004304B0 ); 131 131 DefFunc( COrTextArea_Print , 0x00431340 ); 132 132 DefFunc( COrConsole_StatusLine_Display , 0x00431E70 ); 133 133 DefFunc( ONiGameState_FindAutoPromptMessage , 0x004FDBE0 ); 134 134 DefFunc( ONiMain , 0x004d3280 ); -
Daodan/MSVC/Oni_Symbols.h
r568 r572 105 105 106 106 typedef int ( *_COrMessage_Print)(char* Message, char* Key, void* noidea); 107 107 typedef void ( *_COrConsole_StatusLine_Display)(); 108 108 typedef int16_t ( *_TMrInstance_GetDataPtr)(int tag, char* name, void* pointer); 109 109 typedef char* ( *_TMrInstance_GetInstanceName)(void* InstancePointer); … … 122 122 ExtFunc(SLrGlobalVariable_Register_Float); 123 123 ExtFunc(SLrGlobalVariable_Register_String); 124 124 ExtFunc(COrConsole_StatusLine_Display); 125 125 126 126 extern _UUrMachineTime_High UUrMachineTime_High; -
Daodan/MSVC/daodan_gl.c
r567 r572 5 5 #include "Oni_Persistence.h" 6 6 #include "Daodan_Utility.h" 7 7 #include <gl/gl.h> 8 #include <gl/glu.h> 9 #include "gl/wglext.h" //WGL extensions 10 #include "gl/glext.h" //GL extensions 11 #include "Daodan_Win32.h" 8 12 #include "BFW_Utility.h" 9 13 … … 45 49 { 1920, 1440, 0, 0 }, 46 50 }; 47 48 short daodan_resdepths[] = { 16, 32 };49 51 //Just going to always use 32 bits for now... 52 //short daodan_resdepths[] = { 16, 32 }; 53 short daodan_resdepths[] = { 32 }; 50 54 DEVMODE orig_devmode, cur_devmode, new_devmode; 51 55 … … 83 87 { 84 88 unsigned int vmodes = 0; 85 unsigned int screen_x = orig_devmode.dmPelsWidth;86 unsigned int screen_y = orig_devmode.dmPelsHeight;89 unsigned int screen_x = GetSystemMetrics(SM_CXSCREEN); 90 unsigned int screen_y = GetSystemMetrics(SM_CYSCREEN); 87 91 88 92 uint16_t i, j; 89 93 90 94 DDrStartupMessage("listing display modes"); 91 95 /* 92 96 if (!M3gResolutionSwitch) 93 97 daodan_resdepths[0] = orig_devmode.dmBitsPerPel; 94 98 */ 95 99 for (i = 0; i < builtin_depths; i ++) 96 100 { … … 192 196 return 1; 193 197 } 194 195 void daodan_set_gamma(float gamma)196 {197 WORD ramp[3][256];198 int i;199 200 if (!gl_gamma_ramp_valid)201 return;202 203 gamma = (1.0f - gamma) * 1.2f + 0.4f;204 205 for (i = 0; i < 256; i++)206 {207 int value = (int)(pow(gl_gamma_ramp[i] / 65535.0f, gamma) * 65535.0f);208 209 if (value < 0)210 value = 0;211 else if (value > 65535)212 value = 65535;213 214 ramp[0][i] = ramp[1][i] = ramp[2][i] = value;215 }216 217 if (gl_api->wglSetDeviceGammaRamp3DFX)218 gl_api->wglSetDeviceGammaRamp3DFX(gl_eng->HDC, ramp);219 else220 SetDeviceGammaRamp(gl_eng->HDC, ramp);221 }222 223 198 int ONICALL daodangl_platform_initialize() 224 199 { … … 265 240 gl_gamma_ramp_valid = 1; 266 241 } 267 242 /* 268 243 if (gl_gamma_ramp_valid) 269 244 daodan_set_gamma(ONrPersist_GetGamma()); 270 else 245 else*/ 271 246 DDrStartupMessage("gamma adjustment not supported"); 272 247 -
Daodan/MSVC/daodan_gl.h
r567 r572 15 15 void daodan_set_gamma(float gamma); 16 16 int ONICALL daodangl_platform_initialize(); 17 17 daodan_init_msaa(); 18 18 #endif
Note:
See TracChangeset
for help on using the changeset viewer.