<commit_before>#include "main.h"

char messages[TILEMAP_HEIGHT][TILEMAP_WIDTH];
int numMessages;
bool midDrop;
bool midUse;
bool midFire;
int fireIndex;

Entity game_null_entity()
{
  SpriteData nullSpriteData = NULL_SPRITEDATA;
  Point nullPoint = NULL_POINT;
  Item nullItem = NULL_ITEM;

  Entity out;
  out.active = false;
  out.sprite = nullSpriteData;
  out.frame = nullPoint;
  out.pos = nullPoint;
  out.turn = INT_MAX;
  out.player = false;
  out.speed = 100;
  out.o2 = 100;
  out.maxo2 = 100;
  out.o2timer = 0;
  out.strength = 4;
  out.name = NULL;
  out.flags = EF_SENTIENT;
  out.lastKnownPlayerPos = nullPoint;
  out.hunting = false;
  out.scared = false;
  out.xp = 1;
  out.level = 0;
  out.blindTimer = 0;

  int i;
  for(i=0; i<MAX_INVENTORY; i++)
    out.inventory[i] = nullItem;
  return out;
}

FathomData game_null_fathomdata()
{
  FathomData out;
  int i;
  Entity nullEntity = NULL_ENTITY;
  for(i=0; i<MAX_ENTITIES; i++)
    out.entities[i] = nullEntity;

  Item nullItem = NULL_ITEM;
  for(i=0; i<MAX_ITEMS; i++)
    out.items[i] = nullItem;

  out.tileMap = tilemap_generate();
  return out;
}

void game_reset_gamedata(GameData* game)
{
  game->current = 0;

  item_shuffleTypes((int*)game->charmTypes, CHARM_MAX);
  item_shuffleTypes((int*)game->conchTypes, CONCH_MAX);

  int i;
  for(i=0; i<MAX_FATHOMS; i++)
  {
    int j;
    game->fathoms[i] = game_null_fathomdata();
    feature_process(game, &game->fathoms[i], i);
    int threat = 4+i*2;
    while(threat > 0)
    {
      int type = ET_MAX_ENEMY;
      while(type >= ET_MAX_ENEMY)
      {
        type = 0;
        for(j=0; j<i/2+3; j++)
          type += sys_randint(2);
      }
      Entity e = spawn_entity(type);
      if(e.flags & EF_TOOLED)
      {
        Item i = spawn_item(game, sys_randint(IT_MAX));
        i.active = true;
        if(i.type == IT_CHARM)
          i.worn = true;
        if(i.type != IT_CONCH || i.conchSubtype != CONCH_DEATH) // death isn't fair
          e.inventory[0] = i;
      }
      game_spawn(&game->fathoms[i], e);
      threat -= type+1;
    }    
    for(j=0; j<(MAX_FATHOMS-i)/4+4; j++)
      game_spawn(&game->fathoms[i], spawn_entity(ET_BUBBLE));
    int numSpawns;
    numSpawns = sys_randint(3);
    for(j=0; j<numSpawns; j++)
      game_place(&game->fathoms[i], spawn_item(game, IT_CONCH));
    numSpawns = sys_randint(2);
    for(j=0; j<numSpawns; j++)
      game_place(&game->fathoms[i], spawn_item(game, IT_CHARM));
  }
  game_spawn(&game->fathoms[0], spawn_entity(ET_SCUBA));    

  // this isn't quite the right place for this stuff anymore
  numMessages = 0;
  game_addGlobalMessage("Welcome to Sunk Coast.");
  midDrop = false;<commit_msg>Increased danger<commit_after>#include "main.h"

char messages[TILEMAP_HEIGHT][TILEMAP_WIDTH];
int numMessages;
bool midDrop;
bool midUse;
bool midFire;
int fireIndex;

Entity game_null_entity()
{
  SpriteData nullSpriteData = NULL_SPRITEDATA;
  Point nullPoint = NULL_POINT;
  Item nullItem = NULL_ITEM;

  Entity out;
  out.active = false;
  out.sprite = nullSpriteData;
  out.frame = nullPoint;
  out.pos = nullPoint;
  out.turn = INT_MAX;
  out.player = false;
  out.speed = 100;
  out.o2 = 100;
  out.maxo2 = 100;
  out.o2timer = 0;
  out.strength = 4;
  out.name = NULL;
  out.flags = EF_SENTIENT;
  out.lastKnownPlayerPos = nullPoint;
  out.hunting = false;
  out.scared = false;
  out.xp = 1;
  out.level = 0;
  out.blindTimer = 0;

  int i;
  for(i=0; i<MAX_INVENTORY; i++)
    out.inventory[i] = nullItem;
  return out;
}

FathomData game_null_fathomdata()
{
  FathomData out;
  int i;
  Entity nullEntity = NULL_ENTITY;
  for(i=0; i<MAX_ENTITIES; i++)
    out.entities[i] = nullEntity;

  Item nullItem = NULL_ITEM;
  for(i=0; i<MAX_ITEMS; i++)
    out.items[i] = nullItem;

  out.tileMap = tilemap_generate();
  return out;
}

void game_reset_gamedata(GameData* game)
{
  game->current = 0;

  item_shuffleTypes((int*)game->charmTypes, CHARM_MAX);
  item_shuffleTypes((int*)game->conchTypes, CONCH_MAX);

  int i;
  for(i=0; i<MAX_FATHOMS; i++)
  {
    int j;
    game->fathoms[i] = game_null_fathomdata();
    feature_process(game, &game->fathoms[i], i);
    int threat = 4+i*3;
    while(threat > 0)
    {
      int type = ET_MAX_ENEMY;
      while(type >= ET_MAX_ENEMY)
      {
        type = 0;
        for(j=0; j<i/2+5; j++)
          type += sys_randint(2);
      }
      Entity e = spawn_entity(type);
      if(e.flags & EF_TOOLED)
      {
        Item i = spawn_item(game, sys_randint(IT_MAX));
        i.active = true;
        if(i.type == IT_CHARM)
          i.worn = true;
        if(i.type != IT_CONCH || i.conchSubtype != CONCH_DEATH) // death isn't fair
          e.inventory[0] = i;
      }
      game_spawn(&game->fathoms[i], e);
      threat -= type+1;
    }    
    for(j=0; j<(MAX_FATHOMS-i)/4+4; j++)
      game_spawn(&game->fathoms[i], spawn_entity(ET_BUBBLE));
    int numSpawns;
    numSpawns = sys_randint(3);
    for(j=0; j<numSpawns; j++)
      game_place(&game->fathoms[i], spawn_item(game, IT_CONCH));
    numSpawns = sys_randint(2);
    for(j=0; j<numSpawns; j++)
      game_place(&game->fathoms[i], spawn_item(game, IT_CHARM));
  }
  game_spawn(&game->fathoms[0], spawn_entity(ET_SCUBA));    

  // this isn't quite the right place for this stuff anymore
  numMessages = 0;
  game_addGlobalMessage("Welcome to Sunk Coast.");
  midDrop = false;
{'fraction_non_alphanumeric': 0.14458729271473822, 'fraction_numerical': 0.015278554127072852, 'mean_word_length': 3.091463414634146, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '58781', 'n_tokens_mistral': 2240, 'n_tokens_neox': 2169, 'n_words': 418}