8 #include "texture_handler.h"
9 #include "KeybindingScreen.h"
15 texture_handlerst texture
;
17 long movie_version
= 10001;
20 int mt_index
[MT_BUFFER_NUM
];
22 short mt_virtual_buffer
;
23 unsigned long mt_buffer
[MT_BUFFER_NUM
][MT_LEN
];
25 char filecomp_buffer2_aux
[80000];
26 char filecomp_buffer_aux
[20000];
28 string errorlog_prefix
;
31 bool tetriminoes
[7][2][4] =
32 {{{0,0,0,0},{1,1,1,1}},
33 {{1,0,0,0},{1,1,1,0}},
34 {{0,0,0,1},{0,1,1,1}},
35 {{0,1,1,0},{0,1,1,0}},
36 {{0,0,1,1},{0,1,1,0}},
37 {{0,0,1,0},{0,1,1,1}},
38 {{1,1,0,0},{0,1,1,0}}};
41 int x
, y
; // Location of the topmost character. y may be negative.
46 class Matrix
: public viewscreenst
{
48 typedef list
<line
>::iterator lit
;
51 string
random_string(int len
) {
53 for (int i
=0; i
<len
; i
++)
54 s
[i
] = basic_random(256);
61 virtual void feed(set
<InterfaceKey
> &events
) {
62 if (events
.count(INTERFACEKEY_D_PAUSE
))
63 breakdownlevel
= INTERFACE_BREAKDOWN_STOPSCREEN
;
65 virtual void render() {
66 drawborder("Matrix", 1, 0);
67 for (lit i
= lines
.begin(); i
!= lines
.end(); ++i
) {
68 for (int j
= 0; j
< i
->s
.size(); ++j
) {
71 if (x
< gps
.dimx
&& y
> 0 && y
< gps
.dimy
)
72 gps
.addchar(i
->x
, i
->y
+ j
, i
->s
[j
], i
->color
, 0, 0);
76 virtual void logic() {
77 if ((frame
++) % 2) return;
78 // if (enabler.tracking_on)
79 // cout << gps.mouse_x << " " << gps.mouse_y << endl;
80 enabler
.flag
|= ENABLERFLAG_RENDER
;
81 // Advance each line one step
82 for (lit i
= lines
.begin(); i
!= lines
.end();) {
83 if ((++(i
->y
)) >= gps
.dimy
)
88 // Maybe add a new line
89 if (basic_random(100) < 30) {
91 l
.x
= basic_random(gps
.dimx
);
92 int len
= basic_random(gps
.dimy
);
94 l
.s
= random_string(len
);
95 l
.color
= basic_random(7) + 1;
98 // Pretend this takes a while
100 // Uint32 start = SDL_GetTicks();
101 // while (SDL_GetTicks() - start < 3);
103 virtual void resize(int w
, int h
) {
104 // Clear out lines that are now off-screen
105 for (lit i
= lines
.begin(); i
!= lines
.end();) {
106 if (i
->x
>= w
|| i
->y
>= h
)
114 char beginroutine() {
116 gview
.addscreen(new Matrix
, INTERFACE_PUSH_AT_BACK
, NULL
);
117 // viewscreen_movieplayerst *m = viewscreen_movieplayerst::create(INTERFACE_PUSH_AT_BACK);
118 // m->force_play("data/initial_movies/test.cmv");
129 void dwarf_help_routine() {
132 void dwarf_end_announcements() {
135 void dwarf_option_screen() {
136 new KeybindingScreen();
139 void dwarf_remove_screen() {
142 void texture_handlerst::clean() {
145 void finishscrolling(int32_t &selection
,int32_t min
,int32_t max
,int32_t jump
,uint32_t flag
,char littlekey
) {}
146 char standardscrolling(std::set
<InterfaceKey
> &events
,short &selection
,int32_t min
,int32_t max
,int32_t jump
,uint32_t flag
) {}
147 char standardscrolling(std::set
<InterfaceKey
> &events
,int32_t &selection
,int32_t min
,int32_t max
,int32_t jump
,uint32_t flag
) {}
148 char secondaryscrolling(std::set
<InterfaceKey
> &events
,short &scroll
,int32_t min
,int32_t max
,int32_t jump
,uint32_t flag
) {}
149 char secondaryscrolling(std::set
<InterfaceKey
> &events
,int32_t &scroll
,int32_t min
,int32_t max
,int32_t jump
,uint32_t flag
) {}
151 void process_object_lines(textlinesst
&lines
, string
&chktype
, string
&graphics_dir
) {
154 void drawborder(const char *str
, char style
, const char *color
) {
157 gps
.changecolor(7,7,0);
158 for (int x
=0; x
< gps
.dimx
; x
++) {
161 gps
.locate(gps
.dimy
-1, x
);
164 for (int y
=1; y
< gps
.dimy
-1; y
++) {
167 gps
.locate(y
, gps
.dimx
-1);
172 // gps.locate(0, MAX((gps.dimx - strlen(str)) / 2,0));
173 gps
.locate(0, gps
.dimx
/2);
175 gps
.addcoloredst(str
, color
);
177 gps
.changecolor(7,0,1);
178 // Uint32 now = SDL_GetTicks() % 3000;
179 // gps.addst(str, now < 1000 ? justify_left : now < 2000 ? justify_center : justify_right);
180 gps
.addst(str
, justify_center
);
184 void viewscreenst::help() { }
186 bool viewscreenst::key_conflict(InterfaceKey k
) { return false; }