File: nt_graph.c

package info (click to toggle)
xsystem35 2.17.0-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 8,096 kB
  • sloc: ansic: 38,159; java: 4,085; xml: 249; sh: 134; python: 15; makefile: 12
file content (198 lines) | stat: -rw-r--r-- 3,861 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
#include <stdio.h>
#include <SDL.h>

#include "portab.h"
#include "system.h"
#include "cg.h"
#include "ags.h"
#include "night.h"
#include "sprite.h"
#include "nt_scenario.h"
#include "sactcg.h"

// 壁紙スプライト表示位置
#define WALL_LOC_X 0
#define WALL_LOC_Y 0
// 風景スプライト表示位置
#define SCENERY_LOC_X 0
#define SCENERY_LOC_Y 64
// 顔スプライト表示位置
#define FACE_LOC_X 6
#define FACE_LOC_Y 272
// 立ち絵左スプライト表示位置
#define TACHI_L_LOC_X 0
#define TACHI_L_LOC_Y 0
// 立ち絵中央スプライト位置
#define TACHI_M_LOC_X 160
#define TACHI_M_LOC_Y 0
// 立ち絵右スプライト位置
#define TACHI_R_LOC_X 360
#define TACHI_R_LOC_Y 0

static int effecttime;

void nt_gr_init() {
}

void nt_gr_set_wallpaper(int no) {
	sprite_t *sp = night.sp[SPNO_WALL];
	
	if (sp) {
		nt_sp_remove_updatelist(sp);
		nt_sp_free(sp);
	}
	
	if (no == 1013 && nt_sco_is_natsu()) {
		no = 1011;
	}
	
	if (no == 1014 && nt_sco_is_natsu()) {
		no = 1012;
	}
	
	sp = nt_sp_new(SPNO_WALL, no, 0, 0, SPRITE_WP);
	nt_sp_add_updatelist(sp);
	if (no == 0) {
		sp->width  = main_surface->w;
		sp->height = main_surface->h;
		sp->update = nt_sp_draw_wall;
	}
	
	night.sp[SPNO_WALL] = sp;
}

void nt_gr_set_scenery(int no) {
	sprite_t *sp = night.sp[SPNO_SCENERY];

	if (sp) {
		nt_sp_remove_updatelist(sp);
		nt_sp_free(sp);
		sp = NULL;
	}

	if (no) {
		sp = nt_sp_new(SPNO_SCENERY, no, 0, 0, SPRITE_NORMAL);
		nt_sp_add_updatelist(sp);
		nt_sp_set_loc(sp, SCENERY_LOC_X, SCENERY_LOC_Y);
	}
	
	night.sp[SPNO_SCENERY] = sp;
}

void nt_gr_set_face(int no) {
	sprite_t *sp = night.sp[SPNO_FACE];
	
	if (sp) {
		nt_sp_remove_updatelist(sp);
		nt_sp_free(sp);
		sp = NULL;
	}
	if (no) {
		sp = nt_sp_new(SPNO_FACE, no, 0, 0, SPRITE_NORMAL);
		nt_sp_add_updatelist(sp);
		nt_sp_set_loc(sp, FACE_LOC_X, FACE_LOC_Y);
		night.msgplace = 2;
	} else {
		night.msgplace = 0;
	}
	night.sp[SPNO_FACE] = sp;
}

void nt_gr_set_spL(int no) {
	sprite_t *sp = night.sp[SPNO_TACHI_L];
	
	if (sp) {
		nt_sp_remove_updatelist(sp);
		nt_sp_free(sp);
		sp = NULL;
	}
	if (no) {
		sp = nt_sp_new(SPNO_TACHI_L, no, 0, 0, SPRITE_NORMAL);
		nt_sp_add_updatelist(sp);
		nt_sp_set_loc(sp, TACHI_L_LOC_X, TACHI_L_LOC_Y);
	}
	night.sp[SPNO_TACHI_L] = sp;
}

void nt_gr_set_spM(int no) {
	sprite_t *sp = night.sp[SPNO_TACHI_M];
	
	if (sp) {
		nt_sp_remove_updatelist(sp);
		nt_sp_free(sp);
		sp = NULL;
	}
	if (no) {
		sp = nt_sp_new(SPNO_TACHI_M, no, 0, 0, SPRITE_NORMAL);
		nt_sp_add_updatelist(sp);
		nt_sp_set_loc(sp, TACHI_M_LOC_X, TACHI_M_LOC_Y);
	}
	night.sp[SPNO_TACHI_M] = sp;
}

void nt_gr_set_spR(int no) {
	sprite_t *sp = night.sp[SPNO_TACHI_R];

	if (sp) {
		nt_sp_remove_updatelist(sp);
		nt_sp_free(sp);
		sp = NULL;
	}
	if (no) {
		sp = nt_sp_new(SPNO_TACHI_R, no, 0, 0, SPRITE_NORMAL);
		nt_sp_add_updatelist(sp);
		nt_sp_set_loc(sp, TACHI_R_LOC_X, TACHI_R_LOC_Y);
	}
	night.sp[SPNO_TACHI_R] = sp;
}

void nt_gr_set_spsL(int no) {
	if (no) {
		if (nt_sco_is_natsu()) no++;
	}
	nt_gr_set_spL(no);
}

void nt_gr_set_spsM(int no) {
	if (no) {
		if (nt_sco_is_natsu()) no++;
	}
	nt_gr_set_spM(no);
}

void nt_gr_set_spsR(int no) {
	if (no) {
		if (nt_sco_is_natsu()) no++;
	}
	nt_gr_set_spR(no);
}

void nt_gr_set_drawtime(int msec) {
	effecttime = msec;
}

void nt_gr_draw(int effectno) {
	switch(effectno) {
	case 0:
		// 全消し
		break;
	case 1:
		nt_sp_update_all(true);
		break;
	default:
		if (night.waitskiplv > 1) {
			nt_sp_update_all(true);
			break;
		}
		//nt_sp_eupdate(effectno, effecttime, true);
		nt_sp_eupdate(effectno, 1000, true);
	}
}

void nt_gr_screencg(int no, int x, int y) {
	SDL_Surface *sf = cg_load_as_sdlsurface(no - 1);
	SDL_SetSurfaceBlendMode(sf, SDL_BLENDMODE_ADD);
	SDL_BlitSurface(sf, NULL, main_surface, &(SDL_Rect){x, y, sf->w, sf->h});
	ags_updateArea(x, y, sf->w, sf->h);
	SDL_FreeSurface(sf);
}