mirror of
https://github.com/jmarshall23/CnC_Remastered_Collection.git
synced 2026-08-12 08:00:55 +02:00
Display tile cache is now complete for render icons. External code now compiles with optimizations.
This commit is contained in:
+5
-1
@@ -6,7 +6,8 @@ enable_language(ASM)
|
||||
set(CMAKE_CXX_FLAGS "")
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../)
|
||||
set(CMAKE_VERBOSE_MAKEFILE ON)
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "/MTd /Od /Ob0 /Zi /DDEBUG /D_DEBUG")
|
||||
SET(CMAKE_C_FLAGS_DEBUG "/MTd /Od /Ob0 /Zi /DDEBUG /D_DEBUG")
|
||||
|
||||
set(src_launcher
|
||||
./launcher/launcher_main.cpp
|
||||
@@ -728,6 +729,9 @@ set(FFmpeg_LIBRARIES
|
||||
"${CMAKE_SOURCE_DIR}/external/ffmpeg-win64/lib/swscale.lib")
|
||||
|
||||
if (MSVC)
|
||||
# External always compiles with optimizations enabled.
|
||||
set_source_files_properties(${src_external} PROPERTIES COMPILE_FLAGS "/O2")
|
||||
|
||||
add_definitions(-D RA_AF -DCHEAT_KEYS -DIMGUI_IMPL_OPENGL_LOADER_GLEW -DSCENARIO_EDITOR -DWINDOWS_IGNORE_PACKING_MISMATCH -DTRUE_FALSE_DEFINED -DWIN32 -DWINDOWS -DENGLISH -D_USRDLL -DREDALERT_EXPORTS)
|
||||
add_compile_options(/permissive+ /Zc:forScope- /Zp1)
|
||||
endif(MSVC)
|
||||
|
||||
+19
-29
@@ -205,6 +205,8 @@ DisplayClass::DisplayClass(void) :
|
||||
{
|
||||
ShadowShapes = 0;
|
||||
TransIconset = 0;
|
||||
cellDisplayCache = NULL;
|
||||
numCachedDisplayCells = 0;
|
||||
|
||||
Set_View_Dimensions(0, 8 * RESFACTOR, ScreenWidth, ScreenHeight);
|
||||
}
|
||||
@@ -596,6 +598,11 @@ void DisplayClass::Set_View_Dimensions(int x, int y, int width, int height)
|
||||
TacViewportRect.Y2 += (MapCellY * CELL_PIXEL_H);
|
||||
}
|
||||
|
||||
if (cellDisplayCache == NULL) {
|
||||
cellDisplayCache = new CellCache_t[MAP_CELL_W * MAP_CELL_H];
|
||||
}
|
||||
numCachedDisplayCells = 0;
|
||||
|
||||
/*
|
||||
** Adjust the tactical cell if it is now in an invalid position
|
||||
** because of the changed dimensions.
|
||||
@@ -1886,6 +1893,7 @@ ObjectClass * DisplayClass::Cell_Object(CELL cell, int x, int y) const
|
||||
|
||||
void DisplayClass::CacheVisibleCells(void) {
|
||||
IsShadowPresent = false;
|
||||
numCachedDisplayCells = 0;
|
||||
for (int y = -Coord_YLepton(TacticalCoord); y <= TacLeptonHeight; y += CELL_LEPTON_H) {
|
||||
for (int x = -Coord_XLepton(TacticalCoord); x <= TacLeptonWidth; x += CELL_LEPTON_W) {
|
||||
COORDINATE coord = Coord_Add(TacticalCoord, XY_Coord(x, y));
|
||||
@@ -1896,22 +1904,22 @@ void DisplayClass::CacheVisibleCells(void) {
|
||||
continue;
|
||||
|
||||
/*
|
||||
** Only cells flagged to be redraw are examined.
|
||||
** Only cells flagged to be redraw are examined.
|
||||
*/
|
||||
int xpixel;
|
||||
int ypixel;
|
||||
|
||||
if (Coord_To_Pixel(coord, xpixel, ypixel)) {
|
||||
CellClass* cellptr = &(*this)[coord];
|
||||
if (cellptr->Is_Mapped(PlayerPtr) || Debug_Unshroud) {
|
||||
if ((cellptr->Is_Mapped(PlayerPtr) && cellptr->Is_Visible(PlayerPtr)) || Debug_Unshroud) {
|
||||
cellptr->visibleFrame = g_startFrameTime;
|
||||
cellptr->x_world_pos = xpixel;
|
||||
cellptr->y_world_pos = ypixel;
|
||||
cellDisplayCache[numCachedDisplayCells++].ptr = cellptr;
|
||||
}
|
||||
|
||||
if (!cellptr->Is_Visible(PlayerPtr) && !Debug_Unshroud) {
|
||||
else {
|
||||
IsShadowPresent = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2177,18 +2185,9 @@ void DisplayClass::CacheVisibleCells(void) {
|
||||
*=============================================================================================*/
|
||||
void DisplayClass::Redraw_Icons(void)
|
||||
{
|
||||
for (int y = -Coord_YLepton(TacticalCoord); y <= TacLeptonHeight; y += CELL_LEPTON_H) {
|
||||
for (int x = -Coord_XLepton(TacticalCoord); x <= TacLeptonWidth; x += CELL_LEPTON_W) {
|
||||
COORDINATE coord = Coord_Add(TacticalCoord, XY_Coord(x, y));
|
||||
CELL cell = Coord_Cell(coord);
|
||||
coord = Coord_Whole(Cell_Coord(cell));
|
||||
|
||||
CellClass* cellptr = &(*this)[coord];
|
||||
if (cellptr->visibleFrame != g_startFrameTime)
|
||||
continue;
|
||||
|
||||
cellptr->Draw_It(cellptr->x_world_pos, cellptr->y_world_pos);
|
||||
}
|
||||
for (int i = 0; i < numCachedDisplayCells; i++) {
|
||||
CellClass* cellptr = cellDisplayCache[i].ptr;
|
||||
cellptr->Draw_It(cellptr->x_world_pos, cellptr->y_world_pos);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2196,18 +2195,9 @@ void DisplayClass::Redraw_Icons(void)
|
||||
#ifdef SORTDRAW
|
||||
void DisplayClass::Redraw_OIcons(void)
|
||||
{
|
||||
for (int y = -Coord_YLepton(TacticalCoord); y <= TacLeptonHeight; y += CELL_LEPTON_H) {
|
||||
for (int x = -Coord_XLepton(TacticalCoord); x <= TacLeptonWidth; x += CELL_LEPTON_W) {
|
||||
COORDINATE coord = Coord_Add(TacticalCoord, XY_Coord(x, y));
|
||||
CELL cell = Coord_Cell(coord);
|
||||
coord = Coord_Whole(Cell_Coord(cell));
|
||||
|
||||
CellClass* cellptr = &(*this)[coord];
|
||||
if (cellptr->visibleFrame != g_startFrameTime)
|
||||
continue;
|
||||
|
||||
cellptr->Draw_It(cellptr->x_world_pos, cellptr->y_world_pos, true);
|
||||
}
|
||||
for (int i = 0; i < numCachedDisplayCells; i++) {
|
||||
CellClass* cellptr = cellDisplayCache[i].ptr;
|
||||
cellptr->Draw_It(cellptr->x_world_pos, cellptr->y_world_pos, true);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -61,6 +61,13 @@ struct Image_t;
|
||||
|
||||
extern COORDINATE Coord_Add(COORDINATE coord1, COORDINATE coord2);
|
||||
|
||||
struct CellCache_t {
|
||||
CellCache_t() {
|
||||
ptr = NULL;
|
||||
}
|
||||
CellClass* ptr;
|
||||
};
|
||||
|
||||
|
||||
class DisplayClass: public MapClass
|
||||
{
|
||||
@@ -255,6 +262,8 @@ class DisplayClass: public MapClass
|
||||
|
||||
protected:
|
||||
void CacheVisibleCells(void);
|
||||
CellCache_t* cellDisplayCache;
|
||||
int numCachedDisplayCells;
|
||||
|
||||
/*
|
||||
** If it is currently in rubber band mode (multi unit selection), then this
|
||||
|
||||
Reference in New Issue
Block a user