@@ -334,47 +334,34 @@ void CSurface::DrawTriangleField(SDL_Surface* display, const DisplayRectangle& d
334334 {
335335 if (y % 2 == 0 )
336336 {
337- // first RightSideUp (edge wrap)
337+ // first RightSideUp
338338 tempP2 = myMap.getVertex (width - 1 , y + 1 );
339339 tempP2.x = 0 ;
340340 DrawTriangle (display, displayRect, myMap, type, myMap.getVertex (0 , y), tempP2,
341341 myMap.getVertex (0 , y + 1 ));
342- // first UpSideDown (s25client convention, visual column 0)
343- const auto usd0 = clientUsdTriangleVertices (0 , y);
344- DrawTriangle (display, displayRect, myMap, type, myMap.getVertex (usd0.p1x , usd0.p1y ),
345- myMap.getVertex (usd0.p2x , usd0.p2y ), myMap.getVertex (usd0.p3x , usd0.p3y ));
346- for (unsigned x = std::max (col_start, 1 ); x < width - 1u && x <= static_cast <unsigned >(col_end); x++)
342+ for (unsigned x = std::max (col_start, 1 ); x < width && x <= static_cast <unsigned >(col_end); x++)
347343 {
348- // RightSideUp (same in both conventions)
344+ // RightSideUp
349345 DrawTriangle (display, displayRect, myMap, type, myMap.getVertex (x, y),
350346 myMap.getVertex (x - 1 , y + 1 ), myMap.getVertex (x, y + 1 ));
351- // UpSideDown (s25client convention)
352- const auto usd = clientUsdTriangleVertices (x, y);
347+ // UpSideDown
348+ const auto usd = clientUsdTriangleVertices (x - 1 , y);
353349 DrawTriangle (display, displayRect, myMap, type, myMap.getVertex (usd.p1x , usd.p1y ),
354350 myMap.getVertex (usd.p2x , usd.p2y ), myMap.getVertex (usd.p3x , usd.p3y ));
355351 }
356- // last RightSideUp
357- DrawTriangle (display, displayRect, myMap, type, myMap.getVertex (static_cast <int >(width) - 1 , y),
358- myMap.getVertex (static_cast <int >(width) - 2 , static_cast <int >(y) + 1 ),
359- myMap.getVertex (static_cast <int >(width) - 1 , static_cast <int >(y) + 1 ));
360- // last UpSideDown (wrap edge, s25client convention)
361- // Visual column width-1, source vertex = width-1, P3 wraps to 0
362- const int sx = clientUsdX (static_cast <int >(width) - 1 , static_cast <int >(y));
363- const int sx_p3 = (sx + 1 >= static_cast <int >(width)) ? sx + 1 - static_cast <int >(width) : sx + 1 ;
364- MapNode tP3 = myMap.getVertex (sx_p3, y);
365- tP3.x = myMap.getVertex (sx, y).x + triangleWidth;
366- DrawTriangle (display, displayRect, myMap, type,
367- myMap.getVertex (sx, y + 1 ), // P1 = bottom-left (even y: y&1=0)
368- myMap.getVertex (sx, y), // P2 = top
369- tP3); // P3 = bottom-right, wrapped to (0,y)
352+ // last UpSideDown
353+ tempP3 = myMap.getVertex (0 , y);
354+ tempP3.x = myMap.getVertex (width - 1 , y).x + triangleWidth;
355+ DrawTriangle (display, displayRect, myMap, type, myMap.getVertex (width - 1 , y + 1 ),
356+ myMap.getVertex (width - 1 , y), tempP3);
370357 } else
371358 {
372359 for (unsigned x = col_start; x < width - 1u && x <= static_cast <unsigned >(col_end); x++)
373360 {
374- // RightSideUp (same in both conventions)
361+ // RightSideUp
375362 DrawTriangle (display, displayRect, myMap, type, myMap.getVertex (x, y),
376363 myMap.getVertex (x, y + 1 ), myMap.getVertex (x + 1 , y + 1 ));
377- // UpSideDown (s25client convention)
364+ // UpSideDown
378365 const auto usd = clientUsdTriangleVertices (x, y);
379366 DrawTriangle (display, displayRect, myMap, type, myMap.getVertex (usd.p1x , usd.p1y ),
380367 myMap.getVertex (usd.p2x , usd.p2y ), myMap.getVertex (usd.p3x , usd.p3y ));
@@ -384,17 +371,12 @@ void CSurface::DrawTriangleField(SDL_Surface* display, const DisplayRectangle& d
384371 tempP3.x = myMap.getVertex (width - 1 , y + 1 ).x + triangleWidth;
385372 DrawTriangle (display, displayRect, myMap, type, myMap.getVertex (width - 1 , y),
386373 myMap.getVertex (width - 1 , y + 1 ), tempP3);
387- // last UpSideDown (wrap edge, s25client convention)
388- const int sx = clientUsdX (static_cast <int >(width) - 1 , static_cast <int >(y));
389- const int sx1_w = (sx + 1 >= static_cast <int >(width)) ? sx + 1 - static_cast <int >(width) : sx + 1 ;
390- MapNode tP1 = myMap.getVertex (sx1_w, y + 1 );
391- tP1.x = myMap.getVertex (sx, y + 1 ).x + triangleWidth;
392- MapNode tP3 = myMap.getVertex (sx1_w, y);
393- tP3.x = myMap.getVertex (sx, y).x + triangleWidth;
394- DrawTriangle (display, displayRect, myMap, type,
395- tP1, // P1 = bottom-left (odd y: y&1=1)
396- myMap.getVertex (sx, y), // P2 = top
397- tP3); // P3 = bottom-right, wrapped
374+ // last UpSideDown
375+ tempP1 = myMap.getVertex (0 , y + 1 );
376+ tempP1.x = myMap.getVertex (width - 1 , y + 1 ).x + triangleWidth;
377+ tempP3 = myMap.getVertex (0 , y);
378+ tempP3.x = myMap.getVertex (width - 1 , y).x + triangleWidth;
379+ DrawTriangle (display, displayRect, myMap, type, tempP1, myMap.getVertex (width - 1 , y), tempP3);
398380 }
399381 }
400382
0 commit comments