def update(self, markerType, pos, direction, sizeVector, relaxTime,
            collData):
     super(new_DefaultGunMarkerController,
           self).update(markerType, pos, direction, sizeVector, relaxTime,
                        collData)
     positionMatrix = Math.Matrix()
     positionMatrix.setTranslate(pos)
     self._updateMatrixProvider(positionMatrix, relaxTime)
     size = sizeVector[0]  # !!!
     replayCtrl = BattleReplay.g_replayCtrl
     if replayCtrl.isPlaying and replayCtrl.isClientReady:
         s = replayCtrl.getArcadeGunMarkerSize()
         if s != -1.0:
             size = s
     elif replayCtrl.isRecording:
         if replayCtrl.isServerAim and self._gunMarkerType == _MARKER_TYPE.SERVER:
             replayCtrl.setArcadeGunMarkerSize(size)
         elif self._gunMarkerType == _MARKER_TYPE.CLIENT:
             replayCtrl.setArcadeGunMarkerSize(size)
     worldMatrix = _makeWorldMatrix(positionMatrix)
     self.__curSize = _calcScale(worldMatrix,
                                 size) * self.__screenRatio * config.data[
                                     'DispersionCircleScale'] / 2.3  # !!!
     if self.__replSwitchTime > 0.0:
         self.__replSwitchTime -= relaxTime
         self._dataProvider.updateSize(self.__curSize, 0.0)
     else:
         self._dataProvider.updateSize(self.__curSize, relaxTime)
Exemplo n.º 2
0
    def update(self, markerType, pos, direction, sizeVector, relaxTime,
               collData):
        super(_DefaultGunMarkerController,
              self).update(markerType, pos, direction, sizeVector, relaxTime,
                           collData)
        positionMatrix = Math.Matrix()
        positionMatrix.setTranslate(pos)
        self._updateMatrixProvider(positionMatrix, relaxTime)

        # size = sizeVector[0]
        # idealSize = sizeVector[1]
        size = getFocusedSize(positionMatrix)
        idealSize = size

        # Those below lines of code have to be commented for dispersion gun markers.
        # Otherwise, this controller would:
        # - read current dispersion from replay controller, by this, it
        #   would override calculated focused dispersion in replays
        # - it would override gun dispersion of vanilla gun marker in
        #   replay file (undefined behavior, in replays it probably would
        #   display zero-size dispersion).
        #
        # replayCtrl = BattleReplay.g_replayCtrl
        # if replayCtrl.isPlaying and replayCtrl.isClientReady:
        #     s = replayCtrl.getArcadeGunMarkerSize()
        #     if s != -1.0:
        #         size = s
        # elif replayCtrl.isRecording:
        #     if replayCtrl.isServerAim and self._gunMarkerType == GUN_MARKER_TYPE_SERVER_FOCUS:
        #         replayCtrl.setArcadeGunMarkerSize(size)
        #     elif self._gunMarkerType == GUN_MARKER_TYPE_CLIENT_FOCUS:
        #         replayCtrl.setArcadeGunMarkerSize(size)

        positionMatrixForScale = self._DefaultGunMarkerController__checkAndRecalculateIfPositionInExtremeProjection(
            positionMatrix)
        worldMatrix = _makeWorldMatrix(positionMatrixForScale)
        currentSize = _calcScale(
            worldMatrix, size) * self._DefaultGunMarkerController__screenRatio
        idealSize = _calcScale(
            worldMatrix,
            idealSize) * self._DefaultGunMarkerController__screenRatio
        self._DefaultGunMarkerController__sizeFilter.update(
            currentSize, idealSize)
        self._DefaultGunMarkerController__curSize = self._DefaultGunMarkerController__sizeFilter.getSize(
        )
        if self._DefaultGunMarkerController__replSwitchTime > 0.0:
            self._DefaultGunMarkerController__replSwitchTime -= relaxTime
            self._dataProvider.updateSize(
                self._DefaultGunMarkerController__curSize, 0.0)
        else:
            self._dataProvider.updateSize(
                self._DefaultGunMarkerController__curSize, relaxTime)