refactor: decouple minecraft/ from app/ via IGameServices virtual interface

This commit is contained in:
MatthewBeshay
2026-04-06 20:32:24 -05:00
committed by Tropical
parent 7787015025
commit 5d9bcac156
246 changed files with 1897 additions and 2224 deletions
+706
View File
@@ -0,0 +1,706 @@
#pragma once
enum eFileExtensionType {
eFileExtensionType_PNG = 0,
eFileExtensionType_INF,
eFileExtensionType_DAT,
};
enum eTMSFileType {
eTMSFileType_MinecraftStore = 0,
eTMSFileType_TexturePack,
eTMSFileType_All
};
enum eTPDFileType {
eTPDFileType_Loc = 0,
eTPDFileType_Icon,
// eTPDFileType_Banner,
eTPDFileType_Comparison,
};
enum eFont {
eFont_European = 0,
eFont_Korean,
eFont_Japanese,
eFont_Chinese,
eFont_None, // to fallback to nothing
};
enum eXuiAction {
eAppAction_Idle = 0,
eAppAction_SaveGame,
eAppAction_SaveGameCapturedThumbnail,
eAppAction_ExitWorld,
eAppAction_ExitWorldCapturedThumbnail,
eAppAction_ExitWorldTrial,
// eAppAction_ExitGameFatalLoadError,
eAppAction_Respawn,
eAppAction_WaitForRespawnComplete,
eAppAction_PrimaryPlayerSignedOut,
eAppAction_PrimaryPlayerSignedOutReturned,
eAppAction_PrimaryPlayerSignedOutReturned_Menus,
eAppAction_ExitPlayer, // secondary player
eAppAction_ExitPlayerPreLogin,
eAppAction_TrialOver,
eAppAction_ExitTrial,
eAppAction_WaitForDimensionChangeComplete,
// eAppAction_SocialPost,
// eAppAction_SocialPostScreenshot,
eAppAction_EthernetDisconnected,
eAppAction_EthernetDisconnectedReturned,
eAppAction_EthernetDisconnectedReturned_Menus,
eAppAction_ExitAndJoinFromInvite,
eAppAction_DashboardTrialJoinFromInvite,
eAppAction_ExitAndJoinFromInviteConfirmed,
eAppAction_JoinFromInvite,
eAppAction_ChangeSessionType,
eAppAction_SetDefaultOptions,
eAppAction_LocalPlayerJoined,
eAppAction_RemoteServerSave,
eAppAction_WaitRemoteServerSaveComplete,
eAppAction_FailedToJoinNoPrivileges,
eAppAction_AutosaveSaveGame,
eAppAction_AutosaveSaveGameCapturedThumbnail,
eAppAction_ProfileReadError,
eAppAction_DisplayLavaMessage,
eAppAction_BanLevel,
eAppAction_LevelInBanLevelList,
eAppAction_ReloadTexturePack,
eAppAction_ReloadFont,
eAppAction_TexturePackRequired, // when the user has joined from invite,
// but doesn't have the texture pack
eAppAction_DebugText,
};
enum eTMSAction {
eTMSAction_Idle = 0,
eTMSAction_TMS_RetrieveFiles_Complete,
eTMSAction_TMSPP_RetrieveFiles_CreateLoad_SignInReturned,
eTMSAction_TMSPP_RetrieveFiles_RunPlayGame,
eTMSAction_TMSPP_RetrieveFiles_HelpAndOptions,
eTMSAction_TMSPP_RetrieveFiles_DLCMain,
eTMSAction_TMSPP_GlobalFileList,
eTMSAction_TMSPP_GlobalFileList_Waiting,
// eTMSAction_TMSPP_ConfigFile,
// eTMSAction_TMSPP_ConfigFile_Waiting,
eTMSAction_TMSPP_UserFileList,
eTMSAction_TMSPP_UserFileList_Waiting,
eTMSAction_TMSPP_XUIDSFile,
eTMSAction_TMSPP_XUIDSFile_Waiting,
eTMSAction_TMSPP_DLCFile,
eTMSAction_TMSPP_DLCFile_Waiting,
eTMSAction_TMSPP_BannedListFile,
eTMSAction_TMSPP_BannedListFile_Waiting,
eTMSAction_TMSPP_RetrieveFiles_Complete,
eTMSAction_TMSPP_DLCFileOnly,
eTMSAction_TMSPP_RetrieveUserFilelist_DLCFileOnly,
};
// The server runs on its own thread, so we need to call its actions there
// rather than where all other Xui actions are performed In general these are
// debugging options
enum eXuiServerAction {
eXuiServerAction_Idle = 0,
eXuiServerAction_DropItem, // Debug
eXuiServerAction_SaveGame,
eXuiServerAction_AutoSaveGame,
eXuiServerAction_SpawnMob, // Debug
eXuiServerAction_PauseServer,
eXuiServerAction_ToggleRain, // Debug
eXuiServerAction_ToggleThunder, // Debug
eXuiServerAction_ServerSettingChanged_Gamertags,
eXuiServerAction_ServerSettingChanged_Difficulty,
eXuiServerAction_ExportSchematic, // Debug
eXuiServerAction_ServerSettingChanged_BedrockFog,
eXuiServerAction_SetCameraLocation, // Debug
};
enum eGameSetting {
eGameSetting_MusicVolume = 0,
eGameSetting_SoundFXVolume,
eGameSetting_Gamma,
eGameSetting_Difficulty,
eGameSetting_Sensitivity_InGame,
eGameSetting_Sensitivity_InMenu,
eGameSetting_ViewBob,
eGameSetting_ControlScheme,
eGameSetting_ControlInvertLook,
eGameSetting_ControlSouthPaw,
eGameSetting_SplitScreenVertical,
eGameSetting_GamertagsVisible,
// Interim TU 1.6.6
eGameSetting_Autosave,
eGameSetting_DisplaySplitscreenGamertags,
eGameSetting_Hints,
eGameSetting_InterfaceOpacity,
eGameSetting_Tooltips,
// TU5
eGameSetting_Clouds,
eGameSetting_Online,
eGameSetting_InviteOnly,
eGameSetting_FriendsOfFriends,
eGameSetting_DisplayUpdateMessage,
// TU6
eGameSetting_BedrockFog,
eGameSetting_DisplayHUD,
eGameSetting_DisplayHand,
// TU7
eGameSetting_CustomSkinAnim,
// TU9
eGameSetting_DeathMessages,
eGameSetting_UISize,
eGameSetting_UISizeSplitscreen,
eGameSetting_AnimatedCharacter,
// PS3
eGameSetting_PS3_EULA_Read,
// PSVita
eGameSetting_PSVita_NetworkModeAdhoc,
};
enum eGameMode { eMode_Singleplayer, eMode_Multiplayer };
enum eMinecraftColour {
eMinecraftColour_NOT_SET,
eMinecraftColour_Foliage_Evergreen,
eMinecraftColour_Foliage_Birch,
eMinecraftColour_Foliage_Default,
eMinecraftColour_Foliage_Common,
eMinecraftColour_Foliage_Ocean,
eMinecraftColour_Foliage_Plains,
eMinecraftColour_Foliage_Desert,
eMinecraftColour_Foliage_ExtremeHills,
eMinecraftColour_Foliage_Forest,
eMinecraftColour_Foliage_Taiga,
eMinecraftColour_Foliage_Swampland,
eMinecraftColour_Foliage_River,
eMinecraftColour_Foliage_Hell,
eMinecraftColour_Foliage_Sky,
eMinecraftColour_Foliage_FrozenOcean,
eMinecraftColour_Foliage_FrozenRiver,
eMinecraftColour_Foliage_IcePlains,
eMinecraftColour_Foliage_IceMountains,
eMinecraftColour_Foliage_MushroomIsland,
eMinecraftColour_Foliage_MushroomIslandShore,
eMinecraftColour_Foliage_Beach,
eMinecraftColour_Foliage_DesertHills,
eMinecraftColour_Foliage_ForestHills,
eMinecraftColour_Foliage_TaigaHills,
eMinecraftColour_Foliage_ExtremeHillsEdge,
eMinecraftColour_Foliage_Jungle,
eMinecraftColour_Foliage_JungleHills,
eMinecraftColour_Grass_Common,
eMinecraftColour_Grass_Ocean,
eMinecraftColour_Grass_Plains,
eMinecraftColour_Grass_Desert,
eMinecraftColour_Grass_ExtremeHills,
eMinecraftColour_Grass_Forest,
eMinecraftColour_Grass_Taiga,
eMinecraftColour_Grass_Swampland,
eMinecraftColour_Grass_River,
eMinecraftColour_Grass_Hell,
eMinecraftColour_Grass_Sky,
eMinecraftColour_Grass_FrozenOcean,
eMinecraftColour_Grass_FrozenRiver,
eMinecraftColour_Grass_IcePlains,
eMinecraftColour_Grass_IceMountains,
eMinecraftColour_Grass_MushroomIsland,
eMinecraftColour_Grass_MushroomIslandShore,
eMinecraftColour_Grass_Beach,
eMinecraftColour_Grass_DesertHills,
eMinecraftColour_Grass_ForestHills,
eMinecraftColour_Grass_TaigaHills,
eMinecraftColour_Grass_ExtremeHillsEdge,
eMinecraftColour_Grass_Jungle,
eMinecraftColour_Grass_JungleHills,
eMinecraftColour_Water_Ocean,
eMinecraftColour_Water_Plains,
eMinecraftColour_Water_Desert,
eMinecraftColour_Water_ExtremeHills,
eMinecraftColour_Water_Forest,
eMinecraftColour_Water_Taiga,
eMinecraftColour_Water_Swampland,
eMinecraftColour_Water_River,
eMinecraftColour_Water_Hell,
eMinecraftColour_Water_Sky,
eMinecraftColour_Water_FrozenOcean,
eMinecraftColour_Water_FrozenRiver,
eMinecraftColour_Water_IcePlains,
eMinecraftColour_Water_IceMountains,
eMinecraftColour_Water_MushroomIsland,
eMinecraftColour_Water_MushroomIslandShore,
eMinecraftColour_Water_Beach,
eMinecraftColour_Water_DesertHills,
eMinecraftColour_Water_ForestHills,
eMinecraftColour_Water_TaigaHills,
eMinecraftColour_Water_ExtremeHillsEdge,
eMinecraftColour_Water_Jungle,
eMinecraftColour_Water_JungleHills,
eMinecraftColour_Sky_Ocean,
eMinecraftColour_Sky_Plains,
eMinecraftColour_Sky_Desert,
eMinecraftColour_Sky_ExtremeHills,
eMinecraftColour_Sky_Forest,
eMinecraftColour_Sky_Taiga,
eMinecraftColour_Sky_Swampland,
eMinecraftColour_Sky_River,
eMinecraftColour_Sky_Hell,
eMinecraftColour_Sky_Sky,
eMinecraftColour_Sky_FrozenOcean,
eMinecraftColour_Sky_FrozenRiver,
eMinecraftColour_Sky_IcePlains,
eMinecraftColour_Sky_IceMountains,
eMinecraftColour_Sky_MushroomIsland,
eMinecraftColour_Sky_MushroomIslandShore,
eMinecraftColour_Sky_Beach,
eMinecraftColour_Sky_DesertHills,
eMinecraftColour_Sky_ForestHills,
eMinecraftColour_Sky_TaigaHills,
eMinecraftColour_Sky_ExtremeHillsEdge,
eMinecraftColour_Sky_Jungle,
eMinecraftColour_Sky_JungleHills,
eMinecraftColour_Tile_RedstoneDust,
eMinecraftColour_Tile_RedstoneDustUnlit,
eMinecraftColour_Tile_RedstoneDustLitMin,
eMinecraftColour_Tile_RedstoneDustLitMax,
eMinecraftColour_Tile_StemMin,
eMinecraftColour_Tile_StemMax,
eMinecraftColour_Tile_WaterLily,
eMinecraftColour_Sky_Dawn_Dark,
eMinecraftColour_Sky_Dawn_Bright,
eMinecraftColour_Material_None,
eMinecraftColour_Material_Grass,
eMinecraftColour_Material_Sand,
eMinecraftColour_Material_Cloth,
eMinecraftColour_Material_Fire,
eMinecraftColour_Material_Ice,
eMinecraftColour_Material_Metal,
eMinecraftColour_Material_Plant,
eMinecraftColour_Material_Snow,
eMinecraftColour_Material_Clay,
eMinecraftColour_Material_Dirt,
eMinecraftColour_Material_Stone,
eMinecraftColour_Material_Water,
eMinecraftColour_Material_Wood,
eMinecraftColour_Material_Emerald,
eMinecraftColour_Particle_Note_00,
eMinecraftColour_Particle_Note_01,
eMinecraftColour_Particle_Note_02,
eMinecraftColour_Particle_Note_03,
eMinecraftColour_Particle_Note_04,
eMinecraftColour_Particle_Note_05,
eMinecraftColour_Particle_Note_06,
eMinecraftColour_Particle_Note_07,
eMinecraftColour_Particle_Note_08,
eMinecraftColour_Particle_Note_09,
eMinecraftColour_Particle_Note_10,
eMinecraftColour_Particle_Note_11,
eMinecraftColour_Particle_Note_12,
eMinecraftColour_Particle_Note_13,
eMinecraftColour_Particle_Note_14,
eMinecraftColour_Particle_Note_15,
eMinecraftColour_Particle_Note_16,
eMinecraftColour_Particle_Note_17,
eMinecraftColour_Particle_Note_18,
eMinecraftColour_Particle_Note_19,
eMinecraftColour_Particle_Note_20,
eMinecraftColour_Particle_Note_21,
eMinecraftColour_Particle_Note_22,
eMinecraftColour_Particle_Note_23,
eMinecraftColour_Particle_Note_24,
eMinecraftColour_Particle_NetherPortal,
eMinecraftColour_Particle_EnderPortal,
eMinecraftColour_Particle_Smoke,
eMinecraftColour_Particle_Ender,
eMinecraftColour_Particle_Explode,
eMinecraftColour_Particle_HugeExplosion,
eMinecraftColour_Particle_DripWater,
eMinecraftColour_Particle_DripLavaStart,
eMinecraftColour_Particle_DripLavaEnd,
eMinecraftColour_Particle_EnchantmentTable,
eMinecraftColour_Particle_DragonBreathMin,
eMinecraftColour_Particle_DragonBreathMax,
eMinecraftColour_Particle_Suspend,
eMinecraftColour_Particle_CritStart,
eMinecraftColour_Particle_CritEnd,
eMinecraftColour_Effect_MovementSpeed,
eMinecraftColour_Effect_MovementSlowDown,
eMinecraftColour_Effect_DigSpeed,
eMinecraftColour_Effect_DigSlowdown,
eMinecraftColour_Effect_DamageBoost,
eMinecraftColour_Effect_Heal,
eMinecraftColour_Effect_Harm,
eMinecraftColour_Effect_Jump,
eMinecraftColour_Effect_Confusion,
eMinecraftColour_Effect_Regeneration,
eMinecraftColour_Effect_DamageResistance,
eMinecraftColour_Effect_FireResistance,
eMinecraftColour_Effect_WaterBreathing,
eMinecraftColour_Effect_Invisiblity,
eMinecraftColour_Effect_Blindness,
eMinecraftColour_Effect_NightVision,
eMinecraftColour_Effect_Hunger,
eMinecraftColour_Effect_Weakness,
eMinecraftColour_Effect_Poison,
eMinecraftColour_Effect_Wither,
eMinecraftColour_Effect_HealthBoost,
eMinecraftColour_Effect_Absoprtion,
eMinecraftColour_Effect_Saturation,
eMinecraftColour_Potion_BaseColour,
eMinecraftColour_Mob_Creeper_Colour1,
eMinecraftColour_Mob_Creeper_Colour2,
eMinecraftColour_Mob_Skeleton_Colour1,
eMinecraftColour_Mob_Skeleton_Colour2,
eMinecraftColour_Mob_Spider_Colour1,
eMinecraftColour_Mob_Spider_Colour2,
eMinecraftColour_Mob_Zombie_Colour1,
eMinecraftColour_Mob_Zombie_Colour2,
eMinecraftColour_Mob_Slime_Colour1,
eMinecraftColour_Mob_Slime_Colour2,
eMinecraftColour_Mob_Ghast_Colour1,
eMinecraftColour_Mob_Ghast_Colour2,
eMinecraftColour_Mob_PigZombie_Colour1,
eMinecraftColour_Mob_PigZombie_Colour2,
eMinecraftColour_Mob_Enderman_Colour1,
eMinecraftColour_Mob_Enderman_Colour2,
eMinecraftColour_Mob_CaveSpider_Colour1,
eMinecraftColour_Mob_CaveSpider_Colour2,
eMinecraftColour_Mob_Silverfish_Colour1,
eMinecraftColour_Mob_Silverfish_Colour2,
eMinecraftColour_Mob_Blaze_Colour1,
eMinecraftColour_Mob_Blaze_Colour2,
eMinecraftColour_Mob_LavaSlime_Colour1,
eMinecraftColour_Mob_LavaSlime_Colour2,
eMinecraftColour_Mob_Pig_Colour1,
eMinecraftColour_Mob_Pig_Colour2,
eMinecraftColour_Mob_Sheep_Colour1,
eMinecraftColour_Mob_Sheep_Colour2,
eMinecraftColour_Mob_Cow_Colour1,
eMinecraftColour_Mob_Cow_Colour2,
eMinecraftColour_Mob_Chicken_Colour1,
eMinecraftColour_Mob_Chicken_Colour2,
eMinecraftColour_Mob_Squid_Colour1,
eMinecraftColour_Mob_Squid_Colour2,
eMinecraftColour_Mob_Wolf_Colour1,
eMinecraftColour_Mob_Wolf_Colour2,
eMinecraftColour_Mob_MushroomCow_Colour1,
eMinecraftColour_Mob_MushroomCow_Colour2,
eMinecraftColour_Mob_Ocelot_Colour1,
eMinecraftColour_Mob_Ocelot_Colour2,
eMinecraftColour_Mob_Villager_Colour1,
eMinecraftColour_Mob_Villager_Colour2,
eMinecraftColour_Mob_Bat_Colour1,
eMinecraftColour_Mob_Bat_Colour2,
eMinecraftColour_Mob_Witch_Colour1,
eMinecraftColour_Mob_Witch_Colour2,
eMinecraftColour_Mob_Horse_Colour1,
eMinecraftColour_Mob_Horse_Colour2,
eMinecraftColour_Armour_Default_Leather_Colour,
eMinecraftColour_Under_Water_Clear_Colour,
eMinecraftColour_Under_Lava_Clear_Colour,
eMinecraftColour_In_Cloud_Base_Colour,
eMinecraftColour_Under_Water_Fog_Colour,
eMinecraftColour_Under_Lava_Fog_Colour,
eMinecraftColour_In_Cloud_Fog_Colour,
eMinecraftColour_Default_Fog_Colour,
eMinecraftColour_Nether_Fog_Colour,
eMinecraftColour_End_Fog_Colour,
eMinecraftColour_Sign_Text,
eMinecraftColour_Map_Text,
eMinecraftColour_Leash_Light_Colour,
eMinecraftColour_Leash_Dark_Colour,
eMinecraftColour_Fire_Overlay,
eHTMLColor_0,
eHTMLColor_1,
eHTMLColor_2,
eHTMLColor_3,
eHTMLColor_4,
eHTMLColor_5,
eHTMLColor_6,
eHTMLColor_7,
eHTMLColor_8,
eHTMLColor_9,
eHTMLColor_a,
eHTMLColor_b,
eHTMLColor_c,
eHTMLColor_d,
eHTMLColor_e,
eHTMLColor_f,
eHTMLColor_0_dark,
eHTMLColor_1_dark,
eHTMLColor_2_dark,
eHTMLColor_3_dark,
eHTMLColor_4_dark,
eHTMLColor_5_dark,
eHTMLColor_6_dark,
eHTMLColor_7_dark,
eHTMLColor_8_dark,
eHTMLColor_9_dark,
eHTMLColor_a_dark,
eHTMLColor_b_dark,
eHTMLColor_c_dark,
eHTMLColor_d_dark,
eHTMLColor_e_dark,
eHTMLColor_f_dark,
eHTMLColor_T1,
eHTMLColor_T2,
eHTMLColor_T3,
eHTMLColor_Black,
eHTMLColor_White,
eTextColor_Enchant,
eTextColor_EnchantFocus,
eTextColor_EnchantDisabled,
eTextColor_RenamedItemTitle,
// eHTMLColor_0 = 0x000000, //r:0 , g: 0, b: 0, i: 0
// eHTMLColor_1 = 0x0000aa, //r:0 , g: 0, b: aa, i: 1 // blue, quite dark
// eHTMLColor_2 = 0x109e10, // Changed by request of Dave //0x00aa00, //r:0
// , g: aa, b: 0, i: 2 // green eHTMLColor_3 = 0x109e9e, // Changed by
// request of Dave //0x00aaaa, //r:0 , g: aa, b: aa, i: 3 // cyan
// eHTMLColor_4 = 0xaa0000, //r:aa , g: 0, b: 0, i: 4 // red
// eHTMLColor_5 = 0xaa00aa, //r:aa , g: 0, b: aa, i: 5 // purple
// eHTMLColor_6 = 0xffaa00, //r:ff , g: aa, b: 0, i: 6 // orange
// eHTMLColor_7 = 0xaaaaaa, //r:aa , g: aa, b: aa, i: 7 // light gray
// eHTMLColor_8 = 0x555555, //r:55 , g: 55, b: 55, i: 8 // gray
// eHTMLColor_9 = 0x5555ff, //r:55 , g: 55, b: ff, i: 9 // blue
// eHTMLColor_a = 0x55ff55, //r:55 , g: ff, b: 55, i: a // green
// eHTMLColor_b = 0x55ffff, //r:55 , g: ff, b: ff, i: b // cyan
// eHTMLColor_c = 0xff5555, //r:ff , g: 55, b: 55, i: c // red pink
// eHTMLColor_d = 0xff55ff, //r:ff , g: 55, b: ff, i: d // bright pink
// eHTMLColor_e = 0xffff55, //r:ff , g: ff, b: 55, i: e // yellow
// eHTMLColor_f = 0xffffff, //r:ff , g: ff, b: ff, i: f
// eHTMLColor_0_dark = 0x000000, //r:0 , g: 0, b: 0, i: 10
// eHTMLColor_1_dark = 0x00002a, //r:0 , g: 0, b: 2a, i: 11
// eHTMLColor_2_dark = 0x002a00, //r:0 , g: 2a, b: 0, i: 12
// eHTMLColor_3_dark = 0x002a2a, //r:0 , g: 2a, b: 2a, i: 13
// eHTMLColor_4_dark = 0x2a0000, //r:2a , g: 0, b: 0, i: 14
// eHTMLColor_5_dark = 0x2a002a, //r:2a , g: 0, b: 2a, i: 15
// eHTMLColor_6_dark = 0x2a2a00, //r:2a , g: 2a, b: 0, i: 16
// eHTMLColor_7_dark = 0x2a2a2a, //r:2a , g: 2a, b: 2a, i: 17 // dark gray
// eHTMLColor_8_dark = 0x151515, //r:15 , g: 15, b: 15, i: 18
// eHTMLColor_9_dark = 0x15153f, //r:15 , g: 15, b: 3f, i: 19
// eHTMLColor_a_dark = 0x153f15, //r:15 , g: 3f, b: 15, i: 1a
// eHTMLColor_b_dark = 0x153f3f, //r:15 , g: 3f, b: 3f, i: 1b
// eHTMLColor_c_dark = 0x3f1515, //r:3f , g: 15, b: 15, i: 1c // brown
// eHTMLColor_d_dark = 0x3f153f, //r:3f , g: 15, b: 3f, i: 1d
// eHTMLColor_e_dark = 0x3f3f15, //r:3f , g: 3f, b: 15, i: 1e
// eHTMLColor_f_dark = 0x3f3f3f, //r:3f , g: 3f, b: 3f, i: 1f
eMinecraftColour_COUNT,
};
enum eDLCContentType {
e_DLC_SkinPack = 0,
e_DLC_TexturePacks,
e_DLC_MashupPacks,
e_DLC_Themes,
e_DLC_AvatarItems,
e_DLC_Gamerpics,
e_DLC_MAX_MinecraftStore,
e_DLC_TexturePackData, // for the icon, banner and text
e_DLC_MAX,
e_DLC_NotDefined,
};
enum eDLCMarketplaceType {
e_Marketplace_Content = 0, // skins, texture packs and mashup packs
e_Marketplace_Themes,
e_Marketplace_AvatarItems,
e_Marketplace_Gamerpics,
e_Marketplace_MAX,
e_Marketplace_NotDefined,
};
enum eDLCContentState {
e_DLC_ContentState_Idle = 0,
e_DLC_ContentState_Retrieving,
e_DLC_ContentState_Retrieved
};
enum eTMSContentState {
e_TMS_ContentState_Idle = 0,
e_TMS_ContentState_Queued,
e_TMS_ContentState_Retrieving,
e_TMS_ContentState_Retrieved
};
enum eXUID {
eXUID_Undefined = 0,
eXUID_NoName, // name not needed
eXUID_Notch,
eXUID_Carl,
eXUID_Daniel,
eXUID_Deadmau5,
eXUID_DannyBStyle,
eXUID_JulianClark,
eXUID_Millionth,
eXUID_4JPaddy,
eXUID_4JStuart,
eXUID_4JDavid,
eXUID_4JRichard,
eXUID_4JSteven,
};
enum _eTerrainFeatureType {
eTerrainFeature_None = 0,
eTerrainFeature_Stronghold,
eTerrainFeature_Mineshaft,
eTerrainFeature_Village,
eTerrainFeature_Ravine,
eTerrainFeature_NetherFortress,
eTerrainFeature_StrongholdEndPortal,
eTerrainFeature_Count
};
// 4J Stu - Whend adding new options you should consider whether having them on
// should disable achievements, and if so add them to the
// CanRecordStatsAndAchievements function 4J Stu - These options are now saved
// in save data, so new options can ONLY be added to the end
enum eGameHostOption {
eGameHostOption_Difficulty = 0,
eGameHostOption_OnlineGame, // Unused
eGameHostOption_InviteOnly, // Unused
eGameHostOption_FriendsOfFriends,
eGameHostOption_Gamertags,
eGameHostOption_Tutorial, // special case
eGameHostOption_GameType,
eGameHostOption_LevelType, // flat or default
eGameHostOption_Structures,
eGameHostOption_BonusChest,
eGameHostOption_HasBeenInCreative,
eGameHostOption_PvP,
eGameHostOption_TrustPlayers,
eGameHostOption_TNT,
eGameHostOption_FireSpreads,
eGameHostOption_CheatsEnabled, // special case
eGameHostOption_HostCanFly,
eGameHostOption_HostCanChangeHunger,
eGameHostOption_HostCanBeInvisible,
eGameHostOption_BedrockFog,
eGameHostOption_NoHUD,
eGameHostOption_WorldSize,
eGameHostOption_All,
eGameHostOption_DisableSaving,
eGameHostOption_WasntSaveOwner, // Added for PS3 save transfer, so we can
// add a nice message in the future instead
// of the creative mode one
eGameHostOption_MobGriefing,
eGameHostOption_KeepInventory,
eGameHostOption_DoMobSpawning,
eGameHostOption_DoMobLoot,
eGameHostOption_DoTileDrops,
eGameHostOption_NaturalRegeneration,
eGameHostOption_DoDaylightCycle,
};
// 4J-PB - If any new DLC items are added to the TMSFiles, this array needs
// updated
enum EHTMLFontSize {
eHTMLSize_Normal,
eHTMLSize_Splitscreen,
eHTMLSize_Tutorial,
eHTMLSize_EndPoem,
eHTMLSize_COUNT,
};
enum eMCLang {
eMCLang_null = 0,
eMCLang_enUS,
eMCLang_enGB,
eMCLang_enIE,
eMCLang_enAU,
eMCLang_enNZ,
eMCLang_enCA,
eMCLang_jaJP,
eMCLang_deDE,
eMCLang_deAT,
eMCLang_frFR,
eMCLang_frCA,
eMCLang_esES,
eMCLang_esMX,
eMCLang_itIT,
eMCLang_koKR,
eMCLang_ptPT,
eMCLang_ptBR,
eMCLang_ruRU,
eMCLang_nlNL,
eMCLang_fiFI,
eMCLang_svSV,
eMCLang_daDA,
eMCLang_noNO,
eMCLang_plPL,
eMCLang_trTR,
eMCLang_elEL,
eMCLang_csCS,
eMCLang_zhCHT,
eMCLang_laLAS,
eMCLang_zhSG,
eMCLang_zhCN,
eMCLang_zhHK,
eMCLang_zhTW,
eMCLang_nlBE,
eMCLang_daDK,
eMCLang_frBE,
eMCLang_frCH,
eMCLang_deCH,
eMCLang_nbNO,
eMCLang_enGR,
eMCLang_enHK,
eMCLang_enSA,
eMCLang_enHU,
eMCLang_enIN,
eMCLang_enIL,
eMCLang_enSG,
eMCLang_enSK,
eMCLang_enZA,
eMCLang_enCZ,
eMCLang_enAE,
eMCLang_esAR,
eMCLang_esCL,
eMCLang_esCO,
eMCLang_esUS,
eMCLang_svSE,
eMCLang_csCZ,
eMCLang_elGR,
eMCLang_nnNO,
eMCLang_skSK,
eMCLang_hans,
eMCLang_hant,
};
-18
View File
@@ -1,25 +1,7 @@
#include "minecraft/GameHostOptions.h"
#include <cassert>
namespace GameHostOptions {
static unsigned int* s_settings = nullptr;
void init(unsigned int* settingsPtr) {
s_settings = settingsPtr;
}
unsigned int get(eGameHostOption option) {
assert(s_settings);
return get(*s_settings, option);
}
void set(eGameHostOption option, unsigned int value) {
assert(s_settings);
set(*s_settings, option, value);
}
unsigned int get(unsigned int settings, eGameHostOption option) {
switch (option) {
case eGameHostOption_FriendsOfFriends:
+4 -6
View File
@@ -3,16 +3,14 @@
#include <cstdint>
#include "app/common/App_Defines.h"
#include "app/common/App_enums.h"
#include "minecraft/GameEnums.h"
// Stateless bitfield utilities - no app dependency.
// The global-state overloads (get/set with no settings arg) have moved
// to IgameServices().getGameHostOption / setGameHostOption.
namespace GameHostOptions {
unsigned int get(unsigned int settings, eGameHostOption option);
void set(unsigned int& settings, eGameHostOption option, unsigned int value);
// Global game settings - initialized by app layer at startup
void init(unsigned int* settingsPtr);
unsigned int get(eGameHostOption option);
void set(eGameHostOption option, unsigned int value);
} // namespace GameHostOptions
-654
View File
@@ -1,654 +0,0 @@
#include "minecraft/GameServices.h"
#include <cassert>
namespace GameServices {
// Level generation
static LevelGenOptsFn s_levelGenOpts = nullptr;
static GameRuleDefsFn s_gameRuleDefs = nullptr;
void initLevelGen(LevelGenOptsFn levelGenOpts, GameRuleDefsFn gameRuleDefs) {
s_levelGenOpts = levelGenOpts;
s_gameRuleDefs = gameRuleDefs;
}
LevelGenerationOptions* getLevelGenerationOptions() {
assert(s_levelGenOpts);
return s_levelGenOpts();
}
LevelRuleset* getGameRuleDefinitions() {
assert(s_gameRuleDefs);
return s_gameRuleDefs();
}
// Texture cache
static AddTexFn s_addTex = nullptr;
static RemoveTexFn s_removeTex = nullptr;
static GetTexDetailsFn s_getTexDetails = nullptr;
static HasTexFn s_hasTex = nullptr;
void initTextureCache(AddTexFn add, RemoveTexFn remove,
GetTexDetailsFn getDetails, HasTexFn has) {
s_addTex = add;
s_removeTex = remove;
s_getTexDetails = getDetails;
s_hasTex = has;
}
void addMemoryTextureFile(const std::wstring& name, std::uint8_t* data,
unsigned int size) {
if (s_addTex) s_addTex(name, data, size);
}
void removeMemoryTextureFile(const std::wstring& name) {
if (s_removeTex) s_removeTex(name);
}
void getMemFileDetails(const std::wstring& name, std::uint8_t** data,
unsigned int* size) {
if (s_getTexDetails) s_getTexDetails(name, data, size);
}
bool isFileInMemoryTextures(const std::wstring& name) {
return s_hasTex ? s_hasTex(name) : false;
}
// Per-player settings
static GetSettingsFn s_getSettings = nullptr;
static GetSettingsNoArgFn s_getSettingsNoArg = nullptr;
void initPlayerSettings(GetSettingsFn getSettings,
GetSettingsNoArgFn getSettingsNoArg) {
s_getSettings = getSettings;
s_getSettingsNoArg = getSettingsNoArg;
}
unsigned char getGameSettings(int iPad, int setting) {
return s_getSettings ? s_getSettings(iPad, setting) : 0;
}
unsigned char getGameSettings(int setting) {
return s_getSettingsNoArg ? s_getSettingsNoArg(setting) : 0;
}
// App time
static AppTimeFn s_appTime = nullptr;
void initAppTime(AppTimeFn fn) { s_appTime = fn; }
float getAppTime() { return s_appTime ? s_appTime() : 0.0f; }
// Game state
static bool (*s_getGameStarted)() = nullptr;
static void (*s_setGameStarted)(bool) = nullptr;
static bool (*s_getTutorialMode)() = nullptr;
static void (*s_setTutorialMode)(bool) = nullptr;
static bool (*s_isAppPaused)() = nullptr;
static int (*s_getLocalPlayerCount)() = nullptr;
static bool (*s_autosaveDue)() = nullptr;
static void (*s_setAutosaveTimerTime)() = nullptr;
static int64_t (*s_secondsToAutosave)() = nullptr;
static void (*s_setDisconnectReason)(DisconnectPacket::eDisconnectReason) = nullptr;
static void (*s_lockSaveNotify)() = nullptr;
static void (*s_unlockSaveNotify)() = nullptr;
static bool (*s_getResetNether)() = nullptr;
static bool (*s_getUseDPadForDebug)() = nullptr;
static bool (*s_getWriteSavesToFolderEnabled)() = nullptr;
static bool (*s_isLocalMultiplayerAvailable)() = nullptr;
static bool (*s_dlcInstallPending)() = nullptr;
static bool (*s_dlcInstallProcessCompleted)() = nullptr;
static bool (*s_canRecordStatsAndAchievements)() = nullptr;
static bool (*s_getTMSGlobalFileListRead)() = nullptr;
static void (*s_setRequiredTexturePackID)(std::uint32_t) = nullptr;
static void (*s_setSpecialTutorialCompletionFlag)(int, int) = nullptr;
static void (*s_setBanListCheck)(int, bool) = nullptr;
static bool (*s_getBanListCheck)(int) = nullptr;
static unsigned int (*s_getGameNewWorldSize)() = nullptr;
static unsigned int (*s_getGameNewWorldSizeUseMoat)() = nullptr;
static unsigned int (*s_getGameNewHellScale)() = nullptr;
void initGameState(
bool (*getGameStartedFn)(),
void (*setGameStartedFn)(bool),
bool (*getTutorialModeFn)(),
void (*setTutorialModeFn)(bool),
bool (*isAppPausedFn)(),
int (*getLocalPlayerCountFn)(),
bool (*autosaveDueFn)(),
void (*setAutosaveTimerTimeFn)(),
int64_t (*secondsToAutosaveFn)(),
void (*setDisconnectReasonFn)(DisconnectPacket::eDisconnectReason),
void (*lockSaveNotifyFn)(),
void (*unlockSaveNotifyFn)(),
bool (*getResetNetherFn)(),
bool (*getUseDPadForDebugFn)(),
bool (*getWriteSavesToFolderEnabledFn)(),
bool (*isLocalMultiplayerAvailableFn)(),
bool (*dlcInstallPendingFn)(),
bool (*dlcInstallProcessCompletedFn)(),
bool (*canRecordStatsAndAchievementsFn)(),
bool (*getTMSGlobalFileListReadFn)(),
void (*setRequiredTexturePackIDFn)(std::uint32_t),
void (*setSpecialTutorialCompletionFlagFn)(int, int),
void (*setBanListCheckFn)(int, bool),
bool (*getBanListCheckFn)(int),
unsigned int (*getGameNewWorldSizeFn)(),
unsigned int (*getGameNewWorldSizeUseMoatFn)(),
unsigned int (*getGameNewHellScaleFn)()
) {
s_getGameStarted = getGameStartedFn;
s_setGameStarted = setGameStartedFn;
s_getTutorialMode = getTutorialModeFn;
s_setTutorialMode = setTutorialModeFn;
s_isAppPaused = isAppPausedFn;
s_getLocalPlayerCount = getLocalPlayerCountFn;
s_autosaveDue = autosaveDueFn;
s_setAutosaveTimerTime = setAutosaveTimerTimeFn;
s_secondsToAutosave = secondsToAutosaveFn;
s_setDisconnectReason = setDisconnectReasonFn;
s_lockSaveNotify = lockSaveNotifyFn;
s_unlockSaveNotify = unlockSaveNotifyFn;
s_getResetNether = getResetNetherFn;
s_getUseDPadForDebug = getUseDPadForDebugFn;
s_getWriteSavesToFolderEnabled = getWriteSavesToFolderEnabledFn;
s_isLocalMultiplayerAvailable = isLocalMultiplayerAvailableFn;
s_dlcInstallPending = dlcInstallPendingFn;
s_dlcInstallProcessCompleted = dlcInstallProcessCompletedFn;
s_canRecordStatsAndAchievements = canRecordStatsAndAchievementsFn;
s_getTMSGlobalFileListRead = getTMSGlobalFileListReadFn;
s_setRequiredTexturePackID = setRequiredTexturePackIDFn;
s_setSpecialTutorialCompletionFlag = setSpecialTutorialCompletionFlagFn;
s_setBanListCheck = setBanListCheckFn;
s_getBanListCheck = getBanListCheckFn;
s_getGameNewWorldSize = getGameNewWorldSizeFn;
s_getGameNewWorldSizeUseMoat = getGameNewWorldSizeUseMoatFn;
s_getGameNewHellScale = getGameNewHellScaleFn;
}
bool getGameStarted() { return s_getGameStarted ? s_getGameStarted() : false; }
void setGameStarted(bool val) { if (s_setGameStarted) s_setGameStarted(val); }
bool getTutorialMode() { return s_getTutorialMode ? s_getTutorialMode() : false; }
void setTutorialMode(bool val) { if (s_setTutorialMode) s_setTutorialMode(val); }
bool isAppPaused() { return s_isAppPaused ? s_isAppPaused() : false; }
int getLocalPlayerCount() { return s_getLocalPlayerCount ? s_getLocalPlayerCount() : 0; }
bool autosaveDue() { return s_autosaveDue ? s_autosaveDue() : false; }
void setAutosaveTimerTime() { if (s_setAutosaveTimerTime) s_setAutosaveTimerTime(); }
int64_t secondsToAutosave() { return s_secondsToAutosave ? s_secondsToAutosave() : 0; }
void setDisconnectReason(DisconnectPacket::eDisconnectReason reason) {
if (s_setDisconnectReason) s_setDisconnectReason(reason);
}
void lockSaveNotification() { if (s_lockSaveNotify) s_lockSaveNotify(); }
void unlockSaveNotification() { if (s_unlockSaveNotify) s_unlockSaveNotify(); }
bool getResetNether() { return s_getResetNether ? s_getResetNether() : false; }
bool getUseDPadForDebug() { return s_getUseDPadForDebug ? s_getUseDPadForDebug() : false; }
bool getWriteSavesToFolderEnabled() {
return s_getWriteSavesToFolderEnabled ? s_getWriteSavesToFolderEnabled() : false;
}
bool isLocalMultiplayerAvailable() {
return s_isLocalMultiplayerAvailable ? s_isLocalMultiplayerAvailable() : false;
}
bool dlcInstallPending() { return s_dlcInstallPending ? s_dlcInstallPending() : false; }
bool dlcInstallProcessCompleted() {
return s_dlcInstallProcessCompleted ? s_dlcInstallProcessCompleted() : false;
}
bool canRecordStatsAndAchievements() {
return s_canRecordStatsAndAchievements ? s_canRecordStatsAndAchievements() : false;
}
bool getTMSGlobalFileListRead() {
return s_getTMSGlobalFileListRead ? s_getTMSGlobalFileListRead() : true;
}
void setRequiredTexturePackID(std::uint32_t id) {
if (s_setRequiredTexturePackID) s_setRequiredTexturePackID(id);
}
void setSpecialTutorialCompletionFlag(int iPad, int index) {
if (s_setSpecialTutorialCompletionFlag) s_setSpecialTutorialCompletionFlag(iPad, index);
}
void setBanListCheck(int iPad, bool val) {
if (s_setBanListCheck) s_setBanListCheck(iPad, val);
}
bool getBanListCheck(int iPad) {
return s_getBanListCheck ? s_getBanListCheck(iPad) : false;
}
unsigned int getGameNewWorldSize() {
return s_getGameNewWorldSize ? s_getGameNewWorldSize() : 0;
}
unsigned int getGameNewWorldSizeUseMoat() {
return s_getGameNewWorldSizeUseMoat ? s_getGameNewWorldSizeUseMoat() : 0;
}
unsigned int getGameNewHellScale() {
return s_getGameNewHellScale ? s_getGameNewHellScale() : 0;
}
// UI dispatch
static void (*s_setAction)(int, eXuiAction, void*) = nullptr;
static void (*s_setXuiServerAction)(int, eXuiServerAction, void*) = nullptr;
static eXuiAction (*s_getXuiAction)(int) = nullptr;
static eXuiServerAction (*s_getXuiServerAction)(int) = nullptr;
static void* (*s_getXuiServerActionParam)(int) = nullptr;
static void (*s_setGlobalXuiAction)(eXuiAction) = nullptr;
static void (*s_handleButtonPresses)() = nullptr;
static void (*s_setTMSAction)(int, eTMSAction) = nullptr;
void initUIDispatch(
void (*setActionFn)(int, eXuiAction, void*),
void (*setXuiServerActionFn)(int, eXuiServerAction, void*),
eXuiAction (*getXuiActionFn)(int),
eXuiServerAction (*getXuiServerActionFn)(int),
void* (*getXuiServerActionParamFn)(int),
void (*setGlobalXuiActionFn)(eXuiAction),
void (*handleButtonPressesFn)(),
void (*setTMSActionFn)(int, eTMSAction)
) {
s_setAction = setActionFn;
s_setXuiServerAction = setXuiServerActionFn;
s_getXuiAction = getXuiActionFn;
s_getXuiServerAction = getXuiServerActionFn;
s_getXuiServerActionParam = getXuiServerActionParamFn;
s_setGlobalXuiAction = setGlobalXuiActionFn;
s_handleButtonPresses = handleButtonPressesFn;
s_setTMSAction = setTMSActionFn;
}
void setAction(int iPad, eXuiAction action, void* param) {
if (s_setAction) s_setAction(iPad, action, param);
}
void setXuiServerAction(int iPad, eXuiServerAction action, void* param) {
if (s_setXuiServerAction) s_setXuiServerAction(iPad, action, param);
}
eXuiAction getXuiAction(int iPad) {
return s_getXuiAction ? s_getXuiAction(iPad) : eAppAction_Idle;
}
eXuiServerAction getXuiServerAction(int iPad) {
return s_getXuiServerAction ? s_getXuiServerAction(iPad) : eXuiServerAction_Idle;
}
void* getXuiServerActionParam(int iPad) {
return s_getXuiServerActionParam ? s_getXuiServerActionParam(iPad) : nullptr;
}
void setGlobalXuiAction(eXuiAction action) {
if (s_setGlobalXuiAction) s_setGlobalXuiAction(action);
}
void handleButtonPresses() {
if (s_handleButtonPresses) s_handleButtonPresses();
}
void setTMSAction(int iPad, eTMSAction action) {
if (s_setTMSAction) s_setTMSAction(iPad, action);
}
// Skin / cape / animation
static std::wstring (*s_getPlayerSkinName)(int) = nullptr;
static std::uint32_t (*s_getPlayerSkinId)(int) = nullptr;
static std::wstring (*s_getPlayerCapeName)(int) = nullptr;
static std::uint32_t (*s_getPlayerCapeId)(int) = nullptr;
static std::uint32_t (*s_getAdditionalModelPartsForPad)(int) = nullptr;
static void (*s_setAdditionalSkinBoxes)(std::uint32_t, SKIN_BOX*, unsigned int) = nullptr;
static std::vector<SKIN_BOX*>* (*s_getAdditionalSkinBoxes)(std::uint32_t) = nullptr;
static std::vector<ModelPart*>* (*s_getAdditionalModelParts)(std::uint32_t) = nullptr;
static std::vector<ModelPart*>* (*s_setAdditionalSkinBoxesFromVec)(
std::uint32_t, std::vector<SKIN_BOX*>*) = nullptr;
static void (*s_setAnimOverrideBitmask)(std::uint32_t, unsigned int) = nullptr;
static unsigned int (*s_getAnimOverrideBitmask)(std::uint32_t) = nullptr;
static std::uint32_t (*s_skinIdFromPath)(const std::wstring&) = nullptr;
static std::wstring (*s_skinPathFromId)(std::uint32_t) = nullptr;
static bool (*s_defaultCapeExists)() = nullptr;
static bool (*s_isXuidNotch)(PlayerUID) = nullptr;
static bool (*s_isXuidDeadmau5)(PlayerUID) = nullptr;
void initSkinCape(
std::wstring (*getPlayerSkinNameFn)(int),
std::uint32_t (*getPlayerSkinIdFn)(int),
std::wstring (*getPlayerCapeNameFn)(int),
std::uint32_t (*getPlayerCapeIdFn)(int),
std::uint32_t (*getAdditionalModelPartsForPadFn)(int),
void (*setAdditionalSkinBoxesFn)(std::uint32_t, SKIN_BOX*, unsigned int),
std::vector<SKIN_BOX*>* (*getAdditionalSkinBoxesFn)(std::uint32_t),
std::vector<ModelPart*>* (*getAdditionalModelPartsFn)(std::uint32_t),
std::vector<ModelPart*>* (*setAdditionalSkinBoxesFromVecFn)(
std::uint32_t, std::vector<SKIN_BOX*>*),
void (*setAnimOverrideBitmaskFn)(std::uint32_t, unsigned int),
unsigned int (*getAnimOverrideBitmaskFn)(std::uint32_t),
std::uint32_t (*skinIdFromPathFn)(const std::wstring&),
std::wstring (*skinPathFromIdFn)(std::uint32_t),
bool (*defaultCapeExistsFn)(),
bool (*isXuidNotchFn)(PlayerUID),
bool (*isXuidDeadmau5Fn)(PlayerUID)
) {
s_getPlayerSkinName = getPlayerSkinNameFn;
s_getPlayerSkinId = getPlayerSkinIdFn;
s_getPlayerCapeName = getPlayerCapeNameFn;
s_getPlayerCapeId = getPlayerCapeIdFn;
s_getAdditionalModelPartsForPad = getAdditionalModelPartsForPadFn;
s_setAdditionalSkinBoxes = setAdditionalSkinBoxesFn;
s_getAdditionalSkinBoxes = getAdditionalSkinBoxesFn;
s_getAdditionalModelParts = getAdditionalModelPartsFn;
s_setAdditionalSkinBoxesFromVec = setAdditionalSkinBoxesFromVecFn;
s_setAnimOverrideBitmask = setAnimOverrideBitmaskFn;
s_getAnimOverrideBitmask = getAnimOverrideBitmaskFn;
s_skinIdFromPath = skinIdFromPathFn;
s_skinPathFromId = skinPathFromIdFn;
s_defaultCapeExists = defaultCapeExistsFn;
s_isXuidNotch = isXuidNotchFn;
s_isXuidDeadmau5 = isXuidDeadmau5Fn;
}
std::wstring getPlayerSkinName(int iPad) {
return s_getPlayerSkinName ? s_getPlayerSkinName(iPad) : L"";
}
std::uint32_t getPlayerSkinId(int iPad) {
return s_getPlayerSkinId ? s_getPlayerSkinId(iPad) : 0;
}
std::wstring getPlayerCapeName(int iPad) {
return s_getPlayerCapeName ? s_getPlayerCapeName(iPad) : L"";
}
std::uint32_t getPlayerCapeId(int iPad) {
return s_getPlayerCapeId ? s_getPlayerCapeId(iPad) : 0;
}
std::uint32_t getAdditionalModelPartsForPad(int iPad) {
return s_getAdditionalModelPartsForPad ? s_getAdditionalModelPartsForPad(iPad) : 0;
}
void setAdditionalSkinBoxes(std::uint32_t dwSkinID, SKIN_BOX* boxA,
unsigned int boxC) {
if (s_setAdditionalSkinBoxes) s_setAdditionalSkinBoxes(dwSkinID, boxA, boxC);
}
std::vector<SKIN_BOX*>* getAdditionalSkinBoxes(std::uint32_t dwSkinID) {
return s_getAdditionalSkinBoxes ? s_getAdditionalSkinBoxes(dwSkinID) : nullptr;
}
std::vector<ModelPart*>* getAdditionalModelParts(std::uint32_t dwSkinID) {
return s_getAdditionalModelParts ? s_getAdditionalModelParts(dwSkinID) : nullptr;
}
std::vector<ModelPart*>* setAdditionalSkinBoxesFromVec(
std::uint32_t dwSkinID, std::vector<SKIN_BOX*>* pvSkinBoxA) {
return s_setAdditionalSkinBoxesFromVec
? s_setAdditionalSkinBoxesFromVec(dwSkinID, pvSkinBoxA)
: nullptr;
}
void setAnimOverrideBitmask(std::uint32_t dwSkinID, unsigned int bitmask) {
if (s_setAnimOverrideBitmask) s_setAnimOverrideBitmask(dwSkinID, bitmask);
}
unsigned int getAnimOverrideBitmask(std::uint32_t dwSkinID) {
return s_getAnimOverrideBitmask ? s_getAnimOverrideBitmask(dwSkinID) : 0;
}
std::uint32_t getSkinIdFromPath(const std::wstring& skin) {
return s_skinIdFromPath ? s_skinIdFromPath(skin) : 0;
}
std::wstring getSkinPathFromId(std::uint32_t skinId) {
return s_skinPathFromId ? s_skinPathFromId(skinId) : L"";
}
bool defaultCapeExists() {
return s_defaultCapeExists ? s_defaultCapeExists() : false;
}
bool isXuidNotch(PlayerUID xuid) {
return s_isXuidNotch ? s_isXuidNotch(xuid) : false;
}
bool isXuidDeadmau5(PlayerUID xuid) {
return s_isXuidDeadmau5 ? s_isXuidDeadmau5(xuid) : false;
}
// Platform features
static void (*s_fatalLoadError)() = nullptr;
static void (*s_setRichPresenceContext)(int, int) = nullptr;
static void (*s_captureSaveThumbnail)() = nullptr;
static void (*s_getSaveThumbnail)(std::uint8_t**, unsigned int*) = nullptr;
static void (*s_readBannedList)(int, eTMSAction, bool) = nullptr;
static void (*s_updatePlayerInfo)(std::uint8_t, int16_t, unsigned int) = nullptr;
static unsigned int (*s_getPlayerPrivileges)(std::uint8_t) = nullptr;
static void (*s_setGameSettingsDebugMask)(int, unsigned int) = nullptr;
void initPlatformFeatures(
void (*fatalLoadErrorFn)(),
void (*setRichPresenceContextFn)(int, int),
void (*captureSaveThumbnailFn)(),
void (*getSaveThumbnailFn)(std::uint8_t**, unsigned int*),
void (*readBannedListFn)(int, eTMSAction, bool),
void (*updatePlayerInfoFn)(std::uint8_t, int16_t, unsigned int),
unsigned int (*getPlayerPrivilegesFn)(std::uint8_t),
void (*setGameSettingsDebugMaskFn)(int, unsigned int)
) {
s_fatalLoadError = fatalLoadErrorFn;
s_setRichPresenceContext = setRichPresenceContextFn;
s_captureSaveThumbnail = captureSaveThumbnailFn;
s_getSaveThumbnail = getSaveThumbnailFn;
s_readBannedList = readBannedListFn;
s_updatePlayerInfo = updatePlayerInfoFn;
s_getPlayerPrivileges = getPlayerPrivilegesFn;
s_setGameSettingsDebugMask = setGameSettingsDebugMaskFn;
}
void fatalLoadError() {
if (s_fatalLoadError) s_fatalLoadError();
}
void setRichPresenceContext(int iPad, int contextId) {
if (s_setRichPresenceContext) s_setRichPresenceContext(iPad, contextId);
}
void captureSaveThumbnail() {
if (s_captureSaveThumbnail) s_captureSaveThumbnail();
}
void getSaveThumbnail(std::uint8_t** data, unsigned int* size) {
if (s_getSaveThumbnail) s_getSaveThumbnail(data, size);
}
void readBannedList(int iPad, eTMSAction action, bool bCallback) {
if (s_readBannedList) s_readBannedList(iPad, action, bCallback);
}
void updatePlayerInfo(std::uint8_t networkSmallId, int16_t playerColourIndex,
unsigned int playerPrivileges) {
if (s_updatePlayerInfo) s_updatePlayerInfo(networkSmallId, playerColourIndex, playerPrivileges);
}
unsigned int getPlayerPrivileges(std::uint8_t networkSmallId) {
return s_getPlayerPrivileges ? s_getPlayerPrivileges(networkSmallId) : 0;
}
void setGameSettingsDebugMask(int iPad, unsigned int uiVal) {
if (s_setGameSettingsDebugMask) s_setGameSettingsDebugMask(iPad, uiVal);
}
// Schematics / terrain
static void (*s_processSchematics)(LevelChunk*) = nullptr;
static void (*s_processSchematicsLighting)(LevelChunk*) = nullptr;
static void (*s_addTerrainFeaturePosition)(_eTerrainFeatureType, int, int) = nullptr;
static bool (*s_getTerrainFeaturePosition)(_eTerrainFeatureType, int*, int*) = nullptr;
static void (*s_loadDefaultGameRules)() = nullptr;
void initSchematics(
void (*processSchematicsFn)(LevelChunk*),
void (*processSchematicsLightingFn)(LevelChunk*),
void (*addTerrainFeaturePositionFn)(_eTerrainFeatureType, int, int),
bool (*getTerrainFeaturePositionFn)(_eTerrainFeatureType, int*, int*),
void (*loadDefaultGameRulesFn)()
) {
s_processSchematics = processSchematicsFn;
s_processSchematicsLighting = processSchematicsLightingFn;
s_addTerrainFeaturePosition = addTerrainFeaturePositionFn;
s_getTerrainFeaturePosition = getTerrainFeaturePositionFn;
s_loadDefaultGameRules = loadDefaultGameRulesFn;
}
void processSchematics(LevelChunk* chunk) {
if (s_processSchematics) s_processSchematics(chunk);
}
void processSchematicsLighting(LevelChunk* chunk) {
if (s_processSchematicsLighting) s_processSchematicsLighting(chunk);
}
void addTerrainFeaturePosition(_eTerrainFeatureType type, int x, int z) {
if (s_addTerrainFeaturePosition) s_addTerrainFeaturePosition(type, x, z);
}
bool getTerrainFeaturePosition(_eTerrainFeatureType type, int* pX, int* pZ) {
return s_getTerrainFeaturePosition ? s_getTerrainFeaturePosition(type, pX, pZ) : false;
}
void loadDefaultGameRules() {
if (s_loadDefaultGameRules) s_loadDefaultGameRules();
}
// Archive / resources
static bool (*s_hasArchiveFile)(const std::wstring&) = nullptr;
static std::vector<std::uint8_t> (*s_getArchiveFile)(const std::wstring&) = nullptr;
void initArchive(
bool (*hasArchiveFileFn)(const std::wstring&),
std::vector<std::uint8_t> (*getArchiveFileFn)(const std::wstring&)
) {
s_hasArchiveFile = hasArchiveFileFn;
s_getArchiveFile = getArchiveFileFn;
}
bool hasArchiveFile(const std::wstring& filename) {
return s_hasArchiveFile ? s_hasArchiveFile(filename) : false;
}
std::vector<std::uint8_t> getArchiveFile(const std::wstring& filename) {
return s_getArchiveFile ? s_getArchiveFile(filename) : std::vector<std::uint8_t>{};
}
// Strings / formatting / misc queries
static int (*s_getHTMLColour)(eMinecraftColour) = nullptr;
static std::wstring (*s_getEntityName)(EntityTypeId) = nullptr;
static const wchar_t* (*s_getGameRulesString)(const std::wstring&) = nullptr;
static unsigned int (*s_createImageTextData)(std::uint8_t*, int64_t, bool,
unsigned int, unsigned int) = nullptr;
static std::wstring (*s_getFilePath)(std::uint32_t, std::wstring, bool,
std::wstring) = nullptr;
static char* (*s_getUniqueMapName)() = nullptr;
static void (*s_setUniqueMapName)(char*) = nullptr;
static unsigned int (*s_getOpacityTimer)(int) = nullptr;
static void (*s_setOpacityTimer)(int) = nullptr;
static void (*s_tickOpacityTimer)(int) = nullptr;
static bool (*s_isInBannedLevelList)(int, PlayerUID, char*) = nullptr;
static MOJANG_DATA* (*s_getMojangDataForXuid)(PlayerUID) = nullptr;
static void (*s_debugPrintf)(const char*) = nullptr;
void initStringsAndMisc(
int (*getHTMLColourFn)(eMinecraftColour),
std::wstring (*getEntityNameFn)(EntityTypeId),
const wchar_t* (*getGameRulesStringFn)(const std::wstring&),
unsigned int (*createImageTextDataFn)(std::uint8_t*, int64_t, bool,
unsigned int, unsigned int),
std::wstring (*getFilePathFn)(std::uint32_t, std::wstring, bool,
std::wstring),
char* (*getUniqueMapNameFn)(),
void (*setUniqueMapNameFn)(char*),
unsigned int (*getOpacityTimerFn)(int),
void (*setOpacityTimerFn)(int),
void (*tickOpacityTimerFn)(int),
bool (*isInBannedLevelListFn)(int, PlayerUID, char*),
MOJANG_DATA* (*getMojangDataForXuidFn)(PlayerUID),
void (*debugPrintfFn)(const char*)
) {
s_getHTMLColour = getHTMLColourFn;
s_getEntityName = getEntityNameFn;
s_getGameRulesString = getGameRulesStringFn;
s_createImageTextData = createImageTextDataFn;
s_getFilePath = getFilePathFn;
s_getUniqueMapName = getUniqueMapNameFn;
s_setUniqueMapName = setUniqueMapNameFn;
s_getOpacityTimer = getOpacityTimerFn;
s_setOpacityTimer = setOpacityTimerFn;
s_tickOpacityTimer = tickOpacityTimerFn;
s_isInBannedLevelList = isInBannedLevelListFn;
s_getMojangDataForXuid = getMojangDataForXuidFn;
s_debugPrintf = debugPrintfFn;
}
int getHTMLColour(eMinecraftColour colour) {
return s_getHTMLColour ? s_getHTMLColour(colour) : 0;
}
int getHTMLColor(eMinecraftColour colour) { return getHTMLColour(colour); }
std::wstring getEntityName(EntityTypeId type) {
return s_getEntityName ? s_getEntityName(type) : L"";
}
const wchar_t* getGameRulesString(const std::wstring& key) {
return s_getGameRulesString ? s_getGameRulesString(key) : L"";
}
unsigned int createImageTextData(std::uint8_t* textMetadata, int64_t seed,
bool hasSeed, unsigned int uiHostOptions,
unsigned int uiTexturePackId) {
return s_createImageTextData
? s_createImageTextData(textMetadata, seed, hasSeed,
uiHostOptions, uiTexturePackId)
: 0;
}
std::wstring getFilePath(std::uint32_t packId, std::wstring filename,
bool bAddDataFolder, std::wstring mountPoint) {
return s_getFilePath ? s_getFilePath(packId, filename, bAddDataFolder, mountPoint) : L"";
}
char* getUniqueMapName() {
return s_getUniqueMapName ? s_getUniqueMapName() : nullptr;
}
void setUniqueMapName(char* name) {
if (s_setUniqueMapName) s_setUniqueMapName(name);
}
unsigned int getOpacityTimer(int iPad) {
return s_getOpacityTimer ? s_getOpacityTimer(iPad) : 0;
}
void setOpacityTimer(int iPad) {
if (s_setOpacityTimer) s_setOpacityTimer(iPad);
}
void tickOpacityTimer(int iPad) {
if (s_tickOpacityTimer) s_tickOpacityTimer(iPad);
}
bool isInBannedLevelList(int iPad, PlayerUID xuid, char* levelName) {
return s_isInBannedLevelList ? s_isInBannedLevelList(iPad, xuid, levelName) : false;
}
MOJANG_DATA* getMojangDataForXuid(PlayerUID xuid) {
return s_getMojangDataForXuid ? s_getMojangDataForXuid(xuid) : nullptr;
}
void debugPrintf(const char* msg) {
if (s_debugPrintf) s_debugPrintf(msg);
}
// Member variable access
static DLCManager* s_dlcManager = nullptr;
static GameRuleManager* s_gameRules = nullptr;
static std::vector<std::wstring>* s_skinNames = nullptr;
static std::vector<FEATURE_DATA*>* s_terrainFeatures = nullptr;
void initMemberAccess(
DLCManager* dlcManager,
GameRuleManager* gameRules,
std::vector<std::wstring>* skinNames,
std::vector<FEATURE_DATA*>* terrainFeatures
) {
s_dlcManager = dlcManager;
s_gameRules = gameRules;
s_skinNames = skinNames;
s_terrainFeatures = terrainFeatures;
}
DLCManager& getDLCManager() {
assert(s_dlcManager);
return *s_dlcManager;
}
GameRuleManager& getGameRules() {
assert(s_gameRules);
return *s_gameRules;
}
std::vector<std::wstring>& getSkinNames() {
assert(s_skinNames);
return *s_skinNames;
}
std::vector<FEATURE_DATA*>& getTerrainFeatures() {
assert(s_terrainFeatures);
return *s_terrainFeatures;
}
// Menu service
static IMenuService* s_menuService = nullptr;
void initMenuService(IMenuService* service) { s_menuService = service; }
IMenuService& menus() {
assert(s_menuService);
return *s_menuService;
}
} // namespace GameServices
-305
View File
@@ -1,305 +0,0 @@
#pragma once
#include <cstdint>
#include <string>
#include <vector>
// Forward declarations - minecraft types
class LevelGenerationOptions;
class LevelRuleset;
class LevelChunk;
class ModelPart;
// Forward declarations - app types (opaque pointers only)
class DLCManager;
class GameRuleManager;
// SKIN_BOX, FEATURE_DATA, MOJANG_DATA are C-style typedef'd structs
// that cannot be forward-declared. Include the lightweight headers.
#include "minecraft/client/SkinBox.h"
#include "app/common/App_structs.h"
// Enums needed by callers - pulled from app layer.
// These are small POD enums safe to include transitively.
#include "app/common/App_enums.h"
#include "platform/PlatformTypes.h" // PlayerUID
#include "minecraft/network/packet/DisconnectPacket.h" // eDisconnectReason
#include "minecraft/client/IMenuService.h"
// eINSTANCEOF lives in java/Class.h which is heavyweight.
// We use int here and cast at init/call sites.
using EntityTypeId = int;
namespace GameServices {
using LevelGenOptsFn = LevelGenerationOptions* (*)();
using GameRuleDefsFn = LevelRuleset* (*)();
void initLevelGen(LevelGenOptsFn levelGenOpts, GameRuleDefsFn gameRuleDefs);
[[nodiscard]] LevelGenerationOptions* getLevelGenerationOptions();
[[nodiscard]] LevelRuleset* getGameRuleDefinitions();
using AddTexFn = void (*)(const std::wstring&, std::uint8_t*, unsigned int);
using RemoveTexFn = void (*)(const std::wstring&);
using GetTexDetailsFn = void (*)(const std::wstring&, std::uint8_t**,
unsigned int*);
using HasTexFn = bool (*)(const std::wstring&);
void initTextureCache(AddTexFn add, RemoveTexFn remove,
GetTexDetailsFn getDetails, HasTexFn has);
void addMemoryTextureFile(const std::wstring& name, std::uint8_t* data,
unsigned int size);
void removeMemoryTextureFile(const std::wstring& name);
void getMemFileDetails(const std::wstring& name, std::uint8_t** data,
unsigned int* size);
[[nodiscard]] bool isFileInMemoryTextures(const std::wstring& name);
using GetSettingsFn = unsigned char (*)(int iPad, int setting);
using GetSettingsNoArgFn = unsigned char (*)(int setting);
void initPlayerSettings(GetSettingsFn getSettings,
GetSettingsNoArgFn getSettingsNoArg);
[[nodiscard]] unsigned char getGameSettings(int iPad, int setting);
[[nodiscard]] unsigned char getGameSettings(int setting);
using AppTimeFn = float (*)();
void initAppTime(AppTimeFn fn);
[[nodiscard]] float getAppTime();
// Game state
void initGameState(
bool (*getGameStarted)(),
void (*setGameStarted)(bool),
bool (*getTutorialMode)(),
void (*setTutorialMode)(bool),
bool (*isAppPaused)(),
int (*getLocalPlayerCount)(),
bool (*autosaveDue)(),
void (*setAutosaveTimerTime)(),
int64_t (*secondsToAutosave)(),
void (*setDisconnectReason)(DisconnectPacket::eDisconnectReason),
void (*lockSaveNotify)(),
void (*unlockSaveNotify)(),
bool (*getResetNether)(),
bool (*getUseDPadForDebug)(),
bool (*getWriteSavesToFolderEnabled)(),
bool (*isLocalMultiplayerAvailable)(),
bool (*dlcInstallPending)(),
bool (*dlcInstallProcessCompleted)(),
bool (*canRecordStatsAndAchievements)(),
bool (*getTMSGlobalFileListRead)(),
void (*setRequiredTexturePackID)(std::uint32_t),
void (*setSpecialTutorialCompletionFlag)(int iPad, int index),
void (*setBanListCheck)(int iPad, bool),
bool (*getBanListCheck)(int iPad),
unsigned int (*getGameNewWorldSize)(),
unsigned int (*getGameNewWorldSizeUseMoat)(),
unsigned int (*getGameNewHellScale)()
);
[[nodiscard]] bool getGameStarted();
void setGameStarted(bool val);
[[nodiscard]] bool getTutorialMode();
void setTutorialMode(bool val);
[[nodiscard]] bool isAppPaused();
[[nodiscard]] int getLocalPlayerCount();
[[nodiscard]] bool autosaveDue();
void setAutosaveTimerTime();
[[nodiscard]] int64_t secondsToAutosave();
void setDisconnectReason(DisconnectPacket::eDisconnectReason reason);
void lockSaveNotification();
void unlockSaveNotification();
[[nodiscard]] bool getResetNether();
[[nodiscard]] bool getUseDPadForDebug();
[[nodiscard]] bool getWriteSavesToFolderEnabled();
[[nodiscard]] bool isLocalMultiplayerAvailable();
[[nodiscard]] bool dlcInstallPending();
[[nodiscard]] bool dlcInstallProcessCompleted();
[[nodiscard]] bool canRecordStatsAndAchievements();
[[nodiscard]] bool getTMSGlobalFileListRead();
void setRequiredTexturePackID(std::uint32_t id);
void setSpecialTutorialCompletionFlag(int iPad, int index);
void setBanListCheck(int iPad, bool val);
[[nodiscard]] bool getBanListCheck(int iPad);
[[nodiscard]] unsigned int getGameNewWorldSize();
[[nodiscard]] unsigned int getGameNewWorldSizeUseMoat();
[[nodiscard]] unsigned int getGameNewHellScale();
// UI dispatch
void initUIDispatch(
void (*setAction)(int iPad, eXuiAction action, void* param),
void (*setXuiServerAction)(int iPad, eXuiServerAction action, void* param),
eXuiAction (*getXuiAction)(int iPad),
eXuiServerAction (*getXuiServerAction)(int iPad),
void* (*getXuiServerActionParam)(int iPad),
void (*setGlobalXuiAction)(eXuiAction action),
void (*handleButtonPresses)(),
void (*setTMSAction)(int iPad, eTMSAction action)
);
void setAction(int iPad, eXuiAction action, void* param = nullptr);
void setXuiServerAction(int iPad, eXuiServerAction action,
void* param = nullptr);
[[nodiscard]] eXuiAction getXuiAction(int iPad);
[[nodiscard]] eXuiServerAction getXuiServerAction(int iPad);
[[nodiscard]] void* getXuiServerActionParam(int iPad);
void setGlobalXuiAction(eXuiAction action);
void handleButtonPresses();
void setTMSAction(int iPad, eTMSAction action);
// Skin / cape / animation
void initSkinCape(
std::wstring (*getPlayerSkinName)(int iPad),
std::uint32_t (*getPlayerSkinId)(int iPad),
std::wstring (*getPlayerCapeName)(int iPad),
std::uint32_t (*getPlayerCapeId)(int iPad),
std::uint32_t (*getAdditionalModelPartsForPad)(int iPad),
void (*setAdditionalSkinBoxes)(std::uint32_t dwSkinID, SKIN_BOX* boxA,
unsigned int boxC),
std::vector<SKIN_BOX*>* (*getAdditionalSkinBoxes)(std::uint32_t dwSkinID),
std::vector<ModelPart*>* (*getAdditionalModelParts)(std::uint32_t dwSkinID),
std::vector<ModelPart*>* (*setAdditionalSkinBoxesFromVec)(
std::uint32_t dwSkinID, std::vector<SKIN_BOX*>* pvSkinBoxA),
void (*setAnimOverrideBitmask)(std::uint32_t dwSkinID, unsigned int bitmask),
unsigned int (*getAnimOverrideBitmask)(std::uint32_t dwSkinID),
std::uint32_t (*skinIdFromPath)(const std::wstring& skin),
std::wstring (*skinPathFromId)(std::uint32_t skinId),
bool (*defaultCapeExists)(),
bool (*isXuidNotch)(PlayerUID xuid),
bool (*isXuidDeadmau5)(PlayerUID xuid)
);
[[nodiscard]] std::wstring getPlayerSkinName(int iPad);
[[nodiscard]] std::uint32_t getPlayerSkinId(int iPad);
[[nodiscard]] std::wstring getPlayerCapeName(int iPad);
[[nodiscard]] std::uint32_t getPlayerCapeId(int iPad);
[[nodiscard]] std::uint32_t getAdditionalModelPartsForPad(int iPad);
void setAdditionalSkinBoxes(std::uint32_t dwSkinID, SKIN_BOX* boxA,
unsigned int boxC);
[[nodiscard]] std::vector<SKIN_BOX*>* getAdditionalSkinBoxes(
std::uint32_t dwSkinID);
[[nodiscard]] std::vector<ModelPart*>* getAdditionalModelParts(
std::uint32_t dwSkinID);
std::vector<ModelPart*>* setAdditionalSkinBoxesFromVec(
std::uint32_t dwSkinID, std::vector<SKIN_BOX*>* pvSkinBoxA);
void setAnimOverrideBitmask(std::uint32_t dwSkinID, unsigned int bitmask);
[[nodiscard]] unsigned int getAnimOverrideBitmask(std::uint32_t dwSkinID);
[[nodiscard]] std::uint32_t getSkinIdFromPath(const std::wstring& skin);
[[nodiscard]] std::wstring getSkinPathFromId(std::uint32_t skinId);
[[nodiscard]] bool defaultCapeExists();
[[nodiscard]] bool isXuidNotch(PlayerUID xuid);
[[nodiscard]] bool isXuidDeadmau5(PlayerUID xuid);
// Platform features
void initPlatformFeatures(
void (*fatalLoadError)(),
void (*setRichPresenceContext)(int iPad, int contextId),
void (*captureSaveThumbnail)(),
void (*getSaveThumbnail)(std::uint8_t**, unsigned int*),
void (*readBannedList)(int iPad, eTMSAction action, bool bCallback),
void (*updatePlayerInfo)(std::uint8_t networkSmallId,
int16_t playerColourIndex,
unsigned int playerPrivileges),
unsigned int (*getPlayerPrivileges)(std::uint8_t networkSmallId),
void (*setGameSettingsDebugMask)(int iPad, unsigned int uiVal)
);
void fatalLoadError();
void setRichPresenceContext(int iPad, int contextId);
void captureSaveThumbnail();
void getSaveThumbnail(std::uint8_t** data, unsigned int* size);
void readBannedList(int iPad, eTMSAction action = (eTMSAction)0,
bool bCallback = false);
void updatePlayerInfo(std::uint8_t networkSmallId, int16_t playerColourIndex,
unsigned int playerPrivileges);
[[nodiscard]] unsigned int getPlayerPrivileges(std::uint8_t networkSmallId);
void setGameSettingsDebugMask(int iPad, unsigned int uiVal);
// Schematics / terrain
void initSchematics(
void (*processSchematics)(LevelChunk* chunk),
void (*processSchematicsLighting)(LevelChunk* chunk),
void (*addTerrainFeaturePosition)(_eTerrainFeatureType, int, int),
bool (*getTerrainFeaturePosition)(_eTerrainFeatureType, int*, int*),
void (*loadDefaultGameRules)()
);
void processSchematics(LevelChunk* chunk);
void processSchematicsLighting(LevelChunk* chunk);
void addTerrainFeaturePosition(_eTerrainFeatureType type, int x, int z);
[[nodiscard]] bool getTerrainFeaturePosition(_eTerrainFeatureType type,
int* pX, int* pZ);
void loadDefaultGameRules();
// Archive / resources
void initArchive(
bool (*hasArchiveFile)(const std::wstring&),
std::vector<std::uint8_t> (*getArchiveFile)(const std::wstring&)
);
[[nodiscard]] bool hasArchiveFile(const std::wstring& filename);
[[nodiscard]] std::vector<std::uint8_t> getArchiveFile(
const std::wstring& filename);
// Strings / formatting / misc queries
void initStringsAndMisc(
int (*getHTMLColour)(eMinecraftColour),
std::wstring (*getEntityName)(EntityTypeId),
const wchar_t* (*getGameRulesString)(const std::wstring&),
unsigned int (*createImageTextData)(std::uint8_t*, int64_t, bool,
unsigned int, unsigned int),
std::wstring (*getFilePath)(std::uint32_t, std::wstring, bool,
std::wstring),
char* (*getUniqueMapName)(),
void (*setUniqueMapName)(char*),
unsigned int (*getOpacityTimer)(int iPad),
void (*setOpacityTimer)(int iPad),
void (*tickOpacityTimer)(int iPad),
bool (*isInBannedLevelList)(int iPad, PlayerUID xuid, char* levelName),
MOJANG_DATA* (*getMojangDataForXuid)(PlayerUID xuid),
void (*debugPrintf)(const char*)
);
[[nodiscard]] int getHTMLColour(eMinecraftColour colour);
[[nodiscard]] int getHTMLColor(eMinecraftColour colour);
[[nodiscard]] std::wstring getEntityName(EntityTypeId type);
[[nodiscard]] const wchar_t* getGameRulesString(const std::wstring& key);
[[nodiscard]] unsigned int createImageTextData(std::uint8_t* textMetadata,
int64_t seed, bool hasSeed,
unsigned int uiHostOptions,
unsigned int uiTexturePackId);
[[nodiscard]] std::wstring getFilePath(std::uint32_t packId,
std::wstring filename,
bool bAddDataFolder,
std::wstring mountPoint = L"TPACK:");
[[nodiscard]] char* getUniqueMapName();
void setUniqueMapName(char* name);
[[nodiscard]] unsigned int getOpacityTimer(int iPad);
void setOpacityTimer(int iPad);
void tickOpacityTimer(int iPad);
[[nodiscard]] bool isInBannedLevelList(int iPad, PlayerUID xuid,
char* levelName);
[[nodiscard]] MOJANG_DATA* getMojangDataForXuid(PlayerUID xuid);
void debugPrintf(const char* msg);
// Member variable access (opaque pointers)
void initMemberAccess(
DLCManager* dlcManager,
GameRuleManager* gameRules,
std::vector<std::wstring>* skinNames,
std::vector<FEATURE_DATA*>* terrainFeatures
);
[[nodiscard]] DLCManager& getDLCManager();
[[nodiscard]] GameRuleManager& getGameRules();
[[nodiscard]] std::vector<std::wstring>& getSkinNames();
[[nodiscard]] std::vector<FEATURE_DATA*>& getTerrainFeatures();
void initMenuService(IMenuService* service);
[[nodiscard]] IMenuService& menus();
} // namespace GameServices
+20
View File
@@ -0,0 +1,20 @@
#pragma once
#include <cstdint>
#include "minecraft/GameEnums.h"
#ifndef MAX_CAPENAME_SIZE
#define MAX_CAPENAME_SIZE 32
#endif
struct MOJANG_DATA {
eXUID eXuid;
wchar_t wchCape[MAX_CAPENAME_SIZE];
wchar_t wchSkin[MAX_CAPENAME_SIZE];
};
struct FEATURE_DATA {
int x, z;
_eTerrainFeatureType eTerrainFeature;
};
+15
View File
@@ -0,0 +1,15 @@
#include "minecraft/IGameServices.h"
#include <cassert>
static IGameServices* s_services = nullptr;
void initGameServices(IGameServices* services) {
s_services = services;
}
IGameServices& gameServices() {
assert(s_services &&
"initGameServices() must be called before gameServices()");
return *s_services;
}
+235
View File
@@ -0,0 +1,235 @@
#pragma once
#include <cstdint>
#include <string>
#include <vector>
// Forward declarations - minecraft types
class LevelGenerationOptions;
class LevelRuleset;
class LevelChunk;
class ModelPart;
// Forward declarations
class DLCSkinFile;
class DLCPack;
#include "minecraft/client/model/SkinBox.h"
#include "minecraft/GameTypes.h"
#include "minecraft/GameEnums.h"
#include "platform/PlatformTypes.h"
#include "minecraft/network/packet/DisconnectPacket.h"
#include "minecraft/client/IMenuService.h"
// eINSTANCEOF lives in java/Class.h which is heavyweight.
using EntityTypeId = int;
class IGameServices {
public:
virtual ~IGameServices() = default;
// -- Strings --
[[nodiscard]] virtual const wchar_t* getString(int id) = 0;
// -- Debug settings --
[[nodiscard]] virtual bool debugSettingsOn() = 0;
[[nodiscard]] virtual bool debugArtToolsOn() = 0;
[[nodiscard]] virtual unsigned int debugGetMask(int iPad = -1,
bool overridePlayer = false) = 0;
[[nodiscard]] virtual bool debugMobsDontAttack() = 0;
[[nodiscard]] virtual bool debugMobsDontTick() = 0;
[[nodiscard]] virtual bool debugFreezePlayers() = 0;
// -- Game host options (global settings via stored pointer) --
[[nodiscard]] virtual unsigned int getGameHostOption(eGameHostOption option) = 0;
virtual void setGameHostOption(eGameHostOption option,
unsigned int value) = 0;
// -- Level generation --
[[nodiscard]] virtual LevelGenerationOptions* getLevelGenerationOptions() = 0;
[[nodiscard]] virtual LevelRuleset* getGameRuleDefinitions() = 0;
// -- Texture cache --
virtual void addMemoryTextureFile(const std::wstring& name,
std::uint8_t* data,
unsigned int size) = 0;
virtual void removeMemoryTextureFile(const std::wstring& name) = 0;
virtual void getMemFileDetails(const std::wstring& name,
std::uint8_t** data,
unsigned int* size) = 0;
[[nodiscard]] virtual bool isFileInMemoryTextures(const std::wstring& name) = 0;
// -- Player settings --
[[nodiscard]] virtual unsigned char getGameSettings(int iPad, int setting) = 0;
[[nodiscard]] virtual unsigned char getGameSettings(int setting) = 0;
// -- App time --
[[nodiscard]] virtual float getAppTime() = 0;
// -- Game state --
[[nodiscard]] virtual bool getGameStarted() = 0;
virtual void setGameStarted(bool val) = 0;
[[nodiscard]] virtual bool getTutorialMode() = 0;
virtual void setTutorialMode(bool val) = 0;
[[nodiscard]] virtual bool isAppPaused() = 0;
[[nodiscard]] virtual int getLocalPlayerCount() = 0;
[[nodiscard]] virtual bool autosaveDue() = 0;
virtual void setAutosaveTimerTime() = 0;
[[nodiscard]] virtual int64_t secondsToAutosave() = 0;
virtual void setDisconnectReason(
DisconnectPacket::eDisconnectReason reason) = 0;
virtual void lockSaveNotification() = 0;
virtual void unlockSaveNotification() = 0;
[[nodiscard]] virtual bool getResetNether() = 0;
[[nodiscard]] virtual bool getUseDPadForDebug() = 0;
[[nodiscard]] virtual bool getWriteSavesToFolderEnabled() = 0;
[[nodiscard]] virtual bool isLocalMultiplayerAvailable() = 0;
[[nodiscard]] virtual bool dlcInstallPending() = 0;
[[nodiscard]] virtual bool dlcInstallProcessCompleted() = 0;
[[nodiscard]] virtual bool canRecordStatsAndAchievements() = 0;
[[nodiscard]] virtual bool getTMSGlobalFileListRead() = 0;
virtual void setRequiredTexturePackID(std::uint32_t id) = 0;
virtual void setSpecialTutorialCompletionFlag(int iPad, int index) = 0;
virtual void setBanListCheck(int iPad, bool val) = 0;
[[nodiscard]] virtual bool getBanListCheck(int iPad) = 0;
[[nodiscard]] virtual unsigned int getGameNewWorldSize() = 0;
[[nodiscard]] virtual unsigned int getGameNewWorldSizeUseMoat() = 0;
[[nodiscard]] virtual unsigned int getGameNewHellScale() = 0;
// -- UI dispatch --
virtual void setAction(int iPad, eXuiAction action,
void* param = nullptr) = 0;
virtual void setXuiServerAction(int iPad, eXuiServerAction action,
void* param = nullptr) = 0;
[[nodiscard]] virtual eXuiAction getXuiAction(int iPad) = 0;
[[nodiscard]] virtual eXuiServerAction getXuiServerAction(int iPad) = 0;
[[nodiscard]] virtual void* getXuiServerActionParam(int iPad) = 0;
virtual void setGlobalXuiAction(eXuiAction action) = 0;
virtual void handleButtonPresses() = 0;
virtual void setTMSAction(int iPad, eTMSAction action) = 0;
// -- Skin / cape / animation --
[[nodiscard]] virtual std::wstring getPlayerSkinName(int iPad) = 0;
[[nodiscard]] virtual std::uint32_t getPlayerSkinId(int iPad) = 0;
[[nodiscard]] virtual std::wstring getPlayerCapeName(int iPad) = 0;
[[nodiscard]] virtual std::uint32_t getPlayerCapeId(int iPad) = 0;
[[nodiscard]] virtual std::uint32_t getAdditionalModelPartsForPad(int iPad) = 0;
virtual void setAdditionalSkinBoxes(std::uint32_t dwSkinID,
SKIN_BOX* boxA,
unsigned int boxC) = 0;
[[nodiscard]] virtual std::vector<SKIN_BOX*>* getAdditionalSkinBoxes(
std::uint32_t dwSkinID) = 0;
[[nodiscard]] virtual std::vector<ModelPart*>* getAdditionalModelParts(
std::uint32_t dwSkinID) = 0;
virtual std::vector<ModelPart*>* setAdditionalSkinBoxesFromVec(
std::uint32_t dwSkinID, std::vector<SKIN_BOX*>* pvSkinBoxA) = 0;
virtual void setAnimOverrideBitmask(std::uint32_t dwSkinID,
unsigned int bitmask) = 0;
[[nodiscard]] virtual unsigned int getAnimOverrideBitmask(
std::uint32_t dwSkinID) = 0;
[[nodiscard]] virtual std::uint32_t getSkinIdFromPath(const std::wstring& skin) = 0;
[[nodiscard]] virtual std::wstring getSkinPathFromId(std::uint32_t skinId) = 0;
[[nodiscard]] virtual bool defaultCapeExists() = 0;
[[nodiscard]] virtual bool isXuidNotch(PlayerUID xuid) = 0;
[[nodiscard]] virtual bool isXuidDeadmau5(PlayerUID xuid) = 0;
// -- Platform features --
virtual void fatalLoadError() = 0;
virtual void setRichPresenceContext(int iPad, int contextId) = 0;
virtual void captureSaveThumbnail() = 0;
virtual void getSaveThumbnail(std::uint8_t** data,
unsigned int* size) = 0;
virtual void readBannedList(int iPad, eTMSAction action = (eTMSAction)0,
bool bCallback = false) = 0;
virtual void updatePlayerInfo(std::uint8_t networkSmallId,
int16_t playerColourIndex,
unsigned int playerPrivileges) = 0;
[[nodiscard]] virtual unsigned int getPlayerPrivileges(
std::uint8_t networkSmallId) = 0;
virtual void setGameSettingsDebugMask(int iPad,
unsigned int uiVal) = 0;
// -- Schematics / terrain --
virtual void processSchematics(LevelChunk* chunk) = 0;
virtual void processSchematicsLighting(LevelChunk* chunk) = 0;
virtual void addTerrainFeaturePosition(_eTerrainFeatureType type,
int x, int z) = 0;
[[nodiscard]] virtual bool getTerrainFeaturePosition(_eTerrainFeatureType type,
int* pX, int* pZ) = 0;
virtual void loadDefaultGameRules() = 0;
// -- Archive / resources --
[[nodiscard]] virtual bool hasArchiveFile(const std::wstring& filename) = 0;
[[nodiscard]] virtual std::vector<std::uint8_t> getArchiveFile(
const std::wstring& filename) = 0;
// -- Strings / formatting / misc queries --
[[nodiscard]] virtual int getHTMLColour(eMinecraftColour colour) = 0;
[[nodiscard]] virtual std::wstring getEntityName(EntityTypeId type) = 0;
[[nodiscard]] virtual const wchar_t* getGameRulesString(
const std::wstring& key) = 0;
[[nodiscard]] virtual unsigned int createImageTextData(
std::uint8_t* textMetadata, int64_t seed, bool hasSeed,
unsigned int uiHostOptions, unsigned int uiTexturePackId) = 0;
[[nodiscard]] virtual std::wstring getFilePath(std::uint32_t packId,
std::wstring filename,
bool bAddDataFolder,
std::wstring mountPoint = L"TPACK:") = 0;
[[nodiscard]] virtual char* getUniqueMapName() = 0;
virtual void setUniqueMapName(char* name) = 0;
[[nodiscard]] virtual unsigned int getOpacityTimer(int iPad) = 0;
virtual void setOpacityTimer(int iPad) = 0;
virtual void tickOpacityTimer(int iPad) = 0;
[[nodiscard]] virtual bool isInBannedLevelList(int iPad, PlayerUID xuid,
char* levelName) = 0;
[[nodiscard]] virtual MOJANG_DATA* getMojangDataForXuid(PlayerUID xuid) = 0;
virtual void debugPrintf(const char* msg) = 0;
// -- DLC --
[[nodiscard]] virtual DLCSkinFile* getDLCSkinFile(
const std::wstring& name) = 0;
[[nodiscard]] virtual bool dlcNeedsCorruptCheck() = 0;
[[nodiscard]] virtual unsigned int dlcCheckForCorrupt(bool showMessage = true) = 0;
[[nodiscard]] virtual bool dlcReadDataFile(unsigned int& filesProcessed,
const std::wstring& path, DLCPack* pack,
bool fromArchive = false) = 0;
virtual void dlcRemovePack(DLCPack* pack) = 0;
// -- Game rules --
virtual LevelGenerationOptions* loadGameRules(std::uint8_t* data,
unsigned int size) = 0;
virtual void saveGameRules(std::uint8_t** data,
unsigned int* size) = 0;
virtual void unloadCurrentGameRules() = 0;
virtual void setLevelGenerationOptions(
LevelGenerationOptions* levelGen) = 0;
// -- Shared data --
[[nodiscard]] virtual std::vector<std::wstring>& getSkinNames() = 0;
[[nodiscard]] virtual std::vector<FEATURE_DATA*>& getTerrainFeatures() = 0;
// -- Menu service --
[[nodiscard]] virtual IMenuService& menus() = 0;
};
// Global accessor - set once at startup, used everywhere in minecraft/
void initGameServices(IGameServices* services);
IGameServices& gameServices();
+6 -6
View File
@@ -10,7 +10,7 @@
#include "app/common/DLC/DLCFile.h"
#include "app/common/DLC/DLCManager.h"
#include "app/common/DLC/DLCPack.h"
#include "minecraft/GameServices.h"
#include "minecraft/IGameServices.h"
#include "app/linux/Stubs/winapi_stubs.h"
#include "PlatformTypes.h"
#include "util/StringHelpers.h"
@@ -98,8 +98,8 @@ BufferedImage::BufferedImage(const std::wstring& File,
&ImageInfo, &data[l]);
} else {
std::wstring archiveKey = L"res/" + fileName;
if (GameServices::hasArchiveFile(archiveKey)) {
std::vector<uint8_t> ba = GameServices::getArchiveFile(archiveKey);
if (gameServices().hasArchiveFile(archiveKey)) {
std::vector<uint8_t> ba = gameServices().getArchiveFile(archiveKey);
hr = RenderManager.LoadTextureData(ba.data(), ba.size(),
&ImageInfo, &data[l]);
}
@@ -140,14 +140,14 @@ BufferedImage::BufferedImage(DLCPack* dlcPack, const std::wstring& File,
mipMapPath + L".png");
if (!dlcPack->doesPackContainFile(DLCManager::e_DLCType_All, name)) {
if (l == 0) GameServices::fatalLoadError();
if (l == 0) gameServices().fatalLoadError();
return;
}
DLCFile* dlcFile = dlcPack->getFile(DLCManager::e_DLCType_All, name);
pbData = dlcFile->getData(dataBytes);
if (pbData == nullptr || dataBytes == 0) {
if (l == 0) GameServices::fatalLoadError();
if (l == 0) gameServices().fatalLoadError();
return;
}
@@ -175,7 +175,7 @@ BufferedImage::BufferedImage(std::uint8_t* pbData, std::uint32_t dataBytes) {
width = ImageInfo.Width;
height = ImageInfo.Height;
} else {
GameServices::fatalLoadError();
gameServices().fatalLoadError();
}
}
+50 -52
View File
@@ -1,7 +1,5 @@
#include "minecraft/GameServices.h"
#include "minecraft/IGameServices.h"
#include "minecraft/client/IMenuService.h"
#include "minecraft/util/DebugSettings.h"
#include "minecraft/GameHostOptions.h"
#include "minecraft/util/Log.h"
#include "Minecraft.h"
@@ -19,7 +17,7 @@
#include "platform/sdl2/Profile.h"
#include "platform/sdl2/Render.h"
#include "platform/sdl2/Storage.h"
#include "app/common/App_enums.h"
#include "minecraft/GameEnums.h"
#include "app/common/Audio/SoundEngine.h"
#include "app/common/DLC/DLCManager.h"
#include "app/common/Network/GameNetworkManager.h"
@@ -284,7 +282,7 @@ void Minecraft::clearConnectionFailed() {
m_connectionFailed[i] = false;
m_connectionFailedReason[i] = DisconnectPacket::eDisconnect_None;
}
GameServices::setDisconnectReason(DisconnectPacket::eDisconnect_None);
gameServices().setDisconnectReason(DisconnectPacket::eDisconnect_None);
}
void Minecraft::connectTo(const std::wstring& server, int port) {
@@ -718,7 +716,7 @@ void Minecraft::updatePlayerViewportAssignments() {
for (int i = 0; i < XUSER_MAX_COUNT; i++) {
if (localplayers[i] != nullptr) {
// Primary player settings decide what the mode is
if (GameServices::getGameSettings(InputManager.GetPrimaryPad(),
if (gameServices().getGameSettings(InputManager.GetPrimaryPad(),
eGameSetting_SplitScreenVertical)) {
localplayers[i]->m_iScreenSection =
C4JRender::VIEWPORT_TYPE_SPLIT_LEFT + found;
@@ -741,7 +739,7 @@ void Minecraft::updatePlayerViewportAssignments() {
// allocations (as the players won't have seen them) This fixes
// an issue with the primary player being the 4th controller
// quadrant, but ending up in the 3rd viewport.
if (GameServices::getGameStarted()) {
if (gameServices().getGameStarted()) {
if ((localplayers[i]->m_iScreenSection >=
C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT) &&
(localplayers[i]->m_iScreenSection <=
@@ -790,7 +788,7 @@ void Minecraft::updatePlayerViewportAssignments() {
// 4J Stu - If the game is not running we do not want to do this yet, and
// should wait until the task that caused the app to not be running is
// finished
if (GameServices::getGameStarted()) ui.UpdatePlayerBasePositions();
if (gameServices().getGameStarted()) ui.UpdatePlayerBasePositions();
}
// Add a temporary player so that the viewports get re-arranged, and add the
@@ -872,7 +870,7 @@ std::shared_ptr<MultiplayerLocalPlayer> Minecraft::createExtraLocalPlayer(
mpLevel->addClientConnection(clientConnection);
}
if (GameServices::getTutorialMode()) {
if (gameServices().getTutorialMode()) {
localgameModes[idx] =
new FullTutorialMode(idx, this, clientConnection);
} else {
@@ -926,7 +924,7 @@ std::shared_ptr<MultiplayerLocalPlayer> Minecraft::createExtraLocalPlayer(
// ClientConnection::handleMovePlayer
// // 4J-PB - can't call this when this function is called
// from the qnet thread (GetGameStarted will be false)
// if(GameServices::getGameStarted())
// if(gameServices().getGameStarted())
// {
// ui.CloseUIScenes(idx);
// }
@@ -1069,7 +1067,7 @@ void Minecraft::run_middle() {
// set the timer
bAutosaveTimerSet=true;
GameServices::setAutosaveTimerTime();
gameServices().setAutosaveTimerTime();
}
else*/
{
@@ -1078,7 +1076,7 @@ void Minecraft::run_middle() {
// player has a app action running , or has any crafting
// or containers open, don't autosave
if (!StorageManager.GetSaveDisabled() &&
(GameServices::getXuiAction(InputManager.GetPrimaryPad()) ==
(gameServices().getXuiAction(InputManager.GetPrimaryPad()) ==
eAppAction_Idle)) {
if (!ui.IsPauseMenuDisplayed(
InputManager.GetPrimaryPad()) &&
@@ -1087,7 +1085,7 @@ void Minecraft::run_middle() {
// check if the autotimer countdown has reached
// zero
unsigned char ucAutosaveVal =
GameServices::getGameSettings(
gameServices().getGameSettings(
InputManager.GetPrimaryPad(),
eGameSetting_Autosave);
bool bTrialTexturepack = false;
@@ -1116,7 +1114,7 @@ void Minecraft::run_middle() {
// check whether we need to save this tick
if ((ucAutosaveVal != 0) &&
!bTrialTexturepack) {
if (GameServices::autosaveDue()) {
if (gameServices().autosaveDue()) {
// disable the autosave countdown
ui.ShowAutosaveCountdownTimer(false);
@@ -1124,10 +1122,10 @@ void Minecraft::run_middle() {
Log::info("+++++++++++\n");
Log::info("+++Autosave\n");
Log::info("+++++++++++\n");
GameServices::setAction(
gameServices().setAction(
InputManager.GetPrimaryPad(),
eAppAction_AutosaveSaveGame);
// GameServices::setAutosaveTimerTime();
// gameServices().setAutosaveTimerTime();
#if !defined(_CONTENT_PACKAGE)
{
// print the time
@@ -1150,7 +1148,7 @@ void Minecraft::run_middle() {
#endif
} else {
int64_t uiTimeToAutosave =
GameServices::secondsToAutosave();
gameServices().secondsToAutosave();
if (uiTimeToAutosave < 6) {
ui.ShowAutosaveCountdownTimer(true);
@@ -1171,14 +1169,14 @@ void Minecraft::run_middle() {
// the level in their banned list and ask if they want to play
// it
for (int i = 0; i < XUSER_MAX_COUNT; i++) {
if (localplayers[i] && (GameServices::getBanListCheck(i) == false) &&
if (localplayers[i] && (gameServices().getBanListCheck(i) == false) &&
!Minecraft::GetInstance()->isTutorial() &&
ProfileManager.IsSignedInLive(i) &&
!ProfileManager.IsGuest(i)) {
// If there is a sys ui displayed, we can't display the
// message box here, so ignore until we can
if (!ProfileManager.IsSystemUIDisplayed()) {
GameServices::setBanListCheck(i, true);
gameServices().setBanListCheck(i, true);
// 4J-PB - check if the level is in the banned level
// list get the unique save name and xuid from
// whoever is the host
@@ -1186,15 +1184,15 @@ void Minecraft::run_middle() {
g_NetworkManager.GetHostPlayer();
PlayerUID xuid = pHostPlayer->GetUID();
if (GameServices::isInBannedLevelList(
i, xuid, GameServices::getUniqueMapName())) {
if (gameServices().isInBannedLevelList(
i, xuid, gameServices().getUniqueMapName())) {
// put up a message box asking if the player
// would like to unban this level
Log::info("This level is banned\n");
// set the app action to bring up the message
// box to give them the option to remove from
// the ban list or exit the level
GameServices::setAction(i, eAppAction_LevelInBanLevelList,
gameServices().setAction(i, eAppAction_LevelInBanLevelList,
(void*)true);
}
}
@@ -1202,10 +1200,10 @@ void Minecraft::run_middle() {
}
if (!ProfileManager.IsSystemUIDisplayed() &&
GameServices::dlcInstallProcessCompleted() &&
!GameServices::dlcInstallPending() &&
GameServices::getDLCManager().NeedsCorruptCheck()) {
GameServices::getDLCManager().checkForCorruptDLCAndAlert();
gameServices().dlcInstallProcessCompleted() &&
!gameServices().dlcInstallPending() &&
gameServices().dlcNeedsCorruptCheck()) {
gameServices().dlcCheckForCorrupt();
}
// When we go into the first loaded level, check if the console
@@ -1218,7 +1216,7 @@ void Minecraft::run_middle() {
if (iFirstTimeCountdown == 0) {
bFirstTimeIntoGame = false;
if (GameServices::isLocalMultiplayerAvailable()) {
if (gameServices().isLocalMultiplayerAvailable()) {
for (int i = 0; i < XUSER_MAX_COUNT; i++) {
if ((localplayers[i] == nullptr) &&
InputManager.IsPadConnected(i)) {
@@ -1297,7 +1295,7 @@ void Minecraft::run_middle() {
1LL << MINECRAFT_ACTION_GAME_INFO;
#if !defined(_FINAL_BUILD)
if (DebugSettings::isOn() && GameServices::getUseDPadForDebug()) {
if (gameServices().debugSettingsOn() && gameServices().getUseDPadForDebug()) {
localplayers[i]->ullDpad_last = 0;
localplayers[i]->ullDpad_this = 0;
localplayers[i]->ullDpad_filtered = 0;
@@ -1375,7 +1373,7 @@ void Minecraft::run_middle() {
// || InputManager.ButtonPressed(i,
// MINECRAFT_ACTION_ACTION))
{
GameServices::setOpacityTimer(i);
gameServices().setOpacityTimer(i);
}
} else {
// 4J Stu - This doesn't make any sense with the way we
@@ -1542,7 +1540,7 @@ void Minecraft::run_middle() {
// again
if (i != 0) {
InputManager.Tick();
GameServices::handleButtonPresses();
gameServices().handleButtonPresses();
}
ticks++;
@@ -1662,12 +1660,12 @@ void Minecraft::run_middle() {
if (i == iPrimaryPad) {
// check to see if we need to capture a
// screenshot for the save game thumbnail
switch (GameServices::getXuiAction(i)) {
switch (gameServices().getXuiAction(i)) {
case eAppAction_ExitWorldCapturedThumbnail:
case eAppAction_SaveGameCapturedThumbnail:
case eAppAction_AutosaveSaveGameCapturedThumbnail:
// capture the save thumbnail
GameServices::captureSaveThumbnail();
gameServices().captureSaveThumbnail();
break;
default:
break;
@@ -1780,7 +1778,7 @@ void Minecraft::run_middle() {
g_NetworkManager.GetPlayerCount() == 1 &&
screen != nullptr && screen->isPauseScreen();
#else
pause = GameServices::isAppPaused();
pause = gameServices().isAppPaused();
#endif
#if !defined(_CONTENT_PACKAGE)
@@ -2015,7 +2013,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) {
// Tick the opacity timer (to display the interface at default opacity for a
// certain time if the user has been navigating it)
GameServices::tickOpacityTimer(iPad);
gameServices().tickOpacityTimer(iPad);
// 4J added
if (bFirst) levelRenderer->destroyedTileManager->tick();
@@ -3040,7 +3038,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) {
// have the
// privilege
{
if (GameHostOptions::get(
if (gameServices().getGameHostOption(
eGameHostOption_PvP) &&
player->isAllowedToAttackPlayers()) {
*piAction = IDS_TOOLTIPS_HIT;
@@ -3366,7 +3364,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) {
}
}
if (DebugSettings::isOn()) {
if (gameServices().debugSettingsOn()) {
if (player->ullButtonsPressed &
(1LL << MINECRAFT_ACTION_CHANGE_SKIN)) {
player->ChangePlayerSkin();
@@ -3376,7 +3374,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) {
if (player->missTime > 0) player->missTime--;
#if defined(_DEBUG_MENUS_ENABLED)
if (DebugSettings::isOn()) {
if (gameServices().debugSettingsOn()) {
// 4J-PB - debugoverlay for primary player only
if (iPad == InputManager.GetPrimaryPad()) {
if ((player->ullButtonsPressed &
@@ -3393,7 +3391,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) {
if ((player->ullButtonsPressed &
(1LL << MINECRAFT_ACTION_SPAWN_CREEPER)) &&
DebugSettings::mobsDontAttack()) {
gameServices().debugMobsDontAttack()) {
// shared_ptr<Mob> mob =
// std::dynamic_pointer_cast<Mob>(Creeper::_class->newInstance(
// level )); shared_ptr<Mob> mob =
@@ -3437,7 +3435,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) {
#if defined(ENABLE_JAVA_GUIS)
setScreen(new InventoryScreen(player));
#else
GameServices::menus().openInventory(iPad, std::static_pointer_cast<LocalPlayer>(player));
gameServices().menus().openInventory(iPad, std::static_pointer_cast<LocalPlayer>(player));
#endif
}
@@ -3458,7 +3456,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) {
setScreen(new CreativeInventoryScreen(player));
}
#else
GameServices::menus().openCreative(iPad, std::static_pointer_cast<LocalPlayer>(player));
gameServices().menus().openCreative(iPad, std::static_pointer_cast<LocalPlayer>(player));
}
// 4J-PB - Microsoft request that we use the 3x3 crafting if someone
// presses X while at the workbench
@@ -3475,7 +3473,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) {
&hitResult->pos, false, &usedItem);
} else {
ui.PlayUISFX(eSFX_Press);
GameServices::menus().openCrafting2x2(iPad, std::static_pointer_cast<LocalPlayer>(player));
gameServices().menus().openCrafting2x2(iPad, std::static_pointer_cast<LocalPlayer>(player));
}
#endif
}
@@ -3543,9 +3541,9 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) {
// printf("Input Detected!\n");
//
// // see if we can react to this
// if(GameServices::getXuiAction(iPad)==eAppAction_Idle)
// if(gameServices().getXuiAction(iPad)==eAppAction_Idle)
// {
// GameServices::setAction(iPad,eAppAction_DebugText,(void*)wchInput);
// gameServices().setAction(iPad,eAppAction_DebugText,(void*)wchInput);
// }
// }
// }
@@ -3972,7 +3970,7 @@ void Minecraft::fileDownloaded(const std::wstring& name, File* file) {
std::wstring Minecraft::gatherStats1() {
// return levelRenderer->gatherStats1();
return L"Time to autosave: " +
toWString<int64_t>(GameServices::secondsToAutosave()) + L"s";
toWString<int64_t>(gameServices().secondsToAutosave()) + L"s";
}
std::wstring Minecraft::gatherStats2() {
@@ -4045,7 +4043,7 @@ void Minecraft::respawnPlayer(int iPad, int dimension, int newEntityId) {
}
// Set the animation override if the skin has one
std::uint32_t dwSkinID = GameServices::getSkinIdFromPath(player->customTextureUrl);
std::uint32_t dwSkinID = gameServices().getSkinIdFromPath(player->customTextureUrl);
if (GET_IS_DLC_SKIN_FROM_BITMASK(dwSkinID)) {
player->setAnimOverrideBitmask(
player->getSkinAnimOverrideBitmask(dwSkinID));
@@ -4059,14 +4057,14 @@ void Minecraft::respawnPlayer(int iPad, int dimension, int newEntityId) {
createPrimaryLocalPlayer(iPad);
// update the debugoptions
GameServices::setGameSettingsDebugMask(InputManager.GetPrimaryPad(),
DebugSettings::getMask(-1, true));
gameServices().setGameSettingsDebugMask(InputManager.GetPrimaryPad(),
gameServices().debugGetMask(-1, true));
} else {
storeExtraLocalPlayer(iPad);
}
player->setShowOnMaps(
GameHostOptions::get(eGameHostOption_Gamertags) != 0 ? true : false);
gameServices().getGameHostOption(eGameHostOption_Gamertags) != 0 ? true : false);
player->resetPos();
level->addEntity(player);
@@ -4208,7 +4206,7 @@ void Minecraft::main() {
User::staticCtor();
Tutorial::staticCtor();
ColourTable::staticCtor();
GameServices::loadDefaultGameRules();
gameServices().loadDefaultGameRules();
#if defined(_LARGE_WORLDS)
LevelRenderer::staticCtor();
@@ -4436,7 +4434,7 @@ bool Minecraft::isTutorial() {
void Minecraft::playerStartedTutorial(int iPad) {
// If the app doesn't think we are in a tutorial mode then just ignore this
// add
if (GameServices::getTutorialMode())
if (gameServices().getTutorialMode())
m_inFullTutorialBits = m_inFullTutorialBits | (1 << iPad);
}
@@ -4444,13 +4442,13 @@ void Minecraft::playerLeftTutorial(int iPad) {
// 4J Stu - Fix for bug that was flooding Sentient with LevelStart events
// If the tutorial bits are already 0 then don't need to update anything
if (m_inFullTutorialBits == 0) {
GameServices::setTutorialMode(false);
gameServices().setTutorialMode(false);
return;
}
m_inFullTutorialBits = m_inFullTutorialBits & ~(1 << iPad);
if (m_inFullTutorialBits == 0) {
GameServices::setTutorialMode(false);
gameServices().setTutorialMode(false);
}
}
@@ -1,5 +1,4 @@
#include "minecraft/GameServices.h"
#include "minecraft/GameHostOptions.h"
#include "minecraft/IGameServices.h"
#include "minecraft/util/Log.h"
#include "CreateWorldScreen.h"
@@ -13,7 +12,7 @@
#include "Button.h"
#include "EditBox.h"
#include "MessageScreen.h"
#include "app/common/App_enums.h"
#include "minecraft/GameEnums.h"
#include "app/common/Network/GameNetworkManager.h"
#include "app/common/UI/All Platforms/UIEnums.h"
#include "app/common/UI/All Platforms/UIStructs.h"
@@ -253,38 +252,38 @@ void CreateWorldScreen::buttonClicked(Button* button) {
param->texturePackId = 0;
param->settings = 0;
GameHostOptions::set(eGameHostOption_Difficulty,
gameServices().setGameHostOption(eGameHostOption_Difficulty,
minecraft->options->difficulty);
GameHostOptions::set(eGameHostOption_FriendsOfFriends,
gameServices().setGameHostOption(eGameHostOption_FriendsOfFriends,
moreOptionsParams->bAllowFriendsOfFriends);
GameHostOptions::set(eGameHostOption_Gamertags, 1);
GameHostOptions::set(eGameHostOption_BedrockFog, 0);
GameHostOptions::set(eGameHostOption_GameType,
gameServices().setGameHostOption(eGameHostOption_Gamertags, 1);
gameServices().setGameHostOption(eGameHostOption_BedrockFog, 0);
gameServices().setGameHostOption(eGameHostOption_GameType,
(gameMode == L"survival")
? GameType::SURVIVAL->getId()
: GameType::CREATIVE->getId());
GameHostOptions::set(eGameHostOption_LevelType,
gameServices().setGameHostOption(eGameHostOption_LevelType,
moreOptionsParams->bFlatWorld);
GameHostOptions::set(eGameHostOption_Structures,
gameServices().setGameHostOption(eGameHostOption_Structures,
moreOptionsParams->bStructures);
GameHostOptions::set(eGameHostOption_BonusChest,
gameServices().setGameHostOption(eGameHostOption_BonusChest,
moreOptionsParams->bBonusChest);
GameHostOptions::set(eGameHostOption_PvP, moreOptionsParams->bPVP);
GameHostOptions::set(eGameHostOption_TrustPlayers,
gameServices().setGameHostOption(eGameHostOption_PvP, moreOptionsParams->bPVP);
gameServices().setGameHostOption(eGameHostOption_TrustPlayers,
moreOptionsParams->bTrust);
GameHostOptions::set(eGameHostOption_FireSpreads,
gameServices().setGameHostOption(eGameHostOption_FireSpreads,
moreOptionsParams->bFireSpreads);
GameHostOptions::set(eGameHostOption_TNT, moreOptionsParams->bTNT);
GameHostOptions::set(eGameHostOption_HostCanFly,
gameServices().setGameHostOption(eGameHostOption_TNT, moreOptionsParams->bTNT);
gameServices().setGameHostOption(eGameHostOption_HostCanFly,
moreOptionsParams->bHostPrivileges);
GameHostOptions::set(eGameHostOption_HostCanChangeHunger,
gameServices().setGameHostOption(eGameHostOption_HostCanChangeHunger,
moreOptionsParams->bHostPrivileges);
GameHostOptions::set(eGameHostOption_HostCanBeInvisible,
gameServices().setGameHostOption(eGameHostOption_HostCanBeInvisible,
moreOptionsParams->bHostPrivileges);
GameHostOptions::set(eGameHostOption_CheatsEnabled,
gameServices().setGameHostOption(eGameHostOption_CheatsEnabled,
moreOptionsParams->bHostPrivileges);
param->settings = GameHostOptions::get(eGameHostOption_All);
param->settings = gameServices().getGameHostOption(eGameHostOption_All);
param->xzSize = LEVEL_MAX_WIDTH;
param->hellScale = HELL_LEVEL_MAX_SCALE;
@@ -297,7 +296,7 @@ void CreateWorldScreen::buttonClicked(Button* button) {
loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc;
loadingParams->lpParam = param;
GameServices::setAutosaveTimerTime();
gameServices().setAutosaveTimerTime();
UIFullscreenProgressCompletionData* completionData =
new UIFullscreenProgressCompletionData();
+16 -17
View File
@@ -1,5 +1,4 @@
#include "minecraft/GameServices.h"
#include "minecraft/locale/Strings.h"
#include "minecraft/IGameServices.h"
#include "Gui.h"
#include <cmath>
@@ -9,7 +8,7 @@
#include "platform/sdl2/Input.h"
#include "platform/sdl2/Render.h"
#include "Facing.h"
#include "app/common/App_enums.h"
#include "minecraft/GameEnums.h"
#include "app/common/App_structs.h"
#include "app/linux/LinuxGame.h"
#include "app/linux/Linux_UIController.h"
@@ -114,10 +113,10 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) {
// 4J-PB - selected the gui scale based on the slider settings
if (minecraft->player->m_iScreenSection ==
C4JRender::VIEWPORT_TYPE_FULLSCREEN) {
guiScale = GameServices::getGameSettings(iPad, eGameSetting_UISize) + 2;
guiScale = gameServices().getGameSettings(iPad, eGameSetting_UISize) + 2;
} else {
guiScale =
GameServices::getGameSettings(iPad, eGameSetting_UISizeSplitscreen) + 2;
gameServices().getGameSettings(iPad, eGameSetting_UISizeSplitscreen) + 2;
}
ScreenSizeCalculator ssc(minecraft->options, minecraft->width,
@@ -248,11 +247,11 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) {
// 4J-PB - turn off the slot display if a xui menu is up, or if we're
// autosaving
bool bDisplayGui = !ui.GetMenuDisplayed(iPad) &&
!(GameServices::getXuiAction(iPad) ==
!(gameServices().getXuiAction(iPad) ==
eAppAction_AutosaveSaveGameCapturedThumbnail);
// if tooltips are off, set the y offset to zero
if (GameServices::getGameSettings(iPad, eGameSetting_Tooltips) == 0 && bDisplayGui) {
if (gameServices().getGameSettings(iPad, eGameSetting_Tooltips) == 0 && bDisplayGui) {
switch (minecraft->player->m_iScreenSection) {
case C4JRender::VIEWPORT_TYPE_FULLSCREEN:
iTooltipsYOffset = screenHeight / 10;
@@ -276,7 +275,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) {
// 4J-PB - Turn off interface if eGameSetting_DisplayHUD is off - for screen
// shots/videos.
if (GameServices::getGameSettings(iPad, eGameSetting_DisplayHUD) == 0) {
if (gameServices().getGameSettings(iPad, eGameSetting_DisplayHUD) == 0) {
bDisplayGui = false;
}
@@ -335,7 +334,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) {
// 4J - this is where to set the blend factor for gui things
// use the primary player's settings
unsigned char ucAlpha = GameServices::getGameSettings(
unsigned char ucAlpha = gameServices().getGameSettings(
InputManager.GetPrimaryPad(), eGameSetting_InterfaceOpacity);
// If the user has started to navigate their quickselect bar, ignore the
@@ -343,7 +342,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) {
float fVal = fAlphaIncrementPerCent * (float)ucAlpha;
if (ucAlpha < 80) {
// check if we have the timer running for the opacity
unsigned int uiOpacityTimer = GameServices::getOpacityTimer(iPad);
unsigned int uiOpacityTimer = gameServices().getOpacityTimer(iPad);
if (uiOpacityTimer != 0) {
if (uiOpacityTimer < 10) {
float fStep = (80.0f - (float)ucAlpha) / 10.0f;
@@ -730,7 +729,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) {
// positions worked out by hand from the xui implementation of the
// crouch icon
if (GameServices::getGameSettings(iPad, eGameSetting_AnimatedCharacter)) {
if (gameServices().getGameSettings(iPad, eGameSetting_AnimatedCharacter)) {
// int playerIdx = minecraft->player->GetXboxPad();
static int characterDisplayTimer[4] = {0};
@@ -979,8 +978,8 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) {
wfeature[eTerrainFeature_Village] = L"Village: ";
wfeature[eTerrainFeature_Ravine] = L"Ravine: ";
for (int i = 0; i < GameServices::getTerrainFeatures().size(); i++) {
FEATURE_DATA* pFeatureData = GameServices::getTerrainFeatures()[i];
for (int i = 0; i < gameServices().getTerrainFeatures().size(); i++) {
FEATURE_DATA* pFeatureData = gameServices().getTerrainFeatures()[i];
std::wstring itemInfo =
L"[" + toWString<int>(pFeatureData->x * 16) + L", " +
@@ -1467,7 +1466,7 @@ void Gui::addMessage(const std::wstring& _string, int iPad,
for (int i = 0; i < XUSER_MAX_COUNT; i++) {
if (minecraft->localplayers[i] &&
!(bIsDeathMessage &&
GameServices::getGameSettings(i, eGameSetting_DeathMessages) == 0)) {
gameServices().getGameSettings(i, eGameSetting_DeathMessages) == 0)) {
guiMessages[i].insert(guiMessages[i].begin(),
GuiMessage(string));
while (guiMessages[i].size() > 50) {
@@ -1476,7 +1475,7 @@ void Gui::addMessage(const std::wstring& _string, int iPad,
}
}
} else if (!(bIsDeathMessage &&
GameServices::getGameSettings(iPad, eGameSetting_DeathMessages) == 0)) {
gameServices().getGameSettings(iPad, eGameSetting_DeathMessages) == 0)) {
guiMessages[iPad].insert(guiMessages[iPad].begin(), GuiMessage(string));
while (guiMessages[iPad].size() > 50) {
guiMessages[iPad].pop_back();
@@ -1511,7 +1510,7 @@ float Gui::getJukeboxOpacity(int iPad) {
void Gui::setNowPlaying(const std::wstring& string) {
// overlayMessageString = L"Now playing: " + string;
overlayMessageString = Strings::get(IDS_NOWPLAYING) + string;
overlayMessageString = gameServices().getString(IDS_NOWPLAYING) + string;
overlayMessageTime = 20 * 3;
animateOverlayMessageColor = true;
}
@@ -1519,7 +1518,7 @@ void Gui::setNowPlaying(const std::wstring& string) {
void Gui::displayClientMessage(int messageId, int iPad) {
// Language *language = Language::getInstance();
std::wstring languageString =
Strings::get(messageId); // language->getElement(messageId);
gameServices().getString(messageId); // language->getElement(messageId);
addMessage(languageString, iPad);
}
+1 -1
View File
@@ -9,7 +9,7 @@
#include "platform/sdl2/Render.h"
#include "Font.h"
#include "app/common/App_enums.h"
#include "minecraft/GameEnums.h"
#include "app/common/Colours/ColourTable.h"
#include "minecraft/client/BufferedImage.h"
#include "minecraft/client/Minecraft.h"
+5 -5
View File
@@ -1,4 +1,4 @@
#include "minecraft/GameServices.h"
#include "minecraft/IGameServices.h"
#include "PauseScreen.h"
#include <math.h>
@@ -11,7 +11,7 @@
#include "platform/sdl2/Input.h"
#include "Button.h"
#include "MessageScreen.h"
#include "app/common/App_enums.h"
#include "minecraft/GameEnums.h"
#include "app/common/Network/GameNetworkManager.h"
#include "app/linux/LinuxGame.h"
#include "OptionsScreen.h"
@@ -33,7 +33,7 @@ void PauseScreen::init() {
// 4jcraft: solves the issue of client-side only pausing in the java gui
if (g_NetworkManager.IsLocalGame() &&
g_NetworkManager.GetPlayerCount() == 1)
GameServices::setXuiServerAction(InputManager.GetPrimaryPad(),
gameServices().setXuiServerAction(InputManager.GetPrimaryPad(),
eXuiServerAction_PauseServer, (void*)true);
buttons.push_back(new Button(1, width / 2 - 100, height / 4 + 24 * 5 + yo,
I18n::get(L"menu.returnToMenu")));
@@ -71,7 +71,7 @@ void PauseScreen::exitWorld(Minecraft* minecraft, bool save) {
if (g_NetworkManager.IsHost()) {
server->setSaveOnExit(save);
}
GameServices::setAction(minecraft->player->GetXboxPad(), eAppAction_ExitWorld);
gameServices().setAction(minecraft->player->GetXboxPad(), eAppAction_ExitWorld);
}
void PauseScreen::buttonClicked(Button* button) {
@@ -91,7 +91,7 @@ void PauseScreen::buttonClicked(Button* button) {
exitWorld(minecraft, true);
}
if (button->id == 4) {
GameServices::setXuiServerAction(InputManager.GetPrimaryPad(),
gameServices().setXuiServerAction(InputManager.GetPrimaryPad(),
eXuiServerAction_PauseServer, (void*)false);
minecraft->setScreen(nullptr);
// minecraft->grabMouse(); // 4J - removed
+3 -3
View File
@@ -1,11 +1,11 @@
#include "minecraft/GameServices.h"
#include "minecraft/IGameServices.h"
#include "Screen.h"
#include "platform/InputActions.h"
#include "platform/sdl2/Input.h"
#include "platform/sdl2/Profile.h"
#include "Button.h"
#include "app/common/App_enums.h"
#include "minecraft/GameEnums.h"
#include "app/common/Audio/SoundEngine.h"
#include "app/common/Network/GameNetworkManager.h"
#include "app/linux/LinuxGame.h"
@@ -44,7 +44,7 @@ void Screen::keyPressed(wchar_t eventCharacter, int eventKey) {
// unpausing is done in all scenarios
if (g_NetworkManager.IsLocalGame() &&
g_NetworkManager.GetPlayerCount() == 1)
GameServices::setXuiServerAction(InputManager.GetPrimaryPad(),
gameServices().setXuiServerAction(InputManager.GetPrimaryPad(),
eXuiServerAction_PauseServer, (void*)false);
}
}
@@ -1,4 +1,4 @@
#include "minecraft/GameServices.h"
#include "minecraft/IGameServices.h"
#include "AbstractContainerScreen.h"
#include <wchar.h>
@@ -249,7 +249,7 @@ void AbstractContainerScreen::renderTooltip(std::shared_ptr<ItemInstance> item,
}
if (!cleanedLines.empty()) {
lineColors[0] = GameServices::getHTMLColour(item->getRarity()->color);
lineColors[0] = gameServices().getHTMLColour(item->getRarity()->color);
}
renderTooltipInternal(cleanedLines, lineColors, xm, ym);
@@ -1,4 +1,4 @@
#include "minecraft/locale/Strings.h"
#include "minecraft/IGameServices.h"
#include "BeaconPowerButton.h"
#include <string>
@@ -35,7 +35,7 @@ void BeaconPowerButton::renderTooltip(int xm, int ym) {
MobEffect* effect = MobEffect::effects[effectId];
if (!effect) return;
std::wstring name = Strings::get(effect->getDescriptionId());
std::wstring name = gameServices().getString(effect->getDescriptionId());
if (tier >= 3 && effect->id != MobEffect::regeneration->id) {
name += L" II";
}
@@ -1,4 +1,4 @@
#include "minecraft/locale/Strings.h"
#include "minecraft/IGameServices.h"
#include "CreativeInventoryScreen.h"
#include <GL/gl.h>
@@ -412,7 +412,7 @@ void CreativeInventoryScreen::renderLabels() {
IUIScene_CreativeMenu::TabSpec* spec =
IUIScene_CreativeMenu::specs[selectedTabIndex];
if (spec) {
std::wstring tabName = Strings::get(spec->m_descriptionId);
std::wstring tabName = gameServices().getString(spec->m_descriptionId);
font->draw(tabName, 8, 6, 0x404040);
}
}
@@ -590,7 +590,7 @@ bool CreativeInventoryScreen::renderIconTooltip(int tab, int mouseX,
glDisable(GL_LIGHTING);
glDisable(GL_DEPTH_TEST);
renderTooltip(
Strings::get(IUIScene_CreativeMenu::specs[tab]->m_descriptionId),
gameServices().getString(IUIScene_CreativeMenu::specs[tab]->m_descriptionId),
mouseX, mouseY);
glEnable(GL_LIGHTING);
glEnable(GL_DEPTH_TEST);
@@ -1,5 +1,5 @@
#pragma once
#include "minecraft/client/SkinBox.h"
#include "minecraft/client/model/SkinBox.h"
#include "minecraft/client/model/geom/Model.h"
class ModelPart;
+1 -1
View File
@@ -5,7 +5,7 @@
#include <unordered_map>
#include <vector>
#include "minecraft/client/SkinBox.h"
#include "minecraft/client/model/SkinBox.h"
#include "java/Random.h"
class Mob;
@@ -2,7 +2,7 @@
#include <string>
#include <vector>
#include "minecraft/client/SkinBox.h"
#include "minecraft/client/model/SkinBox.h"
#include "Model.h"
#include "minecraft/client/model/Polygon.h"
#include "minecraft/client/model/Vertex.h"
File diff suppressed because it is too large Load Diff
@@ -1,4 +1,4 @@
#include "minecraft/util/DebugSettings.h"
#include "minecraft/IGameServices.h"
#include "MultiPlayerGameMode.h"
#include <vector>
@@ -150,8 +150,8 @@ void MultiPlayerGameMode::startDestroyBlock(int x, int y, int z, int face) {
if (t > 0 &&
(Tile::tiles[t]->getDestroyProgress(
minecraft->player, minecraft->player->level, x, y, z) >= 1
// ||(DebugSettings::isOn() &&
// DebugSettings::getMask(InputManager.GetPrimaryPad())&(1L<<eDebugSetting_InstantDestroy))
// ||(gameServices().debugSettingsOn() &&
// gameServices().debugGetMask(InputManager.GetPrimaryPad())&(1L<<eDebugSetting_InstantDestroy))
)) {
destroyBlock(x, y, z, face);
} else {
@@ -1,4 +1,4 @@
#include "minecraft/util/DebugSettings.h"
#include "minecraft/IGameServices.h"
#include "MultiPlayerLevel.h"
#include <float.h>
@@ -122,8 +122,8 @@ void MultiPlayerLevel::tick() {
// 4J: Debug setting added to keep it at day time
#if !defined(_FINAL_BUILD)
bool freezeTime =
DebugSettings::isOn() &&
DebugSettings::getMask(InputManager.GetPrimaryPad()) &
gameServices().debugSettingsOn() &&
gameServices().debugGetMask(InputManager.GetPrimaryPad()) &
(1L << eDebugSetting_FreezeTime);
if (!freezeTime)
#endif
@@ -1,4 +1,4 @@
#include "minecraft/GameServices.h"
#include "minecraft/IGameServices.h"
#include "minecraft/util/Log.h"
#include "MultiPlayerLocalPlayer.h"
@@ -74,11 +74,11 @@ void MultiplayerLocalPlayer::tick() {
// bool bIsisPrimaryHost=g_NetworkManager.IsHost() &&
// (InputManager.GetPrimaryPad()==m_iPad);
/*if((GameServices::getGameSettings(m_iPad,eGameSetting_PlayerVisibleInMap)!=0) !=
/*if((gameServices().getGameSettings(m_iPad,eGameSetting_PlayerVisibleInMap)!=0) !=
m_bShownOnMaps)
{
m_bShownOnMaps =
(GameServices::getGameSettings(m_iPad,eGameSetting_PlayerVisibleInMap)!=0); if
(gameServices().getGameSettings(m_iPad,eGameSetting_PlayerVisibleInMap)!=0); if
(m_bShownOnMaps) connection->send( std::shared_ptr<PlayerCommandPacket>( new
PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::SHOW_ON_MAPS) )
); else connection->send( std::shared_ptr<PlayerCommandPacket>( new
@@ -379,7 +379,7 @@ void MultiplayerLocalPlayer::setAndBroadcastCustomSkin(std::uint32_t skinId) {
if (getCustomSkin() != oldSkinIndex)
connection->send(std::shared_ptr<TextureAndGeometryChangePacket>(
new TextureAndGeometryChangePacket(
shared_from_this(), GameServices::getPlayerSkinName(GetXboxPad()))));
shared_from_this(), gameServices().getPlayerSkinName(GetXboxPad()))));
}
void MultiplayerLocalPlayer::setAndBroadcastCustomCape(std::uint32_t capeId) {
@@ -392,7 +392,7 @@ void MultiplayerLocalPlayer::setAndBroadcastCustomCape(std::uint32_t capeId) {
if (getCustomCape() != oldCapeIndex)
connection->send(std::make_shared<TextureChangePacket>(
shared_from_this(), TextureChangePacket::e_TextureChange_Cape,
GameServices::getPlayerCapeName(GetXboxPad())));
gameServices().getPlayerCapeName(GetXboxPad())));
}
// 4J added for testing. This moves the player in a repeated sequence of 2
@@ -1,6 +1,6 @@
#include "DragonBreathParticle.h"
#include "app/common/App_enums.h"
#include "minecraft/GameEnums.h"
#include "app/common/Colours/ColourTable.h"
#include "java/JavaMath.h"
#include "minecraft/client/Minecraft.h"
@@ -2,7 +2,7 @@
#include <cmath>
#include "app/common/App_enums.h"
#include "minecraft/GameEnums.h"
#include "app/common/Colours/ColourTable.h"
#include "java/JavaMath.h"
#include "minecraft/client/Minecraft.h"
@@ -1,6 +1,6 @@
#include "EnchantmentTableParticle.h"
#include "app/common/App_enums.h"
#include "minecraft/GameEnums.h"
#include "app/common/Colours/ColourTable.h"
#include "java/JavaMath.h"
#include "java/Random.h"
@@ -1,6 +1,6 @@
#include "EnderParticle.h"
#include "app/common/App_enums.h"
#include "minecraft/GameEnums.h"
#include "app/common/Colours/ColourTable.h"
#include "java/JavaMath.h"
#include "java/Random.h"
@@ -1,6 +1,6 @@
#include "ExplodeParticle.h"
#include "app/common/App_enums.h"
#include "minecraft/GameEnums.h"
#include "app/common/Colours/ColourTable.h"
#include "java/JavaMath.h"
#include "java/Random.h"
@@ -3,7 +3,7 @@
#include <GL/gl.h>
#include "platform/sdl2/Render.h"
#include "app/common/App_enums.h"
#include "minecraft/GameEnums.h"
#include "app/common/Colours/ColourTable.h"
#include "java/Random.h"
#include "minecraft/client/Lighting.h"
@@ -1,6 +1,6 @@
#include "NetherPortalParticle.h"
#include "app/common/App_enums.h"
#include "minecraft/GameEnums.h"
#include "app/common/Colours/ColourTable.h"
#include "java/JavaMath.h"
#include "java/Random.h"
@@ -2,7 +2,7 @@
#include <math.h>
#include "app/common/App_enums.h"
#include "minecraft/GameEnums.h"
#include "app/common/Colours/ColourTable.h"
#include "minecraft/client/Minecraft.h"
#include "minecraft/client/particle/Particle.h"
@@ -1,6 +1,6 @@
#include "SmokeParticle.h"
#include "app/common/App_enums.h"
#include "minecraft/GameEnums.h"
#include "app/common/Colours/ColourTable.h"
#include "java/JavaMath.h"
#include "minecraft/client/Minecraft.h"
@@ -2,7 +2,7 @@
#include <cmath>
#include "app/common/App_enums.h"
#include "minecraft/GameEnums.h"
#include "app/common/Colours/ColourTable.h"
#include "java/JavaMath.h"
#include "java/Random.h"
+8 -9
View File
@@ -1,5 +1,4 @@
#include "minecraft/GameServices.h"
#include "minecraft/util/DebugSettings.h"
#include "minecraft/IGameServices.h"
#include "Input.h"
#include <cmath>
@@ -7,7 +6,7 @@
#include "platform/InputActions.h"
#include "platform/sdl2/Input.h"
#include "LocalPlayer.h"
#include "app/common/App_enums.h"
#include "minecraft/GameEnums.h"
#include "app/linux/LinuxGame.h"
#include "minecraft/client/Minecraft.h"
#include "minecraft/client/multiplayer/MultiPlayerGameMode.h"
@@ -52,7 +51,7 @@ void Input::tick(LocalPlayer* player) {
ya = 0.0f;
#ifndef _CONTENT_PACKAGE
if (DebugSettings::freezePlayers()) {
if (gameServices().debugFreezePlayers()) {
xa = ya = 0.0f;
player->abilities.flying = true;
}
@@ -89,7 +88,7 @@ void Input::tick(LocalPlayer* player) {
pMinecraft->localgameModes[iPad]->isInputAllowed(
MINECRAFT_ACTION_LOOK_RIGHT))
tx = InputManager.GetJoypadStick_RX(iPad) *
(((float)GameServices::getGameSettings(iPad,
(((float)gameServices().getGameSettings(iPad,
eGameSetting_Sensitivity_InGame)) /
100.0f); // apply sensitivity to look
if (pMinecraft->localgameModes[iPad]->isInputAllowed(
@@ -97,16 +96,16 @@ void Input::tick(LocalPlayer* player) {
pMinecraft->localgameModes[iPad]->isInputAllowed(
MINECRAFT_ACTION_LOOK_DOWN))
ty = InputManager.GetJoypadStick_RY(iPad) *
(((float)GameServices::getGameSettings(iPad,
(((float)gameServices().getGameSettings(iPad,
eGameSetting_Sensitivity_InGame)) /
100.0f); // apply sensitivity to look
#ifndef _CONTENT_PACKAGE
if (DebugSettings::freezePlayers()) tx = ty = 0.0f;
if (gameServices().debugFreezePlayers()) tx = ty = 0.0f;
#endif
// 4J: WESTY : Invert look Y if required.
if (GameServices::getGameSettings(iPad, eGameSetting_ControlInvertLook)) {
if (gameServices().getGameSettings(iPad, eGameSetting_ControlInvertLook)) {
ty = -ty;
}
@@ -129,7 +128,7 @@ void Input::tick(LocalPlayer* player) {
pMinecraft->localgameModes[iPad]->isInputAllowed(MINECRAFT_ACTION_JUMP);
#ifndef _CONTENT_PACKAGE
if (DebugSettings::freezePlayers()) jumping = false;
if (gameServices().debugFreezePlayers()) jumping = false;
#endif
// OutputDebugString("INPUT: End input tick\n");
+29 -29
View File
@@ -1,5 +1,5 @@
#include "minecraft/client/IMenuService.h"
#include "minecraft/GameServices.h"
#include "minecraft/IGameServices.h"
#include "minecraft/util/Log.h"
#include "LocalPlayer.h"
@@ -117,7 +117,7 @@ LocalPlayer::LocalPlayer(Minecraft* minecraft, Level* level, User* user,
this->name = user->name;
// wprintf(L"Created LocalPlayer with name %ls\n", name.c_str() );
// check to see if this player's xuid is in the list of special players
MOJANG_DATA* pMojangData = GameServices::getMojangDataForXuid(getOnlineXuid());
MOJANG_DATA* pMojangData = gameServices().getMojangDataForXuid(getOnlineXuid());
if (pMojangData) {
customTextureUrl = pMojangData->wchSkin;
}
@@ -592,11 +592,11 @@ void LocalPlayer::openTextEdit(std::shared_ptr<TileEntity> tileEntity) {
bool success;
if (tileEntity->GetType() == eTYPE_SIGNTILEENTITY) {
success = GameServices::menus().openSign(
success = gameServices().menus().openSign(
GetXboxPad(),
std::dynamic_pointer_cast<SignTileEntity>(tileEntity));
} else if (tileEntity->GetType() == eTYPE_COMMANDBLOCKTILEENTITY) {
success = GameServices::menus().openCommandBlock(
success = gameServices().menus().openCommandBlock(
GetXboxPad(),
std::dynamic_pointer_cast<CommandBlockEntity>(tileEntity));
}
@@ -610,7 +610,7 @@ bool LocalPlayer::openContainer(std::shared_ptr<Container> container) {
minecraft->setScreen(new ContainerScreen(inventory, container));
bool success = true;
#else
bool success = GameServices::menus().openContainer(GetXboxPad(), inventory, container);
bool success = gameServices().menus().openContainer(GetXboxPad(), inventory, container);
if (success) ui.PlayUISFX(eSFX_Press);
#endif
// minecraft->setScreen(new ContainerScreen(inventory, container));
@@ -622,7 +622,7 @@ bool LocalPlayer::openHopper(std::shared_ptr<HopperTileEntity> container) {
minecraft->setScreen(new HopperScreen(inventory, container));
bool success = true;
#else
bool success = GameServices::menus().openHopper(GetXboxPad(), inventory, container);
bool success = gameServices().menus().openHopper(GetXboxPad(), inventory, container);
if (success) ui.PlayUISFX(eSFX_Press);
#endif
return success;
@@ -633,7 +633,7 @@ bool LocalPlayer::openHopper(std::shared_ptr<MinecartHopper> container) {
minecraft->setScreen(new HopperScreen(inventory, container));
bool success = true;
#else
bool success = GameServices::menus().openHopperMinecart(GetXboxPad(), inventory, container);
bool success = gameServices().menus().openHopperMinecart(GetXboxPad(), inventory, container);
if (success) ui.PlayUISFX(eSFX_Press);
#endif
return success;
@@ -645,7 +645,7 @@ bool LocalPlayer::openHorseInventory(std::shared_ptr<EntityHorse> horse,
minecraft->setScreen(new HorseInventoryScreen(inventory, container, horse));
bool success = true;
#else
bool success = GameServices::menus().openHorse(GetXboxPad(), inventory, container, horse);
bool success = gameServices().menus().openHorse(GetXboxPad(), inventory, container, horse);
if (success) ui.PlayUISFX(eSFX_Press);
#endif
return success;
@@ -656,7 +656,7 @@ bool LocalPlayer::startCrafting(int x, int y, int z) {
minecraft->setScreen(new CraftingScreen(inventory, level, x, y, z));
bool success = true;
#else
bool success = GameServices::menus().openCrafting3x3(
bool success = gameServices().menus().openCrafting3x3(
GetXboxPad(),
std::dynamic_pointer_cast<LocalPlayer>(shared_from_this()), x, y, z);
if (success) ui.PlayUISFX(eSFX_Press);
@@ -667,7 +667,7 @@ bool LocalPlayer::startCrafting(int x, int y, int z) {
}
bool LocalPlayer::openFireworks(int x, int y, int z) {
bool success = GameServices::menus().openFireworks(
bool success = gameServices().menus().openFireworks(
GetXboxPad(),
std::dynamic_pointer_cast<LocalPlayer>(shared_from_this()), x, y, z);
if (success) ui.PlayUISFX(eSFX_Press);
@@ -681,7 +681,7 @@ bool LocalPlayer::startEnchanting(int x, int y, int z,
bool success = true;
#else
bool success =
GameServices::menus().openEnchanting(GetXboxPad(), inventory, x, y, z, level, name);
gameServices().menus().openEnchanting(GetXboxPad(), inventory, x, y, z, level, name);
if (success) ui.PlayUISFX(eSFX_Press);
#endif
return success;
@@ -693,7 +693,7 @@ bool LocalPlayer::startRepairing(int x, int y, int z) {
bool success = true;
#else
bool success =
GameServices::menus().openRepairing(GetXboxPad(), inventory, level, x, y, z);
gameServices().menus().openRepairing(GetXboxPad(), inventory, level, x, y, z);
if (success) ui.PlayUISFX(eSFX_Press);
#endif
return success;
@@ -704,7 +704,7 @@ bool LocalPlayer::openFurnace(std::shared_ptr<FurnaceTileEntity> furnace) {
minecraft->setScreen(new FurnaceScreen(inventory, furnace));
bool success = true;
#else
bool success = GameServices::menus().openFurnace(GetXboxPad(), inventory, furnace);
bool success = gameServices().menus().openFurnace(GetXboxPad(), inventory, furnace);
if (success) ui.PlayUISFX(eSFX_Press);
#endif
return success;
@@ -717,7 +717,7 @@ bool LocalPlayer::openBrewingStand(
bool success = true;
#else
bool success =
GameServices::menus().openBrewingStand(GetXboxPad(), inventory, brewingStand);
gameServices().menus().openBrewingStand(GetXboxPad(), inventory, brewingStand);
if (success) ui.PlayUISFX(eSFX_Press);
#endif
return success;
@@ -728,7 +728,7 @@ bool LocalPlayer::openBeacon(std::shared_ptr<BeaconTileEntity> beacon) {
minecraft->setScreen(new BeaconScreen(inventory, beacon));
bool success = true;
#else
bool success = GameServices::menus().openBeacon(GetXboxPad(), inventory, beacon);
bool success = gameServices().menus().openBeacon(GetXboxPad(), inventory, beacon);
if (success) ui.PlayUISFX(eSFX_Press);
#endif
return success;
@@ -739,7 +739,7 @@ bool LocalPlayer::openTrap(std::shared_ptr<DispenserTileEntity> trap) {
minecraft->setScreen(new TrapScreen(inventory, trap));
bool success = true;
#else
bool success = GameServices::menus().openTrap(GetXboxPad(), inventory, trap);
bool success = gameServices().menus().openTrap(GetXboxPad(), inventory, trap);
if (success) ui.PlayUISFX(eSFX_Press);
#endif
return success;
@@ -752,7 +752,7 @@ bool LocalPlayer::openTrading(std::shared_ptr<Merchant> traderTarget,
bool success = true;
#else
bool success =
GameServices::menus().openTrading(GetXboxPad(), inventory, traderTarget, level, name);
gameServices().menus().openTrading(GetXboxPad(), inventory, traderTarget, level, name);
if (success) ui.PlayUISFX(eSFX_Press);
#endif
return success;
@@ -826,7 +826,7 @@ void LocalPlayer::displayClientMessage(int messageId) {
void LocalPlayer::awardStat(Stat* stat, const std::vector<uint8_t>& param) {
int count = CommonStats::readParam(param);
if (!GameServices::canRecordStatsAndAchievements()) return;
if (!gameServices().canRecordStatsAndAchievements()) return;
if (stat == nullptr) return;
if (stat->isAchievement()) {
@@ -1576,39 +1576,39 @@ void LocalPlayer::updateRichPresence() {
std::shared_ptr<ItemInstance> selectedItem = inventory->getSelected();
if (selectedItem != nullptr &&
selectedItem->id == Item::fishingRod_Id) {
GameServices::setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_FISHING);
gameServices().setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_FISHING);
} else if (selectedItem != nullptr &&
selectedItem->id == Item::map_Id) {
GameServices::setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_MAP);
gameServices().setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_MAP);
} else if ((riding != nullptr) && riding->instanceof(eTYPE_MINECART)) {
GameServices::setRichPresenceContext(m_iPad,
gameServices().setRichPresenceContext(m_iPad,
CONTEXT_GAME_STATE_RIDING_MINECART);
} else if ((riding != nullptr) && riding->instanceof(eTYPE_BOAT)) {
GameServices::setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_BOATING);
gameServices().setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_BOATING);
} else if ((riding != nullptr) && riding->instanceof(eTYPE_PIG)) {
GameServices::setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_RIDING_PIG);
gameServices().setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_RIDING_PIG);
} else if (this->dimension == -1) {
GameServices::setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_NETHER);
gameServices().setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_NETHER);
} else if (minecraft->soundEngine->GetIsPlayingStreamingCDMusic()) {
GameServices::setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_CD);
gameServices().setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_CD);
} else {
GameServices::setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_BLANK);
gameServices().setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_BLANK);
}
}
}
// 4J Stu - Added for telemetry
void LocalPlayer::SetSessionTimerStart(void) {
m_sessionTimeStart = GameServices::getAppTime();
m_sessionTimeStart = gameServices().getAppTime();
m_dimensionTimeStart = m_sessionTimeStart;
}
float LocalPlayer::getSessionTimer(void) {
return GameServices::getAppTime() - m_sessionTimeStart;
return gameServices().getAppTime() - m_sessionTimeStart;
}
float LocalPlayer::getAndResetChangeDimensionTimer() {
float appTime = GameServices::getAppTime();
float appTime = gameServices().getAppTime();
float returnVal = appTime - m_dimensionTimeStart;
m_dimensionTimeStart = appTime;
return returnVal;
@@ -1,4 +1,4 @@
#include "minecraft/GameServices.h"
#include "minecraft/IGameServices.h"
#include "minecraft/util/Log.h"
#include "GameRenderer.h"
@@ -15,7 +15,7 @@
#include "Chunk.h"
#include "ItemInHandRenderer.h"
#include "LevelRenderer.h"
#include "app/common/App_enums.h"
#include "minecraft/GameEnums.h"
#include "platform/ShutdownManager.h"
#include "app/common/Colours/ColourTable.h"
#include "app/linux/LinuxGame.h"
@@ -665,7 +665,7 @@ void GameRenderer::setupCamera(float a, int eye) {
bool bNoBobbingAnim = (mc->player->getAnimOverrideBitmask() &
(1 << HumanoidModel::eAnim_NoBobbing)) != 0;
if (GameServices::getGameSettings(mc->player->GetXboxPad(), eGameSetting_ViewBob) &&
if (gameServices().getGameSettings(mc->player->GetXboxPad(), eGameSetting_ViewBob) &&
!mc->player->abilities.flying && !bNoLegAnim && !bNoBobbingAnim)
bobView(a);
@@ -719,7 +719,7 @@ void GameRenderer::renderItemInHand(float a, int eye) {
std::shared_ptr<ItemInstance> item =
localplayer->inventory->getSelected();
if (!(item && item->getItem()->id == Item::map_Id) &&
GameServices::getGameSettings(localplayer->GetXboxPad(),
gameServices().getGameSettings(localplayer->GetXboxPad(),
eGameSetting_DisplayHand) == 0)
renderHand = false;
}
@@ -760,7 +760,7 @@ void GameRenderer::renderItemInHand(float a, int eye) {
bool bNoLegAnim = (localplayer->getAnimOverrideBitmask() &
((1 << HumanoidModel::eAnim_NoLegAnim) |
(1 << HumanoidModel::eAnim_NoBobbing))) != 0;
if (GameServices::getGameSettings(localplayer->GetXboxPad(), eGameSetting_ViewBob) &&
if (gameServices().getGameSettings(localplayer->GetXboxPad(), eGameSetting_ViewBob) &&
!localplayer->abilities.flying && !bNoLegAnim)
bobView(a);
@@ -792,7 +792,7 @@ void GameRenderer::renderItemInHand(float a, int eye) {
// 4J-PB - changing this to be per player
// if (mc->options->bobView) bobView(a);
if (GameServices::getGameSettings(localplayer->GetXboxPad(), eGameSetting_ViewBob) &&
if (gameServices().getGameSettings(localplayer->GetXboxPad(), eGameSetting_ViewBob) &&
!localplayer->abilities.flying && !bNoLegAnim)
bobView(a);
}
@@ -1,4 +1,4 @@
#include "minecraft/GameServices.h"
#include "minecraft/IGameServices.h"
#include "minecraft/util/Log.h"
#include "ItemInHandRenderer.h"
@@ -9,7 +9,7 @@
#include <vector>
#include "platform/sdl2/Render.h"
#include "app/common/App_enums.h"
#include "minecraft/GameEnums.h"
#include "app/common/Colours/ColourTable.h"
#include "app/linux/LinuxGame.h"
#include "Tesselator.h"
@@ -549,7 +549,7 @@ void ItemInHandRenderer::render(float a) {
player->inventory->getSelected();
if ((itemInstance &&
(itemInstance->getItem()->id == Item::map_Id)) ||
GameServices::getGameSettings(localPlayer->GetXboxPad(),
gameServices().getGameSettings(localPlayer->GetXboxPad(),
eGameSetting_DisplayHand) != 0) {
playerRenderer->renderHand();
}
@@ -766,7 +766,7 @@ void ItemInHandRenderer::render(float a) {
player->inventory->getSelected();
if ((itemInstance && (itemInstance->getItem()->id == Item::map_Id)) ||
GameServices::getGameSettings(localPlayer->GetXboxPad(),
gameServices().getGameSettings(localPlayer->GetXboxPad(),
eGameSetting_DisplayHand) != 0) {
playerRenderer->renderHand();
}
@@ -1,5 +1,4 @@
#include "minecraft/GameServices.h"
#include "minecraft/util/DebugSettings.h"
#include "minecraft/IGameServices.h"
#include "minecraft/util/Log.h"
#include "LevelRenderer.h"
@@ -21,7 +20,7 @@
#include "platform/sdl2/Render.h"
#include "Chunk.h"
#include "GameRenderer.h"
#include "app/common/App_enums.h"
#include "minecraft/GameEnums.h"
#include "app/common/Audio/SoundEngine.h"
#include "app/common/Colours/ColourTable.h"
#include "app/common/Console_Debug_enum.h"
@@ -448,8 +447,8 @@ void LevelRenderer::setLevel(int playerIndex, MultiPlayerLevel* level) {
}
void LevelRenderer::AddDLCSkinsToMemTextures() {
for (int i = 0; i < GameServices::getSkinNames().size(); i++) {
textures->addMemTexture(GameServices::getSkinNames()[i],
for (int i = 0; i < gameServices().getSkinNames().size(); i++) {
textures->addMemTexture(gameServices().getSkinNames()[i],
new MobSkinMemTextureProcessor());
}
}
@@ -1165,7 +1164,7 @@ void LevelRenderer::renderClouds(float alpha) {
int playerIndex = mc->player->GetXboxPad();
// if the primary player has clouds off, so do all players on this machine
if (GameServices::getGameSettings(InputManager.GetPrimaryPad(),
if (gameServices().getGameSettings(InputManager.GetPrimaryPad(),
eGameSetting_Clouds) == 0) {
return;
}
@@ -1178,8 +1177,8 @@ void LevelRenderer::renderClouds(float alpha) {
return;
}
if (DebugSettings::isOn()) {
if (DebugSettings::getMask(InputManager.GetPrimaryPad()) &
if (gameServices().debugSettingsOn()) {
if (gameServices().debugGetMask(InputManager.GetPrimaryPad()) &
(1L << eDebugSetting_FreezeTime)) {
iTicks = m_freezeticks;
}
@@ -1256,8 +1255,8 @@ void LevelRenderer::renderClouds(float alpha) {
glDisable(GL_BLEND);
glEnable(GL_CULL_FACE);
if (DebugSettings::isOn()) {
if (!(DebugSettings::getMask(InputManager.GetPrimaryPad()) &
if (gameServices().debugSettingsOn()) {
if (!(gameServices().debugGetMask(InputManager.GetPrimaryPad()) &
(1L << eDebugSetting_FreezeTime))) {
m_freezeticks = iTicks;
}
@@ -1442,8 +1441,8 @@ void LevelRenderer::renderAdvancedClouds(float alpha) {
int iTicks = ticks;
if (DebugSettings::isOn()) {
if (DebugSettings::getMask(InputManager.GetPrimaryPad()) &
if (gameServices().debugSettingsOn()) {
if (gameServices().debugGetMask(InputManager.GetPrimaryPad()) &
(1L << eDebugSetting_FreezeTime)) {
iTicks = m_freezeticks;
}
@@ -1689,8 +1688,8 @@ void LevelRenderer::renderAdvancedClouds(float alpha) {
glDisable(GL_BLEND);
glEnable(GL_CULL_FACE);
if (DebugSettings::isOn()) {
if (!(DebugSettings::getMask(InputManager.GetPrimaryPad()) &
if (gameServices().debugSettingsOn()) {
if (!(gameServices().debugGetMask(InputManager.GetPrimaryPad()) &
(1L << eDebugSetting_FreezeTime))) {
m_freezeticks = iTicks;
}
@@ -2221,7 +2220,7 @@ void LevelRenderer::renderHitOutline(std::shared_ptr<Player> player,
const float ss = 0.002f;
// 4J-PB - If Display HUD is false, don't render the hit outline
if (GameServices::getGameSettings(iPad, eGameSetting_DisplayHUD) == 0) return;
if (gameServices().getGameSettings(iPad, eGameSetting_DisplayHUD) == 0) return;
RenderManager.StateSetLightingEnable(false);
glDisable(GL_TEXTURE_2D);
@@ -1,6 +1,6 @@
#pragma once
#include "platform/NetTypes.h"
#include "minecraft/client/SkinBox.h"
#include "minecraft/client/model/SkinBox.h"
#include "OffsettedRenderList.h"
#include "platform/C4JThread.h"
#include "util/Definitions.h"
@@ -1,4 +1,4 @@
#include "minecraft/GameServices.h"
#include "minecraft/IGameServices.h"
#include "Textures.h"
#include <assert.h>
@@ -1004,7 +1004,7 @@ int Textures::loadMemTexture(const std::wstring& url,
if (it != memTextures.end()) {
texture = (*it).second;
}
if (texture == nullptr && GameServices::isFileInMemoryTextures(url)) {
if (texture == nullptr && gameServices().isFileInMemoryTextures(url)) {
// If we haven't loaded it yet, but we have the data for it then add it
texture = addMemTexture(url, new MobSkinMemTextureProcessor());
}
@@ -1041,7 +1041,7 @@ int Textures::loadMemTexture(const std::wstring& url, int backup) {
if (it != memTextures.end()) {
texture = (*it).second;
}
if (texture == nullptr && GameServices::isFileInMemoryTextures(url)) {
if (texture == nullptr && gameServices().isFileInMemoryTextures(url)) {
// If we haven't loaded it yet, but we have the data for it then add it
texture = addMemTexture(url, new MobSkinMemTextureProcessor());
}
@@ -1082,7 +1082,7 @@ MemTexture* Textures::addMemTexture(const std::wstring& name,
// can we find it in the app mem files?
std::uint8_t* pbData = nullptr;
unsigned int dwBytes = 0;
GameServices::getMemFileDetails(name, &pbData, &dwBytes);
gameServices().getMemFileDetails(name, &pbData, &dwBytes);
if (dwBytes != 0) {
texture = new MemTexture(name, pbData, dwBytes, processor);
@@ -12,7 +12,7 @@
#include "platform/sdl2/Render.h"
#include "EntityTileRenderer.h"
#include "GameRenderer.h"
#include "app/common/App_enums.h"
#include "minecraft/GameEnums.h"
#include "app/common/Colours/ColourTable.h"
#include "util/FrameProfiler.h"
#include "Tesselator.h"
@@ -1,5 +1,4 @@
#include "minecraft/GameServices.h"
#include "minecraft/GameHostOptions.h"
#include "minecraft/IGameServices.h"
#include "LivingEntityRenderer.h"
#include <cmath>
@@ -8,7 +7,7 @@
#include "platform/sdl2/Render.h"
#include "EntityRenderDispatcher.h"
#include "app/common/App_enums.h"
#include "minecraft/GameEnums.h"
#include "app/linux/LinuxGame.h"
#include "java/Class.h"
@@ -390,12 +389,12 @@ void LivingEntityRenderer::renderName(std::shared_ptr<LivingEntity> mob,
if (!msg.empty()) {
if (mob->isSneaking()) {
if (GameServices::getGameSettings(eGameSetting_DisplayHUD) == 0) {
if (gameServices().getGameSettings(eGameSetting_DisplayHUD) == 0) {
// 4J-PB - turn off gamertag render
return;
}
if (GameHostOptions::get(eGameHostOption_Gamertags) == 0) {
if (gameServices().getGameHostOption(eGameHostOption_Gamertags) == 0) {
// turn off gamertags if the host has set them off
return;
}
@@ -465,12 +464,12 @@ void LivingEntityRenderer::renderNameTag(std::shared_ptr<LivingEntity> mob,
const std::wstring& name, double x,
double y, double z, int maxDist,
int color /*= 0xff000000*/) {
if (GameServices::getGameSettings(eGameSetting_DisplayHUD) == 0) {
if (gameServices().getGameSettings(eGameSetting_DisplayHUD) == 0) {
// 4J-PB - turn off gamertag render
return;
}
if (GameHostOptions::get(eGameHostOption_Gamertags) == 0) {
if (gameServices().getGameHostOption(eGameHostOption_Gamertags) == 0) {
// turn off gamertags if the host has set them off
return;
}
@@ -501,7 +500,7 @@ void LivingEntityRenderer::renderNameTag(std::shared_ptr<LivingEntity> mob,
int readableDist = PLAYER_NAME_READABLE_FULLSCREEN;
if (!RenderManager.IsHiDef()) {
readableDist = PLAYER_NAME_READABLE_DISTANCE_SD;
} else if (GameServices::getLocalPlayerCount() > 2) {
} else if (gameServices().getLocalPlayerCount() > 2) {
readableDist = PLAYER_NAME_READABLE_DISTANCE_SPLITSCREEN;
}
@@ -529,7 +528,7 @@ void LivingEntityRenderer::renderNameTag(std::shared_ptr<LivingEntity> mob,
if (mob->instanceof(eTYPE_PLAYER)) {
std::shared_ptr<Player> player = std::dynamic_pointer_cast<Player>(mob);
if (GameServices::isXuidDeadmau5(player->getXuid())) offs = -10;
if (gameServices().isXuidDeadmau5(player->getXuid())) offs = -10;
playerName = name;
} else {
@@ -7,7 +7,7 @@
#include "platform/sdl2/Render.h"
#include "EntityRenderDispatcher.h"
#include "LivingEntityRenderer.h"
#include "app/common/App_enums.h"
#include "minecraft/GameEnums.h"
#include "app/common/Colours/ColourTable.h"
#include "java/Class.h"
@@ -1,5 +1,4 @@
#include "minecraft/GameServices.h"
#include "minecraft/GameHostOptions.h"
#include "minecraft/IGameServices.h"
#include "PlayerRenderer.h"
#include <cmath>
@@ -9,7 +8,7 @@
#include "platform/sdl2/Render.h"
#include "EntityRenderDispatcher.h"
#include "HumanoidMobRenderer.h"
#include "app/common/App_enums.h"
#include "minecraft/GameEnums.h"
#include "app/linux/LinuxGame.h"
#include "java/Class.h"
#include "minecraft/Facing.h"
@@ -303,7 +302,7 @@ void PlayerRenderer::additionalRendering(std::shared_ptr<LivingEntity> _mob,
}
// need to add a custom texture for deadmau5
if (mob != nullptr && GameServices::isXuidDeadmau5(mob->getXuid()) &&
if (mob != nullptr && gameServices().isXuidDeadmau5(mob->getXuid()) &&
bindTexture(mob->customTextureUrl, L"")) {
for (int i = 0; i < 2; i++) {
float yr = (mob->yRotO + (mob->yRot - mob->yRotO) * a) -
@@ -524,7 +523,7 @@ void PlayerRenderer::setupRotations(std::shared_ptr<LivingEntity> _mob,
// 4J Added override to stop rendering shadow if player is invisible
void PlayerRenderer::renderShadow(std::shared_ptr<Entity> e, double x, double y,
double z, float pow, float a) {
if (GameHostOptions::get(eGameHostOption_HostCanBeInvisible) > 0) {
if (gameServices().getGameHostOption(eGameHostOption_HostCanBeInvisible) > 0) {
std::shared_ptr<Player> player = std::dynamic_pointer_cast<Player>(e);
if (player != nullptr && player->hasInvisiblePrivilege()) return;
}
@@ -3,7 +3,7 @@
#include <string>
#include "platform/NetTypes.h"
#include "minecraft/client/SkinBox.h"
#include "minecraft/client/model/SkinBox.h"
#include "MobRenderer.h"
#include "minecraft/client/renderer/entity/LivingEntityRenderer.h"
#include "minecraft/world/entity/player/Player.h"
@@ -1,4 +1,4 @@
#include "minecraft/locale/Strings.h"
#include "minecraft/IGameServices.h"
#include "SignRenderer.h"
#include <cstdint>
@@ -6,7 +6,7 @@
#include <string>
#include "platform/sdl2/Render.h"
#include "app/common/App_enums.h"
#include "minecraft/GameEnums.h"
#include "app/common/Colours/ColourTable.h"
#include "app/linux/LinuxGame.h"
#include "platform/XboxStubs.h"
@@ -90,7 +90,7 @@ void SignRenderer::render(std::shared_ptr<TileEntity> _sign, double x, double y,
msg = L"Censored"; // In-game font, so English only
break;
default:
msg = Strings::get(IDS_STRINGVERIFY_CENSORED);
msg = gameServices().getString(IDS_STRINGVERIFY_CENSORED);
break;
}
} else {
@@ -105,7 +105,7 @@ void SignRenderer::render(std::shared_ptr<TileEntity> _sign, double x, double y,
L"Awaiting Approval"; // In-game font, so English only
break;
default:
msg = Strings::get(IDS_STRINGVERIFY_AWAITING_APPROVAL);
msg = gameServices().getString(IDS_STRINGVERIFY_AWAITING_APPROVAL);
break;
}
}
@@ -7,7 +7,7 @@
#include <vector>
#include "app/common/Colours/ColourTable.h"
#include "minecraft/GameServices.h"
#include "minecraft/IGameServices.h"
#include "app/linux/Linux_UIController.h"
#include "app/linux/Stubs/winapi_stubs.h"
#include "minecraft/client/BufferedImage.h"
@@ -194,14 +194,14 @@ void AbstractTexturePack::loadDefaultColourTable() {
} else {
Log::info("Failed to load the default colours table\n");
GameServices::fatalLoadError();
gameServices().fatalLoadError();
}
}
void AbstractTexturePack::loadDefaultHTMLColourTable() {
if (GameServices::hasArchiveFile(L"HTMLColours.col")) {
if (gameServices().hasArchiveFile(L"HTMLColours.col")) {
std::vector<uint8_t> textColours =
GameServices::getArchiveFile(L"HTMLColours.col");
gameServices().getArchiveFile(L"HTMLColours.col");
m_colourTable->loadColoursFromData(textColours.data(),
textColours.size());
}
@@ -1,4 +1,4 @@
#include "minecraft/GameServices.h"
#include "minecraft/IGameServices.h"
#include "minecraft/util/Log.h"
#include "DLCTexturePack.h"
@@ -9,7 +9,7 @@
#include "platform/sdl2/Input.h"
#include "platform/sdl2/Storage.h"
#include "app/common/App_enums.h"
#include "minecraft/GameEnums.h"
#include "app/common/Audio/SoundEngine.h"
#include "app/common/Colours/ColourTable.h"
#include "app/common/DLC/DLCAudioFile.h"
@@ -79,8 +79,8 @@ DLCTexturePack::DLCTexturePack(std::uint32_t id, DLCPack* pack,
m_bLoadingData = false;
m_bHasLoadedData = false;
m_archiveFile = nullptr;
if (GameServices::getLevelGenerationOptions())
GameServices::getLevelGenerationOptions()->setLoadedData();
if (gameServices().getLevelGenerationOptions())
gameServices().getLevelGenerationOptions()->setLoadedData();
m_bUsingDefaultColourTable = true;
m_stringTable = nullptr;
@@ -226,9 +226,9 @@ void DLCTexturePack::loadColourTable() {
}
// Load the text colours
if (GameServices::hasArchiveFile(L"HTMLColours.col")) {
if (gameServices().hasArchiveFile(L"HTMLColours.col")) {
std::vector<uint8_t> textColours =
GameServices::getArchiveFile(L"HTMLColours.col");
gameServices().getArchiveFile(L"HTMLColours.col");
m_colourTable->loadColoursFromData(textColours.data(),
textColours.size());
}
@@ -246,8 +246,8 @@ void DLCTexturePack::loadData() {
"TPACK") != ERROR_IO_PENDING) {
// corrupt DLC
m_bHasLoadedData = true;
if (GameServices::getLevelGenerationOptions())
GameServices::getLevelGenerationOptions()->setLoadedData();
if (gameServices().getLevelGenerationOptions())
gameServices().getLevelGenerationOptions()->setLoadedData();
Log::info("Failed to mount texture pack DLC %d for pad %d\n",
mountIndex, InputManager.GetPrimaryPad());
} else {
@@ -257,9 +257,9 @@ void DLCTexturePack::loadData() {
}
} else {
m_bHasLoadedData = true;
if (GameServices::getLevelGenerationOptions())
GameServices::getLevelGenerationOptions()->setLoadedData();
GameServices::setAction(InputManager.GetPrimaryPad(),
if (gameServices().getLevelGenerationOptions())
gameServices().getLevelGenerationOptions()->setLoadedData();
gameServices().setAction(InputManager.GetPrimaryPad(),
eAppAction_ReloadTexturePack);
}
}
@@ -267,7 +267,7 @@ void DLCTexturePack::loadData() {
std::wstring DLCTexturePack::getFilePath(std::uint32_t packId,
std::wstring filename,
bool bAddDataFolder) {
return GameServices::getFilePath(packId, filename, bAddDataFolder);
return gameServices().getFilePath(packId, filename, bAddDataFolder);
}
int DLCTexturePack::onPackMounted(int iPad, std::uint32_t dwErr,
@@ -288,7 +288,7 @@ int DLCTexturePack::onPackMounted(int iPad, std::uint32_t dwErr,
std::wstring dataFilePath =
texturePack->m_dlcInfoPack->getFullDataPath();
if (!dataFilePath.empty()) {
if (!GameServices::getDLCManager().readDLCDataFile(
if (!gameServices().dlcReadDataFile(
dwFilesProcessed,
getFilePath(texturePack->m_dlcInfoPack->GetPackID(),
dataFilePath),
@@ -311,7 +311,7 @@ int DLCTexturePack::onPackMounted(int iPad, std::uint32_t dwErr,
*/
DLCPack* pack = texturePack->m_dlcInfoPack->GetParentPack();
LevelGenerationOptions* levelGen =
GameServices::getLevelGenerationOptions();
gameServices().getLevelGenerationOptions();
if (levelGen != nullptr && !levelGen->hasLoadedData()) {
int gameRulesCount = pack->getDLCItemsCount(
DLCManager::e_DLCType_GameRulesHeader);
@@ -338,10 +338,10 @@ int DLCTexturePack::onPackMounted(int iPad, std::uint32_t dwErr,
delete[] pbData;
GameServices::getGameRules().setLevelGenerationOptions(
gameServices().setLevelGenerationOptions(
dlcFile->lgo);
} else {
GameServices::fatalLoadError();
gameServices().fatalLoadError();
}
}
}
@@ -359,7 +359,7 @@ int DLCTexturePack::onPackMounted(int iPad, std::uint32_t dwErr,
// after a read fail and it's not an error?
levelGen->setBaseSaveData(pbData, fileSize);
} else {
GameServices::fatalLoadError();
gameServices().fatalLoadError();
}
}
}
@@ -402,9 +402,9 @@ int DLCTexturePack::onPackMounted(int iPad, std::uint32_t dwErr,
}
texturePack->m_bHasLoadedData = true;
if (GameServices::getLevelGenerationOptions())
GameServices::getLevelGenerationOptions()->setLoadedData();
GameServices::setAction(InputManager.GetPrimaryPad(), eAppAction_ReloadTexturePack);
if (gameServices().getLevelGenerationOptions())
gameServices().getLevelGenerationOptions()->setLoadedData();
gameServices().setAction(InputManager.GetPrimaryPad(), eAppAction_ReloadTexturePack);
return 0;
}
@@ -431,7 +431,7 @@ void DLCTexturePack::unloadUI() {
}
AbstractTexturePack::unloadUI();
GameServices::getDLCManager().removePack(m_dlcDataPack);
gameServices().dlcRemovePack(m_dlcDataPack);
m_dlcDataPack = nullptr;
delete m_archiveFile;
m_bHasLoadedData = false;
@@ -1,4 +1,4 @@
#include "minecraft/GameServices.h"
#include "minecraft/IGameServices.h"
#include "DefaultTexturePack.h"
@@ -18,9 +18,9 @@ DefaultTexturePack::DefaultTexturePack()
}
void DefaultTexturePack::loadIcon() {
if (GameServices::hasArchiveFile(L"Graphics\\TexturePackIcon.png")) {
if (gameServices().hasArchiveFile(L"Graphics\\TexturePackIcon.png")) {
std::vector<uint8_t> ba =
GameServices::getArchiveFile(L"Graphics\\TexturePackIcon.png");
gameServices().getArchiveFile(L"Graphics\\TexturePackIcon.png");
m_iconData = ba.data();
m_iconSize = static_cast<std::uint32_t>(ba.size());
}
@@ -3,7 +3,7 @@
#include "AbstractTexturePack.h"
#include "java/InputOutputStream/InputStream.h"
#include "minecraft/locale/Strings.h"
#include "minecraft/IGameServices.h"
#include "strings.h"
class DefaultTexturePack : public AbstractTexturePack {
@@ -22,7 +22,7 @@ public:
bool hasFile(const std::wstring& name);
bool isTerrainUpdateCompatible();
std::wstring getDesc1() { return Strings::get(IDS_DEFAULT_TEXTUREPACK); }
std::wstring getDesc1() { return gameServices().getString(IDS_DEFAULT_TEXTUREPACK); }
protected:
//@Override
+1 -1
View File
@@ -3,7 +3,7 @@
#include <cstdint>
#include <string>
#include "app/common/App_enums.h"
#include "minecraft/GameEnums.h"
class InputStream;
class Minecraft;
@@ -1,4 +1,4 @@
#include "minecraft/GameServices.h"
#include "minecraft/IGameServices.h"
#include "minecraft/util/Log.h"
#include "TexturePackRepository.h"
@@ -10,7 +10,7 @@
#include "platform/sdl2/Input.h"
#include "DLCTexturePack.h"
#include "DefaultTexturePack.h"
#include "app/common/App_enums.h"
#include "minecraft/GameEnums.h"
#include "app/common/DLC/DLCManager.h"
#include "app/common/DLC/DLCPack.h"
#include "app/linux/LinuxGame.h"
@@ -142,7 +142,7 @@ bool TexturePackRepository::selectTexturePackById(std::uint32_t id) {
// invite games
// (where they don't have the texture pack) can check this when the texture
// pack is installed
GameServices::setRequiredTexturePackID(id);
gameServices().setRequiredTexturePackID(id);
auto it = cacheById.find(id);
if (it != cacheById.end()) {
@@ -151,7 +151,7 @@ bool TexturePackRepository::selectTexturePackById(std::uint32_t id) {
selectSkin(newPack);
if (newPack->hasData()) {
GameServices::setAction(InputManager.GetPrimaryPad(),
gameServices().setAction(InputManager.GetPrimaryPad(),
eAppAction_ReloadTexturePack);
} else {
newPack->loadData();
@@ -167,7 +167,7 @@ bool TexturePackRepository::selectTexturePackById(std::uint32_t id) {
"Failed to select texture pack %d as it is not in the list\n", id);
// Fail safely
if (selectSkin(DEFAULT_TEXTURE_PACK)) {
GameServices::setAction(InputManager.GetPrimaryPad(),
gameServices().setAction(InputManager.GetPrimaryPad(),
eAppAction_ReloadTexturePack);
}
}
@@ -1,4 +1,4 @@
#include "minecraft/GameServices.h"
#include "minecraft/IGameServices.h"
#include "minecraft/util/Log.h"
#include "TitleScreen.h"
@@ -43,8 +43,8 @@ TitleScreen::TitleScreen() {
int splashIndex;
std::wstring filename = L"splashes.txt";
if (GameServices::hasArchiveFile(filename)) {
std::vector<uint8_t> splashesArray = GameServices::getArchiveFile(filename);
if (gameServices().hasArchiveFile(filename)) {
std::vector<uint8_t> splashesArray = gameServices().getArchiveFile(filename);
ByteArrayInputStream bais(splashesArray);
InputStreamReader isr(&bais);
BufferedReader br(&isr);
@@ -1,10 +1,10 @@
#include "minecraft/GameHostOptions.h"
#include "minecraft/IGameServices.h"
#include "ItemDispenseBehaviors.h"
#include <memory>
#include <string>
#include "app/common/App_enums.h"
#include "minecraft/GameEnums.h"
#include "app/linux/LinuxGame.h"
#include "java/Class.h"
#include "java/Random.h"
@@ -449,7 +449,7 @@ std::shared_ptr<ItemInstance> TntDispenseBehavior::execute(
Level* world = source->getWorld();
if (world->newPrimedTntAllowed() &&
GameHostOptions::get(eGameHostOption_TNT)) {
gameServices().getGameHostOption(eGameHostOption_TNT)) {
int targetX = source->getBlockX() + facing->getStepX();
int targetY = source->getBlockY() + facing->getStepY();
int targetZ = source->getBlockZ() + facing->getStepZ();
-16
View File
@@ -1,16 +0,0 @@
#include "minecraft/locale/Strings.h"
#include <cassert>
namespace Strings {
static LookupFn s_lookup = nullptr;
void init(LookupFn fn) { s_lookup = fn; }
const wchar_t* get(int id) {
assert(s_lookup && "Strings::init() must be called before Strings::get()");
return s_lookup(id);
}
} // namespace Strings
-12
View File
@@ -1,12 +0,0 @@
#pragma once
#include <cstdint>
namespace Strings {
using LookupFn = const wchar_t* (*)(int);
void init(LookupFn fn);
[[nodiscard]] const wchar_t* get(int id);
} // namespace Strings
@@ -1,3 +1,4 @@
#include "minecraft/IGameServices.h"
#include "minecraft/util/Log.h"
#include "PreLoginPacket.h"
@@ -6,7 +7,6 @@
#include "app/common/BuildVer/BuildVer.h"
#include "platform/IPlatformNetwork.h"
#include "app/linux/LinuxGame.h"
#include "app/linux/Stubs/winapi_stubs.h"
#include "PacketListener.h"
#include "java/InputOutputStream/DataInputStream.h"
@@ -83,7 +83,7 @@ void PreLoginPacket::read(DataInputStream* dis) // throws IOException
m_texturePackId = static_cast<std::uint32_t>(dis->readInt());
// Set the name of the map so we can check it for players banned lists
app.SetUniqueMapName((char*)m_szUniqueSaveName);
gameServices().setUniqueMapName((char*)m_szUniqueSaveName);
}
void PreLoginPacket::write(DataOutputStream* dos) // throws IOException
@@ -5,7 +5,7 @@
#include <string>
#include <vector>
#include "minecraft/client/SkinBox.h"
#include "minecraft/client/model/SkinBox.h"
#include "Packet.h"
#include "minecraft/client/model/geom/Model.h"
#include "minecraft/network/packet/Packet.h"
+47 -49
View File
@@ -1,6 +1,4 @@
#include "minecraft/GameServices.h"
#include "minecraft/util/DebugSettings.h"
#include "minecraft/GameHostOptions.h"
#include "minecraft/IGameServices.h"
#include "minecraft/util/Log.h"
#include "MinecraftServer.h"
@@ -19,7 +17,7 @@
#include "platform/sdl2/Storage.h"
#include "ConsoleInput.h"
#include "DispenserBootstrap.h"
#include "app/common/App_enums.h"
#include "minecraft/GameEnums.h"
#include "app/common/GameRules/GameRuleManager.h"
#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h"
#include "app/common/Network/GameNetworkManager.h"
@@ -154,27 +152,27 @@ bool MinecraftServer::initServer(int64_t seed, NetworkGameInitData* initData,
Log::info("\n*** SERVER SETTINGS ***\n");
Log::info(
"ServerSettings: host-friends-only is %s\n",
(GameHostOptions::get(eGameHostOption_FriendsOfFriends) > 0) ? "on"
(gameServices().getGameHostOption(eGameHostOption_FriendsOfFriends) > 0) ? "on"
: "off");
Log::info("ServerSettings: game-type is %s\n",
(GameHostOptions::get(eGameHostOption_GameType) == 0)
(gameServices().getGameHostOption(eGameHostOption_GameType) == 0)
? "Survival Mode"
: "Creative Mode");
Log::info(
"ServerSettings: pvp is %s\n",
(GameHostOptions::get(eGameHostOption_PvP) > 0) ? "on" : "off");
(gameServices().getGameHostOption(eGameHostOption_PvP) > 0) ? "on" : "off");
Log::info("ServerSettings: fire spreads is %s\n",
(GameHostOptions::get(eGameHostOption_FireSpreads) > 0)
(gameServices().getGameHostOption(eGameHostOption_FireSpreads) > 0)
? "on"
: "off");
Log::info(
"ServerSettings: tnt explodes is %s\n",
(GameHostOptions::get(eGameHostOption_TNT) > 0) ? "on" : "off");
(gameServices().getGameHostOption(eGameHostOption_TNT) > 0) ? "on" : "off");
Log::info("\n");
// TODO 4J Stu - Init a load of settings based on data passed as params
// settings->setBooleanAndSave( L"host-friends-only",
// (GameHostOptions::get(eGameHostOption_FriendsOfFriends)>0) );
// (gameServices().getGameHostOption(eGameHostOption_FriendsOfFriends)>0) );
// 4J - Unused
// localIp = settings->getString(L"server-ip", L"");
@@ -184,7 +182,7 @@ bool MinecraftServer::initServer(int64_t seed, NetworkGameInitData* initData,
setAnimals(settings->getBoolean(L"spawn-animals", true));
setNpcsEnabled(settings->getBoolean(L"spawn-npcs", true));
setPvpAllowed(GameHostOptions::get(eGameHostOption_PvP) > 0
setPvpAllowed(gameServices().getGameHostOption(eGameHostOption_PvP) > 0
? true
: false); // settings->getBoolean(L"pvp", true);
@@ -204,12 +202,12 @@ bool MinecraftServer::initServer(int64_t seed, NetworkGameInitData* initData,
setPlayers(new PlayerList(this));
// 4J-JEV: Need to wait for levelGenerationOptions to load.
while (GameServices::getLevelGenerationOptions() != nullptr &&
!GameServices::getLevelGenerationOptions()->hasLoadedData())
while (gameServices().getLevelGenerationOptions() != nullptr &&
!gameServices().getLevelGenerationOptions()->hasLoadedData())
std::this_thread::sleep_for(std::chrono::milliseconds(1));
if (GameServices::getLevelGenerationOptions() != nullptr &&
!GameServices::getLevelGenerationOptions()->ready()) {
if (gameServices().getLevelGenerationOptions() != nullptr &&
!gameServices().getLevelGenerationOptions()->ready()) {
// TODO: Stop loading, add error message.
}
@@ -219,12 +217,12 @@ bool MinecraftServer::initServer(int64_t seed, NetworkGameInitData* initData,
std::wstring levelTypeString;
bool gameRuleUseFlatWorld = false;
if (GameServices::getLevelGenerationOptions() != nullptr) {
if (gameServices().getLevelGenerationOptions() != nullptr) {
gameRuleUseFlatWorld =
GameServices::getLevelGenerationOptions()->getuseFlatWorld();
gameServices().getLevelGenerationOptions()->getuseFlatWorld();
}
if (gameRuleUseFlatWorld ||
GameHostOptions::get(eGameHostOption_LevelType) > 0) {
gameServices().getGameHostOption(eGameHostOption_LevelType) > 0) {
levelTypeString = settings->getString(L"level-type", L"flat");
} else {
levelTypeString = settings->getString(L"level-type", L"default");
@@ -380,16 +378,16 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource,
int gameTypeId = settings->getInt(
L"gamemode",
GameHostOptions::get(
gameServices().getGameHostOption(
eGameHostOption_GameType)); // LevelSettings::GAMETYPE_SURVIVAL);
GameType* gameType = LevelSettings::validateGameType(gameTypeId);
Log::info("Default game type: %d\n", gameTypeId);
LevelSettings* levelSettings = new LevelSettings(
levelSeed, gameType,
GameHostOptions::get(eGameHostOption_Structures) > 0 ? true : false,
gameServices().getGameHostOption(eGameHostOption_Structures) > 0 ? true : false,
isHardcore(), true, pLevelType, initData->xzSize, initData->hellScale);
if (GameHostOptions::get(eGameHostOption_BonusChest))
if (gameServices().getGameHostOption(eGameHostOption_BonusChest))
levelSettings->enableStartingBonusItems();
// 4J - temp - load existing level
@@ -422,7 +420,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource,
// We are loading a save from the storage manager
#if defined(SPLIT_SAVES)
bool bLevelGenBaseSave = false;
LevelGenerationOptions* levelGen = GameServices::getLevelGenerationOptions();
LevelGenerationOptions* levelGen = gameServices().getLevelGenerationOptions();
if (levelGen != nullptr && levelGen->requiresBaseSave()) {
unsigned int fileSize = 0;
std::uint8_t* pvSaveData = levelGen->getBaseSaveData(fileSize);
@@ -461,9 +459,9 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource,
if (i == 0) {
levels[i] =
new ServerLevel(this, storage, name, dimension, levelSettings);
if (GameServices::getLevelGenerationOptions() != nullptr) {
if (gameServices().getLevelGenerationOptions() != nullptr) {
LevelGenerationOptions* mapOptions =
GameServices::getLevelGenerationOptions();
gameServices().getLevelGenerationOptions();
Pos* spawnPos = mapOptions->getSpawnPos();
if (spawnPos != nullptr) {
levels[i]->setSpawnPos(spawnPos);
@@ -485,7 +483,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource,
// ? Difficulty::EASY : Difficulty::PEACEFUL;
Minecraft* pMinecraft = Minecraft::GetInstance();
// m_lastSentDifficulty = pMinecraft->options->difficulty;
levels[i]->difficulty = GameHostOptions::get(
levels[i]->difficulty = gameServices().getGameHostOption(
eGameHostOption_Difficulty); // pMinecraft->options->difficulty;
Log::info("MinecraftServer::loadLevel - Difficulty = %d\n",
levels[i]->difficulty);
@@ -498,9 +496,9 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource,
#endif
levels[i]->getLevelData()->setGameType(gameType);
if (GameServices::getLevelGenerationOptions() != nullptr) {
if (gameServices().getLevelGenerationOptions() != nullptr) {
LevelGenerationOptions* mapOptions =
GameServices::getLevelGenerationOptions();
gameServices().getLevelGenerationOptions();
levels[i]->getLevelData()->setHasBeenInCreative(
mapOptions->getLevelHasBeenInCreative());
}
@@ -513,10 +511,10 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource,
} else {
mcprogress->progressStage(IDS_PROGRESS_LOADING_SPAWN_AREA);
}
GameHostOptions::set(
gameServices().setGameHostOption(
eGameHostOption_HasBeenInCreative,
gameType == GameType::CREATIVE || levels[0]->getHasBeenInCreative());
GameHostOptions::set(eGameHostOption_Structures,
gameServices().setGameHostOption(eGameHostOption_Structures,
levels[0]->isGenerateMapFeatures());
if (s_bServerHalted || !g_NetworkManager.IsInSession()) return false;
@@ -556,14 +554,14 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource,
&numberOfBytesRead);
assert(numberOfBytesRead == ba_gameRules.size());
GameServices::getGameRules().loadGameRules(ba_gameRules.data(), ba_gameRules.size());
gameServices().loadGameRules(ba_gameRules.data(), ba_gameRules.size());
csf->closeHandle(fe);
}
int64_t lastTime = System::currentTimeMillis();
#if defined(_LARGE_WORLDS)
if (GameServices::getGameNewWorldSize() > levels[0]->getLevelData()->getXZSizeOld()) {
if (!GameServices::getGameNewWorldSizeUseMoat()) // check the moat settings to
if (gameServices().getGameNewWorldSize() > levels[0]->getLevelData()->getXZSizeOld()) {
if (!gameServices().getGameNewWorldSizeUseMoat()) // check the moat settings to
// see if we should be
// overwriting the edge tiles
{
@@ -654,7 +652,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource,
if (!levels[0]->getLevelData()->getHasStronghold()) {
int x, z;
if (GameServices::getTerrainFeaturePosition(eTerrainFeature_Stronghold, &x,
if (gameServices().getTerrainFeaturePosition(eTerrainFeature_Stronghold, &x,
&z)) {
levels[0]->getLevelData()->setXStronghold(x);
levels[0]->getLevelData()->setZStronghold(z);
@@ -833,8 +831,8 @@ void MinecraftServer::saveAllChunks() {
// 4J-JEV: Added
void MinecraftServer::saveGameRules() {
#if !defined(_CONTENT_PACKAGE)
if (DebugSettings::isOn() &&
DebugSettings::getMask(InputManager.GetPrimaryPad()) &
if (gameServices().debugSettingsOn() &&
gameServices().debugGetMask(InputManager.GetPrimaryPad()) &
(1L << eDebugSetting_DistributableSave)) {
// Do nothing
} else
@@ -842,7 +840,7 @@ void MinecraftServer::saveGameRules() {
{
uint8_t* baPtr = nullptr;
unsigned int baSize = 0;
GameServices::getGameRules().saveGameRules(&baPtr, &baSize);
gameServices().saveGameRules(&baPtr, &baSize);
if (baPtr != nullptr) {
std::vector<uint8_t> ba(baPtr, baPtr + baSize);
@@ -928,7 +926,7 @@ void MinecraftServer::stopServer(bool didInit) {
//}
saveGameRules();
GameServices::getGameRules().unloadCurrentGameRules();
gameServices().unloadCurrentGameRules();
if (levels[0] != nullptr) // This can be null if stopServer happens
// very quickly due to network error
{
@@ -1065,7 +1063,7 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) {
bool findSeed = false;
if (lpParameter != nullptr) {
initData = (NetworkGameInitData*)lpParameter;
initSettings = GameHostOptions::get(eGameHostOption_All);
initSettings = gameServices().getGameHostOption(eGameHostOption_All);
findSeed = initData->findSeed;
m_texturePackId = initData->texturePackId;
}
@@ -1081,7 +1079,7 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) {
if (pLevelData && pLevelData->getHasStronghold() == false) {
int x, z;
if (GameServices::getTerrainFeaturePosition(eTerrainFeature_Stronghold, &x,
if (gameServices().getTerrainFeaturePosition(eTerrainFeature_Stronghold, &x,
&z)) {
pLevelData->setXStronghold(x);
pLevelData->setZStronghold(z);
@@ -1184,13 +1182,13 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) {
eXuiServerAction eAction;
void* param;
for (int i = 0; i < XUSER_MAX_COUNT; i++) {
eAction = GameServices::getXuiServerAction(i);
param = GameServices::getXuiServerActionParam(i);
eAction = gameServices().getXuiServerAction(i);
param = gameServices().getXuiServerActionParam(i);
switch (eAction) {
case eXuiServerAction_AutoSaveGame:
case eXuiServerAction_SaveGame:
GameServices::lockSaveNotification();
gameServices().lockSaveNotification();
if (players != nullptr) {
players->saveAll(
Minecraft::GetInstance()->progressRenderer);
@@ -1225,7 +1223,7 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) {
Minecraft::GetInstance()->progressRenderer,
(eAction == eXuiServerAction_AutoSaveGame));
}
GameServices::unlockSaveNotification();
gameServices().unlockSaveNotification();
break;
case eXuiServerAction_DropItem:
// Find the player, and drop the id at their feet
@@ -1283,7 +1281,7 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) {
std::shared_ptr<ServerSettingsChangedPacket>(
new ServerSettingsChangedPacket(
ServerSettingsChangedPacket::HOST_OPTIONS,
GameHostOptions::get(
gameServices().getGameHostOption(
eGameHostOption_Gamertags))));
break;
case eXuiServerAction_ServerSettingChanged_BedrockFog:
@@ -1292,7 +1290,7 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) {
new ServerSettingsChangedPacket(
ServerSettingsChangedPacket::
HOST_IN_GAME_SETTINGS,
GameHostOptions::get(
gameServices().getGameHostOption(
eGameHostOption_All))));
break;
@@ -1306,7 +1304,7 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) {
break;
case eXuiServerAction_ExportSchematic:
#if !defined(_CONTENT_PACKAGE)
GameServices::lockSaveNotification();
gameServices().lockSaveNotification();
// players->broadcastAll(
// shared_ptr<UpdateProgressPacket>( new
@@ -1340,7 +1338,7 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) {
delete initData;
}
GameServices::unlockSaveNotification();
gameServices().unlockSaveNotification();
#endif
break;
case eXuiServerAction_SetCameraLocation:
@@ -1373,7 +1371,7 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) {
break;
}
GameServices::setXuiServerAction(i, eXuiServerAction_Idle);
gameServices().setXuiServerAction(i, eXuiServerAction_Idle);
}
std::this_thread::sleep_for(std::chrono::milliseconds(1));
@@ -1442,7 +1440,7 @@ void MinecraftServer::tick() {
// 4J Stu - We set the levels difficulty based on the minecraft
// options
level->difficulty = GameHostOptions::get(
level->difficulty = gameServices().getGameHostOption(
eGameHostOption_Difficulty); // pMinecraft->options->difficulty;
#if DEBUG_SERVER_DONT_SPAWN_MOBS
+15 -16
View File
@@ -1,5 +1,4 @@
#include "minecraft/GameServices.h"
#include "minecraft/GameHostOptions.h"
#include "minecraft/IGameServices.h"
#include "minecraft/util/Log.h"
#include "PlayerList.h"
@@ -12,7 +11,7 @@
#include <cstdint>
#include "platform/sdl2/Profile.h"
#include "app/common/App_enums.h"
#include "minecraft/GameEnums.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h"
#include "app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h"
#include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h"
@@ -188,14 +187,14 @@ void PlayerList::placeNewPlayer(Connection* connection,
Item::map_Id, 1,
level->getAuxValueForMap(player->getXuid(), 0, centreXC,
centreZC, mapScale)));
if (GameServices::getGameRuleDefinitions() != nullptr) {
GameServices::getGameRuleDefinitions()->postProcessPlayer(player);
if (gameServices().getGameRuleDefinitions() != nullptr) {
gameServices().getGameRuleDefinitions()->postProcessPlayer(player);
}
}
if (!player->customTextureUrl.empty() &&
player->customTextureUrl.substr(0, 3).compare(L"def") != 0 &&
!GameServices::isFileInMemoryTextures(player->customTextureUrl)) {
!gameServices().isFileInMemoryTextures(player->customTextureUrl)) {
if (server->getConnection()->addPendingTextureRequest(
player->customTextureUrl)) {
#if !defined(_CONTENT_PACKAGE)
@@ -209,14 +208,14 @@ void PlayerList::placeNewPlayer(Connection* connection,
0)));
}
} else if (!player->customTextureUrl.empty() &&
GameServices::isFileInMemoryTextures(player->customTextureUrl)) {
gameServices().isFileInMemoryTextures(player->customTextureUrl)) {
// Update the ref count on the memory texture data
GameServices::addMemoryTextureFile(player->customTextureUrl, nullptr, 0);
gameServices().addMemoryTextureFile(player->customTextureUrl, nullptr, 0);
}
if (!player->customTextureUrl2.empty() &&
player->customTextureUrl2.substr(0, 3).compare(L"def") != 0 &&
!GameServices::isFileInMemoryTextures(player->customTextureUrl2)) {
!gameServices().isFileInMemoryTextures(player->customTextureUrl2)) {
if (server->getConnection()->addPendingTextureRequest(
player->customTextureUrl2)) {
#if !defined(_CONTENT_PACKAGE)
@@ -229,9 +228,9 @@ void PlayerList::placeNewPlayer(Connection* connection,
new TexturePacket(player->customTextureUrl2, nullptr, 0)));
}
} else if (!player->customTextureUrl2.empty() &&
GameServices::isFileInMemoryTextures(player->customTextureUrl2)) {
gameServices().isFileInMemoryTextures(player->customTextureUrl2)) {
// Update the ref count on the memory texture data
GameServices::addMemoryTextureFile(player->customTextureUrl2, nullptr, 0);
gameServices().addMemoryTextureFile(player->customTextureUrl2, nullptr, 0);
}
player->setIsGuest(packet->m_isGuest);
@@ -604,11 +603,11 @@ std::shared_ptr<ServerPlayer> PlayerList::getPlayerForLogin(
pendingConnection->connection->getSocket()->getPlayer();
if (networkPlayer != nullptr && !networkPlayer->IsHost()) {
player->enableAllPlayerPrivileges(
GameHostOptions::get(eGameHostOption_TrustPlayers) > 0);
gameServices().getGameHostOption(eGameHostOption_TrustPlayers) > 0);
}
// 4J Added
LevelRuleset* serverRuleDefs = GameServices::getGameRuleDefinitions();
LevelRuleset* serverRuleDefs = gameServices().getGameRuleDefinitions();
if (serverRuleDefs != nullptr) {
player->gameMode->setGameRules(
GameRuleDefinition::generateNewGameRulesInstance(
@@ -819,7 +818,7 @@ std::shared_ptr<ServerPlayer> PlayerList::respawn(
if (Minecraft::GetInstance()->isTutorial() &&
(!Minecraft::GetInstance()->gameMode->getTutorial()->isStateCompleted(
e_Tutorial_State_Food_Bar))) {
GameServices::getGameRuleDefinitions()->postProcessPlayer(player);
gameServices().getGameRuleDefinitions()->postProcessPlayer(player);
}
if (oldDimension == 1 && player->dimension != 1) {
@@ -1168,9 +1167,9 @@ bool PlayerList::isWhiteListed(const std::wstring& name) { return true; }
bool PlayerList::isOp(const std::wstring& name) { return false; }
bool PlayerList::isOp(std::shared_ptr<ServerPlayer> player) {
bool cheatsEnabled = GameHostOptions::get(eGameHostOption_CheatsEnabled);
bool cheatsEnabled = gameServices().getGameHostOption(eGameHostOption_CheatsEnabled);
#if defined(_DEBUG_MENUS_ENABLED)
cheatsEnabled = cheatsEnabled || GameServices::getUseDPadForDebug();
cheatsEnabled = cheatsEnabled || gameServices().getUseDPadForDebug();
#endif
INetworkPlayer* networkPlayer = player->connection->getNetworkPlayer();
bool isOp = cheatsEnabled &&
@@ -7,7 +7,7 @@
#include <algorithm>
#include "minecraft/GameServices.h"
#include "minecraft/IGameServices.h"
#include "app/linux/Stubs/winapi_stubs.h"
#include "ServerLevel.h"
#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h"
@@ -560,7 +560,7 @@ void ServerChunkCache::flagPostProcessComplete(short flag, int x, int z) {
// Are all neighbouring chunks And this one now post-processed?
if (lc->terrainPopulated == LevelChunk::sTerrainPopulatedAllNeighbours) {
// Special lighting patching for schematics first
GameServices::processSchematicsLighting(lc);
gameServices().processSchematicsLighting(lc);
// This would be a good time to fix up any lighting for this chunk since
// all the geometry that could affect it should now be in place
@@ -1,4 +1,4 @@
#include "minecraft/util/DebugSettings.h"
#include "minecraft/IGameServices.h"
#include "minecraft/util/Log.h"
#include "ServerLevel.h"
@@ -325,8 +325,8 @@ void ServerLevel::tick() {
// 4J: Debug setting added to keep it at day time
#if !defined(_FINAL_BUILD)
bool freezeTime =
DebugSettings::isOn() &&
DebugSettings::getMask(InputManager.GetPrimaryPad()) &
gameServices().debugSettingsOn() &&
gameServices().debugGetMask(InputManager.GetPrimaryPad()) &
(1L << eDebugSetting_FreezeTime);
if (!freezeTime)
#endif
@@ -491,7 +491,7 @@ void ServerLevel::tickTiles() {
// AP moved this outside of the loop
int prob = 100000;
if (DebugSettings::getMask() & (1L << eDebugSetting_RegularLightning))
if (gameServices().debugGetMask() & (1L << eDebugSetting_RegularLightning))
prob = 100;
auto itEndCtp = chunksToPoll.end();
+11 -13
View File
@@ -1,6 +1,4 @@
#include "minecraft/GameServices.h"
#include "minecraft/util/DebugSettings.h"
#include "minecraft/locale/Strings.h"
#include "minecraft/IGameServices.h"
#include "minecraft/util/Log.h"
#include "ServerPlayer.h"
@@ -587,7 +585,7 @@ void ServerPlayer::doChunkSendingTick(bool dontDelayChunks) {
void ServerPlayer::doTickB() {
#if !defined(_CONTENT_PACKAGE)
// check if there's a debug dimension change requested
// if(DebugSettings::getMask(InputManager.GetPrimaryPad())&(1L<<eDebugSetting_GoToNether))
// if(gameServices().debugGetMask(InputManager.GetPrimaryPad())&(1L<<eDebugSetting_GoToNether))
//{
// if(level->dimension->id == 0 )
// {
@@ -595,11 +593,11 @@ void ServerPlayer::doTickB() {
// portalTime=1;
// }
// unsigned int
// uiVal=DebugSettings::getMask(InputManager.GetPrimaryPad());
// GameServices::setGameSettingsDebugMask(InputManager.GetPrimaryPad(),uiVal&~(1L<<eDebugSetting_GoToNether));
// uiVal=gameServices().debugGetMask(InputManager.GetPrimaryPad());
// gameServices().setGameSettingsDebugMask(InputManager.GetPrimaryPad(),uiVal&~(1L<<eDebugSetting_GoToNether));
//}
// else if
// (DebugSettings::getMask(InputManager.GetPrimaryPad())&(1L<<eDebugSetting_GoToEnd))
// (gameServices().debugGetMask(InputManager.GetPrimaryPad())&(1L<<eDebugSetting_GoToEnd))
// {
// if(level->dimension->id == 0 )
// {
@@ -607,19 +605,19 @@ void ServerPlayer::doTickB() {
// std::dynamic_pointer_cast<ServerPlayer>( shared_from_this() ), 1 );
// }
// unsigned int
// uiVal=DebugSettings::getMask(InputManager.GetPrimaryPad());
// GameServices::setGameSettingsDebugMask(InputManager.GetPrimaryPad(),uiVal&~(1L<<eDebugSetting_GoToEnd));
// uiVal=gameServices().debugGetMask(InputManager.GetPrimaryPad());
// gameServices().setGameSettingsDebugMask(InputManager.GetPrimaryPad(),uiVal&~(1L<<eDebugSetting_GoToEnd));
// }
// else
if (DebugSettings::getMask(InputManager.GetPrimaryPad()) &
if (gameServices().debugGetMask(InputManager.GetPrimaryPad()) &
(1L << eDebugSetting_GoToOverworld)) {
if (level->dimension->id != 0) {
isInsidePortal = true;
portalTime = 1;
}
unsigned int uiVal =
DebugSettings::getMask(InputManager.GetPrimaryPad());
GameServices::setGameSettingsDebugMask(
gameServices().debugGetMask(InputManager.GetPrimaryPad());
gameServices().setGameSettingsDebugMask(
InputManager.GetPrimaryPad(),
uiVal & ~(1L << eDebugSetting_GoToOverworld));
}
@@ -1553,7 +1551,7 @@ void ServerPlayer::displayClientMessage(int messageId) {
// Language *language = Language::getInstance();
// wstring languageString =
// Strings::get(messageId);//language->getElement(messageId);
// gameServices().getString(messageId);//language->getElement(messageId);
// connection->send( shared_ptr<ChatPacket>( new ChatPacket(L"",
// messageType) ) );
}
@@ -1,4 +1,4 @@
#include "minecraft/util/DebugSettings.h"
#include "minecraft/IGameServices.h"
#include "ServerPlayerGameMode.h"
#include <vector>
@@ -152,7 +152,7 @@ void ServerPlayerGameMode::startDestroyBlock(int x, int y, int z, int face) {
if (t > 0 &&
(progress >=
1)) //|| (DebugSettings::isOn() &&
1)) //|| (gameServices().debugSettingsOn() &&
//(player->GetDebugOptions()&(1L<<eDebugSetting_InstantDestroy)
//) )))
{
@@ -1,4 +1,4 @@
#include "minecraft/GameHostOptions.h"
#include "minecraft/IGameServices.h"
#include "minecraft/util/Log.h"
#include "PendingConnection.h"
@@ -9,7 +9,7 @@
#include "platform/PlatformTypes.h"
#include "platform/sdl2/Storage.h"
#include "app/common/App_enums.h"
#include "minecraft/GameEnums.h"
#include "app/common/BuildVer/BuildVer.h"
#include "app/common/Network/NetworkPlayerInterface.h"
#include "platform/IPlatformNetwork.h"
@@ -139,7 +139,7 @@ void PendingConnection::sendPreLoginResponse() {
connection->send(std::shared_ptr<PreLoginPacket>(
new PreLoginPacket(L"-", ugcXuids, ugcXuidCount, ugcFriendsOnlyBits,
server->m_ugcPlayersVersion, szUniqueMapName,
GameHostOptions::get(eGameHostOption_All),
gameServices().getGameHostOption(eGameHostOption_All),
hostIndex, server->m_texturePackId)));
}
}
@@ -1,5 +1,4 @@
#include "minecraft/GameServices.h"
#include "minecraft/util/DebugSettings.h"
#include "minecraft/IGameServices.h"
#include "minecraft/GameHostOptions.h"
#include "minecraft/util/Log.h"
#include "PlayerConnection.h"
@@ -12,7 +11,7 @@
#include <format>
#include <utility>
#include "app/common/App_enums.h"
#include "minecraft/GameEnums.h"
#include "app/common/Console_Debug_enum.h"
#include "app/common/DLC/DLCManager.h"
#include "app/common/DLC/DLCSkinFile.h"
@@ -20,7 +19,7 @@
#include "app/common/Network/NetworkPlayerInterface.h"
#include "app/common/Network/Socket.h"
#include "app/linux/LinuxGame.h"
#include "minecraft/client/SkinBox.h"
#include "minecraft/client/model/SkinBox.h"
#include "ServerConnection.h"
#include "java/Class.h"
#include "java/InputOutputStream/ByteArrayInputStream.h"
@@ -141,7 +140,7 @@ PlayerConnection::PlayerConnection(MinecraftServer* server,
m_bHasClientTickedOnce = false;
setShowOnMaps(
GameHostOptions::get(eGameHostOption_Gamertags) != 0 ? true : false);
gameServices().getGameHostOption(eGameHostOption_Gamertags) != 0 ? true : false);
}
PlayerConnection::~PlayerConnection() { delete connection; }
@@ -815,7 +814,7 @@ void PlayerConnection::handleTexture(std::shared_ptr<TexturePacket> packet) {
#endif
std::uint8_t* pbData = nullptr;
unsigned int dwBytes = 0;
GameServices::getMemFileDetails(packet->textureName, &pbData, &dwBytes);
gameServices().getMemFileDetails(packet->textureName, &pbData, &dwBytes);
if (dwBytes != 0) {
send(std::shared_ptr<TexturePacket>(
@@ -829,7 +828,7 @@ void PlayerConnection::handleTexture(std::shared_ptr<TexturePacket> packet) {
wprintf(L"Server received custom texture %ls\n",
packet->textureName.c_str());
#endif
GameServices::addMemoryTextureFile(packet->textureName, packet->pbData,
gameServices().addMemoryTextureFile(packet->textureName, packet->pbData,
packet->dataBytes);
server->connection->handleTextureReceived(packet->textureName);
}
@@ -848,9 +847,9 @@ void PlayerConnection::handleTextureAndGeometry(
#endif
std::uint8_t* pbData = nullptr;
unsigned int dwTextureBytes = 0;
GameServices::getMemFileDetails(packet->textureName, &pbData, &dwTextureBytes);
gameServices().getMemFileDetails(packet->textureName, &pbData, &dwTextureBytes);
DLCSkinFile* pDLCSkinFile =
GameServices::getDLCManager().getSkinFile(packet->textureName);
gameServices().getDLCSkinFile(packet->textureName);
if (dwTextureBytes != 0) {
if (pDLCSkinFile) {
@@ -868,9 +867,9 @@ void PlayerConnection::handleTextureAndGeometry(
// we don't have the dlc skin, so retrieve the data from the app
// store
std::vector<SKIN_BOX*>* pvSkinBoxes =
GameServices::getAdditionalSkinBoxes(packet->dwSkinID);
gameServices().getAdditionalSkinBoxes(packet->dwSkinID);
unsigned int uiAnimOverrideBitmask =
GameServices::getAnimOverrideBitmask(packet->dwSkinID);
gameServices().getAnimOverrideBitmask(packet->dwSkinID);
send(std::shared_ptr<TextureAndGeometryPacket>(
new TextureAndGeometryPacket(packet->textureName, pbData,
@@ -886,7 +885,7 @@ void PlayerConnection::handleTextureAndGeometry(
wprintf(L"Server received custom texture %ls and geometry\n",
packet->textureName.c_str());
#endif
GameServices::addMemoryTextureFile(packet->textureName, packet->pbData,
gameServices().addMemoryTextureFile(packet->textureName, packet->pbData,
packet->dwTextureBytes);
// add the geometry to the app list
@@ -895,11 +894,11 @@ void PlayerConnection::handleTextureAndGeometry(
wprintf(L"Adding skin boxes for skin id %X, box count %d\n",
packet->dwSkinID, packet->dwBoxC);
#endif
GameServices::setAdditionalSkinBoxes(packet->dwSkinID, packet->BoxDataA,
gameServices().setAdditionalSkinBoxes(packet->dwSkinID, packet->BoxDataA,
packet->dwBoxC);
}
// Add the anim override
GameServices::setAnimOverrideBitmask(packet->dwSkinID,
gameServices().setAnimOverrideBitmask(packet->dwSkinID,
packet->uiAnimOverrideBitmask);
player->setCustomSkin(packet->dwSkinID);
@@ -917,7 +916,7 @@ void PlayerConnection::handleTextureReceived(const std::wstring& textureName) {
if (it != m_texturesRequested.end()) {
std::uint8_t* pbData = nullptr;
unsigned int dwBytes = 0;
GameServices::getMemFileDetails(textureName, &pbData, &dwBytes);
gameServices().getMemFileDetails(textureName, &pbData, &dwBytes);
if (dwBytes != 0) {
send(std::shared_ptr<TexturePacket>(
@@ -936,8 +935,8 @@ void PlayerConnection::handleTextureAndGeometryReceived(
if (it != m_texturesRequested.end()) {
std::uint8_t* pbData = nullptr;
unsigned int dwTextureBytes = 0;
GameServices::getMemFileDetails(textureName, &pbData, &dwTextureBytes);
DLCSkinFile* pDLCSkinFile = GameServices::getDLCManager().getSkinFile(textureName);
gameServices().getMemFileDetails(textureName, &pbData, &dwTextureBytes);
DLCSkinFile* pDLCSkinFile = gameServices().getDLCSkinFile(textureName);
if (dwTextureBytes != 0) {
if (pDLCSkinFile &&
@@ -947,11 +946,11 @@ void PlayerConnection::handleTextureAndGeometryReceived(
textureName, pbData, dwTextureBytes, pDLCSkinFile)));
} else {
// get the data from the app
std::uint32_t dwSkinID = GameServices::getSkinIdFromPath(textureName);
std::uint32_t dwSkinID = gameServices().getSkinIdFromPath(textureName);
std::vector<SKIN_BOX*>* pvSkinBoxes =
GameServices::getAdditionalSkinBoxes(dwSkinID);
gameServices().getAdditionalSkinBoxes(dwSkinID);
unsigned int uiAnimOverrideBitmask =
GameServices::getAnimOverrideBitmask(dwSkinID);
gameServices().getAnimOverrideBitmask(dwSkinID);
send(std::shared_ptr<TextureAndGeometryPacket>(
new TextureAndGeometryPacket(textureName, pbData,
@@ -967,7 +966,7 @@ void PlayerConnection::handleTextureChange(
std::shared_ptr<TextureChangePacket> packet) {
switch (packet->action) {
case TextureChangePacket::e_TextureChange_Skin:
player->setCustomSkin(GameServices::getSkinIdFromPath(packet->path));
player->setCustomSkin(gameServices().getSkinIdFromPath(packet->path));
#if !defined(_CONTENT_PACKAGE)
wprintf(L"Skin for server player %ls has changed to %ls (%d)\n",
player->name.c_str(), player->customTextureUrl.c_str(),
@@ -985,7 +984,7 @@ void PlayerConnection::handleTextureChange(
}
if (!packet->path.empty() &&
packet->path.substr(0, 3).compare(L"def") != 0 &&
!GameServices::isFileInMemoryTextures(packet->path)) {
!gameServices().isFileInMemoryTextures(packet->path)) {
if (server->connection->addPendingTextureRequest(packet->path)) {
#if !defined(_CONTENT_PACKAGE)
wprintf(
@@ -997,9 +996,9 @@ void PlayerConnection::handleTextureChange(
new TexturePacket(packet->path, nullptr, 0)));
}
} else if (!packet->path.empty() &&
GameServices::isFileInMemoryTextures(packet->path)) {
gameServices().isFileInMemoryTextures(packet->path)) {
// Update the ref count on the memory texture data
GameServices::addMemoryTextureFile(packet->path, nullptr, 0);
gameServices().addMemoryTextureFile(packet->path, nullptr, 0);
}
server->getPlayers()->broadcastAll(
std::shared_ptr<TextureChangePacket>(
@@ -1009,7 +1008,7 @@ void PlayerConnection::handleTextureChange(
void PlayerConnection::handleTextureAndGeometryChange(
std::shared_ptr<TextureAndGeometryChangePacket> packet) {
player->setCustomSkin(GameServices::getSkinIdFromPath(packet->path));
player->setCustomSkin(gameServices().getSkinIdFromPath(packet->path));
#if !defined(_CONTENT_PACKAGE)
wprintf(
L"PlayerConnection::handleTextureAndGeometryChange - Skin for server "
@@ -1020,7 +1019,7 @@ void PlayerConnection::handleTextureAndGeometryChange(
if (!packet->path.empty() &&
packet->path.substr(0, 3).compare(L"def") != 0 &&
!GameServices::isFileInMemoryTextures(packet->path)) {
!gameServices().isFileInMemoryTextures(packet->path)) {
if (server->connection->addPendingTextureRequest(packet->path)) {
#if !defined(_CONTENT_PACKAGE)
wprintf(
@@ -1032,15 +1031,15 @@ void PlayerConnection::handleTextureAndGeometryChange(
new TextureAndGeometryPacket(packet->path, nullptr, 0)));
}
} else if (!packet->path.empty() &&
GameServices::isFileInMemoryTextures(packet->path)) {
gameServices().isFileInMemoryTextures(packet->path)) {
// Update the ref count on the memory texture data
GameServices::addMemoryTextureFile(packet->path, nullptr, 0);
gameServices().addMemoryTextureFile(packet->path, nullptr, 0);
player->setCustomSkin(packet->dwSkinID);
// If we already have the texture, then we already have the model parts
// too
// GameServices::setAdditionalSkinBoxes(packet->dwSkinID,)
// gameServices().setAdditionalSkinBoxes(packet->dwSkinID,)
// DebugBreak();
}
server->getPlayers()->broadcastAll(
@@ -1058,37 +1057,37 @@ void PlayerConnection::handleServerSettingsChanged(
INetworkPlayer* networkPlayer = getNetworkPlayer();
if ((networkPlayer != nullptr && networkPlayer->IsHost()) ||
player->isModerator()) {
GameHostOptions::set(
gameServices().setGameHostOption(
eGameHostOption_FireSpreads,
GameHostOptions::get(packet->data,
eGameHostOption_FireSpreads));
GameHostOptions::set(
gameServices().setGameHostOption(
eGameHostOption_TNT,
GameHostOptions::get(packet->data, eGameHostOption_TNT));
GameHostOptions::set(
gameServices().setGameHostOption(
eGameHostOption_MobGriefing,
GameHostOptions::get(packet->data,
eGameHostOption_MobGriefing));
GameHostOptions::set(
gameServices().setGameHostOption(
eGameHostOption_KeepInventory,
GameHostOptions::get(packet->data,
eGameHostOption_KeepInventory));
GameHostOptions::set(
gameServices().setGameHostOption(
eGameHostOption_DoMobSpawning,
GameHostOptions::get(packet->data,
eGameHostOption_DoMobSpawning));
GameHostOptions::set(
gameServices().setGameHostOption(
eGameHostOption_DoMobLoot,
GameHostOptions::get(packet->data, eGameHostOption_DoMobLoot));
GameHostOptions::set(
gameServices().setGameHostOption(
eGameHostOption_DoTileDrops,
GameHostOptions::get(packet->data,
eGameHostOption_DoTileDrops));
GameHostOptions::set(
gameServices().setGameHostOption(
eGameHostOption_DoDaylightCycle,
GameHostOptions::get(packet->data,
eGameHostOption_DoDaylightCycle));
GameHostOptions::set(
gameServices().setGameHostOption(
eGameHostOption_NaturalRegeneration,
GameHostOptions::get(packet->data,
eGameHostOption_NaturalRegeneration));
@@ -1097,7 +1096,7 @@ void PlayerConnection::handleServerSettingsChanged(
std::shared_ptr<ServerSettingsChangedPacket>(
new ServerSettingsChangedPacket(
ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS,
GameHostOptions::get(eGameHostOption_All))));
gameServices().getGameHostOption(eGameHostOption_All))));
// Update the QoS data
g_NetworkManager.UpdateAndSetGameSessionData();
@@ -1410,9 +1409,9 @@ void PlayerConnection::handlePlayerInfo(
unsigned int origPrivs = serverPlayer->getAllPlayerGamePrivileges();
bool trustPlayers =
GameHostOptions::get(eGameHostOption_TrustPlayers) != 0;
gameServices().getGameHostOption(eGameHostOption_TrustPlayers) != 0;
bool cheats =
GameHostOptions::get(eGameHostOption_CheatsEnabled) != 0;
gameServices().getGameHostOption(eGameHostOption_CheatsEnabled) != 0;
if (serverPlayer == player) {
GameType* gameType =
Player::getPlayerGamePrivilege(
@@ -1692,7 +1691,7 @@ void PlayerConnection::handleCraftItem(
std::shared_ptr<ItemInstance> pTempItemInst =
pRecipeIngredientsRequired[iRecipe].pRecipy->assemble(nullptr);
if (DebugSettings::isOn() &&
if (gameServices().debugSettingsOn() &&
(player->GetDebugOptions() & (1L << eDebugSetting_CraftAnything))) {
pTempItemInst->onCraftedBy(
player->level,
@@ -1,4 +1,4 @@
#include "minecraft/GameHostOptions.h"
#include "minecraft/IGameServices.h"
#include "minecraft/util/Log.h"
#include "ServerConnection.h"
@@ -176,7 +176,7 @@ void ServerConnection::handleServerSettingsChanged(
// if(packet->action==ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS)//
// options
// {
// GameHostOptions::set(eGameHostOption_All,packet->m_serverSettings)
// gameServices().setGameHostOption(eGameHostOption_All,packet->m_serverSettings)
// }
// else
// {
+2 -2
View File
@@ -8,7 +8,7 @@
#include <vector>
#include "GenericStats.h"
#include "minecraft/GameServices.h"
#include "minecraft/IGameServices.h"
#include "app/linux/LinuxGame.h"
#include "StatFormatter.h"
@@ -63,7 +63,7 @@ public:
// 4J-JEV, for Durango stats
virtual void handleParamBlob(std::shared_ptr<LocalPlayer> plr,
std::vector<uint8_t>& param) {
GameServices::debugPrintf("'Stat.h', Unhandled AwardStat blob.\n");
gameServices().debugPrintf("'Stat.h', Unhandled AwardStat blob.\n");
return;
}
};
-33
View File
@@ -1,33 +0,0 @@
#include "minecraft/util/DebugSettings.h"
#include <cassert>
namespace DebugSettings {
static BoolFn s_debugOn = nullptr;
static BoolFn s_artToolsOn = nullptr;
static MaskFn s_mask = nullptr;
static BoolFn s_mobsDontAttack = nullptr;
static BoolFn s_mobsDontTick = nullptr;
static BoolFn s_freezePlayers = nullptr;
void init(BoolFn debugOn, BoolFn artToolsOn, MaskFn mask,
BoolFn mobsDontAttack, BoolFn mobsDontTick, BoolFn freezePlayers) {
s_debugOn = debugOn;
s_artToolsOn = artToolsOn;
s_mask = mask;
s_mobsDontAttack = mobsDontAttack;
s_mobsDontTick = mobsDontTick;
s_freezePlayers = freezePlayers;
}
bool isOn() { return s_debugOn && s_debugOn(); }
bool artToolsOn() { return s_artToolsOn && s_artToolsOn(); }
unsigned int getMask(int iPad, bool overridePlayer) {
return s_mask ? s_mask(iPad, overridePlayer) : 0;
}
bool mobsDontAttack() { return s_mobsDontAttack && s_mobsDontAttack(); }
bool mobsDontTick() { return s_mobsDontTick && s_mobsDontTick(); }
bool freezePlayers() { return s_freezePlayers && s_freezePlayers(); }
} // namespace DebugSettings
-20
View File
@@ -1,20 +0,0 @@
#pragma once
#include <cstdint>
namespace DebugSettings {
using BoolFn = bool (*)();
using MaskFn = unsigned int (*)(int, bool);
void init(BoolFn debugOn, BoolFn artToolsOn, MaskFn mask,
BoolFn mobsDontAttack, BoolFn mobsDontTick, BoolFn freezePlayers);
[[nodiscard]] bool isOn();
[[nodiscard]] bool artToolsOn();
[[nodiscard]] unsigned int getMask(int iPad = -1, bool overridePlayer = false);
[[nodiscard]] bool mobsDontAttack();
[[nodiscard]] bool mobsDontTick();
[[nodiscard]] bool freezePlayers();
} // namespace DebugSettings
+2 -2
View File
@@ -4,7 +4,7 @@
#include <sstream>
#include <vector>
#include "minecraft/GameServices.h"
#include "minecraft/IGameServices.h"
#include "util/StringHelpers.h"
HtmlString::HtmlString(std::wstring text, eMinecraftColour hexColor,
@@ -30,7 +30,7 @@ std::wstring HtmlString::ToString() {
this->color == eMinecraftColour_NOT_SET ? eHTMLColor_7 : this->color;
ss << L"<font color=\"#" << std::setfill(L'0') << std::setw(6) << std::hex
<< GameServices::getHTMLColor(color) << L"\">" << text << "</font>";
<< gameServices().getHTMLColour(color) << L"\">" << text << "</font>";
if (italics) {
ss << "</i>";
+1 -1
View File
@@ -4,7 +4,7 @@
#include <string>
#include <vector>
#include "app/common/App_enums.h"
#include "minecraft/GameEnums.h"
// 4J: Simple std::string wrapper that includes basic formatting information
class HtmlString {
@@ -1,4 +1,4 @@
#include "minecraft/locale/Strings.h"
#include "minecraft/IGameServices.h"
#include "CompoundContainer.h"
#include "app/linux/LinuxGame.h"
@@ -29,7 +29,7 @@ bool CompoundContainer::contains(std::shared_ptr<Container> c) {
std::wstring CompoundContainer::getName() {
if (c1->hasCustomName()) return c1->getName();
if (c2->hasCustomName()) return c2->getName();
return Strings::get(name);
return gameServices().getString(name);
}
std::wstring CompoundContainer::getCustomName() {
+2 -2
View File
@@ -1,4 +1,4 @@
#include "minecraft/locale/Strings.h"
#include "minecraft/IGameServices.h"
#include "SimpleContainer.h"
#include <vector>
@@ -82,7 +82,7 @@ void SimpleContainer::setItem(unsigned int slot,
unsigned int SimpleContainer::getContainerSize() { return size; }
std::wstring SimpleContainer::getName() {
return stringName.empty() ? Strings::get(name) : stringName;
return stringName.empty() ? gameServices().getString(name) : stringName;
}
std::wstring SimpleContainer::getCustomName() {
@@ -1,6 +1,6 @@
#pragma once
#include "app/common/App_enums.h"
#include "minecraft/GameEnums.h"
#include "MobEffect.h"
class LivingEntity;
@@ -1,6 +1,6 @@
#pragma once
#include "app/common/App_enums.h"
#include "minecraft/GameEnums.h"
#include "MobEffect.h"
class AttributeModifier;
@@ -1,6 +1,6 @@
#pragma once
#include "app/common/App_enums.h"
#include "minecraft/GameEnums.h"
#include "MobEffect.h"
class LivingEntity;
@@ -1,7 +1,7 @@
#include "minecraft/world/effect/InstantaneousMobEffect.h"
#include "app/common/App_enums.h"
#include "minecraft/GameEnums.h"
#include "minecraft/world/effect/MobEffect.h"
InstantenousMobEffect::InstantenousMobEffect(int id, bool isHarmful,
@@ -1,6 +1,6 @@
#pragma once
#include "app/common/App_enums.h"
#include "minecraft/GameEnums.h"
#include "MobEffect.h"
class InstantenousMobEffect : public MobEffect {
+1 -1
View File
@@ -9,7 +9,7 @@
#include <unordered_map>
#include <utility>
#include "app/common/App_enums.h"
#include "minecraft/GameEnums.h"
#include "java/Class.h"
#include "minecraft/SharedConstants.h"
#include "minecraft/world/damageSource/DamageSource.h"
+1 -1
View File
@@ -4,7 +4,7 @@
#include <string>
#include <unordered_map>
#include "app/common/App_enums.h"
#include "minecraft/GameEnums.h"
#include "minecraft/world/entity/ai/attributes/AttributeModifier.h"
class Mob;
+3 -3
View File
@@ -1,4 +1,4 @@
#include "minecraft/GameServices.h"
#include "minecraft/IGameServices.h"
#include "minecraft/util/Log.h"
#include "Entity.h"
@@ -17,7 +17,7 @@
#include "EntityIO.h"
#include "EntityPos.h"
#include "SyncedEntityData.h"
#include "app/common/App_enums.h"
#include "minecraft/GameEnums.h"
#include "app/linux/LinuxGame.h"
#include "app/linux/Stubs/winapi_stubs.h"
#include "java/Class.h"
@@ -1867,7 +1867,7 @@ void Entity::setAnimOverrideBitmask(unsigned int uiBitmask) {
Log::info("!!! Setting anim override bitmask to %d\n", uiBitmask);
}
unsigned int Entity::getAnimOverrideBitmask() {
if (GameServices::getGameSettings(eGameSetting_CustomSkinAnim) == 0) {
if (gameServices().getGameSettings(eGameSetting_CustomSkinAnim) == 0) {
// We have a force animation for some skins (claptrap)
// 4J-PB - treat all the eAnim_Disable flags as a force anim
unsigned int uiIgnoreUserCustomSkinAnimSettingMask =
+1 -1
View File
@@ -5,7 +5,7 @@
#include <unordered_map>
#include "Entity.h"
#include "app/common/App_enums.h"
#include "minecraft/GameEnums.h"
#include "app/common/Colours/ColourTable.h"
#include "java/Class.h"
#include "java/JavaIntHash.h"
+2 -2
View File
@@ -1,4 +1,4 @@
#include "minecraft/util/DebugSettings.h"
#include "minecraft/IGameServices.h"
#include "Painting.h"
#include <memory>
@@ -78,7 +78,7 @@ Painting::Painting(Level* level, int xTile, int yTile, int zTile, int dir)
// needed in the ctor 4J Stu - Added motive param for debugging/artists only
void Painting::PaintingPostConstructor(int dir, int motive) {
#ifndef _CONTENT_PACKAGE
if (DebugSettings::artToolsOn() && motive >= 0) {
if (gameServices().debugArtToolsOn() && motive >= 0) {
this->motive = (Motive*)Motive::values[motive];
setDir(dir);
} else
@@ -1,10 +1,10 @@
#include "minecraft/locale/Strings.h"
#include "minecraft/IGameServices.h"
#include "AttributeModifier.h"
#include <assert.h>
#include <wchar.h>
#include "app/common/App_enums.h"
#include "minecraft/GameEnums.h"
#include "app/linux/LinuxGame.h"
#include "minecraft/util/HtmlString.h"
#include "minecraft/world/entity/ai/attributes/Attribute.h"
@@ -107,7 +107,7 @@ HtmlString AttributeModifier::getHoverText(eATTRIBUTE_ID attribute) {
wchar_t formatted[256];
swprintf(formatted, 256, L"%ls%d%ls %ls", (amount > 0 ? L"+" : L"-"),
(int)displayAmount, (percentage ? L"%" : L""),
Strings::get(Attribute::getName(attribute)));
gameServices().getString(Attribute::getName(attribute)));
return HtmlString(formatted, color);
}
@@ -1,4 +1,4 @@
#include "minecraft/util/DebugSettings.h"
#include "minecraft/IGameServices.h"
#include "Ocelot.h"
#include <stdint.h>
@@ -307,7 +307,7 @@ MobGroupData* Ocelot::finalizeMobSpawn(
groupData = TamableAnimal::finalizeMobSpawn(groupData);
#ifndef _CONTENT_PACKAGE
if (DebugSettings::artToolsOn() && (extraData != 0)) {
if (gameServices().debugArtToolsOn() && (extraData != 0)) {
setTame(true);
setCatType(extraData - 1);
setOwnerUUID(Minecraft::GetInstance()
@@ -5,7 +5,7 @@
#include <string>
#include <vector>
#include "minecraft/locale/Strings.h"
#include "minecraft/IGameServices.h"
#include "java/Class.h"
#include "minecraft/stdafx.h"
#include "minecraft/world/entity/LivingEntity.h"
@@ -207,7 +207,7 @@ public:
std::vector<double>& partPos);
Vec3 getHeadLookVector(float a);
virtual std::wstring getAName() { return Strings::get(IDS_ENDERDRAGON); };
virtual std::wstring getAName() { return gameServices().getString(IDS_ENDERDRAGON); };
virtual float getHealth() { return LivingEntity::getHealth(); };
virtual float getMaxHealth() { return LivingEntity::getMaxHealth(); };
};
@@ -3,7 +3,7 @@
#include <memory>
#include <string>
#include "minecraft/locale/Strings.h"
#include "minecraft/IGameServices.h"
#include "java/Class.h"
#include "minecraft/stdafx.h"
#include "minecraft/world/entity/EntitySelector.h"
@@ -120,5 +120,5 @@ public:
// 4J Stu - These are required for the BossMob interface
virtual float getMaxHealth() { return Monster::getMaxHealth(); };
virtual float getHealth() { return Monster::getHealth(); };
virtual std::wstring getAName() { return Strings::get(IDS_WITHER); };
virtual std::wstring getAName() { return gameServices().getString(IDS_WITHER); };
};
@@ -1,4 +1,4 @@
#include "minecraft/locale/Strings.h"
#include "minecraft/IGameServices.h"
#include "MinecartContainer.h"
#include <stdint.h>
@@ -120,7 +120,7 @@ bool MinecartContainer::canPlaceItem(int slot,
std::wstring MinecartContainer::getName() {
return hasCustomName() ? getCustomName()
: Strings::get(IDS_CONTAINER_MINECART);
: gameServices().getString(IDS_CONTAINER_MINECART);
}
int MinecartContainer::getMaxStackSize() {
@@ -1,4 +1,4 @@
#include "minecraft/util/DebugSettings.h"
#include "minecraft/IGameServices.h"
#include "EnderMan.h"
#include <math.h>
@@ -107,7 +107,7 @@ void EnderMan::readAdditionalSaveData(CompoundTag* tag) {
std::shared_ptr<Entity> EnderMan::findAttackTarget() {
#ifndef _FINAL_BUILD
if (DebugSettings::mobsDontAttack()) {
if (gameServices().debugMobsDontAttack()) {
return std::shared_ptr<Player>();
}
#endif
@@ -1,4 +1,4 @@
#include "minecraft/util/DebugSettings.h"
#include "minecraft/IGameServices.h"
#include "Monster.h"
#include <math.h>
@@ -49,7 +49,7 @@ void Monster::tick() {
std::shared_ptr<Entity> Monster::findAttackTarget() {
#ifndef _FINAL_BUILD
if (DebugSettings::mobsDontAttack()) {
if (gameServices().debugMobsDontAttack()) {
return std::shared_ptr<Player>();
}
#endif
@@ -1,4 +1,4 @@
#include "minecraft/util/DebugSettings.h"
#include "minecraft/IGameServices.h"
#include "PigZombie.h"
#include <string>
@@ -94,7 +94,7 @@ void PigZombie::readAdditionalSaveData(CompoundTag* tag) {
std::shared_ptr<Entity> PigZombie::findAttackTarget() {
#ifndef _FINAL_BUILD
#ifdef _DEBUG_MENUS_ENABLED
if (DebugSettings::mobsDontAttack()) {
if (gameServices().debugMobsDontAttack()) {
return std::shared_ptr<Player>();
}
#endif
@@ -1,4 +1,4 @@
#include "minecraft/util/DebugSettings.h"
#include "minecraft/IGameServices.h"
#include "Silverfish.h"
#include <memory>
@@ -44,7 +44,7 @@ bool Silverfish::makeStepSound() { return false; }
std::shared_ptr<Entity> Silverfish::findAttackTarget() {
#ifndef _FINAL_BUILD
if (DebugSettings::mobsDontAttack()) {
if (gameServices().debugMobsDontAttack()) {
return std::shared_ptr<Player>();
}
#endif
@@ -1,4 +1,4 @@
#include "minecraft/util/DebugSettings.h"
#include "minecraft/IGameServices.h"
#include "Spider.h"
#include <math.h>
@@ -61,7 +61,7 @@ void Spider::registerAttributes() {
std::shared_ptr<Entity> Spider::findAttackTarget() {
#ifndef _FINAL_BUILD
#ifdef _DEBUG_MENUS_ENABLED
if (DebugSettings::mobsDontAttack()) {
if (gameServices().debugMobsDontAttack()) {
return std::shared_ptr<Player>();
}
#endif
@@ -1,4 +1,4 @@
#include "minecraft/locale/Strings.h"
#include "minecraft/IGameServices.h"
#include "Villager.h"
#include <algorithm>
@@ -797,5 +797,5 @@ std::wstring Villager::getDisplayName() {
name = IDS_VILLAGER_BUTCHER;
break;
};
return Strings::get(name);
return gameServices().getString(name);
}
@@ -1,4 +1,4 @@
#include "minecraft/locale/Strings.h"
#include "minecraft/IGameServices.h"
#include "minecraft/util/Log.h"
#include "Inventory.h"
@@ -490,7 +490,7 @@ std::shared_ptr<ItemInstance> Inventory::getItem(unsigned int slot) {
*/
}
std::wstring Inventory::getName() { return Strings::get(IDS_INVENTORY); }
std::wstring Inventory::getName() { return gameServices().getString(IDS_INVENTORY); }
std::wstring Inventory::getCustomName() { return L""; }
@@ -1,5 +1,4 @@
#include "minecraft/GameServices.h"
#include "minecraft/GameHostOptions.h"
#include "minecraft/IGameServices.h"
#include "minecraft/util/Log.h"
// 4J TODO
@@ -23,7 +22,7 @@
#include <vector>
#include "Inventory.h"
#include "app/common/App_enums.h"
#include "minecraft/GameEnums.h"
#include "app/common/App_structs.h"
#include "app/common/Minecraft_Macros.h"
#include "app/common/DLC/DLCManager.h"
@@ -185,7 +184,7 @@ Player::Player(Level* level, const std::wstring& name) : LivingEntity(level) {
m_OnlineXuid = INVALID_XUID;
// m_bShownOnMaps = true;
setShowOnMaps(
GameHostOptions::get(eGameHostOption_Gamertags) != 0 ? true : false);
gameServices().getGameHostOption(eGameHostOption_Gamertags) != 0 ? true : false);
m_bIsGuest = false;
// 4J: Set UUID to name on none-XB1 consoles, may change in future but for
@@ -572,10 +571,10 @@ void Player::setCustomSkin(std::uint32_t skinId) {
setPlayerDefaultSkin(playerSkin);
m_dwSkinId = skinId;
this->customTextureUrl = GameServices::getSkinPathFromId(skinId);
this->customTextureUrl = gameServices().getSkinPathFromId(skinId);
// set the new player additional boxes
/*vector<ModelPart *> *pvModelParts=GameServices::getAdditionalModelParts(m_dwSkinId);
/*vector<ModelPart *> *pvModelParts=gameServices().getAdditionalModelParts(m_dwSkinId);
if(pvModelParts==nullptr)
{
@@ -584,7 +583,7 @@ void Player::setCustomSkin(std::uint32_t skinId) {
// do we have it from the DLC pack?
DLCSkinFile *pDLCSkinFile =
GameServices::getDLCManager().getSkinFile(this->customTextureUrl);
gameServices().getDLCSkinFile(this->customTextureUrl);
if(pDLCSkinFile!=nullptr)
{
@@ -592,14 +591,14 @@ void Player::setCustomSkin(std::uint32_t skinId) {
pDLCSkinFile->getAdditionalBoxesCount(); if(additionalBoxCount != 0)
{
Log::info("Got model parts from DLCskin for skin %X\n",m_dwSkinId);
pvModelParts=GameServices::setAdditionalSkinBoxesFromVec(m_dwSkinId,pDLCSkinFile->getAdditionalBoxes());
pvModelParts=gameServices().setAdditionalSkinBoxesFromVec(m_dwSkinId,pDLCSkinFile->getAdditionalBoxes());
this->SetAdditionalModelParts(pvModelParts);
}
else
{
this->SetAdditionalModelParts(nullptr);
}
GameServices::setAnimOverrideBitmask(pDLCSkinFile->getSkinID(),pDLCSkinFile->getAnimOverrideBitmask());
gameServices().setAnimOverrideBitmask(pDLCSkinFile->getSkinID(),pDLCSkinFile->getAnimOverrideBitmask());
}
else
{
@@ -653,7 +652,7 @@ unsigned int Player::getSkinAnimOverrideBitmask(std::uint32_t skinId) {
default:
// This is not one of the prefined skins
// Does the app have an anim override for this skin?
bitmask = GameServices::getAnimOverrideBitmask(skinId);
bitmask = gameServices().getAnimOverrideBitmask(skinId);
break;
}
}
@@ -673,13 +672,13 @@ void Player::setCustomCape(std::uint32_t capeId) {
if (capeId > 0) {
this->customTextureUrl2 = Player::getCapePathFromId(capeId);
} else {
MOJANG_DATA* pMojangData = GameServices::getMojangDataForXuid(getOnlineXuid());
MOJANG_DATA* pMojangData = gameServices().getMojangDataForXuid(getOnlineXuid());
if (pMojangData) {
// Cape
if (pMojangData->wchCape[0] != 0) {
this->customTextureUrl2 = pMojangData->wchCape;
} else {
if (GameServices::defaultCapeExists()) {
if (gameServices().defaultCapeExists()) {
this->customTextureUrl2 = std::wstring(L"Special_Cape.png");
} else {
this->customTextureUrl2 = std::wstring(L"");
@@ -688,7 +687,7 @@ void Player::setCustomCape(std::uint32_t capeId) {
} else {
// if there is a custom default cloak, then set it here
if (GameServices::defaultCapeExists()) {
if (gameServices().defaultCapeExists()) {
this->customTextureUrl2 = std::wstring(L"Special_Cape.png");
} else {
this->customTextureUrl2 = std::wstring(L"");
@@ -747,23 +746,23 @@ std::wstring Player::getCapePathFromId(std::uint32_t capeId) {
}
void Player::ChangePlayerSkin() {
if (GameServices::getSkinNames().size() > 0) {
if (gameServices().getSkinNames().size() > 0) {
m_uiPlayerCurrentSkin++;
if (m_uiPlayerCurrentSkin > GameServices::getSkinNames().size()) {
if (m_uiPlayerCurrentSkin > gameServices().getSkinNames().size()) {
m_uiPlayerCurrentSkin = 0;
this->customTextureUrl = L"";
} else {
if (m_uiPlayerCurrentSkin > 0) {
// change this players custom texture url
this->customTextureUrl =
GameServices::getSkinNames()[m_uiPlayerCurrentSkin - 1];
gameServices().getSkinNames()[m_uiPlayerCurrentSkin - 1];
}
}
}
}
void Player::prepareCustomTextures() {
MOJANG_DATA* pMojangData = GameServices::getMojangDataForXuid(getOnlineXuid());
MOJANG_DATA* pMojangData = gameServices().getMojangDataForXuid(getOnlineXuid());
if (pMojangData) {
// Skin
@@ -779,7 +778,7 @@ void Player::prepareCustomTextures() {
//}
// else
//{
// if(GameServices::defaultCapeExists())
// if(gameServices().defaultCapeExists())
// {
// this->customTextureUrl2= wstring(L"Default_Cape.png");
// }
@@ -792,7 +791,7 @@ void Player::prepareCustomTextures() {
} else {
// 4J Stu - Don't update the cape here, it gets set elsewhere
// if there is a custom default cloak, then set it here
// if(GameServices::defaultCapeExists())
// if(gameServices().defaultCapeExists())
//{
// this->customTextureUrl2= wstring(L"Default_Cape.png");
//}
@@ -936,7 +935,7 @@ void Player::die(DamageSource* source) {
yd = 0.1f;
// 4J - TODO need to use a xuid
if (GameServices::isXuidNotch(m_xuid)) {
if (gameServices().isXuidNotch(m_xuid)) {
drop(std::make_shared<ItemInstance>(Item::apple, 1), true);
}
if (!level->getGameRules()->getBoolean(GameRules::RULE_KEEPINVENTORY)) {
@@ -2084,7 +2083,7 @@ void Player::causeFoodExhaustion(float amount) {
// 4J Stu - Added 1.8.2 bug fix (TU6) - If players cannot eat, then their
// food bar should not decrease due to exhaustion
if (GameHostOptions::get(eGameHostOption_TrustPlayers) == 0 &&
if (gameServices().getGameHostOption(eGameHostOption_TrustPlayers) == 0 &&
getPlayerGamePrivilege(Player::ePlayerGamePrivilege_CannotBuild) != 0)
return;
@@ -2390,7 +2389,7 @@ void Player::setPlayerGamePrivilege(unsigned int& uiGamePrivileges,
bool Player::isAllowedToUse(Tile* tile) {
bool allowed = true;
if (tile != nullptr &&
GameHostOptions::get(eGameHostOption_TrustPlayers) == 0) {
gameServices().getGameHostOption(eGameHostOption_TrustPlayers) == 0) {
allowed = false;
if (getPlayerGamePrivilege(
@@ -2461,7 +2460,7 @@ bool Player::isAllowedToUse(Tile* tile) {
bool Player::isAllowedToUse(std::shared_ptr<ItemInstance> item) {
bool allowed = true;
if (item != nullptr &&
GameHostOptions::get(eGameHostOption_TrustPlayers) == 0) {
gameServices().getGameHostOption(eGameHostOption_TrustPlayers) == 0) {
if (getPlayerGamePrivilege(Player::ePlayerGamePrivilege_CannotBuild) !=
0) {
allowed = false;
@@ -2505,7 +2504,7 @@ bool Player::isAllowedToUse(std::shared_ptr<ItemInstance> item) {
bool Player::isAllowedToInteract(std::shared_ptr<Entity> target) {
bool allowed = true;
if (GameHostOptions::get(eGameHostOption_TrustPlayers) == 0) {
if (gameServices().getGameHostOption(eGameHostOption_TrustPlayers) == 0) {
if (target->instanceof(eTYPE_MINECART)) {
if (getPlayerGamePrivilege(
Player::ePlayerGamePrivilege_CanUseContainers) == 0) {
@@ -2533,7 +2532,7 @@ bool Player::isAllowedToInteract(std::shared_ptr<Entity> target) {
bool Player::isAllowedToMine() {
bool allowed = true;
if (GameHostOptions::get(eGameHostOption_TrustPlayers) == 0) {
if (gameServices().getGameHostOption(eGameHostOption_TrustPlayers) == 0) {
if (getPlayerGamePrivilege(Player::ePlayerGamePrivilege_CannotMine) !=
0) {
allowed = false;
@@ -2545,7 +2544,7 @@ bool Player::isAllowedToMine() {
bool Player::isAllowedToAttackPlayers() {
bool allowed = true;
if (hasInvisiblePrivilege() ||
((GameHostOptions::get(eGameHostOption_TrustPlayers) == 0) &&
((gameServices().getGameHostOption(eGameHostOption_TrustPlayers) == 0) &&
getPlayerGamePrivilege(
Player::ePlayerGamePrivilege_CannotAttackPlayers))) {
allowed = false;
@@ -2555,7 +2554,7 @@ bool Player::isAllowedToAttackPlayers() {
bool Player::isAllowedToAttackAnimals() {
bool allowed = true;
if ((GameHostOptions::get(eGameHostOption_TrustPlayers) == 0) &&
if ((gameServices().getGameHostOption(eGameHostOption_TrustPlayers) == 0) &&
getPlayerGamePrivilege(
Player::ePlayerGamePrivilege_CannotAttackAnimals)) {
allowed = false;
@@ -2589,7 +2588,7 @@ bool Player::isAllowedToHurtEntity(std::shared_ptr<Entity> target) {
bool Player::isAllowedToFly() {
bool allowed = false;
if (GameHostOptions::get(eGameHostOption_HostCanFly) != 0 &&
if (gameServices().getGameHostOption(eGameHostOption_HostCanFly) != 0 &&
getPlayerGamePrivilege(Player::ePlayerGamePrivilege_CanFly) != 0) {
allowed = true;
}
@@ -2598,7 +2597,7 @@ bool Player::isAllowedToFly() {
bool Player::isAllowedToIgnoreExhaustion() {
bool allowed = false;
if ((GameHostOptions::get(eGameHostOption_HostCanChangeHunger) != 0 &&
if ((gameServices().getGameHostOption(eGameHostOption_HostCanChangeHunger) != 0 &&
getPlayerGamePrivilege(Player::ePlayerGamePrivilege_ClassicHunger) !=
0) ||
(isAllowedToFly() && abilities.flying)) {
@@ -2618,7 +2617,7 @@ bool Player::isAllowedToTeleport() {
bool Player::hasInvisiblePrivilege() {
bool enabled = false;
if (GameHostOptions::get(eGameHostOption_HostCanBeInvisible) != 0 &&
if (gameServices().getGameHostOption(eGameHostOption_HostCanBeInvisible) != 0 &&
getPlayerGamePrivilege(Player::ePlayerGamePrivilege_Invisible) != 0) {
enabled = true;
}
@@ -2627,7 +2626,7 @@ bool Player::hasInvisiblePrivilege() {
bool Player::hasInvulnerablePrivilege() {
bool enabled = false;
if (GameHostOptions::get(eGameHostOption_HostCanBeInvisible) != 0 &&
if (gameServices().getGameHostOption(eGameHostOption_HostCanBeInvisible) != 0 &&
getPlayerGamePrivilege(Player::ePlayerGamePrivilege_Invulnerable) !=
0) {
enabled = true;
@@ -2674,14 +2673,14 @@ std::vector<ModelPart*>* Player::GetAdditionalModelParts() {
customTextureUrl.substr(0, 3).compare(L"def") == 0;
// see if we can find the parts
m_ppAdditionalModelParts = GameServices::getAdditionalModelParts(m_dwSkinId);
m_ppAdditionalModelParts = gameServices().getAdditionalModelParts(m_dwSkinId);
// If it's a default texture (which has no parts), we have the parts, or
// we already have the texture (in which case we should have parts if
// there are any) then we are done
if (!hasCustomTexture || customTextureIsDefaultSkin ||
m_ppAdditionalModelParts != nullptr ||
GameServices::isFileInMemoryTextures(customTextureUrl)) {
gameServices().isFileInMemoryTextures(customTextureUrl)) {
m_bCheckedForModelParts = true;
}
if (m_ppAdditionalModelParts == nullptr &&
@@ -2696,7 +2695,7 @@ std::vector<ModelPart*>* Player::GetAdditionalModelParts() {
// do we have it from the DLC pack?
DLCSkinFile* pDLCSkinFile =
GameServices::getDLCManager().getSkinFile(this->customTextureUrl);
gameServices().getDLCSkinFile(this->customTextureUrl);
if (pDLCSkinFile != nullptr) {
const int additionalBoxCount =
@@ -2706,11 +2705,11 @@ std::vector<ModelPart*>* Player::GetAdditionalModelParts() {
"m_bCheckedForModelParts Got model parts from DLCskin "
"for skin %X\n",
m_dwSkinId);
m_ppAdditionalModelParts = GameServices::setAdditionalSkinBoxesFromVec(
m_ppAdditionalModelParts = gameServices().setAdditionalSkinBoxesFromVec(
m_dwSkinId, pDLCSkinFile->getAdditionalBoxes());
}
GameServices::setAnimOverrideBitmask(
gameServices().setAnimOverrideBitmask(
pDLCSkinFile->getSkinID(),
pDLCSkinFile->getAnimOverrideBitmask());

Some files were not shown because too many files have changed in this diff Show More