1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #include "glk/tads/tads2/error.h"
24 #include "glk/tads/tads2/os.h"
25 #include "glk/tads/tads2/run.h"
26 #include "glk/tads/tads2/tokenizer.h"
27 #include "glk/tads/tads2/vocabulary.h"
28 
29 
30 namespace Glk {
31 namespace TADS {
32 namespace TADS2 {
33 
34 static runcxdef *runctx;
35 static voccxdef *vocctx;
36 static tiocxdef *tioctx;
37 
runstat(void)38 void runstat(void)
39 {
40 	objnum  locobj;
41 	int     savemoremode;
42 
43 	/* get the location of the Me object */
44 	runppr(runctx, vocctx->voccxme, PRP_LOCATION, 0);
45 
46 	/* if that's no an object, there's nothing we can do */
47 	if (runtostyp(runctx) != DAT_OBJECT)
48 	{
49 		rundisc(runctx);
50 		return;
51 	}
52 
53 	/* get Me.location */
54 	locobj = runpopobj(runctx);
55 
56 	/* flush any pending output */
57 	outflushn(0);
58 
59 	/* switch to output display mode 1 (status line) */
60 	os_status(1);
61 
62 	/* turn off MORE mode */
63 	savemoremode = setmore(0);
64 
65 	/* call the statusLine method of the current room */
66 	runppr(runctx, locobj, PRP_STATUSLINE, 0);
67 
68 	/* if we're in the status line, make sure the line gets flushed */
69 	if (os_get_status() != 0)
70 		tioputs(tioctx, "\\n");
71 	outflushn(0);
72 
73 	/* restore the previous MORE mode */
74 	setmore(savemoremode);
75 
76 	/* switch to output display mode 0 (main text area) */
77 	os_status(0);
78 }
79 
runistat(voccxdef * vctx,runcxdef * rctx,tiocxdef * tctx)80 void runistat(voccxdef *vctx, runcxdef *rctx, tiocxdef *tctx)
81 {
82 	runctx = rctx;
83 	vocctx = vctx;
84 	tioctx = tctx;
85 }
86 
87 } // End of namespace TADS2
88 } // End of namespace TADS
89 } // End of namespace Glk
90