This repository has been archived by the owner on Jun 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
api.txt
446 lines (384 loc) · 9.51 KB
/
api.txt
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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
A file to document the ''api''
+===============+
| Logic |
+===============+
+---------------+
Structs
+---------------+
Game-user
|-name
|-level
|-room
|-inventory
|-started-quests
|-finished-quests
|-items-collected
|_kills
Bounding-box
|-x
|-y
|-width
|_height
t-object
|-x
|-y
|-width
|-height
|-vector
|-acceleration
|-friction
|-mass
|_bounding-box
entity
|-PARENT:T-OBJECT
|-name
|-attack
|-attack-mod
|-defense
|-defense-mod
|-range-attack
|-range-attack-mod
|-magic-attack
|-magic-attack-mod
|-magic-defense
|-magic-defense-mod
|-agility
|-agility-mod
|-speed
|-speed-mod
|-dodge
|-dodge-mod
|-hp
|-max-hp
|-mp
|-max-mp
|-xp
|-level
|-elemental
|-status
|-extra-effect ;;unsure of implementation
|-symbol
|-line-of-sight
|-weapon
|-armor
|-sprite-sheet
|-bg-color
|-symbol-color
|-current-cell
|_score
Level
|-name
|-type
|-music
|-battle-chance
|-creatures
|-sheet-surface
|_rooms
Area
|-name
|-array
|-texture
|-transitions
|-connected-areas
|-connected-level
|_spring
Quest
|-name
|-started
|-goals
|-finished
|-type
|_reward
Goal
|-enemy
|-to-kill
|-killed
|-item
|-to-acquire
|-acquired
|-location
|-arrived
|-person
|_talked
Inventory
|-weapons
|-armor
|-items
|-weight
|-max-weight
|-max-items
|-max-weapons
|_max-armor
Item
|-name
|-type
|-target
|-class
|-can-equip
|-attack
|-defense
|-agility
|-restore
|-cost
|-amount
|-weight
|-information
|_symbol
Spell
|-name
|-cost
|-level
|-target
|_effect
Vector-3d
|-x
|-y
|_z
+++++physics+++++
Joint
|_PARENT: t-object
Soft-body
|-PARENT: t-object
|-joints
|_shape
+---------------+
Functions
+---------------+
(test-point-collision A B C) ;;checks to see if A is between B and C
(test-bb-collision entity-a entity-b)
(point-within-bounding-box point bounding-box) ;; tests to see if a point (x y) is within a bounding-box
(within-bounding-box x y bounding-box)
(move-entity entity &key FRICTION)
(stop-moving entity)
(ascii-to-string CODE) ;;ascii-code = from 0 to 255
(right-triangle a b)
(rad->degrees RADS &key EQUATION) ;;equation: one of 'sin 'cos 'tan
(find-angle a b &key EQUATION) ;;uses 2 numbers, creates a right-triangle of them, then finds the angle (in degrees)
+++++vectors+++++
(vector-3d-add VECTOR-A VECTOR-B) ;;returns values of (+ (vector-3d-x VECTOR-A) (vector-3d-x VECTOR-B))
(vector-3d-sub VECTOR-A VECTOR-B) ;;returns values of (- (vector-3d-x VECTOR-A) (vector-3d-x VECTOR-B))
(scalar-multiply VECTOR-A SCALAR) ;;returns values of (* (vector-3d-x/y/z VECTOR-A) SCALAR), rounded down/up if positve/negative (4.2 = 4, -4.2 = -4)
(vector-3d-dot VECTOR-A VECTOR-B) ;;returns dot product of VECTOR-A VECTOR-B
(set-vector-3d-values VECTOR-A VECTOR-B &key FUNCTION SCALAR)
+++++physics+++++
(calculate-force OBJECT-STRUCTURE)
(apply-force OBJECT-STRUCTURE &key COLLIDED-OBJECT FORCE)
(velocity OBJECT-STRUCTURE &key DIMENSIONS)
(draw-joints SOFT-BODY)
+---------------+
Variables
+---------------+
+++++physics+++++
*gravity*
+---------------+
Macros
+---------------+
(define-level VARIABLE &key NAME TYPE MUSIC BATTLE-CHANCE CREATURES)
(define-area HASH-SYMBOL LEVEL &key NAME ARRAY TRANSITIONS CONNECTED-AREAS CONNECTED-LEVEL SPRING)
(define-goal &key ENEMY TO-KILL ITEM TO-ACQUIRE LOCATION PERSON)
(define-quest &key NAME GOALS TYPE REWARD)
(finish-quest QUEST)
(defweapon ..)
(defarmor ..)
(defpotion ..)
(defspell VAR SPELL_NAME COST ELEMENT &key LEVEL-REQUIREMENT TARGET EFFECT SPELL-LEVEL)
(decrease-hp TARGET AMOUNT)
+===============+
| Audio |
+===============+
+---------------+
Structs
+---------------+
Sample
|-Path
|_(TODO:) sound | more descriptive than 'sound', like sound-object
Track
|-Path
|-Stream
|_Loop-point
+---------------+
Functions
+---------------+
(play-sound SOUND_PATH CHANNEL);;needs fixing
(free-sound SOUND_OBJECT)
(loop-track TRACK) ;;currently unimplemented correctly
(start-level-music MUSIC_STRUCTURE)
(pause-music) ;;pauses all music
(stop-music) ;;hard stops all music
(free-music TRACK) ;;frees a music stream (track-stream TRACK)
(resume-music) ;;resumes music after PAUSE
(start-game-music) ;;Does it /really/ need to be a function?
(test-music) ;;called within the main game loop, checks VOLUME-STATE ('increasing 'decreasing or 'track-changing)
(lower-volume DELTA) ;;lowers the max-volume for everything (extra volumes will be implemented) by DELTA, an integer (whole number)
(raise-volume DELTA) ;;raises max-volume for everything by DELTA
+---------------+
Variables
+---------------+
max-volume
+track-volume+
+---------------+
Macros
+---------------+
(define-track TRACK_NAME PATH_TO_MUSIC &key :LOOP-POINT (default 0))
+===============+
| Graphics |
+===============+
+---------------+
Structs
+---------------+
Menu
|-x
|-x-equation (uses the original value of X)
|-y
|-y-equation (uses the original value of Y)
|-width
|-width-equation (uses the original value of WIDTH)
|-height
|-height-equation (uses the original value of HEIGHT)
|-border-color
|_fill-color
sprite-sheet
|-width
|-height
|-cells
|-file
|-surface
|_texture
+---------------+
Functions
+---------------+
(combine-strings FIRST_STRING &rest STRINGS) ;;the &rest feature puts everything past that point into a list. Combines the strings into a single string and returns a string
(start-string FIRST_STRING &rest STRINGS) ;;adds a new line to the end of each string and returns a string
(render-character-to-buffer ..) ;;for use ONLY with (create-text-buffer ..)
(create-text-buffer STRING &key WIDTH HEIGHT TO-TEXTURE STRING-CASE) ;;Oh boy. So, the width and height should be how many characters you want in each direction
(font-to-surface ..) ;;Unimplemented, skeleton code for TTF support
(draw-menu MENU)
(update-window-size) ;;only call when you are changing *screen-width* and/or *screen-height*
(render-box X Y WIDTH HEIGHT &key COLOR)
+---------------+
Variables
+---------------+
+font-sheet+ ;;recommendation: don't mess with this variable. Just replace font.png with what bitmap font you like. Eventually, I'll add in true-type font support (.ttf), but for now, I'm not going to. Anti-aliasing is more important at this point
|Paramaters| ;;can be changed, but will need a permanent 'fixture' to keep them changed. They are there to help facilitate faster prototyping
character-size ;;the size of the characters for the font sheet
+black+
+white+
+pastel-grey+
+dark-pastel-grey+
+pastel-dark-grey+
+red+
+dark-red+
+green+
+blue+
+yellow+
+pastel-red+
+dark-pastel-red+
+pastel-green+
+pastel-blue+
+pastel-yellow+
+aqua+
+purple-jade+
+cobalt+
+yellow-zinc+
+chalk-white+
+brown+
+natural-green+
+dark-natural-green+
+navy-blue+
+steel-blue+
+dark-steel-blue+
menus
tile-buffer ;;Deprecated, unused by the engine, overwrite if you want to
+---------------+
Macros
+---------------+
(define-menu MENU_NAME SCREEN_MENUS X Y WIDTH HEIGHT BORDER_COLOR FILL_COLOR)
(define-screen SCREEN_NAME SCREEN_MENUS) ;; (screen-name) would be called first in, say (render-level) or (render-options)
(define-buffer BUFFER) ;;DEPRECATED DON'T USE
(with-rectangle NAME (list X Y WIDTH HEIGHT) BODY) ;; a 'wrapper' to facilitate faster development
(create-rectangle (list X Y WIDTH HEIGHT)) ;;makes a rectangle
(defsheet ENTITY FILE '(CELL-WIDTH CELL-HEIGHT))
[/USED BY DEFSHEET]
(optimize-sheet SHEET)
(set-sheet-width sheet width)
(set-sheet-height sheet height)
(set-cells sheet tile-size)
[/]
(tex-blit TEXTURE &key SOURCE_RECTANGLE DESTINATION_RECTANGLE COLOR ANGLE CENTER FLIP)
(draw-cell SHEET CELL X Y &key WIDTH HEIGHT COLOR ANGLE CENTER FLIP)
(free-sheet SHEET)
(reset-text-buffer TEXT_BUFFER)
(draw-rectangle X Y WIDTH HEIGHT COLOR)
+===============+
| Input |
+===============+
A word about input
Making a simpler way to deal with Input was...a giant fucking pain in the ass
I'm going to eventually make it simpler/faster to add keys and mouse buttons (controller support is PLANNED, but is on hold for the time being)
Currently, to add a key you will need to prepend 'scancode-' to whatever key you want, so :down is :scancode-down, :x is :scancode-x, :enter is :scancode-return
It's a limitation I'm going to fix in the future. I think having to type in 'scancode' before each and every damn key is ridiculous. that's 8, EIGHT!, characters, meaning 200 key definitions (for the different states) becomes 1600 unnecessary keystrokes. Who the hell made that decision, the people who made the lisp package system?
+---------------+
Structs
+---------------+
modifier-states
|-control
|-meta
|_shift
^don't worry about dealing with the modifier-states, just use meta-t (alt), control-t, and shift-t to test whether those buttons are pressed along with another key
+---------------+
Functions
+---------------+
(mouse-button-check BUTTON)
(mouse-button-release BUTTON)
(mouse-move BUTTON-STATE X Y XREL YREL)
(meta-t)
(alt-t)
(control-t)
(shift-t)
(quit-game) ;;move this
(exit-to-main-menu)
(go-to-options)
(change-selection DIRECTION &key MAX-ROW MAX-COLUMN)
(keydown-check KEY)
(keydown-check KEY)
+---------------+
Variables
+---------------+
*mouse-x*
*mouse-y*
*mouse-velocity-x*
*mouse-velocity-y*
modifier-states
*selection-column*
*selection-row*
+===============+
| LOOPS |
+===============+
+---------------+
Functions
+---------------+
(process-loop)
(pause-game)
(resume-game)
(render-state)
(process-changing-state)
+---------------+
Variables
+---------------+
+transition-box-alpha+
+transition-state+
+===============+
| Template |
+===============+
+---------------+
Structs
+---------------+
+---------------+
Functions
+---------------+
+---------------+
Variables
+---------------+
+---------------+
Macros
+---------------+