新增三个板块基本信息,暂未加入到主函数

This commit is contained in:
hinomori_minori
2026-09-12 10:58:54 +09:00
parent 8f1e8a775f
commit bf34acbcc4
2 changed files with 40 additions and 3 deletions
+6 -1
View File
@@ -6,7 +6,12 @@
enum {
PLATE_COUNT=1,
PLATE_JITTER_X,
PLATE_JITTER_Y
PLATE_JITTER_Y,
PLATE_PROP,
PLATE_IS_OCEAN,
PLATE_THICK,
PLATE_SPEED_X,
PLATE_SPEED_Y
};
uint64_t game_hash(uint64_t seed,int type,int subtype);
+34 -2
View File
@@ -9,8 +9,8 @@ static void plate_seed(struct Plate_list _i,uint64_t seed){
double cw = WORLD_W/G;
double ch = WORLD_H/G;
for(int i=0;i<_i.count;i++){
double jx = (double)game_hash(seed,PLATE_JITTER_X,i/G)/UINT64_MAX;
double jy = (double)game_hash(seed,PLATE_JITTER_Y,i%G)/UINT64_MAX;
double jx = (double)game_hash(seed,PLATE_JITTER_X,i)/UINT64_MAX;
double jy = (double)game_hash(seed,PLATE_JITTER_Y,i)/UINT64_MAX;
double x = (i%G +jx)*cw;
if(x>WORLD_W)x-=WORLD_W;
(_i._p+i)->seed.x = x;
@@ -77,6 +77,38 @@ static void lloyd_iterate(struct World_Block *_p,struct Plate_list _i,int _t){
return;
}
static void plate_is_ocean(struct Plate_list _i,uint64_t seed){
for(int i=0;i<_i.count;i++){
if((double)game_hash(seed,PLATE_IS_OCEAN,i)/UINT64_MAX>0.4){
(_i._p+i)->is_ocean = true;
}else{
(_i._p+i)->is_ocean = false;
}
}
}
static void plate_thick(struct Plate_list _i,uint64_t seed){
for(int i=0;i<_i.count;i++){
if((_i._p+i)->is_ocean){
(_i._p+i)->thick=5+(double)game_hash(seed,PLATE_THICK,i)/UINT64_MAX*5;
}else{
(_i._p+i)->thick=30+(double)game_hash(seed,PLATE_THICK,i)/UINT64_MAX*40;
}
}
}
static void plate_speed(struct Plate_list _i,uint64_t seed){
for(int i=0;i<_i.count;i++){
if((_i._p+i)->is_ocean){
(_i._p+i)->speed.x=1+(double)game_hash(seed,PLATE_SPEED_X,i)/UINT64_MAX*9;
(_i._p+i)->speed.y=1+(double)game_hash(seed,PLATE_SPEED_Y,i)/UINT64_MAX*9;
}else{
(_i._p+i)->speed.x=(double)game_hash(seed,PLATE_SPEED_X,i)/UINT64_MAX*5;
(_i._p+i)->speed.y=(double)game_hash(seed,PLATE_SPEED_Y,i)/UINT64_MAX*5;
}
}
}
struct Plate_list plate_init(uint64_t seed,struct World_Block *block){
int count = plate_count(seed);
struct Plate_list list;