mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-09-09 15:30:42 +02:00
Move Newtonian gravity into a new file
This commit is contained in:
committed by
Simon Robertshaw
parent
20dd54f36e
commit
934d1da66e
@@ -2,24 +2,6 @@
|
||||
#define AIR_H
|
||||
#include "defines.h"
|
||||
|
||||
extern float gravmap[YRES/CELL][XRES/CELL]; //Maps to be used by the main thread
|
||||
extern float gravx[YRES/CELL][XRES/CELL];
|
||||
extern float gravy[YRES/CELL][XRES/CELL];
|
||||
extern float gravp[YRES/CELL][XRES/CELL];
|
||||
extern float *gravpf;
|
||||
extern float *gravxf;
|
||||
extern float *gravyf;
|
||||
extern unsigned gravmask[YRES/CELL][XRES/CELL];
|
||||
|
||||
extern float th_ogravmap[YRES/CELL][XRES/CELL]; // Maps to be processed by the gravity thread
|
||||
extern float th_gravmap[YRES/CELL][XRES/CELL];
|
||||
extern float th_gravx[YRES/CELL][XRES/CELL];
|
||||
extern float th_gravy[YRES/CELL][XRES/CELL];
|
||||
extern float *th_gravpf;
|
||||
extern float *th_gravxf;
|
||||
extern float *th_gravyf;
|
||||
extern float th_gravp[YRES/CELL][XRES/CELL];
|
||||
|
||||
extern float vx[YRES/CELL][XRES/CELL], ovx[YRES/CELL][XRES/CELL];
|
||||
extern float vy[YRES/CELL][XRES/CELL], ovy[YRES/CELL][XRES/CELL];
|
||||
extern float pv[YRES/CELL][XRES/CELL], opv[YRES/CELL][XRES/CELL];
|
||||
@@ -39,13 +21,6 @@ void make_kernel(void);
|
||||
|
||||
void update_airh(void);
|
||||
|
||||
void update_grav(void);
|
||||
|
||||
#ifdef GRAVFFT
|
||||
void grav_fft_init();
|
||||
void grav_fft_cleanup();
|
||||
#endif
|
||||
|
||||
void update_air(void);
|
||||
|
||||
#endif
|
||||
|
@@ -149,7 +149,6 @@ int GRAV_G2;
|
||||
int GRAV_B2;
|
||||
|
||||
extern int legacy_enable;
|
||||
extern int ngrav_enable; //Newtonian gravity
|
||||
extern int sound_enable;
|
||||
extern int kiosk_enable;
|
||||
extern int aheat_enable;
|
||||
@@ -251,7 +250,5 @@ void clear_sim(void);
|
||||
void del_stamp(int d);
|
||||
void sdl_seticon(void);
|
||||
void play_sound(char *file);
|
||||
void start_grav_async(void);
|
||||
void stop_grav_async(void);
|
||||
int set_scale(int scale, int kiosk);
|
||||
#endif
|
||||
|
@@ -3,6 +3,7 @@
|
||||
// This header should be included by all files in src/elements/
|
||||
|
||||
#include "powder.h"
|
||||
#include "gravity.h"
|
||||
#include "misc.h"
|
||||
#include "math.h"
|
||||
#include "powdergraphics.h"
|
||||
|
44
includes/gravity.h
Normal file
44
includes/gravity.h
Normal file
@@ -0,0 +1,44 @@
|
||||
#ifndef GRAVITY_H
|
||||
#define GRAVITY_H
|
||||
|
||||
#include "defines.h"
|
||||
|
||||
extern int ngrav_enable; //Newtonian gravity
|
||||
extern int gravwl_timeout;
|
||||
extern int gravityMode;
|
||||
|
||||
extern float gravmap[YRES/CELL][XRES/CELL]; //Maps to be used by the main thread
|
||||
extern float gravx[YRES/CELL][XRES/CELL];
|
||||
extern float gravy[YRES/CELL][XRES/CELL];
|
||||
extern float gravp[YRES/CELL][XRES/CELL];
|
||||
extern float *gravpf;
|
||||
extern float *gravxf;
|
||||
extern float *gravyf;
|
||||
extern unsigned gravmask[YRES/CELL][XRES/CELL];
|
||||
|
||||
extern float th_ogravmap[YRES/CELL][XRES/CELL]; // Maps to be processed by the gravity thread
|
||||
extern float th_gravmap[YRES/CELL][XRES/CELL];
|
||||
extern float th_gravx[YRES/CELL][XRES/CELL];
|
||||
extern float th_gravy[YRES/CELL][XRES/CELL];
|
||||
extern float *th_gravpf;
|
||||
extern float *th_gravxf;
|
||||
extern float *th_gravyf;
|
||||
extern float th_gravp[YRES/CELL][XRES/CELL];
|
||||
|
||||
void gravity_init();
|
||||
void gravity_cleanup();
|
||||
void gravity_update_async();
|
||||
|
||||
void start_grav_async();
|
||||
void stop_grav_async();
|
||||
void update_grav();
|
||||
void gravity_mask();
|
||||
|
||||
void bilinear_interpolation(float *src, float *dst, int sw, int sh, int rw, int rh);
|
||||
|
||||
#ifdef GRAVFFT
|
||||
void grav_fft_init();
|
||||
void grav_fft_cleanup();
|
||||
#endif
|
||||
|
||||
#endif
|
@@ -1051,15 +1051,12 @@ extern int portal_ry[8];
|
||||
|
||||
extern int wire_placed;
|
||||
|
||||
extern int gravwl_timeout;
|
||||
|
||||
extern playerst player;
|
||||
extern playerst player2;
|
||||
|
||||
extern playerst fighters[256];
|
||||
extern unsigned char fighcount;
|
||||
|
||||
extern int gravityMode;
|
||||
extern int airMode;
|
||||
|
||||
extern particle *parts;
|
||||
@@ -1137,6 +1134,4 @@ void orbitalparts_get(int block1, int block2, int resblock1[], int resblock2[]);
|
||||
|
||||
void orbitalparts_set(int *block1, int *block2, int resblock1[], int resblock2[]);
|
||||
|
||||
void gravity_mask();
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user