some fixes to video init/deinit
[k8vacspelynky.git] / mapent / MapTileBG.vc
blob30ebf07a108f1cf2c14b7edaada833e4f139f90c
1 /**********************************************************************************
2  * Copyright (c) 2008, 2009 Derek Yu and Mossmouth, LLC
3  * Copyright (c) 2010, Moloch
4  * Copyright (c) 2018, Ketmar Dark
5  *
6  * This file is part of Spelunky.
7  *
8  * You can redistribute and/or modify Spelunky, including its source code, under
9  * the terms of the Spelunky User License.
10  *
11  * Spelunky is distributed in the hope that it will be entertaining and useful,
12  * but WITHOUT WARRANTY.  Please see the Spelunky User License for more details.
13  *
14  * The Spelunky User License should be available in "Game Information", which
15  * can be found in the Resource Explorer, or as an external file called COPYING.
16  * If not, please obtain a new copy of Spelunky from <http://spelunkyworld.com/>
17  *
18  **********************************************************************************/
19 class MapBackTile : MapEntity;
21 transient BackTileImage bgt;
22 name bgtName;
23 // tile coords in `bgt`
24 int tx0, ty0;
25 int w = 16, h = 16;
27 //WARNING! destroying back tile WILL BREAK A LIST
28 MapBackTile next; // in various lists
30 override int width () { return w; }
31 override int height () { return h; }
34 override void onLoaded () {
35   ::onLoaded();
36   if (bgtName) {
37     //writeln("BGT: ", bgtName);
38     bgt = level.bgtileStore[bgtName];
39   }
43 override void drawWithOfs (int xpos, int ypos, int scale, float currFrameDelta) {
44   if (w < 1 || h < 1 || scale < 1) return;
45   xpos = x0*scale-xpos;
46   ypos = y0*scale-ypos;
47   bgt.tex.blitExt(xpos, ypos, xpos+w*scale, ypos+h*scale, tx0, ty0, tx0+w, ty0+h);
51 defaultproperties {
52   objName = 'oBackTile';
53   objType = 'oBackTile';
54   depth = 10100; // > is further