@@ -334,47 +334,42 @@ 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)
342+ // first UpSideDown
343343 const auto usd0 = clientUsdTriangleVertices (0 , y);
344344 DrawTriangle (display, displayRect, myMap, type, myMap.getVertex (usd0.p1x , usd0.p1y ),
345345 myMap.getVertex (usd0.p2x , usd0.p2y ), myMap.getVertex (usd0.p3x , usd0.p3y ));
346346 for (unsigned x = std::max (col_start, 1 ); x < width - 1u && x <= static_cast <unsigned >(col_end); x++)
347347 {
348- // RightSideUp (same in both conventions)
348+ // RightSideUp
349349 DrawTriangle (display, displayRect, myMap, type, myMap.getVertex (x, y),
350350 myMap.getVertex (x - 1 , y + 1 ), myMap.getVertex (x, y + 1 ));
351- // UpSideDown (s25client convention)
351+ // UpSideDown
352352 const auto usd = clientUsdTriangleVertices (x, y);
353353 DrawTriangle (display, displayRect, myMap, type, myMap.getVertex (usd.p1x , usd.p1y ),
354354 myMap.getVertex (usd.p2x , usd.p2y ), myMap.getVertex (usd.p3x , usd.p3y ));
355355 }
356356 // 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)
357+ DrawTriangle (display, displayRect, myMap, type, myMap.getVertex (width - 1 , y),
358+ myMap.getVertex (width - 2 , y + 1 ),
359+ myMap.getVertex (width - 1 , y + 1 ));
360+ // last UpSideDown
361+ tempP3 = myMap.getVertex (0 , y);
362+ tempP3.x = myMap.getVertex (width - 1 , y).x + triangleWidth;
363+ DrawTriangle (display, displayRect, myMap, type, myMap.getVertex (width - 1 , y + 1 ),
364+ myMap.getVertex (width - 1 , y), tempP3);
370365 } else
371366 {
372367 for (unsigned x = col_start; x < width - 1u && x <= static_cast <unsigned >(col_end); x++)
373368 {
374- // RightSideUp (same in both conventions)
369+ // RightSideUp
375370 DrawTriangle (display, displayRect, myMap, type, myMap.getVertex (x, y),
376371 myMap.getVertex (x, y + 1 ), myMap.getVertex (x + 1 , y + 1 ));
377- // UpSideDown (s25client convention)
372+ // UpSideDown
378373 const auto usd = clientUsdTriangleVertices (x, y);
379374 DrawTriangle (display, displayRect, myMap, type, myMap.getVertex (usd.p1x , usd.p1y ),
380375 myMap.getVertex (usd.p2x , usd.p2y ), myMap.getVertex (usd.p3x , usd.p3y ));
@@ -384,17 +379,12 @@ void CSurface::DrawTriangleField(SDL_Surface* display, const DisplayRectangle& d
384379 tempP3.x = myMap.getVertex (width - 1 , y + 1 ).x + triangleWidth;
385380 DrawTriangle (display, displayRect, myMap, type, myMap.getVertex (width - 1 , y),
386381 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
382+ // last UpSideDown
383+ tempP1 = myMap.getVertex (0 , y + 1 );
384+ tempP1.x = myMap.getVertex (width - 1 , y + 1 ).x + triangleWidth;
385+ tempP3 = myMap.getVertex (0 , y);
386+ tempP3.x = myMap.getVertex (width - 1 , y).x + triangleWidth;
387+ DrawTriangle (display, displayRect, myMap, type, tempP1, myMap.getVertex (width - 1 , y), tempP3);
398388 }
399389 }
400390
0 commit comments