反魂蝶八分咲きをつくろうの章で
for(j=0;j<2;j++){ for(i=0;i<num;i++){ int plmn=(j ? -1 : 1);という部分がありますが、
これはint型で宣言した文字列plmnにどのような値を代入することになるのですか?
(j ? -1 : 1)この部分はどのような意味を持つのですか?

横からすみません。私も龍神録プログラミングの条件演算子でつっかかっていたので教えてください。
これはcshot.cpp内の一部を丸ごとコピーしたものなんですが、
これを条件演算子を一切使わずにプログラムを書くとしたらどうなるのでしょうか?
分かる方がいましたら教えてください。
#include "../include/GV.h"
int cshot0num[2] ={2,4};
int cshot0pos_x[4]={-10, 10,-30, 30};
int cshot0pos_y[4]={-30,-30,-10,-10};
#define OPTION_X 25
#define OPTION_Y 35
int option0num[2] ={2,4};
double option0ang[4] = {-PI/2,-PI/2,-PI/2-PI/4,-PI/2+PI/4};//オプションの発射角度(49)
//自機ショットの登録可能番号を返す
int search_cshot(){
for(int i=0;i<CSHOT_MAX;i++){
if(cshot.flag==0)
return i;
}
return -1;
}
//通常ショット登録
void ch0_shot_pattern(){
int k;
int n=cshot0num[ch.power<200?0:1];
for(int i=0;i<n;i++){
if((k=search_cshot())!=-1){
cshot[k].flag=1;
cshot[k].cnt=0;
cshot[k].angle=-PI/2;
cshot[k].spd=20;
cshot[k].x=ch.x+cshot0pos_x;
cshot[k].y=ch.y+cshot0pos_y;
cshot[k].power= (n<2 ? 20 : 12) +ch.power/100;//2筋なら20,4筋なら12(50)
cshot[k].knd=0;
cshot[k].img=img_cshot[0];//画像番号代入(49)
}
}
se_flag[2]=1;//発射音オン
if(ch.power>=100){
for(int i=0;i<(ch.power<300?2:4);i++){
if((k=search_cshot())!=-1){
cshot[k].flag=1;
cshot[k].cnt=0;
cshot[k].angle=option0ang;
cshot[k].spd=20;
cshot[k].x=option_bb[i%2].x;
cshot[k].y=option_bb[i%2].y;
cshot[k].power=10-7*(i/2);//マイナスにならないよう注意(50)
cshot[k].knd=1;
cshot[k].img=img_cshot[1];//画像番号代入(49)
}
}
}
}
//低速通常ショット登録
void ch1_shot_pattern(){
int k;
int n=cshot0num[ch.power<200?0:1];
for(int i=0;i<n;i++){
if((k=search_cshot())!=-1){
cshot[k].flag=1;
cshot[k].cnt=0;
cshot[k].angle=-PI/2;
cshot[k].spd=20;
cshot[k].x=ch.x+cshot0pos_x/3;//低速中なら位置を中心側へ
cshot[k].y=ch.y+cshot0pos_y/2;
cshot[k].power= (n<2 ? 20 : 12) +ch.power/100;//2筋なら20,4筋なら12(50)
cshot[k].knd=0;
cshot[k].img=img_cshot[0];//画像番号代入(49)
}
}
se_flag[2]=1;
if(ch.power>=100){
for(int i=0;i<(ch.power<300?2:4);i++){
if((k=search_cshot())!=-1){
cshot[k].flag=1;
cshot[k].cnt=0;
cshot[k].angle=option0ang;
cshot[k].spd=20;
cshot[k].x=option_bb[i%2].x;
cshot[k].y=option_bb[i%2].y;
cshot[k].power=10-7*(i/2);//マイナスにならないよう注意(50)
cshot[k].knd=1;
cshot[k].img=img_cshot[1];//画像番号代入(49)
}
}
}
}
//オプションのぼんぼん計算
void calc_option_bb(){
if(ch.power>=100){//パワー100以上ならオプションをつける
for(int i=0;i<2;i++){
if(CheckStatePad(configpad.slow)==0){//低速移動中じゃないなら
option_bb.x=ch.x+OPTION_X*(i==0 ? -1 : 1);
option_bb.y=ch.y+OPTION_Y+sin(PI2/150*option_bb.cnt)*20;
}
else{
option_bb[i].x=ch.x+OPTION_X/2*(i==0 ? -1 : 1);
option_bb[i].y=ch.y+OPTION_Y/2;
}
option_bb[i].cnt++;
}
if(option_bb[0].flag==0)
option_bb[0].flag = option_bb[1].flag = 1;
}
else{
if(option_bb[0].flag==1)
option_bb[0].flag = option_bb[1].flag = 0;
}
}
if(j==0) plmn=1; else plmn=-1;ということでいいのでしょうか?