Changeset - r21797:9309da181ed6
[Not reviewed]
master
0 1 0
peter1138 - 10 years ago 2014-09-30 11:35:21
peter1138@openttd.org
(svn r26942) -Codechange: Make sprite aligner useful for people making full-zoom graphics.
1 file changed with 6 insertions and 6 deletions:
0 comments (0 inline, 0 general)
src/newgrf_debug_gui.cpp
Show inline comments
 
@@ -820,26 +820,26 @@ struct SpriteAlignerWindow : Window {
 
	}
 

	
 
	virtual void SetStringParameters(int widget) const
 
	{
 
		switch (widget) {
 
			case WID_SA_CAPTION:
 
				SetDParam(0, this->current_sprite);
 
				SetDParamStr(1, FioGetFilename(GetOriginFileSlot(this->current_sprite)));
 
				break;
 

	
 
			case WID_SA_OFFSETS: {
 
				const Sprite *spr = GetSprite(this->current_sprite, ST_NORMAL);
 
				SetDParam(0, spr->x_offs / ZOOM_LVL_BASE);
 
				SetDParam(1, spr->y_offs / ZOOM_LVL_BASE);
 
				SetDParam(0, spr->x_offs);
 
				SetDParam(1, spr->y_offs);
 
				break;
 
			}
 

	
 
			default:
 
				break;
 
		}
 
	}
 

	
 
	virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
 
	{
 
		if (widget != WID_SA_LIST) return;
 

	
 
@@ -941,28 +941,28 @@ struct SpriteAlignerWindow : Window {
 
				 * No... I don't think it is useful to make this less of a hack.
 
				 *
 
				 * If you want to align sprites, you just need the number. Generally
 
				 * the sprite caches are big enough to not remove the sprite from the
 
				 * cache. If that's not the case, just let the NewGRF developer
 
				 * increase the cache size instead of storing thousands of offsets
 
				 * for the incredibly small chance that it's actually going to be
 
				 * used by someone and the sprite cache isn't big enough for that
 
				 * particular NewGRF developer.
 
				 */
 
				Sprite *spr = const_cast<Sprite *>(GetSprite(this->current_sprite, ST_NORMAL));
 
				switch (widget) {
 
					case WID_SA_UP:    spr->y_offs -= ZOOM_LVL_BASE; break;
 
					case WID_SA_DOWN:  spr->y_offs += ZOOM_LVL_BASE; break;
 
					case WID_SA_LEFT:  spr->x_offs -= ZOOM_LVL_BASE; break;
 
					case WID_SA_RIGHT: spr->x_offs += ZOOM_LVL_BASE; break;
 
					case WID_SA_UP:    spr->y_offs--; break;
 
					case WID_SA_DOWN:  spr->y_offs++; break;
 
					case WID_SA_LEFT:  spr->x_offs--; break;
 
					case WID_SA_RIGHT: spr->x_offs++; break;
 
				}
 
				/* Of course, we need to redraw the sprite, but where is it used?
 
				 * Everywhere is a safe bet. */
 
				MarkWholeScreenDirty();
 
				break;
 
			}
 
		}
 
	}
 

	
 
	virtual void OnQueryTextFinished(char *str)
 
	{
 
		if (StrEmpty(str)) return;
0 comments (0 inline, 0 general)