mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Merge remote-tracking branch 'upstream/develop' into new-plugin-system
This commit is contained in:
commit
191199d9de
@ -427,6 +427,13 @@ class Game:
|
|||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def get_culling_points(self):
|
||||||
|
"""
|
||||||
|
Check culling points
|
||||||
|
:return: List of culling points
|
||||||
|
"""
|
||||||
|
return self.__culling_points
|
||||||
|
|
||||||
# 1 = red, 2 = blue
|
# 1 = red, 2 = blue
|
||||||
def get_player_coalition_id(self):
|
def get_player_coalition_id(self):
|
||||||
return 2
|
return 2
|
||||||
|
|||||||
@ -51,8 +51,12 @@ class DisplayOptions:
|
|||||||
control_points = DisplayRule("Control Points", True)
|
control_points = DisplayRule("Control Points", True)
|
||||||
lines = DisplayRule("Lines", True)
|
lines = DisplayRule("Lines", True)
|
||||||
events = DisplayRule("Events", True)
|
events = DisplayRule("Events", True)
|
||||||
sam_ranges = DisplayRule("SAM Ranges", True)
|
sam_ranges = DisplayRule("Ally SAM Threat Range", False)
|
||||||
|
enemy_sam_ranges = DisplayRule("Enemy SAM Threat Range", True)
|
||||||
|
detection_range = DisplayRule("SAM Detection Range", False)
|
||||||
|
map_poly = DisplayRule("Map Polygon Debug Mode", False)
|
||||||
waypoint_info = DisplayRule("Waypoint Information", True)
|
waypoint_info = DisplayRule("Waypoint Information", True)
|
||||||
|
culling = DisplayRule("Display Culling Zones", False)
|
||||||
flight_paths = FlightPathOptions()
|
flight_paths = FlightPathOptions()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
@ -49,6 +49,8 @@ COLORS: Dict[str, QColor] = {
|
|||||||
"super_red": QColor(227, 32, 0),
|
"super_red": QColor(227, 32, 0),
|
||||||
|
|
||||||
"green": QColor(128, 186, 128),
|
"green": QColor(128, 186, 128),
|
||||||
|
"light_green": QColor(223, 255, 173),
|
||||||
|
"light_green_transparent": QColor(180, 255, 140, 50),
|
||||||
"bright_green": QColor(64, 200, 64),
|
"bright_green": QColor(64, 200, 64),
|
||||||
|
|
||||||
"black": QColor(0, 0, 0),
|
"black": QColor(0, 0, 0),
|
||||||
@ -59,6 +61,10 @@ COLORS: Dict[str, QColor] = {
|
|||||||
"night_overlay": QColor(12, 20, 69),
|
"night_overlay": QColor(12, 20, 69),
|
||||||
"dawn_dust_overlay": QColor(46, 38, 85),
|
"dawn_dust_overlay": QColor(46, 38, 85),
|
||||||
|
|
||||||
|
"grey": QColor(150, 150, 150),
|
||||||
|
"dark_grey": QColor(75, 75, 75),
|
||||||
|
"dark_dark_grey": QColor(48, 48, 48),
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CP_SIZE = 12
|
CP_SIZE = 12
|
||||||
|
|||||||
@ -4,8 +4,8 @@ import datetime
|
|||||||
import logging
|
import logging
|
||||||
from typing import List, Optional, Tuple
|
from typing import List, Optional, Tuple
|
||||||
|
|
||||||
from PySide2.QtCore import Qt
|
from PySide2.QtCore import Qt, QPointF
|
||||||
from PySide2.QtGui import QBrush, QColor, QPen, QPixmap, QWheelEvent
|
from PySide2.QtGui import QBrush, QColor, QPen, QPixmap, QWheelEvent, QPolygonF
|
||||||
from PySide2.QtWidgets import (
|
from PySide2.QtWidgets import (
|
||||||
QFrame,
|
QFrame,
|
||||||
QGraphicsItem,
|
QGraphicsItem,
|
||||||
@ -49,7 +49,7 @@ class QLiberationMap(QGraphicsView):
|
|||||||
# A tuple of (package index, flight index), or none.
|
# A tuple of (package index, flight index), or none.
|
||||||
self.selected_flight: Optional[Tuple[int, int]] = None
|
self.selected_flight: Optional[Tuple[int, int]] = None
|
||||||
|
|
||||||
self.setMinimumSize(800,600)
|
self.setMinimumSize(800, 600)
|
||||||
self.setMaximumHeight(2160)
|
self.setMaximumHeight(2160)
|
||||||
self._zoom = 0
|
self._zoom = 0
|
||||||
self.factor = 1
|
self.factor = 1
|
||||||
@ -99,8 +99,6 @@ class QLiberationMap(QGraphicsView):
|
|||||||
if self.game is not None:
|
if self.game is not None:
|
||||||
self.reload_scene()
|
self.reload_scene()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
Uncomment to set up theather reference points
|
Uncomment to set up theather reference points
|
||||||
@ -154,6 +152,17 @@ class QLiberationMap(QGraphicsView):
|
|||||||
# text = scene.addText(str(r), font=QFont("Trebuchet MS", 10, weight=5, italic=False))
|
# text = scene.addText(str(r), font=QFont("Trebuchet MS", 10, weight=5, italic=False))
|
||||||
# text.setPos(0, i * 24)
|
# text.setPos(0, i * 24)
|
||||||
|
|
||||||
|
# Display Culling
|
||||||
|
if DisplayOptions.culling and self.game.settings.perf_culling:
|
||||||
|
culling_points = self.game_model.game.get_culling_points()
|
||||||
|
culling_distance = self.game_model.game.settings.perf_culling_distance
|
||||||
|
for point in culling_points:
|
||||||
|
culling_distance_point = Point(point.x + culling_distance*1000, point.y + culling_distance*1000)
|
||||||
|
distance_point = self._transform_point(culling_distance_point)
|
||||||
|
transformed = self._transform_point(point)
|
||||||
|
diameter = distance_point[0] - transformed[0]
|
||||||
|
scene.addEllipse(transformed[0]-diameter/2, transformed[1]-diameter/2, diameter, diameter, CONST.COLORS["transparent"], CONST.COLORS["light_green_transparent"])
|
||||||
|
|
||||||
for cp in self.game.theater.controlpoints:
|
for cp in self.game.theater.controlpoints:
|
||||||
|
|
||||||
pos = self._transform_point(cp.position)
|
pos = self._transform_point(cp.position)
|
||||||
@ -175,14 +184,17 @@ class QLiberationMap(QGraphicsView):
|
|||||||
if ground_object.obj_name in added_objects:
|
if ground_object.obj_name in added_objects:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
||||||
go_pos = self._transform_point(ground_object.position)
|
go_pos = self._transform_point(ground_object.position)
|
||||||
if not ground_object.airbase_group:
|
if not ground_object.airbase_group:
|
||||||
buildings = self.game.theater.find_ground_objects_by_obj_name(ground_object.obj_name)
|
buildings = self.game.theater.find_ground_objects_by_obj_name(ground_object.obj_name)
|
||||||
scene.addItem(QMapGroundObject(self, go_pos[0], go_pos[1], 14, 12, cp, ground_object, self.game, buildings))
|
scene.addItem(QMapGroundObject(self, go_pos[0], go_pos[1], 14, 12, cp, ground_object, self.game, buildings))
|
||||||
|
|
||||||
is_aa = ground_object.category == "aa"
|
is_aa = ground_object.category == "aa"
|
||||||
if is_aa and DisplayOptions.sam_ranges:
|
should_display = ((DisplayOptions.sam_ranges and cp.captured)
|
||||||
|
or
|
||||||
|
(DisplayOptions.enemy_sam_ranges and not cp.captured))
|
||||||
|
|
||||||
|
if is_aa and should_display:
|
||||||
threat_range = 0
|
threat_range = 0
|
||||||
detection_range = 0
|
detection_range = 0
|
||||||
can_fire = False
|
can_fire = False
|
||||||
@ -205,8 +217,9 @@ class QLiberationMap(QGraphicsView):
|
|||||||
detection_radius = Point(*go_pos).distance_to_point(Point(*detection_pos))
|
detection_radius = Point(*go_pos).distance_to_point(Point(*detection_pos))
|
||||||
|
|
||||||
# Add detection range circle
|
# Add detection range circle
|
||||||
scene.addEllipse(go_pos[0] - detection_radius/2 + 7, go_pos[1] - detection_radius/2 + 6,
|
if DisplayOptions.detection_range:
|
||||||
detection_radius, detection_radius, self.detection_pen(cp.captured))
|
scene.addEllipse(go_pos[0] - detection_radius/2 + 7, go_pos[1] - detection_radius/2 + 6,
|
||||||
|
detection_radius, detection_radius, self.detection_pen(cp.captured))
|
||||||
|
|
||||||
# Add threat range circle
|
# Add threat range circle
|
||||||
scene.addEllipse(go_pos[0] - threat_radius / 2 + 7, go_pos[1] - threat_radius / 2 + 6,
|
scene.addEllipse(go_pos[0] - threat_radius / 2 + 7, go_pos[1] - threat_radius / 2 + 6,
|
||||||
@ -468,23 +481,38 @@ class QLiberationMap(QGraphicsView):
|
|||||||
def addBackground(self):
|
def addBackground(self):
|
||||||
scene = self.scene()
|
scene = self.scene()
|
||||||
|
|
||||||
bg = QPixmap("./resources/" + self.game.theater.overview_image)
|
if not DisplayOptions.map_poly:
|
||||||
scene.addPixmap(bg)
|
bg = QPixmap("./resources/" + self.game.theater.overview_image)
|
||||||
|
scene.addPixmap(bg)
|
||||||
|
|
||||||
|
# Apply graphical effects to simulate current daytime
|
||||||
|
if self.game.current_turn_daytime == "day":
|
||||||
|
pass
|
||||||
|
elif self.game.current_turn_daytime == "night":
|
||||||
|
ov = QPixmap(bg.width(), bg.height())
|
||||||
|
ov.fill(CONST.COLORS["night_overlay"])
|
||||||
|
overlay = scene.addPixmap(ov)
|
||||||
|
effect = QGraphicsOpacityEffect()
|
||||||
|
effect.setOpacity(0.7)
|
||||||
|
overlay.setGraphicsEffect(effect)
|
||||||
|
else:
|
||||||
|
ov = QPixmap(bg.width(), bg.height())
|
||||||
|
ov.fill(CONST.COLORS["dawn_dust_overlay"])
|
||||||
|
overlay = scene.addPixmap(ov)
|
||||||
|
effect = QGraphicsOpacityEffect()
|
||||||
|
effect.setOpacity(0.3)
|
||||||
|
overlay.setGraphicsEffect(effect)
|
||||||
|
|
||||||
# Apply graphical effects to simulate current daytime
|
|
||||||
if self.game.current_turn_daytime == "day":
|
|
||||||
pass
|
|
||||||
elif self.game.current_turn_daytime == "night":
|
|
||||||
ov = QPixmap(bg.width(), bg.height())
|
|
||||||
ov.fill(CONST.COLORS["night_overlay"])
|
|
||||||
overlay = scene.addPixmap(ov)
|
|
||||||
effect = QGraphicsOpacityEffect()
|
|
||||||
effect.setOpacity(0.7)
|
|
||||||
overlay.setGraphicsEffect(effect)
|
|
||||||
else:
|
else:
|
||||||
ov = QPixmap(bg.width(), bg.height())
|
# Polygon display mode
|
||||||
ov.fill(CONST.COLORS["dawn_dust_overlay"])
|
if self.game.theater.landmap is not None:
|
||||||
overlay = scene.addPixmap(ov)
|
|
||||||
effect = QGraphicsOpacityEffect()
|
for inclusion_zone in self.game.theater.landmap[0]:
|
||||||
effect.setOpacity(0.3)
|
poly = QPolygonF([QPointF(*self._transform_point(Point(point[0], point[1]))) for point in inclusion_zone])
|
||||||
overlay.setGraphicsEffect(effect)
|
scene.addPolygon(poly, CONST.COLORS["grey"], CONST.COLORS["dark_grey"])
|
||||||
|
|
||||||
|
for exclusion_zone in self.game.theater.landmap[1]:
|
||||||
|
poly = QPolygonF([QPointF(*self._transform_point(Point(point[0], point[1]))) for point in exclusion_zone])
|
||||||
|
scene.addPolygon(poly, CONST.COLORS["grey"], CONST.COLORS["dark_dark_grey"])
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
1
resources/dcs/beacons/thechannel.json
Normal file
1
resources/dcs/beacons/thechannel.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
[]
|
||||||
Loading…
x
Reference in New Issue
Block a user