diff --git a/src/dots.c b/src/dots.c
index d89b9d6122fd359742141cf17d219cbeaa99e2df..b9ca8ec7104913b821402546238821ead00226a9 100644 (file)
--- a/src/dots.c
+++ b/src/dots.c
*/
#include "glob.h"
+#include <stdio.h>
#include <stdlib.h>
-#include "vga.h"
#include "view.h"
#include "dots.h"
#include "misc.h"
+#include "my.h"
#define MAXINI 50
#define MAXSR 20
#define SP_MINT 5
#define SP_MAXT 7
-extern byte z_dot;
-
-#pragma pack(1)
-typedef struct{
- obj_t o;
- byte c,t;
-}dot_t;
-#pragma pack()
-
typedef struct{
int xv,yv;
byte c,t;
}init_t;
-static dot_t dot[MAXDOT];
+dot_t dot[MAXDOT];
+
static init_t bl_ini[MAXINI],sp_ini[MAXINI];
static int bl_r,sp_r,sr_r,sxr[MAXSR],syr[MAXSR];
static int ldot;
-void DOT_savegame(FILE* h) {
- int i,n;
-
- for(i=n=0;i<MAXDOT;++i) if(dot[i].t) ++n;
- myfwrite(&n,1,4,h);
- for(i=0;i<MAXDOT;++i) if(dot[i].t) myfwrite(&dot[i],1,sizeof(dot_t),h);
+void DOT_savegame (FILE *h) {
+ int i, n;
+ for (i = n = 0; i < MAXDOT; ++i) {
+ if (dot[i].t) {
+ ++n;
+ }
+ }
+ myfwrite32(n, h);
+ for (i = 0; i < MAXDOT; ++i) {
+ if (dot[i].t) {
+ myfwrite32(dot[i].o.x, h);
+ myfwrite32(dot[i].o.y, h);
+ myfwrite32(dot[i].o.xv, h);
+ myfwrite32(dot[i].o.yv, h);
+ myfwrite32(dot[i].o.vx, h);
+ myfwrite32(dot[i].o.vy, h);
+ myfwrite32(dot[i].o.r, h);
+ myfwrite32(dot[i].o.h, h);
+ myfwrite8(dot[i].c, h);
+ myfwrite8(dot[i].t, h);
+ }
+ }
}
-void DOT_loadgame(FILE* h) {
- int n;
-
- myfread(&n,1,4,h);
- myfread(dot,1,n*sizeof(dot_t),h);
+void DOT_loadgame (FILE *h) {
+ int i, n;
+ n = myfread32(h);
+ for (i = 0; i < n; i++) {
+ dot[i].o.x = myfread32(h);
+ dot[i].o.y = myfread32(h);
+ dot[i].o.xv = myfread32(h);
+ dot[i].o.yv = myfread32(h);
+ dot[i].o.vx = myfread32(h);
+ dot[i].o.vy = myfread32(h);
+ dot[i].o.r = myfread32(h);
+ dot[i].o.h = myfread32(h);
+ dot[i].c = myfread8(h);
+ dot[i].t = myfread8(h);
+ }
}
void DOT_init(void) {
z_dot=0;
}
-void DOT_draw(void) {
- int i;
-
- for(i=0;i<MAXDOT;++i)
- if(dot[i].t) V_dot(dot[i].o.x-w_x+WD/2,dot[i].o.y-w_y+HT/2+1+w_o,dot[i].c);//if(dot[i].t) V_dot(dot[i].o.x-w_x+100,dot[i].o.y-w_y+50+w_o,dot[i].c);
-}
-
void DOT_add(int x,int y,char xv,char yv,byte c,byte t) {
int i;