I’m surprised someone downvoted you. The game I’m most familiar with is Double Dragon, but I understand there ae multiple versions, right? Which one would be the best to check out?
Thanks for the tip! I’ve never really looked into the Genesis before.
I’m honestly really bad for lurking haha. I’m reading though. Observing. Watching you.
Welp, I feel stupid. The link to the channel is here.
Thanks. I can’t seem to correct it though, for some reason.
By the way, a good tip is to map the directional buttons to number keys, so you can access stuff in the inventory bar easier. I also map the triggers to the scroll wheel, but it’s super finnicky, so the directional buttons help a lot.
Thanks, there’s definitely a lot to consider. I hope my controller-complaining didn’t ruin anything for you. I’m glad that the video was still enjoyable.
Also, I’m glad to hear that you like variety in gameplay, as that’s what I try to bring to the table. All free culture stuff, though. I know it’s not everyone’s cup of tea. Thanks!
Thanks for the help! I’ll definitely start using -Wall. I don’t know why I don’t do it by default…
Wow that’s cool. I had no idea GCC did stuff like this.
Awesome, thank you so much!
How do you use fanalyzer? I’m passing it as a build option in GCC, assuming that it’ll alert me of any issues on either compile or runtime.
I tried -fsanitize=undefined
and -fsanitize=unreachable
with no luck. Are there other appropriate sanitizers I’m missing?
Only a file that doesn’t change between runs. I posted a copy of the full source code in a different post here in this thread. It’s been minimised down to 105 lines. Still can’t figure out where the bug is.
I’ll try your suggestion though, thank you!
Thanks for the suggestion! I managed to squish the program down into 105 lines. This is my MRE.
#include<stdlib.h>
#include<confuse.h>
struct entry
{
int Day;
long int Date;
float C;
float F;
float P;
float L;
};
int DiaryNum;
struct entry *Diary;
char DiaryPath[] = "/home/lofenyy/.config/Calorimeter/Diary";
cfg_opt_t entry_opts[] =
{
CFG_INT("Date", 0, CFGF_NONE),
CFG_INT("Day", 0, CFGF_NONE),
CFG_FLOAT("C", 0, CFGF_NONE),
CFG_FLOAT("F", 0, CFGF_NONE),
CFG_FLOAT("P", 0, CFGF_NONE),
CFG_FLOAT("L", 0, CFGF_NONE),
CFG_END()
};
cfg_opt_t entry_base_opts[] =
{
CFG_SEC("Entry", entry_opts, CFGF_MULTI),
CFG_END()
};
int lodEntry()
{
//Initialization
cfg_t *cfg;
cfg_t *cfg_entry;
cfg = cfg_init(entry_base_opts, CFGF_NONE);
//Open our file and check for errors
if(cfg_parse(cfg, DiaryPath) == CFG_PARSE_ERROR)
printf("Err!\n");
//Allocate enough memory for our internal diary
DiaryNum = cfg_size(cfg, "Entry");
Diary = malloc(DiaryNum * sizeof(struct entry));
//For every entry in our external diary
for(int C = 0;C < cfg_size(cfg, "Entry");C++)
{
//Copy our entries to our internal diary
cfg_entry = cfg_getnsec(cfg, "Entry", C);
Diary[C].Date = cfg_getint(cfg_entry, "Date");
Diary[C].Day = cfg_getint(cfg_entry, "Day");
Diary[C].C = cfg_getfloat(cfg_entry, "C");
Diary[C].F = cfg_getfloat(cfg_entry, "F");
Diary[C].P = cfg_getfloat(cfg_entry, "P");
Diary[C].L = cfg_getfloat(cfg_entry, "L");
}
cfg_free(cfg);
}
double getEntryCalories(int C)
{
//4 calories per carb and protein. 9 per lipid.
return 4*(Diary[C].C+Diary[C].P)+9*(Diary[C].L);
}
int prnStats()
{
float C,F,P,L,Calories = 0;
int day0 = Diary[0].Day;
int day1 = Diary[DiaryNum -1].Day;
int days = (day1 - day0) +1;
//For every diary entry
for(int i = 0;i < DiaryNum;i++)
{
//Count up our nutrients
C = C + Diary[i].C;
F = F + Diary[i].F;
P = P + Diary[i].P;
L = L + Diary[i].L;
Calories = Calories + getEntryCalories(i);
}
//Print them out
printf("Average Calories: %2.2f\n", (float)(Calories/days));
printf("Average Carbs: %2.2f\n", (float)(C/days));
printf("Average Fibre: %2.2f\n", (float)(F/days));
printf("Average Proteins: %2.2f\n", (float)(P/days));
printf("Average Lipids: %2.2f\n", (float)(L/days));
}
int main(int argc, char *argv[])
{
// Load our internal food diary from our external food diary
// print out our statistics
lodEntry();
prnStats();
}
This is the contents of Diary
Entry
{
Date = 1679542784
Day = 0
C = 6.000000
F = 5.000000
P = 4.000000
L = 3.000000
}
Entry
{
Date = 1679546112
Day = 0
C = 60.000000
F = 50.000000
P = 20.000000
L = 1.000000
}
Entry
{
Date = 1679547008
Day = 0
C = 4.000000
F = 4.000000
P = 4.000000
L = 4.000000
}
Entry
{
Date = 1679547136
Day = 1
C = 4.000000
F = 4.000000
P = 4.000000
L = 4.000000
}
Entry
{
Date = 1679547136
Day = 5
C = 60.000000
F = 50.000000
P = 20.000000
L = 1.000000
}
Is this likely the case if the program runs only in a single thread?
I love Pink Floyd, so I’ll likely do one of their songs haha.