#define SS_TRIAL_C
#include "ss_data.c"
#define FIXTM mtt(500)
#define BLTM mtt(500)
#define STM_SHORT mtt(100)
#define STM_LONG mtt(400)
#define MAXRT mtt(5000)
#define FBTM mtt(500)
#define ITI mtt(2000)
struct {
__int64 junk;
__int64 t1, e1;
__int64 t2, e2;
} rttmp;
void trial(int i)
{
__int64 stm;
if (data[i].stimdur == SHORTD)
stm = STM_SHORT;
else
stm = STM_LONG;
int spos;
if (data[i].stimpos == LEFT)
spos = -ax(.5);
else
spos = ax(.5);
int scol;
if (data[i].cword == CRED)
scol = RED;
else
scol = GREEN;
char stim[20];
if (data[i].mword == CRED)
sprintf(stim, "RED");
else
sprintf(stim, "GREEN");
int oldcol, oldfill;
oldcol = ts_fgcolor(WHITE);
ts_vsync(&rttmp.junk, &rttmp.junk);
oldfill = ts_fill(ON);
ts_circle(0, 0, 3);
ts_wait(FIXTM);
ts_vsync(&rttmp.junk, &rttmp.junk);
ts_clrscr();
ts_wait(BLTM);
ts_fgcolor(scol);
ts_vsync(&rttmp.t1, &rttmp.e1);
ts_printf_centre(spos, 0, stim);
data[i].r = ts_resp(&rttmp.t2, &rttmp.e2, stm);
ts_clrscr();
if (!data[i].r)
data[i].r = ts_resp(&rttmp.t2, &rttmp.e2, MAXRT - stm);
data[i].rt = ttm(rttmp.t2 - rttmp.t1);
data[i].re = ttm(rttmp.e2 + rttmp.e1);
if (data[i].r == 3) {
writedata();
ts_fatal("aborted by user");
}
if (data[i].r == data[i].xr)
data[i].corr = C;
else
data[i].corr = E;
if (data[i].corr == E) {
ts_fgcolor(WHITE);
ts_printf_centre(0, 0, "Wrong response!");
ts_wait(FBTM);
ts_clrscr();
}
ts_wait(ITI);
ts_fgcolor(oldcol);
ts_fill(oldfill);
}
#ifndef SS_EXP_C
int main()
{
randomize(0, 0);
ts_defkey(M1);
ts_defkey(M2);
ts_defkey(KEY_ESC);
int i;
for (i = 0; i < NTRIALS; i++)
trial(i);
writedata();
return 0;
}
END_OF_MAIN();
#endif