def create(self, mapName): global _V_START_POS global _V_START_ANGLES try: LOG_DEBUG('OfflineMapCreator.Create( %s )' % mapName) g_appLoader.showBattle() cfgType = 'basic' self.__loadCfg(cfgType, mapName) BigWorld.worldDrawEnabled(False) BigWorld.setWatcher('Visibility/GUI', False) self.__spaceId = BigWorld.createSpace() self.__isActive = True self.__arenaTypeID = self._arenaTypeIDByArenaName.get(mapName) self.__accountID = BigWorld.createEntity('Account', self.__spaceId, 0, _V_START_POS, (_V_START_ANGLES[2], _V_START_ANGLES[1], _V_START_ANGLES[0]), dict()) self.__spaceMappingId = BigWorld.addSpaceGeometryMapping(self.__spaceId, None, 'spaces/' + mapName) self.__vEntityId = BigWorld.createEntity('Avatar', self.__spaceId, 0, _V_START_POS, (_V_START_ANGLES[2], _V_START_ANGLES[1], _V_START_ANGLES[0]), dict()) BigWorld.player(BigWorld.entities[self.__vEntityId]) self.__setupCamera() BigWorld.worldDrawEnabled(True) except: LOG_DEBUG('OfflineMapCreator.Create( %s ): FAILED with: ' % mapName) LOG_CURRENT_EXCEPTION() self.cancel() return
def create(self, mapName): global _V_START_POS global _V_START_ANGLES try: LOG_DEBUG('OfflineMapCreator.Create( %s )' % mapName) g_appLoader.showBattlePage() cfgType = 'basic' self.__loadCfg(cfgType, mapName) BigWorld.worldDrawEnabled(False) BigWorld.setWatcher('Visibility/GUI', False) self.__spaceId = BigWorld.createSpace() self.__isActive = True self.__arenaTypeID = self.__getArenaTypeId(mapName) self.__spaceMappingId = BigWorld.addSpaceGeometryMapping(self.__spaceId, None, 'spaces/' + mapName) self.__vEntityId = BigWorld.createEntity('Avatar', self.__spaceId, 0, _V_START_POS, (_V_START_ANGLES[2], _V_START_ANGLES[1], _V_START_ANGLES[0]), {}) avatar = BigWorld.entities[self.__vEntityId] avatar.arenaUniqueID = 0 avatar.arenaTypeID = self.__arenaTypeID avatar.arenaBonusType = constants.ARENA_BONUS_TYPE.UNKNOWN avatar.arenaGuiType = constants.ARENA_GUI_TYPE.UNKNOWN avatar.arenaExtraData = {} avatar.weatherPresetID = 0 BigWorld.player(avatar) self.__setupCamera() BigWorld.worldDrawEnabled(True) except: LOG_DEBUG('OfflineMapCreator.Create( %s ): FAILED with: ' % mapName) LOG_CURRENT_EXCEPTION() self.cancel() return
def cancel(self): self.__spaceId = 0 self.__spaceMappingId = 0 self.__vEntityId = 0 self.__isActive = False BigWorld.setWatcher('Visibility/GUI', True) BigWorld.worldDrawEnabled(True)
def launch(spaceName): global g_enablePostProcessing global g_offlineModeEnabled print 'Entering offline space', spaceName BigWorld.clearAllSpaces() BigWorld.worldDrawEnabled(False) _displayGUI(spaceName) spaceID = BigWorld.createSpace() BigWorld.addSpaceGeometryMapping(spaceID, None, spaceName) _loadCameraTransforms() camera = BigWorld.FreeCamera() camera.spaceID = spaceID BigWorld.camera(camera) _setCameraTransform(g_curCameraTransform) BigWorld.camera().fixed = True BigWorld.projection().fov = math.radians(75.0) BigWorld.setWatcher('Client Settings/Strafe Rate', 175.0) BigWorld.setWatcher('Client Settings/Camera Mass', 5.0) BigWorld.setCursor(GUI.mcursor()) GUI.mcursor().visible = True GUI.mcursor().clipped = False g_offlineModeEnabled = True BigWorld.callback(1.0, _offlineLoadCheck) g_postProcessing.init() _enablePostProcessing(g_enablePostProcessing, 'arcade') return
def destroy(self): try: LOG_DEBUG('OfflineMapCreator.destroy()') self.__isActive = False BigWorld.worldDrawEnabled(False) BigWorld.setWatcher('Visibility/GUI', True) self.__spaceMappingId = 0 BigWorld.cameraSpaceID(0) BigWorld.camera(None) self.__cam = None BigWorld.clearEntitiesAndSpaces() MapActivities.g_mapActivities.stop() if self.__spaceId and BigWorld.isClientSpace(self.__spaceId): if self.__spaceMappingId: BigWorld.delSpaceGeometryMapping(self.__spaceId, self.__spaceMappingId) BigWorld.clearSpace(self.__spaceId) BigWorld.releaseSpace(self.__spaceId) self.__spaceId = 0 self.__spaceMappingId = 0 self.__arenaTypeID = 0 self.__vEntityId = 0 BigWorld.worldDrawEnabled(True) except: LOG_DEBUG('OfflineMapCreator.destroy(): FAILED with: ') LOG_CURRENT_EXCEPTION() self.cancel() return
def adjustSpeed(diff): global g_currentMoveRate g_currentMoveRate = max(0.1, g_currentMoveRate + diff) strafeRate = float(BigWorld.getWatcher('Client Settings/Strafe Rate')) strafeRate = 1.0 + math.pow(g_currentMoveRate, MOVE_SPEED_POW) * MOVE_SPEED_MAX BigWorld.setWatcher('Client Settings/Strafe Rate', strafeRate)
def launch(spaceName): global g_offlineModeEnabled print 'Entering offline space', spaceName BigWorld.clearAllSpaces() BigWorld.worldDrawEnabled(False) _displayGUI(spaceName) spaceID = BigWorld.createSpace() visibilityMask = game_mode_emulator.gameModeVisibilityMask() BigWorld.addSpaceGeometryMapping(spaceID, None, spaceName, visibilityMask) _loadCameraTransforms() camera = BigWorld.FreeCamera() camera.spaceID = spaceID BigWorld.camera(camera) _setCameraTransform(g_curCameraTransform) BigWorld.camera().fixed = True BigWorld.projection().fov = math.radians(75.0) BigWorld.setWatcher('Client Settings/Strafe Rate', 175.0) BigWorld.setWatcher('Client Settings/Camera Mass', 5.0) BigWorld.setCursor(GUI.mcursor()) GUI.mcursor().visible = True GUI.mcursor().clipped = False g_offlineModeEnabled = True BigWorld.callback(1.0, _offlineLoadCheck) createFakeAvatar() return
def start(mapName): print 'mod_OfflineMode: start' if not OfflineMode.enabled(): for x in GUI.roots(): GUI.delRoot(x) OfflineMode.launch(mapName) BigWorld.setWatcher('Visibility/GUI', True)
def start(mapName): print 'mod_OfflineMode: start' if not OfflineMode.enabled(): for x in GUI.roots(): GUI.delRoot(x) WWISE.WW_eventGlobal('loginscreen_mute') OfflineMode.launch(mapName) BigWorld.setWatcher('Visibility/GUI', True)
def destroy(self): try: LOG_DEBUG('OfflineMapCreator.destroy()') self.__isActive = False BigWorld.worldDrawEnabled(False) BigWorld.setWatcher('Visibility/GUI', True) self.__spaceMappingId = 0 BigWorld.cameraSpaceID(0) BigWorld.camera(None) self.__cam = None BigWorld.clearEntitiesAndSpaces() BigWorld.releaseSpace(self.__spaceId) self.__spaceId = 0 self.__arenaTypeID = 0 accountId = 0 self.__vEntityId = 0 BigWorld.worldDrawEnabled(True) except: LOG_DEBUG('OfflineMapCreator.destroy(): FAILED with: ') LOG_CURRENT_EXCEPTION() self.cancel()
def enable(self, doEnable): if self.__isEnabled == doEnable: return if not doEnable: self.__isEnabled = False BigWorld.camera(self.__savedCamera) BigWorld.wg_enableSuperShot(False, False) for (k, v,) in self.__savedWatchers.iteritems(): BigWorld.setWatcher(k, v) LOG_DEBUG('Vertical screenshot camera is disabled') return self.__isEnabled = True self.__savedCamera = BigWorld.camera() arenaBB = BigWorld.wg_getSpaceBounds() centerXZ = Math.Vector2(0.5 * (arenaBB[0] + arenaBB[2]), 0.5 * (arenaBB[1] + arenaBB[3])) halfSizesXZ = Math.Vector2(0.5 * (arenaBB[2] - arenaBB[0]), 0.5 * (arenaBB[3] - arenaBB[1])) camFov = math.radians(15.0) camPos = Math.Vector3(centerXZ.x, 0, centerXZ.z) aspectRatio = 1.0 if not BigWorld.isVideoWindowed(): aspectRatio = BigWorld.getFullScreenAspectRatio() else: aspectRatio = BigWorld.screenWidth() / BigWorld.screenHeight() camPos.y = max(halfSizesXZ.x / math.sin(0.5 * camFov * aspectRatio), halfSizesXZ.y / math.sin(0.5 * camFov)) camMatr = Math.Matrix() camMatr.setRotateYPR(Math.Vector3(0.0, math.pi * 0.5, 0.0)) camMatr.translation = camPos camMatr.invert() self.__cam = BigWorld.FreeCamera() self.__cam.set(camMatr) BigWorld.camera(self.__cam) BigWorld.wg_enableSuperShot(True, False) self.__savedWatchers = {} for name in self.__watcherNames: self.__savedWatchers[name] = BigWorld.getWatcher(name) if name.startswith('Visibility'): BigWorld.setWatcher(name, False) BigWorld.setWatcher('Client Settings/std fog/enabled', False) BigWorld.setWatcher('Render/Fov', camFov) BigWorld.setWatcher('Render/Near Plane', max(0.1, camPos.y - 1000.0)) BigWorld.setWatcher('Render/Far Plane', camPos.y + 1000.0) BigWorld.setWatcher('Render/Objects Far Plane/Enabled', False) BigWorld.setWatcher('Render/Shadows/dynamicEnabled', False) BigWorld.setWatcher('Render/Shadows/dynamicViewDistanceTo', 1000000) BigWorld.setWatcher('Client Settings/Script tick', False) LOG_DEBUG('Vertical screenshot camera is enabled')
def enable(self, doEnable): if self.__isEnabled == doEnable: return from cameras import FovExtended if not doEnable: self.__isEnabled = False BigWorld.camera(self.__savedCamera) BigWorld.wg_enableSuperShot(False, False) for k, v in self.__savedWatchers.iteritems(): BigWorld.setWatcher(k, v) FovExtended.instance().enabled = True LOG_DEBUG('Vertical screenshot camera is disabled') return self.__isEnabled = True self.__savedCamera = BigWorld.camera() FovExtended.instance().enabled = False arenaBB = BigWorld.wg_getSpaceBounds() centerXZ = Math.Vector2(0.5 * (arenaBB[0] + arenaBB[2]), 0.5 * (arenaBB[1] + arenaBB[3])) halfSizesXZ = Math.Vector2(0.5 * (arenaBB[2] - arenaBB[0]), 0.5 * (arenaBB[3] - arenaBB[1])) camFov = math.radians(15.0) camPos = Math.Vector3(centerXZ.x, 0, centerXZ.z) aspectRatio = 1.0 if not BigWorld.isVideoWindowed(): aspectRatio = BigWorld.getFullScreenAspectRatio() else: aspectRatio = BigWorld.screenWidth() / BigWorld.screenHeight() camPos.y = max(halfSizesXZ.x / math.sin(0.5 * camFov * aspectRatio), halfSizesXZ.y / math.sin(0.5 * camFov)) camMatr = Math.Matrix() camMatr.setRotateYPR(Math.Vector3(0.0, math.pi * 0.5, 0.0)) camMatr.translation = camPos camMatr.invert() self.__cam = BigWorld.FreeCamera() self.__cam.set(camMatr) BigWorld.camera(self.__cam) BigWorld.wg_enableSuperShot(True, False) self.__savedWatchers = {} for name in self.__watcherNames: try: self.__savedWatchers[name] = BigWorld.getWatcher(name) if name.startswith('Visibility'): BigWorld.setWatcher(name, False) except TypeError: LOG_WARNING('Failed to get/set watcher', name) BigWorld.setWatcher('Client Settings/std fog/enabled', False) BigWorld.projection().fov = camFov BigWorld.setWatcher('Render/Fov', camFov) BigWorld.setWatcher('Render/Near Plane', max(0.1, camPos.y - 1000.0)) BigWorld.setWatcher('Render/Far Plane', camPos.y + 1000.0) BigWorld.setWatcher('Render/Objects Far Plane/Enabled', False) BigWorld.setWatcher('Render/Shadows/qualityPreset', 7) BigWorld.setWatcher('Client Settings/Script tick', False) LOG_DEBUG('Vertical screenshot camera is enabled')
def onDisableUmbraMode( item ): """ Sets both Umbra and the useUmbra Option so that the game will start in the last set state """ BigWorld.setWatcher( "Render/Umbra/enabled", 0 ) WorldEditor.setOptionInt( "render/useUmbra", 0)
def enable(self, doEnable): if self.__isEnabled == doEnable: return from cameras import FovExtended if not doEnable: self.__isEnabled = False BigWorld.camera(self.__savedCamera) BigWorld.wg_enableSuperShot(False, False) for k, v in self.__savedWatchers.iteritems(): BigWorld.setWatcher(k, v) FovExtended.instance().enabled = True BigWorld.projection().nearPlane = self.__nearPlane BigWorld.projection().farPlane = self.__farPlane BigWorld.setWatcher('Render/Fog/enabled', True) BigWorld.setWatcher('Occlusion Culling/Enabled', True) BigWorld.setWatcher('Render/Terrain/AdaptiveMesh/cascades enabled', True) BigWorld.setWatcher('Render/Water/out land water', True) LOG_DEBUG('Vertical screenshot camera is disabled') return self.__isEnabled = True self.__savedCamera = BigWorld.camera() FovExtended.instance().enabled = False arenaBB = BigWorld.player().arena.arenaType.spaceBoundingBox centerXZ = Math.Vector2(0.5 * (arenaBB[0][0] + arenaBB[1][0]), 0.5 * (arenaBB[0][1] + arenaBB[1][1])) halfSizesXZ = Math.Vector2(0.5 * (arenaBB[1][0] - arenaBB[0][0]), 0.5 * (arenaBB[1][1] - arenaBB[0][1])) camFov = math.radians(15.0) camPos = Math.Vector3(centerXZ.x, 0, centerXZ.z) aspectRatio = BigWorld.getAspectRatio() camPos.y = max(halfSizesXZ.x / math.sin(0.5 * camFov * aspectRatio), halfSizesXZ.y / math.sin(0.5 * camFov)) camMatr = Math.Matrix() camMatr.setRotateYPR(Math.Vector3(0.0, math.pi * 0.5, 0.0)) camMatr.translation = camPos camMatr.invert() self.__cam = BigWorld.FreeCamera() self.__cam.set(camMatr) BigWorld.camera(self.__cam) BigWorld.wg_enableSuperShot(True, False) self.__savedWatchers = {} for name in self.__watcherNames: try: self.__savedWatchers[name] = BigWorld.getWatcher(name) if name.startswith('Visibility'): BigWorld.setWatcher(name, False) except TypeError: LOG_WARNING('Failed to get/set watcher', name) self.__nearPlane = BigWorld.projection().nearPlane self.__farPlane = BigWorld.projection().farPlane BigWorld.setWatcher('Render/Fog/enabled', False) BigWorld.projection().fov = camFov BigWorld.projection().nearPlane = max(0.1, camPos.y - 1000.0) BigWorld.projection().farPlane = camPos.y + 1000 BigWorld.setWatcher('Render/Shadows/qualityPreset', 4) BigWorld.setWatcher('Client Settings/Script tick', False) BigWorld.setWatcher('Occlusion Culling/Enabled', False) BigWorld.setWatcher('Render/Terrain/AdaptiveMesh/cascades enabled', False) BigWorld.setWatcher('Render/Water/out land water', False) LOG_DEBUG('Vertical screenshot camera is enabled')
def onDisableUmbraMode(item): """ Sets both Umbra and the useUmbra Option so that the game will start in the last set state """ BigWorld.setWatcher("Render/Umbra/enabled", 0) WorldEditor.setOptionInt("render/useUmbra", 0)