Changeset 476


Ignore:
Timestamp:
Nov 3, 2009, 11:38:47 AM (12 years ago)
Author:
gumby
Message:

Added Weapon information for dropped weapons
Started on adding new dsay colors

Location:
Daodan/src
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • Daodan/src/BFW_Utility.h

    r446 r476  
    2424void* TestContext;
    2525void 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);
     26int ONICALL COrMessage_Print(char* Message, char* Key, void* noidea);
     27void ONICALL COrMessage_Remove(char* Key);
    2628int16_t ONICALL TSrContext_DrawText(uint32_t TSrContext, char* Text, int alpha, uint32_t usuallyzero, OniRectangle* pRect);
    2729int16_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*);
  • Daodan/src/Daodan.c

    r474 r476  
    88#include "Daodan_Persistence.h"
    99#include "Daodan_BSL.h"
     10#include "Daodan_Console.h"
    1011
    1112#include "Daodan_WindowHack.h"
     
    179180        //Test newweap patch
    180181//      if (patch_newweapon) {
    181 //              DDrPatch_NOOP( OniExe + 0x000E4DF8, 2);
     182               
     183                //Makes it always say "Recieved weapon_name."
     184                //Needs check for loc_4DFC66
     185                DDrPatch_NOOP( OniExe + 0x000E4DF8,2);
     186
     187                //Adds Weapon name and ammo meter to pickup autoprompt
     188                DDrPatch_NOOP( OniExe + 0x000FAC73, 9);
     189                DDrPatch_NOOP( OniExe + 0x000FAC80, 5);
     190                DDrPatch_MakeCall( OniExe + 0xFAC85, DDrWeapon2Message);
     191               
     192                //Moves location of colors
     193                DDrPatch_Int32( OniExe + 0x0002E3D5, (int)&DDrDSayColors[0].Char );
     194                DDrPatch_Int32( OniExe + 0x0002E3DA, (int)&DDrDSayColors[0].Char );
    182195//      }
    183196       
  • Daodan/src/Daodan_BSL.c

    r474 r476  
    673673}
    674674
     675uint16_t ONICALL bsl_findmsg(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret)
     676{
     677        //DDrMake_Weapon_Message(args[0].value_str32);
     678        return false;
     679}
    675680void SLrDaodan_Initalize()
    676681{
     
    684689
    685690        SLrConfig();
    686        
     691        SLrScript_Command_Register_ReturnType("d_wp", "Shows weapon message", "wpn:string", sl_void, bsl_findmsg);
    687692
    688693        SLrScript_Command_Register_ReturnType("int32mul", "Multiplies two numbers", "n1:int n2:int", sl_int32, bsl_int32mul);
  • Daodan/src/Daodan_Cheater.c

    r474 r476  
    4444};
    4545
     46
     47
    4648// Just copied all these defines from the old daodan, they were originaly from SFeLi's code.
    4749
  • Daodan/src/Daodan_Console.c

    r446 r476  
    3131        return;
    3232}
     33
     34TStColorFormattingCharacter DDrDSayColors[] = {
     35        {'r', 0, 0, 0xFFEB5050},
     36        {'z', 0, 0, 0xFFFFFFFF},
     37        {0}
     38};
     39
     40               
  • Daodan/src/Daodan_Console.h

    r446 r476  
    1414} RGBA;
    1515
     16
     17typedef struct {
     18char A;
     19char R;
     20char G;
     21char B;
     22} ARGB;
     23
     24typedef struct {
     25        char Char;
     26        char ignored;
     27        char alsoignored;
     28        int Color; //ARGB Color;
     29} TStColorFormattingCharacter;
     30
     31extern TStColorFormattingCharacter* TStColorFormattingCharacters;
     32extern TStColorFormattingCharacter DDrDSayColors[];
    1633void DDrConsole_Print(const char* text);
    1734void DDrConsole_PrintColored(const char* text, int priority, RGBA color, RGBA shade);
  • Daodan/src/Daodan_Utility.c

    r380 r476  
    77#include "Daodan_Utility.h"
    88#include "BFW_Utility.h"
     9#include "Oni.h"
    910
    1011const double fps = 60.0;
     
    8081//      if (!QueryPerformanceFrequency(&Frequency))
    8182                return 1000.0;
    82 
     83       
    8384//      return Frequency.QuadPart;
    8485}
     86       
     87void 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
     104void 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}
  • Daodan/src/Daodan_Utility.h

    r276 r476  
    1010double  ONICALL DDrMachineTime_High_Frequency();
    1111int64_t ONICALL DDrMachineTime_Sixtieths();
    12 
     12void ONICALL DDrMake_Weapon_Message(char* weapon_string, char* output_ptr);
     13void ONICALL DDrWeapon2Message(int* weapon, void* output_ptr);
    1314#endif
  • Daodan/src/Daodan_Win32.c

    r326 r476  
    3535        Rect.right = Rect.left + Width;
    3636        Rect.bottom = Rect.top + Height;
    37         AdjustWindowRect(&Rect, WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_POPUP, FALSE);
     37        AdjustWindowRect(&Rect, WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_POPUP | WS_TILEDWINDOW , FALSE);
    3838
    39         PlatformData->Window = CreateWindowEx(0, "ONI ", "ONI ", WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_POPUP, Rect.left, Rect.top, Rect.right - Rect.left, Rect.bottom - Rect.top, NULL, NULL, PlatformData->Instance, NULL);
     39        PlatformData->Window = CreateWindowEx(0, "ONI ", "ONI ", WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_POPUP | WS_TILEDWINDOW , Rect.left, Rect.top, Rect.right - Rect.left, Rect.bottom - Rect.top, NULL, NULL, PlatformData->Instance, NULL);
    4040        ShowWindow(PlatformData->Window, SW_SHOWNORMAL);
    4141        UpdateWindow(PlatformData->Window);
  • Daodan/src/Oni.h

    r473 r476  
    2222uint8_t ONICALL ONrCheater(uint32_t cheat);
    2323
     24char* ONICALL SSrMessage_Find(char* message_key); //Returns a prompt message from a message key
     25void ONICALL ONiGameState_FindAutoPromptMessage(char* Note, void* ptr);
     26
     27//
     28void ONICALL TMrInstance_GetDataPtr_List(
     29        char Tag[4], //as in 'ONWC'
     30        int MaxCount, //# of elements in PointerList
     31        void** PointerList, //Where the found pointers go
     32        int* FoundCount         //Where the number of pointers found go.
     33        );
     34
    2435extern HINSTANCE g_Instance;
    2536extern ONtPlatformData ONgPlatformData;
     
    3748extern char SSgSearchOnDisk;
    3849
     50
    3951#endif
  • Daodan/src/Oni_Symbols.S

    r473 r476  
    7373symbol ( _COgDefaultTextShadow                     , 0x00133f74 )
    7474
     75symbol ( _TStColorFormattingCharacter                      , 0x00133DA0 )
     76
     77symbol ( @COrMessage_Print@12                                      , 0x000304B0 )
     78symbol ( @COrMessage_Remove@4                                      , 0x00030640 )
     79
    7580// ScriptingLanguage
    7681symbol ( @SLrScript_Command_Register_ReturnType@20 , 0x00077b20 )
     
    7984symbol ( @SLrGlobalVariable_Register_Float@12      , 0x00077ec0 )
    8085
     86// Messages
     87symbol ( @SSrMessage_Find@4                                                , 0x0007F550 )
     88symbol ( @ONiGameState_FindAutoPromptMessage@8     , 0x000FDBE0 )
     89
     90// Data
     91symbol ( @TMrInstance_GetDataPtr_List@16                   , 0x00023540 )
  • Daodan/src/daodan_gl.c

    r474 r476  
    242242                Rect.right = Rect.left + gl->DisplayMode.Width;
    243243                Rect.bottom = Rect.top + gl->DisplayMode.Height;
    244                 AdjustWindowRect(&Rect, WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_CAPTION, TRUE);
     244                AdjustWindowRect(&Rect, WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_CAPTION |WS_TILEDWINDOW , FALSE);
    245245               
    246246                SetWindowPos(ONgPlatformData.Window, NULL, Rect.left, Rect.top, Rect.right - Rect.left, Rect.bottom - Rect.top, SWP_NOACTIVATE | SWP_NOZORDER);
Note: See TracChangeset for help on using the changeset viewer.