int __thiscall ChatToAllies_Execute(void *a) { if (!PlayerPtr->Defeated) { ChatToAlliesFlag = 1; // Defined in chatallies.asm WWDebug_Printf("ChatToAllies enabled[%x]\n",&ChatToAllies_Execute); } else WWDebug_Printf("Can't chat allies, you read dead[%x]\n",ChatToAllies_Execute); return 1; }
void __stdcall HookInitCommands() { CommandClass *NewHotkeys[] = { &ChatToAlliesCommand, &ChatToAllCommand, &ChatToPlayerCommand, &TextBackgroundColorCommand, &GrantControlCommand, #ifdef WWDEBUG &MultiplayerDebugCommand, &MapSnapshotCommand, &ToggleTacticalZoomCommand #endif }; size_t len = sizeof(NewHotkeys)/sizeof((NewHotkeys)[0]); for (int i = 0; i < len; i++) { DynamicVectorClass__CommandClass__Add(&DynamicVectorClass__CommandClass, &(NewHotkeys[i])); } Load_Keyboard_Hotkeys(); bool seen_all = 0, seen_allies = 0, seen_return = 0, seen_backspace = 0; // Loop through hotkeys and if chattoallis is not enabled then set it to backspace for (int i = 0; i < Hotkeys_ActiveCount; i++) { Hotkey key = Hotkeys_Vector[i]; if (key.Command == &ChatToAlliesCommand) { seen_allies = 1; WWDebug_Printf("****************************Seen ChatToAllies\n"); } if (key.Command == &ChatToAllCommand) { seen_all = 1; WWDebug_Printf("****************************Seen ChatToAll\n"); } if (key.KeyCode == 0x8) seen_backspace = 1; if (key.KeyCode == 0xD) seen_return = 1; } if (!seen_allies && !seen_backspace) { WWDebug_Printf("****************************didn't see ChatToAllies adding as hotkey[%d]\n",Hotkeys_ActiveCount); if (Hotkeys_VectorMax <= Hotkeys_ActiveCount+1) CCINIClass_Vector_Resize(&Hotkeys, 10); Hotkeys_Vector[Hotkeys_ActiveCount].Command = &ChatToAlliesCommand; Hotkeys_Vector[Hotkeys_ActiveCount].KeyCode = 0x8; ++Hotkeys_ActiveCount; } if (!seen_all && !seen_return) { WWDebug_Printf("****************************didn't see ChatToAll adding as hotkey[%d]\n",Hotkeys_ActiveCount); Hotkeys_Vector[Hotkeys_ActiveCount].Command = &ChatToAllCommand; Hotkeys_Vector[Hotkeys_ActiveCount].KeyCode = 0x0D; ++Hotkeys_ActiveCount; } }
void __fastcall show_stats(int32_t *width, char *str, void *surface, Rect *s_coord, Rect *coord, int32_t *color, int32_t bg_color, int32_t TextPrintType, int32_t a9) { WWDebug_Printf("%x,%s, surface = %x, s_coord = (%d,%d,%d,%d),", width,str, surface, s_coord->left, s_coord->top, s_coord->width, s_coord->height); WWDebug_Printf("coord = (%d,%d,%d,%d),", coord->left, coord->top, coord->width, coord->height); WWDebug_Printf(" color = %d, bg_color = %x, TextPrintType = %x, a9 = %x\n", *color, bg_color, TextPrintType, a9); }
void __thiscall GrantControl_Execute() { if (SessionType.GameSession && !PlayerPtr->Defeated && SharedControl) { if (CurrentObjectsArray.ActiveCount > 0) { ObjectClass *first = *CurrentObjectsArray.Vector; int32_t his_id = ((AbstractClass *)first)->vftable->Owning_HouseID((AbstractClass *)first); if (PlayerPtr->ID != his_id && HouseClass__Is_Ally(PlayerPtr, his_id)) { EventClass e; EventClass__EventClass_PlayerID(&e, PlayerPtr->ID, EVENTTYPE_GRANTCONTROL, his_id); WWDebug_Printf("Enqueing event %s => %d, %d\n", "GRANTCONTROL", PlayerPtr->ID, his_id); EventClass__EnqueueEvent(&e); } } } }
void Toggle_Control(EventClass *e) { WWDebug_Printf("offset = 0x%x\n", offsetof(HouseClass, RecheckItems)); char message[128]; uint32_t grantee = Controlling_Houses[e->ID]; uint32_t target_mask = 1 << (e->Target_ID); if (grantee ^ target_mask) sprintf(message, "Player %s has shared control with player %s\n", HouseClassArray.Vector[e->ID]->Name, HouseClassArray.Vector[e->Target_ID]->Name ); else sprintf(message, "Player %s has revoked control from %s\n", HouseClassArray.Vector[e->ID]->Name, HouseClassArray.Vector[e->Target_ID]->Name ); Controlling_Houses[e->ID] = grantee ^ target_mask; WWDebug_Printf("Control = %x %x %x %x %x %x %x %x\n", Controlling_Houses[0], Controlling_Houses[1], Controlling_Houses[2], Controlling_Houses[3], Controlling_Houses[4], Controlling_Houses[5], Controlling_Houses[6], Controlling_Houses[7] ); MessageListClass__Add_Message(&MessageListClass_this, 0, 0, message, HouseClassArray.Vector[e->ID]->ColorSchemeType, 0x4046, (int)(Rules->MessageDuration * FramesPerMinute)); }
void LoadSunIni() { IsNoCD = SunIni_GetBool("Options", "NoCD", true); if (SunIni_GetBool("Options", "SingleProcAffinity", true)) SetSingleProcAffinity(); else SetMultiProcAffinity(); VideoBackBuffer = SunIni_GetBool("Video", "VideoBackBuffer", true); NoWindowFrame = SunIni_GetBool("Video", "NoWindowFrame", false); UseGraphicsPatch = SunIni_GetBool("Video", "UseGraphicsPatch", true); VideoWindowed = SunIni_GetBool("Video", "Video.Windowed", false); ScrollDelay = SunIni_GetInt("Options", "ScrollDelay", 0); ForceConversionType4 = SunIni_GetBool("Video", "ForceConversionType4", true); UsePNG = SunIni_GetBool("Video", "UsePNG", true); if (SunIni_GetBool("Video", "DisableHighDpiScaling", false)) DisableHighDpiScaling(); if (SunIni_GetBool("Video", "DisableMaxWindowedMode", true)) fnDisableMaxWindowedMode(); if (SunIni_GetBool("Win8Compat", "Enabled", false)) { DWMOffForPrimaryLock = SunIni_GetBool("Win8Compat", "DWMOffForPrimaryLock", DWMOffForPrimaryLock); DWMOffForPrimaryBlt = SunIni_GetBool("Win8Compat", "DWMOffForPrimaryBlt", DWMOffForPrimaryBlt); ForceFullscreenSprite = SunIni_GetBool("Win8Compat", "ForceFullscreenSprite", ForceFullscreenSprite); ForceBltToPrimary = SunIni_GetBool("Win8Compat", "ForceBltToPrimary", ForceBltToPrimary); LockColorkey = SunIni_GetBool("Win8Compat", "LockColorkey", LockColorkey); DWMOffForFullscreen = SunIni_GetBool("Win8Compat", "DWMOffForFullscreen", DWMOffForFullscreen); DisableLockEmulation = SunIni_GetBool("Win8Compat", "DisableLockEmulation", DisableLockEmulation); EnableOverlays = SunIni_GetBool("Win8Compat", "EnableOverlays", EnableOverlays); DisableSurfaceLock = SunIni_GetBool("Win8Compat", "DisableSurfaceLock", DisableSurfaceLock); RedirectPrimarySurfBlts = SunIni_GetBool("Win8Compat", "RedirectPrimarySurfBlts", RedirectPrimarySurfBlts); StripMaxWindowBorder = SunIni_GetBool("Win8Compat", "StripMaxWindowBorder", StripMaxWindowBorder); DisableMaxWindowedMode = SunIni_GetBool("Win8Compat", "DisableMaxWindowedMode", DisableMaxWindowedMode); SetWin8CompatData(); } HMODULE hDDraw = LoadLibraryA("ddraw.dll"); bool *isDDraw = (bool *)GetProcAddress(hDDraw, "TSDDRAW"); UsingTSDDRAW = isDDraw && *isDDraw; LPDWORD TargetFPS = (LPDWORD)GetProcAddress(hDDraw, "TargetFPS"); if (TargetFPS) { *TargetFPS = SunIni_GetInt("Video", "DDrawTargetFPS", *TargetFPS); } // If video_mode_hacks is included then set ThreadSafe to disable SingleProcAffinity LPDWORD ThreadSafe = (LPDWORD)GetProcAddress(hDDraw, "ThreadSafe"); if (ThreadSafe) { *ThreadSafe = true; } MouseIntervalResolution = SunIni_GetInt("Video", "MouseResolution", 1); MouseRenderInterval = SunIni_GetInt("Video", "MouseRenderInterval", 16); #ifndef SINGLEPLAYER bool *handleClose = (bool *)GetProcAddress(hDDraw, "GameHandlesClose"); if (handleClose) *handleClose = true; if (OverrideColors = SunIni_GetBool("Options","OverrideColors",false)) ApplyUserColorOverrides(); TextBackgroundColor = SunIni_GetInt("Options","TextBackgroundColor",0); DisableEdgeScrolling = SunIni_GetBool("Options","DisableEdgeScrolling",false); MultiplayerDebug = SunIni_GetBool("Options","MultiplayerDebug",false); IntegrateMumbleSun = SunIni_GetBool("Options", "IntegrateMumble", false); if (SunIni_GetBool("Options", "DisableAltTab", false)) { WWDebug_Printf("Disabling Alt+Tab\n"); LoadKeyboardHook(); } DragDistance = SunIni_GetInt("Options", "DragDistance", 4); MouseAlwaysInFocus = SunIni_GetBool("Options", "MouseAlwaysInFocus", false); HoverShowHealth = SunIni_GetBool("Options", "HoverShowHealth", true); InfoPanel = SunIni_GetInt("Options", "InfoPanel", -1); MoveToUndeploy = SunIni_GetBool("Options", "MoveToUndeploy", true); SkipScoreScreen = SunIni_GetBool("Options", "SkipScoreScreen", false); DoubleTapInterval = SunIni_GetInt("Options", "DoubleTapInterval", -1); AltToRally = SunIni_GetBool("Options", "AltToRally", false); AddTeamStyle2 = SunIni_GetBool("Options", "AddTeamStyle2", false); #endif }